blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
sequence | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
sequence | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
90290ffa15b7283cfc92837b9f8fc0f5450eb303 | 14,851,996,911,252 | 56981b70470b8e4ade1cd2e4e6a36c0aa141da3f | /src/com/xiong/pattern/single/SingleTon.java | 1a8077ce1615426f6e58ff3212b2952ad01d3cbd | [] | no_license | havenBoy/Design-Pattern | https://github.com/havenBoy/Design-Pattern | fe3f5d82128c37d7bfc05d5e45e5e20fcdd2c17a | fb4ee03c40595665566e37fc09ffb172c5edc0dc | refs/heads/master | 2020-03-11T00:43:58.696000 | 2018-10-19T02:31:33 | 2018-10-19T02:31:33 | 129,670,867 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xiong.pattern.single;
/***
* 单例模式的不同实现
* 因程序需要,有时我们只需要某个类同时保留一个对象,不希望有更多对象,此时,我们则应考虑单例模式的设计。
*/
public class SingleTon {
/***
* 私有构造函数,避免类外的调用
*/
private SingleTon () {}
/** 懒汉模式,当真正需要的时候才回去创建实例,但没有考虑到多线程的问题,
* 可以考虑在获取的方法上添加同步的关键字,但同时效率比较低
* private static SingleTon singleTon;
public static synchronized SingleTon getInstance() {
if (singleTon == null) {
singleTon = new SingleTon();
}
return singleTon;
}
*/
/** 饿汗模式,在类加载时创建一个对象,
* private static SingleTon singleTon = new SingleTon();
public static SingleTon getInstance() {
return singleTon;
}*/
/**
* 双重的校验锁法
* 线程安全,并且实现了懒加载
*/
private volatile static SingleTon singleTon;
public static SingleTon getInstance() {
if (singleTon == null) synchronized (SingleTon.class) {
if (singleTon == null) {
singleTon = new SingleTon();
}
}
return singleTon;
}
}
| UTF-8 | Java | 1,241 | java | SingleTon.java | Java | [] | null | [] | package com.xiong.pattern.single;
/***
* 单例模式的不同实现
* 因程序需要,有时我们只需要某个类同时保留一个对象,不希望有更多对象,此时,我们则应考虑单例模式的设计。
*/
public class SingleTon {
/***
* 私有构造函数,避免类外的调用
*/
private SingleTon () {}
/** 懒汉模式,当真正需要的时候才回去创建实例,但没有考虑到多线程的问题,
* 可以考虑在获取的方法上添加同步的关键字,但同时效率比较低
* private static SingleTon singleTon;
public static synchronized SingleTon getInstance() {
if (singleTon == null) {
singleTon = new SingleTon();
}
return singleTon;
}
*/
/** 饿汗模式,在类加载时创建一个对象,
* private static SingleTon singleTon = new SingleTon();
public static SingleTon getInstance() {
return singleTon;
}*/
/**
* 双重的校验锁法
* 线程安全,并且实现了懒加载
*/
private volatile static SingleTon singleTon;
public static SingleTon getInstance() {
if (singleTon == null) synchronized (SingleTon.class) {
if (singleTon == null) {
singleTon = new SingleTon();
}
}
return singleTon;
}
}
| 1,241 | 0.673743 | 0.673743 | 48 | 17.645834 | 17.628681 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25 | false | false | 13 |
0c4f1d40c646b673bfd02de0289c357501e64c9f | 20,572,893,352,186 | c099ff1dc9c6fa5e9c14a73c3be269ffff585c8b | /src/main/java/cn/banny/wx4j/UUIDException.java | 380bfb673c4d36abd760749a8f39bf9e2c81dda5 | [] | no_license | zhkl0228/wx4j | https://github.com/zhkl0228/wx4j | 2b6fb2938fa9159c5c6e6e06802f2a8964a38152 | fc06b7acd8c63702cdbd45e04dd3318467c35557 | refs/heads/master | 2020-02-17T10:28:26.500000 | 2018-03-12T04:06:05 | 2018-03-12T04:06:05 | 124,830,527 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.banny.wx4j;
/**
* 生成uuid异常
*/
public class UUIDException extends Exception {
private final int code;
public UUIDException(int code, String error) {
super(error);
this.code = code;
}
public int getCode() {
return code;
}
}
| UTF-8 | Java | 291 | java | UUIDException.java | Java | [] | null | [] | package cn.banny.wx4j;
/**
* 生成uuid异常
*/
public class UUIDException extends Exception {
private final int code;
public UUIDException(int code, String error) {
super(error);
this.code = code;
}
public int getCode() {
return code;
}
}
| 291 | 0.600707 | 0.597173 | 18 | 14.722222 | 15.383272 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 13 |
873cf62d073842a859c1584929335c6796cda214 | 6,365,141,561,390 | 2895bec023282a59e520e2de042e42f57561f2f8 | /app/src/main/java/com/example/notesapplication/MainActivity.java | 7a7c8b65e3900cb724a3611af0967c3ba0ed23c9 | [] | no_license | HannaTuominen/notesapplication | https://github.com/HannaTuominen/notesapplication | 75bf77345e2f5633f8a2e03148534ec570e4983f | 269071c7455caad0fa73a922482b3e6e504d55d1 | refs/heads/master | 2020-12-06T19:58:45.015000 | 2020-01-08T10:38:18 | 2020-01-08T10:38:18 | 232,539,410 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.notesapplication;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.Date;
public class MainActivity extends AppCompatActivity {
private SharedPreferences mPreferences;
private SharedPreferences.Editor mEditor;
ListView notesListView;
//LIST OF ARRAY STRINGS WHICH WILL SERVE AS LIST ITEMS
ArrayList<String> listItems=new ArrayList<String>();
ArrayList<String> noteInfo = new ArrayList<>();
ArrayList<Date> timeInfo = new ArrayList<>();
private ListView list;
int maxID = -1;
int id = 0;
int loadID = 0;
String finishedSaveNote = "note" + id;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Resources res = getResources();
notesListView = (ListView) findViewById(R.id.NotesListView);
//notes = res.getStringArray(R.array.notes);
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mEditor = mPreferences.edit();
checkSharedPreferences();
if(mPreferences.getBoolean("deleting",false) == true) {
deletingItems();
mEditor.putBoolean("deleting",false);
mEditor.commit();
}else {
loadArrayListItems();
}
CustomAdapter adapter = new CustomAdapter(MainActivity.this,noteInfo,listItems,timeInfo);
//list = (ListView) findViewById(R.id.NotesListView);
// adapter=new ArrayAdapter<String>(this,
// android.R.layout.simple_list_item_1,
// listItems);
notesListView.setAdapter(adapter);
maxID = mPreferences.getInt("maxID",0);
notesListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent showDetailActivity = new Intent(getApplicationContext(),DetailActivity.class);
showDetailActivity.putExtra("com.example.notesapplication.ITEM_INDEX", position);
startActivity(showDetailActivity);
}
});
Button addNoteBtn = (Button) findViewById(R.id.addNoteBtn);
addNoteBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startIntent = new Intent(getApplicationContext(), AddNoteBtn.class);
//startIntent.putExtra("com.example.notesapplication.SOMETHING","HELLO WORLD!");
startActivity(startIntent);
}
});
}
public void loadArrayListItems() {
String shortenedMessage ="";
if(maxID> 0) {
while(loadID < maxID) {
for(int i = 0; i <mPreferences.getString(finishedSaveNote,"").length(); i++) {
if(i >80 && i <84) {
shortenedMessage = shortenedMessage + '.';
} else if (i >= 84) {
break;
} else {
shortenedMessage = shortenedMessage + mPreferences.getString(finishedSaveNote,"").charAt(i);
}
}
Long time = mPreferences.getLong("noteDate"+loadID, 0L);
Date theDate = new Date(time);
noteInfo.add("Note "+ (loadID+1));
listItems.add(shortenedMessage);
timeInfo.add(theDate);
loadID++;
finishedSaveNote = "note"+loadID;
shortenedMessage="";
}
}
loadID = 0;
}
//
private void checkSharedPreferences() {
maxID = mPreferences.getInt("maxID",0);
}
public void deletingItems() {
Intent in = getIntent();
int deleteIndex = in.getIntExtra("com.example.notesapplication.INDEX_ID_DETAIL_ACTIVITY",0);
int deleteIndexChanging = deleteIndex+1;
String movingString = "";
String finishedSaveNote = "";
String finishedSaveNoteMoved = "";
Long movingLong;
String finishedDateNote = "";
String finishedDateNoteMoved = "";
for(int i = deleteIndex; i < maxID; i++){
finishedSaveNote = "note" + i;
finishedSaveNoteMoved = "note" + deleteIndexChanging;
movingString = mPreferences.getString(finishedSaveNoteMoved,"");
finishedDateNote = "noteDate" + i;
finishedDateNoteMoved = "noteDate"+ deleteIndexChanging;
movingLong = mPreferences.getLong(finishedDateNoteMoved,0L);
mEditor.putLong(finishedDateNote,movingLong);
mEditor.putString(finishedSaveNote,movingString);
deleteIndexChanging++;
mEditor.putBoolean("deleting",true);
mEditor.commit();
}
String removeNote = "note" + (maxID-1);
String removeDate = "noteDate" + (maxID-1);
mEditor.remove(removeDate);
mEditor.remove(removeNote);
maxID--;
mEditor.putInt("maxID",maxID);
mEditor.commit();
loadArrayListItems();
}
} | UTF-8 | Java | 5,496 | java | MainActivity.java | Java | [] | null | [] | package com.example.notesapplication;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.Date;
public class MainActivity extends AppCompatActivity {
private SharedPreferences mPreferences;
private SharedPreferences.Editor mEditor;
ListView notesListView;
//LIST OF ARRAY STRINGS WHICH WILL SERVE AS LIST ITEMS
ArrayList<String> listItems=new ArrayList<String>();
ArrayList<String> noteInfo = new ArrayList<>();
ArrayList<Date> timeInfo = new ArrayList<>();
private ListView list;
int maxID = -1;
int id = 0;
int loadID = 0;
String finishedSaveNote = "note" + id;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Resources res = getResources();
notesListView = (ListView) findViewById(R.id.NotesListView);
//notes = res.getStringArray(R.array.notes);
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mEditor = mPreferences.edit();
checkSharedPreferences();
if(mPreferences.getBoolean("deleting",false) == true) {
deletingItems();
mEditor.putBoolean("deleting",false);
mEditor.commit();
}else {
loadArrayListItems();
}
CustomAdapter adapter = new CustomAdapter(MainActivity.this,noteInfo,listItems,timeInfo);
//list = (ListView) findViewById(R.id.NotesListView);
// adapter=new ArrayAdapter<String>(this,
// android.R.layout.simple_list_item_1,
// listItems);
notesListView.setAdapter(adapter);
maxID = mPreferences.getInt("maxID",0);
notesListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent showDetailActivity = new Intent(getApplicationContext(),DetailActivity.class);
showDetailActivity.putExtra("com.example.notesapplication.ITEM_INDEX", position);
startActivity(showDetailActivity);
}
});
Button addNoteBtn = (Button) findViewById(R.id.addNoteBtn);
addNoteBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startIntent = new Intent(getApplicationContext(), AddNoteBtn.class);
//startIntent.putExtra("com.example.notesapplication.SOMETHING","HELLO WORLD!");
startActivity(startIntent);
}
});
}
public void loadArrayListItems() {
String shortenedMessage ="";
if(maxID> 0) {
while(loadID < maxID) {
for(int i = 0; i <mPreferences.getString(finishedSaveNote,"").length(); i++) {
if(i >80 && i <84) {
shortenedMessage = shortenedMessage + '.';
} else if (i >= 84) {
break;
} else {
shortenedMessage = shortenedMessage + mPreferences.getString(finishedSaveNote,"").charAt(i);
}
}
Long time = mPreferences.getLong("noteDate"+loadID, 0L);
Date theDate = new Date(time);
noteInfo.add("Note "+ (loadID+1));
listItems.add(shortenedMessage);
timeInfo.add(theDate);
loadID++;
finishedSaveNote = "note"+loadID;
shortenedMessage="";
}
}
loadID = 0;
}
//
private void checkSharedPreferences() {
maxID = mPreferences.getInt("maxID",0);
}
public void deletingItems() {
Intent in = getIntent();
int deleteIndex = in.getIntExtra("com.example.notesapplication.INDEX_ID_DETAIL_ACTIVITY",0);
int deleteIndexChanging = deleteIndex+1;
String movingString = "";
String finishedSaveNote = "";
String finishedSaveNoteMoved = "";
Long movingLong;
String finishedDateNote = "";
String finishedDateNoteMoved = "";
for(int i = deleteIndex; i < maxID; i++){
finishedSaveNote = "note" + i;
finishedSaveNoteMoved = "note" + deleteIndexChanging;
movingString = mPreferences.getString(finishedSaveNoteMoved,"");
finishedDateNote = "noteDate" + i;
finishedDateNoteMoved = "noteDate"+ deleteIndexChanging;
movingLong = mPreferences.getLong(finishedDateNoteMoved,0L);
mEditor.putLong(finishedDateNote,movingLong);
mEditor.putString(finishedSaveNote,movingString);
deleteIndexChanging++;
mEditor.putBoolean("deleting",true);
mEditor.commit();
}
String removeNote = "note" + (maxID-1);
String removeDate = "noteDate" + (maxID-1);
mEditor.remove(removeDate);
mEditor.remove(removeNote);
maxID--;
mEditor.putInt("maxID",maxID);
mEditor.commit();
loadArrayListItems();
}
} | 5,496 | 0.610626 | 0.606441 | 153 | 34.928104 | 26.123915 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.79085 | false | false | 13 |
fa05be45cd4903059bfdcca8ac7ca6fc23f3fe44 | 6,365,141,563,509 | 52017997a5c5372148cf8b01253e404be25204ef | /app/src/main/java/com/easy/make/tenantmaker/base/Gallery/view/AddPicsAdapter.java | f9fe1c4fa33c7f1e426bb7a97bd089105421b52f | [] | no_license | AndroidKiran/TenantMaker | https://github.com/AndroidKiran/TenantMaker | 26e5474b1507cf946fe5dddfeb670593948a7e9f | 29d18b7da9bc2607191a0881d68adad740993d05 | refs/heads/master | 2020-12-25T14:32:43.306000 | 2016-12-14T07:26:49 | 2016-12-14T07:26:49 | 67,667,989 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.easy.make.tenantmaker.base.Gallery.view;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.easy.make.tenantmaker.R;
import com.easy.make.tenantmaker.core.gallery.displayer.AddPicsDisplayer;
import com.easy.make.tenantmaker.core.gallery.model.GalleryPic;
import com.easy.make.tenantmaker.core.gallery.model.GalleryPics;
import java.util.ArrayList;
/**
* Created by ravi on 14/10/16.
*/
public class AddPicsAdapter extends RecyclerView.Adapter<AddPicViewHolder> {
private final LayoutInflater inflater;
private GalleryPics galleryPics;
private AddPicItemView addPicItemView;
private AddPicsDisplayer.AddPicInteractionListener addPicInteractionListener;
public AddPicsAdapter(LayoutInflater inflater) {
this.inflater = inflater;
galleryPics = new GalleryPics(new ArrayList<GalleryPic>());
setHasStableIds(true);
}
public void setData(GalleryPics galleryPics){
this.galleryPics = galleryPics;
notifyItemRangeInserted(getItemCount(), galleryPics.size());
}
@Override
public AddPicViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
addPicItemView = (AddPicItemView) inflater.inflate(R.layout.add_pic_item_layout, parent, false);
return new AddPicViewHolder(addPicItemView);
}
@Override
public void onBindViewHolder(AddPicViewHolder holder, int position) {
holder.bind(galleryPics.get(position), addListener);
}
@Override
public int getItemCount() {
return galleryPics.size();
}
public void attach(AddPicsDisplayer.AddPicInteractionListener addPicInteractionListener) {
this.addPicInteractionListener = addPicInteractionListener;
}
public void detach(AddPicsDisplayer.AddPicInteractionListener addPicInteractionListener) {
this.addPicInteractionListener = null;
}
AddPicViewHolder.AddListener addListener = new AddPicViewHolder.AddListener() {
@Override
public void onPicSelected(GalleryPic galleryPic) {
addPicInteractionListener.onPicSelected(galleryPic);
}
};
}
| UTF-8 | Java | 2,185 | java | AddPicsAdapter.java | Java | [
{
"context": "s;\n\nimport java.util.ArrayList;\n\n/**\n * Created by ravi on 14/10/16.\n */\n\npublic class AddPicsAdapter ext",
"end": 460,
"score": 0.9988685846328735,
"start": 456,
"tag": "USERNAME",
"value": "ravi"
}
] | null | [] | package com.easy.make.tenantmaker.base.Gallery.view;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.easy.make.tenantmaker.R;
import com.easy.make.tenantmaker.core.gallery.displayer.AddPicsDisplayer;
import com.easy.make.tenantmaker.core.gallery.model.GalleryPic;
import com.easy.make.tenantmaker.core.gallery.model.GalleryPics;
import java.util.ArrayList;
/**
* Created by ravi on 14/10/16.
*/
public class AddPicsAdapter extends RecyclerView.Adapter<AddPicViewHolder> {
private final LayoutInflater inflater;
private GalleryPics galleryPics;
private AddPicItemView addPicItemView;
private AddPicsDisplayer.AddPicInteractionListener addPicInteractionListener;
public AddPicsAdapter(LayoutInflater inflater) {
this.inflater = inflater;
galleryPics = new GalleryPics(new ArrayList<GalleryPic>());
setHasStableIds(true);
}
public void setData(GalleryPics galleryPics){
this.galleryPics = galleryPics;
notifyItemRangeInserted(getItemCount(), galleryPics.size());
}
@Override
public AddPicViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
addPicItemView = (AddPicItemView) inflater.inflate(R.layout.add_pic_item_layout, parent, false);
return new AddPicViewHolder(addPicItemView);
}
@Override
public void onBindViewHolder(AddPicViewHolder holder, int position) {
holder.bind(galleryPics.get(position), addListener);
}
@Override
public int getItemCount() {
return galleryPics.size();
}
public void attach(AddPicsDisplayer.AddPicInteractionListener addPicInteractionListener) {
this.addPicInteractionListener = addPicInteractionListener;
}
public void detach(AddPicsDisplayer.AddPicInteractionListener addPicInteractionListener) {
this.addPicInteractionListener = null;
}
AddPicViewHolder.AddListener addListener = new AddPicViewHolder.AddListener() {
@Override
public void onPicSelected(GalleryPic galleryPic) {
addPicInteractionListener.onPicSelected(galleryPic);
}
};
}
| 2,185 | 0.748741 | 0.745538 | 67 | 31.61194 | 30.277304 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.477612 | false | false | 13 |
208884a65afc7a5a28dab8e10655be8b9916b5b8 | 26,182,120,639,026 | b5c72ad0ce8565b32b1f90382428c3ef1514d8b0 | /src/main/java/com/kamilkurp/creatures/Creature.java | 54f372520eae49f9e9b7e2e15849d1f29aecbc2a | [] | no_license | EasternSauce/slickgame | https://github.com/EasternSauce/slickgame | 50e61df9d66a85cc79e2dc350ce0bc3d36346408 | a11dcbedf0410a1158df725d95e62f16106214d5 | refs/heads/master | 2023-02-15T07:37:39.694000 | 2021-01-07T23:30:35 | 2021-01-07T23:30:35 | 272,548,617 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kamilkurp.creatures;
import com.kamilkurp.Globals;
import com.kamilkurp.KeyInput;
import com.kamilkurp.abilities.*;
import com.kamilkurp.animations.WalkAnimation;
import com.kamilkurp.areagate.AreaGate;
import com.kamilkurp.assets.Assets;
import com.kamilkurp.effect.Effect;
import com.kamilkurp.items.Item;
import com.kamilkurp.items.ItemType;
import com.kamilkurp.spawn.Blockade;
import com.kamilkurp.systems.GameSystem;
import com.kamilkurp.terrain.Area;
import com.kamilkurp.terrain.TerrainTile;
import com.kamilkurp.utils.Camera;
import com.kamilkurp.utils.Rect;
import com.kamilkurp.utils.Timer;
import org.newdawn.slick.*;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.geom.Vector2f;
import java.util.*;
public abstract class Creature {
protected Rectangle rect;
protected Rectangle hitbox;
protected String id;
protected boolean running = false;
protected int direction = 0;
protected Timer runningTimer;
protected boolean moving;
protected int totalDirections;
protected int dirX;
protected int dirY;
protected float speed = 0f;
protected float maxHealthPoints = 100f;
protected float healthPoints = maxHealthPoints;
protected float maxStaminaPoints = 100f;
protected float staminaPoints = maxStaminaPoints;
protected Vector2f facingVector;
protected Vector2f attackingVector;
protected WalkAnimation walkAnimation;
protected Map<Integer, Item> equipmentItems;
protected float healthRegen = 0.3f;
protected float staminaRegen = 10f;
protected Timer healthRegenTimer;
protected Timer staminaRegenTimer;
protected Timer poisonTickTimer;
protected Area area;
protected boolean passedGateRecently = false;
protected Area pendingArea;
protected boolean toBeRemoved;
protected Float pendingX;
protected Float pendingY;
protected GameSystem gameSystem;
protected List<Ability> abilityList;
protected List<Attack> attackList;
protected Attack currentAttack;
protected BowAttack bowAttack;
protected UnarmedAttack unarmedAttack;
protected SwordAttack swordAttack;
protected TridentAttack tridentAttack;
protected float unarmedDamage;
protected boolean sprinting;
protected Timer staminaOveruseTimer;
protected int staminaOveruseTime = 1300;
protected boolean staminaOveruse;
protected int poisonTickTime = 1500;
protected int poisonTime = 20000;
protected float knockbackPower;
private Timer healingTimer;
private Timer healingTickTimer;
private boolean healing;
protected int healingTickTime = 300;
protected int healingTime = 8000;
private float healingPower;
protected boolean knockback = false;
protected Timer knockbackTimer;
protected Vector2f knockbackVector;
protected float knockbackSpeed;
protected Vector2f movementVector;
protected float startingPosX;
protected float startingPosY;
protected float scale;
protected boolean isAttacking;
protected String name;
protected boolean knocbackable;
protected boolean isBoss;
protected Map<String, Float> dropTable;
protected Sound onGettingHitSound;
protected float baseSpeed;
protected String creatureType;
protected Map<String, Effect> effectMap;
public Creature(GameSystem gameSystem, String id) {
this.gameSystem = gameSystem;
this.id = id;
rect = new Rectangle(0, 0, 64, 64);
hitbox = new Rectangle(2, 2, 60, 60);
walkAnimation = new WalkAnimation(Assets.male1SpriteSheet, 3, 100, new int[]{3, 1, 0, 2}, 1);
runningTimer = new Timer();
healthRegenTimer = new Timer();
staminaRegenTimer = new Timer();
knockbackTimer = new Timer();
staminaRegenTimer.start();
healthRegenTimer.start();
facingVector = new Vector2f(0f, 0f);
equipmentItems = new TreeMap<>();
abilityList = new LinkedList<>();
toBeRemoved = false;
pendingX = 0.0f;
pendingY = 0.0f;
unarmedDamage = 15f;
sprinting = false;
staminaOveruseTimer = new Timer();
staminaOveruse = false;
attackingVector = new Vector2f(0f, 0f);
healingTimer = new Timer(true);
healingTickTimer = new Timer(true);
poisonTickTimer = new Timer(true);
healing = false;
healingPower = 0f;
knockbackPower = 0f;
movementVector = new Vector2f(0f,0f);
scale = 1.0f;
knocbackable = true;
isBoss = false;
dropTable = new HashMap<>();
onGettingHitSound = Assets.painSound;
baseSpeed = 0.2f;
effectMap = new HashMap<>();
effectMap.put("immune", new Effect(this));
effectMap.put("immobilized", new Effect(this));
effectMap.put("staminaRegenStopped", new Effect(this));
effectMap.put("poisoned", new Effect(this));
}
public void defineStandardAbilities() {
abilityList = new LinkedList<>();
attackList = new LinkedList<>();
bowAttack = BowAttack.newInstance(this);
unarmedAttack = UnarmedAttack.newInstance(this);
swordAttack = SwordAttack.newInstance(this);
tridentAttack = TridentAttack.newInstance(this);
attackList.add(bowAttack);
attackList.add(unarmedAttack);
attackList.add(swordAttack);
attackList.add(tridentAttack);
currentAttack = unarmedAttack;
}
public void onInit() {
defineStandardAbilities();
defineCustomAbilities();
updateAttackType();
}
protected void defineCustomAbilities() {
}
public void render(Graphics g, Camera camera) {
Image sprite = walkAnimation.getRestPosition(direction);
if (Globals.SHOW_HITBOXES) {
g.setColor(Color.pink);
g.fillRect(rect.getX() - camera.getPosX(), rect.getY() - camera.getPosY(), rect.getWidth(), rect.getHeight());
}
if (!running) {
if (!isAlive()) {
sprite.rotate(90f);
}
sprite.draw(rect.getX() - camera.getPosX(), rect.getY() - camera.getPosY(), rect.getWidth(), rect.getHeight());
if (isAlive() && isImmune() && (effectMap.get("immune").getRemainingTime() % 250) < 125) {
sprite.draw(rect.getX() - camera.getPosX(), rect.getY() - camera.getPosY(), rect.getWidth(), rect.getHeight(), Color.red);
}
else {
sprite.draw(rect.getX() - camera.getPosX(), rect.getY() - camera.getPosY(), rect.getWidth(), rect.getHeight());
}
} else {
if (isAlive() && isImmune() && (effectMap.get("immune").getRemainingTime() % 250) < 125) {
walkAnimation.getAnimation(direction).draw((int) rect.getX() - (int) camera.getPosX(), (int) rect.getY() - (int) camera.getPosY(), rect.getWidth(), rect.getHeight(), Color.red);
}
else {
walkAnimation.getAnimation(direction).draw((int) rect.getX() - (int) camera.getPosX(), (int) rect.getY() - (int) camera.getPosY(), rect.getWidth(), rect.getHeight());
}
}
Assets.verdanaTtf.drawString((int) rect.getX() - (int) camera.getPosX(), (int) rect.getY() - (int) camera.getPosY() - 30f, (int) Math.ceil(healthPoints) + "/" + (int) Math.ceil(getMaxHealthPoints()), Color.red);
}
public void renderAbilities(Graphics g, Camera camera) {
for (Ability ability : abilityList) {
ability.render(g, camera);
}
currentAttack.render(g, camera);
}
public void update(GameContainer gc, int i, KeyInput keyInput, GameSystem gameSystem) {
walkAnimation.getAnimation(direction).update(i);
if (isAlive()) {
onUpdateStart(i);
for (Ability ability : abilityList) {
ability.performOnUpdateStart(i);
}
currentAttack.performOnUpdateStart(i);
performActions(gc, keyInput);
executeMovementLogic();
setFacingDirection(gc);
regenerate();
}
for (Effect effect : effectMap.values()) {
effect.update();
}
for (Ability ability : abilityList) {
ability.update(i);
}
currentAttack.update(i);
}
public void onPassedGate(List<AreaGate> gatesList) {
boolean leftGate = true;
for (AreaGate areaGate : gatesList) {
if (areaGate.getAreaFrom() == area) {
if (rect.intersects(areaGate.getFromRect())) {
leftGate = false;
break;
}
}
if (areaGate.getAreaTo() == area) {
if (rect.intersects(areaGate.getToRect())) {
leftGate = false;
break;
}
}
}
passedGateRecently = !leftGate;
}
public void regenerate() {
if (healthRegenTimer.getElapsed() > 500f) {
heal(healthRegen);
healthRegenTimer.reset();
}
if (!isEffectActive("staminaRegenStopped") && !sprinting) {
if (staminaRegenTimer.getElapsed() > 250f && !isAbilityActive() && !staminaOveruse) {
if (getStaminaPoints() < getMaxStaminaPoints()) {
float afterRegen = getStaminaPoints() + staminaRegen;
staminaPoints = Math.min(afterRegen, getMaxStaminaPoints());
}
staminaRegenTimer.reset();
}
}
if (staminaOveruse) {
if (staminaOveruseTimer.getElapsed() > staminaOveruseTime) {
staminaOveruse = false;
}
}
if (getEffect("poisoned").isActive()) {
if (poisonTickTimer.getElapsed() > poisonTickTime) {
takeDamage(15f, false, 0, 0, 0);
poisonTickTimer.reset();
}
}
if (healing) {
if (healingTickTimer.getElapsed() > healingTickTime) {
heal(healingPower);
healingTickTimer.reset();
}
if (healingTimer.getElapsed() > healingTime || getHealthPoints() >= getMaxHealthPoints()) {
healing = false;
}
}
}
private boolean isAbilityActive() {
boolean abilityActive = false;
for (Ability ability : abilityList) {
if (ability.isActive()) {
abilityActive = true;
break;
}
}
if (currentAttack.isActive()) {
return true;
}
return abilityActive;
}
private void heal(float healValue) {
if (getHealthPoints() < getMaxHealthPoints()) {
float afterHeal = getHealthPoints() + healValue;
healthPoints = Math.min(afterHeal, getMaxHealthPoints());
}
}
protected abstract void setFacingDirection(GameContainer gc);
public void becomePoisoned() {
poisonTickTimer.reset();
getEffect("poisoned").applyEffect(poisonTime);
}
public void takeDamage(float damage, boolean immunityFrames, float knockbackPower, float sourceX, float sourceY) {
if (isAlive()) {
float beforeHP = healthPoints;
float actualDamage = damage * 100f/(100f + getTotalArmor());
if (healthPoints - actualDamage > 0) healthPoints -= actualDamage;
else healthPoints = 0f;
if (beforeHP != healthPoints && healthPoints == 0f) {
onDeath();
}
if (immunityFrames) {
// immunity frames on hit
effectMap.get("immune").applyEffect(750);
// stagger on hit
effectMap.get("immobilized").applyEffect(350);
}
if (knocbackable && !knockback && knockbackPower > 0f) {
this.knockbackPower = knockbackPower;
knockbackVector = new Vector2f(rect.getX() - sourceX, rect.getY() - sourceY).getNormal();
knockback = true;
knockbackTimer.reset();
}
onGettingHitSound.play(1.0f, 0.1f);
}
}
public float getTotalArmor() {
float totalArmor = 0.0f;
for (Map.Entry<Integer, Item> equipmentItem : equipmentItems.entrySet()) {
if (equipmentItem.getValue() != null && equipmentItem.getValue().getItemType().getMaxArmor() != null) {
totalArmor += equipmentItem.getValue().getItemType().getMaxArmor();
}
}
return totalArmor;
}
public abstract void onDeath();
public void move(float dx, float dy) {
rect.setX(rect.getX() + dx);
rect.setY(rect.getY() + dy);
}
public boolean isCollidingX(List<TerrainTile> tiles, List<Blockade> blockadeList, float newPosX, float newPosY) {
int tilesetColumns = area.getTerrainColumns();
int tilesetRows = area.getTerrainRows();
int startColumn = ((int)(newPosX / 64f) - 4) < 0f ? 0 : ((int)(newPosX / 64f) - 4);
int startRow = ((int)(newPosY / 64f) - 4) < 0f ? 0 : ((int)(newPosY / 64f) - 4);
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
int column = startColumn + j >= tilesetColumns ? tilesetColumns - 1 : startColumn + j;
int row = startRow + i >= tilesetRows ? tilesetRows -1 : startRow + i;
TerrainTile tile = tiles.get(tilesetColumns * row + column);
if (tile.isPassable()) continue;
Rectangle tileRect = tile.getRect();
Rect rect1 = new Rect(tileRect.getX(), tileRect.getY(), tileRect.getWidth(), tileRect.getHeight());
Rect rect2 = new Rect(newPosX + hitbox.getX(), rect.getY() + hitbox.getY(), hitbox.getWidth(), hitbox.getHeight());
if (Globals.intersects(rect1, rect2)) {
return true;
}
}
}
Rect creatureRect = new Rect(newPosX + hitbox.getX(), rect.getY() + hitbox.getY(), hitbox.getWidth(), hitbox.getHeight());
for (Blockade blockade : blockadeList) {
if (blockade.isActive()) {
if (Globals.intersects(blockade.getRect(), creatureRect)) {
return true;
}
}
}
return false;
}
public boolean isCollidingY(List<TerrainTile> tiles, List<Blockade> blockadeList, float newPosX, float newPosY) {
int tilesetColumns = area.getTerrainColumns();
int tilesetRows = area.getTerrainRows();
int startColumn = ((int)(newPosX / 64f) - 4) < 0f ? 0 : ((int)(newPosX / 64f) - 4);
int startRow = ((int)(newPosY / 64f) - 4) < 0f ? 0 : ((int)(newPosY / 64f) - 4);
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
int column = startColumn + j >= tilesetColumns ? tilesetColumns - 1 : startColumn + j;
int row = startRow + i >= tilesetRows ? tilesetRows -1 : startRow + i;
TerrainTile tile = tiles.get(tilesetColumns * row + column);
if (tile.isPassable()) continue;
Rectangle tileRect = tile.getRect();
Rect rect1 = new Rect(tileRect.getX(), tileRect.getY(), tileRect.getWidth(), tileRect.getHeight());
Rect rect2 = new Rect(rect.getX() + hitbox.getX(), newPosY + hitbox.getY(), hitbox.getWidth(), hitbox.getHeight());
if (Globals.intersects(rect1, rect2)) {
return true;
}
}
}
Rect creatureRect = new Rect(rect.getX() + hitbox.getX(), newPosY + hitbox.getY(), hitbox.getWidth(), hitbox.getHeight());
for (Blockade blockade : blockadeList) {
if (blockade.isActive()) {
if (Globals.intersects(blockade.getRect(), creatureRect)) {
return true;
}
}
}
return false;
}
public void onUpdateStart(int i) {
moving = false;
totalDirections = 0;
knockbackSpeed = knockbackPower * i;
dirX = 0;
dirY = 0;
speed = baseSpeed * i;
if (isAttacking) {
speed = speed / 2f;
}
}
public void moveUp() {
dirY = -1;
moving = true;
direction = 0;
totalDirections++;
}
public void moveLeft() {
dirX = -1;
moving = true;
direction = 1;
totalDirections++;
}
public void moveDown() {
dirY = 1;
moving = true;
direction = 2;
totalDirections++;
}
public void moveRight() {
dirX = 1;
moving = true;
direction = 3;
totalDirections++;
}
public void executeMovementLogic() {
List<TerrainTile> tiles = area.getTiles();
if (!isEffectActive("immobilized") && !knockback) {
if (totalDirections > 1) {
speed /= Math.sqrt(2);
}
float newPosX = rect.getX() + speed * dirX;
float newPosY = rect.getY() + speed * dirY;
List<Blockade> blockadeList = gameSystem.getCurrentArea().getBlockadeList();
if (!isCollidingX(tiles, blockadeList, newPosX, newPosY) && newPosX >= 0 && newPosX < tiles.get(tiles.size() - 1).getRect().getX()) {
move(speed * dirX, 0);
movementVector.x = speed * dirX;
}
else {
movementVector.x = 0;
}
if (!isCollidingY(tiles, blockadeList, newPosX, newPosY) && newPosY >= 0 && newPosY < tiles.get(tiles.size() - 1).getRect().getY()) {
move(0, speed * dirY);
movementVector.y = speed * dirY;
}
else {
movementVector.y = 0;
}
if (moving) {
runningTimer.reset();
running = true;
}
}
if (knockback) {
float newPosX = rect.getX() + knockbackSpeed * knockbackVector.getX();
float newPosY = rect.getY() + knockbackSpeed * knockbackVector.getY();
List<Blockade> blockadeList = gameSystem.getCurrentArea().getBlockadeList();
if (!isCollidingX(tiles, blockadeList, newPosX, newPosY) && newPosX >= 0 && newPosX < tiles.get(tiles.size() - 1).getRect().getX()) {
move(knockbackSpeed * knockbackVector.getX(), 0);
}
if (!isCollidingY(tiles, blockadeList, newPosX, newPosY) && newPosY >= 0 && newPosY < tiles.get(tiles.size() - 1).getRect().getY()) {
move(0, knockbackSpeed * knockbackVector.getY());
}
if (knockbackTimer.getElapsed() > 200f) {
knockback = false;
}
}
for (Ability ability : abilityList) {
ability.performMovement();
}
currentAttack.performMovement();
}
public abstract void performActions(GameContainer gc, KeyInput keyInput);
public String getId() {
return id;
}
public Rectangle getRect() {
return rect;
}
public float getHealthPoints() {
return healthPoints;
}
public float getMaxHealthPoints() {
if (equipmentItems.get(4) != null && equipmentItems.get(4).getItemType().getId().equals("lifeRing")) return maxHealthPoints * 1.35f;
return maxHealthPoints;
}
public float getMaxStaminaPoints() {
return maxStaminaPoints;
}
public float getStaminaPoints() {
return staminaPoints;
}
public void kill() {
healthPoints = 0f;
}
public void moveToArea(Area area, float posX, float posY) {
pendingArea = area;
pendingX = posX;
pendingY = posY;
}
public void takeStaminaDamage(float staminaDamage) {
if (staminaPoints - staminaDamage > 0) staminaPoints -= staminaDamage;
else {
staminaPoints = 0f;
staminaOveruse = true;
staminaOveruseTimer.reset();
}
}
public void useItem(Item item) {
if (item.getItemType().getId().equals("healingPowder")) {
startHealing(10f);
}
}
private void startHealing(float healingPower) {
healingTimer.reset();
healingTickTimer.reset();
healing = true;
this.healingPower = healingPower;
}
public void reset() {
setHealthPoints(getMaxHealthPoints());
rect.setX(startingPosX);
rect.setY(startingPosY);
}
public void onAttack() {
if (equipmentItems.get(4) != null && equipmentItems.get(4).getItemType().getId().equals("thiefRing")) {
heal(7f);
}
}
public Map<Integer, Item> getEquipmentItems() {
return equipmentItems;
}
public void setMaxHealthPoints(float maxHealthPoints) {
this.maxHealthPoints = maxHealthPoints;
}
public void setHealthPoints(float healthPoints) {
this.healthPoints = healthPoints;
}
public Area getArea() {
return area;
}
public void setArea(Area area) {
this.area = area;
pendingArea = null;
}
public boolean isAlive() {
return healthPoints > 0f;
}
public void setPassedGateRecently(boolean passedGateRecently) {
this.passedGateRecently = passedGateRecently;
}
public boolean isPassedGateRecently() {
return passedGateRecently;
}
public Area getPendingArea() {
return pendingArea;
}
public void markForDeletion() {
toBeRemoved = true;
}
public boolean isToBeRemoved() {
return toBeRemoved;
}
public Float getPendingX() {
return pendingX;
}
public Float getPendingY() {
return pendingY;
}
public Vector2f getFacingVector() {
return facingVector;
}
public void setFacingVector(Vector2f facingVector) {
this.facingVector = facingVector;
}
public Vector2f getAttackingVector() {
return attackingVector;
}
public void setAttackingVector(Vector2f attackingVector) {
this.attackingVector = attackingVector;
}
public float getUnarmedDamage() {
return unarmedDamage;
}
public boolean isImmune() {
return isEffectActive("immune");
}
public void setStartingPosX(float startingPosX) {
this.startingPosX = startingPosX;
}
public void setStartingPosY(float startingPosY) {
this.startingPosY = startingPosY;
}
public boolean isAttacking() {
return isAttacking;
}
public void setAttacking(boolean attacking) {
isAttacking = attacking;
}
public boolean isStaminaOveruse() {
return staminaOveruse;
}
public void setStaminaPoints(float staminaPoints) {
this.staminaPoints = staminaPoints;
}
public void updateAttackType() {
Item weapon = equipmentItems.get(0);
if (weapon != null) {
ItemType weaponItemType = weapon.getItemType();
Attack attackAbility = attackList.stream().filter(attack -> attack.getAttackType().equals(weaponItemType.getAttackType())).findAny().get();
currentAttack = attackAbility;
}
else {
Attack attackAbility = attackList.stream().filter(attack -> attack.getAttackType().equals(AttackType.UNARMED)).findAny().get();
currentAttack = attackAbility;
}
}
public boolean isNoAbilityActive() {
for (Ability ability : abilityList) {
if (ability.isActive()) return false;
}
return true;
}
public String getName() {
if (name != null) return name;
return creatureType;
}
public void onAggroed() {
}
public boolean isBoss() {
return isBoss;
}
public Effect getEffect(String effectName) {
return effectMap.get(effectName);
}
public boolean isEffectActive(String effect) {
return effectMap.get(effect).isActive();
}
}
| UTF-8 | Java | 24,398 | java | Creature.java | Java | [] | null | [] | package com.kamilkurp.creatures;
import com.kamilkurp.Globals;
import com.kamilkurp.KeyInput;
import com.kamilkurp.abilities.*;
import com.kamilkurp.animations.WalkAnimation;
import com.kamilkurp.areagate.AreaGate;
import com.kamilkurp.assets.Assets;
import com.kamilkurp.effect.Effect;
import com.kamilkurp.items.Item;
import com.kamilkurp.items.ItemType;
import com.kamilkurp.spawn.Blockade;
import com.kamilkurp.systems.GameSystem;
import com.kamilkurp.terrain.Area;
import com.kamilkurp.terrain.TerrainTile;
import com.kamilkurp.utils.Camera;
import com.kamilkurp.utils.Rect;
import com.kamilkurp.utils.Timer;
import org.newdawn.slick.*;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.geom.Vector2f;
import java.util.*;
public abstract class Creature {
protected Rectangle rect;
protected Rectangle hitbox;
protected String id;
protected boolean running = false;
protected int direction = 0;
protected Timer runningTimer;
protected boolean moving;
protected int totalDirections;
protected int dirX;
protected int dirY;
protected float speed = 0f;
protected float maxHealthPoints = 100f;
protected float healthPoints = maxHealthPoints;
protected float maxStaminaPoints = 100f;
protected float staminaPoints = maxStaminaPoints;
protected Vector2f facingVector;
protected Vector2f attackingVector;
protected WalkAnimation walkAnimation;
protected Map<Integer, Item> equipmentItems;
protected float healthRegen = 0.3f;
protected float staminaRegen = 10f;
protected Timer healthRegenTimer;
protected Timer staminaRegenTimer;
protected Timer poisonTickTimer;
protected Area area;
protected boolean passedGateRecently = false;
protected Area pendingArea;
protected boolean toBeRemoved;
protected Float pendingX;
protected Float pendingY;
protected GameSystem gameSystem;
protected List<Ability> abilityList;
protected List<Attack> attackList;
protected Attack currentAttack;
protected BowAttack bowAttack;
protected UnarmedAttack unarmedAttack;
protected SwordAttack swordAttack;
protected TridentAttack tridentAttack;
protected float unarmedDamage;
protected boolean sprinting;
protected Timer staminaOveruseTimer;
protected int staminaOveruseTime = 1300;
protected boolean staminaOveruse;
protected int poisonTickTime = 1500;
protected int poisonTime = 20000;
protected float knockbackPower;
private Timer healingTimer;
private Timer healingTickTimer;
private boolean healing;
protected int healingTickTime = 300;
protected int healingTime = 8000;
private float healingPower;
protected boolean knockback = false;
protected Timer knockbackTimer;
protected Vector2f knockbackVector;
protected float knockbackSpeed;
protected Vector2f movementVector;
protected float startingPosX;
protected float startingPosY;
protected float scale;
protected boolean isAttacking;
protected String name;
protected boolean knocbackable;
protected boolean isBoss;
protected Map<String, Float> dropTable;
protected Sound onGettingHitSound;
protected float baseSpeed;
protected String creatureType;
protected Map<String, Effect> effectMap;
public Creature(GameSystem gameSystem, String id) {
this.gameSystem = gameSystem;
this.id = id;
rect = new Rectangle(0, 0, 64, 64);
hitbox = new Rectangle(2, 2, 60, 60);
walkAnimation = new WalkAnimation(Assets.male1SpriteSheet, 3, 100, new int[]{3, 1, 0, 2}, 1);
runningTimer = new Timer();
healthRegenTimer = new Timer();
staminaRegenTimer = new Timer();
knockbackTimer = new Timer();
staminaRegenTimer.start();
healthRegenTimer.start();
facingVector = new Vector2f(0f, 0f);
equipmentItems = new TreeMap<>();
abilityList = new LinkedList<>();
toBeRemoved = false;
pendingX = 0.0f;
pendingY = 0.0f;
unarmedDamage = 15f;
sprinting = false;
staminaOveruseTimer = new Timer();
staminaOveruse = false;
attackingVector = new Vector2f(0f, 0f);
healingTimer = new Timer(true);
healingTickTimer = new Timer(true);
poisonTickTimer = new Timer(true);
healing = false;
healingPower = 0f;
knockbackPower = 0f;
movementVector = new Vector2f(0f,0f);
scale = 1.0f;
knocbackable = true;
isBoss = false;
dropTable = new HashMap<>();
onGettingHitSound = Assets.painSound;
baseSpeed = 0.2f;
effectMap = new HashMap<>();
effectMap.put("immune", new Effect(this));
effectMap.put("immobilized", new Effect(this));
effectMap.put("staminaRegenStopped", new Effect(this));
effectMap.put("poisoned", new Effect(this));
}
public void defineStandardAbilities() {
abilityList = new LinkedList<>();
attackList = new LinkedList<>();
bowAttack = BowAttack.newInstance(this);
unarmedAttack = UnarmedAttack.newInstance(this);
swordAttack = SwordAttack.newInstance(this);
tridentAttack = TridentAttack.newInstance(this);
attackList.add(bowAttack);
attackList.add(unarmedAttack);
attackList.add(swordAttack);
attackList.add(tridentAttack);
currentAttack = unarmedAttack;
}
public void onInit() {
defineStandardAbilities();
defineCustomAbilities();
updateAttackType();
}
protected void defineCustomAbilities() {
}
public void render(Graphics g, Camera camera) {
Image sprite = walkAnimation.getRestPosition(direction);
if (Globals.SHOW_HITBOXES) {
g.setColor(Color.pink);
g.fillRect(rect.getX() - camera.getPosX(), rect.getY() - camera.getPosY(), rect.getWidth(), rect.getHeight());
}
if (!running) {
if (!isAlive()) {
sprite.rotate(90f);
}
sprite.draw(rect.getX() - camera.getPosX(), rect.getY() - camera.getPosY(), rect.getWidth(), rect.getHeight());
if (isAlive() && isImmune() && (effectMap.get("immune").getRemainingTime() % 250) < 125) {
sprite.draw(rect.getX() - camera.getPosX(), rect.getY() - camera.getPosY(), rect.getWidth(), rect.getHeight(), Color.red);
}
else {
sprite.draw(rect.getX() - camera.getPosX(), rect.getY() - camera.getPosY(), rect.getWidth(), rect.getHeight());
}
} else {
if (isAlive() && isImmune() && (effectMap.get("immune").getRemainingTime() % 250) < 125) {
walkAnimation.getAnimation(direction).draw((int) rect.getX() - (int) camera.getPosX(), (int) rect.getY() - (int) camera.getPosY(), rect.getWidth(), rect.getHeight(), Color.red);
}
else {
walkAnimation.getAnimation(direction).draw((int) rect.getX() - (int) camera.getPosX(), (int) rect.getY() - (int) camera.getPosY(), rect.getWidth(), rect.getHeight());
}
}
Assets.verdanaTtf.drawString((int) rect.getX() - (int) camera.getPosX(), (int) rect.getY() - (int) camera.getPosY() - 30f, (int) Math.ceil(healthPoints) + "/" + (int) Math.ceil(getMaxHealthPoints()), Color.red);
}
public void renderAbilities(Graphics g, Camera camera) {
for (Ability ability : abilityList) {
ability.render(g, camera);
}
currentAttack.render(g, camera);
}
public void update(GameContainer gc, int i, KeyInput keyInput, GameSystem gameSystem) {
walkAnimation.getAnimation(direction).update(i);
if (isAlive()) {
onUpdateStart(i);
for (Ability ability : abilityList) {
ability.performOnUpdateStart(i);
}
currentAttack.performOnUpdateStart(i);
performActions(gc, keyInput);
executeMovementLogic();
setFacingDirection(gc);
regenerate();
}
for (Effect effect : effectMap.values()) {
effect.update();
}
for (Ability ability : abilityList) {
ability.update(i);
}
currentAttack.update(i);
}
public void onPassedGate(List<AreaGate> gatesList) {
boolean leftGate = true;
for (AreaGate areaGate : gatesList) {
if (areaGate.getAreaFrom() == area) {
if (rect.intersects(areaGate.getFromRect())) {
leftGate = false;
break;
}
}
if (areaGate.getAreaTo() == area) {
if (rect.intersects(areaGate.getToRect())) {
leftGate = false;
break;
}
}
}
passedGateRecently = !leftGate;
}
public void regenerate() {
if (healthRegenTimer.getElapsed() > 500f) {
heal(healthRegen);
healthRegenTimer.reset();
}
if (!isEffectActive("staminaRegenStopped") && !sprinting) {
if (staminaRegenTimer.getElapsed() > 250f && !isAbilityActive() && !staminaOveruse) {
if (getStaminaPoints() < getMaxStaminaPoints()) {
float afterRegen = getStaminaPoints() + staminaRegen;
staminaPoints = Math.min(afterRegen, getMaxStaminaPoints());
}
staminaRegenTimer.reset();
}
}
if (staminaOveruse) {
if (staminaOveruseTimer.getElapsed() > staminaOveruseTime) {
staminaOveruse = false;
}
}
if (getEffect("poisoned").isActive()) {
if (poisonTickTimer.getElapsed() > poisonTickTime) {
takeDamage(15f, false, 0, 0, 0);
poisonTickTimer.reset();
}
}
if (healing) {
if (healingTickTimer.getElapsed() > healingTickTime) {
heal(healingPower);
healingTickTimer.reset();
}
if (healingTimer.getElapsed() > healingTime || getHealthPoints() >= getMaxHealthPoints()) {
healing = false;
}
}
}
private boolean isAbilityActive() {
boolean abilityActive = false;
for (Ability ability : abilityList) {
if (ability.isActive()) {
abilityActive = true;
break;
}
}
if (currentAttack.isActive()) {
return true;
}
return abilityActive;
}
private void heal(float healValue) {
if (getHealthPoints() < getMaxHealthPoints()) {
float afterHeal = getHealthPoints() + healValue;
healthPoints = Math.min(afterHeal, getMaxHealthPoints());
}
}
protected abstract void setFacingDirection(GameContainer gc);
public void becomePoisoned() {
poisonTickTimer.reset();
getEffect("poisoned").applyEffect(poisonTime);
}
public void takeDamage(float damage, boolean immunityFrames, float knockbackPower, float sourceX, float sourceY) {
if (isAlive()) {
float beforeHP = healthPoints;
float actualDamage = damage * 100f/(100f + getTotalArmor());
if (healthPoints - actualDamage > 0) healthPoints -= actualDamage;
else healthPoints = 0f;
if (beforeHP != healthPoints && healthPoints == 0f) {
onDeath();
}
if (immunityFrames) {
// immunity frames on hit
effectMap.get("immune").applyEffect(750);
// stagger on hit
effectMap.get("immobilized").applyEffect(350);
}
if (knocbackable && !knockback && knockbackPower > 0f) {
this.knockbackPower = knockbackPower;
knockbackVector = new Vector2f(rect.getX() - sourceX, rect.getY() - sourceY).getNormal();
knockback = true;
knockbackTimer.reset();
}
onGettingHitSound.play(1.0f, 0.1f);
}
}
public float getTotalArmor() {
float totalArmor = 0.0f;
for (Map.Entry<Integer, Item> equipmentItem : equipmentItems.entrySet()) {
if (equipmentItem.getValue() != null && equipmentItem.getValue().getItemType().getMaxArmor() != null) {
totalArmor += equipmentItem.getValue().getItemType().getMaxArmor();
}
}
return totalArmor;
}
public abstract void onDeath();
public void move(float dx, float dy) {
rect.setX(rect.getX() + dx);
rect.setY(rect.getY() + dy);
}
public boolean isCollidingX(List<TerrainTile> tiles, List<Blockade> blockadeList, float newPosX, float newPosY) {
int tilesetColumns = area.getTerrainColumns();
int tilesetRows = area.getTerrainRows();
int startColumn = ((int)(newPosX / 64f) - 4) < 0f ? 0 : ((int)(newPosX / 64f) - 4);
int startRow = ((int)(newPosY / 64f) - 4) < 0f ? 0 : ((int)(newPosY / 64f) - 4);
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
int column = startColumn + j >= tilesetColumns ? tilesetColumns - 1 : startColumn + j;
int row = startRow + i >= tilesetRows ? tilesetRows -1 : startRow + i;
TerrainTile tile = tiles.get(tilesetColumns * row + column);
if (tile.isPassable()) continue;
Rectangle tileRect = tile.getRect();
Rect rect1 = new Rect(tileRect.getX(), tileRect.getY(), tileRect.getWidth(), tileRect.getHeight());
Rect rect2 = new Rect(newPosX + hitbox.getX(), rect.getY() + hitbox.getY(), hitbox.getWidth(), hitbox.getHeight());
if (Globals.intersects(rect1, rect2)) {
return true;
}
}
}
Rect creatureRect = new Rect(newPosX + hitbox.getX(), rect.getY() + hitbox.getY(), hitbox.getWidth(), hitbox.getHeight());
for (Blockade blockade : blockadeList) {
if (blockade.isActive()) {
if (Globals.intersects(blockade.getRect(), creatureRect)) {
return true;
}
}
}
return false;
}
public boolean isCollidingY(List<TerrainTile> tiles, List<Blockade> blockadeList, float newPosX, float newPosY) {
int tilesetColumns = area.getTerrainColumns();
int tilesetRows = area.getTerrainRows();
int startColumn = ((int)(newPosX / 64f) - 4) < 0f ? 0 : ((int)(newPosX / 64f) - 4);
int startRow = ((int)(newPosY / 64f) - 4) < 0f ? 0 : ((int)(newPosY / 64f) - 4);
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
int column = startColumn + j >= tilesetColumns ? tilesetColumns - 1 : startColumn + j;
int row = startRow + i >= tilesetRows ? tilesetRows -1 : startRow + i;
TerrainTile tile = tiles.get(tilesetColumns * row + column);
if (tile.isPassable()) continue;
Rectangle tileRect = tile.getRect();
Rect rect1 = new Rect(tileRect.getX(), tileRect.getY(), tileRect.getWidth(), tileRect.getHeight());
Rect rect2 = new Rect(rect.getX() + hitbox.getX(), newPosY + hitbox.getY(), hitbox.getWidth(), hitbox.getHeight());
if (Globals.intersects(rect1, rect2)) {
return true;
}
}
}
Rect creatureRect = new Rect(rect.getX() + hitbox.getX(), newPosY + hitbox.getY(), hitbox.getWidth(), hitbox.getHeight());
for (Blockade blockade : blockadeList) {
if (blockade.isActive()) {
if (Globals.intersects(blockade.getRect(), creatureRect)) {
return true;
}
}
}
return false;
}
public void onUpdateStart(int i) {
moving = false;
totalDirections = 0;
knockbackSpeed = knockbackPower * i;
dirX = 0;
dirY = 0;
speed = baseSpeed * i;
if (isAttacking) {
speed = speed / 2f;
}
}
public void moveUp() {
dirY = -1;
moving = true;
direction = 0;
totalDirections++;
}
public void moveLeft() {
dirX = -1;
moving = true;
direction = 1;
totalDirections++;
}
public void moveDown() {
dirY = 1;
moving = true;
direction = 2;
totalDirections++;
}
public void moveRight() {
dirX = 1;
moving = true;
direction = 3;
totalDirections++;
}
public void executeMovementLogic() {
List<TerrainTile> tiles = area.getTiles();
if (!isEffectActive("immobilized") && !knockback) {
if (totalDirections > 1) {
speed /= Math.sqrt(2);
}
float newPosX = rect.getX() + speed * dirX;
float newPosY = rect.getY() + speed * dirY;
List<Blockade> blockadeList = gameSystem.getCurrentArea().getBlockadeList();
if (!isCollidingX(tiles, blockadeList, newPosX, newPosY) && newPosX >= 0 && newPosX < tiles.get(tiles.size() - 1).getRect().getX()) {
move(speed * dirX, 0);
movementVector.x = speed * dirX;
}
else {
movementVector.x = 0;
}
if (!isCollidingY(tiles, blockadeList, newPosX, newPosY) && newPosY >= 0 && newPosY < tiles.get(tiles.size() - 1).getRect().getY()) {
move(0, speed * dirY);
movementVector.y = speed * dirY;
}
else {
movementVector.y = 0;
}
if (moving) {
runningTimer.reset();
running = true;
}
}
if (knockback) {
float newPosX = rect.getX() + knockbackSpeed * knockbackVector.getX();
float newPosY = rect.getY() + knockbackSpeed * knockbackVector.getY();
List<Blockade> blockadeList = gameSystem.getCurrentArea().getBlockadeList();
if (!isCollidingX(tiles, blockadeList, newPosX, newPosY) && newPosX >= 0 && newPosX < tiles.get(tiles.size() - 1).getRect().getX()) {
move(knockbackSpeed * knockbackVector.getX(), 0);
}
if (!isCollidingY(tiles, blockadeList, newPosX, newPosY) && newPosY >= 0 && newPosY < tiles.get(tiles.size() - 1).getRect().getY()) {
move(0, knockbackSpeed * knockbackVector.getY());
}
if (knockbackTimer.getElapsed() > 200f) {
knockback = false;
}
}
for (Ability ability : abilityList) {
ability.performMovement();
}
currentAttack.performMovement();
}
public abstract void performActions(GameContainer gc, KeyInput keyInput);
public String getId() {
return id;
}
public Rectangle getRect() {
return rect;
}
public float getHealthPoints() {
return healthPoints;
}
public float getMaxHealthPoints() {
if (equipmentItems.get(4) != null && equipmentItems.get(4).getItemType().getId().equals("lifeRing")) return maxHealthPoints * 1.35f;
return maxHealthPoints;
}
public float getMaxStaminaPoints() {
return maxStaminaPoints;
}
public float getStaminaPoints() {
return staminaPoints;
}
public void kill() {
healthPoints = 0f;
}
public void moveToArea(Area area, float posX, float posY) {
pendingArea = area;
pendingX = posX;
pendingY = posY;
}
public void takeStaminaDamage(float staminaDamage) {
if (staminaPoints - staminaDamage > 0) staminaPoints -= staminaDamage;
else {
staminaPoints = 0f;
staminaOveruse = true;
staminaOveruseTimer.reset();
}
}
public void useItem(Item item) {
if (item.getItemType().getId().equals("healingPowder")) {
startHealing(10f);
}
}
private void startHealing(float healingPower) {
healingTimer.reset();
healingTickTimer.reset();
healing = true;
this.healingPower = healingPower;
}
public void reset() {
setHealthPoints(getMaxHealthPoints());
rect.setX(startingPosX);
rect.setY(startingPosY);
}
public void onAttack() {
if (equipmentItems.get(4) != null && equipmentItems.get(4).getItemType().getId().equals("thiefRing")) {
heal(7f);
}
}
public Map<Integer, Item> getEquipmentItems() {
return equipmentItems;
}
public void setMaxHealthPoints(float maxHealthPoints) {
this.maxHealthPoints = maxHealthPoints;
}
public void setHealthPoints(float healthPoints) {
this.healthPoints = healthPoints;
}
public Area getArea() {
return area;
}
public void setArea(Area area) {
this.area = area;
pendingArea = null;
}
public boolean isAlive() {
return healthPoints > 0f;
}
public void setPassedGateRecently(boolean passedGateRecently) {
this.passedGateRecently = passedGateRecently;
}
public boolean isPassedGateRecently() {
return passedGateRecently;
}
public Area getPendingArea() {
return pendingArea;
}
public void markForDeletion() {
toBeRemoved = true;
}
public boolean isToBeRemoved() {
return toBeRemoved;
}
public Float getPendingX() {
return pendingX;
}
public Float getPendingY() {
return pendingY;
}
public Vector2f getFacingVector() {
return facingVector;
}
public void setFacingVector(Vector2f facingVector) {
this.facingVector = facingVector;
}
public Vector2f getAttackingVector() {
return attackingVector;
}
public void setAttackingVector(Vector2f attackingVector) {
this.attackingVector = attackingVector;
}
public float getUnarmedDamage() {
return unarmedDamage;
}
public boolean isImmune() {
return isEffectActive("immune");
}
public void setStartingPosX(float startingPosX) {
this.startingPosX = startingPosX;
}
public void setStartingPosY(float startingPosY) {
this.startingPosY = startingPosY;
}
public boolean isAttacking() {
return isAttacking;
}
public void setAttacking(boolean attacking) {
isAttacking = attacking;
}
public boolean isStaminaOveruse() {
return staminaOveruse;
}
public void setStaminaPoints(float staminaPoints) {
this.staminaPoints = staminaPoints;
}
public void updateAttackType() {
Item weapon = equipmentItems.get(0);
if (weapon != null) {
ItemType weaponItemType = weapon.getItemType();
Attack attackAbility = attackList.stream().filter(attack -> attack.getAttackType().equals(weaponItemType.getAttackType())).findAny().get();
currentAttack = attackAbility;
}
else {
Attack attackAbility = attackList.stream().filter(attack -> attack.getAttackType().equals(AttackType.UNARMED)).findAny().get();
currentAttack = attackAbility;
}
}
public boolean isNoAbilityActive() {
for (Ability ability : abilityList) {
if (ability.isActive()) return false;
}
return true;
}
public String getName() {
if (name != null) return name;
return creatureType;
}
public void onAggroed() {
}
public boolean isBoss() {
return isBoss;
}
public Effect getEffect(String effectName) {
return effectMap.get(effectName);
}
public boolean isEffectActive(String effect) {
return effectMap.get(effect).isActive();
}
}
| 24,398 | 0.584269 | 0.57476 | 892 | 26.352018 | 29.598537 | 219 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.534753 | false | false | 13 |
af2afd2572c3441cc244e876bd5190bc62be2253 | 30,700,426,249,980 | 2be707e8a82bde8313f47cde7b0c227bb40b04c2 | /trainsys/src/cn/tisson/train/itfc/oa/unity/dao/impl/WorkItemLogDAOImpl.java | 13e914b28d57b38d5995af317d4d8bc83a5fa7ae | [] | no_license | solar1985/Solar00 | https://github.com/solar1985/Solar00 | 91e0aaba4a2b14251b4521b3143fc7a05ec12385 | af518b5018a7a0389ad3a7f3e2bfa8c9cc9fd4d1 | refs/heads/master | 2019-01-16T00:26:08.605000 | 2016-11-14T03:14:51 | 2016-11-14T03:14:51 | 73,665,642 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.tisson.train.itfc.oa.unity.dao.impl;
import java.util.Hashtable;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.SqlMapClientFactoryBean;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Component;
import cn.tisson.train.common.CommonDAO;
import cn.tisson.train.common.CommonExample;
import cn.tisson.train.common.Constants;
import cn.tisson.train.common.ValueUtil;
import cn.tisson.train.itfc.oa.unity.dao.WorkItemLogDAO;
import cn.tisson.train.itfc.oa.unity.entity.WorkItemVO;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.regaltec.baf.org.user.common.valueobj.UserVO;
import com.regaltec.common.util.Constant;
@Component(value="workItemLogDAOImpl")
public class WorkItemLogDAOImpl extends CommonDAO implements WorkItemLogDAO {
@Autowired
@Qualifier("sqlMapClient")
private SqlMapClientFactoryBean sqlMapClient;
@Override
protected SqlMapClient getSqlMapClient() {
return (SqlMapClient)this.sqlMapClient.getObject();
}
public void insertWorkItem (Hashtable<String, Object> ht) throws Exception {
WorkItemVO workItemVo =(WorkItemVO)ht.get("pMap");
String id = (String)this.getSqlMapClientTemplate().queryForObject("Time.getNextSequence", "SEQ_T_PUB_WORKITEM_LOG");
workItemVo.setWorkItemId(Long.valueOf(id));
this.getSqlMapClientTemplate().insert("workItemLog.insertWorkItem", workItemVo);
}
public void selectWorkItem (Hashtable<String, Object> ht) throws Exception {
Long sendOaId =(Long)ht.get("pMap");
List list = null;
list = this.getSqlMapClientTemplate().queryForList("workItemLog.selectWorkItem",sendOaId);
if (list!=null) {
ht.put("recordMap",list);
}
}
}
| UTF-8 | Java | 1,934 | java | WorkItemLogDAOImpl.java | Java | [] | null | [] | package cn.tisson.train.itfc.oa.unity.dao.impl;
import java.util.Hashtable;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.SqlMapClientFactoryBean;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Component;
import cn.tisson.train.common.CommonDAO;
import cn.tisson.train.common.CommonExample;
import cn.tisson.train.common.Constants;
import cn.tisson.train.common.ValueUtil;
import cn.tisson.train.itfc.oa.unity.dao.WorkItemLogDAO;
import cn.tisson.train.itfc.oa.unity.entity.WorkItemVO;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.regaltec.baf.org.user.common.valueobj.UserVO;
import com.regaltec.common.util.Constant;
@Component(value="workItemLogDAOImpl")
public class WorkItemLogDAOImpl extends CommonDAO implements WorkItemLogDAO {
@Autowired
@Qualifier("sqlMapClient")
private SqlMapClientFactoryBean sqlMapClient;
@Override
protected SqlMapClient getSqlMapClient() {
return (SqlMapClient)this.sqlMapClient.getObject();
}
public void insertWorkItem (Hashtable<String, Object> ht) throws Exception {
WorkItemVO workItemVo =(WorkItemVO)ht.get("pMap");
String id = (String)this.getSqlMapClientTemplate().queryForObject("Time.getNextSequence", "SEQ_T_PUB_WORKITEM_LOG");
workItemVo.setWorkItemId(Long.valueOf(id));
this.getSqlMapClientTemplate().insert("workItemLog.insertWorkItem", workItemVo);
}
public void selectWorkItem (Hashtable<String, Object> ht) throws Exception {
Long sendOaId =(Long)ht.get("pMap");
List list = null;
list = this.getSqlMapClientTemplate().queryForList("workItemLog.selectWorkItem",sendOaId);
if (list!=null) {
ht.put("recordMap",list);
}
}
}
| 1,934 | 0.780765 | 0.780765 | 52 | 35.192307 | 28.998035 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.307692 | false | false | 13 |
6cc526ca1872af47723da1ab4fd5e08ea2bef1ce | 12,541,304,535,667 | ab2f05523d7ae78870d59c4f95c69eda0a24313c | /BillSharing/src/Service/BillSharingService.java | eb2826bd59c010e69993e603de24efa12835970a | [] | no_license | snehajgec/MachineCoding | https://github.com/snehajgec/MachineCoding | dbb65f16323f3f40f597d4ccbd729fbd25d0474d | 80355d31e5aa48ba96f9abc2a6139791deb5719b | refs/heads/master | 2022-08-04T04:46:37.997000 | 2020-05-08T19:28:59 | 2020-05-08T19:28:59 | 262,410,680 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import Entity.Group;
import Entity.User;
import Entity.UserGroup;
import Entity.UserGroupTransaction;
public class BillSharingService {
private List<UserGroup> userGroupList2;
private Map<String, Group> groupList;
private Map<String, User> userList;
private Map<Group, List<User>> userGroupList;
private List<UserGroupTransaction> userGroupTransactionList;
private Map<Group, List<UserGroupTransaction>> userGroupTransactionMap;
public BillSharingService() {
userGroupList2 = new ArrayList<UserGroup>();
groupList = new HashMap<String, Group>();
userList = new HashMap<String, User>();
userGroupList = new HashMap<Group, List<User>>();
userGroupTransactionList = new ArrayList<UserGroupTransaction>();
userGroupTransactionMap = new HashMap<Group, List<UserGroupTransaction>>();
}
public void createGroup(String groupName) throws Exception {
Group group;
if (this.groupList.containsKey(groupName)) {
throw new Exception("Group already exists!!");
}
group = new Group(groupName);
this.groupList.put(groupName, group);
}
public void addPersons(String groupName, List<String> userList) {
Group group = this.groupList.get(groupName);
List<User> users = userList.stream().map(userName -> {
User user;
if (!this.userList.containsKey(userName)) {
user = new User(userName);
this.userList.put(userName, user);
} else {
user = this.userList.get(userName);
}
UserGroup userGroup = new UserGroup(user, group);
this.userGroupList2.add(userGroup);
return user;
}).collect(Collectors.toList());
this.userGroupList.put(group, users);
}
public void addTransaction(String groupName, Map<String, Double> userGroupTransactionList) {
Group group = this.groupList.get(groupName);
Boolean isGroupTrans = false;
List<User> usersOfGroup = new ArrayList<User>();
List<UserGroupTransaction> usersOfGroupTransaction = new ArrayList<UserGroupTransaction>();
if (userGroupTransactionMap.containsKey(group)) {
isGroupTrans = true;
usersOfGroupTransaction = userGroupTransactionMap.get(group);
}
//List<UserGroupTransaction> userGroupTransactions = new ArrayList<UserGroupTransaction>();
for (String temp : userGroupTransactionList.keySet()) {
User user = this.userList.get(temp);
Double amountPaid = 0D;
Boolean isUserInGroup = false;
UserGroupTransaction userGroupTransaction = null;
if (isGroupTrans == true) {
for (UserGroupTransaction tempUser : usersOfGroupTransaction) {
if (tempUser.getUser().equals(user)) {
isUserInGroup = true;
tempUser.setAmountPaid(tempUser.getAmountPaid() + userGroupTransactionList.get(temp));
userGroupTransaction = tempUser;
break;
}
}
if (isUserInGroup == false) {
amountPaid = userGroupTransactionList.get(temp);
userGroupTransaction = new UserGroupTransaction(user, amountPaid, group);
this.userGroupTransactionList.add(userGroupTransaction);
usersOfGroupTransaction.add(userGroupTransaction);
}
} else {
amountPaid = userGroupTransactionList.get(temp);
userGroupTransaction = new UserGroupTransaction(user, amountPaid, group);
// maybe not needed
this.userGroupTransactionList.add(userGroupTransaction);
usersOfGroupTransaction.add(userGroupTransaction);
}
}
this.userGroupTransactionMap.put(group, usersOfGroupTransaction);
}
public Double getBalanceOfPersonInGroup(String groupName, String userName) {
Group group = this.groupList.get(groupName);
double sum = 0;
double amountPaidByUser = 0;
List<UserGroupTransaction> userGroupTransactions = this.userGroupTransactionMap.get(group);
for (UserGroupTransaction userGroupTransaction : userGroupTransactions) {
sum = sum + userGroupTransaction.getAmountPaid();
if (userGroupTransaction.getUser().getName().equals(userName)) {
amountPaidByUser = userGroupTransaction.getAmountPaid();
}
}
double indiContribution = sum / userGroupTransactions.size();
return (amountPaidByUser - indiContribution);
}
public Map<String, Double> getBalanceOfPersonsInGroup(String groupName) {
Group group = this.groupList.get(groupName);
double sum = 0;
List<UserGroupTransaction> userGroupTransactions = this.userGroupTransactionMap.get(group);
Map<String, Double> userBalanceInGroup = new HashMap<String, Double>();
for (UserGroupTransaction userGroupTransaction : userGroupTransactions) {
sum = sum + userGroupTransaction.getAmountPaid();
userBalanceInGroup.put(userGroupTransaction.getUser().getName(), 0D);
}
double indiContribution = sum / userGroupTransactions.size();
for (UserGroupTransaction userGroupTransaction : userGroupTransactions) {
userBalanceInGroup.put(userGroupTransaction.getUser().getName(),
userGroupTransaction.getAmountPaid() - indiContribution);
}
return userBalanceInGroup;
}
public Double getBalanceAcrossAllGroups(String userName) {
List<UserGroup> groupOfUser = this.userGroupList2.stream()
.filter(temp -> temp.getUser().getName().equals(userName)).collect(Collectors.toList());
Double sum = 0D;
for (UserGroup userGroup : groupOfUser) {
sum = sum + getBalanceOfPersonInGroup(userGroup.getGroup().getGroupName(), userName);
}
return sum;
}
}
| UTF-8 | Java | 5,380 | java | BillSharingService.java | Java | [] | null | [] | package Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import Entity.Group;
import Entity.User;
import Entity.UserGroup;
import Entity.UserGroupTransaction;
public class BillSharingService {
private List<UserGroup> userGroupList2;
private Map<String, Group> groupList;
private Map<String, User> userList;
private Map<Group, List<User>> userGroupList;
private List<UserGroupTransaction> userGroupTransactionList;
private Map<Group, List<UserGroupTransaction>> userGroupTransactionMap;
public BillSharingService() {
userGroupList2 = new ArrayList<UserGroup>();
groupList = new HashMap<String, Group>();
userList = new HashMap<String, User>();
userGroupList = new HashMap<Group, List<User>>();
userGroupTransactionList = new ArrayList<UserGroupTransaction>();
userGroupTransactionMap = new HashMap<Group, List<UserGroupTransaction>>();
}
public void createGroup(String groupName) throws Exception {
Group group;
if (this.groupList.containsKey(groupName)) {
throw new Exception("Group already exists!!");
}
group = new Group(groupName);
this.groupList.put(groupName, group);
}
public void addPersons(String groupName, List<String> userList) {
Group group = this.groupList.get(groupName);
List<User> users = userList.stream().map(userName -> {
User user;
if (!this.userList.containsKey(userName)) {
user = new User(userName);
this.userList.put(userName, user);
} else {
user = this.userList.get(userName);
}
UserGroup userGroup = new UserGroup(user, group);
this.userGroupList2.add(userGroup);
return user;
}).collect(Collectors.toList());
this.userGroupList.put(group, users);
}
public void addTransaction(String groupName, Map<String, Double> userGroupTransactionList) {
Group group = this.groupList.get(groupName);
Boolean isGroupTrans = false;
List<User> usersOfGroup = new ArrayList<User>();
List<UserGroupTransaction> usersOfGroupTransaction = new ArrayList<UserGroupTransaction>();
if (userGroupTransactionMap.containsKey(group)) {
isGroupTrans = true;
usersOfGroupTransaction = userGroupTransactionMap.get(group);
}
//List<UserGroupTransaction> userGroupTransactions = new ArrayList<UserGroupTransaction>();
for (String temp : userGroupTransactionList.keySet()) {
User user = this.userList.get(temp);
Double amountPaid = 0D;
Boolean isUserInGroup = false;
UserGroupTransaction userGroupTransaction = null;
if (isGroupTrans == true) {
for (UserGroupTransaction tempUser : usersOfGroupTransaction) {
if (tempUser.getUser().equals(user)) {
isUserInGroup = true;
tempUser.setAmountPaid(tempUser.getAmountPaid() + userGroupTransactionList.get(temp));
userGroupTransaction = tempUser;
break;
}
}
if (isUserInGroup == false) {
amountPaid = userGroupTransactionList.get(temp);
userGroupTransaction = new UserGroupTransaction(user, amountPaid, group);
this.userGroupTransactionList.add(userGroupTransaction);
usersOfGroupTransaction.add(userGroupTransaction);
}
} else {
amountPaid = userGroupTransactionList.get(temp);
userGroupTransaction = new UserGroupTransaction(user, amountPaid, group);
// maybe not needed
this.userGroupTransactionList.add(userGroupTransaction);
usersOfGroupTransaction.add(userGroupTransaction);
}
}
this.userGroupTransactionMap.put(group, usersOfGroupTransaction);
}
public Double getBalanceOfPersonInGroup(String groupName, String userName) {
Group group = this.groupList.get(groupName);
double sum = 0;
double amountPaidByUser = 0;
List<UserGroupTransaction> userGroupTransactions = this.userGroupTransactionMap.get(group);
for (UserGroupTransaction userGroupTransaction : userGroupTransactions) {
sum = sum + userGroupTransaction.getAmountPaid();
if (userGroupTransaction.getUser().getName().equals(userName)) {
amountPaidByUser = userGroupTransaction.getAmountPaid();
}
}
double indiContribution = sum / userGroupTransactions.size();
return (amountPaidByUser - indiContribution);
}
public Map<String, Double> getBalanceOfPersonsInGroup(String groupName) {
Group group = this.groupList.get(groupName);
double sum = 0;
List<UserGroupTransaction> userGroupTransactions = this.userGroupTransactionMap.get(group);
Map<String, Double> userBalanceInGroup = new HashMap<String, Double>();
for (UserGroupTransaction userGroupTransaction : userGroupTransactions) {
sum = sum + userGroupTransaction.getAmountPaid();
userBalanceInGroup.put(userGroupTransaction.getUser().getName(), 0D);
}
double indiContribution = sum / userGroupTransactions.size();
for (UserGroupTransaction userGroupTransaction : userGroupTransactions) {
userBalanceInGroup.put(userGroupTransaction.getUser().getName(),
userGroupTransaction.getAmountPaid() - indiContribution);
}
return userBalanceInGroup;
}
public Double getBalanceAcrossAllGroups(String userName) {
List<UserGroup> groupOfUser = this.userGroupList2.stream()
.filter(temp -> temp.getUser().getName().equals(userName)).collect(Collectors.toList());
Double sum = 0D;
for (UserGroup userGroup : groupOfUser) {
sum = sum + getBalanceOfPersonInGroup(userGroup.getGroup().getGroupName(), userName);
}
return sum;
}
}
| 5,380 | 0.754647 | 0.752788 | 147 | 35.59864 | 27.766926 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.795918 | false | false | 13 |
be619be7259423f4a7d8b347827e7e1b1dccf204 | 3,006,477,126,990 | f64a18517bd0b6879bc16706447ef211173088be | /src/main/java/ir/sharif/math/ap98/hearthstone/characters/cards/Spell_Card.java | c39d09f42093f835915e178050d64b8b08c3ce15 | [] | no_license | alireza-shirzad/Hearthstone | https://github.com/alireza-shirzad/Hearthstone | 24adcc76fb5234f10c120e75e7bc1d4684f5a5e5 | 9b91428ee296e62059286cb652ec11678486e5fa | refs/heads/master | 2022-12-08T00:49:22.625000 | 2020-06-12T10:41:47 | 2020-06-12T10:41:47 | 269,919,306 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ir.sharif.math.ap98.hearthstone.characters.cards;
import ir.sharif.math.ap98.hearthstone.characters.heros.Hero;
public class Spell_Card extends Card {
public Spell_Card(String Name, Hero.Type heroClass,
RarityType rarity, int manaCost, String description, int goldCost) {
super(Name, Type.Spell, heroClass, rarity, manaCost, description, goldCost);
}
}
| UTF-8 | Java | 397 | java | Spell_Card.java | Java | [] | null | [] | package ir.sharif.math.ap98.hearthstone.characters.cards;
import ir.sharif.math.ap98.hearthstone.characters.heros.Hero;
public class Spell_Card extends Card {
public Spell_Card(String Name, Hero.Type heroClass,
RarityType rarity, int manaCost, String description, int goldCost) {
super(Name, Type.Spell, heroClass, rarity, manaCost, description, goldCost);
}
}
| 397 | 0.72796 | 0.717884 | 10 | 38.700001 | 33.148304 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false | 13 |
a67cb97f809b68c5da6fc0992df888b5c0747911 | 18,571,438,595,573 | 9d27838ee91c69ceedd5be9e33c019533a75c433 | /app/src/main/java/me/hekr/sthome/equipment/data/InstructionsHm.java | 818924e18d425162e55d56dc35c757a8e2b23d60 | [] | no_license | javofxu/FamilyWell-188 | https://github.com/javofxu/FamilyWell-188 | 7ee0e097b59d5143fd33c3ba80353a9b386c3494 | 1118e4114e7d0b917e3398ccb591ee9690046130 | refs/heads/master | 2021-07-16T12:17:02.611000 | 2020-11-24T03:41:24 | 2020-11-24T03:41:24 | 246,959,290 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.hekr.sthome.equipment.data;
import me.hekr.sthome.R;
/**
* @author skygge
* @date 2020-04-08.
* GitHub:javofxu@github.com
* email:skygge@yeah.net
* description:系统说明书
*/
public enum InstructionsHm {
GATEWAY("GS188A", R.string.gateway, R.mipmap.gs188,"GS188A User Manual_V2.01.pdf"),
CO_ALARM("GS816A", R.string.coalarm, R.mipmap.gs816,"GS816A CO Alarm User Manual_Ver01.01.pdf"),
THERMAL_ALARM("GS412A", R.string.thermalalarm, R.mipmap.gs412,"GS412A Heat Alarm User Manual_Ver01.01.pdf"),
WATER_ALARM("GS156A", R.string.wt, R.mipmap.gs156,"GS156A Wtater Alarm User Manual_Ver01.01.pdf"),
SX_SM_ALARM("GS559A", R.string.cxsmalarm, R.mipmap.gs592,"GS559A Photoelectric Smoke Alarm User Manual_Ver01.01.pdf"),
SX_SM_ALARM2("GS592A", R.string.cxsmalarm, R.mipmap.gs592,"GS559A Photoelectric Smoke Alarm User Manual_Ver01.01.pdf"),
PIR("GS300A", R.string.pir, R.mipmap.gs300d,"GS300A Motion Detector User Manual_Ver01.01.pdf"),
DOOR("GS320A", R.string.door, R.mipmap.gs320d,"GS320A Door Sensor User Manual_Ver01.01.pdf"),
SOS("GS390A", R.string.soskey, R.mipmap.gs390,"GS390A SOS Emergency Button User Manual_Ver01.01.pdf"),
OUTDOOR("GS380A", R.string.outdoor_siren, R.mipmap.gs380,"GS380A Outdoor Siren Manual_Ver01.00.pdf"),
PIC("GS290", R.string.camera, R.mipmap.gs290,"GS290A IP Camera User Manual_Ver01.01.pdf"),
LOCK("GS921A", R.string.lock, R.mipmap.gs920,"GS920A Door Lock User Manual_Ver01.01.pdf"),
SOCKET("GS350A", R.string.socket, R.mipmap.gs350,"GS350A Smart Socket User Manual_Ver01.01.pdf"),
BUTTON("GS585A", R.string.button, R.mipmap.gs585,"GS585A Custom Button User Manual_Ver01.00.pdf"),
MODE_BUTTON("GS584A", R.string.mode_button, R.mipmap.gs584,"GS584A Scene Switch Button User Manual_Ver01.00.pdf"),
HUMITURE("GS240A", R.string.thcheck, R.mipmap.gs240d,"GS240A Hygrothermograph User Manual_Ver01.00.pdf"),
THERMOSTAT("GS361A", R.string.temp_controler, R.mipmap.gs361,"GS361A Radiator Thermostat User Manual_Ver01.00.pdf");
private String model;
private int drawableRes;
private int productRes;
private String link;
InstructionsHm(String model, int product, int icon, String link) {
this.model = model;
this.productRes = product;
this.drawableRes = icon;
this.link = link;
}
public String getModel() {
return model;
}
public int getProductRes() {
return productRes;
}
public int getDrawableRes() {
return drawableRes;
}
public String getLink() {
return link;
}
}
| UTF-8 | Java | 2,626 | java | InstructionsHm.java | Java | [
{
"context": "nt.data;\n\nimport me.hekr.sthome.R;\n\n/**\n * @author skygge\n * @date 2020-04-08.\n * GitHub:javofxu@github.com",
"end": 87,
"score": 0.999659538269043,
"start": 81,
"tag": "USERNAME",
"value": "skygge"
},
{
"context": "\n * @author skygge\n * @date 2020-04-08.\n * GitHub:javofxu@github.com\n * email:skygge@yeah.net\n * description:系统说明书\n */",
"end": 137,
"score": 0.9999266266822815,
"start": 119,
"tag": "EMAIL",
"value": "javofxu@github.com"
},
{
"context": "2020-04-08.\n * GitHub:javofxu@github.com\n * email:skygge@yeah.net\n * description:系统说明书\n */\npublic enum Instructions",
"end": 162,
"score": 0.9999301433563232,
"start": 147,
"tag": "EMAIL",
"value": "skygge@yeah.net"
}
] | null | [] | package me.hekr.sthome.equipment.data;
import me.hekr.sthome.R;
/**
* @author skygge
* @date 2020-04-08.
* GitHub:<EMAIL>
* email:<EMAIL>
* description:系统说明书
*/
public enum InstructionsHm {
GATEWAY("GS188A", R.string.gateway, R.mipmap.gs188,"GS188A User Manual_V2.01.pdf"),
CO_ALARM("GS816A", R.string.coalarm, R.mipmap.gs816,"GS816A CO Alarm User Manual_Ver01.01.pdf"),
THERMAL_ALARM("GS412A", R.string.thermalalarm, R.mipmap.gs412,"GS412A Heat Alarm User Manual_Ver01.01.pdf"),
WATER_ALARM("GS156A", R.string.wt, R.mipmap.gs156,"GS156A Wtater Alarm User Manual_Ver01.01.pdf"),
SX_SM_ALARM("GS559A", R.string.cxsmalarm, R.mipmap.gs592,"GS559A Photoelectric Smoke Alarm User Manual_Ver01.01.pdf"),
SX_SM_ALARM2("GS592A", R.string.cxsmalarm, R.mipmap.gs592,"GS559A Photoelectric Smoke Alarm User Manual_Ver01.01.pdf"),
PIR("GS300A", R.string.pir, R.mipmap.gs300d,"GS300A Motion Detector User Manual_Ver01.01.pdf"),
DOOR("GS320A", R.string.door, R.mipmap.gs320d,"GS320A Door Sensor User Manual_Ver01.01.pdf"),
SOS("GS390A", R.string.soskey, R.mipmap.gs390,"GS390A SOS Emergency Button User Manual_Ver01.01.pdf"),
OUTDOOR("GS380A", R.string.outdoor_siren, R.mipmap.gs380,"GS380A Outdoor Siren Manual_Ver01.00.pdf"),
PIC("GS290", R.string.camera, R.mipmap.gs290,"GS290A IP Camera User Manual_Ver01.01.pdf"),
LOCK("GS921A", R.string.lock, R.mipmap.gs920,"GS920A Door Lock User Manual_Ver01.01.pdf"),
SOCKET("GS350A", R.string.socket, R.mipmap.gs350,"GS350A Smart Socket User Manual_Ver01.01.pdf"),
BUTTON("GS585A", R.string.button, R.mipmap.gs585,"GS585A Custom Button User Manual_Ver01.00.pdf"),
MODE_BUTTON("GS584A", R.string.mode_button, R.mipmap.gs584,"GS584A Scene Switch Button User Manual_Ver01.00.pdf"),
HUMITURE("GS240A", R.string.thcheck, R.mipmap.gs240d,"GS240A Hygrothermograph User Manual_Ver01.00.pdf"),
THERMOSTAT("GS361A", R.string.temp_controler, R.mipmap.gs361,"GS361A Radiator Thermostat User Manual_Ver01.00.pdf");
private String model;
private int drawableRes;
private int productRes;
private String link;
InstructionsHm(String model, int product, int icon, String link) {
this.model = model;
this.productRes = product;
this.drawableRes = icon;
this.link = link;
}
public String getModel() {
return model;
}
public int getProductRes() {
return productRes;
}
public int getDrawableRes() {
return drawableRes;
}
public String getLink() {
return link;
}
}
| 2,607 | 0.69272 | 0.604981 | 78 | 32.46154 | 40.971439 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.089744 | false | false | 13 |
fa2305ba863f6834fdd3d52bddc567fba83f5239 | 23,313,082,491,465 | 90d6dbf73b33f25382c43b75085c30578a646241 | /src/main/java/org/whispersystems/libaxolotl/j2me/jce/mac/BouncyMacSha256.java | d048b3bb77f1d9ec36263a6e7f6080e9ee39389e | [] | no_license | SeppPenner/libaxolotl-j2me | https://github.com/SeppPenner/libaxolotl-j2me | 5313f88dc96393a2c3a324903dacbbd650928500 | a6e25500e751233a7022f7be1185c042afe90668 | refs/heads/master | 2021-04-15T08:24:06.388000 | 2019-06-12T07:02:31 | 2019-06-12T07:02:31 | 126,365,983 | 1 | 1 | null | true | 2019-06-12T07:02:32 | 2018-03-22T16:42:34 | 2018-03-22T16:42:38 | 2019-06-12T07:02:32 | 202 | 1 | 0 | 0 | Java | false | false | package org.whispersystems.libaxolotl.j2me.jce.mac;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.macs.HMac;
import org.bouncycastle.crypto.params.KeyParameter;
public class BouncyMacSha256 implements Mac {
private final HMac mac;
public BouncyMacSha256(byte[] key) {
this.mac = new HMac(new SHA256Digest());
this.mac.init(new KeyParameter(key, 0, key.length));
}
public void update(byte[] input, int offset, int length) {
mac.update(input, offset, length);
}
public void update(byte b) {
mac.update(b);
}
public void doFinal(byte[] output, int offset) {
mac.doFinal(output, offset);
}
}
| UTF-8 | Java | 671 | java | BouncyMacSha256.java | Java | [] | null | [] | package org.whispersystems.libaxolotl.j2me.jce.mac;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.macs.HMac;
import org.bouncycastle.crypto.params.KeyParameter;
public class BouncyMacSha256 implements Mac {
private final HMac mac;
public BouncyMacSha256(byte[] key) {
this.mac = new HMac(new SHA256Digest());
this.mac.init(new KeyParameter(key, 0, key.length));
}
public void update(byte[] input, int offset, int length) {
mac.update(input, offset, length);
}
public void update(byte b) {
mac.update(b);
}
public void doFinal(byte[] output, int offset) {
mac.doFinal(output, offset);
}
}
| 671 | 0.718331 | 0.697466 | 27 | 23.851852 | 22.128754 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 13 |
d7eacaf243eff3ae6e4327baf11fe57413395716 | 3,917,010,179,202 | 7ec6223f9321affd1443a8a1be10078c418e5da7 | /src/main/jaxb/com/tibco/xmlns/applicationmanagement/Service.java | 60dd089b331895b7be0ebdded547d9a7aa593b17 | [
"Apache-2.0"
] | permissive | teecube/tic-bw5 | https://github.com/teecube/tic-bw5 | aafe81f22178ef3c45a23e4b8c25e94b5c13450c | f8729bdfb1fb00af88490051bb846582c2eb3dc5 | refs/heads/master | 2020-07-03T22:10:49.192000 | 2019-08-29T09:47:48 | 2019-08-29T09:47:48 | 74,227,813 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.04.16 at 02:58:23 PM CEST
//
package com.tibco.xmlns.applicationmanagement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <extension base="{http://www.tibco.com/xmlns/ApplicationManagement}ServiceType">
* <sequence>
* <element ref="{http://www.tibco.com/xmlns/ApplicationManagement}authentications" minOccurs="0"/>
* <element ref="{http://www.tibco.com/xmlns/ApplicationManagement}isFt" minOccurs="0"/>
* <element ref="{http://www.tibco.com/xmlns/ApplicationManagement}faultTolerant" minOccurs="0"/>
* <element ref="{http://www.tibco.com/xmlns/ApplicationManagement}plugins" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"authentications",
"isFt",
"faultTolerant",
"plugins"
})
public class Service
extends ServiceType
{
protected Authentications authentications;
protected Boolean isFt;
protected FaultTolerant faultTolerant;
protected Plugins plugins;
/**
* Gets the value of the authentications property.
*
* @return
* possible object is
* {@link Authentications }
*
*/
public Authentications getAuthentications() {
return authentications;
}
/**
* Sets the value of the authentications property.
*
* @param value
* allowed object is
* {@link Authentications }
*
*/
public void setAuthentications(Authentications value) {
this.authentications = value;
}
/**
* Gets the value of the isFt property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isIsFt() {
return isFt;
}
/**
* Sets the value of the isFt property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsFt(Boolean value) {
this.isFt = value;
}
/**
* Gets the value of the faultTolerant property.
*
* @return
* possible object is
* {@link FaultTolerant }
*
*/
public FaultTolerant getFaultTolerant() {
return faultTolerant;
}
/**
* Sets the value of the faultTolerant property.
*
* @param value
* allowed object is
* {@link FaultTolerant }
*
*/
public void setFaultTolerant(FaultTolerant value) {
this.faultTolerant = value;
}
/**
* Gets the value of the plugins property.
*
* @return
* possible object is
* {@link Plugins }
*
*/
public Plugins getPlugins() {
return plugins;
}
/**
* Sets the value of the plugins property.
*
* @param value
* allowed object is
* {@link Plugins }
*
*/
public void setPlugins(Plugins value) {
this.plugins = value;
}
}
| UTF-8 | Java | 3,737 | java | Service.java | Java | [] | null | [] | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.04.16 at 02:58:23 PM CEST
//
package com.tibco.xmlns.applicationmanagement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <extension base="{http://www.tibco.com/xmlns/ApplicationManagement}ServiceType">
* <sequence>
* <element ref="{http://www.tibco.com/xmlns/ApplicationManagement}authentications" minOccurs="0"/>
* <element ref="{http://www.tibco.com/xmlns/ApplicationManagement}isFt" minOccurs="0"/>
* <element ref="{http://www.tibco.com/xmlns/ApplicationManagement}faultTolerant" minOccurs="0"/>
* <element ref="{http://www.tibco.com/xmlns/ApplicationManagement}plugins" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"authentications",
"isFt",
"faultTolerant",
"plugins"
})
public class Service
extends ServiceType
{
protected Authentications authentications;
protected Boolean isFt;
protected FaultTolerant faultTolerant;
protected Plugins plugins;
/**
* Gets the value of the authentications property.
*
* @return
* possible object is
* {@link Authentications }
*
*/
public Authentications getAuthentications() {
return authentications;
}
/**
* Sets the value of the authentications property.
*
* @param value
* allowed object is
* {@link Authentications }
*
*/
public void setAuthentications(Authentications value) {
this.authentications = value;
}
/**
* Gets the value of the isFt property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isIsFt() {
return isFt;
}
/**
* Sets the value of the isFt property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsFt(Boolean value) {
this.isFt = value;
}
/**
* Gets the value of the faultTolerant property.
*
* @return
* possible object is
* {@link FaultTolerant }
*
*/
public FaultTolerant getFaultTolerant() {
return faultTolerant;
}
/**
* Sets the value of the faultTolerant property.
*
* @param value
* allowed object is
* {@link FaultTolerant }
*
*/
public void setFaultTolerant(FaultTolerant value) {
this.faultTolerant = value;
}
/**
* Gets the value of the plugins property.
*
* @return
* possible object is
* {@link Plugins }
*
*/
public Plugins getPlugins() {
return plugins;
}
/**
* Sets the value of the plugins property.
*
* @param value
* allowed object is
* {@link Plugins }
*
*/
public void setPlugins(Plugins value) {
this.plugins = value;
}
}
| 3,737 | 0.59513 | 0.589243 | 150 | 23.913334 | 24.875942 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false | 13 |
fbfa746e758f331ad06c05c6cf6ff79cb0ee6f72 | 6,682,969,125,944 | e61be1dc2ec8641d0aa5ba1a1e2f3ab569b5e7e3 | /src/main/java/com/tunjicus/bank/newsHistory/NewsHistoryRepository.java | f2fd5119d3aacb567bdab8ce6f432c4163042af4 | [] | no_license | tunjicus-banking/banking-backend | https://github.com/tunjicus-banking/banking-backend | 612a51e27134c587468d5794dc674181a128d94b | c8e687e3384aaab27bde40b6d793ed279a2ab808 | refs/heads/main | 2023-08-11T18:41:54.265000 | 2021-09-10T05:45:59 | 2021-09-10T05:45:59 | 396,634,134 | 0 | 0 | null | false | 2021-08-31T22:57:32 | 2021-08-16T05:28:55 | 2021-08-27T12:56:07 | 2021-08-31T22:57:31 | 166 | 0 | 0 | 0 | Java | false | false | package com.tunjicus.bank.newsHistory;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Optional;
public interface NewsHistoryRepository extends PagingAndSortingRepository<NewsHistory, Integer> {
Optional<NewsHistory> findTop1ByOrderByCreatedAtDesc();
}
| UTF-8 | Java | 359 | java | NewsHistoryRepository.java | Java | [] | null | [] | package com.tunjicus.bank.newsHistory;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Optional;
public interface NewsHistoryRepository extends PagingAndSortingRepository<NewsHistory, Integer> {
Optional<NewsHistory> findTop1ByOrderByCreatedAtDesc();
}
| 359 | 0.855153 | 0.852368 | 10 | 34.900002 | 33.30901 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 13 |
137aa496fbdd31a5d976d73bdf012dc0bebba053 | 31,602,369,374,043 | ee25ee1ae47ba143586da1d165ee01c9f7c15c3e | /src/main/java/com/spare/cointrade/util/AkkaContext.java | 0ae8c020a0fbbb4f4ca9b5c885409d1dff7b73f1 | [
"Apache-2.0"
] | permissive | zhangda7/cointrade | https://github.com/zhangda7/cointrade | 80ca4542834927af05eef70295627a105e0ca218 | b9a910067424d802722be48fa8cab196d5912993 | refs/heads/master | 2021-01-20T08:24:40.286000 | 2017-09-25T15:09:22 | 2017-09-25T15:09:22 | 101,556,257 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.spare.cointrade.util;
import akka.actor.ActorSystem;
/**
* Created by dada on 2017/8/20.
*/
public class AkkaContext {
private static final ActorSystem system = ActorSystem.create("rootSystem");
public static ActorSystem getSystem() {
return system;
}
}
| UTF-8 | Java | 292 | java | AkkaContext.java | Java | [
{
"context": "\nimport akka.actor.ActorSystem;\n\n/**\n * Created by dada on 2017/8/20.\n */\npublic class AkkaContext {\n\n ",
"end": 89,
"score": 0.9967308044433594,
"start": 85,
"tag": "USERNAME",
"value": "dada"
}
] | null | [] | package com.spare.cointrade.util;
import akka.actor.ActorSystem;
/**
* Created by dada on 2017/8/20.
*/
public class AkkaContext {
private static final ActorSystem system = ActorSystem.create("rootSystem");
public static ActorSystem getSystem() {
return system;
}
}
| 292 | 0.69863 | 0.674658 | 15 | 18.466667 | 21.896322 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false | 13 |
6df4c975c854a8473e0ccc4ce98ce7ae3686ccc3 | 6,708,738,937,087 | dc03a16620e63f274ce4a9f8feedaf2507c65018 | /app/src/main/java/com/tronpc/audiorecorder/MainActivity.java | 5422de9271b3273d38528b6ece7f5f3f13eb805c | [] | no_license | nsharmahack3r/Audio_Recorder | https://github.com/nsharmahack3r/Audio_Recorder | e788e6abfe405457494a2f74fbbdfb52b00ea1f6 | d50cecbf0d1ce06f42077a3fd68645396adc5ca5 | refs/heads/master | 2023-01-20T23:30:20.890000 | 2020-12-04T16:23:49 | 2020-12-04T16:23:49 | 318,571,924 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tronpc.audiorecorder;
import android.graphics.Color;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.tronpc.audiorecorder.ui.main.SectionsPagerAdapter;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager());
ViewPager viewPager = findViewById(R.id.view_pager);
viewPager.setAdapter(sectionsPagerAdapter);
TabLayout tabs = findViewById(R.id.tabs);
tabs.setupWithViewPager(viewPager);
tabs.setSelectedTabIndicatorColor(Color.parseColor("#FFFFFF"));
tabs.setTabTextColors(Color.parseColor("#DBDBDB"), Color.parseColor("#ffffff"));
}
} | UTF-8 | Java | 1,461 | java | MainActivity.java | Java | [] | null | [] | package com.tronpc.audiorecorder;
import android.graphics.Color;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.tronpc.audiorecorder.ui.main.SectionsPagerAdapter;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(this, getSupportFragmentManager());
ViewPager viewPager = findViewById(R.id.view_pager);
viewPager.setAdapter(sectionsPagerAdapter);
TabLayout tabs = findViewById(R.id.tabs);
tabs.setupWithViewPager(viewPager);
tabs.setSelectedTabIndicatorColor(Color.parseColor("#FFFFFF"));
tabs.setTabTextColors(Color.parseColor("#DBDBDB"), Color.parseColor("#ffffff"));
}
} | 1,461 | 0.787132 | 0.78371 | 44 | 32.227272 | 26.65509 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.704545 | false | false | 13 |
7ec35593d7318fb5f30f4b8c1644382d58279210 | 2,207,613,240,125 | 67016dcb0fc4175058ff8f234efb1cf6dbddccae | /app/src/androidTest/java/com/example/artsell/SignupActivityTest.java | 0f97ba0dc02ef780daa716e7adb19478a399f84e | [] | no_license | siam397/uni-project-java | https://github.com/siam397/uni-project-java | 4b969c8c5c6bdd7d465f9231e9d3280d14341c2b | 7e6c11626909f38cf5932b246b3e01250e2a1392 | refs/heads/master | 2023-06-26T03:48:46.329000 | 2021-07-27T08:13:11 | 2021-07-27T08:13:11 | 325,609,166 | 1 | 0 | null | false | 2021-07-27T05:58:08 | 2020-12-30T17:26:39 | 2021-07-27T05:51:17 | 2021-07-27T05:58:07 | 5,128 | 0 | 0 | 0 | Java | false | false | package com.example.artsell;
import android.app.Activity;
import android.app.Instrumentation;
import android.view.View;
import androidx.test.espresso.Espresso;
import androidx.test.rule.ActivityTestRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.*;
public class SignupActivityTest {
@Rule
public ActivityTestRule<SignupActivity> signupActivityActivityTestRule=new ActivityTestRule<SignupActivity>(SignupActivity.class);
private SignupActivity signupActivity=null;
Instrumentation.ActivityMonitor monitor=getInstrumentation().addMonitor(LandingPageActivity.class.getName(),null,false);
Instrumentation.ActivityMonitor monitor1=getInstrumentation().addMonitor(LoginActivity.class.getName(),null,false);
@Before
public void setUp() throws Exception {
signupActivity=signupActivityActivityTestRule.getActivity();
}
@Test
public void testSignUp() throws InterruptedException {
String[] arr={"mofiz","cj","hornet","ghost","ori","tommy","trevor"};
for (int i=0;i<arr.length;i++){
onView(withId(R.id.username)).perform(typeText(arr[i]));
Espresso.closeSoftKeyboard();
onView(withId(R.id.email)).perform(typeText(arr[i]+"@"+arr[i]+".com"));
Espresso.closeSoftKeyboard();
onView(withId(R.id.password)).perform(typeText(arr[i]));
Espresso.closeSoftKeyboard();
onView(withId(R.id.signupbtn)).perform(click());
Activity landing=getInstrumentation().waitForMonitorWithTimeout(monitor,5000);
onView(withId(R.id.profile)).perform(click());
onView(withId(R.id.logout)).perform(click());
TimeUnit.SECONDS.sleep(5);
Activity landing1=getInstrumentation().waitForMonitorWithTimeout(monitor1,5000);
onView(withId(R.id.GoToSignUp)).perform(click());
TimeUnit.SECONDS.sleep(5);
}
// assertNotNull(landing);
}
@After
public void tearDown() throws Exception {
signupActivity=null;
}
} | UTF-8 | Java | 2,496 | java | SignupActivityTest.java | Java | [
{
"context": "ows InterruptedException {\n String[] arr={\"mofiz\",\"cj\",\"hornet\",\"ghost\",\"ori\",\"tommy\",\"trevor\"};\n ",
"end": 1413,
"score": 0.7653964161872864,
"start": 1408,
"tag": "USERNAME",
"value": "mofiz"
},
{
"context": "rruptedException {\n String[] arr={\"mofiz\",\"cj\",\"hornet\",\"ghost\",\"ori\",\"tommy\",\"trevor\"};\n ",
"end": 1418,
"score": 0.707739531993866,
"start": 1416,
"tag": "USERNAME",
"value": "cj"
},
{
"context": "edException {\n String[] arr={\"mofiz\",\"cj\",\"hornet\",\"ghost\",\"ori\",\"tommy\",\"trevor\"};\n for (in",
"end": 1427,
"score": 0.5966058969497681,
"start": 1421,
"tag": "NAME",
"value": "hornet"
},
{
"context": "on {\n String[] arr={\"mofiz\",\"cj\",\"hornet\",\"ghost\",\"ori\",\"tommy\",\"trevor\"};\n for (int i=0;i<",
"end": 1435,
"score": 0.8443082571029663,
"start": 1430,
"tag": "USERNAME",
"value": "ghost"
},
{
"context": " String[] arr={\"mofiz\",\"cj\",\"hornet\",\"ghost\",\"ori\",\"tommy\",\"trevor\"};\n for (int i=0;i<arr.le",
"end": 1441,
"score": 0.7338127493858337,
"start": 1438,
"tag": "USERNAME",
"value": "ori"
},
{
"context": "tring[] arr={\"mofiz\",\"cj\",\"hornet\",\"ghost\",\"ori\",\"tommy\",\"trevor\"};\n for (int i=0;i<arr.length;i++",
"end": 1449,
"score": 0.9028146266937256,
"start": 1444,
"tag": "NAME",
"value": "tommy"
},
{
"context": "arr={\"mofiz\",\"cj\",\"hornet\",\"ghost\",\"ori\",\"tommy\",\"trevor\"};\n for (int i=0;i<arr.length;i++){\n ",
"end": 1458,
"score": 0.8818701505661011,
"start": 1452,
"tag": "NAME",
"value": "trevor"
}
] | null | [] | package com.example.artsell;
import android.app.Activity;
import android.app.Instrumentation;
import android.view.View;
import androidx.test.espresso.Espresso;
import androidx.test.rule.ActivityTestRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.typeText;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.*;
public class SignupActivityTest {
@Rule
public ActivityTestRule<SignupActivity> signupActivityActivityTestRule=new ActivityTestRule<SignupActivity>(SignupActivity.class);
private SignupActivity signupActivity=null;
Instrumentation.ActivityMonitor monitor=getInstrumentation().addMonitor(LandingPageActivity.class.getName(),null,false);
Instrumentation.ActivityMonitor monitor1=getInstrumentation().addMonitor(LoginActivity.class.getName(),null,false);
@Before
public void setUp() throws Exception {
signupActivity=signupActivityActivityTestRule.getActivity();
}
@Test
public void testSignUp() throws InterruptedException {
String[] arr={"mofiz","cj","hornet","ghost","ori","tommy","trevor"};
for (int i=0;i<arr.length;i++){
onView(withId(R.id.username)).perform(typeText(arr[i]));
Espresso.closeSoftKeyboard();
onView(withId(R.id.email)).perform(typeText(arr[i]+"@"+arr[i]+".com"));
Espresso.closeSoftKeyboard();
onView(withId(R.id.password)).perform(typeText(arr[i]));
Espresso.closeSoftKeyboard();
onView(withId(R.id.signupbtn)).perform(click());
Activity landing=getInstrumentation().waitForMonitorWithTimeout(monitor,5000);
onView(withId(R.id.profile)).perform(click());
onView(withId(R.id.logout)).perform(click());
TimeUnit.SECONDS.sleep(5);
Activity landing1=getInstrumentation().waitForMonitorWithTimeout(monitor1,5000);
onView(withId(R.id.GoToSignUp)).perform(click());
TimeUnit.SECONDS.sleep(5);
}
// assertNotNull(landing);
}
@After
public void tearDown() throws Exception {
signupActivity=null;
}
} | 2,496 | 0.71875 | 0.713141 | 63 | 38.634922 | 32.436653 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.84127 | false | false | 13 |
0822907bc0e616d2eb51094877d1ea0e843ea766 | 498,216,240,883 | fee07509619ca10be0b08059720886f9a1f2048d | /bdnav-provider-feign/appburied-provider-feign/src/main/java/com/bdxh/appburied/fallback/ApplyLogControllerClientFallback.java | 63b7faaea9499f684f8b59c234ffd93d3d2a74f9 | [
"Apache-2.0"
] | permissive | jiageh08/tea-springboot | https://github.com/jiageh08/tea-springboot | 70a68c7518f2470268ad8fa03ea7dfa48dff948c | 91892209a70b93e90eaee0a01a4f71e188f4a61a | refs/heads/master | 2022-12-05T13:10:06.654000 | 2020-08-07T01:29:56 | 2020-08-07T01:29:56 | 285,574,085 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bdxh.appburied.fallback;
import com.bdxh.appburied.dto.AddApplyLogDto;
import com.bdxh.appburied.dto.ApplyLogQueryDto;
import com.bdxh.appburied.dto.DelOrFindAppBuriedDto;
import com.bdxh.appburied.dto.ModifyApplyLogDto;
import com.bdxh.appburied.entity.AppStatus;
import com.bdxh.appburied.entity.ApplyLog;
import com.bdxh.appburied.feign.ApplyLogControllerClient;
import com.bdxh.common.utils.wrapper.WrapMapper;
import com.bdxh.common.utils.wrapper.Wrapper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description: 控制器
* @Author Kang
* @Date 2019-04-11 16:39:55
*/
@Component
public class ApplyLogControllerClientFallback implements ApplyLogControllerClient {
@Override
public Wrapper addApplyLog(AddApplyLogDto addApplyLogDto) {
return WrapMapper.error();
}
@Override
public Wrapper modifyApplyLog(ModifyApplyLogDto modifyApplyLogDto) {
return WrapMapper.error();
}
@Override
public Wrapper delApplyLogById(DelOrFindAppBuriedDto AddapplyLogDto) {
return WrapMapper.error();
}
@Override
public Wrapper<ApplyLog> findApplyLogById(DelOrFindAppBuriedDto findApplyLogDto) {
return WrapMapper.error();
}
@Override
public Wrapper<PageInfo<ApplyLog>> findApplyLogInContionPaging(ApplyLogQueryDto applyLogQueryDto) {
return WrapMapper.error();
}
@Override
public Wrapper<List<ApplyLog>> familyFindApplyLogInfo(String schoolCode, String cardNumber) {
return WrapMapper.error();
}
@Override
public Wrapper modifyVerifyApplyLog(ModifyApplyLogDto modifyApplyLogDto) {
return WrapMapper.error();
}
} | UTF-8 | Java | 1,735 | java | ApplyLogControllerClientFallback.java | Java | [
{
"context": "a.util.List;\n\n\n/**\n * @Description: 控制器\n * @Author Kang\n * @Date 2019-04-11 16:39:55\n */\n@Component\npubli",
"end": 628,
"score": 0.9872508645057678,
"start": 624,
"tag": "NAME",
"value": "Kang"
}
] | null | [] | package com.bdxh.appburied.fallback;
import com.bdxh.appburied.dto.AddApplyLogDto;
import com.bdxh.appburied.dto.ApplyLogQueryDto;
import com.bdxh.appburied.dto.DelOrFindAppBuriedDto;
import com.bdxh.appburied.dto.ModifyApplyLogDto;
import com.bdxh.appburied.entity.AppStatus;
import com.bdxh.appburied.entity.ApplyLog;
import com.bdxh.appburied.feign.ApplyLogControllerClient;
import com.bdxh.common.utils.wrapper.WrapMapper;
import com.bdxh.common.utils.wrapper.Wrapper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Description: 控制器
* @Author Kang
* @Date 2019-04-11 16:39:55
*/
@Component
public class ApplyLogControllerClientFallback implements ApplyLogControllerClient {
@Override
public Wrapper addApplyLog(AddApplyLogDto addApplyLogDto) {
return WrapMapper.error();
}
@Override
public Wrapper modifyApplyLog(ModifyApplyLogDto modifyApplyLogDto) {
return WrapMapper.error();
}
@Override
public Wrapper delApplyLogById(DelOrFindAppBuriedDto AddapplyLogDto) {
return WrapMapper.error();
}
@Override
public Wrapper<ApplyLog> findApplyLogById(DelOrFindAppBuriedDto findApplyLogDto) {
return WrapMapper.error();
}
@Override
public Wrapper<PageInfo<ApplyLog>> findApplyLogInContionPaging(ApplyLogQueryDto applyLogQueryDto) {
return WrapMapper.error();
}
@Override
public Wrapper<List<ApplyLog>> familyFindApplyLogInfo(String schoolCode, String cardNumber) {
return WrapMapper.error();
}
@Override
public Wrapper modifyVerifyApplyLog(ModifyApplyLogDto modifyApplyLogDto) {
return WrapMapper.error();
}
} | 1,735 | 0.757663 | 0.749566 | 59 | 28.322035 | 27.503122 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.355932 | false | false | 13 |
a7402355b3009bffb7753b5d5ae46e8a1f704cdb | 128,849,040,757 | 2793a7b04bda89582bd470c990e93e05066efead | /jpl/test/ch10/ex02/SpecialCharTest.java | fa823bea779ab312237e26ff1bf338274ff0277a | [] | no_license | hiroki-yoneda/JavaTraining | https://github.com/hiroki-yoneda/JavaTraining | ab5006ff930135421b7670fcdad8664e3a227cf6 | 7f7b1ebbc17b87053bae32b24705f8ef634f38c5 | refs/heads/master | 2021-06-25T07:56:09.537000 | 2021-02-19T05:24:33 | 2021-02-19T05:24:33 | 199,353,793 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jpl.ch10.ex02;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Test;
public class SpecialCharTest {
@Test
public void CheckSpecialChar() {
ChangeToSpecialChar changeToSpecialChar = new ChangeToSpecialChar();
assertThat(changeToSpecialChar.Change("\n"), is("\\n"));
assertThat(changeToSpecialChar.Change("\t"), is("\\t"));
}
}
| UTF-8 | Java | 392 | java | SpecialCharTest.java | Java | [] | null | [] | package jpl.ch10.ex02;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Test;
public class SpecialCharTest {
@Test
public void CheckSpecialChar() {
ChangeToSpecialChar changeToSpecialChar = new ChangeToSpecialChar();
assertThat(changeToSpecialChar.Change("\n"), is("\\n"));
assertThat(changeToSpecialChar.Change("\t"), is("\\t"));
}
}
| 392 | 0.742347 | 0.732143 | 15 | 25.133333 | 23.0994 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | false | false | 13 |
7c9776f85f1f15f0fb707e49a88af6fd00b945e9 | 128,849,039,966 | 56df5cd94bbd230bfcfa0a2b35db024db10fba15 | /src/main/java/com/jafernandez/nasaapp/providers/NasaProvider.java | 148769d5c24486c9b689e06122cfbe2c2b3f230f | [] | no_license | 9julio/nasa-app | https://github.com/9julio/nasa-app | debcb695e78a7254786a2a10ff33d9be4040e8fa | c8f66c73b2edf90372c292842f76ccfb94144e38 | refs/heads/master | 2023-08-10T15:04:34.173000 | 2021-09-15T16:37:29 | 2021-09-15T16:37:29 | 406,716,493 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jafernandez.nasaapp.providers;
import com.jafernandez.nasaapp.models.responses.Asteroid;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpStatus;
import org.apache.http.client.utils.URIBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service
public class NasaProvider {
public Asteroid getAsteroids(String startDate, String endDate) {
try {
URIBuilder uriBuilder = new URIBuilder("https://api.nasa.gov/neo/rest/v1/feed");
uriBuilder.addParameter("start_date", startDate);
uriBuilder.addParameter("end_date", endDate);
uriBuilder.addParameter("api_key", "hOMBln4aaqylauUuMn2g5cD5heGAqsAasf43LZwr");
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> result = restTemplate.getForEntity(uriBuilder.build(), String.class);
if (result != null && HttpStatus.SC_OK == result.getStatusCode().value()) {
return new ObjectMapper().readValue(result.getBody(), Asteroid.class);
} else {
return null;
}
} catch (Exception e) {
// Print a log message
return null;
}
}
}
| UTF-8 | Java | 1,330 | java | NasaProvider.java | Java | [
{
"context": ";\n uriBuilder.addParameter(\"api_key\", \"hOMBln4aaqylauUuMn2g5cD5heGAqsAasf43LZwr\");\n\n RestTemplate restTemplate = new R",
"end": 809,
"score": 0.9997753500938416,
"start": 769,
"tag": "KEY",
"value": "hOMBln4aaqylauUuMn2g5cD5heGAqsAasf43LZwr"
}
] | null | [] | package com.jafernandez.nasaapp.providers;
import com.jafernandez.nasaapp.models.responses.Asteroid;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpStatus;
import org.apache.http.client.utils.URIBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service
public class NasaProvider {
public Asteroid getAsteroids(String startDate, String endDate) {
try {
URIBuilder uriBuilder = new URIBuilder("https://api.nasa.gov/neo/rest/v1/feed");
uriBuilder.addParameter("start_date", startDate);
uriBuilder.addParameter("end_date", endDate);
uriBuilder.addParameter("api_key", "<KEY>");
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> result = restTemplate.getForEntity(uriBuilder.build(), String.class);
if (result != null && HttpStatus.SC_OK == result.getStatusCode().value()) {
return new ObjectMapper().readValue(result.getBody(), Asteroid.class);
} else {
return null;
}
} catch (Exception e) {
// Print a log message
return null;
}
}
}
| 1,295 | 0.674436 | 0.669173 | 37 | 34.945946 | 30.947161 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.621622 | false | false | 13 |
304802c4081b62bf4a5ed5604fc2a9131ecfba58 | 3,496,103,399,000 | 4d008ea5cae15a2971228ff8bddb2a251288ce0c | /main/java/ghostwolf/steampunkrevolution/fluids/FluidSteam.java | 27588916ee82f57dc656d4231276daecb9530948 | [] | no_license | theredghostwolf/SteampunkRevolution | https://github.com/theredghostwolf/SteampunkRevolution | 7b3d9370f280cc764c90d889becea993a28216e4 | d2bea706030a46442e315b2845b867fc73ad41f1 | refs/heads/master | 2021-05-06T03:22:17.351000 | 2018-02-23T18:17:17 | 2018-02-23T18:17:17 | 114,894,706 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ghostwolf.steampunkrevolution.fluids;
import java.awt.Color;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
public class FluidSteam extends Fluid {
public FluidSteam() {
super("steam", new ResourceLocation("minecraft:blocks/lava_still"), new ResourceLocation("minecraft:blocks/lava_flow"), Color.WHITE);
}
}
| UTF-8 | Java | 363 | java | FluidSteam.java | Java | [] | null | [] | package ghostwolf.steampunkrevolution.fluids;
import java.awt.Color;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
public class FluidSteam extends Fluid {
public FluidSteam() {
super("steam", new ResourceLocation("minecraft:blocks/lava_still"), new ResourceLocation("minecraft:blocks/lava_flow"), Color.WHITE);
}
}
| 363 | 0.785124 | 0.785124 | 15 | 23.200001 | 34.679871 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 13 |
b80f4f81bfbf4a16c76fe884b4ea62e801110370 | 15,573,551,446,389 | a3ca3003ee87901e6e0b225a3b33db1d0751f70a | /app/src/main/java/day02/l/example/com/everywheretrip/trip/view/main/CollectionView.java | 37711ed8d0594afc4e03564f65c25d3ce64d11db | [] | no_license | xiaomidic/travels | https://github.com/xiaomidic/travels | c074d691e51cfcbe5782873509d58817ffb56685 | 811fec4bae9a72862cbf0fd095960e510f679195 | refs/heads/master | 2020-05-24T01:06:04.257000 | 2019-05-16T13:06:23 | 2019-05-16T13:06:23 | 187,028,991 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package day02.l.example.com.everywheretrip.trip.view.main;
import day02.l.example.com.everywheretrip.trip.base.BaseMvpView;
import day02.l.example.com.everywheretrip.trip.bean.CollectionBean;
public interface CollectionView extends BaseMvpView{
void setData(CollectionBean collectionBean);
}
| UTF-8 | Java | 300 | java | CollectionView.java | Java | [] | null | [] | package day02.l.example.com.everywheretrip.trip.view.main;
import day02.l.example.com.everywheretrip.trip.base.BaseMvpView;
import day02.l.example.com.everywheretrip.trip.bean.CollectionBean;
public interface CollectionView extends BaseMvpView{
void setData(CollectionBean collectionBean);
}
| 300 | 0.826667 | 0.806667 | 10 | 29 | 29.236963 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 13 |
5795ff67a70f16721d1a71c48fea85e29d2f5b2f | 2,680,059,633,732 | e32d90708030751acdffa1e3964a7b619f8ed5b8 | /app/src/main/java/com/example/admin/todolist/ToDoAdapter.java | 2f91e0a3d7eb1571e0e047f670c818b4ca967bd7 | [] | no_license | avantika16014/ToDoList | https://github.com/avantika16014/ToDoList | 19bc3eb9d208fb3d2b8f64c478cba0b5045e4ed1 | 1ebb648282d3ed3dfe895a640ec893baa89fe4fb | refs/heads/master | 2020-12-24T10:31:08.788000 | 2016-11-08T05:13:23 | 2016-11-08T05:13:23 | 73,151,487 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.admin.todolist;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.ImageButton;
import android.widget.Toast;
import java.util.ArrayList;
/**
* Created by Admin on 11/3/2016.
*/
public class ToDoAdapter extends RecyclerView.Adapter<ToDoAdapter.ToDoHolder>{
private ArrayList<ListItem> listData;
private LayoutInflater layoutInflater;
public static final String TAG = "TODO";
Context context;
DBHelper myDb;
public ToDoAdapter(ArrayList<ListItem> listData, Context context) {
this.context = context;
this.layoutInflater = LayoutInflater.from(context);
this.listData = listData;
}
@Override
public ToDoAdapter.ToDoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = layoutInflater.inflate(R.layout.list_item, parent, false);
Log.d(TAG, "onCreateViewHolder: ");
return new ToDoHolder(view);
}
@Override
public void onBindViewHolder(ToDoHolder holder, final int position) {
myDb=new DBHelper(context);
final ListItem item = listData.get(position);
holder.item_name.setText(item.getItem_name());
holder.item_desc.setText(item.getDesc());
holder.deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(myDb.deleteEntry(item.getItem_name()))
{
Toast.makeText(context,"Item Deleted!",Toast.LENGTH_SHORT).show();
listData.remove(position);
notifyDataSetChanged();
}
}
});
Log.d(TAG, "onBindViewHolder: " + position);
}
@Override
public int getItemCount() {
return listData.size();
}
public class ToDoHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private TextView item_name;
private TextView item_desc;
private ImageButton deleteButton;
private View container;
public ToDoHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
item_name = (TextView) itemView.findViewById(R.id.list_item_title_text_view);
item_desc = (TextView) itemView.findViewById(R.id.list_item_desc_text_view);
deleteButton=(ImageButton)itemView.findViewById(R.id.delete_todo);
container = itemView.findViewById(R.id.cont_item_root);
container.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position=getLayoutPosition();
Intent intent = new Intent(context, ViewPagerActivity.class);
Bundle data=new Bundle();
data.putParcelableArrayList("listdata", listData);
data.putInt("position",position);
intent.putExtras(data);
context.startActivity(intent);
}
});
}
@Override
public void onClick(View v) {
}
}
}
| UTF-8 | Java | 3,398 | java | ToDoAdapter.java | Java | [
{
"context": "st;\nimport java.util.ArrayList;\n\n/**\n * Created by Admin on 11/3/2016.\n */\n\npublic class ToDoAdapter exten",
"end": 439,
"score": 0.7622005343437195,
"start": 434,
"tag": "USERNAME",
"value": "Admin"
}
] | null | [] | package com.example.admin.todolist;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.ImageButton;
import android.widget.Toast;
import java.util.ArrayList;
/**
* Created by Admin on 11/3/2016.
*/
public class ToDoAdapter extends RecyclerView.Adapter<ToDoAdapter.ToDoHolder>{
private ArrayList<ListItem> listData;
private LayoutInflater layoutInflater;
public static final String TAG = "TODO";
Context context;
DBHelper myDb;
public ToDoAdapter(ArrayList<ListItem> listData, Context context) {
this.context = context;
this.layoutInflater = LayoutInflater.from(context);
this.listData = listData;
}
@Override
public ToDoAdapter.ToDoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = layoutInflater.inflate(R.layout.list_item, parent, false);
Log.d(TAG, "onCreateViewHolder: ");
return new ToDoHolder(view);
}
@Override
public void onBindViewHolder(ToDoHolder holder, final int position) {
myDb=new DBHelper(context);
final ListItem item = listData.get(position);
holder.item_name.setText(item.getItem_name());
holder.item_desc.setText(item.getDesc());
holder.deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(myDb.deleteEntry(item.getItem_name()))
{
Toast.makeText(context,"Item Deleted!",Toast.LENGTH_SHORT).show();
listData.remove(position);
notifyDataSetChanged();
}
}
});
Log.d(TAG, "onBindViewHolder: " + position);
}
@Override
public int getItemCount() {
return listData.size();
}
public class ToDoHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private TextView item_name;
private TextView item_desc;
private ImageButton deleteButton;
private View container;
public ToDoHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
item_name = (TextView) itemView.findViewById(R.id.list_item_title_text_view);
item_desc = (TextView) itemView.findViewById(R.id.list_item_desc_text_view);
deleteButton=(ImageButton)itemView.findViewById(R.id.delete_todo);
container = itemView.findViewById(R.id.cont_item_root);
container.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position=getLayoutPosition();
Intent intent = new Intent(context, ViewPagerActivity.class);
Bundle data=new Bundle();
data.putParcelableArrayList("listdata", listData);
data.putInt("position",position);
intent.putExtras(data);
context.startActivity(intent);
}
});
}
@Override
public void onClick(View v) {
}
}
}
| 3,398 | 0.631842 | 0.629488 | 97 | 34.03093 | 25.270681 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.659794 | false | false | 13 |
2fb7c8f74df58edb1ec26b57640c8c898eb378ce | 12,790,412,627,301 | dfcb99fd9feb71da35182811ed5f32bf69cd2bbf | /src/templates/driver-template/src/main/java/com/example/driver/template/pattern/TemplateDriverPattern.java | b362878ef8ed79edfcec3cf53f8f4f64c996e6af | [
"Apache-2.0"
] | permissive | ogema/ogema-widgets | https://github.com/ogema/ogema-widgets | 99d544d0ec6aebf68fd846fe2c08f5ac5dee7790 | 3adac6461c52555a42a4f1837267380adce293fb | refs/heads/public | 2022-11-29T21:33:14.704000 | 2019-12-09T08:25:41 | 2019-12-09T08:25:41 | 124,270,200 | 0 | 1 | Apache-2.0 | false | 2022-11-16T06:25:46 | 2018-03-07T17:23:28 | 2019-12-09T08:25:57 | 2022-11-16T06:25:42 | 17,378 | 0 | 2 | 13 | JavaScript | false | false | /**
* This file is part of the OGEMA widgets framework.
*
* OGEMA 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.
*
* OGEMA 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 OGEMA. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2014 - 2016
*
* Fraunhofer-Gesellschaft zur Förderung der angewandten Wissenschaften e.V.
*
* Fraunhofer IWES/Fraunhofer IEE
*/
package com.example.driver.template.pattern;
import org.ogema.core.model.Resource;
import org.ogema.core.model.simple.BooleanResource;
import org.ogema.core.model.simple.FloatResource;
import org.ogema.core.model.simple.TimeResource;
import org.ogema.core.resourcemanager.pattern.ResourcePattern;
import org.ogema.model.communication.DeviceAddress;
import org.ogema.model.communication.IPAddressV4;
import com.example.driver.template.drivermodel.TemplateDriverModel;
public class TemplateDriverPattern extends ResourcePattern<TemplateDriverModel> {
public final DeviceAddress address = model.comAddress();
/**
* TODO this is an example for drivers based on IP communication; adapt to your needs
*/
@Existence(required=CreateMode.OPTIONAL)
public final IPAddressV4 ipAddress = address.ipV4Address();
public final FloatResource value = model.value();
/**
* If the resource does not exist, we assume the data point not to be writeable
*/
@Existence(required=CreateMode.OPTIONAL)
public final BooleanResource writeable = address.writeable();
/**
* If the resource does not exist, we assume the data point not to be readable
*/
@Existence(required=CreateMode.OPTIONAL)
public final BooleanResource readable = address.readable();
@Existence(required=CreateMode.OPTIONAL)
public final TimeResource pollingInterval = model.pollingConfiguration().pollingInterval();
/**
* Constructor for the access pattern. This constructor is invoked by the framework. Must be public.
*/
public TemplateDriverPattern(Resource device) {
super(device);
}
}
| UTF-8 | Java | 2,351 | java | TemplateDriverPattern.java | Java | [] | null | [] | /**
* This file is part of the OGEMA widgets framework.
*
* OGEMA 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.
*
* OGEMA 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 OGEMA. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2014 - 2016
*
* Fraunhofer-Gesellschaft zur Förderung der angewandten Wissenschaften e.V.
*
* Fraunhofer IWES/Fraunhofer IEE
*/
package com.example.driver.template.pattern;
import org.ogema.core.model.Resource;
import org.ogema.core.model.simple.BooleanResource;
import org.ogema.core.model.simple.FloatResource;
import org.ogema.core.model.simple.TimeResource;
import org.ogema.core.resourcemanager.pattern.ResourcePattern;
import org.ogema.model.communication.DeviceAddress;
import org.ogema.model.communication.IPAddressV4;
import com.example.driver.template.drivermodel.TemplateDriverModel;
public class TemplateDriverPattern extends ResourcePattern<TemplateDriverModel> {
public final DeviceAddress address = model.comAddress();
/**
* TODO this is an example for drivers based on IP communication; adapt to your needs
*/
@Existence(required=CreateMode.OPTIONAL)
public final IPAddressV4 ipAddress = address.ipV4Address();
public final FloatResource value = model.value();
/**
* If the resource does not exist, we assume the data point not to be writeable
*/
@Existence(required=CreateMode.OPTIONAL)
public final BooleanResource writeable = address.writeable();
/**
* If the resource does not exist, we assume the data point not to be readable
*/
@Existence(required=CreateMode.OPTIONAL)
public final BooleanResource readable = address.readable();
@Existence(required=CreateMode.OPTIONAL)
public final TimeResource pollingInterval = model.pollingConfiguration().pollingInterval();
/**
* Constructor for the access pattern. This constructor is invoked by the framework. Must be public.
*/
public TemplateDriverPattern(Resource device) {
super(device);
}
}
| 2,351 | 0.771489 | 0.766383 | 68 | 33.558823 | 30.298216 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.794118 | false | false | 13 |
9e7bf2ff62e0d3f41079b9538e53ddee39cd2d7b | 5,299,989,693,275 | b09f510ab63ae01b1108c956e9a6ee31d704ec36 | /jd1-les03-ex3/src/by/htp/les03/logic/Task34.java | 0b27c68ed9d07d9ca391f4e3d177e613f034f7ca | [] | no_license | crrromartie/Task_01_logic | https://github.com/crrromartie/Task_01_logic | fd1a5f50317c0decf569fef1761cc5b6850d6c02 | cb033d1622085f931d585673b2b05fdf027bb028 | refs/heads/master | 2022-07-09T01:55:47.236000 | 2020-05-17T11:17:01 | 2020-05-17T11:17:01 | 264,173,957 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package by.htp.les03.logic;
public class Task34 {
public static void task() {
int a = 1505205;
double a1 = a / 1000.0;
double a2 = (double) a / 1000000;
System.out.println("Bytes = " + a);
System.out.println("Kilobytes = " + a1);
System.out.println("Megabytes = " + a2);
}
}
| UTF-8 | Java | 309 | java | Task34.java | Java | [] | null | [] | package by.htp.les03.logic;
public class Task34 {
public static void task() {
int a = 1505205;
double a1 = a / 1000.0;
double a2 = (double) a / 1000000;
System.out.println("Bytes = " + a);
System.out.println("Kilobytes = " + a1);
System.out.println("Megabytes = " + a2);
}
}
| 309 | 0.588997 | 0.501618 | 14 | 20.071428 | 15.921523 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false | 13 |
7a7535db170b4a947168968341eef3169a9f9a56 | 17,403,207,514,919 | 1d805d1cbd194595b7f6d62975d20412df77d4e0 | /SleepLab/app/src/test/java/com/nci/sleeplab/TempFragTest.java | 363cbe4a3d2e1909b792eef6c864ecacee248043 | [] | no_license | HannahMulligan96/SleepLabFinalYearProject | https://github.com/HannahMulligan96/SleepLabFinalYearProject | 9bcd0a62a959d2e4f97668903090439e3d1d3313 | aa9b91569cfa0f16d865d87eb421ec509a4f07fa | refs/heads/master | 2020-04-11T22:08:31.890000 | 2019-05-10T20:56:51 | 2019-05-10T20:56:51 | 162,126,563 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.nci.sleeplab;
import org.junit.Test;
import static org.junit.Assert.*;
public class TempFragTest {
@Test
public void onCreateView() {
}
} | UTF-8 | Java | 165 | java | TempFragTest.java | Java | [] | null | [] | package com.nci.sleeplab;
import org.junit.Test;
import static org.junit.Assert.*;
public class TempFragTest {
@Test
public void onCreateView() {
}
} | 165 | 0.690909 | 0.690909 | 12 | 12.833333 | 13.170885 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 13 |
7956ab8af6dab80e123b3f31f98b3bb3f03b7623 | 26,929,444,971,706 | c06fa5a839234950e2e7033f276e297c956381ea | /OOAE_Customer_Client/src/ooae_customer_client/visitor/OrderDTOVisitable.java | ffd132d47d3d6d99b0bfbe17cd99742cc8af833f | [] | no_license | efarioli/JavaLibraryDesignPatterns | https://github.com/efarioli/JavaLibraryDesignPatterns | aba9d9100dddca6388f594fef95a0ce1a9ac5d5d | 65218c8c9b8861580b20e40bb6610d1037c4b0e3 | refs/heads/master | 2022-04-09T22:06:56.552000 | 2020-03-31T13:41:11 | 2020-03-31T13:41:11 | 248,038,793 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ooae_customer_client.visitor;
import java.util.Calendar;
import java.util.HashMap;
import ooae_library.data_transfer_object.CustomerDTO;
import ooae_library.data_transfer_object.ItemDTO;
import ooae_library.data_transfer_object.OrderDTO;
import ooae_library.data_transfer_object.OrderLineDTO;
/**
*
* @author f023507i
*/
public class OrderDTOVisitable implements Visitable
{
private OrderDTO order;
public OrderDTOVisitable(OrderDTO order)
{
this.order = order;
}
@Override
public void accept(Visitor visitor)
{
visitor.visit(this);
}
public void addOrderLine(int orderLineId, ItemDTO item, double price, int quantity)
{
order.addOrderLine(orderLineId, item, price, quantity);
}
@Override
public boolean equals(Object obj)
{
return order.equals(obj);
}
public CustomerDTO getCustomer()
{
return order.getCustomer();
}
public Calendar getOrderDateTime()
{
return order.getOrderDateTime();
}
public int getOrderId()
{
return order.getOrderId();
}
public HashMap<Integer, OrderLineDTO> getOrderLines()
{
return order.getOrderLines();
}
public String getStatus()
{
return order.getStatus();
}
@Override
public int hashCode()
{
return order.hashCode();
}
public boolean isEmpty()
{
return order.isEmpty();
}
public void setOrderLines(HashMap<Integer, OrderLineDTO> orderLines)
{
order.setOrderLines(orderLines);
}
}
| UTF-8 | Java | 1,801 | java | OrderDTOVisitable.java | Java | [
{
"context": "a_transfer_object.OrderLineDTO;\n\n/**\n *\n * @author f023507i\n */\npublic class OrderDTOVisitable implements Vis",
"end": 514,
"score": 0.9990378618240356,
"start": 506,
"tag": "USERNAME",
"value": "f023507i"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ooae_customer_client.visitor;
import java.util.Calendar;
import java.util.HashMap;
import ooae_library.data_transfer_object.CustomerDTO;
import ooae_library.data_transfer_object.ItemDTO;
import ooae_library.data_transfer_object.OrderDTO;
import ooae_library.data_transfer_object.OrderLineDTO;
/**
*
* @author f023507i
*/
public class OrderDTOVisitable implements Visitable
{
private OrderDTO order;
public OrderDTOVisitable(OrderDTO order)
{
this.order = order;
}
@Override
public void accept(Visitor visitor)
{
visitor.visit(this);
}
public void addOrderLine(int orderLineId, ItemDTO item, double price, int quantity)
{
order.addOrderLine(orderLineId, item, price, quantity);
}
@Override
public boolean equals(Object obj)
{
return order.equals(obj);
}
public CustomerDTO getCustomer()
{
return order.getCustomer();
}
public Calendar getOrderDateTime()
{
return order.getOrderDateTime();
}
public int getOrderId()
{
return order.getOrderId();
}
public HashMap<Integer, OrderLineDTO> getOrderLines()
{
return order.getOrderLines();
}
public String getStatus()
{
return order.getStatus();
}
@Override
public int hashCode()
{
return order.hashCode();
}
public boolean isEmpty()
{
return order.isEmpty();
}
public void setOrderLines(HashMap<Integer, OrderLineDTO> orderLines)
{
order.setOrderLines(orderLines);
}
}
| 1,801 | 0.650194 | 0.646863 | 89 | 19.235954 | 21.080383 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.348315 | false | false | 13 |
92dd021ba8af55b2e587b115b5f29e4ee7804793 | 16,277,926,075,316 | b8225ee9dbd7071ab7c287b9e9407e34c542ed06 | /src/ch05/producerconsumer/Consumer.java | ef5f30bd730656039e2cc7746c38c23a07a3ca8c | [] | no_license | ZhangShenao/JavaConcurrencyProgramming | https://github.com/ZhangShenao/JavaConcurrencyProgramming | 654de9a06129fe469c81792a439b6e5c0b8a443d | b1aee403cb09ef4edbf31432b62063a3fc014547 | refs/heads/master | 2021-01-23T03:16:30.312000 | 2017-06-08T06:55:50 | 2017-06-08T06:55:50 | 86,064,434 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ch05.producerconsumer;
import java.util.Random;
import java.util.concurrent.BlockingQueue;
public class Consumer implements Runnable{
/**
* 生产者和消费者共享的阻塞队列
*/
private BlockingQueue<PCData> queue;
/**
* 线程睡眠时间
*/
private static final int SLEEP_TIME = 1000;
private static final Random random = new Random();
private volatile boolean isRunning = true;
public Consumer(BlockingQueue<PCData> queue) {
this.queue = queue;
}
@Override
public void run() {
try {
while (isRunning){
//从阻塞队列中获取数据
PCData pcData = queue.poll();
if (null != pcData){
System.err.println("从阻塞队列中获取数据: " + pcData);
//计算结果
int intData = pcData.getIntData();
System.out.println(intData + " * " + intData + " = " + intData * intData);
Thread.sleep(random.nextInt(SLEEP_TIME));
}
}
}catch (Exception e){
e.printStackTrace();
Thread.currentThread().interrupt();
}
}
/**
* 停止当前消费者
*/
public void stop(){
this.isRunning = false;
}
}
| UTF-8 | Java | 1,117 | java | Consumer.java | Java | [] | null | [] | package ch05.producerconsumer;
import java.util.Random;
import java.util.concurrent.BlockingQueue;
public class Consumer implements Runnable{
/**
* 生产者和消费者共享的阻塞队列
*/
private BlockingQueue<PCData> queue;
/**
* 线程睡眠时间
*/
private static final int SLEEP_TIME = 1000;
private static final Random random = new Random();
private volatile boolean isRunning = true;
public Consumer(BlockingQueue<PCData> queue) {
this.queue = queue;
}
@Override
public void run() {
try {
while (isRunning){
//从阻塞队列中获取数据
PCData pcData = queue.poll();
if (null != pcData){
System.err.println("从阻塞队列中获取数据: " + pcData);
//计算结果
int intData = pcData.getIntData();
System.out.println(intData + " * " + intData + " = " + intData * intData);
Thread.sleep(random.nextInt(SLEEP_TIME));
}
}
}catch (Exception e){
e.printStackTrace();
Thread.currentThread().interrupt();
}
}
/**
* 停止当前消费者
*/
public void stop(){
this.isRunning = false;
}
}
| 1,117 | 0.640394 | 0.634483 | 54 | 17.796297 | 18.203968 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.092592 | false | false | 13 |
bbaeaabf5f42c41012b82e0442dd1cf318097a44 | 16,423,954,981,303 | 7902830fa927b9d1bb3c0b5919f829d989469968 | /src/com/it61/minecraft/web/servlet/MomentServlet.java | d2c498230627eb6380317c85430197fcbb07bc2c | [] | no_license | niu-qin-yong/myfirstjavawebdemo | https://github.com/niu-qin-yong/myfirstjavawebdemo | f31ab84c89e8477e9c11af53c776e7a48faec6e5 | ba7fc897358469b1deeb3402cb1015642e30e6ef | refs/heads/master | 2021-01-01T18:58:48.357000 | 2018-02-05T07:35:29 | 2018-02-05T07:35:29 | 98,477,457 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.it61.minecraft.web.servlet;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.PropertyFilter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.it61.minecraft.bean.Moment;
import com.it61.minecraft.bean.User;
import com.it61.minecraft.common.Constants;
import com.it61.minecraft.common.Utils;
import com.it61.minecraft.service.MomentService;
import com.it61.minecraft.service.UserService;
import com.it61.minecraft.service.impl.MomentServiceImpl;
import com.it61.minecraft.service.impl.UserServiceImpl;
public class MomentServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//判断form表单的类型是否是 multipart/form-data
if (ServletFileUpload.isMultipartContent(request)) {
HttpSession session = request.getSession(false);
User user = (User) session.getAttribute("user");
Moment moment = new Moment();
moment.setSenderId(user.getId());
moment.setSenderName(user.getUserName());
moment.setSenderLevel(user.getLevel());
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
try {
List<FileItem> items = upload.parseRequest(request);
for (FileItem item : items) {
//普通表单项
if (item.isFormField()) {
String name = item.getFieldName();
String value = item.getString("UTF-8");
System.out.println("name = " + name + " ; value = "+ value);
if(name.equals("moment")){
moment.setContent(value);
}
}else{
//type 是 file 的表单项
String name = item.getFieldName();
String type = item.getContentType();
System.out.println("name:"+name+",filename = " + item.getName()+","+"size="+item.getSize()+",type:"+type);
//判断类型,保证是图片,且大小不为0
if((type.equals(Constants.MIME_IMAGE_JPEG) || type.equals(Constants.MIME_IMAGE_PNG))
&& item.getSize() > 0){
moment.setPic(item.getInputStream());
}
}
}
//调用MomentService发表
MomentService service = new MomentServiceImpl();
service.sendMoment(moment);;
//获取刚发表的动态返回给界面显示
Moment latestMoment = service.getMomentLatest(user.getId());
String json = Utils.FastJsontoJsonString(latestMoment);
System.out.println("MomentServlet:"+json);
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json);
} catch (Exception e) {
e.printStackTrace();
//TODO 发表失败
}
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
| UTF-8 | Java | 3,268 | java | MomentServlet.java | Java | [] | null | [] | package com.it61.minecraft.web.servlet;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.PropertyFilter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.it61.minecraft.bean.Moment;
import com.it61.minecraft.bean.User;
import com.it61.minecraft.common.Constants;
import com.it61.minecraft.common.Utils;
import com.it61.minecraft.service.MomentService;
import com.it61.minecraft.service.UserService;
import com.it61.minecraft.service.impl.MomentServiceImpl;
import com.it61.minecraft.service.impl.UserServiceImpl;
public class MomentServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//判断form表单的类型是否是 multipart/form-data
if (ServletFileUpload.isMultipartContent(request)) {
HttpSession session = request.getSession(false);
User user = (User) session.getAttribute("user");
Moment moment = new Moment();
moment.setSenderId(user.getId());
moment.setSenderName(user.getUserName());
moment.setSenderLevel(user.getLevel());
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
try {
List<FileItem> items = upload.parseRequest(request);
for (FileItem item : items) {
//普通表单项
if (item.isFormField()) {
String name = item.getFieldName();
String value = item.getString("UTF-8");
System.out.println("name = " + name + " ; value = "+ value);
if(name.equals("moment")){
moment.setContent(value);
}
}else{
//type 是 file 的表单项
String name = item.getFieldName();
String type = item.getContentType();
System.out.println("name:"+name+",filename = " + item.getName()+","+"size="+item.getSize()+",type:"+type);
//判断类型,保证是图片,且大小不为0
if((type.equals(Constants.MIME_IMAGE_JPEG) || type.equals(Constants.MIME_IMAGE_PNG))
&& item.getSize() > 0){
moment.setPic(item.getInputStream());
}
}
}
//调用MomentService发表
MomentService service = new MomentServiceImpl();
service.sendMoment(moment);;
//获取刚发表的动态返回给界面显示
Moment latestMoment = service.getMomentLatest(user.getId());
String json = Utils.FastJsontoJsonString(latestMoment);
System.out.println("MomentServlet:"+json);
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json);
} catch (Exception e) {
e.printStackTrace();
//TODO 发表失败
}
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
| 3,268 | 0.718413 | 0.711429 | 100 | 30.5 | 23.697889 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.31 | false | false | 13 |
a23ead338bd7de80e04ae228d0315a8db0e66abf | 18,683,107,760,181 | be678be7ddd9c7b23f9007c39a50ed8367edcb98 | /app/src/main/java/com/jwoos/android/sellbook/intro/SignupActivity.java | 2aef2d8e83030f7f1fe785763247d40f0b461e2b | [] | no_license | jwooss/sellbook | https://github.com/jwooss/sellbook | b221d690025ac6f7fa9fc5d11ca0c6dac94fe408 | ea075728c81c51f0eac0409a53a9a514d9d0e918 | refs/heads/master | 2021-09-26T20:58:03.156000 | 2018-11-02T13:24:49 | 2018-11-02T13:24:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jwoos.android.sellbook.intro;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.TextView;
import com.jwoos.android.sellbook.R;
import com.jwoos.android.sellbook.base.BaseActivity;
import com.jwoos.android.sellbook.base.Gloval;
import com.jwoos.android.sellbook.base.retrofit.ServiceGenerator;
import com.jwoos.android.sellbook.base.retrofit.model.Login;
import com.jwoos.android.sellbook.utils.Dlog;
import com.jwoos.android.sellbook.utils.ObjectUtils;
import com.rey.material.widget.Button;
import com.rey.material.widget.Spinner;
import java.util.Timer;
import java.util.TimerTask;
import butterknife.BindView;
import butterknife.OnClick;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;
/**
* Created by Jwoo on 2016-05-23.
*/
public class SignupActivity extends BaseActivity {
@BindView(R.id.input_id)
EditText et_id;
@BindView(R.id.input_password)
EditText et_pwd;
@BindView(R.id.input_email)
EditText et_email;
@BindView(R.id.input_nickname)
EditText et_nic;
@BindView(R.id.input_major)
Spinner sp_major;
@BindView(R.id.btn_signup)
Button btn_signup;
@BindView(R.id.link_login)
TextView btn_link_login;
@BindView(R.id.chk_id)
Button btn_id_chk;
@BindView(R.id.chk_nic)
Button btn_nik_chk;
private int register_chk;
private String user_nik;
private boolean flag_nic, flag_id = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
register_chk = 0;
String[] items = getResources().getStringArray(R.array.values);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.row_spn, items);
adapter.setDropDownViewResource(R.layout.row_spn_dropdown);
sp_major.setAdapter(adapter);
}
@OnClick({R.id.chk_id, R.id.chk_nic, R.id.btn_signup, R.id.link_login})
public void btn_click(View v) {
switch (v.getId()) {
case R.id.btn_signup:
signup();
break;
case R.id.link_login:
finish();
break;
case R.id.chk_id:
if (et_id.getText().toString().length() == 8 && !ObjectUtils.isEmpty(et_id.getText().toString())) {
et_id.setEnabled(false);
btn_id_chk.setEnabled(false);
ServiceGenerator.getService().Overlap_chk(et_id.getText().toString(), "1", new Callback<Login>() {
@Override
public void success(Login login, Response response) {
if (login.getStatus().equals("1")) {
showToast("가입가능한 학번입니다");
flag_id = true;
} else {
showToast("이미 가입되어있는 학번입니다");
}
et_id.setEnabled(true);
btn_id_chk.setEnabled(true);
}
@Override
public void failure(RetrofitError error) {
et_id.setEnabled(true);
btn_id_chk.setEnabled(true);
showToast("다시 시도해주세요");
Dlog.e(error.getMessage());
}
});
} else {
showToast("학번을 정확히 입력해주세요");
}
break;
case R.id.chk_nic:
if (!ObjectUtils.isEmpty(et_nic.getText().toString())) {
et_nic.setEnabled(false);
btn_nik_chk.setEnabled(false);
ServiceGenerator.getService().Overlap_chk(et_id.getText().toString(), "0", new Callback<Login>() {
@Override
public void success(Login login, Response response) {
if (login.getStatus().equals("1")) {
showToast("가입가능한 닉네임입니다");
flag_nic = true;
} else {
showToast("이미 사용중인 학번입니다");
}
et_nic.setEnabled(true);
btn_nik_chk.setEnabled(true);
}
@Override
public void failure(RetrofitError error) {
et_nic.setEnabled(true);
btn_nik_chk.setEnabled(true);
showToast("다시 시도해주세요");
}
});
} else {
showToast("닉네임을 정확히 입력해주세요");
}
break;
}
}
public void signup() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(et_nic.getWindowToken(), 0);
if (!validate()) {
showToast("회원가입 형식을 확인하세요 :)");
return;
} else if (!(flag_nic && flag_id)) {
showToast("학번과 닉네임 중복체크를 해주세요 :)");
return;
}
btn_signup.setEnabled(false);
showDialog("아이디를 생성중입니다...");
String id = et_id.getText().toString();
String password = et_pwd.getText().toString();
String email = et_email.getText().toString();
user_nik = et_nic.getText().toString();
String major = sp_major.getSelectedItem().toString();
final Timer timer = new Timer();
TimerTask upload_timer = new TimerTask() {
public void run() {
if (register_chk != 0) {
mHandler.obtainMessage(1).sendToTarget();
timer.cancel();
}
}
};
timer.schedule(upload_timer, 3000, 1000);
//회원가입로직은 여기
ServiceGenerator.getService().Signup(id, makeSha256Key(password), email, user_nik, major, new Callback<Login>() {
@Override
public void success(Login login, Response response) {
if (login.getStatus().equals("1")) {
register_chk = 1;
} else if (login.getStatus().equals("0")) {
register_chk = 2;
}
}
@Override
public void failure(RetrofitError error) {
mHandler.obtainMessage(1).sendToTarget();
timer.cancel();
}
});
}
public Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
if (register_chk == 1) { //통신완료 가입완료
onSignupSuccess();
} else if (register_chk == 2) { //통신완료 가입실패
onSignupFailed("다시시도해주세요 :)");
dimssDialog();
btn_signup.setEnabled(true);
} else if (register_chk == 3) { //통신이 실패하였을경우
onSignupFailed("네트워크 환경에 문제가 발생하였습니다");
dimssDialog();
btn_signup.setEnabled(true);
}
}
};
public void onSignupSuccess() {
Gloval.setUser_nik(user_nik);
setResult(RESULT_OK, null);
finish();
}
public void onSignupFailed(String msg) {
showToast(msg);
}
public boolean validate() {
boolean valid = true;
String id = et_id.getText().toString();
String password = et_pwd.getText().toString();
String email = et_email.getText().toString();
String nic = et_nic.getText().toString();
String major = sp_major.getSelectedItem().toString();
if (ObjectUtils.isEmpty(id) || id.length() != 8) {
et_id.setError("학번 8자리를 입력해주세요");
valid = false;
} else {
et_id.setError(null);
}
if (ObjectUtils.isEmpty(password) || password.length() < 4 ) {
et_pwd.setError("비밀번호 4자리 이상 입력해주세요");
valid = false;
} else {
et_pwd.setError(null);
}
if (ObjectUtils.isEmpty(email) || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
et_email.setError("이메일 형식에 맞지않습니다");
valid = false;
} else {
et_email.setError(null);
}
if (ObjectUtils.isEmpty(nic)) {
et_nic.setError("닉네임을 입력해주세요");
valid = false;
} else {
et_nic.setError(null);
}
if (major.isEmpty() && major.equals("소속대학을 선택하세요")) {
showToast("소속대학을 선택해주세요");
valid = false;
} else {
}
return valid;
}
@Override
protected void onDestroy() {
dimssDialog();
cancelToast();
super.onDestroy();
}
}
| UTF-8 | Java | 9,717 | java | SignupActivity.java | Java | [
{
"context": "mport retrofit.client.Response;\n\n/**\n * Created by Jwoo on 2016-05-23.\n */\npublic class SignupActivity ex",
"end": 1026,
"score": 0.9942672848701477,
"start": 1022,
"tag": "USERNAME",
"value": "Jwoo"
},
{
"context": "id.getText().toString();\n String password = et_pwd.getText().toString();\n String email = et_email.getText().toSt",
"end": 5765,
"score": 0.9978421926498413,
"start": 5740,
"tag": "PASSWORD",
"value": "et_pwd.getText().toString"
}
] | null | [] | package com.jwoos.android.sellbook.intro;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.TextView;
import com.jwoos.android.sellbook.R;
import com.jwoos.android.sellbook.base.BaseActivity;
import com.jwoos.android.sellbook.base.Gloval;
import com.jwoos.android.sellbook.base.retrofit.ServiceGenerator;
import com.jwoos.android.sellbook.base.retrofit.model.Login;
import com.jwoos.android.sellbook.utils.Dlog;
import com.jwoos.android.sellbook.utils.ObjectUtils;
import com.rey.material.widget.Button;
import com.rey.material.widget.Spinner;
import java.util.Timer;
import java.util.TimerTask;
import butterknife.BindView;
import butterknife.OnClick;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;
/**
* Created by Jwoo on 2016-05-23.
*/
public class SignupActivity extends BaseActivity {
@BindView(R.id.input_id)
EditText et_id;
@BindView(R.id.input_password)
EditText et_pwd;
@BindView(R.id.input_email)
EditText et_email;
@BindView(R.id.input_nickname)
EditText et_nic;
@BindView(R.id.input_major)
Spinner sp_major;
@BindView(R.id.btn_signup)
Button btn_signup;
@BindView(R.id.link_login)
TextView btn_link_login;
@BindView(R.id.chk_id)
Button btn_id_chk;
@BindView(R.id.chk_nic)
Button btn_nik_chk;
private int register_chk;
private String user_nik;
private boolean flag_nic, flag_id = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
register_chk = 0;
String[] items = getResources().getStringArray(R.array.values);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.row_spn, items);
adapter.setDropDownViewResource(R.layout.row_spn_dropdown);
sp_major.setAdapter(adapter);
}
@OnClick({R.id.chk_id, R.id.chk_nic, R.id.btn_signup, R.id.link_login})
public void btn_click(View v) {
switch (v.getId()) {
case R.id.btn_signup:
signup();
break;
case R.id.link_login:
finish();
break;
case R.id.chk_id:
if (et_id.getText().toString().length() == 8 && !ObjectUtils.isEmpty(et_id.getText().toString())) {
et_id.setEnabled(false);
btn_id_chk.setEnabled(false);
ServiceGenerator.getService().Overlap_chk(et_id.getText().toString(), "1", new Callback<Login>() {
@Override
public void success(Login login, Response response) {
if (login.getStatus().equals("1")) {
showToast("가입가능한 학번입니다");
flag_id = true;
} else {
showToast("이미 가입되어있는 학번입니다");
}
et_id.setEnabled(true);
btn_id_chk.setEnabled(true);
}
@Override
public void failure(RetrofitError error) {
et_id.setEnabled(true);
btn_id_chk.setEnabled(true);
showToast("다시 시도해주세요");
Dlog.e(error.getMessage());
}
});
} else {
showToast("학번을 정확히 입력해주세요");
}
break;
case R.id.chk_nic:
if (!ObjectUtils.isEmpty(et_nic.getText().toString())) {
et_nic.setEnabled(false);
btn_nik_chk.setEnabled(false);
ServiceGenerator.getService().Overlap_chk(et_id.getText().toString(), "0", new Callback<Login>() {
@Override
public void success(Login login, Response response) {
if (login.getStatus().equals("1")) {
showToast("가입가능한 닉네임입니다");
flag_nic = true;
} else {
showToast("이미 사용중인 학번입니다");
}
et_nic.setEnabled(true);
btn_nik_chk.setEnabled(true);
}
@Override
public void failure(RetrofitError error) {
et_nic.setEnabled(true);
btn_nik_chk.setEnabled(true);
showToast("다시 시도해주세요");
}
});
} else {
showToast("닉네임을 정확히 입력해주세요");
}
break;
}
}
public void signup() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(et_nic.getWindowToken(), 0);
if (!validate()) {
showToast("회원가입 형식을 확인하세요 :)");
return;
} else if (!(flag_nic && flag_id)) {
showToast("학번과 닉네임 중복체크를 해주세요 :)");
return;
}
btn_signup.setEnabled(false);
showDialog("아이디를 생성중입니다...");
String id = et_id.getText().toString();
String password = <PASSWORD>();
String email = et_email.getText().toString();
user_nik = et_nic.getText().toString();
String major = sp_major.getSelectedItem().toString();
final Timer timer = new Timer();
TimerTask upload_timer = new TimerTask() {
public void run() {
if (register_chk != 0) {
mHandler.obtainMessage(1).sendToTarget();
timer.cancel();
}
}
};
timer.schedule(upload_timer, 3000, 1000);
//회원가입로직은 여기
ServiceGenerator.getService().Signup(id, makeSha256Key(password), email, user_nik, major, new Callback<Login>() {
@Override
public void success(Login login, Response response) {
if (login.getStatus().equals("1")) {
register_chk = 1;
} else if (login.getStatus().equals("0")) {
register_chk = 2;
}
}
@Override
public void failure(RetrofitError error) {
mHandler.obtainMessage(1).sendToTarget();
timer.cancel();
}
});
}
public Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
if (register_chk == 1) { //통신완료 가입완료
onSignupSuccess();
} else if (register_chk == 2) { //통신완료 가입실패
onSignupFailed("다시시도해주세요 :)");
dimssDialog();
btn_signup.setEnabled(true);
} else if (register_chk == 3) { //통신이 실패하였을경우
onSignupFailed("네트워크 환경에 문제가 발생하였습니다");
dimssDialog();
btn_signup.setEnabled(true);
}
}
};
public void onSignupSuccess() {
Gloval.setUser_nik(user_nik);
setResult(RESULT_OK, null);
finish();
}
public void onSignupFailed(String msg) {
showToast(msg);
}
public boolean validate() {
boolean valid = true;
String id = et_id.getText().toString();
String password = et_pwd.getText().toString();
String email = et_email.getText().toString();
String nic = et_nic.getText().toString();
String major = sp_major.getSelectedItem().toString();
if (ObjectUtils.isEmpty(id) || id.length() != 8) {
et_id.setError("학번 8자리를 입력해주세요");
valid = false;
} else {
et_id.setError(null);
}
if (ObjectUtils.isEmpty(password) || password.length() < 4 ) {
et_pwd.setError("비밀번호 4자리 이상 입력해주세요");
valid = false;
} else {
et_pwd.setError(null);
}
if (ObjectUtils.isEmpty(email) || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
et_email.setError("이메일 형식에 맞지않습니다");
valid = false;
} else {
et_email.setError(null);
}
if (ObjectUtils.isEmpty(nic)) {
et_nic.setError("닉네임을 입력해주세요");
valid = false;
} else {
et_nic.setError(null);
}
if (major.isEmpty() && major.equals("소속대학을 선택하세요")) {
showToast("소속대학을 선택해주세요");
valid = false;
} else {
}
return valid;
}
@Override
protected void onDestroy() {
dimssDialog();
cancelToast();
super.onDestroy();
}
}
| 9,702 | 0.517743 | 0.513402 | 280 | 31.910715 | 23.463709 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.585714 | false | false | 13 |
2ec68eb48c8c5c17275c431ce416266d59d8fc2f | 13,537,736,936,756 | 6839e7abfa2e354becd034ea46f14db3cbcc7488 | /src/com/sinosoft/schema/informationSchema.java | b260bb402454ca26363818846f94acd19c47231c | [] | no_license | trigrass2/wj | https://github.com/trigrass2/wj | aa2d310baa876f9e32a65238bcd36e7a2440b8c6 | 0d4da9d033c6fa2edb014e3a80715c9751a93cd5 | refs/heads/master | 2021-04-19T11:03:25.609000 | 2018-01-12T09:26:11 | 2018-01-12T09:26:11 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sinosoft.schema;
import com.sinosoft.framework.data.DataColumn;
import com.sinosoft.framework.orm.Schema;
import com.sinosoft.framework.orm.SchemaSet;
import com.sinosoft.framework.orm.SchemaColumn;
import com.sinosoft.framework.data.QueryBuilder;
import java.util.Date;
/**
* 表名称:关联orderItem,以及用户订单界面公共属性的信息表<br>
* 表代码:information<br>
* 表主键:id<br>
*/
public class informationSchema extends Schema {
private String id;
private Date createDate;
private Date modifyDate;
private String applicantArea;
private String applicantBirthday;
private String applicantIdentityId;
private String applicantIdentityType;
private String applicantMail;
private String applicantName;
private String applicantSex;
private String applicantTel;
private String coutNo;
private String electronicCout;
private String occupation1;
private String occupation2;
private String occupation3;
private String recognizeeArea;
private String recognizeeBirthday;
private String recognizeeIdentityId;
private String recognizeeIdentityType;
private String recognizeeMail;
private String recognizeeName;
private String recognizeeSex;
private String recognizeeTel;
private String recognizeeZipCode;
private String orderItem_id;
public static final SchemaColumn[] _Columns = new SchemaColumn[] {
new SchemaColumn("id", DataColumn.STRING, 0, 32 , 0 , true , true),
new SchemaColumn("createDate", DataColumn.DATETIME, 1, 0 , 0 , false , false),
new SchemaColumn("modifyDate", DataColumn.DATETIME, 2, 0 , 0 , false , false),
new SchemaColumn("applicantArea", DataColumn.STRING, 3, 255 , 0 , false , false),
new SchemaColumn("applicantBirthday", DataColumn.STRING, 4, 255 , 0 , false , false),
new SchemaColumn("applicantIdentityId", DataColumn.STRING, 5, 255 , 0 , false , false),
new SchemaColumn("applicantIdentityType", DataColumn.STRING, 6, 255 , 0 , false , false),
new SchemaColumn("applicantMail", DataColumn.STRING, 7, 255 , 0 , false , false),
new SchemaColumn("applicantName", DataColumn.STRING, 8, 255 , 0 , false , false),
new SchemaColumn("applicantSex", DataColumn.STRING, 9, 255 , 0 , false , false),
new SchemaColumn("applicantTel", DataColumn.STRING, 10, 255 , 0 , false , false),
new SchemaColumn("coutNo", DataColumn.STRING, 11, 255 , 0 , false , false),
new SchemaColumn("electronicCout", DataColumn.STRING, 12, 255 , 0 , false , false),
new SchemaColumn("occupation1", DataColumn.STRING, 13, 255 , 0 , false , false),
new SchemaColumn("occupation2", DataColumn.STRING, 14, 255 , 0 , false , false),
new SchemaColumn("occupation3", DataColumn.STRING, 15, 255 , 0 , false , false),
new SchemaColumn("recognizeeArea", DataColumn.STRING, 16, 255 , 0 , false , false),
new SchemaColumn("recognizeeBirthday", DataColumn.STRING, 17, 255 , 0 , false , false),
new SchemaColumn("recognizeeIdentityId", DataColumn.STRING, 18, 255 , 0 , false , false),
new SchemaColumn("recognizeeIdentityType", DataColumn.STRING, 19, 255 , 0 , false , false),
new SchemaColumn("recognizeeMail", DataColumn.STRING, 20, 255 , 0 , false , false),
new SchemaColumn("recognizeeName", DataColumn.STRING, 21, 255 , 0 , false , false),
new SchemaColumn("recognizeeSex", DataColumn.STRING, 22, 255 , 0 , false , false),
new SchemaColumn("recognizeeTel", DataColumn.STRING, 23, 255 , 0 , false , false),
new SchemaColumn("recognizeeZipCode", DataColumn.STRING, 24, 255 , 0 , false , false),
new SchemaColumn("orderItem_id", DataColumn.STRING, 25, 32 , 0 , false , false)
};
public static final String _TableCode = "information";
public static final String _NameSpace = "com.sinosoft.schema";
protected static final String _InsertAllSQL = "insert into information values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
protected static final String _UpdateAllSQL = "update information set id=?,createDate=?,modifyDate=?,applicantArea=?,applicantBirthday=?,applicantIdentityId=?,applicantIdentityType=?,applicantMail=?,applicantName=?,applicantSex=?,applicantTel=?,coutNo=?,electronicCout=?,occupation1=?,occupation2=?,occupation3=?,recognizeeArea=?,recognizeeBirthday=?,recognizeeIdentityId=?,recognizeeIdentityType=?,recognizeeMail=?,recognizeeName=?,recognizeeSex=?,recognizeeTel=?,recognizeeZipCode=?,orderItem_id=? where id=?";
protected static final String _DeleteSQL = "delete from information where id=?";
protected static final String _FillAllSQL = "select * from information where id=?";
public informationSchema(){
TableCode = _TableCode;
NameSpace = _NameSpace;
Columns = _Columns;
InsertAllSQL = _InsertAllSQL;
UpdateAllSQL = _UpdateAllSQL;
DeleteSQL = _DeleteSQL;
FillAllSQL = _FillAllSQL;
HasSetFlag = new boolean[26];
}
protected Schema newInstance(){
return new informationSchema();
}
protected SchemaSet newSet(){
return new informationSet();
}
public informationSet query() {
return query(null, -1, -1);
}
public informationSet query(QueryBuilder qb) {
return query(qb, -1, -1);
}
public informationSet query(int pageSize, int pageIndex) {
return query(null, pageSize, pageIndex);
}
public informationSet query(QueryBuilder qb , int pageSize, int pageIndex){
return (informationSet)querySet(qb , pageSize , pageIndex);
}
public void setV(int i, Object v) {
if (i == 0){id = (String)v;return;}
if (i == 1){createDate = (Date)v;return;}
if (i == 2){modifyDate = (Date)v;return;}
if (i == 3){applicantArea = (String)v;return;}
if (i == 4){applicantBirthday = (String)v;return;}
if (i == 5){applicantIdentityId = (String)v;return;}
if (i == 6){applicantIdentityType = (String)v;return;}
if (i == 7){applicantMail = (String)v;return;}
if (i == 8){applicantName = (String)v;return;}
if (i == 9){applicantSex = (String)v;return;}
if (i == 10){applicantTel = (String)v;return;}
if (i == 11){coutNo = (String)v;return;}
if (i == 12){electronicCout = (String)v;return;}
if (i == 13){occupation1 = (String)v;return;}
if (i == 14){occupation2 = (String)v;return;}
if (i == 15){occupation3 = (String)v;return;}
if (i == 16){recognizeeArea = (String)v;return;}
if (i == 17){recognizeeBirthday = (String)v;return;}
if (i == 18){recognizeeIdentityId = (String)v;return;}
if (i == 19){recognizeeIdentityType = (String)v;return;}
if (i == 20){recognizeeMail = (String)v;return;}
if (i == 21){recognizeeName = (String)v;return;}
if (i == 22){recognizeeSex = (String)v;return;}
if (i == 23){recognizeeTel = (String)v;return;}
if (i == 24){recognizeeZipCode = (String)v;return;}
if (i == 25){orderItem_id = (String)v;return;}
}
public Object getV(int i) {
if (i == 0){return id;}
if (i == 1){return createDate;}
if (i == 2){return modifyDate;}
if (i == 3){return applicantArea;}
if (i == 4){return applicantBirthday;}
if (i == 5){return applicantIdentityId;}
if (i == 6){return applicantIdentityType;}
if (i == 7){return applicantMail;}
if (i == 8){return applicantName;}
if (i == 9){return applicantSex;}
if (i == 10){return applicantTel;}
if (i == 11){return coutNo;}
if (i == 12){return electronicCout;}
if (i == 13){return occupation1;}
if (i == 14){return occupation2;}
if (i == 15){return occupation3;}
if (i == 16){return recognizeeArea;}
if (i == 17){return recognizeeBirthday;}
if (i == 18){return recognizeeIdentityId;}
if (i == 19){return recognizeeIdentityType;}
if (i == 20){return recognizeeMail;}
if (i == 21){return recognizeeName;}
if (i == 22){return recognizeeSex;}
if (i == 23){return recognizeeTel;}
if (i == 24){return recognizeeZipCode;}
if (i == 25){return orderItem_id;}
return null;
}
/**
* 获取字段id的值,该字段的<br>
* 字段名称 :记录ID<br>
* 数据类型 :varchar(32)<br>
* 是否主键 :true<br>
* 是否必填 :true<br>
*/
public String getid() {
return id;
}
/**
* 设置字段id的值,该字段的<br>
* 字段名称 :记录ID<br>
* 数据类型 :varchar(32)<br>
* 是否主键 :true<br>
* 是否必填 :true<br>
*/
public void setid(String id) {
this.id = id;
}
/**
* 获取字段createDate的值,该字段的<br>
* 字段名称 :创建日期<br>
* 数据类型 :datetime<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public Date getcreateDate() {
return createDate;
}
/**
* 设置字段createDate的值,该字段的<br>
* 字段名称 :创建日期<br>
* 数据类型 :datetime<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setcreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* 获取字段modifyDate的值,该字段的<br>
* 字段名称 :修改日期<br>
* 数据类型 :datetime<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public Date getmodifyDate() {
return modifyDate;
}
/**
* 设置字段modifyDate的值,该字段的<br>
* 字段名称 :修改日期<br>
* 数据类型 :datetime<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setmodifyDate(Date modifyDate) {
this.modifyDate = modifyDate;
}
/**
* 获取字段applicantArea的值,该字段的<br>
* 字段名称 :投保人所在地<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantArea() {
return applicantArea;
}
/**
* 设置字段applicantArea的值,该字段的<br>
* 字段名称 :投保人所在地<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantArea(String applicantArea) {
this.applicantArea = applicantArea;
}
/**
* 获取字段applicantBirthday的值,该字段的<br>
* 字段名称 :投保人出生日期<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantBirthday() {
return applicantBirthday;
}
/**
* 设置字段applicantBirthday的值,该字段的<br>
* 字段名称 :投保人出生日期<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantBirthday(String applicantBirthday) {
this.applicantBirthday = applicantBirthday;
}
/**
* 获取字段applicantIdentityId的值,该字段的<br>
* 字段名称 :投保人证件号码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantIdentityId() {
return applicantIdentityId;
}
/**
* 设置字段applicantIdentityId的值,该字段的<br>
* 字段名称 :投保人证件号码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantIdentityId(String applicantIdentityId) {
this.applicantIdentityId = applicantIdentityId;
}
/**
* 获取字段applicantIdentityType的值,该字段的<br>
* 字段名称 :投保人证件类型<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantIdentityType() {
return applicantIdentityType;
}
/**
* 设置字段applicantIdentityType的值,该字段的<br>
* 字段名称 :投保人证件类型<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantIdentityType(String applicantIdentityType) {
this.applicantIdentityType = applicantIdentityType;
}
/**
* 获取字段applicantMail的值,该字段的<br>
* 字段名称 :投保人电子邮箱<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantMail() {
return applicantMail;
}
/**
* 设置字段applicantMail的值,该字段的<br>
* 字段名称 :投保人电子邮箱<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantMail(String applicantMail) {
this.applicantMail = applicantMail;
}
/**
* 获取字段applicantName的值,该字段的<br>
* 字段名称 :投保人姓名<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantName() {
return applicantName;
}
/**
* 设置字段applicantName的值,该字段的<br>
* 字段名称 :投保人姓名<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantName(String applicantName) {
this.applicantName = applicantName;
}
/**
* 获取字段applicantSex的值,该字段的<br>
* 字段名称 :投保人性别<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantSex() {
return applicantSex;
}
/**
* 设置字段applicantSex的值,该字段的<br>
* 字段名称 :投保人性别<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantSex(String applicantSex) {
this.applicantSex = applicantSex;
}
/**
* 获取字段applicantTel的值,该字段的<br>
* 字段名称 :投保人电话<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantTel() {
return applicantTel;
}
/**
* 设置字段applicantTel的值,该字段的<br>
* 字段名称 :投保人电话<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantTel(String applicantTel) {
this.applicantTel = applicantTel;
}
/**
* 获取字段coutNo的值,该字段的<br>
* 字段名称 :保单号<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getcoutNo() {
return coutNo;
}
/**
* 设置字段coutNo的值,该字段的<br>
* 字段名称 :保单号<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setcoutNo(String coutNo) {
this.coutNo = coutNo;
}
/**
* 获取字段electronicCout的值,该字段的<br>
* 字段名称 :上传电子保单<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getelectronicCout() {
return electronicCout;
}
/**
* 设置字段electronicCout的值,该字段的<br>
* 字段名称 :上传电子保单<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setelectronicCout(String electronicCout) {
this.electronicCout = electronicCout;
}
/**
* 获取字段occupation1的值,该字段的<br>
* 字段名称 :职业1<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getoccupation1() {
return occupation1;
}
/**
* 设置字段occupation1的值,该字段的<br>
* 字段名称 :职业1<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setoccupation1(String occupation1) {
this.occupation1 = occupation1;
}
/**
* 获取字段occupation2的值,该字段的<br>
* 字段名称 :职业2<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getoccupation2() {
return occupation2;
}
/**
* 设置字段occupation2的值,该字段的<br>
* 字段名称 :职业2<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setoccupation2(String occupation2) {
this.occupation2 = occupation2;
}
/**
* 获取字段occupation3的值,该字段的<br>
* 字段名称 :职业3<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getoccupation3() {
return occupation3;
}
/**
* 设置字段occupation3的值,该字段的<br>
* 字段名称 :职业3<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setoccupation3(String occupation3) {
this.occupation3 = occupation3;
}
/**
* 获取字段recognizeeArea的值,该字段的<br>
* 字段名称 :被保人所在地<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeArea() {
return recognizeeArea;
}
/**
* 设置字段recognizeeArea的值,该字段的<br>
* 字段名称 :被保人所在地<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeArea(String recognizeeArea) {
this.recognizeeArea = recognizeeArea;
}
/**
* 获取字段recognizeeBirthday的值,该字段的<br>
* 字段名称 :被保人出生日期<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeBirthday() {
return recognizeeBirthday;
}
/**
* 设置字段recognizeeBirthday的值,该字段的<br>
* 字段名称 :被保人出生日期<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeBirthday(String recognizeeBirthday) {
this.recognizeeBirthday = recognizeeBirthday;
}
/**
* 获取字段recognizeeIdentityId的值,该字段的<br>
* 字段名称 :被保人证件号码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeIdentityId() {
return recognizeeIdentityId;
}
/**
* 设置字段recognizeeIdentityId的值,该字段的<br>
* 字段名称 :被保人证件号码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeIdentityId(String recognizeeIdentityId) {
this.recognizeeIdentityId = recognizeeIdentityId;
}
/**
* 获取字段recognizeeIdentityType的值,该字段的<br>
* 字段名称 :被保人证件类型<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeIdentityType() {
return recognizeeIdentityType;
}
/**
* 设置字段recognizeeIdentityType的值,该字段的<br>
* 字段名称 :被保人证件类型<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeIdentityType(String recognizeeIdentityType) {
this.recognizeeIdentityType = recognizeeIdentityType;
}
/**
* 获取字段recognizeeMail的值,该字段的<br>
* 字段名称 :被保人电子邮箱<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeMail() {
return recognizeeMail;
}
/**
* 设置字段recognizeeMail的值,该字段的<br>
* 字段名称 :被保人电子邮箱<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeMail(String recognizeeMail) {
this.recognizeeMail = recognizeeMail;
}
/**
* 获取字段recognizeeName的值,该字段的<br>
* 字段名称 :被保人姓名<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeName() {
return recognizeeName;
}
/**
* 设置字段recognizeeName的值,该字段的<br>
* 字段名称 :被保人姓名<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeName(String recognizeeName) {
this.recognizeeName = recognizeeName;
}
/**
* 获取字段recognizeeSex的值,该字段的<br>
* 字段名称 :被保人性别<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeSex() {
return recognizeeSex;
}
/**
* 设置字段recognizeeSex的值,该字段的<br>
* 字段名称 :被保人性别<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeSex(String recognizeeSex) {
this.recognizeeSex = recognizeeSex;
}
/**
* 获取字段recognizeeTel的值,该字段的<br>
* 字段名称 :被保人电话<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeTel() {
return recognizeeTel;
}
/**
* 设置字段recognizeeTel的值,该字段的<br>
* 字段名称 :被保人电话<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeTel(String recognizeeTel) {
this.recognizeeTel = recognizeeTel;
}
/**
* 获取字段recognizeeZipCode的值,该字段的<br>
* 字段名称 :被保人邮政编码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeZipCode() {
return recognizeeZipCode;
}
/**
* 设置字段recognizeeZipCode的值,该字段的<br>
* 字段名称 :被保人邮政编码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeZipCode(String recognizeeZipCode) {
this.recognizeeZipCode = recognizeeZipCode;
}
/**
* 获取字段orderItem_id的值,该字段的<br>
* 字段名称 :订单<br>
* 数据类型 :varchar(32)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getorderItem_id() {
return orderItem_id;
}
/**
* 设置字段orderItem_id的值,该字段的<br>
* 字段名称 :订单<br>
* 数据类型 :varchar(32)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setorderItem_id(String orderItem_id) {
this.orderItem_id = orderItem_id;
}
} | UTF-8 | Java | 21,835 | java | informationSchema.java | Java | [] | null | [] | package com.sinosoft.schema;
import com.sinosoft.framework.data.DataColumn;
import com.sinosoft.framework.orm.Schema;
import com.sinosoft.framework.orm.SchemaSet;
import com.sinosoft.framework.orm.SchemaColumn;
import com.sinosoft.framework.data.QueryBuilder;
import java.util.Date;
/**
* 表名称:关联orderItem,以及用户订单界面公共属性的信息表<br>
* 表代码:information<br>
* 表主键:id<br>
*/
public class informationSchema extends Schema {
private String id;
private Date createDate;
private Date modifyDate;
private String applicantArea;
private String applicantBirthday;
private String applicantIdentityId;
private String applicantIdentityType;
private String applicantMail;
private String applicantName;
private String applicantSex;
private String applicantTel;
private String coutNo;
private String electronicCout;
private String occupation1;
private String occupation2;
private String occupation3;
private String recognizeeArea;
private String recognizeeBirthday;
private String recognizeeIdentityId;
private String recognizeeIdentityType;
private String recognizeeMail;
private String recognizeeName;
private String recognizeeSex;
private String recognizeeTel;
private String recognizeeZipCode;
private String orderItem_id;
public static final SchemaColumn[] _Columns = new SchemaColumn[] {
new SchemaColumn("id", DataColumn.STRING, 0, 32 , 0 , true , true),
new SchemaColumn("createDate", DataColumn.DATETIME, 1, 0 , 0 , false , false),
new SchemaColumn("modifyDate", DataColumn.DATETIME, 2, 0 , 0 , false , false),
new SchemaColumn("applicantArea", DataColumn.STRING, 3, 255 , 0 , false , false),
new SchemaColumn("applicantBirthday", DataColumn.STRING, 4, 255 , 0 , false , false),
new SchemaColumn("applicantIdentityId", DataColumn.STRING, 5, 255 , 0 , false , false),
new SchemaColumn("applicantIdentityType", DataColumn.STRING, 6, 255 , 0 , false , false),
new SchemaColumn("applicantMail", DataColumn.STRING, 7, 255 , 0 , false , false),
new SchemaColumn("applicantName", DataColumn.STRING, 8, 255 , 0 , false , false),
new SchemaColumn("applicantSex", DataColumn.STRING, 9, 255 , 0 , false , false),
new SchemaColumn("applicantTel", DataColumn.STRING, 10, 255 , 0 , false , false),
new SchemaColumn("coutNo", DataColumn.STRING, 11, 255 , 0 , false , false),
new SchemaColumn("electronicCout", DataColumn.STRING, 12, 255 , 0 , false , false),
new SchemaColumn("occupation1", DataColumn.STRING, 13, 255 , 0 , false , false),
new SchemaColumn("occupation2", DataColumn.STRING, 14, 255 , 0 , false , false),
new SchemaColumn("occupation3", DataColumn.STRING, 15, 255 , 0 , false , false),
new SchemaColumn("recognizeeArea", DataColumn.STRING, 16, 255 , 0 , false , false),
new SchemaColumn("recognizeeBirthday", DataColumn.STRING, 17, 255 , 0 , false , false),
new SchemaColumn("recognizeeIdentityId", DataColumn.STRING, 18, 255 , 0 , false , false),
new SchemaColumn("recognizeeIdentityType", DataColumn.STRING, 19, 255 , 0 , false , false),
new SchemaColumn("recognizeeMail", DataColumn.STRING, 20, 255 , 0 , false , false),
new SchemaColumn("recognizeeName", DataColumn.STRING, 21, 255 , 0 , false , false),
new SchemaColumn("recognizeeSex", DataColumn.STRING, 22, 255 , 0 , false , false),
new SchemaColumn("recognizeeTel", DataColumn.STRING, 23, 255 , 0 , false , false),
new SchemaColumn("recognizeeZipCode", DataColumn.STRING, 24, 255 , 0 , false , false),
new SchemaColumn("orderItem_id", DataColumn.STRING, 25, 32 , 0 , false , false)
};
public static final String _TableCode = "information";
public static final String _NameSpace = "com.sinosoft.schema";
protected static final String _InsertAllSQL = "insert into information values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
protected static final String _UpdateAllSQL = "update information set id=?,createDate=?,modifyDate=?,applicantArea=?,applicantBirthday=?,applicantIdentityId=?,applicantIdentityType=?,applicantMail=?,applicantName=?,applicantSex=?,applicantTel=?,coutNo=?,electronicCout=?,occupation1=?,occupation2=?,occupation3=?,recognizeeArea=?,recognizeeBirthday=?,recognizeeIdentityId=?,recognizeeIdentityType=?,recognizeeMail=?,recognizeeName=?,recognizeeSex=?,recognizeeTel=?,recognizeeZipCode=?,orderItem_id=? where id=?";
protected static final String _DeleteSQL = "delete from information where id=?";
protected static final String _FillAllSQL = "select * from information where id=?";
public informationSchema(){
TableCode = _TableCode;
NameSpace = _NameSpace;
Columns = _Columns;
InsertAllSQL = _InsertAllSQL;
UpdateAllSQL = _UpdateAllSQL;
DeleteSQL = _DeleteSQL;
FillAllSQL = _FillAllSQL;
HasSetFlag = new boolean[26];
}
protected Schema newInstance(){
return new informationSchema();
}
protected SchemaSet newSet(){
return new informationSet();
}
public informationSet query() {
return query(null, -1, -1);
}
public informationSet query(QueryBuilder qb) {
return query(qb, -1, -1);
}
public informationSet query(int pageSize, int pageIndex) {
return query(null, pageSize, pageIndex);
}
public informationSet query(QueryBuilder qb , int pageSize, int pageIndex){
return (informationSet)querySet(qb , pageSize , pageIndex);
}
public void setV(int i, Object v) {
if (i == 0){id = (String)v;return;}
if (i == 1){createDate = (Date)v;return;}
if (i == 2){modifyDate = (Date)v;return;}
if (i == 3){applicantArea = (String)v;return;}
if (i == 4){applicantBirthday = (String)v;return;}
if (i == 5){applicantIdentityId = (String)v;return;}
if (i == 6){applicantIdentityType = (String)v;return;}
if (i == 7){applicantMail = (String)v;return;}
if (i == 8){applicantName = (String)v;return;}
if (i == 9){applicantSex = (String)v;return;}
if (i == 10){applicantTel = (String)v;return;}
if (i == 11){coutNo = (String)v;return;}
if (i == 12){electronicCout = (String)v;return;}
if (i == 13){occupation1 = (String)v;return;}
if (i == 14){occupation2 = (String)v;return;}
if (i == 15){occupation3 = (String)v;return;}
if (i == 16){recognizeeArea = (String)v;return;}
if (i == 17){recognizeeBirthday = (String)v;return;}
if (i == 18){recognizeeIdentityId = (String)v;return;}
if (i == 19){recognizeeIdentityType = (String)v;return;}
if (i == 20){recognizeeMail = (String)v;return;}
if (i == 21){recognizeeName = (String)v;return;}
if (i == 22){recognizeeSex = (String)v;return;}
if (i == 23){recognizeeTel = (String)v;return;}
if (i == 24){recognizeeZipCode = (String)v;return;}
if (i == 25){orderItem_id = (String)v;return;}
}
public Object getV(int i) {
if (i == 0){return id;}
if (i == 1){return createDate;}
if (i == 2){return modifyDate;}
if (i == 3){return applicantArea;}
if (i == 4){return applicantBirthday;}
if (i == 5){return applicantIdentityId;}
if (i == 6){return applicantIdentityType;}
if (i == 7){return applicantMail;}
if (i == 8){return applicantName;}
if (i == 9){return applicantSex;}
if (i == 10){return applicantTel;}
if (i == 11){return coutNo;}
if (i == 12){return electronicCout;}
if (i == 13){return occupation1;}
if (i == 14){return occupation2;}
if (i == 15){return occupation3;}
if (i == 16){return recognizeeArea;}
if (i == 17){return recognizeeBirthday;}
if (i == 18){return recognizeeIdentityId;}
if (i == 19){return recognizeeIdentityType;}
if (i == 20){return recognizeeMail;}
if (i == 21){return recognizeeName;}
if (i == 22){return recognizeeSex;}
if (i == 23){return recognizeeTel;}
if (i == 24){return recognizeeZipCode;}
if (i == 25){return orderItem_id;}
return null;
}
/**
* 获取字段id的值,该字段的<br>
* 字段名称 :记录ID<br>
* 数据类型 :varchar(32)<br>
* 是否主键 :true<br>
* 是否必填 :true<br>
*/
public String getid() {
return id;
}
/**
* 设置字段id的值,该字段的<br>
* 字段名称 :记录ID<br>
* 数据类型 :varchar(32)<br>
* 是否主键 :true<br>
* 是否必填 :true<br>
*/
public void setid(String id) {
this.id = id;
}
/**
* 获取字段createDate的值,该字段的<br>
* 字段名称 :创建日期<br>
* 数据类型 :datetime<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public Date getcreateDate() {
return createDate;
}
/**
* 设置字段createDate的值,该字段的<br>
* 字段名称 :创建日期<br>
* 数据类型 :datetime<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setcreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* 获取字段modifyDate的值,该字段的<br>
* 字段名称 :修改日期<br>
* 数据类型 :datetime<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public Date getmodifyDate() {
return modifyDate;
}
/**
* 设置字段modifyDate的值,该字段的<br>
* 字段名称 :修改日期<br>
* 数据类型 :datetime<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setmodifyDate(Date modifyDate) {
this.modifyDate = modifyDate;
}
/**
* 获取字段applicantArea的值,该字段的<br>
* 字段名称 :投保人所在地<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantArea() {
return applicantArea;
}
/**
* 设置字段applicantArea的值,该字段的<br>
* 字段名称 :投保人所在地<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantArea(String applicantArea) {
this.applicantArea = applicantArea;
}
/**
* 获取字段applicantBirthday的值,该字段的<br>
* 字段名称 :投保人出生日期<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantBirthday() {
return applicantBirthday;
}
/**
* 设置字段applicantBirthday的值,该字段的<br>
* 字段名称 :投保人出生日期<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantBirthday(String applicantBirthday) {
this.applicantBirthday = applicantBirthday;
}
/**
* 获取字段applicantIdentityId的值,该字段的<br>
* 字段名称 :投保人证件号码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantIdentityId() {
return applicantIdentityId;
}
/**
* 设置字段applicantIdentityId的值,该字段的<br>
* 字段名称 :投保人证件号码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantIdentityId(String applicantIdentityId) {
this.applicantIdentityId = applicantIdentityId;
}
/**
* 获取字段applicantIdentityType的值,该字段的<br>
* 字段名称 :投保人证件类型<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantIdentityType() {
return applicantIdentityType;
}
/**
* 设置字段applicantIdentityType的值,该字段的<br>
* 字段名称 :投保人证件类型<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantIdentityType(String applicantIdentityType) {
this.applicantIdentityType = applicantIdentityType;
}
/**
* 获取字段applicantMail的值,该字段的<br>
* 字段名称 :投保人电子邮箱<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantMail() {
return applicantMail;
}
/**
* 设置字段applicantMail的值,该字段的<br>
* 字段名称 :投保人电子邮箱<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantMail(String applicantMail) {
this.applicantMail = applicantMail;
}
/**
* 获取字段applicantName的值,该字段的<br>
* 字段名称 :投保人姓名<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantName() {
return applicantName;
}
/**
* 设置字段applicantName的值,该字段的<br>
* 字段名称 :投保人姓名<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantName(String applicantName) {
this.applicantName = applicantName;
}
/**
* 获取字段applicantSex的值,该字段的<br>
* 字段名称 :投保人性别<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantSex() {
return applicantSex;
}
/**
* 设置字段applicantSex的值,该字段的<br>
* 字段名称 :投保人性别<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantSex(String applicantSex) {
this.applicantSex = applicantSex;
}
/**
* 获取字段applicantTel的值,该字段的<br>
* 字段名称 :投保人电话<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getapplicantTel() {
return applicantTel;
}
/**
* 设置字段applicantTel的值,该字段的<br>
* 字段名称 :投保人电话<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setapplicantTel(String applicantTel) {
this.applicantTel = applicantTel;
}
/**
* 获取字段coutNo的值,该字段的<br>
* 字段名称 :保单号<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getcoutNo() {
return coutNo;
}
/**
* 设置字段coutNo的值,该字段的<br>
* 字段名称 :保单号<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setcoutNo(String coutNo) {
this.coutNo = coutNo;
}
/**
* 获取字段electronicCout的值,该字段的<br>
* 字段名称 :上传电子保单<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getelectronicCout() {
return electronicCout;
}
/**
* 设置字段electronicCout的值,该字段的<br>
* 字段名称 :上传电子保单<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setelectronicCout(String electronicCout) {
this.electronicCout = electronicCout;
}
/**
* 获取字段occupation1的值,该字段的<br>
* 字段名称 :职业1<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getoccupation1() {
return occupation1;
}
/**
* 设置字段occupation1的值,该字段的<br>
* 字段名称 :职业1<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setoccupation1(String occupation1) {
this.occupation1 = occupation1;
}
/**
* 获取字段occupation2的值,该字段的<br>
* 字段名称 :职业2<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getoccupation2() {
return occupation2;
}
/**
* 设置字段occupation2的值,该字段的<br>
* 字段名称 :职业2<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setoccupation2(String occupation2) {
this.occupation2 = occupation2;
}
/**
* 获取字段occupation3的值,该字段的<br>
* 字段名称 :职业3<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getoccupation3() {
return occupation3;
}
/**
* 设置字段occupation3的值,该字段的<br>
* 字段名称 :职业3<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setoccupation3(String occupation3) {
this.occupation3 = occupation3;
}
/**
* 获取字段recognizeeArea的值,该字段的<br>
* 字段名称 :被保人所在地<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeArea() {
return recognizeeArea;
}
/**
* 设置字段recognizeeArea的值,该字段的<br>
* 字段名称 :被保人所在地<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeArea(String recognizeeArea) {
this.recognizeeArea = recognizeeArea;
}
/**
* 获取字段recognizeeBirthday的值,该字段的<br>
* 字段名称 :被保人出生日期<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeBirthday() {
return recognizeeBirthday;
}
/**
* 设置字段recognizeeBirthday的值,该字段的<br>
* 字段名称 :被保人出生日期<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeBirthday(String recognizeeBirthday) {
this.recognizeeBirthday = recognizeeBirthday;
}
/**
* 获取字段recognizeeIdentityId的值,该字段的<br>
* 字段名称 :被保人证件号码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeIdentityId() {
return recognizeeIdentityId;
}
/**
* 设置字段recognizeeIdentityId的值,该字段的<br>
* 字段名称 :被保人证件号码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeIdentityId(String recognizeeIdentityId) {
this.recognizeeIdentityId = recognizeeIdentityId;
}
/**
* 获取字段recognizeeIdentityType的值,该字段的<br>
* 字段名称 :被保人证件类型<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeIdentityType() {
return recognizeeIdentityType;
}
/**
* 设置字段recognizeeIdentityType的值,该字段的<br>
* 字段名称 :被保人证件类型<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeIdentityType(String recognizeeIdentityType) {
this.recognizeeIdentityType = recognizeeIdentityType;
}
/**
* 获取字段recognizeeMail的值,该字段的<br>
* 字段名称 :被保人电子邮箱<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeMail() {
return recognizeeMail;
}
/**
* 设置字段recognizeeMail的值,该字段的<br>
* 字段名称 :被保人电子邮箱<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeMail(String recognizeeMail) {
this.recognizeeMail = recognizeeMail;
}
/**
* 获取字段recognizeeName的值,该字段的<br>
* 字段名称 :被保人姓名<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeName() {
return recognizeeName;
}
/**
* 设置字段recognizeeName的值,该字段的<br>
* 字段名称 :被保人姓名<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeName(String recognizeeName) {
this.recognizeeName = recognizeeName;
}
/**
* 获取字段recognizeeSex的值,该字段的<br>
* 字段名称 :被保人性别<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeSex() {
return recognizeeSex;
}
/**
* 设置字段recognizeeSex的值,该字段的<br>
* 字段名称 :被保人性别<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeSex(String recognizeeSex) {
this.recognizeeSex = recognizeeSex;
}
/**
* 获取字段recognizeeTel的值,该字段的<br>
* 字段名称 :被保人电话<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeTel() {
return recognizeeTel;
}
/**
* 设置字段recognizeeTel的值,该字段的<br>
* 字段名称 :被保人电话<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeTel(String recognizeeTel) {
this.recognizeeTel = recognizeeTel;
}
/**
* 获取字段recognizeeZipCode的值,该字段的<br>
* 字段名称 :被保人邮政编码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getrecognizeeZipCode() {
return recognizeeZipCode;
}
/**
* 设置字段recognizeeZipCode的值,该字段的<br>
* 字段名称 :被保人邮政编码<br>
* 数据类型 :varchar(255)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setrecognizeeZipCode(String recognizeeZipCode) {
this.recognizeeZipCode = recognizeeZipCode;
}
/**
* 获取字段orderItem_id的值,该字段的<br>
* 字段名称 :订单<br>
* 数据类型 :varchar(32)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public String getorderItem_id() {
return orderItem_id;
}
/**
* 设置字段orderItem_id的值,该字段的<br>
* 字段名称 :订单<br>
* 数据类型 :varchar(32)<br>
* 是否主键 :false<br>
* 是否必填 :false<br>
*/
public void setorderItem_id(String orderItem_id) {
this.orderItem_id = orderItem_id;
}
} | 21,835 | 0.67764 | 0.655133 | 776 | 22.762886 | 26.934542 | 513 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.563144 | false | false | 13 |
9eac96f6eb8b074d63297ab0ab491f51a0d827e5 | 8,108,898,263,747 | af15b60eef63f748894e424d5e9afab3a95e7e4f | /addToCart/src/com/Dao/bookCollection.java | e9a4092bf720f4cda90c1f44a10a4759a177671f | [] | no_license | malagreddy/Add-To-Cart | https://github.com/malagreddy/Add-To-Cart | 426fab1277212253699b84a3d45674f5882e9567 | 61a7bda6c0e09fa05c2558aa2323f0c441452e0a | refs/heads/master | 2020-03-26T01:22:31.489000 | 2018-08-11T07:20:28 | 2018-08-11T07:20:28 | 144,364,298 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.Dao;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.pojo.Books;
import com.pojo.Cart;
public class bookCollection implements bookCollectionDao {
private static Map<Integer, Books> bookdb = new HashMap<Integer, Books>();
private static Map<Integer, Cart> cart = new HashMap<Integer, Cart>();
private static Books b1 = new Books(101, "Alchemist", "Philosophy", 499);
private static Books b2 = new Books(102, "twilight", "Romance and drama", 999);
private static Books b3 = new Books(103, "All your Perfects", "Romance", 400);
static {
bookdb.put(b1.getId(), b1);
System.out.println(b1.getId() + "---------------");
bookdb.put(b2.getId(), b2);
bookdb.put(b3.getId(), b3);
}
@Override
public Collection<Books> ViewAllBooks() {
return bookdb.values();
}
@Override
public Collection<Cart> ViewCart() {
return cart.values();
}
@Override
public void addBook(int id) {
if (cart.get(id) == null) {
for (Books book : ViewAllBooks()) {
if (book.getId() == id) {
Cart crt = new Cart(1, book);
cart.put(id, crt);
}
}
} else {
Cart crt = cart.get(id);
crt.setQuantity(crt.getQuantity() + 1);
}
}
@Override
public void delete(int id) {
for (Cart crt : ViewCart()) {
if (crt.getBook().getId() == id) {
if (crt.getQuantity() > 1) {
crt.setQuantity(crt.getQuantity() - 1);
break;
} else {
cart.remove(id);
break;
}
}
}
}
@Override
public int getTotalQuantity() {
int totalQuantity = 0;
for (Cart crt : ViewCart()) {
totalQuantity += crt.getQuantity();
}
System.out.println("The quantity is" + totalQuantity);
return totalQuantity;
}
@Override
public double getTotalPrice() {
double totalPrice = 0.0;
for (Cart crt : ViewCart()) {
totalPrice += (crt.getQuantity()) * (crt.getBook().getPrice());
}
// System.out.println(totalPrice);
return totalPrice;
}
}
| UTF-8 | Java | 2,040 | java | bookCollection.java | Java | [] | null | [] | package com.Dao;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.pojo.Books;
import com.pojo.Cart;
public class bookCollection implements bookCollectionDao {
private static Map<Integer, Books> bookdb = new HashMap<Integer, Books>();
private static Map<Integer, Cart> cart = new HashMap<Integer, Cart>();
private static Books b1 = new Books(101, "Alchemist", "Philosophy", 499);
private static Books b2 = new Books(102, "twilight", "Romance and drama", 999);
private static Books b3 = new Books(103, "All your Perfects", "Romance", 400);
static {
bookdb.put(b1.getId(), b1);
System.out.println(b1.getId() + "---------------");
bookdb.put(b2.getId(), b2);
bookdb.put(b3.getId(), b3);
}
@Override
public Collection<Books> ViewAllBooks() {
return bookdb.values();
}
@Override
public Collection<Cart> ViewCart() {
return cart.values();
}
@Override
public void addBook(int id) {
if (cart.get(id) == null) {
for (Books book : ViewAllBooks()) {
if (book.getId() == id) {
Cart crt = new Cart(1, book);
cart.put(id, crt);
}
}
} else {
Cart crt = cart.get(id);
crt.setQuantity(crt.getQuantity() + 1);
}
}
@Override
public void delete(int id) {
for (Cart crt : ViewCart()) {
if (crt.getBook().getId() == id) {
if (crt.getQuantity() > 1) {
crt.setQuantity(crt.getQuantity() - 1);
break;
} else {
cart.remove(id);
break;
}
}
}
}
@Override
public int getTotalQuantity() {
int totalQuantity = 0;
for (Cart crt : ViewCart()) {
totalQuantity += crt.getQuantity();
}
System.out.println("The quantity is" + totalQuantity);
return totalQuantity;
}
@Override
public double getTotalPrice() {
double totalPrice = 0.0;
for (Cart crt : ViewCart()) {
totalPrice += (crt.getQuantity()) * (crt.getBook().getPrice());
}
// System.out.println(totalPrice);
return totalPrice;
}
}
| 2,040 | 0.607353 | 0.590196 | 92 | 20.173914 | 20.806358 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.086957 | false | false | 13 |
35353f9a952bf67b9859712bdc638959141c18c9 | 14,164,802,162,126 | 9a84da6a76413128c82099ee4888d6e909d0f664 | /app/src/main/java/app/smarthome/smarthome/GlobalValue.java | 0a0a6a771e5226a1912ce08c13e08aaf8b7532ab | [] | no_license | SME-Group/SmartHome | https://github.com/SME-Group/SmartHome | 07195da9856fa7c70e1f1c46d2f7fbb718c9e64d | 51387c619efc9e448881af42476dd65c61a9d749 | refs/heads/master | 2021-08-22T03:54:13.937000 | 2017-11-29T06:31:03 | 2017-11-29T06:31:03 | 112,418,119 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package app.smarthome.smarthome;
import android.app.Application;
/**
* Created by limzh on 21/12/2015.
*/
public class GlobalValue extends Application{
private String doorBool = "0"; // 0 = authorised, 1 = unauthorised
private String tempBool = "24"; // Day time = 26-30, Night time = 0-26
private String smokeBool = "0"; // 0 = absent, 1 = present
private String gasBool = "0"; // 0 = absent, 1 = present
private String humBool = "35"; // raining potential = 85 - 100
private String DoorOpenBool = "0"; // 0 = door closed, 1 = door opened
private String alarmValue = "7:00am";
private String autoPlayTime = "8:00pm";
private String sleepTime = "12:00pm";
private String livingRoomBool = "0"; // 0 = closed
private String diningRoomBool = "0";
private String masterRoomBool = "0";
private String kitchenBool = "0";
private String clothHorseBool = "0"; // 0 = Protection Mode Off
public String getClothHorseBool() {
return clothHorseBool;
}
public void setClothHorseBool(String clothHorseBool) {
this.clothHorseBool = clothHorseBool;
}
public String getLivingRoomBool() {
return livingRoomBool;
}
public void setLivingRoomBool(String livingRoomBool) {
this.livingRoomBool = livingRoomBool;
}
public String getDiningRoomBool() {
return diningRoomBool;
}
public void setDiningRoomBool(String diningRoomBool) {
this.diningRoomBool = diningRoomBool;
}
public String getMasterRoomBool() {
return masterRoomBool;
}
public void setMasterRoomBool(String masterRoomBool) {
this.masterRoomBool = masterRoomBool;
}
public String getKitchenBool() {
return kitchenBool;
}
public void setKitchenBool(String kitchenBool) {
this.kitchenBool = kitchenBool;
}
public String getSleepTime() {
return sleepTime;
}
public void setSleepTime(String sleepTime) {
this.sleepTime = sleepTime;
}
public String getAutoPlayTime() {
return autoPlayTime;
}
public void setAutoPlayTime(String autoPlayTime) {
this.autoPlayTime = autoPlayTime;
}
public String getAlarmValue() {
return alarmValue;
}
public void setAlarmValue(String alarmValue) {
this.alarmValue = alarmValue;
}
public String getDoorOpenBool() {
return DoorOpenBool;
}
public void setDoorOpenBool(String doorOpenBool) {
DoorOpenBool = doorOpenBool;
}
public String getTempBool() {
return tempBool;
}
public void setTempBool(String tempBool) {
this.tempBool = tempBool;
}
public String getSmokeBool() {
return smokeBool;
}
public void setSmokeBool(String smokeBool) {
this.smokeBool = smokeBool;
}
public String getGasBool() {
return gasBool;
}
public void setGasBool(String gasBool) {
this.gasBool = gasBool;
}
public String getHumBool() {
return humBool;
}
public void setHumBool(String humBool) {
this.humBool = humBool;
}
public String getDoorBool() {
return doorBool;
}
public void setDoorBool(String doorBool) {
this.doorBool = doorBool;
}
}
| UTF-8 | Java | 3,316 | java | GlobalValue.java | Java | [
{
"context": "import android.app.Application;\n\n/**\n * Created by limzh on 21/12/2015.\n */\npublic class GlobalValue exten",
"end": 90,
"score": 0.9996317625045776,
"start": 85,
"tag": "USERNAME",
"value": "limzh"
}
] | null | [] | package app.smarthome.smarthome;
import android.app.Application;
/**
* Created by limzh on 21/12/2015.
*/
public class GlobalValue extends Application{
private String doorBool = "0"; // 0 = authorised, 1 = unauthorised
private String tempBool = "24"; // Day time = 26-30, Night time = 0-26
private String smokeBool = "0"; // 0 = absent, 1 = present
private String gasBool = "0"; // 0 = absent, 1 = present
private String humBool = "35"; // raining potential = 85 - 100
private String DoorOpenBool = "0"; // 0 = door closed, 1 = door opened
private String alarmValue = "7:00am";
private String autoPlayTime = "8:00pm";
private String sleepTime = "12:00pm";
private String livingRoomBool = "0"; // 0 = closed
private String diningRoomBool = "0";
private String masterRoomBool = "0";
private String kitchenBool = "0";
private String clothHorseBool = "0"; // 0 = Protection Mode Off
public String getClothHorseBool() {
return clothHorseBool;
}
public void setClothHorseBool(String clothHorseBool) {
this.clothHorseBool = clothHorseBool;
}
public String getLivingRoomBool() {
return livingRoomBool;
}
public void setLivingRoomBool(String livingRoomBool) {
this.livingRoomBool = livingRoomBool;
}
public String getDiningRoomBool() {
return diningRoomBool;
}
public void setDiningRoomBool(String diningRoomBool) {
this.diningRoomBool = diningRoomBool;
}
public String getMasterRoomBool() {
return masterRoomBool;
}
public void setMasterRoomBool(String masterRoomBool) {
this.masterRoomBool = masterRoomBool;
}
public String getKitchenBool() {
return kitchenBool;
}
public void setKitchenBool(String kitchenBool) {
this.kitchenBool = kitchenBool;
}
public String getSleepTime() {
return sleepTime;
}
public void setSleepTime(String sleepTime) {
this.sleepTime = sleepTime;
}
public String getAutoPlayTime() {
return autoPlayTime;
}
public void setAutoPlayTime(String autoPlayTime) {
this.autoPlayTime = autoPlayTime;
}
public String getAlarmValue() {
return alarmValue;
}
public void setAlarmValue(String alarmValue) {
this.alarmValue = alarmValue;
}
public String getDoorOpenBool() {
return DoorOpenBool;
}
public void setDoorOpenBool(String doorOpenBool) {
DoorOpenBool = doorOpenBool;
}
public String getTempBool() {
return tempBool;
}
public void setTempBool(String tempBool) {
this.tempBool = tempBool;
}
public String getSmokeBool() {
return smokeBool;
}
public void setSmokeBool(String smokeBool) {
this.smokeBool = smokeBool;
}
public String getGasBool() {
return gasBool;
}
public void setGasBool(String gasBool) {
this.gasBool = gasBool;
}
public String getHumBool() {
return humBool;
}
public void setHumBool(String humBool) {
this.humBool = humBool;
}
public String getDoorBool() {
return doorBool;
}
public void setDoorBool(String doorBool) {
this.doorBool = doorBool;
}
}
| 3,316 | 0.64234 | 0.626357 | 136 | 23.382353 | 21.370354 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.360294 | false | false | 13 |
df0b18273a57b2ca1cab6536734c869646e1a42c | 6,811,818,158,850 | 5a027c7a6d9afc1bbc8b2bc86e43e96b80dd9fa8 | /workspace_movistar_wl11/zejbVpiStbBaClient/actividadesvpistbba/co/com/telefonica/atiempo/vpistbba/actividades/factory/df/ACierrePrimarioPeticionFactory.java | 07032c965cc7dbeabd8a135e00550b8b3c0e06b0 | [] | no_license | alexcamp/ArrobaTiempoGradle | https://github.com/alexcamp/ArrobaTiempoGradle | 00135dc6f101e99026a377adc0d3b690cb5f2bd7 | fc4a845573232e332c5f1211b72216ce227c3f38 | refs/heads/master | 2020-12-31T00:18:57.337000 | 2016-05-27T15:02:04 | 2016-05-27T15:02:04 | 59,520,455 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Created on May 6, 2008
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package co.com.telefonica.atiempo.vpistbba.actividades.factory.df;
import javax.ejb.CreateException;
import javax.naming.NamingException;
import co.com.telefonica.atiempo.actividades.IActividadEJB;
import co.com.telefonica.atiempo.actividades.IActividadFactoryEJBService;
import co.com.telefonica.atiempo.vpistbba.actividades.df.ejb.sb.ACierrePrimarioPeticionLocalHome;
import com.telefonica_chile.atiempo.actividades.TnProcesoExcepcion;
import com.telefonica_chile.atiempo.utiles.HomeFactory;
/**
* @author 804226
*
* For TCS ( TATA Consultancy Services).
*/
public class ACierrePrimarioPeticionFactory implements IActividadFactoryEJBService {
/* (non-Javadoc)
* @see co.com.telefonica.atiempo.vpistbba.actividades.factory.IActividadFactoryEJBService#getActividadEJB()
*/
public IActividadEJB getActividadEJB() throws TnProcesoExcepcion {
IActividadEJB actEJB=null;
try {
ACierrePrimarioPeticionLocalHome ejbHome= (ACierrePrimarioPeticionLocalHome)HomeFactory.getHome(ACierrePrimarioPeticionLocalHome.JNDI_NAME);
actEJB=(IActividadEJB) ejbHome.create();
} catch (CreateException e) {
throw new TnProcesoExcepcion(e.getClass().getName() + " : El EJB " + ACierrePrimarioPeticionLocalHome.JNDI_NAME + " no es posible levantarlo" + e.getMessage());
} catch (NamingException e) {
throw new TnProcesoExcepcion(e.getClass().getName() + " : El EJB " + ACierrePrimarioPeticionLocalHome.JNDI_NAME + " no es posible levantarlo" + e.getMessage());
}
return actEJB;
}
}
| UTF-8 | Java | 1,670 | java | ACierrePrimarioPeticionFactory.java | Java | [
{
"context": "hile.atiempo.utiles.HomeFactory;\n\n\n/**\n * @author 804226\n *\n * For TCS ( TATA Consultancy Services).\n */\np",
"end": 685,
"score": 0.9982628226280212,
"start": 679,
"tag": "USERNAME",
"value": "804226"
}
] | null | [] | /*
* Created on May 6, 2008
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package co.com.telefonica.atiempo.vpistbba.actividades.factory.df;
import javax.ejb.CreateException;
import javax.naming.NamingException;
import co.com.telefonica.atiempo.actividades.IActividadEJB;
import co.com.telefonica.atiempo.actividades.IActividadFactoryEJBService;
import co.com.telefonica.atiempo.vpistbba.actividades.df.ejb.sb.ACierrePrimarioPeticionLocalHome;
import com.telefonica_chile.atiempo.actividades.TnProcesoExcepcion;
import com.telefonica_chile.atiempo.utiles.HomeFactory;
/**
* @author 804226
*
* For TCS ( TATA Consultancy Services).
*/
public class ACierrePrimarioPeticionFactory implements IActividadFactoryEJBService {
/* (non-Javadoc)
* @see co.com.telefonica.atiempo.vpistbba.actividades.factory.IActividadFactoryEJBService#getActividadEJB()
*/
public IActividadEJB getActividadEJB() throws TnProcesoExcepcion {
IActividadEJB actEJB=null;
try {
ACierrePrimarioPeticionLocalHome ejbHome= (ACierrePrimarioPeticionLocalHome)HomeFactory.getHome(ACierrePrimarioPeticionLocalHome.JNDI_NAME);
actEJB=(IActividadEJB) ejbHome.create();
} catch (CreateException e) {
throw new TnProcesoExcepcion(e.getClass().getName() + " : El EJB " + ACierrePrimarioPeticionLocalHome.JNDI_NAME + " no es posible levantarlo" + e.getMessage());
} catch (NamingException e) {
throw new TnProcesoExcepcion(e.getClass().getName() + " : El EJB " + ACierrePrimarioPeticionLocalHome.JNDI_NAME + " no es posible levantarlo" + e.getMessage());
}
return actEJB;
}
}
| 1,670 | 0.782635 | 0.776048 | 44 | 36.954544 | 44.042828 | 163 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.181818 | false | false | 13 |
36702fd6a548c97c31c877edb62e23b4fc37f8e7 | 8,426,725,856,506 | 05c99c84ad7d0ae3a9f1040905d1100620db65b7 | /src/main/java/com/itexico/demo/models/dao/IReservationDao.java | c8f789b82957eab22af7d8cd42a92dbeba3bd544 | [] | no_license | edgarmagana/DemoItexico | https://github.com/edgarmagana/DemoItexico | ec762f1d14cf63821ca4dfd056813d83a9a7ba8b | 2a9001dcfd8697adc5831d3cab3e992a32b0ebc2 | refs/heads/master | 2022-12-11T12:01:51.615000 | 2020-08-31T00:24:29 | 2020-08-31T00:24:29 | 291,345,540 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.itexico.demo.models.dao;
import com.itexico.demo.models.entity.Reservation;
import org.springframework.data.repository.CrudRepository;
/**
*Provides all methods for DAO operations.
* It use the CrudRepository interface for common methods.
* examples: findAll(),findById(),save().
*/
public interface IReservationDao extends CrudRepository<Reservation, Integer> {
}
| UTF-8 | Java | 388 | java | IReservationDao.java | Java | [] | null | [] | package com.itexico.demo.models.dao;
import com.itexico.demo.models.entity.Reservation;
import org.springframework.data.repository.CrudRepository;
/**
*Provides all methods for DAO operations.
* It use the CrudRepository interface for common methods.
* examples: findAll(),findById(),save().
*/
public interface IReservationDao extends CrudRepository<Reservation, Integer> {
}
| 388 | 0.778351 | 0.778351 | 13 | 28.846153 | 26.92967 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false | 13 |
af76ce37564d8a41491539f52f29f1ef9b87d92e | 24,386,824,320,924 | 30f27a1b0fc60e1179ac4cc248df9253745d314e | /20200708Reflection/src/com/company/ParentClass.java | 1ca362a69e3704a94880d593f038167708339c82 | [] | no_license | Evgenij-Pavlenko/TelranIdea | https://github.com/Evgenij-Pavlenko/TelranIdea | f19e7bb6c968679a9a97a46c1a08c1bd83266223 | 1f277ac5ddf8df4764eb872e84878c93dfc3277a | refs/heads/master | 2021-03-05T15:18:25.967000 | 2020-07-27T21:40:17 | 2020-07-27T21:40:17 | 246,560,664 | 1 | 0 | null | false | 2020-06-25T20:01:04 | 2020-03-11T12:08:03 | 2020-05-05T22:29:20 | 2020-06-25T19:59:54 | 585 | 0 | 0 | 9 | Java | false | false | package com.company;
public class ParentClass {
}
| UTF-8 | Java | 51 | java | ParentClass.java | Java | [] | null | [] | package com.company;
public class ParentClass {
}
| 51 | 0.764706 | 0.764706 | 4 | 11.75 | 11.453712 | 26 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 13 |
247c4d2b5bc070a04a8238de475905f37a3e17a1 | 25,984,552,152,865 | 9335e78a81393635f04ee2f2a2bfed7eb06f34e8 | /framework/framework-provider/src/main/java/com/haojiankang/framework/provider/utils/validate/ValidateFunction.java | 0a68bc2f8d9edbbeb03da3be21c34bf58c7eb121 | [
"Apache-2.0"
] | permissive | haojiankang/spring-cloud | https://github.com/haojiankang/spring-cloud | 6ebf1efd9513a8674608fad8bc3a2678840f94ed | 0c07bb4617b09f12199f686477f1f52c0469ad6c | refs/heads/master | 2020-05-25T16:03:42.371000 | 2017-03-28T01:31:17 | 2017-03-28T01:31:17 | 84,944,632 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Project Name:EHealthData
* File Name:ValidateFunction.java
* Package Name:com.ghit.common.validate
* Date:2016年6月23日上午11:10:33
*/
package com.haojiankang.framework.provider.utils.validate;
import java.util.List;
/**
* ClassName:ValidateFunction <br/>
* Function: 注册验证时的函数 <br/>
* Date: 2016年6月23日 上午11:10:33 <br/>
*
* @author ren7wei
* @version
* @since JDK 1.6
* @see
*/
public class ValidateFunction {
public boolean eq(Object arg1, Object arg2) {
if (arg1 == arg2)
return true;
if (arg1 == null || arg2 == null)
return false;
return arg1.toString().equals(arg2.toString());
}
public boolean empty(Object obj) {
if (obj == null)
return true;
if (obj instanceof String)
return obj.toString().equals("");
return false;
}
public boolean notEmpty(Object obj) {
return !empty(obj);
}
public boolean len(Object obj, int min, int max) {
int length = 0;
if (obj != null)
length = obj.toString().length();
return length >= min && length <= max ;
}
public boolean in(Object obj, List<Object> args) {
return args.stream().filter(t -> {
return eq(obj, t);
}).count() > 0;
}
}
| UTF-8 | Java | 1,343 | java | ValidateFunction.java | Java | [
{
"context": "* Date: 2016年6月23日 上午11:10:33 <br/>\n * \n * @author ren7wei\n * @version\n * @since JDK 1.6\n * @see\n */\npublic ",
"end": 358,
"score": 0.9994282722473145,
"start": 351,
"tag": "USERNAME",
"value": "ren7wei"
}
] | null | [] | /**
* Project Name:EHealthData
* File Name:ValidateFunction.java
* Package Name:com.ghit.common.validate
* Date:2016年6月23日上午11:10:33
*/
package com.haojiankang.framework.provider.utils.validate;
import java.util.List;
/**
* ClassName:ValidateFunction <br/>
* Function: 注册验证时的函数 <br/>
* Date: 2016年6月23日 上午11:10:33 <br/>
*
* @author ren7wei
* @version
* @since JDK 1.6
* @see
*/
public class ValidateFunction {
public boolean eq(Object arg1, Object arg2) {
if (arg1 == arg2)
return true;
if (arg1 == null || arg2 == null)
return false;
return arg1.toString().equals(arg2.toString());
}
public boolean empty(Object obj) {
if (obj == null)
return true;
if (obj instanceof String)
return obj.toString().equals("");
return false;
}
public boolean notEmpty(Object obj) {
return !empty(obj);
}
public boolean len(Object obj, int min, int max) {
int length = 0;
if (obj != null)
length = obj.toString().length();
return length >= min && length <= max ;
}
public boolean in(Object obj, List<Object> args) {
return args.stream().filter(t -> {
return eq(obj, t);
}).count() > 0;
}
}
| 1,343 | 0.573068 | 0.543229 | 55 | 22.763636 | 17.596449 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.381818 | false | false | 13 |
d9960fbfb5c36e1d0bedc5d1a5028e005eaba802 | 5,205,500,394,342 | 4e73d8858ee288621e08c92ef755317bb3f07149 | /src/main/java/com/db/codecontest/CoreLogic/EmployeeManagerServiceImpl.java | 88c1c0a2eb8c111ceecea8df29f53600d86b5f80 | [] | no_license | rasokan/EmployeeSystem | https://github.com/rasokan/EmployeeSystem | 2402ee5d77fb76cb8a3166d39667aaa8571dc512 | 831bde3d917f7a40f5d40df802b2ecb1afbe5f50 | refs/heads/master | 2021-01-10T21:29:19.934000 | 2014-05-13T04:27:02 | 2014-05-13T04:27:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.db.codecontest.CoreLogic;
import com.db.codecontest.DomainModel.Employee;
public class EmployeeManagerServiceImpl implements EmployeeManagerService {
public Boolean addNewEmployee(Employee employee) {
// TODO Auto-generated method stub
return null;
}
public Employee searchEmployee(Employee employee) {
// TODO Auto-generated method stub
return null;
}
}
| UTF-8 | Java | 384 | java | EmployeeManagerServiceImpl.java | Java | [] | null | [] | package com.db.codecontest.CoreLogic;
import com.db.codecontest.DomainModel.Employee;
public class EmployeeManagerServiceImpl implements EmployeeManagerService {
public Boolean addNewEmployee(Employee employee) {
// TODO Auto-generated method stub
return null;
}
public Employee searchEmployee(Employee employee) {
// TODO Auto-generated method stub
return null;
}
}
| 384 | 0.789063 | 0.789063 | 17 | 21.588236 | 23.736443 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.941176 | false | false | 13 |
23a4929506a25a3697e187d73aaa72c0939836be | 2,164,663,578,975 | 19e144e1d84956bc502e2c76362d827e8c4374e4 | /src/main/java/com/osis/cipres/users/AuditRegister.java | 57618020e5eb45fad48286d4020088141dc7619d | [] | no_license | DjeHermann/Test_git_v1 | https://github.com/DjeHermann/Test_git_v1 | c0435458b2834e06ce919cce494e11912e170571 | 9e196808b6690a9cba0d55ce471011e0d3632a4b | refs/heads/master | 2023-03-06T03:35:22.804000 | 2021-02-16T13:29:35 | 2021-02-16T13:29:35 | 339,458,316 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.osis.cipres.users;
import java.util.Date;
public class AuditRegister {
private String user;
private String action;
private Date actionDate;
private String Statut;
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public Date getActionDate() {
return actionDate;
}
public void setActionDate(Date actionDate) {
this.actionDate = actionDate;
}
public String getStatut() {
return Statut;
}
public void setStatut(String statut) {
Statut = statut;
}
public AuditRegister(String user, String action, Date actionDate, String statut) {
super();
this.user = user;
this.action = action;
this.actionDate = actionDate;
Statut = statut;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public AuditRegister() {
super();
// TODO Auto-generated constructor stub
}
public String toString() {
return this.user+" "+this.action+" avec "+this.Statut+" "+this.actionDate+"";
}
}
| UTF-8 | Java | 1,048 | java | AuditRegister.java | Java | [] | null | [] | package com.osis.cipres.users;
import java.util.Date;
public class AuditRegister {
private String user;
private String action;
private Date actionDate;
private String Statut;
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public Date getActionDate() {
return actionDate;
}
public void setActionDate(Date actionDate) {
this.actionDate = actionDate;
}
public String getStatut() {
return Statut;
}
public void setStatut(String statut) {
Statut = statut;
}
public AuditRegister(String user, String action, Date actionDate, String statut) {
super();
this.user = user;
this.action = action;
this.actionDate = actionDate;
Statut = statut;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public AuditRegister() {
super();
// TODO Auto-generated constructor stub
}
public String toString() {
return this.user+" "+this.action+" avec "+this.Statut+" "+this.actionDate+"";
}
}
| 1,048 | 0.697519 | 0.697519 | 54 | 18.407408 | 18.02829 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.574074 | false | false | 2 |
901bb6ae2f21e0850fc612c8e6a27c2cc7df315c | 8,246,337,272,895 | aba44c02a75bd9b4bc792dc6ee8d81606d8de6b0 | /Main.java | e8249e19de8f3ecdee79f878d681221b1401b40f | [] | no_license | soibac35/Leauge-of-Legends-ping-checks-desktop | https://github.com/soibac35/Leauge-of-Legends-ping-checks-desktop | 951ed09214028a965dccd20bd5a02369d6ec654a | cf03d9ef8eae3bfda6eda08cfef8a4a35f100495 | refs/heads/master | 2020-04-04T18:35:44.145000 | 2018-11-05T06:21:53 | 2018-11-05T06:21:53 | 156,169,969 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.RenderingHints;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
/*********************************************************
** **
** Simple program to check ping on LOL server **
** **
**********************************************************/
public class Main {
// create thread
private static ExecutorService threadService = Executors.newFixedThreadPool(2);
private static ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
private static boolean notified = false;
// Settings
private static long averagePing;
private static int tolerance;
private static String server1;
private static String server2;
private static long updateInterval;
private static boolean notifications;
private static boolean logToFile;
// Window
private static JFrame frame = new JFrame();
private static PopupMenu popup;
private static SystemTray tray;
private static TrayIcon trayIcon;
public static void main(String[] args) {
loadSettings();
setupTray();
initiate();
}
private static void loadSettings() {
try {
Path path = filePrep(System.getProperty("user.dir") + "/settings.txt",false);
if(!Files.exists(path)) {
path = filePrep(System.getProperty("user.home") + "/settings.txt",false);
}
Properties prop = new Properties();
InputStream input = new FileInputStream(path.toString());
prop.load(input);
averagePing = Long.parseLong(prop.getProperty("averagePing"));
tolerance = Integer.parseInt(prop.getProperty("tolerance"));
server1 = prop.getProperty("server1");
server2 = prop.getProperty("server2");
updateInterval = Long.parseLong(prop.getProperty("updateInterval"));
notifications = Boolean.valueOf(prop.getProperty("notifications"));
logToFile = Boolean.valueOf(prop.getProperty("logToFile"));
OutputStream output = new FileOutputStream(path.toString());
prop.store(output,null);
input.close();
output.close();
} catch(Exception e) {e.printStackTrace();}
}
private static void initiate() {
Runnable runnable = new Runnable() {
public void run() {
long ping = pingServer(server1);
if(ping < 0 && !server2.equals("") && server2 != null) {
ping = pingServer(server2);
}
notifyPing(ping);
}
};
service.scheduleAtFixedRate(runnable,0L,updateInterval,TimeUnit.SECONDS);
}
private static long pingServer(String server) {
try {
long start = System.currentTimeMillis();
InetAddress address = InetAddress.getByName(server);
address.isReachable(10000);
return System.currentTimeMillis()-start;
} catch(Exception e) {e.printStackTrace();}
return -1;
}
private static void notifyPing(long ping) {
try {
final long latency = ping;
trayIcon.setImage(textToImage(ping));
if(logToFile) {
write(new SimpleDateFormat("MMM d, h:mma ").format(new Date()) + ping + "ms",System.getProperty("user.home") + "/log.txt");
}
if(notifications) {
if(ping < 0 && !notified) {
threadService.submit(new Runnable() {public void run() {JOptionPane.showMessageDialog(frame,"Error connecting to server","No Connection",JOptionPane.ERROR_MESSAGE);}});
notified = true;
}
else if(ping >= averagePing+tolerance && !notified) {
threadService.submit(new Runnable() {public void run() {JOptionPane.showMessageDialog(frame,"Ping is " + latency + "ms","High Ping",JOptionPane.ERROR_MESSAGE);}});
notified = true;
}
else if(ping < averagePing+tolerance && notified) {
threadService.submit(new Runnable() {public void run() {JOptionPane.showMessageDialog(frame,"Ping is " + latency + "ms");}});
notified = false;
}
}
} catch(Exception e) {e.printStackTrace();}
}
private static void setupTray() {
try {
// Window
frame.setTitle("Ping Check");
frame.setAlwaysOnTop(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// Tray Options
popup = new PopupMenu();
MenuItem defaultItem = new MenuItem("Exit");
defaultItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
popup.add(defaultItem);
// Tray
tray = SystemTray.getSystemTray();
trayIcon = new TrayIcon(textToImage(0),"League Ping",popup);
trayIcon.setImageAutoSize(true);
frame.addWindowStateListener(new WindowStateListener() {
public void windowStateChanged(WindowEvent e) {
try {
if(e.getNewState() == JFrame.ICONIFIED) {
tray.add(trayIcon);
frame.setVisible(false);
}
if(e.getNewState() == 7){
tray.add(trayIcon);
frame.setVisible(false);
}
if(e.getNewState() == JFrame.MAXIMIZED_BOTH) {
tray.remove(trayIcon);
frame.setVisible(true);
}
if(e.getNewState() == JFrame.NORMAL) {
tray.remove(trayIcon);
frame.setVisible(true);
}
} catch(Exception ex) {ex.printStackTrace();}
}
});
tray.add(trayIcon);
} catch(Exception e) {e.printStackTrace();}
}
public static Image textToImage(long number) {
String text = Long.toString(number);
Font font = new Font(Font.DIALOG,Font.PLAIN,18);
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = img.createGraphics();
g2d.setFont(font);
FontMetrics fm = g2d.getFontMetrics();
int width = fm.stringWidth(text);
int height = fm.getHeight();
g2d.dispose();
img = new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
g2d = img.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2d.setFont(font);
fm = g2d.getFontMetrics();
Color color = Color.YELLOW;
if(number <= averagePing-5) {
color = Color.GREEN;
}
else if(number >= averagePing+5) {
color = Color.ORANGE;
}
g2d.setColor(color);
g2d.drawString(text, 0, fm.getAscent());
g2d.dispose();
int trayIconWidth = new TrayIcon(img).getSize().width;
return img.getScaledInstance(trayIconWidth,-1,Image.SCALE_SMOOTH);
}
private static void write(String line, String dir) {
try {
FileWriter writer = new FileWriter(filePrep(dir).toString(),true);
writer.write(line + "\r\n");
writer.close();
} catch(Exception e) {e.printStackTrace();}
}
public static Path filePrep(String dir, boolean... createFile) {
dir = dir.replaceAll("/","\\" + System.getProperty("file.separator"));
Path path = Paths.get(dir);
try {
if((createFile.length == 0 || (createFile.length > 0 && createFile[0]))) {
if(path.getParent() != null) {
Files.createDirectories(path.getParent());
}
if(!Files.exists(path) && path.toString().substring(path.toString().length()-4).contains(".")) {
Files.createFile(path);
}
}
} catch(Exception e) {e.printStackTrace();}
return path;
}
} | UTF-8 | Java | 8,820 | java | Main.java | Java | [] | null | [] | import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.RenderingHints;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
/*********************************************************
** **
** Simple program to check ping on LOL server **
** **
**********************************************************/
public class Main {
// create thread
private static ExecutorService threadService = Executors.newFixedThreadPool(2);
private static ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
private static boolean notified = false;
// Settings
private static long averagePing;
private static int tolerance;
private static String server1;
private static String server2;
private static long updateInterval;
private static boolean notifications;
private static boolean logToFile;
// Window
private static JFrame frame = new JFrame();
private static PopupMenu popup;
private static SystemTray tray;
private static TrayIcon trayIcon;
public static void main(String[] args) {
loadSettings();
setupTray();
initiate();
}
private static void loadSettings() {
try {
Path path = filePrep(System.getProperty("user.dir") + "/settings.txt",false);
if(!Files.exists(path)) {
path = filePrep(System.getProperty("user.home") + "/settings.txt",false);
}
Properties prop = new Properties();
InputStream input = new FileInputStream(path.toString());
prop.load(input);
averagePing = Long.parseLong(prop.getProperty("averagePing"));
tolerance = Integer.parseInt(prop.getProperty("tolerance"));
server1 = prop.getProperty("server1");
server2 = prop.getProperty("server2");
updateInterval = Long.parseLong(prop.getProperty("updateInterval"));
notifications = Boolean.valueOf(prop.getProperty("notifications"));
logToFile = Boolean.valueOf(prop.getProperty("logToFile"));
OutputStream output = new FileOutputStream(path.toString());
prop.store(output,null);
input.close();
output.close();
} catch(Exception e) {e.printStackTrace();}
}
private static void initiate() {
Runnable runnable = new Runnable() {
public void run() {
long ping = pingServer(server1);
if(ping < 0 && !server2.equals("") && server2 != null) {
ping = pingServer(server2);
}
notifyPing(ping);
}
};
service.scheduleAtFixedRate(runnable,0L,updateInterval,TimeUnit.SECONDS);
}
private static long pingServer(String server) {
try {
long start = System.currentTimeMillis();
InetAddress address = InetAddress.getByName(server);
address.isReachable(10000);
return System.currentTimeMillis()-start;
} catch(Exception e) {e.printStackTrace();}
return -1;
}
private static void notifyPing(long ping) {
try {
final long latency = ping;
trayIcon.setImage(textToImage(ping));
if(logToFile) {
write(new SimpleDateFormat("MMM d, h:mma ").format(new Date()) + ping + "ms",System.getProperty("user.home") + "/log.txt");
}
if(notifications) {
if(ping < 0 && !notified) {
threadService.submit(new Runnable() {public void run() {JOptionPane.showMessageDialog(frame,"Error connecting to server","No Connection",JOptionPane.ERROR_MESSAGE);}});
notified = true;
}
else if(ping >= averagePing+tolerance && !notified) {
threadService.submit(new Runnable() {public void run() {JOptionPane.showMessageDialog(frame,"Ping is " + latency + "ms","High Ping",JOptionPane.ERROR_MESSAGE);}});
notified = true;
}
else if(ping < averagePing+tolerance && notified) {
threadService.submit(new Runnable() {public void run() {JOptionPane.showMessageDialog(frame,"Ping is " + latency + "ms");}});
notified = false;
}
}
} catch(Exception e) {e.printStackTrace();}
}
private static void setupTray() {
try {
// Window
frame.setTitle("Ping Check");
frame.setAlwaysOnTop(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// Tray Options
popup = new PopupMenu();
MenuItem defaultItem = new MenuItem("Exit");
defaultItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
popup.add(defaultItem);
// Tray
tray = SystemTray.getSystemTray();
trayIcon = new TrayIcon(textToImage(0),"League Ping",popup);
trayIcon.setImageAutoSize(true);
frame.addWindowStateListener(new WindowStateListener() {
public void windowStateChanged(WindowEvent e) {
try {
if(e.getNewState() == JFrame.ICONIFIED) {
tray.add(trayIcon);
frame.setVisible(false);
}
if(e.getNewState() == 7){
tray.add(trayIcon);
frame.setVisible(false);
}
if(e.getNewState() == JFrame.MAXIMIZED_BOTH) {
tray.remove(trayIcon);
frame.setVisible(true);
}
if(e.getNewState() == JFrame.NORMAL) {
tray.remove(trayIcon);
frame.setVisible(true);
}
} catch(Exception ex) {ex.printStackTrace();}
}
});
tray.add(trayIcon);
} catch(Exception e) {e.printStackTrace();}
}
public static Image textToImage(long number) {
String text = Long.toString(number);
Font font = new Font(Font.DIALOG,Font.PLAIN,18);
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = img.createGraphics();
g2d.setFont(font);
FontMetrics fm = g2d.getFontMetrics();
int width = fm.stringWidth(text);
int height = fm.getHeight();
g2d.dispose();
img = new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
g2d = img.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g2d.setFont(font);
fm = g2d.getFontMetrics();
Color color = Color.YELLOW;
if(number <= averagePing-5) {
color = Color.GREEN;
}
else if(number >= averagePing+5) {
color = Color.ORANGE;
}
g2d.setColor(color);
g2d.drawString(text, 0, fm.getAscent());
g2d.dispose();
int trayIconWidth = new TrayIcon(img).getSize().width;
return img.getScaledInstance(trayIconWidth,-1,Image.SCALE_SMOOTH);
}
private static void write(String line, String dir) {
try {
FileWriter writer = new FileWriter(filePrep(dir).toString(),true);
writer.write(line + "\r\n");
writer.close();
} catch(Exception e) {e.printStackTrace();}
}
public static Path filePrep(String dir, boolean... createFile) {
dir = dir.replaceAll("/","\\" + System.getProperty("file.separator"));
Path path = Paths.get(dir);
try {
if((createFile.length == 0 || (createFile.length > 0 && createFile[0]))) {
if(path.getParent() != null) {
Files.createDirectories(path.getParent());
}
if(!Files.exists(path) && path.toString().substring(path.toString().length()-4).contains(".")) {
Files.createFile(path);
}
}
} catch(Exception e) {e.printStackTrace();}
return path;
}
} | 8,820 | 0.684354 | 0.678118 | 241 | 34.605808 | 27.989443 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.273859 | false | false | 2 |
3f9c02084764d9f66f48687c0ae398a7bf52f2e9 | 24,215,025,672,677 | 8e23d6441c7649d712084e42851938347cf9d2d3 | /src/com/skytree/epubtest/SkyApplication.java | 448fdba56e897b796c3c2f10063a57d46da4e979 | [] | no_license | johan--/SkyTest | https://github.com/johan--/SkyTest | 2d5a739e55844e8b3fcb7b7683e2fa47eeb8cd22 | 848654a283ee048b061458b211157a057f81721a | refs/heads/master | 2020-03-09T01:18:40.539000 | 2016-08-16T14:38:22 | 2016-08-16T14:38:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.skytree.epubtest;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import com.skytree.epub.BookInformation;
import com.skytree.epub.SkyKeyManager;
import android.app.Application;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class SkyApplication extends Application {
public String message = "We are the world.";
public ArrayList<BookInformation> bis;
public ArrayList<CustomFont> customFonts = new ArrayList<CustomFont>();
public SkySetting setting;
public SkyDatabase sd = null;
public int sortType=0;
public SkyKeyManager keyManager;
@Override
public void onCreate() {
super.onCreate();
sd = new SkyDatabase(this);
reloadBookInformations();
loadSetting();
createSkyDRM();
}
public void reloadBookInformations() {
this.bis = sd.fetchBookInformations(sortType,"");
}
public void reloadBookInformations(String key) {
this.bis = sd.fetchBookInformations(sortType,key);
}
public void loadSetting() {
this.setting = sd.fetchSetting();
}
public void saveSetting() {
sd.updateSetting(this.setting);
}
public void createSkyDRM() {
this.keyManager = new SkyKeyManager("A3UBZzJNCoXmXQlBWD4xNo", "zfZl40AQXu8xHTGKMRwG69");
}
}
| UTF-8 | Java | 1,412 | java | SkyApplication.java | Java | [
{
"context": "SkyDRM() {\n\t\tthis.keyManager = new SkyKeyManager(\"A3UBZzJNCoXmXQlBWD4xNo\", \"zfZl40AQXu8xHTGKMRwG69\");\t\t\n\t}\n}\n",
"end": 1375,
"score": 0.9996190071105957,
"start": 1353,
"tag": "KEY",
"value": "A3UBZzJNCoXmXQlBWD4xNo"
},
{
"context": "er = new SkyKeyManager(\"A3UBZzJNCoXmXQlBWD4xNo\", \"zfZl40AQXu8xHTGKMRwG69\");\t\t\n\t}\n}\n",
"end": 1401,
"score": 0.9996031522750854,
"start": 1379,
"tag": "KEY",
"value": "zfZl40AQXu8xHTGKMRwG69"
}
] | null | [] | package com.skytree.epubtest;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import com.skytree.epub.BookInformation;
import com.skytree.epub.SkyKeyManager;
import android.app.Application;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class SkyApplication extends Application {
public String message = "We are the world.";
public ArrayList<BookInformation> bis;
public ArrayList<CustomFont> customFonts = new ArrayList<CustomFont>();
public SkySetting setting;
public SkyDatabase sd = null;
public int sortType=0;
public SkyKeyManager keyManager;
@Override
public void onCreate() {
super.onCreate();
sd = new SkyDatabase(this);
reloadBookInformations();
loadSetting();
createSkyDRM();
}
public void reloadBookInformations() {
this.bis = sd.fetchBookInformations(sortType,"");
}
public void reloadBookInformations(String key) {
this.bis = sd.fetchBookInformations(sortType,key);
}
public void loadSetting() {
this.setting = sd.fetchSetting();
}
public void saveSetting() {
sd.updateSetting(this.setting);
}
public void createSkyDRM() {
this.keyManager = new SkyKeyManager("<KEY>", "<KEY>");
}
}
| 1,378 | 0.747875 | 0.74221 | 53 | 25.64151 | 20.076359 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.264151 | false | false | 2 |
642bb79ae6cfffcb3f6016165692a5d8d993def0 | 25,228,637,954,887 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Mate20-9.0/src/main/java/com/android/server/hidata/wavemapping/dao/LocationDAO.java | 90c3fcb60d5dd30aca0108ed209ef2b9d36f7045 | [] | no_license | morningblu/HWFramework | https://github.com/morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603000 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.android.server.hidata.wavemapping.dao;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import com.android.server.hidata.wavemapping.cons.Constant;
import com.android.server.hidata.wavemapping.util.LogUtil;
import java.util.Arrays;
public class LocationDAO {
private static final String TAG = ("WMapping." + LocationDAO.class.getSimpleName());
private SQLiteDatabase db = DatabaseSingleton.getInstance();
public boolean insert(String frequentlocation) {
if (frequentlocation == null) {
LogUtil.d("insert failed ,frequentlocation == null");
return false;
} else if (0 < getOOBTime()) {
return updateFrequentLocation(frequentlocation);
} else {
ContentValues cValue = new ContentValues();
long now = System.currentTimeMillis();
cValue.put("UPDATETIME", Long.valueOf(now));
cValue.put("OOBTIME", Long.valueOf(now));
cValue.put("FREQUENTLOCATION", frequentlocation);
try {
this.db.beginTransaction();
this.db.insert(Constant.LOCATION_TABLE_NAME, null, cValue);
this.db.setTransactionSuccessful();
this.db.endTransaction();
return true;
} catch (Exception e) {
LogUtil.e("insert exception: " + e.getMessage());
this.db.endTransaction();
return false;
} catch (Throwable th) {
this.db.endTransaction();
throw th;
}
}
}
public boolean insertOOBTime(long OOBTime) {
if (0 < getOOBTime()) {
return false;
}
ContentValues cValue = new ContentValues();
cValue.put("OOBTIME", Long.valueOf(OOBTime));
try {
this.db.beginTransaction();
this.db.insert(Constant.LOCATION_TABLE_NAME, null, cValue);
this.db.setTransactionSuccessful();
this.db.endTransaction();
return true;
} catch (Exception e) {
LogUtil.e("insert exception: " + e.getMessage());
this.db.endTransaction();
return false;
} catch (Throwable th) {
this.db.endTransaction();
throw th;
}
}
public boolean updateFrequentLocation(String frequentlocation) {
if (frequentlocation == null) {
LogUtil.d("update failure,frequentlocation == null");
return false;
}
Object[] args = {Long.valueOf(System.currentTimeMillis()), frequentlocation};
LogUtil.i("update begin: frequentlocation = " + frequentlocation);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE FREQUENT_LOCATION SET UPDATETIME = ?,FREQUENTLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("UPDATE exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean updateBenefitCHRTime(long now) {
if (0 == getOOBTime()) {
LogUtil.i("updateBenefitCHRTime: OOBTime = 0");
return false;
}
Object[] args = {Long.valueOf(now)};
LogUtil.i("update begin: CHRBENEFITUPLOADTIME = " + now);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE FREQUENT_LOCATION SET CHRBENEFITUPLOADTIME = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("UPDATE exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean updateSpaceUserCHRTime(long now) {
if (0 == getOOBTime()) {
LogUtil.i("updateSpaceUserCHRTime: OOBTime = 0");
return false;
}
Object[] args = {Long.valueOf(now)};
LogUtil.i("update begin: CHRSPACEUSERUPLOADTIME = " + now);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE FREQUENT_LOCATION SET CHRSPACEUSERUPLOADTIME = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("UPDATE exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean remove() {
try {
this.db.execSQL("DELETE FROM FREQUENT_LOCATION", null);
return true;
} catch (SQLException e) {
LogUtil.e("remove exception: " + e.getMessage());
return false;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x005f, code lost:
if (r1 == null) goto L_0x0062;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0022, code lost:
if (r1 != null) goto L_0x0024;
*/
public String getFrequentLocation() {
String frequentlocation = null;
Cursor cursor = null;
if (this.db == null) {
return null;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
frequentlocation = cursor.getString(cursor.getColumnIndexOrThrow("FREQUENTLOCATION"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getFrequentLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getFrequentLocation Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
if (frequentlocation != null) {
LogUtil.i("getFrequentLocation, frequentlocation:" + frequentlocation);
} else {
LogUtil.d("getFrequentLocation, NO DATA");
}
return frequentlocation;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x0060, code lost:
if (r2 == null) goto L_0x0063;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0023, code lost:
if (r2 != null) goto L_0x0025;
*/
public long getBenefitCHRTime() {
long time = 0;
Cursor cursor = null;
if (this.db == null) {
return 0;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
time = cursor.getLong(cursor.getColumnIndexOrThrow("CHRBENEFITUPLOADTIME"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getBenefitCHRTime IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getBenefitCHRTime Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
LogUtil.i("getBenefitCHRTime, time:" + time);
return time;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x0060, code lost:
if (r2 == null) goto L_0x0063;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0023, code lost:
if (r2 != null) goto L_0x0025;
*/
public long getSpaceUserCHRTime() {
long time = 0;
Cursor cursor = null;
if (this.db == null) {
return 0;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
time = cursor.getLong(cursor.getColumnIndexOrThrow("CHRSPACEUSERUPLOADTIME"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getSpaceUserCHRTime IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getSpaceUserCHRTime Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
LogUtil.i("getSpaceUserCHRTime, time:" + time);
return time;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x0060, code lost:
if (r2 == null) goto L_0x0063;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0023, code lost:
if (r2 != null) goto L_0x0025;
*/
public long getlastUpdateTime() {
long time = 0;
Cursor cursor = null;
if (this.db == null) {
return 0;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
time = cursor.getLong(cursor.getColumnIndexOrThrow("UPDATETIME"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getlastUpdateTime IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getlastUpdateTime Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
LogUtil.i("getlastUpdateTime, time:" + time);
return time;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x0060, code lost:
if (r2 == null) goto L_0x0063;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0023, code lost:
if (r2 != null) goto L_0x0025;
*/
public long getOOBTime() {
long oob_time = 0;
Cursor cursor = null;
if (this.db == null) {
return 0;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
oob_time = cursor.getLong(cursor.getColumnIndexOrThrow("OOBTIME"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getOOBTime IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getOOBTime Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
LogUtil.d("getOOBTime, OOBTime:" + oob_time);
return oob_time;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
public boolean insertCHR(String freqlocation) {
if (findCHRbyFreqLoc(freqlocation).containsKey("FREQLOCATION")) {
return false;
}
ContentValues cValue = new ContentValues();
cValue.put("FREQLOCATION", freqlocation);
long oobtime = getOOBTime();
long now = System.currentTimeMillis();
int firstreport = Math.round(((float) (now - oobtime)) / 3600000.0f);
cValue.put("FIRSTREPORT", Integer.valueOf(firstreport));
LogUtil.d("insertCHR, OOBTime:" + oobtime + " now: " + now + " first report:" + firstreport);
try {
this.db.beginTransaction();
this.db.insert(Constant.CHR_LOCATION_TABLE_NAME, null, cValue);
this.db.setTransactionSuccessful();
this.db.endTransaction();
return true;
} catch (Exception e) {
LogUtil.e("insertCHR exception: " + e.getMessage());
this.db.endTransaction();
return false;
} catch (Throwable th) {
this.db.endTransaction();
throw th;
}
}
public boolean accCHREnterybyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHREnterybyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: entry " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET ENTERY = ENTERY + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHREnterybyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRLeavebyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRLeavebyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: leave " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET LEAVE = LEAVE + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRLeavebyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRSpaceChangebyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRSpaceChangebyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: SPACECHANGE " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET SPACECHANGE = SPACECHANGE + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRSpaceChangebyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRSpaceLeavebyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRSpaceChangebyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: SPACELEAVE " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET SPACELEAVE = SPACELEAVE + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRSpaceLeavebyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean addCHRDurationbyFreqLoc(int duration, String location) {
if (location == null) {
LogUtil.d("addCHRDurationbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {Integer.valueOf(duration), location};
LogUtil.i("update begin: add duration " + duration + " location:" + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET DURATION = DURATION + ? WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("addCHRDurationbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefNoSwitchFailbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefNoSwitchFailbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPNOSWITCHFAIL at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPNOSWITCHFAIL = UPNOSWITCHFAIL + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefNoSwitchFailbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefAutoFailbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefAutoFailbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPAUTOFAIL at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPAUTOFAIL = UPAUTOFAIL + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefAutoFailbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefAutoSuccbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefAutoSuccbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPAUTOSUCC at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPAUTOSUCC = UPAUTOSUCC + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefAutoSuccbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefManualSuccbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefManualSuccbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPMANUALSUCC at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPMANUALSUCC = UPMANUALSUCC + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefManualSuccbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefTotalSwitchbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefTotalSwitchbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPTOTALSWITCH at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPTOTALSWITCH = UPTOTALSWITCH + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefTotalSwitchbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefQueryCntbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefQueryCntbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPQRYCNT at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPQRYCNT = UPQRYCNT + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefQueryCntbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefResCntbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefResCntbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPRESCNT at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPRESCNT = UPRESCNT + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefResCntbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefUnknownDBbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefUnknownDBbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPUNKNOWNDB at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPUNKNOWNDB = UPUNKNOWNDB + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefUnknownDBbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefUnknownSpacebyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefUnknownSpacebyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPUNKNOWNSPACE at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPUNKNOWNSPACE = UPUNKNOWNSPACE + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefUnknownSpacebyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean resetCHRbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("resetCHRbyFreqLoc failure,frequent location == null");
return false;
} else if (!findCHRbyFreqLoc(location).containsKey("FREQLOCATION")) {
return false;
} else {
Object[] args = {location};
LogUtil.i("update begin: RESET CHR at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET ENTERY = 0,LEAVE = 0,DURATION = 0,SPACECHANGE = 0,SPACELEAVE = 0,UPTOTALSWITCH = 0,UPAUTOSUCC = 0,UPMANUALSUCC = 0,UPAUTOFAIL = 0,UPNOSWITCHFAIL = 0,UPQRYCNT = 0,UPRESCNT = 0,UPUNKNOWNDB = 0,UPUNKNOWNSPACE = 0,LPTOTALSWITCH = 0,LPDATARX = 0,LPDATATX = 0,LPDURATION = 0,LPOFFSET = 0,LPALREADYBEST = 0,LPNOTREACH = 0,LPBACK = 0,LPUNKNOWNDB = 0,LPUNKNOWNSPACE = 0 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("resetCHRbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
}
/* JADX WARNING: Code restructure failed: missing block: B:74:0x0414, code lost:
if (r4 == null) goto L_0x043c;
*/
/* JADX WARNING: Code restructure failed: missing block: B:75:0x0416, code lost:
r4.close();
*/
/* JADX WARNING: Code restructure failed: missing block: B:80:0x0439, code lost:
if (r4 == null) goto L_0x043c;
*/
/* JADX WARNING: Removed duplicated region for block: B:84:0x0440 */
/* JADX WARNING: Unknown top exception splitter block from list: {B:78:0x0421=Splitter:B:78:0x0421, B:72:0x03fc=Splitter:B:72:0x03fc} */
public Bundle findCHRbyFreqLoc(String freqlocation) {
Bundle results;
Bundle results2;
Cursor cursor;
int firstreport;
int entery;
int leave;
int duration;
int spacechange;
int spaceleave;
int uptotalswitch;
int upautosucc;
int upmanualsucc;
int upautofail;
int upnoswitchfail;
String sql;
int upqrycnt;
String[] args;
int uprescnt;
int upunknowndb;
int upunknownspace;
int lptotalswitch;
int lpdatarx;
int lpdatatx;
int lpduration;
int lpoffset;
int lpalreadybest;
int lpnotreach;
int lpback;
int lpunknowndb;
int lpunknownspace;
Cursor cursor2;
String str = freqlocation;
Bundle results3 = new Bundle();
Cursor cursor3 = null;
if (this.db == null) {
results = results3;
} else if (str == null) {
results = results3;
} else {
String sql2 = "SELECT * FROM CHR_FREQUENT_LOCATION WHERE FREQLOCATION = ?";
String[] args2 = {str};
LogUtil.i("findCHRbyFreqLocation: sql=" + sql2 + " ,args=" + Arrays.toString(args2));
try {
cursor3 = this.db.rawQuery(sql2, args2);
while (cursor3.moveToNext()) {
try {
try {
firstreport = cursor3.getInt(cursor3.getColumnIndexOrThrow("FIRSTREPORT"));
entery = cursor3.getInt(cursor3.getColumnIndexOrThrow("ENTERY"));
leave = cursor3.getInt(cursor3.getColumnIndexOrThrow("LEAVE"));
duration = cursor3.getInt(cursor3.getColumnIndexOrThrow(Constant.USERDB_APP_NAME_DURATION));
spacechange = cursor3.getInt(cursor3.getColumnIndexOrThrow("SPACECHANGE"));
spaceleave = cursor3.getInt(cursor3.getColumnIndexOrThrow("SPACELEAVE"));
uptotalswitch = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPTOTALSWITCH"));
upautosucc = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPAUTOSUCC"));
upmanualsucc = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPMANUALSUCC"));
upautofail = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPAUTOFAIL"));
upnoswitchfail = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPNOSWITCHFAIL"));
sql = sql2;
} catch (IllegalArgumentException e) {
e = e;
results2 = results3;
Cursor cursor4 = cursor3;
String str2 = sql2;
String[] strArr = args2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
e = e2;
results2 = results3;
Cursor cursor5 = cursor3;
String str3 = sql2;
String[] strArr2 = args2;
try {
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th) {
th = th;
if (cursor3 != null) {
}
throw th;
}
} catch (Throwable th2) {
th = th2;
Bundle bundle = results3;
Cursor cursor6 = cursor3;
String str4 = sql2;
String[] strArr3 = args2;
if (cursor3 != null) {
}
throw th;
}
try {
upqrycnt = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPQRYCNT"));
args = args2;
} catch (IllegalArgumentException e3) {
e = e3;
results2 = results3;
Cursor cursor7 = cursor3;
String[] strArr4 = args2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e4) {
e = e4;
results2 = results3;
Cursor cursor8 = cursor3;
String[] strArr5 = args2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th3) {
th = th3;
Bundle bundle2 = results3;
Cursor cursor9 = cursor3;
String[] strArr6 = args2;
if (cursor3 != null) {
}
throw th;
}
try {
uprescnt = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPRESCNT"));
upunknowndb = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPUNKNOWNDB"));
upunknownspace = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPUNKNOWNSPACE"));
lptotalswitch = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPTOTALSWITCH"));
lpdatarx = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPDATARX"));
lpdatatx = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPDATATX"));
lpduration = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPDURATION"));
lpoffset = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPOFFSET"));
lpalreadybest = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPALREADYBEST"));
lpnotreach = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPNOTREACH"));
lpback = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPBACK"));
lpunknowndb = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPUNKNOWNDB"));
lpunknownspace = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPUNKNOWNSPACE"));
cursor2 = cursor3;
} catch (IllegalArgumentException e5) {
e = e5;
results2 = results3;
Cursor cursor10 = cursor3;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e6) {
e = e6;
results2 = results3;
Cursor cursor11 = cursor3;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th4) {
th = th4;
Bundle bundle3 = results3;
Cursor cursor12 = cursor3;
if (cursor3 != null) {
}
throw th;
}
} catch (IllegalArgumentException e7) {
e = e7;
results2 = results3;
Cursor cursor13 = cursor3;
String str5 = sql2;
String[] strArr7 = args2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e8) {
e = e8;
results2 = results3;
Cursor cursor14 = cursor3;
String str6 = sql2;
String[] strArr8 = args2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th5) {
th = th5;
Bundle bundle4 = results3;
Cursor cursor15 = cursor3;
String str7 = sql2;
String[] strArr9 = args2;
if (cursor3 != null) {
}
throw th;
}
try {
results3.putString("FREQLOCATION", str);
results3.putInt("FIRSTREPORT", firstreport);
results3.putInt("ENTERY", entery);
results3.putInt("LEAVE", leave);
results3.putInt(Constant.USERDB_APP_NAME_DURATION, duration);
results3.putInt("SPACECHANGE", spacechange);
results3.putInt("SPACELEAVE", spaceleave);
results3.putInt("UPTOTALSWITCH", uptotalswitch);
results3.putInt("UPAUTOSUCC", upautosucc);
results3.putInt("UPMANUALSUCC", upmanualsucc);
results3.putInt("UPAUTOFAIL", upautofail);
results3.putInt("UPNOSWITCHFAIL", upnoswitchfail);
results3.putInt("UPQRYCNT", upqrycnt);
int upqrycnt2 = upqrycnt;
int uprescnt2 = uprescnt;
results3.putInt("UPRESCNT", uprescnt2);
int uprescnt3 = uprescnt2;
int uprescnt4 = upunknowndb;
results3.putInt("UPUNKNOWNDB", uprescnt4);
int upunknowndb2 = uprescnt4;
int upunknownspace2 = upunknownspace;
results3.putInt("UPUNKNOWNSPACE", upunknownspace2);
int upunknownspace3 = upunknownspace2;
int upunknownspace4 = lptotalswitch;
results3.putInt("LPTOTALSWITCH", upunknownspace4);
int lptotalswitch2 = upunknownspace4;
int lpdatarx2 = lpdatarx;
results3.putInt("LPDATARX", lpdatarx2);
int lpdatarx3 = lpdatarx2;
int lpdatatx2 = lpdatatx;
results3.putInt("LPDATATX", lpdatatx2);
int lpdatatx3 = lpdatatx2;
int lpduration2 = lpduration;
results3.putInt("LPDURATION", lpduration2);
int lpduration3 = lpduration2;
int lpduration4 = lpoffset;
results3.putInt("LPOFFSET", lpduration4);
int lpoffset2 = lpduration4;
int lpalreadybest2 = lpalreadybest;
results3.putInt("LPALREADYBEST", lpalreadybest2);
int lpalreadybest3 = lpalreadybest2;
int lpalreadybest4 = lpnotreach;
results3.putInt("LPNOTREACH", lpalreadybest4);
int lpnotreach2 = lpalreadybest4;
int lpback2 = lpback;
results3.putInt("LPBACK", lpback2);
int lpback3 = lpback2;
int lpunknowndb2 = lpunknowndb;
results3.putInt("LPUNKNOWNDB", lpunknowndb2);
results3.putInt("LPUNKNOWNSPACE", lpunknownspace);
StringBuilder sb = new StringBuilder();
results2 = results3;
try {
sb.append(" freqlocation:");
sb.append(str);
sb.append(",first report:");
sb.append(firstreport);
sb.append(",entery:");
sb.append(entery);
sb.append(",leave:");
sb.append(leave);
sb.append(",duration:");
sb.append(duration);
sb.append(",space change:");
sb.append(spacechange);
sb.append(",space leave:");
sb.append(spaceleave);
LogUtil.i(sb.toString());
StringBuilder sb2 = new StringBuilder();
sb2.append(" uptotalswitch:");
sb2.append(uptotalswitch);
sb2.append(",upautosucc:");
sb2.append(upautosucc);
sb2.append(",upmanualsucc:");
sb2.append(upmanualsucc);
sb2.append(",upautofail:");
sb2.append(upautofail);
sb2.append(",upnoswitchfail:");
sb2.append(upnoswitchfail);
sb2.append(",upqrycnt:");
sb2.append(upqrycnt2);
int i = firstreport;
sb2.append(",uprescnt:");
int uprescnt5 = uprescnt3;
sb2.append(uprescnt5);
int i2 = uprescnt5;
sb2.append(" upunknowndb:");
int upunknowndb3 = upunknowndb2;
sb2.append(upunknowndb3);
int i3 = upunknowndb3;
sb2.append(" upunknownspace:");
int upunknownspace5 = upunknownspace3;
sb2.append(upunknownspace5);
LogUtil.i(sb2.toString());
StringBuilder sb3 = new StringBuilder();
int i4 = upunknownspace5;
sb3.append(" lptotalswitch:");
int lptotalswitch3 = lptotalswitch2;
sb3.append(lptotalswitch3);
int i5 = lptotalswitch3;
sb3.append(",lpdatarx:");
int lpdatarx4 = lpdatarx3;
sb3.append(lpdatarx4);
int i6 = lpdatarx4;
sb3.append(",lpdatatx:");
int lpdatatx4 = lpdatatx3;
sb3.append(lpdatatx4);
int i7 = lpdatatx4;
sb3.append(",lpduration:");
int lpduration5 = lpduration3;
sb3.append(lpduration5);
int i8 = lpduration5;
sb3.append(",lpoffset:");
int lpoffset3 = lpoffset2;
sb3.append(lpoffset3);
int i9 = lpoffset3;
sb3.append(",lpalreadybest:");
int lpalreadybest5 = lpalreadybest3;
sb3.append(lpalreadybest5);
int i10 = lpalreadybest5;
sb3.append(",lpnotreach:");
int lpnotreach3 = lpnotreach2;
sb3.append(lpnotreach3);
int i11 = lpnotreach3;
sb3.append(" lpback:");
int lpback4 = lpback3;
sb3.append(lpback4);
int i12 = lpback4;
sb3.append(" lpunknowndb:");
sb3.append(lpunknowndb2);
sb3.append(" lpunknownspace:");
sb3.append(lpunknownspace);
LogUtil.i(sb3.toString());
sql2 = sql;
args2 = args;
cursor3 = cursor2;
results3 = results2;
} catch (IllegalArgumentException e9) {
e = e9;
cursor3 = cursor2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e10) {
e = e10;
cursor3 = cursor2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th6) {
th = th6;
cursor3 = cursor2;
if (cursor3 != null) {
}
throw th;
}
} catch (IllegalArgumentException e11) {
e = e11;
results2 = results3;
cursor3 = cursor2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e12) {
e = e12;
results2 = results3;
cursor3 = cursor2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th7) {
th = th7;
Bundle bundle5 = results3;
cursor3 = cursor2;
if (cursor3 != null) {
}
throw th;
}
}
results2 = results3;
Cursor cursor16 = cursor3;
String str8 = sql2;
String[] strArr10 = args2;
if (cursor16 != null) {
cursor = cursor16;
cursor.close();
} else {
cursor = cursor16;
}
Cursor cursor17 = cursor;
} catch (IllegalArgumentException e13) {
e = e13;
results2 = results3;
String str9 = sql2;
String[] strArr11 = args2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e14) {
e = e14;
results2 = results3;
String str10 = sql2;
String[] strArr12 = args2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th8) {
th = th8;
Bundle bundle6 = results3;
String str11 = sql2;
String[] strArr13 = args2;
if (cursor3 != null) {
cursor3.close();
}
throw th;
}
return results2;
}
return results;
}
}
| UTF-8 | Java | 45,436 | java | LocationDAO.java | Java | [] | null | [] | package com.android.server.hidata.wavemapping.dao;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import com.android.server.hidata.wavemapping.cons.Constant;
import com.android.server.hidata.wavemapping.util.LogUtil;
import java.util.Arrays;
public class LocationDAO {
private static final String TAG = ("WMapping." + LocationDAO.class.getSimpleName());
private SQLiteDatabase db = DatabaseSingleton.getInstance();
public boolean insert(String frequentlocation) {
if (frequentlocation == null) {
LogUtil.d("insert failed ,frequentlocation == null");
return false;
} else if (0 < getOOBTime()) {
return updateFrequentLocation(frequentlocation);
} else {
ContentValues cValue = new ContentValues();
long now = System.currentTimeMillis();
cValue.put("UPDATETIME", Long.valueOf(now));
cValue.put("OOBTIME", Long.valueOf(now));
cValue.put("FREQUENTLOCATION", frequentlocation);
try {
this.db.beginTransaction();
this.db.insert(Constant.LOCATION_TABLE_NAME, null, cValue);
this.db.setTransactionSuccessful();
this.db.endTransaction();
return true;
} catch (Exception e) {
LogUtil.e("insert exception: " + e.getMessage());
this.db.endTransaction();
return false;
} catch (Throwable th) {
this.db.endTransaction();
throw th;
}
}
}
public boolean insertOOBTime(long OOBTime) {
if (0 < getOOBTime()) {
return false;
}
ContentValues cValue = new ContentValues();
cValue.put("OOBTIME", Long.valueOf(OOBTime));
try {
this.db.beginTransaction();
this.db.insert(Constant.LOCATION_TABLE_NAME, null, cValue);
this.db.setTransactionSuccessful();
this.db.endTransaction();
return true;
} catch (Exception e) {
LogUtil.e("insert exception: " + e.getMessage());
this.db.endTransaction();
return false;
} catch (Throwable th) {
this.db.endTransaction();
throw th;
}
}
public boolean updateFrequentLocation(String frequentlocation) {
if (frequentlocation == null) {
LogUtil.d("update failure,frequentlocation == null");
return false;
}
Object[] args = {Long.valueOf(System.currentTimeMillis()), frequentlocation};
LogUtil.i("update begin: frequentlocation = " + frequentlocation);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE FREQUENT_LOCATION SET UPDATETIME = ?,FREQUENTLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("UPDATE exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean updateBenefitCHRTime(long now) {
if (0 == getOOBTime()) {
LogUtil.i("updateBenefitCHRTime: OOBTime = 0");
return false;
}
Object[] args = {Long.valueOf(now)};
LogUtil.i("update begin: CHRBENEFITUPLOADTIME = " + now);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE FREQUENT_LOCATION SET CHRBENEFITUPLOADTIME = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("UPDATE exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean updateSpaceUserCHRTime(long now) {
if (0 == getOOBTime()) {
LogUtil.i("updateSpaceUserCHRTime: OOBTime = 0");
return false;
}
Object[] args = {Long.valueOf(now)};
LogUtil.i("update begin: CHRSPACEUSERUPLOADTIME = " + now);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE FREQUENT_LOCATION SET CHRSPACEUSERUPLOADTIME = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("UPDATE exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean remove() {
try {
this.db.execSQL("DELETE FROM FREQUENT_LOCATION", null);
return true;
} catch (SQLException e) {
LogUtil.e("remove exception: " + e.getMessage());
return false;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x005f, code lost:
if (r1 == null) goto L_0x0062;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0022, code lost:
if (r1 != null) goto L_0x0024;
*/
public String getFrequentLocation() {
String frequentlocation = null;
Cursor cursor = null;
if (this.db == null) {
return null;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
frequentlocation = cursor.getString(cursor.getColumnIndexOrThrow("FREQUENTLOCATION"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getFrequentLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getFrequentLocation Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
if (frequentlocation != null) {
LogUtil.i("getFrequentLocation, frequentlocation:" + frequentlocation);
} else {
LogUtil.d("getFrequentLocation, NO DATA");
}
return frequentlocation;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x0060, code lost:
if (r2 == null) goto L_0x0063;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0023, code lost:
if (r2 != null) goto L_0x0025;
*/
public long getBenefitCHRTime() {
long time = 0;
Cursor cursor = null;
if (this.db == null) {
return 0;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
time = cursor.getLong(cursor.getColumnIndexOrThrow("CHRBENEFITUPLOADTIME"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getBenefitCHRTime IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getBenefitCHRTime Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
LogUtil.i("getBenefitCHRTime, time:" + time);
return time;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x0060, code lost:
if (r2 == null) goto L_0x0063;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0023, code lost:
if (r2 != null) goto L_0x0025;
*/
public long getSpaceUserCHRTime() {
long time = 0;
Cursor cursor = null;
if (this.db == null) {
return 0;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
time = cursor.getLong(cursor.getColumnIndexOrThrow("CHRSPACEUSERUPLOADTIME"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getSpaceUserCHRTime IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getSpaceUserCHRTime Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
LogUtil.i("getSpaceUserCHRTime, time:" + time);
return time;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x0060, code lost:
if (r2 == null) goto L_0x0063;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0023, code lost:
if (r2 != null) goto L_0x0025;
*/
public long getlastUpdateTime() {
long time = 0;
Cursor cursor = null;
if (this.db == null) {
return 0;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
time = cursor.getLong(cursor.getColumnIndexOrThrow("UPDATETIME"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getlastUpdateTime IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getlastUpdateTime Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
LogUtil.i("getlastUpdateTime, time:" + time);
return time;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:18:0x0060, code lost:
if (r2 == null) goto L_0x0063;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:0x0023, code lost:
if (r2 != null) goto L_0x0025;
*/
public long getOOBTime() {
long oob_time = 0;
Cursor cursor = null;
if (this.db == null) {
return 0;
}
try {
cursor = this.db.rawQuery("SELECT * FROM FREQUENT_LOCATION", null);
if (cursor.moveToNext()) {
oob_time = cursor.getLong(cursor.getColumnIndexOrThrow("OOBTIME"));
}
} catch (IllegalArgumentException e) {
LogUtil.e("getOOBTime IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
LogUtil.e("getOOBTime Exception: " + e2.getMessage());
if (cursor != null) {
cursor.close();
}
LogUtil.d("getOOBTime, OOBTime:" + oob_time);
return oob_time;
} catch (Throwable th) {
if (cursor != null) {
cursor.close();
}
throw th;
}
}
public boolean insertCHR(String freqlocation) {
if (findCHRbyFreqLoc(freqlocation).containsKey("FREQLOCATION")) {
return false;
}
ContentValues cValue = new ContentValues();
cValue.put("FREQLOCATION", freqlocation);
long oobtime = getOOBTime();
long now = System.currentTimeMillis();
int firstreport = Math.round(((float) (now - oobtime)) / 3600000.0f);
cValue.put("FIRSTREPORT", Integer.valueOf(firstreport));
LogUtil.d("insertCHR, OOBTime:" + oobtime + " now: " + now + " first report:" + firstreport);
try {
this.db.beginTransaction();
this.db.insert(Constant.CHR_LOCATION_TABLE_NAME, null, cValue);
this.db.setTransactionSuccessful();
this.db.endTransaction();
return true;
} catch (Exception e) {
LogUtil.e("insertCHR exception: " + e.getMessage());
this.db.endTransaction();
return false;
} catch (Throwable th) {
this.db.endTransaction();
throw th;
}
}
public boolean accCHREnterybyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHREnterybyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: entry " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET ENTERY = ENTERY + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHREnterybyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRLeavebyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRLeavebyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: leave " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET LEAVE = LEAVE + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRLeavebyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRSpaceChangebyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRSpaceChangebyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: SPACECHANGE " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET SPACECHANGE = SPACECHANGE + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRSpaceChangebyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRSpaceLeavebyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRSpaceChangebyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: SPACELEAVE " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET SPACELEAVE = SPACELEAVE + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRSpaceLeavebyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean addCHRDurationbyFreqLoc(int duration, String location) {
if (location == null) {
LogUtil.d("addCHRDurationbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {Integer.valueOf(duration), location};
LogUtil.i("update begin: add duration " + duration + " location:" + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET DURATION = DURATION + ? WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("addCHRDurationbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefNoSwitchFailbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefNoSwitchFailbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPNOSWITCHFAIL at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPNOSWITCHFAIL = UPNOSWITCHFAIL + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefNoSwitchFailbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefAutoFailbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefAutoFailbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPAUTOFAIL at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPAUTOFAIL = UPAUTOFAIL + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefAutoFailbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefAutoSuccbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefAutoSuccbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPAUTOSUCC at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPAUTOSUCC = UPAUTOSUCC + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefAutoSuccbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefManualSuccbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefManualSuccbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPMANUALSUCC at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPMANUALSUCC = UPMANUALSUCC + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefManualSuccbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefTotalSwitchbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefTotalSwitchbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPTOTALSWITCH at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPTOTALSWITCH = UPTOTALSWITCH + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefTotalSwitchbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefQueryCntbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefQueryCntbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPQRYCNT at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPQRYCNT = UPQRYCNT + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefQueryCntbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefResCntbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefResCntbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPRESCNT at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPRESCNT = UPRESCNT + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefResCntbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefUnknownDBbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefUnknownDBbyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPUNKNOWNDB at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPUNKNOWNDB = UPUNKNOWNDB + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefUnknownDBbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean accCHRUserPrefUnknownSpacebyFreqLoc(String location) {
if (location == null) {
LogUtil.d("accCHRUserPrefUnknownSpacebyFreqLoc failure,frequent location == null");
return false;
}
insertCHR(location);
Object[] args = {location};
LogUtil.i("update begin: UPUNKNOWNSPACE at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET UPUNKNOWNSPACE = UPUNKNOWNSPACE + 1 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("accCHRUserPrefUnknownSpacebyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
public boolean resetCHRbyFreqLoc(String location) {
if (location == null) {
LogUtil.d("resetCHRbyFreqLoc failure,frequent location == null");
return false;
} else if (!findCHRbyFreqLoc(location).containsKey("FREQLOCATION")) {
return false;
} else {
Object[] args = {location};
LogUtil.i("update begin: RESET CHR at " + location);
try {
this.db.beginTransaction();
this.db.execSQL("UPDATE CHR_FREQUENT_LOCATION SET ENTERY = 0,LEAVE = 0,DURATION = 0,SPACECHANGE = 0,SPACELEAVE = 0,UPTOTALSWITCH = 0,UPAUTOSUCC = 0,UPMANUALSUCC = 0,UPAUTOFAIL = 0,UPNOSWITCHFAIL = 0,UPQRYCNT = 0,UPRESCNT = 0,UPUNKNOWNDB = 0,UPUNKNOWNSPACE = 0,LPTOTALSWITCH = 0,LPDATARX = 0,LPDATATX = 0,LPDURATION = 0,LPOFFSET = 0,LPALREADYBEST = 0,LPNOTREACH = 0,LPBACK = 0,LPUNKNOWNDB = 0,LPUNKNOWNSPACE = 0 WHERE FREQLOCATION = ?", args);
this.db.setTransactionSuccessful();
return true;
} catch (SQLException e) {
LogUtil.e("resetCHRbyFreqLoc exception: " + e.getMessage());
return false;
} finally {
this.db.endTransaction();
}
}
}
/* JADX WARNING: Code restructure failed: missing block: B:74:0x0414, code lost:
if (r4 == null) goto L_0x043c;
*/
/* JADX WARNING: Code restructure failed: missing block: B:75:0x0416, code lost:
r4.close();
*/
/* JADX WARNING: Code restructure failed: missing block: B:80:0x0439, code lost:
if (r4 == null) goto L_0x043c;
*/
/* JADX WARNING: Removed duplicated region for block: B:84:0x0440 */
/* JADX WARNING: Unknown top exception splitter block from list: {B:78:0x0421=Splitter:B:78:0x0421, B:72:0x03fc=Splitter:B:72:0x03fc} */
public Bundle findCHRbyFreqLoc(String freqlocation) {
Bundle results;
Bundle results2;
Cursor cursor;
int firstreport;
int entery;
int leave;
int duration;
int spacechange;
int spaceleave;
int uptotalswitch;
int upautosucc;
int upmanualsucc;
int upautofail;
int upnoswitchfail;
String sql;
int upqrycnt;
String[] args;
int uprescnt;
int upunknowndb;
int upunknownspace;
int lptotalswitch;
int lpdatarx;
int lpdatatx;
int lpduration;
int lpoffset;
int lpalreadybest;
int lpnotreach;
int lpback;
int lpunknowndb;
int lpunknownspace;
Cursor cursor2;
String str = freqlocation;
Bundle results3 = new Bundle();
Cursor cursor3 = null;
if (this.db == null) {
results = results3;
} else if (str == null) {
results = results3;
} else {
String sql2 = "SELECT * FROM CHR_FREQUENT_LOCATION WHERE FREQLOCATION = ?";
String[] args2 = {str};
LogUtil.i("findCHRbyFreqLocation: sql=" + sql2 + " ,args=" + Arrays.toString(args2));
try {
cursor3 = this.db.rawQuery(sql2, args2);
while (cursor3.moveToNext()) {
try {
try {
firstreport = cursor3.getInt(cursor3.getColumnIndexOrThrow("FIRSTREPORT"));
entery = cursor3.getInt(cursor3.getColumnIndexOrThrow("ENTERY"));
leave = cursor3.getInt(cursor3.getColumnIndexOrThrow("LEAVE"));
duration = cursor3.getInt(cursor3.getColumnIndexOrThrow(Constant.USERDB_APP_NAME_DURATION));
spacechange = cursor3.getInt(cursor3.getColumnIndexOrThrow("SPACECHANGE"));
spaceleave = cursor3.getInt(cursor3.getColumnIndexOrThrow("SPACELEAVE"));
uptotalswitch = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPTOTALSWITCH"));
upautosucc = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPAUTOSUCC"));
upmanualsucc = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPMANUALSUCC"));
upautofail = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPAUTOFAIL"));
upnoswitchfail = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPNOSWITCHFAIL"));
sql = sql2;
} catch (IllegalArgumentException e) {
e = e;
results2 = results3;
Cursor cursor4 = cursor3;
String str2 = sql2;
String[] strArr = args2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e2) {
e = e2;
results2 = results3;
Cursor cursor5 = cursor3;
String str3 = sql2;
String[] strArr2 = args2;
try {
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th) {
th = th;
if (cursor3 != null) {
}
throw th;
}
} catch (Throwable th2) {
th = th2;
Bundle bundle = results3;
Cursor cursor6 = cursor3;
String str4 = sql2;
String[] strArr3 = args2;
if (cursor3 != null) {
}
throw th;
}
try {
upqrycnt = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPQRYCNT"));
args = args2;
} catch (IllegalArgumentException e3) {
e = e3;
results2 = results3;
Cursor cursor7 = cursor3;
String[] strArr4 = args2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e4) {
e = e4;
results2 = results3;
Cursor cursor8 = cursor3;
String[] strArr5 = args2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th3) {
th = th3;
Bundle bundle2 = results3;
Cursor cursor9 = cursor3;
String[] strArr6 = args2;
if (cursor3 != null) {
}
throw th;
}
try {
uprescnt = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPRESCNT"));
upunknowndb = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPUNKNOWNDB"));
upunknownspace = cursor3.getInt(cursor3.getColumnIndexOrThrow("UPUNKNOWNSPACE"));
lptotalswitch = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPTOTALSWITCH"));
lpdatarx = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPDATARX"));
lpdatatx = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPDATATX"));
lpduration = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPDURATION"));
lpoffset = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPOFFSET"));
lpalreadybest = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPALREADYBEST"));
lpnotreach = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPNOTREACH"));
lpback = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPBACK"));
lpunknowndb = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPUNKNOWNDB"));
lpunknownspace = cursor3.getInt(cursor3.getColumnIndexOrThrow("LPUNKNOWNSPACE"));
cursor2 = cursor3;
} catch (IllegalArgumentException e5) {
e = e5;
results2 = results3;
Cursor cursor10 = cursor3;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e6) {
e = e6;
results2 = results3;
Cursor cursor11 = cursor3;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th4) {
th = th4;
Bundle bundle3 = results3;
Cursor cursor12 = cursor3;
if (cursor3 != null) {
}
throw th;
}
} catch (IllegalArgumentException e7) {
e = e7;
results2 = results3;
Cursor cursor13 = cursor3;
String str5 = sql2;
String[] strArr7 = args2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e8) {
e = e8;
results2 = results3;
Cursor cursor14 = cursor3;
String str6 = sql2;
String[] strArr8 = args2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th5) {
th = th5;
Bundle bundle4 = results3;
Cursor cursor15 = cursor3;
String str7 = sql2;
String[] strArr9 = args2;
if (cursor3 != null) {
}
throw th;
}
try {
results3.putString("FREQLOCATION", str);
results3.putInt("FIRSTREPORT", firstreport);
results3.putInt("ENTERY", entery);
results3.putInt("LEAVE", leave);
results3.putInt(Constant.USERDB_APP_NAME_DURATION, duration);
results3.putInt("SPACECHANGE", spacechange);
results3.putInt("SPACELEAVE", spaceleave);
results3.putInt("UPTOTALSWITCH", uptotalswitch);
results3.putInt("UPAUTOSUCC", upautosucc);
results3.putInt("UPMANUALSUCC", upmanualsucc);
results3.putInt("UPAUTOFAIL", upautofail);
results3.putInt("UPNOSWITCHFAIL", upnoswitchfail);
results3.putInt("UPQRYCNT", upqrycnt);
int upqrycnt2 = upqrycnt;
int uprescnt2 = uprescnt;
results3.putInt("UPRESCNT", uprescnt2);
int uprescnt3 = uprescnt2;
int uprescnt4 = upunknowndb;
results3.putInt("UPUNKNOWNDB", uprescnt4);
int upunknowndb2 = uprescnt4;
int upunknownspace2 = upunknownspace;
results3.putInt("UPUNKNOWNSPACE", upunknownspace2);
int upunknownspace3 = upunknownspace2;
int upunknownspace4 = lptotalswitch;
results3.putInt("LPTOTALSWITCH", upunknownspace4);
int lptotalswitch2 = upunknownspace4;
int lpdatarx2 = lpdatarx;
results3.putInt("LPDATARX", lpdatarx2);
int lpdatarx3 = lpdatarx2;
int lpdatatx2 = lpdatatx;
results3.putInt("LPDATATX", lpdatatx2);
int lpdatatx3 = lpdatatx2;
int lpduration2 = lpduration;
results3.putInt("LPDURATION", lpduration2);
int lpduration3 = lpduration2;
int lpduration4 = lpoffset;
results3.putInt("LPOFFSET", lpduration4);
int lpoffset2 = lpduration4;
int lpalreadybest2 = lpalreadybest;
results3.putInt("LPALREADYBEST", lpalreadybest2);
int lpalreadybest3 = lpalreadybest2;
int lpalreadybest4 = lpnotreach;
results3.putInt("LPNOTREACH", lpalreadybest4);
int lpnotreach2 = lpalreadybest4;
int lpback2 = lpback;
results3.putInt("LPBACK", lpback2);
int lpback3 = lpback2;
int lpunknowndb2 = lpunknowndb;
results3.putInt("LPUNKNOWNDB", lpunknowndb2);
results3.putInt("LPUNKNOWNSPACE", lpunknownspace);
StringBuilder sb = new StringBuilder();
results2 = results3;
try {
sb.append(" freqlocation:");
sb.append(str);
sb.append(",first report:");
sb.append(firstreport);
sb.append(",entery:");
sb.append(entery);
sb.append(",leave:");
sb.append(leave);
sb.append(",duration:");
sb.append(duration);
sb.append(",space change:");
sb.append(spacechange);
sb.append(",space leave:");
sb.append(spaceleave);
LogUtil.i(sb.toString());
StringBuilder sb2 = new StringBuilder();
sb2.append(" uptotalswitch:");
sb2.append(uptotalswitch);
sb2.append(",upautosucc:");
sb2.append(upautosucc);
sb2.append(",upmanualsucc:");
sb2.append(upmanualsucc);
sb2.append(",upautofail:");
sb2.append(upautofail);
sb2.append(",upnoswitchfail:");
sb2.append(upnoswitchfail);
sb2.append(",upqrycnt:");
sb2.append(upqrycnt2);
int i = firstreport;
sb2.append(",uprescnt:");
int uprescnt5 = uprescnt3;
sb2.append(uprescnt5);
int i2 = uprescnt5;
sb2.append(" upunknowndb:");
int upunknowndb3 = upunknowndb2;
sb2.append(upunknowndb3);
int i3 = upunknowndb3;
sb2.append(" upunknownspace:");
int upunknownspace5 = upunknownspace3;
sb2.append(upunknownspace5);
LogUtil.i(sb2.toString());
StringBuilder sb3 = new StringBuilder();
int i4 = upunknownspace5;
sb3.append(" lptotalswitch:");
int lptotalswitch3 = lptotalswitch2;
sb3.append(lptotalswitch3);
int i5 = lptotalswitch3;
sb3.append(",lpdatarx:");
int lpdatarx4 = lpdatarx3;
sb3.append(lpdatarx4);
int i6 = lpdatarx4;
sb3.append(",lpdatatx:");
int lpdatatx4 = lpdatatx3;
sb3.append(lpdatatx4);
int i7 = lpdatatx4;
sb3.append(",lpduration:");
int lpduration5 = lpduration3;
sb3.append(lpduration5);
int i8 = lpduration5;
sb3.append(",lpoffset:");
int lpoffset3 = lpoffset2;
sb3.append(lpoffset3);
int i9 = lpoffset3;
sb3.append(",lpalreadybest:");
int lpalreadybest5 = lpalreadybest3;
sb3.append(lpalreadybest5);
int i10 = lpalreadybest5;
sb3.append(",lpnotreach:");
int lpnotreach3 = lpnotreach2;
sb3.append(lpnotreach3);
int i11 = lpnotreach3;
sb3.append(" lpback:");
int lpback4 = lpback3;
sb3.append(lpback4);
int i12 = lpback4;
sb3.append(" lpunknowndb:");
sb3.append(lpunknowndb2);
sb3.append(" lpunknownspace:");
sb3.append(lpunknownspace);
LogUtil.i(sb3.toString());
sql2 = sql;
args2 = args;
cursor3 = cursor2;
results3 = results2;
} catch (IllegalArgumentException e9) {
e = e9;
cursor3 = cursor2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e10) {
e = e10;
cursor3 = cursor2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th6) {
th = th6;
cursor3 = cursor2;
if (cursor3 != null) {
}
throw th;
}
} catch (IllegalArgumentException e11) {
e = e11;
results2 = results3;
cursor3 = cursor2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e12) {
e = e12;
results2 = results3;
cursor3 = cursor2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th7) {
th = th7;
Bundle bundle5 = results3;
cursor3 = cursor2;
if (cursor3 != null) {
}
throw th;
}
}
results2 = results3;
Cursor cursor16 = cursor3;
String str8 = sql2;
String[] strArr10 = args2;
if (cursor16 != null) {
cursor = cursor16;
cursor.close();
} else {
cursor = cursor16;
}
Cursor cursor17 = cursor;
} catch (IllegalArgumentException e13) {
e = e13;
results2 = results3;
String str9 = sql2;
String[] strArr11 = args2;
LogUtil.e("findCHRbyFreqLocation IllegalArgumentException: " + e.getMessage());
} catch (Exception e14) {
e = e14;
results2 = results3;
String str10 = sql2;
String[] strArr12 = args2;
LogUtil.e("findCHRbyFreqLocation Exception: " + e.getMessage());
} catch (Throwable th8) {
th = th8;
Bundle bundle6 = results3;
String str11 = sql2;
String[] strArr13 = args2;
if (cursor3 != null) {
cursor3.close();
}
throw th;
}
return results2;
}
return results;
}
}
| 45,436 | 0.501717 | 0.486134 | 1,047 | 42.39637 | 29.384558 | 458 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777459 | false | false | 2 |
b0893fae0ddde7d78291b5b0c273ee6b09084c01 | 4,853,313,113,562 | afe289925036ff80521d0cfc11e256c284d4fc08 | /app/src/main/java/com/suning/snrf/fragment/downloadmanager/DownloadThread.java | 2bcd5deacc4ac2bcd3734d86697bd859c7e68c5b | [] | no_license | athas0920/MyTest | https://github.com/athas0920/MyTest | 14df39f8d1fe311a37485b7863e10ffef9a51d02 | cfbc9afe3377e2ff992057676be101ff1b534242 | refs/heads/master | 2020-12-02T09:58:55.605000 | 2017-07-09T07:48:05 | 2017-07-09T07:48:05 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright 2011-2013
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.suning.snrf.fragment.downloadmanager;
import java.io.File;
/**
* <b>下载线程
* @version 1.0.0
* @author Yan.Sairong
*/
public class DownloadThread extends Thread {
private File saveFile;
private String downUrl;
private long block;
private long startPos;
private long endPos;
private int threadId = -1;
private long downLength;
private boolean finish = false;
private Status state = Status.RUNING;
/**
// * @see {@link }
*/
private HttpDownloader downloader;
/**
* 下载线程是否出错
* @note 下载线程完成了下载但是在关闭流的时候出错,不属于下载出错
*/
private boolean isError = false;
/**
* @param downloader <a>HttpDownloader</a>
* @param downUrl 下载地址
* @param saveFile 保存的文件
* @param startPos 下载线程从startPos开始下载
* @param endPos 下载线程下载至endPos
* @param downLength 已经下载的长度
* @param tid 线程ID
*/
public DownloadThread(HttpDownloader downloader, String downUrl, File saveFile, long startPos, long endPos, long downLength, int tid) {
this.downUrl = downUrl;
this.saveFile = saveFile;
this.startPos = startPos;
this.endPos = endPos;
this.downloader = downloader;
this.threadId = tid;
this.downLength = downLength;
this.block = endPos - startPos + 1;
}
@Override
public void run() {
doDownload();
}
private void doDownload() {
}
/**
* 下载是否完成
* @return
*/
public boolean isFinish() {
return finish;
}
/**
* 已经下载的内容大小
* @return 如果返回值为-1,代表下载失败
*/
public long getDownLength() {
return downLength;
}
/**
* 下载线程是否发生错误
* @return
*/
public boolean isError() {
return isError;
}
public Status getStatus() {
return state;
}
public enum Status {RUNING, FINISH}
}
| UTF-8 | Java | 2,673 | java | DownloadThread.java | Java | [
{
"context": "File;\n\n/**\n * <b>下载线程\n * @version 1.0.0\n * @author Yan.Sairong\n */\npublic class DownloadThread extends Thread {\n",
"end": 704,
"score": 0.9998924732208252,
"start": 693,
"tag": "NAME",
"value": "Yan.Sairong"
}
] | null | [] | /**
* Copyright 2011-2013
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.suning.snrf.fragment.downloadmanager;
import java.io.File;
/**
* <b>下载线程
* @version 1.0.0
* @author Yan.Sairong
*/
public class DownloadThread extends Thread {
private File saveFile;
private String downUrl;
private long block;
private long startPos;
private long endPos;
private int threadId = -1;
private long downLength;
private boolean finish = false;
private Status state = Status.RUNING;
/**
// * @see {@link }
*/
private HttpDownloader downloader;
/**
* 下载线程是否出错
* @note 下载线程完成了下载但是在关闭流的时候出错,不属于下载出错
*/
private boolean isError = false;
/**
* @param downloader <a>HttpDownloader</a>
* @param downUrl 下载地址
* @param saveFile 保存的文件
* @param startPos 下载线程从startPos开始下载
* @param endPos 下载线程下载至endPos
* @param downLength 已经下载的长度
* @param tid 线程ID
*/
public DownloadThread(HttpDownloader downloader, String downUrl, File saveFile, long startPos, long endPos, long downLength, int tid) {
this.downUrl = downUrl;
this.saveFile = saveFile;
this.startPos = startPos;
this.endPos = endPos;
this.downloader = downloader;
this.threadId = tid;
this.downLength = downLength;
this.block = endPos - startPos + 1;
}
@Override
public void run() {
doDownload();
}
private void doDownload() {
}
/**
* 下载是否完成
* @return
*/
public boolean isFinish() {
return finish;
}
/**
* 已经下载的内容大小
* @return 如果返回值为-1,代表下载失败
*/
public long getDownLength() {
return downLength;
}
/**
* 下载线程是否发生错误
* @return
*/
public boolean isError() {
return isError;
}
public Status getStatus() {
return state;
}
public enum Status {RUNING, FINISH}
}
| 2,673 | 0.631579 | 0.624235 | 100 | 23.51 | 21.569653 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.39 | false | false | 2 |
81e47e096b833f84450d59acbcb5818bd552e9aa | 26,697,516,715,133 | 8c6bd11343e1e88e8c4ade282a34c7e7ad4afe16 | /src/Day29_ReturnMethods/WarmUpIQ.java | d4e5825d1dc5ff531de6e20e5c69c281f7e51a47 | [] | no_license | RepositoryOfCode/SummerJava2019 | https://github.com/RepositoryOfCode/SummerJava2019 | ebe8ff351d9cce6798b6e370af0512acea5fa102 | c6715c00c70c969952b4b9bd4e0ff1b43b763561 | refs/heads/master | 2022-04-04T00:18:28.666000 | 2020-02-09T16:56:12 | 2020-02-09T16:56:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Day29_ReturnMethods;
public class WarmUpIQ {
public static void main(String[] args) {
/*
1.Write a method tha can find the frequency of characters in String
*/
String str = "aabbaaabbbcccccDDaaEEE";
// expected result: a5b5c5D2
// letters: "abcd"
String RemoveDup = ""; // to store the non duplicated values of the str
for(int i=0; i < str.length(); i++) {
if( ! RemoveDup.contains( str.substring(i, i+1)) ) {
RemoveDup += str.substring(i, i+1);
}
}
System.out.println(RemoveDup);
// str = "aabbaaabbbcccccDD"; RemoveDup = "abcd";
// j, j+1
// (1, 2)
// result = a5b5c5D2
String result =""; // to store the expected result
for(int j=0; j < RemoveDup.length(); j++) {
int count =0; // count the numbers of apperances
for(int i=0; i < str.length(); i++) {
if( str.substring(i, i+1).equals( RemoveDup.substring(j, j+1)) ) {
count++;
}
}
result += RemoveDup.substring(j, j+1) + count;
}
System.out.println(result);
//==============
String input = "XXXYYYYZZZZ";
//expected result: "X3Y3Z3"
//letters:XYZ
String nonDuplicates = "";//remove the duplicates from input, and store it
for (int i = 0; i< input.length();i++) {
if( ! nonDuplicates.contains(""+input.charAt(i)) ) {
nonDuplicates += ""+input.charAt(i);
}
}
String expectedResult = "";
for (int j = 0; j< nonDuplicates.length();j++) {
int times = 0;//count the occurence of X
for (int i=0;i<input.length(); i++) {
if( input.charAt(i)==nonDuplicates.charAt(j)) {
times++;
}
}
expectedResult +=""+nonDuplicates.charAt(j)+times;
System.out.println(times);
}
System.out.println(expectedResult);
}
}
| UTF-8 | Java | 1,923 | java | WarmUpIQ.java | Java | [] | null | [] | package Day29_ReturnMethods;
public class WarmUpIQ {
public static void main(String[] args) {
/*
1.Write a method tha can find the frequency of characters in String
*/
String str = "aabbaaabbbcccccDDaaEEE";
// expected result: a5b5c5D2
// letters: "abcd"
String RemoveDup = ""; // to store the non duplicated values of the str
for(int i=0; i < str.length(); i++) {
if( ! RemoveDup.contains( str.substring(i, i+1)) ) {
RemoveDup += str.substring(i, i+1);
}
}
System.out.println(RemoveDup);
// str = "aabbaaabbbcccccDD"; RemoveDup = "abcd";
// j, j+1
// (1, 2)
// result = a5b5c5D2
String result =""; // to store the expected result
for(int j=0; j < RemoveDup.length(); j++) {
int count =0; // count the numbers of apperances
for(int i=0; i < str.length(); i++) {
if( str.substring(i, i+1).equals( RemoveDup.substring(j, j+1)) ) {
count++;
}
}
result += RemoveDup.substring(j, j+1) + count;
}
System.out.println(result);
//==============
String input = "XXXYYYYZZZZ";
//expected result: "X3Y3Z3"
//letters:XYZ
String nonDuplicates = "";//remove the duplicates from input, and store it
for (int i = 0; i< input.length();i++) {
if( ! nonDuplicates.contains(""+input.charAt(i)) ) {
nonDuplicates += ""+input.charAt(i);
}
}
String expectedResult = "";
for (int j = 0; j< nonDuplicates.length();j++) {
int times = 0;//count the occurence of X
for (int i=0;i<input.length(); i++) {
if( input.charAt(i)==nonDuplicates.charAt(j)) {
times++;
}
}
expectedResult +=""+nonDuplicates.charAt(j)+times;
System.out.println(times);
}
System.out.println(expectedResult);
}
}
| 1,923 | 0.538742 | 0.523141 | 82 | 22.45122 | 22.19215 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.670732 | false | false | 2 |
960cc391bcb13fe7b2f2915951ee4027572ef4a1 | 17,300,128,332,226 | 590417b46976c80f1c694e7d1d5d552b70ab7a9d | /src/java/com/icp/sigipro/produccion/modelos/Cronograma.java | 11c1ec4ecd39847e35d68991b6ff63af78a22844 | [] | no_license | DNJJ1/SIGIPRO | https://github.com/DNJJ1/SIGIPRO | 216a3873dba38dd5da1fc26555ae3ea9db3c0f23 | 3783625aafa3f39cb211a96a6795454d19439e50 | refs/heads/master | 2021-03-16T07:55:16.451000 | 2020-05-26T18:24:28 | 2020-05-26T18:24:28 | 27,406,819 | 0 | 2 | null | false | 2020-05-26T18:24:30 | 2014-12-02T00:17:10 | 2018-11-13T20:51:05 | 2020-05-26T18:24:29 | 23,135 | 0 | 2 | 0 | Java | false | false | /*
* 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.icp.sigipro.produccion.modelos;
import java.lang.reflect.Field;
import java.sql.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import org.json.JSONObject;
/**
*
* @author Josue
*/
public class Cronograma {
private int id_cronograma;
private String nombre;
private String observaciones;
private Date valido_desde;
public int getId_cronograma() {
return id_cronograma;
}
public void setId_cronograma(int id_cronograma) {
this.id_cronograma = id_cronograma;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getObservaciones() {
return observaciones;
}
public void setObservaciones(String observaciones) {
this.observaciones = observaciones;
}
public Date getValido_desde() {
return valido_desde;
}
public void setValido_desde(Date valido_desde) {
this.valido_desde = valido_desde;
}
private String formatearFecha(Date fecha)
{
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
return df.format(fecha);
}
public String getValido_desde_S(){
if (this.valido_desde != null)
{return formatearFecha(this.valido_desde);}
else
{return "";}
}
public String parseJSON() {
Class _class = this.getClass();
JSONObject JSON = new JSONObject();
try {
Field properties[] = _class.getDeclaredFields();
for (int i = 0; i < properties.length; i++) {
Field field = properties[i];
if (i != 0) {
JSON.put(field.getName(), field.get(this));
} else {
JSON.put("id_objeto", field.get(this));
}
}
} catch (Exception e) {
}
return JSON.toString();
}
}
| UTF-8 | Java | 2,257 | java | Cronograma.java | Java | [
{
"context": "import org.json.JSONObject;\r\n\r\n/**\r\n *\r\n * @author Josue\r\n */\r\npublic class Cronograma {\r\n\r\n private in",
"end": 415,
"score": 0.992169201374054,
"start": 410,
"tag": "NAME",
"value": "Josue"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.icp.sigipro.produccion.modelos;
import java.lang.reflect.Field;
import java.sql.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import org.json.JSONObject;
/**
*
* @author Josue
*/
public class Cronograma {
private int id_cronograma;
private String nombre;
private String observaciones;
private Date valido_desde;
public int getId_cronograma() {
return id_cronograma;
}
public void setId_cronograma(int id_cronograma) {
this.id_cronograma = id_cronograma;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getObservaciones() {
return observaciones;
}
public void setObservaciones(String observaciones) {
this.observaciones = observaciones;
}
public Date getValido_desde() {
return valido_desde;
}
public void setValido_desde(Date valido_desde) {
this.valido_desde = valido_desde;
}
private String formatearFecha(Date fecha)
{
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
return df.format(fecha);
}
public String getValido_desde_S(){
if (this.valido_desde != null)
{return formatearFecha(this.valido_desde);}
else
{return "";}
}
public String parseJSON() {
Class _class = this.getClass();
JSONObject JSON = new JSONObject();
try {
Field properties[] = _class.getDeclaredFields();
for (int i = 0; i < properties.length; i++) {
Field field = properties[i];
if (i != 0) {
JSON.put(field.getName(), field.get(this));
} else {
JSON.put("id_objeto", field.get(this));
}
}
} catch (Exception e) {
}
return JSON.toString();
}
}
| 2,257 | 0.565352 | 0.564466 | 89 | 23.35955 | 19.953455 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.404494 | false | false | 2 |
dd7eeee90673fbb959abd0644eebffeb48eab715 | 27,900,107,620,474 | 68cab87333e24283dbefed8adf35afb37c341520 | /sh-dao/src/main/java/com/sh/db/service/ShLogService.java | e4b2db2dc5e7a23afb1434239290275d9bac5647 | [] | no_license | AndyRuiDy/sh-shop | https://github.com/AndyRuiDy/sh-shop | 0f287715a11fdcb350a72f5c5db3155f5d8e25a4 | b25c5810ab1428e69132aecce2359a261f027b0b | refs/heads/master | 2023-01-12T09:57:14.020000 | 2020-11-05T03:11:51 | 2020-11-05T03:11:51 | 309,933,281 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sh.db.service;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sh.db.dao.ShLogMapper;
import com.sh.db.domain.ShLog;
@Service
public class ShLogService {
@Autowired
private ShLogMapper logMapper;
public void add(ShLog log) {
log.setAddTime(LocalDateTime.now());
log.setUpdateTime(LocalDateTime.now());
logMapper.insertSelective(log);
}
}
| UTF-8 | Java | 518 | java | ShLogService.java | Java | [] | null | [] | package com.sh.db.service;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sh.db.dao.ShLogMapper;
import com.sh.db.domain.ShLog;
@Service
public class ShLogService {
@Autowired
private ShLogMapper logMapper;
public void add(ShLog log) {
log.setAddTime(LocalDateTime.now());
log.setUpdateTime(LocalDateTime.now());
logMapper.insertSelective(log);
}
}
| 518 | 0.714286 | 0.714286 | 23 | 20.52174 | 19.00771 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.652174 | false | false | 2 |
cbba30991c098472bea940b611855877ca90f113 | 7,756,710,941,821 | 127d682f028a19e3bc64ea6e01979dbda1766b74 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/ftc16072/actions/WarmUpShooter.java | 44f6f6db46de20af4616a7b0b334a54948fc05d7 | [] | no_license | ftc16072/UltimateGoal20-21 | https://github.com/ftc16072/UltimateGoal20-21 | c5733a01f3451e8f97db08d0010e4b91971c07d1 | f61915b998fc774a6ade6e2e81b1af117d388e48 | refs/heads/master | 2023-07-17T01:25:55.635000 | 2021-05-26T00:08:02 | 2021-05-26T00:08:02 | 298,387,920 | 1 | 0 | null | false | 2021-05-26T00:08:03 | 2020-09-24T20:28:11 | 2021-03-29T23:53:03 | 2021-05-26T00:08:02 | 29,481 | 0 | 0 | 0 | Java | false | false | package org.firstinspires.ftc.teamcode.ftc16072.actions;
import org.firstinspires.ftc.teamcode.ftc16072.opModes.QQ_Opmode;
public class WarmUpShooter extends QQ_Action {
/**
* turn on shooter
* @param opmode this gives the action access to our robot, gamepads, time left etc
* @return nextAction
*/
@Override
public QQ_Action run(QQ_Opmode opmode) {
opmode.robot.shooter.spinWheels(true);
return nextAction;
}
}
| UTF-8 | Java | 467 | java | WarmUpShooter.java | Java | [] | null | [] | package org.firstinspires.ftc.teamcode.ftc16072.actions;
import org.firstinspires.ftc.teamcode.ftc16072.opModes.QQ_Opmode;
public class WarmUpShooter extends QQ_Action {
/**
* turn on shooter
* @param opmode this gives the action access to our robot, gamepads, time left etc
* @return nextAction
*/
@Override
public QQ_Action run(QQ_Opmode opmode) {
opmode.robot.shooter.spinWheels(true);
return nextAction;
}
}
| 467 | 0.69379 | 0.672377 | 17 | 26.470589 | 25.741058 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false | 2 |
2aaf146fcdb7d63fa6fc329f4050fed3c69a7f72 | 1,477,468,760,190 | dd8a97fecb9c33a7b52ed5adb9bbf1069dcd991e | /src/main/java/com/atm/exception/ATMExceptionHandler.java | caeca1246cd60fe99d187efa321a99abe7f9db45 | [] | no_license | NithyaPeriyasamy89/Atm-Service | https://github.com/NithyaPeriyasamy89/Atm-Service | ac3371656c9fdf5db34608632a9409135a4c419a | dd6a76f4fcde41405a92c79d0bff3a33309169c8 | refs/heads/master | 2023-05-03T15:22:20.322000 | 2021-05-30T14:47:02 | 2021-05-30T14:47:02 | 372,236,004 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.atm.exception;
import java.time.LocalDate;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import com.atm.response.ATMMachineRequestResult;
import com.atm.service.PostATMMachineService;
import com.fasterxml.jackson.databind.JsonMappingException;
@ControllerAdvice
public class ATMExceptionHandler extends ResponseEntityExceptionHandler{
@Autowired
private PostATMMachineService abstractService;
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(
MethodArgumentNotValidException ex, HttpHeaders headers,
HttpStatus status, WebRequest request) {
Map<String, Object> body = new LinkedHashMap<>();
body.put("timestamp", LocalDate.now());
body.put("status", status.value());
List<String> errors = ex.getBindingResult()
.getFieldErrors()
.stream()
.map(x -> x.getDefaultMessage())
.collect(Collectors.toList());
body.put("errors", errors);
return new ResponseEntity<>(body, HttpStatus.BAD_REQUEST);
}
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseEntity<Object> handleJsonMappingException(JsonMappingException ex) {
return new ResponseEntity<>("invalid request", HttpStatus.BAD_REQUEST);
}
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseEntity<Object> handleUserAccountException(UserAccountException ex) {
ATMMachineRequestResult requestResult = abstractService.prepareErrorResponse(ex.getMessage());
return new ResponseEntity<>(requestResult, HttpStatus.BAD_REQUEST);
}
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseEntity<Object> handleValidationException(ValidationException ex) {
ATMMachineRequestResult requestResult = abstractService.prepareErrorResponse(ex.getMessage());
return new ResponseEntity<>(requestResult, HttpStatus.BAD_REQUEST);
}
}
| UTF-8 | Java | 2,667 | java | ATMExceptionHandler.java | Java | [] | null | [] | package com.atm.exception;
import java.time.LocalDate;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import com.atm.response.ATMMachineRequestResult;
import com.atm.service.PostATMMachineService;
import com.fasterxml.jackson.databind.JsonMappingException;
@ControllerAdvice
public class ATMExceptionHandler extends ResponseEntityExceptionHandler{
@Autowired
private PostATMMachineService abstractService;
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(
MethodArgumentNotValidException ex, HttpHeaders headers,
HttpStatus status, WebRequest request) {
Map<String, Object> body = new LinkedHashMap<>();
body.put("timestamp", LocalDate.now());
body.put("status", status.value());
List<String> errors = ex.getBindingResult()
.getFieldErrors()
.stream()
.map(x -> x.getDefaultMessage())
.collect(Collectors.toList());
body.put("errors", errors);
return new ResponseEntity<>(body, HttpStatus.BAD_REQUEST);
}
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseEntity<Object> handleJsonMappingException(JsonMappingException ex) {
return new ResponseEntity<>("invalid request", HttpStatus.BAD_REQUEST);
}
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseEntity<Object> handleUserAccountException(UserAccountException ex) {
ATMMachineRequestResult requestResult = abstractService.prepareErrorResponse(ex.getMessage());
return new ResponseEntity<>(requestResult, HttpStatus.BAD_REQUEST);
}
@ExceptionHandler
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseEntity<Object> handleValidationException(ValidationException ex) {
ATMMachineRequestResult requestResult = abstractService.prepareErrorResponse(ex.getMessage());
return new ResponseEntity<>(requestResult, HttpStatus.BAD_REQUEST);
}
}
| 2,667 | 0.769779 | 0.769779 | 68 | 38.220589 | 28.800962 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.161765 | false | false | 2 |
3f46a237a2e6d9469e2b4e804337fbbc3c9975fc | 26,285,199,900,210 | 59fff901d5b9510a46dd09aeab2d26e961be51ef | /Code/api/hswechat/com.hsapi.wechat.autoServiceSys/src/com/huasheng/usersWechat/WeChatIPUrl.java | d555a70dfa26709dd703dd86c5d38a3890544014 | [] | no_license | dinglingbo/test | https://github.com/dinglingbo/test | b488fc312ecc259f1cdd8e26963ac3f79becfe8a | 7db6fcd44817bace948cc4c307455fe045e33038 | refs/heads/master | 2021-06-23T16:42:19.809000 | 2021-02-06T01:33:58 | 2021-02-06T01:33:58 | 191,119,851 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.huasheng.usersWechat;
import java.util.Map;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.eos.system.annotation.Bizlet;
import com.wechat.Tool.WechatCommonTool;
@Bizlet("")
public class WeChatIPUrl {
public static String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
public static String AppID = "wxd10b49dcb45e5591";
public static String Secret = "8f21ab04f3b9bc252d8dce64a6d055e4";
@Bizlet("")
public static String queryWeChatIp(){
String Accesstoken = null;
url=url+"&appid="+AppID+"&secret="+Secret;
String JAccesstoken = WechatCommonTool.transferLinkInterface(url);
System.out.println(url);
JSONObject json = JSONObject.parseObject(JAccesstoken);
System.out.println(json.toJSONString());
if (json != null) {
try {
Accesstoken = json.getString("access_token");
} catch (JSONException e) {
Accesstoken = null;
System.out.println("系统异常,获取access_token失败");
}
}
return json.toJSONString();
}
}
| UTF-8 | Java | 1,056 | java | WeChatIPUrl.java | Java | [
{
"context": "10b49dcb45e5591\";\n\tpublic static String Secret = \"8f21ab04f3b9bc252d8dce64a6d055e4\";\n\t@Bizlet(\"\")\n\tpublic static String queryWeChatI",
"end": 481,
"score": 0.99974524974823,
"start": 449,
"tag": "KEY",
"value": "8f21ab04f3b9bc252d8dce64a6d055e4"
}
] | null | [] | package com.huasheng.usersWechat;
import java.util.Map;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.eos.system.annotation.Bizlet;
import com.wechat.Tool.WechatCommonTool;
@Bizlet("")
public class WeChatIPUrl {
public static String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
public static String AppID = "wxd10b49dcb45e5591";
public static String Secret = "<KEY>";
@Bizlet("")
public static String queryWeChatIp(){
String Accesstoken = null;
url=url+"&appid="+AppID+"&secret="+Secret;
String JAccesstoken = WechatCommonTool.transferLinkInterface(url);
System.out.println(url);
JSONObject json = JSONObject.parseObject(JAccesstoken);
System.out.println(json.toJSONString());
if (json != null) {
try {
Accesstoken = json.getString("access_token");
} catch (JSONException e) {
Accesstoken = null;
System.out.println("系统异常,获取access_token失败");
}
}
return json.toJSONString();
}
}
| 1,029 | 0.739884 | 0.712909 | 35 | 28.657143 | 23.274687 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.885714 | false | false | 2 |
f92d5685cb10f4f313d9a9e3807cffdad34ecbb1 | 29,523,605,248,711 | 411d9da75de5e92e9732cc8640dd9529f463325f | /src/main/java/com/pinganzhiyuan/service/LogInService.java | 613e30524e3a0afcc31e38674d41e835cbeab8e3 | [] | no_license | jerry0429/panda_loan_backend_server | https://github.com/jerry0429/panda_loan_backend_server | 6269a0a6082abcefc400166f960dbade23d094b9 | 94bb8918b374f8d6334e0cc8035aea35c890ec92 | refs/heads/master | 2023-05-02T10:50:22.168000 | 2018-04-09T12:39:42 | 2018-04-09T12:39:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.pinganzhiyuan.service;
import com.pinganzhiyuan.model.DeviceLog;
import com.pinganzhiyuan.model.SMSLog;
public interface LogInService {
public void createLogInByDeviceLog(DeviceLog deviceLog);
}
| UTF-8 | Java | 212 | java | LogInService.java | Java | [] | null | [] | package com.pinganzhiyuan.service;
import com.pinganzhiyuan.model.DeviceLog;
import com.pinganzhiyuan.model.SMSLog;
public interface LogInService {
public void createLogInByDeviceLog(DeviceLog deviceLog);
}
| 212 | 0.830189 | 0.830189 | 10 | 20.200001 | 21.003809 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 2 |
ebf4a285a0d9c14ecc81a109ad7150c104ecae76 | 24,223,615,600,455 | 34fb95b16ccefbde3a1899334ba5815a8f7c8383 | /mwfj_JavaSE_practice/src/thread_practice/ThreadSynchroized2.java | f5234cd02d867d23ec2543388c3162676e405159 | [] | no_license | mwfj/Java_Basic_Practice | https://github.com/mwfj/Java_Basic_Practice | 80b7fce6e2f164494e3811dc3a9ae7ffda1acbce | 6067e2703cd8693d081bdcf666728640586f6abf | refs/heads/master | 2021-03-31T03:42:01.873000 | 2021-01-18T20:40:37 | 2021-01-18T20:40:37 | 248,072,781 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package thread_practice;
public class ThreadSynchroized2 extends Thread{
Card_synchroized card_synchroized;
public ThreadSynchroized2(Card_synchroized card) {
// TODO Auto-generated constructor stub
this.card_synchroized = card;
}
@Override
public void run() {
// TODO Auto-generated method stub
super.run();
try {
card_synchroized.WithdrawMoney_Synchriozed(50.00);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("取钱线程结束");
}
}
| UTF-8 | Java | 538 | java | ThreadSynchroized2.java | Java | [] | null | [] | package thread_practice;
public class ThreadSynchroized2 extends Thread{
Card_synchroized card_synchroized;
public ThreadSynchroized2(Card_synchroized card) {
// TODO Auto-generated constructor stub
this.card_synchroized = card;
}
@Override
public void run() {
// TODO Auto-generated method stub
super.run();
try {
card_synchroized.WithdrawMoney_Synchriozed(50.00);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("取钱线程结束");
}
}
| 538 | 0.730038 | 0.718631 | 22 | 22.90909 | 17.490021 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.727273 | false | false | 2 |
859be37a134ca8a76030c4a3edeb3e4f819ff1f5 | 4,861,903,042,699 | 8ca32b3f19282b0cb3ef4cc06a919b3d328eac42 | /src/main/java/com/fdmgroup/medievalmayor/exceptions/InsufficientPopulationException.java | 970bfbbdec7bbf7cee8131a303c44041c9df4cc1 | [] | no_license | Chief-Glew/MedievalMayor | https://github.com/Chief-Glew/MedievalMayor | cb34b712ca35d2641616dde8e4da91a6dbaa08d1 | 743a07b8a662e3babd40f5290db7c393e1cf74e1 | refs/heads/master | 2020-03-25T09:02:14.965000 | 2017-09-22T09:28:58 | 2017-09-22T09:28:58 | 143,644,143 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fdmgroup.medievalmayor.exceptions;
public class InsufficientPopulationException extends Exception {
private static final long serialVersionUID = 1L;
public InsufficientPopulationException(String s){
super(s);
}
}
| UTF-8 | Java | 234 | java | InsufficientPopulationException.java | Java | [] | null | [] | package com.fdmgroup.medievalmayor.exceptions;
public class InsufficientPopulationException extends Exception {
private static final long serialVersionUID = 1L;
public InsufficientPopulationException(String s){
super(s);
}
}
| 234 | 0.807692 | 0.803419 | 10 | 22.4 | 24.944738 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.9 | false | false | 2 |
1a93e9dc3f5b18f3f581b33c1fa56a9c4c705b9c | 15,882,789,063,199 | 4f8e4017bbd83da8d37649b8bb7504ac84fa623b | /src/Logica/CatalogoDeUsuarios.java | fa5c67bf7a59308b9305e1cab6d6218dc0eb7709 | [] | no_license | LucasAngeloni/Portal | https://github.com/LucasAngeloni/Portal | d72bca84192bd8905d4b91e1d9916b65138e0954 | a2c32a0434a042c183e283546182ccf947037557 | refs/heads/main | 2023-07-22T03:57:53.113000 | 2021-09-09T20:05:25 | 2021-09-09T20:05:25 | 404,798,091 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Logica;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import Datos.EsUsuarioAdministradorException;
import Datos.PreferenciasData;
import Datos.UsuarioData;
import Modelo.Usuario;
import Modelo.BusinessEntity.States;
import Modelo.Categoria;
import Modelo.Hilo;
import Modelo.Preferencia;
public class CatalogoDeUsuarios {
private UsuarioData UsuarioData;
public CatalogoDeUsuarios() {
UsuarioData = new UsuarioData();
}
public Usuario getOne(String nom_usu, String contra) throws SQLException, EsUsuarioAdministradorException {
try {
return UsuarioData.getOne(nom_usu, contra);
} catch (SQLException e) {
throw new SQLException("Error al recuperar al usuario");
} catch (EsUsuarioAdministradorException e) {
throw e;
}
}
public Usuario getOne(String nom_usu) throws SQLException {
try {
return (Usuario)UsuarioData.getOne(nom_usu);
} catch (SQLException e) {
throw new SQLException("Error al recuperar un usuario");
}
}
public ArrayList<Usuario> getAll() throws SQLException{
try {
return this.UsuarioData.getAll();
} catch (SQLException e) {
throw new SQLException("Error al recuperar la lista de usuarios");
}
}
public void guardarHilo(Hilo hilo, Usuario usuario) throws SQLException {
try {
this.UsuarioData.guardarHilo(hilo.getIdHilo(), usuario.getNombreUsuario());
usuario.guardarHilo(hilo);
}
catch (SQLException e) {
throw new SQLException(e);
}
}
public void desguardarHilo(Hilo hilo, Usuario usuario) throws SQLException {
try {
this.UsuarioData.desguardarHilo(hilo.getIdHilo(), usuario.getNombreUsuario());
usuario.quitarHiloGuardado(hilo);
}
catch (SQLException e) {
throw new SQLException(e);
}
}
public void save(Usuario usuario) throws ExcepcionCampos, SQLException, IOException{
if(usuario.getState() == States.NEW)
this.validarCampos(usuario);
if(usuario.getState() == States.MODIFIED)
this.validarFormatosDatos(usuario);
try {
this.UsuarioData.save(usuario);
}
catch (SQLException e) {
if(e.getErrorCode() == 0)
throw new SQLException("El nombre de usuario elegido ya existe");
else
throw new SQLException("Error de conexion");
} catch (IOException e) {
throw new IOException("Error al intentar guardar la imagen");
}
}
public void cambiarImagen(Usuario usuario, String imagen, String direccion_imgs) throws ExcepcionCampos, SQLException, IOException {
this.validarImagen(imagen);
String imagen_usuario = direccion_imgs + imagen;
usuario.setImagen(imagen_usuario);
usuario.setState(States.MODIFIED);
this.save(usuario);
}
private void validarImagen(String imagen) throws ExcepcionCampos {
Pattern pat = Pattern.compile(".+(.jpg|.png|.jfif)$");
Matcher mat = pat.matcher(imagen);
if(!mat.matches())
throw new ExcepcionCampos("El formato de la imagen no es válida. Debe ser .jpg, .png o .jfif");
}
private void validarCampos(Usuario usuario) throws ExcepcionCampos{
if(!usuario.getContraseña().equals(usuario.getRepeticionContraseña()))
throw new ExcepcionCampos("Las claves ingresadas no coinciden");
if(usuario.getNombreUsuario().equals("") || usuario.getEmail().equals("") || usuario.getTelefono().equals("") || usuario.getImagen().equals("") ||
usuario.getContraseña().equals(""))
throw new ExcepcionCampos("Se deben completar todos los campos");
this.validarFormatosDatos(usuario);
this.validarImagen(usuario.getImagen());
this.validarClave(usuario.getContraseña());
}
private void validarFormatosDatos(Usuario usuario) throws ExcepcionCampos {
this.validarEmail(usuario.getEmail());
this.validarTelefono(usuario.getTelefono());
}
private void validarTelefono(String telefono) throws ExcepcionCampos {
Pattern pat = Pattern.compile("\\d{10}");
Matcher mat = pat.matcher(telefono);
if(!mat.matches())
throw new ExcepcionCampos("Formato del teléfono inválido");
}
private void validarClave(String clave) throws ExcepcionCampos {
if(clave.length() < 8 )
throw new ExcepcionCampos("La clave no puede contener menos de 8 caracteres");
Pattern pat = Pattern.compile("\\w+");
Matcher mat = pat.matcher(clave);
if(!mat.matches())
throw new ExcepcionCampos("La clave solo puede contener digitos o letras minúsculas o mayúsculas");
}
private void validarEmail(String email) throws ExcepcionCampos {
Pattern pat = Pattern.compile("[^@]+@[^@]+\\.[a-zA-Z]{2,}");
Matcher mat = pat.matcher(email);
if(!mat.matches())
throw new ExcepcionCampos("Formato de email inválido");
}
public void cambiarClave(Usuario usuario, String claveActual, String claveNueva) throws SQLException, ExcepcionCampos {
if(usuario.getContraseña().equals(claveActual)) {
this.validarClave(claveNueva);
try {
this.UsuarioData.cambiarClave(usuario.getNombreUsuario(),claveNueva);
}
catch (SQLException e) {
throw new SQLException("Error de conexión");
}
}
else
throw new ExcepcionCampos("La clave que se desea modificar no es la correcta");
}
public void lectorAComunicador(String nombre_usuario, String nombre, String apellido, String descripcion) throws SQLException, ExcepcionCampos {
if(nombre.equals("") || apellido.equals("") || descripcion.equals(""))
throw new ExcepcionCampos("No puede haber campos vacíos");
try {
this.UsuarioData.lectorAComunicador(nombre_usuario, nombre, apellido, descripcion);
} catch (SQLException e) {
throw new SQLException("Error de conexion");
}
}
public void updatePreferencias(Usuario usuario, String accion, ArrayList<Categoria> categorias_hilo) throws SQLException {
EstrategiaPreferencias est = new EstrategiaPreferencias(usuario.getPreferencias(),categorias_hilo);
est.updatePreferencias(accion);
}
public void cerrarSesion(Usuario usuario) throws SQLException {
ArrayList<Preferencia> preferencias_nuevas = new ArrayList<Preferencia>();
for(Preferencia preferencia : usuario.getPreferencias()) {
if(preferencia.getState() == States.NEW)
preferencias_nuevas.add(preferencia);
}
PreferenciasData.insertPreferencias(preferencias_nuevas, usuario.getNombreUsuario());
PreferenciasData.updatePreferencias(usuario.getPreferencias(),usuario.getNombreUsuario());
}
public ArrayList<Usuario> buscarUsuarios(String tipo_filtro, String texto) throws SQLException{
try {
switch(tipo_filtro) {
case "usuario":
return this.UsuarioData.buscarUsuarios("nombre_usuario", texto);
case "email":
return this.UsuarioData.buscarUsuarios(tipo_filtro, texto);
default:
return null;
}
}
catch(SQLException e) {
throw new SQLException("ERROR de conexión");
}
}
public class ExcepcionCampos extends Exception{
private static final long serialVersionUID = 1L;
public ExcepcionCampos(String msg) {
super(msg);
}
}
}
| ISO-8859-1 | Java | 6,989 | java | CatalogoDeUsuarios.java | Java | [
{
"context": "rio\":\n\t\t\t\treturn this.UsuarioData.buscarUsuarios(\"nombre_usuario\", texto);\n\t\t\tcase \"email\":\n\t\t\t\treturn this.Usuari",
"end": 6598,
"score": 0.998603105545044,
"start": 6584,
"tag": "USERNAME",
"value": "nombre_usuario"
}
] | null | [] | package Logica;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import Datos.EsUsuarioAdministradorException;
import Datos.PreferenciasData;
import Datos.UsuarioData;
import Modelo.Usuario;
import Modelo.BusinessEntity.States;
import Modelo.Categoria;
import Modelo.Hilo;
import Modelo.Preferencia;
public class CatalogoDeUsuarios {
private UsuarioData UsuarioData;
public CatalogoDeUsuarios() {
UsuarioData = new UsuarioData();
}
public Usuario getOne(String nom_usu, String contra) throws SQLException, EsUsuarioAdministradorException {
try {
return UsuarioData.getOne(nom_usu, contra);
} catch (SQLException e) {
throw new SQLException("Error al recuperar al usuario");
} catch (EsUsuarioAdministradorException e) {
throw e;
}
}
public Usuario getOne(String nom_usu) throws SQLException {
try {
return (Usuario)UsuarioData.getOne(nom_usu);
} catch (SQLException e) {
throw new SQLException("Error al recuperar un usuario");
}
}
public ArrayList<Usuario> getAll() throws SQLException{
try {
return this.UsuarioData.getAll();
} catch (SQLException e) {
throw new SQLException("Error al recuperar la lista de usuarios");
}
}
public void guardarHilo(Hilo hilo, Usuario usuario) throws SQLException {
try {
this.UsuarioData.guardarHilo(hilo.getIdHilo(), usuario.getNombreUsuario());
usuario.guardarHilo(hilo);
}
catch (SQLException e) {
throw new SQLException(e);
}
}
public void desguardarHilo(Hilo hilo, Usuario usuario) throws SQLException {
try {
this.UsuarioData.desguardarHilo(hilo.getIdHilo(), usuario.getNombreUsuario());
usuario.quitarHiloGuardado(hilo);
}
catch (SQLException e) {
throw new SQLException(e);
}
}
public void save(Usuario usuario) throws ExcepcionCampos, SQLException, IOException{
if(usuario.getState() == States.NEW)
this.validarCampos(usuario);
if(usuario.getState() == States.MODIFIED)
this.validarFormatosDatos(usuario);
try {
this.UsuarioData.save(usuario);
}
catch (SQLException e) {
if(e.getErrorCode() == 0)
throw new SQLException("El nombre de usuario elegido ya existe");
else
throw new SQLException("Error de conexion");
} catch (IOException e) {
throw new IOException("Error al intentar guardar la imagen");
}
}
public void cambiarImagen(Usuario usuario, String imagen, String direccion_imgs) throws ExcepcionCampos, SQLException, IOException {
this.validarImagen(imagen);
String imagen_usuario = direccion_imgs + imagen;
usuario.setImagen(imagen_usuario);
usuario.setState(States.MODIFIED);
this.save(usuario);
}
private void validarImagen(String imagen) throws ExcepcionCampos {
Pattern pat = Pattern.compile(".+(.jpg|.png|.jfif)$");
Matcher mat = pat.matcher(imagen);
if(!mat.matches())
throw new ExcepcionCampos("El formato de la imagen no es válida. Debe ser .jpg, .png o .jfif");
}
private void validarCampos(Usuario usuario) throws ExcepcionCampos{
if(!usuario.getContraseña().equals(usuario.getRepeticionContraseña()))
throw new ExcepcionCampos("Las claves ingresadas no coinciden");
if(usuario.getNombreUsuario().equals("") || usuario.getEmail().equals("") || usuario.getTelefono().equals("") || usuario.getImagen().equals("") ||
usuario.getContraseña().equals(""))
throw new ExcepcionCampos("Se deben completar todos los campos");
this.validarFormatosDatos(usuario);
this.validarImagen(usuario.getImagen());
this.validarClave(usuario.getContraseña());
}
private void validarFormatosDatos(Usuario usuario) throws ExcepcionCampos {
this.validarEmail(usuario.getEmail());
this.validarTelefono(usuario.getTelefono());
}
private void validarTelefono(String telefono) throws ExcepcionCampos {
Pattern pat = Pattern.compile("\\d{10}");
Matcher mat = pat.matcher(telefono);
if(!mat.matches())
throw new ExcepcionCampos("Formato del teléfono inválido");
}
private void validarClave(String clave) throws ExcepcionCampos {
if(clave.length() < 8 )
throw new ExcepcionCampos("La clave no puede contener menos de 8 caracteres");
Pattern pat = Pattern.compile("\\w+");
Matcher mat = pat.matcher(clave);
if(!mat.matches())
throw new ExcepcionCampos("La clave solo puede contener digitos o letras minúsculas o mayúsculas");
}
private void validarEmail(String email) throws ExcepcionCampos {
Pattern pat = Pattern.compile("[^@]+@[^@]+\\.[a-zA-Z]{2,}");
Matcher mat = pat.matcher(email);
if(!mat.matches())
throw new ExcepcionCampos("Formato de email inválido");
}
public void cambiarClave(Usuario usuario, String claveActual, String claveNueva) throws SQLException, ExcepcionCampos {
if(usuario.getContraseña().equals(claveActual)) {
this.validarClave(claveNueva);
try {
this.UsuarioData.cambiarClave(usuario.getNombreUsuario(),claveNueva);
}
catch (SQLException e) {
throw new SQLException("Error de conexión");
}
}
else
throw new ExcepcionCampos("La clave que se desea modificar no es la correcta");
}
public void lectorAComunicador(String nombre_usuario, String nombre, String apellido, String descripcion) throws SQLException, ExcepcionCampos {
if(nombre.equals("") || apellido.equals("") || descripcion.equals(""))
throw new ExcepcionCampos("No puede haber campos vacíos");
try {
this.UsuarioData.lectorAComunicador(nombre_usuario, nombre, apellido, descripcion);
} catch (SQLException e) {
throw new SQLException("Error de conexion");
}
}
public void updatePreferencias(Usuario usuario, String accion, ArrayList<Categoria> categorias_hilo) throws SQLException {
EstrategiaPreferencias est = new EstrategiaPreferencias(usuario.getPreferencias(),categorias_hilo);
est.updatePreferencias(accion);
}
public void cerrarSesion(Usuario usuario) throws SQLException {
ArrayList<Preferencia> preferencias_nuevas = new ArrayList<Preferencia>();
for(Preferencia preferencia : usuario.getPreferencias()) {
if(preferencia.getState() == States.NEW)
preferencias_nuevas.add(preferencia);
}
PreferenciasData.insertPreferencias(preferencias_nuevas, usuario.getNombreUsuario());
PreferenciasData.updatePreferencias(usuario.getPreferencias(),usuario.getNombreUsuario());
}
public ArrayList<Usuario> buscarUsuarios(String tipo_filtro, String texto) throws SQLException{
try {
switch(tipo_filtro) {
case "usuario":
return this.UsuarioData.buscarUsuarios("nombre_usuario", texto);
case "email":
return this.UsuarioData.buscarUsuarios(tipo_filtro, texto);
default:
return null;
}
}
catch(SQLException e) {
throw new SQLException("ERROR de conexión");
}
}
public class ExcepcionCampos extends Exception{
private static final long serialVersionUID = 1L;
public ExcepcionCampos(String msg) {
super(msg);
}
}
}
| 6,989 | 0.733333 | 0.73233 | 224 | 30.138393 | 31.552019 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.392857 | false | false | 2 |
9652761e81954deb489bc9c3ee8732806792dc07 | 506,806,154,574 | 184562fafa201722a54e78f6bdecb8ebed108011 | /src/main/java/testy_i_próby/zadania_datatypes_TS/Task5TS.java | 7aa06638d02f79436408365c2d4af677c7b2b2ec | [] | no_license | Rafal-Stefanski/Git | https://github.com/Rafal-Stefanski/Git | bb407ef8d3ac5ac781d73325bd56a4324edb7f77 | e2ecb2dea893fe95e4136decf434353622361059 | refs/heads/master | 2020-04-24T19:08:35.344000 | 2020-04-21T15:07:37 | 2020-04-21T15:07:37 | 172,202,750 | 1 | 0 | null | false | 2021-03-31T21:38:57 | 2019-02-23T10:46:13 | 2021-03-08T16:53:19 | 2021-03-31T21:38:57 | 1,044 | 1 | 0 | 1 | Java | false | false | package testy_i_próby.zadania_datatypes_TS;
/*
public class Task5TS {
}
*/
public class Task5TS {
public static void main(String[] args) {
int a = 65; // pierwszy znak łaciński
int b = 1488; // pierwszy znak hebrajski
int c = 3840; // pierwszy znak tybetański
for (int i = 0; i < 5; i++) {
System.out.print((char) a + " ");
a = (a + 1);
}
System.out.println();
for (int i = 0; i < 5; i++){
System.out.print(b + " ");
int x = (int)b++;
}
System.out.println();
for (int i = 0; i < 5; i++){
System.out.print(c + " ");
int x = (int)c++;
}
System.out.println();
}
}
| UTF-8 | Java | 754 | java | Task5TS.java | Java | [] | null | [] | package testy_i_próby.zadania_datatypes_TS;
/*
public class Task5TS {
}
*/
public class Task5TS {
public static void main(String[] args) {
int a = 65; // pierwszy znak łaciński
int b = 1488; // pierwszy znak hebrajski
int c = 3840; // pierwszy znak tybetański
for (int i = 0; i < 5; i++) {
System.out.print((char) a + " ");
a = (a + 1);
}
System.out.println();
for (int i = 0; i < 5; i++){
System.out.print(b + " ");
int x = (int)b++;
}
System.out.println();
for (int i = 0; i < 5; i++){
System.out.print(c + " ");
int x = (int)c++;
}
System.out.println();
}
}
| 754 | 0.448 | 0.422667 | 40 | 17.75 | 17.897974 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.475 | false | false | 2 |
984e04576e13df7dbe18fc7f0371622809d20d10 | 506,806,154,620 | 3b354128e2ddbe057e542c86c77900d749befde1 | /src/main/java/neri/rodrigo/botmsd/model/vendas/itentquatro/IItent4.java | 0f413be719233ff4f3051fe7f514a62b7f21c2e5 | [] | no_license | rodrigogregorioneri/botmsd | https://github.com/rodrigogregorioneri/botmsd | 8bef8095b26b721f43621192f4f9ae5ed0462967 | 8f7acf71c42f0495c6a6b773df3b2e4bc11b3815 | refs/heads/master | 2023-06-04T06:16:04.109000 | 2021-06-25T14:15:42 | 2021-06-25T14:15:42 | 375,175,009 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package neri.rodrigo.botmsd.model.vendas.itentquatro;
public interface IItent4 {
String getLinha();
String getAno();
String getMes();
String getMeta();
String getRealizado();
String getDesempenho();
}
| UTF-8 | Java | 233 | java | IItent4.java | Java | [] | null | [] | package neri.rodrigo.botmsd.model.vendas.itentquatro;
public interface IItent4 {
String getLinha();
String getAno();
String getMes();
String getMeta();
String getRealizado();
String getDesempenho();
}
| 233 | 0.669528 | 0.665236 | 17 | 12.705882 | 15.090959 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false | 2 |
31b34e00a6ff377a6818a7eb04c7f913b4dc6d75 | 24,017,457,144,648 | cc7ce7ae253196255f2cf0f4091c3e1bdf3c9a9b | /build/generated/src/org/apache/jsp/office_jsp.java | 7e828beb9853d5acaf8da9ad303029430bdb7913 | [] | no_license | satyarth2404/Quarter-Allocation-Application-for-AAI | https://github.com/satyarth2404/Quarter-Allocation-Application-for-AAI | 33711d0d62c63d9b2577705aef53b0fec071a670 | f19c9f51244cd651556361072491826db0d5c51b | refs/heads/master | 2020-03-22T02:49:04.593000 | 2018-07-02T05:28:11 | 2018-07-02T05:28:11 | 139,394,904 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.sql.Statement;
import java.sql.DriverManager;
import java.sql.Connection;
public final class office_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List<String> _jspx_dependants;
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public java.util.List<String> getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write("<head>\n");
out.write("<title>AIRPORT AUTHORITY OF INDIA</title>\n");
out.write("</head>\n");
out.write("\n");
out.write("\n");
out.write("\t<center><img align=\"top\" src=\"untitled.jpg\" alt=\"Smiley face\" height=\"250\" width=\"250\">\n");
out.write("\t<h1>AIRPORT AUTHORITY OF INDIA</h1>\n");
out.write("\t<h2>Quarter Allocation System</h2>\n");
out.write("</center>\n");
out.write("\n");
out.write("<body bgcolor=\"#ccffe6\">\n");
out.write("\t<table border=\"5\" cellpadding=\"3\" width=\"100%\" align=\"center\"\n");
out.write("cellspacing=\"3\">\n");
out.write(" <tr>\n");
out.write(" <td bgcolor=\"#33ff33\" ><center><font size=\"4\"><b>REGISTRATION</b></center></font></center></td>\n");
out.write(" <td bgcolor=\"#42b3f4\"><center><font size=\"4\"><b>OFFICIAL DETAILS</b></center></font></center></td>\n");
out.write(" <td bgcolor=\"#ff3333\"><center><font size=\"4\"><b>RESIDENTIAL DETAILS</b></center></font></center></td>\n");
out.write("\n");
out.write(" </tr>\n");
out.write("</table>\n");
out.write("<br>\n");
out.write("<br>\n");
out.write("<br>\n");
out.write("<style type=\"text/css\">\n");
out.write(" #r1{\n");
out.write(" background-color: #ff1a1a; \n");
out.write(" border: none;\n");
out.write(" color: white;\n");
out.write(" padding: 10px 32px;\n");
out.write(" text-align: center;\n");
out.write(" text-decoration: none;\n");
out.write(" display: inline-block;\n");
out.write(" font-size: 16px;\n");
out.write(" }\n");
out.write("\n");
out.write(" #s1{\n");
out.write(" background-color: #009933; \n");
out.write(" border: none;\n");
out.write(" color: white;\n");
out.write(" padding: 10px 32px;\n");
out.write(" text-align: center;\n");
out.write(" text-decoration: none;\n");
out.write(" display: inline-block;\n");
out.write(" font-size: 16px;\n");
out.write(" }\n");
out.write("\n");
out.write("\n");
out.write("</style>\n");
out.write("\n");
out.write("\n");
out.write("<form>\n");
out.write("\n");
out.write("<table style=\"font-weight: bold; font-size: 18\" border=\"1\" cellpadding=\"3\" width=\"80%\" bgcolor=\"#ffcccc\" align=\"center\"\n");
out.write("cellspacing=\"12\">\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td colspan=2>\n");
out.write("<center><font size=4><b>OFFICIAL FORM</b></font></center>\n");
out.write("</td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>1) Service to which Official/Officer belong</td>\n");
out.write("<td><input type=text name=\"service\" id=\"service\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>2) Present Address</td>\n");
out.write("<td><input type=\"text\" name=\"padd\" id=\"padd\"\n");
out.write("size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>3) Designation</td>\n");
out.write("<td><input type=\"text\" name=\"designation\" id=\"designation\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>4) Department</td>\n");
out.write("<td><input type=\"text\" name=\"dept\" id=\"dept\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>5) Groups</td>\n");
out.write("<td><input type=\"text\" name=\"groups\" id=\"groups\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>6) Date from which continuously employed in govt. service</td>\n");
out.write("<td><input type=\"text\" name=\"dtemp\" id=\"dtemp\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>7) Date of Superannuation/Retirement</td>\n");
out.write("<td><input type=\"text\" name=\"dtret\" id=\"dtret\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>8) Date from which continuously posted in the present city</td>\n");
out.write("<td><input type=\"text\" name=\"dtpresent\" id=\"dtpresent\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>9) Eligible for rent free accomodation</td>\n");
out.write("<td><input type=\"text\" name=\"eligible\" id=\"eligible\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>10) Entitled for HRA</td>\n");
out.write("<td><input type=\"text\" name=\"hra\" id=\"hra\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>11) Service Status</td>\n");
out.write("<td><input type=\"text\" name=\"servicest\" id=\"servicest\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>12) Pay Scale</td>\n");
out.write("<td><input type=\"text\" name=\"pays\" id=\"pays\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>13) Basic Pay</td>\n");
out.write("<td><select name=\"bpay\">\n");
out.write("<option value=\"10200 - 12749\">10200 - 12749</option>\n");
out.write("<option value=\"10200 - 12749\">10200 - 12749</option>\n");
out.write("<option value=\"12750 - 17379\">12750 - 17379</option>\n");
out.write("<option value=\"17380 - 33599\">17380 - 33599</option>\n");
out.write("<option value=\"33600 - 40549\">33600 - 40549</option>\n");
out.write("<option value=\"33600 - 40549\">33600 - 40549</option>\n");
out.write("<option value=\"40550 - 55019\">40550 - 55019</option>\n");
out.write("<option value=\"55020 & above\">55020 & above</option>\n");
out.write("</select></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td><b>14) Entitlement of Accomodation</b></td>\n");
out.write("<td><select name=\"entitlement\">\n");
out.write("<option value=\"A1\">A1 :10200 - 12749</option>\n");
out.write("<option value=\"A2\">A2 :10200 - 12749</option>\n");
out.write("<option value=\"B1\">B1 :12750 - 17379</option>\n");
out.write("<option value=\"B2\">B2 :17380 - 33599</option>\n");
out.write("<option value=\"C1\">C1 :33600 - 40549</option>\n");
out.write("<option value=\"C2\">C2 :33600 - 40549</option>\n");
out.write("<option value=\"D\">D :40550 - 55019</option>\n");
out.write("<option value=\"E\">E :55020 & above</option>\n");
out.write("</select></td>\n");
out.write("</tr> \n");
out.write("</table>\n");
out.write("\n");
out.write("<br>\n");
out.write("<br>\n");
out.write("<center><input type=\"reset\" id=\"r1\"/>\n");
out.write("\n");
out.write(" <span style=\"display:inline-block; width: 50px;\"></span>\n");
out.write("<input id=\"s1\" type=\"submit\" value=\"submit\" name=\"submit\"/>\n");
out.write("</center>\n");
out.write("<br>\n");
out.write("<br>\n");
out.write("\n");
out.write("\n");
out.write("</form> \n");
out.write("<br>\n");
out.write("<br>\n");
String name=(String)session.getAttribute("name");
String empid=(String)session.getAttribute("empid");
String service= request.getParameter("service");
String padd= request.getParameter("padd");
String designation= request.getParameter("designation");
String dept= request.getParameter("dept");
String groups= request.getParameter("groups");
String dtemp= request.getParameter("dtemp");
String dtret= request.getParameter("dtret");
String dtpresent= request.getParameter("dtpresent");
String eligible= request.getParameter("eligible");
String hra= request.getParameter("hra");
String servicest= request.getParameter("servicest");
String pays= request.getParameter("pays");
String bpay= request.getParameter("bpay");
String entitlement= request.getParameter("entitlement");
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","hr","hr");
try {
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
String strDate = dateFormat.format(date);
String date1 = strDate.substring(0,4);
String date2= dtret.substring(6,10);
Statement st=con.createStatement();
if(request.getParameter("submit")!=null)
{
if(date1.compareTo(date2)>0)
response.sendRedirect("error.jsp");
else {
st.executeQuery("Insert into OFFICEAAI values('"+name+"','"+empid+"','"+service+"','"+padd+"','"+designation+"','"+dept+"','"+groups+"','"+dtemp+"','"+dtret+"','"+dtpresent+"','"+eligible+"','"+hra+"','"+servicest+"','"+pays+"','"+bpay+"','"+entitlement+"')");
out.println("<h1>Inserted</h1>");
response.sendRedirect("residence.jsp");
}
}
}
catch(Exception E) {
out.println("Exception");
}
out.write("\n");
out.write("</body>\n");
out.write("</html>\n");
out.write("\n");
out.write("\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| UTF-8 | Java | 12,185 | java | office_jsp.java | Java | [] | null | [] | package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.sql.Statement;
import java.sql.DriverManager;
import java.sql.Connection;
public final class office_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List<String> _jspx_dependants;
private org.glassfish.jsp.api.ResourceInjector _jspx_resourceInjector;
public java.util.List<String> getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.glassfish.jsp.api.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE html>\n");
out.write("<html>\n");
out.write("<head>\n");
out.write("<title>AIRPORT AUTHORITY OF INDIA</title>\n");
out.write("</head>\n");
out.write("\n");
out.write("\n");
out.write("\t<center><img align=\"top\" src=\"untitled.jpg\" alt=\"Smiley face\" height=\"250\" width=\"250\">\n");
out.write("\t<h1>AIRPORT AUTHORITY OF INDIA</h1>\n");
out.write("\t<h2>Quarter Allocation System</h2>\n");
out.write("</center>\n");
out.write("\n");
out.write("<body bgcolor=\"#ccffe6\">\n");
out.write("\t<table border=\"5\" cellpadding=\"3\" width=\"100%\" align=\"center\"\n");
out.write("cellspacing=\"3\">\n");
out.write(" <tr>\n");
out.write(" <td bgcolor=\"#33ff33\" ><center><font size=\"4\"><b>REGISTRATION</b></center></font></center></td>\n");
out.write(" <td bgcolor=\"#42b3f4\"><center><font size=\"4\"><b>OFFICIAL DETAILS</b></center></font></center></td>\n");
out.write(" <td bgcolor=\"#ff3333\"><center><font size=\"4\"><b>RESIDENTIAL DETAILS</b></center></font></center></td>\n");
out.write("\n");
out.write(" </tr>\n");
out.write("</table>\n");
out.write("<br>\n");
out.write("<br>\n");
out.write("<br>\n");
out.write("<style type=\"text/css\">\n");
out.write(" #r1{\n");
out.write(" background-color: #ff1a1a; \n");
out.write(" border: none;\n");
out.write(" color: white;\n");
out.write(" padding: 10px 32px;\n");
out.write(" text-align: center;\n");
out.write(" text-decoration: none;\n");
out.write(" display: inline-block;\n");
out.write(" font-size: 16px;\n");
out.write(" }\n");
out.write("\n");
out.write(" #s1{\n");
out.write(" background-color: #009933; \n");
out.write(" border: none;\n");
out.write(" color: white;\n");
out.write(" padding: 10px 32px;\n");
out.write(" text-align: center;\n");
out.write(" text-decoration: none;\n");
out.write(" display: inline-block;\n");
out.write(" font-size: 16px;\n");
out.write(" }\n");
out.write("\n");
out.write("\n");
out.write("</style>\n");
out.write("\n");
out.write("\n");
out.write("<form>\n");
out.write("\n");
out.write("<table style=\"font-weight: bold; font-size: 18\" border=\"1\" cellpadding=\"3\" width=\"80%\" bgcolor=\"#ffcccc\" align=\"center\"\n");
out.write("cellspacing=\"12\">\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td colspan=2>\n");
out.write("<center><font size=4><b>OFFICIAL FORM</b></font></center>\n");
out.write("</td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>1) Service to which Official/Officer belong</td>\n");
out.write("<td><input type=text name=\"service\" id=\"service\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>2) Present Address</td>\n");
out.write("<td><input type=\"text\" name=\"padd\" id=\"padd\"\n");
out.write("size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>3) Designation</td>\n");
out.write("<td><input type=\"text\" name=\"designation\" id=\"designation\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>4) Department</td>\n");
out.write("<td><input type=\"text\" name=\"dept\" id=\"dept\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>5) Groups</td>\n");
out.write("<td><input type=\"text\" name=\"groups\" id=\"groups\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>6) Date from which continuously employed in govt. service</td>\n");
out.write("<td><input type=\"text\" name=\"dtemp\" id=\"dtemp\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>7) Date of Superannuation/Retirement</td>\n");
out.write("<td><input type=\"text\" name=\"dtret\" id=\"dtret\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>8) Date from which continuously posted in the present city</td>\n");
out.write("<td><input type=\"text\" name=\"dtpresent\" id=\"dtpresent\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td>9) Eligible for rent free accomodation</td>\n");
out.write("<td><input type=\"text\" name=\"eligible\" id=\"eligible\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>10) Entitled for HRA</td>\n");
out.write("<td><input type=\"text\" name=\"hra\" id=\"hra\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>11) Service Status</td>\n");
out.write("<td><input type=\"text\" name=\"servicest\" id=\"servicest\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>12) Pay Scale</td>\n");
out.write("<td><input type=\"text\" name=\"pays\" id=\"pays\" size=\"30\" required></td>\n");
out.write("</tr>\n");
out.write("<tr>\n");
out.write("<td>13) Basic Pay</td>\n");
out.write("<td><select name=\"bpay\">\n");
out.write("<option value=\"10200 - 12749\">10200 - 12749</option>\n");
out.write("<option value=\"10200 - 12749\">10200 - 12749</option>\n");
out.write("<option value=\"12750 - 17379\">12750 - 17379</option>\n");
out.write("<option value=\"17380 - 33599\">17380 - 33599</option>\n");
out.write("<option value=\"33600 - 40549\">33600 - 40549</option>\n");
out.write("<option value=\"33600 - 40549\">33600 - 40549</option>\n");
out.write("<option value=\"40550 - 55019\">40550 - 55019</option>\n");
out.write("<option value=\"55020 & above\">55020 & above</option>\n");
out.write("</select></td>\n");
out.write("</tr>\n");
out.write("\n");
out.write("<tr>\n");
out.write("<td><b>14) Entitlement of Accomodation</b></td>\n");
out.write("<td><select name=\"entitlement\">\n");
out.write("<option value=\"A1\">A1 :10200 - 12749</option>\n");
out.write("<option value=\"A2\">A2 :10200 - 12749</option>\n");
out.write("<option value=\"B1\">B1 :12750 - 17379</option>\n");
out.write("<option value=\"B2\">B2 :17380 - 33599</option>\n");
out.write("<option value=\"C1\">C1 :33600 - 40549</option>\n");
out.write("<option value=\"C2\">C2 :33600 - 40549</option>\n");
out.write("<option value=\"D\">D :40550 - 55019</option>\n");
out.write("<option value=\"E\">E :55020 & above</option>\n");
out.write("</select></td>\n");
out.write("</tr> \n");
out.write("</table>\n");
out.write("\n");
out.write("<br>\n");
out.write("<br>\n");
out.write("<center><input type=\"reset\" id=\"r1\"/>\n");
out.write("\n");
out.write(" <span style=\"display:inline-block; width: 50px;\"></span>\n");
out.write("<input id=\"s1\" type=\"submit\" value=\"submit\" name=\"submit\"/>\n");
out.write("</center>\n");
out.write("<br>\n");
out.write("<br>\n");
out.write("\n");
out.write("\n");
out.write("</form> \n");
out.write("<br>\n");
out.write("<br>\n");
String name=(String)session.getAttribute("name");
String empid=(String)session.getAttribute("empid");
String service= request.getParameter("service");
String padd= request.getParameter("padd");
String designation= request.getParameter("designation");
String dept= request.getParameter("dept");
String groups= request.getParameter("groups");
String dtemp= request.getParameter("dtemp");
String dtret= request.getParameter("dtret");
String dtpresent= request.getParameter("dtpresent");
String eligible= request.getParameter("eligible");
String hra= request.getParameter("hra");
String servicest= request.getParameter("servicest");
String pays= request.getParameter("pays");
String bpay= request.getParameter("bpay");
String entitlement= request.getParameter("entitlement");
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","hr","hr");
try {
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
String strDate = dateFormat.format(date);
String date1 = strDate.substring(0,4);
String date2= dtret.substring(6,10);
Statement st=con.createStatement();
if(request.getParameter("submit")!=null)
{
if(date1.compareTo(date2)>0)
response.sendRedirect("error.jsp");
else {
st.executeQuery("Insert into OFFICEAAI values('"+name+"','"+empid+"','"+service+"','"+padd+"','"+designation+"','"+dept+"','"+groups+"','"+dtemp+"','"+dtret+"','"+dtpresent+"','"+eligible+"','"+hra+"','"+servicest+"','"+pays+"','"+bpay+"','"+entitlement+"')");
out.println("<h1>Inserted</h1>");
response.sendRedirect("residence.jsp");
}
}
}
catch(Exception E) {
out.println("Exception");
}
out.write("\n");
out.write("</body>\n");
out.write("</html>\n");
out.write("\n");
out.write("\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| 12,185 | 0.568404 | 0.538039 | 282 | 42.209221 | 30.884058 | 274 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.035461 | false | false | 2 |
3f9f81c331b42c2cec32eca1dd845d656e029eff | 5,720,896,449,870 | 304e89f8518037ca1e9fb5edc48ac5e76f148ad6 | /Studium/src/com/studium/madang/controller/StudyMadangLikeUpServlet.java | 1a97ff4f27134c28e6885a7beda14703194b726f | [] | no_license | Reviday/studium | https://github.com/Reviday/studium | 3877a384385fd43747491a8c7e85ae26ba1b8ebd | 08261a5b7629ec5fb82e21227a8f52085e38cf7b | refs/heads/master | 2022-05-13T20:12:10.147000 | 2019-10-04T12:52:35 | 2019-10-04T12:52:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.studium.madang.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
import com.google.gson.Gson;
import com.studium.madang.model.service.StudyMadangService;
import com.studium.madang.model.vo.StudyMadang;
/**
* Servlet implementation class StudyMadangLikeUpServlet
*/
@WebServlet("/madang/studyMadangLikeUp")
public class StudyMadangLikeUpServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public StudyMadangLikeUpServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
int madangNo = Integer.parseInt(request.getParameter("madangNo"));
int memNo = Integer.parseInt(request.getParameter("memNo"));
String REMOTE_ADDR=request.getParameter("REMOTE_ADDR");
int result=new StudyMadangService().insertLike(madangNo, memNo, REMOTE_ADDR);
String msg="";
StudyMadang sm= new StudyMadang();
JSONObject obj = new JSONObject();
if(result<0) { // 이미 추천 하였음.
msg="이미 추천하였습니다.";
obj.put("msg",msg);
obj.put("result", "fail");
} else if(result>0) { // 추천 성공
msg="추천하였습니다!";
// 추천에 성공하였으니, 해당하는 값을 불러와서 페이지에 띄워주어야한다.
sm=new StudyMadangService().selectMadang(madangNo, true);
obj.put("msg",msg);
obj.put("result", "success");
obj.put("madang", sm);
} else {
msg="추천에 실패하였습니다. 다시 시도해주시기 바랍니다.";
obj.put("msg",msg);
obj.put("result", "error");
}
response.setContentType("application/x-json; charset=UTF-8");
new Gson().toJson(obj,response.getWriter());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| UTF-8 | Java | 2,559 | java | StudyMadangLikeUpServlet.java | Java | [] | null | [] | package com.studium.madang.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
import com.google.gson.Gson;
import com.studium.madang.model.service.StudyMadangService;
import com.studium.madang.model.vo.StudyMadang;
/**
* Servlet implementation class StudyMadangLikeUpServlet
*/
@WebServlet("/madang/studyMadangLikeUp")
public class StudyMadangLikeUpServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public StudyMadangLikeUpServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
int madangNo = Integer.parseInt(request.getParameter("madangNo"));
int memNo = Integer.parseInt(request.getParameter("memNo"));
String REMOTE_ADDR=request.getParameter("REMOTE_ADDR");
int result=new StudyMadangService().insertLike(madangNo, memNo, REMOTE_ADDR);
String msg="";
StudyMadang sm= new StudyMadang();
JSONObject obj = new JSONObject();
if(result<0) { // 이미 추천 하였음.
msg="이미 추천하였습니다.";
obj.put("msg",msg);
obj.put("result", "fail");
} else if(result>0) { // 추천 성공
msg="추천하였습니다!";
// 추천에 성공하였으니, 해당하는 값을 불러와서 페이지에 띄워주어야한다.
sm=new StudyMadangService().selectMadang(madangNo, true);
obj.put("msg",msg);
obj.put("result", "success");
obj.put("madang", sm);
} else {
msg="추천에 실패하였습니다. 다시 시도해주시기 바랍니다.";
obj.put("msg",msg);
obj.put("result", "error");
}
response.setContentType("application/x-json; charset=UTF-8");
new Gson().toJson(obj,response.getWriter());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| 2,559 | 0.705123 | 0.703457 | 75 | 30.013334 | 26.973316 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.853333 | false | false | 2 |
892c30041925847d6fdd696223ee37fe5d052d8a | 18,193,481,503,310 | d514bb8848fb61e9976e9e111c8776605adf5445 | /project_cloud/src/test/java/org/whehtk22/mapper/Enq_BoardMapperTests.java | df661c35236d184407bac582729b2017aff67741 | [] | no_license | whehtk22/cloud | https://github.com/whehtk22/cloud | 8c433588303d86235824092f77d23be303932a1e | a9d5620810235986e1ffec43cf27d7eb42b03e65 | refs/heads/master | 2020-04-03T02:15:07.893000 | 2018-12-29T15:41:25 | 2018-12-29T15:41:25 | 154,951,039 | 0 | 0 | null | false | 2018-12-29T15:41:26 | 2018-10-27T10:17:29 | 2018-12-25T14:24:33 | 2018-12-29T15:41:25 | 5,322 | 0 | 1 | 0 | HTML | false | null | /*package org.whehtk22.mapper;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.whehtk22.domain.Enq_BoardVO;
import org.whehtk22.domain.PageSetting;
import lombok.Setter;
import lombok.extern.log4j.Log4j;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml")
@Log4j
public class Enq_BoardMapperTests {
@Setter(onMethod_ = @Autowired)
private Enq_BoardMapper mapper;
//@Test
public void testGetList() {
mapper.getList().forEach(board->log.info(board));
}
// @Test
public void testInsert() {
Enq_BoardVO board = new Enq_BoardVO();
board.setTitle("새로 작성글");
board.setContent("새로 작성하는 내용");
board.setWriter("newbie");
mapper.insert(board);
log.info(board);
}
// @Test
public void testInsertSelectKey() {
Enq_BoardVO board = new Enq_BoardVO();
board.setTitle("새로 작성하는 글 select key");
board.setContent("새로 작성하는 내용 select Key");
board.setWriter("newbie");
mapper.insertSelectKey(board);
}
@Test
public void testRead() {
//존재하는 게시물 번호로 테스트
Enq_BoardVO board = mapper.read(9L);
log.info(board);
}
// @Test
public void testDelete() {
log.info("DELETE COUNT: "+mapper.delete(3L));
}
//@Test
public void testUpdate() {
Enq_BoardVO board = new Enq_BoardVO();
//실행전 존재하는 번호인지 확인할 것
board.setBno(20L);
board.setTitle("수정된 제목~");
board.setContent("수정된 내용~~");
board.setWriter("user~~~");
int count = mapper.update(board);
log.info("UPDATE COUNT: "+count);
}
//@Test
public void testPaging() {
PageSetting page = new PageSetting();
page.setAmount(10);
page.setPageNum(1);
List<Enq_BoardVO> list = mapper.getListWithPaging(page);
list.forEach(board->log.info(board));
}
@Test
public void testSearch() {
PageSetting page = new PageSetting();
page.setKeyword("새로");
page.setType("TC");
List<Enq_BoardVO>list = mapper.getListWithPaging(page);
list.forEach(board->log.info(board));
}
}
*/ | UTF-8 | Java | 2,403 | java | Enq_BoardMapperTests.java | Java | [] | null | [] | /*package org.whehtk22.mapper;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.whehtk22.domain.Enq_BoardVO;
import org.whehtk22.domain.PageSetting;
import lombok.Setter;
import lombok.extern.log4j.Log4j;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml")
@Log4j
public class Enq_BoardMapperTests {
@Setter(onMethod_ = @Autowired)
private Enq_BoardMapper mapper;
//@Test
public void testGetList() {
mapper.getList().forEach(board->log.info(board));
}
// @Test
public void testInsert() {
Enq_BoardVO board = new Enq_BoardVO();
board.setTitle("새로 작성글");
board.setContent("새로 작성하는 내용");
board.setWriter("newbie");
mapper.insert(board);
log.info(board);
}
// @Test
public void testInsertSelectKey() {
Enq_BoardVO board = new Enq_BoardVO();
board.setTitle("새로 작성하는 글 select key");
board.setContent("새로 작성하는 내용 select Key");
board.setWriter("newbie");
mapper.insertSelectKey(board);
}
@Test
public void testRead() {
//존재하는 게시물 번호로 테스트
Enq_BoardVO board = mapper.read(9L);
log.info(board);
}
// @Test
public void testDelete() {
log.info("DELETE COUNT: "+mapper.delete(3L));
}
//@Test
public void testUpdate() {
Enq_BoardVO board = new Enq_BoardVO();
//실행전 존재하는 번호인지 확인할 것
board.setBno(20L);
board.setTitle("수정된 제목~");
board.setContent("수정된 내용~~");
board.setWriter("user~~~");
int count = mapper.update(board);
log.info("UPDATE COUNT: "+count);
}
//@Test
public void testPaging() {
PageSetting page = new PageSetting();
page.setAmount(10);
page.setPageNum(1);
List<Enq_BoardVO> list = mapper.getListWithPaging(page);
list.forEach(board->log.info(board));
}
@Test
public void testSearch() {
PageSetting page = new PageSetting();
page.setKeyword("새로");
page.setType("TC");
List<Enq_BoardVO>list = mapper.getListWithPaging(page);
list.forEach(board->log.info(board));
}
}
*/ | 2,403 | 0.685929 | 0.677547 | 88 | 23.78409 | 18.189938 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.681818 | false | false | 2 |
dbb1dc026b62e62fef059fbce5ab6e065906d44a | 15,040,975,527,464 | 624a39af72c233fb24a041b43c903cafa8810c4b | /app/src/main/java/geekygirl/prog/dev/gouvernorate/ui/login/LoginView.java | b6739a9040ef0a54464fb4b4949b0b9d1fadc90f | [
"Apache-2.0"
] | permissive | Safa-NAOUI/Gouvernorate-Dagger2-ButterKnife | https://github.com/Safa-NAOUI/Gouvernorate-Dagger2-ButterKnife | a7feea9eae94a6465476db5e7e761dc7d2c5eb63 | 95d81277d2d2090a0f44bcb5347506769e54306d | refs/heads/master | 2021-01-09T06:36:05.765000 | 2017-02-05T21:14:34 | 2017-02-05T21:14:34 | 81,020,982 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package geekygirl.prog.dev.gouvernorate.ui.login;
public interface LoginView {
public void showProgress();
public void hideProgress();
public void setUsernameError();
public void setPasswordError();
public void setUserPasswordError();
public void navigateToHome();
}
| UTF-8 | Java | 298 | java | LoginView.java | Java | [] | null | [] | package geekygirl.prog.dev.gouvernorate.ui.login;
public interface LoginView {
public void showProgress();
public void hideProgress();
public void setUsernameError();
public void setPasswordError();
public void setUserPasswordError();
public void navigateToHome();
}
| 298 | 0.724832 | 0.724832 | 16 | 17.625 | 18.023855 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | false | false | 2 |
841d01e6c5677b9dd5e3be7e892bf3b11334a020 | 11,209,864,704,709 | f502d25a7d8887709944e81f0691b3d4cc77b544 | /src/main/java/me/coley/recaf/util/ThreadUtil.java | c964be5659a7a0b247bb79c360e6d9e9aad19c74 | [
"MIT"
] | permissive | sthagen/Recaf | https://github.com/sthagen/Recaf | a17959402f8787667556ccd91dd1fb8f9561452e | 17a433b8cb26868c8c2ee5c6b674b6ee08f4433a | refs/heads/master | 2023-07-16T03:20:02.758000 | 2023-03-25T16:27:17 | 2023-03-25T16:27:17 | 341,444,534 | 1 | 0 | MIT | true | 2021-07-16T09:27:52 | 2021-02-23T05:53:09 | 2021-04-26T19:30:07 | 2021-07-16T09:27:52 | 45,696 | 1 | 0 | 0 | Java | false | false | package me.coley.recaf.util;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import javafx.application.Platform;
import javafx.concurrent.Task;
import java.util.concurrent.*;
import java.util.function.Consumer;
import java.util.function.Supplier;
import static me.coley.recaf.util.Log.*;
/**
* Threading utils.
*
* @author Matt
*/
public class ThreadUtil {
private static final ScheduledExecutorService scheduledService =
Executors.newScheduledThreadPool(threadCount(),
new ThreadFactoryBuilder()
.setNameFormat("Recaf Scheduler Thread #%d")
.setDaemon(true).build());
private static final ExecutorService service = Executors.newWorkStealingPool(threadCount());
/**
* @param action
* Runnable to start in new thread.
*
* @return Thread future.
*/
public static Future<?> run(Runnable action) {
return service.submit(action);
}
/**
* @param action
* Task to start in new thread.
* @param <T>
* Type of task return value.
*
* @return Thread future.
*/
@SuppressWarnings("unchecked")
public static <T> Future<T> run(Task<T> action) {
return (Future<T>) service.submit(action);
}
/**
* @param updateInterval
* Time in milliseconds between each execution.
* @param action
* Runnable to start in new thread.
*
* @return Scheduled future.
*/
public static ScheduledFuture<?> runRepeated(long updateInterval, Runnable action) {
return scheduledService.scheduleAtFixedRate(action, 0, updateInterval,
TimeUnit.MILLISECONDS);
}
/**
* @param time
* Delay to wait in milliseconds.
* @param action
* Runnable to start in new thread.
*
* @return Scheduled future.
*/
public static Future<?> runDelayed(long time, Runnable action) {
return scheduledService.schedule(action, time, TimeUnit.MILLISECONDS);
}
/**
* Run a given action with a timeout.
*
* @param time
* Timeout in milliseconds.
* @param action
* Runnable to execute.
*
* @return {@code true}
*/
public static boolean timeout(int time, Runnable action) {
try {
Future<?> future = run(action);
future.get(time, TimeUnit.MILLISECONDS);
return true;
} catch(TimeoutException e) {
// Expected: Timeout
return false;
} catch(Throwable t) {
// Other error
return true;
}
}
/**
* @param supplier
* Value generator, run on a non-jfx thread.
* @param consumer
* JavaFx consumer thread, takes the supplied value.
* @param <T>
* Type of value.
*/
public static <T> void runSupplyConsumer(Supplier<T> supplier, Consumer<T> consumer) {
runSupplyConsumer(supplier, Long.MAX_VALUE, null, consumer, null);
}
/**
* @param supplier
* Value generator, run on a non-jfx thread.
* @param supplierTimeout
* Time to wait on the supplier generating a value before aborting the task.
* @param timeoutAction
* Action to run when timeout is reached.
* @param consumer
* JavaFx consumer thread, takes the supplied value.
* @param handler
* Error handling.
* @param <T>
* Type of value.
*/
public static <T> void runSupplyConsumer(Supplier<T> supplier, long supplierTimeout, Runnable timeoutAction,
Consumer<T> consumer, Consumer<Throwable> handler) {
new Thread(() -> {
try {
// Attempt to compute value within given time
Future<T> future = service.submit(supplier::get);
T value = future.get(supplierTimeout, TimeUnit.MILLISECONDS);
// Execute action with value
Platform.runLater(() -> consumer.accept(value));
} catch(CancellationException | InterruptedException | TimeoutException r) {
// Timed out
if (timeoutAction != null)
timeoutAction.run();
} catch(ExecutionException e) {
// Supplier encountered an error
// - Actual cause is wrapped twice
Throwable cause = e.getCause().getCause();
if(handler != null)
handler.accept(cause);
}
catch(Throwable t) {
// Unknown error
if(handler != null)
handler.accept(t);
}
}).start();
}
/**
* @param time
* Delay to wait in milliseconds.
* @param consumer
* JavaFx runnable action.
*
* @return Scheduled future.
*/
public static Future<?> runJfxDelayed(long time, Runnable consumer) {
return scheduledService.schedule(() -> Platform.runLater(consumer), time, TimeUnit.MILLISECONDS);
}
/**
* @param consumer
* JavaFx runnable action.
*/
public static void checkJfxAndEnqueue(Runnable consumer) {
if (!Platform.isFxApplicationThread()) {
Platform.runLater(consumer);
} else {
consumer.run();
}
}
/**
* Shutdowns executors.
*/
public static void shutdown() {
trace("Shutting down thread executors");
service.shutdownNow();
scheduledService.shutdownNow();
}
private static int threadCount() {
return Runtime.getRuntime().availableProcessors();
}
}
| UTF-8 | Java | 4,838 | java | ThreadUtil.java | Java | [
{
"context": "util.Log.*;\n\n/**\n * Threading utils.\n *\n * @author Matt\n */\npublic class ThreadUtil {\n\tprivate static fin",
"end": 349,
"score": 0.9987192153930664,
"start": 345,
"tag": "NAME",
"value": "Matt"
}
] | null | [] | package me.coley.recaf.util;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import javafx.application.Platform;
import javafx.concurrent.Task;
import java.util.concurrent.*;
import java.util.function.Consumer;
import java.util.function.Supplier;
import static me.coley.recaf.util.Log.*;
/**
* Threading utils.
*
* @author Matt
*/
public class ThreadUtil {
private static final ScheduledExecutorService scheduledService =
Executors.newScheduledThreadPool(threadCount(),
new ThreadFactoryBuilder()
.setNameFormat("Recaf Scheduler Thread #%d")
.setDaemon(true).build());
private static final ExecutorService service = Executors.newWorkStealingPool(threadCount());
/**
* @param action
* Runnable to start in new thread.
*
* @return Thread future.
*/
public static Future<?> run(Runnable action) {
return service.submit(action);
}
/**
* @param action
* Task to start in new thread.
* @param <T>
* Type of task return value.
*
* @return Thread future.
*/
@SuppressWarnings("unchecked")
public static <T> Future<T> run(Task<T> action) {
return (Future<T>) service.submit(action);
}
/**
* @param updateInterval
* Time in milliseconds between each execution.
* @param action
* Runnable to start in new thread.
*
* @return Scheduled future.
*/
public static ScheduledFuture<?> runRepeated(long updateInterval, Runnable action) {
return scheduledService.scheduleAtFixedRate(action, 0, updateInterval,
TimeUnit.MILLISECONDS);
}
/**
* @param time
* Delay to wait in milliseconds.
* @param action
* Runnable to start in new thread.
*
* @return Scheduled future.
*/
public static Future<?> runDelayed(long time, Runnable action) {
return scheduledService.schedule(action, time, TimeUnit.MILLISECONDS);
}
/**
* Run a given action with a timeout.
*
* @param time
* Timeout in milliseconds.
* @param action
* Runnable to execute.
*
* @return {@code true}
*/
public static boolean timeout(int time, Runnable action) {
try {
Future<?> future = run(action);
future.get(time, TimeUnit.MILLISECONDS);
return true;
} catch(TimeoutException e) {
// Expected: Timeout
return false;
} catch(Throwable t) {
// Other error
return true;
}
}
/**
* @param supplier
* Value generator, run on a non-jfx thread.
* @param consumer
* JavaFx consumer thread, takes the supplied value.
* @param <T>
* Type of value.
*/
public static <T> void runSupplyConsumer(Supplier<T> supplier, Consumer<T> consumer) {
runSupplyConsumer(supplier, Long.MAX_VALUE, null, consumer, null);
}
/**
* @param supplier
* Value generator, run on a non-jfx thread.
* @param supplierTimeout
* Time to wait on the supplier generating a value before aborting the task.
* @param timeoutAction
* Action to run when timeout is reached.
* @param consumer
* JavaFx consumer thread, takes the supplied value.
* @param handler
* Error handling.
* @param <T>
* Type of value.
*/
public static <T> void runSupplyConsumer(Supplier<T> supplier, long supplierTimeout, Runnable timeoutAction,
Consumer<T> consumer, Consumer<Throwable> handler) {
new Thread(() -> {
try {
// Attempt to compute value within given time
Future<T> future = service.submit(supplier::get);
T value = future.get(supplierTimeout, TimeUnit.MILLISECONDS);
// Execute action with value
Platform.runLater(() -> consumer.accept(value));
} catch(CancellationException | InterruptedException | TimeoutException r) {
// Timed out
if (timeoutAction != null)
timeoutAction.run();
} catch(ExecutionException e) {
// Supplier encountered an error
// - Actual cause is wrapped twice
Throwable cause = e.getCause().getCause();
if(handler != null)
handler.accept(cause);
}
catch(Throwable t) {
// Unknown error
if(handler != null)
handler.accept(t);
}
}).start();
}
/**
* @param time
* Delay to wait in milliseconds.
* @param consumer
* JavaFx runnable action.
*
* @return Scheduled future.
*/
public static Future<?> runJfxDelayed(long time, Runnable consumer) {
return scheduledService.schedule(() -> Platform.runLater(consumer), time, TimeUnit.MILLISECONDS);
}
/**
* @param consumer
* JavaFx runnable action.
*/
public static void checkJfxAndEnqueue(Runnable consumer) {
if (!Platform.isFxApplicationThread()) {
Platform.runLater(consumer);
} else {
consumer.run();
}
}
/**
* Shutdowns executors.
*/
public static void shutdown() {
trace("Shutting down thread executors");
service.shutdownNow();
scheduledService.shutdownNow();
}
private static int threadCount() {
return Runtime.getRuntime().availableProcessors();
}
}
| 4,838 | 0.680653 | 0.680446 | 188 | 24.734043 | 22.65029 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.101064 | false | false | 2 |
12ffea223edac7ff8853ba560c9e37713c3d04cb | 19,121,194,457,642 | bcfeda648e0999c37e80694e8f98089fcd3dd11b | /xoa-phan-tu/src/test.java | fcf14af1864bb85fea924a828e74ea5d549e48b4 | [] | no_license | tranminhthong/Module_2 | https://github.com/tranminhthong/Module_2 | 84fc36adaa9452b2962eaa2313480dd4bbde44cd | c86741aa5f2e5bebd771662ec4477a25f2cf6f8a | refs/heads/master | 2023-03-09T12:50:55.463000 | 2021-02-26T16:34:40 | 2021-02-26T16:34:40 | 327,825,238 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Arrays;
public class test {
public static void main(String[] args) {
int [] a = {1,2,3,4,5,5,6,7,8,9,3,2,5,6};
int x = 5;
int count = 0;
for (int i = 0; i < a.length; i++) {
if (a[i]==x){
count++;
}
}
int [] c = new int[a.length-count];
for (int i = 0; i < c.length; i++) {
}
System.out.println(Arrays.toString(c));
}
}
| UTF-8 | Java | 459 | java | test.java | Java | [] | null | [] | import java.util.Arrays;
public class test {
public static void main(String[] args) {
int [] a = {1,2,3,4,5,5,6,7,8,9,3,2,5,6};
int x = 5;
int count = 0;
for (int i = 0; i < a.length; i++) {
if (a[i]==x){
count++;
}
}
int [] c = new int[a.length-count];
for (int i = 0; i < c.length; i++) {
}
System.out.println(Arrays.toString(c));
}
}
| 459 | 0.422658 | 0.383442 | 19 | 23.157894 | 16.828119 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.263158 | false | false | 2 |
25ff56f37655239b52be838c3c2de4d794006bf6 | 28,269,474,761,008 | bf0e7f8385295366be8377b410da3c4e7cd06396 | /src/servlet/getHomeworkMax.java | 5869e37f7faf658fcedd1a34701915edc44ae309 | [] | no_license | Thesonggodoftoliet/efun_origin | https://github.com/Thesonggodoftoliet/efun_origin | 75413f84a3b848bd32efbc0723030444dfd7a747 | 6e1ed9a2e308f009ae16db79876b028de2000c64 | refs/heads/master | 2020-04-26T02:07:43.474000 | 2019-03-01T03:09:14 | 2019-03-01T03:09:14 | 173,225,012 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package servlet;
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 instance.Course;
import service.Service;
import net.sf.json.JSONArray;
/**
* Servlet implementation class getHomeworkMax
*/
@WebServlet("/getHomeworkMax")
public class getHomeworkMax extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public getHomeworkMax() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
String courseid=request.getParameter("coursename");
Service service = new Service();
Course course = new Course();
course.setCourseid(courseid);
int nummax=service.getHomeworkMax(course);
JSONArray jsonArray2 = JSONArray.fromObject(nummax);
System.out.println(jsonArray2);
PrintWriter out = response.getWriter();
out.print(jsonArray2);
request.setAttribute("jsonArray2", jsonArray2);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| UTF-8 | Java | 1,846 | java | getHomeworkMax.java | Java | [] | null | [] | package servlet;
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 instance.Course;
import service.Service;
import net.sf.json.JSONArray;
/**
* Servlet implementation class getHomeworkMax
*/
@WebServlet("/getHomeworkMax")
public class getHomeworkMax extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public getHomeworkMax() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
String courseid=request.getParameter("coursename");
Service service = new Service();
Course course = new Course();
course.setCourseid(courseid);
int nummax=service.getHomeworkMax(course);
JSONArray jsonArray2 = JSONArray.fromObject(nummax);
System.out.println(jsonArray2);
PrintWriter out = response.getWriter();
out.print(jsonArray2);
request.setAttribute("jsonArray2", jsonArray2);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| 1,846 | 0.738353 | 0.73402 | 63 | 28.301588 | 26.793528 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 2 |
06878d5f0273bace128c69a1d44e3f0cf045c0c8 | 20,744,692,091,311 | 30c558b2bc879c11f2d983e4c957487a61445b00 | /OnYard/onYard/src/main/java/com/iaai/onyard/activity/fragment/ReshootListFragment.java | aed2e8588cc81652e28b41519910cb98f0812f10 | [] | no_license | rbgautam/AndroidProgramming | https://github.com/rbgautam/AndroidProgramming | 4624db5e51d9f5386a62ff9c47bd9edee829b7d2 | 1c53e24a5f20c153e44a4fc50db6ef63526712ed | refs/heads/master | 2021-05-15T07:16:24.883000 | 2017-12-23T21:09:18 | 2017-12-23T21:09:18 | 111,718,487 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.iaai.onyard.activity.fragment;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.iaai.onyard.R;
import com.iaai.onyard.adapter.ReshootArrayAdapter;
import com.iaai.onyard.application.OnYard.ErrorMessage;
import com.iaai.onyard.event.ReshootVehiclesRetrievedEvent;
import com.iaai.onyard.task.GetReshootVehiclesTask;
import com.iaai.onyardproviderapi.classes.VehicleInfo;
import com.squareup.otto.Subscribe;
public class ReshootListFragment extends SearchListFragment {
@InjectView(R.id.reshoot_list)
ListView mReshootListView;
@InjectView(R.id.reshoot_list_title)
TextView mTxtTitle;
@InjectView(R.id.reshoot_list_title_line)
View mTitleLine;
private GetReshootVehiclesTask mGetReshootsTask;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
try {
final View view = inflater.inflate(R.layout.fragment_reshoot_list, container, false);
ButterKnife.inject(this, view);
return view;
}
catch (final Exception e) {
showFatalErrorDialog(ErrorMessage.PAGE_LOAD);
logError(e);
return null;
}
}
@Subscribe
public void onReshootVehiclesRetrieved(ReshootVehiclesRetrievedEvent event) {
try {
final Activity activity = getActivity();
if (activity != null) {
final ReshootArrayAdapter adapter = new ReshootArrayAdapter(activity,
event.getReshootList());
mReshootListView.setAdapter(adapter);
mReshootListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
try {
if (getActivity() != null && !mIsItemLoading) {
mIsItemLoading = true;
showProgressDialog();
final VehicleInfo vehicle = (VehicleInfo) parent.getAdapter().getItem(position);
createSessionData(vehicle.getStockNumber());
}
}
catch (final Exception e) {
showFatalErrorDialog(ErrorMessage.VEHICLE_DATA_LOAD);
logWarning(e);
}
}
});
setListVisibility();
}
}
catch (final Exception e) {
logWarning(e);
}
}
@Override
protected void repopulateList() {
super.repopulateList();
final Activity activity = getActivity();
if (activity != null) {
mGetReshootsTask = new GetReshootVehiclesTask();
mGetReshootsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
activity.getApplicationContext(), getEventBus());
}
}
@Override
protected void setListVisibility() {
try {
if (mReshootListView.getCount() > 0) {
mReshootListView.setVisibility(View.VISIBLE);
mTxtTitle.setVisibility(View.VISIBLE);
mTitleLine.setVisibility(View.VISIBLE);
}
else {
mReshootListView.setVisibility(View.GONE);
mTxtTitle.setVisibility(View.GONE);
mTitleLine.setVisibility(View.GONE);
}
}
catch (final Exception e) {
logWarning(e);
}
}
@Override
protected void cancelAsyncTask() {
if (mGetReshootsTask != null) {
mGetReshootsTask.cancel(true);
}
}
}
| UTF-8 | Java | 4,119 | java | ReshootListFragment.java | Java | [] | null | [] | package com.iaai.onyard.activity.fragment;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.iaai.onyard.R;
import com.iaai.onyard.adapter.ReshootArrayAdapter;
import com.iaai.onyard.application.OnYard.ErrorMessage;
import com.iaai.onyard.event.ReshootVehiclesRetrievedEvent;
import com.iaai.onyard.task.GetReshootVehiclesTask;
import com.iaai.onyardproviderapi.classes.VehicleInfo;
import com.squareup.otto.Subscribe;
public class ReshootListFragment extends SearchListFragment {
@InjectView(R.id.reshoot_list)
ListView mReshootListView;
@InjectView(R.id.reshoot_list_title)
TextView mTxtTitle;
@InjectView(R.id.reshoot_list_title_line)
View mTitleLine;
private GetReshootVehiclesTask mGetReshootsTask;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
try {
final View view = inflater.inflate(R.layout.fragment_reshoot_list, container, false);
ButterKnife.inject(this, view);
return view;
}
catch (final Exception e) {
showFatalErrorDialog(ErrorMessage.PAGE_LOAD);
logError(e);
return null;
}
}
@Subscribe
public void onReshootVehiclesRetrieved(ReshootVehiclesRetrievedEvent event) {
try {
final Activity activity = getActivity();
if (activity != null) {
final ReshootArrayAdapter adapter = new ReshootArrayAdapter(activity,
event.getReshootList());
mReshootListView.setAdapter(adapter);
mReshootListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
try {
if (getActivity() != null && !mIsItemLoading) {
mIsItemLoading = true;
showProgressDialog();
final VehicleInfo vehicle = (VehicleInfo) parent.getAdapter().getItem(position);
createSessionData(vehicle.getStockNumber());
}
}
catch (final Exception e) {
showFatalErrorDialog(ErrorMessage.VEHICLE_DATA_LOAD);
logWarning(e);
}
}
});
setListVisibility();
}
}
catch (final Exception e) {
logWarning(e);
}
}
@Override
protected void repopulateList() {
super.repopulateList();
final Activity activity = getActivity();
if (activity != null) {
mGetReshootsTask = new GetReshootVehiclesTask();
mGetReshootsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
activity.getApplicationContext(), getEventBus());
}
}
@Override
protected void setListVisibility() {
try {
if (mReshootListView.getCount() > 0) {
mReshootListView.setVisibility(View.VISIBLE);
mTxtTitle.setVisibility(View.VISIBLE);
mTitleLine.setVisibility(View.VISIBLE);
}
else {
mReshootListView.setVisibility(View.GONE);
mTxtTitle.setVisibility(View.GONE);
mTitleLine.setVisibility(View.GONE);
}
}
catch (final Exception e) {
logWarning(e);
}
}
@Override
protected void cancelAsyncTask() {
if (mGetReshootsTask != null) {
mGetReshootsTask.cancel(true);
}
}
}
| 4,119 | 0.593833 | 0.593591 | 123 | 32.487804 | 25.837631 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.520325 | false | false | 2 |
9786188fdca02440f30ec155deafdb84e24bdfa2 | 29,051,158,854,362 | 81a6a76338a61e971217b976cf7c8d30524a4da8 | /javabase0/src/com/base/test/RunTest.java | c4a35b8394c9adb68f676fce3dc846f6fef30a2b | [] | no_license | geeksun/javabase0 | https://github.com/geeksun/javabase0 | 5ecf35674423a4a65625bd7706ec23672fdf13cb | cfbe3956c811b5bd56ba030c154844112d7bef03 | refs/heads/master | 2020-06-02T09:27:26.814000 | 2015-07-02T12:30:43 | 2015-07-02T12:30:43 | 38,095,926 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.base.test;
public class RunTest implements Run {
int i = 2;
public void run() {
// TODO Auto-generated method stub
++i;
System.out.println("-------"+i);
}
public static void main(String[] args){
boolean a = true;
boolean b = true;
boolean c = false;
System.out.println(a==c);
}
}
| UTF-8 | Java | 328 | java | RunTest.java | Java | [] | null | [] | package com.base.test;
public class RunTest implements Run {
int i = 2;
public void run() {
// TODO Auto-generated method stub
++i;
System.out.println("-------"+i);
}
public static void main(String[] args){
boolean a = true;
boolean b = true;
boolean c = false;
System.out.println(a==c);
}
}
| 328 | 0.60061 | 0.597561 | 16 | 18.5 | 13.336979 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.6875 | false | false | 2 |
15e09970081f92437b9b53a7d90f920f58c08d20 | 29,257,317,244,560 | 8743fbcf00cef86673104a77a3088b198122af7a | /src/main/java/com/CoinBeast/MyMinecraftMod/entities/ShadowCloneEntity.java | 7ef0898f994e2b6c3b97fc6254dba00ad7ec79d5 | [] | no_license | justwzhang/Minecraft-1.16.4-Mod | https://github.com/justwzhang/Minecraft-1.16.4-Mod | e493a8ce03d70e212052adfb6b070d818f8cb1a3 | 8e76cd78ed696c4a3661432eee06646bc9db3f4b | refs/heads/main | 2023-04-01T19:25:44.772000 | 2021-04-17T19:04:23 | 2021-04-17T19:04:23 | 343,223,613 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.CoinBeast.MyMinecraftMod.entities;
import com.CoinBeast.MyMinecraftMod.util.RegistryHandler;
import net.minecraft.entity.AgeableEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.monster.AbstractSkeletonEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Hand;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ShadowCloneEntity extends TameableEntity {
private PlayerEntity player;
public ShadowCloneEntity(World worldIn, @Nonnull PlayerEntity playerIn){
this(RegistryHandler.SHADOW_CLONE.get(), worldIn);
this.player = playerIn;
}
public ShadowCloneEntity(EntityType<? extends TameableEntity> type, World worldIn) {
super(type, worldIn);
this.setTamed(true);
this.setOwnerId(player.getUniqueID());
}
@Override
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0, new SwimGoal(this));
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, true));
this.goalSelector.addGoal(2, new WaterAvoidingRandomWalkingGoal(this, 1.0D));
this.goalSelector.addGoal(3, new FollowOwnerGoal(this, 1.0D, 10.0F, 2.0F, false));
this.goalSelector.addGoal(4, new LookRandomlyGoal(this));
this.targetSelector.addGoal(1, new OwnerHurtByTargetGoal(this));
this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, MonsterEntity.class, false));
}
public static AttributeModifierMap.MutableAttribute func_234233_eS_() {
return MobEntity.func_233666_p_().createMutableAttribute(Attributes.MOVEMENT_SPEED, (double)1.0F).createMutableAttribute(Attributes.MAX_HEALTH, 2.0D).createMutableAttribute(Attributes.ATTACK_DAMAGE, 6.0D);
}
@Override
public void setTamed(boolean tamed){
super.setTamed(true);
func_234233_eS_();
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(2.0D);
this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(6.0D);
}
@Nullable
@Override
public AgeableEntity func_241840_a(ServerWorld p_241840_1_, AgeableEntity p_241840_2_) {
return null;
}
}
| UTF-8 | Java | 2,740 | java | ShadowCloneEntity.java | Java | [] | null | [] | package com.CoinBeast.MyMinecraftMod.entities;
import com.CoinBeast.MyMinecraftMod.util.RegistryHandler;
import net.minecraft.entity.AgeableEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ai.attributes.AttributeModifierMap;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.monster.AbstractSkeletonEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Hand;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ShadowCloneEntity extends TameableEntity {
private PlayerEntity player;
public ShadowCloneEntity(World worldIn, @Nonnull PlayerEntity playerIn){
this(RegistryHandler.SHADOW_CLONE.get(), worldIn);
this.player = playerIn;
}
public ShadowCloneEntity(EntityType<? extends TameableEntity> type, World worldIn) {
super(type, worldIn);
this.setTamed(true);
this.setOwnerId(player.getUniqueID());
}
@Override
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0, new SwimGoal(this));
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, true));
this.goalSelector.addGoal(2, new WaterAvoidingRandomWalkingGoal(this, 1.0D));
this.goalSelector.addGoal(3, new FollowOwnerGoal(this, 1.0D, 10.0F, 2.0F, false));
this.goalSelector.addGoal(4, new LookRandomlyGoal(this));
this.targetSelector.addGoal(1, new OwnerHurtByTargetGoal(this));
this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, MonsterEntity.class, false));
}
public static AttributeModifierMap.MutableAttribute func_234233_eS_() {
return MobEntity.func_233666_p_().createMutableAttribute(Attributes.MOVEMENT_SPEED, (double)1.0F).createMutableAttribute(Attributes.MAX_HEALTH, 2.0D).createMutableAttribute(Attributes.ATTACK_DAMAGE, 6.0D);
}
@Override
public void setTamed(boolean tamed){
super.setTamed(true);
func_234233_eS_();
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(2.0D);
this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(6.0D);
}
@Nullable
@Override
public AgeableEntity func_241840_a(ServerWorld p_241840_1_, AgeableEntity p_241840_2_) {
return null;
}
}
| 2,740 | 0.727007 | 0.702555 | 66 | 39.515152 | 35.685173 | 213 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.954545 | false | false | 2 |
160a30a44b60bd1d1a625e4698e06bb8227cfb54 | 6,536,940,264,622 | a5c7471ec326fde89157d3433554ebe59404163a | /src/main/java/com/yc/Appconfig.java | 01d7781808c9b7bab99205b40e88ca6b20b29295 | [] | no_license | xulegion/SpringIOC | https://github.com/xulegion/SpringIOC | fd13f8b54b18985af3332a32b1dc7770c492b873 | 0d5c31be0d66790b9d95cc809194ce3c11a524b1 | refs/heads/master | 2023-07-13T20:57:49.997000 | 2021-08-14T12:18:16 | 2021-08-14T12:18:16 | 395,997,617 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yc;
import com.yc.springframework.annotations.YcComponentScan;
import com.yc.springframework.annotations.YcConfiguration;
@YcConfiguration
@YcComponentScan(basePackage = "com.yc")
public class Appconfig {
}
| UTF-8 | Java | 221 | java | Appconfig.java | Java | [] | null | [] | package com.yc;
import com.yc.springframework.annotations.YcComponentScan;
import com.yc.springframework.annotations.YcConfiguration;
@YcConfiguration
@YcComponentScan(basePackage = "com.yc")
public class Appconfig {
}
| 221 | 0.823529 | 0.823529 | 9 | 23.555555 | 22.09128 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 2 |
06d51722a5fc8d4bc619d9ab51d014e7e36c6603 | 21,809,843,938,345 | 85c1066831f52e52272a67f18715b6c4979dc2cf | /Codility_practice/sortMatrixByOccurrences.java | 600c585d41df8d887f749186c00fa8d66976f4ee | [] | no_license | Rishabh-Mehta/OA-Practice | https://github.com/Rishabh-Mehta/OA-Practice | ddbc39a338387b061f03b707111c27ee9e3ca578 | ea1c673eda45bc4b84d5f38fa1d8c0c4d802f7d7 | refs/heads/master | 2023-04-03T02:13:58.220000 | 2021-04-06T17:15:49 | 2021-04-06T17:15:49 | 333,248,525 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Codility_practice;
import java.util.*;
public class sortMatrixByOccurrences {
public static int[][] sortMatrixByOcc(int[][] m) {
// (number, count)
Map<Integer,Integer> map = new TreeMap<>();
HashMap<Integer,List<Integer>> diagonalMap = new HashMap<>();
Comparator<Integer> comp = new Comparator<Integer>(){
@Override
public int compare(Integer o1, Integer o2) {
if(map.get(o1) == map.get(o2)){
return Integer.compare(o2, o1);
}
else{
return map.get(o2) - map.get(o1);
}
}
};
PriorityQueue<Integer> minHeap = new PriorityQueue<>(comp);
for(int i=0;i<m.length;i++){
for(int j=0;j<m[i].length;j++){
map.put(m[i][j],map.getOrDefault(m[i][j], 0)+1);
List<Integer> temp;
if(diagonalMap.containsKey(i+j)){
temp= diagonalMap.get(i+j);
}
else{
temp = new ArrayList<>();
}
temp.add(m[i][j]);
diagonalMap.put(i+j,temp);
}
}
for(int num:map.keySet()){
int size = map.get(num);
while(size !=0){
minHeap.add(num);
size--;
}
}
for(int i=0;i<m.length+m[0].length-1;i++){
int size = diagonalMap.get(i).size();
List<Integer> temp = new ArrayList<>();
while(size!=0 && !minHeap.isEmpty()){
int val = minHeap.poll();
temp.add(val);
size--;
}
diagonalMap.put(i,temp);
}
for(int i=0;i<m.length;i++){
for(int j=0;j<m[i].length;j++){
m[i][j]=diagonalMap.get(i+j).get(0);
diagonalMap.get(i+j).remove(0);
}
}
return m;
}
public static void main(String[] args) {
int[][] input = {{ 1, 4, -2},
{-2, 3, 4},
{ 3, 1, 3}};
int[][] res = sortMatrixByOcc(input);
for(int i=0;i<res.length;i++){
for(int j=0;j<res[i].length;j++){
System.out.print(res[i][j]+" ");
}
System.out.println();
}
}
}
| UTF-8 | Java | 2,517 | java | sortMatrixByOccurrences.java | Java | [] | null | [] | package Codility_practice;
import java.util.*;
public class sortMatrixByOccurrences {
public static int[][] sortMatrixByOcc(int[][] m) {
// (number, count)
Map<Integer,Integer> map = new TreeMap<>();
HashMap<Integer,List<Integer>> diagonalMap = new HashMap<>();
Comparator<Integer> comp = new Comparator<Integer>(){
@Override
public int compare(Integer o1, Integer o2) {
if(map.get(o1) == map.get(o2)){
return Integer.compare(o2, o1);
}
else{
return map.get(o2) - map.get(o1);
}
}
};
PriorityQueue<Integer> minHeap = new PriorityQueue<>(comp);
for(int i=0;i<m.length;i++){
for(int j=0;j<m[i].length;j++){
map.put(m[i][j],map.getOrDefault(m[i][j], 0)+1);
List<Integer> temp;
if(diagonalMap.containsKey(i+j)){
temp= diagonalMap.get(i+j);
}
else{
temp = new ArrayList<>();
}
temp.add(m[i][j]);
diagonalMap.put(i+j,temp);
}
}
for(int num:map.keySet()){
int size = map.get(num);
while(size !=0){
minHeap.add(num);
size--;
}
}
for(int i=0;i<m.length+m[0].length-1;i++){
int size = diagonalMap.get(i).size();
List<Integer> temp = new ArrayList<>();
while(size!=0 && !minHeap.isEmpty()){
int val = minHeap.poll();
temp.add(val);
size--;
}
diagonalMap.put(i,temp);
}
for(int i=0;i<m.length;i++){
for(int j=0;j<m[i].length;j++){
m[i][j]=diagonalMap.get(i+j).get(0);
diagonalMap.get(i+j).remove(0);
}
}
return m;
}
public static void main(String[] args) {
int[][] input = {{ 1, 4, -2},
{-2, 3, 4},
{ 3, 1, 3}};
int[][] res = sortMatrixByOcc(input);
for(int i=0;i<res.length;i++){
for(int j=0;j<res[i].length;j++){
System.out.print(res[i][j]+" ");
}
System.out.println();
}
}
}
| 2,517 | 0.402861 | 0.390147 | 87 | 27.931034 | 18.641687 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.701149 | false | false | 2 |
95ce8adf9fe7c6ccd39e678718dafea1a956355c | 24,472,723,673,456 | 25c5d243ffac4b4f4f9efcd6a28cb41d51b23c90 | /src/main/java/org/apache/sysds/runtime/compress/estim/sample/SmoothedJackknifeEstimator.java | 362a25674e8e7b624812ac5c47a6f6fee5f5e7f4 | [
"Apache-2.0"
] | permissive | apache/systemds | https://github.com/apache/systemds | 5351e8dd9aa842b693e8c148cf3be151697f07a7 | 73555e932a516063c860f5d05c84e6523cc7619b | refs/heads/main | 2023-08-31T03:46:03.010000 | 2023-08-30T18:25:59 | 2023-08-30T18:34:41 | 45,896,813 | 194 | 167 | Apache-2.0 | false | 2023-09-13T08:43:37 | 2015-11-10T08:00:06 | 2023-09-10T09:50:33 | 2023-09-13T08:43:35 | 360,210 | 984 | 447 | 31 | Java | false | false | /*
* 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.sysds.runtime.compress.estim.sample;
public interface SmoothedJackknifeEstimator {
/**
* Peter J. Haas, Jeffrey F. Naughton, S. Seshadri, and Lynne Stokes. Sampling-Based Estimation of the Number of
* Distinct Values of an Attribute. VLDB'95, Section 4.3.
*
* @param numVals The number of unique values in the sample
* @param freqCounts The inverse histogram of frequencies. counts extracted
* @param nRows The original number of rows in the entire input
* @param sampleSize The number of rows in the sample
* @return Estimate of the number of distinct values
*/
public static int distinctCount(int numVals, int[] freqCounts, int nRows, int sampleSize) {
int d = numVals;
double f1 = freqCounts[0];
int Nn = nRows * sampleSize;
double D0 = (d - f1 / sampleSize) / (1 - (nRows - sampleSize + 1) * f1 / Nn);
double NTilde = nRows / D0;
/*-
*
* h (as defined in eq. 5 in the paper) can be implemented as:
*
* double h = Gamma(nRows - NTilde + 1) x Gamma.gamma(nRows -sampleSize + 1)
* ----------------------------------------------------------------
* Gamma.gamma(nRows - sampleSize - NTilde + 1) x Gamma.gamma(nRows + 1)
*
*
* However, for large values of nRows, Gamma.gamma returns NAN
* (factorial of a very large number).
*
* The following implementation solves this problem by leveraging the
* cancellations that show up when expanding the factorials in the
* numerator and the denominator.
*
*
* min(A,D-1) x [min(A,D-1) -1] x .... x B
* h = -------------------------------------------
* C x [C-1] x .... x max(A+1,D)
*
* where A = N-\tilde{N}
* B = N-\tilde{N} - n + a
* C = N
* D = N-n+1
*
*
*
*/
double A = nRows - NTilde;
double B = A - sampleSize + 1;
double C = nRows;
double D = nRows - sampleSize + 1;
A = Math.min(A, D - 1);
D = Math.max(A + 1, D);
double h = 1;
for(; A >= B || C >= D; A--, C--) {
if(A >= B)
h *= A;
h /= C;
}
// end of h computation
double g = 0, gamma = 0;
// k here corresponds to k+1 in the paper (the +1 comes from replacing n
// with n-1)
for(int k = 2; k <= sampleSize + 1; k++) {
g += 1.0 / (nRows - NTilde - sampleSize + k);
}
for(int i = 1; i <= freqCounts.length; i++) {
gamma += i * (i - 1) * freqCounts[i - 1];
}
gamma *= (nRows - 1) * D0 / Nn / (sampleSize - 1);
gamma += D0 / nRows - 1;
double estimate = (d + nRows * h * g * gamma) / (1 - (nRows - NTilde - sampleSize + 1) * f1 / Nn);
return (int) Math.round(estimate);
}
}
| UTF-8 | Java | 3,438 | java | SmoothedJackknifeEstimator.java | Java | [
{
"context": "c interface SmoothedJackknifeEstimator {\n\n\t/**\n\t * Peter J. Haas, Jeffrey F. Naughton, S. Seshadri, and Lynne Stok",
"end": 935,
"score": 0.9998674392700195,
"start": 922,
"tag": "NAME",
"value": "Peter J. Haas"
},
{
"context": "othedJackknifeEstimator {\n\n\t/**\n\t * Peter J. Haas, Jeffrey F. Naughton, S. Seshadri, and Lynne Stokes. Sampling-Based Es",
"end": 956,
"score": 0.9998781681060791,
"start": 937,
"tag": "NAME",
"value": "Jeffrey F. Naughton"
},
{
"context": "or {\n\n\t/**\n\t * Peter J. Haas, Jeffrey F. Naughton, S. Seshadri, and Lynne Stokes. Sampling-Based Estimation of t",
"end": 969,
"score": 0.9998660683631897,
"start": 958,
"tag": "NAME",
"value": "S. Seshadri"
},
{
"context": "ter J. Haas, Jeffrey F. Naughton, S. Seshadri, and Lynne Stokes. Sampling-Based Estimation of the Number of\n\t * D",
"end": 987,
"score": 0.9998559951782227,
"start": 975,
"tag": "NAME",
"value": "Lynne Stokes"
}
] | null | [] | /*
* 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.sysds.runtime.compress.estim.sample;
public interface SmoothedJackknifeEstimator {
/**
* <NAME>, <NAME>, <NAME>, and <NAME>. Sampling-Based Estimation of the Number of
* Distinct Values of an Attribute. VLDB'95, Section 4.3.
*
* @param numVals The number of unique values in the sample
* @param freqCounts The inverse histogram of frequencies. counts extracted
* @param nRows The original number of rows in the entire input
* @param sampleSize The number of rows in the sample
* @return Estimate of the number of distinct values
*/
public static int distinctCount(int numVals, int[] freqCounts, int nRows, int sampleSize) {
int d = numVals;
double f1 = freqCounts[0];
int Nn = nRows * sampleSize;
double D0 = (d - f1 / sampleSize) / (1 - (nRows - sampleSize + 1) * f1 / Nn);
double NTilde = nRows / D0;
/*-
*
* h (as defined in eq. 5 in the paper) can be implemented as:
*
* double h = Gamma(nRows - NTilde + 1) x Gamma.gamma(nRows -sampleSize + 1)
* ----------------------------------------------------------------
* Gamma.gamma(nRows - sampleSize - NTilde + 1) x Gamma.gamma(nRows + 1)
*
*
* However, for large values of nRows, Gamma.gamma returns NAN
* (factorial of a very large number).
*
* The following implementation solves this problem by leveraging the
* cancellations that show up when expanding the factorials in the
* numerator and the denominator.
*
*
* min(A,D-1) x [min(A,D-1) -1] x .... x B
* h = -------------------------------------------
* C x [C-1] x .... x max(A+1,D)
*
* where A = N-\tilde{N}
* B = N-\tilde{N} - n + a
* C = N
* D = N-n+1
*
*
*
*/
double A = nRows - NTilde;
double B = A - sampleSize + 1;
double C = nRows;
double D = nRows - sampleSize + 1;
A = Math.min(A, D - 1);
D = Math.max(A + 1, D);
double h = 1;
for(; A >= B || C >= D; A--, C--) {
if(A >= B)
h *= A;
h /= C;
}
// end of h computation
double g = 0, gamma = 0;
// k here corresponds to k+1 in the paper (the +1 comes from replacing n
// with n-1)
for(int k = 2; k <= sampleSize + 1; k++) {
g += 1.0 / (nRows - NTilde - sampleSize + k);
}
for(int i = 1; i <= freqCounts.length; i++) {
gamma += i * (i - 1) * freqCounts[i - 1];
}
gamma *= (nRows - 1) * D0 / Nn / (sampleSize - 1);
gamma += D0 / nRows - 1;
double estimate = (d + nRows * h * g * gamma) / (1 - (nRows - NTilde - sampleSize + 1) * f1 / Nn);
return (int) Math.round(estimate);
}
}
| 3,407 | 0.604712 | 0.589587 | 100 | 33.380001 | 27.777609 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.99 | false | false | 2 |
a09046504c2e8cc230eb9fbda6cf86eccbf8df02 | 10,823,317,633,012 | 42b9b19d22b99cb5e96c4e656d43c96dd689666c | /src/features/nonlinear/entropy/CorrectedConditionalShannonEntropy.java | c7015753527314258cdb96fc7a9791365e873508 | [] | no_license | lsuc/EEGFrame | https://github.com/lsuc/EEGFrame | 6459925ae694b233d1f6140871840aebde92f870 | cc3f04989b2ffc89a7f83d73448e942e99d09034 | refs/heads/master | 2020-04-24T21:54:46.637000 | 2015-02-15T13:09:23 | 2015-02-15T13:09:23 | 21,299,820 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package features.nonlinear.entropy;
import statisticMeasure.Statistics;
//A. Porta, G. Baselli, D. Liberati, N. Montano, C. Cogliati, T. Gnecchi-Ruscone, et al., “Measuring regularity by means of a corrected conditional entropy in sympathetic outflow,” Biol. Cybern., vol. 78, no. 1, pp. 71–78, 1998.
//PROVJERITI JOŠ
public class CorrectedConditionalShannonEntropy {
public static double calculateCorrectedConditionalShannonEntropy(double [] series, int dim, int division){
double max = Statistics.maximum(series);
double min = Statistics.minimum(series);
double boxSize = (max-min)/division;
int sum;
// find distribution of points within dim dimensional boxes of size boxSize
int[] boxes = new int[(int)Math.pow((double)division, (double)dim)];
int[] locator = new int[dim];
for (int i=0; i<series.length-dim; i++){
for (int j=0; j<dim; j++){
locator[j]=(int)Math.ceil((series[i+j]-min)/boxSize)-1;
if (locator[j]<0){
locator[j]=0;
}
}
sum = 0;
for (int j=0, a=dim-1; j<dim; j++, a--){
sum += (int)locator[j]*Math.pow(division,a);
}
boxes[sum]++;
}
double sumEntropy = 0.0;
double entropy = 0.0;
// divide and logarithmize in order to obtain Shannon entropy, find percent of those boxes with only one point in them, disregard empty boxes
double percent = 0.0;
double log2 = Math.log10(2.0);
for (int i=0; i<boxes.length; i++){
if (boxes[i]>1){
sumEntropy += (double)(boxes[i])/(series.length-dim+1)*Math.log10((double)(boxes[i])/(series.length-dim+1))/log2;
}
else if (boxes[i] == 1){
percent ++;
}
}
entropy = -sumEntropy;
percent /= (series.length-dim+1);
// repeat for one dimension less
boxes = new int[(int)Math.pow((double)division, (double)(dim-1))];
locator = new int[dim-1];
for (int i=0; i<series.length-(dim-1); i++){
for (int j=0; j<dim-1; j++){
locator[j]=(int)Math.ceil((series[i+j]-min)/boxSize)-1;
if (locator[j]<0){
locator[j]=0;
}
}
sum = 0;
for (int j=0, a=dim-2; j<dim-1; j++, a--){
sum += (int)locator[j]*Math.pow(division,a);
}
boxes[sum]++;
}
sumEntropy = 0.0;
// divide and logarithmize in order to obtain Shannon entropy
for (int i=0; i<boxes.length; i++){
if (boxes[i]>1){
sumEntropy += (double)(boxes[i])/(series.length-dim+1)*Math.log10((double)(boxes[i])/(series.length-dim+1))/log2;
}
}
entropy = entropy - (-sumEntropy);
sum = 0;
// repeat for one-dimensional case
boxes = new int[division];
for (int i=0; i<series.length-(dim-1); i++){
sum = (int)Math.ceil((series[i]-min)/boxSize)-1;
if (sum<0){
sum = 0;
}
boxes[sum]++;
}
sumEntropy = 0.0;
// divide and logarithmize in order to obtain Shannon entropy
for (int i=0; i<boxes.length; i++){
if (boxes[i]>1){
sumEntropy += (double)(boxes[i])/(series.length-dim+1)*Math.log10((double)(boxes[i])/(series.length-dim+1))/log2;
}
}
return (entropy + percent*(-sumEntropy));
}
public static final int MINIMAL_LENGTH_FOR_EXTRACTION = 20;
}
| WINDOWS-1250 | Java | 3,058 | java | CorrectedConditionalShannonEntropy.java | Java | [
{
"context": "r.entropy;\n\nimport statisticMeasure.Statistics;\n//A. Porta, G. Baselli, D. Liberati, N. Montano, C. Cogliati",
"end": 83,
"score": 0.9998752474784851,
"start": 75,
"tag": "NAME",
"value": "A. Porta"
},
{
"context": ";\n\nimport statisticMeasure.Statistics;\n//A. Porta, G. Baselli, D. Liberati, N. Montano, C. Cogliati, T. Gnecchi",
"end": 95,
"score": 0.9998674392700195,
"start": 85,
"tag": "NAME",
"value": "G. Baselli"
},
{
"context": "atisticMeasure.Statistics;\n//A. Porta, G. Baselli, D. Liberati, N. Montano, C. Cogliati, T. Gnecchi-Ruscone, et ",
"end": 108,
"score": 0.999853253364563,
"start": 97,
"tag": "NAME",
"value": "D. Liberati"
},
{
"context": "e.Statistics;\n//A. Porta, G. Baselli, D. Liberati, N. Montano, C. Cogliati, T. Gnecchi-Ruscone, et al., “Measur",
"end": 120,
"score": 0.9998414516448975,
"start": 110,
"tag": "NAME",
"value": "N. Montano"
},
{
"context": ";\n//A. Porta, G. Baselli, D. Liberati, N. Montano, C. Cogliati, T. Gnecchi-Ruscone, et al., “Measuring regularit",
"end": 133,
"score": 0.9998619556427002,
"start": 122,
"tag": "NAME",
"value": "C. Cogliati"
},
{
"context": " G. Baselli, D. Liberati, N. Montano, C. Cogliati, T. Gnecchi-Ruscone, et al., “Measuring regularity by means of a corr",
"end": 153,
"score": 0.9998604655265808,
"start": 135,
"tag": "NAME",
"value": "T. Gnecchi-Ruscone"
}
] | null | [] | package features.nonlinear.entropy;
import statisticMeasure.Statistics;
//<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, et al., “Measuring regularity by means of a corrected conditional entropy in sympathetic outflow,” Biol. Cybern., vol. 78, no. 1, pp. 71–78, 1998.
//PROVJERITI JOŠ
public class CorrectedConditionalShannonEntropy {
public static double calculateCorrectedConditionalShannonEntropy(double [] series, int dim, int division){
double max = Statistics.maximum(series);
double min = Statistics.minimum(series);
double boxSize = (max-min)/division;
int sum;
// find distribution of points within dim dimensional boxes of size boxSize
int[] boxes = new int[(int)Math.pow((double)division, (double)dim)];
int[] locator = new int[dim];
for (int i=0; i<series.length-dim; i++){
for (int j=0; j<dim; j++){
locator[j]=(int)Math.ceil((series[i+j]-min)/boxSize)-1;
if (locator[j]<0){
locator[j]=0;
}
}
sum = 0;
for (int j=0, a=dim-1; j<dim; j++, a--){
sum += (int)locator[j]*Math.pow(division,a);
}
boxes[sum]++;
}
double sumEntropy = 0.0;
double entropy = 0.0;
// divide and logarithmize in order to obtain Shannon entropy, find percent of those boxes with only one point in them, disregard empty boxes
double percent = 0.0;
double log2 = Math.log10(2.0);
for (int i=0; i<boxes.length; i++){
if (boxes[i]>1){
sumEntropy += (double)(boxes[i])/(series.length-dim+1)*Math.log10((double)(boxes[i])/(series.length-dim+1))/log2;
}
else if (boxes[i] == 1){
percent ++;
}
}
entropy = -sumEntropy;
percent /= (series.length-dim+1);
// repeat for one dimension less
boxes = new int[(int)Math.pow((double)division, (double)(dim-1))];
locator = new int[dim-1];
for (int i=0; i<series.length-(dim-1); i++){
for (int j=0; j<dim-1; j++){
locator[j]=(int)Math.ceil((series[i+j]-min)/boxSize)-1;
if (locator[j]<0){
locator[j]=0;
}
}
sum = 0;
for (int j=0, a=dim-2; j<dim-1; j++, a--){
sum += (int)locator[j]*Math.pow(division,a);
}
boxes[sum]++;
}
sumEntropy = 0.0;
// divide and logarithmize in order to obtain Shannon entropy
for (int i=0; i<boxes.length; i++){
if (boxes[i]>1){
sumEntropy += (double)(boxes[i])/(series.length-dim+1)*Math.log10((double)(boxes[i])/(series.length-dim+1))/log2;
}
}
entropy = entropy - (-sumEntropy);
sum = 0;
// repeat for one-dimensional case
boxes = new int[division];
for (int i=0; i<series.length-(dim-1); i++){
sum = (int)Math.ceil((series[i]-min)/boxSize)-1;
if (sum<0){
sum = 0;
}
boxes[sum]++;
}
sumEntropy = 0.0;
// divide and logarithmize in order to obtain Shannon entropy
for (int i=0; i<boxes.length; i++){
if (boxes[i]>1){
sumEntropy += (double)(boxes[i])/(series.length-dim+1)*Math.log10((double)(boxes[i])/(series.length-dim+1))/log2;
}
}
return (entropy + percent*(-sumEntropy));
}
public static final int MINIMAL_LENGTH_FOR_EXTRACTION = 20;
}
| 3,026 | 0.630941 | 0.605375 | 92 | 32.152172 | 35.560093 | 228 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.347826 | false | false | 2 |
e7fc3fa60dc1363d87174e96c658221a9e2e234d | 16,277,926,086,512 | 7f3ecdec1d44c0f330925f9770617ce4012d7a6a | /src/main/java/sf/MagacinBackend/mapper/PoslovnaGodinaMapper.java | d1ea4a847143cdd0f8f19123707df223d2dee364 | [] | no_license | zoranmalta/MagacinBackend | https://github.com/zoranmalta/MagacinBackend | 2212ca8b39d27979c27784d85ff06f2b6664dc58 | 1eba91880c5d578ae37fb01c1082400e4eb616de | refs/heads/master | 2022-11-07T04:07:03.768000 | 2020-07-09T23:52:19 | 2020-07-09T23:52:19 | 263,756,818 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sf.MagacinBackend.mapper;
import org.springframework.stereotype.Component;
import sf.MagacinBackend.model.PoslovnaGodina;
import sf.MagacinBackend.modelDTO.PoslovnaGodinaDTO;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class PoslovnaGodinaMapper {
public PoslovnaGodina toPoslovnaGodina(PoslovnaGodinaDTO poslovnaGodinaDTO){
PoslovnaGodina p=new PoslovnaGodina();
p.setId(poslovnaGodinaDTO.getId());
p.setAktivna(poslovnaGodinaDTO.isAktivna());
p.setZakljucena(poslovnaGodinaDTO.isZakljucena());
p.setGodinaStart(poslovnaGodinaDTO.getGodinaStart());
p.setGodinaEnd(poslovnaGodinaDTO.getGodinaEnd());
return p;
}
public PoslovnaGodinaDTO toPoslovnaGodinaDTO(PoslovnaGodina poslovnaGodina){
PoslovnaGodinaDTO p=new PoslovnaGodinaDTO();
p.setId(poslovnaGodina.getId());
p.setAktivna(poslovnaGodina.isAktivna());
p.setZakljucena(poslovnaGodina.isZakljucena());
p.setGodinaStart(poslovnaGodina.getGodinaStart());
p.setGodinaEnd(poslovnaGodina.getGodinaEnd());
return p;
}
public List<PoslovnaGodinaDTO> toListPoslovnaGodinaDTO(List<PoslovnaGodina> list){
return list.stream().map(poslovnaGodina -> toPoslovnaGodinaDTO(poslovnaGodina))
.collect(Collectors.toList());
}
}
| UTF-8 | Java | 1,369 | java | PoslovnaGodinaMapper.java | Java | [] | null | [] | package sf.MagacinBackend.mapper;
import org.springframework.stereotype.Component;
import sf.MagacinBackend.model.PoslovnaGodina;
import sf.MagacinBackend.modelDTO.PoslovnaGodinaDTO;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class PoslovnaGodinaMapper {
public PoslovnaGodina toPoslovnaGodina(PoslovnaGodinaDTO poslovnaGodinaDTO){
PoslovnaGodina p=new PoslovnaGodina();
p.setId(poslovnaGodinaDTO.getId());
p.setAktivna(poslovnaGodinaDTO.isAktivna());
p.setZakljucena(poslovnaGodinaDTO.isZakljucena());
p.setGodinaStart(poslovnaGodinaDTO.getGodinaStart());
p.setGodinaEnd(poslovnaGodinaDTO.getGodinaEnd());
return p;
}
public PoslovnaGodinaDTO toPoslovnaGodinaDTO(PoslovnaGodina poslovnaGodina){
PoslovnaGodinaDTO p=new PoslovnaGodinaDTO();
p.setId(poslovnaGodina.getId());
p.setAktivna(poslovnaGodina.isAktivna());
p.setZakljucena(poslovnaGodina.isZakljucena());
p.setGodinaStart(poslovnaGodina.getGodinaStart());
p.setGodinaEnd(poslovnaGodina.getGodinaEnd());
return p;
}
public List<PoslovnaGodinaDTO> toListPoslovnaGodinaDTO(List<PoslovnaGodina> list){
return list.stream().map(poslovnaGodina -> toPoslovnaGodinaDTO(poslovnaGodina))
.collect(Collectors.toList());
}
}
| 1,369 | 0.737765 | 0.737765 | 34 | 39.264706 | 25.654158 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.617647 | false | false | 2 |
ee73db57e0bc8b254db7d3ed647094c5483dcc2e | 8,744,553,442,016 | 4976ee8731f25543614e8aff4d77958857818bf2 | /src/main/java/com/dreamer/service/mobile/impl/CardHandlerImpl.java | 27fcb10d9bd83cb586db6e0832c92093ee636813 | [] | no_license | huangfe1/gc-maven | https://github.com/huangfe1/gc-maven | 03ed85e86717ae9d3a2ffbe0b81210f3b8d79ad8 | c1c7202008876cfc7749e588b27a2a63b68da0d9 | refs/heads/master | 2021-09-07T16:44:14.062000 | 2018-02-26T06:35:27 | 2018-02-26T06:35:27 | 107,620,610 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.dreamer.service.mobile.impl;
import com.dreamer.domain.user.Card;
import com.dreamer.repository.mobile.CardDao;
import com.dreamer.service.mobile.CardHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by huangfei on 02/07/2017.
*/
@Service
public class CardHandlerImpl extends BaseHandlerImpl<Card> implements CardHandler {
private CardDao cardDao;
public CardDao getCardDao() {
return cardDao;
}
@Autowired
public void setCardDao(CardDao cardDao) {
setBaseDao(cardDao);
this.cardDao = cardDao;
}
}
| UTF-8 | Java | 649 | java | CardHandlerImpl.java | Java | [
{
"context": "ngframework.stereotype.Service;\n\n/**\n * Created by huangfei on 02/07/2017.\n */\n@Service\npublic class CardHand",
"end": 309,
"score": 0.9989620447158813,
"start": 301,
"tag": "USERNAME",
"value": "huangfei"
}
] | null | [] | package com.dreamer.service.mobile.impl;
import com.dreamer.domain.user.Card;
import com.dreamer.repository.mobile.CardDao;
import com.dreamer.service.mobile.CardHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by huangfei on 02/07/2017.
*/
@Service
public class CardHandlerImpl extends BaseHandlerImpl<Card> implements CardHandler {
private CardDao cardDao;
public CardDao getCardDao() {
return cardDao;
}
@Autowired
public void setCardDao(CardDao cardDao) {
setBaseDao(cardDao);
this.cardDao = cardDao;
}
}
| 649 | 0.74114 | 0.728814 | 27 | 23.037037 | 22.30011 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37037 | false | false | 2 |
fc6bae608ca4d39158f33f251b5db470ca24cd6c | 23,381,802,020,177 | 0f7f01ce49f25243b42288a095671d796b04ee78 | /wp-android/src/org/multiversewriters/android/ui/notifications/ReplyList.java | f6297a64f82be17c00132e27995738f7819a916e | [
"MIT"
] | permissive | themultiverseproject/org.multiversewriters.android | https://github.com/themultiverseproject/org.multiversewriters.android | 4f4ad0a4832a17a7127f44e717e232162d7e5ec6 | a4c0540ed96f78304a1022ea00fa2b0b55ab4c71 | refs/heads/master | 2015-08-11T05:55:19.305000 | 2014-04-14T23:20:02 | 2014-04-14T23:20:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.multiversewriters.android.ui.notifications;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.os.Build;
import org.multiversewriters.android.R;
import org.multiversewriters.android.models.Note;
public class ReplyList extends LinearLayout {
// Gingerbread has weird layout issues regarding clipChildren and clipToPadding so we're
// disabling the animations for anything before Jelly Bean
private static final boolean ANIMATE=Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
public ReplyList(Context context){
super(context);
}
public ReplyList(Context context, AttributeSet attrs){
super(context, attrs);
}
public ReplyList(Context context, AttributeSet attrs, int defStyle){
super(context, attrs, defStyle);
}
protected void onFinishInflate(){
if (ANIMATE) {
setClipChildren(false);
setClipToPadding(false);
}
}
/**
* Add a reply item
*/
public ReplyRow addReply(Note.Reply reply){
// inflate the view
setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingLeft());
LayoutInflater inflater = LayoutInflater.from(getContext());
ReplyRow row = (ReplyRow) inflater.inflate(R.layout.notifications_reply_row, this, false);
addView(row);
if (ANIMATE) {
Animation zoom = AnimationUtils.loadAnimation(getContext(), R.anim.zoom);
row.startAnimation(zoom);
}
return row;
}
} | UTF-8 | Java | 1,761 | java | ReplyList.java | Java | [] | null | [] | package org.multiversewriters.android.ui.notifications;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.os.Build;
import org.multiversewriters.android.R;
import org.multiversewriters.android.models.Note;
public class ReplyList extends LinearLayout {
// Gingerbread has weird layout issues regarding clipChildren and clipToPadding so we're
// disabling the animations for anything before Jelly Bean
private static final boolean ANIMATE=Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
public ReplyList(Context context){
super(context);
}
public ReplyList(Context context, AttributeSet attrs){
super(context, attrs);
}
public ReplyList(Context context, AttributeSet attrs, int defStyle){
super(context, attrs, defStyle);
}
protected void onFinishInflate(){
if (ANIMATE) {
setClipChildren(false);
setClipToPadding(false);
}
}
/**
* Add a reply item
*/
public ReplyRow addReply(Note.Reply reply){
// inflate the view
setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingLeft());
LayoutInflater inflater = LayoutInflater.from(getContext());
ReplyRow row = (ReplyRow) inflater.inflate(R.layout.notifications_reply_row, this, false);
addView(row);
if (ANIMATE) {
Animation zoom = AnimationUtils.loadAnimation(getContext(), R.anim.zoom);
row.startAnimation(zoom);
}
return row;
}
} | 1,761 | 0.69222 | 0.69222 | 52 | 32.884617 | 26.871241 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false | 2 |
a4883691cdf32df959d6955b9d274004e76996ce | 13,537,736,948,416 | 5d4b3ffdb3cd9e0bef9ddd70cc56d584af413ce0 | /app/src/main/java/com/example/tanman/streamingapp/fragments/FavoriteSongsListFragment.java | 041719a218263773ce4676f4ebbae63062419ede | [] | no_license | tanman2391/DatabaseSample | https://github.com/tanman2391/DatabaseSample | 1f78788cfc6beacab9e2832eb4240d2840e658a8 | 49699f17deade6be823515c57b9f50d0157b2e00 | refs/heads/master | 2020-04-16T12:21:59.663000 | 2019-01-17T20:52:04 | 2019-01-17T20:52:04 | 165,575,829 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.tanman.streamingapp.fragments;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.example.tanman.streamingapp.R;
import com.example.tanman.streamingapp.adapters.SongRecyclerViewAdapter;
import com.example.tanman.streamingapp.entities.SongEntity;
import com.example.tanman.streamingapp.viewmodels.SongViewModel;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class FavoriteSongsListFragment extends Fragment implements View.OnClickListener, SongRecyclerViewAdapter.OnItemClickLIstener {
View view;
private SongViewModel songViewModel;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_favorite_song_list, container, false);
setHasOptionsMenu(true);
RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(container.getContext()));
final SongRecyclerViewAdapter adapter = new SongRecyclerViewAdapter(this);
recyclerView.setAdapter(adapter);
FloatingActionButton fab = view.findViewById(R.id.fab_add_to_list);
fab.setOnClickListener(this);
songViewModel = ViewModelProviders.of(this).get(SongViewModel.class);
songViewModel.getAllSongs().observe(this, new Observer<List<SongEntity>>() {
@Override
public void onChanged(List<SongEntity> songEntities) {
adapter.submitList(songEntities);
}
});
new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) {
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder viewHolder1) {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
songViewModel.delete(adapter.getSongAt(viewHolder.getAdapterPosition()));
Snackbar snackbar = Snackbar.make(view.findViewById(R.id.recycler_view), R.string.delete_message, Snackbar.LENGTH_SHORT);
snackbar.show();
}
}).attachToRecyclerView(recyclerView);
return view;
}
@Override
public void onResume() {
super.onResume();
getActivity().setTitle(getString(R.string.app_name));
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_favorite_song_list, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.delete_all_songs:
songViewModel.deleteAll();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.fab_add_to_list:
FragmentManager fm = getActivity().getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.fragment_container, new AddSongFragment());
ft.addToBackStack(null).commit();
}
}
@Override
public void onItemClick(SongEntity song) {
try {
Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(song.getUrl()));
startActivity(browse);
} catch (Exception e) {
Snackbar snackbar = Snackbar.make(view.findViewById(R.id.recycler_view), R.string.url_load_error_message, Snackbar.LENGTH_SHORT);
snackbar.show();
}
}
}
| UTF-8 | Java | 4,643 | java | FavoriteSongsListFragment.java | Java | [] | null | [] | package com.example.tanman.streamingapp.fragments;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.example.tanman.streamingapp.R;
import com.example.tanman.streamingapp.adapters.SongRecyclerViewAdapter;
import com.example.tanman.streamingapp.entities.SongEntity;
import com.example.tanman.streamingapp.viewmodels.SongViewModel;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class FavoriteSongsListFragment extends Fragment implements View.OnClickListener, SongRecyclerViewAdapter.OnItemClickLIstener {
View view;
private SongViewModel songViewModel;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_favorite_song_list, container, false);
setHasOptionsMenu(true);
RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(container.getContext()));
final SongRecyclerViewAdapter adapter = new SongRecyclerViewAdapter(this);
recyclerView.setAdapter(adapter);
FloatingActionButton fab = view.findViewById(R.id.fab_add_to_list);
fab.setOnClickListener(this);
songViewModel = ViewModelProviders.of(this).get(SongViewModel.class);
songViewModel.getAllSongs().observe(this, new Observer<List<SongEntity>>() {
@Override
public void onChanged(List<SongEntity> songEntities) {
adapter.submitList(songEntities);
}
});
new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) {
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder viewHolder1) {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
songViewModel.delete(adapter.getSongAt(viewHolder.getAdapterPosition()));
Snackbar snackbar = Snackbar.make(view.findViewById(R.id.recycler_view), R.string.delete_message, Snackbar.LENGTH_SHORT);
snackbar.show();
}
}).attachToRecyclerView(recyclerView);
return view;
}
@Override
public void onResume() {
super.onResume();
getActivity().setTitle(getString(R.string.app_name));
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_favorite_song_list, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.delete_all_songs:
songViewModel.deleteAll();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.fab_add_to_list:
FragmentManager fm = getActivity().getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.fragment_container, new AddSongFragment());
ft.addToBackStack(null).commit();
}
}
@Override
public void onItemClick(SongEntity song) {
try {
Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(song.getUrl()));
startActivity(browse);
} catch (Exception e) {
Snackbar snackbar = Snackbar.make(view.findViewById(R.id.recycler_view), R.string.url_load_error_message, Snackbar.LENGTH_SHORT);
snackbar.show();
}
}
}
| 4,643 | 0.699978 | 0.699548 | 121 | 37.371902 | 33.741882 | 162 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.661157 | false | false | 2 |
7dc7b6bb222303711100843c085293d8bba27dfc | 22,393,959,513,153 | 2af8d29ad4347310247ab01231c6af1b993aa1dd | /xith3d/src/org/xith3d/render/OpenGLInfo.java | 9ed2aa2ebc9b582a5ee128b4f7afdb70c3c7ddb5 | [
"BSD-2-Clause"
] | permissive | pboechat/xithcluster | https://github.com/pboechat/xithcluster | 332951bef924febd3bb6a5181344aa26f09aaa9a | 4fc7cd30525b7661eaba35fcb9928891d866f442 | refs/heads/master | 2021-04-05T23:21:20.824000 | 2016-07-24T18:33:19 | 2016-07-24T18:33:19 | 1,865,370 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright (c) 2003-2010, Xith3D Project Group all rights reserved.
*
* Portions based on the Java3D interface, Copyright by Sun Microsystems.
* Many thanks to the developers of Java3D and Sun Microsystems for their
* innovation and design.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of the 'Xith3D Project Group' nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) A
* RISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE
*/
package org.xith3d.render;
import java.util.Arrays;
/**
* Small class to hold the information about the OpenGL layer
*
* @author Marvin Froehlich (aka Qudus)
*/
public class OpenGLInfo
{
public static final int NORM_VERSION_1_1 = composeNormalizedVersion( 1, 1, 0 );
public static final int NORM_VERSION_1_2 = composeNormalizedVersion( 1, 2, 0 );
public static final int NORM_VERSION_1_3 = composeNormalizedVersion( 1, 3, 0 );
public static final int NORM_VERSION_1_4 = composeNormalizedVersion( 1, 4, 0 );
public static final int NORM_VERSION_1_5 = composeNormalizedVersion( 1, 5, 0 );
public static final int NORM_VERSION_2_0 = composeNormalizedVersion( 2, 0, 0 );
public static final int NORM_VERSION_2_1 = composeNormalizedVersion( 2, 1, 0 );
public static enum KnownVendor
{
NVIDIA,
ATI,
INTEL,
MESA,
;
public static KnownVendor getKnownVendor( String vendor )
{
if ( vendor.toLowerCase().contains( "nvidia" ) )
return ( NVIDIA );
if ( vendor.toLowerCase().contains( "ati" ) )
return ( ATI );
if ( vendor.toLowerCase().contains( "intel" ) )
return ( INTEL );
if ( vendor.toLowerCase().contains( "mesa" ) )
return ( MESA );
return ( null );
}
}
private final String RENDERER;
private final String VERSION;
private final int VERSION_MAJOR;
private final int VERSION_MINOR;
private final int VERSION_REVISION;
private final int NORM_VERSION;
private final String VENDOR;
private final KnownVendor KNOWN_VENDOR;
private final String[] EXTENSIONS;
private final int[] EXT_HASHES;
public final String getRenderer()
{
return ( RENDERER );
}
public final String getVersion()
{
return ( VERSION );
}
public final int getNormalizedVersion()
{
return ( NORM_VERSION );
}
public final int getVersionMajor()
{
return ( VERSION_MAJOR );
}
public final int getVersionMinor()
{
return ( VERSION_MINOR );
}
public final int getVersionRevision()
{
return ( VERSION_REVISION );
}
public final String getVendor()
{
return ( VENDOR );
}
public final KnownVendor getKnwonVendor()
{
return ( KNOWN_VENDOR );
}
public final String[] getExtensions()
{
return ( EXTENSIONS );
}
public final boolean hasExtension( String extension )
{
return ( Arrays.binarySearch( EXT_HASHES, extension.hashCode() ) >= 0 );
}
@Override
public String toString()
{
StringBuffer buff = new StringBuffer();
buff.append( "OpenGL Renderer = " );
buff.append( RENDERER );
buff.append( '\n' );
buff.append( "OpenGL Version = " );
buff.append( VERSION );
buff.append( '\n' );
buff.append( "OpenGL Vendor = " );
buff.append( VENDOR );
buff.append( '\n' );
buff.append( "OpenGL Extensions =" );
for ( int i = 0; i < EXTENSIONS.length; i++ )
{
buff.append( ' ' );
buff.append( EXTENSIONS[ i ] );
}
return ( buff.toString() );
}
public void dump()
{
System.out.println( toString() );
}
public void dumpExtensions()
{
System.out.println( "OpenGL Extensions:" );
for ( int i = 0; i < EXTENSIONS.length; i++ )
{
System.out.println( EXTENSIONS[ i ] );
}
}
private static int composeNormalizedVersion( int major, int minor, int revision )
{
int normVersion = revision + ( minor * 10000 ) + ( major * 10000 * 100 );
return ( normVersion );
}
public OpenGLInfo( String renderer, String version, String vendor, String extensions )
{
this.RENDERER = renderer;
this.VERSION = version;
this.VENDOR = vendor;
this.KNOWN_VENDOR = KnownVendor.getKnownVendor( vendor );
this.EXTENSIONS = extensions.split( " " );
int p = VERSION.indexOf( ' ' );
String[] ver = ( p > -1 ? VERSION.substring( 0, p ) : VERSION ).split( "\\." );
this.VERSION_MAJOR = Integer.parseInt( ver[ 0 ] );
this.VERSION_MINOR = ( ver.length > 1 ) ? Integer.parseInt( ver[ 1 ] ) : 0;
this.VERSION_REVISION = ( ver.length > 2 ) ? Integer.parseInt( ver[ 2 ] ) : 0;
this.NORM_VERSION = composeNormalizedVersion( VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION );
this.EXT_HASHES = new int[ EXTENSIONS.length ];
for ( int i = 0; i < EXTENSIONS.length; i++ )
{
EXT_HASHES[ i ] = EXTENSIONS[ i ].hashCode();
}
Arrays.sort( EXT_HASHES );
}
}
| UTF-8 | Java | 6,852 | java | OpenGLInfo.java | Java | [
{
"context": " information about the OpenGL layer\n * \n * @author Marvin Froehlich (aka Qudus)\n */\npublic class OpenGLInfo\n{\n pub",
"end": 1910,
"score": 0.9998778700828552,
"start": 1894,
"tag": "NAME",
"value": "Marvin Froehlich"
}
] | null | [] | /**
* Copyright (c) 2003-2010, Xith3D Project Group all rights reserved.
*
* Portions based on the Java3D interface, Copyright by Sun Microsystems.
* Many thanks to the developers of Java3D and Sun Microsystems for their
* innovation and design.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of the 'Xith3D Project Group' nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) A
* RISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE
*/
package org.xith3d.render;
import java.util.Arrays;
/**
* Small class to hold the information about the OpenGL layer
*
* @author <NAME> (aka Qudus)
*/
public class OpenGLInfo
{
public static final int NORM_VERSION_1_1 = composeNormalizedVersion( 1, 1, 0 );
public static final int NORM_VERSION_1_2 = composeNormalizedVersion( 1, 2, 0 );
public static final int NORM_VERSION_1_3 = composeNormalizedVersion( 1, 3, 0 );
public static final int NORM_VERSION_1_4 = composeNormalizedVersion( 1, 4, 0 );
public static final int NORM_VERSION_1_5 = composeNormalizedVersion( 1, 5, 0 );
public static final int NORM_VERSION_2_0 = composeNormalizedVersion( 2, 0, 0 );
public static final int NORM_VERSION_2_1 = composeNormalizedVersion( 2, 1, 0 );
public static enum KnownVendor
{
NVIDIA,
ATI,
INTEL,
MESA,
;
public static KnownVendor getKnownVendor( String vendor )
{
if ( vendor.toLowerCase().contains( "nvidia" ) )
return ( NVIDIA );
if ( vendor.toLowerCase().contains( "ati" ) )
return ( ATI );
if ( vendor.toLowerCase().contains( "intel" ) )
return ( INTEL );
if ( vendor.toLowerCase().contains( "mesa" ) )
return ( MESA );
return ( null );
}
}
private final String RENDERER;
private final String VERSION;
private final int VERSION_MAJOR;
private final int VERSION_MINOR;
private final int VERSION_REVISION;
private final int NORM_VERSION;
private final String VENDOR;
private final KnownVendor KNOWN_VENDOR;
private final String[] EXTENSIONS;
private final int[] EXT_HASHES;
public final String getRenderer()
{
return ( RENDERER );
}
public final String getVersion()
{
return ( VERSION );
}
public final int getNormalizedVersion()
{
return ( NORM_VERSION );
}
public final int getVersionMajor()
{
return ( VERSION_MAJOR );
}
public final int getVersionMinor()
{
return ( VERSION_MINOR );
}
public final int getVersionRevision()
{
return ( VERSION_REVISION );
}
public final String getVendor()
{
return ( VENDOR );
}
public final KnownVendor getKnwonVendor()
{
return ( KNOWN_VENDOR );
}
public final String[] getExtensions()
{
return ( EXTENSIONS );
}
public final boolean hasExtension( String extension )
{
return ( Arrays.binarySearch( EXT_HASHES, extension.hashCode() ) >= 0 );
}
@Override
public String toString()
{
StringBuffer buff = new StringBuffer();
buff.append( "OpenGL Renderer = " );
buff.append( RENDERER );
buff.append( '\n' );
buff.append( "OpenGL Version = " );
buff.append( VERSION );
buff.append( '\n' );
buff.append( "OpenGL Vendor = " );
buff.append( VENDOR );
buff.append( '\n' );
buff.append( "OpenGL Extensions =" );
for ( int i = 0; i < EXTENSIONS.length; i++ )
{
buff.append( ' ' );
buff.append( EXTENSIONS[ i ] );
}
return ( buff.toString() );
}
public void dump()
{
System.out.println( toString() );
}
public void dumpExtensions()
{
System.out.println( "OpenGL Extensions:" );
for ( int i = 0; i < EXTENSIONS.length; i++ )
{
System.out.println( EXTENSIONS[ i ] );
}
}
private static int composeNormalizedVersion( int major, int minor, int revision )
{
int normVersion = revision + ( minor * 10000 ) + ( major * 10000 * 100 );
return ( normVersion );
}
public OpenGLInfo( String renderer, String version, String vendor, String extensions )
{
this.RENDERER = renderer;
this.VERSION = version;
this.VENDOR = vendor;
this.KNOWN_VENDOR = KnownVendor.getKnownVendor( vendor );
this.EXTENSIONS = extensions.split( " " );
int p = VERSION.indexOf( ' ' );
String[] ver = ( p > -1 ? VERSION.substring( 0, p ) : VERSION ).split( "\\." );
this.VERSION_MAJOR = Integer.parseInt( ver[ 0 ] );
this.VERSION_MINOR = ( ver.length > 1 ) ? Integer.parseInt( ver[ 1 ] ) : 0;
this.VERSION_REVISION = ( ver.length > 2 ) ? Integer.parseInt( ver[ 2 ] ) : 0;
this.NORM_VERSION = composeNormalizedVersion( VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION );
this.EXT_HASHES = new int[ EXTENSIONS.length ];
for ( int i = 0; i < EXTENSIONS.length; i++ )
{
EXT_HASHES[ i ] = EXTENSIONS[ i ].hashCode();
}
Arrays.sort( EXT_HASHES );
}
}
| 6,842 | 0.604349 | 0.593549 | 208 | 31.942308 | 27.37957 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.600962 | false | false | 2 |
4e88d61d5ea75b72273642093a7b37e4b1a43188 | 6,485,400,623,560 | 3131e524a962e62ef1b1cf66bd91abfbad2b49ad | /src/main/java/com/aimprosoft/camed/compiler/extensions/AllowedExtensions.java | e161467c3fcb183c1c5fbd5d9640d3eac359091f | [] | no_license | mikleee/camed | https://github.com/mikleee/camed | 7efb4a4fb19fe4d62df6a575f814bb6f9cea28c1 | 2d8795cafdbd0d15783ccb11cc4d12a3b031a8a5 | refs/heads/master | 2021-01-17T07:08:24.573000 | 2015-03-02T18:51:34 | 2015-03-02T18:51:34 | 30,844,663 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.aimprosoft.camed.compiler.extensions;
import java.lang.reflect.Constructor;
import java.util.Collection;
import java.util.HashMap;
import org.jdom.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author 802051682
*
*/
public class AllowedExtensions {
static Logger logger = LoggerFactory.getLogger(AllowedExtensions.class);
static HashMap<String,IExtension> extensions = new HashMap<String, IExtension>();
public static IExtension allocateExtension(String name,Element element){
try {
Class<?> cls = Class.forName(name);
Class<?> partypes[] = new Class[1];
partypes[0] = Element.class;
Constructor<?> ct = cls.getConstructor(partypes);
Object arglist[] = new Object[1];
arglist[0] = element;
Object retObj = ct.newInstance(arglist);
if (retObj instanceof IExtension){
extensions.put(name, (IExtension) retObj);
return (IExtension) retObj;
}
} catch (Exception e) {
logger.warn("Unable allocate extensions", e);
return null;
}
return null;
}
public static IExtension getExtension(String name){
if (extensions.get(name) == null){
return allocateExtension(name, null);
}
return extensions.get(name);
}
public static Collection<IExtension> getExtensions(){
return extensions.values();
}
public static void dispose(){
for (IExtension ext: getExtensions()){
ext.dispose();
}
}
}
| UTF-8 | Java | 1,427 | java | AllowedExtensions.java | Java | [
{
"context": ";\nimport org.slf4j.LoggerFactory;\n\n/**\n * @author 802051682\n *\n */\npublic class AllowedExtensions {\n\n\tstatic ",
"end": 252,
"score": 0.9955489635467529,
"start": 243,
"tag": "USERNAME",
"value": "802051682"
}
] | null | [] | package com.aimprosoft.camed.compiler.extensions;
import java.lang.reflect.Constructor;
import java.util.Collection;
import java.util.HashMap;
import org.jdom.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author 802051682
*
*/
public class AllowedExtensions {
static Logger logger = LoggerFactory.getLogger(AllowedExtensions.class);
static HashMap<String,IExtension> extensions = new HashMap<String, IExtension>();
public static IExtension allocateExtension(String name,Element element){
try {
Class<?> cls = Class.forName(name);
Class<?> partypes[] = new Class[1];
partypes[0] = Element.class;
Constructor<?> ct = cls.getConstructor(partypes);
Object arglist[] = new Object[1];
arglist[0] = element;
Object retObj = ct.newInstance(arglist);
if (retObj instanceof IExtension){
extensions.put(name, (IExtension) retObj);
return (IExtension) retObj;
}
} catch (Exception e) {
logger.warn("Unable allocate extensions", e);
return null;
}
return null;
}
public static IExtension getExtension(String name){
if (extensions.get(name) == null){
return allocateExtension(name, null);
}
return extensions.get(name);
}
public static Collection<IExtension> getExtensions(){
return extensions.values();
}
public static void dispose(){
for (IExtension ext: getExtensions()){
ext.dispose();
}
}
}
| 1,427 | 0.701472 | 0.69096 | 60 | 22.783333 | 21.553106 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.816667 | false | false | 2 |
6ba2b37f49e83c5e29232a988035032ee160ecbf | 6,751,688,620,038 | 6d047b0ad4f8fb4c28d69b733f73d562da390fb8 | /src/main/java/com/sy/hting/quartz/Demo.java | 9f841c64530dec89c3f7a34cda0dca54184edf19 | [] | no_license | org-clrvn/hanting | https://github.com/org-clrvn/hanting | e397e581eba2d0c152c766fcb6d44039c5667313 | 9ebc7c93e2ac457dbd34b419dbda1caa8f326379 | refs/heads/master | 2020-04-30T14:01:31.201000 | 2019-05-18T01:58:42 | 2019-05-18T01:58:42 | 176,876,537 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sy.hting.quartz;
public class Demo {
public static void main(String[] args) {
/*// 1.
JobDetail jd = JobBuilder.newJob(MyJob.class).withIdentity("job1", "g1").build();
// 2.
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity("t1", "g1")
.withSchedule(CronScheduleBuilder.cronSchedule("0/5 * * * * ?")).build();
//3.
StdSchedulerFactory ssf=new StdSchedulerFactory();
try {
//调度器
Scheduler s=ssf.getScheduler();
s.scheduleJob(jd, trigger);//调度任务(追加)
s.start();
} catch (SchedulerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
}
}
| UTF-8 | Java | 645 | java | Demo.java | Java | [] | null | [] | package com.sy.hting.quartz;
public class Demo {
public static void main(String[] args) {
/*// 1.
JobDetail jd = JobBuilder.newJob(MyJob.class).withIdentity("job1", "g1").build();
// 2.
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity("t1", "g1")
.withSchedule(CronScheduleBuilder.cronSchedule("0/5 * * * * ?")).build();
//3.
StdSchedulerFactory ssf=new StdSchedulerFactory();
try {
//调度器
Scheduler s=ssf.getScheduler();
s.scheduleJob(jd, trigger);//调度任务(追加)
s.start();
} catch (SchedulerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
}
}
| 645 | 0.660287 | 0.645933 | 25 | 24.08 | 25.2316 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.12 | false | false | 2 |
5c22b2c5923d214de9cb3c8dc927ea6c4f696447 | 14,714,557,962,724 | aa03c9fe794a6893e6d078ef2109d7bc50aed255 | /javax/mail/event/FolderEvent.java | 2157593a48a769eb5c2aec19b44d73f4cd6b393e | [
"MIT"
] | permissive | CoOwner/StaffAuth | https://github.com/CoOwner/StaffAuth | 7f5a5c85b35132159875bdf4d04285c03ba65bb6 | 0f7abd4f6b10f36a2de8bb732bca19f4c101e644 | refs/heads/master | 2022-09-14T04:39:25.652000 | 2020-05-25T15:46:15 | 2020-05-25T15:46:15 | 266,816,879 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package javax.mail.event;
import javax.mail.*;
public class FolderEvent extends MailEvent
{
public static final int CREATED = 1;
public static final int DELETED = 2;
public static final int RENAMED = 3;
protected int type;
protected transient Folder folder;
protected transient Folder newFolder;
private static final long serialVersionUID = 5278131310563694307L;
public FolderEvent(final Object source, final Folder folder, final int type) {
this(source, folder, folder, type);
}
public FolderEvent(final Object source, final Folder oldFolder, final Folder newFolder, final int type) {
super(source);
this.folder = oldFolder;
this.newFolder = newFolder;
this.type = type;
}
public int getType() {
return this.type;
}
public Folder getFolder() {
return this.folder;
}
public Folder getNewFolder() {
return this.newFolder;
}
public void dispatch(final Object listener) {
if (this.type == 1) {
((FolderListener)listener).folderCreated(this);
}
else if (this.type == 2) {
((FolderListener)listener).folderDeleted(this);
}
else if (this.type == 3) {
((FolderListener)listener).folderRenamed(this);
}
}
}
| UTF-8 | Java | 1,355 | java | FolderEvent.java | Java | [] | null | [] | package javax.mail.event;
import javax.mail.*;
public class FolderEvent extends MailEvent
{
public static final int CREATED = 1;
public static final int DELETED = 2;
public static final int RENAMED = 3;
protected int type;
protected transient Folder folder;
protected transient Folder newFolder;
private static final long serialVersionUID = 5278131310563694307L;
public FolderEvent(final Object source, final Folder folder, final int type) {
this(source, folder, folder, type);
}
public FolderEvent(final Object source, final Folder oldFolder, final Folder newFolder, final int type) {
super(source);
this.folder = oldFolder;
this.newFolder = newFolder;
this.type = type;
}
public int getType() {
return this.type;
}
public Folder getFolder() {
return this.folder;
}
public Folder getNewFolder() {
return this.newFolder;
}
public void dispatch(final Object listener) {
if (this.type == 1) {
((FolderListener)listener).folderCreated(this);
}
else if (this.type == 2) {
((FolderListener)listener).folderDeleted(this);
}
else if (this.type == 3) {
((FolderListener)listener).folderRenamed(this);
}
}
}
| 1,355 | 0.619188 | 0.600738 | 49 | 26.653061 | 23.334787 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 2 |
2bc2377061647f23cf74724d25c546df7ca45d88 | 14,645,838,494,297 | 9707d02c0c36d8e42850f37c7acc85c8d3f8a2d2 | /src/main/java/com/examw/netplatform/dao/admin/security/MenuRightMapper.java | 9f430033c313f2df5f5e7fdedb4fe37d6b7a0670 | [] | no_license | jeasonyoung/examw-netplatform | https://github.com/jeasonyoung/examw-netplatform | f5464a46e5de29b1bf70833db66134485bdd7054 | e8b2b7e76ee2af7aaec99c372e20e01dfe240618 | refs/heads/master | 2021-01-23T19:13:39.613000 | 2015-10-07T05:54:22 | 2015-10-07T05:54:22 | 22,415,058 | 1 | 7 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.examw.netplatform.dao.admin.security;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.examw.netplatform.domain.admin.security.MenuPermission;
import com.examw.netplatform.domain.admin.security.MenuRight;
/**
* 菜单权限数据访问接口。
* @author yangyong.
* @since 2014-05-04.
*/
public interface MenuRightMapper {
/**
* 获取菜单权限数据。
* @param menuRightId
* @return
*/
MenuRight getMenuRight(String menuRightId);
/**
* 加载菜单权限数据。
* @param menuId
* 菜单ID。
* @param rightId
* 权限ID。
* @return
* 菜单权限数据。
*/
MenuRight loadMenuRight(@Param("menuId")String menuId, @Param("rightId")String rightId);
/**
* 查询数据。
* @param info
* 查询条件。
* @return
* 查询结果。
*/
List<MenuRight> findMenuRights(MenuRight info);
/**
* 查询全部菜单及其权限集合。
* @return
*/
List<MenuPermission> findMenuPermissions(MenuRight info);
/**
* 加载用户的菜单权限。
* @param userId
* @return
*/
List<MenuRight> findMenuPermissionsByUser(String userId);
/**
* 查询角色下的菜单权限集合。
* @param roleId
* @return
*/
List<MenuRight> findMenuRightsByRole(String roleId);
/**
* 插入菜单权限数据。
* @param data
*/
void insertMenuRight(MenuRight data);
/**
* 更新菜单权限数据。
* @param data
*/
void updateMenuRight(MenuRight data);
/**
* 删除菜单权限数据。
* @param id
*/
void deleteMenuRight(String id);
} | UTF-8 | Java | 1,563 | java | MenuRightMapper.java | Java | [
{
"context": "security.MenuRight;\n\n/**\n * 菜单权限数据访问接口。\n * @author yangyong.\n * @since 2014-05-04.\n */\npublic interface MenuR",
"end": 288,
"score": 0.9995684623718262,
"start": 280,
"tag": "USERNAME",
"value": "yangyong"
}
] | null | [] | package com.examw.netplatform.dao.admin.security;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.examw.netplatform.domain.admin.security.MenuPermission;
import com.examw.netplatform.domain.admin.security.MenuRight;
/**
* 菜单权限数据访问接口。
* @author yangyong.
* @since 2014-05-04.
*/
public interface MenuRightMapper {
/**
* 获取菜单权限数据。
* @param menuRightId
* @return
*/
MenuRight getMenuRight(String menuRightId);
/**
* 加载菜单权限数据。
* @param menuId
* 菜单ID。
* @param rightId
* 权限ID。
* @return
* 菜单权限数据。
*/
MenuRight loadMenuRight(@Param("menuId")String menuId, @Param("rightId")String rightId);
/**
* 查询数据。
* @param info
* 查询条件。
* @return
* 查询结果。
*/
List<MenuRight> findMenuRights(MenuRight info);
/**
* 查询全部菜单及其权限集合。
* @return
*/
List<MenuPermission> findMenuPermissions(MenuRight info);
/**
* 加载用户的菜单权限。
* @param userId
* @return
*/
List<MenuRight> findMenuPermissionsByUser(String userId);
/**
* 查询角色下的菜单权限集合。
* @param roleId
* @return
*/
List<MenuRight> findMenuRightsByRole(String roleId);
/**
* 插入菜单权限数据。
* @param data
*/
void insertMenuRight(MenuRight data);
/**
* 更新菜单权限数据。
* @param data
*/
void updateMenuRight(MenuRight data);
/**
* 删除菜单权限数据。
* @param id
*/
void deleteMenuRight(String id);
} | 1,563 | 0.671958 | 0.665911 | 72 | 17.388889 | 18.486147 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.986111 | false | false | 2 |
1937ff9b0588e2dbbbf3d9b9b6501e49ed3d7ac8 | 4,569,845,220,002 | 157d84f8aafc76ba9ea0dbbf08ede744966b4250 | /code/implementation/register/src/main/java/io/cattle/platform/register/auth/RegistrationAuthTokenManager.java | 59ac607442433c0076d39957ae3e31261b548491 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | rancher/cattle | https://github.com/rancher/cattle | 81d165a0339a41950561fe534c7529ec74203c56 | 82d154a53f4089fecfb9f320caad826bb4f6055f | refs/heads/v1.6 | 2023-08-27T20:19:31.989000 | 2020-05-01T18:15:55 | 2020-05-01T20:11:28 | 18,023,059 | 487 | 233 | Apache-2.0 | false | 2022-01-03T18:07:33 | 2014-03-23T00:19:52 | 2022-01-03T18:07:13 | 2022-01-03T18:07:31 | 32,707 | 578 | 192 | 0 | Java | false | false | package io.cattle.platform.register.auth;
import io.cattle.platform.core.model.Account;
public interface RegistrationAuthTokenManager {
Account validateToken(String token);
}
| UTF-8 | Java | 183 | java | RegistrationAuthTokenManager.java | Java | [] | null | [] | package io.cattle.platform.register.auth;
import io.cattle.platform.core.model.Account;
public interface RegistrationAuthTokenManager {
Account validateToken(String token);
}
| 183 | 0.803279 | 0.803279 | 9 | 19.333334 | 21.478672 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 2 |
e190e878a51cebee179e5e715b4dd0b7ef0cc48b | 26,594,437,551,326 | f7c0c95653224b87df2ca26eeaf25b9d2c0100bb | /src/main/java/com/bankaccont/repository/AccountConfiguration.java | 4bdc961dbe32830f83efe1132dec4b75637e45c0 | [] | no_license | ZaimJ/bankaccount | https://github.com/ZaimJ/bankaccount | 8a33d4a859477ac49258aa0c8144862c7700345d | e9feb8b265748c8aaf768825a12a363dce112314 | refs/heads/master | 2022-11-02T15:26:45.865000 | 2019-07-12T12:06:52 | 2019-07-12T12:06:52 | 193,900,883 | 1 | 0 | null | false | 2022-09-22T18:46:49 | 2019-06-26T12:33:48 | 2019-07-12T12:07:17 | 2022-09-22T18:46:47 | 153 | 1 | 0 | 1 | Java | false | false | package com.bankaccont.repository;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@Configuration
@ComponentScan
@EnableJpaRepositories("com.bankaccont.repository")
public class AccountConfiguration {
}
| UTF-8 | Java | 357 | java | AccountConfiguration.java | Java | [] | null | [] | package com.bankaccont.repository;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@Configuration
@ComponentScan
@EnableJpaRepositories("com.bankaccont.repository")
public class AccountConfiguration {
}
| 357 | 0.859944 | 0.859944 | 12 | 28.75 | 26.508253 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 2 |
ca62b4746f00ec601317215b358d2c75eb7ccfe0 | 20,830,591,422,404 | e561da685a72a0a4463442525987e795430891c5 | /src/sample/Listener.java | 067f1b5a520a870c1c2409385e755918ebc025f1 | [] | no_license | Ashuid/P2PVoting | https://github.com/Ashuid/P2PVoting | 3cc74b7b7495b4d6a9422f48df159f12fbfd3028 | f8eaa49d2087be7722e1a4692216078c99b74c3c | refs/heads/master | 2016-09-01T10:08:02.327000 | 2015-10-05T11:30:14 | 2015-10-05T11:30:14 | 43,670,783 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sample;
/**
* Created by Mathias on 05/10/2015.
*/
public class Listener {
}
| UTF-8 | Java | 88 | java | Listener.java | Java | [
{
"context": "package sample;\n\n/**\n * Created by Mathias on 05/10/2015.\n */\npublic class Listener {\n}\n",
"end": 42,
"score": 0.9997187852859497,
"start": 35,
"tag": "NAME",
"value": "Mathias"
}
] | null | [] | package sample;
/**
* Created by Mathias on 05/10/2015.
*/
public class Listener {
}
| 88 | 0.659091 | 0.568182 | 7 | 11.571428 | 12.715088 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | false | false | 2 |
bc17554d447a2daf81141c6bd8657226f6a5ae46 | 31,370,441,180,588 | 7d2d35cf42b51123d6f3de337de64e73c3cff002 | /src/java_basics/seven_numbers_and_strings/test/mystringbuffer/MyStringBuffer_new.java | cf2504b08fd47744d87a361551e4e7aab3a0425d | [] | no_license | TinyYu/JavaSE | https://github.com/TinyYu/JavaSE | 4f49a9dda30fe318b7bf97f43911576a069c2720 | 8e90b0a61b6b38e5378a23c2c825d854ae767a5a | refs/heads/master | 2021-05-18T01:01:30.321000 | 2020-04-23T09:42:26 | 2020-04-23T09:42:26 | 251,036,236 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package java_basics.seven_numbers_and_strings.test.mystringbuffer;
public class MyStringBuffer_new implements IStringBuffer{
int capacity = 16;//容量
int length = 0;//长度
char[] value;//字符数组
//分配字符数组空间
public MyStringBuffer_new(){
value = new char[capacity];
}
//有参数构造方法
public MyStringBuffer_new(String str){
this();
if (null == str)
return;
if (capacity < str.length()){
capacity = value.length * 2;//如果容量不够,重新分配容量
length = value.length;//获取字符串长度
}
if (capacity >= str.length()){
System.arraycopy(str.toCharArray(),0,value,0,str.length());//转换为字符数组
}
length = str.length();
}
@Override
public void append(String str) {//追加字符串
insert(length,str);
}
@Override
public void append(char c) {//追加字符
append(String.valueOf(c));
}
@Override
public void insert(int pos, char b) {//插入字符
insert(pos,String.valueOf(b));
}
@Override
public void insert(int pos, String b) {//插入字符串
//边界条件判断
//参数边界不能小于0,不能大于字符串长度,字符串不能为空
if (pos < 0)
return;
if (pos > length)
return;
if (b == null)
return;
//扩容
//如果原始字符串加上插入字符串长度大于容量需要扩容
while (length + b.length() > capacity){
capacity = (int) ((length + b.length()) * 1.5f);
//重新分配字符数组空间
char[] newValue = new char[capacity];
System.arraycopy(value,0,newValue,0,length);//原始数组复制到扩容数组中
value = newValue;//重新分配空间
}
char[] cs = b.toCharArray();//将插入字符串转换为字符数组
//将原始数据向后移
System.arraycopy(value,pos,value,pos + cs.length,length - pos);
//插入指定位置
System.arraycopy(cs,0,value,pos,cs.length);
length = length + cs.length;
}
@Override
public void delete(int start) {//删除字符
delete(start,length);
}
@Override
public void delete(int start, int end) {//删除字符串
//边界条件判断
if (start < 0)
return;
if (start >= end)
return;
if (end < 0)
return;
if (start > length)
return;
System.arraycopy(value,end,value,start,length - end);
length -= end - start;
}
@Override
public void reverse() {//反转
for (int i = 0;i < length / 2;i++){
char c = value[i];
value[i] = value[length - i - 1];
value[length - i - 1] = c;
}
}
@Override
public int length() {
return length;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
| UTF-8 | Java | 3,117 | java | MyStringBuffer_new.java | Java | [] | null | [] | package java_basics.seven_numbers_and_strings.test.mystringbuffer;
public class MyStringBuffer_new implements IStringBuffer{
int capacity = 16;//容量
int length = 0;//长度
char[] value;//字符数组
//分配字符数组空间
public MyStringBuffer_new(){
value = new char[capacity];
}
//有参数构造方法
public MyStringBuffer_new(String str){
this();
if (null == str)
return;
if (capacity < str.length()){
capacity = value.length * 2;//如果容量不够,重新分配容量
length = value.length;//获取字符串长度
}
if (capacity >= str.length()){
System.arraycopy(str.toCharArray(),0,value,0,str.length());//转换为字符数组
}
length = str.length();
}
@Override
public void append(String str) {//追加字符串
insert(length,str);
}
@Override
public void append(char c) {//追加字符
append(String.valueOf(c));
}
@Override
public void insert(int pos, char b) {//插入字符
insert(pos,String.valueOf(b));
}
@Override
public void insert(int pos, String b) {//插入字符串
//边界条件判断
//参数边界不能小于0,不能大于字符串长度,字符串不能为空
if (pos < 0)
return;
if (pos > length)
return;
if (b == null)
return;
//扩容
//如果原始字符串加上插入字符串长度大于容量需要扩容
while (length + b.length() > capacity){
capacity = (int) ((length + b.length()) * 1.5f);
//重新分配字符数组空间
char[] newValue = new char[capacity];
System.arraycopy(value,0,newValue,0,length);//原始数组复制到扩容数组中
value = newValue;//重新分配空间
}
char[] cs = b.toCharArray();//将插入字符串转换为字符数组
//将原始数据向后移
System.arraycopy(value,pos,value,pos + cs.length,length - pos);
//插入指定位置
System.arraycopy(cs,0,value,pos,cs.length);
length = length + cs.length;
}
@Override
public void delete(int start) {//删除字符
delete(start,length);
}
@Override
public void delete(int start, int end) {//删除字符串
//边界条件判断
if (start < 0)
return;
if (start >= end)
return;
if (end < 0)
return;
if (start > length)
return;
System.arraycopy(value,end,value,start,length - end);
length -= end - start;
}
@Override
public void reverse() {//反转
for (int i = 0;i < length / 2;i++){
char c = value[i];
value[i] = value[length - i - 1];
value[length - i - 1] = c;
}
}
@Override
public int length() {
return length;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
| 3,117 | 0.523705 | 0.516722 | 111 | 23.513514 | 18.714962 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.585586 | false | false | 2 |
090e781542a0cb2fee8b678e5c3fe1e11937ec57 | 7,361,573,997,111 | 34f12ee81ba092dcf0229a8fdf7eefc8e01bd83d | /app/src/main/java/com/example/administrator/news/activity/MainActivity.java | 0e55d36dc35cda06a1eeb6f69e21df5265e97bb3 | [] | no_license | zhangsan008/news | https://github.com/zhangsan008/news | 6dc199216eca7192d277da72f3aaf5b79f07e131 | 43fb1fbf8c95a9daaf2b1dc6055ac5d67b305ab0 | refs/heads/master | 2021-01-18T22:48:38.413000 | 2017-04-05T17:18:52 | 2017-04-05T17:18:52 | 87,074,760 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.administrator.news.activity;
import android.os.Bundle;
import com.example.administrator.news.R;
import com.example.administrator.news.utils.DensityUtil;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity;
public class MainActivity extends SlidingFragmentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//设置左侧菜单
setBehindContentView(R.layout.activity_leftmenu);
//设置右侧菜单
SlidingMenu slidingMenu = getSlidingMenu();
slidingMenu.setSecondaryMenu(R.layout.rightmenu);
//设置显示模式:左侧+主页,左侧+主页+右侧,主页+右侧
slidingMenu.setMode(SlidingMenu.LEFT);
//设置滑动模式:边缘滑动,全屏滑动,不可滑动
slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
//设置主页占据的宽度
slidingMenu.setBehindOffset(DensityUtil.dip2px(MainActivity.this,200));
}
}
| UTF-8 | Java | 1,159 | java | MainActivity.java | Java | [] | null | [] | package com.example.administrator.news.activity;
import android.os.Bundle;
import com.example.administrator.news.R;
import com.example.administrator.news.utils.DensityUtil;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity;
public class MainActivity extends SlidingFragmentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//设置左侧菜单
setBehindContentView(R.layout.activity_leftmenu);
//设置右侧菜单
SlidingMenu slidingMenu = getSlidingMenu();
slidingMenu.setSecondaryMenu(R.layout.rightmenu);
//设置显示模式:左侧+主页,左侧+主页+右侧,主页+右侧
slidingMenu.setMode(SlidingMenu.LEFT);
//设置滑动模式:边缘滑动,全屏滑动,不可滑动
slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
//设置主页占据的宽度
slidingMenu.setBehindOffset(DensityUtil.dip2px(MainActivity.this,200));
}
}
| 1,159 | 0.738581 | 0.734694 | 32 | 31.15625 | 25.650425 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.46875 | false | false | 2 |
e895473aa2dffb0cd66c07bf8ebeaad3d261c6e5 | 23,081,154,299,947 | 00b6cb55684b8d6ad527b4f963ed5c588d44094f | /src/test/java/com/feljadue/app/DronInventoryImplTest.java | 2db3e7ae51ab37784deba86f3690eac21dac497e | [] | no_license | fayeljadue/DronDispatcher | https://github.com/fayeljadue/DronDispatcher | 1d96cd66a1f7ac4152b8341e20280cc5500b8dcf | 315fce08808e9678a548838b04dc9bb06672953f | refs/heads/main | 2023-02-17T12:13:08.041000 | 2021-01-19T16:21:56 | 2021-01-19T16:21:56 | 330,714,162 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.feljadue.app;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;
import com.feljadue.app.inventory.DronInventoryImpl;
import com.feljadue.app.inventory.IInventory;
import com.feljadue.app.vehicle.DronVehicle;
import com.feljadue.app.vehicle.IVehicle;
public class DronInventoryImplTest {
static IInventory dronInventory;
@BeforeClass
public static void init() {
dronInventory = new DronInventoryImpl(5);
}
@Test
public void testListVehicules() {
List<Integer> testDrones = new ArrayList<>();
for(int i= 1;i<=5;i++) {
testDrones.add(i);
}
List<Integer> dronesId = new ArrayList<>();
for(IVehicle dronN:dronInventory.listVehicules()) {
dronesId.add(dronN.getVehiculeId());
}
assertEquals("Equals Objects", testDrones,dronesId);
}
@Test
public void testAddVehicule() {
IVehicle dron = new DronVehicle(6);
dronInventory.removeVehicule(5);
dronInventory.addVehicule(dron);
List<Integer> testDrones = new ArrayList<>();
for(int i= 1;i<=3;i++) {
testDrones.add(i);
}
testDrones.add(6);
List<Integer> dronesId = new ArrayList<>();
for(IVehicle dronN:dronInventory.listVehicules()) {
dronesId.add(dronN.getVehiculeId());
}
assertEquals("Equals Objects", testDrones,dronesId);
}
@Test
public void testAddVehicule1() {
IVehicle dron = new DronVehicle(5);
assertEquals("Equals Objects", false,dronInventory.addVehicule(dron));
}
@Test
public void testRemoveVehicule() {
dronInventory.removeVehicule(4);
List<Integer> testDrones = new ArrayList<>();
for(int i= 1;i<=3;i++) {
testDrones.add(i);
}
testDrones.add(5);
List<Integer> dronesId = new ArrayList<>();
for(IVehicle dronN:dronInventory.listVehicules()) {
dronesId.add(dronN.getVehiculeId());
}
assertEquals("Equals Objects", testDrones,dronesId);
}
}
| UTF-8 | Java | 1,932 | java | DronInventoryImplTest.java | Java | [] | null | [] | package com.feljadue.app;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;
import com.feljadue.app.inventory.DronInventoryImpl;
import com.feljadue.app.inventory.IInventory;
import com.feljadue.app.vehicle.DronVehicle;
import com.feljadue.app.vehicle.IVehicle;
public class DronInventoryImplTest {
static IInventory dronInventory;
@BeforeClass
public static void init() {
dronInventory = new DronInventoryImpl(5);
}
@Test
public void testListVehicules() {
List<Integer> testDrones = new ArrayList<>();
for(int i= 1;i<=5;i++) {
testDrones.add(i);
}
List<Integer> dronesId = new ArrayList<>();
for(IVehicle dronN:dronInventory.listVehicules()) {
dronesId.add(dronN.getVehiculeId());
}
assertEquals("Equals Objects", testDrones,dronesId);
}
@Test
public void testAddVehicule() {
IVehicle dron = new DronVehicle(6);
dronInventory.removeVehicule(5);
dronInventory.addVehicule(dron);
List<Integer> testDrones = new ArrayList<>();
for(int i= 1;i<=3;i++) {
testDrones.add(i);
}
testDrones.add(6);
List<Integer> dronesId = new ArrayList<>();
for(IVehicle dronN:dronInventory.listVehicules()) {
dronesId.add(dronN.getVehiculeId());
}
assertEquals("Equals Objects", testDrones,dronesId);
}
@Test
public void testAddVehicule1() {
IVehicle dron = new DronVehicle(5);
assertEquals("Equals Objects", false,dronInventory.addVehicule(dron));
}
@Test
public void testRemoveVehicule() {
dronInventory.removeVehicule(4);
List<Integer> testDrones = new ArrayList<>();
for(int i= 1;i<=3;i++) {
testDrones.add(i);
}
testDrones.add(5);
List<Integer> dronesId = new ArrayList<>();
for(IVehicle dronN:dronInventory.listVehicules()) {
dronesId.add(dronN.getVehiculeId());
}
assertEquals("Equals Objects", testDrones,dronesId);
}
}
| 1,932 | 0.70911 | 0.701863 | 86 | 21.465117 | 19.561291 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.930233 | false | false | 2 |
e4f4b1d77273f47e9e698fd8cdc46ab889c97424 | 21,131,239,147,257 | 1f3d9adcb1b795585c0baf7c34fa017f002eaaca | /src/main/java/com/lrh/train/leetcode/交替打印/FooBar3.java | 0d6c95e15870931744bcbd5d681716a725fb2b12 | [] | no_license | lrhddzyj/concurrent-programming | https://github.com/lrhddzyj/concurrent-programming | 6b1ca16a510c422b09423e68ab120fd56cbf9e86 | 9afa6d41d49be39a281e499104f6987104e21e7b | refs/heads/master | 2023-06-21T07:28:13.092000 | 2020-12-03T01:28:38 | 2020-12-03T01:28:38 | 265,127,942 | 0 | 0 | null | false | 2023-06-14T22:30:34 | 2020-05-19T03:04:12 | 2020-12-03T01:28:50 | 2023-06-14T22:30:34 | 44 | 0 | 0 | 1 | Java | false | false | package com.lrh.train.leetcode.交替打印;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
/**
* @description:
* @author: lrh
* @date: 2020/7/3 17:44
*/
public class FooBar3 {
private volatile int n;
public FooBar3(int n) {
this.n = n;
}
private CyclicBarrier cyclicBarrier = new CyclicBarrier(2);
private CountDownLatch countDownLatch = new CountDownLatch(0);
public void foo(Runnable runnable) {
while (true) {
if(n > 0){
//打印
runnable.run();
countDownLatch.countDown();
try {
cyclicBarrier.await();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}
}
}
public void bar(Runnable runnable) {
while (true) {
if(n > 0){
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
runnable.run();
int newN = n - 1;
if (newN > 0) {
countDownLatch = new CountDownLatch(1);
}
n = newN;
try {
cyclicBarrier.await();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}
}
}
public static void main(String[] args) {
final FooBar3 fooBar3 = new FooBar3(5);
Runnable r1 = () ->{
System.out.print("foo");
};
Runnable r2 = () ->{
System.out.print("bar");
System.out.println();
};
Thread t1 = new Thread(() -> {
fooBar3.foo(r1);
});
Thread t2 = new Thread(() -> {
fooBar3.bar(r2);
});
t1.start();
t2.start();
}
}
| UTF-8 | Java | 1,868 | java | FooBar3.java | Java | [
{
"context": "t.CyclicBarrier;\n\n/**\n * @description:\n * @author: lrh\n * @date: 2020/7/3 17:44\n */\npublic class FooBar3",
"end": 214,
"score": 0.9996635913848877,
"start": 211,
"tag": "USERNAME",
"value": "lrh"
}
] | null | [] | package com.lrh.train.leetcode.交替打印;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
/**
* @description:
* @author: lrh
* @date: 2020/7/3 17:44
*/
public class FooBar3 {
private volatile int n;
public FooBar3(int n) {
this.n = n;
}
private CyclicBarrier cyclicBarrier = new CyclicBarrier(2);
private CountDownLatch countDownLatch = new CountDownLatch(0);
public void foo(Runnable runnable) {
while (true) {
if(n > 0){
//打印
runnable.run();
countDownLatch.countDown();
try {
cyclicBarrier.await();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}
}
}
public void bar(Runnable runnable) {
while (true) {
if(n > 0){
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
runnable.run();
int newN = n - 1;
if (newN > 0) {
countDownLatch = new CountDownLatch(1);
}
n = newN;
try {
cyclicBarrier.await();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}
}
}
public static void main(String[] args) {
final FooBar3 fooBar3 = new FooBar3(5);
Runnable r1 = () ->{
System.out.print("foo");
};
Runnable r2 = () ->{
System.out.print("bar");
System.out.println();
};
Thread t1 = new Thread(() -> {
fooBar3.foo(r1);
});
Thread t2 = new Thread(() -> {
fooBar3.bar(r2);
});
t1.start();
t2.start();
}
}
| 1,868 | 0.545259 | 0.527478 | 99 | 17.747475 | 16.363512 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.343434 | false | false | 2 |
0bca45bfbb2fa49b9d31b6081a19337f5d73b668 | 18,717,467,518,411 | b0f7e380c49406cc2b7cd32f77fff87776d1ef0a | /src/leetcode_tree/E_108.java | 44b7127939a820ae47e2748b1bd1323b20333c5d | [] | no_license | Jackjoily/leetcode | https://github.com/Jackjoily/leetcode | 478bdfdafb1f50bd505b31c900ee9bd7cde02267 | 74a153123b27d4725885bd7704c054334aa5ba6d | refs/heads/main | 2023-07-12T12:17:53.889000 | 2021-08-07T12:17:10 | 2021-08-07T12:17:10 | 307,641,661 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package leetcode_tree;
/**
* 将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。
*
* @author jackjoily
*
*/
public class E_108 {
/**
* 给了一个有序数组,相当于告诉一棵树的中序遍历了,所以此时的树任然是不确定的 ,再给一个限制条件平衡二叉树,这棵树任然可能含有多种情况
*
* @param nums
* @return
*/
public TreeNode sortedArrayToBST(int[] nums) {
return createNode(0, nums.length - 1, nums);
}
/**
* 至于这里为什么是二叉平衡树,在1382 官方题解中有正确性好的证明
* @param low
* @param high
* @param num
* @return
*/
// 这也是一种分治法的体现,与前面(前序,中序)以及(中序,后序)建立二叉树是同样的思想
public TreeNode createNode(int low, int high, int[] num) {
if (low > high) {
return null;
}
int mid = (low + high) / 2;
TreeNode root = new TreeNode(num[mid]);
root.left = createNode(low, mid - 1, num);
root.right = createNode(mid + 1, high, num);
return root;
}
}
| UTF-8 | Java | 1,147 | java | E_108.java | Java | [
{
"context": " * 将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。\r\n * \r\n * @author jackjoily\r\n *\r\n */\r\npublic class E_108 {\r\n\t/**\r\n\t * 给了一个有序数",
"end": 91,
"score": 0.9991440773010254,
"start": 82,
"tag": "USERNAME",
"value": "jackjoily"
}
] | null | [] | package leetcode_tree;
/**
* 将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。
*
* @author jackjoily
*
*/
public class E_108 {
/**
* 给了一个有序数组,相当于告诉一棵树的中序遍历了,所以此时的树任然是不确定的 ,再给一个限制条件平衡二叉树,这棵树任然可能含有多种情况
*
* @param nums
* @return
*/
public TreeNode sortedArrayToBST(int[] nums) {
return createNode(0, nums.length - 1, nums);
}
/**
* 至于这里为什么是二叉平衡树,在1382 官方题解中有正确性好的证明
* @param low
* @param high
* @param num
* @return
*/
// 这也是一种分治法的体现,与前面(前序,中序)以及(中序,后序)建立二叉树是同样的思想
public TreeNode createNode(int low, int high, int[] num) {
if (low > high) {
return null;
}
int mid = (low + high) / 2;
TreeNode root = new TreeNode(num[mid]);
root.left = createNode(low, mid - 1, num);
root.right = createNode(mid + 1, high, num);
return root;
}
}
| 1,147 | 0.602203 | 0.587515 | 38 | 19.5 | 18.572405 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.210526 | false | false | 2 |
65592fbd9eccd19cc3a3600933e2dca87063783e | 7,438,883,419,592 | 8f4eff9124211b2a3daf9172fdaeebe936dc71ff | /src/com/geruman/chocolates/ChocolateRocklets.java | bd07cb4aba9fa4ecfd51bcd1f679ce87514a9176 | [] | no_license | geruman/4_Abstract_factory | https://github.com/geruman/4_Abstract_factory | c05df27bb471e1cf42cff5ba3efcc4e097713813 | 7f44e11c9fecae12528ab57028768c6d8d549441 | refs/heads/master | 2023-08-28T09:33:13.726000 | 2021-11-09T02:42:28 | 2021-11-09T02:42:28 | 423,646,902 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.geruman.chocolates;
public class ChocolateRocklets implements Chocolate {
@Override
public String agarrar() {
return "no se derrite en tu mano";
}
@Override
public String degustar() {
return "crunchy crunchy chocolato!";
}
}
| UTF-8 | Java | 251 | java | ChocolateRocklets.java | Java | [] | null | [] | package com.geruman.chocolates;
public class ChocolateRocklets implements Chocolate {
@Override
public String agarrar() {
return "no se derrite en tu mano";
}
@Override
public String degustar() {
return "crunchy crunchy chocolato!";
}
}
| 251 | 0.729084 | 0.729084 | 15 | 15.733334 | 17.148243 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.866667 | false | false | 2 |
d6243e9aaac1ffa1abc40646147fc0ab8ce41b9c | 21,260,088,152,678 | 8ea9f803170bd4e0058228c95629a3ea85dc44a6 | /src/main/java/ifer/web/shopping/repo/ShopitemRepoImpl.java | d0f7c0ee4a437a72460b659a327f33b0f02f0e57 | [] | no_license | ifer/ShoppingListService | https://github.com/ifer/ShoppingListService | d210073e39cb78d38508074d431fb9e28b98e35a | 695f333a5fcc625335d5d526fd0937762e8fab1e | refs/heads/master | 2021-05-21T19:57:29.064000 | 2020-04-24T05:44:53 | 2020-04-24T05:44:53 | 252,779,642 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ifer.web.shopping.repo;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import ifer.web.shopping.db.Category;
import ifer.web.shopping.db.Product;
import ifer.web.shopping.db.Shopitem;
import ifer.web.shopping.form.ShopitemForm;
import ifer.web.shopping.util.DataException;
import ifer.web.shopping.util.ShoppingListConstants;
public class ShopitemRepoImpl implements ShopitemRepoCustom {
@Autowired
private ShopitemRepo shopitemRepo;
@Autowired
private ProductRepo productRepo;
@Override
@Transactional(rollbackFor = Exception.class)
public Shopitem addOrUpdateShopitem(ShopitemForm shopitemform) throws DataException {
Shopitem shopitem;
if (shopitemform.getItemid() == null || shopitemform.getItemid() == 0){
if (shopitemform.getProdid() == null) {
throw new DataException (ShoppingListConstants.ProductIdNotFound);
}
Product product;
Optional<Product> optProd = productRepo.findById(shopitemform.getProdid());
if (optProd.isPresent()) {
product = optProd.get();
}
else {
throw new DataException (ShoppingListConstants.ProductIdNotFound + " " + shopitemform.getProdid());
}
shopitem = new Shopitem();
shopitem.setProduct(product);
}
else {
Optional<Shopitem> optShop = shopitemRepo.findById(shopitemform.getItemid());
if (optShop.isPresent()) {
shopitem = optShop.get();
}
else {
throw new DataException (ShoppingListConstants.ShopitemIdNotFound + " " + shopitemform.getItemid());
}
}
shopitem = shopitemform.toShopitem(shopitem);
shopitem = shopitemRepo.save(shopitem);
return (shopitem);
}
@Transactional(rollbackFor = Exception.class)
public void addShopitemList (List<ShopitemForm> shopitemsList) throws DataException {
for (ShopitemForm sf : shopitemsList) {
this.addOrUpdateShopitem(sf);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteShopitem(Integer itemid) throws DataException {
Shopitem shopitem;
Optional<Shopitem> optProd = shopitemRepo.findById(itemid);
if (optProd.isPresent()) {
shopitem = optProd.get();
}
else {
throw new DataException (ShoppingListConstants.ShopitemIdNotFound + " " + itemid);
}
shopitemRepo.delete(shopitem);
}
@Transactional(rollbackFor = Exception.class)
public void deleteShopitemList (List<ShopitemForm> shopitemsList) throws DataException {
for (ShopitemForm sf : shopitemsList) {
this.deleteShopitem(sf.getItemid());
}
}
}
| UTF-8 | Java | 2,619 | java | ShopitemRepoImpl.java | Java | [] | null | [] | package ifer.web.shopping.repo;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import ifer.web.shopping.db.Category;
import ifer.web.shopping.db.Product;
import ifer.web.shopping.db.Shopitem;
import ifer.web.shopping.form.ShopitemForm;
import ifer.web.shopping.util.DataException;
import ifer.web.shopping.util.ShoppingListConstants;
public class ShopitemRepoImpl implements ShopitemRepoCustom {
@Autowired
private ShopitemRepo shopitemRepo;
@Autowired
private ProductRepo productRepo;
@Override
@Transactional(rollbackFor = Exception.class)
public Shopitem addOrUpdateShopitem(ShopitemForm shopitemform) throws DataException {
Shopitem shopitem;
if (shopitemform.getItemid() == null || shopitemform.getItemid() == 0){
if (shopitemform.getProdid() == null) {
throw new DataException (ShoppingListConstants.ProductIdNotFound);
}
Product product;
Optional<Product> optProd = productRepo.findById(shopitemform.getProdid());
if (optProd.isPresent()) {
product = optProd.get();
}
else {
throw new DataException (ShoppingListConstants.ProductIdNotFound + " " + shopitemform.getProdid());
}
shopitem = new Shopitem();
shopitem.setProduct(product);
}
else {
Optional<Shopitem> optShop = shopitemRepo.findById(shopitemform.getItemid());
if (optShop.isPresent()) {
shopitem = optShop.get();
}
else {
throw new DataException (ShoppingListConstants.ShopitemIdNotFound + " " + shopitemform.getItemid());
}
}
shopitem = shopitemform.toShopitem(shopitem);
shopitem = shopitemRepo.save(shopitem);
return (shopitem);
}
@Transactional(rollbackFor = Exception.class)
public void addShopitemList (List<ShopitemForm> shopitemsList) throws DataException {
for (ShopitemForm sf : shopitemsList) {
this.addOrUpdateShopitem(sf);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteShopitem(Integer itemid) throws DataException {
Shopitem shopitem;
Optional<Shopitem> optProd = shopitemRepo.findById(itemid);
if (optProd.isPresent()) {
shopitem = optProd.get();
}
else {
throw new DataException (ShoppingListConstants.ShopitemIdNotFound + " " + itemid);
}
shopitemRepo.delete(shopitem);
}
@Transactional(rollbackFor = Exception.class)
public void deleteShopitemList (List<ShopitemForm> shopitemsList) throws DataException {
for (ShopitemForm sf : shopitemsList) {
this.deleteShopitem(sf.getItemid());
}
}
}
| 2,619 | 0.743795 | 0.743414 | 96 | 26.28125 | 27.56723 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.010417 | false | false | 2 |
addeef78fce6d26b61bbfd0aec70bb6b699de40b | 4,896,262,759,211 | c3bac395c86ce8f25ed730e47182ec9b7b1cd6a0 | /app/src/main/java/com/example/fooddelivery/Fragments/BasketFragment.java | 11cd67d83cc95ddce8368ae6df6d92d91e4ed359 | [] | no_license | KudaibergenAbdyldaev/Product-Delivery | https://github.com/KudaibergenAbdyldaev/Product-Delivery | 0354d7f02c1e6e2de701e4f0a0520e14094d89e4 | e20e7111428c6a01343212a280bf96a692ddb7ce | refs/heads/master | 2020-09-30T11:25:54.020000 | 2020-04-26T17:14:00 | 2020-04-26T17:14:00 | 227,278,889 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.fooddelivery.Fragments;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.fooddelivery.Adapter.BasketAdapter;
import com.example.fooddelivery.Models.AddToBasket;
import com.example.fooddelivery.Models.UserInfo;
import com.example.fooddelivery.R;
import com.firebase.ui.auth.data.model.User;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BasketFragment extends Fragment implements BasketAdapter.OnItemClickListener {
private RecyclerView recyclerView;
private FirebaseStorage firebaseStorage;
private DatabaseReference databaseReference;
private ValueEventListener mDBListener;
private List<AddToBasket> addToBasketsList = new ArrayList<>();
FirebaseUser user;
TextView title,amount,price;
ImageView imageView;
Button button_order;
final String[] addressToDeliver = new String[1];
final String[] clientName = new String[1];
final String[] clientPhone = new String[1];
BasketAdapter adapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_basket, container, false);
Toolbar toolbar = view.findViewById(R.id.toolbar);
((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
((AppCompatActivity)getActivity()).setTitle("Оформить заказ");
recyclerView =(RecyclerView) view.findViewById(R.id.recycler_view_basket);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
adapter = new BasketAdapter(getContext(), addToBasketsList);
adapter.setOnItemClickListener(BasketFragment.this);
recyclerView.setAdapter(adapter);
user = FirebaseAuth.getInstance().getCurrentUser();
firebaseStorage = FirebaseStorage.getInstance();
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
databaseReference = FirebaseDatabase.getInstance().getReference("uploads").child("basket").child(user.getUid());
title = (TextView) view.findViewById(R.id.title_basket);
amount = (TextView) view.findViewById(R.id.txt_count);
price = (TextView) view.findViewById(R.id.price_basket);
imageView = (ImageView) view.findViewById(R.id.img_basket);
button_order=(Button) view.findViewById(R.id.btn_order);
button_order.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
orderNow();
}
});
{
final DatabaseReference reference = FirebaseDatabase
.getInstance()
.getReference("Users")
.child(user.getUid());
reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
UserInfo userInfo = dataSnapshot.getValue(UserInfo.class);
addressToDeliver[0] = userInfo.getAddress();
clientName[0] = userInfo.getUsername();
clientPhone[0] = userInfo.getPhone();
getFirstCategory(addressToDeliver[0], clientName[0], clientPhone[0]);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
return view;
}
private void orderNow() {
final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Order");
AddToBasket basket = new AddToBasket();
reference.child(user.getUid())
.setValue(addToBasketsList, basket.getClientName())
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
FirebaseUser user= FirebaseAuth.getInstance().getCurrentUser();
DatabaseReference mPostReference = FirebaseDatabase.getInstance().getReference("uploads")
.child("basket").child(user.getUid());
mPostReference.removeValue();
Toast.makeText(getActivity(), "Блюдо заказано", Toast.LENGTH_SHORT).show();
}
});
}
private void getFirstCategory(final String address, final String name, final String phone){
mDBListener = databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
addToBasketsList.clear();
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
AddToBasket addToBasket = postSnapshot.getValue(AddToBasket.class);
{
addToBasket.setAddressToDeliver(address);
addToBasket.setClientName(name);
addToBasket.setClientPhone(phone);
addToBasket.setAmount("1");
}
addToBasket.setKey(postSnapshot.getKey());
addToBasketsList.add(addToBasket);
}
adapter.notifyDataSetChanged();
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
setHasOptionsMenu(true);
super.onCreate(savedInstanceState);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.close_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if(id == R.id.delete_item){
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onItemClick(int position) {
Toast.makeText(getActivity(), "Normal click at position: " + position, Toast.LENGTH_SHORT).show();
}
@Override
public void onDeleteClick(int position) {
AddToBasket selectedItem = addToBasketsList.get(position);
final String selectedKey = selectedItem.getKey();
databaseReference.child(selectedKey).removeValue();
}
@Override
public void onDestroy() {
super.onDestroy();
databaseReference.removeEventListener(mDBListener);
}
}
| UTF-8 | Java | 8,322 | java | BasketFragment.java | Java | [] | null | [] | package com.example.fooddelivery.Fragments;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.fooddelivery.Adapter.BasketAdapter;
import com.example.fooddelivery.Models.AddToBasket;
import com.example.fooddelivery.Models.UserInfo;
import com.example.fooddelivery.R;
import com.firebase.ui.auth.data.model.User;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BasketFragment extends Fragment implements BasketAdapter.OnItemClickListener {
private RecyclerView recyclerView;
private FirebaseStorage firebaseStorage;
private DatabaseReference databaseReference;
private ValueEventListener mDBListener;
private List<AddToBasket> addToBasketsList = new ArrayList<>();
FirebaseUser user;
TextView title,amount,price;
ImageView imageView;
Button button_order;
final String[] addressToDeliver = new String[1];
final String[] clientName = new String[1];
final String[] clientPhone = new String[1];
BasketAdapter adapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_basket, container, false);
Toolbar toolbar = view.findViewById(R.id.toolbar);
((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
((AppCompatActivity)getActivity()).setTitle("Оформить заказ");
recyclerView =(RecyclerView) view.findViewById(R.id.recycler_view_basket);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
adapter = new BasketAdapter(getContext(), addToBasketsList);
adapter.setOnItemClickListener(BasketFragment.this);
recyclerView.setAdapter(adapter);
user = FirebaseAuth.getInstance().getCurrentUser();
firebaseStorage = FirebaseStorage.getInstance();
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
databaseReference = FirebaseDatabase.getInstance().getReference("uploads").child("basket").child(user.getUid());
title = (TextView) view.findViewById(R.id.title_basket);
amount = (TextView) view.findViewById(R.id.txt_count);
price = (TextView) view.findViewById(R.id.price_basket);
imageView = (ImageView) view.findViewById(R.id.img_basket);
button_order=(Button) view.findViewById(R.id.btn_order);
button_order.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
orderNow();
}
});
{
final DatabaseReference reference = FirebaseDatabase
.getInstance()
.getReference("Users")
.child(user.getUid());
reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
UserInfo userInfo = dataSnapshot.getValue(UserInfo.class);
addressToDeliver[0] = userInfo.getAddress();
clientName[0] = userInfo.getUsername();
clientPhone[0] = userInfo.getPhone();
getFirstCategory(addressToDeliver[0], clientName[0], clientPhone[0]);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
return view;
}
private void orderNow() {
final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Order");
AddToBasket basket = new AddToBasket();
reference.child(user.getUid())
.setValue(addToBasketsList, basket.getClientName())
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
FirebaseUser user= FirebaseAuth.getInstance().getCurrentUser();
DatabaseReference mPostReference = FirebaseDatabase.getInstance().getReference("uploads")
.child("basket").child(user.getUid());
mPostReference.removeValue();
Toast.makeText(getActivity(), "Блюдо заказано", Toast.LENGTH_SHORT).show();
}
});
}
private void getFirstCategory(final String address, final String name, final String phone){
mDBListener = databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
addToBasketsList.clear();
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
AddToBasket addToBasket = postSnapshot.getValue(AddToBasket.class);
{
addToBasket.setAddressToDeliver(address);
addToBasket.setClientName(name);
addToBasket.setClientPhone(phone);
addToBasket.setAmount("1");
}
addToBasket.setKey(postSnapshot.getKey());
addToBasketsList.add(addToBasket);
}
adapter.notifyDataSetChanged();
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
setHasOptionsMenu(true);
super.onCreate(savedInstanceState);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.close_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if(id == R.id.delete_item){
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onItemClick(int position) {
Toast.makeText(getActivity(), "Normal click at position: " + position, Toast.LENGTH_SHORT).show();
}
@Override
public void onDeleteClick(int position) {
AddToBasket selectedItem = addToBasketsList.get(position);
final String selectedKey = selectedItem.getKey();
databaseReference.child(selectedKey).removeValue();
}
@Override
public void onDestroy() {
super.onDestroy();
databaseReference.removeEventListener(mDBListener);
}
}
| 8,322 | 0.64501 | 0.643804 | 219 | 35.881279 | 28.350941 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.598173 | false | false | 2 |
f4703d220208070f616f0f1801fd1d152295e9e0 | 10,118,943,018,902 | b1c81b8caa41978c662c5e978b67741f6e1acbcd | /java/interfaceTest2/MyInterface.java | 7e01bf519faf4d8f2c967976921c85abfc9025fe | [] | no_license | mmammel/projects | https://github.com/mmammel/projects | 6e254444664d13a3f8fbd9c01037d37c6e3c010b | f78c8fc7f00ad4fdbd458afa890f5d271a7d9b1d | refs/heads/master | 2023-09-03T22:52:55.198000 | 2023-08-16T18:24:29 | 2023-08-16T18:24:29 | 5,439,201 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public interface MyInterface
{
public enum Status
{
STATE1,
STATE2,
STATE3
}
public void doSomething();
}
| UTF-8 | Java | 129 | java | MyInterface.java | Java | [] | null | [] | public interface MyInterface
{
public enum Status
{
STATE1,
STATE2,
STATE3
}
public void doSomething();
}
| 129 | 0.627907 | 0.604651 | 13 | 8.923077 | 9.980454 | 28 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | false | false | 2 |
aacb1a8342b6d5ac2333160974a45a7e899de6ec | 26,147,760,950,198 | 2c5773b05819d334f6c1dd3256520cf1ef736726 | /src/com/book/entity/Order.java | 110801abfbe0ed86ac2213f3a71407d6231eb792 | [] | no_license | diliburong/jsp.book | https://github.com/diliburong/jsp.book | 3137634548ab3bf88ca7d7d2acbb1aac21271778 | b10612e957822d9a7aecc44ead93172d12ef658c | refs/heads/master | 2021-01-01T17:29:19.765000 | 2017-07-23T08:07:14 | 2017-07-23T08:07:14 | 98,083,121 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.book.entity;
import java.util.ArrayList;
import com.book.entity.IdEntity;
public class Order extends IdEntity {
private int user_id;
private String order_no;
private float total_price;
private int status;
private ArrayList<Order_Item> order_items;
public int getUser_id() {
return user_id;
}
public void setUser_id(int user_id) {
this.user_id = user_id;
}
public String getOrder_no() {
return order_no;
}
public void setOrder_no(String order_no) {
this.order_no = order_no;
}
public float getTotal_price() {
return total_price;
}
public void setTotal_price(float total_price) {
this.total_price = total_price;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public ArrayList<Order_Item> getOrder_items() {
return order_items;
}
public void setOrder_items(ArrayList<Order_Item> order_items) {
this.order_items = order_items;
}
@Override
public String toString() {
return "Order [user_id=" + user_id + ", order_no=" + order_no + ", total_price=" + total_price + ", status="
+ status + ", order_items=" + order_items + "]";
}
}
| UTF-8 | Java | 1,165 | java | Order.java | Java | [] | null | [] | package com.book.entity;
import java.util.ArrayList;
import com.book.entity.IdEntity;
public class Order extends IdEntity {
private int user_id;
private String order_no;
private float total_price;
private int status;
private ArrayList<Order_Item> order_items;
public int getUser_id() {
return user_id;
}
public void setUser_id(int user_id) {
this.user_id = user_id;
}
public String getOrder_no() {
return order_no;
}
public void setOrder_no(String order_no) {
this.order_no = order_no;
}
public float getTotal_price() {
return total_price;
}
public void setTotal_price(float total_price) {
this.total_price = total_price;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public ArrayList<Order_Item> getOrder_items() {
return order_items;
}
public void setOrder_items(ArrayList<Order_Item> order_items) {
this.order_items = order_items;
}
@Override
public String toString() {
return "Order [user_id=" + user_id + ", order_no=" + order_no + ", total_price=" + total_price + ", status="
+ status + ", order_items=" + order_items + "]";
}
}
| 1,165 | 0.67897 | 0.67897 | 56 | 19.803572 | 20.613293 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false | 2 |
cc63c20f87f1561e2073b1caaf7b0de2e855f9f4 | 15,341,623,242,877 | d17c7a35e819b6efb2581b13dd57bdcceb37b446 | /products/MachExpress/tags/RELEASE-2.0.0/src/main/java/model/InvoiceObject.java | a05920c427d6418f6e5744c2528ea62843edaf5f | [] | no_license | paawak/legacy-apps-from-desktop | https://github.com/paawak/legacy-apps-from-desktop | 031fba07174415dc8a29eab9b230d8fd530479f5 | 22ccbe553fbc7e34c7e3941423aaf054fa938195 | refs/heads/master | 2022-12-28T16:42:50.069000 | 2021-04-27T18:25:09 | 2021-04-27T18:25:09 | 72,349,934 | 0 | 0 | null | false | 2022-12-16T15:36:12 | 2016-10-30T13:04:32 | 2021-04-27T18:25:12 | 2022-12-16T15:36:09 | 73,286 | 0 | 0 | 17 | Java | false | false | /*
* InvoiceObject.java
*
* Created on 06 April 2004, 04:17
*/
package model;
/**
*
* @author paawak
*/
import java.text.DecimalFormat;
import java.util.Vector;
import model.database.InvoiceDB;
public class InvoiceObject implements InvoiceDB {
private Object invoicenum = null;
private Object invoicedate = null;
private Object curmonth = null;
private Object curyear = null;
private Object accnum = null;
private Object totalamt = null;
private Object tax = null;
private Object invoiceamt = null;
private Object tdsamount = null;
private Object bookadjamt = null;
private Object remarks = null;
private Object netreceivable = null;
private Object recievedamt = null;
private Object ispartpayment = null;
private Object haspaidfull = null;
private Object employeeid = null;
private Object entrytime = null;
private Object entrydate = null;
private float fuelCharge;
/** Creates a new instance of InvoiceObject */
public InvoiceObject() {
}
public InvoiceObject(Object[] objArray) throws Exception {
setInvoiceObject(objArray);
}
public InvoiceObject(Vector vecArray) throws Exception {
setInvoiceObject(vecArray);
}
public void setInvoiceObject(Vector vecArray) throws Exception {
int len = vecArray.size();
if (len != fields)
throw new Exception();
Object[] objArray = new Object[len];
for (int i = 0; i < len; i++)
objArray[i] = vecArray.elementAt(i);
setInvoiceObject(objArray);
}
public void setInvoiceObject(Object[] objArray) throws Exception {
if (objArray.length != fields)
throw new Exception();
invoicenum = objArray[0];
invoicedate = objArray[1];
// format it to show a leading zero
DecimalFormat frm = new DecimalFormat("00");
try {
curmonth = frm.format(Integer.parseInt(objArray[2].toString()));
} catch (Exception e) {
}
curyear = objArray[3];
accnum = objArray[4];
totalamt = objArray[5];
tax = objArray[6];
tdsamount = objArray[7];
invoiceamt = objArray[8];
bookadjamt = objArray[9];
remarks = objArray[10];
netreceivable = objArray[11];
recievedamt = objArray[12];
ispartpayment = objArray[13];
haspaidfull = objArray[14];
employeeid = objArray[15];
entrytime = objArray[16];
entrydate = objArray[17];
}
public Object[] getInvoiceObjectAsArray() {
Object[] objArray = null;
Vector objVec = getInvoiceObjectAsVector();
if (objVec.size() != fields)
return objArray;
objArray = new Object[fields];
for (int i = 0; i < fields; i++)
objArray[i] = objVec.elementAt(i);
return objArray;
}
public Vector getInvoiceObjectAsVector() {
Vector objVec = new Vector(fields);
objVec.addElement(invoicenum);
objVec.addElement(invoicedate);
objVec.addElement(curmonth);
objVec.addElement(curyear);
objVec.addElement(accnum);
objVec.addElement(totalamt);
objVec.addElement(tax);
objVec.addElement(tdsamount);
objVec.addElement(invoiceamt);
objVec.addElement(bookadjamt);
objVec.addElement(remarks);
objVec.addElement(netreceivable);
objVec.addElement(recievedamt);
objVec.addElement(ispartpayment);
objVec.addElement(haspaidfull);
objVec.addElement(employeeid);
objVec.addElement(entrytime);
objVec.addElement(entrydate);
return objVec;
}
/**
* method to set the class variables
*
*/
public Object getInvoiceNum() {
return invoicenum;
}
public void setInvoiceNum(Object invoicenum) {
this.invoicenum = invoicenum;
}
public Object getInvoiceDate() {
return invoicedate;
}
public void setInvoiceDate(Object invoicedate) {
this.invoicedate = invoicedate;
}
public Object getCurMonth() {
return curmonth;
}
public void setCurMonth(Object curmonth) {
this.curmonth = curmonth;
}
public Object getCurYear() {
return curyear;
}
public void setCurYear(Object curyear) {
this.curyear = curyear;
}
public Object getAccNum() {
return accnum;
}
public void setAccNum(Object accnum) {
this.accnum = accnum;
}
public Object getTotalAmt() {
return totalamt;
}
public void setTotalAmt(Object totalamt) {
this.totalamt = totalamt;
}
public Object getTax() {
return tax;
}
public void setTax(Object tax) {
this.tax = tax;
}
public Object getInvoiceAmt() {
return invoiceamt;
}
public void setInvoiceAmt(Object invoiceamt) {
this.invoiceamt = invoiceamt;
}
public Object getTdsAmount() {
return tdsamount;
}
public void setTdsAmount(Object tdsamount) {
this.tdsamount = tdsamount;
}
public Object getBookAdjAmt() {
return bookadjamt;
}
public void setBookAdjAmt(Object bookadjamt) {
this.bookadjamt = bookadjamt;
}
public Object getRemarks() {
return remarks;
}
public void setRemarks(Object remarks) {
this.remarks = remarks;
}
public Object getNetReceivable() {
return netreceivable;
}
public void setNetReceivable(Object netreceivable) {
this.netreceivable = netreceivable;
}
public Object getRecievedAmt() {
return recievedamt;
}
public void setRecievedAmt(Object recievedamt) {
this.recievedamt = recievedamt;
}
public Object getIsPartPayment() {
return ispartpayment;
}
public void setIsPartPayment(Object ispartpayment) {
this.ispartpayment = ispartpayment;
}
public Object getHasPaidFull() {
return haspaidfull;
}
public void setHasPaidFull(Object haspaidfull) {
this.haspaidfull = haspaidfull;
}
public Object getEmployeeId() {
return employeeid;
}
public void setEmployeeId(Object employeeid) {
this.employeeid = employeeid;
}
public Object getEntryTime() {
return entrytime;
}
public void setEntryTime(Object entrytime) {
this.entrytime = entrytime;
}
public Object getEntryDate() {
return entrydate;
}
public void setEntryDate(Object entrydate) {
this.entrydate = entrydate;
}
public float getFuelCharge() {
return fuelCharge;
}
public void setFuelCharge(float fuelCharge) {
this.fuelCharge = fuelCharge;
}
}
| UTF-8 | Java | 6,868 | java | InvoiceObject.java | Java | [
{
"context": "004, 04:17\n */\n\npackage model;\n\n/**\n *\n * @author paawak\n */\nimport java.text.DecimalFormat;\nimport java.u",
"end": 109,
"score": 0.9992286562919617,
"start": 103,
"tag": "USERNAME",
"value": "paawak"
}
] | null | [] | /*
* InvoiceObject.java
*
* Created on 06 April 2004, 04:17
*/
package model;
/**
*
* @author paawak
*/
import java.text.DecimalFormat;
import java.util.Vector;
import model.database.InvoiceDB;
public class InvoiceObject implements InvoiceDB {
private Object invoicenum = null;
private Object invoicedate = null;
private Object curmonth = null;
private Object curyear = null;
private Object accnum = null;
private Object totalamt = null;
private Object tax = null;
private Object invoiceamt = null;
private Object tdsamount = null;
private Object bookadjamt = null;
private Object remarks = null;
private Object netreceivable = null;
private Object recievedamt = null;
private Object ispartpayment = null;
private Object haspaidfull = null;
private Object employeeid = null;
private Object entrytime = null;
private Object entrydate = null;
private float fuelCharge;
/** Creates a new instance of InvoiceObject */
public InvoiceObject() {
}
public InvoiceObject(Object[] objArray) throws Exception {
setInvoiceObject(objArray);
}
public InvoiceObject(Vector vecArray) throws Exception {
setInvoiceObject(vecArray);
}
public void setInvoiceObject(Vector vecArray) throws Exception {
int len = vecArray.size();
if (len != fields)
throw new Exception();
Object[] objArray = new Object[len];
for (int i = 0; i < len; i++)
objArray[i] = vecArray.elementAt(i);
setInvoiceObject(objArray);
}
public void setInvoiceObject(Object[] objArray) throws Exception {
if (objArray.length != fields)
throw new Exception();
invoicenum = objArray[0];
invoicedate = objArray[1];
// format it to show a leading zero
DecimalFormat frm = new DecimalFormat("00");
try {
curmonth = frm.format(Integer.parseInt(objArray[2].toString()));
} catch (Exception e) {
}
curyear = objArray[3];
accnum = objArray[4];
totalamt = objArray[5];
tax = objArray[6];
tdsamount = objArray[7];
invoiceamt = objArray[8];
bookadjamt = objArray[9];
remarks = objArray[10];
netreceivable = objArray[11];
recievedamt = objArray[12];
ispartpayment = objArray[13];
haspaidfull = objArray[14];
employeeid = objArray[15];
entrytime = objArray[16];
entrydate = objArray[17];
}
public Object[] getInvoiceObjectAsArray() {
Object[] objArray = null;
Vector objVec = getInvoiceObjectAsVector();
if (objVec.size() != fields)
return objArray;
objArray = new Object[fields];
for (int i = 0; i < fields; i++)
objArray[i] = objVec.elementAt(i);
return objArray;
}
public Vector getInvoiceObjectAsVector() {
Vector objVec = new Vector(fields);
objVec.addElement(invoicenum);
objVec.addElement(invoicedate);
objVec.addElement(curmonth);
objVec.addElement(curyear);
objVec.addElement(accnum);
objVec.addElement(totalamt);
objVec.addElement(tax);
objVec.addElement(tdsamount);
objVec.addElement(invoiceamt);
objVec.addElement(bookadjamt);
objVec.addElement(remarks);
objVec.addElement(netreceivable);
objVec.addElement(recievedamt);
objVec.addElement(ispartpayment);
objVec.addElement(haspaidfull);
objVec.addElement(employeeid);
objVec.addElement(entrytime);
objVec.addElement(entrydate);
return objVec;
}
/**
* method to set the class variables
*
*/
public Object getInvoiceNum() {
return invoicenum;
}
public void setInvoiceNum(Object invoicenum) {
this.invoicenum = invoicenum;
}
public Object getInvoiceDate() {
return invoicedate;
}
public void setInvoiceDate(Object invoicedate) {
this.invoicedate = invoicedate;
}
public Object getCurMonth() {
return curmonth;
}
public void setCurMonth(Object curmonth) {
this.curmonth = curmonth;
}
public Object getCurYear() {
return curyear;
}
public void setCurYear(Object curyear) {
this.curyear = curyear;
}
public Object getAccNum() {
return accnum;
}
public void setAccNum(Object accnum) {
this.accnum = accnum;
}
public Object getTotalAmt() {
return totalamt;
}
public void setTotalAmt(Object totalamt) {
this.totalamt = totalamt;
}
public Object getTax() {
return tax;
}
public void setTax(Object tax) {
this.tax = tax;
}
public Object getInvoiceAmt() {
return invoiceamt;
}
public void setInvoiceAmt(Object invoiceamt) {
this.invoiceamt = invoiceamt;
}
public Object getTdsAmount() {
return tdsamount;
}
public void setTdsAmount(Object tdsamount) {
this.tdsamount = tdsamount;
}
public Object getBookAdjAmt() {
return bookadjamt;
}
public void setBookAdjAmt(Object bookadjamt) {
this.bookadjamt = bookadjamt;
}
public Object getRemarks() {
return remarks;
}
public void setRemarks(Object remarks) {
this.remarks = remarks;
}
public Object getNetReceivable() {
return netreceivable;
}
public void setNetReceivable(Object netreceivable) {
this.netreceivable = netreceivable;
}
public Object getRecievedAmt() {
return recievedamt;
}
public void setRecievedAmt(Object recievedamt) {
this.recievedamt = recievedamt;
}
public Object getIsPartPayment() {
return ispartpayment;
}
public void setIsPartPayment(Object ispartpayment) {
this.ispartpayment = ispartpayment;
}
public Object getHasPaidFull() {
return haspaidfull;
}
public void setHasPaidFull(Object haspaidfull) {
this.haspaidfull = haspaidfull;
}
public Object getEmployeeId() {
return employeeid;
}
public void setEmployeeId(Object employeeid) {
this.employeeid = employeeid;
}
public Object getEntryTime() {
return entrytime;
}
public void setEntryTime(Object entrytime) {
this.entrytime = entrytime;
}
public Object getEntryDate() {
return entrydate;
}
public void setEntryDate(Object entrydate) {
this.entrydate = entrydate;
}
public float getFuelCharge() {
return fuelCharge;
}
public void setFuelCharge(float fuelCharge) {
this.fuelCharge = fuelCharge;
}
}
| 6,868 | 0.617647 | 0.611823 | 302 | 21.741722 | 18.502537 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.39404 | false | false | 2 |
d9b72453e93bddf55ff31031159e4ae1a591f3d6 | 9,079,560,864,161 | 7ab48b1e9f1d63e5e0c8174d24980c9c7d4015a5 | /src/event/OnOffServerPreWakeupEvent.java | 5d420ce50f53d1c6b98def9988caaa3aebd4565a | [] | no_license | murtaza549/HolDCSim | https://github.com/murtaza549/HolDCSim | fa13eff9d0f972349d4ac213bdf82c6d45e6f6d9 | f75c5a8ee7e56614808165587dc38f63edf46019 | refs/heads/master | 2021-05-26T00:01:10.868000 | 2020-03-02T17:38:07 | 2020-03-02T17:38:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package event;
import infrastructure.AbstractSleepController;
import infrastructure.DelayOffController;
import infrastructure.UniprocessorServer;
import job.Task;
import queue.BaseQueue;
import debug.Sim;
import experiment.Experiment;
import experiment.OnSleepExperiment;
public class OnOffServerPreWakeupEvent extends AbstractEvent {
/**
*
*/
private static final long serialVersionUID = 1L;
protected UniprocessorServer server;
protected OnSleepExperiment onSleepExp;
public OnOffServerPreWakeupEvent(double theTime, OnSleepExperiment anExperiment,
UniprocessorServer server) {
super(theTime, anExperiment);
this.server = server;
this.onSleepExp = anExperiment;
// TODO Auto-generated constructor stub
}
@Override
public void process() {
// TODO Auto-generated method stub
verbose();
server.updateWakupTime();
//FIXME: hardcoded sleep state
server.accumulateSSTimes(5, time - server.getLastEneterSleepStateTime());
BaseQueue globalQueue = onSleepExp.getGlobalQueue();
if (globalQueue == null) {
Sim.fatalError("fatal error: global queue is not initialized");
} else if (globalQueue.size() == 0) {
// no more jobs in the queue, put the server to shallow
// sleepstate immediately
Sim.debug(3, "server : " + server.getNodeId() + " will idle wait after wakedup");
server.setLastSleepStateTime(0.0);
int id = server.getNodeId();
//FIXME: temp fix for bypassing idle state bug
AbstractSleepController abController = server.getSleepController();
// if(abController instanceof DelayOffController){
// DelayOffController doController = (DelayOffController)abController;
// doController.setByPass(true);
// }
//go to idle and then deep sleep instead of directy go to sleep as in OnSleepServerWakeup
abController.prepareForSleep(time);
} else {
int num = globalQueue.size();
// now set the server to active
server.setActive();
// need to set lastEntersleepstate to 0.0
// similar to CoreWakedupEvent
server.setLastSleepStateTime(0.0);
Task dequeuedTask = globalQueue.poll();
Sim.debug(3,
"Turned on server picked job: " + dequeuedTask.getTaskId()
+ " server " + server.getNodeId());
// experiment.getGlobalQueue().updateThreadholds(time);
// don't forget to set the server for task
dequeuedTask.setServer(server);
// System.out.println("/// task " + dequeuedTask.getTaskId() +
// " get fetched by newly wakeup server: " +
// server.getNodeId());
server.startTaskService(time, dequeuedTask);
server.TasksInServerInvariant++;
}
}
@Override
public void printEventInfo() {
Sim.debug(3, "^^^ Time: " + time + " server : " + server.getNodeId()
+ " is turned on");
}
}
| UTF-8 | Java | 2,730 | java | OnOffServerPreWakeupEvent.java | Java | [] | null | [] | package event;
import infrastructure.AbstractSleepController;
import infrastructure.DelayOffController;
import infrastructure.UniprocessorServer;
import job.Task;
import queue.BaseQueue;
import debug.Sim;
import experiment.Experiment;
import experiment.OnSleepExperiment;
public class OnOffServerPreWakeupEvent extends AbstractEvent {
/**
*
*/
private static final long serialVersionUID = 1L;
protected UniprocessorServer server;
protected OnSleepExperiment onSleepExp;
public OnOffServerPreWakeupEvent(double theTime, OnSleepExperiment anExperiment,
UniprocessorServer server) {
super(theTime, anExperiment);
this.server = server;
this.onSleepExp = anExperiment;
// TODO Auto-generated constructor stub
}
@Override
public void process() {
// TODO Auto-generated method stub
verbose();
server.updateWakupTime();
//FIXME: hardcoded sleep state
server.accumulateSSTimes(5, time - server.getLastEneterSleepStateTime());
BaseQueue globalQueue = onSleepExp.getGlobalQueue();
if (globalQueue == null) {
Sim.fatalError("fatal error: global queue is not initialized");
} else if (globalQueue.size() == 0) {
// no more jobs in the queue, put the server to shallow
// sleepstate immediately
Sim.debug(3, "server : " + server.getNodeId() + " will idle wait after wakedup");
server.setLastSleepStateTime(0.0);
int id = server.getNodeId();
//FIXME: temp fix for bypassing idle state bug
AbstractSleepController abController = server.getSleepController();
// if(abController instanceof DelayOffController){
// DelayOffController doController = (DelayOffController)abController;
// doController.setByPass(true);
// }
//go to idle and then deep sleep instead of directy go to sleep as in OnSleepServerWakeup
abController.prepareForSleep(time);
} else {
int num = globalQueue.size();
// now set the server to active
server.setActive();
// need to set lastEntersleepstate to 0.0
// similar to CoreWakedupEvent
server.setLastSleepStateTime(0.0);
Task dequeuedTask = globalQueue.poll();
Sim.debug(3,
"Turned on server picked job: " + dequeuedTask.getTaskId()
+ " server " + server.getNodeId());
// experiment.getGlobalQueue().updateThreadholds(time);
// don't forget to set the server for task
dequeuedTask.setServer(server);
// System.out.println("/// task " + dequeuedTask.getTaskId() +
// " get fetched by newly wakeup server: " +
// server.getNodeId());
server.startTaskService(time, dequeuedTask);
server.TasksInServerInvariant++;
}
}
@Override
public void printEventInfo() {
Sim.debug(3, "^^^ Time: " + time + " server : " + server.getNodeId()
+ " is turned on");
}
}
| 2,730 | 0.722711 | 0.718315 | 92 | 28.673914 | 23.778008 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.228261 | false | false | 2 |
82f89f956e6f76d2edbf83957711750ed15f3925 | 30,459,908,118,316 | 63ad83e655b9ea287afc46ddeb389e2b07470f36 | /ModifiedReAction/bukkit/src/main/java/me/fromgate/reactions/activators/ButtonActivator.java | 5aa50fcd3e47dd178c8f69720a3e6d779e143779 | [] | no_license | F1tos/minecraftplugins | https://github.com/F1tos/minecraftplugins | 26f99e8504b7b8a1645c2ac984e0cb9a675a4f44 | d35aab83c6067b8060575f14729e46806b241768 | refs/heads/master | 2021-01-19T20:34:26.743000 | 2017-05-06T14:32:16 | 2017-05-06T14:32:16 | 88,522,076 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* ReActions, Minecraft bukkit plugin
* (c)2012-2013, fromgate, fromgate@gmail.com
* http://dev.bukkit.org/server-mods/reactions/
* *
* This file is part of ReActions.
*
* ReActions 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.
*
* ReActions 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 ReActions. If not, see <http://www.gnorg/licenses/>.
*
*/
package me.fromgate.reactions.activators;
import me.fromgate.reactions.actions.Actions;
import me.fromgate.reactions.event.ButtonEvent;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.Event;
public class ButtonActivator extends Activator {
String world;
int x;
int y;
int z;
ButtonActivator(String name, String group, YamlConfiguration cfg) {
super(name, group, cfg);
}
public ButtonActivator(String name, String group, Block b) {
super(name, group);
this.world = b.getWorld().getName();
this.x = b.getX();
this.y = b.getY();
this.z = b.getZ();
}
public ButtonActivator(String name, Block b) {
super(name, "activators");
this.world = b.getWorld().getName();
this.x = b.getX();
this.y = b.getY();
this.z = b.getZ();
}
@Override
public boolean activate(Event event) {
if (!(event instanceof ButtonEvent)) return false;
ButtonEvent be = (ButtonEvent) event;
if (!isLocatedAt(be.getButtonLocation())) return false;
return Actions.executeActivator(be.getPlayer(), this);
}
@Override
public boolean isLocatedAt(Location l) {
if (l == null) return false;
if (!world.equalsIgnoreCase(l.getWorld().getName())) return false;
if (x != l.getBlockX()) return false;
if (y != l.getBlockY()) return false;
return (z == l.getBlockZ());
}
@Override
public void save(String root, YamlConfiguration cfg) {
cfg.set(root + ".world", this.world);
cfg.set(root + ".x", x);
cfg.set(root + ".y", y);
cfg.set(root + ".z", z);
}
@Override
public void load(String root, YamlConfiguration cfg) {
world = cfg.getString(root + ".world");
x = cfg.getInt(root + ".x");
y = cfg.getInt(root + ".y");
z = cfg.getInt(root + ".z");
}
@Override
public ActivatorType getType() {
return ActivatorType.BUTTON;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(name).append(" [").append(getType()).append("]");
if (!getFlags().isEmpty()) sb.append(" F:").append(getFlags().size());
if (!getActions().isEmpty()) sb.append(" A:").append(getActions().size());
if (!getReactions().isEmpty()) sb.append(" R:").append(getReactions().size());
sb.append(" (").append(world).append(", ").append(x).append(", ").append(y).append(", ").append(z).append(")");
return sb.toString();
}
}
| UTF-8 | Java | 3,496 | java | ButtonActivator.java | Java | [
{
"context": "Actions, Minecraft bukkit plugin\n * (c)2012-2013, fromgate, fromgate@gmail.com\n * http://dev.bukkit.org/ser",
"end": 70,
"score": 0.999570369720459,
"start": 62,
"tag": "USERNAME",
"value": "fromgate"
},
{
"context": "inecraft bukkit plugin\n * (c)2012-2013, fromgate, fromgate@gmail.com\n * http://dev.bukkit.org/server-mods/reactions/\n",
"end": 90,
"score": 0.999926745891571,
"start": 72,
"tag": "EMAIL",
"value": "fromgate@gmail.com"
}
] | null | [] | /*
* ReActions, Minecraft bukkit plugin
* (c)2012-2013, fromgate, <EMAIL>
* http://dev.bukkit.org/server-mods/reactions/
* *
* This file is part of ReActions.
*
* ReActions 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.
*
* ReActions 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 ReActions. If not, see <http://www.gnorg/licenses/>.
*
*/
package me.fromgate.reactions.activators;
import me.fromgate.reactions.actions.Actions;
import me.fromgate.reactions.event.ButtonEvent;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.Event;
public class ButtonActivator extends Activator {
String world;
int x;
int y;
int z;
ButtonActivator(String name, String group, YamlConfiguration cfg) {
super(name, group, cfg);
}
public ButtonActivator(String name, String group, Block b) {
super(name, group);
this.world = b.getWorld().getName();
this.x = b.getX();
this.y = b.getY();
this.z = b.getZ();
}
public ButtonActivator(String name, Block b) {
super(name, "activators");
this.world = b.getWorld().getName();
this.x = b.getX();
this.y = b.getY();
this.z = b.getZ();
}
@Override
public boolean activate(Event event) {
if (!(event instanceof ButtonEvent)) return false;
ButtonEvent be = (ButtonEvent) event;
if (!isLocatedAt(be.getButtonLocation())) return false;
return Actions.executeActivator(be.getPlayer(), this);
}
@Override
public boolean isLocatedAt(Location l) {
if (l == null) return false;
if (!world.equalsIgnoreCase(l.getWorld().getName())) return false;
if (x != l.getBlockX()) return false;
if (y != l.getBlockY()) return false;
return (z == l.getBlockZ());
}
@Override
public void save(String root, YamlConfiguration cfg) {
cfg.set(root + ".world", this.world);
cfg.set(root + ".x", x);
cfg.set(root + ".y", y);
cfg.set(root + ".z", z);
}
@Override
public void load(String root, YamlConfiguration cfg) {
world = cfg.getString(root + ".world");
x = cfg.getInt(root + ".x");
y = cfg.getInt(root + ".y");
z = cfg.getInt(root + ".z");
}
@Override
public ActivatorType getType() {
return ActivatorType.BUTTON;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder(name).append(" [").append(getType()).append("]");
if (!getFlags().isEmpty()) sb.append(" F:").append(getFlags().size());
if (!getActions().isEmpty()) sb.append(" A:").append(getActions().size());
if (!getReactions().isEmpty()) sb.append(" R:").append(getReactions().size());
sb.append(" (").append(world).append(", ").append(x).append(", ").append(y).append(", ").append(z).append(")");
return sb.toString();
}
}
| 3,485 | 0.62357 | 0.620995 | 107 | 31.672897 | 26.12006 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.682243 | false | false | 2 |
d92a31c7a47c7603d922cef8564331f9443fe300 | 10,359,461,184,350 | 2f9c1b14fe7931cb1a72f4331780508303f96514 | /src/com/project/tiaBird/gameObject/geometryObject/creature/character/feat/general/Toughness.java | 7e87067228ad5b180119bac6a0e4c54b0ee55ea1 | [] | no_license | RoadBird/finalGameProj | https://github.com/RoadBird/finalGameProj | 9bcc7a54b92a0a622e9948cb10043cc1e78e7d3e | 6fbc3a6ac1eda40efc17a20ea813e46618f18fa7 | refs/heads/master | 2018-09-10T06:01:02.977000 | 2018-08-19T12:12:17 | 2018-08-19T12:12:17 | 121,157,839 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.project.tiaBird.gameObject.geometryObject.creature.character.feat.general;
import com.project.tiaBird.gameObject.geometryObject.creature.character.Character;
import java.nio.charset.Charset;
import java.util.Random;
public class Toughness extends GeneralFeat {
private static Random random = new Random();
public Toughness(){
byte[] array = new byte[7];
random.nextBytes(array);
setKey(new String(array, Charset.forName("UTF-8")));
}
@Override
public boolean canPersonUse(Character character) {
return true;
}
}
| UTF-8 | Java | 583 | java | Toughness.java | Java | [] | null | [] | package com.project.tiaBird.gameObject.geometryObject.creature.character.feat.general;
import com.project.tiaBird.gameObject.geometryObject.creature.character.Character;
import java.nio.charset.Charset;
import java.util.Random;
public class Toughness extends GeneralFeat {
private static Random random = new Random();
public Toughness(){
byte[] array = new byte[7];
random.nextBytes(array);
setKey(new String(array, Charset.forName("UTF-8")));
}
@Override
public boolean canPersonUse(Character character) {
return true;
}
}
| 583 | 0.718696 | 0.715266 | 19 | 29.68421 | 26.289988 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false | 2 |
9a3e2429d373e0a5e92d491d6bfa75c38e592a85 | 2,319,282,400,066 | 646b84ae9ef40fcf6f0e7c06c3d6091a780bea6f | /app/src/main/java/com/example/admin/premierleague/HomeActivity.java | dbb21b57535c5400430189c08d8f94052b13f388 | [] | no_license | Dineo789/PremierLeague | https://github.com/Dineo789/PremierLeague | dd4fda59e11568df4e38349ecc0cd92650b50e90 | d4df91168dc0f02bcb08be85b504d0cc2dffa483 | refs/heads/master | 2021-01-20T11:41:43.721000 | 2017-09-07T10:21:27 | 2017-09-07T10:21:27 | 101,682,163 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.admin.premierleague;
import android.os.Bundle;
import android.support.v4.app.FragmentTabHost;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Created by admin on 2017/08/28.
* Loads the home page with tabs
*/
public class HomeActivity extends AppCompatActivity {
TextView textView;
ImageView logo;
private FragmentTabHost tabHost;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
setTheme(android.R.style.Theme);//adds theme dynamically
logo = (ImageView) findViewById(R.id.logo);
tabHost = (FragmentTabHost) findViewById(R.id.tabhost);
tabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent);
tabHost.addTab(
tabHost.newTabSpec("tab1").setIndicator("Teams", null),
TeamsFragment.class, null);
tabHost.addTab(
tabHost.newTabSpec("tab2").setIndicator("Competitions", null),
FixtureFragment.class, null);
tabHost.addTab(
tabHost.newTabSpec("tab3").setIndicator("Fixtures", null),
FixtureFragment.class, null);
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {//keeps track of the tabs and apply style
tabHost.getTabWidget().getChildTabViewAt(i).setBackgroundResource(R.drawable.tab_indicator);
}
}
}
| UTF-8 | Java | 1,536 | java | HomeActivity.java | Java | [
{
"context": "import android.widget.TextView;\n\n/**\n * Created by admin on 2017/08/28.\n * Loads the home page with tabs\n ",
"end": 253,
"score": 0.9583778381347656,
"start": 248,
"tag": "USERNAME",
"value": "admin"
}
] | null | [] | package com.example.admin.premierleague;
import android.os.Bundle;
import android.support.v4.app.FragmentTabHost;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Created by admin on 2017/08/28.
* Loads the home page with tabs
*/
public class HomeActivity extends AppCompatActivity {
TextView textView;
ImageView logo;
private FragmentTabHost tabHost;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
setTheme(android.R.style.Theme);//adds theme dynamically
logo = (ImageView) findViewById(R.id.logo);
tabHost = (FragmentTabHost) findViewById(R.id.tabhost);
tabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent);
tabHost.addTab(
tabHost.newTabSpec("tab1").setIndicator("Teams", null),
TeamsFragment.class, null);
tabHost.addTab(
tabHost.newTabSpec("tab2").setIndicator("Competitions", null),
FixtureFragment.class, null);
tabHost.addTab(
tabHost.newTabSpec("tab3").setIndicator("Fixtures", null),
FixtureFragment.class, null);
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {//keeps track of the tabs and apply style
tabHost.getTabWidget().getChildTabViewAt(i).setBackgroundResource(R.drawable.tab_indicator);
}
}
}
| 1,536 | 0.672526 | 0.663411 | 46 | 32.391304 | 29.270462 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.695652 | false | false | 2 |
0777bc521a5767ba1c810998da56f6b6fbd41b0a | 31,447,750,604,118 | 2d64de90e26a8591449c5bc64b4ae91d1f4e64d8 | /FlashCards/FlashCard/app/src/main/java/com/android_projet/yizhe_xiang/flashcard/manage/ShowOneCardFragment.java | f5d3451b020d68d26b1190b89b2cdb0dc9fa7963 | [] | no_license | MagicienDeCode/backup_projects | https://github.com/MagicienDeCode/backup_projects | 183cc7cfb5a96c0457b09f2379556723878f502d | f2b5e83559cb6f013851b51de9d55ece57add3cd | refs/heads/master | 2021-05-17T13:50:28.292000 | 2020-04-05T18:46:13 | 2020-04-05T18:46:13 | 250,806,405 | 0 | 0 | null | false | 2021-06-23T21:00:16 | 2020-03-28T13:48:53 | 2020-04-05T18:46:22 | 2021-06-23T21:00:14 | 20,169 | 0 | 0 | 17 | Java | false | false | package com.android_projet.yizhe_xiang.flashcard.manage;
import android.content.ContentValues;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import com.android_projet.yizhe_xiang.flashcard.database.FlashCardProvider;
import com.android_projet.yizhe_xiang.flashcard.entity.OneCard;
import com.android_projet.yizhe_xiang.flashcard.R;
import com.android_projet.yizhe_xiang.flashcard.play.OneCardFragment;
import com.android_projet.yizhe_xiang.flashcard.play.OneCardMusicService;
import com.android_projet.yizhe_xiang.flashcard.play.PlayCardActivity;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {//@link ShowOneCardFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link ShowOneCardFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class ShowOneCardFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
// TODO: Rename and change types of parameters
private OneCard mParam1;
private int level;
private int box;
private TextView idCard;
private TextView question;
private TextView reponse;
private TextView showBox;
private RadioButton easy;
private RadioButton difficult;
private RadioButton trivial;
private RadioButton normal;
private ImageView cardImage;
private Button cardAudio;
private Button modify;
//private OnFragmentInteractionListener mListener;
public ShowOneCardFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @return A new instance of fragment ShowOneCardFragment.
*/
// TODO: Rename and change types and number of parameters
public static ShowOneCardFragment newInstance(OneCard param1) {
ShowOneCardFragment fragment = new ShowOneCardFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_PARAM1, param1);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getParcelable(ARG_PARAM1);
}
setRetainInstance(true);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Log.d("---mParam1 AutoSaved---", "onActivityCreated: "+mParam1.getQuestion());
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_show_one_card, container, false);
idCard = (TextView)v.findViewById(R.id.idCard);
idCard.setText(""+mParam1.getId());
question = (EditText)v.findViewById(R.id.cardQuestion);
question.setText(mParam1.getQuestion().replace("|","'"));
reponse = (EditText)v.findViewById(R.id.cardReponse);
reponse.setText(mParam1.getAnswer());
easy = (RadioButton)v.findViewById(R.id.showEasy);
difficult = (RadioButton)v.findViewById(R.id.showDifficult);
trivial = (RadioButton)v.findViewById(R.id.showTrivial);
normal = (RadioButton)v.findViewById(R.id.normal);
cardImage = (ImageView)v.findViewById(R.id.cardImage);
cardAudio = (Button)v.findViewById(R.id.cardAudio);
cardAudio.setEnabled(false);
if (!(mParam1.getAudiopath().length()<1)){
cardAudio.setEnabled(true);
cardAudio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String sdPath= Environment.getExternalStorageDirectory()+"/FlashCard";
sdPath+="/"+CardManageActivity.gameName;
sdPath+="/"+mParam1.getAudiopath();
Log.d("audioPath",sdPath);
Intent intent=new Intent(getContext(),OneCardMusicService.class);
intent.putExtra("audiopath",sdPath);
getActivity().startService(intent);
}
});
}
if (!(mParam1.getImgpath().length()<1)){
String sdPath= Environment.getExternalStorageDirectory()+"/FlashCard";
sdPath+="/"+CardManageActivity.gameName;
sdPath+="/"+mParam1.getImgpath();
Log.d("imgPath",sdPath);
new AfficherImg().execute(sdPath);
}
level = mParam1.getLevel();
box = mParam1.getBox();
switch (level){
case 0:
normal.setChecked(true);
break;
case 1:
easy.setChecked(true);
break;
case 2:
difficult.setChecked(true);
break;
case 3:
trivial.setChecked(true);
break;
}
showBox = (TextView)v.findViewById(R.id.showBox);
showBox.setText("every "+box+" day(s) to learn again.");
modify = (Button)v.findViewById(R.id.cardModify);
modify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri.Builder builder = new Uri.Builder();
ContentValues values=new ContentValues();
values.put("question",question.getText().toString());
values.put("answer",reponse.getText().toString());
if (easy.isChecked()){
level = 1;
box = getActivity().getSharedPreferences("myFlashCard", AppCompatActivity.MODE_PRIVATE).getInt("boxfacile",4);
}else if(difficult.isChecked()){
level = 2;
box = getActivity().getSharedPreferences("myFlashCard", AppCompatActivity.MODE_PRIVATE).getInt("boxdifficile",1);
}else if(trivial.isChecked()){
level = 3;
box = 0;
}else if(normal.isChecked()){
if (level == 3){
box = 1;
}
level = 0;
}
values.put("box",box);
values.put("level",level);
Uri uri = builder.scheme("content")
.authority(FlashCardProvider.authority)
.appendPath("updateonecard")
.appendPath(CardManageActivity.gameName).build();
int res = getActivity().getContentResolver()
.update(uri,values,"rowid = ?",new String[]{ mParam1.getId()+"" });
if(res >= 0 ){
Toast.makeText(getContext(),"Update Successfully",Toast.LENGTH_SHORT).show();
getActivity().onBackPressed();
}
else{
Toast.makeText(getContext(),"Update Failed",Toast.LENGTH_SHORT).show();
}
}
});
return v;
}
// TODO: Rename method, update argument and hook method into UI event
/* public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
*/
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
/* public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
*/
@Override
public void onDestroy() {
Log.d("++++", "onDestroy: showOneCardFragment");
super.onDestroy();
Intent intent=new Intent(getContext(),OneCardMusicService.class);
getActivity().stopService(intent);
getActivity().findViewById(R.id.bDeleteCard).setEnabled(true);
getActivity().findViewById(R.id.bAddCard).setEnabled(true);
}
class AfficherImg extends AsyncTask<String,Integer, Bitmap> {
@Override
protected Bitmap doInBackground(String... params) {
Bitmap bm= BitmapFactory.decodeFile(params[0]);
return bm;
}
//onPostExecute方法用于在执行完后台任务后更新UI,显示结果
@Override
protected void onPostExecute(Bitmap bmp) {
cardImage.setImageBitmap(bmp);
}
}
}
| UTF-8 | Java | 10,207 | java | ShowOneCardFragment.java | Java | [] | null | [] | package com.android_projet.yizhe_xiang.flashcard.manage;
import android.content.ContentValues;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import com.android_projet.yizhe_xiang.flashcard.database.FlashCardProvider;
import com.android_projet.yizhe_xiang.flashcard.entity.OneCard;
import com.android_projet.yizhe_xiang.flashcard.R;
import com.android_projet.yizhe_xiang.flashcard.play.OneCardFragment;
import com.android_projet.yizhe_xiang.flashcard.play.OneCardMusicService;
import com.android_projet.yizhe_xiang.flashcard.play.PlayCardActivity;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {//@link ShowOneCardFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link ShowOneCardFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class ShowOneCardFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
// TODO: Rename and change types of parameters
private OneCard mParam1;
private int level;
private int box;
private TextView idCard;
private TextView question;
private TextView reponse;
private TextView showBox;
private RadioButton easy;
private RadioButton difficult;
private RadioButton trivial;
private RadioButton normal;
private ImageView cardImage;
private Button cardAudio;
private Button modify;
//private OnFragmentInteractionListener mListener;
public ShowOneCardFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @return A new instance of fragment ShowOneCardFragment.
*/
// TODO: Rename and change types and number of parameters
public static ShowOneCardFragment newInstance(OneCard param1) {
ShowOneCardFragment fragment = new ShowOneCardFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_PARAM1, param1);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getParcelable(ARG_PARAM1);
}
setRetainInstance(true);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Log.d("---mParam1 AutoSaved---", "onActivityCreated: "+mParam1.getQuestion());
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_show_one_card, container, false);
idCard = (TextView)v.findViewById(R.id.idCard);
idCard.setText(""+mParam1.getId());
question = (EditText)v.findViewById(R.id.cardQuestion);
question.setText(mParam1.getQuestion().replace("|","'"));
reponse = (EditText)v.findViewById(R.id.cardReponse);
reponse.setText(mParam1.getAnswer());
easy = (RadioButton)v.findViewById(R.id.showEasy);
difficult = (RadioButton)v.findViewById(R.id.showDifficult);
trivial = (RadioButton)v.findViewById(R.id.showTrivial);
normal = (RadioButton)v.findViewById(R.id.normal);
cardImage = (ImageView)v.findViewById(R.id.cardImage);
cardAudio = (Button)v.findViewById(R.id.cardAudio);
cardAudio.setEnabled(false);
if (!(mParam1.getAudiopath().length()<1)){
cardAudio.setEnabled(true);
cardAudio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String sdPath= Environment.getExternalStorageDirectory()+"/FlashCard";
sdPath+="/"+CardManageActivity.gameName;
sdPath+="/"+mParam1.getAudiopath();
Log.d("audioPath",sdPath);
Intent intent=new Intent(getContext(),OneCardMusicService.class);
intent.putExtra("audiopath",sdPath);
getActivity().startService(intent);
}
});
}
if (!(mParam1.getImgpath().length()<1)){
String sdPath= Environment.getExternalStorageDirectory()+"/FlashCard";
sdPath+="/"+CardManageActivity.gameName;
sdPath+="/"+mParam1.getImgpath();
Log.d("imgPath",sdPath);
new AfficherImg().execute(sdPath);
}
level = mParam1.getLevel();
box = mParam1.getBox();
switch (level){
case 0:
normal.setChecked(true);
break;
case 1:
easy.setChecked(true);
break;
case 2:
difficult.setChecked(true);
break;
case 3:
trivial.setChecked(true);
break;
}
showBox = (TextView)v.findViewById(R.id.showBox);
showBox.setText("every "+box+" day(s) to learn again.");
modify = (Button)v.findViewById(R.id.cardModify);
modify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri.Builder builder = new Uri.Builder();
ContentValues values=new ContentValues();
values.put("question",question.getText().toString());
values.put("answer",reponse.getText().toString());
if (easy.isChecked()){
level = 1;
box = getActivity().getSharedPreferences("myFlashCard", AppCompatActivity.MODE_PRIVATE).getInt("boxfacile",4);
}else if(difficult.isChecked()){
level = 2;
box = getActivity().getSharedPreferences("myFlashCard", AppCompatActivity.MODE_PRIVATE).getInt("boxdifficile",1);
}else if(trivial.isChecked()){
level = 3;
box = 0;
}else if(normal.isChecked()){
if (level == 3){
box = 1;
}
level = 0;
}
values.put("box",box);
values.put("level",level);
Uri uri = builder.scheme("content")
.authority(FlashCardProvider.authority)
.appendPath("updateonecard")
.appendPath(CardManageActivity.gameName).build();
int res = getActivity().getContentResolver()
.update(uri,values,"rowid = ?",new String[]{ mParam1.getId()+"" });
if(res >= 0 ){
Toast.makeText(getContext(),"Update Successfully",Toast.LENGTH_SHORT).show();
getActivity().onBackPressed();
}
else{
Toast.makeText(getContext(),"Update Failed",Toast.LENGTH_SHORT).show();
}
}
});
return v;
}
// TODO: Rename method, update argument and hook method into UI event
/* public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
*/
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
/* public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
*/
@Override
public void onDestroy() {
Log.d("++++", "onDestroy: showOneCardFragment");
super.onDestroy();
Intent intent=new Intent(getContext(),OneCardMusicService.class);
getActivity().stopService(intent);
getActivity().findViewById(R.id.bDeleteCard).setEnabled(true);
getActivity().findViewById(R.id.bAddCard).setEnabled(true);
}
class AfficherImg extends AsyncTask<String,Integer, Bitmap> {
@Override
protected Bitmap doInBackground(String... params) {
Bitmap bm= BitmapFactory.decodeFile(params[0]);
return bm;
}
//onPostExecute方法用于在执行完后台任务后更新UI,显示结果
@Override
protected void onPostExecute(Bitmap bmp) {
cardImage.setImageBitmap(bmp);
}
}
}
| 10,207 | 0.621103 | 0.617072 | 281 | 35.188614 | 25.809803 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.594306 | false | false | 2 |
07d52781b8a3729ac8b5f1bab15dda4c71215324 | 23,648,089,965,686 | 2b9103db162e3b0178d66989bd1bf9322d622474 | /src/main/java/agrar/io/model/AIPlayer.java | 4a27a211e0a07269f2b5323f3aced7598af6e136 | [] | no_license | flobaader/agrar.io | https://github.com/flobaader/agrar.io | 5069ae09b4e3a34d14f0340f2410854bf54d2612 | ee7b5b8d52c5690d89958e111b05322525688306 | refs/heads/master | 2021-01-09T20:51:36.776000 | 2019-10-01T07:53:51 | 2019-10-01T07:53:51 | 57,366,680 | 0 | 0 | null | false | 2019-10-01T07:53:52 | 2016-04-29T07:58:55 | 2017-11-02T13:23:20 | 2019-10-01T07:53:51 | 13,949 | 0 | 0 | 1 | Java | false | false | package agrar.io.model;
import java.awt.Color;
import agrar.io.controller.AIPlayerBehavior;
import agrar.io.controller.Controller;
import agrar.io.util.Vector;
/**
* Represents the model of an AI-Player
* @author Flo
*
*/
public class AIPlayer extends Player{
/**
* Creates a new AI Player Model
* @param parent The game controller
* @param loc The spawn location
* @param size The initial size of the Player
* @param col The color of the Player
* @param name The name of the Player
*/
public AIPlayer(Controller parent, Vector loc, int size, Color col, String name, int Level) {
super(parent, loc, size, col, name);
this.behavior = new AIPlayerBehavior(this, parent,Level);
}
}
| UTF-8 | Java | 710 | java | AIPlayer.java | Java | [
{
"context": " * Represents the model of an AI-Player\n * @author Flo\n *\n */\npublic class AIPlayer extends Player{\n\n\t/*",
"end": 221,
"score": 0.9964898824691772,
"start": 218,
"tag": "USERNAME",
"value": "Flo"
}
] | null | [] | package agrar.io.model;
import java.awt.Color;
import agrar.io.controller.AIPlayerBehavior;
import agrar.io.controller.Controller;
import agrar.io.util.Vector;
/**
* Represents the model of an AI-Player
* @author Flo
*
*/
public class AIPlayer extends Player{
/**
* Creates a new AI Player Model
* @param parent The game controller
* @param loc The spawn location
* @param size The initial size of the Player
* @param col The color of the Player
* @param name The name of the Player
*/
public AIPlayer(Controller parent, Vector loc, int size, Color col, String name, int Level) {
super(parent, loc, size, col, name);
this.behavior = new AIPlayerBehavior(this, parent,Level);
}
}
| 710 | 0.71831 | 0.71831 | 30 | 22.666666 | 22.524555 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.066667 | false | false | 2 |
75a20ee6e299e4030151db7ce417b40e28c9cfea | 13,245,679,166,536 | 047c1351b229ea01106ef8a9f292fbd4b19602a5 | /code.java | a7156118c618680ca29106c015712508e978ccf7 | [
"MIT"
] | permissive | AbeSalman/Peaks_in_Data | https://github.com/AbeSalman/Peaks_in_Data | e34cb79be37b03ff922aff1a2566f86ae32ba768 | 6ee3733640f818b12f1bd09bf322247329a8760e | refs/heads/master | 2021-05-03T09:50:06.815000 | 2018-02-07T07:28:47 | 2018-02-07T07:28:47 | 120,579,452 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package as_peaks_in_data;
/**
*
* @author iCloud
*/
public class AS_Peaks_in_Data {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//given data array to scan through and find peaks//
float [] x = {0.2f, 0.5f, 0.1f, 0.15f, 0.2f, 0.13f, 0.3f, 0.25f, 0.3f, 0.3f,
0.7f, 0.2f, 0.45f, 0.15f, 0.2f, 0.85f, 0.3f, 0.65f, 0.2f, 0.1f};
// print the given array data above up to its forth decimal point//
int peakCount = 0;
System.out.print("Data array: ");
for (int i = 0; i<x.length; i++) { /*loop PLUS statements to allocate space and print array in two rows*/
if (i%10==0) {
System.out.println();
}
System.out.printf("%.4f ", x[i]);
}
System.out.println("\n");
//test each element of the array if it was peak or not//
for (int i=1; i<x.length-1; i++) { /*loop PLUS statements to seek and find peaks*/
if(x[i]>x[i-1]*2.0 && x[i]>x[i+1]*2.0) {
peakCount++;
}
}
int [] peaks = new int [peakCount];
int index = 0;
for (int i = 1; i<x.length-1; i++) {
if (x[i]>x[i-1]*2.0 && x[i]>x[i+1]*2.0){
peaks [index++] = i;
}
}
//determine & print peak elements along with their indexes in non-decending order//
System.out.println(peakCount + " Peaks found: ");
for (int i=0; i<peakCount; i++){ /*loop and statments to store result and print them*/
System.out.println(peaks[i] + " " + x[peaks[i]]);
}
//Extra credit code to sort founded peaks in descending order according to their magnitudes//
System.out.println("\n");
System.out.println("Sorted peaks: ");
for (int i=0; i<peakCount; i++) { /*loops & statements to find smallest element*/
float currentMin = x[peaks[i]];
int minIndex = i;
for (int j=i+1; j < peakCount; j++) {
if (x[peaks[j]] < currentMin) {
currentMin = x[peaks[j]];
minIndex = j;
}
}
if (minIndex != i) { /*statements to swap smallest element with initiated swapper*/
int swap;
swap = peaks[i];
peaks[i] = peaks[minIndex];
peaks[minIndex] = swap;
}
}
for (int i=0; i<peakCount; i++) {
System.out.println(peaks[i] + " " + x[peaks[i]]);
}
}
}
| UTF-8 | Java | 2,781 | java | code.java | Java | [
{
"context": "package as_peaks_in_data;\n/**\n *\n * @author iCloud\n */\npublic class AS_Peaks_in_Data {\n\n /**\n ",
"end": 50,
"score": 0.9991533756256104,
"start": 44,
"tag": "USERNAME",
"value": "iCloud"
}
] | null | [] | package as_peaks_in_data;
/**
*
* @author iCloud
*/
public class AS_Peaks_in_Data {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//given data array to scan through and find peaks//
float [] x = {0.2f, 0.5f, 0.1f, 0.15f, 0.2f, 0.13f, 0.3f, 0.25f, 0.3f, 0.3f,
0.7f, 0.2f, 0.45f, 0.15f, 0.2f, 0.85f, 0.3f, 0.65f, 0.2f, 0.1f};
// print the given array data above up to its forth decimal point//
int peakCount = 0;
System.out.print("Data array: ");
for (int i = 0; i<x.length; i++) { /*loop PLUS statements to allocate space and print array in two rows*/
if (i%10==0) {
System.out.println();
}
System.out.printf("%.4f ", x[i]);
}
System.out.println("\n");
//test each element of the array if it was peak or not//
for (int i=1; i<x.length-1; i++) { /*loop PLUS statements to seek and find peaks*/
if(x[i]>x[i-1]*2.0 && x[i]>x[i+1]*2.0) {
peakCount++;
}
}
int [] peaks = new int [peakCount];
int index = 0;
for (int i = 1; i<x.length-1; i++) {
if (x[i]>x[i-1]*2.0 && x[i]>x[i+1]*2.0){
peaks [index++] = i;
}
}
//determine & print peak elements along with their indexes in non-decending order//
System.out.println(peakCount + " Peaks found: ");
for (int i=0; i<peakCount; i++){ /*loop and statments to store result and print them*/
System.out.println(peaks[i] + " " + x[peaks[i]]);
}
//Extra credit code to sort founded peaks in descending order according to their magnitudes//
System.out.println("\n");
System.out.println("Sorted peaks: ");
for (int i=0; i<peakCount; i++) { /*loops & statements to find smallest element*/
float currentMin = x[peaks[i]];
int minIndex = i;
for (int j=i+1; j < peakCount; j++) {
if (x[peaks[j]] < currentMin) {
currentMin = x[peaks[j]];
minIndex = j;
}
}
if (minIndex != i) { /*statements to swap smallest element with initiated swapper*/
int swap;
swap = peaks[i];
peaks[i] = peaks[minIndex];
peaks[minIndex] = swap;
}
}
for (int i=0; i<peakCount; i++) {
System.out.println(peaks[i] + " " + x[peaks[i]]);
}
}
}
| 2,781 | 0.45703 | 0.430421 | 97 | 27.639175 | 27.854254 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.804124 | false | false | 2 |
3f084e77bbcf6d9c2c00535b6170255f3916931d | 34,333,968,590,096 | 882c66d4c64fef7f051fe2aaba07ca459319c8c9 | /presision/src/main/java/com/jdb/dmp/task/sync/SyncBorrowBuyLicaiProductTask.java | b9366fd5a48a3c5e74d09d6be271801c7eba1096 | [] | no_license | xujiabin02/jdbforreal | https://github.com/xujiabin02/jdbforreal | 7134ee393e88e162eadc91e6b296af46aeabab81 | c87f48f1ded13009e34da4e8dd496bd46fa34937 | refs/heads/master | 2022-02-05T17:02:27.844000 | 2019-05-08T07:26:43 | 2019-05-08T07:26:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jdb.dmp.task.sync;
import com.dangdang.ddframe.job.api.JobExecutionMultipleShardingContext;
import com.dangdang.ddframe.job.plugin.job.type.simple.AbstractSimpleElasticJob;
import com.jdb.dmp.domain.BorrowBuyLicaiProduct;
import com.jdb.dmp.service.BorrowBuyLicaiProductService;
import com.jdb.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
/**
* 增量同步新手任务数据
*
* Created by zhouqf on 16/10/11.
*/
@Component
public class SyncBorrowBuyLicaiProductTask extends AbstractSimpleElasticJob {
@Autowired
private BorrowBuyLicaiProductService borrowBuyLicaiProductService;
Logger logger = LoggerFactory.getLogger(SyncBorrowBuyLicaiProductTask.class);
public void process(JobExecutionMultipleShardingContext context)
{
logger.info("Enter SyncBorrowBuyLicaiProductTask");
int fromId = 0;
List<BorrowBuyLicaiProduct> list = borrowBuyLicaiProductService.find(fromId, 100);
while (list.size() > 0)
{
try {
Iterator<BorrowBuyLicaiProduct> itr = list.iterator();
while(itr.hasNext())
{
fromId++;
BorrowBuyLicaiProduct borrowBuyLicaiProduct = itr.next();
String product_uuid = borrowBuyLicaiProduct.getProduct_uuid();
if (borrowBuyLicaiProductService.exists(product_uuid))
{
continue;
}
borrowBuyLicaiProductService.insert(borrowBuyLicaiProduct);
logger.info(borrowBuyLicaiProduct.getEntry_uuid() + " " + borrowBuyLicaiProduct.getProduct_uuid() + " BorrowBuyLicaiProduct Added.");
}
list = borrowBuyLicaiProductService.find(fromId, 100);
} catch (Exception e) {
e.printStackTrace();
}
}
logger.info("Exit SyncBorrowBuyLicaiProductTask");
}
}
| UTF-8 | Java | 2,172 | java | SyncBorrowBuyLicaiProductTask.java | Java | [
{
"context": "ava.util.List;\n\n/**\n * 增量同步新手任务数据\n *\n * Created by zhouqf on 16/10/11.\n */\n@Component\npublic class SyncBorr",
"end": 607,
"score": 0.9992552399635315,
"start": 601,
"tag": "USERNAME",
"value": "zhouqf"
}
] | null | [] | package com.jdb.dmp.task.sync;
import com.dangdang.ddframe.job.api.JobExecutionMultipleShardingContext;
import com.dangdang.ddframe.job.plugin.job.type.simple.AbstractSimpleElasticJob;
import com.jdb.dmp.domain.BorrowBuyLicaiProduct;
import com.jdb.dmp.service.BorrowBuyLicaiProductService;
import com.jdb.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
/**
* 增量同步新手任务数据
*
* Created by zhouqf on 16/10/11.
*/
@Component
public class SyncBorrowBuyLicaiProductTask extends AbstractSimpleElasticJob {
@Autowired
private BorrowBuyLicaiProductService borrowBuyLicaiProductService;
Logger logger = LoggerFactory.getLogger(SyncBorrowBuyLicaiProductTask.class);
public void process(JobExecutionMultipleShardingContext context)
{
logger.info("Enter SyncBorrowBuyLicaiProductTask");
int fromId = 0;
List<BorrowBuyLicaiProduct> list = borrowBuyLicaiProductService.find(fromId, 100);
while (list.size() > 0)
{
try {
Iterator<BorrowBuyLicaiProduct> itr = list.iterator();
while(itr.hasNext())
{
fromId++;
BorrowBuyLicaiProduct borrowBuyLicaiProduct = itr.next();
String product_uuid = borrowBuyLicaiProduct.getProduct_uuid();
if (borrowBuyLicaiProductService.exists(product_uuid))
{
continue;
}
borrowBuyLicaiProductService.insert(borrowBuyLicaiProduct);
logger.info(borrowBuyLicaiProduct.getEntry_uuid() + " " + borrowBuyLicaiProduct.getProduct_uuid() + " BorrowBuyLicaiProduct Added.");
}
list = borrowBuyLicaiProductService.find(fromId, 100);
} catch (Exception e) {
e.printStackTrace();
}
}
logger.info("Exit SyncBorrowBuyLicaiProductTask");
}
}
| 2,172 | 0.664498 | 0.657063 | 58 | 36.103447 | 31.616064 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.517241 | false | false | 2 |
a3f9ea1ed4ac24c7f8c0dfa238034de543b88970 | 32,624,571,649,380 | f577a4716ac8df5841a5ecf8b49318c90e1deff9 | /app/src/main/java/com/app/market_street/uis/activity_filter/FilterActivity.java | 54c48d36893089c61f003ffafc3431018a284390 | [] | no_license | MotawroonProjects/MarketStreet | https://github.com/MotawroonProjects/MarketStreet | 181b96738b52cd9aeba9b11ae502f778d11c27e3 | b7706ab4a214eab3890056b7393968224b6dc10f | refs/heads/master | 2023-05-26T12:46:01.096000 | 2021-06-13T08:45:01 | 2021-06-13T08:45:01 | 374,590,367 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.app.market_street.uis.activity_filter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.app.market_street.R;
import com.app.market_street.adapters.CategoryFilterAdapter;
import com.app.market_street.databinding.ActivityFilterBinding;
import com.app.market_street.language.Language;
import com.app.market_street.models.UserModel;
import com.app.market_street.preferences.Preferences;
import java.util.ArrayList;
import java.util.List;
import io.paperdb.Paper;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class FilterActivity extends AppCompatActivity {
private ActivityFilterBinding binding;
private String lang;
private List<Object> subCategoryDataModelList;
private CategoryFilterAdapter adapter;
private Preferences preferences;
private UserModel userModel;
@Override
protected void attachBaseContext(Context newBase) {
Paper.init(newBase);
super.attachBaseContext(Language.updateResources(newBase, Paper.book().read("lang", "ar")));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_filter);
initView();
}
private void initView() {
preferences = Preferences.getInstance();
//userModel = Preferences.getUserData(this);
Paper.init(this);
lang = Paper.book().read("lang", "ar");
subCategoryDataModelList = new ArrayList<>();
binding.setLang(lang);
binding.recViewCountry.setLayoutManager(new LinearLayoutManager(this));
adapter = new CategoryFilterAdapter(this, subCategoryDataModelList,0);
binding.recViewCountry.setAdapter(adapter);
binding.llBack.setOnClickListener(view -> finish());
binding.lldepart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (binding.elexpendDepart.isExpanded()) {
binding.elexpendDepart.setExpanded(false);
if(lang.equals("en")){
binding.arrow.setRotation(180);
}
else {
binding.arrow.setRotation(0);
}
} else {
binding.elexpendDepart.setExpanded(true);
binding.arrow.setRotation(-90);
}
}
});
binding.btnRecet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
binding.btnConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
} | UTF-8 | Java | 3,103 | java | FilterActivity.java | Java | [] | null | [] | package com.app.market_street.uis.activity_filter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.app.market_street.R;
import com.app.market_street.adapters.CategoryFilterAdapter;
import com.app.market_street.databinding.ActivityFilterBinding;
import com.app.market_street.language.Language;
import com.app.market_street.models.UserModel;
import com.app.market_street.preferences.Preferences;
import java.util.ArrayList;
import java.util.List;
import io.paperdb.Paper;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class FilterActivity extends AppCompatActivity {
private ActivityFilterBinding binding;
private String lang;
private List<Object> subCategoryDataModelList;
private CategoryFilterAdapter adapter;
private Preferences preferences;
private UserModel userModel;
@Override
protected void attachBaseContext(Context newBase) {
Paper.init(newBase);
super.attachBaseContext(Language.updateResources(newBase, Paper.book().read("lang", "ar")));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_filter);
initView();
}
private void initView() {
preferences = Preferences.getInstance();
//userModel = Preferences.getUserData(this);
Paper.init(this);
lang = Paper.book().read("lang", "ar");
subCategoryDataModelList = new ArrayList<>();
binding.setLang(lang);
binding.recViewCountry.setLayoutManager(new LinearLayoutManager(this));
adapter = new CategoryFilterAdapter(this, subCategoryDataModelList,0);
binding.recViewCountry.setAdapter(adapter);
binding.llBack.setOnClickListener(view -> finish());
binding.lldepart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (binding.elexpendDepart.isExpanded()) {
binding.elexpendDepart.setExpanded(false);
if(lang.equals("en")){
binding.arrow.setRotation(180);
}
else {
binding.arrow.setRotation(0);
}
} else {
binding.elexpendDepart.setExpanded(true);
binding.arrow.setRotation(-90);
}
}
});
binding.btnRecet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
binding.btnConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
} | 3,103 | 0.656784 | 0.653561 | 104 | 28.846153 | 24.357422 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 2 |
822590efb23497bcb1d38d9d54948d45aefdc8ea | 37,014,028,157,807 | 95e17c0cf213846c3ba4402004da8ec5c93a6457 | /HeCkert/MenschAErgereDichNicht/src/Meeple.java | cb175f4b737861999c4f99164f6a78162eb5ddcf | [] | no_license | irenerothe/EmbeddedSystemWS17 | https://github.com/irenerothe/EmbeddedSystemWS17 | 6d9d21af83459091de6483dda9a54e3fe77f6f05 | acc50c480f7d2d54a82f26be67011f7c6878fc0a | refs/heads/master | 2021-01-12T00:03:25.756000 | 2017-12-11T10:24:15 | 2017-12-11T10:24:15 | 78,663,525 | 0 | 0 | null | false | 2017-11-27T09:55:08 | 2017-01-11T17:43:04 | 2017-11-26T22:23:06 | 2017-11-27T09:55:08 | 210 | 0 | 0 | 0 | Java | false | null | // Author Sebastian Hentges
// EmbeddedSystemWS17\HeCkert\MenschAErgereDichNicht\src\Meeple.java
//
// Meeple class represents tokens of board games.
//
public class Meeple {
private int position;
private final char color;
public Meeple(char color, int initialPosition) {
this.color=color;
this.setPosition(initialPosition);
}
/**
* Assigns a new Position to <code>Meeple</code>
* @param newPosition <code>int</code> value where <code>Meeple</code>
* shall be positioned
*/
// Made final so it can be called in constructor without issues
final public void setPosition(int newPosition) {
this.position = newPosition;
}
/**
* Returns the current position of this <code>Meeple</code>
* @return
* Returns current Position as <code>int</code> value
*/
public int getPosition() {
return this.position;
}
public char getColor(){
return this.color;
}
}
| UTF-8 | Java | 1,007 | java | Meeple.java | Java | [
{
"context": "// Author Sebastian Hentges\n// EmbeddedSystemWS17\\HeCkert\\MenschAErgereDic",
"end": 31,
"score": 0.9998782873153687,
"start": 14,
"tag": "NAME",
"value": "Sebastian Hentges"
}
] | null | [] | // Author <NAME>
// EmbeddedSystemWS17\HeCkert\MenschAErgereDichNicht\src\Meeple.java
//
// Meeple class represents tokens of board games.
//
public class Meeple {
private int position;
private final char color;
public Meeple(char color, int initialPosition) {
this.color=color;
this.setPosition(initialPosition);
}
/**
* Assigns a new Position to <code>Meeple</code>
* @param newPosition <code>int</code> value where <code>Meeple</code>
* shall be positioned
*/
// Made final so it can be called in constructor without issues
final public void setPosition(int newPosition) {
this.position = newPosition;
}
/**
* Returns the current position of this <code>Meeple</code>
* @return
* Returns current Position as <code>int</code> value
*/
public int getPosition() {
return this.position;
}
public char getColor(){
return this.color;
}
}
| 996 | 0.633565 | 0.631579 | 40 | 24.174999 | 22.711107 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.