blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
list | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
list | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b458e9967c3b5cc6697fc3a9c683b414505d81d5
| 35,656,818,520,474 |
9dd938e3047d2cbd37540b941d6c4581706c2b84
|
/app/src/main/java/com/example/tea/Fragment/DataFragment.java
|
aa220a4e2354219bc84704cf7988488ded880a59
|
[] |
no_license
|
jhonwest/Tea
|
https://github.com/jhonwest/Tea
|
8ffadefd87a843336adfe715c658b15b58b71ed6
|
adbc34eaa442b279a239ece5e947506c29743a99
|
refs/heads/master
| 2021-01-20T13:36:45.268000 | 2017-02-21T15:16:22 | 2017-02-21T15:16:22 | 82,692,004 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.tea.Fragment;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import com.example.tea.Activity.UrlActivity;
import com.example.tea.R;
import com.example.tea.utils.CharSetUtil;
import com.example.tea.utils.HttpUtils;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by lenovo on 2016/10/13.
*/
public class DataFragment extends Fragment {
private ListView listView;
private List<String> listUrl;
private String str,title;
private StringBuffer sb1,sb2;
private SimpleAdapter simpleAdapter;
private List<Map<String,Object>> datas = new ArrayList<>();
String path = "http://sns.maimaicha.com/api?apikey=b4f4ee31a8b9acc866ef2afb754c33e6&format=json&method=news.getListByType&page=0&rows=15&type=54";
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view =inflater.inflate(R.layout.fragment_encyclopedia,container,false);
listView = (ListView) view.findViewById(R.id.listView);
new Test().execute(path);
return view;
}
public final class Test extends AsyncTask<String, Void, List<Map<String, Object>>> {
@Override
protected List<Map<String, Object>> doInBackground(String... params) {
InputStream inputStream = HttpUtils.getInputSteam(params[0]);
if (inputStream != null) {
String json = HttpUtils.getString(inputStream);
if (json != null) {
String str = CharSetUtil.decodeUnicode(json);
List<Map<String, Object>> mapList = HttpUtils.getDrugStore(str);
return mapList;
}
}
return null;
}
@Override
protected void onPostExecute(final List<Map<String, Object>> maps) {
super.onPostExecute(maps);
final String mapStr = maps.toString();
listUrl=new ArrayList<>();
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Map<String ,Object> strMap = maps.get(position - 1);
str = (String) strMap.get("id");
title = (String) strMap.get("title");
String url1 = "http://sns.maimaicha.com/news/detail/";
sb1 = new StringBuffer();
sb1.append(url1).append(str);
sb2 = new StringBuffer();
sb2.append(strMap.toString());
listUrl.add(strMap.toString());
String sbStr = sb1.toString();
Intent intent = new Intent(getActivity(),UrlActivity.class);
intent.putExtra("url",sbStr);
intent.putExtra("title",title);
intent.putExtra("id",str);
intent.putExtra("collect",sb2.toString());
startActivity(intent);
}
});
if((maps != null) && (maps.size() != 0 )){
datas.addAll(maps);
if(simpleAdapter == null){
simpleAdapter = new SimpleAdapter(getActivity(),datas,R.layout.item,new String[]{"wapthumb", "title", "source", "nickname", "createtime"},
new int[]{R.id.imageView,R.id.textView_title,R.id.textView_class,R.id.textView_url,R.id.textView_time});
listView.setAdapter(simpleAdapter);
simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() {
@Override
public boolean setViewValue(View view, Object data, String textRepresentation) {
if (view instanceof ImageView){
final ImageView wapthumb = (ImageView) view;
class LodaImageAsyncTask extends AsyncTask<String , Void , Bitmap>{
@Override
protected Bitmap doInBackground(String... params) {
InputStream inputStream = HttpUtils.getInputSteam(params[0]);
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
return bitmap;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
if(bitmap != null){
wapthumb.setImageBitmap(bitmap);
}
}
}
new LodaImageAsyncTask().execute(textRepresentation);
return true;
}
return false;
}
});
}else{
simpleAdapter.notifyDataSetChanged();
}
}
}
}
}
|
UTF-8
|
Java
| 5,761 |
java
|
DataFragment.java
|
Java
|
[
{
"context": "til.List;\nimport java.util.Map;\n\n/**\n * Created by lenovo on 2016/10/13.\n */\npublic class DataFragment exte",
"end": 788,
"score": 0.9995462894439697,
"start": 782,
"tag": "USERNAME",
"value": "lenovo"
},
{
"context": "tring path = \"http://sns.maimaicha.com/api?apikey=b4f4ee31a8b9acc866ef2afb754c33e6&format=json&method=news.getListByType&page=0&rows",
"end": 1176,
"score": 0.9997106194496155,
"start": 1144,
"tag": "KEY",
"value": "b4f4ee31a8b9acc866ef2afb754c33e6"
}
] | null |
[] |
package com.example.tea.Fragment;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import com.example.tea.Activity.UrlActivity;
import com.example.tea.R;
import com.example.tea.utils.CharSetUtil;
import com.example.tea.utils.HttpUtils;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by lenovo on 2016/10/13.
*/
public class DataFragment extends Fragment {
private ListView listView;
private List<String> listUrl;
private String str,title;
private StringBuffer sb1,sb2;
private SimpleAdapter simpleAdapter;
private List<Map<String,Object>> datas = new ArrayList<>();
String path = "http://sns.maimaicha.com/api?apikey=b4f4ee31a8b9acc866ef2afb754c33e6&format=json&method=news.getListByType&page=0&rows=15&type=54";
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view =inflater.inflate(R.layout.fragment_encyclopedia,container,false);
listView = (ListView) view.findViewById(R.id.listView);
new Test().execute(path);
return view;
}
public final class Test extends AsyncTask<String, Void, List<Map<String, Object>>> {
@Override
protected List<Map<String, Object>> doInBackground(String... params) {
InputStream inputStream = HttpUtils.getInputSteam(params[0]);
if (inputStream != null) {
String json = HttpUtils.getString(inputStream);
if (json != null) {
String str = CharSetUtil.decodeUnicode(json);
List<Map<String, Object>> mapList = HttpUtils.getDrugStore(str);
return mapList;
}
}
return null;
}
@Override
protected void onPostExecute(final List<Map<String, Object>> maps) {
super.onPostExecute(maps);
final String mapStr = maps.toString();
listUrl=new ArrayList<>();
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Map<String ,Object> strMap = maps.get(position - 1);
str = (String) strMap.get("id");
title = (String) strMap.get("title");
String url1 = "http://sns.maimaicha.com/news/detail/";
sb1 = new StringBuffer();
sb1.append(url1).append(str);
sb2 = new StringBuffer();
sb2.append(strMap.toString());
listUrl.add(strMap.toString());
String sbStr = sb1.toString();
Intent intent = new Intent(getActivity(),UrlActivity.class);
intent.putExtra("url",sbStr);
intent.putExtra("title",title);
intent.putExtra("id",str);
intent.putExtra("collect",sb2.toString());
startActivity(intent);
}
});
if((maps != null) && (maps.size() != 0 )){
datas.addAll(maps);
if(simpleAdapter == null){
simpleAdapter = new SimpleAdapter(getActivity(),datas,R.layout.item,new String[]{"wapthumb", "title", "source", "nickname", "createtime"},
new int[]{R.id.imageView,R.id.textView_title,R.id.textView_class,R.id.textView_url,R.id.textView_time});
listView.setAdapter(simpleAdapter);
simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() {
@Override
public boolean setViewValue(View view, Object data, String textRepresentation) {
if (view instanceof ImageView){
final ImageView wapthumb = (ImageView) view;
class LodaImageAsyncTask extends AsyncTask<String , Void , Bitmap>{
@Override
protected Bitmap doInBackground(String... params) {
InputStream inputStream = HttpUtils.getInputSteam(params[0]);
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
return bitmap;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
if(bitmap != null){
wapthumb.setImageBitmap(bitmap);
}
}
}
new LodaImageAsyncTask().execute(textRepresentation);
return true;
}
return false;
}
});
}else{
simpleAdapter.notifyDataSetChanged();
}
}
}
}
}
| 5,761 | 0.542788 | 0.53515 | 147 | 38.190475 | 32.256695 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.755102 | false | false |
0
|
771d4018bb501a2c9d577322b5d8e2a1f158aea2
| 35,759,897,739,919 |
c55ef669c5a9928d037552791fefebe305495f95
|
/ethiso-iso20022/src/main/java/com/std/ie/ethiso/iso/domain/Originator.java
|
34e126ca8a7438a4d2b3556392d5a3d041f7af6c
|
[
"Apache-2.0"
] |
permissive
|
tenda-dev/ethiso
|
https://github.com/tenda-dev/ethiso
|
00ef22c2c8bec9e53b8d6f59169f15a94e13e874
|
0f0e4b478433affbb9facab50729d06e33655755
|
refs/heads/master
| 2022-11-20T04:32:39.298000 | 2019-09-26T15:33:10 | 2019-09-26T15:33:10 | 211,078,488 | 1 | 0 |
Apache-2.0
| false | 2022-11-15T23:50:53 | 2019-09-26T12:00:02 | 2019-09-26T15:33:13 | 2022-11-15T23:50:53 | 1,206 | 0 | 0 | 9 |
JavaScript
| false | false |
/*******************************************************************************
* Copyright (c) 2016 Royal Bank of Scotland
*
* 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.std.ie.ethiso.iso.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Originator {
private Identification identification;
private String name;
@JsonProperty("Id")
public Identification getIdentification() {
return identification;
}
public void setIdentification(Identification identification) {
this.identification = identification;
}
@JsonProperty("Nm")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
UTF-8
|
Java
| 1,282 |
java
|
Originator.java
|
Java
|
[] | null |
[] |
/*******************************************************************************
* Copyright (c) 2016 Royal Bank of Scotland
*
* 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.std.ie.ethiso.iso.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Originator {
private Identification identification;
private String name;
@JsonProperty("Id")
public Identification getIdentification() {
return identification;
}
public void setIdentification(Identification identification) {
this.identification = identification;
}
@JsonProperty("Nm")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| 1,282 | 0.654446 | 0.648206 | 43 | 28.813953 | 27.022175 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.767442 | false | false |
0
|
9af34bd46bb1e26c7cdc3d993981ea9705a5bdb5
| 38,886,633,926,642 |
a6d1bba997f17767ebd2d285a12c4c692c241af4
|
/src/Customer.java
|
d599181359a8be4fab65fb6b920636fc6db03b71
|
[] |
no_license
|
lirond101/CouponSYS
|
https://github.com/lirond101/CouponSYS
|
8157c2684aee4b24a7f2553e7c0cbca682e016e5
|
722aeb32764f227849e4473faff925fdcf55eeaf
|
refs/heads/master
| 2021-01-25T08:32:11.641000 | 2015-04-22T15:36:25 | 2015-04-22T15:36:25 | 34,399,077 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Date;
/**
* Created by לירון on 22/04/2015.
*/
public class Customer {
public String _email;
public Date _dateOfBirth;
public String _categoryType;
public Customer (String email, Date dateOfBirth, String categoryType){
this._email = email;
this._dateOfBirth = dateOfBirth;
this._categoryType = categoryType;
}
}
|
WINDOWS-1255
|
Java
| 383 |
java
|
Customer.java
|
Java
|
[
{
"context": "import java.util.Date;\n\n/**\n * Created by לירון on 22/04/2015.\n */\npublic class Customer {\n pu",
"end": 47,
"score": 0.9997027516365051,
"start": 42,
"tag": "NAME",
"value": "לירון"
}
] | null |
[] |
import java.util.Date;
/**
* Created by לירון on 22/04/2015.
*/
public class Customer {
public String _email;
public Date _dateOfBirth;
public String _categoryType;
public Customer (String email, Date dateOfBirth, String categoryType){
this._email = email;
this._dateOfBirth = dateOfBirth;
this._categoryType = categoryType;
}
}
| 383 | 0.65873 | 0.637566 | 17 | 21.235294 | 19.794621 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529412 | false | false |
0
|
47608fe4ae639dfe4e4ab397b2e074bd66000436
| 38,886,633,925,137 |
84ce6cf314b2779b5c16aadaae9a504d2ab7aae3
|
/app/src/main/java/com/agp/leaveapplication/SplashScreen.java
|
526e991d2fc0c6e4c5fe86e7e34a731eb3ea32f8
|
[] |
no_license
|
Saad-Rasheed/LeaveApplication
|
https://github.com/Saad-Rasheed/LeaveApplication
|
4ded48d8a5d904ee11464dc7f6915c0c2dee816e
|
d87c245717cdc9aae0bff8fb50bfb144a76c4668
|
refs/heads/master
| 2021-01-02T01:40:36.710000 | 2020-02-10T05:49:33 | 2020-02-10T05:49:33 | 239,437,737 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.agp.leaveapplication;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.agp.leaveapplication.Admin.Admin_HomeActivity;
public class SplashScreen extends AppCompatActivity {
private final int SPLASH_DISPLAY_LENGTH = 3000;
private SharedPreferences sharedPreferences;
private String role;
private Boolean saveLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
sharedPreferences = getSharedPreferences("MyPre", MODE_PRIVATE);
role = sharedPreferences.getString("Role", "");
saveLogin = sharedPreferences.getBoolean("saveLogin", false);
if (saveLogin.equals(true)) {
if (role.equals("0")) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashScreen.this, EmployeeHomeActivity.class);
startActivity(intent);
finish();
}
}, SPLASH_DISPLAY_LENGTH);
} else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashScreen.this, Admin_HomeActivity.class);
startActivity(intent);
finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
} else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashScreen.this, LoginActivity.class);
startActivity(intent);
finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
}
}
|
UTF-8
|
Java
| 2,074 |
java
|
SplashScreen.java
|
Java
|
[] | null |
[] |
package com.agp.leaveapplication;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.agp.leaveapplication.Admin.Admin_HomeActivity;
public class SplashScreen extends AppCompatActivity {
private final int SPLASH_DISPLAY_LENGTH = 3000;
private SharedPreferences sharedPreferences;
private String role;
private Boolean saveLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
sharedPreferences = getSharedPreferences("MyPre", MODE_PRIVATE);
role = sharedPreferences.getString("Role", "");
saveLogin = sharedPreferences.getBoolean("saveLogin", false);
if (saveLogin.equals(true)) {
if (role.equals("0")) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashScreen.this, EmployeeHomeActivity.class);
startActivity(intent);
finish();
}
}, SPLASH_DISPLAY_LENGTH);
} else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashScreen.this, Admin_HomeActivity.class);
startActivity(intent);
finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
} else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashScreen.this, LoginActivity.class);
startActivity(intent);
finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
}
}
| 2,074 | 0.557377 | 0.554484 | 61 | 33.016392 | 23.899717 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.606557 | false | false |
0
|
de537e9ea876b0535e079ed8517ff15cb6f897e2
| 4,088,808,894,198 |
52dcdd9b9e6263948ae2feaef912160ee46a2171
|
/u04/tarea_control/c1/C1.java
|
82a91f442d35ed862e7f2a99912d6d1983feaef2
|
[] |
no_license
|
fran-sc/prog-1920
|
https://github.com/fran-sc/prog-1920
|
ac0ead5ec8692cdb19700998440e1153b54adee4
|
5697974eb5a3f12fdc4d1bb54ea0d052fd7d681b
|
refs/heads/master
| 2021-06-24T19:56:15.108000 | 2021-03-02T10:32:05 | 2021-03-02T10:32:05 | 202,211,682 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class C1 {
public static void main(String[] args) {
for(int i=0, j=0; i<100; i++, j++) {
if(j==10) {
j=0;
System.out.println();
}
System.out.printf("%04d ", i*i);
}
System.out.println();
}
}
|
UTF-8
|
Java
| 298 |
java
|
C1.java
|
Java
|
[] | null |
[] |
public class C1 {
public static void main(String[] args) {
for(int i=0, j=0; i<100; i++, j++) {
if(j==10) {
j=0;
System.out.println();
}
System.out.printf("%04d ", i*i);
}
System.out.println();
}
}
| 298 | 0.395973 | 0.35906 | 12 | 23.916666 | 15.102199 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
0
|
5beac91662304932ce4fc93b75849ae2898528e8
| 28,836,410,463,605 |
89d2ece470a72410fb8c4acb9658ba8457037265
|
/ACSCheckpointing/CheckpointInterval.java
|
5138447bb4322c688fd65de21d42ebe4759e5fd3
|
[] |
no_license
|
amlne/Checkpointing-in-Cloud-Simulation
|
https://github.com/amlne/Checkpointing-in-Cloud-Simulation
|
012ef4b391a0f89500c4c644216aaf6388307a31
|
d0ea66657cf671045b15bb7060f91872ed566958
|
refs/heads/master
| 2020-04-13T21:04:06.998000 | 2018-12-28T20:34:41 | 2018-12-28T20:34:41 | 163,447,207 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public interface CheckpointInterval {
long getCheckpointInterval(long delta);
void onFailure(long ttf);
}
|
UTF-8
|
Java
| 112 |
java
|
CheckpointInterval.java
|
Java
|
[] | null |
[] |
public interface CheckpointInterval {
long getCheckpointInterval(long delta);
void onFailure(long ttf);
}
| 112 | 0.776786 | 0.776786 | 6 | 17.333334 | 17.527756 | 40 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
0
|
ea4af36272fd7445f530bf16d9c6987a4e4385c0
| 22,084,721,883,087 |
3840895ac0e4b1599e452ae9e38d1eb8aa41af9a
|
/Final/src/Enemy.java
|
3819c58e1cd92549e859025a1fedd59e9318df4f
|
[] |
no_license
|
editeddruid/Bullet-Skies
|
https://github.com/editeddruid/Bullet-Skies
|
4f0445104ddc1dbff149ee2d4109dca3501462e7
|
bed2cd95ec772d37e372c9e78ab330574921eafa
|
refs/heads/main
| 2023-05-13T12:10:22.073000 | 2021-06-07T17:37:36 | 2021-06-07T17:37:36 | 365,237,156 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import javax.swing.JComponent;
/**
*
* @author Philip Melavila and John D'Arcy
*
* Image code from Brendan Cashman
*
*/
public class Enemy extends JComponent {
//Fields
private Rectangle2D.Double enemy;
private int dx, dy, health, width, height, tick, pattern;
private ArrayList<Bullet> bullets;
private BufferedImage image;
//Constructor
public Enemy(int x, int y, int health, int width, int height, int pattern) {
enemy = new Rectangle2D.Double(0,0,width,height);
setSize(width + 1,height + 1);
dx = 0;
dy = 0;
tick = 0;
this.pattern = pattern;
this.health = health;
bullets = new ArrayList<Bullet>();
try {
image = ImageIO.read(new File("art\\Enemy.png"));
} catch (IOException ex) {
System.out.println("ERROR");
}
setLocation(x,y);
}
//Unique Methods (Different for every enemy)
public void move() {
if (pattern == 0) {
if (tick == 0) {
setDx(-2);
}
if (getX() < 0) {
setLocation(0,getY());
setDx(2);
}
if (getX() > 780 - getWidth()) {
setLocation(780 - getWidth(),getY());
setDx(-2);
}
}
}
public ArrayList<Bullet> shoot() {
if(tick % 25 == 0)
{
if(bullets.size() == 0)
{
bullets.add(new Bullet(getX() + (width/2), getY() - height, 0, (int) (Math.random() * 4) + 1, 10, 10, true, Color.BLUE, 0));
}
return bullets;
}
else
return null;
}
public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
// g2.setColor(Color.RED);
// g2.fill(enemy);
g2.drawImage(image, 0, 0, this);
}
//Getter Methods
public int getDx() {
return dx;
}
public int getDy() {
return dy;
}
public int getHealth() {
return health;
}
//Setter Methods
public void setDx(int x) {
dx = x;
}
public void setDy(int y) {
dy = y;
}
public void setHealth(int damage) {
health += damage;
}
public void update() {
tick ++;
setLocation(getX() + dx, getY() + dy);
}
}
|
UTF-8
|
Java
| 2,382 |
java
|
Enemy.java
|
Java
|
[
{
"context": "rt javax.swing.JComponent;\r\n\r\n/**\r\n * \r\n * @author Philip Melavila and John D'Arcy\r\n * \r\n * Image code from Brendan ",
"end": 336,
"score": 0.9998834729194641,
"start": 321,
"tag": "NAME",
"value": "Philip Melavila"
},
{
"context": "onent;\r\n\r\n/**\r\n * \r\n * @author Philip Melavila and John D'Arcy\r\n * \r\n * Image code from Brendan Cashman\r\n *\r\n */",
"end": 352,
"score": 0.9998807907104492,
"start": 341,
"tag": "NAME",
"value": "John D'Arcy"
},
{
"context": " Melavila and John D'Arcy\r\n * \r\n * Image code from Brendan Cashman\r\n *\r\n */\r\npublic class Enemy extends JComponent {",
"end": 393,
"score": 0.9998912811279297,
"start": 378,
"tag": "NAME",
"value": "Brendan Cashman"
}
] | null |
[] |
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import javax.swing.JComponent;
/**
*
* @author <NAME> and <NAME>
*
* Image code from <NAME>
*
*/
public class Enemy extends JComponent {
//Fields
private Rectangle2D.Double enemy;
private int dx, dy, health, width, height, tick, pattern;
private ArrayList<Bullet> bullets;
private BufferedImage image;
//Constructor
public Enemy(int x, int y, int health, int width, int height, int pattern) {
enemy = new Rectangle2D.Double(0,0,width,height);
setSize(width + 1,height + 1);
dx = 0;
dy = 0;
tick = 0;
this.pattern = pattern;
this.health = health;
bullets = new ArrayList<Bullet>();
try {
image = ImageIO.read(new File("art\\Enemy.png"));
} catch (IOException ex) {
System.out.println("ERROR");
}
setLocation(x,y);
}
//Unique Methods (Different for every enemy)
public void move() {
if (pattern == 0) {
if (tick == 0) {
setDx(-2);
}
if (getX() < 0) {
setLocation(0,getY());
setDx(2);
}
if (getX() > 780 - getWidth()) {
setLocation(780 - getWidth(),getY());
setDx(-2);
}
}
}
public ArrayList<Bullet> shoot() {
if(tick % 25 == 0)
{
if(bullets.size() == 0)
{
bullets.add(new Bullet(getX() + (width/2), getY() - height, 0, (int) (Math.random() * 4) + 1, 10, 10, true, Color.BLUE, 0));
}
return bullets;
}
else
return null;
}
public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
// g2.setColor(Color.RED);
// g2.fill(enemy);
g2.drawImage(image, 0, 0, this);
}
//Getter Methods
public int getDx() {
return dx;
}
public int getDy() {
return dy;
}
public int getHealth() {
return health;
}
//Setter Methods
public void setDx(int x) {
dx = x;
}
public void setDy(int y) {
dy = y;
}
public void setHealth(int damage) {
health += damage;
}
public void update() {
tick ++;
setLocation(getX() + dx, getY() + dy);
}
}
| 2,359 | 0.576406 | 0.557515 | 124 | 17.225807 | 18.497532 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.032258 | false | false |
0
|
6dca1e61053ffd5f29ec923dd32bfb48534e7f60
| 12,661,563,656,039 |
0af8b92686a58eb0b64e319b22411432aca7a8f3
|
/large-multiproject/project3/src/test/java/org/gradle/test/performance3_3/Test3_294.java
|
7c54c4e0a7cf64ee4c4f993829fcc5c06e392427
|
[] |
no_license
|
gradle/performance-comparisons
|
https://github.com/gradle/performance-comparisons
|
b0d38db37c326e0ce271abebdb3c91769b860799
|
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
|
refs/heads/master
| 2023-08-14T19:24:39.164000 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | false | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | 2022-09-09T14:38:38 | 2022-09-30T08:04:34 | 19,731 | 14 | 13 | 103 | null | false | false |
package org.gradle.test.performance3_3;
import static org.junit.Assert.*;
public class Test3_294 {
private final Production3_294 production = new Production3_294("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
}
|
UTF-8
|
Java
| 288 |
java
|
Test3_294.java
|
Java
|
[] | null |
[] |
package org.gradle.test.performance3_3;
import static org.junit.Assert.*;
public class Test3_294 {
private final Production3_294 production = new Production3_294("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
}
| 288 | 0.694444 | 0.645833 | 12 | 23.083334 | 23.570667 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
0
|
55c8947ac1a7610a6ab4f01ad287acee5cc96f71
| 11,544,872,145,125 |
6308e091364a50265be56ae2fb4a2591d1135599
|
/playground/Javase/src/com/wangy325/collection/list/ex3/wList.java
|
d08637bab3aa905942bf0c92daaaaea07d61c7ee
|
[] |
no_license
|
wangy325/javaSE
|
https://github.com/wangy325/javaSE
|
c9c9d452e10a41e13d4d3b09da5b8b56a0e3aea9
|
348d5b94107fe3380f6d1026683d3fcac934a15b
|
refs/heads/master
| 2021-09-07T18:23:15.785000 | 2018-02-27T08:35:04 | 2018-02-27T08:35:04 | 112,810,591 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
*/
package com.wangy325.collection.list.ex3;
import java.util.*;
/**
* @author wangy325
*
* @date Dec 19, 2017 5:43:17 PM
*
* @decription 调用集合元素的方法, 要对集合中取出的元素进行类型转换
*
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class wList {
private List workList;
public wList() {
this.workList = new ArrayList();
}
// 初始化集合的方法 iniList()
public void iniList() {
workList.add(new Worker("zhang3", 18, 3000));
workList.add(new Worker("li4", 20, 3500));
workList.add(new Worker("wang5", 19, 3200));
}
// 输出集合中元素的方法
public void printListElement() {
for (Object li : workList) { // 增强for 循环遍历
if (li instanceof Worker) { // instance(实例a) instanceof class [多态中的向下转型啊]
Worker list = (Worker) li; // 为了调用 Worker 的方法,此处将 遍历中的 集合元素强转成 Worker 类
list.showInfo();
}
}
System.out.println("-------------------");
}
// 向集合中添加元素的方法
public void addWorker(int index, Worker worker) {
workList.add(index, worker);
}
// 删除集合中指定位置的元素
public void rmWorker(int index) {
workList.remove(index);
}
// 利用迭代器输出集合元素的方法 printListElement2()
public void printListElement2() {
Iterator ite = workList.iterator();
while (ite.hasNext()) {
// ite.next() 返回一个 Object 需要 类型转换
// if (ite.next() instanceof Worker) { //①
Worker wok = (Worker) ite.next();
wok.showInfo();
// }
/**
* 说明: 这里如果加入了①式 中的 instanceof 语句, 会导致 NullSuchElementException 错误
* 这个错误, 与 Exercises2/com.wangy325.workbook1_8/Test.java 中使用 Scanner 的next()
* 读取控制台输入出现的错误一样
*
* 原因在于, if 判断语句里面迭代一次, 然后类型强制转换里面又迭代了一次,
* 这导致了 cousor 值越界, 而集合对象对应的 Worker 对象并不存在
*/
}
System.out.println("-------------------");
}
// 判断集合中是否存在给定 Worker 对象的方法 isExist()
public boolean isExist(Worker worker) {
if (workList.contains(worker))
return true;
return false;
}
public static void main(String[] args) {
wList wl = new wList();
wl.iniList();
wl.printListElement();
Worker worker4 = new Worker("zhao6",26,4100);
wl.addWorker(0, worker4);
wl.printListElement();
wl.rmWorker(3);
wl.printListElement2();
Worker worker5 = new Worker("wang5",19,3200);
System.out.println(wl.isExist(worker5)?"存在worker5:":"不存在worker5");
}
}
/*// 测试为 Worker 类重写的 equals 方法:
// 新建两个worker 对象
Worker worker1 = new Worker("li4", 20, 3500);// 存在
Worker worker2 = new Worker("wang5", 19, 3200);// 不存在
Worker worker3 = new Worker(null, 19, 3200);// ① 不存在
*//**
* 如果没有重写 equals 方法, 两个表达式返回的都是 false
* 利用equals 可以进行判断之后的增加操作, 若已经存在, 则不添加, 否则添加....
*
* contains() 方法依次比较的是 workList.get(index).eauqals(worker) 是否
* 逻辑相等, 只要有一个相等, 便返回 true
*
* 对于①表达式, 如果判断出现 NullPointerException 错误, 这是由于重写的 equals 方法
* 不够健康, 没有判空!
*//*
System.out.println("集合中是否包含 worker1?" + (workList.contains(worker1) ? "是" : "否"));
System.out.println("集合中是否包含 worker2?" + (workList.contains(worker2) ? "是" : "否"));
System.out.println("集合中是否包含 worker3?" + (workList.contains(worker3) ? "是" : "否"));*/
|
UTF-8
|
Java
| 3,732 |
java
|
wList.java
|
Java
|
[
{
"context": "ion.list.ex3;\n\nimport java.util.*;\n\n/**\n * @author wangy325\n *\n * @date Dec 19, 2017 5:43:17 PM\n *\n * @decri",
"end": 99,
"score": 0.9996712803840637,
"start": 91,
"tag": "USERNAME",
"value": "wangy325"
},
{
"context": "ublic void iniList() {\n\t\tworkList.add(new Worker(\"zhang3\", 18, 3000));\n\t\tworkList.add(new Worker(\"li4\", 20",
"end": 424,
"score": 0.8118894696235657,
"start": 418,
"tag": "USERNAME",
"value": "zhang3"
},
{
"context": "ker(\"li4\", 20, 3500));\n\t\tworkList.add(new Worker(\"wang5\", 19, 3200));\n\t}\n\n\t// 输出集合中元素的方法\n\tpublic void pri",
"end": 516,
"score": 0.7177045941352844,
"start": 511,
"tag": "USERNAME",
"value": "wang5"
},
{
"context": "rintListElement();\n\t\tWorker worker4 = new Worker(\"zhao6\",26,4100);\n\t\twl.addWorker(0, worker4);\n\t\twl.print",
"end": 1961,
"score": 0.9777905941009521,
"start": 1956,
"tag": "USERNAME",
"value": "zhao6"
},
{
"context": "intListElement2();\n\t\tWorker worker5 = new Worker(\"wang5\",19,3200);\n\t\tSystem.out.println(wl.isExist(worker",
"end": 2106,
"score": 0.9902663230895996,
"start": 2101,
"tag": "USERNAME",
"value": "wang5"
},
{
"context": "\t\t// 新建两个worker 对象\n\t\tWorker worker1 = new Worker(\"li4\", 20, 3500);// 存在\n\t\tWorker worker2 = new Worker(\"",
"end": 2277,
"score": 0.9790912866592407,
"start": 2274,
"tag": "USERNAME",
"value": "li4"
},
{
"context": "\", 20, 3500);// 存在\n\t\tWorker worker2 = new Worker(\"wang5\", 19, 3200);// 不存在\n\t\tWorker worker3 = new Worker(",
"end": 2332,
"score": 0.9824652671813965,
"start": 2327,
"tag": "USERNAME",
"value": "wang5"
}
] | null |
[] |
/**
*
*/
package com.wangy325.collection.list.ex3;
import java.util.*;
/**
* @author wangy325
*
* @date Dec 19, 2017 5:43:17 PM
*
* @decription 调用集合元素的方法, 要对集合中取出的元素进行类型转换
*
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class wList {
private List workList;
public wList() {
this.workList = new ArrayList();
}
// 初始化集合的方法 iniList()
public void iniList() {
workList.add(new Worker("zhang3", 18, 3000));
workList.add(new Worker("li4", 20, 3500));
workList.add(new Worker("wang5", 19, 3200));
}
// 输出集合中元素的方法
public void printListElement() {
for (Object li : workList) { // 增强for 循环遍历
if (li instanceof Worker) { // instance(实例a) instanceof class [多态中的向下转型啊]
Worker list = (Worker) li; // 为了调用 Worker 的方法,此处将 遍历中的 集合元素强转成 Worker 类
list.showInfo();
}
}
System.out.println("-------------------");
}
// 向集合中添加元素的方法
public void addWorker(int index, Worker worker) {
workList.add(index, worker);
}
// 删除集合中指定位置的元素
public void rmWorker(int index) {
workList.remove(index);
}
// 利用迭代器输出集合元素的方法 printListElement2()
public void printListElement2() {
Iterator ite = workList.iterator();
while (ite.hasNext()) {
// ite.next() 返回一个 Object 需要 类型转换
// if (ite.next() instanceof Worker) { //①
Worker wok = (Worker) ite.next();
wok.showInfo();
// }
/**
* 说明: 这里如果加入了①式 中的 instanceof 语句, 会导致 NullSuchElementException 错误
* 这个错误, 与 Exercises2/com.wangy325.workbook1_8/Test.java 中使用 Scanner 的next()
* 读取控制台输入出现的错误一样
*
* 原因在于, if 判断语句里面迭代一次, 然后类型强制转换里面又迭代了一次,
* 这导致了 cousor 值越界, 而集合对象对应的 Worker 对象并不存在
*/
}
System.out.println("-------------------");
}
// 判断集合中是否存在给定 Worker 对象的方法 isExist()
public boolean isExist(Worker worker) {
if (workList.contains(worker))
return true;
return false;
}
public static void main(String[] args) {
wList wl = new wList();
wl.iniList();
wl.printListElement();
Worker worker4 = new Worker("zhao6",26,4100);
wl.addWorker(0, worker4);
wl.printListElement();
wl.rmWorker(3);
wl.printListElement2();
Worker worker5 = new Worker("wang5",19,3200);
System.out.println(wl.isExist(worker5)?"存在worker5:":"不存在worker5");
}
}
/*// 测试为 Worker 类重写的 equals 方法:
// 新建两个worker 对象
Worker worker1 = new Worker("li4", 20, 3500);// 存在
Worker worker2 = new Worker("wang5", 19, 3200);// 不存在
Worker worker3 = new Worker(null, 19, 3200);// ① 不存在
*//**
* 如果没有重写 equals 方法, 两个表达式返回的都是 false
* 利用equals 可以进行判断之后的增加操作, 若已经存在, 则不添加, 否则添加....
*
* contains() 方法依次比较的是 workList.get(index).eauqals(worker) 是否
* 逻辑相等, 只要有一个相等, 便返回 true
*
* 对于①表达式, 如果判断出现 NullPointerException 错误, 这是由于重写的 equals 方法
* 不够健康, 没有判空!
*//*
System.out.println("集合中是否包含 worker1?" + (workList.contains(worker1) ? "是" : "否"));
System.out.println("集合中是否包含 worker2?" + (workList.contains(worker2) ? "是" : "否"));
System.out.println("集合中是否包含 worker3?" + (workList.contains(worker3) ? "是" : "否"));*/
| 3,732 | 0.651123 | 0.616065 | 109 | 25.944954 | 22.67757 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.972477 | false | false |
0
|
36bffdeeea4274b0ce5dad27fde50f7c005655e2
| 24,180,665,887,323 |
832bf5140baf52fc9aa03ab25e0d77da9f6f16f0
|
/src/com/ChewieLouie/Topical/WatchedTopicListAdapter.java
|
ddabdcf8e0dd680247ae4b02b6d70e3a647dd392
|
[] |
no_license
|
julianchurchill/Topical
|
https://github.com/julianchurchill/Topical
|
892082b5aed2c018f1057cf6a0b83544903c1804
|
fb511a57bb5c33d7782f86e8d78bc754a2bb6975
|
refs/heads/master
| 2020-05-29T12:32:50.912000 | 2015-02-09T20:17:49 | 2015-02-09T20:17:49 | 2,350,508 | 4 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ChewieLouie.Topical;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.ChewieLouie.Topical.View.WatchedTopicView;
public class WatchedTopicListAdapter extends ArrayAdapter<TopicIfc> {
private static final int layoutResource = R.layout.watched_topic_list_item;
private List<TopicIfc> items = null;
private Context myContext = null;
private Map<Integer, View> viewCache = new HashMap<Integer, View>();
public WatchedTopicListAdapter(Context context, ArrayList<TopicIfc> arrayList) {
super(context, layoutResource, arrayList);
this.items = arrayList;
this.myContext = context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = viewCache.get( position );
if( v == null ) {
LayoutInflater vi = (LayoutInflater)myContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(layoutResource, null);
viewCache.put( position, v );
}
TopicIfc topic = items.get(position);
if( topic != null ) {
TextView textView = (TextView) v.findViewById( R.id.topic_list_item_text );
TextView statusTextView = (TextView) v.findViewById( R.id.topic_list_item_status );
topic.showStatus( new WatchedTopicView( textView, statusTextView ) );
}
return v;
}
}
|
UTF-8
|
Java
| 1,633 |
java
|
WatchedTopicListAdapter.java
|
Java
|
[] | null |
[] |
package com.ChewieLouie.Topical;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.ChewieLouie.Topical.View.WatchedTopicView;
public class WatchedTopicListAdapter extends ArrayAdapter<TopicIfc> {
private static final int layoutResource = R.layout.watched_topic_list_item;
private List<TopicIfc> items = null;
private Context myContext = null;
private Map<Integer, View> viewCache = new HashMap<Integer, View>();
public WatchedTopicListAdapter(Context context, ArrayList<TopicIfc> arrayList) {
super(context, layoutResource, arrayList);
this.items = arrayList;
this.myContext = context;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = viewCache.get( position );
if( v == null ) {
LayoutInflater vi = (LayoutInflater)myContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(layoutResource, null);
viewCache.put( position, v );
}
TopicIfc topic = items.get(position);
if( topic != null ) {
TextView textView = (TextView) v.findViewById( R.id.topic_list_item_text );
TextView statusTextView = (TextView) v.findViewById( R.id.topic_list_item_status );
topic.showStatus( new WatchedTopicView( textView, statusTextView ) );
}
return v;
}
}
| 1,633 | 0.699939 | 0.699939 | 47 | 32.787235 | 27.711227 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.234043 | false | false |
0
|
b0759f9c42fd558a56226677ad1ffcd7fa709036
| 33,586,644,278,620 |
e1024953736c025e14457b1be379dbfd15f23838
|
/base/src/main/java/com/nabinbhandari/notification/NotificationsFragment.java
|
6df96aaec246980d76ec6228f17d2cf26730e50f
|
[] |
no_license
|
MKAMANOJ/Nepal-Municipality
|
https://github.com/MKAMANOJ/Nepal-Municipality
|
fbca30f15a4b1092cd43f021427de5b99781c9b9
|
27e2644312789ceacea21e20cb74622582b908a6
|
refs/heads/master
| 2023-06-20T00:40:40.171000 | 2021-07-17T14:22:03 | 2021-07-17T14:22:03 | 137,220,884 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.nabinbhandari.notification;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.nabinbhandari.firebaseutils.ChildEventAdapter;
import com.nabinbhandari.municipality.BaseFragment;
import com.nabinbhandari.municipality.R;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
/**
* Created at 9:47 PM on 1/20/2018.
*
* @author bnabin51@gmail.com
*/
public class NotificationsFragment extends BaseFragment {
private NotificationsAdapter adapter;
private DatabaseReference dbReference;
private ChildEventAdapter listener;
public NotificationsFragment() {
}
public static NotificationsFragment newInstance() {
return new NotificationsFragment();
}
@Override
protected View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container) {
final Context context = getContext() == null ? inflater.getContext() : getContext();
ListView listView = new ListView(context);
listView.setSelector(android.R.color.transparent);
int padding = context.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);
listView.setPadding(padding / 2, padding, padding / 2, padding);
listView.setDivider(null);
adapter = new NotificationsAdapter(context, new ArrayList<NotificationContent>());
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
NotificationContent content = adapter.getItem(position);
if (content == null) return;
String dbLocation = "tbl_push_notifications/" + content.key + "/message";
startActivity(new Intent(context, NotificationActivity.class)
.putExtra(NotificationActivity.KEY_TITLE, content.title)
.putExtra(NotificationActivity.KEY_DB_LOCATION, dbLocation));
}
});
loadNotifications();
return listView;
}
public void loadNotifications() {
dbReference = FirebaseDatabase.getInstance().getReference("tbl_push_notifications");
listener = new ChildEventAdapter(getContext()) {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
NotificationContent content = NotificationContent.from(dataSnapshot);
if (content == null) return;
adapter.add(content);
onLoad(adapter.getCount());
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
NotificationContent content = NotificationContent.from(dataSnapshot);
if (content == null) return;
adapter.remove(content);
onLoad(adapter.getCount());
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
NotificationContent content = NotificationContent.from(dataSnapshot);
if (content == null) return;
int index = adapter.getPosition(content);
if (index < 0) return;
NotificationContent existing = adapter.getItem(index);
if (existing == null) return;
existing.set(content);
adapter.notifyDataSetChanged();
}
};
startLoading(dbReference, listener);
}
@Override
public void onDestroy() {
if (dbReference != null) dbReference.removeEventListener(listener);
super.onDestroy();
}
private class NotificationsAdapter extends ArrayAdapter<NotificationContent> {
private ArrayList<NotificationContent> notifications;
NotificationsAdapter(@NonNull Context context, ArrayList<NotificationContent> notifications) {
super(context, R.layout.item_content, notifications);
this.notifications = notifications;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View rootView = convertView;
if (rootView == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());
rootView = inflater.inflate(R.layout.item_content, parent, false);
}
NotificationContent content = getItem(position);
if (content == null) return rootView;
TextView titleTextView = rootView.findViewById(R.id.content_title_text);
TextView descTextView = rootView.findViewById(R.id.content_desc_text);
titleTextView.setText(getString(R.string.app_name));
descTextView.setText(content.title);
return rootView;
}
@Override
public void notifyDataSetChanged() {
Collections.sort(notifications, new Comparator<NotificationContent>() {
@Override
public int compare(NotificationContent o1, NotificationContent o2) {
if (o1.updated_at == null || o2.updated_at == null) return 0;
return o2.updated_at.compareTo(o1.updated_at);
}
});
super.notifyDataSetChanged();
}
}
}
|
UTF-8
|
Java
| 5,926 |
java
|
NotificationsFragment.java
|
Java
|
[
{
"context": "\n * Created at 9:47 PM on 1/20/2018.\n *\n * @author bnabin51@gmail.com\n */\n\npublic class NotificationsFragment extends B",
"end": 891,
"score": 0.9999234676361084,
"start": 873,
"tag": "EMAIL",
"value": "bnabin51@gmail.com"
}
] | null |
[] |
package com.nabinbhandari.notification;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.nabinbhandari.firebaseutils.ChildEventAdapter;
import com.nabinbhandari.municipality.BaseFragment;
import com.nabinbhandari.municipality.R;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
/**
* Created at 9:47 PM on 1/20/2018.
*
* @author <EMAIL>
*/
public class NotificationsFragment extends BaseFragment {
private NotificationsAdapter adapter;
private DatabaseReference dbReference;
private ChildEventAdapter listener;
public NotificationsFragment() {
}
public static NotificationsFragment newInstance() {
return new NotificationsFragment();
}
@Override
protected View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container) {
final Context context = getContext() == null ? inflater.getContext() : getContext();
ListView listView = new ListView(context);
listView.setSelector(android.R.color.transparent);
int padding = context.getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);
listView.setPadding(padding / 2, padding, padding / 2, padding);
listView.setDivider(null);
adapter = new NotificationsAdapter(context, new ArrayList<NotificationContent>());
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
NotificationContent content = adapter.getItem(position);
if (content == null) return;
String dbLocation = "tbl_push_notifications/" + content.key + "/message";
startActivity(new Intent(context, NotificationActivity.class)
.putExtra(NotificationActivity.KEY_TITLE, content.title)
.putExtra(NotificationActivity.KEY_DB_LOCATION, dbLocation));
}
});
loadNotifications();
return listView;
}
public void loadNotifications() {
dbReference = FirebaseDatabase.getInstance().getReference("tbl_push_notifications");
listener = new ChildEventAdapter(getContext()) {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
NotificationContent content = NotificationContent.from(dataSnapshot);
if (content == null) return;
adapter.add(content);
onLoad(adapter.getCount());
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
NotificationContent content = NotificationContent.from(dataSnapshot);
if (content == null) return;
adapter.remove(content);
onLoad(adapter.getCount());
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
NotificationContent content = NotificationContent.from(dataSnapshot);
if (content == null) return;
int index = adapter.getPosition(content);
if (index < 0) return;
NotificationContent existing = adapter.getItem(index);
if (existing == null) return;
existing.set(content);
adapter.notifyDataSetChanged();
}
};
startLoading(dbReference, listener);
}
@Override
public void onDestroy() {
if (dbReference != null) dbReference.removeEventListener(listener);
super.onDestroy();
}
private class NotificationsAdapter extends ArrayAdapter<NotificationContent> {
private ArrayList<NotificationContent> notifications;
NotificationsAdapter(@NonNull Context context, ArrayList<NotificationContent> notifications) {
super(context, R.layout.item_content, notifications);
this.notifications = notifications;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View rootView = convertView;
if (rootView == null) {
LayoutInflater inflater = LayoutInflater.from(getContext());
rootView = inflater.inflate(R.layout.item_content, parent, false);
}
NotificationContent content = getItem(position);
if (content == null) return rootView;
TextView titleTextView = rootView.findViewById(R.id.content_title_text);
TextView descTextView = rootView.findViewById(R.id.content_desc_text);
titleTextView.setText(getString(R.string.app_name));
descTextView.setText(content.title);
return rootView;
}
@Override
public void notifyDataSetChanged() {
Collections.sort(notifications, new Comparator<NotificationContent>() {
@Override
public int compare(NotificationContent o1, NotificationContent o2) {
if (o1.updated_at == null || o2.updated_at == null) return 0;
return o2.updated_at.compareTo(o1.updated_at);
}
});
super.notifyDataSetChanged();
}
}
}
| 5,915 | 0.651704 | 0.647992 | 155 | 37.232258 | 29.585049 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.664516 | false | false |
0
|
be01c5a36a1186537a60763b3fcd1a1682ea9fd1
| 24,266,565,281,884 |
14184f73238b1ebc61b1b9f92ce4d791f1994118
|
/aframework/aframework-web/src/main/java/com/controllers/font/UserController.java
|
e7874829bfbdda1765866363609a99e5d2f7c895
|
[] |
no_license
|
xizhimojie/aframework-layer
|
https://github.com/xizhimojie/aframework-layer
|
986207fea7fae08229599c3e0cc5dbb568615d5f
|
4fde7b36ede9e130b6bd4426e9c285395ef05439
|
refs/heads/master
| 2021-07-15T09:36:47.012000 | 2017-10-18T01:25:50 | 2017-10-18T01:25:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.controllers.font;
import java.sql.Timestamp;
import java.util.UUID;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.domain.users.User;
import com.service.authentication.IAuthenticationService;
import com.service.users.IUserService;
/**
* @author Alvis
* @version 1.0.0
* @ClassName UserController
* @Description UserController
* @Date Jul 6, 2017 4:12:42 PM
*/
@Controller("FUserController")
@RequestMapping("/user")
public class UserController extends BaseFontController {
@Autowired
private IUserService userService;
@Autowired
private IAuthenticationService authenticationService;
@RequestMapping("/login")
public String Login() {
return prefView + "/user/login";
}
@RequestMapping(value = "/loginPost", method = RequestMethod.POST)
public String LoginPost(String username, String password) {
Subject currentUser = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username, password,true);
try {
currentUser.login(token);
return "redirect:/admin/home/index";
// return "redirect:/Home/Index";
} catch (AuthenticationException e) {
e.printStackTrace();
return prefView + "/user/login";
}
// 是否认证通过
// boolean isAuthenticated = currentUser.isAuthenticated();
// System.out.println("是否认证通过: " + isAuthenticated);
// 退出操作
// currentUser.logout();
// isAuthenticated = currentUser.isAuthenticated();
// System.out.println("是否认证通过: " + isAuthenticated);
// 基于资源的授权(权限标识符)
// boolean permitted = currentUser.isPermitted("user:create");
// System.out.println("基于资源的授权: " + permitted);
}
@RequestMapping("/register")
public String Register() {
return prefView + "/user/register";
}
@PostMapping("/registerPost")
public String RegisterPost(String username, String password) {
User user = new User();
UUID uuid = UUID.randomUUID();
user.setUserUuid(uuid.toString());
String encodePwd = authenticationService.pwdEncode(password);
user.setPassword(encodePwd);
user.setUserName(username);
user.setName(username);
user.setLastActiveTime(new Timestamp(System.currentTimeMillis()));
userService.insertUser(user);
return prefView + "/user/login";
}
@RequestMapping("/loginout")
public String Loginout() {
Subject currentUser = SecurityUtils.getSubject();
currentUser.logout();
return prefView + "/user/login";
}
}
|
UTF-8
|
Java
| 3,178 |
java
|
UserController.java
|
Java
|
[
{
"context": "rt com.service.users.IUserService;\n\n/**\n * @author Alvis\n * @version 1.0.0\n * @ClassName UserController\n *",
"end": 717,
"score": 0.9972274303436279,
"start": 712,
"tag": "NAME",
"value": "Alvis"
},
{
"context": ".setPassword(encodePwd);\n user.setUserName(username);\n user.setName(username);\n user.se",
"end": 2697,
"score": 0.9636849164962769,
"start": 2689,
"tag": "USERNAME",
"value": "username"
},
{
"context": " user.setUserName(username);\n user.setName(username);\n user.setLastActiveTime(new Timestamp(Sy",
"end": 2729,
"score": 0.9081347584724426,
"start": 2721,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package com.controllers.font;
import java.sql.Timestamp;
import java.util.UUID;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.domain.users.User;
import com.service.authentication.IAuthenticationService;
import com.service.users.IUserService;
/**
* @author Alvis
* @version 1.0.0
* @ClassName UserController
* @Description UserController
* @Date Jul 6, 2017 4:12:42 PM
*/
@Controller("FUserController")
@RequestMapping("/user")
public class UserController extends BaseFontController {
@Autowired
private IUserService userService;
@Autowired
private IAuthenticationService authenticationService;
@RequestMapping("/login")
public String Login() {
return prefView + "/user/login";
}
@RequestMapping(value = "/loginPost", method = RequestMethod.POST)
public String LoginPost(String username, String password) {
Subject currentUser = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username, password,true);
try {
currentUser.login(token);
return "redirect:/admin/home/index";
// return "redirect:/Home/Index";
} catch (AuthenticationException e) {
e.printStackTrace();
return prefView + "/user/login";
}
// 是否认证通过
// boolean isAuthenticated = currentUser.isAuthenticated();
// System.out.println("是否认证通过: " + isAuthenticated);
// 退出操作
// currentUser.logout();
// isAuthenticated = currentUser.isAuthenticated();
// System.out.println("是否认证通过: " + isAuthenticated);
// 基于资源的授权(权限标识符)
// boolean permitted = currentUser.isPermitted("user:create");
// System.out.println("基于资源的授权: " + permitted);
}
@RequestMapping("/register")
public String Register() {
return prefView + "/user/register";
}
@PostMapping("/registerPost")
public String RegisterPost(String username, String password) {
User user = new User();
UUID uuid = UUID.randomUUID();
user.setUserUuid(uuid.toString());
String encodePwd = authenticationService.pwdEncode(password);
user.setPassword(encodePwd);
user.setUserName(username);
user.setName(username);
user.setLastActiveTime(new Timestamp(System.currentTimeMillis()));
userService.insertUser(user);
return prefView + "/user/login";
}
@RequestMapping("/loginout")
public String Loginout() {
Subject currentUser = SecurityUtils.getSubject();
currentUser.logout();
return prefView + "/user/login";
}
}
| 3,178 | 0.685401 | 0.681202 | 99 | 30.272728 | 23.09568 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.525253 | false | false |
0
|
5a14f6cf182816203860f209a3ad33c71ebc052c
| 2,087,354,123,570 |
10b2922b74b792060b65dc1ae80658bf287c4622
|
/src/main/java/com/liberty/util/ControllerUtils.java
|
57728a0740a9d6150c2561c87c07dc2de787fc1f
|
[] |
no_license
|
dimitrkovalsky/fifa-backend
|
https://github.com/dimitrkovalsky/fifa-backend
|
7d49332a917a15bc5e0c275f051146be185b935b
|
0c23e2f15035ea489ffd1bd07120f3636d074501
|
refs/heads/master
| 2021-01-12T13:21:12.565000 | 2016-12-05T09:55:59 | 2016-12-05T09:55:59 | 72,206,376 | 0 | 0 | null | false | 2016-12-05T09:55:59 | 2016-10-28T12:42:24 | 2016-10-28T12:42:39 | 2016-12-05T09:55:59 | 22 | 0 | 0 | 0 |
Java
| null | null |
package com.liberty.util;
import static com.google.common.base.Strings.isNullOrEmpty;
public class ControllerUtils {
private static final String SPLITTER = ",";
public static String[] splitRequestParameter(String requestParameter) {
if (isNullOrEmpty(requestParameter)) {
return null;
}
return requestParameter.split(SPLITTER);
}
}
|
UTF-8
|
Java
| 384 |
java
|
ControllerUtils.java
|
Java
|
[] | null |
[] |
package com.liberty.util;
import static com.google.common.base.Strings.isNullOrEmpty;
public class ControllerUtils {
private static final String SPLITTER = ",";
public static String[] splitRequestParameter(String requestParameter) {
if (isNullOrEmpty(requestParameter)) {
return null;
}
return requestParameter.split(SPLITTER);
}
}
| 384 | 0.695313 | 0.695313 | 15 | 24.6 | 24.311314 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
0
|
f631f2de3ba6a7fb10a1c7e9fbc2570e1e9bc944
| 2,087,354,126,296 |
3a4ea1330e1d3738d6a8170610997acd3f0a179a
|
/src/main/java/com/company/akeninbaev/json/UserInteractionDeserializer.java
|
1d5673ba7bc1b71b9c16234653fd66141288e6e4
|
[] |
no_license
|
Alish04/MemoTinder
|
https://github.com/Alish04/MemoTinder
|
85fbbd0a36c91368d5b4f01269405bd8e7c9aa71
|
1cd8eb9a4edf58521b9ae6b94ab02e5044621c99
|
refs/heads/master
| 2023-04-08T14:58:18.010000 | 2021-04-12T12:54:07 | 2021-04-12T12:54:07 | 356,516,094 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.company.akeninbaev.json;
import com.company.akeninbaev.model.Meme;
import com.company.akeninbaev.model.User;
import com.company.akeninbaev.model.MemeReview;
import com.company.akeninbaev.model.UserInteraction;
import com.company.akeninbaev.services.Service;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.DaoManager;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class UserInteractionDeserializer extends StdDeserializer<UserInteraction> {
private final Service<User, Integer> userService;
protected UserInteractionDeserializer(Service<User, Integer> userService) {
super(UserInteraction.class);
this.userService = userService;
}
@Override
public UserInteraction deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
JsonNode root = jsonParser.getCodec().readTree(jsonParser);
int id = root.get("id").asInt();
int source = root.get("source").asInt();
User user = userService.findById(source);
int target = root.get("target").asInt();
User user1 = userService.findById(target);
boolean reaction = root.get("reaction").asBoolean();
String date = root.get("date").asText();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MMM-yyyy");
LocalDate date1 = LocalDate.parse(date,formatter);
return new UserInteraction(id, user, user1, reaction, date1);
}
}
|
UTF-8
|
Java
| 1,877 |
java
|
UserInteractionDeserializer.java
|
Java
|
[] | null |
[] |
package com.company.akeninbaev.json;
import com.company.akeninbaev.model.Meme;
import com.company.akeninbaev.model.User;
import com.company.akeninbaev.model.MemeReview;
import com.company.akeninbaev.model.UserInteraction;
import com.company.akeninbaev.services.Service;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.DaoManager;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class UserInteractionDeserializer extends StdDeserializer<UserInteraction> {
private final Service<User, Integer> userService;
protected UserInteractionDeserializer(Service<User, Integer> userService) {
super(UserInteraction.class);
this.userService = userService;
}
@Override
public UserInteraction deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
JsonNode root = jsonParser.getCodec().readTree(jsonParser);
int id = root.get("id").asInt();
int source = root.get("source").asInt();
User user = userService.findById(source);
int target = root.get("target").asInt();
User user1 = userService.findById(target);
boolean reaction = root.get("reaction").asBoolean();
String date = root.get("date").asText();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MMM-yyyy");
LocalDate date1 = LocalDate.parse(date,formatter);
return new UserInteraction(id, user, user1, reaction, date1);
}
}
| 1,877 | 0.742674 | 0.737347 | 42 | 42.690475 | 29.020098 | 154 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.928571 | false | false |
0
|
7960710c8898618c82b6bfc831202524ed42999c
| 30,468,498,057,166 |
e53f1e8836de2771127b3687f0e6d9c44f9b3c5d
|
/src/UdpTransmitter.java
|
aa30c0cabe2837964d1c0a66f2abaafaaa3a62a8
|
[] |
no_license
|
nietoperz809/IpAddressField
|
https://github.com/nietoperz809/IpAddressField
|
16534f5ee9eba061dbd9d2887b5f942acc7b5f93
|
5766934a154fc66e2482edd4bc5bc21a4cb1aacb
|
refs/heads/master
| 2023-01-15T10:33:22.836000 | 2020-11-18T14:13:59 | 2020-11-18T14:13:59 | 310,716,493 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import javax.swing.*;
import java.net.InetAddress;
public class UdpTransmitter extends PeriodicTransmitter {
private final UdpSocket socket;
private final int port;
private final InetAddress dest;
public UdpTransmitter(UdpSocket sc, JTextArea source, InetAddress dest, int port) {
super (source);
this.dest = dest;
this.port = port;
this.socket = sc;
}
void doSend (byte[] buff)
{
socket.sendDirect (dest, port, buff);
}
}
|
UTF-8
|
Java
| 499 |
java
|
UdpTransmitter.java
|
Java
|
[] | null |
[] |
import javax.swing.*;
import java.net.InetAddress;
public class UdpTransmitter extends PeriodicTransmitter {
private final UdpSocket socket;
private final int port;
private final InetAddress dest;
public UdpTransmitter(UdpSocket sc, JTextArea source, InetAddress dest, int port) {
super (source);
this.dest = dest;
this.port = port;
this.socket = sc;
}
void doSend (byte[] buff)
{
socket.sendDirect (dest, port, buff);
}
}
| 499 | 0.651303 | 0.651303 | 20 | 23.9 | 21.382002 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
0
|
82071333d564bb31c703492cf94305c2e52cfb3b
| 25,924,422,644,906 |
21cae18da95f4b2ab66bb122c090f95df39fbae9
|
/sc-feign/src/main/java/com/zhengjing/web/hystrix/simple/NewsRemoteClientHystrix.java
|
c435a4cc7ff3a658a115ff7d05e395b280a6171a
|
[] |
no_license
|
zhengjing1124/springcloud
|
https://github.com/zhengjing1124/springcloud
|
7151714735de728c911916d90824c50ef2b6fc17
|
ed5e77fc792fa346de3bc30ac86b5ec0e2170a0f
|
refs/heads/master
| 2022-11-13T17:11:30.690000 | 2017-11-28T11:00:52 | 2017-11-28T11:00:52 | 112,320,855 | 2 | 0 | null | false | 2022-10-19T09:25:59 | 2017-11-28T10:26:13 | 2019-01-23T11:36:44 | 2022-10-19T09:25:57 | 2,854 | 0 | 0 | 1 |
Java
| false | false |
package com.zhengjing.web.hystrix.simple;
import com.github.pagehelper.PageInfo;
import com.zhengjing.api.common.exception.BusinessException;
import com.zhengjing.api.common.exception.RemoteRequestExcepton;
import com.zhengjing.api.model.simple.News;
import com.zhengjing.web.remote.simple.NewsRemoteClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class NewsRemoteClientHystrix implements NewsRemoteClient {
private static final Logger log = LoggerFactory.getLogger(NewsRemoteClient.class);
@Override
public Boolean addNews(News news) throws BusinessException {
log.error("# addNews Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("发布新闻信息失败");
}
@Override
public News findNewsById(String id) throws BusinessException {
log.error("# findNewsById Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("查看新闻信息失败");
}
@Override
public Boolean editNews(News news) throws BusinessException {
log.error("# editNews Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("编辑新闻信息失败");
}
@Override
public PageInfo<News> findNewsByPage(String keywords, Integer pageNum) throws BusinessException {
log.error("# findNewsByPage Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("获取新闻信息列表失败");
}
@Override
public News getNews() throws RemoteRequestExcepton {
log.error("# getNews Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("获取新闻头条信息失败");
}
}
|
UTF-8
|
Java
| 1,906 |
java
|
NewsRemoteClientHystrix.java
|
Java
|
[] | null |
[] |
package com.zhengjing.web.hystrix.simple;
import com.github.pagehelper.PageInfo;
import com.zhengjing.api.common.exception.BusinessException;
import com.zhengjing.api.common.exception.RemoteRequestExcepton;
import com.zhengjing.api.model.simple.News;
import com.zhengjing.web.remote.simple.NewsRemoteClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class NewsRemoteClientHystrix implements NewsRemoteClient {
private static final Logger log = LoggerFactory.getLogger(NewsRemoteClient.class);
@Override
public Boolean addNews(News news) throws BusinessException {
log.error("# addNews Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("发布新闻信息失败");
}
@Override
public News findNewsById(String id) throws BusinessException {
log.error("# findNewsById Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("查看新闻信息失败");
}
@Override
public Boolean editNews(News news) throws BusinessException {
log.error("# editNews Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("编辑新闻信息失败");
}
@Override
public PageInfo<News> findNewsByPage(String keywords, Integer pageNum) throws BusinessException {
log.error("# findNewsByPage Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("获取新闻信息列表失败");
}
@Override
public News getNews() throws RemoteRequestExcepton {
log.error("# getNews Hystrix");
// TODO business something
//return null;
throw new RemoteRequestExcepton("获取新闻头条信息失败");
}
}
| 1,906 | 0.705171 | 0.70407 | 56 | 31.464285 | 24.597448 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.464286 | false | false |
0
|
29cb7d8e2c3233d7c4b9ea89831c1de83d27a630
| 1,348,619,777,972 |
047a7602fab5b3a4d44364b8600eaa860dfc74f2
|
/exam-web/src/main/java/zjut/sy/exam/dto/StudentDto.java
|
db14b7bd00dadb752ca87a155729aff4a1f3a1b9
|
[] |
no_license
|
oneboat/ExamOnline
|
https://github.com/oneboat/ExamOnline
|
0b0e9de5bf4b18bd506938dda097c9e95270aaf5
|
e15cb21de19e8814ae1ed9a752bb780acf4c19ec
|
refs/heads/master
| 2020-08-05T03:11:38.590000 | 2017-02-18T03:20:51 | 2017-02-18T04:15:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package zjut.sy.exam.dto;
import zjut.sy.model.Admin;
import zjut.sy.model.Student;
import java.util.List;
/**
* Created by dell on 2016/5/11.
*/
public class StudentDto {
private int id;
private String username;
private String password;
private String realname;
private String address;
private String sno;
private String school;
private String email;
//1:启用 0:禁用
private int status;
private String picpath;
private int tid;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getSno() {
return sno;
}
public void setSno(String sno) {
this.sno = sno;
}
public String getSchool() {
return school;
}
public void setSchool(String school) {
this.school = school;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getPicpath() {
return picpath;
}
public void setPicpath(String picpath) {
this.picpath = picpath;
}
public int getTid() {
return tid;
}
public void setTid(int tid) {
this.tid = tid;
}
public Student getStudent(){
Student s=new Student();
s.setId(this.id);
s.setUsername(this.username);
s.setPassword(this.password);
s.setStatus(this.status);
s.setPicpath(this.picpath);
s.setEmail(this.email);
s.setSno(this.sno);
s.setAddress(this.address);
s.setRealname(this.realname);
s.setSchool(this.school);
return s;
}
public StudentDto(Student student){
this.setId(student.getId());
this.setUsername(student.getUsername());
this.setPassword(student.getPassword());
this.setStatus(student.getStatus());
this.setPicpath(student.getPicpath());
this.setEmail(student.getEmail());
this.setSno(student.getSno());
this.setAddress(student.getAddress());
this.setRealname(student.getRealname());
this.setSchool(student.getSchool());
}
public StudentDto(Student student,Integer tid){
this.setId(student.getId());
this.setUsername(student.getUsername());
this.setPassword(student.getPassword());
this.setStatus(student.getStatus());
this.setPicpath(student.getPicpath());
this.setEmail(student.getEmail());
this.setSno(student.getSno());
this.setAddress(student.getAddress());
this.setRealname(student.getRealname());
this.setSchool(student.getSchool());
this.setTid(tid);
}
public StudentDto() {
}
}
|
UTF-8
|
Java
| 3,510 |
java
|
StudentDto.java
|
Java
|
[
{
"context": "tudent;\n\nimport java.util.List;\n\n/**\n * Created by dell on 2016/5/11.\n */\npublic class StudentDto {\n p",
"end": 132,
"score": 0.9957305788993835,
"start": 128,
"tag": "USERNAME",
"value": "dell"
},
{
"context": " s.setId(this.id);\n s.setUsername(this.username);\n s.setPassword(this.password);\n s",
"end": 2132,
"score": 0.6705601811408997,
"start": 2124,
"tag": "USERNAME",
"value": "username"
},
{
"context": "setUsername(this.username);\n s.setPassword(this.password);\n s.setStatus(this.status);\n s.set",
"end": 2170,
"score": 0.9725872874259949,
"start": 2157,
"tag": "PASSWORD",
"value": "this.password"
},
{
"context": ".setId(student.getId());\n this.setUsername(student.getUsername());\n this.setPassword(student.",
"end": 2545,
"score": 0.8415219187736511,
"start": 2538,
"tag": "USERNAME",
"value": "student"
},
{
"context": "tudent.getId());\n this.setUsername(student.getUsername());\n this.setPassword(student.getPassword(",
"end": 2557,
"score": 0.9575275778770447,
"start": 2546,
"tag": "USERNAME",
"value": "getUsername"
},
{
"context": "t.getUsername());\n this.setPassword(student.getPassword());\n this.setStatus(student.getStatus());\n",
"end": 2606,
"score": 0.8960913419723511,
"start": 2595,
"tag": "PASSWORD",
"value": "getPassword"
},
{
"context": ".setId(student.getId());\n this.setUsername(student.getUsername());\n this.setPassword(student.",
"end": 3054,
"score": 0.7530712485313416,
"start": 3047,
"tag": "USERNAME",
"value": "student"
},
{
"context": "tudent.getId());\n this.setUsername(student.getUsername());\n this.setPassword(student.getPassword(",
"end": 3066,
"score": 0.9272269606590271,
"start": 3055,
"tag": "USERNAME",
"value": "getUsername"
},
{
"context": "(student.getUsername());\n this.setPassword(student.getPassword());\n this.setStatus(student.getStatus());\n",
"end": 3115,
"score": 0.9867262244224548,
"start": 3096,
"tag": "PASSWORD",
"value": "student.getPassword"
}
] | null |
[] |
package zjut.sy.exam.dto;
import zjut.sy.model.Admin;
import zjut.sy.model.Student;
import java.util.List;
/**
* Created by dell on 2016/5/11.
*/
public class StudentDto {
private int id;
private String username;
private String password;
private String realname;
private String address;
private String sno;
private String school;
private String email;
//1:启用 0:禁用
private int status;
private String picpath;
private int tid;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getSno() {
return sno;
}
public void setSno(String sno) {
this.sno = sno;
}
public String getSchool() {
return school;
}
public void setSchool(String school) {
this.school = school;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getPicpath() {
return picpath;
}
public void setPicpath(String picpath) {
this.picpath = picpath;
}
public int getTid() {
return tid;
}
public void setTid(int tid) {
this.tid = tid;
}
public Student getStudent(){
Student s=new Student();
s.setId(this.id);
s.setUsername(this.username);
s.setPassword(<PASSWORD>);
s.setStatus(this.status);
s.setPicpath(this.picpath);
s.setEmail(this.email);
s.setSno(this.sno);
s.setAddress(this.address);
s.setRealname(this.realname);
s.setSchool(this.school);
return s;
}
public StudentDto(Student student){
this.setId(student.getId());
this.setUsername(student.getUsername());
this.setPassword(student.<PASSWORD>());
this.setStatus(student.getStatus());
this.setPicpath(student.getPicpath());
this.setEmail(student.getEmail());
this.setSno(student.getSno());
this.setAddress(student.getAddress());
this.setRealname(student.getRealname());
this.setSchool(student.getSchool());
}
public StudentDto(Student student,Integer tid){
this.setId(student.getId());
this.setUsername(student.getUsername());
this.setPassword(<PASSWORD>());
this.setStatus(student.getStatus());
this.setPicpath(student.getPicpath());
this.setEmail(student.getEmail());
this.setSno(student.getSno());
this.setAddress(student.getAddress());
this.setRealname(student.getRealname());
this.setSchool(student.getSchool());
this.setTid(tid);
}
public StudentDto() {
}
}
| 3,497 | 0.599943 | 0.597373 | 157 | 21.305733 | 16.242455 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.452229 | false | false |
0
|
d4bf1a6dab2860c72d6e6c31dd35584a2f273993
| 20,590,073,219,690 |
2c922130678fbe2f3c603ea75e01d2ec289c3027
|
/src/com/test/InvocationCountTest.java
|
61dc77f41c64060af28749bebb51856c53d37b80
|
[] |
no_license
|
utpalforever/Basics-of-Selenium-WebDriver
|
https://github.com/utpalforever/Basics-of-Selenium-WebDriver
|
760fe588c450da2b99c130ddbd12929ed4ff2a67
|
c1cef5ddae367531a5ea5be3274e82cb6715af0a
|
refs/heads/master
| 2020-09-22T05:22:36.932000 | 2020-01-04T18:43:28 | 2020-01-04T18:43:28 | 225,064,831 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.test;
import org.testng.annotations.Test;
public class InvocationCountTest {
@Test(invocationCount=10)
public void test() {
System.out.println("test");
}
}
|
UTF-8
|
Java
| 176 |
java
|
InvocationCountTest.java
|
Java
|
[] | null |
[] |
package com.test;
import org.testng.annotations.Test;
public class InvocationCountTest {
@Test(invocationCount=10)
public void test() {
System.out.println("test");
}
}
| 176 | 0.732955 | 0.721591 | 11 | 15 | 14.006492 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.727273 | false | false |
0
|
cbb584368f068b0f3502ea9428990e821d0b8df0
| 31,069,793,439,587 |
757bf18147a67e67fd819e81d2c31f7117375395
|
/app/src/main/java/com/example/klemen/indoorsignalmeasurement/Login.java
|
9615bfa21c621e115dfcf2c1257e3df3858faaf9
|
[] |
no_license
|
scarfaceablo/indoor_meas_android_app
|
https://github.com/scarfaceablo/indoor_meas_android_app
|
d75477c8de1080c1f9c59c364f3b2d084e4972c0
|
62ff9cd2508d2b0c7e3c3bed6c7b6e3837b3de92
|
refs/heads/master
| 2020-03-21T09:16:21.453000 | 2018-06-24T07:55:54 | 2018-06-24T07:55:54 | 138,391,450 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.klemen.indoorsignalmeasurement;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class Login extends AppCompatActivity {
private static EditText username;
private static EditText password;
private static TextView attempt;
private static Button login_button;
private static Button register_button;
int attempt_counter = 50;
private String response_from_api = "false";
//public String response_from_api = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Button login_button = (Button) findViewById(R.id.button_login);
final RequestQueue LoginReqQueue = Volley.newRequestQueue(this);
final String url = getString(R.string.api_ip)+"login";
Log.i("string", url);
username = (EditText)findViewById(R.id.editText_user);
password = (EditText)findViewById(R.id.editText_password);
attempt = (TextView)findViewById(R.id.textView_attempt);
login_button = (Button)findViewById(R.id.button_login);
register_button = (Button)findViewById(R.id.register_button);
login_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// construct json object from username and password fields
final JSONObject obj = new JSONObject();
try {
obj.put("username", username.getText().toString());
obj.put("password", password.getText().toString());
} catch (JSONException e) {
e.printStackTrace();
}
JsonObjectRequest LoginRequest = new JsonObjectRequest(Request.Method.POST, url, obj,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
String response_message=response.getString("message");
String response_user_id=response.getString("user_id");
Log.i("response_json",response_message);
Log.i("response_json", Integer.toString(response_message.length()));
if (response_message.equals("OK")){
Log.i("response_if","equals");
Toast.makeText(Login.this,"Username and password is correct",
Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Login.this, MainActivity.class);
intent.putExtra("user_id", response_user_id);
startActivity(intent);
}else{
Toast.makeText(Login.this,"Username and password NOT correct",
Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() { //Create an error listener to handle errors appropriately.
@Override
public void onErrorResponse(VolleyError error) {
//This code is executed if there is an error.
}
});
LoginReqQueue.add(LoginRequest);
}
});
register_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Login.this, Register.class);
startActivity(intent);
}
});
}
}
|
UTF-8
|
Java
| 5,093 |
java
|
Login.java
|
Java
|
[
{
"context": "package com.example.klemen.indoorsignalmeasurement;\n\nimport android.content.",
"end": 26,
"score": 0.996998131275177,
"start": 20,
"tag": "USERNAME",
"value": "klemen"
}
] | null |
[] |
package com.example.klemen.indoorsignalmeasurement;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
public class Login extends AppCompatActivity {
private static EditText username;
private static EditText password;
private static TextView attempt;
private static Button login_button;
private static Button register_button;
int attempt_counter = 50;
private String response_from_api = "false";
//public String response_from_api = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Button login_button = (Button) findViewById(R.id.button_login);
final RequestQueue LoginReqQueue = Volley.newRequestQueue(this);
final String url = getString(R.string.api_ip)+"login";
Log.i("string", url);
username = (EditText)findViewById(R.id.editText_user);
password = (EditText)findViewById(R.id.editText_password);
attempt = (TextView)findViewById(R.id.textView_attempt);
login_button = (Button)findViewById(R.id.button_login);
register_button = (Button)findViewById(R.id.register_button);
login_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// construct json object from username and password fields
final JSONObject obj = new JSONObject();
try {
obj.put("username", username.getText().toString());
obj.put("password", password.getText().toString());
} catch (JSONException e) {
e.printStackTrace();
}
JsonObjectRequest LoginRequest = new JsonObjectRequest(Request.Method.POST, url, obj,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
String response_message=response.getString("message");
String response_user_id=response.getString("user_id");
Log.i("response_json",response_message);
Log.i("response_json", Integer.toString(response_message.length()));
if (response_message.equals("OK")){
Log.i("response_if","equals");
Toast.makeText(Login.this,"Username and password is correct",
Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Login.this, MainActivity.class);
intent.putExtra("user_id", response_user_id);
startActivity(intent);
}else{
Toast.makeText(Login.this,"Username and password NOT correct",
Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() { //Create an error listener to handle errors appropriately.
@Override
public void onErrorResponse(VolleyError error) {
//This code is executed if there is an error.
}
});
LoginReqQueue.add(LoginRequest);
}
});
register_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Login.this, Register.class);
startActivity(intent);
}
});
}
}
| 5,093 | 0.568427 | 0.567838 | 141 | 35.070923 | 29.115725 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.624114 | false | false |
0
|
c9038eac0136f49ffbd10b2dfdd66ba475112dc8
| 23,562,190,636,885 |
14d9cf24f2069c58a13a668cb185f8eee6431dcb
|
/src/main/java/wanderingMiniBosses/patches/dunno/RenderTopCard.java
|
96dd2289b82aca5cecb61a68efd3083bef6f358c
|
[] |
no_license
|
erasels/wanderingMiniBosses
|
https://github.com/erasels/wanderingMiniBosses
|
9ff05799bbd394219fd50151c9a44abf39842203
|
26990fd92a32c844bd8acedf1897467264c7fa42
|
refs/heads/master
| 2023-08-03T16:13:15.615000 | 2023-07-05T21:13:33 | 2023-07-05T21:13:33 | 234,706,884 | 1 | 10 | null | false | 2023-07-05T21:13:34 | 2020-01-18T08:51:45 | 2021-01-06T16:42:04 | 2023-07-05T21:13:33 | 30,037 | 1 | 5 | 0 |
Java
| false | false |
package wanderingMiniBosses.patches.dunno;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.evacipated.cardcrawl.modthespire.lib.*;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.ui.panels.DrawPilePanel;
import javassist.CtBehavior;
import wanderingMiniBosses.relics.Inkheart;
public class RenderTopCard {
//patch refresh hand layout to also refresh position of top card
@SpirePatch(
clz = DrawPilePanel.class,
method = "render"
)
public static class Render
{
@SpirePostfixPatch
public static void doTheRenderThing(DrawPilePanel __instance, SpriteBatch sb)
{
if (!AbstractDungeon.isScreenUp && AbstractDungeon.player.hasRelic(Inkheart.ID))
{
if (!AbstractDungeon.player.drawPile.isEmpty())
{
AbstractCard top = AbstractDungeon.player.drawPile.getTopCard();
if (!top.equals(AbstractDungeon.player.hoveredCard))
{
AbstractDungeon.player.drawPile.getTopCard().render(sb);
}
}
}
}
}
@SpirePatch(
clz = AbstractCard.class,
method = "renderEnergy"
)
public static class RenderAltColor
{
private static final Color RED = new Color(1.0f, 0.3f, 0.3f, 1.0f);
@SpireInsertPatch(
locator = Locator.class,
localvars = { "costColor" }
)
public static void modifyColor(AbstractCard __instance, SpriteBatch sb, @ByRef Color[] costColor)
{
if (AbstractDungeon.player != null)
{
if (__instance.equals(UpdateAndTrackTopCard.Fields.currentCard.get(AbstractDungeon.player.drawPile)))
{
if (!__instance.hasEnoughEnergy()) {
costColor[0] = RED;
}
}
}
}
private static class Locator extends SpireInsertLocator
{
@Override
public int[] Locate(CtBehavior ctMethodToPatch) throws Exception
{
Matcher finalMatcher = new Matcher.FieldAccessMatcher(AbstractCard.class, "transparency");
return LineFinder.findInOrder(ctMethodToPatch, finalMatcher);
}
}
}
}
|
UTF-8
|
Java
| 2,519 |
java
|
RenderTopCard.java
|
Java
|
[] | null |
[] |
package wanderingMiniBosses.patches.dunno;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.evacipated.cardcrawl.modthespire.lib.*;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.ui.panels.DrawPilePanel;
import javassist.CtBehavior;
import wanderingMiniBosses.relics.Inkheart;
public class RenderTopCard {
//patch refresh hand layout to also refresh position of top card
@SpirePatch(
clz = DrawPilePanel.class,
method = "render"
)
public static class Render
{
@SpirePostfixPatch
public static void doTheRenderThing(DrawPilePanel __instance, SpriteBatch sb)
{
if (!AbstractDungeon.isScreenUp && AbstractDungeon.player.hasRelic(Inkheart.ID))
{
if (!AbstractDungeon.player.drawPile.isEmpty())
{
AbstractCard top = AbstractDungeon.player.drawPile.getTopCard();
if (!top.equals(AbstractDungeon.player.hoveredCard))
{
AbstractDungeon.player.drawPile.getTopCard().render(sb);
}
}
}
}
}
@SpirePatch(
clz = AbstractCard.class,
method = "renderEnergy"
)
public static class RenderAltColor
{
private static final Color RED = new Color(1.0f, 0.3f, 0.3f, 1.0f);
@SpireInsertPatch(
locator = Locator.class,
localvars = { "costColor" }
)
public static void modifyColor(AbstractCard __instance, SpriteBatch sb, @ByRef Color[] costColor)
{
if (AbstractDungeon.player != null)
{
if (__instance.equals(UpdateAndTrackTopCard.Fields.currentCard.get(AbstractDungeon.player.drawPile)))
{
if (!__instance.hasEnoughEnergy()) {
costColor[0] = RED;
}
}
}
}
private static class Locator extends SpireInsertLocator
{
@Override
public int[] Locate(CtBehavior ctMethodToPatch) throws Exception
{
Matcher finalMatcher = new Matcher.FieldAccessMatcher(AbstractCard.class, "transparency");
return LineFinder.findInOrder(ctMethodToPatch, finalMatcher);
}
}
}
}
| 2,519 | 0.588329 | 0.584359 | 75 | 32.586666 | 29.406618 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346667 | false | false |
0
|
e1afcaabb3f30ce978d9c60d0e3fc1fa88eb05c2
| 8,546,984,970,430 |
ee21c74e1d758452a3f5719751c914c62665001b
|
/src/main/java/com/cqjtu/service/impl/QualityServiceImpl.java
|
df1b4293a9f827d9257cf98f311616845d93ef3c
|
[] |
no_license
|
kit101/cqes
|
https://github.com/kit101/cqes
|
e22d9d7bb316cd39639348444fb591a456999ac6
|
0f03a01bfd912f3cecfdfe87bef980a2260e6162
|
refs/heads/master
| 2021-09-16T01:28:56.029000 | 2018-05-20T09:17:36 | 2018-05-20T09:17:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cqjtu.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.cqjtu.mapper.ItemTypeMapper;
import com.cqjtu.mapper.QualityItemAuditMapper;
import com.cqjtu.mapper.QualityItemMapper;
import com.cqjtu.mapper.QualityMapper;
import com.cqjtu.model.Quality;
import com.cqjtu.model.QualityItem;
import com.cqjtu.model.QualityItemAudit;
import com.cqjtu.service.QualityService;
@Service
public class QualityServiceImpl implements QualityService {
@Autowired
QualityMapper qualityMapper;
@Autowired
ItemTypeMapper itemTypeMapper;
@Autowired
QualityItemMapper qualityItemMapper;
@Autowired
QualityItemAuditMapper qualityItemAuditMapper;
@Override
public int insertQuality(Quality quality) {
return qualityMapper.insert(quality);
}
@Override
public List<Map<String, Object>> getTypeList() {
return itemTypeMapper.getList();
}
@Override
public void uploadQualityItem(Map<String, Object> param) {
Quality quality = qualityMapper.selectByStudentId(param);
QualityItem qualityItem = new QualityItem();
qualityItem.setQualityId(quality.getQualityId());
qualityItem.setItemName((String) param.get("itemName"));
qualityItem.setQualityTypeId(Integer.parseInt((String) param.get("itemType")));
qualityItem.setItemScore(Integer.parseInt((String) param.get("itemScore")));
qualityItem.setItemEvidenceUrl((String) param.get("filepath"));
qualityItemMapper.insert(qualityItem);
QualityItemAudit audit = new QualityItemAudit();
audit.setQualityItemId(qualityItem.getQualityTiemId());
audit.setItemStatus("待审核");
qualityItemAuditMapper.insert(audit);
}
@Override
public void updateQualityItemById(Map<String, Object> param) {
QualityItem qualityItem = qualityItemMapper
.selectByPrimaryKey(Integer.parseInt((String) param.get("qualityItemId")));
String filepath = qualityItem.getItemEvidenceUrl();
qualityItem.setItemName((String) param.get("itemName"));
qualityItem.setItemScore(Integer.parseInt((String) param.get("itemScore")));
qualityItem.setQualityTypeId(Integer.parseInt((String) param.get("typeId")));
String newFilepath = (String) param.get("filepath");
if(newFilepath != null) {
qualityItem.setItemEvidenceUrl(newFilepath);
}
qualityItemMapper.updateByPrimaryKey(qualityItem);
}
@Transactional
@Override
public boolean deleteQualityItem(Integer qualityItemId) {
int result1 = qualityItemAuditMapper.deleteByQualityItemId(qualityItemId);
int result2 = qualityItemMapper.deleteByPrimaryKey(qualityItemId);
System.err.println(result1 +"\t"+result2);
if(result1 == 1 && result2 == 1) {
return true;
}else {
return false;
}
}
}
|
UTF-8
|
Java
| 2,904 |
java
|
QualityServiceImpl.java
|
Java
|
[] | null |
[] |
package com.cqjtu.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.cqjtu.mapper.ItemTypeMapper;
import com.cqjtu.mapper.QualityItemAuditMapper;
import com.cqjtu.mapper.QualityItemMapper;
import com.cqjtu.mapper.QualityMapper;
import com.cqjtu.model.Quality;
import com.cqjtu.model.QualityItem;
import com.cqjtu.model.QualityItemAudit;
import com.cqjtu.service.QualityService;
@Service
public class QualityServiceImpl implements QualityService {
@Autowired
QualityMapper qualityMapper;
@Autowired
ItemTypeMapper itemTypeMapper;
@Autowired
QualityItemMapper qualityItemMapper;
@Autowired
QualityItemAuditMapper qualityItemAuditMapper;
@Override
public int insertQuality(Quality quality) {
return qualityMapper.insert(quality);
}
@Override
public List<Map<String, Object>> getTypeList() {
return itemTypeMapper.getList();
}
@Override
public void uploadQualityItem(Map<String, Object> param) {
Quality quality = qualityMapper.selectByStudentId(param);
QualityItem qualityItem = new QualityItem();
qualityItem.setQualityId(quality.getQualityId());
qualityItem.setItemName((String) param.get("itemName"));
qualityItem.setQualityTypeId(Integer.parseInt((String) param.get("itemType")));
qualityItem.setItemScore(Integer.parseInt((String) param.get("itemScore")));
qualityItem.setItemEvidenceUrl((String) param.get("filepath"));
qualityItemMapper.insert(qualityItem);
QualityItemAudit audit = new QualityItemAudit();
audit.setQualityItemId(qualityItem.getQualityTiemId());
audit.setItemStatus("待审核");
qualityItemAuditMapper.insert(audit);
}
@Override
public void updateQualityItemById(Map<String, Object> param) {
QualityItem qualityItem = qualityItemMapper
.selectByPrimaryKey(Integer.parseInt((String) param.get("qualityItemId")));
String filepath = qualityItem.getItemEvidenceUrl();
qualityItem.setItemName((String) param.get("itemName"));
qualityItem.setItemScore(Integer.parseInt((String) param.get("itemScore")));
qualityItem.setQualityTypeId(Integer.parseInt((String) param.get("typeId")));
String newFilepath = (String) param.get("filepath");
if(newFilepath != null) {
qualityItem.setItemEvidenceUrl(newFilepath);
}
qualityItemMapper.updateByPrimaryKey(qualityItem);
}
@Transactional
@Override
public boolean deleteQualityItem(Integer qualityItemId) {
int result1 = qualityItemAuditMapper.deleteByQualityItemId(qualityItemId);
int result2 = qualityItemMapper.deleteByPrimaryKey(qualityItemId);
System.err.println(result1 +"\t"+result2);
if(result1 == 1 && result2 == 1) {
return true;
}else {
return false;
}
}
}
| 2,904 | 0.7657 | 0.76294 | 84 | 32.5 | 24.688778 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.702381 | false | false |
0
|
16a1bc4323cf6e9569b9f1406fadded5dcf26676
| 17,858,474,068,989 |
9049eabb2562cd3e854781dea6bd0a5e395812d3
|
/sources/com/google/android/ads/tasks/C0162c.java
|
dcbc294fc1a8c37f54a1a754e79cd6ef19d36afc
|
[] |
no_license
|
Romern/gms_decompiled
|
https://github.com/Romern/gms_decompiled
|
4c75449feab97321da23ecbaac054c2303150076
|
a9c245404f65b8af456b7b3440f48d49313600ba
|
refs/heads/master
| 2022-07-17T23:22:00.441000 | 2020-05-17T18:26:16 | 2020-05-17T18:26:16 | 264,227,100 | 2 | 5 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.google.android.ads.tasks;
import android.content.Context;
import com.google.ads.afma.proto2api.C0152c;
import com.google.android.gms.ads.internal.config.C0371o;
import com.google.android.gms.org.conscrypt.PSKKeyManager;
import java.lang.reflect.Method;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicReference;
/* renamed from: com.google.android.ads.tasks.c */
/* compiled from: :com.google.android.gms@201515033@20.15.15 (120300-306758586) */
public final class C0162c extends C0181v {
/* renamed from: h */
private static final C0182w f7572h = new C0182w();
/* renamed from: i */
private final Context f7573i;
public C0162c(dca dca, String str, String str2, bxvd bxvd, int i, Context context) {
super(dca, str, str2, bxvd, i, 27);
this.f7573i = context;
}
/* access modifiers changed from: protected */
/* renamed from: a */
public final void mo5035a() {
dac dac;
int i;
boolean z;
Boolean bool;
AtomicReference a = f7572h.mo5040a(this.f7573i.getPackageName());
synchronized (a) {
dac dac2 = (dac) a.get();
if (dac2 == null || dcc.m8147b(dac2.f12491a) || dac2.f12491a.equals("E") || dac2.f12491a.equals("0000000000000000000000000000000000000000000000000000000000000000")) {
String str = null;
if (dcc.m8147b(null)) {
if (!dcc.m8147b(null)) {
bool = false;
} else {
bool = false;
}
if (!bool.booleanValue() || !this.f7592a.f12778n) {
i = 3;
} else {
i = 4;
}
} else {
i = 5;
}
Method method = this.f7595d;
Object[] objArr = new Object[3];
objArr[0] = this.f7573i;
if (i == 3) {
z = true;
} else {
z = false;
}
objArr[1] = Boolean.valueOf(z);
objArr[2] = C0371o.f8202P.mo6604a();
dac dac3 = new dac((String) method.invoke(null, objArr));
if (dcc.m8147b(dac3.f12491a) || dac3.f12491a.equals("E")) {
int i2 = i - 1;
if (i2 == 3) {
try {
Future future = this.f7592a.f12775k;
if (future != null) {
future.get();
}
C0152c cVar = this.f7592a.f12774j;
if (!(cVar == null || (cVar.f7518a & 4194304) == 0)) {
str = cVar.f7532o;
}
} catch (InterruptedException | ExecutionException e) {
}
if (!dcc.m8147b(str)) {
dac3.f12491a = str;
}
a.set(dac3);
} else if (i2 == 4) {
throw null;
}
}
a.set(dac3);
}
dac = (dac) a.get();
}
synchronized (this.f7598g) {
if (dac != null) {
bxvd bxvd = this.f7598g;
String str2 = dac.f12491a;
if (bxvd.f164950c) {
bxvd.mo74035c();
bxvd.f164950c = false;
}
C0152c cVar2 = (C0152c) bxvd.f164949b;
C0152c cVar3 = C0152c.f7500Q;
str2.getClass();
cVar2.f7518a = 4194304 | cVar2.f7518a;
cVar2.f7532o = str2;
bxvd bxvd2 = this.f7598g;
long j = dac.f12492b;
if (bxvd2.f164950c) {
bxvd2.mo74035c();
bxvd2.f164950c = false;
}
C0152c cVar4 = (C0152c) bxvd2.f164949b;
cVar4.f7518a |= 536870912;
cVar4.f7538u = j;
bxvd bxvd3 = this.f7598g;
String str3 = dac.f12493c;
if (bxvd3.f164950c) {
bxvd3.mo74035c();
bxvd3.f164950c = false;
}
C0152c cVar5 = (C0152c) bxvd3.f164949b;
str3.getClass();
cVar5.f7518a |= 268435456;
cVar5.f7537t = str3;
bxvd bxvd4 = this.f7598g;
String str4 = dac.f12494d;
if (bxvd4.f164950c) {
bxvd4.mo74035c();
bxvd4.f164950c = false;
}
C0152c cVar6 = (C0152c) bxvd4.f164949b;
str4.getClass();
cVar6.f7519b |= 128;
cVar6.f7540w = str4;
bxvd bxvd5 = this.f7598g;
String str5 = dac.f12495e;
if (bxvd5.f164950c) {
bxvd5.mo74035c();
bxvd5.f164950c = false;
}
C0152c cVar7 = (C0152c) bxvd5.f164949b;
str5.getClass();
cVar7.f7519b |= PSKKeyManager.MAX_KEY_LENGTH_BYTES;
cVar7.f7541x = str5;
}
}
}
}
|
UTF-8
|
Java
| 5,498 |
java
|
C0162c.java
|
Java
|
[] | null |
[] |
package com.google.android.ads.tasks;
import android.content.Context;
import com.google.ads.afma.proto2api.C0152c;
import com.google.android.gms.ads.internal.config.C0371o;
import com.google.android.gms.org.conscrypt.PSKKeyManager;
import java.lang.reflect.Method;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicReference;
/* renamed from: com.google.android.ads.tasks.c */
/* compiled from: :com.google.android.gms@201515033@20.15.15 (120300-306758586) */
public final class C0162c extends C0181v {
/* renamed from: h */
private static final C0182w f7572h = new C0182w();
/* renamed from: i */
private final Context f7573i;
public C0162c(dca dca, String str, String str2, bxvd bxvd, int i, Context context) {
super(dca, str, str2, bxvd, i, 27);
this.f7573i = context;
}
/* access modifiers changed from: protected */
/* renamed from: a */
public final void mo5035a() {
dac dac;
int i;
boolean z;
Boolean bool;
AtomicReference a = f7572h.mo5040a(this.f7573i.getPackageName());
synchronized (a) {
dac dac2 = (dac) a.get();
if (dac2 == null || dcc.m8147b(dac2.f12491a) || dac2.f12491a.equals("E") || dac2.f12491a.equals("0000000000000000000000000000000000000000000000000000000000000000")) {
String str = null;
if (dcc.m8147b(null)) {
if (!dcc.m8147b(null)) {
bool = false;
} else {
bool = false;
}
if (!bool.booleanValue() || !this.f7592a.f12778n) {
i = 3;
} else {
i = 4;
}
} else {
i = 5;
}
Method method = this.f7595d;
Object[] objArr = new Object[3];
objArr[0] = this.f7573i;
if (i == 3) {
z = true;
} else {
z = false;
}
objArr[1] = Boolean.valueOf(z);
objArr[2] = C0371o.f8202P.mo6604a();
dac dac3 = new dac((String) method.invoke(null, objArr));
if (dcc.m8147b(dac3.f12491a) || dac3.f12491a.equals("E")) {
int i2 = i - 1;
if (i2 == 3) {
try {
Future future = this.f7592a.f12775k;
if (future != null) {
future.get();
}
C0152c cVar = this.f7592a.f12774j;
if (!(cVar == null || (cVar.f7518a & 4194304) == 0)) {
str = cVar.f7532o;
}
} catch (InterruptedException | ExecutionException e) {
}
if (!dcc.m8147b(str)) {
dac3.f12491a = str;
}
a.set(dac3);
} else if (i2 == 4) {
throw null;
}
}
a.set(dac3);
}
dac = (dac) a.get();
}
synchronized (this.f7598g) {
if (dac != null) {
bxvd bxvd = this.f7598g;
String str2 = dac.f12491a;
if (bxvd.f164950c) {
bxvd.mo74035c();
bxvd.f164950c = false;
}
C0152c cVar2 = (C0152c) bxvd.f164949b;
C0152c cVar3 = C0152c.f7500Q;
str2.getClass();
cVar2.f7518a = 4194304 | cVar2.f7518a;
cVar2.f7532o = str2;
bxvd bxvd2 = this.f7598g;
long j = dac.f12492b;
if (bxvd2.f164950c) {
bxvd2.mo74035c();
bxvd2.f164950c = false;
}
C0152c cVar4 = (C0152c) bxvd2.f164949b;
cVar4.f7518a |= 536870912;
cVar4.f7538u = j;
bxvd bxvd3 = this.f7598g;
String str3 = dac.f12493c;
if (bxvd3.f164950c) {
bxvd3.mo74035c();
bxvd3.f164950c = false;
}
C0152c cVar5 = (C0152c) bxvd3.f164949b;
str3.getClass();
cVar5.f7518a |= 268435456;
cVar5.f7537t = str3;
bxvd bxvd4 = this.f7598g;
String str4 = dac.f12494d;
if (bxvd4.f164950c) {
bxvd4.mo74035c();
bxvd4.f164950c = false;
}
C0152c cVar6 = (C0152c) bxvd4.f164949b;
str4.getClass();
cVar6.f7519b |= 128;
cVar6.f7540w = str4;
bxvd bxvd5 = this.f7598g;
String str5 = dac.f12495e;
if (bxvd5.f164950c) {
bxvd5.mo74035c();
bxvd5.f164950c = false;
}
C0152c cVar7 = (C0152c) bxvd5.f164949b;
str5.getClass();
cVar7.f7519b |= PSKKeyManager.MAX_KEY_LENGTH_BYTES;
cVar7.f7541x = str5;
}
}
}
}
| 5,498 | 0.436704 | 0.32139 | 145 | 36.91724 | 20.895308 | 178 | false | false | 0 | 0 | 0 | 0 | 64 | 0.011641 | 0.772414 | false | false |
0
|
e48c541e3396998b8efc0b1726f1aa50088fcc5e
| 2,207,613,194,708 |
823183fbd10bf233f5eb8a098b7e2fa33c51e571
|
/src/main/java/model/User.java
|
29b65de81fa525b8318ed4d4fb0bc3370cb659f6
|
[] |
no_license
|
ClaudiuTertiu/Rest-API
|
https://github.com/ClaudiuTertiu/Rest-API
|
2c0eda4debdfd25b76166ff2a42deb7af3400f81
|
34d7a81dd35129566c26bd15260890d2f5374bbc
|
refs/heads/master
| 2022-12-25T21:35:19.858000 | 2020-10-03T07:33:33 | 2020-10-03T07:33:33 | 271,894,379 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
@AllArgsConstructor
@Getter
@Setter
@ToString
@Value
@Builder
public class User {
String id;
@JsonProperty("username")
String username;
@JsonProperty("password")
String password;
}
|
UTF-8
|
Java
| 290 |
java
|
User.java
|
Java
|
[
{
"context": "ic class User {\n String id;\n @JsonProperty(\"username\")\n String username;\n @JsonProperty(\"passwor",
"end": 212,
"score": 0.9981456398963928,
"start": 204,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
@AllArgsConstructor
@Getter
@Setter
@ToString
@Value
@Builder
public class User {
String id;
@JsonProperty("username")
String username;
@JsonProperty("password")
String password;
}
| 290 | 0.731034 | 0.731034 | 18 | 15.055555 | 12.607195 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
0
|
e2090c9323144f252181f3e2406c9a74648c1588
| 24,154,896,133,757 |
f9df7f07283c357c31c915f981e9469bd68559ae
|
/cdm/core/src/test/java/ucar/nc2/ft/TestFeatureDatasetFactoryManager.java
|
490e0aac255851e583eed744fa92fb88b2ea0bd7
|
[
"BSD-3-Clause"
] |
permissive
|
Unidata/netcdf-java
|
https://github.com/Unidata/netcdf-java
|
80faec3c59f24e455cd16ab5538bc70b2ddde681
|
45a7d9323ca9f9826a21a4da82f1988160327251
|
refs/heads/maint-5.x
| 2023-09-04T06:47:25.666000 | 2023-08-25T20:41:19 | 2023-08-25T20:41:19 | 184,285,250 | 113 | 111 |
BSD-3-Clause
| false | 2023-09-08T22:05:55 | 2019-04-30T15:15:55 | 2023-08-31T14:22:49 | 2023-09-08T22:05:54 | 1,061,802 | 114 | 60 | 73 |
Java
| false | false |
/*
* Copyright (c) 1998-2018 University Corporation for Atmospheric Research/Unidata
* See LICENSE.txt for license information.
*/
package ucar.nc2.ft;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import ucar.nc2.constants.FeatureType;
import ucar.unidata.util.test.TestDir;
public class TestFeatureDatasetFactoryManager {
/**
* Tests a non-CF compliant trajectory file
*
* This tests a non-CF compliant trajectory file
* which is read in using the ucar.nc2.ft.point.standard.plug.SimpleTrajectory
* plug.
*/
@Test
public void testSimpleTrajectory() throws IOException {
FeatureType type = FeatureType.ANY;
Path location_path =
Paths.get(TestDir.cdmLocalTestDataDir, "trajectory", "aircraft", "uw_kingair-2005-01-19-113957.nc");
FeatureDataset featureDataset = FeatureDatasetFactoryManager.open(type, location_path.toString(), null, null);
assert featureDataset != null;
assert featureDataset.getFeatureType() == FeatureType.TRAJECTORY;
}
}
|
UTF-8
|
Java
| 1,064 |
java
|
TestFeatureDatasetFactoryManager.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 1998-2018 University Corporation for Atmospheric Research/Unidata
* See LICENSE.txt for license information.
*/
package ucar.nc2.ft;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import ucar.nc2.constants.FeatureType;
import ucar.unidata.util.test.TestDir;
public class TestFeatureDatasetFactoryManager {
/**
* Tests a non-CF compliant trajectory file
*
* This tests a non-CF compliant trajectory file
* which is read in using the ucar.nc2.ft.point.standard.plug.SimpleTrajectory
* plug.
*/
@Test
public void testSimpleTrajectory() throws IOException {
FeatureType type = FeatureType.ANY;
Path location_path =
Paths.get(TestDir.cdmLocalTestDataDir, "trajectory", "aircraft", "uw_kingair-2005-01-19-113957.nc");
FeatureDataset featureDataset = FeatureDatasetFactoryManager.open(type, location_path.toString(), null, null);
assert featureDataset != null;
assert featureDataset.getFeatureType() == FeatureType.TRAJECTORY;
}
}
| 1,064 | 0.745301 | 0.721804 | 34 | 30.294117 | 30.951128 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529412 | false | false |
0
|
c1bc154cd607aba6e946b78c42ede89d9ffdd457
| 20,933,670,655,950 |
60b9836fb92226c68602f8737e347d6244f7ae28
|
/consultor-vendas/src/entities/AcaoBolsaValores.java
|
e7e46268cba5d5ecb66d1b83713d604abce4a618
|
[] |
no_license
|
hsteffens/consultor-bolsavalores-backend
|
https://github.com/hsteffens/consultor-bolsavalores-backend
|
3e17c8ebbb43bb8d3830248a8d4859e061fd6039
|
192e7dddb4b70ebfbf8a3498bd270bd8c62cacb1
|
refs/heads/master
| 2020-04-06T04:08:52.744000 | 2016-06-29T02:51:23 | 2016-06-29T02:51:23 | 56,387,451 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package entities;
import org.joda.time.LocalDate;
public class AcaoBolsaValores {
private String codigo;
private String nomeAcao;
private double volumeMedioDiario;
private double valorAtual;
private double variacaoValor;
private double variacaoPercentual;
private EnTipoMoeda moeda;
private LocalDate dataUltimaNegociacao;
private int horaUltimaNegociacao;
private double menorValorDia;
private double maiorValorDia;
private double menorValorAno;
private double maiorValorAno;
private String capitalMercado;
private String EBITDA;
private double valorAbertura;
private double ultimoValorFechamento;
private double percentual;
private String exchange;
public String getCodigo() {
return codigo;
}
public void setCodigo(String codigo) {
this.codigo = codigo;
}
public String getNomeAcao() {
return nomeAcao;
}
public void setNomeAcao(String nomeAcao) {
this.nomeAcao = nomeAcao;
}
public double getVolumeMedioDiario() {
return volumeMedioDiario;
}
public void setVolumeMedioDiario(double volumeMedioDiario) {
this.volumeMedioDiario = volumeMedioDiario;
}
public double getVariacaoValor() {
return variacaoValor;
}
public void setVariacaoValor(double variacaoValor) {
this.variacaoValor = variacaoValor;
}
public double getVariacaoPercentual() {
return variacaoPercentual;
}
public void setVariacaoPercentual(double variacaoPercentual) {
this.variacaoPercentual = variacaoPercentual;
}
public EnTipoMoeda getMoeda() {
return moeda;
}
public void setMoeda(EnTipoMoeda moeda) {
this.moeda = moeda;
}
public LocalDate getDataUltimaNegociacao() {
return dataUltimaNegociacao;
}
public void setDataUltimaNegociacao(LocalDate dataUltimaNegociacao) {
this.dataUltimaNegociacao = dataUltimaNegociacao;
}
public int getHoraUltimaNegociacao() {
return horaUltimaNegociacao;
}
public void setHoraUltimaNegociacao(int horaUltimaNegociacao) {
this.horaUltimaNegociacao = horaUltimaNegociacao;
}
public double getMenorValorDia() {
return menorValorDia;
}
public void setMenorValorDia(double menorValorDia) {
this.menorValorDia = menorValorDia;
}
public double getMaiorValorDia() {
return maiorValorDia;
}
public void setMaiorValorDia(double maiorValorDia) {
this.maiorValorDia = maiorValorDia;
}
public double getMenorValorAno() {
return menorValorAno;
}
public void setMenorValorAno(double menorValorAno) {
this.menorValorAno = menorValorAno;
}
public double getMaiorValorAno() {
return maiorValorAno;
}
public void setMaiorValorAno(double maiorValorAno) {
this.maiorValorAno = maiorValorAno;
}
public String getCapitalMercado() {
return capitalMercado;
}
public void setCapitalMercado(String capitalMercado) {
this.capitalMercado = capitalMercado;
}
public String getEBITDA() {
return EBITDA;
}
public void setEBITDA(String eBITDA) {
EBITDA = eBITDA;
}
public double getValorAbertura() {
return valorAbertura;
}
public void setValorAbertura(double valorAbertura) {
this.valorAbertura = valorAbertura;
}
public double getUltimoValorFechamento() {
return ultimoValorFechamento;
}
public void setUltimoValorFechamento(double ultimoValorFechamento) {
this.ultimoValorFechamento = ultimoValorFechamento;
}
public double getPercentual() {
return percentual;
}
public void setPercentual(double percentual) {
this.percentual = percentual;
}
public String getExchange() {
return exchange;
}
public void setExchange(String exchange) {
this.exchange = exchange;
}
public double getValorAtual() {
return valorAtual;
}
public void setValorAtual(double valorAtual) {
this.valorAtual = valorAtual;
}
}
|
UTF-8
|
Java
| 3,649 |
java
|
AcaoBolsaValores.java
|
Java
|
[] | null |
[] |
package entities;
import org.joda.time.LocalDate;
public class AcaoBolsaValores {
private String codigo;
private String nomeAcao;
private double volumeMedioDiario;
private double valorAtual;
private double variacaoValor;
private double variacaoPercentual;
private EnTipoMoeda moeda;
private LocalDate dataUltimaNegociacao;
private int horaUltimaNegociacao;
private double menorValorDia;
private double maiorValorDia;
private double menorValorAno;
private double maiorValorAno;
private String capitalMercado;
private String EBITDA;
private double valorAbertura;
private double ultimoValorFechamento;
private double percentual;
private String exchange;
public String getCodigo() {
return codigo;
}
public void setCodigo(String codigo) {
this.codigo = codigo;
}
public String getNomeAcao() {
return nomeAcao;
}
public void setNomeAcao(String nomeAcao) {
this.nomeAcao = nomeAcao;
}
public double getVolumeMedioDiario() {
return volumeMedioDiario;
}
public void setVolumeMedioDiario(double volumeMedioDiario) {
this.volumeMedioDiario = volumeMedioDiario;
}
public double getVariacaoValor() {
return variacaoValor;
}
public void setVariacaoValor(double variacaoValor) {
this.variacaoValor = variacaoValor;
}
public double getVariacaoPercentual() {
return variacaoPercentual;
}
public void setVariacaoPercentual(double variacaoPercentual) {
this.variacaoPercentual = variacaoPercentual;
}
public EnTipoMoeda getMoeda() {
return moeda;
}
public void setMoeda(EnTipoMoeda moeda) {
this.moeda = moeda;
}
public LocalDate getDataUltimaNegociacao() {
return dataUltimaNegociacao;
}
public void setDataUltimaNegociacao(LocalDate dataUltimaNegociacao) {
this.dataUltimaNegociacao = dataUltimaNegociacao;
}
public int getHoraUltimaNegociacao() {
return horaUltimaNegociacao;
}
public void setHoraUltimaNegociacao(int horaUltimaNegociacao) {
this.horaUltimaNegociacao = horaUltimaNegociacao;
}
public double getMenorValorDia() {
return menorValorDia;
}
public void setMenorValorDia(double menorValorDia) {
this.menorValorDia = menorValorDia;
}
public double getMaiorValorDia() {
return maiorValorDia;
}
public void setMaiorValorDia(double maiorValorDia) {
this.maiorValorDia = maiorValorDia;
}
public double getMenorValorAno() {
return menorValorAno;
}
public void setMenorValorAno(double menorValorAno) {
this.menorValorAno = menorValorAno;
}
public double getMaiorValorAno() {
return maiorValorAno;
}
public void setMaiorValorAno(double maiorValorAno) {
this.maiorValorAno = maiorValorAno;
}
public String getCapitalMercado() {
return capitalMercado;
}
public void setCapitalMercado(String capitalMercado) {
this.capitalMercado = capitalMercado;
}
public String getEBITDA() {
return EBITDA;
}
public void setEBITDA(String eBITDA) {
EBITDA = eBITDA;
}
public double getValorAbertura() {
return valorAbertura;
}
public void setValorAbertura(double valorAbertura) {
this.valorAbertura = valorAbertura;
}
public double getUltimoValorFechamento() {
return ultimoValorFechamento;
}
public void setUltimoValorFechamento(double ultimoValorFechamento) {
this.ultimoValorFechamento = ultimoValorFechamento;
}
public double getPercentual() {
return percentual;
}
public void setPercentual(double percentual) {
this.percentual = percentual;
}
public String getExchange() {
return exchange;
}
public void setExchange(String exchange) {
this.exchange = exchange;
}
public double getValorAtual() {
return valorAtual;
}
public void setValorAtual(double valorAtual) {
this.valorAtual = valorAtual;
}
}
| 3,649 | 0.780762 | 0.780762 | 142 | 24.704226 | 18.357479 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.633803 | false | false |
0
|
b1f9d01d1f14875a8cd302321fafaae86928fc35
| 19,937,238,243,157 |
217f2542b215c797c8553a35eea8d7df706b2817
|
/src/Input/WindowInputpackage/WindowFinisher.java
|
9d15d343aa434e01dbbc36de7a946201ca0d1a55
|
[] |
no_license
|
DJDDDM/Sanktionsliste
|
https://github.com/DJDDDM/Sanktionsliste
|
c4ce2f34bf326297eff0f52edb9608898a74fab6
|
f4b766fce36d1f6df02476fa0ec39a21c65e3704
|
refs/heads/master
| 2023-01-05T01:23:44.349000 | 2022-08-20T16:38:48 | 2022-08-20T16:38:48 | 309,783,312 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Input.WindowInputpackage;
import Input.WindowInputpackage.WindowProperties;
public class WindowFinisher {
private WindowProperties Window;
public WindowFinisher(WindowProperties window) {
this.Window = window;
}
public String finish(){
String name = Window.tfName.getText();
Window.Frame.dispose();
return name;
}
}
|
UTF-8
|
Java
| 378 |
java
|
WindowFinisher.java
|
Java
|
[] | null |
[] |
package Input.WindowInputpackage;
import Input.WindowInputpackage.WindowProperties;
public class WindowFinisher {
private WindowProperties Window;
public WindowFinisher(WindowProperties window) {
this.Window = window;
}
public String finish(){
String name = Window.tfName.getText();
Window.Frame.dispose();
return name;
}
}
| 378 | 0.693122 | 0.693122 | 15 | 24.200001 | 17.596212 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.466667 | false | false |
0
|
7517a6cf4e2edfe58290dbf29b3a031e35d18aee
| 22,746,146,863,310 |
dca569f201c29c490b3a8da2cc5a4d7e4b0be6b4
|
/Java Poczatki/src/java25_06/Czlowiek.java
|
aa4a94a2c2be19b073816415cfcd6d7d8647daf2
|
[] |
no_license
|
SebastianZelazny/Java
|
https://github.com/SebastianZelazny/Java
|
6a33290a053c48383225acca80a57395e60127e9
|
bd602103c36a32752b606b2808805a58ee1c0bc1
|
refs/heads/master
| 2021-01-01T17:58:33.850000 | 2017-07-24T15:44:02 | 2017-07-24T15:44:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package java25_06;
public class Czlowiek extends Byt {
private String imie;
private String nazwisko;
public void rusz_reka()
{
System.out.println("Ruszam rÍka");
}
public String getNazwisko() {
return nazwisko;
}
public void setNazwisko(String nazwisko) {
this.nazwisko = nazwisko;
}
public String getImie() {
return imie;
}
public void setImie(String imie) {
this.imie = imie;
}
}
|
MacCentralEurope
|
Java
| 418 |
java
|
Czlowiek.java
|
Java
|
[] | null |
[] |
package java25_06;
public class Czlowiek extends Byt {
private String imie;
private String nazwisko;
public void rusz_reka()
{
System.out.println("Ruszam rÍka");
}
public String getNazwisko() {
return nazwisko;
}
public void setNazwisko(String nazwisko) {
this.nazwisko = nazwisko;
}
public String getImie() {
return imie;
}
public void setImie(String imie) {
this.imie = imie;
}
}
| 418 | 0.685851 | 0.676259 | 28 | 13.892858 | 13.852125 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false |
0
|
cc0f3dbaa4b74dc500e128b6aa584890adb5c60e
| 21,165,598,894,933 |
f60d6d22300adadcc09a0b53fb7c54fcc01c43f1
|
/src/java/stylish/client/controller/CompareController.java
|
59e317d4df69b28e211d607f1f1d814894a73c79
|
[] |
no_license
|
hoangnlm/stylish
|
https://github.com/hoangnlm/stylish
|
866779cafefe7ea7ed7f5291b47d62539b7f3897
|
9d0ab3fde72122bbe6f1dfa54ae3a27435be9dcb
|
refs/heads/master
| 2020-12-02T22:42:32.780000 | 2017-07-11T14:56:14 | 2017-07-11T14:56:14 | 96,167,927 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package stylish.client.controller;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import stylish.ejb.CompareStateFullBeanLocal;
import stylish.ejb.OrderStateLessBeanLocal;
import stylish.ejb.ProductStateLessBeanLocal;
import stylish.entity.Categories;
import stylish.entity.Products;
@Controller
@RequestMapping(value = "/compare/")
public class CompareController {
private CompareStateFullBeanLocal compareStateFullBean = lookupCompareStateFullBeanLocal();
private ProductStateLessBeanLocal productStateLessBean = lookupProductStateLessBeanLocal();
private OrderStateLessBeanLocal orderStateLessBean = lookupOrderStateLessBeanLocal();
// AJAX CLEAR COMPARE LIST
@ResponseBody
@RequestMapping(value = "ajax/clear", method = RequestMethod.GET)
public String ajaxCompareClear() {
// System.out.println("compare/ajax/clear");
List<Products> list = compareStateFullBean.showCompare();
if (!list.isEmpty()) {
list.clear();
}
return "0"; // Success
}
// AJAX GET COMPARE LIST
@ResponseBody
@RequestMapping(value = "ajax/getCompare", method = RequestMethod.GET)
public String getCompare() {
String result = "";
String itemDetails = "";
String compareButton = "<div class=\"cart-btn\">"
+ "<a style=\"font-size: 9px; margin-right: 3px;\" href=\"compare/view.html\">COMPARE</a>"
+ "<button type=\"button\" onclick=\"compareClearClick();\" style=\""
+ "font-size: 9px;\n"
+ "text-transform: none;\n"
+ "height: 33px;\n"
+ "padding: 0 17px;\n"
+ "line-height: 33px;\n"
+ "font-weight: 700;\" class=\"btn btn-warning\">CLEAR</button> \n"
+ "</div>";
List<Products> list = compareStateFullBean.showCompare();
if (!list.isEmpty()) {
for (Products p : list) {
itemDetails += "<div class=\"ci-item\">\n"
+ " <img src=\"assets/images/products/" + p.getUrlImg() + "\" width=\"50\" alt=\"\"/>\n"
+ " <div class=\"ci-item-info\">\n"
+ " <h5>\n"
+ " <a style=\"font-weight: 700;\" href=\"" + p.getProductID() + "-" + p.getProductNameNA() + ".html\">\n"
+ " " + p.getProductName() + "\n"
+ " </a>\n"
+ " </h5>\n"
+ " <p>Price:   $" + p.getPrice() + "</p>\n"
+ " </div>\n"
+ " </div>";
}
}
result += "<div class=\"compare-info\">\n"
+ "<small>You have <em class=\"highlight\">" + list.size() + " item(s)</em> in compare list.</small>\n"
+ itemDetails
+ (list.isEmpty() ? "" : compareButton)
+ "</div>";
return result;
}
// AJAX ADD ITEM TO COMPARE LIST
@ResponseBody
@RequestMapping(value = "ajax/add", method = RequestMethod.GET)
public String ajaxAdd(@RequestParam("productID") Integer productID) {
Products pro = orderStateLessBean.getProductByID(productID); //Tim trong danh sach san pham
// System.out.println("ajaxAdd ================================================================================================================================================= " + pro);
if (pro != null) {
// Tim trong danh sach compare
if (compareStateFullBean.getProductInListByID(productID) == null) {
compareStateFullBean.addProduct(pro);
return "0"; // Added to compare list successfully!
}
return "1"; // This product has been added!
}
return "2"; // This product not found!
}
// AJAX DELETE ITEM OUT OF LIST
@ResponseBody
@RequestMapping(value = "ajax/delete/{productID}", method = RequestMethod.GET)
public String delete(@PathVariable("productID") int productID) {
if (compareStateFullBean.deleteItem(productID)) {
if (compareStateFullBean.showCompare().isEmpty()) {
return "2";
}
return "0";
}
return "1";
}
@RequestMapping(value = "view")
public String compare(ModelMap model, HttpServletRequest request) {
//2 dòng này thêm để render ra menu chính
List<Categories> cateList = productStateLessBean.categoryList();
model.addAttribute("cateList", cateList);
model.addAttribute("compareList", compareStateFullBean.showCompare());
return "client/pages/compare";
}
@RequestMapping(value = "deleteAll", method = RequestMethod.GET)
public String deleteCompare() {
compareStateFullBean.deleteAll();
return "redirect:/compare/view.html";
}
private OrderStateLessBeanLocal lookupOrderStateLessBeanLocal() {
try {
Context c = new InitialContext();
return (OrderStateLessBeanLocal) c.lookup("java:global/stylish/OrderStateLessBean!stylish.ejb.OrderStateLessBeanLocal");
} catch (NamingException ne) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
}
private ProductStateLessBeanLocal lookupProductStateLessBeanLocal() {
try {
Context c = new InitialContext();
return (ProductStateLessBeanLocal) c.lookup("java:global/stylish/ProductStateLessBean!stylish.ejb.ProductStateLessBeanLocal");
} catch (NamingException ne) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
}
private CompareStateFullBeanLocal lookupCompareStateFullBeanLocal() {
try {
Context c = new InitialContext();
return (CompareStateFullBeanLocal) c.lookup("java:global/stylish/CompareStateFullBean!stylish.ejb.CompareStateFullBeanLocal");
} catch (NamingException ne) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
}
}
|
UTF-8
|
Java
| 7,155 |
java
|
CompareController.java
|
Java
|
[] | null |
[] |
package stylish.client.controller;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import stylish.ejb.CompareStateFullBeanLocal;
import stylish.ejb.OrderStateLessBeanLocal;
import stylish.ejb.ProductStateLessBeanLocal;
import stylish.entity.Categories;
import stylish.entity.Products;
@Controller
@RequestMapping(value = "/compare/")
public class CompareController {
private CompareStateFullBeanLocal compareStateFullBean = lookupCompareStateFullBeanLocal();
private ProductStateLessBeanLocal productStateLessBean = lookupProductStateLessBeanLocal();
private OrderStateLessBeanLocal orderStateLessBean = lookupOrderStateLessBeanLocal();
// AJAX CLEAR COMPARE LIST
@ResponseBody
@RequestMapping(value = "ajax/clear", method = RequestMethod.GET)
public String ajaxCompareClear() {
// System.out.println("compare/ajax/clear");
List<Products> list = compareStateFullBean.showCompare();
if (!list.isEmpty()) {
list.clear();
}
return "0"; // Success
}
// AJAX GET COMPARE LIST
@ResponseBody
@RequestMapping(value = "ajax/getCompare", method = RequestMethod.GET)
public String getCompare() {
String result = "";
String itemDetails = "";
String compareButton = "<div class=\"cart-btn\">"
+ "<a style=\"font-size: 9px; margin-right: 3px;\" href=\"compare/view.html\">COMPARE</a>"
+ "<button type=\"button\" onclick=\"compareClearClick();\" style=\""
+ "font-size: 9px;\n"
+ "text-transform: none;\n"
+ "height: 33px;\n"
+ "padding: 0 17px;\n"
+ "line-height: 33px;\n"
+ "font-weight: 700;\" class=\"btn btn-warning\">CLEAR</button> \n"
+ "</div>";
List<Products> list = compareStateFullBean.showCompare();
if (!list.isEmpty()) {
for (Products p : list) {
itemDetails += "<div class=\"ci-item\">\n"
+ " <img src=\"assets/images/products/" + p.getUrlImg() + "\" width=\"50\" alt=\"\"/>\n"
+ " <div class=\"ci-item-info\">\n"
+ " <h5>\n"
+ " <a style=\"font-weight: 700;\" href=\"" + p.getProductID() + "-" + p.getProductNameNA() + ".html\">\n"
+ " " + p.getProductName() + "\n"
+ " </a>\n"
+ " </h5>\n"
+ " <p>Price:   $" + p.getPrice() + "</p>\n"
+ " </div>\n"
+ " </div>";
}
}
result += "<div class=\"compare-info\">\n"
+ "<small>You have <em class=\"highlight\">" + list.size() + " item(s)</em> in compare list.</small>\n"
+ itemDetails
+ (list.isEmpty() ? "" : compareButton)
+ "</div>";
return result;
}
// AJAX ADD ITEM TO COMPARE LIST
@ResponseBody
@RequestMapping(value = "ajax/add", method = RequestMethod.GET)
public String ajaxAdd(@RequestParam("productID") Integer productID) {
Products pro = orderStateLessBean.getProductByID(productID); //Tim trong danh sach san pham
// System.out.println("ajaxAdd ================================================================================================================================================= " + pro);
if (pro != null) {
// Tim trong danh sach compare
if (compareStateFullBean.getProductInListByID(productID) == null) {
compareStateFullBean.addProduct(pro);
return "0"; // Added to compare list successfully!
}
return "1"; // This product has been added!
}
return "2"; // This product not found!
}
// AJAX DELETE ITEM OUT OF LIST
@ResponseBody
@RequestMapping(value = "ajax/delete/{productID}", method = RequestMethod.GET)
public String delete(@PathVariable("productID") int productID) {
if (compareStateFullBean.deleteItem(productID)) {
if (compareStateFullBean.showCompare().isEmpty()) {
return "2";
}
return "0";
}
return "1";
}
@RequestMapping(value = "view")
public String compare(ModelMap model, HttpServletRequest request) {
//2 dòng này thêm để render ra menu chính
List<Categories> cateList = productStateLessBean.categoryList();
model.addAttribute("cateList", cateList);
model.addAttribute("compareList", compareStateFullBean.showCompare());
return "client/pages/compare";
}
@RequestMapping(value = "deleteAll", method = RequestMethod.GET)
public String deleteCompare() {
compareStateFullBean.deleteAll();
return "redirect:/compare/view.html";
}
private OrderStateLessBeanLocal lookupOrderStateLessBeanLocal() {
try {
Context c = new InitialContext();
return (OrderStateLessBeanLocal) c.lookup("java:global/stylish/OrderStateLessBean!stylish.ejb.OrderStateLessBeanLocal");
} catch (NamingException ne) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
}
private ProductStateLessBeanLocal lookupProductStateLessBeanLocal() {
try {
Context c = new InitialContext();
return (ProductStateLessBeanLocal) c.lookup("java:global/stylish/ProductStateLessBean!stylish.ejb.ProductStateLessBeanLocal");
} catch (NamingException ne) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
}
private CompareStateFullBeanLocal lookupCompareStateFullBeanLocal() {
try {
Context c = new InitialContext();
return (CompareStateFullBeanLocal) c.lookup("java:global/stylish/CompareStateFullBean!stylish.ejb.CompareStateFullBeanLocal");
} catch (NamingException ne) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
}
}
| 7,155 | 0.576805 | 0.572888 | 162 | 42.123455 | 33.905418 | 193 | false | false | 0 | 0 | 0 | 0 | 145 | 0.020285 | 0.524691 | false | false |
0
|
8f26160c3985bb6b90e19c2649f1c405030610f5
| 21,165,598,893,835 |
4f644567986ffb5465790b96196020989ea5051d
|
/src/test/java/net/coderodde/javadb/TableTest.java
|
a65a6881e618c4c37f1eadc363a052532f44aea1
|
[] |
no_license
|
coderodde/JavaDB
|
https://github.com/coderodde/JavaDB
|
5026198f4bc1346b89761d125357a6e3e9544706
|
3a30df149cec9fc486dec4151f70a75e2c9720f6
|
refs/heads/master
| 2021-01-12T07:26:19.417000 | 2017-08-03T08:48:28 | 2017-08-03T08:48:28 | 76,960,298 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.coderodde.javadb;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.junit.Test;
import static org.junit.Assert.*;
public class TableTest {
@Test
public void testSerializeDeserialize() {
// Table table = new Table("hello_table");
//
// TableColumnDescriptor column1 =
// new TableColumnDescriptor("col1",
// TableCellType.TYPE_STRING);
//
// TableColumnDescriptor column2 =
// new TableColumnDescriptor("col2",
// TableCellType.TYPE_INT);
//
// TableColumnDescriptor column3 =
// new TableColumnDescriptor("col3",
// TableCellType.TYPE_BINARY);
//
// table.addTableColumnDescriptor(column1);
// table.addTableColumnDescriptor(column2);
// table.addTableColumnDescriptor(column3);
//
// TableRow row1 = new TableRow(null);
// TableRow row2 = new TableRow(null);
//
// row1.add(0, new TableCell(TableCellType.TYPE_STRING));
// row1.add(1, new TableCell(123));
// row1.add(2, new TableCell(new byte[] {4, 3, 2, 1, 0}));
//
// row2.add(0, new TableCell("Funky"));
// row2.add(1, new TableCell(TableCellType.TYPE_INT));
// row2.add(2, new TableCell(TableCellType.TYPE_BINARY));
//
// table.put
// table.addRow(row1);
// table.addRow(row2);
//
// ByteBuffer byteBuffer =
// ByteBuffer.allocate(table.getSerializationLength())
// .order(ByteOrder.LITTLE_ENDIAN);
//
// table.serialize(byteBuffer);
//
// byteBuffer.position(0);
//
// Table table2 = Table.deserialize(byteBuffer);
//
// assertEquals(table, table2);
}
@Test
public void testEquals() {
// Table table1 = new Table("table1");
// Table table2 = new Table("table2");
//
// assertTrue(table1.equals(table2));
// assertTrue(table2.equals(table2));
// assertTrue(table1.equals(table1));
// assertFalse(table1.equals(null));
//
// TableColumnDescriptor column1 =
// new TableColumnDescriptor("col1",
// TableCellType.TYPE_BINARY);
//
// TableColumnDescriptor column2 =
// new TableColumnDescriptor("col2",
// TableCellType.TYPE_DOUBLE);
//
// table1.addTableColumnDescriptor(column1);
// assertFalse(table1.equals(table2));
//
// table2.addTableColumnDescriptor(column1);
// assertTrue(table1.equals(table2));
//
// table1.addTableColumnDescriptor(column2);
// assertFalse(table1.equals(table2));
//
// table2.addTableColumnDescriptor(column2);
// assertTrue(table1.equals(table2));
//
// TableRow row1 = new TableRow();
// TableRow row2 = new TableRow();
//
// row1.add(new TableCell(new byte[] { 2, 9 }));
// row1.add(new TableCell(45.6));
//
// table1.addRow(row1);
//
// assertFalse(table1.equals(table2));
//
// row2.add(new TableCell(new byte[] { 2, 9 }));
// row2.add(new TableCell(45.6));
//
// table1.addRow(row2);
//
// assertFalse(table1.equals(table2));
//
// table2.addRow(row1);
// table2.addRow(row2);
//
// assertTrue(table1.equals(table2));
}
}
|
UTF-8
|
Java
| 3,694 |
java
|
TableTest.java
|
Java
|
[] | null |
[] |
package net.coderodde.javadb;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.junit.Test;
import static org.junit.Assert.*;
public class TableTest {
@Test
public void testSerializeDeserialize() {
// Table table = new Table("hello_table");
//
// TableColumnDescriptor column1 =
// new TableColumnDescriptor("col1",
// TableCellType.TYPE_STRING);
//
// TableColumnDescriptor column2 =
// new TableColumnDescriptor("col2",
// TableCellType.TYPE_INT);
//
// TableColumnDescriptor column3 =
// new TableColumnDescriptor("col3",
// TableCellType.TYPE_BINARY);
//
// table.addTableColumnDescriptor(column1);
// table.addTableColumnDescriptor(column2);
// table.addTableColumnDescriptor(column3);
//
// TableRow row1 = new TableRow(null);
// TableRow row2 = new TableRow(null);
//
// row1.add(0, new TableCell(TableCellType.TYPE_STRING));
// row1.add(1, new TableCell(123));
// row1.add(2, new TableCell(new byte[] {4, 3, 2, 1, 0}));
//
// row2.add(0, new TableCell("Funky"));
// row2.add(1, new TableCell(TableCellType.TYPE_INT));
// row2.add(2, new TableCell(TableCellType.TYPE_BINARY));
//
// table.put
// table.addRow(row1);
// table.addRow(row2);
//
// ByteBuffer byteBuffer =
// ByteBuffer.allocate(table.getSerializationLength())
// .order(ByteOrder.LITTLE_ENDIAN);
//
// table.serialize(byteBuffer);
//
// byteBuffer.position(0);
//
// Table table2 = Table.deserialize(byteBuffer);
//
// assertEquals(table, table2);
}
@Test
public void testEquals() {
// Table table1 = new Table("table1");
// Table table2 = new Table("table2");
//
// assertTrue(table1.equals(table2));
// assertTrue(table2.equals(table2));
// assertTrue(table1.equals(table1));
// assertFalse(table1.equals(null));
//
// TableColumnDescriptor column1 =
// new TableColumnDescriptor("col1",
// TableCellType.TYPE_BINARY);
//
// TableColumnDescriptor column2 =
// new TableColumnDescriptor("col2",
// TableCellType.TYPE_DOUBLE);
//
// table1.addTableColumnDescriptor(column1);
// assertFalse(table1.equals(table2));
//
// table2.addTableColumnDescriptor(column1);
// assertTrue(table1.equals(table2));
//
// table1.addTableColumnDescriptor(column2);
// assertFalse(table1.equals(table2));
//
// table2.addTableColumnDescriptor(column2);
// assertTrue(table1.equals(table2));
//
// TableRow row1 = new TableRow();
// TableRow row2 = new TableRow();
//
// row1.add(new TableCell(new byte[] { 2, 9 }));
// row1.add(new TableCell(45.6));
//
// table1.addRow(row1);
//
// assertFalse(table1.equals(table2));
//
// row2.add(new TableCell(new byte[] { 2, 9 }));
// row2.add(new TableCell(45.6));
//
// table1.addRow(row2);
//
// assertFalse(table1.equals(table2));
//
// table2.addRow(row1);
// table2.addRow(row2);
//
// assertTrue(table1.equals(table2));
}
}
| 3,694 | 0.523822 | 0.497564 | 110 | 32.581818 | 20.257605 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.672727 | false | false |
0
|
131fd83dc84d522eae0b465ca6f818730cd4ebe9
| 704,374,656,444 |
d4fdb17c6ec0d851747b3799212d25598d113271
|
/src/main/java/openrecordz/service/RegistrationService.java
|
2b48e6c5148cb0600f5b524929584a8e7f3dde0f
|
[] |
no_license
|
williamaurreav23/openrecordz-server
|
https://github.com/williamaurreav23/openrecordz-server
|
378170e09f7473c2d7980bc1d7cd487b3b44cc00
|
f2740cc4fa239b3e0feabfef4c32516cba1db80b
|
refs/heads/master
| 2022-01-12T21:23:28.718000 | 2019-03-19T12:12:52 | 2019-03-19T12:12:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package openrecordz.service;
import openrecordz.exception.EmailAlreadyInUseException;
import openrecordz.exception.OpenRecordzException;
import openrecordz.security.exception.UsernameAlreadyInUseException;
public interface RegistrationService {
//aop-script related
public String register(String username, String fullName, String email, String password) throws UsernameAlreadyInUseException, EmailAlreadyInUseException, OpenRecordzException;
}
|
UTF-8
|
Java
| 453 |
java
|
RegistrationService.java
|
Java
|
[
{
"context": "/aop-script related\n\tpublic String register(String username, String fullName, String email, String password) ",
"end": 309,
"score": 0.5835561156272888,
"start": 301,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package openrecordz.service;
import openrecordz.exception.EmailAlreadyInUseException;
import openrecordz.exception.OpenRecordzException;
import openrecordz.security.exception.UsernameAlreadyInUseException;
public interface RegistrationService {
//aop-script related
public String register(String username, String fullName, String email, String password) throws UsernameAlreadyInUseException, EmailAlreadyInUseException, OpenRecordzException;
}
| 453 | 0.860927 | 0.860927 | 13 | 33.846153 | 47.243797 | 176 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.076923 | false | false |
0
|
5cfb3a3d8f726df50589fa3a615ed24b64f4ae69
| 704,374,657,818 |
a236b021c3a04a0c58a82e94c0a038e84ffcdd08
|
/First/src/main/java/com/first/service/login/LoginServiceImpl.java
|
46791d67a61fd99b1aa80b38a2fb481a05751b9c
|
[] |
no_license
|
leeseungju92/PJ_Spring_FIRST
|
https://github.com/leeseungju92/PJ_Spring_FIRST
|
da72e49da013b31ffaecc2a3e3d8cd6789b58e2e
|
0b91714e736cc78a3ff70698f6aa0530266ec044
|
refs/heads/master
| 2022-12-22T21:25:53.672000 | 2020-05-28T07:06:54 | 2020-05-28T07:06:54 | 239,912,330 | 0 | 0 | null | false | 2022-12-15T23:31:11 | 2020-02-12T02:43:18 | 2020-05-28T07:07:27 | 2022-12-15T23:31:11 | 1,254 | 0 | 0 | 14 |
CSS
| false | false |
package com.first.service.login;
import javax.servlet.http.HttpSession;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import com.first.domain.MemberDTO;
import com.first.persistence.LoginDAO;
import lombok.extern.slf4j.Slf4j;
@Service
@Slf4j
public class LoginServiceImpl implements LoginService{
@Autowired
PasswordEncoder passwordEncoder;
@Autowired
private SqlSession sqlSession;
private LoginDAO lDao;
@Autowired
public void newMemberDAO() {
lDao = sqlSession.getMapper(LoginDAO.class);
}
@Override
public int login(MemberDTO mDto, HttpSession session) {
// TODO Auto-generated method stub
MemberDTO loginDto = lDao.loginUser(mDto);
log.info("*******************************************결과");
int result =0;
if(loginDto==null) {
result = 0;
return result;
}
if(!(loginDto.getUseyn().equals("y"))){
result = 2;
return result;
}
if(loginDto.getUseyn().equals("d")){
result = 3;
return result;
}
if(loginDto != null) {
if(passwordEncoder.matches(mDto.getPw(), loginDto.getPw())) {
result = 1;
session.removeAttribute("userid");
session.removeAttribute("name");
session.setAttribute("userid", loginDto.getId());
session.setAttribute("name", loginDto.getName());
}else {
result = 3;
}
}
return result;
}
@Override
public void logout(HttpSession session) {
// TODO Auto-generated method stub
session.invalidate();
}
}
|
UTF-8
|
Java
| 1,625 |
java
|
LoginServiceImpl.java
|
Java
|
[] | null |
[] |
package com.first.service.login;
import javax.servlet.http.HttpSession;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import com.first.domain.MemberDTO;
import com.first.persistence.LoginDAO;
import lombok.extern.slf4j.Slf4j;
@Service
@Slf4j
public class LoginServiceImpl implements LoginService{
@Autowired
PasswordEncoder passwordEncoder;
@Autowired
private SqlSession sqlSession;
private LoginDAO lDao;
@Autowired
public void newMemberDAO() {
lDao = sqlSession.getMapper(LoginDAO.class);
}
@Override
public int login(MemberDTO mDto, HttpSession session) {
// TODO Auto-generated method stub
MemberDTO loginDto = lDao.loginUser(mDto);
log.info("*******************************************결과");
int result =0;
if(loginDto==null) {
result = 0;
return result;
}
if(!(loginDto.getUseyn().equals("y"))){
result = 2;
return result;
}
if(loginDto.getUseyn().equals("d")){
result = 3;
return result;
}
if(loginDto != null) {
if(passwordEncoder.matches(mDto.getPw(), loginDto.getPw())) {
result = 1;
session.removeAttribute("userid");
session.removeAttribute("name");
session.setAttribute("userid", loginDto.getId());
session.setAttribute("name", loginDto.getName());
}else {
result = 3;
}
}
return result;
}
@Override
public void logout(HttpSession session) {
// TODO Auto-generated method stub
session.invalidate();
}
}
| 1,625 | 0.69525 | 0.689698 | 73 | 21.205479 | 19.514629 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.013699 | false | false |
0
|
af005d4d2f68d83c5ea94aa7bc620c039315ea6c
| 31,868,657,339,627 |
7ea45377de05a91d447687c53e1a836cfaec4b11
|
/team_contests/nwerc2012/NWERC_2012_ProblemSet_TestCases_Solutions/E/EdgeCase.java
|
cadf474862ef5ba9c6ad682ae9e0b475fdb64e77
|
[] |
no_license
|
saikrishna17394/Code
|
https://github.com/saikrishna17394/Code
|
d2b71efe5e3e932824339149008c3ea33dff6acb
|
1213f951233a502ae6ecf2df337f340d8d65d498
|
refs/heads/master
| 2020-05-19T14:16:49.037000 | 2017-01-26T17:17:13 | 2017-01-26T17:17:13 | 24,478,656 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// @EXPECTED_RESULTS@: CORRECT
import java.util.*;
import java.io.*;
import java.math.*;
public class EdgeCase {
public static void main(String[] args){
int i;
Scanner in = new Scanner(System.in);
BigInteger[] Lucas = new BigInteger[10001];
Lucas[1] = BigInteger.valueOf(1);
Lucas[2] = BigInteger.valueOf(3);
for( i = 3 ;i<=10000;i++)
Lucas[i] = Lucas[i-1].add(Lucas[i-2]);
while(in.hasNextInt()){
int n = in.nextInt();
System.out.println(Lucas[n]);
}
}
}
|
UTF-8
|
Java
| 514 |
java
|
EdgeCase.java
|
Java
|
[] | null |
[] |
// @EXPECTED_RESULTS@: CORRECT
import java.util.*;
import java.io.*;
import java.math.*;
public class EdgeCase {
public static void main(String[] args){
int i;
Scanner in = new Scanner(System.in);
BigInteger[] Lucas = new BigInteger[10001];
Lucas[1] = BigInteger.valueOf(1);
Lucas[2] = BigInteger.valueOf(3);
for( i = 3 ;i<=10000;i++)
Lucas[i] = Lucas[i-1].add(Lucas[i-2]);
while(in.hasNextInt()){
int n = in.nextInt();
System.out.println(Lucas[n]);
}
}
}
| 514 | 0.603113 | 0.570039 | 22 | 22.318182 | 15.528234 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.590909 | false | false |
0
|
bd5ecb81995f208745fc1fb2a283d51d24058060
| 14,104,672,603,559 |
8ccd1c071b19388f1f2e92c5e5dbedc78fead327
|
/src/main/java/ohos/agp/components/ComponentParent.java
|
10131efe8711d106a1ecd9e9ad3a37aac68bf0b5
|
[] |
no_license
|
yearsyan/Harmony-OS-Java-class-library
|
https://github.com/yearsyan/Harmony-OS-Java-class-library
|
d6c135b6a672c4c9eebf9d3857016995edeb38c9
|
902adac4d7dca6fd82bb133c75c64f331b58b390
|
refs/heads/main
| 2023-06-11T21:41:32.097000 | 2021-06-24T05:35:32 | 2021-06-24T05:35:32 | 379,816,304 | 6 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ohos.agp.components;
import ohos.agp.components.ComponentContainer;
public interface ComponentParent {
int getChildIndex(Component component);
ComponentParent getComponentParent();
void moveChildToFront(Component component);
boolean onDrag(Component component, DragEvent dragEvent);
void postLayout();
void removeComponent(Component component);
void removeComponentAt(int i);
void removeComponents(int i, int i2);
ComponentContainer.LayoutConfig verifyLayoutConfig(ComponentContainer.LayoutConfig layoutConfig);
}
|
UTF-8
|
Java
| 591 |
java
|
ComponentParent.java
|
Java
|
[] | null |
[] |
package ohos.agp.components;
import ohos.agp.components.ComponentContainer;
public interface ComponentParent {
int getChildIndex(Component component);
ComponentParent getComponentParent();
void moveChildToFront(Component component);
boolean onDrag(Component component, DragEvent dragEvent);
void postLayout();
void removeComponent(Component component);
void removeComponentAt(int i);
void removeComponents(int i, int i2);
ComponentContainer.LayoutConfig verifyLayoutConfig(ComponentContainer.LayoutConfig layoutConfig);
}
| 591 | 0.751269 | 0.749577 | 23 | 23.695652 | 26.573008 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false |
0
|
aab91cdf6d5c17cdc391d4149d22a01f3ad175a0
| 15,504,831,941,944 |
8ae0ecef4b2beeb14d4d3759e567808761470480
|
/com/suscipio_solutions/consecro_mud/Abilities/Skills/Skill_MountedCombat.java
|
3f147ec6bd6cc87fad1e9de250b77af85a3e6ed5
|
[
"Apache-2.0"
] |
permissive
|
consecrocreations/ConsecroMUD
|
https://github.com/consecrocreations/ConsecroMUD
|
11aa0e166519c86061694d80ff836843c7fce795
|
a945f72a361342731d6a7148497ed44646affe80
|
refs/heads/master
| 2016-05-30T06:00:55.355000 | 2014-11-04T17:30:12 | 2014-11-04T17:30:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.suscipio_solutions.consecro_mud.Abilities.Skills;
import com.suscipio_solutions.consecro_mud.Abilities.interfaces.Ability;
import com.suscipio_solutions.consecro_mud.Common.interfaces.PhyStats;
import com.suscipio_solutions.consecro_mud.MOBS.interfaces.MOB;
import com.suscipio_solutions.consecro_mud.core.CMLib;
import com.suscipio_solutions.consecro_mud.core.interfaces.Physical;
public class Skill_MountedCombat extends StdSkill
{
@Override public String ID() { return "Skill_MountedCombat"; }
private final static String localizedName = CMLib.lang().L("Mounted Combat");
@Override public String name() { return localizedName; }
@Override public String displayText(){ return "";}
@Override protected int canAffectCode(){return CAN_MOBS;}
@Override protected int canTargetCode(){return 0;}
@Override public int abstractQuality(){return Ability.QUALITY_BENEFICIAL_SELF;}
@Override public int classificationCode(){return Ability.ACODE_SKILL|Ability.DOMAIN_ANIMALAFFINITY;}
@Override public boolean isAutoInvoked(){return true;}
@Override public boolean canBeUninvoked(){return false;}
@Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((mob.isInCombat())&&(mob.rangeToTarget()==0)&&(mob.riding()!=null)&&(mob.riding().amRiding(mob)))
{
final int xlvl=super.getXLEVELLevel(invoker());
affectableStats.setAttackAdjustment(affectableStats.attackAdjustment()+((1+(xlvl/3))*mob.basePhyStats().attackAdjustment()));
affectableStats.setDamage(affectableStats.damage()+((1+(xlvl/3))*mob.basePhyStats().damage()));
}
}
}
}
|
UTF-8
|
Java
| 1,718 |
java
|
Skill_MountedCombat.java
|
Java
|
[] | null |
[] |
package com.suscipio_solutions.consecro_mud.Abilities.Skills;
import com.suscipio_solutions.consecro_mud.Abilities.interfaces.Ability;
import com.suscipio_solutions.consecro_mud.Common.interfaces.PhyStats;
import com.suscipio_solutions.consecro_mud.MOBS.interfaces.MOB;
import com.suscipio_solutions.consecro_mud.core.CMLib;
import com.suscipio_solutions.consecro_mud.core.interfaces.Physical;
public class Skill_MountedCombat extends StdSkill
{
@Override public String ID() { return "Skill_MountedCombat"; }
private final static String localizedName = CMLib.lang().L("Mounted Combat");
@Override public String name() { return localizedName; }
@Override public String displayText(){ return "";}
@Override protected int canAffectCode(){return CAN_MOBS;}
@Override protected int canTargetCode(){return 0;}
@Override public int abstractQuality(){return Ability.QUALITY_BENEFICIAL_SELF;}
@Override public int classificationCode(){return Ability.ACODE_SKILL|Ability.DOMAIN_ANIMALAFFINITY;}
@Override public boolean isAutoInvoked(){return true;}
@Override public boolean canBeUninvoked(){return false;}
@Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
super.affectPhyStats(affected,affectableStats);
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((mob.isInCombat())&&(mob.rangeToTarget()==0)&&(mob.riding()!=null)&&(mob.riding().amRiding(mob)))
{
final int xlvl=super.getXLEVELLevel(invoker());
affectableStats.setAttackAdjustment(affectableStats.attackAdjustment()+((1+(xlvl/3))*mob.basePhyStats().attackAdjustment()));
affectableStats.setDamage(affectableStats.damage()+((1+(xlvl/3))*mob.basePhyStats().damage()));
}
}
}
}
| 1,718 | 0.772992 | 0.769499 | 37 | 45.432434 | 34.984585 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.891892 | false | false |
0
|
bb14e23ac3cefc8990b116c41b303ee17984f8a2
| 17,274,358,476,429 |
93d313b456e1df094586c68d327ccecb7fc2421c
|
/TransmitterPHP/app/src/main/java/com/example/virtus/transmitter/ExpandableListActivity.java
|
5af3825b08a2aa250714beaf948d90e71ad2d8a5
|
[] |
no_license
|
VirtusF12/TransmitterPHP
|
https://github.com/VirtusF12/TransmitterPHP
|
1636767f41da56f2c532c69533622de6723eda04
|
7f8abe0049a4c38c1bd70415e394b5d9bad81b93
|
refs/heads/master
| 2023-06-13T08:11:21.274000 | 2021-07-10T09:55:21 | 2021-07-10T09:55:21 | 384,659,170 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.virtus.transmitter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import Robot.Robot;
/**
* Активити - вложенный список моих задач
* @author Mihail Kovalenko
*/
public final class ExpandableListActivity extends AppCompatActivity {
private static final String TEG_ExpandableListActivity = "TEG_ExpandableListActivity";
private ExpandableListView expListView;
private ExpandableListAdapter expListAdapter;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private HashMap<String, ArrayList<String>> expListDetail;
private HashMap<String, ArrayList<Boolean>> expListFlag;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private String myLogin;
private ListDate listDate;
private void setActionBar(){
try {
android.support.v7.widget.Toolbar toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar);
toolbar.setTitleTextColor(getResources().getColor(R.color.white));
toolbar.setTitle("Мои задачи");
setSupportActionBar(toolbar);
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
} catch (Exception ex){
Log.d(TEG_ExpandableListActivity, "Ошибка TEG_ExpandableListActivity ActionBar: " + ex.toString());
}
}
/**
* Получение моего логина
*/
private void getDate(){
try {
Intent intent = getIntent();
this.myLogin = intent.getStringExtra("myLogin");
Log.d(TEG_ExpandableListActivity, "Данные с SecondMainActivity: " + this.myLogin);
} catch (Exception ex){
Log.d(TEG_ExpandableListActivity, "Ошибка: " + ex.toString());
}
}
private void initialize(){
// btnSendSubmTask = (Button) findViewById(R.id.btnSendSubmTask);
expListView = (ExpandableListView) findViewById(R.id.expListView);
expListDetail = new HashMap<>();
expListFlag = new HashMap<>();
/**
* данные от сервера на основе объекта
*/
try {
listDate = new ListDate(myLogin, getApplicationContext());
} catch (Exception ex){
Log.d(TEG_ExpandableListActivity, "Ошибка ex = " + ex.toString());
}
listDate.setExpendableList(expListDetail, expListFlag);
expListAdapter = new ListAdapter(this, listDate.getListThemJoin(), expListDetail, expListFlag, listDate.getListTask(), listDate.getListExec(), myLogin); // иниц. кастомного адаптера (списком ключей и всем списком)
expListView.setAdapter(expListAdapter);
}
private void checkInternet(){
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (!Robot.isOnline(getApplicationContext()))
Toast.makeText(getApplicationContext(), "Нет соединения с интернетом.",Toast.LENGTH_SHORT).show();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_expandable_list);
setActionBar();
getDate();
initialize();
checkInternet();
/**
* Выполнение действий при нажатии на title (при раскрытии списка)
*/
expListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
//Toast.makeText(getApplicationContext(),
// listDate.getListThemJoin().get(groupPosition) + " Список раскрыт.",
// Toast.LENGTH_SHORT).show();
}
});
/**
* Выполнение действий при нажатии на title (при скрытии списка)
*/
expListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
//Toast.makeText(getApplicationContext(),
// listDate.getListThemJoin().get(groupPosition) + " Список скрыт.",
// Toast.LENGTH_SHORT).show();
}
});
expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Log.d(TEG_ExpandableListActivity, "setOnChildClickListener");
Toast.makeText(getApplicationContext(),
listDate.getListThemJoin().get(groupPosition)
+ " : " + expListDetail.get(listDate.getListThemJoin().get(groupPosition))
.get(childPosition), Toast.LENGTH_SHORT).show();
return false;
}
});
}
}
|
UTF-8
|
Java
| 5,529 |
java
|
ExpandableListActivity.java
|
Java
|
[
{
"context": " Активити - вложенный список моих задач\n * @author Mihail Kovalenko\n */\npublic final class ExpandableListActivity ext",
"end": 464,
"score": 0.9992218613624573,
"start": 448,
"tag": "NAME",
"value": "Mihail Kovalenko"
}
] | null |
[] |
package com.example.virtus.transmitter;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import Robot.Robot;
/**
* Активити - вложенный список моих задач
* @author <NAME>
*/
public final class ExpandableListActivity extends AppCompatActivity {
private static final String TEG_ExpandableListActivity = "TEG_ExpandableListActivity";
private ExpandableListView expListView;
private ExpandableListAdapter expListAdapter;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private HashMap<String, ArrayList<String>> expListDetail;
private HashMap<String, ArrayList<Boolean>> expListFlag;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private String myLogin;
private ListDate listDate;
private void setActionBar(){
try {
android.support.v7.widget.Toolbar toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar);
toolbar.setTitleTextColor(getResources().getColor(R.color.white));
toolbar.setTitle("Мои задачи");
setSupportActionBar(toolbar);
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
} catch (Exception ex){
Log.d(TEG_ExpandableListActivity, "Ошибка TEG_ExpandableListActivity ActionBar: " + ex.toString());
}
}
/**
* Получение моего логина
*/
private void getDate(){
try {
Intent intent = getIntent();
this.myLogin = intent.getStringExtra("myLogin");
Log.d(TEG_ExpandableListActivity, "Данные с SecondMainActivity: " + this.myLogin);
} catch (Exception ex){
Log.d(TEG_ExpandableListActivity, "Ошибка: " + ex.toString());
}
}
private void initialize(){
// btnSendSubmTask = (Button) findViewById(R.id.btnSendSubmTask);
expListView = (ExpandableListView) findViewById(R.id.expListView);
expListDetail = new HashMap<>();
expListFlag = new HashMap<>();
/**
* данные от сервера на основе объекта
*/
try {
listDate = new ListDate(myLogin, getApplicationContext());
} catch (Exception ex){
Log.d(TEG_ExpandableListActivity, "Ошибка ex = " + ex.toString());
}
listDate.setExpendableList(expListDetail, expListFlag);
expListAdapter = new ListAdapter(this, listDate.getListThemJoin(), expListDetail, expListFlag, listDate.getListTask(), listDate.getListExec(), myLogin); // иниц. кастомного адаптера (списком ключей и всем списком)
expListView.setAdapter(expListAdapter);
}
private void checkInternet(){
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (!Robot.isOnline(getApplicationContext()))
Toast.makeText(getApplicationContext(), "Нет соединения с интернетом.",Toast.LENGTH_SHORT).show();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_expandable_list);
setActionBar();
getDate();
initialize();
checkInternet();
/**
* Выполнение действий при нажатии на title (при раскрытии списка)
*/
expListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
//Toast.makeText(getApplicationContext(),
// listDate.getListThemJoin().get(groupPosition) + " Список раскрыт.",
// Toast.LENGTH_SHORT).show();
}
});
/**
* Выполнение действий при нажатии на title (при скрытии списка)
*/
expListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
//Toast.makeText(getApplicationContext(),
// listDate.getListThemJoin().get(groupPosition) + " Список скрыт.",
// Toast.LENGTH_SHORT).show();
}
});
expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Log.d(TEG_ExpandableListActivity, "setOnChildClickListener");
Toast.makeText(getApplicationContext(),
listDate.getListThemJoin().get(groupPosition)
+ " : " + expListDetail.get(listDate.getListThemJoin().get(groupPosition))
.get(childPosition), Toast.LENGTH_SHORT).show();
return false;
}
});
}
}
| 5,519 | 0.605475 | 0.6049 | 136 | 37.411766 | 34.522472 | 221 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.588235 | false | false |
0
|
266105e2b998d40fdc7cbb6e7e0ee4a24947da9d
| 386,547,057,065 |
00a947e46dc8782aed292093279237da6ca50682
|
/src/main/java/com/demo/dao/IUserDao.java
|
7360a8993fa730ba21f0e1f685868eb6be1281db
|
[] |
no_license
|
14787484930/ssm_shiro
|
https://github.com/14787484930/ssm_shiro
|
7900469f96bc860ab3d612faab157a1fdc722a95
|
62c6995ae7f11307b5f2dd4ead203f3d929e413a
|
refs/heads/master
| 2022-12-28T07:41:26.936000 | 2019-09-16T09:36:38 | 2019-09-16T09:36:38 | 208,762,793 | 0 | 0 | null | false | 2022-12-16T00:42:30 | 2019-09-16T09:36:31 | 2019-09-16T09:37:49 | 2022-12-16T00:42:26 | 40 | 0 | 0 | 11 |
Java
| false | false |
package com.demo.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.demo.entity.User;
public interface IUserDao {
int deleteByPrimaryKey(Integer userId);
int insert(User record);
User selectByPrimaryKey(Integer userId);
List<User> selectAll();
int updateByPrimaryKey(User record);
/**
* 登录查询方法
*
* @param username
* @return
* @author wzw
* @date 2018-08-02
*/
public User login(@Param("username") String username);
public List<User> findByPage(@Param("page") Integer page, @Param("rows") Integer rows);
public long totalCount();
public User findById(@Param("userId") Integer userId);
}
|
UTF-8
|
Java
| 667 |
java
|
IUserDao.java
|
Java
|
[
{
"context": "Key(User record);\n\n\t/**\n\t * 登录查询方法\n\t * \n\t * @param username\n\t * @return\n\t * @author wzw\n\t * @date 2018-08-02\n",
"end": 368,
"score": 0.5605279207229614,
"start": 360,
"tag": "USERNAME",
"value": "username"
},
{
"context": "法\n\t * \n\t * @param username\n\t * @return\n\t * @author wzw\n\t * @date 2018-08-02\n\t */\n\tpublic User login(@Par",
"end": 396,
"score": 0.999693751335144,
"start": 393,
"tag": "USERNAME",
"value": "wzw"
}
] | null |
[] |
package com.demo.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.demo.entity.User;
public interface IUserDao {
int deleteByPrimaryKey(Integer userId);
int insert(User record);
User selectByPrimaryKey(Integer userId);
List<User> selectAll();
int updateByPrimaryKey(User record);
/**
* 登录查询方法
*
* @param username
* @return
* @author wzw
* @date 2018-08-02
*/
public User login(@Param("username") String username);
public List<User> findByPage(@Param("page") Integer page, @Param("rows") Integer rows);
public long totalCount();
public User findById(@Param("userId") Integer userId);
}
| 667 | 0.714504 | 0.70229 | 36 | 17.222221 | 20.538733 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.861111 | false | false |
0
|
40976c94999498d3b1f0fe255ec9ca548a76bc44
| 2,791,728,753,073 |
0e3cd00cdd940697fee2fa13e12c834279c3fec6
|
/src/controller/WyszukajTraseOdcinkiController.java
|
fceb7ee9ddb85753e542b13ecfa080531d3cebc5
|
[] |
no_license
|
MarekMk/TrasyWycieczekGorskich_zmienionykod
|
https://github.com/MarekMk/TrasyWycieczekGorskich_zmienionykod
|
8f8e12db11c88858dc2d1e631ee78e93b04968ff
|
dc1d9af374556e8b6188906614f4f758592215d3
|
refs/heads/master
| 2016-06-08T01:09:57.967000 | 2016-05-31T11:21:51 | 2016-05-31T11:21:51 | 57,619,922 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package controller;
import java.util.*;
import java.io.*;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import model.Trasa;
import model.ZalogowanyUzytkownik;
public class WyszukajTraseOdcinkiController extends HttpServlet {
private static final long serialVersionUID = 102831973239L;
public WyszukajTraseOdcinkiController()
{
super();
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
int id =Integer.parseInt(request.getParameter("id"));
int poziom = Integer.parseInt(request.getParameter("poziom"));
String typWyszukania = (String) request.getParameter("typwyszukania");
int zakres = Integer.parseInt(request.getParameter("zakres"));
RequestDispatcher rd = null;
HttpSession session = request.getSession();
ZalogowanyUzytkownik user = (ZalogowanyUzytkownik) session.getAttribute("user");
user.setTrasa(user.getWyszukaneTrasy().get(id));
String wynik = user.getTrasa().wyszukajOdcinki();
if(wynik.equals("Znaleziono odcinki"))
{
rd = request.getRequestDispatcher("/wyszukane_odcinki_trasy.jsp");
user.getTrasa().wyszukajKomentarze(zakres);
request.setAttribute("trasa", user.getTrasa());
session.setAttribute("user", user);
request.setAttribute("typwyszukania", typWyszukania);
}
else
{
rd = request.getRequestDispatcher("/stronaGlowna");
request.setAttribute("info", wynik);
session.setAttribute("user", user);
}
rd.forward(request, response);
}
}
|
UTF-8
|
Java
| 1,778 |
java
|
WyszukajTraseOdcinkiController.java
|
Java
|
[] | null |
[] |
package controller;
import java.util.*;
import java.io.*;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import model.Trasa;
import model.ZalogowanyUzytkownik;
public class WyszukajTraseOdcinkiController extends HttpServlet {
private static final long serialVersionUID = 102831973239L;
public WyszukajTraseOdcinkiController()
{
super();
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
int id =Integer.parseInt(request.getParameter("id"));
int poziom = Integer.parseInt(request.getParameter("poziom"));
String typWyszukania = (String) request.getParameter("typwyszukania");
int zakres = Integer.parseInt(request.getParameter("zakres"));
RequestDispatcher rd = null;
HttpSession session = request.getSession();
ZalogowanyUzytkownik user = (ZalogowanyUzytkownik) session.getAttribute("user");
user.setTrasa(user.getWyszukaneTrasy().get(id));
String wynik = user.getTrasa().wyszukajOdcinki();
if(wynik.equals("Znaleziono odcinki"))
{
rd = request.getRequestDispatcher("/wyszukane_odcinki_trasy.jsp");
user.getTrasa().wyszukajKomentarze(zakres);
request.setAttribute("trasa", user.getTrasa());
session.setAttribute("user", user);
request.setAttribute("typwyszukania", typWyszukania);
}
else
{
rd = request.getRequestDispatcher("/stronaGlowna");
request.setAttribute("info", wynik);
session.setAttribute("user", user);
}
rd.forward(request, response);
}
}
| 1,778 | 0.767154 | 0.760405 | 59 | 29.135593 | 26.549894 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.915254 | false | false |
0
|
46a0ca99ccd77c1e6ad827e8b7b61154098bb274
| 14,413,910,295,610 |
e88005a1d69335d141767b72045eb4f22cd616ce
|
/src/Bob.java
|
accb3a00606995d2708d5b3fef0a492030260af2
|
[] |
no_license
|
bandrewss/CS410CardGameSimulator
|
https://github.com/bandrewss/CS410CardGameSimulator
|
dc12c23f4b643a162d29016fa046635680588542
|
fde8deb196818c4ca61b0711151e35669724250f
|
refs/heads/master
| 2021-05-16T09:52:54.349000 | 2017-10-08T18:29:20 | 2017-10-08T18:29:20 | 104,662,565 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Ben Andrews
// CS366 HW3
// 6-22-17
public class Bob
{
public static void main(String[] args)
{
Client client = new Client("Bob", "127.0.0.3", "127.0.0.1", 12321);
client.go();
}
}
|
UTF-8
|
Java
| 213 |
java
|
Bob.java
|
Java
|
[
{
"context": "// Ben Andrews\r\n// CS366 HW3 \r\n// 6-22-17\r\n\r\n\r\npublic class Bob ",
"end": 14,
"score": 0.9998083114624023,
"start": 3,
"tag": "NAME",
"value": "Ben Andrews"
},
{
"context": "tring[] args) \r\n\t{\r\n\t\tClient client = new Client(\"Bob\", \"127.0.0.3\", \"127.0.0.1\", 12321);\r\n\t\tclient.go(",
"end": 150,
"score": 0.38933756947517395,
"start": 147,
"tag": "USERNAME",
"value": "Bob"
},
{
"context": " args) \r\n\t{\r\n\t\tClient client = new Client(\"Bob\", \"127.0.0.3\", \"127.0.0.1\", 12321);\r\n\t\tclient.go();\r\n\t}\r\n\r\n}\r\n",
"end": 163,
"score": 0.9995013475418091,
"start": 154,
"tag": "IP_ADDRESS",
"value": "127.0.0.3"
},
{
"context": "\t\tClient client = new Client(\"Bob\", \"127.0.0.3\", \"127.0.0.1\", 12321);\r\n\t\tclient.go();\r\n\t}\r\n\r\n}\r\n",
"end": 176,
"score": 0.9996651411056519,
"start": 167,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
}
] | null |
[] |
// <NAME>
// CS366 HW3
// 6-22-17
public class Bob
{
public static void main(String[] args)
{
Client client = new Client("Bob", "127.0.0.3", "127.0.0.1", 12321);
client.go();
}
}
| 208 | 0.544601 | 0.422535 | 15 | 12.2 | 18.418106 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false |
0
|
72902ecafc81f563cc17147b90305b1cfe89ac6f
| 20,675,972,613,218 |
157960f25fffaba8cb12136761ad30fd164b1bc1
|
/src/main/java/com/company/callchain/exception/SyntaxErrorException.java
|
e0b59575c31354c397d64f99d8e735d7b8057966
|
[] |
no_license
|
turbo-potato13/call_chain_jb
|
https://github.com/turbo-potato13/call_chain_jb
|
fa6eff25dbe9d61f4539fedd86d2ae910adcf87f
|
5ee43e173960222c3d3d7b16fa29b0a1f65311ba
|
refs/heads/master
| 2021-05-21T04:03:01.420000 | 2020-04-03T21:35:45 | 2020-04-03T21:35:45 | 252,534,267 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.company.callchain.exception;
public class SyntaxErrorException extends RuntimeException {
public SyntaxErrorException() {
}
public SyntaxErrorException(String message) {
super(message);
}
}
|
UTF-8
|
Java
| 229 |
java
|
SyntaxErrorException.java
|
Java
|
[] | null |
[] |
package com.company.callchain.exception;
public class SyntaxErrorException extends RuntimeException {
public SyntaxErrorException() {
}
public SyntaxErrorException(String message) {
super(message);
}
}
| 229 | 0.724891 | 0.724891 | 11 | 19.818182 | 21.501873 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | false | false |
0
|
9ff038af7fc059d89e206e35e1c7586a0fdf8a4f
| 34,299,608,876,785 |
5989e641cf6c046869b724a70e5049b3909cc001
|
/src/main/java/org/hzero/halm/afm/infra/repository/impl/TransactionTypesRepositoryImpl.java
|
ba85c251605f2de1c9087861b6a18342818e2394
|
[] |
no_license
|
chuanshang/halm_atn
|
https://github.com/chuanshang/halm_atn
|
a35c30f652c06e12abda9736ca88096299acc454
|
714ce6c2ed01584ddf924a4b0359797f43cf7de1
|
refs/heads/master
| 2020-06-11T02:32:23.445000 | 2019-06-26T04:08:24 | 2019-06-26T04:08:24 | 193,826,841 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.hzero.halm.afm.infra.repository.impl;
import org.hzero.halm.afm.api.dto.TransactionTypesDTO;
import org.hzero.halm.afm.infra.mapper.TransactionTypesMapper;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.hzero.halm.afm.domain.entity.TransactionTypes;
import org.hzero.halm.afm.domain.repository.TransactionTypesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 资产事务处理类型 资源库实现
*
* @author qing.huang@hand-china.com 2019-03-19 19:43:01
*/
@Component
public class TransactionTypesRepositoryImpl extends BaseRepositoryImpl<TransactionTypes> implements TransactionTypesRepository {
@Autowired
TransactionTypesMapper transactionTypesMapper;
@Override
public TransactionTypes getTransactionTypes(Long tenantId, Long transactionTypeId) {
return transactionTypesMapper.getTransactionTypes(tenantId,transactionTypeId);
}
@Override
public List<TransactionTypes> selectNodeAndChildNodeTransactionTypes(Long tenantId, TransactionTypes transactionTypes) {
transactionTypes.setTenantId(tenantId);
return transactionTypesMapper.selectNodeAndChildNodeTransactionTypes(transactionTypes);
}
@Override
public List<TransactionTypesDTO> exportTransactionTypes(TransactionTypesDTO transactionTypesDTO) {
List<TransactionTypesDTO> transactionTypesExportList = transactionTypesMapper.exportTransactionTypes(transactionTypesDTO);
if (CollectionUtils.isEmpty(transactionTypesExportList)){
transactionTypesExportList = new ArrayList<>();
}
return transactionTypesExportList;
}
@Override
public List<TransactionTypes> listTransactionTypes(TransactionTypes transactionTypes) {
return transactionTypesMapper.listTransactionTypes(transactionTypes);
}
}
|
UTF-8
|
Java
| 2,009 |
java
|
TransactionTypesRepositoryImpl.java
|
Java
|
[
{
"context": "va.util.List;\n\n/**\n * 资产事务处理类型 资源库实现\n *\n * @author qing.huang@hand-china.com 2019-03-19 19:43:01\n */\n@Component\npublic class T",
"end": 636,
"score": 0.9997327327728271,
"start": 611,
"tag": "EMAIL",
"value": "qing.huang@hand-china.com"
}
] | null |
[] |
package org.hzero.halm.afm.infra.repository.impl;
import org.hzero.halm.afm.api.dto.TransactionTypesDTO;
import org.hzero.halm.afm.infra.mapper.TransactionTypesMapper;
import org.hzero.mybatis.base.impl.BaseRepositoryImpl;
import org.hzero.halm.afm.domain.entity.TransactionTypes;
import org.hzero.halm.afm.domain.repository.TransactionTypesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 资产事务处理类型 资源库实现
*
* @author <EMAIL> 2019-03-19 19:43:01
*/
@Component
public class TransactionTypesRepositoryImpl extends BaseRepositoryImpl<TransactionTypes> implements TransactionTypesRepository {
@Autowired
TransactionTypesMapper transactionTypesMapper;
@Override
public TransactionTypes getTransactionTypes(Long tenantId, Long transactionTypeId) {
return transactionTypesMapper.getTransactionTypes(tenantId,transactionTypeId);
}
@Override
public List<TransactionTypes> selectNodeAndChildNodeTransactionTypes(Long tenantId, TransactionTypes transactionTypes) {
transactionTypes.setTenantId(tenantId);
return transactionTypesMapper.selectNodeAndChildNodeTransactionTypes(transactionTypes);
}
@Override
public List<TransactionTypesDTO> exportTransactionTypes(TransactionTypesDTO transactionTypesDTO) {
List<TransactionTypesDTO> transactionTypesExportList = transactionTypesMapper.exportTransactionTypes(transactionTypesDTO);
if (CollectionUtils.isEmpty(transactionTypesExportList)){
transactionTypesExportList = new ArrayList<>();
}
return transactionTypesExportList;
}
@Override
public List<TransactionTypes> listTransactionTypes(TransactionTypes transactionTypes) {
return transactionTypesMapper.listTransactionTypes(transactionTypes);
}
}
| 1,991 | 0.800807 | 0.793243 | 51 | 37.882355 | 38.035919 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.431373 | false | false |
0
|
ab19d2b969dc26e85d72c0b5a72e2148919c9d1e
| 32,487,132,643,027 |
6cf51ff662152d85ffb24935bb7bd9dd22262c91
|
/Concepts/Array/ArrayDemo5.java
|
f6cc7b5f2d184d02b5cac62ed47a5ac7569fae24
|
[] |
no_license
|
nehetegaurav3/C2W_JavaAssignment
|
https://github.com/nehetegaurav3/C2W_JavaAssignment
|
f01bf7defb619b224ea3952eb0ca91be7feaae94
|
52735c73b53db9fe6b16aa23482a2d0da6be99bd
|
refs/heads/master
| 2022-12-27T19:49:58.581000 | 2022-12-03T12:27:30 | 2022-12-03T12:27:30 | 282,638,717 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.*;
class ArrayDemo {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter size of Array: ");
int x = Integer.parseInt(br.readLine());
int[] arr = new int[x];
System.out.println("User Input: ");
for(int i = 0; i < x; i++) { //x can be replaced by arr.length
//length is method of Object class
arr[i] = Integer.parseInt(br.readLine());
}
System.out.println("Array is: ");
for(int i = 0; i < arr.length; i++) {
System.out.println((arr[i]));
}
}
}
|
UTF-8
|
Java
| 616 |
java
|
ArrayDemo5.java
|
Java
|
[] | null |
[] |
import java.io.*;
class ArrayDemo {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter size of Array: ");
int x = Integer.parseInt(br.readLine());
int[] arr = new int[x];
System.out.println("User Input: ");
for(int i = 0; i < x; i++) { //x can be replaced by arr.length
//length is method of Object class
arr[i] = Integer.parseInt(br.readLine());
}
System.out.println("Array is: ");
for(int i = 0; i < arr.length; i++) {
System.out.println((arr[i]));
}
}
}
| 616 | 0.625 | 0.621753 | 27 | 21.814816 | 23.010525 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.111111 | false | false |
0
|
6a17ef05dc51a6dc783e94d4bd24ae6b7798ae82
| 16,767,552,337,632 |
eea11265db5d235fe0959d386beef9071d97886c
|
/swing-application-impl/src/main/java/org/cytoscape/internal/view/SimpleRootPaneContainer.java
|
3d2770f37020c26512fc703ad85e44ff668493ba
|
[] |
no_license
|
rostam/cytoscape-impl
|
https://github.com/rostam/cytoscape-impl
|
a93e31f9b8964155f602f8dfd678cb0784ecc5bc
|
4279156be3a4fae6d696fb89732914766d42c917
|
refs/heads/develop
| 2020-07-13T06:11:49.743000 | 2017-06-14T00:08:31 | 2017-06-14T00:08:31 | 94,292,711 | 1 | 0 | null | true | 2017-06-14T05:30:53 | 2017-06-14T05:30:53 | 2017-01-26T17:35:38 | 2017-06-14T00:12:37 | 182,133 | 0 | 0 | 0 | null | null | null |
package org.cytoscape.internal.view;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.LayoutManager;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JRootPane;
import javax.swing.RootPaneContainer;
/*
* #%L
* Cytoscape Swing Application Impl (swing-application-impl)
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2006 - 2016 The Cytoscape Consortium
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
@SuppressWarnings("serial")
public class SimpleRootPaneContainer extends JComponent implements RootPaneContainer {
/**
* The <code>JRootPane</code> instance that manages the <code>contentPane</code>
* and optional <code>menuBar</code> for this frame, as well as the <code>glassPane</code>.
*/
protected JRootPane rootPane;
/**
* If true then calls to <code>add</code> and <code>setLayout</code>
* will be forwarded to the <code>contentPane</code>. This is initially
* false, but is set to true when the <code>NetworkViewContainer</code> is constructed.
*/
private boolean rootPaneCheckingEnabled;
public SimpleRootPaneContainer() {
setRootPane(createDefaultRootPane());
setLayout(new BorderLayout());
add(getRootPane(), BorderLayout.CENTER);
}
@Override
public Container getContentPane() {
return getRootPane().getContentPane();
}
@Override
public void setContentPane(final Container c) {
Container oldValue = getContentPane();
getRootPane().setContentPane(c);
firePropertyChange("contentPane", oldValue, c);
}
@Override
public JLayeredPane getLayeredPane() {
return getRootPane().getLayeredPane();
}
@Override
public void setLayeredPane(JLayeredPane layered) {
final JLayeredPane oldValue = getLayeredPane();
getRootPane().setLayeredPane(layered);
firePropertyChange("layeredPane", oldValue, layered);
}
@Override
public Component getGlassPane() {
return getRootPane().getGlassPane();
}
@Override
public void setGlassPane(Component glass) {
Component oldValue = getGlassPane();
getRootPane().setGlassPane(glass);
firePropertyChange("glassPane", oldValue, glass);
}
@Override
public JRootPane getRootPane() {
return rootPane;
}
protected JRootPane createDefaultRootPane() {
return new JRootPane();
}
protected void setRootPane(JRootPane root) {
if (rootPane != null)
remove(rootPane);
JRootPane oldValue = getRootPane();
rootPane = root;
if (rootPane != null) {
boolean checkingEnabled = isRootPaneCheckingEnabled();
try {
setRootPaneCheckingEnabled(false);
add(rootPane, BorderLayout.CENTER);
} finally {
setRootPaneCheckingEnabled(checkingEnabled);
}
}
firePropertyChange("rootPane", oldValue, root);
}
/**
* Removes the specified component from the container. If
* <code>comp</code> is not the <code>rootPane</code>, this will forward
* the call to the <code>contentPane</code>. This will do nothing if
* <code>comp</code> is not a child of the <code>JFrame</code> or <code>contentPane</code>.
*/
@Override
public void remove(Component comp) {
final int oldCount = getComponentCount();
super.remove(comp);
if (oldCount == getComponentCount())
getContentPane().remove(comp);
}
/**
* Overridden to conditionally forward the call to the <code>contentPane</code>.
* Refer to {@link javax.swing.RootPaneContainer} for more information.
*/
@Override
public void setLayout(LayoutManager manager) {
if (isRootPaneCheckingEnabled())
getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
/**
* This method is overridden to conditionally forward calls to the <code>contentPane</code>.
* By default, children are added to the <code>contentPane</code> instead
* of the frame, refer to {@link javax.swing.RootPaneContainer} for details.
*/
@Override
protected void addImpl(Component comp, Object constraints, int index) {
if (isRootPaneCheckingEnabled())
getContentPane().add(comp, constraints, index);
else
super.addImpl(comp, constraints, index);
}
private boolean isRootPaneCheckingEnabled() {
return rootPaneCheckingEnabled;
}
private void setRootPaneCheckingEnabled(boolean enabled) {
rootPaneCheckingEnabled = enabled;
}
}
|
UTF-8
|
Java
| 5,081 |
java
|
SimpleRootPaneContainer.java
|
Java
|
[] | null |
[] |
package org.cytoscape.internal.view;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.LayoutManager;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JRootPane;
import javax.swing.RootPaneContainer;
/*
* #%L
* Cytoscape Swing Application Impl (swing-application-impl)
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2006 - 2016 The Cytoscape Consortium
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
@SuppressWarnings("serial")
public class SimpleRootPaneContainer extends JComponent implements RootPaneContainer {
/**
* The <code>JRootPane</code> instance that manages the <code>contentPane</code>
* and optional <code>menuBar</code> for this frame, as well as the <code>glassPane</code>.
*/
protected JRootPane rootPane;
/**
* If true then calls to <code>add</code> and <code>setLayout</code>
* will be forwarded to the <code>contentPane</code>. This is initially
* false, but is set to true when the <code>NetworkViewContainer</code> is constructed.
*/
private boolean rootPaneCheckingEnabled;
public SimpleRootPaneContainer() {
setRootPane(createDefaultRootPane());
setLayout(new BorderLayout());
add(getRootPane(), BorderLayout.CENTER);
}
@Override
public Container getContentPane() {
return getRootPane().getContentPane();
}
@Override
public void setContentPane(final Container c) {
Container oldValue = getContentPane();
getRootPane().setContentPane(c);
firePropertyChange("contentPane", oldValue, c);
}
@Override
public JLayeredPane getLayeredPane() {
return getRootPane().getLayeredPane();
}
@Override
public void setLayeredPane(JLayeredPane layered) {
final JLayeredPane oldValue = getLayeredPane();
getRootPane().setLayeredPane(layered);
firePropertyChange("layeredPane", oldValue, layered);
}
@Override
public Component getGlassPane() {
return getRootPane().getGlassPane();
}
@Override
public void setGlassPane(Component glass) {
Component oldValue = getGlassPane();
getRootPane().setGlassPane(glass);
firePropertyChange("glassPane", oldValue, glass);
}
@Override
public JRootPane getRootPane() {
return rootPane;
}
protected JRootPane createDefaultRootPane() {
return new JRootPane();
}
protected void setRootPane(JRootPane root) {
if (rootPane != null)
remove(rootPane);
JRootPane oldValue = getRootPane();
rootPane = root;
if (rootPane != null) {
boolean checkingEnabled = isRootPaneCheckingEnabled();
try {
setRootPaneCheckingEnabled(false);
add(rootPane, BorderLayout.CENTER);
} finally {
setRootPaneCheckingEnabled(checkingEnabled);
}
}
firePropertyChange("rootPane", oldValue, root);
}
/**
* Removes the specified component from the container. If
* <code>comp</code> is not the <code>rootPane</code>, this will forward
* the call to the <code>contentPane</code>. This will do nothing if
* <code>comp</code> is not a child of the <code>JFrame</code> or <code>contentPane</code>.
*/
@Override
public void remove(Component comp) {
final int oldCount = getComponentCount();
super.remove(comp);
if (oldCount == getComponentCount())
getContentPane().remove(comp);
}
/**
* Overridden to conditionally forward the call to the <code>contentPane</code>.
* Refer to {@link javax.swing.RootPaneContainer} for more information.
*/
@Override
public void setLayout(LayoutManager manager) {
if (isRootPaneCheckingEnabled())
getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
/**
* This method is overridden to conditionally forward calls to the <code>contentPane</code>.
* By default, children are added to the <code>contentPane</code> instead
* of the frame, refer to {@link javax.swing.RootPaneContainer} for details.
*/
@Override
protected void addImpl(Component comp, Object constraints, int index) {
if (isRootPaneCheckingEnabled())
getContentPane().add(comp, constraints, index);
else
super.addImpl(comp, constraints, index);
}
private boolean isRootPaneCheckingEnabled() {
return rootPaneCheckingEnabled;
}
private void setRootPaneCheckingEnabled(boolean enabled) {
rootPaneCheckingEnabled = enabled;
}
}
| 5,081 | 0.707932 | 0.70557 | 173 | 28.369942 | 26.320208 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.242775 | false | false |
0
|
890a690332685e4dab5d1c5cf20f3650e9404286
| 39,324,720,587,721 |
217f151899ad15f5607ebe1386645c938b56a3b5
|
/OA系统/JeeSite/src/main/java/com/thinkgem/jeesite/modules/test/web/TestController1.java
|
3769bbb46531022bc2a0be6a29a1a177c0b37c61
|
[
"Apache-2.0"
] |
permissive
|
youmulove/OA
|
https://github.com/youmulove/OA
|
a6d070f616ba13fcd17527a6940413ee16f16e1b
|
991c84d144008a2c6201002eb8d99ca328645ad8
|
refs/heads/master
| 2020-03-28T11:39:06.507000 | 2018-09-11T01:38:49 | 2018-09-11T01:38:49 | 148,235,257 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.test.web;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentBuilder;
import org.junit.Test;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.thinkgem.jeesite.common.web.BaseController;
/**
* 测试Controller
*
* @author ThinkGem
* @version 2013-10-17
*/
@Controller
@RequestMapping(value = "${adminPath}/test/test")
public class TestController1 extends BaseController {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
@Test
public void test2() {
DeploymentBuilder builder = processEngine.getRepositoryService()
.createDeployment();
builder.addClasspathResource("act/designs/oa/test_audit/test.bpmn");
builder.addClasspathResource("act/designs/oa/test_audit/test.png");
Deployment deploy = builder.deploy();
System.out.println(deploy.getId());
}
}
|
UTF-8
|
Java
| 1,163 |
java
|
TestController1.java
|
Java
|
[
{
"context": "ight © 2012-2016 <a href=\"https://github.com/thinkgem/jeesite\">JeeSite</a> All rights reserved.\n */\npac",
"end": 70,
"score": 0.9992406368255615,
"start": 62,
"tag": "USERNAME",
"value": "thinkgem"
},
{
"context": "aseController;\n\n/**\n * 测试Controller\n * \n * @author ThinkGem\n * @version 2013-10-17\n */\n@Controller\n@RequestMa",
"end": 593,
"score": 0.9995946884155273,
"start": 585,
"tag": "USERNAME",
"value": "ThinkGem"
}
] | null |
[] |
/**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.test.web;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentBuilder;
import org.junit.Test;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.thinkgem.jeesite.common.web.BaseController;
/**
* 测试Controller
*
* @author ThinkGem
* @version 2013-10-17
*/
@Controller
@RequestMapping(value = "${adminPath}/test/test")
public class TestController1 extends BaseController {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
@Test
public void test2() {
DeploymentBuilder builder = processEngine.getRepositoryService()
.createDeployment();
builder.addClasspathResource("act/designs/oa/test_audit/test.bpmn");
builder.addClasspathResource("act/designs/oa/test_audit/test.png");
Deployment deploy = builder.deploy();
System.out.println(deploy.getId());
}
}
| 1,163 | 0.780846 | 0.765315 | 38 | 29.5 | 27.613642 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.894737 | false | false |
0
|
ccc6d22a3e3c435163ee1892c2e47efa9ece4be5
| 34,686,155,938,381 |
4089c96549102857362a844bd9a044de487df596
|
/src/leetcode400_449/N471.java
|
f4acdf49e0bf4ef6a9e67ba00212a05ea0daeab9
|
[] |
no_license
|
billybrown81/training
|
https://github.com/billybrown81/training
|
62d0fc7e56d7ebb489ae8fbb74ba41fd16da6e11
|
6679902fa75fe59f2be82fa8f495e10cca8c0f0d
|
refs/heads/master
| 2021-03-27T13:37:20.979000 | 2018-06-04T21:41:56 | 2018-06-04T21:41:56 | 123,853,002 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package leetcode400_449;
//471. Encode String with Shortest Length
//Given a non-empty string, encode the string such that its encoded length is the shortest.
//
//The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times.
//
//Note:
//k will be a positive integer and encoded string will not be empty or have extra space.
//You may assume that the input string contains only lowercase English letters. The string's length is at most 160.
//If an encoding process does not make the string shorter, then do not encode it. If there are several solutions, return any of them is fine.
//Example 1:
//
//Input: "aaa"
//Output: "aaa"
//Explanation: There is no way to encode it such that it is shorter than the input string, so we do not encode it.
//Example 2:
//
//Input: "aaaaa"
//Output: "5[a]"
//Explanation: "5[a]" is shorter than "aaaaa" by 1 character.
//Example 3:
//
//Input: "aaaaaaaaaa"
//Output: "10[a]"
//Explanation: "a9[a]" or "9[a]a" are also valid solutions, both of them have the same length = 5, which is the same as "10[a]".
//Example 4:
//
//Input: "aabcaabcd"
//Output: "2[aabc]d"
//Explanation: "aabc" occurs twice, so one answer can be "2[aabc]d".
//Example 5:
//
//Input: "abbbabbbcabbbabbbc"
//Output: "2[2[abbb]c]"
//Explanation: "abbbabbbc" occurs twice, but "abbbabbbc" can also be encoded to "2[abbb]c", so one answer can be "2[2[abbb]c]".
public class N471 {
public String encode(String s) {
int n = s.length();
String[][] dp = new String[n][n];
for (int l = 0; l < n; l++) {
for (int i = 0; i < n - l; i++) {
int j = i + l;
String substr = s.substring(i, j + 1);
dp[i][j] = substr;
if (l >= 4) {
for (int k = i; k < j; k++) {
if ((dp[i][k] + dp[k + 1][j]).length() < dp[i][j].length()) {
dp[i][j] = dp[i][k] + dp[k + 1][j];
}
}
for (int k = 0; k < substr.length(); k++) {
String rpt = substr.substring(0, k + 1);
if (substr.length() % rpt.length() == 0 && substr.replaceAll(rpt, "").length() == 0) {
String tmp = substr.length() / rpt.length() + "[" + dp[i][i + k] +"]";
if (tmp.length() < dp[i][j].length()) {
dp[i][j] = tmp;
}
}
}
}
}
}
return dp[0][n - 1];
}
}
|
UTF-8
|
Java
| 2,313 |
java
|
N471.java
|
Java
|
[] | null |
[] |
package leetcode400_449;
//471. Encode String with Shortest Length
//Given a non-empty string, encode the string such that its encoded length is the shortest.
//
//The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times.
//
//Note:
//k will be a positive integer and encoded string will not be empty or have extra space.
//You may assume that the input string contains only lowercase English letters. The string's length is at most 160.
//If an encoding process does not make the string shorter, then do not encode it. If there are several solutions, return any of them is fine.
//Example 1:
//
//Input: "aaa"
//Output: "aaa"
//Explanation: There is no way to encode it such that it is shorter than the input string, so we do not encode it.
//Example 2:
//
//Input: "aaaaa"
//Output: "5[a]"
//Explanation: "5[a]" is shorter than "aaaaa" by 1 character.
//Example 3:
//
//Input: "aaaaaaaaaa"
//Output: "10[a]"
//Explanation: "a9[a]" or "9[a]a" are also valid solutions, both of them have the same length = 5, which is the same as "10[a]".
//Example 4:
//
//Input: "aabcaabcd"
//Output: "2[aabc]d"
//Explanation: "aabc" occurs twice, so one answer can be "2[aabc]d".
//Example 5:
//
//Input: "abbbabbbcabbbabbbc"
//Output: "2[2[abbb]c]"
//Explanation: "abbbabbbc" occurs twice, but "abbbabbbc" can also be encoded to "2[abbb]c", so one answer can be "2[2[abbb]c]".
public class N471 {
public String encode(String s) {
int n = s.length();
String[][] dp = new String[n][n];
for (int l = 0; l < n; l++) {
for (int i = 0; i < n - l; i++) {
int j = i + l;
String substr = s.substring(i, j + 1);
dp[i][j] = substr;
if (l >= 4) {
for (int k = i; k < j; k++) {
if ((dp[i][k] + dp[k + 1][j]).length() < dp[i][j].length()) {
dp[i][j] = dp[i][k] + dp[k + 1][j];
}
}
for (int k = 0; k < substr.length(); k++) {
String rpt = substr.substring(0, k + 1);
if (substr.length() % rpt.length() == 0 && substr.replaceAll(rpt, "").length() == 0) {
String tmp = substr.length() / rpt.length() + "[" + dp[i][i + k] +"]";
if (tmp.length() < dp[i][j].length()) {
dp[i][j] = tmp;
}
}
}
}
}
}
return dp[0][n - 1];
}
}
| 2,313 | 0.597492 | 0.575875 | 66 | 34.045456 | 36.817089 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.242424 | false | false |
0
|
e9d7bfb7e75b153a28f74723ec74ba3e92c6bf2f
| 34,686,155,938,916 |
8d3b4161414e0118a8e7f3e1dfa44c48d9b7846e
|
/orbisgis-core/src/main/java/org/orbisgis/core/javaManager/parser/ASTMemberValue.java
|
73e5cc2878dc982f60271c6668c9bd25d6838c74
|
[] |
no_license
|
johnnythinkgeo/orbisgis
|
https://github.com/johnnythinkgeo/orbisgis
|
1b604e412e4d2d4bcc0f5a3a9e053d98d79d2d0f
|
210acfad10bde26f970ce489838f2549ac46f822
|
refs/heads/master
| 2020-12-30T16:58:36.421000 | 2009-12-28T17:34:32 | 2009-12-28T17:34:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/* Generated By:JJTree: Do not edit this line. ASTMemberValue.java Version 4.1 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY= */
package org.orbisgis.core.javaManager.parser;
public class ASTMemberValue extends SimpleNode {
public ASTMemberValue(int id) {
super(id);
}
public ASTMemberValue(JavaParser p, int id) {
super(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}
/* JavaCC - OriginalChecksum=d40c5ea636fdf4c96e0a2af412ce7735 (do not edit this line) */
|
UTF-8
|
Java
| 665 |
java
|
ASTMemberValue.java
|
Java
|
[] | null |
[] |
/* Generated By:JJTree: Do not edit this line. ASTMemberValue.java Version 4.1 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY= */
package org.orbisgis.core.javaManager.parser;
public class ASTMemberValue extends SimpleNode {
public ASTMemberValue(int id) {
super(id);
}
public ASTMemberValue(JavaParser p, int id) {
super(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}
/* JavaCC - OriginalChecksum=d40c5ea636fdf4c96e0a2af412ce7735 (do not edit this line) */
| 665 | 0.735338 | 0.705263 | 20 | 32.25 | 35.343845 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false |
0
|
0f615f19d3cb4b834c13e60fd33122397cb5643d
| 5,076,651,406,850 |
3946c0f6379e0735a2d4258df3a8a5ca693f97d8
|
/application/src/main/java/com/portfobio/application/RemoteController.java
|
24df93c8cb66a15e890a06423b20e9ccc8af224b
|
[] |
no_license
|
schwarzwald/remote-control
|
https://github.com/schwarzwald/remote-control
|
7a2e5d7d5098575a156e585a26e71a88f406aa5c
|
20eda1c96a348ade24f2962c83dc744c66858de7
|
refs/heads/master
| 2021-01-22T21:41:30.350000 | 2017-03-19T09:48:59 | 2017-03-19T09:48:59 | 85,464,805 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.portfobio.application;
import com.portfobio.application.command.CommandContainer;
import com.portfobio.application.commandexecutor.CommandExecutor;
import com.portfobio.application.commandexecutor.CommandExecutorThread;
import com.portfobio.application.commandreceiver.CommandParserFactory;
import com.portfobio.application.commandreceiver.CommandReceiver;
import com.portfobio.application.commandreceiver.CommandSourceReceiver;
import com.portfobio.application.console.ConsoleCommandParser;
import com.portfobio.application.console.DelayedConsoleModule;
import com.portfobio.application.core.ApplicationModuleInfo;
import com.portfobio.application.domain.QueuedCommandContainer;
import com.portfobio.application.domain.SimpleCommandParserFactory;
import com.portfobio.application.mouse.MouseCommandParser;
import com.portfobio.application.mouse.RobotMouseModule;
import com.portfobio.application.system.SystemCommandParser;
import com.portfobio.application.system.WindowsSystemModule;
import com.portfobio.networking.Receiver;
import com.portfobio.networking.datagram.DatagramReceiver;
public class RemoteController {
private static CommandExecutor application;
private static CommandContainer commandContainer;
private static CommandReceiver commandReceiver;
private static final int PORT = 9999;
public static void main(String[] args) {
assemblyApplication();
run();
}
private static void assemblyApplication() {
createApplication();
createCommandContainer();
createAndRegisterModules();
createCommandReceiver();
application.setCommandContainer(commandContainer);
}
private static void createApplication() {
application = new CommandExecutor();
}
private static void createCommandContainer() {
commandContainer = new QueuedCommandContainer();
}
private static void createAndRegisterModules() {
application.registerModule(new DelayedConsoleModule());
application.registerModule(new RobotMouseModule());
application.registerModule(new WindowsSystemModule());
}
private static void createCommandReceiver() {
CommandSourceReceiver receiver = new CommandSourceReceiver();
receiver.setCommandContainer(commandContainer);
receiver.setCommandParserFactory(createCommandParserFactory());
receiver.setReceiver(createReceiver());
commandReceiver = receiver;
}
private static Receiver createReceiver() {
return new DatagramReceiver(PORT);
}
private static CommandParserFactory createCommandParserFactory() {
SimpleCommandParserFactory factory = new SimpleCommandParserFactory();
factory.registerParser(ConsoleCommandParser.PARSER_ID, new ConsoleCommandParser());
factory.registerParser(MouseCommandParser.PARSER_ID, new MouseCommandParser());
factory.registerParser(SystemCommandParser.PARSER_ID, new SystemCommandParser());
return factory;
}
private static void run() {
CommandExecutorThread thread = new CommandExecutorThread(application);
thread.setDaemon(true);
thread.start();
printStartedInfo();
while (true) {
commandReceiver.receiveCommand();
}
}
private static void printStartedInfo() {
System.out.println("App started");
System.out.println("---------------------");
System.out.println("Modules:");
for (ApplicationModuleInfo info : application.getModuleInfos()) {
System.out.println(info.getName());
}
System.out.println("---------------------");
}
}
|
UTF-8
|
Java
| 3,386 |
java
|
RemoteController.java
|
Java
|
[] | null |
[] |
package com.portfobio.application;
import com.portfobio.application.command.CommandContainer;
import com.portfobio.application.commandexecutor.CommandExecutor;
import com.portfobio.application.commandexecutor.CommandExecutorThread;
import com.portfobio.application.commandreceiver.CommandParserFactory;
import com.portfobio.application.commandreceiver.CommandReceiver;
import com.portfobio.application.commandreceiver.CommandSourceReceiver;
import com.portfobio.application.console.ConsoleCommandParser;
import com.portfobio.application.console.DelayedConsoleModule;
import com.portfobio.application.core.ApplicationModuleInfo;
import com.portfobio.application.domain.QueuedCommandContainer;
import com.portfobio.application.domain.SimpleCommandParserFactory;
import com.portfobio.application.mouse.MouseCommandParser;
import com.portfobio.application.mouse.RobotMouseModule;
import com.portfobio.application.system.SystemCommandParser;
import com.portfobio.application.system.WindowsSystemModule;
import com.portfobio.networking.Receiver;
import com.portfobio.networking.datagram.DatagramReceiver;
public class RemoteController {
private static CommandExecutor application;
private static CommandContainer commandContainer;
private static CommandReceiver commandReceiver;
private static final int PORT = 9999;
public static void main(String[] args) {
assemblyApplication();
run();
}
private static void assemblyApplication() {
createApplication();
createCommandContainer();
createAndRegisterModules();
createCommandReceiver();
application.setCommandContainer(commandContainer);
}
private static void createApplication() {
application = new CommandExecutor();
}
private static void createCommandContainer() {
commandContainer = new QueuedCommandContainer();
}
private static void createAndRegisterModules() {
application.registerModule(new DelayedConsoleModule());
application.registerModule(new RobotMouseModule());
application.registerModule(new WindowsSystemModule());
}
private static void createCommandReceiver() {
CommandSourceReceiver receiver = new CommandSourceReceiver();
receiver.setCommandContainer(commandContainer);
receiver.setCommandParserFactory(createCommandParserFactory());
receiver.setReceiver(createReceiver());
commandReceiver = receiver;
}
private static Receiver createReceiver() {
return new DatagramReceiver(PORT);
}
private static CommandParserFactory createCommandParserFactory() {
SimpleCommandParserFactory factory = new SimpleCommandParserFactory();
factory.registerParser(ConsoleCommandParser.PARSER_ID, new ConsoleCommandParser());
factory.registerParser(MouseCommandParser.PARSER_ID, new MouseCommandParser());
factory.registerParser(SystemCommandParser.PARSER_ID, new SystemCommandParser());
return factory;
}
private static void run() {
CommandExecutorThread thread = new CommandExecutorThread(application);
thread.setDaemon(true);
thread.start();
printStartedInfo();
while (true) {
commandReceiver.receiveCommand();
}
}
private static void printStartedInfo() {
System.out.println("App started");
System.out.println("---------------------");
System.out.println("Modules:");
for (ApplicationModuleInfo info : application.getModuleInfos()) {
System.out.println(info.getName());
}
System.out.println("---------------------");
}
}
| 3,386 | 0.801831 | 0.80065 | 103 | 31.873787 | 26.499561 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.533981 | false | false |
0
|
f9c805ba09054a950612c75cd7c552ea46885513
| 25,271,587,582,852 |
91a775b99a300a718b741f738babded171b23b16
|
/OfficeAutomation/src/dlmu/oa/service/ProcessDefinitionService.java
|
dc2074491c6830aab85d3151e1d23aabf7bcece5
|
[] |
no_license
|
chiguokun/OfficeAutomation
|
https://github.com/chiguokun/OfficeAutomation
|
de83aa79236ca2263fff889d2fdb1695cdb3d90a
|
a34610dd5161d6cf366b1eccd7aca4a4cd726b8c
|
refs/heads/master
| 2021-01-18T17:46:41.386000 | 2017-06-02T08:00:17 | 2017-06-02T08:00:17 | 86,814,122 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package dlmu.oa.service;
import java.io.InputStream;
import java.util.List;
import java.util.zip.ZipInputStream;
import org.jbpm.api.ProcessDefinition;
public interface ProcessDefinitionService {
/**
* 查询所有最新版本
* @return
*/
List<ProcessDefinition> findAllLatestVersions();
/**
* 删除对应key的所有流程定义
* @param key
*/
void deleteByKey(String key);
/**
* 部署流程定义(zip)
* @param zipInputStream
*/
void deploy(ZipInputStream zipInputStream);
/**
* 获取流程定义的图片资源流
* @param id
* @return
*/
InputStream getProcessImageResourceAsStream(String id);
}
|
UTF-8
|
Java
| 686 |
java
|
ProcessDefinitionService.java
|
Java
|
[] | null |
[] |
package dlmu.oa.service;
import java.io.InputStream;
import java.util.List;
import java.util.zip.ZipInputStream;
import org.jbpm.api.ProcessDefinition;
public interface ProcessDefinitionService {
/**
* 查询所有最新版本
* @return
*/
List<ProcessDefinition> findAllLatestVersions();
/**
* 删除对应key的所有流程定义
* @param key
*/
void deleteByKey(String key);
/**
* 部署流程定义(zip)
* @param zipInputStream
*/
void deploy(ZipInputStream zipInputStream);
/**
* 获取流程定义的图片资源流
* @param id
* @return
*/
InputStream getProcessImageResourceAsStream(String id);
}
| 686 | 0.665033 | 0.665033 | 36 | 15 | 15.779734 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.916667 | false | false |
0
|
26b4a19cb06ede485e766ea190953a7b151f0b8a
| 22,402,549,417,071 |
5dd33dfbbf8c7e3bc4d9b95c46ed15295179257d
|
/app/src/main/java/com/map_movil/map_movil/presenter/downloadData/DownloadDataFragmentPresenter.java
|
ae6965da7195b8b2a14f0ca371ed93b36a4d5f63
|
[] |
no_license
|
skylinedm50/map
|
https://github.com/skylinedm50/map
|
cb698f9503cf28d8ad7fc51ee5ad6cddff314aab
|
8eee554c21e3731ae278d936fa55f540fc452aac
|
refs/heads/master
| 2021-01-05T09:45:34.032000 | 2020-02-16T22:55:47 | 2020-02-16T22:55:47 | 240,979,257 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.map_movil.map_movil.presenter.downloadData;
import java.util.ArrayList;
public interface DownloadDataFragmentPresenter {
void findDetailDataLocal();
void showDetailDataLocal(int[] arrayIntCant, ArrayList<String> arrayListMunicipio,String strDepartamentoSelected);
void downloadData(ArrayList<String> arrayListMunicipiosSelect, String strDepartamento,int Usuario);
void showMessage(String strMessage);
}
|
UTF-8
|
Java
| 433 |
java
|
DownloadDataFragmentPresenter.java
|
Java
|
[] | null |
[] |
package com.map_movil.map_movil.presenter.downloadData;
import java.util.ArrayList;
public interface DownloadDataFragmentPresenter {
void findDetailDataLocal();
void showDetailDataLocal(int[] arrayIntCant, ArrayList<String> arrayListMunicipio,String strDepartamentoSelected);
void downloadData(ArrayList<String> arrayListMunicipiosSelect, String strDepartamento,int Usuario);
void showMessage(String strMessage);
}
| 433 | 0.819861 | 0.819861 | 10 | 42.299999 | 39.064178 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
0
|
3045cca6ff2fc8e84900ebff58e83ab2c6a2f52e
| 22,402,549,417,237 |
5fb695563c7496e58f41edc1ffc70dd466bffd53
|
/src/basicQuestions/ExternalizableExample.java
|
b33cf5654fd514e02053e3f1f2eaa3fc86a2f1bd
|
[] |
no_license
|
rohittomar114/JavaInterviewQuestionsAnswers
|
https://github.com/rohittomar114/JavaInterviewQuestionsAnswers
|
129597a5a702df19885f31ac66002a2e8bc83327
|
049291f59d34445e8519807d92f674f8cd714a39
|
refs/heads/master
| 2021-01-23T02:23:09.675000 | 2018-05-19T21:09:02 | 2018-05-19T21:09:02 | 85,988,428 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package basicQuestions;
import java.io.Externalizable;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
public class ExternalizableExample
{
public static void main(String[] args)
{
UserSettings settings = new UserSettings();
settings.setDoNotStoreMe("Sensitive info");
settings.setFieldOne(10000);
settings.setFieldTwo("HowToDoInJava.com");
settings.setFieldThree(false);
//Before
System.out.println("---------Passed object of settings-------");
System.out.println(settings);
storeUserSettings(settings);
UserSettings loadedSettings = loadSettings();
System.out.println(loadedSettings);
}
static String OUTPUT_FILE_STRING;
private static UserSettings loadSettings() {
System.out.println("--------Input Stream---- With Null value for those not serialized------");
try {
FileInputStream fis = new FileInputStream("object.ser");
//FileInputStream fis = new FileInputStream(OUTPUT_FILE_STRING);
ObjectInputStream ois = new ObjectInputStream(fis);
UserSettings settings = (UserSettings) ois.readObject();
ois.close();
return settings;
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return null;
}
private static void storeUserSettings(UserSettings settings)
{
System.out.println("---------OutputStream-------");
try {
FileOutputStream fos = new FileOutputStream("object.ser");
//FileOutputStream fos = new FileOutputStream(OUTPUT_FILE_STRING);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(settings);
oos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
class UserSettings implements Externalizable {
//This is required
public UserSettings(){
}
private String doNotStoreMe;
private Integer fieldOne;
private String fieldTwo;
private boolean fieldThree;
public String getDoNotStoreMe() {
return doNotStoreMe;
}
public void setDoNotStoreMe(String doNotStoreMe) {
this.doNotStoreMe = doNotStoreMe;
}
public Integer getFieldOne() {
return fieldOne;
}
public void setFieldOne(Integer fieldOne) {
this.fieldOne = fieldOne;
}
public String getFieldTwo() {
return fieldTwo;
}
public void setFieldTwo(String fieldTwo) {
this.fieldTwo = fieldTwo;
}
public boolean isFieldThree() {
return fieldThree;
}
public void setFieldThree(boolean fieldThree) {
this.fieldThree = fieldThree;
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
fieldOne = in.readInt();
fieldTwo = in.readUTF();
fieldThree = in.readBoolean();
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(fieldOne);
out.writeUTF(fieldTwo);
out.writeBoolean(fieldThree);
}
@Override
public String toString() {
return "UserSettings [doNotStoreMe=" + doNotStoreMe + ", fieldOne="
+ fieldOne + ", fieldTwo=" + fieldTwo + ", fieldThree="
+ fieldThree + "]";
}
}
|
UTF-8
|
Java
| 3,691 |
java
|
ExternalizableExample.java
|
Java
|
[] | null |
[] |
package basicQuestions;
import java.io.Externalizable;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
public class ExternalizableExample
{
public static void main(String[] args)
{
UserSettings settings = new UserSettings();
settings.setDoNotStoreMe("Sensitive info");
settings.setFieldOne(10000);
settings.setFieldTwo("HowToDoInJava.com");
settings.setFieldThree(false);
//Before
System.out.println("---------Passed object of settings-------");
System.out.println(settings);
storeUserSettings(settings);
UserSettings loadedSettings = loadSettings();
System.out.println(loadedSettings);
}
static String OUTPUT_FILE_STRING;
private static UserSettings loadSettings() {
System.out.println("--------Input Stream---- With Null value for those not serialized------");
try {
FileInputStream fis = new FileInputStream("object.ser");
//FileInputStream fis = new FileInputStream(OUTPUT_FILE_STRING);
ObjectInputStream ois = new ObjectInputStream(fis);
UserSettings settings = (UserSettings) ois.readObject();
ois.close();
return settings;
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return null;
}
private static void storeUserSettings(UserSettings settings)
{
System.out.println("---------OutputStream-------");
try {
FileOutputStream fos = new FileOutputStream("object.ser");
//FileOutputStream fos = new FileOutputStream(OUTPUT_FILE_STRING);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(settings);
oos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
class UserSettings implements Externalizable {
//This is required
public UserSettings(){
}
private String doNotStoreMe;
private Integer fieldOne;
private String fieldTwo;
private boolean fieldThree;
public String getDoNotStoreMe() {
return doNotStoreMe;
}
public void setDoNotStoreMe(String doNotStoreMe) {
this.doNotStoreMe = doNotStoreMe;
}
public Integer getFieldOne() {
return fieldOne;
}
public void setFieldOne(Integer fieldOne) {
this.fieldOne = fieldOne;
}
public String getFieldTwo() {
return fieldTwo;
}
public void setFieldTwo(String fieldTwo) {
this.fieldTwo = fieldTwo;
}
public boolean isFieldThree() {
return fieldThree;
}
public void setFieldThree(boolean fieldThree) {
this.fieldThree = fieldThree;
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
fieldOne = in.readInt();
fieldTwo = in.readUTF();
fieldThree = in.readBoolean();
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(fieldOne);
out.writeUTF(fieldTwo);
out.writeBoolean(fieldThree);
}
@Override
public String toString() {
return "UserSettings [doNotStoreMe=" + doNotStoreMe + ", fieldOne="
+ fieldOne + ", fieldTwo=" + fieldTwo + ", fieldThree="
+ fieldThree + "]";
}
}
| 3,691 | 0.619344 | 0.61799 | 130 | 27.392307 | 22.539366 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.492308 | false | false |
0
|
535180087dfc73a1b237a29165cbbe66da8ba317
| 15,255,723,862,938 |
c21a3c1b1465cd16cc0a344ab5eeca70abccb941
|
/P_GestionIncidencias/src/Controlador/TipoIncidenciaController.java
|
141d00363aac112ded9f0aed2100e6a5f2b57176
|
[] |
no_license
|
proLETARi/P_GestionIncidencias
|
https://github.com/proLETARi/P_GestionIncidencias
|
17a89d45060790979a6e976c4315110bf5d6d906
|
ba7bd91725a0e0e05dfc53c03935d97bba6ad522
|
refs/heads/master
| 2021-01-10T04:38:21.587000 | 2015-07-24T07:28:25 | 2015-07-24T07:28:25 | 36,591,881 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Controlador;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import Entidades.BE_Incidencia;
import Entidades.BE_TipoIncidencia;
public class TipoIncidenciaController {
private ArrayList<BE_TipoIncidencia> arrayTipoIncidencia;
private IncidenciaController IncidenciaC = new IncidenciaController();
// Region Mantenimientos
public void agregarTipoIncidencia(BE_TipoIncidencia a) {
arrayTipoIncidencia.add(a);
}
public void eliminarTipoIncidencia(BE_TipoIncidencia a) {
arrayTipoIncidencia.remove(a);
}
public void modificarTipoIncidencia(int i, BE_TipoIncidencia a) {
arrayTipoIncidencia.set(i, a);
}
public void guardarTipoIncidencia(BE_TipoIncidencia ti) {
try {
File fTIncidencia = new File("TipoIncidencia.txt");
if (!fTIncidencia.exists()) {
PrintWriter pw = new PrintWriter(new FileWriter(
"TipoIncidencia.txt"));
pw.println(getDataToLine(ti));
pw.close();
} else {
FileWriter fw = new FileWriter("TipoIncidencia.txt", true);
fw.write("\n" +getDataToLine(ti));
fw.close();
}
} catch (Exception e) {
// TODO: handle exception
}
}
public void guardarTipoIncidencia() {
try {
PrintWriter pw = new PrintWriter(new FileWriter(
"TipoIncidencia.txt"));
BE_TipoIncidencia ti;
for (int i = 0; i < size(); i++) {
ti = arrayTipoIncidencia.get(i);
pw.println(getDataToLine(ti));
}
pw.close();
} catch (Exception e) {
// TODO: handle exception
}
}
public void eliminaTipoIncidencia(int codigoTIncidenci){
try {
PrintWriter pw = new PrintWriter(new FileWriter("temp.txt"));
BufferedReader br = new BufferedReader(new FileReader("TipoIncidencia.txt"));
String linea, s[];
String path = System.getProperty("user.dir");
while((linea = br.readLine()) != null){
s = linea.split(",");
if(Integer.parseInt(s[0]) != codigoTIncidenci)
pw.println(linea);
}
pw.close();
br.close();
File file = new File(path + "\\temp.txt");
File temp = new File(path + "\\TipoIncidencia.txt");
temp.delete();
file.renameTo(new File(path + "\\TipoIncidencia.txt"));
} catch (Exception e) {
// TODO: handle exception
}
}
public int generarCodigo() {
if (arrayTipoIncidencia.size() == 0)
return 0;
else
return arrayTipoIncidencia.get(arrayTipoIncidencia.size() - 1)
.getCodigo() + 1;
}
String getDataToLine(BE_TipoIncidencia ti) {
return ti.getCodigo() + "," + ti.getDescripcion() + ","
+ ti.getAbreviacion() + "," + ti.getEstado();
}
// EndRegion Mantenimientos
public TipoIncidenciaController() {
arrayTipoIncidencia = new ArrayList<BE_TipoIncidencia>();
cargar();
}
public int size() {
return arrayTipoIncidencia.size();
}
public int getPosTipoIncidencia(BE_TipoIncidencia a) {
int pos = arrayTipoIncidencia.indexOf(a);
return pos;
}
public BE_TipoIncidencia getTipoIncidencia(int i) {
return arrayTipoIncidencia.get(i);
}
public BE_TipoIncidencia buscarTipoIncidenciaxCodigo(int codigo) {
for (BE_TipoIncidencia a : arrayTipoIncidencia) {
if (a.getCodigo() == codigo)
return a;
}
return null;
}
public String[] lista() {
String[] data = new String[totalActivos()];
int i = 0;
for(BE_TipoIncidencia ti : arrayTipoIncidencia)
if(ti.getEstado() == 0){
data[i] = ti.getDescripcion();
i++;
}
return data;
}
private int totalActivos() {
int conta = 0;
for (BE_TipoIncidencia ti : arrayTipoIncidencia)
if (ti.getEstado() == 0)
conta++;
return conta;
}
public ArrayList<BE_TipoIncidencia> getListaTipoIncidencia() {
ArrayList<BE_TipoIncidencia> aux = new ArrayList<BE_TipoIncidencia>();
for (BE_TipoIncidencia ti : arrayTipoIncidencia)
aux.add(ti);
return aux;
}
public void cargar() {
try {
File fTIncidencia = new File("TipoIncidencia.txt");
if (fTIncidencia.exists()) {
BufferedReader br = new BufferedReader(new FileReader(
"TipoIncidencia.txt"));
String linea, data[], descripcion, abreviacion;
int codigo, estado;
while ((linea = br.readLine()) != null) {
data = linea.split(",");
codigo = Integer.parseInt(data[0]);
descripcion = data[1];
abreviacion = data[2];
estado = Integer.parseInt(data[3]);
arrayTipoIncidencia.add(new BE_TipoIncidencia(codigo,
descripcion, abreviacion, estado));
}
br.close();
} else
return;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public boolean isTIncidenciaReferencedToIncidencia(int codigoTIncidencia) {
for (BE_Incidencia i : IncidenciaC.getListaIncidencia())
if (i.getCodigoTipoIncidencia() == codigoTIncidencia)
return true;
return false;
}
public int getCodigoTIncidenciaxDescripcion(String descripcion){
for(BE_TipoIncidencia ti : arrayTipoIncidencia)
{
if(ti.getDescripcion().equals(descripcion))
return ti.getCodigo();
}
return 0;
}
}
|
UTF-8
|
Java
| 5,105 |
java
|
TipoIncidenciaController.java
|
Java
|
[] | null |
[] |
package Controlador;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import Entidades.BE_Incidencia;
import Entidades.BE_TipoIncidencia;
public class TipoIncidenciaController {
private ArrayList<BE_TipoIncidencia> arrayTipoIncidencia;
private IncidenciaController IncidenciaC = new IncidenciaController();
// Region Mantenimientos
public void agregarTipoIncidencia(BE_TipoIncidencia a) {
arrayTipoIncidencia.add(a);
}
public void eliminarTipoIncidencia(BE_TipoIncidencia a) {
arrayTipoIncidencia.remove(a);
}
public void modificarTipoIncidencia(int i, BE_TipoIncidencia a) {
arrayTipoIncidencia.set(i, a);
}
public void guardarTipoIncidencia(BE_TipoIncidencia ti) {
try {
File fTIncidencia = new File("TipoIncidencia.txt");
if (!fTIncidencia.exists()) {
PrintWriter pw = new PrintWriter(new FileWriter(
"TipoIncidencia.txt"));
pw.println(getDataToLine(ti));
pw.close();
} else {
FileWriter fw = new FileWriter("TipoIncidencia.txt", true);
fw.write("\n" +getDataToLine(ti));
fw.close();
}
} catch (Exception e) {
// TODO: handle exception
}
}
public void guardarTipoIncidencia() {
try {
PrintWriter pw = new PrintWriter(new FileWriter(
"TipoIncidencia.txt"));
BE_TipoIncidencia ti;
for (int i = 0; i < size(); i++) {
ti = arrayTipoIncidencia.get(i);
pw.println(getDataToLine(ti));
}
pw.close();
} catch (Exception e) {
// TODO: handle exception
}
}
public void eliminaTipoIncidencia(int codigoTIncidenci){
try {
PrintWriter pw = new PrintWriter(new FileWriter("temp.txt"));
BufferedReader br = new BufferedReader(new FileReader("TipoIncidencia.txt"));
String linea, s[];
String path = System.getProperty("user.dir");
while((linea = br.readLine()) != null){
s = linea.split(",");
if(Integer.parseInt(s[0]) != codigoTIncidenci)
pw.println(linea);
}
pw.close();
br.close();
File file = new File(path + "\\temp.txt");
File temp = new File(path + "\\TipoIncidencia.txt");
temp.delete();
file.renameTo(new File(path + "\\TipoIncidencia.txt"));
} catch (Exception e) {
// TODO: handle exception
}
}
public int generarCodigo() {
if (arrayTipoIncidencia.size() == 0)
return 0;
else
return arrayTipoIncidencia.get(arrayTipoIncidencia.size() - 1)
.getCodigo() + 1;
}
String getDataToLine(BE_TipoIncidencia ti) {
return ti.getCodigo() + "," + ti.getDescripcion() + ","
+ ti.getAbreviacion() + "," + ti.getEstado();
}
// EndRegion Mantenimientos
public TipoIncidenciaController() {
arrayTipoIncidencia = new ArrayList<BE_TipoIncidencia>();
cargar();
}
public int size() {
return arrayTipoIncidencia.size();
}
public int getPosTipoIncidencia(BE_TipoIncidencia a) {
int pos = arrayTipoIncidencia.indexOf(a);
return pos;
}
public BE_TipoIncidencia getTipoIncidencia(int i) {
return arrayTipoIncidencia.get(i);
}
public BE_TipoIncidencia buscarTipoIncidenciaxCodigo(int codigo) {
for (BE_TipoIncidencia a : arrayTipoIncidencia) {
if (a.getCodigo() == codigo)
return a;
}
return null;
}
public String[] lista() {
String[] data = new String[totalActivos()];
int i = 0;
for(BE_TipoIncidencia ti : arrayTipoIncidencia)
if(ti.getEstado() == 0){
data[i] = ti.getDescripcion();
i++;
}
return data;
}
private int totalActivos() {
int conta = 0;
for (BE_TipoIncidencia ti : arrayTipoIncidencia)
if (ti.getEstado() == 0)
conta++;
return conta;
}
public ArrayList<BE_TipoIncidencia> getListaTipoIncidencia() {
ArrayList<BE_TipoIncidencia> aux = new ArrayList<BE_TipoIncidencia>();
for (BE_TipoIncidencia ti : arrayTipoIncidencia)
aux.add(ti);
return aux;
}
public void cargar() {
try {
File fTIncidencia = new File("TipoIncidencia.txt");
if (fTIncidencia.exists()) {
BufferedReader br = new BufferedReader(new FileReader(
"TipoIncidencia.txt"));
String linea, data[], descripcion, abreviacion;
int codigo, estado;
while ((linea = br.readLine()) != null) {
data = linea.split(",");
codigo = Integer.parseInt(data[0]);
descripcion = data[1];
abreviacion = data[2];
estado = Integer.parseInt(data[3]);
arrayTipoIncidencia.add(new BE_TipoIncidencia(codigo,
descripcion, abreviacion, estado));
}
br.close();
} else
return;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public boolean isTIncidenciaReferencedToIncidencia(int codigoTIncidencia) {
for (BE_Incidencia i : IncidenciaC.getListaIncidencia())
if (i.getCodigoTipoIncidencia() == codigoTIncidencia)
return true;
return false;
}
public int getCodigoTIncidenciaxDescripcion(String descripcion){
for(BE_TipoIncidencia ti : arrayTipoIncidencia)
{
if(ti.getDescripcion().equals(descripcion))
return ti.getCodigo();
}
return 0;
}
}
| 5,105 | 0.680901 | 0.677963 | 208 | 23.54327 | 21.24328 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.519231 | false | false |
0
|
d86e073a1d4c26b90ac9e8925289c0bccce62ee9
| 39,376,260,210,299 |
6d9bd091cf17634492314b01cfaf9a351a33762f
|
/L13/src/main/java/ru/otus/db_service/DBWorkSimulator.java
|
d835fd7b88c7e11507a40ef604f4abcc7b341681
|
[] |
no_license
|
Serebrennikoff/otus_L1
|
https://github.com/Serebrennikoff/otus_L1
|
afc94d3117b649c97c8f31ab09ed3d943d032587
|
a852838764533ac2cb361a481e781bc34e80355a
|
refs/heads/master
| 2021-01-19T01:06:51.509000 | 2017-08-17T17:04:57 | 2017-08-17T17:04:57 | 87,226,357 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.otus.db_service;
import org.eclipse.jetty.websocket.api.Session;
public interface DBWorkSimulator {
void startWork(Session session);
void stopWork();
String getCacheStats();
}
|
UTF-8
|
Java
| 204 |
java
|
DBWorkSimulator.java
|
Java
|
[] | null |
[] |
package ru.otus.db_service;
import org.eclipse.jetty.websocket.api.Session;
public interface DBWorkSimulator {
void startWork(Session session);
void stopWork();
String getCacheStats();
}
| 204 | 0.735294 | 0.735294 | 12 | 16 | 16.950909 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
0
|
0ce82ea7b0239dae3bbe45de4ed026b8cf2535f1
| 12,189,117,249,190 |
4fdef88440d6049fb11cd80c098b2bf02942f0e5
|
/src/com/company/Footballer.java
|
f4602ef4833bec0c2c1dddab874a5d0351335d63
|
[] |
no_license
|
heghineh/footballer
|
https://github.com/heghineh/footballer
|
63b5a222d13b5e4f8a63d14b8efddb1aac6650e4
|
867eed224386e0f9da0fb7b58622d79bf29a9e9d
|
refs/heads/master
| 2023-02-03T22:02:59.406000 | 2020-12-18T23:31:51 | 2020-12-18T23:31:51 | 322,727,293 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.company;
public class Footballer {
private String name;
private int rating;
//region Constructors
Footballer(){
}
public Footballer(String name, int rating) {
this.name = name;
this.rating = rating;
}
//endregion
//region Getters and Setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
//endregion
}
|
UTF-8
|
Java
| 593 |
java
|
Footballer.java
|
Java
|
[] | null |
[] |
package com.company;
public class Footballer {
private String name;
private int rating;
//region Constructors
Footballer(){
}
public Footballer(String name, int rating) {
this.name = name;
this.rating = rating;
}
//endregion
//region Getters and Setters
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
//endregion
}
| 593 | 0.581788 | 0.581788 | 35 | 15.971429 | 13.57621 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false |
0
|
b7d829682db6eec50c05b302f957e185dec24aed
| 39,367,670,271,701 |
90c98d18f085f3f348cd95932859dc9b0715fb82
|
/src/main/java/me/dzhmud/euler/pack6/Problem66.java
|
d57cb141f4e509abe2f5be38f5fb3746b32076dc
|
[
"MIT"
] |
permissive
|
dzhmud/euler
|
https://github.com/dzhmud/euler
|
529f04dc2a1f42efddaf1380df5807f775a91d08
|
1f63f42509fd1991c62ba62e7ff170d3d5a4f28a
|
refs/heads/master
| 2021-05-05T08:46:06.500000 | 2017-11-23T19:52:47 | 2017-11-23T19:52:47 | 105,530,861 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package me.dzhmud.euler.pack6;
import me.dzhmud.euler.EulerSolution;
import me.dzhmud.euler.util.BigIntegerFraction;
import me.dzhmud.euler.util.PositionSequence;
import me.dzhmud.euler.util.SQRTContinuedFractions;
import me.dzhmud.euler.util.Tuple;
import java.math.BigInteger;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.stream.IntStream;
/**
* Diophantine equation
* Consider quadratic Diophantine equations of the form:
x^2 – Dy^2 = 1
For example, when D=13, the minimal solution in x is 649^2 – 13×180^2 = 1.
It can be assumed that there are no solutions in positive integers when D is square.
By finding minimal solutions in x for D = {2, 3, 5, 6, 7}, we obtain the following:
3^2 – 2×2^2 = 1
2^2 – 3×1^2 = 1
9^2 – 5×4^2 = 1
5^2 – 6×2^2 = 1
8^2 – 7×3^2 = 1
Hence, by considering minimal solutions in x for D ≤ 7, the largest x is obtained when D=5.
Find the value of D ≤ 1000 in minimal solutions of x for which the largest value of x is obtained.
*
* @author dzhmud
*/
public class Problem66 implements EulerSolution {
public static void main(String[] args) {
EulerSolution.measureTime(new Problem66()::getAnswer);
}
/**
* {@see https://en.wikipedia.org/wiki/Pell%27s_equation#Fundamental_solution_via_continued_fractions}
* Code from {@link Problem64} and {@link Problem65} can be used to first generate continued fractions for each D
* and then iteratively try fractions until we get a solution.
*/
@Override
public String getAnswer() {
return "" + IntStream.rangeClosed(2, 1000)
.filter(D -> !squares.contains(D))
.mapToObj(Problem66::findSolution)
.max(Comparator.comparing(Tuple::getValue))
.orElseThrow(SolutionNotFoundException::new)
.getKey();
}
private static PositionSequence squares = PositionSequence.get(n -> (long)n*n);
private static Tuple<BigInteger, BigInteger> findSolution(int D) {
final SQRTContinuedFractions sqrt = new SQRTContinuedFractions(D);
final int[] fractions = sqrt.getSequence();
final LinkedList<Integer> fractionsList = new LinkedList<>();
fractionsList.add(sqrt.roundPart);
for (int i = 0; i < Integer.MAX_VALUE; i++) {
fractionsList.add(fractions[i %fractions.length]);
BigIntegerFraction fraction = BigIntegerFraction.getValue(fractionsList);
if (fraction.denominator.pow(2).multiply(BigInteger.valueOf(D)).add(BigInteger.ONE)
.equals(fraction.nominator.pow(2))) {
return Tuple.of(BigInteger.valueOf(D), fraction.nominator);
}
}
throw new SolutionNotFoundException();
}
}
|
UTF-8
|
Java
| 2,582 |
java
|
Problem66.java
|
Java
|
[
{
"context": " the largest value of x is obtained.\n *\n * @author dzhmud\n */\npublic class Problem66 implements EulerSoluti",
"end": 1032,
"score": 0.9996176362037659,
"start": 1026,
"tag": "USERNAME",
"value": "dzhmud"
}
] | null |
[] |
package me.dzhmud.euler.pack6;
import me.dzhmud.euler.EulerSolution;
import me.dzhmud.euler.util.BigIntegerFraction;
import me.dzhmud.euler.util.PositionSequence;
import me.dzhmud.euler.util.SQRTContinuedFractions;
import me.dzhmud.euler.util.Tuple;
import java.math.BigInteger;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.stream.IntStream;
/**
* Diophantine equation
* Consider quadratic Diophantine equations of the form:
x^2 – Dy^2 = 1
For example, when D=13, the minimal solution in x is 649^2 – 13×180^2 = 1.
It can be assumed that there are no solutions in positive integers when D is square.
By finding minimal solutions in x for D = {2, 3, 5, 6, 7}, we obtain the following:
3^2 – 2×2^2 = 1
2^2 – 3×1^2 = 1
9^2 – 5×4^2 = 1
5^2 – 6×2^2 = 1
8^2 – 7×3^2 = 1
Hence, by considering minimal solutions in x for D ≤ 7, the largest x is obtained when D=5.
Find the value of D ≤ 1000 in minimal solutions of x for which the largest value of x is obtained.
*
* @author dzhmud
*/
public class Problem66 implements EulerSolution {
public static void main(String[] args) {
EulerSolution.measureTime(new Problem66()::getAnswer);
}
/**
* {@see https://en.wikipedia.org/wiki/Pell%27s_equation#Fundamental_solution_via_continued_fractions}
* Code from {@link Problem64} and {@link Problem65} can be used to first generate continued fractions for each D
* and then iteratively try fractions until we get a solution.
*/
@Override
public String getAnswer() {
return "" + IntStream.rangeClosed(2, 1000)
.filter(D -> !squares.contains(D))
.mapToObj(Problem66::findSolution)
.max(Comparator.comparing(Tuple::getValue))
.orElseThrow(SolutionNotFoundException::new)
.getKey();
}
private static PositionSequence squares = PositionSequence.get(n -> (long)n*n);
private static Tuple<BigInteger, BigInteger> findSolution(int D) {
final SQRTContinuedFractions sqrt = new SQRTContinuedFractions(D);
final int[] fractions = sqrt.getSequence();
final LinkedList<Integer> fractionsList = new LinkedList<>();
fractionsList.add(sqrt.roundPart);
for (int i = 0; i < Integer.MAX_VALUE; i++) {
fractionsList.add(fractions[i %fractions.length]);
BigIntegerFraction fraction = BigIntegerFraction.getValue(fractionsList);
if (fraction.denominator.pow(2).multiply(BigInteger.valueOf(D)).add(BigInteger.ONE)
.equals(fraction.nominator.pow(2))) {
return Tuple.of(BigInteger.valueOf(D), fraction.nominator);
}
}
throw new SolutionNotFoundException();
}
}
| 2,582 | 0.727131 | 0.696638 | 73 | 34.041096 | 30.22674 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.534247 | false | false |
0
|
9f131273b568b24ba7cdc8d29996a749f3bb995e
| 37,108,517,475,428 |
a35df7310dc70478ca0efbaf8c8bd3d1ef2af070
|
/src/main/java/UserTech/model/hibernateAnnotation/Technology.java
|
39f0a5129202d6b19fb5a158581557ae6e016ab1
|
[] |
no_license
|
vasidzius/UserTech
|
https://github.com/vasidzius/UserTech
|
379e368c12c7693a2d44aa19797ca4a6ff88888f
|
e9fe791e1f950239b8405525658d5888ee0f8caa
|
refs/heads/master
| 2018-01-11T20:14:06.597000 | 2015-12-11T14:47:05 | 2015-12-11T14:47:05 | 46,170,034 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package UserTech.model.hibernateAnnotation;
import javax.persistence.*;
/**
* Created by Vasiliy on 26.11.2015.
*/
@Entity
@Table(name="technologies",
uniqueConstraints = {@UniqueConstraint(columnNames = "id")})
public class Technology {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true, length = 11)
private int id;
@Column(name = "name", length = 45)
private String name;
@Column(name = "description", length = 1000)
private String description;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
UTF-8
|
Java
| 972 |
java
|
Technology.java
|
Java
|
[
{
"context": "n;\n\nimport javax.persistence.*;\n\n/**\n * Created by Vasiliy on 26.11.2015.\n */\n\n@Entity\n@Table(name=\"technolo",
"end": 99,
"score": 0.9993586540222168,
"start": 92,
"tag": "NAME",
"value": "Vasiliy"
}
] | null |
[] |
package UserTech.model.hibernateAnnotation;
import javax.persistence.*;
/**
* Created by Vasiliy on 26.11.2015.
*/
@Entity
@Table(name="technologies",
uniqueConstraints = {@UniqueConstraint(columnNames = "id")})
public class Technology {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true, length = 11)
private int id;
@Column(name = "name", length = 45)
private String name;
@Column(name = "description", length = 1000)
private String description;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| 972 | 0.621399 | 0.604938 | 49 | 18.836735 | 19.295074 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346939 | false | false |
0
|
e7cd4c0b29eac35c94b935678d0acbb189a7af5e
| 37,108,517,476,739 |
22d6a5ece092b379acdc354790b3214216c4d33e
|
/geniar.html2pdf/src/geniar/html2pdf/filter/Html2PdfServletOutputStream.java
|
d56ffda950dca1b599d73ae7e17f9256225fe1e9
|
[] |
no_license
|
josealvarohincapie/carritos
|
https://github.com/josealvarohincapie/carritos
|
82dd4927b4fab38ce6f393eebcdcf54da4eada85
|
b60ff02175facdbbd2ebc441a24e460200a18dd9
|
refs/heads/master
| 2021-01-25T04:08:59.955000 | 2015-03-04T03:44:59 | 2015-03-04T03:44:59 | 32,355,348 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package geniar.html2pdf.filter;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import javax.servlet.ServletOutputStream;
/**
* Mock implementation of ServletOutputStream.
*
* @system. Html2PdfFilter
* @author Jaime Chavarriaga
* @version 1.0
* @requirement.
* @date. 05-Dic-2006
*/
public class Html2PdfServletOutputStream extends ServletOutputStream
{
private PrintWriter printStream;
private ByteArrayOutputStream buffer;
private String encoding;
/**
* Set default output stream encoding.
*/
public Html2PdfServletOutputStream()
{
this("ISO-8859-1");
}
/**
* Set output stream encoding.
* @param encoding encoding
*/
public Html2PdfServletOutputStream(String encoding)
{
buffer = new ByteArrayOutputStream();
printStream = new PrintWriter(buffer, true);
this.encoding = encoding;
}
/**
* Set class encoding.
* @param encoding encoding
*/
public void setEncoding(String encoding)
{
this.encoding = encoding;
}
/**
* Print to buffer.
* @see java.io.OutputStream#write(int)
*/
public void write(int value) throws IOException
{
System.out.println("imprimiendo" + value + " en " + buffer.size());
buffer.write(value);
}
/**
* Return stream content.
* @return stream content.
*/
public String getContent()
{
try
{
printStream.flush();
buffer.flush();
return buffer.toString(encoding);
}
catch(IOException exc)
{
System.out.println("error en outputstream.getcontent");
throw new RuntimeException(exc);
}
}
/**
* Return binary content.
* @return binary content.
*/
public byte[] getBinaryContent()
{
try
{
buffer.flush();
return buffer.toByteArray();
}
catch(IOException exc)
{
System.out.println("error en outputstream.getbinarycontent");
throw new RuntimeException(exc);
}
}
/**
* Clear buffer content.
*/
public void clearContent()
{
buffer.reset();
}
/**
* Overrides close.
* @throws IOException exception
*/
public void close() throws IOException {}
/**
* Overrides flush
* @throws IOException excepction
*/
public void flush() throws IOException {
System.out.println("Hola");
}
/**
* Return hashcode.
* @return hashcode
*/
public int hashCode() {
return buffer.hashCode();
}
/**
* Print boolean to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(boolean arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print char to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(char arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print double to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(double arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print float to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(float arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print int to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(int arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print long to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(long arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print string to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(String arg0) throws IOException {
printStream.print(arg0);
}
/**
* Overrides println.
* @throws IOException exception
*/
public void println() throws IOException {
printStream.println();
}
/**
* Println boolean to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(boolean arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println char to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(char arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println double to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(double arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println float to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(float arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println int to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(int arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println long to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(long arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println string to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(String arg0) throws IOException {
printStream.println(arg0);
}
/**
* Convert buffer to string.
* @return buffer as string
*/
public String toString() {
return buffer.toString();
}
/**
* Write to buffer.
* @param arg0 argument
* @param arg1 argument
* @param arg2 argument
* @throws IOException exception
*/
public void write(byte[] arg0, int arg1, int arg2) throws IOException {
// System.out.println("no se puede imprimir - byte 2 args");
buffer.write(arg0, arg1, arg2);
}
/**
* Write to buffer.
* @param arg0 argument
* @throws IOException exception
*/
public void write(byte[] arg0) throws IOException {
// System.out.println("no se puede imprimir - byte array");
buffer.write(arg0);
}
/**
* Print writer.
* @return printstream
*/
public PrintWriter getWriter() {
return printStream;
}
}
|
UTF-8
|
Java
| 6,678 |
java
|
Html2PdfServletOutputStream.java
|
Java
|
[
{
"context": "eam.\r\n * \r\n * @system. Html2PdfFilter\r\n * @author Jaime Chavarriaga\r\n * @version 1.0\r\n * @requirement. \r\n * @date. ",
"end": 294,
"score": 0.9998817443847656,
"start": 277,
"tag": "NAME",
"value": "Jaime Chavarriaga"
}
] | null |
[] |
package geniar.html2pdf.filter;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import javax.servlet.ServletOutputStream;
/**
* Mock implementation of ServletOutputStream.
*
* @system. Html2PdfFilter
* @author <NAME>
* @version 1.0
* @requirement.
* @date. 05-Dic-2006
*/
public class Html2PdfServletOutputStream extends ServletOutputStream
{
private PrintWriter printStream;
private ByteArrayOutputStream buffer;
private String encoding;
/**
* Set default output stream encoding.
*/
public Html2PdfServletOutputStream()
{
this("ISO-8859-1");
}
/**
* Set output stream encoding.
* @param encoding encoding
*/
public Html2PdfServletOutputStream(String encoding)
{
buffer = new ByteArrayOutputStream();
printStream = new PrintWriter(buffer, true);
this.encoding = encoding;
}
/**
* Set class encoding.
* @param encoding encoding
*/
public void setEncoding(String encoding)
{
this.encoding = encoding;
}
/**
* Print to buffer.
* @see java.io.OutputStream#write(int)
*/
public void write(int value) throws IOException
{
System.out.println("imprimiendo" + value + " en " + buffer.size());
buffer.write(value);
}
/**
* Return stream content.
* @return stream content.
*/
public String getContent()
{
try
{
printStream.flush();
buffer.flush();
return buffer.toString(encoding);
}
catch(IOException exc)
{
System.out.println("error en outputstream.getcontent");
throw new RuntimeException(exc);
}
}
/**
* Return binary content.
* @return binary content.
*/
public byte[] getBinaryContent()
{
try
{
buffer.flush();
return buffer.toByteArray();
}
catch(IOException exc)
{
System.out.println("error en outputstream.getbinarycontent");
throw new RuntimeException(exc);
}
}
/**
* Clear buffer content.
*/
public void clearContent()
{
buffer.reset();
}
/**
* Overrides close.
* @throws IOException exception
*/
public void close() throws IOException {}
/**
* Overrides flush
* @throws IOException excepction
*/
public void flush() throws IOException {
System.out.println("Hola");
}
/**
* Return hashcode.
* @return hashcode
*/
public int hashCode() {
return buffer.hashCode();
}
/**
* Print boolean to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(boolean arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print char to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(char arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print double to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(double arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print float to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(float arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print int to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(int arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print long to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(long arg0) throws IOException {
printStream.print(arg0);
}
/**
* Print string to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void print(String arg0) throws IOException {
printStream.print(arg0);
}
/**
* Overrides println.
* @throws IOException exception
*/
public void println() throws IOException {
printStream.println();
}
/**
* Println boolean to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(boolean arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println char to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(char arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println double to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(double arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println float to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(float arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println int to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(int arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println long to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(long arg0) throws IOException {
printStream.println(arg0);
}
/**
* Println string to stream.
* @param arg0 argument to be printed
* @throws IOException exception
*/
public void println(String arg0) throws IOException {
printStream.println(arg0);
}
/**
* Convert buffer to string.
* @return buffer as string
*/
public String toString() {
return buffer.toString();
}
/**
* Write to buffer.
* @param arg0 argument
* @param arg1 argument
* @param arg2 argument
* @throws IOException exception
*/
public void write(byte[] arg0, int arg1, int arg2) throws IOException {
// System.out.println("no se puede imprimir - byte 2 args");
buffer.write(arg0, arg1, arg2);
}
/**
* Write to buffer.
* @param arg0 argument
* @throws IOException exception
*/
public void write(byte[] arg0) throws IOException {
// System.out.println("no se puede imprimir - byte array");
buffer.write(arg0);
}
/**
* Print writer.
* @return printstream
*/
public PrintWriter getWriter() {
return printStream;
}
}
| 6,667 | 0.612459 | 0.601527 | 300 | 20.26 | 17.582352 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.89 | false | false |
0
|
43d6c8d99f3260915e7d0ef5852fca5e8e1c4875
| 33,749,853,080,030 |
04265ce4a30742bd9ad9701224d1ab1cc86e0496
|
/rest-oauth2/src/main/java/ru/phi/modules/repository/GeoPointRepository.java
|
730816fc980306ef2c11ff8d4a276cddce9909b5
|
[
"Apache-2.0"
] |
permissive
|
Pastor/modules
|
https://github.com/Pastor/modules
|
500587289cf3dc5bdeaae08519f145bf9bff6e6d
|
5d07030f74ada0a7630973acb2959e7f345eda62
|
refs/heads/master
| 2021-01-16T23:14:08.301000 | 2018-10-19T13:12:44 | 2018-10-19T13:12:44 | 62,468,459 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.phi.modules.repository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import ru.phi.modules.entity.GeoPoint;
@Repository("geoPointRepository.v1")
@Service
public interface GeoPointRepository extends PagingAndSortingRepository<GeoPoint, Long> {
GeoPoint findByLatitudeAndLongitude(double latitude, double longitude);
}
|
UTF-8
|
Java
| 457 |
java
|
GeoPointRepository.java
|
Java
|
[] | null |
[] |
package ru.phi.modules.repository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import ru.phi.modules.entity.GeoPoint;
@Repository("geoPointRepository.v1")
@Service
public interface GeoPointRepository extends PagingAndSortingRepository<GeoPoint, Long> {
GeoPoint findByLatitudeAndLongitude(double latitude, double longitude);
}
| 457 | 0.849015 | 0.846827 | 12 | 37.083332 | 29.218882 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
0
|
354dc7b7bdf01dd794c6d8434fcc84967ecbd6d4
| 30,777,735,696,533 |
867e34820f2d12ce6c058529ea6c41fd7d744ee4
|
/kenpoSchedule/src/main/java/com/idahokenpo/kenposchedule/data/LessonLink.java
|
0bc54ad32ab79e1e6bb6deebe375134a965a7b24
|
[] |
no_license
|
snowmobiler20047/karateProject
|
https://github.com/snowmobiler20047/karateProject
|
1b320ebdb061430b7e7badc2f38fb040929eb4ed
|
1ae021b3c70a19c4866177ffa3f339ae06dee1ca
|
refs/heads/master
| 2021-05-01T08:08:03.023000 | 2017-07-03T06:58:23 | 2017-07-03T06:58:23 | 79,675,978 | 0 | 0 | null | false | 2017-07-03T06:58:23 | 2017-01-21T22:09:31 | 2017-01-22T00:20:04 | 2017-07-03T06:58:23 | 26,860 | 0 | 0 | 19 |
Java
| null | null |
package com.idahokenpo.kenposchedule.data;
import com.google.common.collect.Sets;
import com.idahokenpo.kenposchedule.dao.LessonDao;
import java.util.HashSet;
import java.util.Set;
/**
* A class to represent linked lessons that will be used to calculate discounts for the
* additional lessons.
* @author Korey
*/
public class LessonLink
{
private final String primaryLessonId;
private final Set<String> additionalLessonIds;
transient boolean loaded = false;
transient Lesson primaryLesson;
transient Set<Lesson> additionalLessons = new HashSet();
private LessonLink(String primaryLessonId, Set<String> additionalLessonIds)
{
this.primaryLessonId = primaryLessonId;
this.additionalLessonIds = additionalLessonIds;
}
// private LessonLink(Lesson primaryLesson, Set<Lesson> additionalLessons)
// {
// this.primaryLesson = primaryLesson;
// this.additionalLessons = additionalLessons;
// }
public Lesson getPrimaryLesson()
{
if (loaded)
load();
return primaryLesson;
}
public Set<Lesson> getAdditionalLessons()
{
if (loaded)
load();
return additionalLessons;
}
public void load()
{
LessonDao lessonDao = new LessonDao();
this.primaryLesson = lessonDao.get(primaryLessonId);
this.additionalLessons.addAll(lessonDao.get(additionalLessonIds));
loaded = true;
}
public static class LessonLinkBuilder
{
private final String primaryLessonId;
private final Set<String> additionalLessonIds;
public LessonLinkBuilder(String primaryLessonId)
{
this.primaryLessonId = primaryLessonId;
this.additionalLessonIds = Sets.newHashSet();
}
public LessonLink build()
{
return new LessonLink(primaryLessonId, additionalLessonIds);
}
public LessonLinkBuilder withAdditionalLesson(String lessonId)
{
this.additionalLessonIds.add(lessonId);
return this;
}
public LessonLinkBuilder withAdditionalLessons(Set<String> ids)
{
additionalLessonIds.addAll(ids);
return this;
}
}
}
|
UTF-8
|
Java
| 2,364 |
java
|
LessonLink.java
|
Java
|
[
{
"context": "iscounts for the\n * additional lessons.\n * @author Korey\n */\npublic class LessonLink\n{\n private final S",
"end": 314,
"score": 0.9898646473884583,
"start": 309,
"tag": "NAME",
"value": "Korey"
}
] | null |
[] |
package com.idahokenpo.kenposchedule.data;
import com.google.common.collect.Sets;
import com.idahokenpo.kenposchedule.dao.LessonDao;
import java.util.HashSet;
import java.util.Set;
/**
* A class to represent linked lessons that will be used to calculate discounts for the
* additional lessons.
* @author Korey
*/
public class LessonLink
{
private final String primaryLessonId;
private final Set<String> additionalLessonIds;
transient boolean loaded = false;
transient Lesson primaryLesson;
transient Set<Lesson> additionalLessons = new HashSet();
private LessonLink(String primaryLessonId, Set<String> additionalLessonIds)
{
this.primaryLessonId = primaryLessonId;
this.additionalLessonIds = additionalLessonIds;
}
// private LessonLink(Lesson primaryLesson, Set<Lesson> additionalLessons)
// {
// this.primaryLesson = primaryLesson;
// this.additionalLessons = additionalLessons;
// }
public Lesson getPrimaryLesson()
{
if (loaded)
load();
return primaryLesson;
}
public Set<Lesson> getAdditionalLessons()
{
if (loaded)
load();
return additionalLessons;
}
public void load()
{
LessonDao lessonDao = new LessonDao();
this.primaryLesson = lessonDao.get(primaryLessonId);
this.additionalLessons.addAll(lessonDao.get(additionalLessonIds));
loaded = true;
}
public static class LessonLinkBuilder
{
private final String primaryLessonId;
private final Set<String> additionalLessonIds;
public LessonLinkBuilder(String primaryLessonId)
{
this.primaryLessonId = primaryLessonId;
this.additionalLessonIds = Sets.newHashSet();
}
public LessonLink build()
{
return new LessonLink(primaryLessonId, additionalLessonIds);
}
public LessonLinkBuilder withAdditionalLesson(String lessonId)
{
this.additionalLessonIds.add(lessonId);
return this;
}
public LessonLinkBuilder withAdditionalLessons(Set<String> ids)
{
additionalLessonIds.addAll(ids);
return this;
}
}
}
| 2,364 | 0.630711 | 0.630711 | 89 | 25.561798 | 23.280872 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382022 | false | false |
0
|
1a11166bda04c66cbb72b9637288b110cc17daec
| 17,781,164,657,756 |
3198809fa87870f5c644dddd33d6082e94d0db1f
|
/src/trunk/stream/sameas/SATransform.java
|
d695deda695884f991933939afa4aeb171a6b93c
|
[
"MIT"
] |
permissive
|
xgfd/DisSPARQL
|
https://github.com/xgfd/DisSPARQL
|
02c3f3d05e3634659120b5ff7ecfe0d413937816
|
d047454360abbf2b448574b803e012f5ec7bb3bf
|
refs/heads/master
| 2020-03-02T05:02:59.672000 | 2014-10-10T13:46:09 | 2014-10-10T13:46:09 | 11,137,581 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package trunk.stream.sameas;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import trunk.description.Statistics;
import trunk.description.RemoteService;
import trunk.stream.engine.iter.BindJoinIter;
import trunk.util.QueryUtil;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.sparql.algebra.Op;
import com.hp.hpl.jena.sparql.algebra.OpVisitor;
import com.hp.hpl.jena.sparql.algebra.TransformCopy;
import com.hp.hpl.jena.sparql.algebra.op.Op2;
import com.hp.hpl.jena.sparql.algebra.op.OpAssign;
import com.hp.hpl.jena.sparql.algebra.op.OpBGP;
import com.hp.hpl.jena.sparql.algebra.op.OpConditional;
import com.hp.hpl.jena.sparql.algebra.op.OpDatasetNames;
import com.hp.hpl.jena.sparql.algebra.op.OpDiff;
import com.hp.hpl.jena.sparql.algebra.op.OpDisjunction;
import com.hp.hpl.jena.sparql.algebra.op.OpDistinct;
import com.hp.hpl.jena.sparql.algebra.op.OpExt;
import com.hp.hpl.jena.sparql.algebra.op.OpExtend;
import com.hp.hpl.jena.sparql.algebra.op.OpFilter;
import com.hp.hpl.jena.sparql.algebra.op.OpGraph;
import com.hp.hpl.jena.sparql.algebra.op.OpGroup;
import com.hp.hpl.jena.sparql.algebra.op.OpJoin;
import com.hp.hpl.jena.sparql.algebra.op.OpLabel;
import com.hp.hpl.jena.sparql.algebra.op.OpLeftJoin;
import com.hp.hpl.jena.sparql.algebra.op.OpList;
import com.hp.hpl.jena.sparql.algebra.op.OpMinus;
import com.hp.hpl.jena.sparql.algebra.op.OpNull;
import com.hp.hpl.jena.sparql.algebra.op.OpOrder;
import com.hp.hpl.jena.sparql.algebra.op.OpPath;
import com.hp.hpl.jena.sparql.algebra.op.OpProcedure;
import com.hp.hpl.jena.sparql.algebra.op.OpProject;
import com.hp.hpl.jena.sparql.algebra.op.OpPropFunc;
import com.hp.hpl.jena.sparql.algebra.op.OpQuadPattern;
import com.hp.hpl.jena.sparql.algebra.op.OpReduced;
import com.hp.hpl.jena.sparql.algebra.op.OpSequence;
import com.hp.hpl.jena.sparql.algebra.op.OpService;
import com.hp.hpl.jena.sparql.algebra.op.OpSlice;
import com.hp.hpl.jena.sparql.algebra.op.OpTable;
import com.hp.hpl.jena.sparql.algebra.op.OpTriple;
import com.hp.hpl.jena.sparql.algebra.op.OpUnion;
import com.hp.hpl.jena.sparql.core.BasicPattern;
import com.hp.hpl.jena.sparql.core.Var;
import com.hp.hpl.jena.sparql.engine.binding.Binding;
import com.hp.hpl.jena.sparql.engine.binding.BindingFactory;
import com.hp.hpl.jena.sparql.syntax.ElementGroup;
public class SATransform extends TransformCopy{
private Set<Binding> saBindings;
private Statistics config;
private Set<Node> visited = new HashSet<Node>();
public static Map<Node,Integer> sameAsCount = new HashMap<Node,Integer>();
public static final String sameAs = "http://www.w3.org/2002/07/owl#sameAs";
public SATransform() {
}
public SATransform(Statistics config) {
this.config = config;
sameAsCount = new HashMap<Node,Integer>();
}
public Set<Binding> transform(Op op){
SAVisitor opVisitor = new SAVisitor();
op.visit(opVisitor);
return saBindings;
}
class SAVisitor implements OpVisitor {
@Override
public void visit(OpBGP opBGP) {
BasicPattern pattern = opBGP.getPattern();
List<Triple> triples = pattern.getList();
List<Triple> newList = new ArrayList<Triple>();
for(Triple t:triples) {
Triple newTriple = make(t);
newList.add(newTriple);
}
triples.clear();
triples.addAll(newList);
}
/**
* Identify the nodes having equivalent URIs and replace them with variables.
* Also combine all sameAs URIs to generate initial bindings.
* @param t
* @return
*/
private Triple make(Triple t) {//TODO if no sameAs URIs leave it unchanged
Node sub = t.getSubject();
Node obj = t.getObject();
Node pre = t.getPredicate();
Node newSub;
Node newObj;
Node newPre;
newSub = findSA(sub);
newObj = findSA(obj);
newPre = findSA(pre);
return new Triple(newSub,newPre,newObj);
}
private Node findSA(Node n) {
Node node = n;
if(n.isURI() && !visited.contains(n)) {
Set<Binding> bindings = sameAsQuery(n);
visited.add(n);
if(bindings.size() == 1)
return n;
if(saBindings == null) {
saBindings = bindings;
}
else {
saBindings = QueryUtil.concatenate(saBindings, bindings);
}
node = Var.alloc(n.getLocalName());
sameAsCount.put(node,bindings.size());
}
return node;
}
/**
* Get equivalent URIs for a given node.
* @param n
* @return
*/
private Set<Binding> sameAsQuery(Node n) {
Triple tri = new Triple(n, Node.createURI(sameAs), Var.alloc(n.getLocalName()));
List<RemoteService> services = config.getServiceRegistry().getMatchingServices(tri);
Query query = new Query();
ElementGroup elg = new ElementGroup();
elg.addTriplePattern(tri);
query.setQueryResultStar(true);
query.setQueryPattern(elg);
query.setQuerySelectType();
QueryUtil util = new QueryUtil();
Set<Binding> bindings = util.execQueryPara(query, services);
Binding originalValue = BindingFactory.create();
originalValue.add(Var.alloc(n.getLocalName()), n);
bindings.add(originalValue);
return bindings;
}
@Override
public void visit(OpQuadPattern quadPattern) {
}
@Override
public void visit(OpTriple opTriple) {
}
@Override
public void visit(OpPath opPath) {
}
@Override
public void visit(OpTable opTable) {
}
@Override
public void visit(OpNull opNull) {
}
@Override
public void visit(OpProcedure opProc) {
Op sub = opProc.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpPropFunc opPropFunc) {
Op sub = opPropFunc.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpFilter opFilter) {
Op sub = opFilter.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpGraph opGraph) {
Op sub = opGraph.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpService opService) {
Op sub = opService.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpDatasetNames dsNames) {
}
@Override
public void visit(OpLabel opLabel) {
Op sub = opLabel.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpAssign opAssign) {
Op sub = opAssign.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpExtend opExtend) {
Op sub = opExtend.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpJoin opJoin) {
/*Op2 op2 = opJoin;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);*/
}
@Override
public void visit(OpLeftJoin opLeftJoin) {
Op2 op2 = opLeftJoin;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpUnion opUnion) {
Op2 op2 = opUnion;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpDiff opDiff) {
Op2 op2 = opDiff;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpMinus opMinus) {
Op2 op2 = opMinus;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpConditional opCondition) {
Op2 op2 = opCondition;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpSequence opSequence) {
}
@Override
public void visit(OpDisjunction opDisjunction) {
}
@Override
public void visit(OpExt opExt) {
}
@Override
public void visit(OpList opList) {
Op sub = opList.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpOrder opOrder) {
Op sub = opOrder.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpProject opProject) {
Op sub = opProject.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpReduced opReduced) {
Op sub = opReduced.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpDistinct opDistinct) {
Op sub = opDistinct.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpSlice opSlice) {
Op sub = opSlice.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpGroup opGroup) {
Op sub = opGroup.getSubOp();
sub.visit(this);
}
}
}
|
UTF-8
|
Java
| 8,614 |
java
|
SATransform.java
|
Java
|
[] | null |
[] |
package trunk.stream.sameas;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import trunk.description.Statistics;
import trunk.description.RemoteService;
import trunk.stream.engine.iter.BindJoinIter;
import trunk.util.QueryUtil;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.sparql.algebra.Op;
import com.hp.hpl.jena.sparql.algebra.OpVisitor;
import com.hp.hpl.jena.sparql.algebra.TransformCopy;
import com.hp.hpl.jena.sparql.algebra.op.Op2;
import com.hp.hpl.jena.sparql.algebra.op.OpAssign;
import com.hp.hpl.jena.sparql.algebra.op.OpBGP;
import com.hp.hpl.jena.sparql.algebra.op.OpConditional;
import com.hp.hpl.jena.sparql.algebra.op.OpDatasetNames;
import com.hp.hpl.jena.sparql.algebra.op.OpDiff;
import com.hp.hpl.jena.sparql.algebra.op.OpDisjunction;
import com.hp.hpl.jena.sparql.algebra.op.OpDistinct;
import com.hp.hpl.jena.sparql.algebra.op.OpExt;
import com.hp.hpl.jena.sparql.algebra.op.OpExtend;
import com.hp.hpl.jena.sparql.algebra.op.OpFilter;
import com.hp.hpl.jena.sparql.algebra.op.OpGraph;
import com.hp.hpl.jena.sparql.algebra.op.OpGroup;
import com.hp.hpl.jena.sparql.algebra.op.OpJoin;
import com.hp.hpl.jena.sparql.algebra.op.OpLabel;
import com.hp.hpl.jena.sparql.algebra.op.OpLeftJoin;
import com.hp.hpl.jena.sparql.algebra.op.OpList;
import com.hp.hpl.jena.sparql.algebra.op.OpMinus;
import com.hp.hpl.jena.sparql.algebra.op.OpNull;
import com.hp.hpl.jena.sparql.algebra.op.OpOrder;
import com.hp.hpl.jena.sparql.algebra.op.OpPath;
import com.hp.hpl.jena.sparql.algebra.op.OpProcedure;
import com.hp.hpl.jena.sparql.algebra.op.OpProject;
import com.hp.hpl.jena.sparql.algebra.op.OpPropFunc;
import com.hp.hpl.jena.sparql.algebra.op.OpQuadPattern;
import com.hp.hpl.jena.sparql.algebra.op.OpReduced;
import com.hp.hpl.jena.sparql.algebra.op.OpSequence;
import com.hp.hpl.jena.sparql.algebra.op.OpService;
import com.hp.hpl.jena.sparql.algebra.op.OpSlice;
import com.hp.hpl.jena.sparql.algebra.op.OpTable;
import com.hp.hpl.jena.sparql.algebra.op.OpTriple;
import com.hp.hpl.jena.sparql.algebra.op.OpUnion;
import com.hp.hpl.jena.sparql.core.BasicPattern;
import com.hp.hpl.jena.sparql.core.Var;
import com.hp.hpl.jena.sparql.engine.binding.Binding;
import com.hp.hpl.jena.sparql.engine.binding.BindingFactory;
import com.hp.hpl.jena.sparql.syntax.ElementGroup;
public class SATransform extends TransformCopy{
private Set<Binding> saBindings;
private Statistics config;
private Set<Node> visited = new HashSet<Node>();
public static Map<Node,Integer> sameAsCount = new HashMap<Node,Integer>();
public static final String sameAs = "http://www.w3.org/2002/07/owl#sameAs";
public SATransform() {
}
public SATransform(Statistics config) {
this.config = config;
sameAsCount = new HashMap<Node,Integer>();
}
public Set<Binding> transform(Op op){
SAVisitor opVisitor = new SAVisitor();
op.visit(opVisitor);
return saBindings;
}
class SAVisitor implements OpVisitor {
@Override
public void visit(OpBGP opBGP) {
BasicPattern pattern = opBGP.getPattern();
List<Triple> triples = pattern.getList();
List<Triple> newList = new ArrayList<Triple>();
for(Triple t:triples) {
Triple newTriple = make(t);
newList.add(newTriple);
}
triples.clear();
triples.addAll(newList);
}
/**
* Identify the nodes having equivalent URIs and replace them with variables.
* Also combine all sameAs URIs to generate initial bindings.
* @param t
* @return
*/
private Triple make(Triple t) {//TODO if no sameAs URIs leave it unchanged
Node sub = t.getSubject();
Node obj = t.getObject();
Node pre = t.getPredicate();
Node newSub;
Node newObj;
Node newPre;
newSub = findSA(sub);
newObj = findSA(obj);
newPre = findSA(pre);
return new Triple(newSub,newPre,newObj);
}
private Node findSA(Node n) {
Node node = n;
if(n.isURI() && !visited.contains(n)) {
Set<Binding> bindings = sameAsQuery(n);
visited.add(n);
if(bindings.size() == 1)
return n;
if(saBindings == null) {
saBindings = bindings;
}
else {
saBindings = QueryUtil.concatenate(saBindings, bindings);
}
node = Var.alloc(n.getLocalName());
sameAsCount.put(node,bindings.size());
}
return node;
}
/**
* Get equivalent URIs for a given node.
* @param n
* @return
*/
private Set<Binding> sameAsQuery(Node n) {
Triple tri = new Triple(n, Node.createURI(sameAs), Var.alloc(n.getLocalName()));
List<RemoteService> services = config.getServiceRegistry().getMatchingServices(tri);
Query query = new Query();
ElementGroup elg = new ElementGroup();
elg.addTriplePattern(tri);
query.setQueryResultStar(true);
query.setQueryPattern(elg);
query.setQuerySelectType();
QueryUtil util = new QueryUtil();
Set<Binding> bindings = util.execQueryPara(query, services);
Binding originalValue = BindingFactory.create();
originalValue.add(Var.alloc(n.getLocalName()), n);
bindings.add(originalValue);
return bindings;
}
@Override
public void visit(OpQuadPattern quadPattern) {
}
@Override
public void visit(OpTriple opTriple) {
}
@Override
public void visit(OpPath opPath) {
}
@Override
public void visit(OpTable opTable) {
}
@Override
public void visit(OpNull opNull) {
}
@Override
public void visit(OpProcedure opProc) {
Op sub = opProc.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpPropFunc opPropFunc) {
Op sub = opPropFunc.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpFilter opFilter) {
Op sub = opFilter.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpGraph opGraph) {
Op sub = opGraph.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpService opService) {
Op sub = opService.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpDatasetNames dsNames) {
}
@Override
public void visit(OpLabel opLabel) {
Op sub = opLabel.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpAssign opAssign) {
Op sub = opAssign.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpExtend opExtend) {
Op sub = opExtend.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpJoin opJoin) {
/*Op2 op2 = opJoin;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);*/
}
@Override
public void visit(OpLeftJoin opLeftJoin) {
Op2 op2 = opLeftJoin;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpUnion opUnion) {
Op2 op2 = opUnion;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpDiff opDiff) {
Op2 op2 = opDiff;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpMinus opMinus) {
Op2 op2 = opMinus;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpConditional opCondition) {
Op2 op2 = opCondition;
Op left = op2.getLeft();
Op right = op2.getRight();
left.visit(this);
right.visit(this);
}
@Override
public void visit(OpSequence opSequence) {
}
@Override
public void visit(OpDisjunction opDisjunction) {
}
@Override
public void visit(OpExt opExt) {
}
@Override
public void visit(OpList opList) {
Op sub = opList.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpOrder opOrder) {
Op sub = opOrder.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpProject opProject) {
Op sub = opProject.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpReduced opReduced) {
Op sub = opReduced.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpDistinct opDistinct) {
Op sub = opDistinct.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpSlice opSlice) {
Op sub = opSlice.getSubOp();
sub.visit(this);
}
@Override
public void visit(OpGroup opGroup) {
Op sub = opGroup.getSubOp();
sub.visit(this);
}
}
}
| 8,614 | 0.691549 | 0.687718 | 371 | 22.210243 | 19.209135 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.334232 | false | false |
0
|
ce0a6a5b1ff6cb8a2e0ba3627edd79bf183194db
| 25,262,997,703,563 |
6abf6a64ad7a3c4f9adadffe5f70624c14f68ddb
|
/src/main/java/sample/model/Parameter.java
|
a77bd4b81cc26d7ec8286029ae40877f268fe17c
|
[] |
no_license
|
lighthouse145/MagnitImpulsFormation
|
https://github.com/lighthouse145/MagnitImpulsFormation
|
0c3fc89d0c505f460e5d656ab89cd9fabd3e70cb
|
7409218b106c4141e52d08066518791bddf7ebca
|
refs/heads/master
| 2019-07-24T02:09:10.015000 | 2019-03-05T23:43:20 | 2019-03-05T23:43:20 | 81,599,180 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package sample.model;
import javafx.beans.property.*;
import javax.persistence.*;
/**
* Created by user on 24.05.2017.
*/
@Entity
@Access(value = AccessType.PROPERTY)
public class Parameter {
private Long id;
private StringProperty name;
private StringProperty label;
private BooleanProperty output;
private StringProperty multiplier;
private StringProperty value;
public Parameter(){
this.name = new SimpleStringProperty();
this.label = new SimpleStringProperty();
this.output = new SimpleBooleanProperty();
this.output.setValue(false);
this.multiplier = new SimpleStringProperty();
this.multiplier.set(Multipliers.DEFAULT_TEXT);
this.value = new SimpleStringProperty();
this.value.set("0.0");
}
public Parameter(String name){
this();
this.name.setValue(name);
}
public Parameter(String name,String value){
this();
this.name.setValue(name);
this.value.setValue(value);
}
public Parameter(String name,String label,Boolean output,String multiplier){
this();
this.name.setValue(name);
this.label.setValue(label);
this.output.setValue(output);
this.multiplier.setValue(multiplier);
}
public Parameter(String name, String label, Boolean output, String multiplier, String value){
this();
this.name.setValue(name);
this.label.setValue(label);
this.output.setValue(output);
this.multiplier.setValue(multiplier);
this.value.setValue(value);
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name.get();
}
public void setName(String name) {
this.name = new SimpleStringProperty(name);
}
public StringProperty nameProperty() {
return name;
}
public void setLabel(String label) {
this.label = new SimpleStringProperty(label);
}
public String getLabel() {
return label.get();
}
public StringProperty labelProperty() {
return label;
}
public boolean getOutput() {
return output.get();
}
public BooleanProperty outputProperty() {
return output;
}
public void setOutput(boolean output) {
this.output.set(output);
}
public void setMultiplier(String multiplier) {
this.multiplier.set(multiplier);
}
public String getMultiplier() {
return multiplier.get();
}
public StringProperty multiplierProperty() {
return multiplier;
}
public void setMultiplier(float multiplier) {
this.multiplier.set(String.valueOf(multiplier));
}
public String getValue() {
return value.get();
}
public StringProperty valueProperty() {
return value;
}
public void setValue(String value) {
this.value.set(value);
}
}
|
UTF-8
|
Java
| 3,074 |
java
|
Parameter.java
|
Java
|
[] | null |
[] |
package sample.model;
import javafx.beans.property.*;
import javax.persistence.*;
/**
* Created by user on 24.05.2017.
*/
@Entity
@Access(value = AccessType.PROPERTY)
public class Parameter {
private Long id;
private StringProperty name;
private StringProperty label;
private BooleanProperty output;
private StringProperty multiplier;
private StringProperty value;
public Parameter(){
this.name = new SimpleStringProperty();
this.label = new SimpleStringProperty();
this.output = new SimpleBooleanProperty();
this.output.setValue(false);
this.multiplier = new SimpleStringProperty();
this.multiplier.set(Multipliers.DEFAULT_TEXT);
this.value = new SimpleStringProperty();
this.value.set("0.0");
}
public Parameter(String name){
this();
this.name.setValue(name);
}
public Parameter(String name,String value){
this();
this.name.setValue(name);
this.value.setValue(value);
}
public Parameter(String name,String label,Boolean output,String multiplier){
this();
this.name.setValue(name);
this.label.setValue(label);
this.output.setValue(output);
this.multiplier.setValue(multiplier);
}
public Parameter(String name, String label, Boolean output, String multiplier, String value){
this();
this.name.setValue(name);
this.label.setValue(label);
this.output.setValue(output);
this.multiplier.setValue(multiplier);
this.value.setValue(value);
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name.get();
}
public void setName(String name) {
this.name = new SimpleStringProperty(name);
}
public StringProperty nameProperty() {
return name;
}
public void setLabel(String label) {
this.label = new SimpleStringProperty(label);
}
public String getLabel() {
return label.get();
}
public StringProperty labelProperty() {
return label;
}
public boolean getOutput() {
return output.get();
}
public BooleanProperty outputProperty() {
return output;
}
public void setOutput(boolean output) {
this.output.set(output);
}
public void setMultiplier(String multiplier) {
this.multiplier.set(multiplier);
}
public String getMultiplier() {
return multiplier.get();
}
public StringProperty multiplierProperty() {
return multiplier;
}
public void setMultiplier(float multiplier) {
this.multiplier.set(String.valueOf(multiplier));
}
public String getValue() {
return value.get();
}
public StringProperty valueProperty() {
return value;
}
public void setValue(String value) {
this.value.set(value);
}
}
| 3,074 | 0.625244 | 0.621991 | 136 | 21.602942 | 19.556583 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.433824 | false | false |
0
|
670c439e44ad8e784fc56c1e5f4d0e487c379076
| 28,080,496,225,213 |
1ce05d19cdef6c03fde8299cbd2ecbaf99f87a79
|
/OfficeManagementSystem/src/com/oms/controller/RegistrationController.java
|
7bd42f3dcb3e600cfe8079a41af32c228e1b4604
|
[] |
no_license
|
AniketPaul1592/simple_codes
|
https://github.com/AniketPaul1592/simple_codes
|
762ba5e7c10e8adb0f15c43d47b49c02ae8d4d18
|
b3ad71bc6c6f867ce8a0005715f73b9d6cbf1a24
|
refs/heads/master
| 2021-01-11T11:07:15.417000 | 2015-10-07T18:52:57 | 2015-10-07T18:52:57 | 43,834,704 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.oms.controller;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import com.oms.bo.RegistrationBO;
import com.oms.constants.Constants;
import com.oms.constants.ErrorConstants;
import com.oms.cryptography.AESEncryption;
import com.oms.exceptions.ApplicationException;
import com.oms.exceptions.DatabaseOperationException;
import com.oms.model.RegistrationTO;
/**
* Servlet implementation class RegistrationController
*/
public class RegistrationController extends HttpServlet {
/** The Constant LOG. */
public static final Logger LOG = Logger.getLogger("RegistrationController");
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public RegistrationController() {
super();
// TODO Auto-generated constructor stub
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session=req.getSession(false);
if(session!=null){
if(session.getAttribute("role")==null){
resp.sendRedirect("login.jsp");
}
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
LOG.info("Inside - method doPost in RegistrationController class");
RegistrationTO registartionTo=new RegistrationTO();
registartionTo.setEmployeeName(request.getParameter("name"));
registartionTo.setEmailId(request.getParameter("email"));
registartionTo.setContact(Long.parseLong(request.getParameter("contact")));
SimpleDateFormat sd=new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdf=new SimpleDateFormat("dd-MMM-yyyy");
Date birthDate =null;
Date joinDate=null;
try {
birthDate = sdf.parse(sdf.format(sd.parse(request.getParameter("birth_date"))));
joinDate=sdf.parse(sdf.format(sd.parse(request.getParameter("join_date"))));
} catch (ParseException e) {
LOG.info("RegistrationController class - ParseException"
+ e.getMessage());
request.setAttribute("message", Constants.EXCEPTION);
final RequestDispatcher dispatcher = request
.getRequestDispatcher(ErrorConstants.ERRORPAGE);
dispatcher.forward(request, response);
}
registartionTo.setEmployeeExist("Y");
registartionTo.setBirthDate(birthDate);
String encryptedPassword = null;
try {
encryptedPassword = AESEncryption.encrypt(request.getParameter("password"));
} catch (Exception e) {
e.printStackTrace();
}
registartionTo.setPassword(encryptedPassword);
registartionTo.setLocation(request.getParameter("location"));
registartionTo.setGender(request.getParameter("gender"));
registartionTo.setExperience(Integer.parseInt(request.getParameter("experience")));
registartionTo.setHighestQualification(request.getParameter("highest_qualification"));
registartionTo.setEmployeeType(request.getParameter("employee_type"));
registartionTo.setJoinDate(joinDate);
RegistrationBO registrationBo=new RegistrationBO();
int flag = 0;
try {
registartionTo=registrationBo.checkEmailId(registartionTo);
if(registartionTo.getMessage()!=null)
{
request.setAttribute("messageRegistration", registartionTo.getMessage());
RequestDispatcher rd=request.getRequestDispatcher("EmployeeRegistration.jsp");
rd.forward(request, response);
}
flag = registrationBo.employeeEntry(registartionTo);
if(flag==1)
{
request.setAttribute("designation",registartionTo.getDesignation());
request.setAttribute("retirementDate",registartionTo.getRetirementDate());
request.setAttribute("empid",registartionTo.getEmpId());
RequestDispatcher rd=request.getRequestDispatcher("SuccessRegister.jsp");
rd.forward(request, response);
}
} catch (DatabaseOperationException dbException) {
LOG.info("RegistrationController class - DatabaseOperationException"
+ dbException.getMessage());
request.setAttribute("message", Constants.EXCEPTION);
final RequestDispatcher dispatcher = request
.getRequestDispatcher(ErrorConstants.ERRORPAGE);
dispatcher.forward(request, response);
} catch (ApplicationException appException) {
LOG.info("RegistrationController class - ApplicationException"
+ appException.getMessage());
request.setAttribute("message", Constants.EXCEPTION);
final RequestDispatcher dispatcher = request
.getRequestDispatcher(ErrorConstants.ERRORPAGE);
dispatcher.forward(request, response);
}
LOG.info("Exit - method doPost in RegistrationController class");
}
}
|
UTF-8
|
Java
| 5,047 |
java
|
RegistrationController.java
|
Java
|
[
{
"context": "BirthDate(birthDate);\n\t\tString encryptedPassword = null;\n\t\ttry {\n\t\t\tencryptedPassword = AESEncryption.enc",
"end": 2817,
"score": 0.9447265863418579,
"start": 2813,
"tag": "PASSWORD",
"value": "null"
},
{
"context": "intStackTrace();\n\t\t}\n\t\tregistartionTo.setPassword(encryptedPassword);\n\t\tregistartionTo.setLocation(request.getParamet",
"end": 3011,
"score": 0.9738372564315796,
"start": 2994,
"tag": "PASSWORD",
"value": "encryptedPassword"
}
] | null |
[] |
package com.oms.controller;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import com.oms.bo.RegistrationBO;
import com.oms.constants.Constants;
import com.oms.constants.ErrorConstants;
import com.oms.cryptography.AESEncryption;
import com.oms.exceptions.ApplicationException;
import com.oms.exceptions.DatabaseOperationException;
import com.oms.model.RegistrationTO;
/**
* Servlet implementation class RegistrationController
*/
public class RegistrationController extends HttpServlet {
/** The Constant LOG. */
public static final Logger LOG = Logger.getLogger("RegistrationController");
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public RegistrationController() {
super();
// TODO Auto-generated constructor stub
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session=req.getSession(false);
if(session!=null){
if(session.getAttribute("role")==null){
resp.sendRedirect("login.jsp");
}
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
LOG.info("Inside - method doPost in RegistrationController class");
RegistrationTO registartionTo=new RegistrationTO();
registartionTo.setEmployeeName(request.getParameter("name"));
registartionTo.setEmailId(request.getParameter("email"));
registartionTo.setContact(Long.parseLong(request.getParameter("contact")));
SimpleDateFormat sd=new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdf=new SimpleDateFormat("dd-MMM-yyyy");
Date birthDate =null;
Date joinDate=null;
try {
birthDate = sdf.parse(sdf.format(sd.parse(request.getParameter("birth_date"))));
joinDate=sdf.parse(sdf.format(sd.parse(request.getParameter("join_date"))));
} catch (ParseException e) {
LOG.info("RegistrationController class - ParseException"
+ e.getMessage());
request.setAttribute("message", Constants.EXCEPTION);
final RequestDispatcher dispatcher = request
.getRequestDispatcher(ErrorConstants.ERRORPAGE);
dispatcher.forward(request, response);
}
registartionTo.setEmployeeExist("Y");
registartionTo.setBirthDate(birthDate);
String encryptedPassword = <PASSWORD>;
try {
encryptedPassword = AESEncryption.encrypt(request.getParameter("password"));
} catch (Exception e) {
e.printStackTrace();
}
registartionTo.setPassword(<PASSWORD>);
registartionTo.setLocation(request.getParameter("location"));
registartionTo.setGender(request.getParameter("gender"));
registartionTo.setExperience(Integer.parseInt(request.getParameter("experience")));
registartionTo.setHighestQualification(request.getParameter("highest_qualification"));
registartionTo.setEmployeeType(request.getParameter("employee_type"));
registartionTo.setJoinDate(joinDate);
RegistrationBO registrationBo=new RegistrationBO();
int flag = 0;
try {
registartionTo=registrationBo.checkEmailId(registartionTo);
if(registartionTo.getMessage()!=null)
{
request.setAttribute("messageRegistration", registartionTo.getMessage());
RequestDispatcher rd=request.getRequestDispatcher("EmployeeRegistration.jsp");
rd.forward(request, response);
}
flag = registrationBo.employeeEntry(registartionTo);
if(flag==1)
{
request.setAttribute("designation",registartionTo.getDesignation());
request.setAttribute("retirementDate",registartionTo.getRetirementDate());
request.setAttribute("empid",registartionTo.getEmpId());
RequestDispatcher rd=request.getRequestDispatcher("SuccessRegister.jsp");
rd.forward(request, response);
}
} catch (DatabaseOperationException dbException) {
LOG.info("RegistrationController class - DatabaseOperationException"
+ dbException.getMessage());
request.setAttribute("message", Constants.EXCEPTION);
final RequestDispatcher dispatcher = request
.getRequestDispatcher(ErrorConstants.ERRORPAGE);
dispatcher.forward(request, response);
} catch (ApplicationException appException) {
LOG.info("RegistrationController class - ApplicationException"
+ appException.getMessage());
request.setAttribute("message", Constants.EXCEPTION);
final RequestDispatcher dispatcher = request
.getRequestDispatcher(ErrorConstants.ERRORPAGE);
dispatcher.forward(request, response);
}
LOG.info("Exit - method doPost in RegistrationController class");
}
}
| 5,046 | 0.764018 | 0.763226 | 134 | 36.671642 | 26.433182 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.716418 | false | false |
0
|
2569bcdfb0464e550d71e09fc4cd638e577d9ddb
| 326,417,525,489 |
b7056bca1018e904713935419a245fb53ea0c541
|
/chapter_002/src/main/java/ru/job4j/profession/doctor/Doctor.java
|
a869ae95ea498a8b8124b51c290a7b8bd9f96dc4
|
[
"Apache-2.0"
] |
permissive
|
dkhlopunov/dkhlopunov
|
https://github.com/dkhlopunov/dkhlopunov
|
a82becd20fff40d6187f12790b45c054e3e6fcba
|
ed6ade443596dd87b8fb6392d6346cff161c0500
|
refs/heads/master
| 2018-11-10T06:18:45.213000 | 2018-10-30T14:01:02 | 2018-10-30T14:01:02 | 116,726,023 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.job4j.profession.doctor;
import ru.job4j.profession.Profession;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
public class Doctor extends Profession {
public Doctor() {
super("Doctor", 8, true, 2000);
}
public Diagnose heal(Patient patient) {
patient.setDoctor(this);
try {
// Healing...
TimeUnit.DAYS.sleep(7);
} catch (InterruptedException e) {
e.printStackTrace();
}
return new Diagnose(String.format("Doctor %s has healed %s", getName(), patient.getName()), ThreadLocalRandom.current().nextBoolean());
}
}
|
UTF-8
|
Java
| 671 |
java
|
Doctor.java
|
Java
|
[] | null |
[] |
package ru.job4j.profession.doctor;
import ru.job4j.profession.Profession;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
public class Doctor extends Profession {
public Doctor() {
super("Doctor", 8, true, 2000);
}
public Diagnose heal(Patient patient) {
patient.setDoctor(this);
try {
// Healing...
TimeUnit.DAYS.sleep(7);
} catch (InterruptedException e) {
e.printStackTrace();
}
return new Diagnose(String.format("Doctor %s has healed %s", getName(), patient.getName()), ThreadLocalRandom.current().nextBoolean());
}
}
| 671 | 0.634873 | 0.622951 | 30 | 21.366667 | 28.44935 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
0
|
ef6a4ec5e574984f9a102361f8d1100b6fa1308e
| 2,980,707,315,458 |
02181d9f01b6e62970563949596b988de13297ed
|
/src/test/java/com/gmibank/stepdefinitions/US_008_StepDefinitions.java
|
5a971515b63e59baed58a0c68d9a3dd67dd96ed0
|
[] |
no_license
|
sinankaradavut/GmiBank
|
https://github.com/sinankaradavut/GmiBank
|
dc40d32bfdab052f52e8c5fd9ba4ee542c85fb04
|
4bd4e98d61a6f764b9b2e7a8fb2e6356cd178999
|
refs/heads/main
| 2023-04-09T19:47:13.559000 | 2021-04-21T18:51:21 | 2021-04-21T18:51:21 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gmibank.stepdefinitions;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import org.junit.Assert;
import org.openqa.selenium.NoSuchElementException;
import com.gmibank.pages.US_008GmiPasswordHomePage;
import com.gmibank.utilities.ConfigurationReader;
import com.gmibank.utilities.Driver;
public class US_008_StepDefinitions {
US_008GmiPasswordHomePage us008PasswordPage=new US_008GmiPasswordHomePage();
@Given("User go to {string}")
public void user_go_to(String string) {
Driver.getDriver().get(ConfigurationReader.getProperty("url"));
}
@Given("User Click the icon in homepage")
public void user_click_the_sign_in_button_from_popup_window() {
us008PasswordPage.iconHomePage.click();
}
@Then("User Click the sign in button")
public void user_click_the_sign_in_button() {
us008PasswordPage.signinButtonHomePage.click();
}
@Then("User Enter a valid {string} and {string}")
public void user_enter_a_valid_and(String string, String string2) {
us008PasswordPage.usernameTextbox.sendKeys(ConfigurationReader.getProperty("username"));
us008PasswordPage.passwordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
}
@Then("User click the signin button in signin page")
public void User_click_the_signin_button_in_signin_page(){
us008PasswordPage.signInButtonSignInPage.click();
}
@Then("User click the icon in user page")
public void User_click_the_icon_in_user_page(){
us008PasswordPage.iconUserPage.click();
}
@Then("User Click the password button from popup window")
public void user_click_the_password_button_from_popup_window() {
us008PasswordPage.passwordButtonUserPage.click();
}
@Given("User Enter current password on the current password field")
public void user_enter_current_password1_on_the_current_password_field() {
us008PasswordPage.currentPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
}
@Then("User Enter current password on the new password field")
public void user_enter_current_password1_on_the_new_password_field() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
}
@Then("User Enter current password on confirmation field")
public void user_enter_current_password1_on_confirmation_field() {
us008PasswordPage.confirmPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
}
@Then("User Click the save button")
public void user_click_the_save_button() throws InterruptedException {
us008PasswordPage.saveButtonInPasswordPage.click();
Thread.sleep(2000);
}
@Then("User See the error message")
public void user_see_the_error_message(){
try{
Assert.assertTrue(us008PasswordPage.errorMessage.isDisplayed());
}catch(Exception e){
Assert.assertTrue(false);
}
}
@Given("User Enter on the new password field least one lowercase char for stronger password")
public void user_enter_on_the_new_password_field_least_lowercase_char_for_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("lower_password"));
}
@Given("User see the level chart change accordingly red")
public void user_see_the_level_chart_change_accordingly_red() {
Assert.assertTrue(us008PasswordPage.passwordStrengthPointRed.isDisplayed());
}
@Given("User Enter on the new password field least one uppercase char for stronger password")
public void user_enter_on_the_new_password_field_least_uppercase_char_for_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("upper_password"));
}
@Given("User see the level chart change accordingly orange")
public void user_see_the_level_chart_change_accordingly_orange() {
Assert.assertTrue(us008PasswordPage.passwordStrengthPointOrange.isDisplayed());
}
@Given("User Enter on the new password field least one digit for stronger password")
public void user_enter_on_the_new_password_field_least_digit_for_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("digit_password"));
}
@Given("User see the level chart change accordingly yellow")
public void user_see_the_level_chart_change_accordingly_second_yellow() {
try{
Assert.assertFalse(us008PasswordPage.passwordStrengthPointYellow.isDisplayed());
}catch(NoSuchElementException e){
Assert.assertTrue(false);
}
}
@Given("User Enter on the new password field least one special char for stronger password")
public void user_enter_on_the_new_password_field_least_special_char_for_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("special_password"));
}
@Given("User see the level chart change accordingly lime")
public void user_see_the_level_chart_change_accordingly_lime() {
Assert.assertTrue(us008PasswordPage.passwordStrengthPointLime.isDisplayed());
}
@Given("User Enter at least seven chars for a stronger password")
public void user_enter_at_least_chars_for_a_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("sevenChar_password"));
}
@Given("User see the level chart change accordingly green")
public void user_see_the_level_chart_change_accordingly_second_green() {
Assert.assertTrue(us008PasswordPage.passwordStrengthPointGreen.isDisplayed());
}
@Then("User Enter a new password on the new password field")
public void user_enter_a_new_password_on_the_new_password_field() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("new_password_7chars"));
}
@Then("User Enter a new password on the confirm field")
public void user_enter_a_new_password_on_the_confirm_field() {
us008PasswordPage.confirmPasswordTextbox.sendKeys(ConfigurationReader.getProperty("new_password_7chars"));
}
@Then("User See the password changed message")
public void user_see_the_password_changed_message() {
Assert.assertTrue(us008PasswordPage.passwordChangedMessage.isDisplayed());
us008PasswordPage.currentPasswordTextbox.clear();
us008PasswordPage.currentPasswordTextbox.sendKeys(ConfigurationReader.getProperty("new_password_7chars"));
us008PasswordPage.newPasswordTextbox.clear();
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
us008PasswordPage.confirmPasswordTextbox.clear();
us008PasswordPage.confirmPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
us008PasswordPage.saveButtonInPasswordPage.click();
}
}
|
UTF-8
|
Java
| 7,024 |
java
|
US_008_StepDefinitions.java
|
Java
|
[
{
"context": "Textbox.sendKeys(ConfigurationReader.getProperty(\"username\"));\n us008PasswordPage.passwordTextbox.send",
"end": 1140,
"score": 0.9961399435997009,
"start": 1132,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package com.gmibank.stepdefinitions;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import org.junit.Assert;
import org.openqa.selenium.NoSuchElementException;
import com.gmibank.pages.US_008GmiPasswordHomePage;
import com.gmibank.utilities.ConfigurationReader;
import com.gmibank.utilities.Driver;
public class US_008_StepDefinitions {
US_008GmiPasswordHomePage us008PasswordPage=new US_008GmiPasswordHomePage();
@Given("User go to {string}")
public void user_go_to(String string) {
Driver.getDriver().get(ConfigurationReader.getProperty("url"));
}
@Given("User Click the icon in homepage")
public void user_click_the_sign_in_button_from_popup_window() {
us008PasswordPage.iconHomePage.click();
}
@Then("User Click the sign in button")
public void user_click_the_sign_in_button() {
us008PasswordPage.signinButtonHomePage.click();
}
@Then("User Enter a valid {string} and {string}")
public void user_enter_a_valid_and(String string, String string2) {
us008PasswordPage.usernameTextbox.sendKeys(ConfigurationReader.getProperty("username"));
us008PasswordPage.passwordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
}
@Then("User click the signin button in signin page")
public void User_click_the_signin_button_in_signin_page(){
us008PasswordPage.signInButtonSignInPage.click();
}
@Then("User click the icon in user page")
public void User_click_the_icon_in_user_page(){
us008PasswordPage.iconUserPage.click();
}
@Then("User Click the password button from popup window")
public void user_click_the_password_button_from_popup_window() {
us008PasswordPage.passwordButtonUserPage.click();
}
@Given("User Enter current password on the current password field")
public void user_enter_current_password1_on_the_current_password_field() {
us008PasswordPage.currentPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
}
@Then("User Enter current password on the new password field")
public void user_enter_current_password1_on_the_new_password_field() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
}
@Then("User Enter current password on confirmation field")
public void user_enter_current_password1_on_confirmation_field() {
us008PasswordPage.confirmPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
}
@Then("User Click the save button")
public void user_click_the_save_button() throws InterruptedException {
us008PasswordPage.saveButtonInPasswordPage.click();
Thread.sleep(2000);
}
@Then("User See the error message")
public void user_see_the_error_message(){
try{
Assert.assertTrue(us008PasswordPage.errorMessage.isDisplayed());
}catch(Exception e){
Assert.assertTrue(false);
}
}
@Given("User Enter on the new password field least one lowercase char for stronger password")
public void user_enter_on_the_new_password_field_least_lowercase_char_for_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("lower_password"));
}
@Given("User see the level chart change accordingly red")
public void user_see_the_level_chart_change_accordingly_red() {
Assert.assertTrue(us008PasswordPage.passwordStrengthPointRed.isDisplayed());
}
@Given("User Enter on the new password field least one uppercase char for stronger password")
public void user_enter_on_the_new_password_field_least_uppercase_char_for_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("upper_password"));
}
@Given("User see the level chart change accordingly orange")
public void user_see_the_level_chart_change_accordingly_orange() {
Assert.assertTrue(us008PasswordPage.passwordStrengthPointOrange.isDisplayed());
}
@Given("User Enter on the new password field least one digit for stronger password")
public void user_enter_on_the_new_password_field_least_digit_for_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("digit_password"));
}
@Given("User see the level chart change accordingly yellow")
public void user_see_the_level_chart_change_accordingly_second_yellow() {
try{
Assert.assertFalse(us008PasswordPage.passwordStrengthPointYellow.isDisplayed());
}catch(NoSuchElementException e){
Assert.assertTrue(false);
}
}
@Given("User Enter on the new password field least one special char for stronger password")
public void user_enter_on_the_new_password_field_least_special_char_for_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("special_password"));
}
@Given("User see the level chart change accordingly lime")
public void user_see_the_level_chart_change_accordingly_lime() {
Assert.assertTrue(us008PasswordPage.passwordStrengthPointLime.isDisplayed());
}
@Given("User Enter at least seven chars for a stronger password")
public void user_enter_at_least_chars_for_a_stronger_password() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("sevenChar_password"));
}
@Given("User see the level chart change accordingly green")
public void user_see_the_level_chart_change_accordingly_second_green() {
Assert.assertTrue(us008PasswordPage.passwordStrengthPointGreen.isDisplayed());
}
@Then("User Enter a new password on the new password field")
public void user_enter_a_new_password_on_the_new_password_field() {
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("new_password_7chars"));
}
@Then("User Enter a new password on the confirm field")
public void user_enter_a_new_password_on_the_confirm_field() {
us008PasswordPage.confirmPasswordTextbox.sendKeys(ConfigurationReader.getProperty("new_password_7chars"));
}
@Then("User See the password changed message")
public void user_see_the_password_changed_message() {
Assert.assertTrue(us008PasswordPage.passwordChangedMessage.isDisplayed());
us008PasswordPage.currentPasswordTextbox.clear();
us008PasswordPage.currentPasswordTextbox.sendKeys(ConfigurationReader.getProperty("new_password_7chars"));
us008PasswordPage.newPasswordTextbox.clear();
us008PasswordPage.newPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
us008PasswordPage.confirmPasswordTextbox.clear();
us008PasswordPage.confirmPasswordTextbox.sendKeys(ConfigurationReader.getProperty("current_password"));
us008PasswordPage.saveButtonInPasswordPage.click();
}
}
| 7,024 | 0.739465 | 0.722096 | 160 | 42.900002 | 37.228046 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2875 | false | false |
0
|
a59463c9577d932fd658a07337ebfb4836db223b
| 4,526,895,585,637 |
45e21fd7b49e3db2078da4d1cf5358cebdb7b869
|
/src/main/java/com/springboot/dao/impl/UserDAOImpl.java
|
df5bb4685db82ee5986bd62744be32e7b99ebc9a
|
[] |
no_license
|
psiva017/springboot-sample-app
|
https://github.com/psiva017/springboot-sample-app
|
47910836a1ad0fe323b8728b455cd948825396a7
|
5cf9a1be62ef3fe1e477d354d9da361dd5940cee
|
refs/heads/master
| 2020-12-24T20:10:34.094000 | 2017-03-26T15:45:28 | 2017-03-26T15:45:28 | 86,243,279 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
*/
package com.springboot.dao.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.springboot.QueryUtils.QueryParam;
import com.springboot.dao.UserDAO;
import com.springboot.db.DataAccessor;
import com.springboot.models.User;
/**
* @author psiva
*
*/
@Repository
public class UserDAOImpl implements UserDAO {
@Autowired
private DataAccessor dataAccessor;
@Override
public List<User> getAllUsers() {
return dataAccessor.getListWithNamedQuery("getAllUser");
}
@Override
public User getUserByEmail(String email) {
QueryParam<String> qp = new QueryParam<>("email", email);
List<QueryParam<?>> qps = new ArrayList<>();
qps.add(qp);
return dataAccessor.getListWithNamedQuery("getUserByEmail", qps);
}
}
|
UTF-8
|
Java
| 867 |
java
|
UserDAOImpl.java
|
Java
|
[
{
"context": "import com.springboot.models.User;\n\n/**\n * @author psiva\n *\n */\n\n@Repository\npublic class UserDAOImpl impl",
"end": 387,
"score": 0.9995139837265015,
"start": 382,
"tag": "USERNAME",
"value": "psiva"
}
] | null |
[] |
/**
*
*/
package com.springboot.dao.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.springboot.QueryUtils.QueryParam;
import com.springboot.dao.UserDAO;
import com.springboot.db.DataAccessor;
import com.springboot.models.User;
/**
* @author psiva
*
*/
@Repository
public class UserDAOImpl implements UserDAO {
@Autowired
private DataAccessor dataAccessor;
@Override
public List<User> getAllUsers() {
return dataAccessor.getListWithNamedQuery("getAllUser");
}
@Override
public User getUserByEmail(String email) {
QueryParam<String> qp = new QueryParam<>("email", email);
List<QueryParam<?>> qps = new ArrayList<>();
qps.add(qp);
return dataAccessor.getListWithNamedQuery("getUserByEmail", qps);
}
}
| 867 | 0.756632 | 0.756632 | 44 | 18.704546 | 21.017935 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.795455 | false | false |
0
|
063a15a2361f32ab94be8d31c20b545aef785f71
| 5,403,068,911,572 |
288cfde56612f9935f84846737d9ee631ddd25b5
|
/TFS.IRP.V8 Project/Project/src/com/tfs/irp/usermedal/service/IrpUserMedalService.java
|
756d00baaf661e9753eb5b39256daa0c098fa732
|
[] |
no_license
|
tfsgaotong/irpv8
|
https://github.com/tfsgaotong/irpv8
|
b97d42e616a71d8d4f4260b27d2b26dc391d4acc
|
6d2548544903dcfbcb7dfdb8e95e8f73937691f2
|
refs/heads/master
| 2021-05-15T07:25:15.874000 | 2017-11-22T09:51:27 | 2017-11-22T09:51:27 | 111,659,185 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tfs.irp.usermedal.service;
import java.util.Date;
import java.util.List;
import com.tfs.irp.usergoodslink.entity.IrpUserCovertGoods;
import com.tfs.irp.usermedal.entity.IrpUserMedal;
import com.tfs.irp.util.PageUtil;
public interface IrpUserMedalService {
/**
* 为用户添加勋章
* @param usermedal
* @return
*/
public int addUserMedal(IrpUserMedal userMedal);
/**
*删除用户勋章
* @param usermedalid
* @return
*/
public int deleteUserMedal(Long usermedalid);
/**
* 根据ID查询商用户勋章
* @param usermedalid
* @return
*/
public IrpUserMedal findUserMedalById(Long usermedalid);
/**
* 修改用户勋章
* @param userMedal
* @return
*/
public int updateUserMedalById(IrpUserMedal userMedal);
/**
* 列表显示所有用户勋章
* @param userMedal
* @return
*/
List<IrpUserMedal> showAllUserMedal(PageUtil pageUtil,String orderField,String orderBy);
List<IrpUserMedal> getUserMedalByUserid(PageUtil pageUtil,Long userid);
List<IrpUserMedal> listUserMedal(Long userid,Long medalid,Long medalstate);
/**
* 统计兑换记录
* @param goods
* @return
*/
public int countUserMedal();
public int countUserMedal(Long userid,Long goodsid,Long medalstate);
public int selectMedalid(Long goodsid);
public int countUserMedal(Long userid);
List<IrpUserMedal> findUserMedalOfPageSize(PageUtil pageUtil,
String _oOrderby,IrpUserMedal _userMedal,Date _starttime,Date _endtime);
List<IrpUserMedal> findUserMedalOfPage(PageUtil pageUtil,
String _oOrderby,IrpUserMedal _userMedal,Date _starttime,Date _endtime);
}
|
UTF-8
|
Java
| 1,682 |
java
|
IrpUserMedalService.java
|
Java
|
[] | null |
[] |
package com.tfs.irp.usermedal.service;
import java.util.Date;
import java.util.List;
import com.tfs.irp.usergoodslink.entity.IrpUserCovertGoods;
import com.tfs.irp.usermedal.entity.IrpUserMedal;
import com.tfs.irp.util.PageUtil;
public interface IrpUserMedalService {
/**
* 为用户添加勋章
* @param usermedal
* @return
*/
public int addUserMedal(IrpUserMedal userMedal);
/**
*删除用户勋章
* @param usermedalid
* @return
*/
public int deleteUserMedal(Long usermedalid);
/**
* 根据ID查询商用户勋章
* @param usermedalid
* @return
*/
public IrpUserMedal findUserMedalById(Long usermedalid);
/**
* 修改用户勋章
* @param userMedal
* @return
*/
public int updateUserMedalById(IrpUserMedal userMedal);
/**
* 列表显示所有用户勋章
* @param userMedal
* @return
*/
List<IrpUserMedal> showAllUserMedal(PageUtil pageUtil,String orderField,String orderBy);
List<IrpUserMedal> getUserMedalByUserid(PageUtil pageUtil,Long userid);
List<IrpUserMedal> listUserMedal(Long userid,Long medalid,Long medalstate);
/**
* 统计兑换记录
* @param goods
* @return
*/
public int countUserMedal();
public int countUserMedal(Long userid,Long goodsid,Long medalstate);
public int selectMedalid(Long goodsid);
public int countUserMedal(Long userid);
List<IrpUserMedal> findUserMedalOfPageSize(PageUtil pageUtil,
String _oOrderby,IrpUserMedal _userMedal,Date _starttime,Date _endtime);
List<IrpUserMedal> findUserMedalOfPage(PageUtil pageUtil,
String _oOrderby,IrpUserMedal _userMedal,Date _starttime,Date _endtime);
}
| 1,682 | 0.717064 | 0.717064 | 63 | 23.301588 | 24.603287 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.412698 | false | false |
0
|
4f443c5083fe9bfc1ee31bfe976851ed78a50cbf
| 22,368,189,727,778 |
88ae80380c1a2a5b760c62b4ab996c8349bbf2c7
|
/src/mmp-application/src/main/java/guru/mmp/application/security/ISecurityService.java
|
90b59bee0915a6d060e1685685431fdbf2119d18
|
[
"Apache-2.0"
] |
permissive
|
marcusportmann/mmp-java
|
https://github.com/marcusportmann/mmp-java
|
abfb83c48a406a295d836b4d43fbe14e6dc80a1b
|
97b347a00e4f6d1c003a144cfb08721ebfaeba97
|
refs/heads/master
| 2021-01-17T13:05:36.607000 | 2018-05-24T10:31:04 | 2018-05-24T10:31:04 | 58,325,716 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright 2017 Marcus Portmann
*
* 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 guru.mmp.application.security;
//~--- JDK imports ------------------------------------------------------------
import java.util.List;
import java.util.UUID;
/**
* The <code>ISecurityService</code> interface defines the functionality provided by a Security
* Service implementation, which manages the security related information for an application.
*
* @author Marcus Portmann
*/
public interface ISecurityService
{
/**
* Add the user to the group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
* @param groupName the name of the security group uniquely identifying the security group
*/
void addUserToGroup(UUID userDirectoryId, String username, String groupName)
throws UserDirectoryNotFoundException, UserNotFoundException, GroupNotFoundException,
SecurityException;
/**
* Administratively change the password for the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify
* the user directory
* @param username the username identifying the user
* @param newPassword the new password
* @param expirePassword expire the user's password
* @param lockUser lock the user
* @param resetPasswordHistory reset the user's password history
* @param reason the reason for changing the password
*/
void adminChangePassword(UUID userDirectoryId, String username, String newPassword,
boolean expirePassword, boolean lockUser, boolean resetPasswordHistory,
PasswordChangeReason reason)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Authenticate the user.
*
* @param username the username identifying the user
* @param password the password being used to authenticate
*
* @return the Universally Unique Identifier (UUID) used to uniquely identify the user directory
*/
UUID authenticate(String username, String password)
throws AuthenticationFailedException, UserLockedException, ExpiredPasswordException,
UserNotFoundException, SecurityException;
/**
* Change the password for the user.
*
* @param username the username identifying the user
* @param password the password for the user that is used to authorise the operation
* @param newPassword the new password
*
* @return the Universally Unique Identifier (UUID) used to uniquely identify the user directory
*/
UUID changePassword(String username, String password, String newPassword)
throws AuthenticationFailedException, UserLockedException, UserNotFoundException,
ExistingPasswordException, SecurityException;
/**
* Create a new authorised function.
*
* @param function the function
*/
void createFunction(Function function)
throws DuplicateFunctionException, SecurityException;
/**
* Create a new security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param group the security group
*/
void createGroup(UUID userDirectoryId, Group group)
throws UserDirectoryNotFoundException, DuplicateGroupException, SecurityException;
/**
* Create a new organisation.
*
* @param organisation the organisation
* @param createUserDirectory should a new internal user directory be created for the organisation
*
* @return the new internal user directory that was created for the organisation or
* <code>null</code> if no user directory was created
*/
UserDirectory createOrganisation(Organisation organisation, boolean createUserDirectory)
throws DuplicateOrganisationException, SecurityException;
/**
* Create a new user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param user the user
* @param expiredPassword create the user with its password expired
* @param userLocked create the user locked
*/
void createUser(UUID userDirectoryId, User user, boolean expiredPassword, boolean userLocked)
throws UserDirectoryNotFoundException, DuplicateUserException, SecurityException;
/**
* Create a new user directory.
*
* @param userDirectory the user directory
*/
void createUserDirectory(UserDirectory userDirectory)
throws SecurityException;
/**
* Delete the authorised function.
*
* @param code the code identifying the authorised function
*/
void deleteFunction(String code)
throws FunctionNotFoundException, SecurityException;
/**
* Delete the security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param groupName the name of the security group uniquely identifying the security group
*/
void deleteGroup(UUID userDirectoryId, String groupName)
throws UserDirectoryNotFoundException, GroupNotFoundException, ExistingGroupMembersException,
SecurityException;
/**
* Delete the organisation.
*
* @param id the Universally Unique Identifier (UUID) used to uniquely identify the organisation
*/
void deleteOrganisation(UUID id)
throws OrganisationNotFoundException, SecurityException;
/**
* Delete the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*/
void deleteUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Delete the user directory.
*
* @param id the Universally Unique Identifier (UUID) used to uniquely identify the user directory
*/
void deleteUserDirectory(UUID id)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the users matching the attribute criteria.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param attributes the attribute criteria used to select the users
*
* @return the list of users whose attributes match the attribute criteria
*/
List<User> findUsers(UUID userDirectoryId, List<Attribute> attributes)
throws UserDirectoryNotFoundException, InvalidAttributeException, SecurityException;
/**
* Retrieve the filtered list of organisations.
*
* @param filter the filter to apply to the organisations
*
* @return the filtered list of organisations
*/
List<Organisation> getFilteredOrganisations(String filter)
throws SecurityException;
/**
* Retrieve the filtered list of user directories.
*
* @param filter the filter to apply to the user directories
*
* @return the filtered list of user directories
*/
List<UserDirectory> getFilteredUserDirectories(String filter)
throws SecurityException;
/**
* Retrieve the filtered list of users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param filter the filter to apply to the users
*
* @return the filtered list of users
*/
List<User> getFilteredUsers(UUID userDirectoryId, String filter)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the authorised function.
*
* @param code the code identifying the function
*
* @return the authorised function
*/
Function getFunction(String code)
throws FunctionNotFoundException, SecurityException;
/**
* Retrieve the authorised function codes for the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*
* @return the list of authorised function codes for the user
*/
List<String> getFunctionCodesForUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Retrieve all the authorised functions.
*
* @return the list of authorised functions
*/
List<Function> getFunctions()
throws SecurityException;
/**
* Retrieve the security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param groupName the name of the security group uniquely identifying the security group
*
* @return the security group
*/
Group getGroup(UUID userDirectoryId, String groupName)
throws UserDirectoryNotFoundException, GroupNotFoundException, SecurityException;
/**
* Retrieve the security group names for the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*
* @return the security group names for the user
*/
List<String> getGroupNamesForUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Retrieve all the security groups.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the list of security groups
*/
List<Group> getGroups(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the security groups for the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*
* @return the security groups for the user
*/
List<Group> getGroupsForUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Retrieve the number of filtered organisations.
*
* @param filter the filter to apply to the organisations
*
* @return the number of filtered organisations
*/
int getNumberOfFilteredOrganisations(String filter)
throws SecurityException;
/**
* Retrieve the number of filtered user directories.
*
* @param filter the filter to apply to the user directories
*
* @return the number of filtered user directories
*/
int getNumberOfFilteredUserDirectories(String filter)
throws SecurityException;
/**
* Retrieve the number of filtered users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param filter the filter to apply to the users
*
* @return the number of filtered users
*/
int getNumberOfFilteredUsers(UUID userDirectoryId, String filter)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the number of security groups
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the number of security groups
*/
int getNumberOfGroups(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the number of organisations
*
* @return the number of organisations
*/
int getNumberOfOrganisations()
throws SecurityException;
/**
* Retrieve the number of user directories
*
* @return the number of user directories
*/
int getNumberOfUserDirectories()
throws SecurityException;
/**
* Retrieve the number of users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the number of users
*/
int getNumberOfUsers(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the organisation.
*
* @param id the Universally Unique Identifier (UUID) used to uniquely identify the organisation
*
* @return the organisation
*/
Organisation getOrganisation(UUID id)
throws OrganisationNotFoundException, SecurityException;
/**
* Retrieve the Universally Unique Identifiers (UUIDs) used to uniquely identify the organisations
* associated with the user directory.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the Universally Unique Identifiers (UUIDs) used to uniquely identify the organisations
* associated with the user directory
*/
List<UUID> getOrganisationIdsForUserDirectory(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the organisations.
*
* @return the list of organisations
*/
List<Organisation> getOrganisations()
throws SecurityException;
/**
* Retrieve the organisations associated with the user directory.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the organisations associated with the user directory
*/
List<Organisation> getOrganisationsForUserDirectory(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*
* @return the user
*/
User getUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Retrieve the user directories.
*
* @return the list of user directories
*/
List<UserDirectory> getUserDirectories()
throws SecurityException;
/**
* Retrieve the user directories the organisation is associated with.
*
* @param organisationId the Universally Unique Identifier (UUID) used to uniquely identify the
* organisation
*
* @return the user directories the organisation is associated with
*/
List<UserDirectory> getUserDirectoriesForOrganisation(UUID organisationId)
throws OrganisationNotFoundException, SecurityException;
/**
* Retrieve the user directory.
*
* @param id the Universally Unique Identifier (UUID) used to uniquely identify the user directory
*
* @return the user directory
*/
UserDirectory getUserDirectory(UUID id)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the Universally Unique Identifier (UUID) used to uniquely identify the user directory
* that the user with the specified username is associated with.
*
* @param username the username identifying the user
*
* @return the Universally Unique Identifier (UUID) used to uniquely identify the user directory
* that the user with the specified username is associated with or <code>null</code> if
* the user cannot be found
*/
UUID getUserDirectoryIdForUser(String username)
throws SecurityException;
/**
* Retrieve the user directory types.
*
* @return the user directory types
*/
List<UserDirectoryType> getUserDirectoryTypes()
throws SecurityException;
/**
* Retrieve all the users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the list of users
*/
List<User> getUsers(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Is the user in the security group?
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
* @param groupName the name of the security group uniquely identifying the security group
*
* @return <code>true</code> if the user is a member of the security group or <code>false</code>
* otherwise
*/
boolean isUserInGroup(UUID userDirectoryId, String username, String groupName)
throws UserDirectoryNotFoundException, UserNotFoundException, GroupNotFoundException,
SecurityException;
/**
* Reload the user directories.
*/
void reloadUserDirectories()
throws SecurityException;
/**
* Remove the user from the security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
* @param groupName the security group name
*/
void removeUserFromGroup(UUID userDirectoryId, String username, String groupName)
throws UserDirectoryNotFoundException, UserNotFoundException, GroupNotFoundException,
SecurityException;
/**
* Does the user directory support administering security groups.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return <code>true</code> if the user directory supports administering security groups or
* <code>false</code> otherwise
*/
boolean supportsGroupAdministration(UUID userDirectoryId)
throws UserDirectoryNotFoundException;
/**
* Does the user directory support administering users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return <code>true</code> if the user directory supports administering users or
* <code>false</code> otherwise
*/
boolean supportsUserAdministration(UUID userDirectoryId)
throws UserDirectoryNotFoundException;
/**
* Update the authorised function.
*
* @param function the function
*/
void updateFunction(Function function)
throws FunctionNotFoundException, SecurityException;
/**
* Update the security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param group the security group
*/
void updateGroup(UUID userDirectoryId, Group group)
throws UserDirectoryNotFoundException, GroupNotFoundException, SecurityException;
/**
* Update the organisation.
*
* @param organisation the organisation
*/
void updateOrganisation(Organisation organisation)
throws OrganisationNotFoundException, SecurityException;
/**
* Update the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param user the user
* @param expirePassword expire the user's password as part of the update
* @param lockUser lock the user as part of the update
*/
void updateUser(UUID userDirectoryId, User user, boolean expirePassword, boolean lockUser)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Update the user directory.
*
* @param userDirectory the user directory
*/
void updateUserDirectory(UserDirectory userDirectory)
throws UserDirectoryNotFoundException, SecurityException;
}
|
UTF-8
|
Java
| 20,713 |
java
|
ISecurityService.java
|
Java
|
[
{
"context": "/*\n * Copyright 2017 Marcus Portmann\n *\n * Licensed under the Apache License, Version ",
"end": 36,
"score": 0.9998170137405396,
"start": 21,
"tag": "NAME",
"value": "Marcus Portmann"
},
{
"context": "ated information for an application.\n *\n * @author Marcus Portmann\n */\npublic interface ISecurityService\n{\n /**\n ",
"end": 989,
"score": 0.9997266530990601,
"start": 974,
"tag": "NAME",
"value": "Marcus Portmann"
},
{
"context": " the user\n * @param newPassword the new password\n * @param expirePassword expire the user'",
"end": 1914,
"score": 0.5410880446434021,
"start": 1906,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
/*
* Copyright 2017 <NAME>
*
* 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 guru.mmp.application.security;
//~--- JDK imports ------------------------------------------------------------
import java.util.List;
import java.util.UUID;
/**
* The <code>ISecurityService</code> interface defines the functionality provided by a Security
* Service implementation, which manages the security related information for an application.
*
* @author <NAME>
*/
public interface ISecurityService
{
/**
* Add the user to the group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
* @param groupName the name of the security group uniquely identifying the security group
*/
void addUserToGroup(UUID userDirectoryId, String username, String groupName)
throws UserDirectoryNotFoundException, UserNotFoundException, GroupNotFoundException,
SecurityException;
/**
* Administratively change the password for the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify
* the user directory
* @param username the username identifying the user
* @param newPassword the new <PASSWORD>
* @param expirePassword expire the user's password
* @param lockUser lock the user
* @param resetPasswordHistory reset the user's password history
* @param reason the reason for changing the password
*/
void adminChangePassword(UUID userDirectoryId, String username, String newPassword,
boolean expirePassword, boolean lockUser, boolean resetPasswordHistory,
PasswordChangeReason reason)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Authenticate the user.
*
* @param username the username identifying the user
* @param password the password being used to authenticate
*
* @return the Universally Unique Identifier (UUID) used to uniquely identify the user directory
*/
UUID authenticate(String username, String password)
throws AuthenticationFailedException, UserLockedException, ExpiredPasswordException,
UserNotFoundException, SecurityException;
/**
* Change the password for the user.
*
* @param username the username identifying the user
* @param password the password for the user that is used to authorise the operation
* @param newPassword the new password
*
* @return the Universally Unique Identifier (UUID) used to uniquely identify the user directory
*/
UUID changePassword(String username, String password, String newPassword)
throws AuthenticationFailedException, UserLockedException, UserNotFoundException,
ExistingPasswordException, SecurityException;
/**
* Create a new authorised function.
*
* @param function the function
*/
void createFunction(Function function)
throws DuplicateFunctionException, SecurityException;
/**
* Create a new security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param group the security group
*/
void createGroup(UUID userDirectoryId, Group group)
throws UserDirectoryNotFoundException, DuplicateGroupException, SecurityException;
/**
* Create a new organisation.
*
* @param organisation the organisation
* @param createUserDirectory should a new internal user directory be created for the organisation
*
* @return the new internal user directory that was created for the organisation or
* <code>null</code> if no user directory was created
*/
UserDirectory createOrganisation(Organisation organisation, boolean createUserDirectory)
throws DuplicateOrganisationException, SecurityException;
/**
* Create a new user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param user the user
* @param expiredPassword create the user with its password expired
* @param userLocked create the user locked
*/
void createUser(UUID userDirectoryId, User user, boolean expiredPassword, boolean userLocked)
throws UserDirectoryNotFoundException, DuplicateUserException, SecurityException;
/**
* Create a new user directory.
*
* @param userDirectory the user directory
*/
void createUserDirectory(UserDirectory userDirectory)
throws SecurityException;
/**
* Delete the authorised function.
*
* @param code the code identifying the authorised function
*/
void deleteFunction(String code)
throws FunctionNotFoundException, SecurityException;
/**
* Delete the security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param groupName the name of the security group uniquely identifying the security group
*/
void deleteGroup(UUID userDirectoryId, String groupName)
throws UserDirectoryNotFoundException, GroupNotFoundException, ExistingGroupMembersException,
SecurityException;
/**
* Delete the organisation.
*
* @param id the Universally Unique Identifier (UUID) used to uniquely identify the organisation
*/
void deleteOrganisation(UUID id)
throws OrganisationNotFoundException, SecurityException;
/**
* Delete the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*/
void deleteUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Delete the user directory.
*
* @param id the Universally Unique Identifier (UUID) used to uniquely identify the user directory
*/
void deleteUserDirectory(UUID id)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the users matching the attribute criteria.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param attributes the attribute criteria used to select the users
*
* @return the list of users whose attributes match the attribute criteria
*/
List<User> findUsers(UUID userDirectoryId, List<Attribute> attributes)
throws UserDirectoryNotFoundException, InvalidAttributeException, SecurityException;
/**
* Retrieve the filtered list of organisations.
*
* @param filter the filter to apply to the organisations
*
* @return the filtered list of organisations
*/
List<Organisation> getFilteredOrganisations(String filter)
throws SecurityException;
/**
* Retrieve the filtered list of user directories.
*
* @param filter the filter to apply to the user directories
*
* @return the filtered list of user directories
*/
List<UserDirectory> getFilteredUserDirectories(String filter)
throws SecurityException;
/**
* Retrieve the filtered list of users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param filter the filter to apply to the users
*
* @return the filtered list of users
*/
List<User> getFilteredUsers(UUID userDirectoryId, String filter)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the authorised function.
*
* @param code the code identifying the function
*
* @return the authorised function
*/
Function getFunction(String code)
throws FunctionNotFoundException, SecurityException;
/**
* Retrieve the authorised function codes for the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*
* @return the list of authorised function codes for the user
*/
List<String> getFunctionCodesForUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Retrieve all the authorised functions.
*
* @return the list of authorised functions
*/
List<Function> getFunctions()
throws SecurityException;
/**
* Retrieve the security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param groupName the name of the security group uniquely identifying the security group
*
* @return the security group
*/
Group getGroup(UUID userDirectoryId, String groupName)
throws UserDirectoryNotFoundException, GroupNotFoundException, SecurityException;
/**
* Retrieve the security group names for the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*
* @return the security group names for the user
*/
List<String> getGroupNamesForUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Retrieve all the security groups.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the list of security groups
*/
List<Group> getGroups(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the security groups for the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*
* @return the security groups for the user
*/
List<Group> getGroupsForUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Retrieve the number of filtered organisations.
*
* @param filter the filter to apply to the organisations
*
* @return the number of filtered organisations
*/
int getNumberOfFilteredOrganisations(String filter)
throws SecurityException;
/**
* Retrieve the number of filtered user directories.
*
* @param filter the filter to apply to the user directories
*
* @return the number of filtered user directories
*/
int getNumberOfFilteredUserDirectories(String filter)
throws SecurityException;
/**
* Retrieve the number of filtered users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param filter the filter to apply to the users
*
* @return the number of filtered users
*/
int getNumberOfFilteredUsers(UUID userDirectoryId, String filter)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the number of security groups
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the number of security groups
*/
int getNumberOfGroups(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the number of organisations
*
* @return the number of organisations
*/
int getNumberOfOrganisations()
throws SecurityException;
/**
* Retrieve the number of user directories
*
* @return the number of user directories
*/
int getNumberOfUserDirectories()
throws SecurityException;
/**
* Retrieve the number of users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the number of users
*/
int getNumberOfUsers(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the organisation.
*
* @param id the Universally Unique Identifier (UUID) used to uniquely identify the organisation
*
* @return the organisation
*/
Organisation getOrganisation(UUID id)
throws OrganisationNotFoundException, SecurityException;
/**
* Retrieve the Universally Unique Identifiers (UUIDs) used to uniquely identify the organisations
* associated with the user directory.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the Universally Unique Identifiers (UUIDs) used to uniquely identify the organisations
* associated with the user directory
*/
List<UUID> getOrganisationIdsForUserDirectory(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the organisations.
*
* @return the list of organisations
*/
List<Organisation> getOrganisations()
throws SecurityException;
/**
* Retrieve the organisations associated with the user directory.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the organisations associated with the user directory
*/
List<Organisation> getOrganisationsForUserDirectory(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
*
* @return the user
*/
User getUser(UUID userDirectoryId, String username)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Retrieve the user directories.
*
* @return the list of user directories
*/
List<UserDirectory> getUserDirectories()
throws SecurityException;
/**
* Retrieve the user directories the organisation is associated with.
*
* @param organisationId the Universally Unique Identifier (UUID) used to uniquely identify the
* organisation
*
* @return the user directories the organisation is associated with
*/
List<UserDirectory> getUserDirectoriesForOrganisation(UUID organisationId)
throws OrganisationNotFoundException, SecurityException;
/**
* Retrieve the user directory.
*
* @param id the Universally Unique Identifier (UUID) used to uniquely identify the user directory
*
* @return the user directory
*/
UserDirectory getUserDirectory(UUID id)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Retrieve the Universally Unique Identifier (UUID) used to uniquely identify the user directory
* that the user with the specified username is associated with.
*
* @param username the username identifying the user
*
* @return the Universally Unique Identifier (UUID) used to uniquely identify the user directory
* that the user with the specified username is associated with or <code>null</code> if
* the user cannot be found
*/
UUID getUserDirectoryIdForUser(String username)
throws SecurityException;
/**
* Retrieve the user directory types.
*
* @return the user directory types
*/
List<UserDirectoryType> getUserDirectoryTypes()
throws SecurityException;
/**
* Retrieve all the users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return the list of users
*/
List<User> getUsers(UUID userDirectoryId)
throws UserDirectoryNotFoundException, SecurityException;
/**
* Is the user in the security group?
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
* @param groupName the name of the security group uniquely identifying the security group
*
* @return <code>true</code> if the user is a member of the security group or <code>false</code>
* otherwise
*/
boolean isUserInGroup(UUID userDirectoryId, String username, String groupName)
throws UserDirectoryNotFoundException, UserNotFoundException, GroupNotFoundException,
SecurityException;
/**
* Reload the user directories.
*/
void reloadUserDirectories()
throws SecurityException;
/**
* Remove the user from the security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param username the username identifying the user
* @param groupName the security group name
*/
void removeUserFromGroup(UUID userDirectoryId, String username, String groupName)
throws UserDirectoryNotFoundException, UserNotFoundException, GroupNotFoundException,
SecurityException;
/**
* Does the user directory support administering security groups.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return <code>true</code> if the user directory supports administering security groups or
* <code>false</code> otherwise
*/
boolean supportsGroupAdministration(UUID userDirectoryId)
throws UserDirectoryNotFoundException;
/**
* Does the user directory support administering users.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
*
* @return <code>true</code> if the user directory supports administering users or
* <code>false</code> otherwise
*/
boolean supportsUserAdministration(UUID userDirectoryId)
throws UserDirectoryNotFoundException;
/**
* Update the authorised function.
*
* @param function the function
*/
void updateFunction(Function function)
throws FunctionNotFoundException, SecurityException;
/**
* Update the security group.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param group the security group
*/
void updateGroup(UUID userDirectoryId, Group group)
throws UserDirectoryNotFoundException, GroupNotFoundException, SecurityException;
/**
* Update the organisation.
*
* @param organisation the organisation
*/
void updateOrganisation(Organisation organisation)
throws OrganisationNotFoundException, SecurityException;
/**
* Update the user.
*
* @param userDirectoryId the Universally Unique Identifier (UUID) used to uniquely identify the
* user directory
* @param user the user
* @param expirePassword expire the user's password as part of the update
* @param lockUser lock the user as part of the update
*/
void updateUser(UUID userDirectoryId, User user, boolean expirePassword, boolean lockUser)
throws UserDirectoryNotFoundException, UserNotFoundException, SecurityException;
/**
* Update the user directory.
*
* @param userDirectory the user directory
*/
void updateUserDirectory(UserDirectory userDirectory)
throws UserDirectoryNotFoundException, SecurityException;
}
| 20,697 | 0.706416 | 0.70603 | 589 | 34.166382 | 31.920416 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.271647 | false | false |
0
|
7f9e4eed6b5fed4ee18e572d2a52d5f9f2eb9288
| 24,541,443,145,967 |
5b5ddfcf497644505fb2ef5e4c84ff33dfaa6177
|
/boats/src/exceptions/ErrorCode.java
|
1edf87780a88baf8816a59ae1ef8dfd7f2f96d70
|
[] |
no_license
|
henriqueleote/projeto-poo-prof-luis-casaca-lc-05-projeto
|
https://github.com/henriqueleote/projeto-poo-prof-luis-casaca-lc-05-projeto
|
92267b130de4d15cc132ca463386f6084e438f08
|
819f680570aabbdf88acf1c574c035dd9482fbec
|
refs/heads/main
| 2023-07-06T09:27:16.674000 | 2021-06-28T21:17:30 | 2021-06-28T21:17:30 | 353,057,846 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package exceptions;
/**
*
* @author Leote (200221060)
*/
public enum ErrorCode {
ARRAY_CANT_BE_NEGATIVE, //Erro nº1
NICKNAME_ALREADY_EXISTS, //Erro nº2
NICKNAME_DOESNT_EXIST, //Erro nº3
BOAT_CANT_POSITION,POSITION_OCCUPIED, //Erro nº4
NO_WATER_UNKNOWN, //Erro nº5
NO_FUNCTION; //Erro nº6
@Override
public String toString() {
switch (this) {
case NICKNAME_ALREADY_EXISTS:
return "O nickname inserido já se encontra em uso.";
case NICKNAME_DOESNT_EXIST:
return "Não existe nenhum utilizador com o nickname inserido.";
case BOAT_CANT_POSITION:
return "Não pode colocar um barco nessa posição.";
case POSITION_OCCUPIED:
return "Essa posição já se encontra ocupada.";
case NO_WATER_UNKNOWN:
return "Não pode colocar agua num lugar que não se encontra desconhecido.";
case NO_FUNCTION:
return "Funcionalidade indisponivel. Obrigado.";
default:
return "Desconhecido";
}
}
}
|
UTF-8
|
Java
| 1,456 |
java
|
ErrorCode.java
|
Java
|
[
{
"context": "package exceptions;\n\n/**\n *\n * @author Leote (200221060)\n */\npublic enum ErrorCode {\n \n ",
"end": 44,
"score": 0.975495457649231,
"start": 39,
"tag": "USERNAME",
"value": "Leote"
}
] | null |
[] |
package exceptions;
/**
*
* @author Leote (200221060)
*/
public enum ErrorCode {
ARRAY_CANT_BE_NEGATIVE, //Erro nº1
NICKNAME_ALREADY_EXISTS, //Erro nº2
NICKNAME_DOESNT_EXIST, //Erro nº3
BOAT_CANT_POSITION,POSITION_OCCUPIED, //Erro nº4
NO_WATER_UNKNOWN, //Erro nº5
NO_FUNCTION; //Erro nº6
@Override
public String toString() {
switch (this) {
case NICKNAME_ALREADY_EXISTS:
return "O nickname inserido já se encontra em uso.";
case NICKNAME_DOESNT_EXIST:
return "Não existe nenhum utilizador com o nickname inserido.";
case BOAT_CANT_POSITION:
return "Não pode colocar um barco nessa posição.";
case POSITION_OCCUPIED:
return "Essa posição já se encontra ocupada.";
case NO_WATER_UNKNOWN:
return "Não pode colocar agua num lugar que não se encontra desconhecido.";
case NO_FUNCTION:
return "Funcionalidade indisponivel. Obrigado.";
default:
return "Desconhecido";
}
}
}
| 1,456 | 0.459722 | 0.449306 | 35 | 40.142857 | 32.347351 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
0
|
e3c9d73649d71bf2f41085eb69bd77026ea223c5
| 25,786,983,647,450 |
3cfe977e449c3ef9164bce6e87d3bcc927e171ce
|
/test/com/xbockr/dr/filesystem/FileSystemTest.java
|
c36c2ecedc995040477ce5f1898291a084694c1f
|
[] |
no_license
|
yk/softwareengineeringhs12
|
https://github.com/yk/softwareengineeringhs12
|
707dc339f41e66653e63afa7033b7e7cc27cdf99
|
6d395b8b855ca154827398b60aec45cc166a4bd8
|
refs/heads/master
| 2021-01-10T01:15:32.201000 | 2013-02-24T00:25:19 | 2013-02-24T00:25:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xbockr.dr.filesystem;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileWriter;
import java.util.Arrays;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.xbockr.dr.filesystem.FileSystem.FSException;
public class FileSystemTest {
private final static File tmpFolder = new File("./tmp"), file1 = new File(
tmpFolder, "f1.txt"), file2 = new File(tmpFolder, "f2.txt"),
folder = new File(tmpFolder, "folder"), fileInFolder = new File(
folder, "fileInFolder.txt");
@Before
public void setUp() throws Exception {
folder.mkdirs();
for (File f : new File[] { file1, file2, fileInFolder }) {
FileWriter fw = new FileWriter(f);
fw.write("This is file content in file " + f.getName());
fw.close();
}
}
@After
public void tearDown() throws Exception {
FileUtils.deleteDirectory(tmpFolder);
}
@Test
public void testMove() throws FSException {
File f1 = new File(folder, "f1.txt");
File f2 = new File(file1.getAbsolutePath());
assertFalse(f1.exists());
assertTrue(f2.exists());
new FileSystem(tmpFolder).move(file1, folder);
assertTrue(f1.exists());
assertFalse(f2.exists());
}
@Test
public void testCopy() throws FSException {
File f1 = new File(folder, "f1.txt");
File f2 = new File(file1.getAbsolutePath());
assertFalse(f1.exists());
assertTrue(f2.exists());
new FileSystem(tmpFolder).copy(file1, folder);
assertTrue(f1.exists());
assertTrue(f2.exists());
}
@Test(expected=FSException.class)
public void testMoveInexistentFile() throws FSException{
new FileSystem(tmpFolder).move(new File("./asdfijf/afysd/hsh"), folder);
}
@Test
public void testMoveFolder() throws FSException{
File newFolder = new File(tmpFolder,"newFolder");
assertTrue(!newFolder.exists());
new FileSystem(tmpFolder).move(folder, newFolder);
assertTrue(newFolder.exists());
assertFalse(folder.exists());
assertTrue(Arrays.asList(new File(newFolder,"folder").list()).contains("fileInFolder.txt"));
}
@Test
public void testGetStuff(){
assertEquals(45L,new FileSystem(tmpFolder).getSize(folder).longValue());
assertEquals("folder",new FileSystem(tmpFolder).getOriginalName(folder));
assertEquals(1L,new FileSystem(tmpFolder).getNumberOfFiles(folder).longValue());
}
@Test
public void testDelete(){
assertTrue(fileInFolder.exists());
new FileSystem(tmpFolder).delete(folder);
assertFalse(fileInFolder.exists());
}
}
|
UTF-8
|
Java
| 2,606 |
java
|
FileSystemTest.java
|
Java
|
[] | null |
[] |
package com.xbockr.dr.filesystem;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileWriter;
import java.util.Arrays;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.xbockr.dr.filesystem.FileSystem.FSException;
public class FileSystemTest {
private final static File tmpFolder = new File("./tmp"), file1 = new File(
tmpFolder, "f1.txt"), file2 = new File(tmpFolder, "f2.txt"),
folder = new File(tmpFolder, "folder"), fileInFolder = new File(
folder, "fileInFolder.txt");
@Before
public void setUp() throws Exception {
folder.mkdirs();
for (File f : new File[] { file1, file2, fileInFolder }) {
FileWriter fw = new FileWriter(f);
fw.write("This is file content in file " + f.getName());
fw.close();
}
}
@After
public void tearDown() throws Exception {
FileUtils.deleteDirectory(tmpFolder);
}
@Test
public void testMove() throws FSException {
File f1 = new File(folder, "f1.txt");
File f2 = new File(file1.getAbsolutePath());
assertFalse(f1.exists());
assertTrue(f2.exists());
new FileSystem(tmpFolder).move(file1, folder);
assertTrue(f1.exists());
assertFalse(f2.exists());
}
@Test
public void testCopy() throws FSException {
File f1 = new File(folder, "f1.txt");
File f2 = new File(file1.getAbsolutePath());
assertFalse(f1.exists());
assertTrue(f2.exists());
new FileSystem(tmpFolder).copy(file1, folder);
assertTrue(f1.exists());
assertTrue(f2.exists());
}
@Test(expected=FSException.class)
public void testMoveInexistentFile() throws FSException{
new FileSystem(tmpFolder).move(new File("./asdfijf/afysd/hsh"), folder);
}
@Test
public void testMoveFolder() throws FSException{
File newFolder = new File(tmpFolder,"newFolder");
assertTrue(!newFolder.exists());
new FileSystem(tmpFolder).move(folder, newFolder);
assertTrue(newFolder.exists());
assertFalse(folder.exists());
assertTrue(Arrays.asList(new File(newFolder,"folder").list()).contains("fileInFolder.txt"));
}
@Test
public void testGetStuff(){
assertEquals(45L,new FileSystem(tmpFolder).getSize(folder).longValue());
assertEquals("folder",new FileSystem(tmpFolder).getOriginalName(folder));
assertEquals(1L,new FileSystem(tmpFolder).getNumberOfFiles(folder).longValue());
}
@Test
public void testDelete(){
assertTrue(fileInFolder.exists());
new FileSystem(tmpFolder).delete(folder);
assertFalse(fileInFolder.exists());
}
}
| 2,606 | 0.724482 | 0.714121 | 92 | 27.326086 | 23.453056 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.923913 | false | false |
0
|
9406d88ed11922ad06233df885dc65f345a60dd6
| 20,512,763,807,582 |
7d01ac5cfb79c7772c5d204ac131df1116ecf799
|
/src/test/java/com/david/guava/concurrency/TestConcurrency.java
|
620f929116d17a5564ff741024b61a1bac90c8b6
|
[] |
no_license
|
davidelena/concurrency-study
|
https://github.com/davidelena/concurrency-study
|
d0e7913675b502bc99529d3be8aba60b746a95be
|
1a1d60a4a02e57276b942edaf95f5f3a2d97e734
|
refs/heads/master
| 2022-05-01T17:22:07.579000 | 2018-08-18T09:28:00 | 2018-08-18T09:28:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.david.guava.concurrency;
import static org.junit.Assert.*;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import org.junit.Test;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
public class TestConcurrency {
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final Logger logger = Logger.getLogger(TestConcurrency.class);
@Test
public void testListenableExecutorService() {
ListeningExecutorService service = MoreExecutors
.listeningDecorator(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));
service.execute(new Runnable() {
@Override
public void run() {
System.out.println("execute action: " + sdf.format(new Date()));
}
});
}
@Test
public void testListenableFuture() {
ListeningExecutorService service = MoreExecutors
.listeningDecorator(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));
ListenableFuture<String> future = service.submit(new Callable<String>() {
@Override
public String call() throws Exception {
String result = sdf.format(new Date());
System.out.println("result: " + result);
return result;
}
});
Futures.addCallback(future, new FutureCallback<String>() {
@Override
public void onFailure(Throwable ex) {
logger.error(ex.getMessage(), ex);
}
@Override
public void onSuccess(String message) {
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
System.out.println("deal with callback value: " + message);
}
});
}
}
|
UTF-8
|
Java
| 2,049 |
java
|
TestConcurrency.java
|
Java
|
[] | null |
[] |
package com.david.guava.concurrency;
import static org.junit.Assert.*;
import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import org.junit.Test;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
public class TestConcurrency {
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final Logger logger = Logger.getLogger(TestConcurrency.class);
@Test
public void testListenableExecutorService() {
ListeningExecutorService service = MoreExecutors
.listeningDecorator(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));
service.execute(new Runnable() {
@Override
public void run() {
System.out.println("execute action: " + sdf.format(new Date()));
}
});
}
@Test
public void testListenableFuture() {
ListeningExecutorService service = MoreExecutors
.listeningDecorator(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()));
ListenableFuture<String> future = service.submit(new Callable<String>() {
@Override
public String call() throws Exception {
String result = sdf.format(new Date());
System.out.println("result: " + result);
return result;
}
});
Futures.addCallback(future, new FutureCallback<String>() {
@Override
public void onFailure(Throwable ex) {
logger.error(ex.getMessage(), ex);
}
@Override
public void onSuccess(String message) {
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
System.out.println("deal with callback value: " + message);
}
});
}
}
| 2,049 | 0.743289 | 0.742313 | 73 | 27.068493 | 26.249763 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.013699 | false | false |
0
|
95b7101b01297631d02d581149e18fd398a34f9e
| 15,032,385,591,403 |
f3937ca46015bc8e2103432471967ad47b987b61
|
/week_1/2-OOP/Cars/src/Mercedes.java
|
7053a6a97ba2b91ec293d947bb1b22a1a2902e4b
|
[] |
no_license
|
markov94ggiz/myrepo
|
https://github.com/markov94ggiz/myrepo
|
7a963746414373c30ab020cd2313167fdf961d49
|
a33c471575a59820b6535d8dc0e453008822a7ca
|
refs/heads/master
| 2015-08-17T07:43:06.870000 | 2015-05-22T10:33:22 | 2015-05-22T10:33:22 | 27,198,635 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Mercedes extends Car{
Mercedes(String model){
super(model);
}
}
|
UTF-8
|
Java
| 94 |
java
|
Mercedes.java
|
Java
|
[] | null |
[] |
public class Mercedes extends Car{
Mercedes(String model){
super(model);
}
}
| 94 | 0.617021 | 0.617021 | 5 | 17.6 | 12.674383 | 34 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
0
|
261f3dc0b201aa375b964c1741c1e412c7a0e1d7
| 23,983,097,446,810 |
86130b338a15daa569e1a73f2666faafe3d75543
|
/evslab1/src/com/company/Main.java
|
bc5632ac8266d06d0749f2103f01fd452a44eee4
|
[] |
no_license
|
Olivievs/university
|
https://github.com/Olivievs/university
|
2ef47b7992a279da025f6160a926fdf3d88bf603
|
e52d314e6380801f51b7772c27ea0e38bd1eff3a
|
refs/heads/master
| 2020-12-15T13:50:22.665000 | 2020-12-13T19:22:03 | 2020-12-13T19:22:03 | 235,124,095 | 0 | 0 | null | false | 2020-11-14T23:53:57 | 2020-01-20T14:44:34 | 2020-11-14T23:53:35 | 2020-11-14T23:53:56 | 108 | 0 | 0 | 1 |
Java
| false | false |
package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
List list = new List();
list.addElem();
list.addElem();
list.addElem();
list.output();
list.delElem(2);
list.output();
}
}
|
UTF-8
|
Java
| 310 |
java
|
Main.java
|
Java
|
[] | null |
[] |
package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
List list = new List();
list.addElem();
list.addElem();
list.addElem();
list.output();
list.delElem(2);
list.output();
}
}
| 310 | 0.525806 | 0.522581 | 14 | 20.142857 | 11.211329 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.642857 | false | false |
0
|
f7df8b230e8caccdf855c8544dd6101e2deb4041
| 3,745,211,502,915 |
ef2086b0f2675afffae9a4b2aa296f0bea3edeac
|
/app/src/main/java/com/example/earth/fuelfriend/StatisticsHelper.java
|
316ae0b64a0a25973d54a470950b21cb9654d87f
|
[] |
no_license
|
hyperdrive3/FuelFriend
|
https://github.com/hyperdrive3/FuelFriend
|
9790d9af8df6a7468fb684ad851346dd4c713a70
|
6c72144320d930e19ab029e512057d1187ccd02d
|
refs/heads/master
| 2021-01-15T22:46:27.631000 | 2018-04-01T13:16:40 | 2018-04-01T13:16:40 | 99,913,468 | 0 | 0 | null | false | 2017-09-06T09:07:17 | 2017-08-10T10:56:30 | 2017-08-22T09:09:08 | 2017-09-06T09:07:17 | 3,282 | 0 | 0 | 22 |
Java
| null | null |
package com.example.earth.fuelfriend;
import android.content.Context;
import java.util.ArrayList;
/**
* Created by EARTH on 4/09/2017.
*/
public class StatisticsHelper {
DBHelper dbHelper;
ArrayList<String> transport;
ArrayList<CustomMarker> markers;
public StatisticsHelper(Context context) {
dbHelper = new DBHelper(context);
transport = dbHelper.getAllTransport();
markers = dbHelper.getAllMarkers();
}
public double getFuelUsage(CustomMarker cm) {
String[] vehicle = cm.getVehicle().split(",");
double distance = cm.getDistance();
return distance * Double.valueOf(vehicle[0]) / 100;
}
public double getTotalTransportFuelUsage(String transport) {
double totalFuel = 0;
for (CustomMarker cm : markers) {
if (cm.getTransportMode().equals(transport)) {
totalFuel += getFuelUsage(cm);
}
}
return totalFuel;
}
public double getTotalTransportDistance(String transport) {
double totalDistance = 0;
for (CustomMarker cm : markers) {
if (cm.getTransportMode().equals(transport)) {
totalDistance += cm.getDistance();
}
}
return totalDistance;
}
public double getCarLongestDistance() {
return 0;
}
public double getBikeLongestDistance() {
return 0;
}
public double getWalkLongestDistance() {
return 0;
}
public double getMostFuelConsumingCar() {
return 0;
}
}
|
UTF-8
|
Java
| 1,581 |
java
|
StatisticsHelper.java
|
Java
|
[
{
"context": "t;\n\nimport java.util.ArrayList;\n\n/**\n * Created by EARTH on 4/09/2017.\n */\n\npublic class StatisticsHelper ",
"end": 124,
"score": 0.9908872246742249,
"start": 119,
"tag": "USERNAME",
"value": "EARTH"
}
] | null |
[] |
package com.example.earth.fuelfriend;
import android.content.Context;
import java.util.ArrayList;
/**
* Created by EARTH on 4/09/2017.
*/
public class StatisticsHelper {
DBHelper dbHelper;
ArrayList<String> transport;
ArrayList<CustomMarker> markers;
public StatisticsHelper(Context context) {
dbHelper = new DBHelper(context);
transport = dbHelper.getAllTransport();
markers = dbHelper.getAllMarkers();
}
public double getFuelUsage(CustomMarker cm) {
String[] vehicle = cm.getVehicle().split(",");
double distance = cm.getDistance();
return distance * Double.valueOf(vehicle[0]) / 100;
}
public double getTotalTransportFuelUsage(String transport) {
double totalFuel = 0;
for (CustomMarker cm : markers) {
if (cm.getTransportMode().equals(transport)) {
totalFuel += getFuelUsage(cm);
}
}
return totalFuel;
}
public double getTotalTransportDistance(String transport) {
double totalDistance = 0;
for (CustomMarker cm : markers) {
if (cm.getTransportMode().equals(transport)) {
totalDistance += cm.getDistance();
}
}
return totalDistance;
}
public double getCarLongestDistance() {
return 0;
}
public double getBikeLongestDistance() {
return 0;
}
public double getWalkLongestDistance() {
return 0;
}
public double getMostFuelConsumingCar() {
return 0;
}
}
| 1,581 | 0.607843 | 0.59709 | 78 | 19.26923 | 20.643911 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294872 | false | false |
0
|
0dac385450603a879c1df160de49749c639e9005
| 2,327,872,322,326 |
1c066abaa71b1eba7bcfb8ba548c2394660df817
|
/app/src/main/java/com/pine/populay_options/mvp/model/di/component/HomeFragmentComponent.java
|
5fb0296a7af5157dce7cafabf883907260a4864a
|
[] |
no_license
|
OuYang-Single/populay_options
|
https://github.com/OuYang-Single/populay_options
|
89070909c5693e4ca9307501c721083aa84bbc57
|
7713787ebc1a30c34aeb0e34225e5c95b41d36e0
|
refs/heads/master
| 2023-02-18T22:11:39.276000 | 2021-01-19T20:17:04 | 2021-01-19T20:17:04 | 313,711,163 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.pine.populay_options.mvp.model.di.component;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.di.scope.ActivityScope;
import com.pine.populay_options.mvp.model.di.module.ForgetPasswordModule;
import com.pine.populay_options.mvp.model.di.module.HomeFragmentModule;
import com.pine.populay_options.mvp.model.mvp.contract.ForgetPasswordContract;
import com.pine.populay_options.mvp.model.mvp.contract.HomeFragmentContract;
import com.pine.populay_options.mvp.model.mvp.ui.activity.ForgetPasswordActivity;
import com.pine.populay_options.mvp.model.mvp.ui.fragment.HomeFragment;
import dagger.BindsInstance;
import dagger.Component;
@ActivityScope
@Component(modules = HomeFragmentModule.class, dependencies = AppComponent.class)
public interface HomeFragmentComponent {
void inject(HomeFragment activity);
@Component.Builder
interface Builder {
@BindsInstance
HomeFragmentComponent.Builder view(HomeFragmentContract.View view);
HomeFragmentComponent.Builder appComponent(AppComponent appComponent);
HomeFragmentComponent build();
}
}
|
UTF-8
|
Java
| 1,116 |
java
|
HomeFragmentComponent.java
|
Java
|
[] | null |
[] |
package com.pine.populay_options.mvp.model.di.component;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.di.scope.ActivityScope;
import com.pine.populay_options.mvp.model.di.module.ForgetPasswordModule;
import com.pine.populay_options.mvp.model.di.module.HomeFragmentModule;
import com.pine.populay_options.mvp.model.mvp.contract.ForgetPasswordContract;
import com.pine.populay_options.mvp.model.mvp.contract.HomeFragmentContract;
import com.pine.populay_options.mvp.model.mvp.ui.activity.ForgetPasswordActivity;
import com.pine.populay_options.mvp.model.mvp.ui.fragment.HomeFragment;
import dagger.BindsInstance;
import dagger.Component;
@ActivityScope
@Component(modules = HomeFragmentModule.class, dependencies = AppComponent.class)
public interface HomeFragmentComponent {
void inject(HomeFragment activity);
@Component.Builder
interface Builder {
@BindsInstance
HomeFragmentComponent.Builder view(HomeFragmentContract.View view);
HomeFragmentComponent.Builder appComponent(AppComponent appComponent);
HomeFragmentComponent build();
}
}
| 1,116 | 0.806452 | 0.806452 | 30 | 36.233334 | 30.354223 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false |
0
|
f8d5106abb1291ce774ec8cc7441db460d91123f
| 34,282,428,961,962 |
e720107c6a002f5b94055d4433d8bd94cbd9752c
|
/src/main/java/duber/engine/GameEngine.java
|
6ba7e0f490f8dcb7c210b678cf8eebf9114b46e1
|
[] |
no_license
|
lnfernal/duberant
|
https://github.com/lnfernal/duberant
|
7ac4600a364c2239e8c844bbe5f911dd9dd08ce4
|
80a73641323558fcd44a829ceac494bcaa31f0cd
|
refs/heads/master
| 2023-04-11T22:55:28.523000 | 2021-04-30T00:39:06 | 2021-04-30T00:39:06 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package duber.engine;
import duber.engine.exceptions.LWJGLException;
import duber.engine.utilities.Timer;
/**
* A game engine used to run a game loop.
*/
public final class GameEngine implements Runnable, Cleansable {
/** The target frames per second to acheive. */
private static final int TARGET_FPS = 60;
/** The target updates per second to achieve. */
private static final int TARGET_UPS = 30;
/**
* The title of the game.
*/
String gameTitle;
/** The window used to display the game. */
private final Window window;
/** The timer used for the game loop. */
private final Timer updateTimer;
/** The GameLogic used to run the game. */
private final GameLogic gameLogic;
/** The Timer used to calculate the frames per second. */
private final Timer fpsTimer;
/** The number of frames per second of the game. */
private int fps;
/** The interpolation factor of the render. */
private float interpolationFactor;
/**
* Constructs a GameEngine.
* @param gameTitle the title of the game and the initial title of the window.
* @param width the width of the window
* @param height the height of the window
* @param gameLogic the game running in the GameEngine
*/
public GameEngine(String gameTitle, int width, int height, GameLogic gameLogic) {
this.gameTitle = gameTitle;
this.gameLogic = gameLogic;
gameLogic.setGameEngine(this);
window = new Window(gameTitle, width, height);
updateTimer = new Timer();
fps = 0;
fpsTimer = new Timer();
}
/**
* Gets the interpolation factor.
* @return the interpolation factor
*/
public float getInterpolationFactor() {
return interpolationFactor;
}
/**
* Runs the game loop
*/
@Override
public void run() {
try {
init();
gameLoop();
} catch (LWJGLException lwjgle) {
lwjgle.printStackTrace();
} finally {
cleanup();
}
System.exit(0);
}
/**
* Initializes the GameEngine when it runs.
* @throws LWJGLException if the GameEngine could not be initialized
*/
private void init() throws LWJGLException {
gameLogic.init(window);
}
/**
* The game loop that constantly updates and renders the game.
*/
private void gameLoop() {
float elapsedTime;
float accumulator = 0f;
float interval = 1.0f/TARGET_UPS;
while(!window.shouldClose()) {
elapsedTime = Math.min(0.25f, updateTimer.getElapsedTimeAndUpdate());
accumulator += elapsedTime;
//Get any input
//Calculate updates in the scene
while(accumulator >= interval) {
update();
accumulator -= interval;
}
interpolationFactor = accumulator/interval;
render();
if (!window.optionIsTurnedOn(Window.Options.ENABLE_VSYNC)) {
sync();
}
}
}
/**
* Syncs the game so that there are no extra renders.
*/
private void sync() {
float loopSlot = 1.0f/TARGET_FPS;
double endTime = updateTimer.getLastRecordedTime() + loopSlot;
while(updateTimer.getTime() < endTime) {
try {
Thread.sleep(1);
} catch (InterruptedException ie) {
ie.printStackTrace();
Thread.currentThread().interrupt();
}
}
}
/**
* Updates the game
*/
public void update() {
gameLogic.update();
}
/**
* Calculates and displays the frames per second.
*/
private void calculateAndDisplayFps() {
if (fpsTimer.secondHasPassed()) {
fpsTimer.getElapsedTimeAndUpdate();
if (window.optionIsTurnedOn(Window.Options.DISPLAY_FPS)) {
window.setTitle(gameTitle + " - " + fps + " FPS");
}
fps = 0;
}
fps++;
}
/**
* Renders the game.
*/
public void render() {
window.clear();
calculateAndDisplayFps();
gameLogic.render();
window.update();
}
/**
* {@inheritDoc}
*/
@Override
public void cleanup() {
gameLogic.cleanup();
}
}
|
UTF-8
|
Java
| 4,477 |
java
|
GameEngine.java
|
Java
|
[] | null |
[] |
package duber.engine;
import duber.engine.exceptions.LWJGLException;
import duber.engine.utilities.Timer;
/**
* A game engine used to run a game loop.
*/
public final class GameEngine implements Runnable, Cleansable {
/** The target frames per second to acheive. */
private static final int TARGET_FPS = 60;
/** The target updates per second to achieve. */
private static final int TARGET_UPS = 30;
/**
* The title of the game.
*/
String gameTitle;
/** The window used to display the game. */
private final Window window;
/** The timer used for the game loop. */
private final Timer updateTimer;
/** The GameLogic used to run the game. */
private final GameLogic gameLogic;
/** The Timer used to calculate the frames per second. */
private final Timer fpsTimer;
/** The number of frames per second of the game. */
private int fps;
/** The interpolation factor of the render. */
private float interpolationFactor;
/**
* Constructs a GameEngine.
* @param gameTitle the title of the game and the initial title of the window.
* @param width the width of the window
* @param height the height of the window
* @param gameLogic the game running in the GameEngine
*/
public GameEngine(String gameTitle, int width, int height, GameLogic gameLogic) {
this.gameTitle = gameTitle;
this.gameLogic = gameLogic;
gameLogic.setGameEngine(this);
window = new Window(gameTitle, width, height);
updateTimer = new Timer();
fps = 0;
fpsTimer = new Timer();
}
/**
* Gets the interpolation factor.
* @return the interpolation factor
*/
public float getInterpolationFactor() {
return interpolationFactor;
}
/**
* Runs the game loop
*/
@Override
public void run() {
try {
init();
gameLoop();
} catch (LWJGLException lwjgle) {
lwjgle.printStackTrace();
} finally {
cleanup();
}
System.exit(0);
}
/**
* Initializes the GameEngine when it runs.
* @throws LWJGLException if the GameEngine could not be initialized
*/
private void init() throws LWJGLException {
gameLogic.init(window);
}
/**
* The game loop that constantly updates and renders the game.
*/
private void gameLoop() {
float elapsedTime;
float accumulator = 0f;
float interval = 1.0f/TARGET_UPS;
while(!window.shouldClose()) {
elapsedTime = Math.min(0.25f, updateTimer.getElapsedTimeAndUpdate());
accumulator += elapsedTime;
//Get any input
//Calculate updates in the scene
while(accumulator >= interval) {
update();
accumulator -= interval;
}
interpolationFactor = accumulator/interval;
render();
if (!window.optionIsTurnedOn(Window.Options.ENABLE_VSYNC)) {
sync();
}
}
}
/**
* Syncs the game so that there are no extra renders.
*/
private void sync() {
float loopSlot = 1.0f/TARGET_FPS;
double endTime = updateTimer.getLastRecordedTime() + loopSlot;
while(updateTimer.getTime() < endTime) {
try {
Thread.sleep(1);
} catch (InterruptedException ie) {
ie.printStackTrace();
Thread.currentThread().interrupt();
}
}
}
/**
* Updates the game
*/
public void update() {
gameLogic.update();
}
/**
* Calculates and displays the frames per second.
*/
private void calculateAndDisplayFps() {
if (fpsTimer.secondHasPassed()) {
fpsTimer.getElapsedTimeAndUpdate();
if (window.optionIsTurnedOn(Window.Options.DISPLAY_FPS)) {
window.setTitle(gameTitle + " - " + fps + " FPS");
}
fps = 0;
}
fps++;
}
/**
* Renders the game.
*/
public void render() {
window.clear();
calculateAndDisplayFps();
gameLogic.render();
window.update();
}
/**
* {@inheritDoc}
*/
@Override
public void cleanup() {
gameLogic.cleanup();
}
}
| 4,477 | 0.559526 | 0.555953 | 175 | 24.588572 | 20.838203 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.331429 | false | false |
0
|
4a4759ac94e5025d686a6e6276604dc9ce102194
| 20,143,396,643,270 |
85f26adae478a8b56e3edca3420851f4969e1f88
|
/src/main/java/it/uniroma3/diadia/comandi/ComandoPosa.java
|
f6760e8a9e26df144cd6553de8077276a8e8c350
|
[
"Unlicense"
] |
permissive
|
gabriele-decapoa/DiaDiaJava
|
https://github.com/gabriele-decapoa/DiaDiaJava
|
1a689b5263b41d97649676baa7a8943bde499064
|
ad4568cc6c03e1fc2449a4aa363bfad85cd63940
|
refs/heads/master
| 2020-01-27T19:47:57.285000 | 2016-11-07T20:08:36 | 2016-11-07T20:08:36 | 72,995,769 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package it.uniroma3.diadia.comandi;
import it.uniroma3.diadia.Partita;
import it.uniroma3.diadia.attrezzi.Attrezzo;
/**
* Classe ComandoPosa
* Classe che implementa il comando "posa" del gioco
*
* @author Gabriele de Capoa e Gabriele Proni, da un'idea di Paolo Merialdo
* @version 2.0
* @see Comando
* @see Partita
* @see String
*/
public class ComandoPosa implements Comando {
private String nomeAttrezzo;
private String errore = null;
private String messaggio = null;
/**
* Esegue il comando "posa"
* prelevando un attrezzo dalla borsa e mettendolo nella stanza
* @param partita la partita in corso
* @see Attrezzo
* @see Borsa
* @see Stanza
*/
@Override
public void esegui(Partita partita) {
boolean posata;
StringBuffer nomeInvertito = new StringBuffer (this.nomeAttrezzo);
nomeInvertito= nomeInvertito.reverse();
if (partita.getGiocatore().getBorsa().hasAttrezzo(this.nomeAttrezzo)) {
partita.getLabirinto().getStanzaCorrente().addAttrezzo(partita.getGiocatore().getBorsa().getAttrezzo(this.nomeAttrezzo));
posata = partita.getLabirinto().getStanzaCorrente().hasAttrezzo(this.nomeAttrezzo)||partita.getLabirinto().getStanzaCorrente().hasAttrezzo(nomeInvertito.toString());
if (posata) {
partita.getGiocatore().getBorsa().removeAttrezzo(this.nomeAttrezzo);
partita.getGiocatore().getBorsa().removeAttrezzo(nomeInvertito.toString());
this.messaggio = "Oggetto posato nella stanza\n";
}
}
else
this.errore = "Attrezzo assente\n";
}
/**
* Assegna il parametro al comando
* @param parametro il parametro da assegnare
*/
@Override
public void setParametro(String parametro) {
this.nomeAttrezzo=parametro;
}
/**
* Restituisce l'eventuale messaggio d'errore generato dal comando.
* @return il messaggio d'errore.
*/
@Override
public String getErrore() {
return this.errore;
}
/**
* Restituisce un messaggio dal comando.
* @return il messaggio.
*/
@Override
public String getMessaggio() {
return this.messaggio;
}
}
|
UTF-8
|
Java
| 2,039 |
java
|
ComandoPosa.java
|
Java
|
[
{
"context": "lementa il comando \"posa\" del gioco\n * \n * @author Gabriele de Capoa e Gabriele Proni, da un'idea di Paolo Merialdo\n *",
"end": 229,
"score": 0.999866783618927,
"start": 212,
"tag": "NAME",
"value": "Gabriele de Capoa"
},
{
"context": "posa\" del gioco\n * \n * @author Gabriele de Capoa e Gabriele Proni, da un'idea di Paolo Merialdo\n * @version 2.0\n * ",
"end": 246,
"score": 0.9998665452003479,
"start": 232,
"tag": "NAME",
"value": "Gabriele Proni"
},
{
"context": "e de Capoa e Gabriele Proni, da un'idea di Paolo Merialdo\n * @version 2.0\n * @see Comando\n * @see Partita\n ",
"end": 276,
"score": 0.5723613500595093,
"start": 269,
"tag": "NAME",
"value": "erialdo"
}
] | null |
[] |
package it.uniroma3.diadia.comandi;
import it.uniroma3.diadia.Partita;
import it.uniroma3.diadia.attrezzi.Attrezzo;
/**
* Classe ComandoPosa
* Classe che implementa il comando "posa" del gioco
*
* @author <NAME> e <NAME>, da un'idea di Paolo Merialdo
* @version 2.0
* @see Comando
* @see Partita
* @see String
*/
public class ComandoPosa implements Comando {
private String nomeAttrezzo;
private String errore = null;
private String messaggio = null;
/**
* Esegue il comando "posa"
* prelevando un attrezzo dalla borsa e mettendolo nella stanza
* @param partita la partita in corso
* @see Attrezzo
* @see Borsa
* @see Stanza
*/
@Override
public void esegui(Partita partita) {
boolean posata;
StringBuffer nomeInvertito = new StringBuffer (this.nomeAttrezzo);
nomeInvertito= nomeInvertito.reverse();
if (partita.getGiocatore().getBorsa().hasAttrezzo(this.nomeAttrezzo)) {
partita.getLabirinto().getStanzaCorrente().addAttrezzo(partita.getGiocatore().getBorsa().getAttrezzo(this.nomeAttrezzo));
posata = partita.getLabirinto().getStanzaCorrente().hasAttrezzo(this.nomeAttrezzo)||partita.getLabirinto().getStanzaCorrente().hasAttrezzo(nomeInvertito.toString());
if (posata) {
partita.getGiocatore().getBorsa().removeAttrezzo(this.nomeAttrezzo);
partita.getGiocatore().getBorsa().removeAttrezzo(nomeInvertito.toString());
this.messaggio = "Oggetto posato nella stanza\n";
}
}
else
this.errore = "Attrezzo assente\n";
}
/**
* Assegna il parametro al comando
* @param parametro il parametro da assegnare
*/
@Override
public void setParametro(String parametro) {
this.nomeAttrezzo=parametro;
}
/**
* Restituisce l'eventuale messaggio d'errore generato dal comando.
* @return il messaggio d'errore.
*/
@Override
public String getErrore() {
return this.errore;
}
/**
* Restituisce un messaggio dal comando.
* @return il messaggio.
*/
@Override
public String getMessaggio() {
return this.messaggio;
}
}
| 2,020 | 0.723884 | 0.721432 | 80 | 24.487499 | 29.269436 | 168 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.3625 | false | false |
0
|
9b1aba5da30fdac37ce3457e91156296c21df0f9
| 21,457,656,633,692 |
b001120fc9efe11d75a16e1f862b874bee2fe2b1
|
/src/main/java/homework/ConversionHandler.java
|
a427fd693a2de2db0bdaebfe696f163295bb401e
|
[] |
no_license
|
dziugasj/converter
|
https://github.com/dziugasj/converter
|
51b1057c1b531574f99cebb2cf9a82df72694791
|
2eaf2f998b6090d69a2e0f49f6ebf474c2329c0c
|
refs/heads/master
| 2020-09-07T01:52:09.291000 | 2019-11-23T13:52:18 | 2019-11-23T13:52:18 | 220,620,960 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package homework;
import homework.argument.ArgumentWrapper;
import homework.argument.Validator;
import homework.currency.ConversionParameter;
import homework.currency.Converter;
import homework.currency.Currency;
import homework.printer.Printer;
import homework.rate.RateProvider;
import java.math.BigDecimal;
import java.util.Optional;
import java.util.stream.Stream;
import static java.util.Optional.empty;
import static java.util.Optional.of;
public class ConversionHandler {
private final Validator validator;
private final Converter converter;
private final Printer printer;
private final RateProvider rateProvider;
public ConversionHandler(final Validator validator, final Converter converter, final Printer printer, final RateProvider rateProvider) {
this.validator = validator;
this.converter = converter;
this.printer = printer;
this.rateProvider = rateProvider;
}
public void convertAndPrintResult(final ArgumentWrapper argument) {
of(argument)
.filter(this::isValid)
.map(this::toConversionParameter)
.flatMap(o -> o)
.map(this::convert)
.ifPresentOrElse(this::printConvertedValue, () -> printFailureMessage(argument));
}
private boolean isValid(ArgumentWrapper argument) {
return validator.isArgumentValid(argument);
}
private Optional<ConversionParameter> toConversionParameter(ArgumentWrapper argument) {
Optional<Currency> sourceCurrency = argument.getSource().map(this::toCurrency);
Optional<Currency> targetCurrency = argument.getTarget().map(this::toCurrency);
Optional<BigDecimal> sourceRate = getSourceRate(argument);
Optional<BigDecimal> targetRate = getTargetRate(argument);
Optional<BigDecimal> amount = argument.getAmount();
if (allValuesPresent(sourceCurrency, targetCurrency, sourceRate, targetRate, amount)) {
return of(new ConversionParameter(
sourceCurrency.get(),
targetCurrency.get(),
sourceRate.get(),
targetRate.get(),
amount.get()));
} else {
return empty();
}
}
private Optional<BigDecimal> getSourceRate(ArgumentWrapper argument) {
return argument.getSource()
.map(this::toCurrency)
.map(rateProvider::getBuyRate)
.flatMap(o -> o);
}
private Optional<BigDecimal> getTargetRate(ArgumentWrapper argument) {
return argument.getTarget()
.map(this::toCurrency)
.map(rateProvider::getSellRate)
.flatMap(o -> o);
}
private boolean allValuesPresent(Optional<Currency> sourceCurrency,
Optional<Currency> targetCurrency,
Optional<BigDecimal> sourceRate,
Optional<BigDecimal> targetRate,
Optional<BigDecimal> amount) {
return Stream.of(sourceCurrency, targetCurrency, sourceRate, targetRate, amount)
.allMatch(Optional::isPresent);
}
private Currency toCurrency(String code) {
return new Currency(code);
}
private BigDecimal convert(ConversionParameter parameter) {
return converter.convert(parameter);
}
private void printConvertedValue(BigDecimal value) {
printer.printNumber(value);
}
private void printFailureMessage(ArgumentWrapper argument) {
printer.printMessage(validator.getFailureMessage(argument));
}
}
|
UTF-8
|
Java
| 3,691 |
java
|
ConversionHandler.java
|
Java
|
[] | null |
[] |
package homework;
import homework.argument.ArgumentWrapper;
import homework.argument.Validator;
import homework.currency.ConversionParameter;
import homework.currency.Converter;
import homework.currency.Currency;
import homework.printer.Printer;
import homework.rate.RateProvider;
import java.math.BigDecimal;
import java.util.Optional;
import java.util.stream.Stream;
import static java.util.Optional.empty;
import static java.util.Optional.of;
public class ConversionHandler {
private final Validator validator;
private final Converter converter;
private final Printer printer;
private final RateProvider rateProvider;
public ConversionHandler(final Validator validator, final Converter converter, final Printer printer, final RateProvider rateProvider) {
this.validator = validator;
this.converter = converter;
this.printer = printer;
this.rateProvider = rateProvider;
}
public void convertAndPrintResult(final ArgumentWrapper argument) {
of(argument)
.filter(this::isValid)
.map(this::toConversionParameter)
.flatMap(o -> o)
.map(this::convert)
.ifPresentOrElse(this::printConvertedValue, () -> printFailureMessage(argument));
}
private boolean isValid(ArgumentWrapper argument) {
return validator.isArgumentValid(argument);
}
private Optional<ConversionParameter> toConversionParameter(ArgumentWrapper argument) {
Optional<Currency> sourceCurrency = argument.getSource().map(this::toCurrency);
Optional<Currency> targetCurrency = argument.getTarget().map(this::toCurrency);
Optional<BigDecimal> sourceRate = getSourceRate(argument);
Optional<BigDecimal> targetRate = getTargetRate(argument);
Optional<BigDecimal> amount = argument.getAmount();
if (allValuesPresent(sourceCurrency, targetCurrency, sourceRate, targetRate, amount)) {
return of(new ConversionParameter(
sourceCurrency.get(),
targetCurrency.get(),
sourceRate.get(),
targetRate.get(),
amount.get()));
} else {
return empty();
}
}
private Optional<BigDecimal> getSourceRate(ArgumentWrapper argument) {
return argument.getSource()
.map(this::toCurrency)
.map(rateProvider::getBuyRate)
.flatMap(o -> o);
}
private Optional<BigDecimal> getTargetRate(ArgumentWrapper argument) {
return argument.getTarget()
.map(this::toCurrency)
.map(rateProvider::getSellRate)
.flatMap(o -> o);
}
private boolean allValuesPresent(Optional<Currency> sourceCurrency,
Optional<Currency> targetCurrency,
Optional<BigDecimal> sourceRate,
Optional<BigDecimal> targetRate,
Optional<BigDecimal> amount) {
return Stream.of(sourceCurrency, targetCurrency, sourceRate, targetRate, amount)
.allMatch(Optional::isPresent);
}
private Currency toCurrency(String code) {
return new Currency(code);
}
private BigDecimal convert(ConversionParameter parameter) {
return converter.convert(parameter);
}
private void printConvertedValue(BigDecimal value) {
printer.printNumber(value);
}
private void printFailureMessage(ArgumentWrapper argument) {
printer.printMessage(validator.getFailureMessage(argument));
}
}
| 3,691 | 0.649418 | 0.649418 | 101 | 35.544556 | 28.178541 | 140 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.564356 | false | false |
0
|
b72c09ba8e6393402b1bbbb6540df0bc2a7e603e
| 18,253,611,052,318 |
eaa6cfcfc230538b71d001749d3b779ef136c6e6
|
/backend/core/src/main/java/com/feed_grabber/core/news/dto/NewsUpdateDto.java
|
7571dd159980d2922340a62fb44cca47b2bc2dc2
|
[] |
no_license
|
BinaryStudioAcademy/bsa-2020-feedgrabber
|
https://github.com/BinaryStudioAcademy/bsa-2020-feedgrabber
|
a487d07b1e187410a645871d4999e5422316e87b
|
2f68f805d2155d080188c4a17013ab60d86ab3d4
|
refs/heads/dev
| 2022-12-16T06:59:32.446000 | 2020-09-12T08:35:42 | 2020-09-12T08:35:42 | 284,298,963 | 11 | 6 | null | false | 2020-09-12T08:35:43 | 2020-08-01T16:39:53 | 2020-09-12T00:17:11 | 2020-09-12T08:35:42 | 4,297 | 6 | 1 | 0 |
TypeScript
| false | false |
package com.feed_grabber.core.news.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.UUID;
@Data
public class NewsUpdateDto {
private UUID id;
@NotBlank
@Size(max = 255)
private String title;
private String type;
@NotBlank
private String body;
private UUID imageId;
}
|
UTF-8
|
Java
| 383 |
java
|
NewsUpdateDto.java
|
Java
|
[] | null |
[] |
package com.feed_grabber.core.news.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.UUID;
@Data
public class NewsUpdateDto {
private UUID id;
@NotBlank
@Size(max = 255)
private String title;
private String type;
@NotBlank
private String body;
private UUID imageId;
}
| 383 | 0.72846 | 0.720627 | 19 | 19.157894 | 13.472245 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false |
0
|
06f1a876ee891b6652795c47a7e30f98c72e15ca
| 18,253,611,049,023 |
358ce4620a6d21af1ffc3bb2984ca40f1961e027
|
/springboot-test-basic/src/main/java/org/springboot/test/basic/SpringAopTest.java
|
87b322365d17d4e9a41a07f8cd9d7296974626e1
|
[] |
no_license
|
YoungCoderAliang/springboot-test
|
https://github.com/YoungCoderAliang/springboot-test
|
315692cb5522b8ddfa984408a2fd63ea9e2314d4
|
eafb4c1c4c51ab6ec13e57a9d126485861dec975
|
refs/heads/master
| 2021-04-26T23:02:10.047000 | 2018-03-30T09:41:12 | 2018-03-30T09:41:12 | 123,918,937 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.springboot.test.basic;
public class SpringAopTest {
}
|
UTF-8
|
Java
| 73 |
java
|
SpringAopTest.java
|
Java
|
[] | null |
[] |
package org.springboot.test.basic;
public class SpringAopTest {
}
| 73 | 0.726027 | 0.726027 | 5 | 12.6 | 15.147277 | 34 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
0
|
2ec174ea0ffe3ad864a0602f98aa7ee525cd22f4
| 18,476,949,322,971 |
2639a957a067c2039446e1bc8cc45a4149ada130
|
/crm/src/main/java/com/xlxd/crm/controller/VerifyRentMessageController.java
|
54129d8142c3035908820f30f31baec28802a4a3
|
[] |
no_license
|
cn-cf-wudan/remair
|
https://github.com/cn-cf-wudan/remair
|
f47daf119abfea64dd04fcb04d64b6f38b0ac98c
|
c7bdcc0eb247f3cd1a15ef09f514ddce9fb92fa2
|
refs/heads/master
| 2016-05-09T16:39:59.152000 | 2016-01-27T09:51:38 | 2016-01-27T09:51:38 | 50,488,574 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xlxd.crm.controller;
import cn.jpush.api.report.UsersResult;
import com.xlxd.crm.model.RentMessage;
import com.xlxd.crm.model.TableData;
import com.xlxd.crm.model.VerifyId;
import com.xlxd.crm.service.RentMessageService;
import com.xlxd.crm.service.RentUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
/**
* Created by LYJ on 7/30/2015.
*/
@Controller
@RequestMapping(value = "/trends")
public class VerifyRentMessageController {
@Autowired
RentMessageService rms;
@Autowired
RentUserService rentUserService;
@RequestMapping("/zuwoba/verifyRentMessage")
@ResponseBody
public ModelAndView identityView() {
ModelAndView modelAndView = new ModelAndView("sys-user/verify-rent-message");
return modelAndView;
}
@RequestMapping("/zuwoba/rentMessage")
@ResponseBody
public TableData rentMessage(Integer type,Integer page, Integer rows, String s_type, String s_val) {
return rms.getRentMessageFromDB(type,page,rows, s_type, s_val);
}
@RequestMapping("/zuwoba/modify_rank")
@ResponseBody
public int modifyRank(@RequestParam(value = "rent_message_id[]") String[] rent_message_id, @RequestParam(value = "rank[]") int[] rank, @RequestParam(value = "user_id[]") String[] user_id) {
return rms.modifyRank(user_id, rank, rent_message_id);
}
@RequestMapping("/zuwoba/modify_amount")
@ResponseBody
public int modifyAmount(@RequestParam(value = "id[]") String[] id, @RequestParam(value = "amount[]") Double[] amount) {
return rms.modifyAmount(id, amount);
}
@RequestMapping("/zuwoba/fa_gai_shi_xin")
@ResponseBody
public int faGaiShiXin(@RequestParam(value = "user_id[]") String[] user_id) {
return rms.faGaiShiXin(user_id);
}
@RequestMapping("/zuwoba/setVerified")
@ResponseBody
public int setVerified(VerifyId verifyIds, @RequestParam(value = "rank[]") int[] rank, @RequestParam(value = "user_id[]") String[] user_id) {
//System.out.println();
//System.out.println(rank);
//System.out.println(user_id);
try {
return rms.verifyRentMessages(verifyIds, rank, user_id);
} catch(Exception e) {
return 0;
}
}
@RequestMapping("/zuwoba/reverify")
@ResponseBody
public int setReverify(VerifyId ids) {
try {
return rms.reverifyRentMessages(ids);
} catch(Exception e) {
return 0;
}
}
@RequestMapping("/zuwoba/setVerifyFail")
@ResponseBody
public int setVerifyFail(VerifyId ids, int type) {
try {
return rms.verifyFailRentMessages(ids, type);
} catch(Exception e) {
return 0;
}
}
@RequestMapping("/zuwoba/verifyRentOrder")
@ResponseBody
public ModelAndView rentOrderView() {
ModelAndView modelAndView = new ModelAndView("sys-user/verify-rent-order");
return modelAndView;
}
@RequestMapping("/zuwoba/addMessageView")
@ResponseBody
public ModelAndView addMessageView(String user_id) {
return rms.addMessageView(user_id);
}
@RequestMapping("/zuwoba/saveRentMessage")
@ResponseBody
public ModelAndView saveRentMessage(RentMessage rentMessage, @RequestParam(value = "img_file", required = false) MultipartFile img_file, @RequestParam(value = "multipart_text", required = false) String [] multipart_text, @RequestParam(value = "multipart_img", required = false) String [] multipart_img) {
ModelAndView modelAndView = new ModelAndView();
String code = rms.saveRentMessage(rentMessage,img_file, multipart_text, multipart_img);
if(code.length() == 32){
modelAndView = rentUserService.detailRentMessage(rentMessage.getUser_id(), code);
}else{
return null;
}
//
return modelAndView;
}
@RequestMapping("/zuwoba/rentOrder")
@ResponseBody
public TableData rentOrder(Integer page, Integer rows, int type, String s_type, String s_val) {
return rms.getOrderMessageFromDB(type, page, rows, s_type, s_val);
}
@RequestMapping("/zuwoba/fa_fa_fa")
@ResponseBody
public int faFaFa(VerifyId ids, int type, @RequestParam(value = "memo[]") String[] memo, @RequestParam(value = "order_id[]") String[] order_id) {
return rms.faFaFa(ids, type, memo, order_id);
}
@RequestMapping("/zuwoba/reCancel")
@ResponseBody
public int reCancel(VerifyId ids, @RequestParam(value = "memo[]") String[] memo, @RequestParam(value = "order_id[]") String[] order_id) {
return rms.reCancel(ids, memo, order_id);
}
@RequestMapping("/zuwoba/set_order_status_22")
@ResponseBody
public int setOrderStatus22(VerifyId ids) {
return rms.setOrderStatus22(ids);
}
@RequestMapping("/zuwoba/set_order_cancel_21")
@ResponseBody
public int setOrderCancel21(VerifyId ids, @RequestParam(value = "order_id[]") String[] order_id,
@RequestParam(value = "user_id[]") String[] user_id) {
return rms.setOrderCancel21(ids, order_id, user_id);
}
@RequestMapping("/zuwoba/set_status_23")
@ResponseBody
public int setStatus23(VerifyId ids) {
return rms.setStatus23(ids);
}
@RequestMapping("/zuwoba/comfirmPay")
@ResponseBody
public int comfirmPay(String user_id, String order_id) {
return rms.comfirmPay(user_id, order_id);
}
@RequestMapping("/zuwoba/updateIsChoice")
@ResponseBody
public int updateIsChoice(@RequestParam(value = "ids[]") String[] ids, Integer is_choice) {
return rms.updateIsChoice(ids, is_choice);
}
@RequestMapping("/zuwoba/isChoiceList")
@ResponseBody
public TableData isChoiceList(String city_code, Integer page, Integer rows, String s_type, String s_val) {
TableData tableData= rms.isChoiceList(city_code, page, rows, s_type, s_val);
return tableData;
}
@RequestMapping("/zuwoba/save_memo")
@ResponseBody
public int saveMemo(@RequestParam(value = "memo[]") String[] memo, @RequestParam(value = "order_id[]") String[] order_id) {
return rms.saveMemo(memo, order_id);
}
@RequestMapping("/zuwoba/ti_xing_bei_gu_cha_kan_xiao_xi")
@ResponseBody
public int ti_xing_bei_gu_cha_kan_xiao_xi(@RequestParam(value = "s_id[]") String[] s_id,
@RequestParam(value = "s_phone_num[]") String[] s_phone_num,
@RequestParam(value = "g_phone_num[]") String[] g_phone_num,
@RequestParam(value = "g_id[]") String[] g_id,
@RequestParam(value = "t") int t) {
return rms.ti_xing_bei_gu_cha_kan_xiao_xi(s_id, s_phone_num, g_id, g_phone_num, t);
}
@RequestMapping("/zuwoba/getNeedVerifyCount")
@ResponseBody
public int getNeedVerifyCount() {
return rms.getNeedVerifyCount();
}
@RequestMapping("/zuwoba/getMessageCountByUserAndCategory")
@ResponseBody
public int getMessageCountByUserAndCategory(String user_id, String category_id) {
return rms.getMessageCountByUserAndCategory(user_id, category_id);
}
@RequestMapping("/zuwoba/updateMessage")
@ResponseBody
public ModelAndView updateMessage(RentMessage rentMessage, @RequestParam(value = "img_file", required = false) MultipartFile img_file) {
ModelAndView modelAndView = new ModelAndView("commons/success");
try{
rms.updateMessage(rentMessage, img_file);
modelAndView = rentUserService.detailRentMessage(rentMessage.getUser_id(), rentMessage.getId());
}catch (Exception e){
e.printStackTrace();
modelAndView = rentUserService.detailRentMessage(rentMessage.getUser_id(), rentMessage.getId());
modelAndView.addObject("msg", "修改失败");
}
return modelAndView;
}
}
|
UTF-8
|
Java
| 8,415 |
java
|
VerifyRentMessageController.java
|
Java
|
[
{
"context": "ework.web.servlet.ModelAndView;\n\n/**\n * Created by LYJ on 7/30/2015.\n */\n\n@Controller\n@RequestMapping(va",
"end": 708,
"score": 0.9995956420898438,
"start": 705,
"tag": "USERNAME",
"value": "LYJ"
}
] | null |
[] |
package com.xlxd.crm.controller;
import cn.jpush.api.report.UsersResult;
import com.xlxd.crm.model.RentMessage;
import com.xlxd.crm.model.TableData;
import com.xlxd.crm.model.VerifyId;
import com.xlxd.crm.service.RentMessageService;
import com.xlxd.crm.service.RentUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
/**
* Created by LYJ on 7/30/2015.
*/
@Controller
@RequestMapping(value = "/trends")
public class VerifyRentMessageController {
@Autowired
RentMessageService rms;
@Autowired
RentUserService rentUserService;
@RequestMapping("/zuwoba/verifyRentMessage")
@ResponseBody
public ModelAndView identityView() {
ModelAndView modelAndView = new ModelAndView("sys-user/verify-rent-message");
return modelAndView;
}
@RequestMapping("/zuwoba/rentMessage")
@ResponseBody
public TableData rentMessage(Integer type,Integer page, Integer rows, String s_type, String s_val) {
return rms.getRentMessageFromDB(type,page,rows, s_type, s_val);
}
@RequestMapping("/zuwoba/modify_rank")
@ResponseBody
public int modifyRank(@RequestParam(value = "rent_message_id[]") String[] rent_message_id, @RequestParam(value = "rank[]") int[] rank, @RequestParam(value = "user_id[]") String[] user_id) {
return rms.modifyRank(user_id, rank, rent_message_id);
}
@RequestMapping("/zuwoba/modify_amount")
@ResponseBody
public int modifyAmount(@RequestParam(value = "id[]") String[] id, @RequestParam(value = "amount[]") Double[] amount) {
return rms.modifyAmount(id, amount);
}
@RequestMapping("/zuwoba/fa_gai_shi_xin")
@ResponseBody
public int faGaiShiXin(@RequestParam(value = "user_id[]") String[] user_id) {
return rms.faGaiShiXin(user_id);
}
@RequestMapping("/zuwoba/setVerified")
@ResponseBody
public int setVerified(VerifyId verifyIds, @RequestParam(value = "rank[]") int[] rank, @RequestParam(value = "user_id[]") String[] user_id) {
//System.out.println();
//System.out.println(rank);
//System.out.println(user_id);
try {
return rms.verifyRentMessages(verifyIds, rank, user_id);
} catch(Exception e) {
return 0;
}
}
@RequestMapping("/zuwoba/reverify")
@ResponseBody
public int setReverify(VerifyId ids) {
try {
return rms.reverifyRentMessages(ids);
} catch(Exception e) {
return 0;
}
}
@RequestMapping("/zuwoba/setVerifyFail")
@ResponseBody
public int setVerifyFail(VerifyId ids, int type) {
try {
return rms.verifyFailRentMessages(ids, type);
} catch(Exception e) {
return 0;
}
}
@RequestMapping("/zuwoba/verifyRentOrder")
@ResponseBody
public ModelAndView rentOrderView() {
ModelAndView modelAndView = new ModelAndView("sys-user/verify-rent-order");
return modelAndView;
}
@RequestMapping("/zuwoba/addMessageView")
@ResponseBody
public ModelAndView addMessageView(String user_id) {
return rms.addMessageView(user_id);
}
@RequestMapping("/zuwoba/saveRentMessage")
@ResponseBody
public ModelAndView saveRentMessage(RentMessage rentMessage, @RequestParam(value = "img_file", required = false) MultipartFile img_file, @RequestParam(value = "multipart_text", required = false) String [] multipart_text, @RequestParam(value = "multipart_img", required = false) String [] multipart_img) {
ModelAndView modelAndView = new ModelAndView();
String code = rms.saveRentMessage(rentMessage,img_file, multipart_text, multipart_img);
if(code.length() == 32){
modelAndView = rentUserService.detailRentMessage(rentMessage.getUser_id(), code);
}else{
return null;
}
//
return modelAndView;
}
@RequestMapping("/zuwoba/rentOrder")
@ResponseBody
public TableData rentOrder(Integer page, Integer rows, int type, String s_type, String s_val) {
return rms.getOrderMessageFromDB(type, page, rows, s_type, s_val);
}
@RequestMapping("/zuwoba/fa_fa_fa")
@ResponseBody
public int faFaFa(VerifyId ids, int type, @RequestParam(value = "memo[]") String[] memo, @RequestParam(value = "order_id[]") String[] order_id) {
return rms.faFaFa(ids, type, memo, order_id);
}
@RequestMapping("/zuwoba/reCancel")
@ResponseBody
public int reCancel(VerifyId ids, @RequestParam(value = "memo[]") String[] memo, @RequestParam(value = "order_id[]") String[] order_id) {
return rms.reCancel(ids, memo, order_id);
}
@RequestMapping("/zuwoba/set_order_status_22")
@ResponseBody
public int setOrderStatus22(VerifyId ids) {
return rms.setOrderStatus22(ids);
}
@RequestMapping("/zuwoba/set_order_cancel_21")
@ResponseBody
public int setOrderCancel21(VerifyId ids, @RequestParam(value = "order_id[]") String[] order_id,
@RequestParam(value = "user_id[]") String[] user_id) {
return rms.setOrderCancel21(ids, order_id, user_id);
}
@RequestMapping("/zuwoba/set_status_23")
@ResponseBody
public int setStatus23(VerifyId ids) {
return rms.setStatus23(ids);
}
@RequestMapping("/zuwoba/comfirmPay")
@ResponseBody
public int comfirmPay(String user_id, String order_id) {
return rms.comfirmPay(user_id, order_id);
}
@RequestMapping("/zuwoba/updateIsChoice")
@ResponseBody
public int updateIsChoice(@RequestParam(value = "ids[]") String[] ids, Integer is_choice) {
return rms.updateIsChoice(ids, is_choice);
}
@RequestMapping("/zuwoba/isChoiceList")
@ResponseBody
public TableData isChoiceList(String city_code, Integer page, Integer rows, String s_type, String s_val) {
TableData tableData= rms.isChoiceList(city_code, page, rows, s_type, s_val);
return tableData;
}
@RequestMapping("/zuwoba/save_memo")
@ResponseBody
public int saveMemo(@RequestParam(value = "memo[]") String[] memo, @RequestParam(value = "order_id[]") String[] order_id) {
return rms.saveMemo(memo, order_id);
}
@RequestMapping("/zuwoba/ti_xing_bei_gu_cha_kan_xiao_xi")
@ResponseBody
public int ti_xing_bei_gu_cha_kan_xiao_xi(@RequestParam(value = "s_id[]") String[] s_id,
@RequestParam(value = "s_phone_num[]") String[] s_phone_num,
@RequestParam(value = "g_phone_num[]") String[] g_phone_num,
@RequestParam(value = "g_id[]") String[] g_id,
@RequestParam(value = "t") int t) {
return rms.ti_xing_bei_gu_cha_kan_xiao_xi(s_id, s_phone_num, g_id, g_phone_num, t);
}
@RequestMapping("/zuwoba/getNeedVerifyCount")
@ResponseBody
public int getNeedVerifyCount() {
return rms.getNeedVerifyCount();
}
@RequestMapping("/zuwoba/getMessageCountByUserAndCategory")
@ResponseBody
public int getMessageCountByUserAndCategory(String user_id, String category_id) {
return rms.getMessageCountByUserAndCategory(user_id, category_id);
}
@RequestMapping("/zuwoba/updateMessage")
@ResponseBody
public ModelAndView updateMessage(RentMessage rentMessage, @RequestParam(value = "img_file", required = false) MultipartFile img_file) {
ModelAndView modelAndView = new ModelAndView("commons/success");
try{
rms.updateMessage(rentMessage, img_file);
modelAndView = rentUserService.detailRentMessage(rentMessage.getUser_id(), rentMessage.getId());
}catch (Exception e){
e.printStackTrace();
modelAndView = rentUserService.detailRentMessage(rentMessage.getUser_id(), rentMessage.getId());
modelAndView.addObject("msg", "修改失败");
}
return modelAndView;
}
}
| 8,415 | 0.656239 | 0.65267 | 244 | 33.454918 | 38.836273 | 308 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.581967 | false | false |
0
|
36c1a2b979cbdc4b374bc8a85429eec809c12d49
| 8,332,236,583,612 |
f9082069606a411e2b0421abe0722bf1af02ab2c
|
/wxw-clickhouse/src/main/java/com/wxw/manager/config/DruidConfig.java
|
5070144ad80e7f644299c74b26af8e3cd282d4c4
|
[
"Apache-2.0"
] |
permissive
|
GitHubWxw/wxw-bigdata
|
https://github.com/GitHubWxw/wxw-bigdata
|
e8355104533a403e613fa597dd12327e6c502549
|
a3f167cb96bc682238d11379ceef51dda1f5b564
|
refs/heads/main
| 2023-06-25T02:27:03.226000 | 2021-04-29T11:35:12 | 2021-04-29T11:35:12 | 362,794,500 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.wxw.manager.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.wxw.manager.properties.JdbcProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource;
import javax.sql.DataSource;
/**
* @author weixiaowei
* @desc:
* @date: 2021/4/27
*/
@Configuration
public class DruidConfig {
@Resource
private JdbcProperties jdbcProperties;
@Bean
public DataSource dataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(jdbcProperties.getUrl());
datasource.setDriverClassName(jdbcProperties.getDriverClassName());
datasource.setInitialSize(jdbcProperties.getInitialSize());
datasource.setMinIdle(jdbcProperties.getMinIdle());
datasource.setMaxActive(jdbcProperties.getMaxActive());
datasource.setMaxWait(jdbcProperties.getMaxWait());
datasource.setUsername(jdbcProperties.getUserName());
datasource.setPassword(jdbcProperties.getPassword());
return datasource;
}
}
|
UTF-8
|
Java
| 1,114 |
java
|
DruidConfig.java
|
Java
|
[
{
"context": "urce;\nimport javax.sql.DataSource;\n\n/**\n * @author weixiaowei\n * @desc:\n * @date: 2021/4/27\n */\n@Configuration\n",
"end": 332,
"score": 0.9995562434196472,
"start": 322,
"tag": "USERNAME",
"value": "weixiaowei"
}
] | null |
[] |
package com.wxw.manager.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.wxw.manager.properties.JdbcProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource;
import javax.sql.DataSource;
/**
* @author weixiaowei
* @desc:
* @date: 2021/4/27
*/
@Configuration
public class DruidConfig {
@Resource
private JdbcProperties jdbcProperties;
@Bean
public DataSource dataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(jdbcProperties.getUrl());
datasource.setDriverClassName(jdbcProperties.getDriverClassName());
datasource.setInitialSize(jdbcProperties.getInitialSize());
datasource.setMinIdle(jdbcProperties.getMinIdle());
datasource.setMaxActive(jdbcProperties.getMaxActive());
datasource.setMaxWait(jdbcProperties.getMaxWait());
datasource.setUsername(jdbcProperties.getUserName());
datasource.setPassword(jdbcProperties.getPassword());
return datasource;
}
}
| 1,114 | 0.749551 | 0.743267 | 34 | 31.764706 | 24.009874 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529412 | false | false |
0
|
d780a6b748fd8bf7d1db7db876ec028ce1bd2b54
| 21,320,217,697,087 |
92dd6bc0a9435c359593a1f9b309bb58d3e3f103
|
/src/Dec2020Leetcode/_0305NumberOfIslandsII.java
|
966676ba1f0bc226140f29f1ac9f4aa21489ec56
|
[
"MIT"
] |
permissive
|
darshanhs90/Java-Coding
|
https://github.com/darshanhs90/Java-Coding
|
bfb2eb84153a8a8a9429efc2833c47f6680f03f4
|
da76ccd7851f102712f7d8dfa4659901c5de7a76
|
refs/heads/master
| 2023-05-27T03:17:45.055000 | 2021-06-16T06:18:08 | 2021-06-16T06:18:08 | 36,981,580 | 3 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Dec2020Leetcode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class _0305NumberOfIslandsII {
public static void main(String[] args) {
System.out.println(numIslands2(3, 3,
new int[][] { new int[] { 0, 0 }, new int[] { 0, 1 }, new int[] { 1, 2 }, new int[] { 2, 1 } }));
System.out.println(numIslands2(8, 6,
new int[][] { new int[] { 0, 5 }, new int[] { 5, 4 }, new int[] { 5, 2 }, new int[] { 7, 3 },
new int[] { 6, 0 }, new int[] { 5, 3 }, new int[] { 5, 1 }, new int[] { 1, 3 },
new int[] { 4, 3 }, new int[] { 2, 3 }, new int[] { 3, 5 }, new int[] { 3, 2 },
new int[] { 3, 0 }, new int[] { 2, 4 }, new int[] { 0, 1 } }));
}
static class Pair {
int x, y;
public Pair(int x, int y) {
this.x = x;
this.y = y;
}
}
public static List<Integer> numIslands2(int m, int n, int[][] positions) {
HashMap<Integer, List<Pair>> islandMap = new HashMap<Integer, List<Pair>>();
List<Integer> output = new ArrayList<Integer>();
int count = 0;
for (int i = 0; i < positions.length; i++) {
int x = positions[i][0];
int y = positions[i][1];
if (islandMap.size() == 0) {
List<Pair> list = new ArrayList<Pair>();
list.add(new Pair(x, y));
islandMap.put(count, list);
count++;
} else {
HashSet<Integer> overLapIslands = new HashSet<Integer>();
int islandId = doesOverLap(x, y, islandMap);
if (islandId != -1) {
output.add(islandMap.size());
continue;
}
if (x - 1 >= 0) {
islandId = doesOverLap(x - 1, y, islandMap);
if (islandId != -1)
overLapIslands.add(islandId);
}
if (x + 1 < m) {
islandId = doesOverLap(x + 1, y, islandMap);
if (islandId != -1)
overLapIslands.add(islandId);
}
if (y - 1 >= 0) {
islandId = doesOverLap(x, y - 1, islandMap);
if (islandId != -1)
overLapIslands.add(islandId);
}
if (y + 1 < n) {
islandId = doesOverLap(x, y + 1, islandMap);
if (islandId != -1)
overLapIslands.add(islandId);
}
if (overLapIslands.size() == 0) {
islandMap.put(count, new ArrayList<Pair>(Arrays.asList(new Pair(x, y))));
count++;
} else if (overLapIslands.size() == 1) {
islandMap.get(overLapIslands.iterator().next()).add(new Pair(x, y));
} else {
Iterator<Integer> iter = overLapIslands.iterator();
int mainIsland = iter.next();
while (iter.hasNext()) {
islandId = iter.next();
islandMap.get(mainIsland).addAll(islandMap.get(islandId));
islandMap.remove(islandId);
}
islandMap.get(mainIsland).add(new Pair(x, y));
}
}
output.add(islandMap.size());
}
return output;
}
public static int doesOverLap(int x, int y, HashMap<Integer, List<Pair>> islandMap) {
int islandId = -1;
for (Map.Entry<Integer, List<Pair>> entry : islandMap.entrySet()) {
List<Pair> list = entry.getValue();
for (int i = 0; i < list.size(); i++) {
if (list.get(i).x == x && list.get(i).y == y)
return entry.getKey();
}
}
return islandId;
}
}
|
UTF-8
|
Java
| 3,170 |
java
|
_0305NumberOfIslandsII.java
|
Java
|
[] | null |
[] |
package Dec2020Leetcode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class _0305NumberOfIslandsII {
public static void main(String[] args) {
System.out.println(numIslands2(3, 3,
new int[][] { new int[] { 0, 0 }, new int[] { 0, 1 }, new int[] { 1, 2 }, new int[] { 2, 1 } }));
System.out.println(numIslands2(8, 6,
new int[][] { new int[] { 0, 5 }, new int[] { 5, 4 }, new int[] { 5, 2 }, new int[] { 7, 3 },
new int[] { 6, 0 }, new int[] { 5, 3 }, new int[] { 5, 1 }, new int[] { 1, 3 },
new int[] { 4, 3 }, new int[] { 2, 3 }, new int[] { 3, 5 }, new int[] { 3, 2 },
new int[] { 3, 0 }, new int[] { 2, 4 }, new int[] { 0, 1 } }));
}
static class Pair {
int x, y;
public Pair(int x, int y) {
this.x = x;
this.y = y;
}
}
public static List<Integer> numIslands2(int m, int n, int[][] positions) {
HashMap<Integer, List<Pair>> islandMap = new HashMap<Integer, List<Pair>>();
List<Integer> output = new ArrayList<Integer>();
int count = 0;
for (int i = 0; i < positions.length; i++) {
int x = positions[i][0];
int y = positions[i][1];
if (islandMap.size() == 0) {
List<Pair> list = new ArrayList<Pair>();
list.add(new Pair(x, y));
islandMap.put(count, list);
count++;
} else {
HashSet<Integer> overLapIslands = new HashSet<Integer>();
int islandId = doesOverLap(x, y, islandMap);
if (islandId != -1) {
output.add(islandMap.size());
continue;
}
if (x - 1 >= 0) {
islandId = doesOverLap(x - 1, y, islandMap);
if (islandId != -1)
overLapIslands.add(islandId);
}
if (x + 1 < m) {
islandId = doesOverLap(x + 1, y, islandMap);
if (islandId != -1)
overLapIslands.add(islandId);
}
if (y - 1 >= 0) {
islandId = doesOverLap(x, y - 1, islandMap);
if (islandId != -1)
overLapIslands.add(islandId);
}
if (y + 1 < n) {
islandId = doesOverLap(x, y + 1, islandMap);
if (islandId != -1)
overLapIslands.add(islandId);
}
if (overLapIslands.size() == 0) {
islandMap.put(count, new ArrayList<Pair>(Arrays.asList(new Pair(x, y))));
count++;
} else if (overLapIslands.size() == 1) {
islandMap.get(overLapIslands.iterator().next()).add(new Pair(x, y));
} else {
Iterator<Integer> iter = overLapIslands.iterator();
int mainIsland = iter.next();
while (iter.hasNext()) {
islandId = iter.next();
islandMap.get(mainIsland).addAll(islandMap.get(islandId));
islandMap.remove(islandId);
}
islandMap.get(mainIsland).add(new Pair(x, y));
}
}
output.add(islandMap.size());
}
return output;
}
public static int doesOverLap(int x, int y, HashMap<Integer, List<Pair>> islandMap) {
int islandId = -1;
for (Map.Entry<Integer, List<Pair>> entry : islandMap.entrySet()) {
List<Pair> list = entry.getValue();
for (int i = 0; i < list.size(); i++) {
if (list.get(i).x == x && list.get(i).y == y)
return entry.getKey();
}
}
return islandId;
}
}
| 3,170 | 0.573502 | 0.549211 | 112 | 27.303572 | 24.421463 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.901786 | false | false |
0
|
e7290d43ff7e3ed79ed0f4d60dc56722596ee727
| 14,267,881,423,179 |
94fb288d936ab14c700f14ff6bbd383350fc0d61
|
/building/Mine.java
|
30004b83727ccf27f3f410023f35b1354ee8046d
|
[] |
no_license
|
burbaki/project
|
https://github.com/burbaki/project
|
61f5c6b2bb8d4ac9b5a05880ce2de1986ed5bdc6
|
4fd5ceb03b4082f31dbabf6fc09c232f8c47eca2
|
refs/heads/master
| 2021-05-24T00:57:31.292000 | 2016-06-01T15:18:26 | 2016-06-01T15:18:26 | 55,079,651 | 0 | 1 | null | false | 2016-04-06T15:51:27 | 2016-03-30T16:38:33 | 2016-03-30T16:39:55 | 2016-04-06T15:51:27 | 1,194 | 0 | 1 | 0 |
Java
| null | null |
package building;
import country.DayChanger;
import enumerationClasses.EnumConverter;
import enumerationClasses.TypeBuilding;
import enumerationClasses.TypeProduction;
import java.util.logging.Level;
import java.util.logging.Logger;
import service.BuildingProperty;
public class Mine extends ResourceBuilding {
private static Logger log = Logger.getLogger(Mine.class.getName());
public TypeProduction typeProduction;
private double amountOfDeposits;
public Mine(TypeBuilding type) {
super(type);
amountOfDeposits = BuildingProperty.getAmountOfDeposit();
typeProduction = EnumConverter.BuildingsToProduction(type);
trader = new BuildingTrader(stock, typeProduction);
log.log(Level.INFO, "Created buildingTrader with {0}", trader.toString());
}
public double getAmountOfDeposit() {
return amountOfDeposits;
}
@Override
public boolean readyForDestroy() {
if (super.readyForDestroy() || amountOfDeposits <= 0) {
trader.setBankrut();
log.log(Level.INFO, "Building {0}, ready for destroy", toString());
}
return false;
}
@Override
public void makeProduction() {
amountOfDeposits -= currentProductionPerDay;
stock.takeProduct(typeProduction, currentProductionPerDay);
}
}
|
UTF-8
|
Java
| 1,348 |
java
|
Mine.java
|
Java
|
[] | null |
[] |
package building;
import country.DayChanger;
import enumerationClasses.EnumConverter;
import enumerationClasses.TypeBuilding;
import enumerationClasses.TypeProduction;
import java.util.logging.Level;
import java.util.logging.Logger;
import service.BuildingProperty;
public class Mine extends ResourceBuilding {
private static Logger log = Logger.getLogger(Mine.class.getName());
public TypeProduction typeProduction;
private double amountOfDeposits;
public Mine(TypeBuilding type) {
super(type);
amountOfDeposits = BuildingProperty.getAmountOfDeposit();
typeProduction = EnumConverter.BuildingsToProduction(type);
trader = new BuildingTrader(stock, typeProduction);
log.log(Level.INFO, "Created buildingTrader with {0}", trader.toString());
}
public double getAmountOfDeposit() {
return amountOfDeposits;
}
@Override
public boolean readyForDestroy() {
if (super.readyForDestroy() || amountOfDeposits <= 0) {
trader.setBankrut();
log.log(Level.INFO, "Building {0}, ready for destroy", toString());
}
return false;
}
@Override
public void makeProduction() {
amountOfDeposits -= currentProductionPerDay;
stock.takeProduct(typeProduction, currentProductionPerDay);
}
}
| 1,348 | 0.700297 | 0.698071 | 47 | 27.680851 | 24.411461 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.659574 | false | false |
0
|
9939d0d1966ed752121294a5350d597b94fe3266
| 29,016,799,116,737 |
e62491b3b648d4d969e637cc7f5e747af7f2991e
|
/src/main/java/com/ccon/chap/entity/History.java
|
d385470cd80e309d53de8a13f5ae0dae11900eb4
|
[] |
no_license
|
CharArt/Currency-converter
|
https://github.com/CharArt/Currency-converter
|
2b99843b6cacd46b44a5e940df6e02385e4fbea1
|
8597e773241740161194ac7bf188e1b1df356133
|
refs/heads/main
| 2023-08-18T03:02:58.946000 | 2021-09-13T21:42:15 | 2021-09-13T21:42:15 | 392,926,383 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ccon.chap.entity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
@Entity
@Table(name = "history")
public class History implements Serializable {
@Id
@Column(name = "request_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long request_id;
@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)
@JoinColumn(name = "write_of_id")
private ValCurs writOfId;
@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)
@JoinColumn(name = "write_in_id")
private ValCurs writeInId;
@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)
@JoinColumn(name = "user_id")
private User user;
@Column(name = "question")
private float question;
@Column(name = "answer")
private float answer;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Column(name = "date_valcurs")
private LocalDateTime dateValcurs;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Column(name = "date_conversion")
private LocalDateTime dateConversion;
public History() {
}
public History(ValCurs writOfId, ValCurs writeInId, User user, float question, float answer, LocalDateTime dateValcurs, LocalDateTime dateConversion) {
this.writOfId = writOfId;
this.writeInId = writeInId;
this.user = user;
this.question = question;
this.answer = answer;
this.dateValcurs = dateValcurs;
this.dateConversion = dateConversion;
}
public Long getRequest_id() {
return request_id;
}
public void setRequest_id(Long request_id) {
this.request_id = request_id;
}
public ValCurs getWritOfId() {
return writOfId;
}
public void setWritOfId(ValCurs writOfId) {
this.writOfId = writOfId;
}
public ValCurs getWriteInId() {
return writeInId;
}
public void setWriteInId(ValCurs writeInId) {
this.writeInId = writeInId;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public float getQuestion() {
return question;
}
public void setQuestion(float question) {
this.question = question;
}
public float getAnswer() {
return answer;
}
public void setAnswer(float answer) {
this.answer = answer;
}
public LocalDateTime getDateValcurs() {
return dateValcurs;
}
public void setDateValcurs(LocalDateTime dateValcurs) {
this.dateValcurs = dateValcurs;
}
public LocalDateTime getDateConversion() {
return dateConversion;
}
public void setDateConversion(LocalDateTime dateConversion) {
this.dateConversion = dateConversion;
}
}
|
UTF-8
|
Java
| 2,888 |
java
|
History.java
|
Java
|
[] | null |
[] |
package com.ccon.chap.entity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
@Entity
@Table(name = "history")
public class History implements Serializable {
@Id
@Column(name = "request_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long request_id;
@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)
@JoinColumn(name = "write_of_id")
private ValCurs writOfId;
@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)
@JoinColumn(name = "write_in_id")
private ValCurs writeInId;
@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)
@JoinColumn(name = "user_id")
private User user;
@Column(name = "question")
private float question;
@Column(name = "answer")
private float answer;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Column(name = "date_valcurs")
private LocalDateTime dateValcurs;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Column(name = "date_conversion")
private LocalDateTime dateConversion;
public History() {
}
public History(ValCurs writOfId, ValCurs writeInId, User user, float question, float answer, LocalDateTime dateValcurs, LocalDateTime dateConversion) {
this.writOfId = writOfId;
this.writeInId = writeInId;
this.user = user;
this.question = question;
this.answer = answer;
this.dateValcurs = dateValcurs;
this.dateConversion = dateConversion;
}
public Long getRequest_id() {
return request_id;
}
public void setRequest_id(Long request_id) {
this.request_id = request_id;
}
public ValCurs getWritOfId() {
return writOfId;
}
public void setWritOfId(ValCurs writOfId) {
this.writOfId = writOfId;
}
public ValCurs getWriteInId() {
return writeInId;
}
public void setWriteInId(ValCurs writeInId) {
this.writeInId = writeInId;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public float getQuestion() {
return question;
}
public void setQuestion(float question) {
this.question = question;
}
public float getAnswer() {
return answer;
}
public void setAnswer(float answer) {
this.answer = answer;
}
public LocalDateTime getDateValcurs() {
return dateValcurs;
}
public void setDateValcurs(LocalDateTime dateValcurs) {
this.dateValcurs = dateValcurs;
}
public LocalDateTime getDateConversion() {
return dateConversion;
}
public void setDateConversion(LocalDateTime dateConversion) {
this.dateConversion = dateConversion;
}
}
| 2,888 | 0.656856 | 0.656856 | 120 | 23.075001 | 22.659863 | 155 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
0
|
9222df81a7f78cc4df64f79479d5ea59a32c0f4a
| 30,305,289,304,744 |
1fddbdfebffdfa117f5020ee896911fde0e1ec50
|
/StockHolic/src/main/java/com/stockholic/webapp/front/board/service/BoardService.java
|
34cf1d4341e837c62e84b969ede71f6147f08b48
|
[] |
no_license
|
stockholic/spring
|
https://github.com/stockholic/spring
|
bb611afdef6a1249509e70861426180c761186f6
|
34642f543e32b8abdccdc4d2312b9275715b3652
|
refs/heads/master
| 2022-05-27T00:29:26.289000 | 2020-02-07T05:01:56 | 2020-02-07T05:01:56 | 142,292,025 | 0 | 0 | null | false | 2022-05-25T23:18:51 | 2018-07-25T11:41:26 | 2020-02-07T05:02:02 | 2022-05-25T23:18:51 | 9,339 | 0 | 0 | 107 |
JavaScript
| false | false |
package com.stockholic.webapp.front.board.service;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.stockholic.core.module.model.FileInfo;
import com.stockholic.core.utils.FileManager;
import com.stockholic.webapp.front.board.dao.BoardDao;
import com.stockholic.webapp.front.board.dao.FileDao;
import com.stockholic.webapp.front.board.model.Board;
@Service
public class BoardService{
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private BoardDao boardDao;
@Autowired
private FileDao fileDao;
/**
* 게시판 수
* @param board
* @return
*/
public int selectBoardCount(Board board){
return boardDao.selectBoardCount(board);
}
/**
* 게시판 목록
* @param board
* @return
*/
public List<Board> selectBoardList(Board board){
board.setTotalRow(selectBoardCount(board));
return boardDao.selectBoardList(board);
}
/**
* 게시판 조회
* @param usrSrl
* @return
*/
public Board selectBoard(Integer boardSrl){
boardDao.updateBoardRead(boardSrl);
return boardDao.selectBoard(boardSrl);
}
/**
* 게시판 등록
* @param board
* @throws IOException
* @throws JsonMappingException
* @throws JsonParseException
*/
@Transactional
@SuppressWarnings("unchecked")
public void insertBoard(Board board) throws JsonParseException, JsonMappingException, IOException{
board.setFid(boardDao.selectBoardFid(board.getFlag()));
board.setLev(0);
board.setStp(1);
boardDao.insertBoard(board);
//첨부파일 등록
if(StringUtils.isNotEmpty(board.getFileInfo())) {
ObjectMapper mapper = new ObjectMapper();
Map<String,Object> map = mapper.readValue(board.getFileInfo(), Map.class);
List<Object> fileList = (List<Object>)map.get("insertFile");
for(Object obj : fileList) {
FileInfo fileInfo = mapper.convertValue(obj, FileInfo.class);
fileInfo.setFileRefSrl(board.getBoardSrl());
fileInfo.setFileTp("board");
fileDao.insertFile(fileInfo);
}
}
}
/**
* 게시판 댓글 등록
* @param board
* @throws IOException
* @throws JsonMappingException
* @throws JsonParseException
*/
@Transactional
@SuppressWarnings("unchecked")
public void replyBoard(Board board) throws JsonParseException, JsonMappingException, IOException{
Board replyInfo = boardDao.selectBoardReply(board.getBoardSrl());
board.setFid(replyInfo.getFid());
board.setLev(replyInfo.getLev());
board.setStp(replyInfo.getStp());
boardDao.updateBoardReplyStp(board);
boardDao.insertBoard(board);
//첨부파일 등록
if(StringUtils.isNotEmpty(board.getFileInfo())) {
ObjectMapper mapper = new ObjectMapper();
Map<String,Object> map = mapper.readValue(board.getFileInfo(), Map.class);
List<Object> fileList = (List<Object>)map.get("insertFile");
for(Object obj : fileList) {
FileInfo fileInfo = mapper.convertValue(obj, FileInfo.class);
fileInfo.setFileRefSrl(board.getBoardSrl());
fileInfo.setFileTp("board");
fileDao.insertFile(fileInfo);
}
}
}
/**
* 게시판 수정
* @param board
* @throws IOException
* @throws JsonMappingException
* @throws JsonParseException
*/
@Transactional
@SuppressWarnings("unchecked")
public void updateBoard(Board board) throws JsonParseException, JsonMappingException, IOException {
boardDao.updateBoard(board);
if(StringUtils.isNotEmpty(board.getFileInfo())) {
ObjectMapper mapper = new ObjectMapper();
Map<String,Object> map = mapper.readValue(board.getFileInfo(), Map.class);
//첨부파일 등록
List<Object> fileList = (List<Object>)map.get("insertFile");
for(Object obj : fileList) {
FileInfo fileInfo = mapper.convertValue(obj, FileInfo.class);
fileInfo.setFileRefSrl(board.getBoardSrl());
fileInfo.setFileTp("board");
fileDao.insertFile(fileInfo);
}
//첨부파일 삭제
List<Object> deleteList = (List<Object>)map.get("deleteFile");
for(Object boardFileSrl : deleteList) {
FileInfo fileInfo = fileDao.selectFile((Integer)boardFileSrl);
FileManager.fileDelete(fileInfo.getFilePath() + "/" + fileInfo.getFileSysNm());
fileDao.deleteFile((Integer)boardFileSrl);
}
}
}
/**
* 게시판 삭제
* @param board
*/
@Transactional
public void deleteBoard(Board board) {
int isDelete = boardDao.deleteBoard(board);
if(isDelete > 0) {
Map<String,Object> map = new HashMap<String,Object>();
map.put("fileTp", "board");
map.put("fileRefSrl", board.getBoardSrl());
List<FileInfo> fileList = fileDao.selectFileList(map);
for(FileInfo fileInfo : fileList) {
FileManager.fileDelete(fileInfo.getFilePath() + "/" + fileInfo.getFileSysNm());
fileDao.deleteFile(fileInfo.getFileSrl());
}
}
}
}
|
UTF-8
|
Java
| 5,285 |
java
|
BoardService.java
|
Java
|
[] | null |
[] |
package com.stockholic.webapp.front.board.service;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.stockholic.core.module.model.FileInfo;
import com.stockholic.core.utils.FileManager;
import com.stockholic.webapp.front.board.dao.BoardDao;
import com.stockholic.webapp.front.board.dao.FileDao;
import com.stockholic.webapp.front.board.model.Board;
@Service
public class BoardService{
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private BoardDao boardDao;
@Autowired
private FileDao fileDao;
/**
* 게시판 수
* @param board
* @return
*/
public int selectBoardCount(Board board){
return boardDao.selectBoardCount(board);
}
/**
* 게시판 목록
* @param board
* @return
*/
public List<Board> selectBoardList(Board board){
board.setTotalRow(selectBoardCount(board));
return boardDao.selectBoardList(board);
}
/**
* 게시판 조회
* @param usrSrl
* @return
*/
public Board selectBoard(Integer boardSrl){
boardDao.updateBoardRead(boardSrl);
return boardDao.selectBoard(boardSrl);
}
/**
* 게시판 등록
* @param board
* @throws IOException
* @throws JsonMappingException
* @throws JsonParseException
*/
@Transactional
@SuppressWarnings("unchecked")
public void insertBoard(Board board) throws JsonParseException, JsonMappingException, IOException{
board.setFid(boardDao.selectBoardFid(board.getFlag()));
board.setLev(0);
board.setStp(1);
boardDao.insertBoard(board);
//첨부파일 등록
if(StringUtils.isNotEmpty(board.getFileInfo())) {
ObjectMapper mapper = new ObjectMapper();
Map<String,Object> map = mapper.readValue(board.getFileInfo(), Map.class);
List<Object> fileList = (List<Object>)map.get("insertFile");
for(Object obj : fileList) {
FileInfo fileInfo = mapper.convertValue(obj, FileInfo.class);
fileInfo.setFileRefSrl(board.getBoardSrl());
fileInfo.setFileTp("board");
fileDao.insertFile(fileInfo);
}
}
}
/**
* 게시판 댓글 등록
* @param board
* @throws IOException
* @throws JsonMappingException
* @throws JsonParseException
*/
@Transactional
@SuppressWarnings("unchecked")
public void replyBoard(Board board) throws JsonParseException, JsonMappingException, IOException{
Board replyInfo = boardDao.selectBoardReply(board.getBoardSrl());
board.setFid(replyInfo.getFid());
board.setLev(replyInfo.getLev());
board.setStp(replyInfo.getStp());
boardDao.updateBoardReplyStp(board);
boardDao.insertBoard(board);
//첨부파일 등록
if(StringUtils.isNotEmpty(board.getFileInfo())) {
ObjectMapper mapper = new ObjectMapper();
Map<String,Object> map = mapper.readValue(board.getFileInfo(), Map.class);
List<Object> fileList = (List<Object>)map.get("insertFile");
for(Object obj : fileList) {
FileInfo fileInfo = mapper.convertValue(obj, FileInfo.class);
fileInfo.setFileRefSrl(board.getBoardSrl());
fileInfo.setFileTp("board");
fileDao.insertFile(fileInfo);
}
}
}
/**
* 게시판 수정
* @param board
* @throws IOException
* @throws JsonMappingException
* @throws JsonParseException
*/
@Transactional
@SuppressWarnings("unchecked")
public void updateBoard(Board board) throws JsonParseException, JsonMappingException, IOException {
boardDao.updateBoard(board);
if(StringUtils.isNotEmpty(board.getFileInfo())) {
ObjectMapper mapper = new ObjectMapper();
Map<String,Object> map = mapper.readValue(board.getFileInfo(), Map.class);
//첨부파일 등록
List<Object> fileList = (List<Object>)map.get("insertFile");
for(Object obj : fileList) {
FileInfo fileInfo = mapper.convertValue(obj, FileInfo.class);
fileInfo.setFileRefSrl(board.getBoardSrl());
fileInfo.setFileTp("board");
fileDao.insertFile(fileInfo);
}
//첨부파일 삭제
List<Object> deleteList = (List<Object>)map.get("deleteFile");
for(Object boardFileSrl : deleteList) {
FileInfo fileInfo = fileDao.selectFile((Integer)boardFileSrl);
FileManager.fileDelete(fileInfo.getFilePath() + "/" + fileInfo.getFileSysNm());
fileDao.deleteFile((Integer)boardFileSrl);
}
}
}
/**
* 게시판 삭제
* @param board
*/
@Transactional
public void deleteBoard(Board board) {
int isDelete = boardDao.deleteBoard(board);
if(isDelete > 0) {
Map<String,Object> map = new HashMap<String,Object>();
map.put("fileTp", "board");
map.put("fileRefSrl", board.getBoardSrl());
List<FileInfo> fileList = fileDao.selectFileList(map);
for(FileInfo fileInfo : fileList) {
FileManager.fileDelete(fileInfo.getFilePath() + "/" + fileInfo.getFileSysNm());
fileDao.deleteFile(fileInfo.getFileSrl());
}
}
}
}
| 5,285 | 0.719264 | 0.718296 | 196 | 25.352041 | 23.859571 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.107143 | false | false |
0
|
00fb6aa6a2196b6e569ba28bd3ec2f5986bb14ab
| 8,787,503,122,079 |
75ec75648e4d35d979a63578bc45be595369d97c
|
/src/main/java/me/ziim/chatchannel/commands/listChannels.java
|
21fcdfcf30fedb659677d29d5206eb7c3b909778
|
[
"MIT"
] |
permissive
|
ZiiMs/ChatChannel
|
https://github.com/ZiiMs/ChatChannel
|
9d251f65aab2c3feed0070d2af1d533be4a0401c
|
d02f8853e9a4301265e52b6a92b63644178ca170
|
refs/heads/master
| 2023-01-02T06:20:01.365000 | 2020-10-16T14:32:36 | 2020-10-16T14:32:36 | 298,849,148 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package me.ziim.chatchannel.commands;
import me.ziim.chatchannel.Channel;
import me.ziim.chatchannel.ChatChannel;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class listChannels implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Channel[] channels = ChatChannel.cHelper.getChannels();
Player player = (Player) sender;
StringBuilder msg;
if (channels.length == 0) {
msg = new StringBuilder("No channels found.");
} else {
msg = new StringBuilder("All channels:\n");
for (Channel chan : channels) {
String tempString = chan.color + chan.channel + ": " + chan.prefix + ", ";
msg.append(tempString);
}
}
player.sendMessage(msg.toString());
return true;
}
}
|
UTF-8
|
Java
| 1,008 |
java
|
listChannels.java
|
Java
|
[] | null |
[] |
package me.ziim.chatchannel.commands;
import me.ziim.chatchannel.Channel;
import me.ziim.chatchannel.ChatChannel;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class listChannels implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Channel[] channels = ChatChannel.cHelper.getChannels();
Player player = (Player) sender;
StringBuilder msg;
if (channels.length == 0) {
msg = new StringBuilder("No channels found.");
} else {
msg = new StringBuilder("All channels:\n");
for (Channel chan : channels) {
String tempString = chan.color + chan.channel + ": " + chan.prefix + ", ";
msg.append(tempString);
}
}
player.sendMessage(msg.toString());
return true;
}
}
| 1,008 | 0.645833 | 0.644841 | 28 | 35 | 24.02231 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.714286 | false | false |
0
|
b2af67f1ef7bc3162d52f20c636635823ff32cb2
| 23,252,952,967,702 |
0c59e608da8f3dbe951f811e1baf0200a4b89542
|
/src/main/java/com/cisco/controller/MenuAppCtrl.java
|
d54631006ff38f65d269b71ecfa24aa112bc285f
|
[] |
no_license
|
kevinyuchi/fitUtil
|
https://github.com/kevinyuchi/fitUtil
|
43d73e587ec684619dc3147baa5d2e55c959e18a
|
5947ab39b4c60f3c99c200153e7d939e9dec8d08
|
refs/heads/master
| 2020-12-02T21:16:00.464000 | 2017-07-05T06:18:34 | 2017-07-05T06:18:34 | 96,283,828 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cisco.controller;
import org.json.simple.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.cisco.service.FileExporter;
/**
* Created by kkaiwen on 7/3/17.
*/
@RestController
public class MenuAppCtrl {
private static Logger logger = LoggerFactory.getLogger(MenuAppCtrl.class);
@Autowired
FileExporter fileExporter;
@RequestMapping(value = "/api/get", method = RequestMethod.GET)
String apiGet() {
return "get method !\n";
}
// @RequestMapping(value = "{userId}/api/post", method = RequestMethod.POST)
// String apiPost(@PathVariable String userId, @RequestBody JSONObject postBody) {
// if (postBody.containsKey("test") && userId != null) {
// return "post method success !\n";
// }
// return "post method not success !\n";
// }
@RequestMapping(value = "/api/post", method = RequestMethod.POST)
String apiPost(@RequestBody JSONObject postBody) {
if (postBody.containsKey("CampaignId")) {
fileExporter.metaDataReader(postBody);
return "File has been exported !\n";
}
return "Missing Campaign Id !\n";
}
}
|
UTF-8
|
Java
| 1,224 |
java
|
MenuAppCtrl.java
|
Java
|
[
{
"context": "om.cisco.service.FileExporter;\n\n\n/**\n * Created by kkaiwen on 7/3/17.\n */\n\n@RestController\n\n\npublic class Me",
"end": 302,
"score": 0.9996814727783203,
"start": 295,
"tag": "USERNAME",
"value": "kkaiwen"
}
] | null |
[] |
package com.cisco.controller;
import org.json.simple.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.cisco.service.FileExporter;
/**
* Created by kkaiwen on 7/3/17.
*/
@RestController
public class MenuAppCtrl {
private static Logger logger = LoggerFactory.getLogger(MenuAppCtrl.class);
@Autowired
FileExporter fileExporter;
@RequestMapping(value = "/api/get", method = RequestMethod.GET)
String apiGet() {
return "get method !\n";
}
// @RequestMapping(value = "{userId}/api/post", method = RequestMethod.POST)
// String apiPost(@PathVariable String userId, @RequestBody JSONObject postBody) {
// if (postBody.containsKey("test") && userId != null) {
// return "post method success !\n";
// }
// return "post method not success !\n";
// }
@RequestMapping(value = "/api/post", method = RequestMethod.POST)
String apiPost(@RequestBody JSONObject postBody) {
if (postBody.containsKey("CampaignId")) {
fileExporter.metaDataReader(postBody);
return "File has been exported !\n";
}
return "Missing Campaign Id !\n";
}
}
| 1,224 | 0.712418 | 0.707516 | 50 | 23.48 | 25.081659 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54 | false | false |
0
|
6ce5d1502032dbe1b44af1fb387af838fbcd6aa7
| 14,774,687,515,312 |
4fa7247594f8c33ce646265214e2f5bf6230cbe0
|
/qaapi/src/com/qaapi/action/WechatAnswerAction.java
|
f355ee6faf5367b06302de9903db85d8af658925
|
[] |
no_license
|
GlacierStudioQ/qaapi
|
https://github.com/GlacierStudioQ/qaapi
|
93e2c54679c6a4d42114b28c9f6a6d1a63823c9d
|
5414985c5b9db469491d076b2252ec7a69e14c8a
|
refs/heads/master
| 2021-01-18T22:37:47.653000 | 2016-06-04T01:51:58 | 2016-06-04T01:51:58 | 55,666,726 | 5 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.qaapi.action;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import com.qaapi.bean.FaqEntry;
import com.qaapi.kei.QueryMatchKeiService;
import com.qaapi.lcs.QueryMatchLcsService;
import com.qaapi.lucenequery.QueryMatchService;
import com.qaapi.util.FilterAnswersUtil;
import com.qaapi.util.ReturnJson;
import com.qaapi.util.WechatUtil;
import static com.qaapi.util.WechatUtil.*;
import static com.qaapi.util.GlobeStatus.*;
@ParentPackage(value = "struts-default")
public class WechatAnswerAction extends BaseAction {
private static final long serialVersionUID = 1L;
public String answer() throws Exception {
System.out.println("sys => into wechat answer action");
HttpServletRequest req = ServletActionContext.getRequest();
Map<String, String> xmlMap = WechatUtil.parseReqXml(req);
String question = xmlMap.get(WX_Content);
List<List<FaqEntry>> answersByAllMethod = new ArrayList<List<FaqEntry>>();
// answersByAllMethod.add(QueryMatchService.queryMatch(schemaName, question));
// answersByAllMethod.add(QueryMatchLcsService.queryMatch(schemaName, question));
// answersByAllMethod.add(QueryMatchKeiService.queryMatch(schemaName, question));
// 计算获得的匹配结果总数,并找出最匹配的结果
//TODO: 最匹配的结果先定义为字数最相近的结果
int totalCount = 0;
FaqEntry fitAnswer = FilterAnswersUtil.LengthMaxMatch(answersByAllMethod);
if(totalCount == 0){
String respXml = WechatUtil.makeRespXml(xmlMap, "未查询到结果");
getResponseWriter().append(respXml).flush();
}else{
// String respXml = WechatUtil.makeRespXml(xmlMap, content);
// getResponseWriter().append(respXml).flush();
}
return NONE;
}
//============setter&getter============
}
|
UTF-8
|
Java
| 2,229 |
java
|
WechatAnswerAction.java
|
Java
|
[] | null |
[] |
package com.qaapi.action;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import com.qaapi.bean.FaqEntry;
import com.qaapi.kei.QueryMatchKeiService;
import com.qaapi.lcs.QueryMatchLcsService;
import com.qaapi.lucenequery.QueryMatchService;
import com.qaapi.util.FilterAnswersUtil;
import com.qaapi.util.ReturnJson;
import com.qaapi.util.WechatUtil;
import static com.qaapi.util.WechatUtil.*;
import static com.qaapi.util.GlobeStatus.*;
@ParentPackage(value = "struts-default")
public class WechatAnswerAction extends BaseAction {
private static final long serialVersionUID = 1L;
public String answer() throws Exception {
System.out.println("sys => into wechat answer action");
HttpServletRequest req = ServletActionContext.getRequest();
Map<String, String> xmlMap = WechatUtil.parseReqXml(req);
String question = xmlMap.get(WX_Content);
List<List<FaqEntry>> answersByAllMethod = new ArrayList<List<FaqEntry>>();
// answersByAllMethod.add(QueryMatchService.queryMatch(schemaName, question));
// answersByAllMethod.add(QueryMatchLcsService.queryMatch(schemaName, question));
// answersByAllMethod.add(QueryMatchKeiService.queryMatch(schemaName, question));
// 计算获得的匹配结果总数,并找出最匹配的结果
//TODO: 最匹配的结果先定义为字数最相近的结果
int totalCount = 0;
FaqEntry fitAnswer = FilterAnswersUtil.LengthMaxMatch(answersByAllMethod);
if(totalCount == 0){
String respXml = WechatUtil.makeRespXml(xmlMap, "未查询到结果");
getResponseWriter().append(respXml).flush();
}else{
// String respXml = WechatUtil.makeRespXml(xmlMap, content);
// getResponseWriter().append(respXml).flush();
}
return NONE;
}
//============setter&getter============
}
| 2,229 | 0.740533 | 0.736793 | 70 | 28.557142 | 24.260866 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.642857 | false | false |
0
|
1ef6790d7e0774cca9960a500eadc885ade93539
| 14,774,687,513,878 |
8e6693610cac86dcd1b7b0219a75d06f13d137cd
|
/APCSA/src/Unit9/ListOddToEven.java
|
2f9a59d9c096b3a7d3e307708f8ae55b7efbe8c3
|
[] |
no_license
|
tylercostello/CompSciA
|
https://github.com/tylercostello/CompSciA
|
a65ad2a8d0bdfcc073f4f8272d34a3e908c99090
|
ceef673138af93164becfe7428b9edcf4fd7c1e2
|
refs/heads/master
| 2020-12-23T21:06:17.599000 | 2020-06-05T21:40:11 | 2020-06-05T21:40:11 | 237,273,861 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//(c) A+ Computer Science
//www.apluscompsci.com
//Name -
//Date -
package Unit9;
import java.util.ArrayList;
import java.util.List;
public class ListOddToEven
{
public static int go( List<Integer> ray )
{
int firstOdd=-1;
int lastEven=-1;
for (int i=0; i<ray.size(); i++){
if (ray.get(i)%2==1 && firstOdd==-1){
firstOdd=i;
}
if (firstOdd!=-1){
if (ray.get(i)%2==0){
lastEven=i;
}
}
}
if (firstOdd==-1 || lastEven==-1){
return -1;
}
else{
return lastEven-firstOdd;
}
}
}
|
UTF-8
|
Java
| 525 |
java
|
ListOddToEven.java
|
Java
|
[] | null |
[] |
//(c) A+ Computer Science
//www.apluscompsci.com
//Name -
//Date -
package Unit9;
import java.util.ArrayList;
import java.util.List;
public class ListOddToEven
{
public static int go( List<Integer> ray )
{
int firstOdd=-1;
int lastEven=-1;
for (int i=0; i<ray.size(); i++){
if (ray.get(i)%2==1 && firstOdd==-1){
firstOdd=i;
}
if (firstOdd!=-1){
if (ray.get(i)%2==0){
lastEven=i;
}
}
}
if (firstOdd==-1 || lastEven==-1){
return -1;
}
else{
return lastEven-firstOdd;
}
}
}
| 525 | 0.580952 | 0.55619 | 32 | 15.4375 | 12.338804 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.09375 | false | false |
0
|
5a93579bdbd25d99c98a18b6f045520b6177d0fa
| 3,143,916,076,286 |
6c176022f3782b0383c552ae094dd9d9e3ab9220
|
/blood/app/src/main/java/com/bloodapp/blood/map.java
|
9db875476445d168a21159cac19335896bc7b7dd
|
[] |
no_license
|
habibrhmn/origind
|
https://github.com/habibrhmn/origind
|
4f4bc4c294f6b333b0b3cfe3512a81473700216c
|
63bfa610f6035df701f9632319eb9b35fb52e316
|
refs/heads/master
| 2022-12-01T06:18:43.582000 | 2022-11-14T02:37:52 | 2022-11-14T02:37:52 | 245,850,027 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bloodapp.blood;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.ChildEventListener;
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 java.lang.reflect.Array;
import java.util.EventListener;
public class map extends FragmentActivity implements OnMapReadyCallback {
FirebaseDatabase mDatabase;
DatabaseReference mDatabaseReference;
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
mDatabase = FirebaseDatabase.getInstance();
mDatabaseReference = mDatabase.getReference("Location");
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mDatabaseReference.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
LatLng newLocation = new LatLng(dataSnapshot.child("Latitude").getValue(Double.class),dataSnapshot.child("Longitude").getValue(Double.class));
mMap.addMarker(new MarkerOptions().position(newLocation).title(dataSnapshot.child("Name").getValue().toString()));
//mMap.animateCamera(CameraUpdateFactory.zoomTo(107.04f));
}
@Override
public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
|
UTF-8
|
Java
| 2,890 |
java
|
map.java
|
Java
|
[] | null |
[] |
package com.bloodapp.blood;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.ChildEventListener;
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 java.lang.reflect.Array;
import java.util.EventListener;
public class map extends FragmentActivity implements OnMapReadyCallback {
FirebaseDatabase mDatabase;
DatabaseReference mDatabaseReference;
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
mDatabase = FirebaseDatabase.getInstance();
mDatabaseReference = mDatabase.getReference("Location");
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mDatabaseReference.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
LatLng newLocation = new LatLng(dataSnapshot.child("Latitude").getValue(Double.class),dataSnapshot.child("Longitude").getValue(Double.class));
mMap.addMarker(new MarkerOptions().position(newLocation).title(dataSnapshot.child("Name").getValue().toString()));
//mMap.animateCamera(CameraUpdateFactory.zoomTo(107.04f));
}
@Override
public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| 2,890 | 0.721453 | 0.719723 | 79 | 35.582279 | 32.835072 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.493671 | false | false |
0
|
b34093c20950c30d449dfd9c9d70d3e0533edb6e
| 17,789,754,575,563 |
f6c43b1d90a1194924764c9caedc40d64114fbf3
|
/src/JDBCTest/Main.java
|
150d56d74e9f743de1f526e484b3732ecb406e45
|
[] |
no_license
|
wangrenqi/JavaPractice
|
https://github.com/wangrenqi/JavaPractice
|
e9a1886cd774e4fac28aff7a52c13889826d2eec
|
6f901f38f40138f0b4f724b27ec9c66ab7a4b19f
|
refs/heads/master
| 2020-06-16T12:53:00.166000 | 2016-12-23T14:55:47 | 2016-12-23T14:55:47 | 75,100,007 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package JDBCTest;
/**
* Created by Mccree on 01/12/2016.
*/
public class Main {
public static void main(String[] args) {
}
}
|
UTF-8
|
Java
| 138 |
java
|
Main.java
|
Java
|
[
{
"context": "package JDBCTest;\n\n/**\n * Created by Mccree on 01/12/2016.\n */\npublic class Main {\n public",
"end": 43,
"score": 0.9990814328193665,
"start": 37,
"tag": "USERNAME",
"value": "Mccree"
}
] | null |
[] |
package JDBCTest;
/**
* Created by Mccree on 01/12/2016.
*/
public class Main {
public static void main(String[] args) {
}
}
| 138 | 0.615942 | 0.557971 | 11 | 11.545455 | 14.736249 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | false | false |
0
|
d9f43d5d4e99556659b40c91e51781dc25add719
| 9,972,914,116,686 |
cbf1ca7139d291ed0e52228bfd425037c0a726aa
|
/src/com/ad/Prom_11.java
|
eb21af8652ef1c52a10e8090f1dd5aa6ab95a47c
|
[] |
no_license
|
ilustyle/algorithm
|
https://github.com/ilustyle/algorithm
|
325a8571129286e68f4f41ab8ab001f7a9e31466
|
f6efb24a0ae3cf3f3d40d4243ad631c6f7e6ee7a
|
refs/heads/master
| 2021-01-23T15:59:06.955000 | 2017-07-02T02:55:52 | 2017-07-02T02:55:52 | 93,252,358 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ad;
import java.util.*;
import java.io.FileInputStream;
public class Prom_11 {
/**
* @param args
* 심해 탐사 - 기출
*/
static int N, M, W, Answer;
static int[][] S;
public static void main(String[] args)throws Exception {
// TODO Auto-generated method stub
System.setIn(new FileInputStream("src/data/prom11"));
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int test_case = 1; test_case <= T; test_case++){
/////////////////////////////////////////////////////////
N = sc.nextInt();
S = new int[10000][2];
int[] sort = new int [N];
for (int i = 0; i < N; i++) {
S[i][0] = sc.nextInt();
S[i][1] = sc.nextInt();
sort[i] = S[i][1]*10000+S[i][0];
sort[i] = S[i][1]*10000+S[i][0];
//System.out.println(sort[i]);
}
Arrays.sort(sort);
for (int i = 0; i < sort.length; i++) {
System.out.println(sort[i]);
}
int sum = 0;
Answer = 0;
int max = Integer.MIN_VALUE;
for (int i = 0; i < N; i++) {
int a = sort[i]/10000;
int b = sort[i]%10000;
sum += b;
//System.out.println(sum-a);
if(sum-a > max) {
max = sum-a;
}
}
System.out.println(max);
/////////////////////////////////////////////////////////
} // end for
} // end main
}
|
UTF-8
|
Java
| 1,356 |
java
|
Prom_11.java
|
Java
|
[] | null |
[] |
package com.ad;
import java.util.*;
import java.io.FileInputStream;
public class Prom_11 {
/**
* @param args
* 심해 탐사 - 기출
*/
static int N, M, W, Answer;
static int[][] S;
public static void main(String[] args)throws Exception {
// TODO Auto-generated method stub
System.setIn(new FileInputStream("src/data/prom11"));
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int test_case = 1; test_case <= T; test_case++){
/////////////////////////////////////////////////////////
N = sc.nextInt();
S = new int[10000][2];
int[] sort = new int [N];
for (int i = 0; i < N; i++) {
S[i][0] = sc.nextInt();
S[i][1] = sc.nextInt();
sort[i] = S[i][1]*10000+S[i][0];
sort[i] = S[i][1]*10000+S[i][0];
//System.out.println(sort[i]);
}
Arrays.sort(sort);
for (int i = 0; i < sort.length; i++) {
System.out.println(sort[i]);
}
int sum = 0;
Answer = 0;
int max = Integer.MIN_VALUE;
for (int i = 0; i < N; i++) {
int a = sort[i]/10000;
int b = sort[i]%10000;
sum += b;
//System.out.println(sum-a);
if(sum-a > max) {
max = sum-a;
}
}
System.out.println(max);
/////////////////////////////////////////////////////////
} // end for
} // end main
}
| 1,356 | 0.465723 | 0.434426 | 58 | 21.137932 | 16.372231 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.948276 | false | false |
0
|
667729eff241638a6a0500b6ad33d7c056d575bd
| 9,448,928,064,050 |
2a2a36c897db58eabaa19fcb75749aa8cf015da2
|
/src/test/java/org/kairosdb/core/carbon/GraphiteTagParserTest.java
|
3744d14fd8ec864ef2271a9b693573d5d5d222b6
|
[
"Apache-2.0"
] |
permissive
|
joemiller/kairosdb-graphite-tag-parser
|
https://github.com/joemiller/kairosdb-graphite-tag-parser
|
6d04e74fe2180ddb49f478d06112dc4b8b7d5ae5
|
ab2897832d508d3a543c7a546e30d85f3f956009
|
refs/heads/master
| 2021-01-10T20:49:44.141000 | 2014-03-01T23:24:59 | 2014-03-01T23:24:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//
// TagGroupByResultTest.java
//
// Copyright 2013, Proofpoint Inc. All rights reserved.
//
package org.kairosdb.core.carbon;
import org.kairosdb.core.DataPointSet;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import java.util.*;
public class GraphiteTagParserTest
{
@Test
public void test_parse() {
GraphiteTagParser parser = new GraphiteTagParser();
DataPointSet dps = parser.parseMetricName("metric.name;tag1=val1,tag-2=val2_special-chars");
SortedMap<String, String> expected_tags = new TreeMap<String, String>();
expected_tags.put("tag1", "val1");
expected_tags.put("tag-2", "val2_special-chars");
assertThat(dps.getName(), equalTo("metric.name"));
assertThat(dps.getTags(), equalTo(expected_tags));
}
}
|
UTF-8
|
Java
| 870 |
java
|
GraphiteTagParserTest.java
|
Java
|
[] | null |
[] |
//
// TagGroupByResultTest.java
//
// Copyright 2013, Proofpoint Inc. All rights reserved.
//
package org.kairosdb.core.carbon;
import org.kairosdb.core.DataPointSet;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import java.util.*;
public class GraphiteTagParserTest
{
@Test
public void test_parse() {
GraphiteTagParser parser = new GraphiteTagParser();
DataPointSet dps = parser.parseMetricName("metric.name;tag1=val1,tag-2=val2_special-chars");
SortedMap<String, String> expected_tags = new TreeMap<String, String>();
expected_tags.put("tag1", "val1");
expected_tags.put("tag-2", "val2_special-chars");
assertThat(dps.getName(), equalTo("metric.name"));
assertThat(dps.getTags(), equalTo(expected_tags));
}
}
| 870 | 0.695402 | 0.681609 | 30 | 28 | 27.238453 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733333 | false | false |
0
|
aca457dcc2e42932094e382648c491f6c1990c4a
| 23,897,198,067,010 |
7d5961d0ed2578036f3974f6f784063070868301
|
/main/java/by/epam/geometrysecond/action/TriangleAction.java
|
e5e1838e270f8b387dfdb263896c613de66a92ed
|
[] |
no_license
|
RuslanKorshunov/GeometrySecond
|
https://github.com/RuslanKorshunov/GeometrySecond
|
27f25fb3f94a3a281a61e522a2793a74b082d35d
|
6d452673b0fc90cfe3007ea25174cdc538c21a5b
|
refs/heads/master
| 2021-10-23T22:14:14.838000 | 2019-03-14T18:50:54 | 2019-03-14T18:50:54 | 176,727,056 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package by.epam.geometrysecond.action;
import by.epam.geometrysecond.entity.Point;
import by.epam.geometrysecond.entity.Triangle;
import java.util.Arrays;
public class TriangleAction
{
public boolean isTriangle(Triangle triangle)
{
boolean answer=false;
double[]sides= findSides(triangle);
if(sides[0]<(sides[1]+sides[2]) && sides[1]<(sides[0]+sides[2]) && sides[2]<(sides[0]+sides[1]))
{
answer=true;
}
return answer;
}
public double calculateSide(Point first, Point second)
{
double answer=0;
double firstSide=first.getX()-second.getX();
double secondSide=first.getY()-second.getY();
answer=Math.hypot(firstSide, secondSide);
return answer;
}
public double perimeter(Triangle triangle) throws TriangleNotExistsException
{
double perimeter=0;
if(isTriangle(triangle))
{
double[]sides= findSides(triangle);
perimeter=sides[0]+sides[1]+sides[2];
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return perimeter;
}
public double square(Triangle triangle) throws TriangleNotExistsException
{
double square=0;
if(isTriangle(triangle))
{
double semiperimeter=perimeter(triangle)/2;
double[]sides= findSides(triangle);
square=Math.sqrt(semiperimeter*(semiperimeter-sides[0])*(semiperimeter-sides[1])*(semiperimeter-sides[2]));
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return square;
}
public boolean isRightTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides= findSides(triangle);
if(sides[0]==Math.hypot(sides[1], sides[2]) ||
sides[1]==Math.hypot(sides[0], sides[2]) ||
sides[2]==Math.hypot(sides[0], sides[1]))
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
public boolean isIsoscelesTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides= findSides(triangle);
if(sides[0]==sides[1] || sides[1]==sides[2] || sides[0]==sides[2])
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
public boolean isEquilateralTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides= findSides(triangle);
if(sides[0]==sides[1] && sides[1]==sides[2])
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
public boolean isAcuteTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides=findSides(triangle);
Arrays.sort(sides);
if(sides[2]*sides[2]<sides[0]*sides[0]+sides[1]*sides[1])
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
public boolean isObtuseTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides=findSides(triangle);
Arrays.sort(sides);
if(sides[2]*sides[2]>sides[0]*sides[0]+sides[1]*sides[1])
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
private double[] findSides(Triangle triangle)
{
Point first=triangle.getFirst();
Point second=triangle.getSecond();
Point third=triangle.getThird();
double[]sides=new double[3];
sides[0]=calculateSide(first, second);
sides[1]=calculateSide(second, third);
sides[2]=calculateSide(first, third);
return sides;
}
}
|
UTF-8
|
Java
| 4,818 |
java
|
TriangleAction.java
|
Java
|
[] | null |
[] |
package by.epam.geometrysecond.action;
import by.epam.geometrysecond.entity.Point;
import by.epam.geometrysecond.entity.Triangle;
import java.util.Arrays;
public class TriangleAction
{
public boolean isTriangle(Triangle triangle)
{
boolean answer=false;
double[]sides= findSides(triangle);
if(sides[0]<(sides[1]+sides[2]) && sides[1]<(sides[0]+sides[2]) && sides[2]<(sides[0]+sides[1]))
{
answer=true;
}
return answer;
}
public double calculateSide(Point first, Point second)
{
double answer=0;
double firstSide=first.getX()-second.getX();
double secondSide=first.getY()-second.getY();
answer=Math.hypot(firstSide, secondSide);
return answer;
}
public double perimeter(Triangle triangle) throws TriangleNotExistsException
{
double perimeter=0;
if(isTriangle(triangle))
{
double[]sides= findSides(triangle);
perimeter=sides[0]+sides[1]+sides[2];
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return perimeter;
}
public double square(Triangle triangle) throws TriangleNotExistsException
{
double square=0;
if(isTriangle(triangle))
{
double semiperimeter=perimeter(triangle)/2;
double[]sides= findSides(triangle);
square=Math.sqrt(semiperimeter*(semiperimeter-sides[0])*(semiperimeter-sides[1])*(semiperimeter-sides[2]));
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return square;
}
public boolean isRightTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides= findSides(triangle);
if(sides[0]==Math.hypot(sides[1], sides[2]) ||
sides[1]==Math.hypot(sides[0], sides[2]) ||
sides[2]==Math.hypot(sides[0], sides[1]))
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
public boolean isIsoscelesTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides= findSides(triangle);
if(sides[0]==sides[1] || sides[1]==sides[2] || sides[0]==sides[2])
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
public boolean isEquilateralTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides= findSides(triangle);
if(sides[0]==sides[1] && sides[1]==sides[2])
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
public boolean isAcuteTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides=findSides(triangle);
Arrays.sort(sides);
if(sides[2]*sides[2]<sides[0]*sides[0]+sides[1]*sides[1])
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
public boolean isObtuseTriangle(Triangle triangle) throws TriangleNotExistsException
{
boolean answer=false;
if(isTriangle(triangle))
{
double[]sides=findSides(triangle);
Arrays.sort(sides);
if(sides[2]*sides[2]>sides[0]*sides[0]+sides[1]*sides[1])
{
answer=true;
}
}
else
{
throw new TriangleNotExistsException(triangle.toString()+" doesn't exist");
}
return answer;
}
private double[] findSides(Triangle triangle)
{
Point first=triangle.getFirst();
Point second=triangle.getSecond();
Point third=triangle.getThird();
double[]sides=new double[3];
sides[0]=calculateSide(first, second);
sides[1]=calculateSide(second, third);
sides[2]=calculateSide(first, third);
return sides;
}
}
| 4,818 | 0.561436 | 0.550228 | 166 | 28.030121 | 26.717493 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.451807 | false | false |
0
|
512555034d593c00e304edb6bfee9a3f87c4f1bf
| 28,372,553,988,688 |
4f42ff2ca076a23164341bdaefb75897a95c4b8e
|
/spring-boot-demo/src/main/java/com/haozi/demo/springboot/dao/AquaticCategoryInfoMapper.java
|
f298f1a6d1f68afd120c846913657c0cf0a97266
|
[] |
no_license
|
haoziapple/spring_component
|
https://github.com/haoziapple/spring_component
|
7c8b8d0cd29f311030e18580eb435b8aa2c8ec83
|
6124a83e207094529787b93f22c2bd67fa03c6d2
|
refs/heads/master
| 2021-01-20T14:25:17.712000 | 2018-01-05T02:54:37 | 2018-01-05T02:54:37 | 90,608,857 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.haozi.demo.springboot.dao;
import com.haozi.demo.springboot.bean.po.AquaticCategoryInfo;
public interface AquaticCategoryInfoMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int insert(AquaticCategoryInfo record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int insertSelective(AquaticCategoryInfo record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
AquaticCategoryInfo selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(AquaticCategoryInfo record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int updateByPrimaryKey(AquaticCategoryInfo record);
}
|
UTF-8
|
Java
| 1,512 |
java
|
AquaticCategoryInfoMapper.java
|
Java
|
[] | null |
[] |
package com.haozi.demo.springboot.dao;
import com.haozi.demo.springboot.bean.po.AquaticCategoryInfo;
public interface AquaticCategoryInfoMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int insert(AquaticCategoryInfo record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int insertSelective(AquaticCategoryInfo record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
AquaticCategoryInfo selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(AquaticCategoryInfo record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table aquatic_category_info
*
* @mbggenerated
*/
int updateByPrimaryKey(AquaticCategoryInfo record);
}
| 1,512 | 0.687169 | 0.687169 | 53 | 27.547171 | 26.299843 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.150943 | false | false |
0
|
1d31177394bbc25d165f566b7eb39094ba95bd5a
| 17,136,919,573,084 |
7e38f54b5709d4b2e3781ea2096b73ee48525e8e
|
/src/main/java/com/zozospider/hadoop/mapreduce/join/reducejoin/ReduceJoinDriver.java
|
5228603b269c7bcd61ebad1f814bae84b0aa8c46
|
[] |
no_license
|
zozospider/note-hadoop-video1
|
https://github.com/zozospider/note-hadoop-video1
|
0b8f391ab9994edccf628ecfa77db8e0c97d3fbd
|
09678d2506fb825e6cce2e4af4c012c2718d39ed
|
refs/heads/master
| 2022-05-19T09:16:24.455000 | 2019-10-27T13:12:18 | 2019-10-27T13:12:18 | 211,523,940 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zozospider.hadoop.mapreduce.join.reducejoin;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import java.io.IOException;
/**
* MapReduce 驱动: 在 fa 的每 1 行尾部添加 field3 (bId) 对应的 fb 中的 field2 (bName).
*/
public class ReduceJoinDriver {
/**
* spiderxmac:input zoz$ ls -l /Users/zoz/zz/other/tmp/MapReduce/input/join/ReduceJoin/
* total 16
* -rw-r--r-- 1 zoz staff 105 10 14 23:20 fa
* -rw-r--r-- 1 zoz staff 67 10 15 00:42 fb
* spiderxmac:input zoz$ cat join/ReduceJoin/fa
* 1 Frank 3
* 2 Jack 5
* 3 John 6
* 4 Olivia 2
* 5 Ava 5
* 6 Mia 1
* 7 David 3
* 8 Anna 4
* 9 Lily 2
* 10 Luke 1
* 11 Oliver 2
* spiderxmac:input zoz$ cat join/ReduceJoin/fb
* 1 New_York
* 2 Los_Angeles
* 3 Chicago
* 4 Houston
* 5 Dallas
* 6 Washington
* spiderxmac:input zoz$
* <p>
* spiderxmac:output zoz$ ls -l /Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin/
* ls: /Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin/: No such file or directory
* spiderxmac:output zoz$
*/
public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
// 本地运行时不要注释下面 1 行
args = new String[]{"/Users/zoz/zz/other/tmp/MapReduce/input/join/ReduceJoin", "/Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin"};
// 1 获取 Job 对象
Configuration conf = new Configuration();
Job job = Job.getInstance(conf);
// 2 设置 Jar, Mapper, Reducer 类
job.setJarByClass(ReduceJoinDriver.class);
job.setMapperClass(ReduceJoinMapper.class);
job.setReducerClass(ReduceJoinReducer.class);
// 3 设置 Map 阶段和最终的 KEYOUT, VALUEOUT
job.setMapOutputKeyClass(IntWritable.class);
job.setMapOutputValueClass(ReduceJoinValueWritable.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(NullWritable.class);
// 4 设置输入输出路径
FileInputFormat.setInputPaths(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
// 5 提交 Job
boolean result = job.waitForCompletion(true);
System.exit(result ? 0 : 1);
}
/**
* spiderxmac:output zoz$ ls -l /Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin/
* total 8
* -rw-r--r-- 1 zoz staff 0 10 15 00:43 _SUCCESS
* -rw-r--r-- 1 zoz staff 505 10 15 00:43 part-r-00000
* spiderxmac:output zoz$ cat join/ReduceJoin/part-r-00000
* aId: 10, aName: Luke, bId: 1, bName: New_York
* aId: 6, aName: Mia, bId: 1, bName: New_York
* aId: 11, aName: Oliver, bId: 2, bName: Los_Angeles
* aId: 9, aName: Lily, bId: 2, bName: Los_Angeles
* aId: 4, aName: Olivia, bId: 2, bName: Los_Angeles
* aId: 7, aName: David, bId: 3, bName: Chicago
* aId: 1, aName: Frank, bId: 3, bName: Chicago
* aId: 8, aName: Anna, bId: 4, bName: Houston
* aId: 5, aName: Ava, bId: 5, bName: Dallas
* aId: 2, aName: Jack, bId: 5, bName: Dallas
* aId: 3, aName: John, bId: 6, bName: Washington
* spiderxmac:output zoz$
*/
/**
* 2019-10-15 00:43:25,298 WARN [org.apache.hadoop.util.NativeCodeLoader] - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
* 2019-10-15 00:43:25,459 INFO [org.apache.hadoop.conf.Configuration.deprecation] - session.id is deprecated. Instead, use dfs.metrics.session-id
* 2019-10-15 00:43:25,459 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Initializing JVM Metrics with processName=JobTracker, sessionId=
* 2019-10-15 00:43:25,875 WARN [org.apache.hadoop.mapreduce.JobResourceUploader] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this.
* 2019-10-15 00:43:25,880 WARN [org.apache.hadoop.mapreduce.JobResourceUploader] - No job jar file set. User classes may not be found. See Job or Job#setJar(String).
* 2019-10-15 00:43:25,902 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 2
* 2019-10-15 00:43:25,944 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:2
* 2019-10-15 00:43:26,016 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local1385696579_0001
* 2019-10-15 00:43:26,130 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null
* 2019-10-15 00:43:26,130 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/
* 2019-10-15 00:43:26,131 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local1385696579_0001
* 2019-10-15 00:43:26,132 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - File Output Committer Algorithm version is 1
* 2019-10-15 00:43:26,133 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
* 2019-10-15 00:43:26,157 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks
* 2019-10-15 00:43:26,157 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1385696579_0001_m_000000_0
* 2019-10-15 00:43:26,174 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - File Output Committer Algorithm version is 1
* 2019-10-15 00:43:26,178 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux.
* 2019-10-15 00:43:26,179 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : null
* 2019-10-15 00:43:26,182 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/Users/zoz/zz/other/tmp/MapReduce/input/join/ReduceJoin/fa:0+105
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584)
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600
* 2019-10-15 00:43:26,236 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.LocalJobRunner] -
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 268; bufvoid = 104857600
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600
* 2019-10-15 00:43:26,245 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0
* 2019-10-15 00:43:26,247 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1385696579_0001_m_000000_0 is done. And is in the process of committing
* 2019-10-15 00:43:26,252 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map
* 2019-10-15 00:43:26,252 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1385696579_0001_m_000000_0' done.
* 2019-10-15 00:43:26,252 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1385696579_0001_m_000000_0
* 2019-10-15 00:43:26,252 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1385696579_0001_m_000001_0
* 2019-10-15 00:43:26,253 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - File Output Committer Algorithm version is 1
* 2019-10-15 00:43:26,253 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux.
* 2019-10-15 00:43:26,253 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : null
* 2019-10-15 00:43:26,254 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/Users/zoz/zz/other/tmp/MapReduce/input/join/ReduceJoin/fb:0+67
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584)
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600
* 2019-10-15 00:43:26,300 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.LocalJobRunner] -
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 169; bufvoid = 104857600
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214376(104857504); length = 21/6553600
* 2019-10-15 00:43:26,302 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0
* 2019-10-15 00:43:26,303 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1385696579_0001_m_000001_0 is done. And is in the process of committing
* 2019-10-15 00:43:26,304 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map
* 2019-10-15 00:43:26,304 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1385696579_0001_m_000001_0' done.
* 2019-10-15 00:43:26,304 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1385696579_0001_m_000001_0
* 2019-10-15 00:43:26,305 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete.
* 2019-10-15 00:43:26,306 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks
* 2019-10-15 00:43:26,306 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1385696579_0001_r_000000_0
* 2019-10-15 00:43:26,311 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - File Output Committer Algorithm version is 1
* 2019-10-15 00:43:26,311 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux.
* 2019-10-15 00:43:26,311 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : null
* 2019-10-15 00:43:26,313 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@5bc3940e
* 2019-10-15 00:43:26,321 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=2672505600, maxSingleShuffleLimit=668126400, mergeThreshold=1763853824, ioSortFactor=10, memToMemMergeOutputsThreshold=10
* 2019-10-15 00:43:26,323 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local1385696579_0001_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events
* 2019-10-15 00:43:26,351 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#1 about to shuffle output of map attempt_local1385696579_0001_m_000000_0 decomp: 292 len: 296 to MEMORY
* 2019-10-15 00:43:26,362 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 292 bytes from map-output for attempt_local1385696579_0001_m_000000_0
* 2019-10-15 00:43:26,362 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 292, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->292
* 2019-10-15 00:43:26,364 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#1 about to shuffle output of map attempt_local1385696579_0001_m_000001_0 decomp: 183 len: 187 to MEMORY
* 2019-10-15 00:43:26,364 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 183 bytes from map-output for attempt_local1385696579_0001_m_000001_0
* 2019-10-15 00:43:26,364 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 183, inMemoryMapOutputs.size() -> 2, commitMemory -> 292, usedMemory ->475
* 2019-10-15 00:43:26,364 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning
* 2019-10-15 00:43:26,365 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2 / 2 copied.
* 2019-10-15 00:43:26,365 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 2 in-memory map-outputs and 0 on-disk map-outputs
* 2019-10-15 00:43:26,369 INFO [org.apache.hadoop.mapred.Merger] - Merging 2 sorted segments
* 2019-10-15 00:43:26,369 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 2 segments left of total size: 463 bytes
* 2019-10-15 00:43:26,370 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 2 segments, 475 bytes to disk to satisfy reduce memory limit
* 2019-10-15 00:43:26,370 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 477 bytes from disk
* 2019-10-15 00:43:26,370 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce
* 2019-10-15 00:43:26,371 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments
* 2019-10-15 00:43:26,372 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 467 bytes
* 2019-10-15 00:43:26,372 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2 / 2 copied.
* 2019-10-15 00:43:26,391 INFO [org.apache.hadoop.conf.Configuration.deprecation] - mapred.skip.on is deprecated. Instead, use mapreduce.job.skiprecords
* 2019-10-15 00:43:26,418 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1385696579_0001_r_000000_0 is done. And is in the process of committing
* 2019-10-15 00:43:26,419 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2 / 2 copied.
* 2019-10-15 00:43:26,419 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local1385696579_0001_r_000000_0 is allowed to commit now
* 2019-10-15 00:43:26,419 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local1385696579_0001_r_000000_0' to file:/Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin/_temporary/0/task_local1385696579_0001_r_000000
* 2019-10-15 00:43:26,420 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
* 2019-10-15 00:43:26,420 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1385696579_0001_r_000000_0' done.
* 2019-10-15 00:43:26,420 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1385696579_0001_r_000000_0
* 2019-10-15 00:43:26,420 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete.
* 2019-10-15 00:43:27,135 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1385696579_0001 running in uber mode : false
* 2019-10-15 00:43:27,136 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100%
* 2019-10-15 00:43:27,136 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1385696579_0001 completed successfully
* 2019-10-15 00:43:27,146 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 30
* File System Counters
* FILE: Number of bytes read=2995
* FILE: Number of bytes written=831832
* FILE: Number of read operations=0
* FILE: Number of large read operations=0
* FILE: Number of write operations=0
* Map-Reduce Framework
* Map input records=17
* Map output records=17
* Map output bytes=437
* Map output materialized bytes=483
* Input split bytes=256
* Combine input records=0
* Combine output records=0
* Reduce input groups=6
* Reduce shuffle bytes=483
* Reduce input records=17
* Reduce output records=11
* Spilled Records=34
* Shuffled Maps =2
* Failed Shuffles=0
* Merged Map outputs=2
* GC time elapsed (ms)=7
* Total committed heap usage (bytes)=983040000
* Shuffle Errors
* BAD_ID=0
* CONNECTION=0
* IO_ERROR=0
* WRONG_LENGTH=0
* WRONG_MAP=0
* WRONG_REDUCE=0
* File Input Format Counters
* Bytes Read=172
* File Output Format Counters
* Bytes Written=517
*
* Process finished with exit code 0
*/
}
|
UTF-8
|
Java
| 17,531 |
java
|
ReduceJoinDriver.java
|
Java
|
[
{
"context": "derxmac:input zoz$ cat join/ReduceJoin/fa\n * 1 Frank 3\n * 2 Jack 5\n * 3 John 6\n * 4 Olivia",
"end": 849,
"score": 0.9997377991676331,
"start": 844,
"tag": "NAME",
"value": "Frank"
},
{
"context": "$ cat join/ReduceJoin/fa\n * 1 Frank 3\n * 2 Jack 5\n * 3 John 6\n * 4 Olivia 2\n * 5 Ava ",
"end": 865,
"score": 0.999703049659729,
"start": 861,
"tag": "NAME",
"value": "Jack"
},
{
"context": "eJoin/fa\n * 1 Frank 3\n * 2 Jack 5\n * 3 John 6\n * 4 Olivia 2\n * 5 Ava 5\n * 6 Mia 1",
"end": 881,
"score": 0.9996886849403381,
"start": 877,
"tag": "NAME",
"value": "John"
},
{
"context": "1 Frank 3\n * 2 Jack 5\n * 3 John 6\n * 4 Olivia 2\n * 5 Ava 5\n * 6 Mia 1\n * 7 David 3\n",
"end": 899,
"score": 0.9982030391693115,
"start": 893,
"tag": "NAME",
"value": "Olivia"
},
{
"context": " Jack 5\n * 3 John 6\n * 4 Olivia 2\n * 5 Ava 5\n * 6 Mia 1\n * 7 David 3\n * 8 Anna 4",
"end": 914,
"score": 0.9988834857940674,
"start": 911,
"tag": "NAME",
"value": "Ava"
},
{
"context": "3 John 6\n * 4 Olivia 2\n * 5 Ava 5\n * 6 Mia 1\n * 7 David 3\n * 8 Anna 4\n * 9 Lily ",
"end": 929,
"score": 0.9975794553756714,
"start": 926,
"tag": "NAME",
"value": "Mia"
},
{
"context": " 4 Olivia 2\n * 5 Ava 5\n * 6 Mia 1\n * 7 David 3\n * 8 Anna 4\n * 9 Lily 2\n * 10 Luke ",
"end": 946,
"score": 0.9993908405303955,
"start": 941,
"tag": "NAME",
"value": "David"
},
{
"context": "* 5 Ava 5\n * 6 Mia 1\n * 7 David 3\n * 8 Anna 4\n * 9 Lily 2\n * 10 Luke 1\n * 11 Oliv",
"end": 962,
"score": 0.9980164766311646,
"start": 958,
"tag": "NAME",
"value": "Anna"
},
{
"context": " 6 Mia 1\n * 7 David 3\n * 8 Anna 4\n * 9 Lily 2\n * 10 Luke 1\n * 11 Oliver 2\n * spid",
"end": 978,
"score": 0.9979020953178406,
"start": 974,
"tag": "NAME",
"value": "Lily"
},
{
"context": " David 3\n * 8 Anna 4\n * 9 Lily 2\n * 10 Luke 1\n * 11 Oliver 2\n * spiderxmac:input zoz$",
"end": 995,
"score": 0.998445987701416,
"start": 991,
"tag": "NAME",
"value": "Luke"
},
{
"context": " Anna 4\n * 9 Lily 2\n * 10 Luke 1\n * 11 Oliver 2\n * spiderxmac:input zoz$ cat join/ReduceJoi",
"end": 1014,
"score": 0.9992488622665405,
"start": 1008,
"tag": "NAME",
"value": "Oliver"
},
{
"context": "oin/ReduceJoin/part-r-00000\n * aId: 10, aName: Luke, bId: 1, bName: New_York\n * aId: 6, aName: Mi",
"end": 2904,
"score": 0.9991547465324402,
"start": 2900,
"tag": "NAME",
"value": "Luke"
},
{
"context": "-00000\n * aId: 10, aName: Luke, bId: 1, bName: New_York\n * aId: 6, aName: Mia, bId: 1, bName: Ne",
"end": 2924,
"score": 0.9663591980934143,
"start": 2921,
"tag": "NAME",
"value": "New"
},
{
"context": "uke, bId: 1, bName: New_York\n * aId: 6, aName: Mia, bId: 1, bName: New_York\n * aId: 11, aName: O",
"end": 2955,
"score": 0.9992491006851196,
"start": 2952,
"tag": "NAME",
"value": "Mia"
},
{
"context": "ia, bId: 1, bName: New_York\n * aId: 11, aName: Oliver, bId: 2, bName: Los_Angeles\n * aId: 9, aName:",
"end": 3010,
"score": 0.9991322755813599,
"start": 3004,
"tag": "NAME",
"value": "Oliver"
},
{
"context": ", bId: 2, bName: Los_Angeles\n * aId: 9, aName: Lily, bId: 2, bName: Los_Angeles\n * aId: 4, aName:",
"end": 3065,
"score": 0.9992517232894897,
"start": 3061,
"tag": "NAME",
"value": "Lily"
},
{
"context": ", bId: 2, bName: Los_Angeles\n * aId: 4, aName: Olivia, bId: 2, bName: Los_Angeles\n * aId: 7, aName:",
"end": 3122,
"score": 0.9993186593055725,
"start": 3116,
"tag": "NAME",
"value": "Olivia"
},
{
"context": ", bId: 2, bName: Los_Angeles\n * aId: 7, aName: David, bId: 3, bName: Chicago\n * aId: 1, aName: Fra",
"end": 3178,
"score": 0.9998239874839783,
"start": 3173,
"tag": "NAME",
"value": "David"
},
{
"context": "avid, bId: 3, bName: Chicago\n * aId: 1, aName: Frank, bId: 3, bName: Chicago\n * aId: 8, aName: Ann",
"end": 3230,
"score": 0.9998362064361572,
"start": 3225,
"tag": "NAME",
"value": "Frank"
},
{
"context": "rank, bId: 3, bName: Chicago\n * aId: 8, aName: Anna, bId: 4, bName: Houston\n * aId: 5, aName: Ava",
"end": 3281,
"score": 0.9994629621505737,
"start": 3277,
"tag": "NAME",
"value": "Anna"
},
{
"context": "Anna, bId: 4, bName: Houston\n * aId: 5, aName: Ava, bId: 5, bName: Dallas\n * aId: 2, aName: Jack",
"end": 3331,
"score": 0.9992703795433044,
"start": 3328,
"tag": "NAME",
"value": "Ava"
},
{
"context": "ouston\n * aId: 5, aName: Ava, bId: 5, bName: Dallas\n * aId: 2, aName: Jack, bId: 5, bName: Dall",
"end": 3352,
"score": 0.611962080001831,
"start": 3349,
"tag": "NAME",
"value": "all"
},
{
"context": ": Ava, bId: 5, bName: Dallas\n * aId: 2, aName: Jack, bId: 5, bName: Dallas\n * aId: 3, aName: John",
"end": 3381,
"score": 0.9998156428337097,
"start": 3377,
"tag": "NAME",
"value": "Jack"
},
{
"context": "allas\n * aId: 2, aName: Jack, bId: 5, bName: Dallas\n * aId: 3, aName: John, bId: 6, bName: Wash",
"end": 3402,
"score": 0.9764110445976257,
"start": 3399,
"tag": "NAME",
"value": "all"
},
{
"context": " Jack, bId: 5, bName: Dallas\n * aId: 3, aName: John, bId: 6, bName: Washington\n * spiderxmac:outp",
"end": 3431,
"score": 0.9998071789741516,
"start": 3427,
"tag": "NAME",
"value": "John"
}
] | null |
[] |
package com.zozospider.hadoop.mapreduce.join.reducejoin;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import java.io.IOException;
/**
* MapReduce 驱动: 在 fa 的每 1 行尾部添加 field3 (bId) 对应的 fb 中的 field2 (bName).
*/
public class ReduceJoinDriver {
/**
* spiderxmac:input zoz$ ls -l /Users/zoz/zz/other/tmp/MapReduce/input/join/ReduceJoin/
* total 16
* -rw-r--r-- 1 zoz staff 105 10 14 23:20 fa
* -rw-r--r-- 1 zoz staff 67 10 15 00:42 fb
* spiderxmac:input zoz$ cat join/ReduceJoin/fa
* 1 Frank 3
* 2 Jack 5
* 3 John 6
* 4 Olivia 2
* 5 Ava 5
* 6 Mia 1
* 7 David 3
* 8 Anna 4
* 9 Lily 2
* 10 Luke 1
* 11 Oliver 2
* spiderxmac:input zoz$ cat join/ReduceJoin/fb
* 1 New_York
* 2 Los_Angeles
* 3 Chicago
* 4 Houston
* 5 Dallas
* 6 Washington
* spiderxmac:input zoz$
* <p>
* spiderxmac:output zoz$ ls -l /Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin/
* ls: /Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin/: No such file or directory
* spiderxmac:output zoz$
*/
public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
// 本地运行时不要注释下面 1 行
args = new String[]{"/Users/zoz/zz/other/tmp/MapReduce/input/join/ReduceJoin", "/Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin"};
// 1 获取 Job 对象
Configuration conf = new Configuration();
Job job = Job.getInstance(conf);
// 2 设置 Jar, Mapper, Reducer 类
job.setJarByClass(ReduceJoinDriver.class);
job.setMapperClass(ReduceJoinMapper.class);
job.setReducerClass(ReduceJoinReducer.class);
// 3 设置 Map 阶段和最终的 KEYOUT, VALUEOUT
job.setMapOutputKeyClass(IntWritable.class);
job.setMapOutputValueClass(ReduceJoinValueWritable.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(NullWritable.class);
// 4 设置输入输出路径
FileInputFormat.setInputPaths(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
// 5 提交 Job
boolean result = job.waitForCompletion(true);
System.exit(result ? 0 : 1);
}
/**
* spiderxmac:output zoz$ ls -l /Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin/
* total 8
* -rw-r--r-- 1 zoz staff 0 10 15 00:43 _SUCCESS
* -rw-r--r-- 1 zoz staff 505 10 15 00:43 part-r-00000
* spiderxmac:output zoz$ cat join/ReduceJoin/part-r-00000
* aId: 10, aName: Luke, bId: 1, bName: New_York
* aId: 6, aName: Mia, bId: 1, bName: New_York
* aId: 11, aName: Oliver, bId: 2, bName: Los_Angeles
* aId: 9, aName: Lily, bId: 2, bName: Los_Angeles
* aId: 4, aName: Olivia, bId: 2, bName: Los_Angeles
* aId: 7, aName: David, bId: 3, bName: Chicago
* aId: 1, aName: Frank, bId: 3, bName: Chicago
* aId: 8, aName: Anna, bId: 4, bName: Houston
* aId: 5, aName: Ava, bId: 5, bName: Dallas
* aId: 2, aName: Jack, bId: 5, bName: Dallas
* aId: 3, aName: John, bId: 6, bName: Washington
* spiderxmac:output zoz$
*/
/**
* 2019-10-15 00:43:25,298 WARN [org.apache.hadoop.util.NativeCodeLoader] - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
* 2019-10-15 00:43:25,459 INFO [org.apache.hadoop.conf.Configuration.deprecation] - session.id is deprecated. Instead, use dfs.metrics.session-id
* 2019-10-15 00:43:25,459 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Initializing JVM Metrics with processName=JobTracker, sessionId=
* 2019-10-15 00:43:25,875 WARN [org.apache.hadoop.mapreduce.JobResourceUploader] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this.
* 2019-10-15 00:43:25,880 WARN [org.apache.hadoop.mapreduce.JobResourceUploader] - No job jar file set. User classes may not be found. See Job or Job#setJar(String).
* 2019-10-15 00:43:25,902 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 2
* 2019-10-15 00:43:25,944 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:2
* 2019-10-15 00:43:26,016 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local1385696579_0001
* 2019-10-15 00:43:26,130 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null
* 2019-10-15 00:43:26,130 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/
* 2019-10-15 00:43:26,131 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local1385696579_0001
* 2019-10-15 00:43:26,132 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - File Output Committer Algorithm version is 1
* 2019-10-15 00:43:26,133 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
* 2019-10-15 00:43:26,157 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks
* 2019-10-15 00:43:26,157 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1385696579_0001_m_000000_0
* 2019-10-15 00:43:26,174 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - File Output Committer Algorithm version is 1
* 2019-10-15 00:43:26,178 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux.
* 2019-10-15 00:43:26,179 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : null
* 2019-10-15 00:43:26,182 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/Users/zoz/zz/other/tmp/MapReduce/input/join/ReduceJoin/fa:0+105
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584)
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600
* 2019-10-15 00:43:26,235 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600
* 2019-10-15 00:43:26,236 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.LocalJobRunner] -
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 268; bufvoid = 104857600
* 2019-10-15 00:43:26,241 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600
* 2019-10-15 00:43:26,245 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0
* 2019-10-15 00:43:26,247 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1385696579_0001_m_000000_0 is done. And is in the process of committing
* 2019-10-15 00:43:26,252 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map
* 2019-10-15 00:43:26,252 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1385696579_0001_m_000000_0' done.
* 2019-10-15 00:43:26,252 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1385696579_0001_m_000000_0
* 2019-10-15 00:43:26,252 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1385696579_0001_m_000001_0
* 2019-10-15 00:43:26,253 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - File Output Committer Algorithm version is 1
* 2019-10-15 00:43:26,253 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux.
* 2019-10-15 00:43:26,253 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : null
* 2019-10-15 00:43:26,254 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/Users/zoz/zz/other/tmp/MapReduce/input/join/ReduceJoin/fb:0+67
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584)
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600
* 2019-10-15 00:43:26,299 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600
* 2019-10-15 00:43:26,300 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.LocalJobRunner] -
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 169; bufvoid = 104857600
* 2019-10-15 00:43:26,301 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214376(104857504); length = 21/6553600
* 2019-10-15 00:43:26,302 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0
* 2019-10-15 00:43:26,303 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1385696579_0001_m_000001_0 is done. And is in the process of committing
* 2019-10-15 00:43:26,304 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map
* 2019-10-15 00:43:26,304 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1385696579_0001_m_000001_0' done.
* 2019-10-15 00:43:26,304 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1385696579_0001_m_000001_0
* 2019-10-15 00:43:26,305 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete.
* 2019-10-15 00:43:26,306 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks
* 2019-10-15 00:43:26,306 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1385696579_0001_r_000000_0
* 2019-10-15 00:43:26,311 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - File Output Committer Algorithm version is 1
* 2019-10-15 00:43:26,311 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux.
* 2019-10-15 00:43:26,311 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : null
* 2019-10-15 00:43:26,313 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@5bc3940e
* 2019-10-15 00:43:26,321 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=2672505600, maxSingleShuffleLimit=668126400, mergeThreshold=1763853824, ioSortFactor=10, memToMemMergeOutputsThreshold=10
* 2019-10-15 00:43:26,323 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local1385696579_0001_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events
* 2019-10-15 00:43:26,351 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#1 about to shuffle output of map attempt_local1385696579_0001_m_000000_0 decomp: 292 len: 296 to MEMORY
* 2019-10-15 00:43:26,362 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 292 bytes from map-output for attempt_local1385696579_0001_m_000000_0
* 2019-10-15 00:43:26,362 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 292, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->292
* 2019-10-15 00:43:26,364 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#1 about to shuffle output of map attempt_local1385696579_0001_m_000001_0 decomp: 183 len: 187 to MEMORY
* 2019-10-15 00:43:26,364 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 183 bytes from map-output for attempt_local1385696579_0001_m_000001_0
* 2019-10-15 00:43:26,364 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 183, inMemoryMapOutputs.size() -> 2, commitMemory -> 292, usedMemory ->475
* 2019-10-15 00:43:26,364 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning
* 2019-10-15 00:43:26,365 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2 / 2 copied.
* 2019-10-15 00:43:26,365 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 2 in-memory map-outputs and 0 on-disk map-outputs
* 2019-10-15 00:43:26,369 INFO [org.apache.hadoop.mapred.Merger] - Merging 2 sorted segments
* 2019-10-15 00:43:26,369 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 2 segments left of total size: 463 bytes
* 2019-10-15 00:43:26,370 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 2 segments, 475 bytes to disk to satisfy reduce memory limit
* 2019-10-15 00:43:26,370 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 477 bytes from disk
* 2019-10-15 00:43:26,370 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce
* 2019-10-15 00:43:26,371 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments
* 2019-10-15 00:43:26,372 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 467 bytes
* 2019-10-15 00:43:26,372 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2 / 2 copied.
* 2019-10-15 00:43:26,391 INFO [org.apache.hadoop.conf.Configuration.deprecation] - mapred.skip.on is deprecated. Instead, use mapreduce.job.skiprecords
* 2019-10-15 00:43:26,418 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1385696579_0001_r_000000_0 is done. And is in the process of committing
* 2019-10-15 00:43:26,419 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2 / 2 copied.
* 2019-10-15 00:43:26,419 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local1385696579_0001_r_000000_0 is allowed to commit now
* 2019-10-15 00:43:26,419 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local1385696579_0001_r_000000_0' to file:/Users/zoz/zz/other/tmp/MapReduce/output/join/ReduceJoin/_temporary/0/task_local1385696579_0001_r_000000
* 2019-10-15 00:43:26,420 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
* 2019-10-15 00:43:26,420 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1385696579_0001_r_000000_0' done.
* 2019-10-15 00:43:26,420 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1385696579_0001_r_000000_0
* 2019-10-15 00:43:26,420 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete.
* 2019-10-15 00:43:27,135 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1385696579_0001 running in uber mode : false
* 2019-10-15 00:43:27,136 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100%
* 2019-10-15 00:43:27,136 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1385696579_0001 completed successfully
* 2019-10-15 00:43:27,146 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 30
* File System Counters
* FILE: Number of bytes read=2995
* FILE: Number of bytes written=831832
* FILE: Number of read operations=0
* FILE: Number of large read operations=0
* FILE: Number of write operations=0
* Map-Reduce Framework
* Map input records=17
* Map output records=17
* Map output bytes=437
* Map output materialized bytes=483
* Input split bytes=256
* Combine input records=0
* Combine output records=0
* Reduce input groups=6
* Reduce shuffle bytes=483
* Reduce input records=17
* Reduce output records=11
* Spilled Records=34
* Shuffled Maps =2
* Failed Shuffles=0
* Merged Map outputs=2
* GC time elapsed (ms)=7
* Total committed heap usage (bytes)=983040000
* Shuffle Errors
* BAD_ID=0
* CONNECTION=0
* IO_ERROR=0
* WRONG_LENGTH=0
* WRONG_MAP=0
* WRONG_REDUCE=0
* File Input Format Counters
* Bytes Read=172
* File Output Format Counters
* Bytes Written=517
*
* Process finished with exit code 0
*/
}
| 17,531 | 0.711138 | 0.560165 | 236 | 72.843224 | 58.215672 | 274 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.080508 | false | false |
0
|
4ce2423c4a0efb2eab35c0d8e0ec6a1c8c3b24df
| 12,738,873,053,193 |
db7d73c9c8eb4b232d53096c07adc06f4a95f1f6
|
/src/main/java/com/crm/qa/pages/HomePage.java
|
81f692da1b9138469ab21c0f9a10ab2df13c163a
|
[] |
no_license
|
nmithun82/FreeCRM
|
https://github.com/nmithun82/FreeCRM
|
92bbc2ab48b3d3c89ff97706cc82136ddd0bfbd1
|
e71ca742294b6151e8c215b5d4532ac650632980
|
refs/heads/master
| 2020-04-02T06:14:49.908000 | 2018-10-26T16:40:52 | 2018-10-26T16:40:52 | 154,137,705 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.crm.qa.pages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.crm.qa.base.TestBase;
import com.relevantcodes.extentreports.LogStatus;
public class HomePage extends TestBase {
@FindBy(xpath="//td[contains(text(),'User: mithun lloyd')]")
WebElement userNameLabel;
@FindBy(css="a[title='Contacts']")
WebElement contactsLink;
@FindBy(css="a[title='New Contact']")
WebElement newContactLink;
@FindBy(xpath="//a[contains(text(),'Deals')]")
WebElement dealsLink;
//Initialization
public HomePage()
{
//PageFactory.initElements(driver, LoginPage.class);
PageFactory.initElements(driver, this);
}
//Actions:
public String validateHomePageTitle()
{
test.log(LogStatus.INFO, "verification Home page title completed");
return driver.getTitle();
}
public boolean verifyUserName()
{
test.log(LogStatus.INFO, "verification username completed");
return userNameLabel.isDisplayed();
}
public ContactsPage clickOnContactsLink()
{
(new WebDriverWait(driver,10)).until(ExpectedConditions.visibilityOf(contactsLink));
Actions actions = new Actions(driver);
actions.moveToElement(contactsLink).click().build().perform();
//contactsLink.click();
//test.log(LogStatus.INFO, "verification Contacts link completed");
return new ContactsPage();
}
public ContactsPage clickOnNewContactLink()
{
Actions actions = new Actions(driver);
actions.moveToElement(contactsLink).build().perform();
newContactLink.click();
return new ContactsPage();
}
public DealsPage clickOnDealsLink()
{
contactsLink.click();
return new DealsPage();
}
}
|
UTF-8
|
Java
| 1,924 |
java
|
HomePage.java
|
Java
|
[
{
"context": "ase {\n\n\t@FindBy(xpath=\"//td[contains(text(),'User: mithun lloyd')]\")\n\tWebElement userNameLabel;\n\t\n\t\n\t@FindBy(css=",
"end": 500,
"score": 0.9983982443809509,
"start": 488,
"tag": "USERNAME",
"value": "mithun lloyd"
}
] | null |
[] |
package com.crm.qa.pages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.crm.qa.base.TestBase;
import com.relevantcodes.extentreports.LogStatus;
public class HomePage extends TestBase {
@FindBy(xpath="//td[contains(text(),'User: mithun lloyd')]")
WebElement userNameLabel;
@FindBy(css="a[title='Contacts']")
WebElement contactsLink;
@FindBy(css="a[title='New Contact']")
WebElement newContactLink;
@FindBy(xpath="//a[contains(text(),'Deals')]")
WebElement dealsLink;
//Initialization
public HomePage()
{
//PageFactory.initElements(driver, LoginPage.class);
PageFactory.initElements(driver, this);
}
//Actions:
public String validateHomePageTitle()
{
test.log(LogStatus.INFO, "verification Home page title completed");
return driver.getTitle();
}
public boolean verifyUserName()
{
test.log(LogStatus.INFO, "verification username completed");
return userNameLabel.isDisplayed();
}
public ContactsPage clickOnContactsLink()
{
(new WebDriverWait(driver,10)).until(ExpectedConditions.visibilityOf(contactsLink));
Actions actions = new Actions(driver);
actions.moveToElement(contactsLink).click().build().perform();
//contactsLink.click();
//test.log(LogStatus.INFO, "verification Contacts link completed");
return new ContactsPage();
}
public ContactsPage clickOnNewContactLink()
{
Actions actions = new Actions(driver);
actions.moveToElement(contactsLink).build().perform();
newContactLink.click();
return new ContactsPage();
}
public DealsPage clickOnDealsLink()
{
contactsLink.click();
return new DealsPage();
}
}
| 1,924 | 0.726092 | 0.725052 | 81 | 22.753086 | 22.458483 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.061728 | false | false |
0
|
b8f44ee34027a9eedd6c7c1f5eb95f031cb4b28d
| 6,322,191,919,137 |
a770e95028afb71f3b161d43648c347642819740
|
/sources/org/telegram/ui/ActionBar/Theme$ThemeInfo$$ExternalSyntheticLambda2.java
|
a68602750cc28e066e77e9beeb2e90849b1fa6f1
|
[] |
no_license
|
Edicksonjga/TGDecompiledBeta
|
https://github.com/Edicksonjga/TGDecompiledBeta
|
d7aa48a2b39bbaefd4752299620ff7b72b515c83
|
d1db6a445d5bed43c1dc8213fb8dbefd96f6c51b
|
refs/heads/master
| 2023-08-25T04:12:15.592000 | 2021-10-28T20:24:07 | 2021-10-28T20:24:07 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.telegram.ui.ActionBar;
import org.telegram.tgnet.TLObject;
import org.telegram.ui.ActionBar.Theme;
public final /* synthetic */ class Theme$ThemeInfo$$ExternalSyntheticLambda2 implements Runnable {
public final /* synthetic */ Theme.ThemeInfo f$0;
public final /* synthetic */ TLObject f$1;
public final /* synthetic */ Theme.ThemeInfo f$2;
public /* synthetic */ Theme$ThemeInfo$$ExternalSyntheticLambda2(Theme.ThemeInfo themeInfo, TLObject tLObject, Theme.ThemeInfo themeInfo2) {
this.f$0 = themeInfo;
this.f$1 = tLObject;
this.f$2 = themeInfo2;
}
public final void run() {
this.f$0.lambda$didReceivedNotification$1(this.f$1, this.f$2);
}
}
|
UTF-8
|
Java
| 719 |
java
|
Theme$ThemeInfo$$ExternalSyntheticLambda2.java
|
Java
|
[] | null |
[] |
package org.telegram.ui.ActionBar;
import org.telegram.tgnet.TLObject;
import org.telegram.ui.ActionBar.Theme;
public final /* synthetic */ class Theme$ThemeInfo$$ExternalSyntheticLambda2 implements Runnable {
public final /* synthetic */ Theme.ThemeInfo f$0;
public final /* synthetic */ TLObject f$1;
public final /* synthetic */ Theme.ThemeInfo f$2;
public /* synthetic */ Theme$ThemeInfo$$ExternalSyntheticLambda2(Theme.ThemeInfo themeInfo, TLObject tLObject, Theme.ThemeInfo themeInfo2) {
this.f$0 = themeInfo;
this.f$1 = tLObject;
this.f$2 = themeInfo2;
}
public final void run() {
this.f$0.lambda$didReceivedNotification$1(this.f$1, this.f$2);
}
}
| 719 | 0.698192 | 0.67872 | 20 | 34.950001 | 35.960361 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65 | false | false |
0
|
5d3b8415705e564a0dfade8e1ffa0fa863f30e2e
| 18,287,970,811,879 |
93548b877f89994fe297966e9edbcc8848805aac
|
/src/main/java/com/gauss/algorithm/service/WeekDataService.java
|
75175222a310b9fc284e1c380bd9d5f10eed1f90
|
[] |
no_license
|
bobbyyang/gauss-gateway
|
https://github.com/bobbyyang/gauss-gateway
|
a0d2dce92bd5c42317aa2d5f307766b3f5d8188f
|
727026e3cc151cb2581531697c401f0c01f00ff1
|
refs/heads/master
| 2019-05-18T07:13:47.177000 | 2016-06-15T13:39:41 | 2016-06-15T13:39:41 | 58,347,816 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gauss.algorithm.service;
import java.util.Date;
import java.util.List;
import com.gauss.algorithm.entity.StockException;
import com.gauss.algorithm.entity.WeekData;
import com.gauss.algorithm.entity.enums.Collection;
public interface WeekDataService {
List<WeekData> getWeekDatasWithStockNo(String stockNo) throws StockException;
List<WeekData> getWeekDatas(Date date) throws StockException;
List<WeekData> getSelectDatas(Date date) throws StockException;
List<WeekData> getSelectDatasWithStringDate(String day) throws StockException;
void saveWeekData(Collection collection, int scale) throws StockException;
}
|
UTF-8
|
Java
| 637 |
java
|
WeekDataService.java
|
Java
|
[] | null |
[] |
package com.gauss.algorithm.service;
import java.util.Date;
import java.util.List;
import com.gauss.algorithm.entity.StockException;
import com.gauss.algorithm.entity.WeekData;
import com.gauss.algorithm.entity.enums.Collection;
public interface WeekDataService {
List<WeekData> getWeekDatasWithStockNo(String stockNo) throws StockException;
List<WeekData> getWeekDatas(Date date) throws StockException;
List<WeekData> getSelectDatas(Date date) throws StockException;
List<WeekData> getSelectDatasWithStringDate(String day) throws StockException;
void saveWeekData(Collection collection, int scale) throws StockException;
}
| 637 | 0.828885 | 0.828885 | 21 | 29.333334 | 29.352266 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.809524 | false | false |
0
|
dc81d24d4d56339583e0bead324a40139012f7eb
| 28,235,115,046,128 |
819d09101b400dc3908cb4b69e52fbcc994936d4
|
/src/test/java/steps/WorkoutCalculatorsSteps.java
|
26eaceefff5da3e84aea0dba594f062ceeca3f76
|
[] |
no_license
|
PrymakMaryna/FinalSurgeProject
|
https://github.com/PrymakMaryna/FinalSurgeProject
|
835de65c99013d94b935a85510cdbb1a95840d82
|
ced743c9ff4d9cabef0a0c680765741b185709f3
|
refs/heads/master
| 2023-06-04T01:29:47.768000 | 2021-06-28T17:47:09 | 2021-06-28T17:47:09 | 372,862,960 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package steps;
import elements.*;
import io.qameta.allure.Step;
import lombok.extern.log4j.Log4j2;
import model.objectsWorkoutCalculators.HunsonsModel;
import model.objectsWorkoutCalculators.IntensityModel;
import model.objectsWorkoutCalculators.McMillanModel;
import model.objectsWorkoutCalculators.TinmanModel;
@Log4j2
public class WorkoutCalculatorsSteps {
WorkoutCalculatorsForm workoutCalculatorsForm = new WorkoutCalculatorsForm();
IntensityForm intensityForm = new IntensityForm();
HunsonsForm hunsonsForm = new HunsonsForm();
McMillanForm mcMillanForm = new McMillanForm();
TinmanForm tinmanForm = new TinmanForm();
@Step("Calculating of the intensity calculator form")
public void calculateIntensityForm(IntensityModel intensityModel) {
log.info("Calculating {} form", intensityModel);
workoutCalculatorsForm.openOfTheWorkoutCalculatorsForm();
intensityForm.selectEvent(intensityModel.getEvent());
workoutCalculatorsForm.selectTime(intensityModel.getHours(), intensityModel.getMinutes(), intensityModel.getSeconds());
intensityForm.clickCalculatePaceButton()
.checkIntensityForm();
}
@Step("Calculating of the hunsons calculator form")
public void calculateHunsonsForm(HunsonsModel hunsonsModel) {
log.info("Calculating {} form", hunsonsModel);
workoutCalculatorsForm.openOfTheWorkoutCalculatorsForm();
hunsonsForm.clickHunsonsButton()
.selectDistanceHunsons(hunsonsModel.getDistanceSelect(), hunsonsModel.getDistanceManual(), hunsonsModel.getDistanceType());
workoutCalculatorsForm.selectTime(hunsonsModel.getHours(), hunsonsModel.getMinutes(), hunsonsModel.getSeconds());
hunsonsForm.selectTemperature(hunsonsModel.getTemperatureManual(), hunsonsModel.getTemperatureType())
.selectHumidity(hunsonsModel.getHumidity())
.selectSpeed(hunsonsModel.getWindSpeedManual(), hunsonsModel.getWindSpeedType())
.clickCalculatePacesButton()
.checkHunsonsForm();
}
@Step("Calculating of the mcMillan calculator form")
public void calculateMcMillanForm(McMillanModel mcMillanModel) {
log.info("Calculating {} form", mcMillanModel);
workoutCalculatorsForm.openOfTheWorkoutCalculatorsForm();
mcMillanForm.clickMcMillanButton()
.selectDistanceMcMillan(mcMillanModel.getRaceDistance());
workoutCalculatorsForm.selectTime(mcMillanModel.getHours(), mcMillanModel.getMinutes(), mcMillanModel.getSeconds());
mcMillanForm.selectGoalDistanceMcMillan(mcMillanModel.getRaceGoalDistance())
.selectGoalTime(mcMillanModel.getGoalHours(), mcMillanModel.getGoalMinutes(), mcMillanModel.getGoalSeconds())
.clickCalculatePacesButton()
.checkMcMillanForm()
.clickReCalculateMyPaces();
}
@Step("Calculating of the Tinman calculator form")
public void calculateTinmanForm(TinmanModel tinmanModel) {
log.info("Calculating {} form", tinmanModel);
workoutCalculatorsForm.openOfTheWorkoutCalculatorsForm();
tinmanForm.clickTinmanButton()
.selectDistanceTinman(tinmanModel.getRaceDistance());
workoutCalculatorsForm.selectTime(tinmanModel.getHours(), tinmanModel.getMinutes(), tinmanModel.getSeconds());
tinmanForm.selectGender(tinmanModel.getGender())
.clickReCalculateMyPaces()
.checkTinmanForm();
}
}
|
UTF-8
|
Java
| 3,532 |
java
|
WorkoutCalculatorsSteps.java
|
Java
|
[] | null |
[] |
package steps;
import elements.*;
import io.qameta.allure.Step;
import lombok.extern.log4j.Log4j2;
import model.objectsWorkoutCalculators.HunsonsModel;
import model.objectsWorkoutCalculators.IntensityModel;
import model.objectsWorkoutCalculators.McMillanModel;
import model.objectsWorkoutCalculators.TinmanModel;
@Log4j2
public class WorkoutCalculatorsSteps {
WorkoutCalculatorsForm workoutCalculatorsForm = new WorkoutCalculatorsForm();
IntensityForm intensityForm = new IntensityForm();
HunsonsForm hunsonsForm = new HunsonsForm();
McMillanForm mcMillanForm = new McMillanForm();
TinmanForm tinmanForm = new TinmanForm();
@Step("Calculating of the intensity calculator form")
public void calculateIntensityForm(IntensityModel intensityModel) {
log.info("Calculating {} form", intensityModel);
workoutCalculatorsForm.openOfTheWorkoutCalculatorsForm();
intensityForm.selectEvent(intensityModel.getEvent());
workoutCalculatorsForm.selectTime(intensityModel.getHours(), intensityModel.getMinutes(), intensityModel.getSeconds());
intensityForm.clickCalculatePaceButton()
.checkIntensityForm();
}
@Step("Calculating of the hunsons calculator form")
public void calculateHunsonsForm(HunsonsModel hunsonsModel) {
log.info("Calculating {} form", hunsonsModel);
workoutCalculatorsForm.openOfTheWorkoutCalculatorsForm();
hunsonsForm.clickHunsonsButton()
.selectDistanceHunsons(hunsonsModel.getDistanceSelect(), hunsonsModel.getDistanceManual(), hunsonsModel.getDistanceType());
workoutCalculatorsForm.selectTime(hunsonsModel.getHours(), hunsonsModel.getMinutes(), hunsonsModel.getSeconds());
hunsonsForm.selectTemperature(hunsonsModel.getTemperatureManual(), hunsonsModel.getTemperatureType())
.selectHumidity(hunsonsModel.getHumidity())
.selectSpeed(hunsonsModel.getWindSpeedManual(), hunsonsModel.getWindSpeedType())
.clickCalculatePacesButton()
.checkHunsonsForm();
}
@Step("Calculating of the mcMillan calculator form")
public void calculateMcMillanForm(McMillanModel mcMillanModel) {
log.info("Calculating {} form", mcMillanModel);
workoutCalculatorsForm.openOfTheWorkoutCalculatorsForm();
mcMillanForm.clickMcMillanButton()
.selectDistanceMcMillan(mcMillanModel.getRaceDistance());
workoutCalculatorsForm.selectTime(mcMillanModel.getHours(), mcMillanModel.getMinutes(), mcMillanModel.getSeconds());
mcMillanForm.selectGoalDistanceMcMillan(mcMillanModel.getRaceGoalDistance())
.selectGoalTime(mcMillanModel.getGoalHours(), mcMillanModel.getGoalMinutes(), mcMillanModel.getGoalSeconds())
.clickCalculatePacesButton()
.checkMcMillanForm()
.clickReCalculateMyPaces();
}
@Step("Calculating of the Tinman calculator form")
public void calculateTinmanForm(TinmanModel tinmanModel) {
log.info("Calculating {} form", tinmanModel);
workoutCalculatorsForm.openOfTheWorkoutCalculatorsForm();
tinmanForm.clickTinmanButton()
.selectDistanceTinman(tinmanModel.getRaceDistance());
workoutCalculatorsForm.selectTime(tinmanModel.getHours(), tinmanModel.getMinutes(), tinmanModel.getSeconds());
tinmanForm.selectGender(tinmanModel.getGender())
.clickReCalculateMyPaces()
.checkTinmanForm();
}
}
| 3,532 | 0.734711 | 0.733296 | 69 | 50.188404 | 34.060165 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.73913 | false | false |
0
|
4be5a6ab99e600edf7f637e90bc5e004548e57a3
| 6,150,393,193,330 |
e7e497b20442a4220296dea1550091a457df5a38
|
/java_workplace/sns-xiaonei/xiaonei-guide/test/src/main/java/com/xiaonei/reg/guide/flows/xfive/logics/GuideXFiveUserSortLogic.java
|
660cefbceaac2540d0c8911149a5b939510c0e84
|
[] |
no_license
|
gunner14/old_rr_code
|
https://github.com/gunner14/old_rr_code
|
cf17a2dedf8dfcdcf441d49139adaadc770c0eea
|
bb047dc88fa7243ded61d840af0f8bad22d68dee
|
refs/heads/master
| 2021-01-17T18:23:28.154000 | 2013-12-02T23:45:33 | 2013-12-02T23:45:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xiaonei.reg.guide.flows.xfive.logics;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import com.ibm.icu.text.DecimalFormat;
import com.xiaonei.platform.core.model.User;
import com.xiaonei.platform.core.model.WUserCache;
import com.xiaonei.reg.guide.util.GuideLogger;
import com.xiaonei.reg.usertrace.dao.GuideRecommendJadeDAO;
import com.xiaonei.sns.platform.core.opt.ice.impl.SnsAdapterFactory;
import com.xiaonei.vip.commons.port.ToFriend;
/**
*
* @author Kobin
* @todo 推荐好友排序逻辑
*/
public class GuideXFiveUserSortLogic {
@Autowired
private GuideRecommendJadeDAO guideRecommendJadeDAO;
/**
* 根据用户价值评分排序:(用户价值评分 = 0.5 * 头像评分 + 0.5 * 登录情况得分)
* @param jsonStr
* 推荐好友的json串:
* {"candidate":[{"id":420144700,"name":"米诺诺","net":" [北京服装学院]","head":"http://hdn.xnimg.cn/photos/hdn121/20111010/0735/tiny_UWil_1389a019117.jpg"}]}
* @return 排序后的json串:增加用户价值评分(mark)属性
*/
public String sortJsonArrayByUserMark(String jsonStr){
if(jsonStr == null){
return null;
}
JSONObject jb = JSONObject.fromObject(jsonStr);
Object jsonOb = jb.get("candidate");
if(jsonOb == null){
return null;
}
/*
* 计算用户价值评分
*/
JSONArray jsonArray = JSONArray.fromObject(jsonOb);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject obj = JSONObject.fromObject(jsonArray.get(i));
int userId = (Integer)obj.get("id");
double mark = getUserMark(userId);
obj.put("mark", mark);
jsonArray.set(i, obj);
}
/*
* 按用户价值评分排序
*/
List<JSONObject> jsonList = sortJsonArray(jsonArray);
/*
* 返回排序后的json数据
*/
JSONObject jsonObj = new JSONObject();
jsonObj.put("candidate", JSONArray.fromObject(jsonList));
return jsonObj.toString();
}
/**
* 添加好友时推荐好友
* @param selfId 登录者id【简称:A】
* @param ownerId 被添加者id【简称:B】
* @return 按推荐度得分排序后的json串:
* {"candidate":[{"id":420144700,"name":"米诺诺","head":"http://head.xiaonei.com/photos/0/0/men_tiny.gif","mark":1.243}]}
*/
public String getRecommendFriends(int selfId, int ownerId){
String resultJson = "";
//查询B的所有好友id列表
List<Integer> friendList = ToFriend.getFriendsIds(ownerId);
if(friendList != null && !friendList.isEmpty()){
JSONArray jsonArray = new JSONArray();
Iterator<Integer> it = friendList.iterator();
while(it.hasNext()){
//B的好友id【简称:F】
int friendId = it.next();
/*
* 计算推荐度得分: 推荐度 = (F和A的关系 + F和B的关系 + F本身质量) / 3
*/
// A与F的共同好友数
Set<Integer> shareIds_AF = SnsAdapterFactory.getBuddyByIdCacheAdapter().getSharedFriends(selfId, friendId);
int counts_AF = 0;
if(shareIds_AF != null){
counts_AF = shareIds_AF.size();
}
// B与F的共同好友数
Set<Integer> shareIds_BF = SnsAdapterFactory.getBuddyByIdCacheAdapter().getSharedFriends(ownerId, friendId);
int counts_BF = 0;
if(shareIds_BF != null){
counts_BF = shareIds_BF.size();
}
// F的用户质量得分
double userMark = getUserMark(friendId);
double mark = (counts_AF + counts_BF + userMark) / 3;
// 格式化小数点位数
DecimalFormat df = new DecimalFormat("0.000");
mark = Double.parseDouble(df.format(mark));
//组织json串数据
User user = SnsAdapterFactory.getUserAdapter().get(friendId);
if(user != null){
JSONObject obj = new JSONObject();
obj.put("id", friendId);
obj.put("name", user.getName());
// jsonObj.put("net", user);
obj.put("head", user.getTinyUrl());
obj.put("mark", mark);
jsonArray.add(obj);
}
}
/*
* 按用户价值评分排序
*/
List<JSONObject> jsonList = sortJsonArray(jsonArray);
/*
* 返回排序后的json数据
*/
JSONObject jsonObj = new JSONObject();
jsonObj.put("candidate", JSONArray.fromObject(jsonList));
resultJson = jsonObj.toString();
}
return resultJson;
}
/**
* 按用户价值评分排序
* @param jsonArray
* @return
*/
private List<JSONObject> sortJsonArray(JSONArray jsonArray){
@SuppressWarnings({ "unchecked", "deprecation" })
List<JSONObject> jsonList = JSONArray.toList(jsonArray, JSONObject.class);
Comparator<Object> comp = new Comparator<Object>(){
@Override
public int compare(Object o1, Object o2) {
JSONObject obj1 = (JSONObject)o1;
JSONObject obj2 = (JSONObject)o2;
if(obj1.getDouble("mark") < obj2.getDouble("mark")){
return 1;
} else{
return 0;
}
}
};
Collections.sort(jsonList, comp);
return jsonList;
}
/**
* 计算用户价值评分:(用户价值评分 = 0.5 * 头像评分 + 0.5 * 登录情况得分)
* @param userId
* @return
*/
private double getUserMark(int userId){
User user = SnsAdapterFactory.getUserAdapter().get(userId);
if(user == null){
return 0;
}
//是否有头像
String head = user.getTinyUrl();
boolean hasHead = true;
String menTiny = "men_tiny.gif";
String womenTiny = "women_tiny.gif";
if(head == null){
hasHead = false;
} else{
if(head.contains(menTiny) || head.contains(womenTiny)){
hasHead = false;
}
}
//是否星级用户
boolean isStar = user.isStarUser();
/*
* 计算用户头像得分
*/
double userHeadMark = 0;
if(isStar && hasHead){//星级头像用户
userHeadMark = 1;
} else if(hasHead && !isStar){//有头像非星级用户
userHeadMark = 0.5;
} else if(!hasHead){//无头像用户
userHeadMark = 0;
}
//用户是否在线(默认异常情况下用户是离线状态)
boolean isOnline = false;
try {
List<Integer> userList = new ArrayList<Integer>();
userList.add(userId);
final Map<Integer, WUserCache> friendUserCaches = SnsAdapterFactory.getUserCacheAdapter().getUserCacheMap(userList);
WUserCache userCache = friendUserCaches.get(userId);
isOnline = userCache.isOnline();
} catch (Exception e1) {
e1.printStackTrace();
}
/*
* 计算用户登录情况评分
*/
double userLoginMark = 0;
if(isOnline){//当前在线
userLoginMark = 1;
} else{
String record = "";
try {
record = guideRecommendJadeDAO.getUserLoginRecord(userId);
if(record == null || record.length() != 28){
GuideLogger.printLog("user_id:" + userId + " | userLogin record:" + record, GuideLogger.ERROR);
}
} catch (SQLException e) {
e.printStackTrace();
}
userLoginMark = getLoginMark(record);
}
//用户在未来7天内的登录情况,最后得分为做归⼀化 2012-07-12 kobin
if(userLoginMark > 1){
userLoginMark = 1;
}
double mark = 0.5 * userHeadMark + 0.5 * userLoginMark;
//格式化小数点位数
DecimalFormat df = new DecimalFormat("0.000");
mark = Double.parseDouble(df.format(mark));
return mark;
}
/**
* 计算用户登录分数
* @param record(用户28天的登录记录)
* @return
*/
private double getLoginMark(String record){
double mark = 0;
if(record != null && record.length() == 28){
mark = 0.499 * getLoginDays(record.substring(0, 7)) +
0.129 * getLoginDays(record.substring(8, 14)) +
0.199 * getLoginDays(record.substring(15, 21)) +
0.086 * getLoginDays(record.substring(22, 28));
}
return mark;
}
/**
* 计算用户一周登录天数
* @param record
* @return
*/
private int getLoginDays(String record){
int s = Integer.parseInt(record, 2);
int re = 0;
while(s!=0){
s &= s-1;
re++;
}
return re;
}
}
|
UTF-8
|
Java
| 8,585 |
java
|
GuideXFiveUserSortLogic.java
|
Java
|
[
{
"context": "nei.vip.commons.port.ToFriend;\n\n/**\n * \n * @author Kobin\n * @todo 推荐好友排序逻辑\n */\npublic class GuideXFiveUs",
"end": 771,
"score": 0.9924766421318054,
"start": 766,
"tag": "NAME",
"value": "Kobin"
},
{
"context": " * {\"candidate\":[{\"id\":420144700,\"name\":\"米诺诺\",\"net\":\" [北京服装学院]\",\"head\":\"http://hdn.xnimg.cn/ph",
"end": 1069,
"score": 0.99940425157547,
"start": 1066,
"tag": "NAME",
"value": "米诺诺"
},
{
"context": " * {\"candidate\":[{\"id\":420144700,\"name\":\"米诺诺\",\"head\":\"http://head.xiaonei.com/photos/0/0/men_t",
"end": 2376,
"score": 0.999700665473938,
"start": 2373,
"tag": "NAME",
"value": "米诺诺"
}
] | null |
[] |
package com.xiaonei.reg.guide.flows.xfive.logics;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import com.ibm.icu.text.DecimalFormat;
import com.xiaonei.platform.core.model.User;
import com.xiaonei.platform.core.model.WUserCache;
import com.xiaonei.reg.guide.util.GuideLogger;
import com.xiaonei.reg.usertrace.dao.GuideRecommendJadeDAO;
import com.xiaonei.sns.platform.core.opt.ice.impl.SnsAdapterFactory;
import com.xiaonei.vip.commons.port.ToFriend;
/**
*
* @author Kobin
* @todo 推荐好友排序逻辑
*/
public class GuideXFiveUserSortLogic {
@Autowired
private GuideRecommendJadeDAO guideRecommendJadeDAO;
/**
* 根据用户价值评分排序:(用户价值评分 = 0.5 * 头像评分 + 0.5 * 登录情况得分)
* @param jsonStr
* 推荐好友的json串:
* {"candidate":[{"id":420144700,"name":"米诺诺","net":" [北京服装学院]","head":"http://hdn.xnimg.cn/photos/hdn121/20111010/0735/tiny_UWil_1389a019117.jpg"}]}
* @return 排序后的json串:增加用户价值评分(mark)属性
*/
public String sortJsonArrayByUserMark(String jsonStr){
if(jsonStr == null){
return null;
}
JSONObject jb = JSONObject.fromObject(jsonStr);
Object jsonOb = jb.get("candidate");
if(jsonOb == null){
return null;
}
/*
* 计算用户价值评分
*/
JSONArray jsonArray = JSONArray.fromObject(jsonOb);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject obj = JSONObject.fromObject(jsonArray.get(i));
int userId = (Integer)obj.get("id");
double mark = getUserMark(userId);
obj.put("mark", mark);
jsonArray.set(i, obj);
}
/*
* 按用户价值评分排序
*/
List<JSONObject> jsonList = sortJsonArray(jsonArray);
/*
* 返回排序后的json数据
*/
JSONObject jsonObj = new JSONObject();
jsonObj.put("candidate", JSONArray.fromObject(jsonList));
return jsonObj.toString();
}
/**
* 添加好友时推荐好友
* @param selfId 登录者id【简称:A】
* @param ownerId 被添加者id【简称:B】
* @return 按推荐度得分排序后的json串:
* {"candidate":[{"id":420144700,"name":"米诺诺","head":"http://head.xiaonei.com/photos/0/0/men_tiny.gif","mark":1.243}]}
*/
public String getRecommendFriends(int selfId, int ownerId){
String resultJson = "";
//查询B的所有好友id列表
List<Integer> friendList = ToFriend.getFriendsIds(ownerId);
if(friendList != null && !friendList.isEmpty()){
JSONArray jsonArray = new JSONArray();
Iterator<Integer> it = friendList.iterator();
while(it.hasNext()){
//B的好友id【简称:F】
int friendId = it.next();
/*
* 计算推荐度得分: 推荐度 = (F和A的关系 + F和B的关系 + F本身质量) / 3
*/
// A与F的共同好友数
Set<Integer> shareIds_AF = SnsAdapterFactory.getBuddyByIdCacheAdapter().getSharedFriends(selfId, friendId);
int counts_AF = 0;
if(shareIds_AF != null){
counts_AF = shareIds_AF.size();
}
// B与F的共同好友数
Set<Integer> shareIds_BF = SnsAdapterFactory.getBuddyByIdCacheAdapter().getSharedFriends(ownerId, friendId);
int counts_BF = 0;
if(shareIds_BF != null){
counts_BF = shareIds_BF.size();
}
// F的用户质量得分
double userMark = getUserMark(friendId);
double mark = (counts_AF + counts_BF + userMark) / 3;
// 格式化小数点位数
DecimalFormat df = new DecimalFormat("0.000");
mark = Double.parseDouble(df.format(mark));
//组织json串数据
User user = SnsAdapterFactory.getUserAdapter().get(friendId);
if(user != null){
JSONObject obj = new JSONObject();
obj.put("id", friendId);
obj.put("name", user.getName());
// jsonObj.put("net", user);
obj.put("head", user.getTinyUrl());
obj.put("mark", mark);
jsonArray.add(obj);
}
}
/*
* 按用户价值评分排序
*/
List<JSONObject> jsonList = sortJsonArray(jsonArray);
/*
* 返回排序后的json数据
*/
JSONObject jsonObj = new JSONObject();
jsonObj.put("candidate", JSONArray.fromObject(jsonList));
resultJson = jsonObj.toString();
}
return resultJson;
}
/**
* 按用户价值评分排序
* @param jsonArray
* @return
*/
private List<JSONObject> sortJsonArray(JSONArray jsonArray){
@SuppressWarnings({ "unchecked", "deprecation" })
List<JSONObject> jsonList = JSONArray.toList(jsonArray, JSONObject.class);
Comparator<Object> comp = new Comparator<Object>(){
@Override
public int compare(Object o1, Object o2) {
JSONObject obj1 = (JSONObject)o1;
JSONObject obj2 = (JSONObject)o2;
if(obj1.getDouble("mark") < obj2.getDouble("mark")){
return 1;
} else{
return 0;
}
}
};
Collections.sort(jsonList, comp);
return jsonList;
}
/**
* 计算用户价值评分:(用户价值评分 = 0.5 * 头像评分 + 0.5 * 登录情况得分)
* @param userId
* @return
*/
private double getUserMark(int userId){
User user = SnsAdapterFactory.getUserAdapter().get(userId);
if(user == null){
return 0;
}
//是否有头像
String head = user.getTinyUrl();
boolean hasHead = true;
String menTiny = "men_tiny.gif";
String womenTiny = "women_tiny.gif";
if(head == null){
hasHead = false;
} else{
if(head.contains(menTiny) || head.contains(womenTiny)){
hasHead = false;
}
}
//是否星级用户
boolean isStar = user.isStarUser();
/*
* 计算用户头像得分
*/
double userHeadMark = 0;
if(isStar && hasHead){//星级头像用户
userHeadMark = 1;
} else if(hasHead && !isStar){//有头像非星级用户
userHeadMark = 0.5;
} else if(!hasHead){//无头像用户
userHeadMark = 0;
}
//用户是否在线(默认异常情况下用户是离线状态)
boolean isOnline = false;
try {
List<Integer> userList = new ArrayList<Integer>();
userList.add(userId);
final Map<Integer, WUserCache> friendUserCaches = SnsAdapterFactory.getUserCacheAdapter().getUserCacheMap(userList);
WUserCache userCache = friendUserCaches.get(userId);
isOnline = userCache.isOnline();
} catch (Exception e1) {
e1.printStackTrace();
}
/*
* 计算用户登录情况评分
*/
double userLoginMark = 0;
if(isOnline){//当前在线
userLoginMark = 1;
} else{
String record = "";
try {
record = guideRecommendJadeDAO.getUserLoginRecord(userId);
if(record == null || record.length() != 28){
GuideLogger.printLog("user_id:" + userId + " | userLogin record:" + record, GuideLogger.ERROR);
}
} catch (SQLException e) {
e.printStackTrace();
}
userLoginMark = getLoginMark(record);
}
//用户在未来7天内的登录情况,最后得分为做归⼀化 2012-07-12 kobin
if(userLoginMark > 1){
userLoginMark = 1;
}
double mark = 0.5 * userHeadMark + 0.5 * userLoginMark;
//格式化小数点位数
DecimalFormat df = new DecimalFormat("0.000");
mark = Double.parseDouble(df.format(mark));
return mark;
}
/**
* 计算用户登录分数
* @param record(用户28天的登录记录)
* @return
*/
private double getLoginMark(String record){
double mark = 0;
if(record != null && record.length() == 28){
mark = 0.499 * getLoginDays(record.substring(0, 7)) +
0.129 * getLoginDays(record.substring(8, 14)) +
0.199 * getLoginDays(record.substring(15, 21)) +
0.086 * getLoginDays(record.substring(22, 28));
}
return mark;
}
/**
* 计算用户一周登录天数
* @param record
* @return
*/
private int getLoginDays(String record){
int s = Integer.parseInt(record, 2);
int re = 0;
while(s!=0){
s &= s-1;
re++;
}
return re;
}
}
| 8,585 | 0.608696 | 0.590099 | 293 | 25.610922 | 23.586428 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.112628 | false | false |
0
|
fb1fd2392819ec2d026e2170b8ded7780dab0525
| 29,506,425,365,081 |
728e6711e5aac7686cb545fa837690d4aef4e4fa
|
/src/main/java/org/woehlke/greenshop/oodm/catalog/repositories/CategoryDescriptionRepository.java
|
50f956b1dd266e63959ec37d6b4de675ae35cca7
|
[] |
no_license
|
vetrisoft/greenshop
|
https://github.com/vetrisoft/greenshop
|
1acfeae2204cb2ec1260df08631f9273aca9d107
|
791264f386443ecfb2c558d84e16108826346d65
|
refs/heads/master
| 2023-01-02T13:53:29.137000 | 2020-03-25T19:07:33 | 2020-03-25T19:07:33 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.woehlke.greenshop.oodm.catalog.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.woehlke.greenshop.oodm.catalog.entities.CategoryDescription;
import org.woehlke.greenshop.oodm.catalog.entities.CategoryDescriptionId;
public interface CategoryDescriptionRepository extends JpaRepository<CategoryDescription,CategoryDescriptionId> {
}
|
UTF-8
|
Java
| 384 |
java
|
CategoryDescriptionRepository.java
|
Java
|
[] | null |
[] |
package org.woehlke.greenshop.oodm.catalog.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.woehlke.greenshop.oodm.catalog.entities.CategoryDescription;
import org.woehlke.greenshop.oodm.catalog.entities.CategoryDescriptionId;
public interface CategoryDescriptionRepository extends JpaRepository<CategoryDescription,CategoryDescriptionId> {
}
| 384 | 0.872396 | 0.872396 | 9 | 41.666668 | 39.961094 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false |
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.