blob_id
stringlengths 40
40
| __id__
int64 225
39,780B
| directory_id
stringlengths 40
40
| path
stringlengths 6
313
| content_id
stringlengths 40
40
| detected_licenses
sequence | license_type
stringclasses 2
values | repo_name
stringlengths 6
132
| repo_url
stringlengths 25
151
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
70
| visit_date
timestamp[ns] | revision_date
timestamp[ns] | committer_date
timestamp[ns] | github_id
int64 7.28k
689M
⌀ | star_events_count
int64 0
131k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 23
values | gha_fork
bool 2
classes | gha_event_created_at
timestamp[ns] | gha_created_at
timestamp[ns] | gha_updated_at
timestamp[ns] | gha_pushed_at
timestamp[ns] | gha_size
int64 0
40.4M
⌀ | gha_stargazers_count
int32 0
112k
⌀ | gha_forks_count
int32 0
39.4k
⌀ | gha_open_issues_count
int32 0
11k
⌀ | gha_language
stringlengths 1
21
⌀ | gha_archived
bool 2
classes | gha_disabled
bool 1
class | content
stringlengths 7
4.37M
| src_encoding
stringlengths 3
16
| language
stringclasses 1
value | length_bytes
int64 7
4.37M
| extension
stringclasses 24
values | filename
stringlengths 4
174
| language_id
stringclasses 1
value | entities
list | contaminating_dataset
stringclasses 0
values | malware_signatures
sequence | redacted_content
stringlengths 7
4.37M
| redacted_length_bytes
int64 7
4.37M
| alphanum_fraction
float32 0.25
0.94
| alpha_fraction
float32 0.25
0.94
| num_lines
int32 1
84k
| avg_line_length
float32 0.76
99.9
| std_line_length
float32 0
220
| max_line_length
int32 5
998
| is_vendor
bool 2
classes | is_generated
bool 1
class | max_hex_length
int32 0
319
| hex_fraction
float32 0
0.38
| max_unicode_length
int32 0
408
| unicode_fraction
float32 0
0.36
| max_base64_length
int32 0
506
| base64_fraction
float32 0
0.5
| avg_csv_sep_count
float32 0
4
| is_autogen_header
bool 1
class | is_empty_html
bool 1
class | shard
stringclasses 16
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b4f35efea8c7c5412bb1963f6facca1d70422db5 | 20,203,526,177,156 | 22edd2b34b4bd45d294f066ce587bc620d86436c | /app/src/main/java/com/example/dyq/myweatherapp/MainActivity.java | 22668aa64d7a377fbb848be19bcacc6b5eb82590 | [
"Apache-2.0"
] | permissive | dengyaqian/MyWeatherApp | https://github.com/dengyaqian/MyWeatherApp | e914627fa70d6964ce1a26d26a3796fee49404e6 | 236b7a9f3ded7950903b019c609b8024290a4b8e | refs/heads/master | 2021-01-20T05:43:57.246000 | 2016-11-23T09:34:01 | 2016-11-23T09:34:01 | 72,612,060 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.dyq.myweatherapp;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import WeatherInfo.DailyData;
import WeatherInfo.GetWeatherInfo;
import WeatherInfo.HourlyData;
public class MainActivity extends Activity implements View.OnClickListener {
GridView gridView;
List<HourlyData> cityItemList = new ArrayList<>();
List<DailyData> dailyItemList = new ArrayList<>();
String fileName = "result.txt";
String response;
GetWeatherInfo getWeatherInfo;
Button btSettings;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
btSettings = (Button) findViewById(R.id.btSettings);
btSettings.setOnClickListener(this);
if (Build.VERSION.SDK_INT >= 11) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads ().detectDiskWrites().detectNetwork().penaltyLog().build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());
}
LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
getHttpData();
gridView = (GridView) findViewById(R.id.grid_view);
setHourlyData();
setDailyData();
setGridView();
setCityName();
setCurrentTemp();
setWeatherType();
setWeatherQulity();
setToday();
setTodayLowTmp();
setTodayHighTmp();
setDaily();
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btSettings:
Intent intent = new Intent(MainActivity.this,CityListActivity.class);
startActivity(intent);
break;
default:
break;
}
}
private void getHttpData(){
//请求网络数据
getWeatherInfo = new GetWeatherInfo();
getWeatherInfo.setInputCityName("深圳");
getWeatherInfo.sendRequestWithHttpClient();
response = getWeatherInfo.getResponse();
File fileCache = this.getFilesDir();
try{
File dir = new File(fileCache.toString());
if(!dir.exists()) {
dir.mkdirs();
}
File txt = new File(dir.getPath(),fileName);
FileOutputStream out = new FileOutputStream(txt);
byte [] bytes = response.getBytes();
out.write(bytes);
out.close();
getWeatherInfo.readWeatherDataFromBuffer(txt.getAbsolutePath());
/*InputStream inputStream = getResources().openRawResource(R.raw.data);
getWeatherInfo.readWeatherDataFromRaw(inputStream);*/
}
catch(Exception e){
e.printStackTrace();
}
}
private void setCityName(){
TextView textCityName = (TextView) findViewById(R.id.cityname_view);
textCityName.setText(getWeatherInfo.getCityName());
}
private void setCurrentTemp(){
TextView temp_view = (TextView) findViewById(R.id.temp_view);
temp_view.setText(getWeatherInfo.getCurrentTemp() + "℃");
}
private void setWeatherType(){
TextView weatherType_view = (TextView) findViewById(R.id.weatherType_view);
weatherType_view.setText(getWeatherInfo.getWeatherType());
}
private void setWeatherQulity(){
TextView weatherQulity_view = (TextView) findViewById(R.id.weatherQuality_view);
weatherQulity_view.setText("|空气" + getWeatherInfo.getQuality());
}
private void setToday(){
TextView today_view = (TextView) findViewById(R.id.today_view);
today_view.setText(getWeatherInfo.getWeek() + " 今天");
}
private void setTodayLowTmp(){
TextView todayLowTmp_view = (TextView) findViewById(R.id.todayLowTemp_view);
todayLowTmp_view.setText(getWeatherInfo.getTempLow() + "℃");
}
private void setTodayHighTmp(){
TextView todayHighTmp_view = (TextView) findViewById(R.id.todayHighTemp_view);
todayHighTmp_view.setText(getWeatherInfo.getTempHigh() + "℃");
}
private void setDaily(){
TextView week = (TextView) findViewById(R.id.week1);
ImageView img = (ImageView) findViewById(R.id.img1);
TextView tempLow = (TextView) findViewById(R.id.tempLow1);
TextView tempHigh = (TextView) findViewById(R.id.tempHigh1);
week.setText(dailyItemList.get(1).getWeek());
img.setImageResource(dailyItemList.get(1).getWeatherImg());
tempLow.setText(dailyItemList.get(1).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(1).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week2);
img = (ImageView) findViewById(R.id.img2);
tempLow = (TextView) findViewById(R.id.tempLow2);
tempHigh = (TextView) findViewById(R.id.tempHigh2);
week.setText(dailyItemList.get(2).getWeek());
img.setImageResource(dailyItemList.get(2).getWeatherImg());
tempLow.setText(dailyItemList.get(2).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(2).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week3);
img = (ImageView) findViewById(R.id.img3);
tempLow = (TextView) findViewById(R.id.tempLow3);
tempHigh = (TextView) findViewById(R.id.tempHigh3);
week.setText(dailyItemList.get(3).getWeek());
img.setImageResource(dailyItemList.get(3).getWeatherImg());
tempLow.setText(dailyItemList.get(3).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(3).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week4);
img = (ImageView) findViewById(R.id.img4);
tempLow = (TextView) findViewById(R.id.tempLow4);
tempHigh = (TextView) findViewById(R.id.tempHigh4);
week.setText(dailyItemList.get(4).getWeek());
img.setImageResource(dailyItemList.get(4).getWeatherImg());
tempLow.setText(dailyItemList.get(4).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(4).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week5);
img = (ImageView) findViewById(R.id.img5);
tempLow = (TextView) findViewById(R.id.tempLow5);
tempHigh = (TextView) findViewById(R.id.tempHigh5);
week.setText(dailyItemList.get(5).getWeek());
img.setImageResource(dailyItemList.get(5).getWeatherImg());
tempLow.setText(dailyItemList.get(5).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(5).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week6);
img = (ImageView) findViewById(R.id.img6);
tempLow = (TextView) findViewById(R.id.tempLow6);
tempHigh = (TextView) findViewById(R.id.tempHigh6);
week.setText(dailyItemList.get(6).getWeek());
img.setImageResource(dailyItemList.get(6).getWeatherImg());
tempLow.setText(dailyItemList.get(6).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(6).getTempHigh() + "℃");
}
private void setHourlyData(){
cityItemList = getWeatherInfo.getHourlyDataList();
}
private void setDailyData(){
dailyItemList = getWeatherInfo.getDailyDataList();
}
private void setGridView(){
if(!cityItemList.isEmpty()){
int size = cityItemList.size();
int length = 100;
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
float density = displayMetrics.density;
int gridviewWidth = (int) (size * (length + 4) * density);
int itemWidth = (int) (length * density);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(gridviewWidth,
ViewGroup.LayoutParams.MATCH_PARENT);
gridView.setLayoutParams(params); // 设置GirdView布局参数,横向布局的关键
gridView.setColumnWidth(itemWidth); // 设置列表项宽
gridView.setHorizontalSpacing(3); // 设置列表项水平间距
gridView.setStretchMode(GridView.NO_STRETCH);
gridView.setNumColumns(size); // 设置列数量=列表集合数
GridViewAdapter adapter = new GridViewAdapter(getApplicationContext(),cityItemList);
gridView.setAdapter(adapter);
}
else {
System.out.println("cityItemData为空");
}
}
public class GridViewAdapter extends BaseAdapter{
Context context;
List<HourlyData> list;
public GridViewAdapter(Context _context,List<HourlyData> _list){
this.context = _context;
this.list = _list;
}
@Override
public int getCount() {
return cityItemList.size();
}
@Override
public Object getItem(int position) {
return cityItemList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
convertView = layoutInflater.inflate(R.layout.list_item,null);
TextView timeView = (TextView) convertView.findViewById(R.id.time_view);
ImageView imageView = (ImageView) convertView.findViewById(R.id.img_view);
TextView tempView = (TextView) convertView.findViewById(R.id.temp_view);
HourlyData city = list.get(position);
timeView.setText(city.getCityTime());
imageView.setImageResource(city.getweatherImg());
tempView.setText(city.getCityTemp() + "℃");
return convertView;
}
}
}
| UTF-8 | Java | 10,680 | java | MainActivity.java | Java | [
{
"context": "package com.example.dyq.myweatherapp;\n\nimport android.app.Activity;\nimpo",
"end": 22,
"score": 0.5450613498687744,
"start": 20,
"tag": "USERNAME",
"value": "dy"
}
] | null | [] | package com.example.dyq.myweatherapp;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import WeatherInfo.DailyData;
import WeatherInfo.GetWeatherInfo;
import WeatherInfo.HourlyData;
public class MainActivity extends Activity implements View.OnClickListener {
GridView gridView;
List<HourlyData> cityItemList = new ArrayList<>();
List<DailyData> dailyItemList = new ArrayList<>();
String fileName = "result.txt";
String response;
GetWeatherInfo getWeatherInfo;
Button btSettings;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
btSettings = (Button) findViewById(R.id.btSettings);
btSettings.setOnClickListener(this);
if (Build.VERSION.SDK_INT >= 11) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads ().detectDiskWrites().detectNetwork().penaltyLog().build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());
}
LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
getHttpData();
gridView = (GridView) findViewById(R.id.grid_view);
setHourlyData();
setDailyData();
setGridView();
setCityName();
setCurrentTemp();
setWeatherType();
setWeatherQulity();
setToday();
setTodayLowTmp();
setTodayHighTmp();
setDaily();
}
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btSettings:
Intent intent = new Intent(MainActivity.this,CityListActivity.class);
startActivity(intent);
break;
default:
break;
}
}
private void getHttpData(){
//请求网络数据
getWeatherInfo = new GetWeatherInfo();
getWeatherInfo.setInputCityName("深圳");
getWeatherInfo.sendRequestWithHttpClient();
response = getWeatherInfo.getResponse();
File fileCache = this.getFilesDir();
try{
File dir = new File(fileCache.toString());
if(!dir.exists()) {
dir.mkdirs();
}
File txt = new File(dir.getPath(),fileName);
FileOutputStream out = new FileOutputStream(txt);
byte [] bytes = response.getBytes();
out.write(bytes);
out.close();
getWeatherInfo.readWeatherDataFromBuffer(txt.getAbsolutePath());
/*InputStream inputStream = getResources().openRawResource(R.raw.data);
getWeatherInfo.readWeatherDataFromRaw(inputStream);*/
}
catch(Exception e){
e.printStackTrace();
}
}
private void setCityName(){
TextView textCityName = (TextView) findViewById(R.id.cityname_view);
textCityName.setText(getWeatherInfo.getCityName());
}
private void setCurrentTemp(){
TextView temp_view = (TextView) findViewById(R.id.temp_view);
temp_view.setText(getWeatherInfo.getCurrentTemp() + "℃");
}
private void setWeatherType(){
TextView weatherType_view = (TextView) findViewById(R.id.weatherType_view);
weatherType_view.setText(getWeatherInfo.getWeatherType());
}
private void setWeatherQulity(){
TextView weatherQulity_view = (TextView) findViewById(R.id.weatherQuality_view);
weatherQulity_view.setText("|空气" + getWeatherInfo.getQuality());
}
private void setToday(){
TextView today_view = (TextView) findViewById(R.id.today_view);
today_view.setText(getWeatherInfo.getWeek() + " 今天");
}
private void setTodayLowTmp(){
TextView todayLowTmp_view = (TextView) findViewById(R.id.todayLowTemp_view);
todayLowTmp_view.setText(getWeatherInfo.getTempLow() + "℃");
}
private void setTodayHighTmp(){
TextView todayHighTmp_view = (TextView) findViewById(R.id.todayHighTemp_view);
todayHighTmp_view.setText(getWeatherInfo.getTempHigh() + "℃");
}
private void setDaily(){
TextView week = (TextView) findViewById(R.id.week1);
ImageView img = (ImageView) findViewById(R.id.img1);
TextView tempLow = (TextView) findViewById(R.id.tempLow1);
TextView tempHigh = (TextView) findViewById(R.id.tempHigh1);
week.setText(dailyItemList.get(1).getWeek());
img.setImageResource(dailyItemList.get(1).getWeatherImg());
tempLow.setText(dailyItemList.get(1).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(1).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week2);
img = (ImageView) findViewById(R.id.img2);
tempLow = (TextView) findViewById(R.id.tempLow2);
tempHigh = (TextView) findViewById(R.id.tempHigh2);
week.setText(dailyItemList.get(2).getWeek());
img.setImageResource(dailyItemList.get(2).getWeatherImg());
tempLow.setText(dailyItemList.get(2).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(2).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week3);
img = (ImageView) findViewById(R.id.img3);
tempLow = (TextView) findViewById(R.id.tempLow3);
tempHigh = (TextView) findViewById(R.id.tempHigh3);
week.setText(dailyItemList.get(3).getWeek());
img.setImageResource(dailyItemList.get(3).getWeatherImg());
tempLow.setText(dailyItemList.get(3).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(3).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week4);
img = (ImageView) findViewById(R.id.img4);
tempLow = (TextView) findViewById(R.id.tempLow4);
tempHigh = (TextView) findViewById(R.id.tempHigh4);
week.setText(dailyItemList.get(4).getWeek());
img.setImageResource(dailyItemList.get(4).getWeatherImg());
tempLow.setText(dailyItemList.get(4).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(4).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week5);
img = (ImageView) findViewById(R.id.img5);
tempLow = (TextView) findViewById(R.id.tempLow5);
tempHigh = (TextView) findViewById(R.id.tempHigh5);
week.setText(dailyItemList.get(5).getWeek());
img.setImageResource(dailyItemList.get(5).getWeatherImg());
tempLow.setText(dailyItemList.get(5).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(5).getTempHigh() + "℃");
week = (TextView) findViewById(R.id.week6);
img = (ImageView) findViewById(R.id.img6);
tempLow = (TextView) findViewById(R.id.tempLow6);
tempHigh = (TextView) findViewById(R.id.tempHigh6);
week.setText(dailyItemList.get(6).getWeek());
img.setImageResource(dailyItemList.get(6).getWeatherImg());
tempLow.setText(dailyItemList.get(6).getTempLow() + "℃~");
tempHigh.setText(dailyItemList.get(6).getTempHigh() + "℃");
}
private void setHourlyData(){
cityItemList = getWeatherInfo.getHourlyDataList();
}
private void setDailyData(){
dailyItemList = getWeatherInfo.getDailyDataList();
}
private void setGridView(){
if(!cityItemList.isEmpty()){
int size = cityItemList.size();
int length = 100;
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
float density = displayMetrics.density;
int gridviewWidth = (int) (size * (length + 4) * density);
int itemWidth = (int) (length * density);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(gridviewWidth,
ViewGroup.LayoutParams.MATCH_PARENT);
gridView.setLayoutParams(params); // 设置GirdView布局参数,横向布局的关键
gridView.setColumnWidth(itemWidth); // 设置列表项宽
gridView.setHorizontalSpacing(3); // 设置列表项水平间距
gridView.setStretchMode(GridView.NO_STRETCH);
gridView.setNumColumns(size); // 设置列数量=列表集合数
GridViewAdapter adapter = new GridViewAdapter(getApplicationContext(),cityItemList);
gridView.setAdapter(adapter);
}
else {
System.out.println("cityItemData为空");
}
}
public class GridViewAdapter extends BaseAdapter{
Context context;
List<HourlyData> list;
public GridViewAdapter(Context _context,List<HourlyData> _list){
this.context = _context;
this.list = _list;
}
@Override
public int getCount() {
return cityItemList.size();
}
@Override
public Object getItem(int position) {
return cityItemList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater layoutInflater = LayoutInflater.from(context);
convertView = layoutInflater.inflate(R.layout.list_item,null);
TextView timeView = (TextView) convertView.findViewById(R.id.time_view);
ImageView imageView = (ImageView) convertView.findViewById(R.id.img_view);
TextView tempView = (TextView) convertView.findViewById(R.id.temp_view);
HourlyData city = list.get(position);
timeView.setText(city.getCityTime());
imageView.setImageResource(city.getweatherImg());
tempView.setText(city.getCityTemp() + "℃");
return convertView;
}
}
}
| 10,680 | 0.646908 | 0.641692 | 281 | 36.516014 | 27.993401 | 165 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.640569 | false | false | 9 |
3069f6540f333f810f6ad8147a91d1a23ab0c94d | 2,181,843,392,048 | 4d1b375f856be41ccbfb0bc4971ef241cd6d88ac | /com.inventage.tools.versiontiger.test/src/main/java/com/inventage/tools/versiontiger/internal/manifest/VersionAttributeTest.java | eb2930077e2342041f34c0f97de2052481de71a6 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | vladdu/version-tiger | https://github.com/vladdu/version-tiger | 793e43c228c3f8f573d9db0c460279a67002324e | 588e252dda1a1eaa1d55f63a2fc89c5c940aed71 | refs/heads/master | 2021-08-17T22:58:10.503000 | 2018-11-08T11:24:12 | 2018-11-13T11:52:30 | 44,056,353 | 1 | 0 | NOASSERTION | true | 2021-01-26T12:54:17 | 2015-10-11T14:56:18 | 2021-01-26T08:56:17 | 2021-01-26T12:54:15 | 292 | 0 | 0 | 0 | Java | false | false | package com.inventage.tools.versiontiger.internal.manifest;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import com.inventage.tools.versiontiger.internal.manifest.VersionAttribute;
import com.inventage.tools.versiontiger.internal.manifest.VersionRange;
public class VersionAttributeTest {
@Test
public void shouldPrintWithQuotes() throws Exception {
// given
final StringBuilder result = new StringBuilder();
VersionAttribute versionAttribute = new VersionAttribute();
VersionRange versionRange = mock(VersionRange.class);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
result.append("[1.0,2.0)");
return null;
}
}).when(versionRange).print(result);
versionAttribute.setVersionRange(versionRange);
versionAttribute.setQuotes(true);
// when
versionAttribute.print(result);
// then
assertEquals("bundle-version=\"[1.0,2.0)\"", result.toString());
}
@Test
public void shouldPrintWithoutQuotes() throws Exception {
// given
final StringBuilder result = new StringBuilder();
VersionAttribute versionAttribute = new VersionAttribute();
VersionRange versionRange = mock(VersionRange.class);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
result.append("1.0");
return null;
}
}).when(versionRange).print(result);
versionAttribute.setVersionRange(versionRange);
versionAttribute.setQuotes(false);
// when
versionAttribute.print(result);
// then
assertEquals("bundle-version=1.0", result.toString());
}
@Test
public void shouldPrintWithQuotesWhenRange() throws Exception {
// given
final StringBuilder result = new StringBuilder();
VersionAttribute versionAttribute = new VersionAttribute();
VersionRange versionRange = mock(VersionRange.class);
when(versionRange.isRange()).thenReturn(true);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
result.append("[1.0,2.0)");
return null;
}
}).when(versionRange).print(result);
versionAttribute.setVersionRange(versionRange);
versionAttribute.setQuotes(false);
// when
versionAttribute.print(result);
// then
assertEquals("bundle-version=\"[1.0,2.0)\"", result.toString());
}
}
| UTF-8 | Java | 2,494 | java | VersionAttributeTest.java | Java | [] | null | [] | package com.inventage.tools.versiontiger.internal.manifest;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import com.inventage.tools.versiontiger.internal.manifest.VersionAttribute;
import com.inventage.tools.versiontiger.internal.manifest.VersionRange;
public class VersionAttributeTest {
@Test
public void shouldPrintWithQuotes() throws Exception {
// given
final StringBuilder result = new StringBuilder();
VersionAttribute versionAttribute = new VersionAttribute();
VersionRange versionRange = mock(VersionRange.class);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
result.append("[1.0,2.0)");
return null;
}
}).when(versionRange).print(result);
versionAttribute.setVersionRange(versionRange);
versionAttribute.setQuotes(true);
// when
versionAttribute.print(result);
// then
assertEquals("bundle-version=\"[1.0,2.0)\"", result.toString());
}
@Test
public void shouldPrintWithoutQuotes() throws Exception {
// given
final StringBuilder result = new StringBuilder();
VersionAttribute versionAttribute = new VersionAttribute();
VersionRange versionRange = mock(VersionRange.class);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
result.append("1.0");
return null;
}
}).when(versionRange).print(result);
versionAttribute.setVersionRange(versionRange);
versionAttribute.setQuotes(false);
// when
versionAttribute.print(result);
// then
assertEquals("bundle-version=1.0", result.toString());
}
@Test
public void shouldPrintWithQuotesWhenRange() throws Exception {
// given
final StringBuilder result = new StringBuilder();
VersionAttribute versionAttribute = new VersionAttribute();
VersionRange versionRange = mock(VersionRange.class);
when(versionRange.isRange()).thenReturn(true);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
result.append("[1.0,2.0)");
return null;
}
}).when(versionRange).print(result);
versionAttribute.setVersionRange(versionRange);
versionAttribute.setQuotes(false);
// when
versionAttribute.print(result);
// then
assertEquals("bundle-version=\"[1.0,2.0)\"", result.toString());
}
}
| 2,494 | 0.744587 | 0.736568 | 85 | 28.341177 | 23.623793 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.258824 | false | false | 9 |
f67b7159563acd01761d8b8e2edf9023129bd489 | 4,492,535,861,519 | cfaea5bae340264f97571288f5e5f5e43cc0c14d | /latihan3.java | e89ad173320f1655a3d1728f647b330273fa9c74 | [] | no_license | rahmataltamazi29/PrakPBO_Pert4 | https://github.com/rahmataltamazi29/PrakPBO_Pert4 | e2859ec488881b56c9dc8a1e593a18846f6488eb | 7d27ad837043f0e90c31b79a9b64c9fcc3b1b09f | refs/heads/main | 2022-12-28T00:24:11.361000 | 2020-10-15T08:16:44 | 2020-10-15T08:16:44 | 304,256,036 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Scanner;
public class latihan3{
public static void main(String[] args)
{
Scanner inputan = new Scanner(System.in);
int nilai;
System.out.print("Masukkan nilai = ");
nilai = inputan.nextInt();
//posisi if berjalan
if (nilai % 2 == 0)
{
System.out.println("Angka yang dimasukkan adalah genap");
}
else
{
System.out.println("Angka yang dimasukkan adalah ganjil");
}
}
}
| UTF-8 | Java | 445 | java | latihan3.java | Java | [] | null | [] | import java.util.Scanner;
public class latihan3{
public static void main(String[] args)
{
Scanner inputan = new Scanner(System.in);
int nilai;
System.out.print("Masukkan nilai = ");
nilai = inputan.nextInt();
//posisi if berjalan
if (nilai % 2 == 0)
{
System.out.println("Angka yang dimasukkan adalah genap");
}
else
{
System.out.println("Angka yang dimasukkan adalah ganjil");
}
}
}
| 445 | 0.624719 | 0.617977 | 22 | 18.227272 | 19.161827 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.909091 | false | false | 9 |
33fd8eb3fd1a4b7e32f6c18f113960c6cbc22ad4 | 20,220,706,087,219 | 134ea7616dffdda202874916005507d90e2c54e1 | /src/maxim/express/opera/define/Op_QUES.java | 445adc8a114d5afce74d73002d917ec3864e95c2 | [
"Apache-2.0"
] | permissive | mlingp/MAXIM_EXPRESS | https://github.com/mlingp/MAXIM_EXPRESS | 9796416286b009ac56009234ad40abf20ec80ba5 | 31c5a584abea4b7ff759a93accd10b3747e1db81 | refs/heads/master | 2020-06-18T16:03:23.150000 | 2019-07-11T09:15:56 | 2019-07-11T09:15:56 | 196,358,128 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package maxim.express.opera.define;
import maxim.express.IllegalExpressionException;
import maxim.express.datameta.BaseDataMeta;
import maxim.express.datameta.Constant;
import maxim.express.opera.IOperatorExecution;
import maxim.express.opera.Operator;
/**
* @author maxim
*/
public class Op_QUES implements IOperatorExecution {
public static final Operator THIS_OPERATOR = Operator.QUES;
public Constant execute(Constant[] args) {
throw new UnsupportedOperationException("操作符\"" + THIS_OPERATOR.getToken() + "不支持该方法");
}
public Constant verify(int opPositin, BaseDataMeta[] args)
throws IllegalExpressionException {
throw new UnsupportedOperationException("操作符\"" + THIS_OPERATOR.getToken() + "不支持该方法");
}
}
| UTF-8 | Java | 826 | java | Op_QUES.java | Java | [
{
"context": "t maxim.express.opera.Operator;\r\n\r\n/**\r\n * @author maxim\r\n */\r\npublic class Op_QUES implements IOperatorEx",
"end": 284,
"score": 0.9925988912582397,
"start": 279,
"tag": "USERNAME",
"value": "maxim"
}
] | null | [] | package maxim.express.opera.define;
import maxim.express.IllegalExpressionException;
import maxim.express.datameta.BaseDataMeta;
import maxim.express.datameta.Constant;
import maxim.express.opera.IOperatorExecution;
import maxim.express.opera.Operator;
/**
* @author maxim
*/
public class Op_QUES implements IOperatorExecution {
public static final Operator THIS_OPERATOR = Operator.QUES;
public Constant execute(Constant[] args) {
throw new UnsupportedOperationException("操作符\"" + THIS_OPERATOR.getToken() + "不支持该方法");
}
public Constant verify(int opPositin, BaseDataMeta[] args)
throws IllegalExpressionException {
throw new UnsupportedOperationException("操作符\"" + THIS_OPERATOR.getToken() + "不支持该方法");
}
}
| 826 | 0.718987 | 0.718987 | 25 | 29.6 | 29.410202 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 9 |
8c3fed1010a59b138c13a4500e4a97cfc115f2fd | 20,323,785,303,806 | ee71939ffd4c1b4d96de9d598da7b1a642dcf18f | /src/main/java/io/github/francoiscampbell/apimodel/Caption.java | 433552e25c8e601d57d0c6ae7ad2f5bb9b9cf9aa | [] | no_license | francoiscampbell/LibMovieMarathon | https://github.com/francoiscampbell/LibMovieMarathon | 85bacc9e5f1cde2345ba212e16ebeb9e0c0c3bea | 63f39c0050ed7f97ce2046738d0348ed487ef145 | refs/heads/master | 2022-07-25T16:05:32.722000 | 2016-05-22T18:59:50 | 2016-05-22T18:59:50 | 38,499,247 | 0 | 0 | null | false | 2019-02-17T20:49:14 | 2015-07-03T15:27:38 | 2016-07-31T05:28:33 | 2019-02-17T20:49:12 | 152 | 0 | 0 | 1 | Java | false | null |
package io.github.francoiscampbell.apimodel;
import com.google.gson.annotations.Expose;
import javax.annotation.Generated;
@Generated("org.jsonschema2pojo")
public class Caption {
@Expose
private String content;
@Expose
private String lang;
/**
*
* @return
* The content
*/
public String getContent() {
return content;
}
/**
*
* @param content
* The content
*/
public void setContent(String content) {
this.content = content;
}
public Caption withContent(String content) {
this.content = content;
return this;
}
/**
*
* @return
* The lang
*/
public String getLang() {
return lang;
}
/**
*
* @param lang
* The lang
*/
public void setLang(String lang) {
this.lang = lang;
}
public Caption withLang(String lang) {
this.lang = lang;
return this;
}
}
| UTF-8 | Java | 1,002 | java | Caption.java | Java | [
{
"context": "\npackage io.github.francoiscampbell.apimodel;\n\nimport com.google.gson.annotations.Exp",
"end": 35,
"score": 0.9993048906326294,
"start": 19,
"tag": "USERNAME",
"value": "francoiscampbell"
}
] | null | [] |
package io.github.francoiscampbell.apimodel;
import com.google.gson.annotations.Expose;
import javax.annotation.Generated;
@Generated("org.jsonschema2pojo")
public class Caption {
@Expose
private String content;
@Expose
private String lang;
/**
*
* @return
* The content
*/
public String getContent() {
return content;
}
/**
*
* @param content
* The content
*/
public void setContent(String content) {
this.content = content;
}
public Caption withContent(String content) {
this.content = content;
return this;
}
/**
*
* @return
* The lang
*/
public String getLang() {
return lang;
}
/**
*
* @param lang
* The lang
*/
public void setLang(String lang) {
this.lang = lang;
}
public Caption withLang(String lang) {
this.lang = lang;
return this;
}
}
| 1,002 | 0.536926 | 0.535928 | 61 | 15.409836 | 13.604938 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.213115 | false | false | 9 |
9413e0cd6c4d4737de3eeba7677f2b960f255deb | 23,802,708,818,962 | 358801fcdddde569271f84320f9255fcdfeb7dbb | /app/src/main/java/com/example/w8/rarangi/ShoppingItem.java | 5bd3ee2ba44bde82f2a44d0355ec411f5506f9c7 | [] | no_license | JuliaOli/Rarangi | https://github.com/JuliaOli/Rarangi | adf0671cc8772b4810d3c9d73cb2d85311da47fb | 726037541e68189e39a2ade2fce1a60988f6681b | refs/heads/master | 2021-01-11T01:18:09.616000 | 2016-10-17T18:26:40 | 2016-10-17T18:26:40 | 71,061,488 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.w8.rarangi;
import android.content.Intent;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import saveme.Save;
public class ShoppingItem extends AppCompatActivity implements Save {
FloatingActionButton fabAdd, fabSave;
String master = null;
TextView title;
EditText text1;
EditText text2;
EditText text3;
EditText text4;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shopping);
fabAdd = (FloatingActionButton) findViewById(R.id.fabAdd);
fabAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
title = (TextView)findViewById(R.id.title1);
text1 = (EditText)findViewById(R.id.textName);
text2 = (EditText)findViewById(R.id.editText6);
text3 = (EditText)findViewById(R.id.editText7);
text4 = (EditText)findViewById(R.id.editText5);
saveAll();
Toast.makeText(getApplicationContext(),"Item added to the list",Toast.LENGTH_SHORT).show();
}
});
fabSave = (FloatingActionButton)findViewById(R.id.fabSave);
fabSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(),"List created",Toast.LENGTH_SHORT).show();
Intent inten = new Intent(ShoppingItem.this, ListActivity.class);
startActivity(inten);
}
});
}
@Override
public void saveAll() {
//master.concat(title.getText().toString() + ",").concat(text1.getText().toString() + ",").concat(text2.getText().toString());
master = title.getText().toString().concat(text1.getText().toString()).concat( ", " + text2.getText().toString() + ", ").concat(text3.getText().toString() + ",")
.concat(text4.getText().toString() + "!!");
}
}
| UTF-8 | Java | 2,382 | java | ShoppingItem.java | Java | [] | null | [] | package com.example.w8.rarangi;
import android.content.Intent;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import saveme.Save;
public class ShoppingItem extends AppCompatActivity implements Save {
FloatingActionButton fabAdd, fabSave;
String master = null;
TextView title;
EditText text1;
EditText text2;
EditText text3;
EditText text4;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shopping);
fabAdd = (FloatingActionButton) findViewById(R.id.fabAdd);
fabAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
title = (TextView)findViewById(R.id.title1);
text1 = (EditText)findViewById(R.id.textName);
text2 = (EditText)findViewById(R.id.editText6);
text3 = (EditText)findViewById(R.id.editText7);
text4 = (EditText)findViewById(R.id.editText5);
saveAll();
Toast.makeText(getApplicationContext(),"Item added to the list",Toast.LENGTH_SHORT).show();
}
});
fabSave = (FloatingActionButton)findViewById(R.id.fabSave);
fabSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(),"List created",Toast.LENGTH_SHORT).show();
Intent inten = new Intent(ShoppingItem.this, ListActivity.class);
startActivity(inten);
}
});
}
@Override
public void saveAll() {
//master.concat(title.getText().toString() + ",").concat(text1.getText().toString() + ",").concat(text2.getText().toString());
master = title.getText().toString().concat(text1.getText().toString()).concat( ", " + text2.getText().toString() + ", ").concat(text3.getText().toString() + ",")
.concat(text4.getText().toString() + "!!");
}
}
| 2,382 | 0.646935 | 0.638539 | 72 | 32.083332 | 32.975895 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.680556 | false | false | 9 |
d6045ce175f4fb8d6497bb629780d976d3260675 | 8,289,286,881,344 | 5acf8f77a0f9efd9ed5d3b13e3861dde0bf6fc95 | /src/main/java/com/example/springbootCM/apiServer/service/CustomUserService.java | 743f2beb69af1e9df1ae615d5fb04d37a2957bad | [] | no_license | jeongyoonjeong/api-cm | https://github.com/jeongyoonjeong/api-cm | 0a3a34c88797abc31100f7eae4521c4fda2f0a44 | 1555473522585b2f23d5d80ec2a6c20a78fe84ab | refs/heads/master | 2023-05-07T17:42:02.375000 | 2021-06-02T05:19:18 | 2021-06-02T05:19:18 | 351,070,545 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.springbootCM.apiServer.service;
import com.example.springbootCM.apiItem.acnt.User;
import com.example.springbootCM.apiServer.repository.UserRepository;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.function.Supplier;
@Transactional
@Service
public class CustomUserService implements UserService {
private final UserRepository repository ;
public CustomUserService(UserRepository repository) {
this.repository = repository;
}
public User getUserByUserId(String userId) throws Exception {
return repository
.findByUserId(userId)
.orElseThrow(Exception::new);
}
//가입
public UserDetails dupliacateUserCheck(String userID) {
return repository
.findByUserId(userID)
.orElse(User.builder().build());
}
public UserDetails register(User userInfo) {
return repository.save(userInfo);
}
public UserDetails getAllInfo(String userId){
return repository
.findByUserId(userId)
.orElse(User.builder().build());
}
}
| UTF-8 | Java | 1,393 | java | CustomUserService.java | Java | [] | null | [] | package com.example.springbootCM.apiServer.service;
import com.example.springbootCM.apiItem.acnt.User;
import com.example.springbootCM.apiServer.repository.UserRepository;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.function.Supplier;
@Transactional
@Service
public class CustomUserService implements UserService {
private final UserRepository repository ;
public CustomUserService(UserRepository repository) {
this.repository = repository;
}
public User getUserByUserId(String userId) throws Exception {
return repository
.findByUserId(userId)
.orElseThrow(Exception::new);
}
//가입
public UserDetails dupliacateUserCheck(String userID) {
return repository
.findByUserId(userID)
.orElse(User.builder().build());
}
public UserDetails register(User userInfo) {
return repository.save(userInfo);
}
public UserDetails getAllInfo(String userId){
return repository
.findByUserId(userId)
.orElse(User.builder().build());
}
}
| 1,393 | 0.720662 | 0.720662 | 45 | 29.866667 | 24.459127 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 9 |
643f08357a7ff8692e9dc994ff55c43d5dae45cd | 32,573,032,036,355 | b19cfbcfd6a3a088a291e917be733b4850cc77c0 | /app/src/main/java/muhanxi/zhibodemo/TView.java | b47aad1095c952872d462348379581c98c3b68df | [] | no_license | qingtian2/ZhiBoDemo | https://github.com/qingtian2/ZhiBoDemo | 5140d199307428a8ee835da2c728dc55115cfe7d | fbe84e04dc835a2f9c4f31f9374de66495bcab92 | refs/heads/master | 2021-01-15T22:47:37.485000 | 2017-08-09T09:43:38 | 2017-08-09T09:43:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package muhanxi.zhibodemo;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by muhanxi on 17/8/7.
*/
public class TView extends View {
public TView(Context context) {
super(context);
}
public TView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public TView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
}
| UTF-8 | Java | 551 | java | TView.java | Java | [
{
"context": "eSet;\nimport android.view.View;\n\n/**\n * Created by muhanxi on 17/8/7.\n */\n\npublic class TView extends View {",
"end": 190,
"score": 0.9996607899665833,
"start": 183,
"tag": "USERNAME",
"value": "muhanxi"
}
] | null | [] | package muhanxi.zhibodemo;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by muhanxi on 17/8/7.
*/
public class TView extends View {
public TView(Context context) {
super(context);
}
public TView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public TView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
}
| 551 | 0.69873 | 0.69147 | 26 | 20.192308 | 21.935253 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 9 |
0f3f3946485695e2c18c80f3b320fb586b8e3a78 | 22,007,412,481,471 | 219b70cbf23f2e3d6b57491d9c37835e0129b409 | /src/main/java/com/mkyong/entity/Person.java | af91b1e11fa8307d0ae6be97551a446ad9e00c5a | [] | no_license | leo-garay/spring-data-jpa-postgresql-audit | https://github.com/leo-garay/spring-data-jpa-postgresql-audit | b68b831b5ee7d4b6032e90ad3334770988c8c2c1 | af2c1d403833745b11cf82081337b0325503ff3b | refs/heads/master | 2020-08-29T18:16:23.512000 | 2019-10-28T19:19:21 | 2019-10-28T19:19:21 | 218,124,996 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mkyong.entity;
import com.mkyong.config.Auditable;
import javax.persistence.*;
@Entity
public class Person extends Auditable<String> {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private int id;
private String name;
public Person() { }
public Person(String name) {
this.name=name;
}
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;
}
}
| UTF-8 | Java | 588 | java | Person.java | Java | [] | null | [] | package com.mkyong.entity;
import com.mkyong.config.Auditable;
import javax.persistence.*;
@Entity
public class Person extends Auditable<String> {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private int id;
private String name;
public Person() { }
public Person(String name) {
this.name=name;
}
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;
}
}
| 588 | 0.602041 | 0.602041 | 36 | 15.333333 | 14.653403 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.277778 | false | false | 9 |
60f090ebd0dabf82e723b6bda3bafe6e864cc35e | 11,012,296,210,520 | 2ba1faadad3ff80cde4b9d11b0222db4471fc97c | /Neptis1/app/src/main/java/com/example/anna/neptis/TreasurePortalPag2.java | de874dba411d1cc75aaeac4b18dcd40912e3a048 | [] | no_license | Balboa90/Gamification-Neptis | https://github.com/Balboa90/Gamification-Neptis | a66920939876bb037c814c2c55a4a815f7c68b2e | 00fdcd33cb713eeaa68549e20eabba4b587b51cd | refs/heads/master | 2020-09-22T11:09:32.222000 | 2017-03-24T10:33:27 | 2017-03-24T10:33:27 | 67,784,425 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.anna.neptis;
import android.content.Intent;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ScrollView;
import android.widget.Toast;
public class TreasurePortalPag2 extends AppCompatActivity {
private final static int CAMERA_REQUEST_CODE = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_treasure_portal_pag2);
//per consentire la navigazione back nelle activity(si può anche personalizzare con un'icona)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
/*___________________________gestione della gridView all'interno della scrollbar______________________*/
final GridView gridView = (GridView) findViewById(R.id.grid_treasures);
// Instance of ImageAdapter Class
gridView.setAdapter(new ImageAdapter(this));
/*__________________________fine gestione gridView all'interno della scrollbar________________________*/
/*___________________________On Click event for Single Gridview Item___________________________*/
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
/********potrebbe essere utile per far apparire una nuova activity con gli elementi presenti in ogni forziere*************
// Sending image id to FullScreenActivity
Intent i = new Intent(getApplicationContext(), FullImageActivity.class);
// passing array index
i.putExtra("id", position);
startActivity(i);
***********************con i dati che ha detto Alessandro***************/
Toast toast = Toast.makeText(getApplicationContext(),"Selezionato forziere " + position ,Toast.LENGTH_SHORT);
toast.show();
}
});
/*___________________fine gestione click sui tesori all'interno della scrollbar____________________*/
//per abilitare la scrollview
ScrollView sView = (ScrollView)findViewById(R.id.ScrollView01);
/*____________________To Hide the Scollbar__________________
sView.setVerticalScrollBarEnabled(false);
sView.setHorizontalScrollBarEnabled(false);
___________________________________________________________*/
/*__________________gestione imageButton COLOSSEO e FOTOCAMERA____________________*/
ImageButton colosseo = (ImageButton)findViewById(R.id.colosseo_image);
colosseo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast toast = Toast.makeText(view.getContext(),"Colosseo ImageButton",Toast.LENGTH_SHORT);
toast.show();
}});
ImageButton camera = (ImageButton)findViewById(R.id.camera_image);
camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent openCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(openCamera,CAMERA_REQUEST_CODE);
/*Toast toast = Toast.makeText(view.getContext(),"Camera ImageButton",Toast.LENGTH_SHORT);
toast.show();*/
}});
/*__________________fine gestione imageButton COLOSSEO e FOTOCAMERA____________________*/
/*__________________gestione bottone SITE INFORMATION____________________*/
Button siteInformation = (Button)findViewById(R.id.site_information);
siteInformation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast toast = Toast.makeText(view.getContext(),"Site Information Button",Toast.LENGTH_SHORT);
toast.show();
}});
/*__________________fine gestione bottone SITE INFORMATION____________________*/
}
@Override
protected void onActivityResult(int requestCode, int resultCode,Intent data)
{
if (requestCode == CAMERA_REQUEST_CODE && resultCode== RESULT_OK){
Toast.makeText(this,"camera ok!",Toast.LENGTH_LONG).show();
}
}
}
| UTF-8 | Java | 4,641 | java | TreasurePortalPag2.java | Java | [] | null | [] | package com.example.anna.neptis;
import android.content.Intent;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ScrollView;
import android.widget.Toast;
public class TreasurePortalPag2 extends AppCompatActivity {
private final static int CAMERA_REQUEST_CODE = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_treasure_portal_pag2);
//per consentire la navigazione back nelle activity(si può anche personalizzare con un'icona)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
/*___________________________gestione della gridView all'interno della scrollbar______________________*/
final GridView gridView = (GridView) findViewById(R.id.grid_treasures);
// Instance of ImageAdapter Class
gridView.setAdapter(new ImageAdapter(this));
/*__________________________fine gestione gridView all'interno della scrollbar________________________*/
/*___________________________On Click event for Single Gridview Item___________________________*/
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
/********potrebbe essere utile per far apparire una nuova activity con gli elementi presenti in ogni forziere*************
// Sending image id to FullScreenActivity
Intent i = new Intent(getApplicationContext(), FullImageActivity.class);
// passing array index
i.putExtra("id", position);
startActivity(i);
***********************con i dati che ha detto Alessandro***************/
Toast toast = Toast.makeText(getApplicationContext(),"Selezionato forziere " + position ,Toast.LENGTH_SHORT);
toast.show();
}
});
/*___________________fine gestione click sui tesori all'interno della scrollbar____________________*/
//per abilitare la scrollview
ScrollView sView = (ScrollView)findViewById(R.id.ScrollView01);
/*____________________To Hide the Scollbar__________________
sView.setVerticalScrollBarEnabled(false);
sView.setHorizontalScrollBarEnabled(false);
___________________________________________________________*/
/*__________________gestione imageButton COLOSSEO e FOTOCAMERA____________________*/
ImageButton colosseo = (ImageButton)findViewById(R.id.colosseo_image);
colosseo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast toast = Toast.makeText(view.getContext(),"Colosseo ImageButton",Toast.LENGTH_SHORT);
toast.show();
}});
ImageButton camera = (ImageButton)findViewById(R.id.camera_image);
camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent openCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(openCamera,CAMERA_REQUEST_CODE);
/*Toast toast = Toast.makeText(view.getContext(),"Camera ImageButton",Toast.LENGTH_SHORT);
toast.show();*/
}});
/*__________________fine gestione imageButton COLOSSEO e FOTOCAMERA____________________*/
/*__________________gestione bottone SITE INFORMATION____________________*/
Button siteInformation = (Button)findViewById(R.id.site_information);
siteInformation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast toast = Toast.makeText(view.getContext(),"Site Information Button",Toast.LENGTH_SHORT);
toast.show();
}});
/*__________________fine gestione bottone SITE INFORMATION____________________*/
}
@Override
protected void onActivityResult(int requestCode, int resultCode,Intent data)
{
if (requestCode == CAMERA_REQUEST_CODE && resultCode== RESULT_OK){
Toast.makeText(this,"camera ok!",Toast.LENGTH_LONG).show();
}
}
}
| 4,641 | 0.581466 | 0.580172 | 135 | 33.370369 | 36.805946 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 9 |
020ee8f4e8e86cc946de779688b451111e792344 | 12,850,542,211,248 | c3fc3a9bd3c37f7b8a268cd7aca31aaccf9e2725 | /src/main/java/burp/JsonEntry.java | 8895a7fc5394a937d8801bd9e3e1bd0640720f6d | [
"Apache-2.0"
] | permissive | CodrinE/burp-suite-jsonpath | https://github.com/CodrinE/burp-suite-jsonpath | 5da0baf5204f27c7397b02b573b3354833c27c95 | 1edc5ba454f5fe6fad60d63e77acc97fd5d39aef | refs/heads/master | 2020-12-07T18:23:20.068000 | 2020-01-06T19:01:17 | 2020-01-06T19:01:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package burp;
public class JsonEntry {
final String path;
final byte[] request;
final String operationName;
final IHttpRequestResponse requestResponse;
final String endpoints;
final String json;
final JsonFormatter formatter;
JsonEntry(String bindingName, byte[] request, String operationName, String endpoints, IHttpRequestResponse requestResponse, JsonFormatter formatter) {
this.path = bindingName;
this.request = request;
this.operationName = operationName;
this.endpoints = endpoints;
this.requestResponse = requestResponse;
this.formatter = formatter;
this.json = formatter.prettyPrint();
}
}
| UTF-8 | Java | 695 | java | JsonEntry.java | Java | [] | null | [] | package burp;
public class JsonEntry {
final String path;
final byte[] request;
final String operationName;
final IHttpRequestResponse requestResponse;
final String endpoints;
final String json;
final JsonFormatter formatter;
JsonEntry(String bindingName, byte[] request, String operationName, String endpoints, IHttpRequestResponse requestResponse, JsonFormatter formatter) {
this.path = bindingName;
this.request = request;
this.operationName = operationName;
this.endpoints = endpoints;
this.requestResponse = requestResponse;
this.formatter = formatter;
this.json = formatter.prettyPrint();
}
}
| 695 | 0.703597 | 0.703597 | 23 | 29.217392 | 30.878382 | 154 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.869565 | false | false | 9 |
399224b6cf4ecad5ade5eb6a6f4b40066d762f27 | 12,850,542,212,288 | dd4e5a15965ec40bfcf6d0fbb773bed4d9e87d2a | /src/main/java/com/fastdata/algorithm/solutions/ch02/section01/ShellSortImpl_2_1_11.java | 338f9328c8ed41ea1cb5047021b6bc5ffbdd723a | [] | no_license | lucky0604/leetcode-practice | https://github.com/lucky0604/leetcode-practice | 6d27719f5e771df75f4aba9c74141913858045f1 | fc4a22ea22dbe82877f45770af8461f1b2e618af | refs/heads/main | 2023-08-15T07:26:36.082000 | 2021-09-20T04:45:37 | 2021-09-20T04:45:37 | 334,917,997 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.fastdata.algorithm.solutions.ch02.section01;
/**
* @Author: Lucky
* @Description:
* 2.1.11:
* Implement a version of shellsort that keeps the increment sequence in an array,
* rather than computing it.
* @Date: created in 2021/3/28 - 13:02
*/
public class ShellSortImpl_2_1_11 {
/**
* Normal shell sort
* @param arr
*/
private static void shellSort(int[] arr) {
int length = arr.length;
for (int step = length / 2; step > 0; step /= 2) {
for (int i = step; i < length; i ++) {
int j = i;
int tmp = arr[j];
while (j - step >= 0 && arr[j - step] > tmp) {
arr[j] = arr[j - step];
j = j - step;
}
arr[j] = tmp;
}
}
}
private static void customShellSort(int[] arr) {
// corner case
if (arr == null || arr.length == 0) return;
// store the increment in an array
int maxIncrement = 1;
int numberOfIncrements = 1;
while ((maxIncrement * 3) + 1 < arr.length) {
maxIncrement = maxIncrement * 3;
maxIncrement ++;
numberOfIncrements ++;
}
int[] incrementSequence = new int[numberOfIncrements];
int index = 0;
while (maxIncrement > 0) {
incrementSequence[index] = maxIncrement;
maxIncrement --;
maxIncrement = maxIncrement / 3;
index ++;
}
// sort
for (int i = 0; i < incrementSequence.length; i ++) {
int increment = incrementSequence[i];
// h-sort the arr
for (int j = increment; j < arr.length; j ++) {
int curr = j;
while (curr >= increment && arr[curr] < arr[curr - increment]) {
int tmp = arr[curr];
arr[curr] = arr[curr - increment];
arr[curr - increment] = tmp;
curr = curr - increment;
}
}
}
}
}
| UTF-8 | Java | 2,093 | java | ShellSortImpl_2_1_11.java | Java | [
{
"context": "gorithm.solutions.ch02.section01;\n\n/**\n * @Author: Lucky\n * @Description:\n * 2.1.11:\n * Implement a versio",
"end": 79,
"score": 0.9922540187835693,
"start": 74,
"tag": "NAME",
"value": "Lucky"
}
] | null | [] | package com.fastdata.algorithm.solutions.ch02.section01;
/**
* @Author: Lucky
* @Description:
* 2.1.11:
* Implement a version of shellsort that keeps the increment sequence in an array,
* rather than computing it.
* @Date: created in 2021/3/28 - 13:02
*/
public class ShellSortImpl_2_1_11 {
/**
* Normal shell sort
* @param arr
*/
private static void shellSort(int[] arr) {
int length = arr.length;
for (int step = length / 2; step > 0; step /= 2) {
for (int i = step; i < length; i ++) {
int j = i;
int tmp = arr[j];
while (j - step >= 0 && arr[j - step] > tmp) {
arr[j] = arr[j - step];
j = j - step;
}
arr[j] = tmp;
}
}
}
private static void customShellSort(int[] arr) {
// corner case
if (arr == null || arr.length == 0) return;
// store the increment in an array
int maxIncrement = 1;
int numberOfIncrements = 1;
while ((maxIncrement * 3) + 1 < arr.length) {
maxIncrement = maxIncrement * 3;
maxIncrement ++;
numberOfIncrements ++;
}
int[] incrementSequence = new int[numberOfIncrements];
int index = 0;
while (maxIncrement > 0) {
incrementSequence[index] = maxIncrement;
maxIncrement --;
maxIncrement = maxIncrement / 3;
index ++;
}
// sort
for (int i = 0; i < incrementSequence.length; i ++) {
int increment = incrementSequence[i];
// h-sort the arr
for (int j = increment; j < arr.length; j ++) {
int curr = j;
while (curr >= increment && arr[curr] < arr[curr - increment]) {
int tmp = arr[curr];
arr[curr] = arr[curr - increment];
arr[curr - increment] = tmp;
curr = curr - increment;
}
}
}
}
}
| 2,093 | 0.47205 | 0.454372 | 70 | 28.9 | 20.865658 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.514286 | false | false | 9 |
fcb4d9bec71f088e2d6a261647f2d7f0187314e8 | 5,669,356,831,029 | c62cefc651fedc2d758634077cbbb2486787ac5a | /ptsp/src/fonctions/exND/minimiserCercle/Point.java | 46ff7ffd4ae6add16a247102922187ed568dbe84 | [] | no_license | Valro666/meta | https://github.com/Valro666/meta | 5ff4e608c5b7c975614099943c12020c344734d8 | cec0b78684869b217e400554933e80b52a1f3e2c | refs/heads/master | 2021-01-20T08:24:28.438000 | 2017-05-28T00:09:59 | 2017-05-28T00:09:59 | 90,140,564 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fonctions.exND.minimiserCercle;
/**
* permet de stocker des points pour minimiser cercle
*
* @author vthomas
*
*/
class Point
{
double x,y;
public Point(int xp,int yp)
{
x=xp;
y=yp;
}
}
| UTF-8 | Java | 211 | java | Point.java | Java | [
{
"context": "er des points pour minimiser cercle\n * \n * @author vthomas\n *\n */\nclass Point\n{\n\tdouble x,y;\n\t\n\tpublic Point",
"end": 121,
"score": 0.9984861016273499,
"start": 114,
"tag": "USERNAME",
"value": "vthomas"
}
] | null | [] | package fonctions.exND.minimiserCercle;
/**
* permet de stocker des points pour minimiser cercle
*
* @author vthomas
*
*/
class Point
{
double x,y;
public Point(int xp,int yp)
{
x=xp;
y=yp;
}
}
| 211 | 0.64455 | 0.64455 | 18 | 10.722222 | 14.479125 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false | 9 |
1600ce846fc4155f4db12e8073daa6a0559ebba9 | 4,458,176,057,617 | 4d184c5c65c99aa8099a4eb2642f0c23b1481789 | /src/main/java/org/eney/domain/Result.java | 3542779b781679fbb5a3e12375fbaaf64efc0026 | [] | no_license | jeonjaehyuk/MCN_o | https://github.com/jeonjaehyuk/MCN_o | 38fc7fcdc7d9884b20b809a3512b40c2ee40fe24 | 55688dcb6985cb7e97f9fcbe23c6c44aad73f376 | HEAD | 2018-07-15T23:21:54.607000 | 2016-06-29T06:47:58 | 2016-06-29T06:47:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.eney.domain;
/**
* json 요청 시, 상태 메세지와 성공 여부, 그리고 요청으로 인해 새로운 id가 필요한 경우에는 newId 정보를 담는 VO 클래스.
* @author KimByeongKou
*
*/
public class Result {
private String msg; // 요청 시 응답 메세지.
private Boolean isSuccess; // 요청 시 성공여부.
private Integer newId; // 필요 시 new Id.
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Boolean getIsSuccess() {
return isSuccess;
}
public void setIsSuccess(Boolean isSuccess) {
this.isSuccess = isSuccess;
}
public Integer getNewId() {
return newId;
}
public void setNewId(Integer newId) {
this.newId = newId;
}
public Result(String msg, Boolean isSuccess, Integer newId) {
super();
this.msg = msg;
this.isSuccess = isSuccess;
this.newId = newId;
}
public Result() {
super();
}
}
| UTF-8 | Java | 940 | java | Result.java | Java | [
{
"context": "해 새로운 id가 필요한 경우에는 newId 정보를 담는 VO 클래스.\n * @author KimByeongKou\n *\n */\npublic class Result {\n\n\tprivate String msg",
"end": 132,
"score": 0.9993991255760193,
"start": 120,
"tag": "NAME",
"value": "KimByeongKou"
}
] | null | [] | package org.eney.domain;
/**
* json 요청 시, 상태 메세지와 성공 여부, 그리고 요청으로 인해 새로운 id가 필요한 경우에는 newId 정보를 담는 VO 클래스.
* @author KimByeongKou
*
*/
public class Result {
private String msg; // 요청 시 응답 메세지.
private Boolean isSuccess; // 요청 시 성공여부.
private Integer newId; // 필요 시 new Id.
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Boolean getIsSuccess() {
return isSuccess;
}
public void setIsSuccess(Boolean isSuccess) {
this.isSuccess = isSuccess;
}
public Integer getNewId() {
return newId;
}
public void setNewId(Integer newId) {
this.newId = newId;
}
public Result(String msg, Boolean isSuccess, Integer newId) {
super();
this.msg = msg;
this.isSuccess = isSuccess;
this.newId = newId;
}
public Result() {
super();
}
}
| 940 | 0.663017 | 0.663017 | 43 | 18.11628 | 17.971825 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.674419 | false | false | 9 |
c958ed4abc566c1b447cae44ebc8679524d03411 | 7,430,293,425,781 | c5a260c52cd928e9a65a4c0320370cfe9ddfb80e | /samples/atompub-contacts-models/src/main/java/com/sun/jersey/samples/contacts/models/User.java | 585be762e8872c5ae9a8721ae716542b7b49b806 | [] | no_license | kshtzsharma48/akka-jersey-samples | https://github.com/kshtzsharma48/akka-jersey-samples | 605b3a5004f1b178d5d48542f269f2a22c795e4e | df4a0b985243bfbf0a7c71e52baee274e9bffc17 | refs/heads/master | 2021-01-18T09:11:16.580000 | 2010-05-17T21:59:24 | 2010-05-17T21:59:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://jersey.dev.java.net/CDDL+GPL.html
* or jersey/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at jersey/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package com.sun.jersey.samples.contacts.models;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* <p>Model class representing a user. This class is annotated for JAXB
* so we can leverage the automatic serialization capabilities of JAX-RS.</p>
*/
@XmlRootElement(namespace="http://example.com/contacts")
public class User {
// ------------------------------------------------------------ Constructors
/**
* <p>Construct a default {@link User} instance.</p>
*/
public User() {
}
// ------------------------------------------------------ Instance Variables
private String id;
private String password;
private Date updated;
private String username;
// ---------------------------------------------------------- Public Methods
// --------------------------------------------------------- Private Methods
// -------------------------------------------------------- Property Methods
@XmlElement(name="id", namespace="http://example.com/contacts")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@XmlElement(name="password", namespace="http://example.com/contacts")
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@XmlElement(name="updated", namespace="http://example.com/contacts")
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
@XmlElement(name="username", namespace="http://example.com/contacts")
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public String toString() {
return String.format("user:{id:%s,username:%s}", id, username);
}
}
| UTF-8 | Java | 3,917 | java | User.java | Java | [
{
"context": "assword(String password) {\n this.password = password;\n }\n\n @XmlElement(name=\"updated\", namespace",
"end": 3338,
"score": 0.9573007822036743,
"start": 3330,
"tag": "PASSWORD",
"value": "password"
}
] | null | [] | /*
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can obtain
* a copy of the License at https://jersey.dev.java.net/CDDL+GPL.html
* or jersey/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at jersey/legal/LICENSE.txt.
* Sun designates this particular file as subject to the "Classpath" exception
* as provided by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the License
* Header, with the fields enclosed by brackets [] replaced by your own
* identifying information: "Portions Copyrighted [year]
* [name of copyright owner]"
*
* Contributor(s):
*
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package com.sun.jersey.samples.contacts.models;
import java.util.Date;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* <p>Model class representing a user. This class is annotated for JAXB
* so we can leverage the automatic serialization capabilities of JAX-RS.</p>
*/
@XmlRootElement(namespace="http://example.com/contacts")
public class User {
// ------------------------------------------------------------ Constructors
/**
* <p>Construct a default {@link User} instance.</p>
*/
public User() {
}
// ------------------------------------------------------ Instance Variables
private String id;
private String password;
private Date updated;
private String username;
// ---------------------------------------------------------- Public Methods
// --------------------------------------------------------- Private Methods
// -------------------------------------------------------- Property Methods
@XmlElement(name="id", namespace="http://example.com/contacts")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@XmlElement(name="password", namespace="http://example.com/contacts")
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = <PASSWORD>;
}
@XmlElement(name="updated", namespace="http://example.com/contacts")
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
@XmlElement(name="username", namespace="http://example.com/contacts")
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public String toString() {
return String.format("user:{id:%s,username:%s}", id, username);
}
}
| 3,919 | 0.647179 | 0.64335 | 119 | 31.915966 | 30.756453 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false | 9 |
904e432a6e711ce16e3bd72c4d16cee051af1585 | 1,984,274,897,094 | 71eb38cf5f72f950c06ce84066f379cbab04ab21 | /foodie-dev-api/src/main/java/com/imooc/controller/ShopcatController.java | d15a0d693bcdf8bc5ad7b5d138bba99c022600b9 | [] | no_license | lvrongbao/lvstuday | https://github.com/lvrongbao/lvstuday | 857e040c55f4421cf1137ec7177ceb55c425b302 | ffb00ca216ec635ca691070ef70cecbc789049d6 | refs/heads/master | 2023-01-16T01:17:10.143000 | 2020-11-23T11:14:52 | 2020-11-23T11:14:52 | 309,229,654 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.imooc.controller;
import com.imooc.pojo.bo.ShopcartBO;
import com.imooc.util.IMOOCJSONResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Api(value = "购物车接口controller", tags = {"购物车接口相关的api"})
@RestController
@RequestMapping("shopcart")
public class ShopcatController {
@ApiOperation(value = "添加商品到购物车",notes = "添加商品到购物车",httpMethod = "POST")
@PostMapping("/add")
public IMOOCJSONResult add(@RequestBody ShopcartBO shopcatBO,
@RequestParam String userId,
HttpServletRequest httpRequest,
HttpServletResponse httpResponse){
if (StringUtils.isBlank(userId)) {
return IMOOCJSONResult.errorMsg("");
}
// TODO 前端用户在登录的情况下,添加商品到购物车,会同时在后端同步购物车到redis缓存
return IMOOCJSONResult.ok();
}
@ApiOperation(value = "从购物车中删除商品", notes = "从购物车中删除商品", httpMethod = "POST")
@PostMapping("/del")
public IMOOCJSONResult del(
@RequestParam String userId,
@RequestParam String itemSpecId,
HttpServletRequest request,
HttpServletResponse response
) {
if (StringUtils.isBlank(userId) || StringUtils.isBlank(itemSpecId)) {
return IMOOCJSONResult.errorMsg("参数不能为空");
}
// TODO 用户在页面删除购物车中的商品数据,如果此时用户已经登录,则需要同步删除后端购物车中的商品
return IMOOCJSONResult.ok();
}
}
| UTF-8 | Java | 1,902 | java | ShopcatController.java | Java | [] | null | [] | package com.imooc.controller;
import com.imooc.pojo.bo.ShopcartBO;
import com.imooc.util.IMOOCJSONResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Api(value = "购物车接口controller", tags = {"购物车接口相关的api"})
@RestController
@RequestMapping("shopcart")
public class ShopcatController {
@ApiOperation(value = "添加商品到购物车",notes = "添加商品到购物车",httpMethod = "POST")
@PostMapping("/add")
public IMOOCJSONResult add(@RequestBody ShopcartBO shopcatBO,
@RequestParam String userId,
HttpServletRequest httpRequest,
HttpServletResponse httpResponse){
if (StringUtils.isBlank(userId)) {
return IMOOCJSONResult.errorMsg("");
}
// TODO 前端用户在登录的情况下,添加商品到购物车,会同时在后端同步购物车到redis缓存
return IMOOCJSONResult.ok();
}
@ApiOperation(value = "从购物车中删除商品", notes = "从购物车中删除商品", httpMethod = "POST")
@PostMapping("/del")
public IMOOCJSONResult del(
@RequestParam String userId,
@RequestParam String itemSpecId,
HttpServletRequest request,
HttpServletResponse response
) {
if (StringUtils.isBlank(userId) || StringUtils.isBlank(itemSpecId)) {
return IMOOCJSONResult.errorMsg("参数不能为空");
}
// TODO 用户在页面删除购物车中的商品数据,如果此时用户已经登录,则需要同步删除后端购物车中的商品
return IMOOCJSONResult.ok();
}
}
| 1,902 | 0.668498 | 0.667888 | 48 | 33.104168 | 23.405163 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.541667 | false | false | 9 |
a65f606b7a786c3398636de2ef75afaa368adcef | 24,558,623,067,621 | 52bd9885183d4c1e6eca2a46039e8e7ade4029fb | /game/src/main/java/org/apollo/game/model/entity/path/PathfindingAlgorithm.java | dddf426e6bc972a2dcf1325e9bf12648fdb033c8 | [
"ISC"
] | permissive | lare96/apollo | https://github.com/lare96/apollo | 32a8aff6e6f0d76ec7487addcd9bf1c6ed416ef5 | a0c78ced90eebf90ed9b0a4e51cece6ddf10932e | refs/heads/kotlin-experiments | 2020-04-05T05:52:32.706000 | 2018-09-04T04:53:06 | 2018-09-04T04:53:06 | 156,615,242 | 1 | 1 | ISC | true | 2018-11-07T22:22:29 | 2018-11-07T22:13:55 | 2018-11-07T22:13:58 | 2018-11-07T22:22:15 | 3,464 | 0 | 0 | 0 | Java | false | null | package org.apollo.game.model.entity.path;
import java.util.Deque;
import java.util.Optional;
import org.apollo.game.model.Direction;
import org.apollo.game.model.Position;
import org.apollo.game.model.World;
import org.apollo.game.model.area.Region;
import org.apollo.game.model.area.RegionRepository;
import org.apollo.game.model.area.collision.CollisionManager;
import org.apollo.game.model.entity.EntityType;
import com.google.common.base.Preconditions;
/**
* An algorithm used to find a path between two {@link Position}s.
*
* @author Major
*/
abstract class PathfindingAlgorithm {
private final CollisionManager collisionManager;
/**
* Creates the PathfindingAlgorithm.
*
* @param collisionManager The {@link CollisionManager} used to check if there is a collision
* between two {@link Position}s in a path.
*/
public PathfindingAlgorithm(CollisionManager collisionManager) {
this.collisionManager = collisionManager;
}
/**
* Finds a valid path from the origin {@link Position} to the target one.
*
* @param origin The origin Position.
* @param target The target Position.
* @return The {@link Deque} containing the Positions to go through.
*/
public abstract Deque<Position> find(Position origin, Position target);
/**
* Returns whether or not a {@link Position} walking one step in any of the specified {@link Direction}s would lead
* to is traversable.
*
* @param current The current Position.
* @param directions The Directions that should be checked.
* @return {@code true} if any of the Directions lead to a traversable tile, otherwise {@code false}.
*/
protected boolean traversable(Position current, Direction... directions) {
return traversable(current, Optional.empty(), directions);
}
/**
* Returns whether or not a {@link Position} walking one step in any of the specified {@link Direction}s would lead
* to is traversable.
*
* @param current The current Position.
* @param boundaries The {@link Optional} containing the Position boundaries.
* @param directions The Directions that should be checked.
* @return {@code true} if any of the Directions lead to a traversable tile, otherwise {@code false}.
*/
protected boolean traversable(Position current, Optional<Position[]> boundaries, Direction... directions) {
Preconditions.checkArgument(directions != null && directions.length > 0, "Directions array cannot be null.");
int height = current.getHeight();
Position[] positions = boundaries.isPresent() ? boundaries.get() : new Position[0];
for (Direction direction : directions) {
int x = current.getX(), y = current.getY();
int value = direction.toInteger();
if (value >= Direction.NORTH_WEST.toInteger() && value <= Direction.NORTH_EAST.toInteger()) {
y++;
} else if (value >= Direction.SOUTH_WEST.toInteger() && value <= Direction.SOUTH_EAST.toInteger()) {
y--;
}
if (direction == Direction.NORTH_EAST || direction == Direction.EAST || direction == Direction.SOUTH_EAST) {
x++;
} else if (direction == Direction.NORTH_WEST || direction == Direction.WEST || direction == Direction.SOUTH_WEST) {
x--;
}
if (collisionManager.traversable(current, EntityType.NPC, direction)) {
return true;
}
}
return false;
}
/**
* Returns whether or not the specified {@link Position} is inside the specified {@code boundary}.
*
* @param position The Position.
* @param boundary The boundary Positions.
* @return {@code true} if the specified Position is inside the boundary, {@code false} if not.
*/
private boolean inside(Position position, Position[] boundary) {
int x = position.getX(), y = position.getY();
Position min = boundary[0], max = boundary[1];
return x >= min.getX() && y >= min.getY() && x <= max.getX() && y <= max.getY();
}
} | UTF-8 | Java | 3,927 | java | PathfindingAlgorithm.java | Java | [
{
"context": "ath between two {@link Position}s.\r\n *\r\n * @author Major\r\n */\r\nabstract class PathfindingAlgorithm {\r\n\r\n\tp",
"end": 570,
"score": 0.9692606925964355,
"start": 565,
"tag": "NAME",
"value": "Major"
}
] | null | [] | package org.apollo.game.model.entity.path;
import java.util.Deque;
import java.util.Optional;
import org.apollo.game.model.Direction;
import org.apollo.game.model.Position;
import org.apollo.game.model.World;
import org.apollo.game.model.area.Region;
import org.apollo.game.model.area.RegionRepository;
import org.apollo.game.model.area.collision.CollisionManager;
import org.apollo.game.model.entity.EntityType;
import com.google.common.base.Preconditions;
/**
* An algorithm used to find a path between two {@link Position}s.
*
* @author Major
*/
abstract class PathfindingAlgorithm {
private final CollisionManager collisionManager;
/**
* Creates the PathfindingAlgorithm.
*
* @param collisionManager The {@link CollisionManager} used to check if there is a collision
* between two {@link Position}s in a path.
*/
public PathfindingAlgorithm(CollisionManager collisionManager) {
this.collisionManager = collisionManager;
}
/**
* Finds a valid path from the origin {@link Position} to the target one.
*
* @param origin The origin Position.
* @param target The target Position.
* @return The {@link Deque} containing the Positions to go through.
*/
public abstract Deque<Position> find(Position origin, Position target);
/**
* Returns whether or not a {@link Position} walking one step in any of the specified {@link Direction}s would lead
* to is traversable.
*
* @param current The current Position.
* @param directions The Directions that should be checked.
* @return {@code true} if any of the Directions lead to a traversable tile, otherwise {@code false}.
*/
protected boolean traversable(Position current, Direction... directions) {
return traversable(current, Optional.empty(), directions);
}
/**
* Returns whether or not a {@link Position} walking one step in any of the specified {@link Direction}s would lead
* to is traversable.
*
* @param current The current Position.
* @param boundaries The {@link Optional} containing the Position boundaries.
* @param directions The Directions that should be checked.
* @return {@code true} if any of the Directions lead to a traversable tile, otherwise {@code false}.
*/
protected boolean traversable(Position current, Optional<Position[]> boundaries, Direction... directions) {
Preconditions.checkArgument(directions != null && directions.length > 0, "Directions array cannot be null.");
int height = current.getHeight();
Position[] positions = boundaries.isPresent() ? boundaries.get() : new Position[0];
for (Direction direction : directions) {
int x = current.getX(), y = current.getY();
int value = direction.toInteger();
if (value >= Direction.NORTH_WEST.toInteger() && value <= Direction.NORTH_EAST.toInteger()) {
y++;
} else if (value >= Direction.SOUTH_WEST.toInteger() && value <= Direction.SOUTH_EAST.toInteger()) {
y--;
}
if (direction == Direction.NORTH_EAST || direction == Direction.EAST || direction == Direction.SOUTH_EAST) {
x++;
} else if (direction == Direction.NORTH_WEST || direction == Direction.WEST || direction == Direction.SOUTH_WEST) {
x--;
}
if (collisionManager.traversable(current, EntityType.NPC, direction)) {
return true;
}
}
return false;
}
/**
* Returns whether or not the specified {@link Position} is inside the specified {@code boundary}.
*
* @param position The Position.
* @param boundary The boundary Positions.
* @return {@code true} if the specified Position is inside the boundary, {@code false} if not.
*/
private boolean inside(Position position, Position[] boundary) {
int x = position.getX(), y = position.getY();
Position min = boundary[0], max = boundary[1];
return x >= min.getX() && y >= min.getY() && x <= max.getX() && y <= max.getY();
}
} | 3,927 | 0.690858 | 0.68984 | 109 | 34.045872 | 35.832275 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.577982 | false | false | 9 |
c9baa88397508325c4b577719dfbb69dd0de6ffc | 32,134,945,312,602 | a370ff524a6e317488970dac65d93a727039f061 | /archive/unsorted/2019.11/2019.11.22 - unsorted/TaskF.java | 06190f345a2dcfcd2b45203ca8cdf6dd081c1da3 | [] | no_license | taodaling/contest | https://github.com/taodaling/contest | 235f4b2a033ecc30ec675a4526e3f031a27d8bbf | 86824487c2e8d4fc405802fff237f710f4e73a5c | refs/heads/master | 2023-04-14T12:41:41.718000 | 2023-04-10T14:12:47 | 2023-04-10T14:12:47 | 213,876,299 | 9 | 1 | null | false | 2021-06-12T06:33:05 | 2019-10-09T09:28:43 | 2021-06-12T06:32:14 | 2021-06-12T06:33:05 | 82,147 | 5 | 1 | 0 | Java | false | false | package contest;
import template.io.FastInput;
import template.io.FastOutput;
import template.utils.ArrayIndex;
public class TaskF {
public void solve(int testNumber, FastInput in, FastOutput out) {
int n = in.readInt();
int m = in.readInt();
int[] a = new int[n];
long[] presumOfA = new long[n];
for (int i = 1; i < n; i++) {
a[i] = in.readInt();
presumOfA[i] = presumOfA[i - 1] + a[i];
}
ArrayIndex aiNM = new ArrayIndex(n + 1, m + 1);
int[] b = new int[aiNM.totalSize()];
int[] l = new int[aiNM.totalSize()];
int[] r = new int[aiNM.totalSize()];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
b[aiNM.indexOf(i, j)] = in.readInt();
}
}
ArrayIndex aiNN = new ArrayIndex(n + 1, n + 1);
long[] intervals = new long[aiNN.totalSize()];
IntDeque deque = new IntDeque(n);
for (int i = 1; i <= m; i++) {
deque.clear();
for (int j = 1; j <= n; j++) {
while (!deque.isEmpty() && b[aiNM.indexOf(deque.peekLast(), i)] <= b[aiNM.indexOf(j, i)]) {
deque.removeLast();
}
if (deque.isEmpty()) {
l[aiNM.indexOf(j, i)] = 1;
} else {
l[aiNM.indexOf(j, i)] = deque.peekLast() + 1;
}
deque.addLast(j);
}
deque.clear();
for (int j = n; j >= 1; j--) {
while (!deque.isEmpty() && b[aiNM.indexOf(deque.peekFirst(), i)] < b[aiNM.indexOf(j, i)]) {
deque.removeFirst();
}
if (deque.isEmpty()) {
r[aiNM.indexOf(j, i)] = n;
} else {
r[aiNM.indexOf(j, i)] = deque.peekFirst() - 1;
}
deque.addFirst(j);
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
int x = l[aiNM.indexOf(i, j)];
int y = r[aiNM.indexOf(i, j)];
intervals[aiNN.indexOf(i, y)] += b[aiNM.indexOf(i, j)];
intervals[aiNN.indexOf(x - 1, y)] -= b[aiNM.indexOf(i, j)];
intervals[aiNN.indexOf(i, i - 1)] -= b[aiNM.indexOf(i, j)];
intervals[aiNN.indexOf(x - 1, i - 1)] += b[aiNM.indexOf(i, j)];
}
}
// push down
for (int i = n + n; i >= 0; i--) {
for (int j = 1; j <= n; j++) {
int k = i - j;
if (k < 1 || k > n) {
continue;
}
if (j + 1 <= n) {
intervals[aiNN.indexOf(j, k)] += intervals[aiNN.indexOf(j + 1, k)];
}
if (k + 1 <= n) {
intervals[aiNN.indexOf(j, k)] += intervals[aiNN.indexOf(j, k + 1)];
}
if (j + 1 <= n && k + 1 <= n) {
intervals[aiNN.indexOf(j, k)] -= intervals[aiNN.indexOf(j + 1, k + 1)];
}
}
}
long ans = 0;
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j++) {
long profit = intervals[aiNN.indexOf(i, j)] - (presumOfA[j - 1] - presumOfA[i - 1]);
ans = Math.max(ans, profit);
}
}
out.println(ans);
}
}
| UTF-8 | Java | 3,487 | java | TaskF.java | Java | [] | null | [] | package contest;
import template.io.FastInput;
import template.io.FastOutput;
import template.utils.ArrayIndex;
public class TaskF {
public void solve(int testNumber, FastInput in, FastOutput out) {
int n = in.readInt();
int m = in.readInt();
int[] a = new int[n];
long[] presumOfA = new long[n];
for (int i = 1; i < n; i++) {
a[i] = in.readInt();
presumOfA[i] = presumOfA[i - 1] + a[i];
}
ArrayIndex aiNM = new ArrayIndex(n + 1, m + 1);
int[] b = new int[aiNM.totalSize()];
int[] l = new int[aiNM.totalSize()];
int[] r = new int[aiNM.totalSize()];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
b[aiNM.indexOf(i, j)] = in.readInt();
}
}
ArrayIndex aiNN = new ArrayIndex(n + 1, n + 1);
long[] intervals = new long[aiNN.totalSize()];
IntDeque deque = new IntDeque(n);
for (int i = 1; i <= m; i++) {
deque.clear();
for (int j = 1; j <= n; j++) {
while (!deque.isEmpty() && b[aiNM.indexOf(deque.peekLast(), i)] <= b[aiNM.indexOf(j, i)]) {
deque.removeLast();
}
if (deque.isEmpty()) {
l[aiNM.indexOf(j, i)] = 1;
} else {
l[aiNM.indexOf(j, i)] = deque.peekLast() + 1;
}
deque.addLast(j);
}
deque.clear();
for (int j = n; j >= 1; j--) {
while (!deque.isEmpty() && b[aiNM.indexOf(deque.peekFirst(), i)] < b[aiNM.indexOf(j, i)]) {
deque.removeFirst();
}
if (deque.isEmpty()) {
r[aiNM.indexOf(j, i)] = n;
} else {
r[aiNM.indexOf(j, i)] = deque.peekFirst() - 1;
}
deque.addFirst(j);
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
int x = l[aiNM.indexOf(i, j)];
int y = r[aiNM.indexOf(i, j)];
intervals[aiNN.indexOf(i, y)] += b[aiNM.indexOf(i, j)];
intervals[aiNN.indexOf(x - 1, y)] -= b[aiNM.indexOf(i, j)];
intervals[aiNN.indexOf(i, i - 1)] -= b[aiNM.indexOf(i, j)];
intervals[aiNN.indexOf(x - 1, i - 1)] += b[aiNM.indexOf(i, j)];
}
}
// push down
for (int i = n + n; i >= 0; i--) {
for (int j = 1; j <= n; j++) {
int k = i - j;
if (k < 1 || k > n) {
continue;
}
if (j + 1 <= n) {
intervals[aiNN.indexOf(j, k)] += intervals[aiNN.indexOf(j + 1, k)];
}
if (k + 1 <= n) {
intervals[aiNN.indexOf(j, k)] += intervals[aiNN.indexOf(j, k + 1)];
}
if (j + 1 <= n && k + 1 <= n) {
intervals[aiNN.indexOf(j, k)] -= intervals[aiNN.indexOf(j + 1, k + 1)];
}
}
}
long ans = 0;
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j++) {
long profit = intervals[aiNN.indexOf(i, j)] - (presumOfA[j - 1] - presumOfA[i - 1]);
ans = Math.max(ans, profit);
}
}
out.println(ans);
}
}
| 3,487 | 0.394322 | 0.384284 | 99 | 34.222221 | 24.642313 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.010101 | false | false | 9 |
900e958ce7b386a23c750ab3aa996c1d8387f67b | 13,597,866,528,222 | 34e0c4986f198d578ae3ca536c67e1f7b93f8ac8 | /ads-poo2/basico/src/aula5/LetrasLacoDuplo.java | c6dc7e915e05eedb6156167ee53f7353c1b0b26d | [] | no_license | paulojrlm/fecaf-2019-2s | https://github.com/paulojrlm/fecaf-2019-2s | f9a95e03bcb18b929f4039fda7b17768ab3061ba | cd0feece9d0d15c5b4124f4be1234164c6bc6690 | refs/heads/master | 2020-09-13T16:33:41.949000 | 2019-11-20T01:31:43 | 2019-11-20T01:31:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package aula5;
public class LetrasLacoDuplo {
public static void main(String[] args) {
char letra = 'A';
for (int x = 0; x < 26; x++) {
for (int j = 0; j < 5; j++) {
System.out.print(letra);
}
letra++;
System.out.println();
}
}
}
// AAAAA
// BBBBB
// CCCCC
// DDDDD
// EEEEE
| UTF-8 | Java | 301 | java | LetrasLacoDuplo.java | Java | [] | null | [] | package aula5;
public class LetrasLacoDuplo {
public static void main(String[] args) {
char letra = 'A';
for (int x = 0; x < 26; x++) {
for (int j = 0; j < 5; j++) {
System.out.print(letra);
}
letra++;
System.out.println();
}
}
}
// AAAAA
// BBBBB
// CCCCC
// DDDDD
// EEEEE
| 301 | 0.551495 | 0.531561 | 19 | 14.842105 | 12.347013 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.736842 | false | false | 9 |
94c27db5a5f97d2d8ca665b03035ad079c6030ca | 3,341,484,579,189 | 4e1505cea1327f8b434cc85da8a12f99bded3feb | /Day15_201013/src/ArrayListExam.java | c91d9e3e311d29e25684d29d6f7318d9bd6dc205 | [] | no_license | dkgus523/KH_Java_Example | https://github.com/dkgus523/KH_Java_Example | fb61df8fb9bb4744cf8aebb5f2391e80bf221688 | 6e3f140bac61b7d6a40cf13f28e63dbdcfff0f3c | refs/heads/master | 2023-01-11T01:18:23.710000 | 2020-11-15T10:28:38 | 2020-11-15T10:28:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.ArrayList;
public class ArrayListExam {
public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList al = new ArrayList(); //ArrayList 클래스 객체 생성
al.add("gemin");
al.add("johnharu");
al.add(new Integer(10));
System.out.println("ArrayList 객체 : " + al);
int length = al.size();
System.out.println("ArrayList 길이 :" + length);
for(int i=0; i<length; i++) {
System.out.println(al.get(i));
}
System.out.println(al.get(2));
}
}
| UHC | Java | 546 | java | ArrayListExam.java | Java | [
{
"context": "ArrayList(); //ArrayList 클래스 객체 생성\r\n\t\t\r\n\t\tal.add(\"gemin\");\r\n\t\tal.add(\"johnharu\");\r\n\t\tal.add(new Integer(1",
"end": 220,
"score": 0.9995462894439697,
"start": 215,
"tag": "NAME",
"value": "gemin"
},
{
"context": "List 클래스 객체 생성\r\n\t\t\r\n\t\tal.add(\"gemin\");\r\n\t\tal.add(\"johnharu\");\r\n\t\tal.add(new Integer(10));\r\n\t\tSystem.out.prin",
"end": 243,
"score": 0.9998024702072144,
"start": 235,
"tag": "NAME",
"value": "johnharu"
}
] | null | [] | import java.util.ArrayList;
public class ArrayListExam {
public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList al = new ArrayList(); //ArrayList 클래스 객체 생성
al.add("gemin");
al.add("johnharu");
al.add(new Integer(10));
System.out.println("ArrayList 객체 : " + al);
int length = al.size();
System.out.println("ArrayList 길이 :" + length);
for(int i=0; i<length; i++) {
System.out.println(al.get(i));
}
System.out.println(al.get(2));
}
}
| 546 | 0.610687 | 0.603053 | 23 | 20.782608 | 17.539909 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.956522 | false | false | 9 |
b824bf28df25b9de11e26c4c89d8c83b1606456b | 9,088,150,807,954 | 22710b2f8cf7bc3d44f0e5403968547cfccf52ce | /src/main/java/br/org/unicef/pcu/core/spring/domain/JdbcTemplateVersionRepositoryImpl.java | d964c00c0359a6c6442b706d666e8862b5d535cf | [] | no_license | sectiolabs/pcu | https://github.com/sectiolabs/pcu | 1f6f7d31e115945079cf6b977a6471f24fb002f9 | ff36a1ac1fd505b846250083d7b245ebc463af16 | refs/heads/master | 2019-04-06T10:43:41.629000 | 2016-02-21T19:15:02 | 2016-02-21T19:15:02 | 16,030,710 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.org.unicef.pcu.core.spring.domain;
import br.org.unicef.pcu.core.domain.*;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;
import java.util.UUID;
/**
* Created by diogopontual on 12/02/14.
*/
@Component
public class JdbcTemplateVersionRepositoryImpl implements VersionRepository {
public static final String SQL_SELECT_BY_ID = "select * from versions where id = ?";
public static final String SQL_SELECT_BY_POST = "select * from versions where id_post = ? order by moment";
public static final String SQL_INSERT = "insert into versions values(?,?,?,?,?)";
public static final String SQL_DELETE = "delete from versions where id = ?";
private RowMapper<Version> rowMapper = new VersionRowMapper();
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public Version get(String id) throws RepositoryException {
try {
return jdbcTemplate.queryForObject(SQL_SELECT_BY_ID, rowMapper, id);
} catch (EmptyResultDataAccessException erdaex) {
throw new ObjectNotFoundException(erdaex);
}
}
@Override
public Version get(UUID id) throws RepositoryException {
try {
return jdbcTemplate.queryForObject(SQL_SELECT_BY_ID, rowMapper, id);
} catch (EmptyResultDataAccessException erdaex) {
throw new ObjectNotFoundException(erdaex);
}
}
@Override
public void add(Version version) throws RepositoryException {
if (version == null)
throw new IllegalArgumentException("Todo cannot be null.");
jdbcTemplate.update(SQL_INSERT, version.getId(), version.getUserId(), version.getPostId(), version.getComment(), new Timestamp(version.getMoment().getMillis()));
}
@Override
public List<Version> list(Long postId) {
return jdbcTemplate.query(SQL_SELECT_BY_POST, rowMapper, postId);
}
@Override
public void delete(String id) {
jdbcTemplate.update(SQL_DELETE, id);
}
@Override
public void delete(UUID id) {
delete(id.toString());
}
private class VersionRowMapper implements RowMapper<Version> {
@Override
public Version mapRow(ResultSet rs, int i) throws SQLException {
Version version = new Version((UUID) rs.getObject("id"),rs.getLong("id_user"));
version.setPostId(rs.getLong("id_post"));
version.setMoment(new DateTime(rs.getTimestamp("moment").getTime()));
version.setComment(rs.getString("comment"));
return version;
}
}
}
| UTF-8 | Java | 2,931 | java | JdbcTemplateVersionRepositoryImpl.java | Java | [
{
"context": "il.List;\nimport java.util.UUID;\n\n/**\n * Created by diogopontual on 12/02/14.\n */\n@Component\npublic class JdbcTemp",
"end": 555,
"score": 0.9996033906936646,
"start": 543,
"tag": "USERNAME",
"value": "diogopontual"
}
] | null | [] | package br.org.unicef.pcu.core.spring.domain;
import br.org.unicef.pcu.core.domain.*;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;
import java.util.UUID;
/**
* Created by diogopontual on 12/02/14.
*/
@Component
public class JdbcTemplateVersionRepositoryImpl implements VersionRepository {
public static final String SQL_SELECT_BY_ID = "select * from versions where id = ?";
public static final String SQL_SELECT_BY_POST = "select * from versions where id_post = ? order by moment";
public static final String SQL_INSERT = "insert into versions values(?,?,?,?,?)";
public static final String SQL_DELETE = "delete from versions where id = ?";
private RowMapper<Version> rowMapper = new VersionRowMapper();
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public Version get(String id) throws RepositoryException {
try {
return jdbcTemplate.queryForObject(SQL_SELECT_BY_ID, rowMapper, id);
} catch (EmptyResultDataAccessException erdaex) {
throw new ObjectNotFoundException(erdaex);
}
}
@Override
public Version get(UUID id) throws RepositoryException {
try {
return jdbcTemplate.queryForObject(SQL_SELECT_BY_ID, rowMapper, id);
} catch (EmptyResultDataAccessException erdaex) {
throw new ObjectNotFoundException(erdaex);
}
}
@Override
public void add(Version version) throws RepositoryException {
if (version == null)
throw new IllegalArgumentException("Todo cannot be null.");
jdbcTemplate.update(SQL_INSERT, version.getId(), version.getUserId(), version.getPostId(), version.getComment(), new Timestamp(version.getMoment().getMillis()));
}
@Override
public List<Version> list(Long postId) {
return jdbcTemplate.query(SQL_SELECT_BY_POST, rowMapper, postId);
}
@Override
public void delete(String id) {
jdbcTemplate.update(SQL_DELETE, id);
}
@Override
public void delete(UUID id) {
delete(id.toString());
}
private class VersionRowMapper implements RowMapper<Version> {
@Override
public Version mapRow(ResultSet rs, int i) throws SQLException {
Version version = new Version((UUID) rs.getObject("id"),rs.getLong("id_user"));
version.setPostId(rs.getLong("id_post"));
version.setMoment(new DateTime(rs.getTimestamp("moment").getTime()));
version.setComment(rs.getString("comment"));
return version;
}
}
}
| 2,931 | 0.69089 | 0.688843 | 83 | 34.313251 | 32.663647 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.614458 | false | false | 9 |
cb450674e46464bc467d7880ec43d4274902f8b9 | 33,612,414,121,311 | a285844b9c47b271f73f1287902a4adc30b49aff | /Java/Socket/SocketProgrammingExamples/src/main/java/com/bizruntime/socket/ClientExample.java | 1d572cceb8bbcbd8c64b2b6103ba24faa1710487 | [] | no_license | jothipandiyanjp/coding_practice | https://github.com/jothipandiyanjp/coding_practice | e51652f9d820bee4a1eae8b0bae78791ef98f7c8 | 9c64f47b01dac64ea90694b179173c124d8e02f8 | refs/heads/master | 2021-05-06T23:30:39.208000 | 2018-01-02T04:50:06 | 2018-01-02T04:50:06 | 112,925,953 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bizruntime.socket;
import java.io.IOException;
import java.net.Socket;
import java.net.SocketPermission;
import java.net.UnknownHostException;
import org.apache.log4j.Logger;
public class ClientExample {
public static Logger log = Logger.getLogger(ClientExample.class);
public static void main(String[] args) throws InterruptedException {
ClientExample ex = new ClientExample();
ex.createSocketObject();
}
private void createSocketObject() throws InterruptedException {
String host = "localhost";
int port = 9099;
Socket client = null;
try {
client = new Socket(host, port);
log.debug("InetAddress for server " + client.getInetAddress());
log.debug("port number " + client.getPort());
log.debug("port the socket is bound to on the local machine. "
+ client.getLocalPort());
log.debug("Address of remote socket"
+ client.getRemoteSocketAddress());
} catch (UnknownHostException e) {
log.error(" Invalid host name " + e.getMessage());
} catch (IOException e) {
log.error(port + " port number not in use : " + e.getMessage());
} finally {
try {
client.close();
} catch (IOException e) {
log.error(" Exception onclosing connection : " + e.getMessage());
}
}
}
}
| UTF-8 | Java | 1,251 | java | ClientExample.java | Java | [] | null | [] | package com.bizruntime.socket;
import java.io.IOException;
import java.net.Socket;
import java.net.SocketPermission;
import java.net.UnknownHostException;
import org.apache.log4j.Logger;
public class ClientExample {
public static Logger log = Logger.getLogger(ClientExample.class);
public static void main(String[] args) throws InterruptedException {
ClientExample ex = new ClientExample();
ex.createSocketObject();
}
private void createSocketObject() throws InterruptedException {
String host = "localhost";
int port = 9099;
Socket client = null;
try {
client = new Socket(host, port);
log.debug("InetAddress for server " + client.getInetAddress());
log.debug("port number " + client.getPort());
log.debug("port the socket is bound to on the local machine. "
+ client.getLocalPort());
log.debug("Address of remote socket"
+ client.getRemoteSocketAddress());
} catch (UnknownHostException e) {
log.error(" Invalid host name " + e.getMessage());
} catch (IOException e) {
log.error(port + " port number not in use : " + e.getMessage());
} finally {
try {
client.close();
} catch (IOException e) {
log.error(" Exception onclosing connection : " + e.getMessage());
}
}
}
}
| 1,251 | 0.697042 | 0.693046 | 45 | 26.799999 | 22.56999 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.111111 | false | false | 9 |
4eba33a2cee6c76043cda8168e49ec68486cfcb4 | 8,504,035,258,990 | ec9bf57a07b7b06134ec7a21407a11f69cc644f7 | /src/fes.java | 5233aff22459053d6d208c1f141e58b1b6d75c44 | [] | no_license | jzarca01/com.ubercab | https://github.com/jzarca01/com.ubercab | f95c12cab7a28f05e8f1d1a9d8a12a5ac7fbf4b1 | e6b454fb0ad547287ae4e71e59d6b9482369647a | refs/heads/master | 2020-06-21T04:37:43.723000 | 2016-07-19T16:30:34 | 2016-07-19T16:30:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import com.ubercab.client.feature.addressbook.UploadContactsIntentService;
public abstract interface fes
extends dyc
{
public abstract void a(UploadContactsIntentService paramUploadContactsIntentService);
}
/* Location:
* Qualified Name: fes
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | UTF-8 | Java | 317 | java | fes.java | Java | [] | null | [] | import com.ubercab.client.feature.addressbook.UploadContactsIntentService;
public abstract interface fes
extends dyc
{
public abstract void a(UploadContactsIntentService paramUploadContactsIntentService);
}
/* Location:
* Qualified Name: fes
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | 317 | 0.760252 | 0.73817 | 13 | 23.461538 | 26.99748 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | false | false | 9 |
0f81062bcf19610480eb15e85aabfefbec546119 | 17,626,545,829,168 | 5cdc0e57ec519266c7f10713966c821acbdb9a91 | /Exercícios/pl6/src/pl6/ex6.java | 5436a5d2fcedca6cee44f0ef5c83ea463ff33dab | [] | no_license | Mick3y16/APROG | https://github.com/Mick3y16/APROG | 395e85a6365c7ae112ea1f46f7d50c369d55f728 | e2bf434541adb71379f4418628a1aa53f05587b1 | refs/heads/master | 2021-05-16T02:00:54.934000 | 2015-11-17T18:53:04 | 2015-11-17T18:53:04 | 25,842,275 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pl6;
import java.util.Scanner;
/**
*
*/
public class ex6 {
static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
String[] visitantes = new String[100];
int n = 0;
char op;
System.out.print(""
+ "\nO que pretende fazer?"
+ "\n1 - Visualizar o menu."
+ "\n2 - Inserir um visitante."
+ "\n3 - Listar todos os visitantes."
+ "\n4 - Actualizar um nome dado."
+ "\n5 - Eliminar um visitante dado."
+ "\n6 - Listar os nomes começados por uma dada letra."
+ "\n7 - Listar os nomes repetidos."
+ "\n8 - Terminar");
do {
System.out.print("\nOpção: ");
op = scan.next().charAt(0);
switch(op) {
case '1':
mostrarMenu();
break;
case '2':
scan.nextLine();
System.out.print("Digite o nome: ");
String nome = scan.nextLine();
n = inserirVisitante(visitantes, nome, n);
break;
case '3':
System.out.println("Lista de Visitantes: ");
listarVisitantes(visitantes, n);
break;
case '4':
System.out.print("Digite o número do visitante que pretende alterar: ");
int i = scan.nextInt();
scan.nextLine();
System.out.print("Insira o nome nome: ");
String novonome = scan.nextLine();
boolean apagou = actualizarVisitantes(visitantes, novonome, i, n);
if (apagou == true) {
System.out.println("O nome foi alterado com sucesso.");
} else {
System.out.println("Não foi possível alterar o nome.");
}
break;
case '5':
System.out.print("Digite o número do visitante que pretende apagar: ");
int d = scan.nextInt();
n = apagarVisitante(visitantes, d, n);
break;
case '6':
System.out.print("Quer procurar visitantes com o nome iniciado por que letra? ");
char ch = scan.next().charAt(0);
System.out.println("Lista de Visitantes, cujo nome começa por "+ch+":");
listarVisitantesporCar(visitantes, ch, n);
break;
case '7':
System.out.println("Lista de nomes repetidos:");
listarVisitantesRep(visitantes, n);
break;
case '8':
// Terminar
break;
default:
System.out.println("Opção inválida!");
break;
}
} while(op != 7);
}
public static void listarVisitantesRep(String[] vec, int n) {
String[] nomesrep = new String[50];
int r = 0;
for (int i = 0; i < n-1; i++) {
for (int j = i+1; j < n; j++) {
if(vec[i].equals(vec[j])) {
int contrep = 0;
for (int l = 0; l < r; l++) {
if(nomesrep[l].equals(vec[i])) {
contrep++;
}
}
if (contrep == 0) {
nomesrep[r] = vec[i];
r++;
}
}
}
}
for (int i = 0; i < r; i++) {
System.out.println(nomesrep[i]);
}
}
public static void listarVisitantesporCar(String[] vec, char ch, int n) {
for (int i = 0; i < n; i++) {
if (ch == (vec[i].charAt(0))) {
System.out.println(vec[i]);
}
}
}
public static int apagarVisitante(String[] vec, int i, int n) {
if(i-1 < n) {
for (int j = i - 1; j < n - 1; j++) {
vec[j] = vec[j + 1];
}
return --n;
} else {
return n;
}
}
public static boolean actualizarVisitantes(String[] vec, String nome, int i, int n) {
if (i > n) {
return false;
} else {
vec[i-1] = nome;
return true;
}
}
public static void listarVisitantes(String[] vec, int n) {
for (int i = 0; i < n; i++) {
System.out.println((i+1)+" - "+vec[i]);
}
}
public static int inserirVisitante(String[] vec, String nome, int n) {
for (int i = n; i < n+1; i++) {
vec[i] = nome;
}
return ++n;
}
public static void mostrarMenu() {
System.out.print(""
+ "\nO que pretende fazer?"
+ "\n1 - Visualizar o menu."
+ "\n2 - Inserir um visitante."
+ "\n3 - Listar todos os visitantes."
+ "\n4 - Actualizar um nome dado."
+ "\n5 - Eliminar um visitante dado"
+ "\n6 - Listar os nomes começados por uma dada letra"
+ "\n7 - Listar os nomes repetidos."
+ "\n8 - Terminar");
}
}
| UTF-8 | Java | 5,755 | java | ex6.java | Java | [] | null | [] |
package pl6;
import java.util.Scanner;
/**
*
*/
public class ex6 {
static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
String[] visitantes = new String[100];
int n = 0;
char op;
System.out.print(""
+ "\nO que pretende fazer?"
+ "\n1 - Visualizar o menu."
+ "\n2 - Inserir um visitante."
+ "\n3 - Listar todos os visitantes."
+ "\n4 - Actualizar um nome dado."
+ "\n5 - Eliminar um visitante dado."
+ "\n6 - Listar os nomes começados por uma dada letra."
+ "\n7 - Listar os nomes repetidos."
+ "\n8 - Terminar");
do {
System.out.print("\nOpção: ");
op = scan.next().charAt(0);
switch(op) {
case '1':
mostrarMenu();
break;
case '2':
scan.nextLine();
System.out.print("Digite o nome: ");
String nome = scan.nextLine();
n = inserirVisitante(visitantes, nome, n);
break;
case '3':
System.out.println("Lista de Visitantes: ");
listarVisitantes(visitantes, n);
break;
case '4':
System.out.print("Digite o número do visitante que pretende alterar: ");
int i = scan.nextInt();
scan.nextLine();
System.out.print("Insira o nome nome: ");
String novonome = scan.nextLine();
boolean apagou = actualizarVisitantes(visitantes, novonome, i, n);
if (apagou == true) {
System.out.println("O nome foi alterado com sucesso.");
} else {
System.out.println("Não foi possível alterar o nome.");
}
break;
case '5':
System.out.print("Digite o número do visitante que pretende apagar: ");
int d = scan.nextInt();
n = apagarVisitante(visitantes, d, n);
break;
case '6':
System.out.print("Quer procurar visitantes com o nome iniciado por que letra? ");
char ch = scan.next().charAt(0);
System.out.println("Lista de Visitantes, cujo nome começa por "+ch+":");
listarVisitantesporCar(visitantes, ch, n);
break;
case '7':
System.out.println("Lista de nomes repetidos:");
listarVisitantesRep(visitantes, n);
break;
case '8':
// Terminar
break;
default:
System.out.println("Opção inválida!");
break;
}
} while(op != 7);
}
public static void listarVisitantesRep(String[] vec, int n) {
String[] nomesrep = new String[50];
int r = 0;
for (int i = 0; i < n-1; i++) {
for (int j = i+1; j < n; j++) {
if(vec[i].equals(vec[j])) {
int contrep = 0;
for (int l = 0; l < r; l++) {
if(nomesrep[l].equals(vec[i])) {
contrep++;
}
}
if (contrep == 0) {
nomesrep[r] = vec[i];
r++;
}
}
}
}
for (int i = 0; i < r; i++) {
System.out.println(nomesrep[i]);
}
}
public static void listarVisitantesporCar(String[] vec, char ch, int n) {
for (int i = 0; i < n; i++) {
if (ch == (vec[i].charAt(0))) {
System.out.println(vec[i]);
}
}
}
public static int apagarVisitante(String[] vec, int i, int n) {
if(i-1 < n) {
for (int j = i - 1; j < n - 1; j++) {
vec[j] = vec[j + 1];
}
return --n;
} else {
return n;
}
}
public static boolean actualizarVisitantes(String[] vec, String nome, int i, int n) {
if (i > n) {
return false;
} else {
vec[i-1] = nome;
return true;
}
}
public static void listarVisitantes(String[] vec, int n) {
for (int i = 0; i < n; i++) {
System.out.println((i+1)+" - "+vec[i]);
}
}
public static int inserirVisitante(String[] vec, String nome, int n) {
for (int i = n; i < n+1; i++) {
vec[i] = nome;
}
return ++n;
}
public static void mostrarMenu() {
System.out.print(""
+ "\nO que pretende fazer?"
+ "\n1 - Visualizar o menu."
+ "\n2 - Inserir um visitante."
+ "\n3 - Listar todos os visitantes."
+ "\n4 - Actualizar um nome dado."
+ "\n5 - Eliminar um visitante dado"
+ "\n6 - Listar os nomes começados por uma dada letra"
+ "\n7 - Listar os nomes repetidos."
+ "\n8 - Terminar");
}
}
| 5,755 | 0.394045 | 0.384816 | 168 | 33.17857 | 23.148415 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.60119 | false | false | 9 |
c1ae59259321be57e3d236eb2160d991b3a871b7 | 32,117,765,483,918 | ab2c70b9f2b4ad4d7f4e965ca07b6eba28592378 | /src/main/java/org/demoiselle/jee/geogov/pojo/Features.java | c9760b13c3a57f0063df3b3254b580e7d53871c6 | [] | no_license | PGXP/demoiselle-geogov | https://github.com/PGXP/demoiselle-geogov | 602aa6f04e175363104d1d2a74fe16239522c8ac | 1ab0ff68f9e42632d64d46ac9845bbf313224cc1 | refs/heads/master | 2022-06-07T23:15:54.245000 | 2019-12-30T17:29:49 | 2019-12-30T17:29:49 | 187,099,562 | 0 | 0 | null | false | 2022-05-20T20:57:47 | 2019-05-16T20:50:57 | 2019-12-30T17:30:10 | 2022-05-20T20:57:46 | 816 | 0 | 0 | 1 | Java | false | false | package org.demoiselle.jee.geogov.pojo;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;
import static java.util.logging.Logger.getLogger;
/**
*
* @author PauloGladson
*/
public class Features {
private static final Logger LOG = getLogger(Features.class.getName());
private String type = "FeatureCollection";
private List<Feature> features = new ArrayList<>();
/**
*
* @return
*/
public String getType() {
return type;
}
/**
*
* @param type
*/
public void setType(String type) {
this.type = type;
}
/**
*
* @return
*/
public List<Feature> getFeatures() {
return (features);
}
/**
*
* @param features
*/
public void setFeatures(List<Feature> features) {
this.features = features;
}
}
| UTF-8 | Java | 912 | java | Features.java | Java | [
{
"context": ".util.logging.Logger.getLogger;\n\n/**\n *\n * @author PauloGladson\n */\npublic class Features {\n\n private static f",
"end": 236,
"score": 0.9998342394828796,
"start": 224,
"tag": "NAME",
"value": "PauloGladson"
}
] | null | [] | package org.demoiselle.jee.geogov.pojo;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;
import static java.util.logging.Logger.getLogger;
/**
*
* @author PauloGladson
*/
public class Features {
private static final Logger LOG = getLogger(Features.class.getName());
private String type = "FeatureCollection";
private List<Feature> features = new ArrayList<>();
/**
*
* @return
*/
public String getType() {
return type;
}
/**
*
* @param type
*/
public void setType(String type) {
this.type = type;
}
/**
*
* @return
*/
public List<Feature> getFeatures() {
return (features);
}
/**
*
* @param features
*/
public void setFeatures(List<Feature> features) {
this.features = features;
}
}
| 912 | 0.588816 | 0.588816 | 52 | 16.538462 | 17.428383 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 9 |
8d64d6b47b001c612e37c32464df259a250084a8 | 6,536,940,271,486 | f8de5390a1a27bfc772018f56c12803e56e5ef58 | /src/main/java/edu/gmu/swe/datadep/inst/DependencyTrackingClassVisitor.java | 14da8b5300889c5d8bf862e3badb38822cf4c7de | [] | no_license | henryw30/datadep-detector | https://github.com/henryw30/datadep-detector | 9dc373a4a1d5e6cc4d1feb77b81f3625e095279e | f0d1024d911288b42df69f91cbc5b56df33b5af6 | refs/heads/master | 2021-01-21T06:33:15.162000 | 2016-12-10T21:38:37 | 2016-12-10T21:38:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.gmu.swe.datadep.inst;
import java.util.LinkedList;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.AnalyzerAdapter;
import org.objectweb.asm.commons.LocalVariablesSorter;
import org.objectweb.asm.tree.FieldNode;
import edu.gmu.swe.datadep.DependencyInfo;
import edu.gmu.swe.datadep.DependencyInstrumented;
import edu.gmu.swe.datadep.Instrumenter;
public class DependencyTrackingClassVisitor extends ClassVisitor {
boolean skipFrames = false;
public DependencyTrackingClassVisitor(ClassVisitor _cv, boolean skipFrames) {
super(Opcodes.ASM5, _cv);
this.skipFrames = skipFrames;
}
String className;
boolean isClass = false;
private boolean patchLDCClass;
private boolean addTaintField = true;
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
// make sure class is not private
access = access & ~Opcodes.ACC_PRIVATE;
access = access | Opcodes.ACC_PUBLIC;
this.isClass = (access & Opcodes.ACC_INTERFACE) == 0;
this.className = name;
this.patchLDCClass = (version & 0xFFFF) < Opcodes.V1_5;
if (!superName.equals("java/lang/Object") && !Instrumenter.isIgnoredClass(superName)) {
addTaintField = false;
}
// Add interface
if (!Instrumenter.isIgnoredClass(name) && isClass && (access & Opcodes.ACC_ENUM) == 0) {
String[] iface = new String[interfaces.length + 1];
System.arraycopy(interfaces, 0, iface, 0, interfaces.length);
iface[interfaces.length] = Type.getInternalName(DependencyInstrumented.class);
interfaces = iface;
if (signature != null)
signature = signature + Type.getDescriptor(DependencyInstrumented.class);
}
super.visit(version, access, name, signature, superName, interfaces);
}
LinkedList<FieldNode> moreFields = new LinkedList<FieldNode>();
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
Type t = Type.getType(desc);
if ((access & Opcodes.ACC_STATIC) != 0 || (t.getSort() != Type.ARRAY && t.getSort() != Type.OBJECT))
moreFields.add(new FieldNode(access, name + "__DEPENDENCY_INFO", Type.getDescriptor(DependencyInfo.class), null, null));
return super.visitField(access, name, desc, signature, value);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
AnalyzerAdapter an = null;
if (!skipFrames) {
an = new AnalyzerAdapter(className, access, name, desc, mv);
mv = an;
}
RWTrackingMethodVisitor rtmv = new RWTrackingMethodVisitor(mv, patchLDCClass, className, access, name, desc);
mv = rtmv;
if (!skipFrames) {
rtmv.setAnalyzer(an);
}
LocalVariablesSorter lvs = new LocalVariablesSorter(access, desc, mv);
rtmv.setLVS(lvs);
return lvs;
}
@Override
public void visitEnd() {
for (FieldNode fn : moreFields) {
fn.accept(cv);
}
if (isClass) {
// Add field to store dep info
if (addTaintField)
super.visitField(Opcodes.ACC_PUBLIC, "__DEPENDENCY_INFO", Type.getDescriptor(DependencyInfo.class), null, null);
MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC, "getDEPENDENCY_INFO", "()" + Type.getDescriptor(DependencyInfo.class), null, null);
mv.visitCode();
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitFieldInsn(Opcodes.GETFIELD, className, "__DEPENDENCY_INFO", Type.getDescriptor(DependencyInfo.class));
mv.visitInsn(Opcodes.DUP);
Label ok = new Label();
mv.visitJumpInsn(Opcodes.IFNONNULL, ok);
mv.visitInsn(Opcodes.POP);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(DependencyInfo.class));
mv.visitInsn(Opcodes.DUP_X1);
mv.visitInsn(Opcodes.DUP);
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(DependencyInfo.class), "<init>", "()V", false);
mv.visitFieldInsn(Opcodes.PUTFIELD, className, "__DEPENDENCY_INFO", Type.getDescriptor(DependencyInfo.class));
mv.visitLabel(ok);
mv.visitFrame(Opcodes.F_FULL, 1, new Object[] { className }, 1, new Object[] { Type.getInternalName(DependencyInfo.class) });
mv.visitInsn(Opcodes.ARETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
mv = super.visitMethod(Opcodes.ACC_PUBLIC, "__initPrimDepInfo", "()V", null, null);
mv.visitCode();
for (FieldNode fn : moreFields) {
if ((fn.access & Opcodes.ACC_STATIC) == 0) {
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(DependencyInfo.class));
mv.visitInsn(Opcodes.DUP);
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(DependencyInfo.class), "<init>", "()V", false);
mv.visitInsn(Opcodes.DUP);
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(DependencyInfo.class), "write", "()V", false);
mv.visitFieldInsn(Opcodes.PUTFIELD, className, fn.name, Type.getDescriptor(DependencyInfo.class));
}
}
mv.visitInsn(Opcodes.RETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
super.visitEnd();
}
}
| UTF-8 | Java | 5,268 | java | DependencyTrackingClassVisitor.java | Java | [] | null | [] | package edu.gmu.swe.datadep.inst;
import java.util.LinkedList;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.AnalyzerAdapter;
import org.objectweb.asm.commons.LocalVariablesSorter;
import org.objectweb.asm.tree.FieldNode;
import edu.gmu.swe.datadep.DependencyInfo;
import edu.gmu.swe.datadep.DependencyInstrumented;
import edu.gmu.swe.datadep.Instrumenter;
public class DependencyTrackingClassVisitor extends ClassVisitor {
boolean skipFrames = false;
public DependencyTrackingClassVisitor(ClassVisitor _cv, boolean skipFrames) {
super(Opcodes.ASM5, _cv);
this.skipFrames = skipFrames;
}
String className;
boolean isClass = false;
private boolean patchLDCClass;
private boolean addTaintField = true;
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
// make sure class is not private
access = access & ~Opcodes.ACC_PRIVATE;
access = access | Opcodes.ACC_PUBLIC;
this.isClass = (access & Opcodes.ACC_INTERFACE) == 0;
this.className = name;
this.patchLDCClass = (version & 0xFFFF) < Opcodes.V1_5;
if (!superName.equals("java/lang/Object") && !Instrumenter.isIgnoredClass(superName)) {
addTaintField = false;
}
// Add interface
if (!Instrumenter.isIgnoredClass(name) && isClass && (access & Opcodes.ACC_ENUM) == 0) {
String[] iface = new String[interfaces.length + 1];
System.arraycopy(interfaces, 0, iface, 0, interfaces.length);
iface[interfaces.length] = Type.getInternalName(DependencyInstrumented.class);
interfaces = iface;
if (signature != null)
signature = signature + Type.getDescriptor(DependencyInstrumented.class);
}
super.visit(version, access, name, signature, superName, interfaces);
}
LinkedList<FieldNode> moreFields = new LinkedList<FieldNode>();
@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
Type t = Type.getType(desc);
if ((access & Opcodes.ACC_STATIC) != 0 || (t.getSort() != Type.ARRAY && t.getSort() != Type.OBJECT))
moreFields.add(new FieldNode(access, name + "__DEPENDENCY_INFO", Type.getDescriptor(DependencyInfo.class), null, null));
return super.visitField(access, name, desc, signature, value);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
AnalyzerAdapter an = null;
if (!skipFrames) {
an = new AnalyzerAdapter(className, access, name, desc, mv);
mv = an;
}
RWTrackingMethodVisitor rtmv = new RWTrackingMethodVisitor(mv, patchLDCClass, className, access, name, desc);
mv = rtmv;
if (!skipFrames) {
rtmv.setAnalyzer(an);
}
LocalVariablesSorter lvs = new LocalVariablesSorter(access, desc, mv);
rtmv.setLVS(lvs);
return lvs;
}
@Override
public void visitEnd() {
for (FieldNode fn : moreFields) {
fn.accept(cv);
}
if (isClass) {
// Add field to store dep info
if (addTaintField)
super.visitField(Opcodes.ACC_PUBLIC, "__DEPENDENCY_INFO", Type.getDescriptor(DependencyInfo.class), null, null);
MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC, "getDEPENDENCY_INFO", "()" + Type.getDescriptor(DependencyInfo.class), null, null);
mv.visitCode();
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitFieldInsn(Opcodes.GETFIELD, className, "__DEPENDENCY_INFO", Type.getDescriptor(DependencyInfo.class));
mv.visitInsn(Opcodes.DUP);
Label ok = new Label();
mv.visitJumpInsn(Opcodes.IFNONNULL, ok);
mv.visitInsn(Opcodes.POP);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(DependencyInfo.class));
mv.visitInsn(Opcodes.DUP_X1);
mv.visitInsn(Opcodes.DUP);
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(DependencyInfo.class), "<init>", "()V", false);
mv.visitFieldInsn(Opcodes.PUTFIELD, className, "__DEPENDENCY_INFO", Type.getDescriptor(DependencyInfo.class));
mv.visitLabel(ok);
mv.visitFrame(Opcodes.F_FULL, 1, new Object[] { className }, 1, new Object[] { Type.getInternalName(DependencyInfo.class) });
mv.visitInsn(Opcodes.ARETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
mv = super.visitMethod(Opcodes.ACC_PUBLIC, "__initPrimDepInfo", "()V", null, null);
mv.visitCode();
for (FieldNode fn : moreFields) {
if ((fn.access & Opcodes.ACC_STATIC) == 0) {
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitTypeInsn(Opcodes.NEW, Type.getInternalName(DependencyInfo.class));
mv.visitInsn(Opcodes.DUP);
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(DependencyInfo.class), "<init>", "()V", false);
mv.visitInsn(Opcodes.DUP);
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getInternalName(DependencyInfo.class), "write", "()V", false);
mv.visitFieldInsn(Opcodes.PUTFIELD, className, fn.name, Type.getDescriptor(DependencyInfo.class));
}
}
mv.visitInsn(Opcodes.RETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
super.visitEnd();
}
}
| 5,268 | 0.729499 | 0.725513 | 135 | 38.022221 | 35.440395 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.185185 | false | false | 9 |
b8295a9a8ddb022836bcc150195834291ad068c8 | 2,156,073,633,682 | 495bab3d71ecd58058d44086fb82d5eaf3ba1a92 | /05-base-api/src/main/java/com/helius/Oct2Bin.java | 1a7f19fac531907d690ca2b2c7ad94c236ea432a | [] | no_license | heliusjing/jdk_src | https://github.com/heliusjing/jdk_src | 30ffa5d761c952f8703d5ba50f5f1b20f4148214 | 37df064e39d1dc21401ec00d81d068502973bd0c | refs/heads/master | 2021-07-11T07:42:08.001000 | 2021-05-05T12:34:44 | 2021-05-05T12:34:44 | 245,174,030 | 0 | 0 | null | false | 2021-01-02T10:18:23 | 2020-03-05T13:44:13 | 2021-01-02T10:18:00 | 2021-01-02T10:18:22 | 165 | 0 | 0 | 7 | Java | false | false | package com.helius;
/**
* @Author Helius
* @Create 2020-08-08-5:47 下午
*/
public class Oct2Bin {
public static void main(String[] args) {
int a = -8;
System.out.println(Integer.toBinaryString(8));
}
}
| UTF-8 | Java | 232 | java | Oct2Bin.java | Java | [
{
"context": "package com.helius;\n\n/**\n * @Author Helius\n * @Create 2020-08-08-5:47 下午\n */\npublic class Oc",
"end": 42,
"score": 0.9905383586883545,
"start": 36,
"tag": "NAME",
"value": "Helius"
}
] | null | [] | package com.helius;
/**
* @Author Helius
* @Create 2020-08-08-5:47 下午
*/
public class Oct2Bin {
public static void main(String[] args) {
int a = -8;
System.out.println(Integer.toBinaryString(8));
}
}
| 232 | 0.605263 | 0.54386 | 12 | 18 | 16.693312 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 9 |
dab4ba37ed20d4a625be99cf3a5d1cf7be1080d1 | 21,990,232,617,890 | ee1ddc5e27feb0764d29de62bacd351d8f3cf9e0 | /MeiMeng/src/com/swater/meimeng/activity/user/addUserForden.java | df2b9ef363c5730e7e2a709fe3d05fef9c3e173e | [] | no_license | struggle111/Meimeng | https://github.com/struggle111/Meimeng | 5180674ae68468652626779b788f4ffc6ebd7df2 | d4e294b9122b9abae92ca79b6bb4574d451b08c1 | refs/heads/master | 2020-06-09T07:28:55.928000 | 2015-03-17T12:24:15 | 2015-03-17T12:24:15 | 32,321,191 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.swater.meimeng.activity.user;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import com.meimeng.app.R;
import com.swater.meimeng.commbase.BaseTemplate;
public class addUserForden extends BaseTemplate {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add_forbiden_user);
TempRun();
}
@Override
public void iniView() {
showNavgationLeftBar("返回");
view_Hide(findViewById(R.id.home_right_btn));
showTitle("添加屏蔽");
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.home_left_btn: {
sysback();
}
break;
case R.id.add_for_btn:
case R.id.home_right_btn: {
shieldName = getValueView(findViewById(R.id.add_for_username));
if (TextUtils.isEmpty(shieldName)) {
showToast("请先输入要添加的屏幕人");
} else {
addUserForbiden();
}
}
break;
default:
break;
}
}
@Override
public void bindClick() {
bindNavgationEvent();
setClickEvent(findButton(R.id.add_for_btn));
}
String shieldName = "";
Handler handler = new Handler() {
public void handleMessage(android.os.Message msg) {
ProDimiss();
switch (msg.what) {
case Resp_exception: {
showToat("服务器异常!");
}
break;
case Resp_action_fail: {
showToat("服务器异常!" + mg2String(msg));
}
break;
case Resp_action_ok: {
showToast("添加成功!");
Intent in = new Intent(CMD_FRESH_SHILED_LIST);
sendBroadcast(in);
onBackPressed();
}
break;
default:
break;
}
};
};
void addUserForbiden() {
ProShow("正在添加屏蔽...");
try {
poolThread.submit(new Runnable() {
@Override
public void run() {
req_map_param.put("key", key_server);
req_map_param.put("uid", shareUserInfo().getUserid() + "");
req_map_param.put("keyword", shieldName);
vo_resp = sendReq(MURL_PERMISSION_ADD_SHIELD, req_map_param);
if (null == vo_resp) {
handler.obtainMessage(Resp_exception).sendToTarget();
}
if (vo_resp.isHasError()) {
handler.obtainMessage(Resp_action_fail,
vo_resp.getErrorDetail()).sendToTarget();
} else {
handler.obtainMessage(Resp_action_ok).sendToTarget();
}
}
});
} catch (Exception e) {
}
}
}
| UTF-8 | Java | 2,442 | java | addUserForden.java | Java | [] | null | [] | package com.swater.meimeng.activity.user;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import com.meimeng.app.R;
import com.swater.meimeng.commbase.BaseTemplate;
public class addUserForden extends BaseTemplate {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add_forbiden_user);
TempRun();
}
@Override
public void iniView() {
showNavgationLeftBar("返回");
view_Hide(findViewById(R.id.home_right_btn));
showTitle("添加屏蔽");
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.home_left_btn: {
sysback();
}
break;
case R.id.add_for_btn:
case R.id.home_right_btn: {
shieldName = getValueView(findViewById(R.id.add_for_username));
if (TextUtils.isEmpty(shieldName)) {
showToast("请先输入要添加的屏幕人");
} else {
addUserForbiden();
}
}
break;
default:
break;
}
}
@Override
public void bindClick() {
bindNavgationEvent();
setClickEvent(findButton(R.id.add_for_btn));
}
String shieldName = "";
Handler handler = new Handler() {
public void handleMessage(android.os.Message msg) {
ProDimiss();
switch (msg.what) {
case Resp_exception: {
showToat("服务器异常!");
}
break;
case Resp_action_fail: {
showToat("服务器异常!" + mg2String(msg));
}
break;
case Resp_action_ok: {
showToast("添加成功!");
Intent in = new Intent(CMD_FRESH_SHILED_LIST);
sendBroadcast(in);
onBackPressed();
}
break;
default:
break;
}
};
};
void addUserForbiden() {
ProShow("正在添加屏蔽...");
try {
poolThread.submit(new Runnable() {
@Override
public void run() {
req_map_param.put("key", key_server);
req_map_param.put("uid", shareUserInfo().getUserid() + "");
req_map_param.put("keyword", shieldName);
vo_resp = sendReq(MURL_PERMISSION_ADD_SHIELD, req_map_param);
if (null == vo_resp) {
handler.obtainMessage(Resp_exception).sendToTarget();
}
if (vo_resp.isHasError()) {
handler.obtainMessage(Resp_action_fail,
vo_resp.getErrorDetail()).sendToTarget();
} else {
handler.obtainMessage(Resp_action_ok).sendToTarget();
}
}
});
} catch (Exception e) {
}
}
}
| 2,442 | 0.646063 | 0.645639 | 129 | 17.310078 | 17.875885 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.348837 | false | false | 9 |
f420a9cb5a9b7051c04ee50d2298ef12bb58e94d | 26,027,501,839,313 | 64f01a2cb2384b00a29a992711a4e9314c528ddf | /src/main/com/palmergames/townynameupdater/TownyNameUpdaterConfiguration.java | 8b1f4130d2f5c6fc1123c2ebc8619a0875c71c1a | [] | no_license | isabella232/TownyNameUpdater | https://github.com/isabella232/TownyNameUpdater | 718df1435c19ba0eca4261a5dec8e81f74b5ea16 | 355b0d35042228f70e1552860b47694fb876d4bb | refs/heads/master | 2023-03-19T04:19:56.219000 | 2020-04-25T20:50:55 | 2020-04-25T20:50:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.palmergames.townynameupdater;
import com.palmergames.bukkit.config.CommentedConfiguration;
import com.palmergames.util.FileMgmt;
import java.io.File;
public class TownyNameUpdaterConfiguration {
private static CommentedConfiguration config;
public static void loadConfig(String filepath) {
if (!FileMgmt.checkOrCreateFile(filepath)) {
System.out.println("Failed to create playermap.yml!");
System.out.println("Will not continue to load TownyNameUpdater!");
return;
}
File file = new File(filepath);
// read the config.yml into memory
config = new CommentedConfiguration(file);
if (!config.load()) {
System.out.print("Failed to load Config!");
System.out.println("Will not continue to load TownyNameUpdater!");
return;
}
CommentedConfiguration newConfig = new CommentedConfiguration(file);
newConfig.load();
config = newConfig;
config.save();
}
private static void setProperty(String root, Object value) {
config.set(root.toLowerCase(), value.toString());
}
public static String getString(String root) {
String data = config.getString(root.toLowerCase());
if (data == null) {
return "";
}
return data;
}
public static void setString(String root, Object value) {
setProperty(root, value);
config.save();
}
}
| UTF-8 | Java | 1,296 | java | TownyNameUpdaterConfiguration.java | Java | [] | null | [] | package com.palmergames.townynameupdater;
import com.palmergames.bukkit.config.CommentedConfiguration;
import com.palmergames.util.FileMgmt;
import java.io.File;
public class TownyNameUpdaterConfiguration {
private static CommentedConfiguration config;
public static void loadConfig(String filepath) {
if (!FileMgmt.checkOrCreateFile(filepath)) {
System.out.println("Failed to create playermap.yml!");
System.out.println("Will not continue to load TownyNameUpdater!");
return;
}
File file = new File(filepath);
// read the config.yml into memory
config = new CommentedConfiguration(file);
if (!config.load()) {
System.out.print("Failed to load Config!");
System.out.println("Will not continue to load TownyNameUpdater!");
return;
}
CommentedConfiguration newConfig = new CommentedConfiguration(file);
newConfig.load();
config = newConfig;
config.save();
}
private static void setProperty(String root, Object value) {
config.set(root.toLowerCase(), value.toString());
}
public static String getString(String root) {
String data = config.getString(root.toLowerCase());
if (data == null) {
return "";
}
return data;
}
public static void setString(String root, Object value) {
setProperty(root, value);
config.save();
}
}
| 1,296 | 0.729938 | 0.729938 | 52 | 23.923077 | 23.287374 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.788462 | false | false | 9 |
6c3978b074b6471e066426214e64d084b4f0eacd | 33,449,205,317,519 | f82ce7378ad318de31c22e2753d4dbc7874fd857 | /env-monitor/env-monitor-provider/src/main/java/org/envtools/monitor/provider/applications/configurable/model/VersionedApplicationXml.java | afb8b17a8d51f66bb88f2f514ba7c3206d3824c1 | [] | no_license | env-tools/env-monitor | https://github.com/env-tools/env-monitor | ec82ec32b9f47b663c8ed7f09fb4f8e2722b44b3 | 61d955cf3f881bc2ee88055589a9a798aa7b2646 | refs/heads/master | 2020-04-14T05:04:59.021000 | 2017-08-30T15:10:57 | 2017-08-30T15:10:57 | 40,150,171 | 1 | 5 | null | false | 2017-07-29T08:58:09 | 2015-08-03T22:03:19 | 2017-01-07T22:21:29 | 2017-07-29T08:58:09 | 243,377 | 1 | 2 | 4 | Java | null | null | package org.envtools.monitor.provider.applications.configurable.model;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.envtools.monitor.model.applications.ApplicationStatus;
import javax.xml.bind.annotation.*;
import java.beans.Transient;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Michal Skuza on 2016-06-22.
*/
@XmlRootElement(name = "application")
@XmlAccessorType(value = XmlAccessType.FIELD)
public class VersionedApplicationXml {
@XmlAttribute
private String id;
@XmlElement
private String name;
@XmlElement
private String type;
@XmlElement
private String host;
@XmlElement
private String port;
@XmlElement
private String url;
@XmlElement(name = "componentname")
private String componentName;
@XmlElement
private MetadataXml metadata;
@XmlElementWrapper
@XmlElement(name = "hostee")
List<VersionedApplicationXml> hostees;
@XmlTransient
private ApplicationStatus status;
@XmlTransient
private String version;
//Which component version relates to?
@XmlElement
private String versionOf;
@XmlTransient
private Double processMemory;
public VersionedApplicationXml() {
}
public VersionedApplicationXml(String id, String name, String type, String host, String port, String url, String componentName, String versionOf) {
this.id = id;
this.name = name;
this.type = type;
this.host = host;
this.port = port;
this.url = url;
this.componentName = componentName;
this.versionOf = versionOf;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getComponentName() {
return componentName;
}
public void setComponentName(String componentName) {
this.componentName = componentName;
}
public String getVersionOf() {
return versionOf;
}
public void setVersionOf(String versionOf) {
this.versionOf = versionOf;
}
public MetadataXml getMetadata() {
return metadata;
}
public void setMetadata(MetadataXml metadataXml) {
this.metadata = metadataXml;
}
public void addHostee(VersionedApplicationXml hostee) {
if (this.hostees == null) {
this.hostees = new ArrayList<>();
}
this.hostees.add(hostee);
}
public List<VersionedApplicationXml> getHostees() {
return hostees;
}
public ApplicationStatus getStatus() {
return status;
}
public void setStatus(ApplicationStatus status) {
this.status = status;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public Double getProcessMemory() {
return processMemory;
}
public void setProcessMemory(Double processMemory) {
this.processMemory = processMemory;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).
append("id", id).
append("name", name).
append("type", type).
append("host", host).
append("port", port).
append("url", url).
append("componentName", componentName).
append("versionOf", versionOf).
append("metadata", metadata).
append("hostees", hostees).
toString();
}
} | UTF-8 | Java | 4,321 | java | VersionedApplicationXml.java | Java | [
{
"context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Michal Skuza on 2016-06-22.\n */\n@XmlRootElement(name = \"applic",
"end": 396,
"score": 0.9998301863670349,
"start": 384,
"tag": "NAME",
"value": "Michal Skuza"
}
] | null | [] | package org.envtools.monitor.provider.applications.configurable.model;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.envtools.monitor.model.applications.ApplicationStatus;
import javax.xml.bind.annotation.*;
import java.beans.Transient;
import java.util.ArrayList;
import java.util.List;
/**
* Created by <NAME> on 2016-06-22.
*/
@XmlRootElement(name = "application")
@XmlAccessorType(value = XmlAccessType.FIELD)
public class VersionedApplicationXml {
@XmlAttribute
private String id;
@XmlElement
private String name;
@XmlElement
private String type;
@XmlElement
private String host;
@XmlElement
private String port;
@XmlElement
private String url;
@XmlElement(name = "componentname")
private String componentName;
@XmlElement
private MetadataXml metadata;
@XmlElementWrapper
@XmlElement(name = "hostee")
List<VersionedApplicationXml> hostees;
@XmlTransient
private ApplicationStatus status;
@XmlTransient
private String version;
//Which component version relates to?
@XmlElement
private String versionOf;
@XmlTransient
private Double processMemory;
public VersionedApplicationXml() {
}
public VersionedApplicationXml(String id, String name, String type, String host, String port, String url, String componentName, String versionOf) {
this.id = id;
this.name = name;
this.type = type;
this.host = host;
this.port = port;
this.url = url;
this.componentName = componentName;
this.versionOf = versionOf;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getComponentName() {
return componentName;
}
public void setComponentName(String componentName) {
this.componentName = componentName;
}
public String getVersionOf() {
return versionOf;
}
public void setVersionOf(String versionOf) {
this.versionOf = versionOf;
}
public MetadataXml getMetadata() {
return metadata;
}
public void setMetadata(MetadataXml metadataXml) {
this.metadata = metadataXml;
}
public void addHostee(VersionedApplicationXml hostee) {
if (this.hostees == null) {
this.hostees = new ArrayList<>();
}
this.hostees.add(hostee);
}
public List<VersionedApplicationXml> getHostees() {
return hostees;
}
public ApplicationStatus getStatus() {
return status;
}
public void setStatus(ApplicationStatus status) {
this.status = status;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public Double getProcessMemory() {
return processMemory;
}
public void setProcessMemory(Double processMemory) {
this.processMemory = processMemory;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).
append("id", id).
append("name", name).
append("type", type).
append("host", host).
append("port", port).
append("url", url).
append("componentName", componentName).
append("versionOf", versionOf).
append("metadata", metadata).
append("hostees", hostees).
toString();
}
} | 4,315 | 0.61583 | 0.613978 | 195 | 21.164103 | 20.087341 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 9 |
155f3f8abd38f7fca0b4edf98f4deca3ece73610 | 7,679,401,567,043 | 51b95840ea8be7f238d4e2a2cf4d1059b0fd65a5 | /src/model/BeanOrderDetail.java | 612e6615b926f3f3c1d5f965a080b852bdb0afc4 | [] | no_license | zhang-wangz/KitchenHelper | https://github.com/zhang-wangz/KitchenHelper | 6a8cc96caa4bbe5ed59d9d0ea12047d880761f4a | b8a943089c435a333f92ee7c6f1bb8a87f72b63a | refs/heads/master | 2020-07-08T18:57:36.672000 | 2019-09-02T02:55:41 | 2019-09-02T02:55:41 | 203,749,342 | 4 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package model;
import util.KitchenSystemUtil;
import java.io.Serializable;
public class BeanOrderDetail implements Serializable {
private static final long serialVersionUID = 1L;
private String orderId;
private String foodId;
private Integer num;
private Integer price;
private Double discount;
private String foodName;
public String getFoodName() {
return KitchenSystemUtil.foodInfoController.findFoodById(this.foodId).getFoodName();
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getFoodId() {
return foodId;
}
public void setFoodId(String foodId) {
this.foodId = foodId;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Double getDiscount() {
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
}
| UTF-8 | Java | 1,200 | java | BeanOrderDetail.java | Java | [] | null | [] | package model;
import util.KitchenSystemUtil;
import java.io.Serializable;
public class BeanOrderDetail implements Serializable {
private static final long serialVersionUID = 1L;
private String orderId;
private String foodId;
private Integer num;
private Integer price;
private Double discount;
private String foodName;
public String getFoodName() {
return KitchenSystemUtil.foodInfoController.findFoodById(this.foodId).getFoodName();
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getFoodId() {
return foodId;
}
public void setFoodId(String foodId) {
this.foodId = foodId;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Double getDiscount() {
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
}
| 1,200 | 0.635833 | 0.635 | 64 | 17.75 | 18.401766 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.328125 | false | false | 9 |
2b2a9102db8eb4310ef8f520c09d19fcb288a078 | 7,679,401,567,434 | 7c1f686a1c86db6068ae5cbcff8821b595fbe24d | /kodilla-patterns2/src/test/java/com/kodilla/patterns2/observer/homework/StudentsTasksQueueTestSuite.java | 82fe6f031e8afaafc34ff65f0fadedb34f187f4e | [] | no_license | micunm/maciej-micun-kodilla-java | https://github.com/micunm/maciej-micun-kodilla-java | 97a28b13821120f594f1801fe3fe7e5432cf1022 | f74c0c05f1eb258a238a41e0e3b4324bdab7aacc | refs/heads/master | 2021-07-07T11:59:22.982000 | 2018-11-10T21:25:11 | 2018-11-10T21:25:11 | 131,519,571 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kodilla.patterns2.observer.homework;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class StudentsTasksQueueTestSuite {
@Test
public void testUpdate() {
//Given
StudentsTasksQueue tasksQueue1 = new StudentsTasksQueue("Michael Obaba");
StudentsTasksQueue tasksQueue2 = new StudentsTasksQueue("Alex Punto");
StudentsTasksQueue tasksQueue3 = new StudentsTasksQueue("Ali Baba");
StudentsTasksQueue tasksQueue4 = new StudentsTasksQueue("Me Moo");
Mentor mentor1 = new Mentor("John Rambo");
Mentor mentor2 = new Mentor("Neo Matrix");
tasksQueue1.registerObserver(mentor1);
tasksQueue2.registerObserver(mentor1);
tasksQueue3.registerObserver(mentor2);
tasksQueue4.registerObserver(mentor1);
//When
tasksQueue1.sendTask("Spring Intro");
tasksQueue1.sendTask("Rest application");
tasksQueue2.sendTask("Big Decimal");
tasksQueue2.sendTask("JQuery");
tasksQueue2.sendTask("Loops");
tasksQueue2.sendTask("Lambda expressions");
tasksQueue3.sendTask("Aspect programming");
tasksQueue4.sendTask("Design pattern Facade");
tasksQueue4.sendTask("Design pattern observer");
tasksQueue1.sendTask("Interfaces");
assertEquals(9, mentor1.getUpdateCount());
assertEquals(1, mentor2.getUpdateCount());
}
}
| UTF-8 | Java | 1,429 | java | StudentsTasksQueueTestSuite.java | Java | [
{
"context": "sTasksQueue tasksQueue1 = new StudentsTasksQueue(\"Michael Obaba\");\n StudentsTasksQueue tasksQueue2 = new S",
"end": 298,
"score": 0.999890148639679,
"start": 285,
"tag": "NAME",
"value": "Michael Obaba"
},
{
"context": "sTasksQueue tasksQueue2 = new StudentsTasksQueue(\"Alex Punto\");\n StudentsTasksQueue tasksQueue3 = new S",
"end": 377,
"score": 0.9998870491981506,
"start": 367,
"tag": "NAME",
"value": "Alex Punto"
},
{
"context": "sTasksQueue tasksQueue3 = new StudentsTasksQueue(\"Ali Baba\");\n StudentsTasksQueue tasksQueue4 = new S",
"end": 454,
"score": 0.999882698059082,
"start": 446,
"tag": "NAME",
"value": "Ali Baba"
},
{
"context": "sTasksQueue tasksQueue4 = new StudentsTasksQueue(\"Me Moo\");\n Mentor mentor1 = new Mentor(\"John Ramb",
"end": 529,
"score": 0.9995790123939514,
"start": 523,
"tag": "NAME",
"value": "Me Moo"
},
{
"context": "e(\"Me Moo\");\n Mentor mentor1 = new Mentor(\"John Rambo\");\n Mentor mentor2 = new Mentor(\"Neo Matri",
"end": 580,
"score": 0.9998815655708313,
"start": 570,
"tag": "NAME",
"value": "John Rambo"
},
{
"context": "ohn Rambo\");\n Mentor mentor2 = new Mentor(\"Neo Matrix\");\n tasksQueue1.registerObserver(mentor1);",
"end": 631,
"score": 0.9998853206634521,
"start": 621,
"tag": "NAME",
"value": "Neo Matrix"
}
] | null | [] | package com.kodilla.patterns2.observer.homework;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class StudentsTasksQueueTestSuite {
@Test
public void testUpdate() {
//Given
StudentsTasksQueue tasksQueue1 = new StudentsTasksQueue("<NAME>");
StudentsTasksQueue tasksQueue2 = new StudentsTasksQueue("<NAME>");
StudentsTasksQueue tasksQueue3 = new StudentsTasksQueue("<NAME>");
StudentsTasksQueue tasksQueue4 = new StudentsTasksQueue("<NAME>");
Mentor mentor1 = new Mentor("<NAME>");
Mentor mentor2 = new Mentor("<NAME>");
tasksQueue1.registerObserver(mentor1);
tasksQueue2.registerObserver(mentor1);
tasksQueue3.registerObserver(mentor2);
tasksQueue4.registerObserver(mentor1);
//When
tasksQueue1.sendTask("Spring Intro");
tasksQueue1.sendTask("Rest application");
tasksQueue2.sendTask("Big Decimal");
tasksQueue2.sendTask("JQuery");
tasksQueue2.sendTask("Loops");
tasksQueue2.sendTask("Lambda expressions");
tasksQueue3.sendTask("Aspect programming");
tasksQueue4.sendTask("Design pattern Facade");
tasksQueue4.sendTask("Design pattern observer");
tasksQueue1.sendTask("Interfaces");
assertEquals(9, mentor1.getUpdateCount());
assertEquals(1, mentor2.getUpdateCount());
}
}
| 1,408 | 0.692092 | 0.671798 | 36 | 38.694443 | 22.855608 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 9 |
32878b49f7fded875b08d36de69dbace09ba9bf1 | 10,196,252,419,675 | c4cdd0f46c80806e2115890374d9b45fc3476520 | /Weloop/wl_JADX/com/baidu/frontia/module/deeplink/C0423g.java | 802be311ed352f201d6c7a31af3bd4a1016daa34 | [
"Apache-2.0"
] | permissive | Andy10101/CraftPlugins | https://github.com/Andy10101/CraftPlugins | 5ccf3afb67e6001a3935c484a4dcf641868e7897 | f80dab6b58baadc5b141a3a923509d87e892a00c | refs/heads/master | 2021-01-20T00:53:27.462000 | 2017-04-22T07:52:35 | 2017-04-22T07:52:35 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.baidu.frontia.module.deeplink;
import android.content.Context;
import android.util.Log;
import com.baidu.android.p062a.p063a.C0164e;
import com.baidu.android.pushservice.C0192a;
import com.baidu.android.pushservice.p070d.C0229o;
import java.util.ArrayList;
/* renamed from: com.baidu.frontia.module.deeplink.g */
public class C0423g {
public static final String f3713a;
private static C0423g f3714h;
private static Object f3715k;
private ArrayList<Integer> f3716b;
private final int f3717c;
private int f3718d;
private final int f3719e;
private int f3720f;
private long f3721g;
private C0164e f3722i;
private final Context f3723j;
static {
f3713a = "WRONG API OR VERSION NOT SUPPORTED - VERSION " + C0192a.m4336a();
f3714h = null;
f3715k = new Object();
}
private C0423g(Context context) {
this.f3717c = 7777;
this.f3718d = 7777;
this.f3719e = 5;
this.f3720f = 0;
this.f3721g = 0;
this.f3722i = null;
this.f3723j = context;
this.f3716b = new ArrayList();
this.f3720f = 0;
}
public static C0423g m5430a() {
return f3714h;
}
public static synchronized C0423g m5431a(Context context) {
C0423g c0423g;
synchronized (C0423g.class) {
if (context == null) {
c0423g = null;
} else {
if (f3714h == null) {
synchronized (f3715k) {
if (f3714h == null) {
f3714h = new C0423g(context);
}
}
}
c0423g = f3714h;
}
}
return c0423g;
}
private void m5436f() {
if (this.f3716b.size() == 0 && this.f3720f < 5) {
this.f3716b = new C0229o(this.f3723j).m4542a();
this.f3720f++;
}
if (this.f3716b != null && 2 == this.f3716b.size()) {
if (this.f3718d == 7777) {
this.f3718d = ((Integer) this.f3716b.get(0)).intValue();
} else if (this.f3718d == ((Integer) this.f3716b.get(0)).intValue()) {
this.f3718d = ((Integer) this.f3716b.get(1)).intValue();
} else {
this.f3718d = 7777;
}
}
}
public Context m5437b() {
return this.f3723j;
}
public boolean m5438c() {
if (m5440e()) {
return true;
}
try {
new Thread(new C0424h(this)).start();
return true;
} catch (Exception e) {
Log.e("LocalServer", "error: " + e.getMessage());
return false;
}
}
public void m5439d() {
if (m5440e()) {
this.f3722i.m4171a();
}
}
public boolean m5440e() {
return this.f3722i != null && this.f3722i.m4173b();
}
}
| UTF-8 | Java | 2,945 | java | C0423g.java | Java | [] | null | [] | package com.baidu.frontia.module.deeplink;
import android.content.Context;
import android.util.Log;
import com.baidu.android.p062a.p063a.C0164e;
import com.baidu.android.pushservice.C0192a;
import com.baidu.android.pushservice.p070d.C0229o;
import java.util.ArrayList;
/* renamed from: com.baidu.frontia.module.deeplink.g */
public class C0423g {
public static final String f3713a;
private static C0423g f3714h;
private static Object f3715k;
private ArrayList<Integer> f3716b;
private final int f3717c;
private int f3718d;
private final int f3719e;
private int f3720f;
private long f3721g;
private C0164e f3722i;
private final Context f3723j;
static {
f3713a = "WRONG API OR VERSION NOT SUPPORTED - VERSION " + C0192a.m4336a();
f3714h = null;
f3715k = new Object();
}
private C0423g(Context context) {
this.f3717c = 7777;
this.f3718d = 7777;
this.f3719e = 5;
this.f3720f = 0;
this.f3721g = 0;
this.f3722i = null;
this.f3723j = context;
this.f3716b = new ArrayList();
this.f3720f = 0;
}
public static C0423g m5430a() {
return f3714h;
}
public static synchronized C0423g m5431a(Context context) {
C0423g c0423g;
synchronized (C0423g.class) {
if (context == null) {
c0423g = null;
} else {
if (f3714h == null) {
synchronized (f3715k) {
if (f3714h == null) {
f3714h = new C0423g(context);
}
}
}
c0423g = f3714h;
}
}
return c0423g;
}
private void m5436f() {
if (this.f3716b.size() == 0 && this.f3720f < 5) {
this.f3716b = new C0229o(this.f3723j).m4542a();
this.f3720f++;
}
if (this.f3716b != null && 2 == this.f3716b.size()) {
if (this.f3718d == 7777) {
this.f3718d = ((Integer) this.f3716b.get(0)).intValue();
} else if (this.f3718d == ((Integer) this.f3716b.get(0)).intValue()) {
this.f3718d = ((Integer) this.f3716b.get(1)).intValue();
} else {
this.f3718d = 7777;
}
}
}
public Context m5437b() {
return this.f3723j;
}
public boolean m5438c() {
if (m5440e()) {
return true;
}
try {
new Thread(new C0424h(this)).start();
return true;
} catch (Exception e) {
Log.e("LocalServer", "error: " + e.getMessage());
return false;
}
}
public void m5439d() {
if (m5440e()) {
this.f3722i.m4171a();
}
}
public boolean m5440e() {
return this.f3722i != null && this.f3722i.m4173b();
}
}
| 2,945 | 0.52292 | 0.402377 | 107 | 26.523365 | 18.933403 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.46729 | false | false | 9 |
6c0671d8aa4dacd67a14f06663cd59dd477fd9a0 | 31,318,901,542,600 | 4206e5d5ebcd31cc706f785b9f1be476b63496da | /src/main/java/net/minestom/server/extras/selfmodification/mixins/MixinPlatformAgentMinestom.java | c35bf2534981571e9986fc5daedacf4f720d8b13 | [
"Apache-2.0"
] | permissive | Swoking/Minestom | https://github.com/Swoking/Minestom | e2655fd1efa335ff940ba871082f6b6990299562 | 6e0ad54d5e83c3e6d1ab12975759505696028f7c | refs/heads/master | 2023-02-03T01:50:05.322000 | 2020-12-22T04:36:15 | 2020-12-22T04:36:15 | 306,135,131 | 3 | 0 | Apache-2.0 | true | 2020-10-21T20:05:30 | 2020-10-21T20:05:28 | 2020-10-21T14:27:05 | 2020-10-21T14:27:03 | 4,322 | 0 | 0 | 0 | null | false | false | package net.minestom.server.extras.selfmodification.mixins;
import org.spongepowered.asm.launch.platform.IMixinPlatformServiceAgent;
import org.spongepowered.asm.launch.platform.MixinPlatformAgentAbstract;
import org.spongepowered.asm.launch.platform.MixinPlatformManager;
import org.spongepowered.asm.launch.platform.container.IContainerHandle;
import org.spongepowered.asm.util.Constants;
import java.util.Collection;
public class MixinPlatformAgentMinestom extends MixinPlatformAgentAbstract implements IMixinPlatformServiceAgent {
@Override
public void init() { }
@Override
public String getSideName() {
return Constants.SIDE_SERVER;
}
@Override
public AcceptResult accept(MixinPlatformManager manager, IContainerHandle handle) {
return AcceptResult.ACCEPTED;
}
@Override
public Collection<IContainerHandle> getMixinContainers() {
return null;
}
}
| UTF-8 | Java | 926 | java | MixinPlatformAgentMinestom.java | Java | [] | null | [] | package net.minestom.server.extras.selfmodification.mixins;
import org.spongepowered.asm.launch.platform.IMixinPlatformServiceAgent;
import org.spongepowered.asm.launch.platform.MixinPlatformAgentAbstract;
import org.spongepowered.asm.launch.platform.MixinPlatformManager;
import org.spongepowered.asm.launch.platform.container.IContainerHandle;
import org.spongepowered.asm.util.Constants;
import java.util.Collection;
public class MixinPlatformAgentMinestom extends MixinPlatformAgentAbstract implements IMixinPlatformServiceAgent {
@Override
public void init() { }
@Override
public String getSideName() {
return Constants.SIDE_SERVER;
}
@Override
public AcceptResult accept(MixinPlatformManager manager, IContainerHandle handle) {
return AcceptResult.ACCEPTED;
}
@Override
public Collection<IContainerHandle> getMixinContainers() {
return null;
}
}
| 926 | 0.784017 | 0.784017 | 29 | 30.931034 | 31.309282 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37931 | false | false | 9 |
4b907f06a5ae8f3dcd3c27191a190387e09ec056 | 14,508,399,557,244 | 0ca91aeefcde8bf7acd0aebc13410705ba96a58a | /src/com/datacompanies/forms/SearchAccountForm.java | 5d836b7f47887bbf3694d1b3a37a03d82fb13461 | [] | no_license | Loris-Steve/DataCompanies_Front | https://github.com/Loris-Steve/DataCompanies_Front | 8c95e7d8eeef5ad1c8777c7fcd6a4f5ba2806cc6 | d9e43859ff22f38cce13cbb7e66b046e4a733e68 | refs/heads/master | 2023-02-27T15:55:27.270000 | 2021-02-01T22:07:37 | 2021-02-01T22:07:37 | 334,266,792 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.datacompanies.forms;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.json.simple.JSONObject;
// import org.json.JSONObject;
import org.lpld.*;
import org.lpld.datacompanies.*;
import org.lpld.datacompanies.backend.Requests;
import org.lpld.datacompanies.backend.model.*;
import org.lpld.datacompanies.backend.mongodb.*;
import com.datacompanies.beans.BeanException;
import com.datacompanies.beans.DictionaryAccount;
public class SearchAccountForm {
private DictionaryAccount dictionaryAccount = new DictionaryAccount();
private Map<String, String> mapAttributs ;
private JSONObject queryUser = new JSONObject();
private JSONObject more_than = new JSONObject();
private JSONObject less_than = new JSONObject();
private JSONObject equals_to = new JSONObject();
public SearchAccountForm() {
mapAttributs = dictionaryAccount.getCodeAttributs() ;
}
public void putJsonOption (String optionFilter,String attributCode , String valAttribut) {
System.out.println("option filter : "+optionFilter+" attributCode : "+attributCode+" valAttribut : "+valAttribut);
// j'ajoute l'option choisi par l'utilisateur à la requête
if(optionFilter.equals("1") ) {
more_than.put(attributCode,valAttribut);
}
else if(optionFilter.equals("2")) {
equals_to.put(attributCode,valAttribut);
}
else {
less_than.put(attributCode,valAttribut);
}
}
public JSONObject verifyAttributs( HttpServletRequest request) throws BeanException {
List<String> annualAccountVarNames = this.dictionaryAccount.getAttributsName();
List<String> annualAccountStringVarNames = this.dictionaryAccount.getStringAttributsName();
String varName = ""; // contient le nom de l'attribut
String valAttribut = null; // contient la valeur de l'attribut
String optionFilter = null ; // on récupère l'option de filtre ( supérieur à ...)
String valExtentionName = "";
String optionExtentionName = "Option";
Integer nbFilter = annualAccountVarNames.size();
// On vérifie si l'utilisateur a choisi que les filtres simples
if(request.getParameter("moreFilter") == null) {
System.out.println("Attributs simple");
valExtentionName = "simple";
optionExtentionName = "simpleOption";
nbFilter = 9;
}
else
System.out.println("more filter!");
System.out.println("nbFilter : "+nbFilter);
// on parcour la liste des filtres simples (9 premiers attributs)
for (int i = 0; i < nbFilter; i++) {
// On récupère le nom de l'attribut à la position i
varName = annualAccountVarNames.get(i);
// on récupère le contenu de la première option
valAttribut = request.getParameter(varName+valExtentionName+"1");
System.out.println("#"+i+"\n");
System.out.println("INT Mentionnée Nom attribut : "+varName+
" val : " + valAttribut);
// on vérifie si le premier champ est rempli avant de le traiter
if(valAttribut != "" ){
// on vérifi si c'est un string
if(!annualAccountStringVarNames.contains(varName)) {
optionFilter = request.getParameter(varName+optionExtentionName+"1");
System.out.println("IF int filtre 1 :"+optionFilter);
putJsonOption(optionFilter, mapAttributs.get(varName), valAttribut);
// on récupère le contenu de la deuxième option
valAttribut = request.getParameter(varName+valExtentionName+"2");
// on vérifie si le champ de la deuxième option a été rempli
if(valAttribut != "" ){
optionFilter = request.getParameter(varName+optionExtentionName+"2");
System.out.println("IF int filtre 2 :"+optionFilter+" | val attribut 2 : "+valAttribut);
putJsonOption(optionFilter, mapAttributs.get(varName), valAttribut);
}
}
else {
System.out.println("IF String filtre 1");
equals_to.put(mapAttributs.get(varName),valAttribut);
}
}
}
if(more_than.size() > 0) {
queryUser.put("more_than", more_than);
}
if(equals_to.size() > 0)
queryUser.put("equals_to", equals_to);
if(less_than.size() > 0)
queryUser.put("less_than", less_than);
if(queryUser.size() > 0)
System.out.println(queryUser);
else
System.out.println("query vide");
return queryUser;
}
}
| UTF-8 | Java | 4,262 | java | SearchAccountForm.java | Java | [] | null | [] | package com.datacompanies.forms;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.json.simple.JSONObject;
// import org.json.JSONObject;
import org.lpld.*;
import org.lpld.datacompanies.*;
import org.lpld.datacompanies.backend.Requests;
import org.lpld.datacompanies.backend.model.*;
import org.lpld.datacompanies.backend.mongodb.*;
import com.datacompanies.beans.BeanException;
import com.datacompanies.beans.DictionaryAccount;
public class SearchAccountForm {
private DictionaryAccount dictionaryAccount = new DictionaryAccount();
private Map<String, String> mapAttributs ;
private JSONObject queryUser = new JSONObject();
private JSONObject more_than = new JSONObject();
private JSONObject less_than = new JSONObject();
private JSONObject equals_to = new JSONObject();
public SearchAccountForm() {
mapAttributs = dictionaryAccount.getCodeAttributs() ;
}
public void putJsonOption (String optionFilter,String attributCode , String valAttribut) {
System.out.println("option filter : "+optionFilter+" attributCode : "+attributCode+" valAttribut : "+valAttribut);
// j'ajoute l'option choisi par l'utilisateur à la requête
if(optionFilter.equals("1") ) {
more_than.put(attributCode,valAttribut);
}
else if(optionFilter.equals("2")) {
equals_to.put(attributCode,valAttribut);
}
else {
less_than.put(attributCode,valAttribut);
}
}
public JSONObject verifyAttributs( HttpServletRequest request) throws BeanException {
List<String> annualAccountVarNames = this.dictionaryAccount.getAttributsName();
List<String> annualAccountStringVarNames = this.dictionaryAccount.getStringAttributsName();
String varName = ""; // contient le nom de l'attribut
String valAttribut = null; // contient la valeur de l'attribut
String optionFilter = null ; // on récupère l'option de filtre ( supérieur à ...)
String valExtentionName = "";
String optionExtentionName = "Option";
Integer nbFilter = annualAccountVarNames.size();
// On vérifie si l'utilisateur a choisi que les filtres simples
if(request.getParameter("moreFilter") == null) {
System.out.println("Attributs simple");
valExtentionName = "simple";
optionExtentionName = "simpleOption";
nbFilter = 9;
}
else
System.out.println("more filter!");
System.out.println("nbFilter : "+nbFilter);
// on parcour la liste des filtres simples (9 premiers attributs)
for (int i = 0; i < nbFilter; i++) {
// On récupère le nom de l'attribut à la position i
varName = annualAccountVarNames.get(i);
// on récupère le contenu de la première option
valAttribut = request.getParameter(varName+valExtentionName+"1");
System.out.println("#"+i+"\n");
System.out.println("INT Mentionnée Nom attribut : "+varName+
" val : " + valAttribut);
// on vérifie si le premier champ est rempli avant de le traiter
if(valAttribut != "" ){
// on vérifi si c'est un string
if(!annualAccountStringVarNames.contains(varName)) {
optionFilter = request.getParameter(varName+optionExtentionName+"1");
System.out.println("IF int filtre 1 :"+optionFilter);
putJsonOption(optionFilter, mapAttributs.get(varName), valAttribut);
// on récupère le contenu de la deuxième option
valAttribut = request.getParameter(varName+valExtentionName+"2");
// on vérifie si le champ de la deuxième option a été rempli
if(valAttribut != "" ){
optionFilter = request.getParameter(varName+optionExtentionName+"2");
System.out.println("IF int filtre 2 :"+optionFilter+" | val attribut 2 : "+valAttribut);
putJsonOption(optionFilter, mapAttributs.get(varName), valAttribut);
}
}
else {
System.out.println("IF String filtre 1");
equals_to.put(mapAttributs.get(varName),valAttribut);
}
}
}
if(more_than.size() > 0) {
queryUser.put("more_than", more_than);
}
if(equals_to.size() > 0)
queryUser.put("equals_to", equals_to);
if(less_than.size() > 0)
queryUser.put("less_than", less_than);
if(queryUser.size() > 0)
System.out.println(queryUser);
else
System.out.println("query vide");
return queryUser;
}
}
| 4,262 | 0.711017 | 0.707006 | 136 | 30.169117 | 27.49159 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.580882 | false | false | 9 |
9d486eed4f70c7f1e6e8671a2b70add47d4d1ff8 | 23,502,061,090,387 | 6868a778f36e4e3caa1efb6e883e81c7f938e4de | /src/main/java/adapter/IteratorAdapter.java | b2e43c98c94f29e48bc1af005d0cf5a6f1f49953 | [] | no_license | zongshuo/JavaPatterns | https://github.com/zongshuo/JavaPatterns | ab113cb6a8a679db3eb85726b838699cc32de160 | 8a8af1e83caab4c5b3581b64c5da119b13c16f1d | refs/heads/master | 2020-09-02T15:32:21.817000 | 2019-11-07T03:01:20 | 2019-11-07T03:01:20 | 219,249,771 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package adapter;
import java.util.Enumeration;
import java.util.Iterator;
/**
* Created by DEll on 2019-11-5.
* 适配器
* 目标接口:Iterator
* 被适配者:Enumeration
* 通过Iterator接口使用Enumeration的具体实现类
*/
public class IteratorAdapter implements Iterator{
Enumeration bookEnum;
public IteratorAdapter(Enumeration bookEnum){
this.bookEnum = bookEnum;
}
@Override
public boolean hasNext() {
return bookEnum.hasMoreElements();
}
@Override
public Object next() {
return bookEnum.nextElement();
}
}
| UTF-8 | Java | 596 | java | IteratorAdapter.java | Java | [
{
"context": "on;\nimport java.util.Iterator;\n\n\n/**\n * Created by DEll on 2019-11-5.\n * 适配器\n * 目标接口:Iterator\n * 被适配者:Enu",
"end": 99,
"score": 0.99858558177948,
"start": 95,
"tag": "USERNAME",
"value": "DEll"
}
] | null | [] | package adapter;
import java.util.Enumeration;
import java.util.Iterator;
/**
* Created by DEll on 2019-11-5.
* 适配器
* 目标接口:Iterator
* 被适配者:Enumeration
* 通过Iterator接口使用Enumeration的具体实现类
*/
public class IteratorAdapter implements Iterator{
Enumeration bookEnum;
public IteratorAdapter(Enumeration bookEnum){
this.bookEnum = bookEnum;
}
@Override
public boolean hasNext() {
return bookEnum.hasMoreElements();
}
@Override
public Object next() {
return bookEnum.nextElement();
}
}
| 596 | 0.680657 | 0.667883 | 30 | 17.266666 | 15.699116 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.233333 | false | false | 9 |
4346b2e818fb9a85ce41f1bab3ab95695d3d8c31 | 32,727,650,824,068 | 870dfb04769a8a3c3351ee326f59e45313ea12ba | /src/GUI/Kreis.java | ee99bbaf11c7aa13eb1d0fe9dd7cfcccc0586ecb | [] | no_license | fabwu/ConnectFour | https://github.com/fabwu/ConnectFour | 1fd4bc4846b68d7ec23e4f78f2f59e826c750141 | ca353c2cf6bcff905ba40346eb9e3261069c3cd7 | refs/heads/master | 2021-05-27T21:28:57.467000 | 2014-09-30T19:28:24 | 2014-09-30T19:28:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package GUI;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
/**
* ConnectFour Kreis
*
* Stellt ein Spielstein dar.
*
* @author S. Winterberger <stefan.winterberger@stud.hslu.ch>
* @author R. Ritter <reto.ritter@stud.hslu.ch>
* @author D. Niederberger <david.niederberger@stud.hslu.ch>
* @author F. Wüthrich <fabian.wuethrich.01@stud.hslu.ch>
*
* @version 1.0
*/
public class Kreis extends JPanel {
//FILEDS--------------------------------------------------------------------
private final int color;
//CONSTRUCTORS--------------------------------------------------------------
/**
* Erstellt einen Spielstein mit der Farbe des Spielers
*
* @param n
*/
public Kreis(int n) {
super();
this.color = n;
setBackground(new java.awt.Color(0, 0, 204));
}
//PUBLIC METHODS------------------------------------------------------------
/**
* Zeichnet den Spielstein auf das gewünschte Feld
*
* @param g Spielfeld auf welches gezeichnet werden soll
*/
@Override
public void paint(Graphics g) {
super.paint(g);
switch (color) {
case 1:
g.setColor(Color.red);
g.fillOval(0, 0, getWidth(), getHeight());
break;
case 2:
g.setColor(Color.yellow);
g.fillOval(0, 0, getWidth(), getHeight());
break;
default:
g.setColor(Color.white);
g.fillOval(0, 0, getWidth(), getHeight());
break;
}
g.setColor(Color.black);
g.drawOval(0, 0, getWidth(), getHeight());
}
}
| UTF-8 | Java | 1,715 | java | Kreis.java | Java | [
{
"context": "eis\n *\n * Stellt ein Spielstein dar.\n *\n * @author S. Winterberger <stefan.winterberger@stud.hslu.ch>\n * @author R. ",
"end": 178,
"score": 0.9998862743377686,
"start": 163,
"tag": "NAME",
"value": "S. Winterberger"
},
{
"context": "in Spielstein dar.\n *\n * @author S. Winterberger <stefan.winterberger@stud.hslu.ch>\n * @author R. Ritter <reto.ritter@stud.hslu.ch>\n",
"end": 212,
"score": 0.9997867345809937,
"start": 180,
"tag": "EMAIL",
"value": "stefan.winterberger@stud.hslu.ch"
},
{
"context": "rger <stefan.winterberger@stud.hslu.ch>\n * @author R. Ritter <reto.ritter@stud.hslu.ch>\n * @author D. Niederbe",
"end": 234,
"score": 0.9998816251754761,
"start": 225,
"tag": "NAME",
"value": "R. Ritter"
},
{
"context": ".winterberger@stud.hslu.ch>\n * @author R. Ritter <reto.ritter@stud.hslu.ch>\n * @author D. Niederberger <david.niederberger@s",
"end": 260,
"score": 0.9990381598472595,
"start": 236,
"tag": "EMAIL",
"value": "reto.ritter@stud.hslu.ch"
},
{
"context": "or R. Ritter <reto.ritter@stud.hslu.ch>\n * @author D. Niederberger <david.niederberger@stud.hslu.ch>\n * @author F. W",
"end": 288,
"score": 0.9998872876167297,
"start": 273,
"tag": "NAME",
"value": "D. Niederberger"
},
{
"context": ".ritter@stud.hslu.ch>\n * @author D. Niederberger <david.niederberger@stud.hslu.ch>\n * @author F. Wüthrich <fabian.wuethrich.01@stud",
"end": 321,
"score": 0.9989432096481323,
"start": 290,
"tag": "EMAIL",
"value": "david.niederberger@stud.hslu.ch"
},
{
"context": "erger <david.niederberger@stud.hslu.ch>\n * @author F. Wüthrich <fabian.wuethrich.01@stud.hslu.ch>\n *\n * @version",
"end": 345,
"score": 0.9998806118965149,
"start": 334,
"tag": "NAME",
"value": "F. Wüthrich"
},
{
"context": "iederberger@stud.hslu.ch>\n * @author F. Wüthrich <fabian.wuethrich.01@stud.hslu.ch>\n *\n * @version 1.0\n */\npublic class Kreis extend",
"end": 379,
"score": 0.9997847080230713,
"start": 347,
"tag": "EMAIL",
"value": "fabian.wuethrich.01@stud.hslu.ch"
}
] | null | [] | package GUI;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
/**
* ConnectFour Kreis
*
* Stellt ein Spielstein dar.
*
* @author <NAME> <<EMAIL>>
* @author <NAME> <<EMAIL>>
* @author <NAME> <<EMAIL>>
* @author <NAME> <<EMAIL>>
*
* @version 1.0
*/
public class Kreis extends JPanel {
//FILEDS--------------------------------------------------------------------
private final int color;
//CONSTRUCTORS--------------------------------------------------------------
/**
* Erstellt einen Spielstein mit der Farbe des Spielers
*
* @param n
*/
public Kreis(int n) {
super();
this.color = n;
setBackground(new java.awt.Color(0, 0, 204));
}
//PUBLIC METHODS------------------------------------------------------------
/**
* Zeichnet den Spielstein auf das gewünschte Feld
*
* @param g Spielfeld auf welches gezeichnet werden soll
*/
@Override
public void paint(Graphics g) {
super.paint(g);
switch (color) {
case 1:
g.setColor(Color.red);
g.fillOval(0, 0, getWidth(), getHeight());
break;
case 2:
g.setColor(Color.yellow);
g.fillOval(0, 0, getWidth(), getHeight());
break;
default:
g.setColor(Color.white);
g.fillOval(0, 0, getWidth(), getHeight());
break;
}
g.setColor(Color.black);
g.drawOval(0, 0, getWidth(), getHeight());
}
}
| 1,597 | 0.489784 | 0.478692 | 65 | 25.353846 | 22.832117 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.523077 | false | false | 9 |
70b91a2487ff5308f9a02665859066f93faed0fa | 29,892,972,405,467 | da776a3defea5157b52c9a4a8db362e8c76fdd3b | /parent/common-module-dao/src/main/java/com/microservice/dao/repository/crawler/insurance/suzhou/InsuranceSuzhouTownsWorkersRepository.java | 1f2cf95f20b918e8401ea16be5bed831c04d434f | [] | no_license | moutainhigh/crawler | https://github.com/moutainhigh/crawler | d4f306d74a9f16bce3490d4dbdcedad953120f97 | 4c201cdf24a025d0b1056188e0f0f4beee0b80aa | refs/heads/master | 2020-09-21T12:22:54.075000 | 2018-11-06T04:33:15 | 2018-11-06T04:33:15 | 224,787,613 | 1 | 0 | null | true | 2019-11-29T06:06:28 | 2019-11-29T06:06:28 | 2018-12-04T07:12:15 | 2018-11-06T05:12:35 | 64,796 | 0 | 0 | 0 | null | false | false | package com.microservice.dao.repository.crawler.insurance.suzhou;
import org.springframework.data.jpa.repository.JpaRepository;
import com.microservice.dao.entity.crawler.insurance.suzhou.InsuranceSuzhouTownsWorkers;
public interface InsuranceSuzhouTownsWorkersRepository extends JpaRepository<InsuranceSuzhouTownsWorkers, Long>{
}
| UTF-8 | Java | 336 | java | InsuranceSuzhouTownsWorkersRepository.java | Java | [] | null | [] | package com.microservice.dao.repository.crawler.insurance.suzhou;
import org.springframework.data.jpa.repository.JpaRepository;
import com.microservice.dao.entity.crawler.insurance.suzhou.InsuranceSuzhouTownsWorkers;
public interface InsuranceSuzhouTownsWorkersRepository extends JpaRepository<InsuranceSuzhouTownsWorkers, Long>{
}
| 336 | 0.872024 | 0.872024 | 9 | 36.333332 | 42.627586 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false | 9 |
0fc7fa3b9d1eb88af9d4a9291d645fd5717ddc60 | 13,700,945,684,247 | b99ea2836682ce90a4c99a58fa0383889acad482 | /arrays-and-strings/SummaryRanges.java | 199d9d09c3c74ff44e447087b92af370b6d98e72 | [] | no_license | bmanley91/practice-problems | https://github.com/bmanley91/practice-problems | 7db7d9a9afd6d377ad28b0748ab24b8adc3ce3b5 | fa562ad67d2c17bc78144d090e419d7492efe474 | refs/heads/main | 2023-01-27T23:19:34.918000 | 2023-01-13T13:09:45 | 2023-01-13T13:09:45 | 303,844,605 | 0 | 0 | null | false | 2023-01-13T13:09:46 | 2020-10-13T22:38:47 | 2020-11-02T19:46:19 | 2023-01-13T13:09:45 | 46 | 0 | 0 | 0 | Java | false | false | class Solution {
// Use two pointers to move through the list
// One pointer will keep track of the start of the range
// The other will move forward through the list to find the end of the range.
// A range ends when there's a gap in the numbers
// i.e. nums[i] != nums[i - 1] + 1
// Once a range ends, construct a range string and add it to the output list
public List<String> summaryRanges(int[] nums) {
List<String> outputList = new ArrayList<>();
// Base Case - If the input is empty, short circuit.
if (nums.length == 0) return outputList;
int low = 0;
int high = 1;
while (high < nums.length) {
// If this happens, that means the current range ended at the previous high index.
if (nums[high] != nums[high - 1] + 1) {
outputList.add(constructRangeString(nums, low, high - 1));
// The next range starts at the current high
low = high;
}
high++;
}
// Construct the final range
outputList.add(constructRangeString(nums, low, high - 1));
return outputList;
}
// Helper method to create the output string for a given range
private String constructRangeString(int[] nums, int low, int high) {
if (low == high) {
return Integer.toString(nums[low]);
} else {
return nums[low] + "->" + nums[high];
}
}
} | UTF-8 | Java | 1,532 | java | SummaryRanges.java | Java | [] | null | [] | class Solution {
// Use two pointers to move through the list
// One pointer will keep track of the start of the range
// The other will move forward through the list to find the end of the range.
// A range ends when there's a gap in the numbers
// i.e. nums[i] != nums[i - 1] + 1
// Once a range ends, construct a range string and add it to the output list
public List<String> summaryRanges(int[] nums) {
List<String> outputList = new ArrayList<>();
// Base Case - If the input is empty, short circuit.
if (nums.length == 0) return outputList;
int low = 0;
int high = 1;
while (high < nums.length) {
// If this happens, that means the current range ended at the previous high index.
if (nums[high] != nums[high - 1] + 1) {
outputList.add(constructRangeString(nums, low, high - 1));
// The next range starts at the current high
low = high;
}
high++;
}
// Construct the final range
outputList.add(constructRangeString(nums, low, high - 1));
return outputList;
}
// Helper method to create the output string for a given range
private String constructRangeString(int[] nums, int low, int high) {
if (low == high) {
return Integer.toString(nums[low]);
} else {
return nums[low] + "->" + nums[high];
}
}
} | 1,532 | 0.552219 | 0.546345 | 42 | 35.5 | 25.664734 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false | 9 |
442f8d3b55f16c5c72523db3d38134ce7151c55e | 12,859,132,117,972 | e6e7a796aa0b9c0a41f340c81e57a80e866fe26a | /app/src/main/java/com/example/sjqcjstock/Activity/user/edituserinfousernameActivity.java | 1d566febf7822a84bb7b27bae072b72258f22421 | [] | no_license | shuijingqiu/sjqcj-android | https://github.com/shuijingqiu/sjqcj-android | f51f0afb7db40b777f160065bff3f9b787e03768 | 67a86a38b84d366737e566fbc08abf11fc18ad1a | refs/heads/master | 2021-08-26T09:47:19.754000 | 2017-11-23T07:24:20 | 2017-11-23T07:27:09 | 111,770,724 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.sjqcjstock.Activity.user;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.example.sjqcjstock.R;
import com.example.sjqcjstock.app.ExitApplication;
import com.example.sjqcjstock.constant.Constants;
import com.example.sjqcjstock.netutil.HttpUtil;
import com.example.sjqcjstock.view.CustomProgress;
import com.example.sjqcjstock.view.CustomToast;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* 修改用户名称
*/
public class edituserinfousernameActivity extends Activity {
private LinearLayout goback1;
private ImageView clearedit1;
private EditText editname1;
private TextView isexist1;
private LinearLayout editusername1;
private String nameStr = "";
// 获取原用户名
private String unamestr2;
// 网络请求提示
private CustomProgress dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.edituserinfousername);
// 将Activity反复链表
ExitApplication.getInstance().addActivity(this);
initView();
}
private void initView() {
dialog = new CustomProgress(this);
// 获取intent的数据
unamestr2 = getIntent().getStringExtra("unamestr");
goback1 = (LinearLayout) findViewById(R.id.goback1);
isexist1 = (TextView) findViewById(R.id.isexist1);
clearedit1 = (ImageView) findViewById(R.id.clearedit1);
editname1 = (EditText) findViewById(R.id.editname1);
editusername1 = (LinearLayout) findViewById(R.id.editusername1);
editname1.setText(unamestr2);
goback1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
clearedit1.setOnClickListener(new clearedit1_listener());
editusername1.setOnClickListener(new editusername1_listener());
}
class editusername1_listener implements OnClickListener {
@Override
public void onClick(View arg0) {
dialog.showDialog();
// 判断用户名是否重复
new Thread(new Runnable() {
@Override
public void run() {
List dataList = new ArrayList();
// 用户名
dataList.add(new BasicNameValuePair("uname", editname1.getText().toString()));
nameStr = HttpUtil.restHttpPost(Constants.newUrl + "/api/register/checkUname", dataList);
handler.sendEmptyMessage(0);
}
}).start();
}
}
class clearedit1_listener implements OnClickListener {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
editname1.setText(null);
}
}
/**
* 线程更新Ui
*/
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0:
dialog.dismissDlog();
try {
JSONObject jsonObject = new JSONObject(nameStr);
String code = jsonObject.getString("code");
String msgStr = jsonObject.getString("msg");
CustomToast.makeText(getApplicationContext(), msgStr, Toast.LENGTH_SHORT).show();
if (Constants.successCode.equals(code)) {
// 将参数传回请求的Activity
Intent intent = getIntent();
Bundle unameBundle = new Bundle();
unameBundle.putString("unamestr", editname1.getText().toString());
intent.putExtras(unameBundle);
// 结果码,以及上一个页面传递过来的intent
setResult(5, intent);
finish();
} else {
editname1.requestFocus();
return;
}
} catch (JSONException e) {
e.printStackTrace();
}
break;
}
}
};
}
| UTF-8 | Java | 4,949 | java | edituserinfousernameActivity.java | Java | [] | null | [] | package com.example.sjqcjstock.Activity.user;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.example.sjqcjstock.R;
import com.example.sjqcjstock.app.ExitApplication;
import com.example.sjqcjstock.constant.Constants;
import com.example.sjqcjstock.netutil.HttpUtil;
import com.example.sjqcjstock.view.CustomProgress;
import com.example.sjqcjstock.view.CustomToast;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
/**
* 修改用户名称
*/
public class edituserinfousernameActivity extends Activity {
private LinearLayout goback1;
private ImageView clearedit1;
private EditText editname1;
private TextView isexist1;
private LinearLayout editusername1;
private String nameStr = "";
// 获取原用户名
private String unamestr2;
// 网络请求提示
private CustomProgress dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.edituserinfousername);
// 将Activity反复链表
ExitApplication.getInstance().addActivity(this);
initView();
}
private void initView() {
dialog = new CustomProgress(this);
// 获取intent的数据
unamestr2 = getIntent().getStringExtra("unamestr");
goback1 = (LinearLayout) findViewById(R.id.goback1);
isexist1 = (TextView) findViewById(R.id.isexist1);
clearedit1 = (ImageView) findViewById(R.id.clearedit1);
editname1 = (EditText) findViewById(R.id.editname1);
editusername1 = (LinearLayout) findViewById(R.id.editusername1);
editname1.setText(unamestr2);
goback1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
clearedit1.setOnClickListener(new clearedit1_listener());
editusername1.setOnClickListener(new editusername1_listener());
}
class editusername1_listener implements OnClickListener {
@Override
public void onClick(View arg0) {
dialog.showDialog();
// 判断用户名是否重复
new Thread(new Runnable() {
@Override
public void run() {
List dataList = new ArrayList();
// 用户名
dataList.add(new BasicNameValuePair("uname", editname1.getText().toString()));
nameStr = HttpUtil.restHttpPost(Constants.newUrl + "/api/register/checkUname", dataList);
handler.sendEmptyMessage(0);
}
}).start();
}
}
class clearedit1_listener implements OnClickListener {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
editname1.setText(null);
}
}
/**
* 线程更新Ui
*/
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0:
dialog.dismissDlog();
try {
JSONObject jsonObject = new JSONObject(nameStr);
String code = jsonObject.getString("code");
String msgStr = jsonObject.getString("msg");
CustomToast.makeText(getApplicationContext(), msgStr, Toast.LENGTH_SHORT).show();
if (Constants.successCode.equals(code)) {
// 将参数传回请求的Activity
Intent intent = getIntent();
Bundle unameBundle = new Bundle();
unameBundle.putString("unamestr", editname1.getText().toString());
intent.putExtras(unameBundle);
// 结果码,以及上一个页面传递过来的intent
setResult(5, intent);
finish();
} else {
editname1.requestFocus();
return;
}
} catch (JSONException e) {
e.printStackTrace();
}
break;
}
}
};
}
| 4,949 | 0.587991 | 0.580719 | 144 | 32.423611 | 23.23897 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 9 |
1cce6e9be56c68c561740d7b44a9fcc87bbfceb0 | 18,537,078,887,897 | 4b461f4eb0b634b3d972ac9ec8b77e5ff16c289f | /app/src/main/java/com/atcampus/shopper/Model/DealsModel.java | 1a53263d8e7d198aa5d45ea583b6438372fec1eb | [] | no_license | diptoroy/Shopper | https://github.com/diptoroy/Shopper | 1364e2a14fd2d2d7f24a873d1de83a4151bd6723 | f46c92e1ef65e19c22f244ccdefb13041f70aa95 | refs/heads/master | 2022-12-25T15:24:17.430000 | 2020-09-24T18:08:40 | 2020-09-24T18:08:40 | 260,737,923 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.atcampus.shopper.Model;
public class DealsModel {
private String dealsID;
private String dealsImage;
private String dealsName;
private String dealsSpec;
private String dealsPrice;
public DealsModel(String dealsID, String dealsImage, String dealsName, String dealsSpec, String dealsPrice) {
this.dealsID = dealsID;
this.dealsImage = dealsImage;
this.dealsName = dealsName;
this.dealsSpec = dealsSpec;
this.dealsPrice = dealsPrice;
}
public String getDealsID() {
return dealsID;
}
public void setDealsID(String dealsID) {
this.dealsID = dealsID;
}
public String getDealsImage() {
return dealsImage;
}
public void setDealsImage(String dealsImage) {
this.dealsImage = dealsImage;
}
public String getDealsName() {
return dealsName;
}
public void setDealsName(String dealsName) {
this.dealsName = dealsName;
}
public String getDealsSpec() {
return dealsSpec;
}
public void setDealsSpec(String dealsSpec) {
this.dealsSpec = dealsSpec;
}
public String getDealsPrice() {
return dealsPrice;
}
public void setDealsPrice(String dealsPrice) {
this.dealsPrice = dealsPrice;
}
}
| UTF-8 | Java | 1,317 | java | DealsModel.java | Java | [] | null | [] | package com.atcampus.shopper.Model;
public class DealsModel {
private String dealsID;
private String dealsImage;
private String dealsName;
private String dealsSpec;
private String dealsPrice;
public DealsModel(String dealsID, String dealsImage, String dealsName, String dealsSpec, String dealsPrice) {
this.dealsID = dealsID;
this.dealsImage = dealsImage;
this.dealsName = dealsName;
this.dealsSpec = dealsSpec;
this.dealsPrice = dealsPrice;
}
public String getDealsID() {
return dealsID;
}
public void setDealsID(String dealsID) {
this.dealsID = dealsID;
}
public String getDealsImage() {
return dealsImage;
}
public void setDealsImage(String dealsImage) {
this.dealsImage = dealsImage;
}
public String getDealsName() {
return dealsName;
}
public void setDealsName(String dealsName) {
this.dealsName = dealsName;
}
public String getDealsSpec() {
return dealsSpec;
}
public void setDealsSpec(String dealsSpec) {
this.dealsSpec = dealsSpec;
}
public String getDealsPrice() {
return dealsPrice;
}
public void setDealsPrice(String dealsPrice) {
this.dealsPrice = dealsPrice;
}
}
| 1,317 | 0.646925 | 0.646925 | 58 | 21.706896 | 20.56781 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.431034 | false | false | 9 |
62f3901871362a23f674e7bd227b8f61bbd67360 | 635,655,204,043 | ea7d0b2719a803dda9d0743a87fc5ffa7c7106d7 | /Task1/GivenNoPolyNdromeOrNot.java | 64a38484b7a57bf4a725c2b50f926c2d873c2e8b | [] | no_license | Kavya8163/Task27programs | https://github.com/Kavya8163/Task27programs | 393a92b820a1d3458affb5b105890962db45351c | 801cd7ed77f5e844db7404f90d0d9b2699e72ac0 | refs/heads/master | 2023-04-03T19:17:54.721000 | 2021-04-15T05:24:48 | 2021-04-15T05:24:48 | 358,136,318 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*Given Number is Polyndrome Or Not*/
package Task1;
import java.util.Scanner;
public class GivenNoPolyNdromeOrNot {
public static void main(String[] args) {
System.out.println("Enter the Value of n");
Scanner sc = new Scanner(System.in);
int r,sum = 0,temp;
int n = sc.nextInt();
temp =n;
while(n>0)
{
r = n%10;//getting Reminder
sum = sum*10+r;
n = n/10;
}
if(temp == sum)
{
System.out.println("Given Number is Polndrome");
}
else
{
System.out.println("Given Number is not a Polndrome");
}
}
}
| UTF-8 | Java | 559 | java | GivenNoPolyNdromeOrNot.java | Java | [] | null | [] | /*Given Number is Polyndrome Or Not*/
package Task1;
import java.util.Scanner;
public class GivenNoPolyNdromeOrNot {
public static void main(String[] args) {
System.out.println("Enter the Value of n");
Scanner sc = new Scanner(System.in);
int r,sum = 0,temp;
int n = sc.nextInt();
temp =n;
while(n>0)
{
r = n%10;//getting Reminder
sum = sum*10+r;
n = n/10;
}
if(temp == sum)
{
System.out.println("Given Number is Polndrome");
}
else
{
System.out.println("Given Number is not a Polndrome");
}
}
}
| 559 | 0.617174 | 0.601073 | 34 | 15.441176 | 16.661318 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.029412 | false | false | 9 |
2989f59e92a2ade3d57aae6de493769d7bc26f95 | 11,793,980,238,070 | 7f963e1dfaa1601fce492d737cc09eaca3fbe439 | /Unit4/aaraujo1-U4-ParkingApp/src/us/aaraujo1/Displayable.java | 5d05f5dab503db06ca9f2dcc033f9ccbbc12e67b | [] | no_license | aaraujo1/Advanced-Java | https://github.com/aaraujo1/Advanced-Java | d4ffa5598278c619f12e2992e4957e66eeae2e85 | a6b15e0831fd3471d66ee5048b7bc5a270f2c5b3 | refs/heads/master | 2020-07-28T12:14:00.267000 | 2019-09-18T21:32:12 | 2019-09-18T21:32:12 | 209,406,300 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package us.aaraujo1;
/**
* @author andregaraujo
* @version 2.0
* <p>
* Interface to display a welcome message
*/
public interface Displayable {
/*---------------------------------------------------------------*/
/*-------------------------- FUNCTIONS --------------------------*/
/*---------------------------------------------------------------*/
/**
* Method to display welcome screen
*/
void welcomeOutput();
/**
* Method to get user's option from the display
*
* @return option as an int
*/
int getDisplayOption();
/**
* Method to set user's option from the display
*
* @param displayOption as int
*/
void setDisplayOption(int displayOption);
}
| UTF-8 | Java | 745 | java | Displayable.java | Java | [
{
"context": "package us.aaraujo1;\n\n/**\n * @author andregaraujo\n * @version 2.0\n * <p>\n * Interface to displa",
"end": 45,
"score": 0.6691063046455383,
"start": 37,
"tag": "USERNAME",
"value": "andregar"
},
{
"context": "package us.aaraujo1;\n\n/**\n * @author andregaraujo\n * @version 2.0\n * <p>\n * Interface to display a ",
"end": 49,
"score": 0.8403177261352539,
"start": 45,
"tag": "NAME",
"value": "aujo"
}
] | null | [] | package us.aaraujo1;
/**
* @author andregaraujo
* @version 2.0
* <p>
* Interface to display a welcome message
*/
public interface Displayable {
/*---------------------------------------------------------------*/
/*-------------------------- FUNCTIONS --------------------------*/
/*---------------------------------------------------------------*/
/**
* Method to display welcome screen
*/
void welcomeOutput();
/**
* Method to get user's option from the display
*
* @return option as an int
*/
int getDisplayOption();
/**
* Method to set user's option from the display
*
* @param displayOption as int
*/
void setDisplayOption(int displayOption);
}
| 745 | 0.438926 | 0.434899 | 33 | 21.575758 | 22.112701 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | false | false | 9 |
e7f1bc9b33f93408a32c7afc8d77a5784095a1c5 | 27,539,330,353,127 | 48191a2a9e9f9ba6f9b8c581dd304140ea4a82b9 | /src/test/java/org/springframework/events/context/AnnotationEventHandlerPostProcessorTest.java | b0ff0c8446aa4c6bdcee0d78533f875fb02f05de | [] | no_license | pdyraga/spring-events | https://github.com/pdyraga/spring-events | 542f8533a0959214bbd76f75fcec903a10a050f3 | ae9f98d231fde7a179178c752131b042a7173583 | HEAD | 2016-09-05T21:29:54.301000 | 2014-01-01T21:10:36 | 2014-01-01T21:10:36 | 10,725,506 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.events.context;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.events.HandlerRegistration;
import org.springframework.events.HasBroadcastEventHandlers;
import org.springframework.events.mock.MockAEvent;
import org.springframework.events.mock.MockBEvent;
import org.springframework.events.mock.MockHandler;
import org.springframework.test.util.ReflectionTestUtils;
import static org.easymock.EasyMock.*;
public class AnnotationEventHandlerPostProcessorTest {
private HasBroadcastEventHandlers mockEventBus;
private AnnotationEventHandlerPostProcessor postProcessor;
@Before
public void setUp() {
this.mockEventBus = createMock(HasBroadcastEventHandlers.class);
this.postProcessor = new AnnotationEventHandlerPostProcessor();
ReflectionTestUtils.setField(this.postProcessor, "publisher", this.mockEventBus);
}
@After
public void tearDown() {
this.postProcessor = null;
this.mockEventBus = null;
}
@Test
public void shouldNotPostProcessBeforeInitialization() {
replay(mockEventBus);
postProcessor.postProcessBeforeInitialization(
new MockHandler<MockAEvent>(), "eventHandler");
verify(mockEventBus);
}
@Test
public void shouldRegisterHandlerAfterInitialization() {
expect(mockEventBus.addHandler(isA(EventHandlerAdapter.class)))
.andReturn(createMock(HandlerRegistration.class));
replay(mockEventBus);
postProcessor.postProcessAfterInitialization(
new Object(), "dummyBean"); // should do nothing
postProcessor.postProcessAfterInitialization(
new MockHandler<MockAEvent>(), "eventHandler");
verify(mockEventBus);
}
@Test
public void shouldUnregisterHandlerBeforeDestruction() {
final MockHandler<MockAEvent> bean =
new MockHandler<MockAEvent>();
final HandlerRegistration mockHandlerRegistration =
createMock(HandlerRegistration.class);
// first registering - no way to unregister without registering before ;)
expect(mockEventBus.addHandler(isA(EventHandlerAdapter.class)))
.andReturn(mockHandlerRegistration);
// and now unregistering assertion
mockHandlerRegistration.removeHandler();
expectLastCall();
replay(mockEventBus, mockHandlerRegistration);
postProcessor.postProcessAfterInitialization(bean, "eventHandler");
postProcessor.postProcessBeforeDestruction(bean, "eventHandler");
verify(mockEventBus, mockHandlerRegistration);
}
@Test
public void shouldUnregisterOnlyDestroyedHandlerBeforeDestruction() {
final MockHandler<MockAEvent> handlerA = new MockHandler<MockAEvent>();
final MockHandler<MockBEvent> handlerB = new MockHandler<MockBEvent>();
final HandlerRegistration mockHandlerRegistrationA =
createMock(HandlerRegistration.class);
final HandlerRegistration mockHandlerRegistrationB =
createMock(HandlerRegistration.class);
// registering two handlers
expect(mockEventBus.addHandler(isA(EventHandlerAdapter.class)))
.andReturn(mockHandlerRegistrationA);
expect(mockEventBus.addHandler(isA(EventHandlerAdapter.class)))
.andReturn(mockHandlerRegistrationB);
// and now unregistering _only_one_ of them
mockHandlerRegistrationA.removeHandler();
expectLastCall();
replay(mockEventBus, mockHandlerRegistrationA, mockHandlerRegistrationB);
postProcessor.postProcessAfterInitialization(handlerA, "eventHandlerA");
postProcessor.postProcessAfterInitialization(handlerB, "eventHandlerB");
postProcessor.postProcessBeforeDestruction(handlerA, "eventHandlerA");
verify(mockEventBus, mockHandlerRegistrationA, mockHandlerRegistrationB);
}
}
| UTF-8 | Java | 4,625 | java | AnnotationEventHandlerPostProcessorTest.java | Java | [] | null | [] | /*
* Copyright (C) the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.events.context;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.events.HandlerRegistration;
import org.springframework.events.HasBroadcastEventHandlers;
import org.springframework.events.mock.MockAEvent;
import org.springframework.events.mock.MockBEvent;
import org.springframework.events.mock.MockHandler;
import org.springframework.test.util.ReflectionTestUtils;
import static org.easymock.EasyMock.*;
public class AnnotationEventHandlerPostProcessorTest {
private HasBroadcastEventHandlers mockEventBus;
private AnnotationEventHandlerPostProcessor postProcessor;
@Before
public void setUp() {
this.mockEventBus = createMock(HasBroadcastEventHandlers.class);
this.postProcessor = new AnnotationEventHandlerPostProcessor();
ReflectionTestUtils.setField(this.postProcessor, "publisher", this.mockEventBus);
}
@After
public void tearDown() {
this.postProcessor = null;
this.mockEventBus = null;
}
@Test
public void shouldNotPostProcessBeforeInitialization() {
replay(mockEventBus);
postProcessor.postProcessBeforeInitialization(
new MockHandler<MockAEvent>(), "eventHandler");
verify(mockEventBus);
}
@Test
public void shouldRegisterHandlerAfterInitialization() {
expect(mockEventBus.addHandler(isA(EventHandlerAdapter.class)))
.andReturn(createMock(HandlerRegistration.class));
replay(mockEventBus);
postProcessor.postProcessAfterInitialization(
new Object(), "dummyBean"); // should do nothing
postProcessor.postProcessAfterInitialization(
new MockHandler<MockAEvent>(), "eventHandler");
verify(mockEventBus);
}
@Test
public void shouldUnregisterHandlerBeforeDestruction() {
final MockHandler<MockAEvent> bean =
new MockHandler<MockAEvent>();
final HandlerRegistration mockHandlerRegistration =
createMock(HandlerRegistration.class);
// first registering - no way to unregister without registering before ;)
expect(mockEventBus.addHandler(isA(EventHandlerAdapter.class)))
.andReturn(mockHandlerRegistration);
// and now unregistering assertion
mockHandlerRegistration.removeHandler();
expectLastCall();
replay(mockEventBus, mockHandlerRegistration);
postProcessor.postProcessAfterInitialization(bean, "eventHandler");
postProcessor.postProcessBeforeDestruction(bean, "eventHandler");
verify(mockEventBus, mockHandlerRegistration);
}
@Test
public void shouldUnregisterOnlyDestroyedHandlerBeforeDestruction() {
final MockHandler<MockAEvent> handlerA = new MockHandler<MockAEvent>();
final MockHandler<MockBEvent> handlerB = new MockHandler<MockBEvent>();
final HandlerRegistration mockHandlerRegistrationA =
createMock(HandlerRegistration.class);
final HandlerRegistration mockHandlerRegistrationB =
createMock(HandlerRegistration.class);
// registering two handlers
expect(mockEventBus.addHandler(isA(EventHandlerAdapter.class)))
.andReturn(mockHandlerRegistrationA);
expect(mockEventBus.addHandler(isA(EventHandlerAdapter.class)))
.andReturn(mockHandlerRegistrationB);
// and now unregistering _only_one_ of them
mockHandlerRegistrationA.removeHandler();
expectLastCall();
replay(mockEventBus, mockHandlerRegistrationA, mockHandlerRegistrationB);
postProcessor.postProcessAfterInitialization(handlerA, "eventHandlerA");
postProcessor.postProcessAfterInitialization(handlerB, "eventHandlerB");
postProcessor.postProcessBeforeDestruction(handlerA, "eventHandlerA");
verify(mockEventBus, mockHandlerRegistrationA, mockHandlerRegistrationB);
}
}
| 4,625 | 0.724757 | 0.723892 | 118 | 38.194916 | 28.269363 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.59322 | false | false | 9 |
c45c72704799acfccdb2170ad4c01c3c2e699a28 | 7,138,235,696,479 | 7a16da162c0a06f23bf224026d7e5c33602ce2c7 | /src/main/java/web/dao/UserDaoImpl.java | 7fbca7c24e1843227a6b1e52c2a2cf182e514d60 | [] | no_license | ivoligo/task_myMVCspring | https://github.com/ivoligo/task_myMVCspring | 5341c5740e028a1060c7c9aa65df4708c3cf0c09 | b2900110b5470045807c860ee4e8cd6fc5db620f | refs/heads/master | 2020-12-30T07:21:25.614000 | 2020-02-07T11:45:42 | 2020-02-07T11:45:42 | 238,906,838 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package web.dao;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import web.model.User;
import javax.persistence.TypedQuery;
import java.util.List;
@Repository
public class UserDaoImpl implements UserDao{
@Autowired
private SessionFactory sessionFactory;
@Override
@SuppressWarnings("unchecked")
public List<User> getAllUsers() {
TypedQuery<User> query= sessionFactory.getCurrentSession().createQuery("from User");
return query.getResultList();
}
@Override
public void create(User user) {
sessionFactory.getCurrentSession().save(user);
}
@Override
public void update(User user) {
sessionFactory.getCurrentSession().update(user);
}
@Override
public void delete(User user) {
sessionFactory.getCurrentSession().remove(user);
}
@Override
public User findUserByEmail(String email) {
return (User) sessionFactory.getCurrentSession().createQuery("from User where email = '" + email + "' ").uniqueResult();
}
@Override
public User findUserById(Long id) {
return (User) sessionFactory.getCurrentSession().createQuery("from User where id = '" + id + "' ").uniqueResult();
}
}
| UTF-8 | Java | 1,317 | java | UserDaoImpl.java | Java | [] | null | [] | package web.dao;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import web.model.User;
import javax.persistence.TypedQuery;
import java.util.List;
@Repository
public class UserDaoImpl implements UserDao{
@Autowired
private SessionFactory sessionFactory;
@Override
@SuppressWarnings("unchecked")
public List<User> getAllUsers() {
TypedQuery<User> query= sessionFactory.getCurrentSession().createQuery("from User");
return query.getResultList();
}
@Override
public void create(User user) {
sessionFactory.getCurrentSession().save(user);
}
@Override
public void update(User user) {
sessionFactory.getCurrentSession().update(user);
}
@Override
public void delete(User user) {
sessionFactory.getCurrentSession().remove(user);
}
@Override
public User findUserByEmail(String email) {
return (User) sessionFactory.getCurrentSession().createQuery("from User where email = '" + email + "' ").uniqueResult();
}
@Override
public User findUserById(Long id) {
return (User) sessionFactory.getCurrentSession().createQuery("from User where id = '" + id + "' ").uniqueResult();
}
}
| 1,317 | 0.699317 | 0.699317 | 47 | 27.021276 | 29.587584 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.319149 | false | false | 9 |
0a9449ae5ba07b358ae0e20bbfd817336f29c87d | 12,378,095,798,708 | 61eb249182cf2ea9af5590066d3261901b957053 | /src/main/java/dev/sandrocaseiro/template/models/AResponse.java | dc161ed1f92d8443386d62c296079174ab9a5c12 | [] | no_license | hugobrendow/java-spring-api | https://github.com/hugobrendow/java-spring-api | 2de24d92897567a9beda8d7a7a9032598291f941 | ca7147bebf9b9c3180eeaea8b4380519e4878b92 | refs/heads/master | 2023-01-06T23:58:23.040000 | 2020-10-26T12:51:06 | 2020-10-26T12:51:06 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dev.sandrocaseiro.template.models;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
public class AResponse<T> {
private boolean isSuccess;
private List<Error> errors;
private T data;
@Data
public static class Error {
private int code;
private ErrorType type;
private String description;
}
@AllArgsConstructor
@Getter
public enum ErrorType {
ERROR("E"),
WARNING("W"),
INFORMATION("I"),
SUCCESS("S");
@JsonValue
private String value;
}
}
| UTF-8 | Java | 779 | java | AResponse.java | Java | [
{
"context": "package dev.sandrocaseiro.template.models;\n\nimport com.fasterxml.jackson.an",
"end": 25,
"score": 0.9063773155212402,
"start": 12,
"tag": "USERNAME",
"value": "sandrocaseiro"
}
] | null | [] | package dev.sandrocaseiro.template.models;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
public class AResponse<T> {
private boolean isSuccess;
private List<Error> errors;
private T data;
@Data
public static class Error {
private int code;
private ErrorType type;
private String description;
}
@AllArgsConstructor
@Getter
public enum ErrorType {
ERROR("E"),
WARNING("W"),
INFORMATION("I"),
SUCCESS("S");
@JsonValue
private String value;
}
}
| 779 | 0.673941 | 0.673941 | 40 | 18.475 | 15.690742 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45 | false | false | 9 |
0e0fe88703067381e144b8519c9b7a14fb7bf493 | 29,300,266,935,847 | c63d4fbdee86332e8b5cce5f2fafbd062d552f22 | /src/main/java/org/codehaus/openxma/mojo/multirelease/mojo/AbstractReleaseMojo.java | 79e71d9fd7abc62eabdcbb4484bdcc357336dc0f | [] | no_license | rakshit-jain/multirelease-maven-plugin | https://github.com/rakshit-jain/multirelease-maven-plugin | 504a0f7da79e9fae5653a7c51efd0d69e934e86a | 6415e9fb785c25987cd305682c282841f1eb5bdc | refs/heads/master | 2021-01-11T02:16:33.679000 | 2016-10-15T11:28:13 | 2016-10-15T11:28:13 | 70,983,353 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.codehaus.openxma.mojo.multirelease.mojo;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.scm.ScmException;
import org.codehaus.openxma.mojo.multirelease.scm.CustomScmManager;
import org.codehaus.openxma.mojo.multirelease.util.DependencyMapper;
import org.codehaus.openxma.mojo.multirelease.util.DependencyResolver;
import org.codehaus.openxma.mojo.multirelease.util.PropertyResolver;
public abstract class AbstractReleaseMojo extends AbstractMojo {
/**
* List of projects in the reactor.
*/
@Parameter(defaultValue = "${reactorProjects}", readonly = true, required = true)
private List<MavenProject> reactorProjects;
/**
* The project currently built.
*/
@Component
private MavenProject parentProject;
/**
*
*/
@Component
private MavenSession mavenSession;
@Parameter(property = propertyFileKey)
private String propertyFile;
@Parameter(property = RELEASE_PROPERTY_KEY)
private String releaseProperties;
private final static String RELEASE_PROPERTIES = "release.properties";
protected final Pattern propertyTagPattern = Pattern.compile("\\$\\{(.*)\\}");
private final static String propertyFileKey = "property-location";
private final static String RELEASE_PROPERTY_KEY = "release-property-location";
public void execute() throws MojoExecutionException, MojoFailureException {
File file = null;
if (propertyFile != null) {
String path = (String) mavenSession.getExecutionProperties().get(propertyFileKey);
if (path != null) {
propertyFile = path;
}
file = new File(propertyFile);
if (file.isDirectory()) {
file = new File(file, "multirelease.properties");
}
if (!file.exists()) {
throw new MojoExecutionException("Invalid path specified for the property file");
}
getLog().info("Using custom multirelease.properties location: " + file);
}
PropertyResolver.getInstance().mergeProperties(mavenSession.getExecutionProperties(), parentProject, file);
}
/**
* Gets the builds the order in which projects will be built.
* @return the project build order
*/
protected List<DependencyMapper> getBuildOrder() {
List<DependencyMapper> projects = getAvailableProjects();
new DependencyResolver().getBuildOrder(projects);
return projects;
}
/**
* Deletes the release.properties created while running the release goal.
*/
protected void cleanUpAfterRelease(File releaseProperty) {
getLog().info("Cleaning up after release.");
for (MavenProject mavenProject : getReactorProjects()) {
String backupFile = mavenProject.getOriginalModel().getPomFile().getName().concat(".releaseBackup");
String path = mavenProject.getOriginalModel().getProjectDirectory().getAbsolutePath();
File file = new File(path, backupFile);
if (file.exists()) {
file.delete();
}
file = new File(path, RELEASE_PROPERTIES);
if (file.exists()) {
file.delete();
}
}
if (releaseProperty.exists()) {
releaseProperty.delete();
}
}
/**
* Gets the available projects declared in parent POM file and child projects corresponding to parent project.
* @return the available projects
*/
private List<DependencyMapper> getAvailableProjects() {
List<DependencyMapper> availableProjects = new ArrayList<DependencyMapper>();
List<?> modules = parentProject.getModules();
for (Object module : modules) {
for (MavenProject mavenProject : reactorProjects) {
if (((String) module).contains(mavenProject.getArtifactId())) {
DependencyMapper dependencyMapper = new DependencyMapper(mavenProject);
for (Object project : mavenProject.getCollectedProjects()) {
dependencyMapper.getChildProject().add((MavenProject) project);
}
availableProjects.add(dependencyMapper);
break;
}
}
}
return availableProjects;
}
/**
* Updates the POM with modified model and commits in SCM.
*
* @param dependencyMapper {@link DependencyMapper}
* @param username the username
* @param password the password
* @throws IOException Signals that an I/O exception has occurred.
* @throws FileNotFoundException the file not found exception
* @throws ScmException the scm exception
*/
protected void commitModifiedModel(DependencyMapper dependencyMapper, String username, String password,
String scmCommentPrefix)
throws IOException, FileNotFoundException, ScmException {
// Commit modified POM to SCM.s
getLog().info("commiting POM file in SVN with username " + username);
MavenProject project = dependencyMapper.getMavenProject();
CustomScmManager customScmManager = new CustomScmManager();
customScmManager.checkin(project.getOriginalModel().getScm().getUrl(), username, password,
project.getOriginalModel().getProjectDirectory(), scmCommentPrefix);
}
/**
* Write modified POM file to the file system.
* @param project {@link MavenProject}
* @throws IOException Signals that an I/O exception has occurred.
* @throws FileNotFoundException the file not found exception
*/
protected void writePOM(MavenProject project) throws IOException, FileNotFoundException {
getLog().info("Updating Dependency versions.");
FileOutputStream fileOutputStream = null;
try {
MavenXpp3Writer xpp3Writer = new MavenXpp3Writer();
fileOutputStream = new FileOutputStream(project.getOriginalModel().getPomFile());
xpp3Writer.write(fileOutputStream, project.getOriginalModel());
} finally {
try {
if (fileOutputStream != null) {
fileOutputStream.close();
}
} catch (IOException e) {
// Do nothing.
}
}
}
protected File getReleasePropertyfile() throws MojoExecutionException {
File file = null;
if (releaseProperties != null) {
String path = (String) getMavenSession().getExecutionProperties().get(RELEASE_PROPERTY_KEY);
if (path != null) {
releaseProperties = path;
}
file = new File(releaseProperties);
if (file.isDirectory()) {
file = new File(file, RELEASE_PROPERTIES);
}
getLog().info("Using custom release.properties location: " + file);
} else {
file = new File(RELEASE_PROPERTIES);
}
return file;
}
protected List<MavenProject> getReactorProjects() {
return reactorProjects;
}
protected MavenProject getParentProject() {
return parentProject;
}
protected MavenSession getMavenSession() {
return mavenSession;
}
}
| UTF-8 | Java | 6,911 | java | AbstractReleaseMojo.java | Java | [
{
"context": "r {@link DependencyMapper}\n\t * @param username the username\n\t * @param password the password\n\t * @throws IOEx",
"end": 4534,
"score": 0.9983251690864563,
"start": 4526,
"tag": "USERNAME",
"value": "username"
},
{
"context": "aram username the username\n\t * @param password the password\n\t * @throws IOException Signals that an I/O excep",
"end": 4567,
"score": 0.953056812286377,
"start": 4559,
"tag": "PASSWORD",
"value": "password"
}
] | null | [] | package org.codehaus.openxma.mojo.multirelease.mojo;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.scm.ScmException;
import org.codehaus.openxma.mojo.multirelease.scm.CustomScmManager;
import org.codehaus.openxma.mojo.multirelease.util.DependencyMapper;
import org.codehaus.openxma.mojo.multirelease.util.DependencyResolver;
import org.codehaus.openxma.mojo.multirelease.util.PropertyResolver;
public abstract class AbstractReleaseMojo extends AbstractMojo {
/**
* List of projects in the reactor.
*/
@Parameter(defaultValue = "${reactorProjects}", readonly = true, required = true)
private List<MavenProject> reactorProjects;
/**
* The project currently built.
*/
@Component
private MavenProject parentProject;
/**
*
*/
@Component
private MavenSession mavenSession;
@Parameter(property = propertyFileKey)
private String propertyFile;
@Parameter(property = RELEASE_PROPERTY_KEY)
private String releaseProperties;
private final static String RELEASE_PROPERTIES = "release.properties";
protected final Pattern propertyTagPattern = Pattern.compile("\\$\\{(.*)\\}");
private final static String propertyFileKey = "property-location";
private final static String RELEASE_PROPERTY_KEY = "release-property-location";
public void execute() throws MojoExecutionException, MojoFailureException {
File file = null;
if (propertyFile != null) {
String path = (String) mavenSession.getExecutionProperties().get(propertyFileKey);
if (path != null) {
propertyFile = path;
}
file = new File(propertyFile);
if (file.isDirectory()) {
file = new File(file, "multirelease.properties");
}
if (!file.exists()) {
throw new MojoExecutionException("Invalid path specified for the property file");
}
getLog().info("Using custom multirelease.properties location: " + file);
}
PropertyResolver.getInstance().mergeProperties(mavenSession.getExecutionProperties(), parentProject, file);
}
/**
* Gets the builds the order in which projects will be built.
* @return the project build order
*/
protected List<DependencyMapper> getBuildOrder() {
List<DependencyMapper> projects = getAvailableProjects();
new DependencyResolver().getBuildOrder(projects);
return projects;
}
/**
* Deletes the release.properties created while running the release goal.
*/
protected void cleanUpAfterRelease(File releaseProperty) {
getLog().info("Cleaning up after release.");
for (MavenProject mavenProject : getReactorProjects()) {
String backupFile = mavenProject.getOriginalModel().getPomFile().getName().concat(".releaseBackup");
String path = mavenProject.getOriginalModel().getProjectDirectory().getAbsolutePath();
File file = new File(path, backupFile);
if (file.exists()) {
file.delete();
}
file = new File(path, RELEASE_PROPERTIES);
if (file.exists()) {
file.delete();
}
}
if (releaseProperty.exists()) {
releaseProperty.delete();
}
}
/**
* Gets the available projects declared in parent POM file and child projects corresponding to parent project.
* @return the available projects
*/
private List<DependencyMapper> getAvailableProjects() {
List<DependencyMapper> availableProjects = new ArrayList<DependencyMapper>();
List<?> modules = parentProject.getModules();
for (Object module : modules) {
for (MavenProject mavenProject : reactorProjects) {
if (((String) module).contains(mavenProject.getArtifactId())) {
DependencyMapper dependencyMapper = new DependencyMapper(mavenProject);
for (Object project : mavenProject.getCollectedProjects()) {
dependencyMapper.getChildProject().add((MavenProject) project);
}
availableProjects.add(dependencyMapper);
break;
}
}
}
return availableProjects;
}
/**
* Updates the POM with modified model and commits in SCM.
*
* @param dependencyMapper {@link DependencyMapper}
* @param username the username
* @param password the <PASSWORD>
* @throws IOException Signals that an I/O exception has occurred.
* @throws FileNotFoundException the file not found exception
* @throws ScmException the scm exception
*/
protected void commitModifiedModel(DependencyMapper dependencyMapper, String username, String password,
String scmCommentPrefix)
throws IOException, FileNotFoundException, ScmException {
// Commit modified POM to SCM.s
getLog().info("commiting POM file in SVN with username " + username);
MavenProject project = dependencyMapper.getMavenProject();
CustomScmManager customScmManager = new CustomScmManager();
customScmManager.checkin(project.getOriginalModel().getScm().getUrl(), username, password,
project.getOriginalModel().getProjectDirectory(), scmCommentPrefix);
}
/**
* Write modified POM file to the file system.
* @param project {@link MavenProject}
* @throws IOException Signals that an I/O exception has occurred.
* @throws FileNotFoundException the file not found exception
*/
protected void writePOM(MavenProject project) throws IOException, FileNotFoundException {
getLog().info("Updating Dependency versions.");
FileOutputStream fileOutputStream = null;
try {
MavenXpp3Writer xpp3Writer = new MavenXpp3Writer();
fileOutputStream = new FileOutputStream(project.getOriginalModel().getPomFile());
xpp3Writer.write(fileOutputStream, project.getOriginalModel());
} finally {
try {
if (fileOutputStream != null) {
fileOutputStream.close();
}
} catch (IOException e) {
// Do nothing.
}
}
}
protected File getReleasePropertyfile() throws MojoExecutionException {
File file = null;
if (releaseProperties != null) {
String path = (String) getMavenSession().getExecutionProperties().get(RELEASE_PROPERTY_KEY);
if (path != null) {
releaseProperties = path;
}
file = new File(releaseProperties);
if (file.isDirectory()) {
file = new File(file, RELEASE_PROPERTIES);
}
getLog().info("Using custom release.properties location: " + file);
} else {
file = new File(RELEASE_PROPERTIES);
}
return file;
}
protected List<MavenProject> getReactorProjects() {
return reactorProjects;
}
protected MavenProject getParentProject() {
return parentProject;
}
protected MavenSession getMavenSession() {
return mavenSession;
}
}
| 6,913 | 0.742729 | 0.741861 | 208 | 32.22596 | 28.757975 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.052885 | false | false | 9 |
3847fa3d64f71b65c3dbdc7924088e5d655e22de | 4,312,147,232,658 | 1e44f354f243e3d7fc74bec62d384ab9fbae90fa | /src/main/java/hello/web/controllers/AttributeController.java | b4f87f03e085e65da09e9c52481541cc95941727 | [] | no_license | ccsalway/prod_info_mngr | https://github.com/ccsalway/prod_info_mngr | e9055eb56337bf90fa3df2895e6431bbed238346 | 21d5964d3a722f74397624e75c8a2d8842acf61d | refs/heads/master | 2021-09-01T04:02:33.458000 | 2017-12-24T16:30:46 | 2017-12-24T16:30:46 | 115,036,567 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hello.web.controllers;
import hello.domain.entity.enities.Attribute;
import hello.domain.entity.enities.Option;
import hello.domain.entity.enities.Product;
import hello.domain.service.AttributeService;
import hello.exceptions.AttributeNotFoundException;
import hello.exceptions.ProductNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@Controller
@RequestMapping("/product/{prod_id}/attribute")
public class AttributeController {
@Autowired
private AttributeService attributeService;
//-------------------------------------------------------
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String add(Model model,
@PathVariable Long prod_id
) throws ProductNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
model.addAttribute("product", product);
model.addAttribute("attribute", new Attribute());
return "attribute_add";
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
public String save(Model model,
@PathVariable Long prod_id,
@Valid Attribute attribute,
BindingResult result
) throws ProductNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
attribute.setProduct(product);
attributeService.save(attribute, result);
if (result.hasErrors()) {
model.addAttribute("product", product);
model.addAttribute("result", result);
return "attribute_add";
}
return "redirect:/product/" + product.getId() + "/attribute/" + attribute.getId();
}
@RequestMapping(value = "/{id}/edit", method = RequestMethod.GET)
public String edit(Model model,
@PathVariable Long prod_id,
@PathVariable Long id
) throws ProductNotFoundException, AttributeNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
Attribute attribute = attributeService.getAttribute(product, id); // throws AttributeNotFoundException
model.addAttribute("product", product);
model.addAttribute("attribute", attribute);
model.addAttribute("form", attribute);
return "attribute_edit";
}
@RequestMapping(value = "/{id}/edit", method = RequestMethod.POST)
public String update(Model model,
@PathVariable Long prod_id,
@Valid @ModelAttribute Attribute form,
BindingResult result
) throws ProductNotFoundException, AttributeNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
Attribute attribute = attributeService.getAttribute(product, form.getId()); // throws AttributeNotFoundException
form.setProduct(product);
form.setPosition(attribute.getPosition()); // not updated from the form
attributeService.save(form, result);
if (result.hasErrors()) {
model.addAttribute("product", product);
model.addAttribute("attribute", attribute); // to separate current values with new values
model.addAttribute("result", result);
return "attribute_edit";
}
return "redirect:/product/" + product.getId() + "/attribute/" + attribute.getId();
}
@RequestMapping(value = "/{id}/delete", method = RequestMethod.GET)
public String delete(@PathVariable Long prod_id, @PathVariable Long id) {
try {
attributeService.delete(id);
} catch (EmptyResultDataAccessException e) {
// record no longer exists - possibly deleted by another user
}
return "redirect:/product/" + prod_id;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String view(Model model,
@PathVariable Long prod_id, @PathVariable Long id,
@RequestParam(name = "page", defaultValue = "0") int page,
@RequestParam(name = "size", defaultValue = "6") int pageSize
) throws ProductNotFoundException, AttributeNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
Attribute attribute = attributeService.getAttribute(product, id); // throws AttributeNotFoundException
// requesting options separately (as opposed to using LAZY) allows the use of paging
Page<Option> options = attributeService.getOptions(attribute, new PageRequest(page, pageSize));
model.addAttribute("product", product);
model.addAttribute("attribute", attribute);
model.addAttribute("options", options);
return "attribute_view";
}
}
| UTF-8 | Java | 5,341 | java | AttributeController.java | Java | [] | null | [] | package hello.web.controllers;
import hello.domain.entity.enities.Attribute;
import hello.domain.entity.enities.Option;
import hello.domain.entity.enities.Product;
import hello.domain.service.AttributeService;
import hello.exceptions.AttributeNotFoundException;
import hello.exceptions.ProductNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@Controller
@RequestMapping("/product/{prod_id}/attribute")
public class AttributeController {
@Autowired
private AttributeService attributeService;
//-------------------------------------------------------
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String add(Model model,
@PathVariable Long prod_id
) throws ProductNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
model.addAttribute("product", product);
model.addAttribute("attribute", new Attribute());
return "attribute_add";
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
public String save(Model model,
@PathVariable Long prod_id,
@Valid Attribute attribute,
BindingResult result
) throws ProductNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
attribute.setProduct(product);
attributeService.save(attribute, result);
if (result.hasErrors()) {
model.addAttribute("product", product);
model.addAttribute("result", result);
return "attribute_add";
}
return "redirect:/product/" + product.getId() + "/attribute/" + attribute.getId();
}
@RequestMapping(value = "/{id}/edit", method = RequestMethod.GET)
public String edit(Model model,
@PathVariable Long prod_id,
@PathVariable Long id
) throws ProductNotFoundException, AttributeNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
Attribute attribute = attributeService.getAttribute(product, id); // throws AttributeNotFoundException
model.addAttribute("product", product);
model.addAttribute("attribute", attribute);
model.addAttribute("form", attribute);
return "attribute_edit";
}
@RequestMapping(value = "/{id}/edit", method = RequestMethod.POST)
public String update(Model model,
@PathVariable Long prod_id,
@Valid @ModelAttribute Attribute form,
BindingResult result
) throws ProductNotFoundException, AttributeNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
Attribute attribute = attributeService.getAttribute(product, form.getId()); // throws AttributeNotFoundException
form.setProduct(product);
form.setPosition(attribute.getPosition()); // not updated from the form
attributeService.save(form, result);
if (result.hasErrors()) {
model.addAttribute("product", product);
model.addAttribute("attribute", attribute); // to separate current values with new values
model.addAttribute("result", result);
return "attribute_edit";
}
return "redirect:/product/" + product.getId() + "/attribute/" + attribute.getId();
}
@RequestMapping(value = "/{id}/delete", method = RequestMethod.GET)
public String delete(@PathVariable Long prod_id, @PathVariable Long id) {
try {
attributeService.delete(id);
} catch (EmptyResultDataAccessException e) {
// record no longer exists - possibly deleted by another user
}
return "redirect:/product/" + prod_id;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String view(Model model,
@PathVariable Long prod_id, @PathVariable Long id,
@RequestParam(name = "page", defaultValue = "0") int page,
@RequestParam(name = "size", defaultValue = "6") int pageSize
) throws ProductNotFoundException, AttributeNotFoundException {
Product product = attributeService.getProduct(prod_id); // throws ProductNotFoundException
Attribute attribute = attributeService.getAttribute(product, id); // throws AttributeNotFoundException
// requesting options separately (as opposed to using LAZY) allows the use of paging
Page<Option> options = attributeService.getOptions(attribute, new PageRequest(page, pageSize));
model.addAttribute("product", product);
model.addAttribute("attribute", attribute);
model.addAttribute("options", options);
return "attribute_view";
}
}
| 5,341 | 0.671223 | 0.670848 | 115 | 45.443478 | 29.347748 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.852174 | false | false | 9 |
b648625fb059601b66ef3390549fa3634e3c1af2 | 33,492,155,029,573 | c8d07adfd059f32140901661345912fc55d39eaf | /spring-cloud/spring-cloud-consul-parent/spring-cloud-service-b/src/main/java/com/future/demo/spring/cloud/consul/ApiController.java | 4d7984fd0f66965856414973933d042f6c21d2f7 | [] | no_license | dexterleslie1/java-study | https://github.com/dexterleslie1/java-study | d1226beae9e60344eef42023e64affa8d423f2bc | 9aa96731311e147fd42b2a1d0756ea2d65feb872 | refs/heads/master | 2022-01-27T10:55:09.835000 | 2022-01-24T13:54:11 | 2022-01-24T13:54:11 | 143,236,269 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.future.demo.spring.cloud.consul;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
/**
*
*/
@RestController
public class ApiController {
@Autowired
CService service;
/**
*
* @param name
* @return
*/
@RequestMapping(value = "/api/v1/b/sayHello", method = RequestMethod.POST)
public String sayHello(@RequestParam(value = "name", defaultValue = "") String name) {
return service.sayHello(name);
}
}
| UTF-8 | Java | 727 | java | ApiController.java | Java | [] | null | [] | package com.future.demo.spring.cloud.consul;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
/**
*
*/
@RestController
public class ApiController {
@Autowired
CService service;
/**
*
* @param name
* @return
*/
@RequestMapping(value = "/api/v1/b/sayHello", method = RequestMethod.POST)
public String sayHello(@RequestParam(value = "name", defaultValue = "") String name) {
return service.sayHello(name);
}
}
| 727 | 0.729023 | 0.727648 | 26 | 26.961538 | 27.641218 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 9 |
617d3f8829341e5447e0de7b4d32e0b25a61ffab | 33,492,155,027,978 | 3355a8fe164cd22bf05a0c61226ac4b0aa58e1b8 | /src/main/java/pl/mkapiczy/usermanagerservice/domain/entity/AddressEntity.java | 9a3f6bfc75555a27a3ffa26ea5a28e582992c97f | [] | no_license | mkapiczy/user-manager-service | https://github.com/mkapiczy/user-manager-service | bb5570b8cd478e8515fe41a5e0ebe6811423b71a | d8559774d8120254a50169bb35b4749749823059 | refs/heads/master | 2023-07-25T00:08:00.862000 | 2020-10-07T15:05:22 | 2020-10-07T15:09:19 | 250,625,754 | 1 | 0 | null | false | 2023-07-07T21:48:31 | 2020-03-27T19:21:17 | 2022-06-24T07:03:24 | 2023-07-07T21:48:28 | 73 | 1 | 0 | 1 | Java | false | false | package pl.mkapiczy.usermanagerservice.domain.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity(name = "address")
public class AddressEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
private String street;
private String zipCode;
private String city;
private String country;
}
| UTF-8 | Java | 524 | java | AddressEntity.java | Java | [
{
"context": "package pl.mkapiczy.usermanagerservice.domain.entity;\n\nimport lombok.",
"end": 19,
"score": 0.5658404231071472,
"start": 13,
"tag": "USERNAME",
"value": "apiczy"
}
] | null | [] | package pl.mkapiczy.usermanagerservice.domain.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity(name = "address")
public class AddressEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
private String street;
private String zipCode;
private String city;
private String country;
}
| 524 | 0.757634 | 0.757634 | 24 | 20.833334 | 14.467397 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.458333 | false | false | 9 |
0016a91e79ad6ce6cae740f360fbede0bcfe1f59 | 19,164,144,131,165 | 81606a540205323ec920cf8c36c611ae376165c0 | /Clases/clase2/src/com/antonio/clase2/loops/WhileExPar.java | 0a01e211b3bf36a06d26d84947c4ce16a64c2d52 | [] | no_license | antonycrowley/CursoJava | https://github.com/antonycrowley/CursoJava | 510d1d89d4781f661f088a4ce1e1a3eceacdce76 | c3f802ecfbdeedc17485ea259519581ea4d32e5d | refs/heads/master | 2020-03-18T16:31:24.889000 | 2018-07-21T14:49:28 | 2018-07-21T14:49:28 | 134,970,566 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.antonio.clase2.loops;
/**
*
* @author Antonio
* Class WhileExPar
*/
public class WhileExPar {
public static void main(String[] args) {
//Impresion de numeros pares
int i = 0;
while(i <= 10) {
if(i == 0) {
i++;
} else if(i%2 == 0) {
System.out.println(i);
}
i++;
}
}
}
| UTF-8 | Java | 322 | java | WhileExPar.java | Java | [
{
"context": "kage com.antonio.clase2.loops;\n\n/**\n * \n * @author Antonio\n * Class WhileExPar\n */\n\npublic class WhileExPar ",
"end": 61,
"score": 0.9978412389755249,
"start": 54,
"tag": "NAME",
"value": "Antonio"
}
] | null | [] | package com.antonio.clase2.loops;
/**
*
* @author Antonio
* Class WhileExPar
*/
public class WhileExPar {
public static void main(String[] args) {
//Impresion de numeros pares
int i = 0;
while(i <= 10) {
if(i == 0) {
i++;
} else if(i%2 == 0) {
System.out.println(i);
}
i++;
}
}
}
| 322 | 0.543478 | 0.521739 | 24 | 12.416667 | 11.902089 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.583333 | false | false | 9 |
26dab2644bd44b62fea8f812ca1b71a672addb06 | 15,204,184,280,304 | 467fc1042a6cf517cce366f83eb1ebc2622cf8e4 | /SootTest/src/Test7.java | d98f589bdf6f22080240e07ba849c410cc19a294 | [] | no_license | Madhvi2/Program-Analysis | https://github.com/Madhvi2/Program-Analysis | 3ba614930935195c4c7d9f3972fe9b3a4cac7537 | e7d9a5c10c8c12736057b72e99a1508ac7b074d9 | refs/heads/master | 2021-01-17T20:00:39.538000 | 2016-08-08T15:56:29 | 2016-08-08T15:56:29 | 65,217,313 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class Test7
{
public static int globalVar = 0;
public void foo(String str,
int n)
{
int x = 0;
int y = n + 2;
String z = str + "foo";
this.globalVar = x;
}
}
| UTF-8 | Java | 208 | java | Test7.java | Java | [] | null | [] | public class Test7
{
public static int globalVar = 0;
public void foo(String str,
int n)
{
int x = 0;
int y = n + 2;
String z = str + "foo";
this.globalVar = x;
}
}
| 208 | 0.504808 | 0.485577 | 13 | 15 | 11.668498 | 34 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false | 9 |
1e5665ad05ca36e00e9ee9fe6ca01d71962799ab | 16,157,666,967,797 | e3c2fe549f6aea52d41cbfa7449cada75bf80b83 | /src/main/java/com/tian/designcode/callBack/async/Test_Async_Callback.java | 176c01b305ff74f98c171188905d836c97fc8765 | [] | no_license | tw0629/springbootdesignpattern | https://github.com/tw0629/springbootdesignpattern | 5acab9eca74deccf95b756f26bff426971069c44 | dc4c56e26b437763638bcfff2e52be3e80df31ad | refs/heads/master | 2022-06-30T04:35:33.103000 | 2021-07-07T07:13:57 | 2021-07-07T07:13:57 | 191,096,894 | 1 | 0 | null | false | 2022-06-17T03:33:16 | 2019-06-10T04:32:34 | 2021-07-07T07:14:08 | 2022-06-17T03:33:16 | 133 | 0 | 0 | 4 | Java | false | false | package com.tian.designcode.callBack.async;
/**
* @author David Tian
* @desc
* @since 2021-01-02 17:27
*/
public class Test_Async_Callback {
public static void main(String[] args) {
Store lawson = new Store("沙中路罗森便利店");
AsyncBuyer asyncBuyer = new AsyncBuyer(lawson, "cherry", "变形金刚");
System.out.println(asyncBuyer.orderGoods());
}
}
| UTF-8 | Java | 398 | java | Test_Async_Callback.java | Java | [
{
"context": "m.tian.designcode.callBack.async;\n\n\n/**\n * @author David Tian\n * @desc\n * @since 2021-01-02 17:27\n */\npublic cl",
"end": 71,
"score": 0.9997358322143555,
"start": 61,
"tag": "NAME",
"value": "David Tian"
}
] | null | [] | package com.tian.designcode.callBack.async;
/**
* @author <NAME>
* @desc
* @since 2021-01-02 17:27
*/
public class Test_Async_Callback {
public static void main(String[] args) {
Store lawson = new Store("沙中路罗森便利店");
AsyncBuyer asyncBuyer = new AsyncBuyer(lawson, "cherry", "变形金刚");
System.out.println(asyncBuyer.orderGoods());
}
}
| 394 | 0.649733 | 0.617647 | 16 | 22.375 | 22.657434 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false | 9 |
ce638a327e1d26acd6fe5dfdbcd7d58ad058ce42 | 30,932,354,526,118 | 5a52afa41ad8d0b2ee41cd647befbb9358362bcb | /ThursdayTask-Week-39/task2/2.a/Main.java | 527274ea01e403781843cc03a668e55044c309e0 | [] | no_license | rasm445f/ThursdayTask | https://github.com/rasm445f/ThursdayTask | 9c3b48d794b7a938cac14790cdfc60b753be02a7 | 71066df5075bfbf4e03cf20ab969505e8db60b1f | refs/heads/main | 2023-08-20T17:58:06.429000 | 2021-10-28T16:12:29 | 2021-10-28T16:12:29 | 404,730,808 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | class Main{
public static boolean happy = true;
public static void main(String [] args) {
if (iAmHappy())
{
System.out.println("I clap my hands");
}
else
{
System.out.println("I don't clap my hands");
}
}
public static boolean iAmHappy()
{
// fill out what is missing here:
if(happy == true)
return true;
else
return false;
}
}
| UTF-8 | Java | 439 | java | Main.java | Java | [] | null | [] | class Main{
public static boolean happy = true;
public static void main(String [] args) {
if (iAmHappy())
{
System.out.println("I clap my hands");
}
else
{
System.out.println("I don't clap my hands");
}
}
public static boolean iAmHappy()
{
// fill out what is missing here:
if(happy == true)
return true;
else
return false;
}
}
| 439 | 0.519362 | 0.519362 | 25 | 16.48 | 15.65917 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 9 |
af901658c151bc0a4b7cb0b69d6d272eb08ca826 | 12,567,074,314,233 | bbb773e0c672f818c47d7256575db1b705d5a682 | /workspace/Inheritance/src/Child2.java | 9f2a00459206a4d12628b022b4713549b3063f40 | [] | no_license | mazangishin/KJH-s-gitRepository | https://github.com/mazangishin/KJH-s-gitRepository | 9e2ce2ab7900d03959c1fd0c32357d70d050c527 | 9863318dda216d1c175c1438dd6976f333a0d5dd | refs/heads/master | 2020-04-13T03:51:48.109000 | 2019-04-26T09:56:10 | 2019-04-26T09:56:10 | 162,944,252 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Child2 extends Parent {
void study () {
System.out.println("공부하자~! ^^");
}
}
| UTF-8 | Java | 113 | java | Child2.java | Java | [] | null | [] |
public class Child2 extends Parent {
void study () {
System.out.println("공부하자~! ^^");
}
}
| 113 | 0.561905 | 0.552381 | 10 | 9.4 | 13.551384 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 9 |
bc7d880192732deea79462666fa47d3aff3c2f79 | 13,761,075,246,540 | c23bf9f6fcd994e8397453dc93d6a680ffdd06fa | /src/main/java/com/example/service/DirectoryService.java | 66f25dd46ac64e3e905d1e6dfe50235644f72087 | [] | no_license | BirteaBogdan/TelephoneDirectory | https://github.com/BirteaBogdan/TelephoneDirectory | 87bbe6fe68a5e5388ec4ddfcda254088d3b8fcc6 | dd095e44cb1b3bdda3b8d63157f6c9849c1ebb38 | refs/heads/master | 2022-11-26T10:47:02.746000 | 2020-07-24T23:28:53 | 2020-07-24T23:28:53 | 277,579,838 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.service;
import java.util.List;
import java.util.Optional;
import com.example.model.Directory;
public interface DirectoryService {
public List<Directory> getContactList();
public void saveContact(Directory contact);
public void deleteById(int directoryId);
public void editContact(Directory contact);
public Optional<Directory> getDirectoryById(int directoryId);
}
| UTF-8 | Java | 402 | java | DirectoryService.java | Java | [] | null | [] | package com.example.service;
import java.util.List;
import java.util.Optional;
import com.example.model.Directory;
public interface DirectoryService {
public List<Directory> getContactList();
public void saveContact(Directory contact);
public void deleteById(int directoryId);
public void editContact(Directory contact);
public Optional<Directory> getDirectoryById(int directoryId);
}
| 402 | 0.793532 | 0.793532 | 20 | 19.1 | 20.223501 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.85 | false | false | 9 |
68bcd9d7fe180ae0211ebd4579000f26736a2479 | 12,524,124,662,424 | 24c2a994d836580a4efaf0e4f5a886a4a49ee44f | /src/main/java/com/project/neo/history/controller/PersonController.java | 68528a687cb1befb8242c4728c3385e9522a57a5 | [] | no_license | PeterYCZ/history-web | https://github.com/PeterYCZ/history-web | 494f96f49630bb4c726fee8b17a4b055e23587dc | 84e071fb301a9322aedc0d8baef5d44d7004d04e | refs/heads/main | 2023-02-08T14:52:34.598000 | 2020-12-10T13:33:28 | 2020-12-10T13:33:28 | 318,734,149 | 0 | 0 | null | false | 2020-12-10T13:33:29 | 2020-12-05T07:59:59 | 2020-12-05T08:02:34 | 2020-12-10T13:33:29 | 19 | 0 | 0 | 0 | Java | false | false | package com.project.neo.history.controller;
import com.project.neo.history.config.StorageProperties;
import com.project.neo.history.entity.PartnerRelationship;
import com.project.neo.history.entity.Person;
import com.project.neo.history.entity.PersonDetail;
import com.project.neo.history.service.FileSystemStorageService;
import com.project.neo.history.service.PersonRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
import java.util.UUID;
@RestController
public class PersonController {
@Autowired
private FileSystemStorageService fileSystemStorageService;
@Autowired
private StorageProperties properties;
@Autowired
private PersonRepository personRepository;
@GetMapping("/api/v1/getPersonDetails/{name}")
public PersonDetail getPersonDetails(@PathVariable String name){
return personRepository.getDetailsByName(name);
}
@PostMapping("/api/v1/uploadPortrait")
public String uploadPortrait(@RequestParam("file") MultipartFile file){
String realName = file.getOriginalFilename();
LocalDateTime localDateTime = LocalDateTime.now();
String uuid = UUID.randomUUID().toString().substring(0,6);
String path = properties.getLocation()+"/"+realName;
fileSystemStorageService.store(file);
return path;
}
@PostMapping("/api/v1/insert")
public Person insertPerson(@RequestBody Person person){
String name = person.getName();
Integer birthyear = person.getBirthyear();
Integer deathyear = person.getDeathyear();
String path = person.getPortrait();
String lifeStory = person.getLifeStory();
return personRepository.inertPerson(name,birthyear,deathyear,path,lifeStory);
}
@PostMapping("/api/v1/create/relationship/")
public PersonDetail createPartner(@RequestBody PartnerRelationship partnerRelationship){
String husband = partnerRelationship.getHusband();
String wife = partnerRelationship.getWife();
return personRepository.createPartner(husband,wife);
}
}
| UTF-8 | Java | 2,222 | java | PersonController.java | Java | [] | null | [] | package com.project.neo.history.controller;
import com.project.neo.history.config.StorageProperties;
import com.project.neo.history.entity.PartnerRelationship;
import com.project.neo.history.entity.Person;
import com.project.neo.history.entity.PersonDetail;
import com.project.neo.history.service.FileSystemStorageService;
import com.project.neo.history.service.PersonRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
import java.util.UUID;
@RestController
public class PersonController {
@Autowired
private FileSystemStorageService fileSystemStorageService;
@Autowired
private StorageProperties properties;
@Autowired
private PersonRepository personRepository;
@GetMapping("/api/v1/getPersonDetails/{name}")
public PersonDetail getPersonDetails(@PathVariable String name){
return personRepository.getDetailsByName(name);
}
@PostMapping("/api/v1/uploadPortrait")
public String uploadPortrait(@RequestParam("file") MultipartFile file){
String realName = file.getOriginalFilename();
LocalDateTime localDateTime = LocalDateTime.now();
String uuid = UUID.randomUUID().toString().substring(0,6);
String path = properties.getLocation()+"/"+realName;
fileSystemStorageService.store(file);
return path;
}
@PostMapping("/api/v1/insert")
public Person insertPerson(@RequestBody Person person){
String name = person.getName();
Integer birthyear = person.getBirthyear();
Integer deathyear = person.getDeathyear();
String path = person.getPortrait();
String lifeStory = person.getLifeStory();
return personRepository.inertPerson(name,birthyear,deathyear,path,lifeStory);
}
@PostMapping("/api/v1/create/relationship/")
public PersonDetail createPartner(@RequestBody PartnerRelationship partnerRelationship){
String husband = partnerRelationship.getHusband();
String wife = partnerRelationship.getWife();
return personRepository.createPartner(husband,wife);
}
}
| 2,222 | 0.748425 | 0.745725 | 61 | 35.426231 | 25.939058 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.606557 | false | false | 9 |
26aadde2099b3c55ceb34b0a6603e5126cfd6a9a | 7,310,034,394,075 | ba3f262013c98b12c178107fbf1ff7bebd61f5fa | /Pictem/src/main/java/com/pictem/common/LoadConfig.java | 618ace706f300302c91ae17a7285e21e7bd7a5d6 | [] | no_license | liukanglucky/pictem | https://github.com/liukanglucky/pictem | fa1d231c7dd6ff16cc777394077090ad86101912 | 8b2f7258619cea3c2a8871de3f2959b8a15e152e | refs/heads/master | 2021-01-10T08:44:24.700000 | 2015-12-19T13:37:09 | 2015-12-19T13:37:09 | 45,838,424 | 0 | 2 | null | false | 2015-11-14T13:29:13 | 2015-11-09T13:07:10 | 2015-11-09T13:14:02 | 2015-11-14T13:29:12 | 0 | 0 | 2 | 0 | Java | null | null | package com.pictem.common;
import com.pictem.common.BaseConfig;
public class LoadConfig extends BaseConfig{
/** 上传系统标志 当前系统 1-外网上传,2-内网上传 **/
private static int uploadType;
private static String uploadFilePath;
private static String sendUser;
private static String sendUname;
private static String sendPwd;
private static String keySmtp;
private static String valueSmtp;
private static String keyProps;
private static boolean valueProps;
public static int getUploadType() {
return uploadType;
}
public static void setUploadType(int uploadType) {
LoadConfig.uploadType = uploadType;
}
public static String getSendUser() {
return sendUser;
}
public static void setSendUser(String sendUser) {
LoadConfig.sendUser = sendUser;
}
public static String getSendUname() {
return sendUname;
}
public static void setSendUname(String sendUname) {
LoadConfig.sendUname = sendUname;
}
public static String getSendPwd() {
return sendPwd;
}
public static void setSendPwd(String sendPwd) {
LoadConfig.sendPwd = sendPwd;
}
public static String getKeySmtp() {
return keySmtp;
}
public static void setKeySmtp(String keySmtp) {
LoadConfig.keySmtp = keySmtp;
}
public static String getValueSmtp() {
return valueSmtp;
}
public static void setValueSmtp(String valueSmtp) {
LoadConfig.valueSmtp = valueSmtp;
}
public static String getKeyProps() {
return keyProps;
}
public static void setKeyProps(String keyProps) {
LoadConfig.keyProps = keyProps;
}
public static boolean getValueProps() {
return valueProps;
}
public static void setValueProps(boolean valueProps) {
LoadConfig.valueProps = valueProps;
}
private static String FILE_PATH = "conf/constant.properties";
static {
loadValue(FILE_PATH, new LoadConfig());
}
/**
* 重新加载配置
*
* @author fantasy
* @date 2013-9-23
*/
public static void reloadValue() {
reloadValue(FILE_PATH, new LoadConfig());
}
public static int getFusysType() {
return uploadType;
}
public static void setFusysType(int fusysType) {
LoadConfig.uploadType = fusysType;
}
public static String getUploadFilePath() {
return uploadFilePath;
}
public static void setUploadFilePath(String uploadFilePath) {
LoadConfig.uploadFilePath = uploadFilePath;
}
}
| UTF-8 | Java | 2,353 | java | LoadConfig.java | Java | [
{
"context": "oadConfig());\n\t}\n\n\t/**\n\t * 重新加载配置\n\t * \n\t * @author fantasy\n\t * @date 2013-9-23\n\t */\n\tpublic static void relo",
"end": 1854,
"score": 0.999569296836853,
"start": 1847,
"tag": "USERNAME",
"value": "fantasy"
}
] | null | [] | package com.pictem.common;
import com.pictem.common.BaseConfig;
public class LoadConfig extends BaseConfig{
/** 上传系统标志 当前系统 1-外网上传,2-内网上传 **/
private static int uploadType;
private static String uploadFilePath;
private static String sendUser;
private static String sendUname;
private static String sendPwd;
private static String keySmtp;
private static String valueSmtp;
private static String keyProps;
private static boolean valueProps;
public static int getUploadType() {
return uploadType;
}
public static void setUploadType(int uploadType) {
LoadConfig.uploadType = uploadType;
}
public static String getSendUser() {
return sendUser;
}
public static void setSendUser(String sendUser) {
LoadConfig.sendUser = sendUser;
}
public static String getSendUname() {
return sendUname;
}
public static void setSendUname(String sendUname) {
LoadConfig.sendUname = sendUname;
}
public static String getSendPwd() {
return sendPwd;
}
public static void setSendPwd(String sendPwd) {
LoadConfig.sendPwd = sendPwd;
}
public static String getKeySmtp() {
return keySmtp;
}
public static void setKeySmtp(String keySmtp) {
LoadConfig.keySmtp = keySmtp;
}
public static String getValueSmtp() {
return valueSmtp;
}
public static void setValueSmtp(String valueSmtp) {
LoadConfig.valueSmtp = valueSmtp;
}
public static String getKeyProps() {
return keyProps;
}
public static void setKeyProps(String keyProps) {
LoadConfig.keyProps = keyProps;
}
public static boolean getValueProps() {
return valueProps;
}
public static void setValueProps(boolean valueProps) {
LoadConfig.valueProps = valueProps;
}
private static String FILE_PATH = "conf/constant.properties";
static {
loadValue(FILE_PATH, new LoadConfig());
}
/**
* 重新加载配置
*
* @author fantasy
* @date 2013-9-23
*/
public static void reloadValue() {
reloadValue(FILE_PATH, new LoadConfig());
}
public static int getFusysType() {
return uploadType;
}
public static void setFusysType(int fusysType) {
LoadConfig.uploadType = fusysType;
}
public static String getUploadFilePath() {
return uploadFilePath;
}
public static void setUploadFilePath(String uploadFilePath) {
LoadConfig.uploadFilePath = uploadFilePath;
}
}
| 2,353 | 0.735562 | 0.731654 | 123 | 17.723577 | 18.735775 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.243902 | false | false | 9 |
75ce4437591ef76d05c66d5cdcfee335f1b1efbf | 16,612,933,506,165 | b40b2561c3d8c5c44e64f30584ac591c827c1c08 | /PracticeDraw1/app/src/main/java/com/hencoder/hencoderpracticedraw1/practice/Practice11PieChartView.java | 882f50c86b4aa62e2e06b9234fa04edcf97e9d13 | [
"Apache-2.0"
] | permissive | xfhy/CustomView | https://github.com/xfhy/CustomView | 5310827af4bd6ba8c7bce41007940a5bf201349a | 2701f9267b84d9f20f310f993e6412c4ee1f6a2f | refs/heads/master | 2020-03-23T17:22:17.008000 | 2018-09-07T08:02:38 | 2018-09-07T08:02:38 | 141,856,618 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hencoder.hencoderpracticedraw1.practice;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import com.hencoder.hencoderpracticedraw1.model.CircleModel;
import java.util.ArrayList;
import java.util.List;
/**
* 2018年7月28日09:04:37
* <p>
* 圆饼图
*/
public class Practice11PieChartView extends View {
private static final int DEFAULT_TOP_BOTTOM_PADDING = 30;
private static final float DEFAULT_LINE_WIDTH = 3;
private List<CircleModel> mCircleModelList = new ArrayList<>();
private Paint mArcPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint mLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
/**
* 圆形半径
*/
private static final int RADIUS = 200;
/**
* 圆形区域
*/
private RectF mCircleRectF;
private static final float LINE_LENGTH = 50;
public Practice11PieChartView(Context context) {
this(context, null);
}
public Practice11PieChartView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public Practice11PieChartView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView();
}
private void initView() {
mLinePaint.setStrokeWidth(DEFAULT_LINE_WIDTH);
mLinePaint.setColor(Color.WHITE);
mTextPaint.setColor(Color.WHITE);
mTextPaint.setTextSize(12);
//圆形区域
mCircleRectF = new RectF(-RADIUS, -RADIUS, RADIUS, RADIUS);
getTestData();
}
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 综合练习
// 练习内容:使用各种 Canvas.drawXXX() 方法画饼图
int size = mCircleModelList.size();
canvas.translate(getWidth() / 2, getHeight() / 2);// 画布移到中心
float startAngle = 0;
for (int i = 0; i < size; i++) {
CircleModel circleModel = mCircleModelList.get(i);
// 扇形的中心线相对于坐标系的角度(0~2π)
double theta = (startAngle + circleModel.angle / 2) * Math.PI / 180;
drawContent(canvas, startAngle, theta, circleModel);
startAngle = startAngle + circleModel.angle;
}
}
private void drawContent(Canvas canvas, float startAngle, double theta, CircleModel circleModel) {
// 画扇形
mArcPaint.setColor(circleModel.color);
canvas.drawArc(mCircleRectF, startAngle, circleModel.angle, true, mArcPaint);
// 画斜线
float lineStartX = (float) (RADIUS * Math.cos(theta));
float lineStartY = (float) (RADIUS * Math.sin(theta));
float lineStopX = (float) ((RADIUS + LINE_LENGTH) * Math.cos(theta));
float lineStopY = (float) ((RADIUS + LINE_LENGTH) * Math.sin(theta));
canvas.drawLine(lineStartX, lineStartY, lineStopX, lineStopY, mLinePaint);
// 画横线和文字
float lineEndX;
Rect r = getTextBounds(circleModel.name, mTextPaint);
if (theta > Math.PI / 2 && theta <= Math.PI * 3 / 2) {// 左半边,往左画横线
lineEndX = lineStopX - LINE_LENGTH;
// 画线
canvas.drawLine(lineStopX, lineStopY, lineEndX, lineStopY, mLinePaint);
// 画文字
canvas.drawText(circleModel.name, lineEndX - r.width() - 10, lineStopY + r.height() / 2, mTextPaint);
} else {// 往右画横线
lineEndX = lineStopX + LINE_LENGTH;
// 画线
canvas.drawLine(lineStopX, lineStopY, lineEndX, lineStopY, mLinePaint);
// 文字
canvas.drawText(circleModel.name, lineEndX + 10, lineStopY + r.height() / 2, mTextPaint);
}
}
/**
* 测量文字大小
*
* @param text
* @param paint
* @return
*/
private Rect getTextBounds(String text, Paint paint) {
Rect rect = new Rect();
paint.getTextBounds(text, 0, text.length(), rect);
return rect;
}
public List<CircleModel> getCircleModelList() {
return mCircleModelList;
}
public void setCircleModelList(List<CircleModel> circleModelList) {
if (circleModelList == null) {
return;
}
mCircleModelList = circleModelList;
int allSize = 0;
for (CircleModel circleModel : mCircleModelList) {
allSize += circleModel.size;
}
//计算每个弧形所占角度
for (CircleModel circleModel : mCircleModelList) {
circleModel.angle = (float) (circleModel.size / (allSize * 1.0) * 360);
}
invalidate();
}
private void getTestData() {
List<CircleModel> circleModels = new ArrayList<>();
circleModels.add(new CircleModel("香蕉", 45, Color.parseColor("#FFE4C4")));
circleModels.add(new CircleModel("苹果", 46, Color.parseColor("#FAEBD7")));
circleModels.add(new CircleModel("草莓", 58, Color.parseColor("#EEA9B8")));
circleModels.add(new CircleModel("菠萝", 25, Color.parseColor("#DAA520")));
circleModels.add(new CircleModel("梨子", 10, Color.parseColor("#D1EEEE")));
circleModels.add(new CircleModel("百香果", 3, Color.parseColor("#CD2626")));
circleModels.add(new CircleModel("西瓜", 79, Color.parseColor("#B5B5B5")));
mCircleModelList = circleModels;
int allSize = 0;
for (CircleModel circleModel : mCircleModelList) {
allSize += circleModel.size;
}
//计算每个弧形所占角度
for (CircleModel circleModel : mCircleModelList) {
circleModel.angle = (float) (circleModel.size / (allSize * 1.0) * 360);
}
}
}
| UTF-8 | Java | 6,137 | java | Practice11PieChartView.java | Java | [] | null | [] | package com.hencoder.hencoderpracticedraw1.practice;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import com.hencoder.hencoderpracticedraw1.model.CircleModel;
import java.util.ArrayList;
import java.util.List;
/**
* 2018年7月28日09:04:37
* <p>
* 圆饼图
*/
public class Practice11PieChartView extends View {
private static final int DEFAULT_TOP_BOTTOM_PADDING = 30;
private static final float DEFAULT_LINE_WIDTH = 3;
private List<CircleModel> mCircleModelList = new ArrayList<>();
private Paint mArcPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint mLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
/**
* 圆形半径
*/
private static final int RADIUS = 200;
/**
* 圆形区域
*/
private RectF mCircleRectF;
private static final float LINE_LENGTH = 50;
public Practice11PieChartView(Context context) {
this(context, null);
}
public Practice11PieChartView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public Practice11PieChartView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView();
}
private void initView() {
mLinePaint.setStrokeWidth(DEFAULT_LINE_WIDTH);
mLinePaint.setColor(Color.WHITE);
mTextPaint.setColor(Color.WHITE);
mTextPaint.setTextSize(12);
//圆形区域
mCircleRectF = new RectF(-RADIUS, -RADIUS, RADIUS, RADIUS);
getTestData();
}
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 综合练习
// 练习内容:使用各种 Canvas.drawXXX() 方法画饼图
int size = mCircleModelList.size();
canvas.translate(getWidth() / 2, getHeight() / 2);// 画布移到中心
float startAngle = 0;
for (int i = 0; i < size; i++) {
CircleModel circleModel = mCircleModelList.get(i);
// 扇形的中心线相对于坐标系的角度(0~2π)
double theta = (startAngle + circleModel.angle / 2) * Math.PI / 180;
drawContent(canvas, startAngle, theta, circleModel);
startAngle = startAngle + circleModel.angle;
}
}
private void drawContent(Canvas canvas, float startAngle, double theta, CircleModel circleModel) {
// 画扇形
mArcPaint.setColor(circleModel.color);
canvas.drawArc(mCircleRectF, startAngle, circleModel.angle, true, mArcPaint);
// 画斜线
float lineStartX = (float) (RADIUS * Math.cos(theta));
float lineStartY = (float) (RADIUS * Math.sin(theta));
float lineStopX = (float) ((RADIUS + LINE_LENGTH) * Math.cos(theta));
float lineStopY = (float) ((RADIUS + LINE_LENGTH) * Math.sin(theta));
canvas.drawLine(lineStartX, lineStartY, lineStopX, lineStopY, mLinePaint);
// 画横线和文字
float lineEndX;
Rect r = getTextBounds(circleModel.name, mTextPaint);
if (theta > Math.PI / 2 && theta <= Math.PI * 3 / 2) {// 左半边,往左画横线
lineEndX = lineStopX - LINE_LENGTH;
// 画线
canvas.drawLine(lineStopX, lineStopY, lineEndX, lineStopY, mLinePaint);
// 画文字
canvas.drawText(circleModel.name, lineEndX - r.width() - 10, lineStopY + r.height() / 2, mTextPaint);
} else {// 往右画横线
lineEndX = lineStopX + LINE_LENGTH;
// 画线
canvas.drawLine(lineStopX, lineStopY, lineEndX, lineStopY, mLinePaint);
// 文字
canvas.drawText(circleModel.name, lineEndX + 10, lineStopY + r.height() / 2, mTextPaint);
}
}
/**
* 测量文字大小
*
* @param text
* @param paint
* @return
*/
private Rect getTextBounds(String text, Paint paint) {
Rect rect = new Rect();
paint.getTextBounds(text, 0, text.length(), rect);
return rect;
}
public List<CircleModel> getCircleModelList() {
return mCircleModelList;
}
public void setCircleModelList(List<CircleModel> circleModelList) {
if (circleModelList == null) {
return;
}
mCircleModelList = circleModelList;
int allSize = 0;
for (CircleModel circleModel : mCircleModelList) {
allSize += circleModel.size;
}
//计算每个弧形所占角度
for (CircleModel circleModel : mCircleModelList) {
circleModel.angle = (float) (circleModel.size / (allSize * 1.0) * 360);
}
invalidate();
}
private void getTestData() {
List<CircleModel> circleModels = new ArrayList<>();
circleModels.add(new CircleModel("香蕉", 45, Color.parseColor("#FFE4C4")));
circleModels.add(new CircleModel("苹果", 46, Color.parseColor("#FAEBD7")));
circleModels.add(new CircleModel("草莓", 58, Color.parseColor("#EEA9B8")));
circleModels.add(new CircleModel("菠萝", 25, Color.parseColor("#DAA520")));
circleModels.add(new CircleModel("梨子", 10, Color.parseColor("#D1EEEE")));
circleModels.add(new CircleModel("百香果", 3, Color.parseColor("#CD2626")));
circleModels.add(new CircleModel("西瓜", 79, Color.parseColor("#B5B5B5")));
mCircleModelList = circleModels;
int allSize = 0;
for (CircleModel circleModel : mCircleModelList) {
allSize += circleModel.size;
}
//计算每个弧形所占角度
for (CircleModel circleModel : mCircleModelList) {
circleModel.angle = (float) (circleModel.size / (allSize * 1.0) * 360);
}
}
}
| 6,137 | 0.629131 | 0.612947 | 176 | 32.352272 | 28.486057 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.789773 | false | false | 9 |
d46ee8a45f456bd8a0d31c633447f6b4d9bbda1f | 19,636,590,536,113 | 90b5dfd3e7e6e2d458114d1efb8a940a282bc0ff | /app/src/main/java/es/jspsoluciones/repartos/zonas/Zonas.java | 8b0d9edc8b9c7d82d4b0e8d02f45292defd11b82 | [] | no_license | shamandul/Repartos | https://github.com/shamandul/Repartos | 00ba2777c81056b1d756acf2310c75cc4a140e42 | 3b39cd25bf4bb352a0389e90837264853a04346b | refs/heads/master | 2021-01-10T04:16:14.946000 | 2016-03-08T18:53:44 | 2016-03-08T18:53:44 | 51,251,552 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package es.jspsoluciones.repartos.zonas;
/**
* Created by jesus on 13/02/16.
*/
public class Zonas {
private int _idZona;
private String nombreZona;
/**
* Obtener _idZona
* @return String
*/
public int get_idZona() {
return _idZona;
}
/**
* Agregar el _idZona
* @param _idZona tipo int
*/
public void set_idZona(int _idZona) {
this._idZona = _idZona;
}
/**
* Obtener el nombreZona
* @return String
*/
public String getNombreZona() {
return nombreZona;
}
/**
* Agregar el nombreZona
* @param nombreZona tipo String
*/
public void setNombreZona(String nombreZona) {
this.nombreZona = nombreZona;
}
}
| UTF-8 | Java | 753 | java | Zonas.java | Java | [
{
"context": "s.jspsoluciones.repartos.zonas;\n\n/**\n * Created by jesus on 13/02/16.\n */\npublic class Zonas {\n private",
"end": 65,
"score": 0.9991616606712341,
"start": 60,
"tag": "USERNAME",
"value": "jesus"
}
] | null | [] | package es.jspsoluciones.repartos.zonas;
/**
* Created by jesus on 13/02/16.
*/
public class Zonas {
private int _idZona;
private String nombreZona;
/**
* Obtener _idZona
* @return String
*/
public int get_idZona() {
return _idZona;
}
/**
* Agregar el _idZona
* @param _idZona tipo int
*/
public void set_idZona(int _idZona) {
this._idZona = _idZona;
}
/**
* Obtener el nombreZona
* @return String
*/
public String getNombreZona() {
return nombreZona;
}
/**
* Agregar el nombreZona
* @param nombreZona tipo String
*/
public void setNombreZona(String nombreZona) {
this.nombreZona = nombreZona;
}
}
| 753 | 0.561753 | 0.553785 | 41 | 17.365854 | 14.127911 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.170732 | false | false | 9 |
e45afddbfc001f7141417c61c51f9e971702e712 | 18,829,136,668,674 | 1399d49517dff3d127627aea7e84d9c47760ce3a | /src/main/java/com/alexprut/algo/algorithms/graph/mst/Prim.java | 7184eac92d869c6e8cc105ad0a5d9a7cc37dea7c | [
"MIT"
] | permissive | mrdarshanbhatt/Algo | https://github.com/mrdarshanbhatt/Algo | 810144c0df88b99d8c9204af6123079da5bf4b5d | ac604f93875314d3ac7fd7ff80d31ae3e39b06db | refs/heads/master | 2023-02-21T01:47:29.035000 | 2020-12-06T21:01:10 | 2020-12-06T21:09:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.alexprut.algo.algorithms.graph.mst;
import com.alexprut.algo.datastructures.Pair;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
public class Prim {
private Prim() {}
/**
* Finds the minimum spanning tree (MST) of a weighted undirected graph.
*
* <p>Example:
*
* <pre>
* 3
* node0 ----- node1
* | |
* 2 | | 6
* | |
* node3 ----- node2
* 1
*
* The Minimum Spanning Tree is:
*
* 3
* node0 ----- node1
* |
* 2 |
* |
* node3 ----- node2
* 1
* </pre>
*
* <p>Time complexity: O(|E|log|V|)
*
* <p>Space complexity: O(|V|)
*
* @see <a
* href="https://en.wikipedia.org/wiki/Prim%27s_algorithm">https://en.wikipedia.org/wiki/Prim%27s_algorithm</a>
* @param adj the adjacency-matrix representation of the graph
* @param n the number of nodes
* @param start the root
* @return the minimum spanning tree
*/
public static int[] prim(List<List<Pair<Integer, Integer>>> adj, int n, int start) {
class CostNodePair extends Pair<Integer, Integer> implements Comparable<CostNodePair> {
CostNodePair(int cost, int node) {
super(cost, node);
}
public int compareTo(CostNodePair b) {
return (this.first() < b.first()) ? -1 : 1;
}
}
int[] parent = new int[n];
parent[start] = -1;
int[] key = new int[n];
Arrays.fill(key, Integer.MAX_VALUE);
key[start] = 0;
boolean[] visited = new boolean[n];
// TODO use MinHeap or FibonacciHeap
PriorityQueue<CostNodePair> minHeap = new PriorityQueue<>();
minHeap.add(new CostNodePair(0, start));
int counter = 0;
while (!minHeap.isEmpty() && counter < n) {
CostNodePair node = minHeap.poll();
int x = node.second();
counter++;
if (!visited[x]) {
visited[x] = true;
for (int i = 0; i < adj.get(x).size(); i++) {
int y = adj.get(x).get(i).first();
int w = adj.get(x).get(i).second();
if (!visited[y]) {
if (w < key[y]) {
key[y] = w;
parent[y] = x;
}
minHeap.add(new CostNodePair(key[y], y));
}
}
}
}
return parent;
}
}
| UTF-8 | Java | 2,344 | java | Prim.java | Java | [] | null | [] | package com.alexprut.algo.algorithms.graph.mst;
import com.alexprut.algo.datastructures.Pair;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
public class Prim {
private Prim() {}
/**
* Finds the minimum spanning tree (MST) of a weighted undirected graph.
*
* <p>Example:
*
* <pre>
* 3
* node0 ----- node1
* | |
* 2 | | 6
* | |
* node3 ----- node2
* 1
*
* The Minimum Spanning Tree is:
*
* 3
* node0 ----- node1
* |
* 2 |
* |
* node3 ----- node2
* 1
* </pre>
*
* <p>Time complexity: O(|E|log|V|)
*
* <p>Space complexity: O(|V|)
*
* @see <a
* href="https://en.wikipedia.org/wiki/Prim%27s_algorithm">https://en.wikipedia.org/wiki/Prim%27s_algorithm</a>
* @param adj the adjacency-matrix representation of the graph
* @param n the number of nodes
* @param start the root
* @return the minimum spanning tree
*/
public static int[] prim(List<List<Pair<Integer, Integer>>> adj, int n, int start) {
class CostNodePair extends Pair<Integer, Integer> implements Comparable<CostNodePair> {
CostNodePair(int cost, int node) {
super(cost, node);
}
public int compareTo(CostNodePair b) {
return (this.first() < b.first()) ? -1 : 1;
}
}
int[] parent = new int[n];
parent[start] = -1;
int[] key = new int[n];
Arrays.fill(key, Integer.MAX_VALUE);
key[start] = 0;
boolean[] visited = new boolean[n];
// TODO use MinHeap or FibonacciHeap
PriorityQueue<CostNodePair> minHeap = new PriorityQueue<>();
minHeap.add(new CostNodePair(0, start));
int counter = 0;
while (!minHeap.isEmpty() && counter < n) {
CostNodePair node = minHeap.poll();
int x = node.second();
counter++;
if (!visited[x]) {
visited[x] = true;
for (int i = 0; i < adj.get(x).size(); i++) {
int y = adj.get(x).get(i).first();
int w = adj.get(x).get(i).second();
if (!visited[y]) {
if (w < key[y]) {
key[y] = w;
parent[y] = x;
}
minHeap.add(new CostNodePair(key[y], y));
}
}
}
}
return parent;
}
}
| 2,344 | 0.526451 | 0.515358 | 94 | 23.936171 | 21.746023 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.553191 | false | false | 9 |
b81146c1b24c206062d4be4e7799bf385f544302 | 11,038,065,954,729 | 9b2b82faebf776a4c166b625849f9b0179f1f313 | /src/com/IFwarunkowe/Zadanie1.java | a2d5e183e2b3a27e27580816ce4f01c11b6712ec | [] | no_license | KlaudiaDurka/KursJavaSDA | https://github.com/KlaudiaDurka/KursJavaSDA | c8c9743e439fb1a0a8cc23ab357cec09d292a2dc | dbeb60422d56e96d16129777dd9252136d4c7d3c | refs/heads/main | 2023-04-25T15:45:38.171000 | 2021-05-12T17:05:58 | 2021-05-12T17:05:58 | 361,905,444 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.IFwarunkowe;
public class Zadanie1 {
public static void main(String[] args) {
int number = 99;
if (number > 100){
System.out.println("Liczba jest większa niż 100");
} else if (number == 100){
System.out.println("Liczba jest równa 100");
} else {
System.out.println("Liczba jest mniejsza niż 100");
}
}
}
| UTF-8 | Java | 406 | java | Zadanie1.java | Java | [] | null | [] | package com.IFwarunkowe;
public class Zadanie1 {
public static void main(String[] args) {
int number = 99;
if (number > 100){
System.out.println("Liczba jest większa niż 100");
} else if (number == 100){
System.out.println("Liczba jest równa 100");
} else {
System.out.println("Liczba jest mniejsza niż 100");
}
}
}
| 406 | 0.557214 | 0.512438 | 15 | 25.799999 | 21.254646 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 9 |
ae60b9b4e3e249441cb028270454f564e97b19a1 | 25,091,198,972,012 | a20bc6dc50c82ffdae32cbe90075c562f53534fa | /DemonetizationException.java | f37eeb987fd65ac6b835b7dc433ee0894b1dc359 | [] | no_license | VishalM23/JAVA- | https://github.com/VishalM23/JAVA- | fde43e55a2ffaa1bcb9ed33b5ae680f600120d30 | c95803625b936c0b4d26702f90fa7c6488d9f9f9 | refs/heads/master | 2020-12-10T17:38:37.132000 | 2020-08-15T13:05:31 | 2020-08-15T13:05:31 | 233,663,032 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class DemonetizationException extends Exception
{
float amount;
DemonetizationException(float amt)
{
amount=amt;
}
public String toString()
{
return "Deposit of old currency of Rs"+amount+"crosses 5000";
}
}
| UTF-8 | Java | 296 | java | DemonetizationException.java | Java | [] | null | [] | public class DemonetizationException extends Exception
{
float amount;
DemonetizationException(float amt)
{
amount=amt;
}
public String toString()
{
return "Deposit of old currency of Rs"+amount+"crosses 5000";
}
}
| 296 | 0.567568 | 0.554054 | 13 | 21.76923 | 21.782681 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | false | false | 9 |
859679ac30e0177e6a7face5d2778d0e4443a57d | 1,391,569,412,494 | 7398714c498444374047497fe2e9c9ad51239034 | /org/mozilla/javascript/ast/WhileLoop.java | 2d6d2957e41e425a6a666f671751e3cba0cc0a49 | [] | no_license | CheatBoss/InnerCore-horizon-sources | https://github.com/CheatBoss/InnerCore-horizon-sources | b3609694df499ccac5f133d64be03962f9f767ef | 84b72431e7cb702b7d929c61c340a8db07d6ece1 | refs/heads/main | 2023-04-07T07:30:19.725000 | 2021-04-10T01:23:04 | 2021-04-10T01:23:04 | 356,437,521 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.mozilla.javascript.ast;
public class WhileLoop extends Loop
{
private AstNode condition;
public WhileLoop() {
this.type = 117;
}
public WhileLoop(final int n) {
super(n);
this.type = 117;
}
public WhileLoop(final int n, final int n2) {
super(n, n2);
this.type = 117;
}
public AstNode getCondition() {
return this.condition;
}
public void setCondition(final AstNode condition) {
this.assertNotNull(condition);
(this.condition = condition).setParent(this);
}
@Override
public String toSource(final int n) {
final StringBuilder sb = new StringBuilder();
sb.append(this.makeIndent(n));
sb.append("while (");
sb.append(this.condition.toSource(0));
sb.append(") ");
if (this.body.getType() == 129) {
sb.append(this.body.toSource(n).trim());
sb.append("\n");
}
else {
sb.append("\n");
sb.append(this.body.toSource(n + 1));
}
return sb.toString();
}
@Override
public void visit(final NodeVisitor nodeVisitor) {
if (nodeVisitor.visit(this)) {
this.condition.visit(nodeVisitor);
this.body.visit(nodeVisitor);
}
}
}
| UTF-8 | Java | 1,353 | java | WhileLoop.java | Java | [] | null | [] | package org.mozilla.javascript.ast;
public class WhileLoop extends Loop
{
private AstNode condition;
public WhileLoop() {
this.type = 117;
}
public WhileLoop(final int n) {
super(n);
this.type = 117;
}
public WhileLoop(final int n, final int n2) {
super(n, n2);
this.type = 117;
}
public AstNode getCondition() {
return this.condition;
}
public void setCondition(final AstNode condition) {
this.assertNotNull(condition);
(this.condition = condition).setParent(this);
}
@Override
public String toSource(final int n) {
final StringBuilder sb = new StringBuilder();
sb.append(this.makeIndent(n));
sb.append("while (");
sb.append(this.condition.toSource(0));
sb.append(") ");
if (this.body.getType() == 129) {
sb.append(this.body.toSource(n).trim());
sb.append("\n");
}
else {
sb.append("\n");
sb.append(this.body.toSource(n + 1));
}
return sb.toString();
}
@Override
public void visit(final NodeVisitor nodeVisitor) {
if (nodeVisitor.visit(this)) {
this.condition.visit(nodeVisitor);
this.body.visit(nodeVisitor);
}
}
}
| 1,353 | 0.544715 | 0.53289 | 55 | 23.6 | 17.407 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.436364 | false | false | 9 |
e6bf65426af7b93d5c08b2c72eef1eaf9a6dd9e7 | 11,416,023,144,419 | 004221f9ced6969f69d7d7b0a753bdc6a5d2c96f | /modules/compiler/src/java/flex2/compiler/as3/reflect/Attributes.java | be8de3454197f11b032fab937b8278e611322c55 | [] | no_license | lancejpollard/flex | https://github.com/lancejpollard/flex | 8f1a057f0074eef0928b0863c306ae846e80abb5 | 3bc21b1f4fbdcd1a095bcc6ea16662b0884b507f | refs/heads/master | 2016-09-07T14:35:13.542000 | 2009-12-06T07:53:22 | 2009-12-06T07:53:22 | 310,375 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | ////////////////////////////////////////////////////////////////////////////////
//
// ADOBE SYSTEMS INCORPORATED
// Copyright 2005-2006 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package flex2.compiler.as3.reflect;
import macromedia.asc.parser.AttributeListNode;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
/**
* @author Clement Wong
*/
public final class Attributes implements flex2.compiler.abc.Attributes
{
Attributes(AttributeListNode attrs)
{
int size = attrs.namespace_ids.size();
if (size != 0)
{
namespaces = new HashSet<String>();
for (int j = 0; j < size; j++)
{
String ns_id = attrs.namespace_ids.get(j);
namespaces.add(ns_id);
}
}
hasIntrinsic = attrs.hasIntrinsic;
hasStatic = attrs.hasStatic;
hasFinal = attrs.hasFinal;
hasVirtual = attrs.hasVirtual;
hasOverride = attrs.hasOverride;
hasDynamic = attrs.hasDynamic;
hasNative = attrs.hasNative;
hasPrivate = attrs.hasPrivate;
hasProtected = attrs.hasProtected;
hasPublic = attrs.hasPublic;
hasInternal = attrs.hasInternal;
hasConst = attrs.hasConst;
hasFalse = attrs.hasFalse;
hasPrototype = attrs.hasPrototype;
}
private boolean hasIntrinsic;
private boolean hasStatic;
private boolean hasFinal;
private boolean hasVirtual;
private boolean hasOverride;
private boolean hasDynamic;
private boolean hasNative;
private boolean hasPrivate;
private boolean hasPublic;
private boolean hasProtected;
private boolean hasInternal;
private boolean hasConst;
private boolean hasFalse;
private boolean hasPrototype;
private Set<String> namespaces;
public boolean hasIntrinsic()
{
return hasIntrinsic;
}
public boolean hasStatic()
{
return hasStatic;
}
public boolean hasFinal()
{
return hasFinal;
}
public boolean hasVirtual()
{
return hasVirtual;
}
public boolean hasOverride()
{
return hasOverride;
}
public boolean hasDynamic()
{
return hasDynamic;
}
public boolean hasNative()
{
return hasNative;
}
public boolean hasPrivate()
{
return hasPrivate;
}
public boolean hasPublic()
{
return hasPublic;
}
public boolean hasProtected()
{
return hasProtected;
}
public boolean hasInternal()
{
return hasInternal;
}
public boolean hasConst()
{
return hasConst;
}
public boolean hasFalse()
{
return hasFalse;
}
public boolean hasPrototype()
{
return hasPrototype;
}
public boolean hasNamespace(String nsValue)
{
return namespaces != null && namespaces.contains(nsValue);
}
public Iterator<String> getNamespaces()
{
return namespaces == null ? null : namespaces.iterator();
}
void setHasConst()
{
this.hasConst = true;
}
}
| UTF-8 | Java | 2,929 | java | Attributes.java | Java | [
{
"context": "il.Iterator;\nimport java.util.Set;\n\n/**\n * @author Clement Wong\n */\npublic final class Attributes implements flex",
"end": 614,
"score": 0.9991633892059326,
"start": 602,
"tag": "NAME",
"value": "Clement Wong"
}
] | null | [] | ////////////////////////////////////////////////////////////////////////////////
//
// ADOBE SYSTEMS INCORPORATED
// Copyright 2005-2006 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package flex2.compiler.as3.reflect;
import macromedia.asc.parser.AttributeListNode;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
/**
* @author <NAME>
*/
public final class Attributes implements flex2.compiler.abc.Attributes
{
Attributes(AttributeListNode attrs)
{
int size = attrs.namespace_ids.size();
if (size != 0)
{
namespaces = new HashSet<String>();
for (int j = 0; j < size; j++)
{
String ns_id = attrs.namespace_ids.get(j);
namespaces.add(ns_id);
}
}
hasIntrinsic = attrs.hasIntrinsic;
hasStatic = attrs.hasStatic;
hasFinal = attrs.hasFinal;
hasVirtual = attrs.hasVirtual;
hasOverride = attrs.hasOverride;
hasDynamic = attrs.hasDynamic;
hasNative = attrs.hasNative;
hasPrivate = attrs.hasPrivate;
hasProtected = attrs.hasProtected;
hasPublic = attrs.hasPublic;
hasInternal = attrs.hasInternal;
hasConst = attrs.hasConst;
hasFalse = attrs.hasFalse;
hasPrototype = attrs.hasPrototype;
}
private boolean hasIntrinsic;
private boolean hasStatic;
private boolean hasFinal;
private boolean hasVirtual;
private boolean hasOverride;
private boolean hasDynamic;
private boolean hasNative;
private boolean hasPrivate;
private boolean hasPublic;
private boolean hasProtected;
private boolean hasInternal;
private boolean hasConst;
private boolean hasFalse;
private boolean hasPrototype;
private Set<String> namespaces;
public boolean hasIntrinsic()
{
return hasIntrinsic;
}
public boolean hasStatic()
{
return hasStatic;
}
public boolean hasFinal()
{
return hasFinal;
}
public boolean hasVirtual()
{
return hasVirtual;
}
public boolean hasOverride()
{
return hasOverride;
}
public boolean hasDynamic()
{
return hasDynamic;
}
public boolean hasNative()
{
return hasNative;
}
public boolean hasPrivate()
{
return hasPrivate;
}
public boolean hasPublic()
{
return hasPublic;
}
public boolean hasProtected()
{
return hasProtected;
}
public boolean hasInternal()
{
return hasInternal;
}
public boolean hasConst()
{
return hasConst;
}
public boolean hasFalse()
{
return hasFalse;
}
public boolean hasPrototype()
{
return hasPrototype;
}
public boolean hasNamespace(String nsValue)
{
return namespaces != null && namespaces.contains(nsValue);
}
public Iterator<String> getNamespaces()
{
return namespaces == null ? null : namespaces.iterator();
}
void setHasConst()
{
this.hasConst = true;
}
}
| 2,923 | 0.68351 | 0.679071 | 155 | 17.896774 | 18.16703 | 80 | false | false | 0 | 0 | 0 | 0 | 93 | 0.061113 | 1.406452 | false | false | 9 |
c7156149667781c2597fd5685b58bd1808d09108 | 34,084,860,470,409 | f5329b59547e7faf602f3f9c8e30a5b258a9c298 | /app/src/main/java/com/lx/hd/adapter/KuaiYunSiJiLieBiaoAdapter.java | bb8ca142c5a0f10d89e258d33fba67a4d2acac3b | [
"Apache-2.0"
] | permissive | zyhchinese/huodi_huzhu | https://github.com/zyhchinese/huodi_huzhu | 009139e0694e029cb818bfe7fcd2915e8b7e94b8 | 334ea5ff558b47b81f8b4689bce1311c5c4f068e | refs/heads/master | 2020-03-26T10:17:05.402000 | 2018-09-04T01:23:28 | 2018-09-04T01:23:28 | 144,789,869 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lx.hd.adapter;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.lx.hd.R;
import com.lx.hd.base.Constant;
import com.lx.hd.bean.KuaiYunSiJiLieBiaoEntity;
import com.lx.hd.ui.activity.LogisticsOrderDetailsActivity2s;
import java.util.List;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by Administrator on 2018/5/10.
*/
public class KuaiYunSiJiLieBiaoAdapter extends RecyclerView.Adapter<KuaiYunSiJiLieBiaoAdapter.ViewHolder>{
private Context context;
private List<KuaiYunSiJiLieBiaoEntity> list;
private XuZhongItem xuZhongItem;
private OnClickCall onClickCall;
private RequestOptions mOptions;
public KuaiYunSiJiLieBiaoAdapter(Context context, List<KuaiYunSiJiLieBiaoEntity> list) {
this.context=context;
this.list=list;
}
public interface XuZhongItem{
void onClick(int position);
}
public void setOnClickCall(OnClickCall onClickCall) {
this.onClickCall = onClickCall;
}
public interface OnClickCall{
void onClick(int position);
}
public void setXuZhongItem(XuZhongItem xuZhongItem) {
this.xuZhongItem = xuZhongItem;
}
@Override
public KuaiYunSiJiLieBiaoAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.kuaiyunsijiliebiao_item, parent, false);
ViewHolder viewHolder=new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(final KuaiYunSiJiLieBiaoAdapter.ViewHolder holder, final int position) {
mOptions = new RequestOptions()
.placeholder(R.mipmap.user_header_defult)
.error(R.mipmap.user_header_defult)
.fitCenter();
Glide.with(context).load(Constant.BASE_URL+list.get(position).getDriver_folder()+"/"+list.get(position).getDriver_autoname()).apply(mOptions).into(holder.img_touxiang);
holder.tv_name.setText(list.get(position).getDriver_name());
holder.tv_phone.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG);
holder.tv_phone.getPaint().setAntiAlias(true);
holder.tv_phone.setTextColor(Color.BLUE);
holder.tv_phone.setText(list.get(position).getDriver_phone());
holder.tv_phone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onClickCall!=null){
onClickCall.onClick(position);
}
}
});
if (list.get(position).getType().equals("1")){
holder.img_jiaobiao.setVisibility(View.VISIBLE);
}else {
holder.img_jiaobiao.setVisibility(View.GONE);
}
holder.tv_xingji.setText(list.get(position).getDriver_star()+"星");
holder.tv_jiaoyi.setText("交易"+list.get(position).getDriver_num()+"笔");
holder.img_xuanze.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
for (KuaiYunSiJiLieBiaoEntity entity:list){
entity.setType1(false);
}
if (holder.img_xuanze.isChecked()){
holder.img_xuanze.setButtonDrawable(R.mipmap.img_huodixuanze1);
list.get(position).setType1(true);
}else {
holder.img_xuanze.setButtonDrawable(R.mipmap.img_huodixuanze);
list.get(position).setType1(false);
}
notifyDataSetChanged();
if (xuZhongItem!=null){
xuZhongItem.onClick(position);
}
}
});
if (list.get(position).isType1()){
holder.img_xuanze.setButtonDrawable(R.mipmap.img_huodixuanze1);
holder.img_xuanze.setChecked(true);
}else {
holder.img_xuanze.setButtonDrawable(R.mipmap.img_huodixuanze);
holder.img_xuanze.setChecked(false);
}
}
@Override
public int getItemCount() {
return list.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
private CheckBox img_xuanze;
private CircleImageView img_touxiang;
private TextView tv_name,tv_phone,tv_xingji,tv_jiaoyi;
private ImageView img_jiaobiao;
public ViewHolder(View itemView) {
super(itemView);
img_xuanze= (CheckBox) itemView.findViewById(R.id.img_xuanze);
img_touxiang= (CircleImageView) itemView.findViewById(R.id.img_touxiang);
tv_name= (TextView) itemView.findViewById(R.id.tv_name);
tv_phone= (TextView) itemView.findViewById(R.id.tv_phone);
tv_xingji= (TextView) itemView.findViewById(R.id.tv_xingji);
tv_jiaoyi= (TextView) itemView.findViewById(R.id.tv_jiaoyi);
img_jiaobiao= (ImageView) itemView.findViewById(R.id.img_jiaobiao);
}
}
}
| UTF-8 | Java | 5,367 | java | KuaiYunSiJiLieBiaoAdapter.java | Java | [
{
"context": "ircleimageview.CircleImageView;\n\n/**\n * Created by Administrator on 2018/5/10.\n */\n\npublic class KuaiYunSiJiLieBia",
"end": 715,
"score": 0.6265383362770081,
"start": 702,
"tag": "NAME",
"value": "Administrator"
}
] | null | [] | package com.lx.hd.adapter;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.lx.hd.R;
import com.lx.hd.base.Constant;
import com.lx.hd.bean.KuaiYunSiJiLieBiaoEntity;
import com.lx.hd.ui.activity.LogisticsOrderDetailsActivity2s;
import java.util.List;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by Administrator on 2018/5/10.
*/
public class KuaiYunSiJiLieBiaoAdapter extends RecyclerView.Adapter<KuaiYunSiJiLieBiaoAdapter.ViewHolder>{
private Context context;
private List<KuaiYunSiJiLieBiaoEntity> list;
private XuZhongItem xuZhongItem;
private OnClickCall onClickCall;
private RequestOptions mOptions;
public KuaiYunSiJiLieBiaoAdapter(Context context, List<KuaiYunSiJiLieBiaoEntity> list) {
this.context=context;
this.list=list;
}
public interface XuZhongItem{
void onClick(int position);
}
public void setOnClickCall(OnClickCall onClickCall) {
this.onClickCall = onClickCall;
}
public interface OnClickCall{
void onClick(int position);
}
public void setXuZhongItem(XuZhongItem xuZhongItem) {
this.xuZhongItem = xuZhongItem;
}
@Override
public KuaiYunSiJiLieBiaoAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.kuaiyunsijiliebiao_item, parent, false);
ViewHolder viewHolder=new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(final KuaiYunSiJiLieBiaoAdapter.ViewHolder holder, final int position) {
mOptions = new RequestOptions()
.placeholder(R.mipmap.user_header_defult)
.error(R.mipmap.user_header_defult)
.fitCenter();
Glide.with(context).load(Constant.BASE_URL+list.get(position).getDriver_folder()+"/"+list.get(position).getDriver_autoname()).apply(mOptions).into(holder.img_touxiang);
holder.tv_name.setText(list.get(position).getDriver_name());
holder.tv_phone.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG);
holder.tv_phone.getPaint().setAntiAlias(true);
holder.tv_phone.setTextColor(Color.BLUE);
holder.tv_phone.setText(list.get(position).getDriver_phone());
holder.tv_phone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onClickCall!=null){
onClickCall.onClick(position);
}
}
});
if (list.get(position).getType().equals("1")){
holder.img_jiaobiao.setVisibility(View.VISIBLE);
}else {
holder.img_jiaobiao.setVisibility(View.GONE);
}
holder.tv_xingji.setText(list.get(position).getDriver_star()+"星");
holder.tv_jiaoyi.setText("交易"+list.get(position).getDriver_num()+"笔");
holder.img_xuanze.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
for (KuaiYunSiJiLieBiaoEntity entity:list){
entity.setType1(false);
}
if (holder.img_xuanze.isChecked()){
holder.img_xuanze.setButtonDrawable(R.mipmap.img_huodixuanze1);
list.get(position).setType1(true);
}else {
holder.img_xuanze.setButtonDrawable(R.mipmap.img_huodixuanze);
list.get(position).setType1(false);
}
notifyDataSetChanged();
if (xuZhongItem!=null){
xuZhongItem.onClick(position);
}
}
});
if (list.get(position).isType1()){
holder.img_xuanze.setButtonDrawable(R.mipmap.img_huodixuanze1);
holder.img_xuanze.setChecked(true);
}else {
holder.img_xuanze.setButtonDrawable(R.mipmap.img_huodixuanze);
holder.img_xuanze.setChecked(false);
}
}
@Override
public int getItemCount() {
return list.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
private CheckBox img_xuanze;
private CircleImageView img_touxiang;
private TextView tv_name,tv_phone,tv_xingji,tv_jiaoyi;
private ImageView img_jiaobiao;
public ViewHolder(View itemView) {
super(itemView);
img_xuanze= (CheckBox) itemView.findViewById(R.id.img_xuanze);
img_touxiang= (CircleImageView) itemView.findViewById(R.id.img_touxiang);
tv_name= (TextView) itemView.findViewById(R.id.tv_name);
tv_phone= (TextView) itemView.findViewById(R.id.tv_phone);
tv_xingji= (TextView) itemView.findViewById(R.id.tv_xingji);
tv_jiaoyi= (TextView) itemView.findViewById(R.id.tv_jiaoyi);
img_jiaobiao= (ImageView) itemView.findViewById(R.id.img_jiaobiao);
}
}
}
| 5,367 | 0.65236 | 0.649375 | 144 | 36.215279 | 29.397932 | 176 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.548611 | false | false | 9 |
b50407e1c1a347f3eccef72622597dca5cca0947 | 30,683,246,431,626 | f814710852d4794080e24fe3d8e4c135a2ebdc94 | /src/aaaaniu/ke/wang/twelve/shenqidekoudaiMain.java | ca8fdd2fa362e99d32c849d7ea6e71365e3edac9 | [] | no_license | yanzi99522/lxy | https://github.com/yanzi99522/lxy | 8a30c782e1023d35b0431e550fdad5739f1fb607 | 227f702f695af2eb56d398f2d62eb416870daa39 | refs/heads/master | 2020-04-28T08:40:29.828000 | 2019-09-14T02:12:10 | 2019-09-14T02:12:10 | 175,137,201 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package aaaaniu.ke.wang.twelve;
import java.util.Scanner;
public class shenqidekoudaiMain {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
while (in.hasNext()){
int n=in.nextInt();
int[] daizi=new int[n];
for (int i=0;i<n;i++){
daizi[i]=in.nextInt() ;
}
}
}
}
| UTF-8 | Java | 388 | java | shenqidekoudaiMain.java | Java | [] | null | [] | package aaaaniu.ke.wang.twelve;
import java.util.Scanner;
public class shenqidekoudaiMain {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
while (in.hasNext()){
int n=in.nextInt();
int[] daizi=new int[n];
for (int i=0;i<n;i++){
daizi[i]=in.nextInt() ;
}
}
}
}
| 388 | 0.518041 | 0.515464 | 17 | 21.82353 | 15.827137 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 9 |
c87cc5261c83f619256f7c709e45d91b5011f563 | 30,219,389,934,503 | 3956e7e6921f1407b5fe24c6649e32c8bfac8485 | /Labo5/src/z1/fabryka/wysyłka/Poczta.java | 8fa37c81357d592661043627f2745deef2f07e26 | [] | no_license | Gedrum99/repo-ZPO-gr2-ZulewskiRobert | https://github.com/Gedrum99/repo-ZPO-gr2-ZulewskiRobert | 97e029c60fa479b81eb6a580be4d45e62dc82515 | b927e5927198e01bbb3f17aa4b70f09459122566 | refs/heads/main | 2023-05-13T02:58:02.288000 | 2021-06-09T00:32:30 | 2021-06-09T00:32:30 | 341,953,575 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package z1.fabryka.wysyłka;
public class Poczta extends Wysyłka{
public Poczta(){
setName( "Poczta" );
}
}
| UTF-8 | Java | 133 | java | Poczta.java | Java | [
{
"context": "Wysyłka{\r\n public Poczta(){\r\n setName( \"Poczta\" );\r\n }\r\n}\r\n",
"end": 115,
"score": 0.9782841205596924,
"start": 109,
"tag": "NAME",
"value": "Poczta"
}
] | null | [] | package z1.fabryka.wysyłka;
public class Poczta extends Wysyłka{
public Poczta(){
setName( "Poczta" );
}
}
| 133 | 0.603053 | 0.59542 | 7 | 16.714285 | 13.519449 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 9 |
805bb85a70a4cb2a5a7d1e1e5ed82c6d2093e861 | 16,999,480,622,165 | 75e404517698b8a77c101d64a3121cb37123a263 | /GameTest/src/UserPlaneEnum.java | 928277aef814e10876f23bdd14d1e58c3cbd296f | [] | no_license | BercesteDincer/CS319-02-Group-03-Sky-Wars | https://github.com/BercesteDincer/CS319-02-Group-03-Sky-Wars | 12183bf9b9259a85710e977d8515a1fdc49d44f9 | 6eb1b5463402110ff486793bb23fe4bc3d0f2cf3 | refs/heads/master | 2016-09-01T06:39:00.274000 | 2015-12-17T18:44:27 | 2015-12-17T18:44:27 | 44,741,588 | 0 | 2 | null | false | 2015-12-17T18:44:27 | 2015-10-22T11:42:08 | 2015-10-22T11:42:08 | 2015-12-17T18:44:27 | 93,838 | 0 | 1 | 0 | null | null | null | import java.awt.Image;
/**
* UserPlaneEnum is an enumeration class to represents values of various instances of user plane
*/
public enum UserPlaneEnum {
ALDERAAN_CRUISER(250, 0, 0, 10),
TOMCAT(500, 10, 0, 20),
F22_RAPTOR(750, 20, 0, 30),
SAAB_GRIPEN(1000, 30, 1, 40),
WUNDERWAFFE(1250, 40, 1, 50);
private int health;
private int shootDamage;
private int shootType;
private int speed;
private UserPlaneEnum(int health, int shootDamage, int shootType, int speed) {
this.health = health;
this.shootDamage = shootDamage;
this.shootType = shootType;
this.speed = speed;
}
public int health(){
return health;
}
public int shootDamage(){
return shootDamage;
}
public int shootType(){
return shootType;
}
public int speed(){
return speed;
}
}
| UTF-8 | Java | 831 | java | UserPlaneEnum.java | Java | [] | null | [] | import java.awt.Image;
/**
* UserPlaneEnum is an enumeration class to represents values of various instances of user plane
*/
public enum UserPlaneEnum {
ALDERAAN_CRUISER(250, 0, 0, 10),
TOMCAT(500, 10, 0, 20),
F22_RAPTOR(750, 20, 0, 30),
SAAB_GRIPEN(1000, 30, 1, 40),
WUNDERWAFFE(1250, 40, 1, 50);
private int health;
private int shootDamage;
private int shootType;
private int speed;
private UserPlaneEnum(int health, int shootDamage, int shootType, int speed) {
this.health = health;
this.shootDamage = shootDamage;
this.shootType = shootType;
this.speed = speed;
}
public int health(){
return health;
}
public int shootDamage(){
return shootDamage;
}
public int shootType(){
return shootType;
}
public int speed(){
return speed;
}
}
| 831 | 0.658243 | 0.606498 | 41 | 18.219513 | 19.471695 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.878049 | false | false | 9 |
fca9850f8ce79ed432ef12804304c3d20bf17a19 | 38,603,166,058,105 | ff1cb594467a2a8a9f8da65dac90d7f77af4c096 | /src/com/learning/defalutMethods/DefaultExecutor.java | aab37c3aaa2c5329594b05cb11649e61b1cd8696 | [] | no_license | anilkumar-padigela/JavaLearning | https://github.com/anilkumar-padigela/JavaLearning | 7b8df5b521eb799a7dc797ae4256be1663c41b69 | c67afcc75284e681b38710f07af1b360f34a20cd | refs/heads/master | 2020-08-11T10:17:13.543000 | 2019-10-22T05:32:20 | 2019-10-22T05:32:20 | 214,548,284 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
*
*/
package com.learning.defalutMethods;
/**
* @author Padigela Anil kumar
*
*/
public class DefaultExecutor {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
MexicanPizza mp = new MexicanPizza();
mp.addCheese();
}
}
class MexicanPizza implements IPizza{
@Override
public void addSauce() {
// TODO Auto-generated method stub
System.out.println("Added sauce");
}
}
| UTF-8 | Java | 451 | java | DefaultExecutor.java | Java | [
{
"context": "ckage com.learning.defalutMethods;\n\n/**\n * @author Padigela Anil kumar\n *\n */\npublic class DefaultExecutor {\n\n\t/**\n\t * @",
"end": 84,
"score": 0.9997906684875488,
"start": 65,
"tag": "NAME",
"value": "Padigela Anil kumar"
}
] | null | [] | /**
*
*/
package com.learning.defalutMethods;
/**
* @author <NAME>
*
*/
public class DefaultExecutor {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
MexicanPizza mp = new MexicanPizza();
mp.addCheese();
}
}
class MexicanPizza implements IPizza{
@Override
public void addSauce() {
// TODO Auto-generated method stub
System.out.println("Added sauce");
}
}
| 438 | 0.662971 | 0.662971 | 31 | 13.548388 | 15.23544 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.741935 | false | false | 9 |
e98f96f773cd8ced4c38fd86206ae09cfe09d6d5 | 36,627,481,105,887 | 1d22ce195d8bfce0e27cd37602d8a537414feda9 | /src/M1_Basics_of_software_code_development/cycles/Task8.java | 624969047a825e78fab769f50a3ca9224b08be0d | [] | no_license | SergeyTsynin/basics | https://github.com/SergeyTsynin/basics | 717aa0aca6d035fde4d84592d34ed1367395cbab | aef6a5db268995efe4adab8c55a6c4cb94e8f9ad | refs/heads/master | 2023-02-11T17:27:01.446000 | 2021-01-08T14:40:56 | 2021-01-08T14:40:56 | 271,004,005 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package M1_Basics_of_software_code_development.cycles;
public class Task8 {
/*
* Даны два числа. Определить цифры, входящие в запись как первого так и второго числа.
*/
// надеюсь, речь не шла о числах с плавающей точкой?
private static void getDuplicateDigits(double a, double b) {
String sa = doubleToString(a);
String sb = doubleToString(b);
for (char c = '0'; c <= '9'; c++) {
if (sa.indexOf(c) >= 0 && sb.indexOf(c) >= 0) {
System.out.println("число " + c + " подходит под условие");
}
}
}
private static String doubleToString(double d) {
if (d == (int) d) {
return Integer.toString((int) d);
} else {
return Double.toString(d);
}
}
}
| UTF-8 | Java | 927 | java | Task8.java | Java | [] | null | [] | package M1_Basics_of_software_code_development.cycles;
public class Task8 {
/*
* Даны два числа. Определить цифры, входящие в запись как первого так и второго числа.
*/
// надеюсь, речь не шла о числах с плавающей точкой?
private static void getDuplicateDigits(double a, double b) {
String sa = doubleToString(a);
String sb = doubleToString(b);
for (char c = '0'; c <= '9'; c++) {
if (sa.indexOf(c) >= 0 && sb.indexOf(c) >= 0) {
System.out.println("число " + c + " подходит под условие");
}
}
}
private static String doubleToString(double d) {
if (d == (int) d) {
return Integer.toString((int) d);
} else {
return Double.toString(d);
}
}
}
| 927 | 0.548306 | 0.540778 | 26 | 29.653847 | 25.894672 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.423077 | false | false | 9 |
06c85a824dea26ca3ea6e1e2f4493eda5c3f28d5 | 29,222,957,535,819 | 52d2ae32ca5173a2903430092ffcb47baf687d04 | /src/main/java/chess/piece/Piece.java | d606ec4b4262a761bf8087f6307c7955f127d908 | [] | no_license | hkorkmaz/alice-challenge | https://github.com/hkorkmaz/alice-challenge | 0225cad4669058265abd2a4af1624b6f29d9d0fe | 1f9d6089130994338c87b266111b51938d6caf7b | refs/heads/master | 2021-08-07T00:09:10.717000 | 2020-08-18T18:02:15 | 2020-08-18T18:02:15 | 211,538,530 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package chess.piece;
import chess.Board;
import chess.Color;
import chess.Square;
import java.util.List;
public abstract class Piece {
protected Square position;
protected Color color;
public Piece(Square position, Color color){
this.position = position;
this.color = color;
}
public abstract List<Square> possibleMoves(Board board);
public void moveTo(Square newPostion){
this.position = newPostion;
}
public Color getColor() {
return color;
}
public Square getPosition() {
return position;
}
}
| UTF-8 | Java | 590 | java | Piece.java | Java | [] | null | [] | package chess.piece;
import chess.Board;
import chess.Color;
import chess.Square;
import java.util.List;
public abstract class Piece {
protected Square position;
protected Color color;
public Piece(Square position, Color color){
this.position = position;
this.color = color;
}
public abstract List<Square> possibleMoves(Board board);
public void moveTo(Square newPostion){
this.position = newPostion;
}
public Color getColor() {
return color;
}
public Square getPosition() {
return position;
}
}
| 590 | 0.655932 | 0.655932 | 33 | 16.878788 | 16.22336 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.424242 | false | false | 9 |
684e98aaae9b4274d521139a7971d8767c50b61b | 798,863,979,531 | 0c16eccd3943b1c740aa2039946be8c990b077c5 | /src/main/java/com/app/sepa/repository/LocalidadAndPartidoRepository.java | 35528ed6c8c4b7799230204f2ea377a521c73336 | [] | no_license | SepaSoporteIt/SEPA_APP_REACT | https://github.com/SepaSoporteIt/SEPA_APP_REACT | 1094c0c10009469c401006f3e53f34e168b101bb | 4899e90a6d6276618ced1933aceb6caee2163234 | refs/heads/master | 2022-06-24T03:49:45.950000 | 2022-06-18T18:05:38 | 2022-06-18T18:05:38 | 225,024,579 | 0 | 0 | null | false | 2022-06-01T23:02:53 | 2019-11-30T14:30:41 | 2021-12-18T19:50:04 | 2022-06-01T23:02:52 | 12,005 | 0 | 0 | 28 | Java | false | false | package com.app.sepa.repository;
import com.app.sepa.domain.LocalidadAndPartido;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the LocalidadAndPartido entity.
*/
@SuppressWarnings("unused")
@Repository
public interface LocalidadAndPartidoRepository extends JpaRepository<LocalidadAndPartido, Long> {
}
| UTF-8 | Java | 395 | java | LocalidadAndPartidoRepository.java | Java | [] | null | [] | package com.app.sepa.repository;
import com.app.sepa.domain.LocalidadAndPartido;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the LocalidadAndPartido entity.
*/
@SuppressWarnings("unused")
@Repository
public interface LocalidadAndPartidoRepository extends JpaRepository<LocalidadAndPartido, Long> {
}
| 395 | 0.817722 | 0.817722 | 14 | 27.214285 | 29.017675 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 9 |
fdb30c87d90fa9b5e1dc5cab95b2c12811e861b3 | 7,224,135,047,118 | fdf91050ffffe3962c9fe7f266f262f7fc346d76 | /Eksamensopgaven/ExamProject/app/src/main/java/examproject/group22/roominator/Fragments/DeleteProductFragment.java | 19b857a0540875061f4f1b682d0414b56628ef2a | [] | no_license | zeroregard/SMAP-Project-MJMJ | https://github.com/zeroregard/SMAP-Project-MJMJ | 7ca6cc71194882ba71c01071db8ec6147648150e | 6b0560969d3f031dd7383ee04fab2ed5fc678897 | refs/heads/master | 2021-06-05T14:08:19.554000 | 2016-10-24T14:55:58 | 2016-10-24T14:55:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package examproject.group22.roominator.Fragments;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import examproject.group22.roominator.R;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link DeleteProductDialogListener} interface
* to handle interaction events.
* Use the {@link DeleteProductFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DeleteProductFragment extends DialogFragment {
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private DeleteProductDialogListener mListener;
public DeleteProductFragment() {
}
public static DeleteProductFragment newInstance(String param1, String param2) {
DeleteProductFragment fragment = new DeleteProductFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.dialog_product_message)
.setPositiveButton(R.string.dialog_product_btnOK, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mListener.onProductDialogPositiveClick(DeleteProductFragment.this);
}
})
.setNegativeButton(R.string.dialog_product_btnCancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mListener.onProductDialogNegativeClick(DeleteProductFragment.this);
}
});
return builder.create();
}
public void onButtonPressed(DialogFragment dialog) {
if (mListener != null) {
mListener.onProductDialogNegativeClick(dialog);
mListener.onProductDialogPositiveClick(dialog);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof DeleteProductDialogListener) {
mListener = (DeleteProductDialogListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement DeleteProductDialogListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface DeleteProductDialogListener {
void onProductDialogPositiveClick(DialogFragment dialog);
void onProductDialogNegativeClick(DialogFragment dialog);
}
}
| UTF-8 | Java | 3,572 | java | DeleteProductFragment.java | Java | [] | null | [] | package examproject.group22.roominator.Fragments;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import examproject.group22.roominator.R;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link DeleteProductDialogListener} interface
* to handle interaction events.
* Use the {@link DeleteProductFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DeleteProductFragment extends DialogFragment {
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private DeleteProductDialogListener mListener;
public DeleteProductFragment() {
}
public static DeleteProductFragment newInstance(String param1, String param2) {
DeleteProductFragment fragment = new DeleteProductFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.dialog_product_message)
.setPositiveButton(R.string.dialog_product_btnOK, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mListener.onProductDialogPositiveClick(DeleteProductFragment.this);
}
})
.setNegativeButton(R.string.dialog_product_btnCancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mListener.onProductDialogNegativeClick(DeleteProductFragment.this);
}
});
return builder.create();
}
public void onButtonPressed(DialogFragment dialog) {
if (mListener != null) {
mListener.onProductDialogNegativeClick(dialog);
mListener.onProductDialogPositiveClick(dialog);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof DeleteProductDialogListener) {
mListener = (DeleteProductDialogListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement DeleteProductDialogListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface DeleteProductDialogListener {
void onProductDialogPositiveClick(DialogFragment dialog);
void onProductDialogNegativeClick(DialogFragment dialog);
}
}
| 3,572 | 0.682811 | 0.678331 | 98 | 35.448978 | 28.487062 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.408163 | false | false | 9 |
f28d54f722f469746f9321b54e445d40af4c1593 | 4,028,679,359,295 | 4b359a832f70ac6eb003a5e1d2e302c8d2251601 | /src/gs1/minho/exception/AlreadyExistEmployeeException.java | b2aaa62868422af751a4650b2150a978cb1ee8fd | [] | no_license | gsg-java/thisisjava | https://github.com/gsg-java/thisisjava | 096cfd96fc42a901dc8abcd7251f1c213d5ff9cd | 6ce9270cb0cd5ae6e92cc93ea22eb2317defd00a | refs/heads/master | 2021-01-23T12:58:04.351000 | 2017-08-15T09:41:44 | 2017-08-15T09:41:44 | 93,215,138 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package gs1.minho.exception;
/**
* IDE : IntelliJ IDEA
* Created by minho on 2017. 6. 8..
*/
public class AlreadyExistEmployeeException extends RuntimeException {
private String message;
public AlreadyExistEmployeeException(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}
| UTF-8 | Java | 358 | java | AlreadyExistEmployeeException.java | Java | [
{
"context": "eption;\n\n\n/**\n * IDE : IntelliJ IDEA\n * Created by minho on 2017. 6. 8..\n */\npublic class AlreadyExistEmpl",
"end": 77,
"score": 0.9971272945404053,
"start": 72,
"tag": "USERNAME",
"value": "minho"
}
] | null | [] | package gs1.minho.exception;
/**
* IDE : IntelliJ IDEA
* Created by minho on 2017. 6. 8..
*/
public class AlreadyExistEmployeeException extends RuntimeException {
private String message;
public AlreadyExistEmployeeException(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}
| 358 | 0.684358 | 0.664804 | 16 | 21.375 | 20.340462 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 9 |
b5d2055be567112d6f8ac954d60ef9e89581cdb4 | 13,494,787,303,959 | 1562d844ec3f6915de205668c906f05112eccd7c | /app/src/main/java/com/a250althani/vmmovieapp/UI/DetailsActivity.java | fb11f0514843d6f45d01a3ec55a0362250ab04c6 | [] | no_license | Abdullah2althani/VMMovieapp | https://github.com/Abdullah2althani/VMMovieapp | f6954c06d15eac28aea076b394de4fc4b001b89b | 63aee829509eb8fa6dc55db17d58833427274688 | refs/heads/master | 2023-02-18T23:11:45.156000 | 2021-01-19T15:19:18 | 2021-01-19T15:19:18 | 331,021,722 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.a250althani.vmmovieapp.UI;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.a250althani.vmmovieapp.Adaptors.MoveAutherAdaptor;
import com.a250althani.vmmovieapp.Data.MovieModel;
import com.a250althani.vmmovieapp.Database.AppDatabase;
import com.a250althani.vmmovieapp.R;
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.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.squareup.picasso.Picasso;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Objects;
public class DetailsActivity extends AppCompatActivity {
FirebaseAnalytics mFirebaseAnalytics = null;
FavoriteMoviesWorker moviesWorker;
MovieModel movieModel250;
int moviesID;
private MoveAutherAdaptor adapter;
public static final String EXTRA_POSITION = "ID";
// private static final int DEFAULT_POSITION = -1;
final static String PARAM_QUERY = "api_key";
public Intent movies_id;
String API_KEY;
RequestQueue mQueue;
ArrayList<MovieModel> movieModel;
String VedioID;
int flag = 0;
TextView noInternetMsg,
original_tv_title, original_tv,
overview_tv_title, overview_tv,
rating_tv_title, rating_tv,
release_date_tv_title, release_date_tv,
Reviewed_adapter, selected_button_title;
ImageView image_iv;
ImageButton toBefavorite_img, removefavorite_img;
LinearLayout linearLayout;
// Member variable for the Database
private AppDatabase mDB;
@Override
protected void onRestart() {
super.onRestart();
Connectivity();
}
private void initialize() {
//Define the TextView of no internet connection
noInternetMsg = findViewById(R.id.no_internet_tv);
original_tv = findViewById(R.id.original_tv);
overview_tv = findViewById(R.id.overview_tv);
rating_tv = findViewById(R.id.rating_tv);
release_date_tv = findViewById(R.id.release_date_tv);
image_iv = findViewById(R.id.image_iv);
linearLayout = findViewById(R.id.contentView);
toBefavorite_img = findViewById(R.id.favorite_img);
removefavorite_img = findViewById(R.id.favorite_img2);
Reviewed_adapter = findViewById(R.id.Reviewed_adapter);
}
private void populateUI() {
Picasso.with(this)
.load(movieModel250.getMoviePoster())
.error(R.drawable.loading_imag)
.into(image_iv);
original_tv.setText(movieModel250.getOriginal_title());
overview_tv.setText(movieModel250.getOverview());
rating_tv.setText(movieModel250.getVote_average());
release_date_tv.setText(movieModel250.getRelease_date());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
Objects.requireNonNull(getSupportActionBar()).hide();
setTitle(getResources().getString(R.string.Details_Activity_title));
API_KEY = getResources().getString(R.string.API_KEY);
movieModel = new ArrayList<>();
moviesWorker = new FavoriteMoviesWorker(this);
initialize();
RecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mDB = AppDatabase.getDatabase(getApplicationContext());
if (getting_passed_id()) return;
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, moviesID + "");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Connectivity();
}
private boolean getting_passed_id() {
movies_id = getIntent();
movieModel250 = (MovieModel) movies_id.getSerializableExtra(EXTRA_POSITION);
assert movieModel250 != null;
moviesID = movieModel250.getMovieId();
moviesWorker.isFavoriteMovie(movieModel250);
populateUI();
return false;
}
protected void Connectivity() {
if (isConnected()) {
noInternetMsg.setVisibility(View.GONE);
linearLayout.setVisibility(View.VISIBLE);
image_iv.setVisibility(View.VISIBLE);
} else {
noInternetMsg.setVisibility(View.VISIBLE);
linearLayout.setVisibility(View.GONE);
image_iv.setVisibility(View.GONE);
}
}
private Boolean isConnected() {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
assert connectivityManager != null;
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
return info != null && info.isConnectedOrConnecting();
}
public void DisplayReviews(View view) {
mQueue = Volley.newRequestQueue(this);
Log.i("DisplayReviews= ", "Clicked");
Reviewed_adapter.setVisibility(View.VISIBLE);
String url = "https://api.themoviedb.org/3/movie/" + moviesID + "/reviews?" + PARAM_QUERY + "=" + API_KEY;
Log.i("url", url);
JsonObjectRequest requestQ = new JsonObjectRequest(
Request.Method.GET,
url,
null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
Log.e("onResponse= ", "Called");
// JSONObject Object = response.getJSONObject("id");
JSONArray jsonArray = response.getJSONArray("results");
if (jsonArray.length() != 0) {
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject resultObject = jsonArray.getJSONObject(i);
String author = resultObject.getString("author");
String content = resultObject.getString("content");
Reviewed_adapter.append("\n" + author + "\n\n" + content + "\n\n");
adapter = new MoveAutherAdaptor(author, content);
Toast.makeText(DetailsActivity.this, "Scroll down", Toast.LENGTH_SHORT).show();
}
} else {
Reviewed_adapter.setText(getResources().getString(R.string.no_reviews));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("onErrorResponse= ", "Called");
}
});
mQueue.add(requestQ);
}
public void DisplayVideo(View view) {
Log.i("DisplayVideo = ", "Clicked");
selected_button_title.setVisibility(View.GONE);
Reviewed_adapter.setVisibility(View.GONE);
mQueue = Volley.newRequestQueue(this);
String url = "https://api.themoviedb.org/3/movie/" + moviesID + "/videos?" + PARAM_QUERY + "=" + API_KEY;
Log.i("url", url);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.GET,
url,
null,
new Response.Listener<JSONObject>() {
@SuppressLint("SetTextI18n")
@Override
public void onResponse(JSONObject response) {
try {
Log.e("onResponse= ", "Called");
JSONArray jsonArray = response.getJSONArray("results");
JSONObject jsonObject1 = jsonArray.getJSONObject(0);
VedioID = jsonObject1.getString("key");
Log.e("VedioID= ", VedioID + "");
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + VedioID)));
Toast.makeText(DetailsActivity.this, "YouTube App will startup", Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("onErrorResponse= ", "Called");
}
}
);
mQueue.add(jsonObjectRequest);
}
public void setIFMovieFavorite(boolean ifMovieFavorite) {
if (ifMovieFavorite) {
flag = 1;
toBefavorite_img.setVisibility(View.GONE);
removefavorite_img.setVisibility(View.VISIBLE);
} else {
flag = 0;
toBefavorite_img.setVisibility(View.GONE);
removefavorite_img.setVisibility(View.VISIBLE);
}
}
public void AddToBeFavorite(View view) {
moviesWorker.addFavoriteMovie(movieModel250);
Toast.makeText(this, "Added to be Favorite Movie", Toast.LENGTH_SHORT).show();
toBefavorite_img.setVisibility(View.GONE);
removefavorite_img.setVisibility(View.VISIBLE);
}
public void RemoveFromFavorite(View view) {
moviesWorker.deleteFavoriteMovie(movieModel250);
Toast.makeText(this, "Removed from Favorite Movie", Toast.LENGTH_SHORT).show();
toBefavorite_img.setVisibility(View.VISIBLE);
removefavorite_img.setVisibility(View.GONE);
}
public class FavoriteMoviesWorker {
private boolean isFavorite = true;
private AppDatabase database;
FavoriteMoviesWorker(Context context) {
database = AppDatabase.getDatabase(context);
}
void addFavoriteMovie(MovieModel movieModel) {
isFavorite = true;
new FavoriteMoviesAsyncTask().execute(movieModel);
}
void deleteFavoriteMovie(MovieModel movieModel) {
isFavorite = false;
new FavoriteMoviesAsyncTask().execute(movieModel);
}
void isFavoriteMovie(MovieModel movieModel) {
new IsFavoriteMoviesAsyncTask().execute(movieModel);
}
@SuppressLint("StaticFieldLeak")
private class IsFavoriteMoviesAsyncTask extends AsyncTask<MovieModel, Void, MovieModel> {
@Override
protected MovieModel doInBackground(MovieModel... movieModel) {
return database.taskDao().loadMovie(movieModel[0].getMovieId());
}
@Override
protected void onPostExecute(MovieModel movieModel) {
super.onPostExecute(movieModel);
setIFMovieFavorite(movieModel != null ? true : false);
}
}
@SuppressLint("StaticFieldLeak")
private class FavoriteMoviesAsyncTask extends AsyncTask<MovieModel, Void, Void> {
@Override
protected Void doInBackground(MovieModel... movieModel) {
if (isFavorite) {
database.taskDao().insertMovieModel(movieModel[0]);
} else {
database.taskDao().deleteMovieModel(movieModel[0]);
}
return null;
}
}
}
}
| UTF-8 | Java | 12,580 | java | DetailsActivity.java | Java | [] | null | [] | package com.a250althani.vmmovieapp.UI;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.a250althani.vmmovieapp.Adaptors.MoveAutherAdaptor;
import com.a250althani.vmmovieapp.Data.MovieModel;
import com.a250althani.vmmovieapp.Database.AppDatabase;
import com.a250althani.vmmovieapp.R;
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.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.squareup.picasso.Picasso;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Objects;
public class DetailsActivity extends AppCompatActivity {
FirebaseAnalytics mFirebaseAnalytics = null;
FavoriteMoviesWorker moviesWorker;
MovieModel movieModel250;
int moviesID;
private MoveAutherAdaptor adapter;
public static final String EXTRA_POSITION = "ID";
// private static final int DEFAULT_POSITION = -1;
final static String PARAM_QUERY = "api_key";
public Intent movies_id;
String API_KEY;
RequestQueue mQueue;
ArrayList<MovieModel> movieModel;
String VedioID;
int flag = 0;
TextView noInternetMsg,
original_tv_title, original_tv,
overview_tv_title, overview_tv,
rating_tv_title, rating_tv,
release_date_tv_title, release_date_tv,
Reviewed_adapter, selected_button_title;
ImageView image_iv;
ImageButton toBefavorite_img, removefavorite_img;
LinearLayout linearLayout;
// Member variable for the Database
private AppDatabase mDB;
@Override
protected void onRestart() {
super.onRestart();
Connectivity();
}
private void initialize() {
//Define the TextView of no internet connection
noInternetMsg = findViewById(R.id.no_internet_tv);
original_tv = findViewById(R.id.original_tv);
overview_tv = findViewById(R.id.overview_tv);
rating_tv = findViewById(R.id.rating_tv);
release_date_tv = findViewById(R.id.release_date_tv);
image_iv = findViewById(R.id.image_iv);
linearLayout = findViewById(R.id.contentView);
toBefavorite_img = findViewById(R.id.favorite_img);
removefavorite_img = findViewById(R.id.favorite_img2);
Reviewed_adapter = findViewById(R.id.Reviewed_adapter);
}
private void populateUI() {
Picasso.with(this)
.load(movieModel250.getMoviePoster())
.error(R.drawable.loading_imag)
.into(image_iv);
original_tv.setText(movieModel250.getOriginal_title());
overview_tv.setText(movieModel250.getOverview());
rating_tv.setText(movieModel250.getVote_average());
release_date_tv.setText(movieModel250.getRelease_date());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
Objects.requireNonNull(getSupportActionBar()).hide();
setTitle(getResources().getString(R.string.Details_Activity_title));
API_KEY = getResources().getString(R.string.API_KEY);
movieModel = new ArrayList<>();
moviesWorker = new FavoriteMoviesWorker(this);
initialize();
RecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mDB = AppDatabase.getDatabase(getApplicationContext());
if (getting_passed_id()) return;
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, moviesID + "");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Connectivity();
}
private boolean getting_passed_id() {
movies_id = getIntent();
movieModel250 = (MovieModel) movies_id.getSerializableExtra(EXTRA_POSITION);
assert movieModel250 != null;
moviesID = movieModel250.getMovieId();
moviesWorker.isFavoriteMovie(movieModel250);
populateUI();
return false;
}
protected void Connectivity() {
if (isConnected()) {
noInternetMsg.setVisibility(View.GONE);
linearLayout.setVisibility(View.VISIBLE);
image_iv.setVisibility(View.VISIBLE);
} else {
noInternetMsg.setVisibility(View.VISIBLE);
linearLayout.setVisibility(View.GONE);
image_iv.setVisibility(View.GONE);
}
}
private Boolean isConnected() {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
assert connectivityManager != null;
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
return info != null && info.isConnectedOrConnecting();
}
public void DisplayReviews(View view) {
mQueue = Volley.newRequestQueue(this);
Log.i("DisplayReviews= ", "Clicked");
Reviewed_adapter.setVisibility(View.VISIBLE);
String url = "https://api.themoviedb.org/3/movie/" + moviesID + "/reviews?" + PARAM_QUERY + "=" + API_KEY;
Log.i("url", url);
JsonObjectRequest requestQ = new JsonObjectRequest(
Request.Method.GET,
url,
null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
Log.e("onResponse= ", "Called");
// JSONObject Object = response.getJSONObject("id");
JSONArray jsonArray = response.getJSONArray("results");
if (jsonArray.length() != 0) {
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject resultObject = jsonArray.getJSONObject(i);
String author = resultObject.getString("author");
String content = resultObject.getString("content");
Reviewed_adapter.append("\n" + author + "\n\n" + content + "\n\n");
adapter = new MoveAutherAdaptor(author, content);
Toast.makeText(DetailsActivity.this, "Scroll down", Toast.LENGTH_SHORT).show();
}
} else {
Reviewed_adapter.setText(getResources().getString(R.string.no_reviews));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("onErrorResponse= ", "Called");
}
});
mQueue.add(requestQ);
}
public void DisplayVideo(View view) {
Log.i("DisplayVideo = ", "Clicked");
selected_button_title.setVisibility(View.GONE);
Reviewed_adapter.setVisibility(View.GONE);
mQueue = Volley.newRequestQueue(this);
String url = "https://api.themoviedb.org/3/movie/" + moviesID + "/videos?" + PARAM_QUERY + "=" + API_KEY;
Log.i("url", url);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.GET,
url,
null,
new Response.Listener<JSONObject>() {
@SuppressLint("SetTextI18n")
@Override
public void onResponse(JSONObject response) {
try {
Log.e("onResponse= ", "Called");
JSONArray jsonArray = response.getJSONArray("results");
JSONObject jsonObject1 = jsonArray.getJSONObject(0);
VedioID = jsonObject1.getString("key");
Log.e("VedioID= ", VedioID + "");
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + VedioID)));
Toast.makeText(DetailsActivity.this, "YouTube App will startup", Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("onErrorResponse= ", "Called");
}
}
);
mQueue.add(jsonObjectRequest);
}
public void setIFMovieFavorite(boolean ifMovieFavorite) {
if (ifMovieFavorite) {
flag = 1;
toBefavorite_img.setVisibility(View.GONE);
removefavorite_img.setVisibility(View.VISIBLE);
} else {
flag = 0;
toBefavorite_img.setVisibility(View.GONE);
removefavorite_img.setVisibility(View.VISIBLE);
}
}
public void AddToBeFavorite(View view) {
moviesWorker.addFavoriteMovie(movieModel250);
Toast.makeText(this, "Added to be Favorite Movie", Toast.LENGTH_SHORT).show();
toBefavorite_img.setVisibility(View.GONE);
removefavorite_img.setVisibility(View.VISIBLE);
}
public void RemoveFromFavorite(View view) {
moviesWorker.deleteFavoriteMovie(movieModel250);
Toast.makeText(this, "Removed from Favorite Movie", Toast.LENGTH_SHORT).show();
toBefavorite_img.setVisibility(View.VISIBLE);
removefavorite_img.setVisibility(View.GONE);
}
public class FavoriteMoviesWorker {
private boolean isFavorite = true;
private AppDatabase database;
FavoriteMoviesWorker(Context context) {
database = AppDatabase.getDatabase(context);
}
void addFavoriteMovie(MovieModel movieModel) {
isFavorite = true;
new FavoriteMoviesAsyncTask().execute(movieModel);
}
void deleteFavoriteMovie(MovieModel movieModel) {
isFavorite = false;
new FavoriteMoviesAsyncTask().execute(movieModel);
}
void isFavoriteMovie(MovieModel movieModel) {
new IsFavoriteMoviesAsyncTask().execute(movieModel);
}
@SuppressLint("StaticFieldLeak")
private class IsFavoriteMoviesAsyncTask extends AsyncTask<MovieModel, Void, MovieModel> {
@Override
protected MovieModel doInBackground(MovieModel... movieModel) {
return database.taskDao().loadMovie(movieModel[0].getMovieId());
}
@Override
protected void onPostExecute(MovieModel movieModel) {
super.onPostExecute(movieModel);
setIFMovieFavorite(movieModel != null ? true : false);
}
}
@SuppressLint("StaticFieldLeak")
private class FavoriteMoviesAsyncTask extends AsyncTask<MovieModel, Void, Void> {
@Override
protected Void doInBackground(MovieModel... movieModel) {
if (isFavorite) {
database.taskDao().insertMovieModel(movieModel[0]);
} else {
database.taskDao().deleteMovieModel(movieModel[0]);
}
return null;
}
}
}
}
| 12,580 | 0.604293 | 0.598887 | 318 | 38.55975 | 26.239725 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.68239 | false | false | 9 |
77797ee725c8f003f8911ab05deddc895a94014f | 38,843,684,265,226 | aeb0bc3c42c1b7182a329afc33b9f07af8d2fc0f | /src/main/java/leetcode/middle/M785_IsGraphBipartite.java | f1b4a209d839231c86aeaee1120f770241d51017 | [] | no_license | fighterhit/code-set | https://github.com/fighterhit/code-set | 9d4bda8e99ee4b76efdc1d0f58e6b94fb37408db | d472676a631473ae9d2e61c158eae09c26700d1b | refs/heads/master | 2021-06-02T12:06:23.959000 | 2020-08-22T04:47:58 | 2020-08-22T04:47:58 | 132,473,673 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package leetcode.middle;
import java.util.Arrays;
import java.util.LinkedList;
/**
* 给定一个无向图graph,当这个图为二分图时返回true。
* <p>
* 二分图定义:
* 如果我们能将一个图的节点集合分割成两个独立的子集A和B,并使图中的每一条边的两个节点一个来自A集合,一个来自B集合,我们就将这个图称为二分图。
* 或
* 如果可以用两种颜色对图中的节点进行着色,并且保证相邻的节点颜色不同,那么这个图就是二分图。
* <p>
* graph将会以邻接表方式给出,graph[i]表示图中与节点i相连的所有节点。每个节点都是一个在0到graph.length-1之间的整数。这图中没有自环和平行边: graph[i] 中不存在i,并且graph[i]中没有重复的值。
* 示例 1:
* 输入: [[1,3], [0,2], [1,3], [0,2]]
* 输出: true
* 解释:
* 无向图如下:
* 0----1
* | |
* | |
* 3----2
* 我们可以将节点分成两组: {0, 2} 和 {1, 3}。
* 示例 2:
* 输入: [[1,2,3], [0,2], [0,1,3], [0,2]]
* 输出: false
* 解释:
* 无向图如下:
* 0----1
* | \ |
* | \ |
* 3----2
* 我们不能将节点分割成两个独立的子集。
* 注意:
* graph 的长度范围为 [1, 100]。
* graph[i] 中的元素的范围为 [0, graph.length - 1]。
* graph[i] 不会包含 i 或者有重复的值。
* 图是无向的: 如果j 在 graph[i]里边, 那么 i 也会在 graph[j]里边。
*/
public class M785_IsGraphBipartite {
/**
* 染色法:DFS
* 将相连的两个顶点染成不同的颜色,一旦在染的过程中发现有两连的两个顶点已经被染成相同的颜色,说明不是二分图。
* 这里我们使用两种颜色,分别用 1 和 -1 来表示,初始时每个顶点用 0 表示未染色.
* 遍历每一个顶点,如果该顶点未被访问过,则调用递归函数,如果返回 false,那么说明不是二分图,则直接返回 false。如果循环退出后没有返回 false,则返回 true。
* 在递归函数中,如果当前顶点已经染色,如果该顶点的颜色和将要染的颜色相同,则返回 true,否则返回 false。如果没被染色,则将当前顶点染色,然后再遍历与该顶点相连的所有的顶点,调用递归函数,如果返回 false 了,则当前递归函数的返回 false,循环结束返回 true
* https://www.cnblogs.com/grandyang/p/8519566.html
*/
public boolean isBipartite(int[][] graph) {
int n = graph.length;
//默认为0,涂色为 1 或 -1
int[] colors = new int[n];
for (int i = 0; i < n; i++) {
if (colors[i] == 0 && !helper(i, 1, graph, colors)) {
return false;
}
}
return true;
}
//第 2 个参数表示该点应涂的颜色
private boolean helper(int i, int color, int[][] graph, int[] colors) {
if (colors[i] != 0) {
return colors[i] == color;
}
colors[i] = color;
for (int neighbor : graph[i]) {
if (!helper(neighbor, -1 * color, graph, colors)) {
return false;
}
}
return true;
}
/**
* 迭代:BFS
* 遍历整个顶点,如果未被染色,则先染色为1,然后使用 BFS 进行遍历,将当前顶点放入队列 queue 中,然后 while 循环 queue 不为空,取出队首元素,遍历其所有相邻的顶点,如果相邻顶点未被染色,则染成和当前顶点相反的颜色,然后把相邻顶点加入 queue 中,否则如果当前顶点和相邻顶点颜色相同,直接返回 false,循环退出后返回 true
*/
public boolean isBipartite2(int[][] graph) {
int n = graph.length;
int[] colors = new int[n];
for (int i = 0; i < graph.length; i++) {
if (colors[i] != 0) {
continue;
}
//没涂色则优先涂1
colors[i] = 1;
LinkedList<Integer> queue = new LinkedList<>();
queue.add(i);
while (queue.size() > 0) {
int node = queue.poll();
//处理改点的邻居节点,涂成和当前节点相反的颜色
for (int neighbor : graph[node]) {
if (colors[neighbor] == colors[node]) {
return false;
}
if (colors[neighbor] == 0) {
colors[neighbor] = -1 * colors[node];
//注意邻居染完色加入队列
queue.add(neighbor);
}
}
}
}
return true;
}
/**
* 并查集
* 并查集,简单来说,就是归类,将同一集合的元素放在一起。
* 开始遍历所有结点,若当前结点没有邻接结点,直接跳过。否则就要开始进行处理.
* 并查集方法的核心就两步,合并跟查询。
* 查询操作:对当前结点和其第一个邻接结点分别调用 find 函数,如果其返回值相同,则意味着其属于同一个集合了,这是不合题意的,直接返回 false。否则我们继续遍历其他的邻接结点,对于每一个新的邻接结点,我们都调用 find 函数,还是判断若返回值跟原结点的相同,return false。
* 否则就要进行合并操作了,根据敌人的敌人就是朋友的原则,所有的邻接结点之间应该属于同一个组,因为就两个组,所以需要将他们都合并起来,合并的时候不管是用 root[parent] = y 还是 root[g[i][j]] = y 都是可以,因为不管直接跟某个结点合并,或者跟其祖宗合并,最终经过 find 函数追踪溯源都会返回相同的值,
*/
public boolean isBipartite3(int[][] graph) {
int n = graph.length;
int[] root = new int[n];
//默认每个节点根节点是自己
for (int i = 0; i < n; i++) {
root[i] = i;
}
for (int i = 0; i < graph.length; i++) {
//注意,若当前节点没有邻居节点则直接跳过
if (graph[i].length == 0) {
continue;
}
//现找当前节点和第一个节点是否属于同一类
int x = find(root, i), y = find(root, graph[i][0]);
//和邻居节点同一类不合题意,直接返回 false
if (x == y) {
return false;
}
for (int j = 1; j < graph[i].length; j++) {
int parent = find(root, graph[i][j]);
if (x == parent) {
return false;
}
//都合并到第一个邻居节点的类中
root[parent] = y;
}
}
return true;
}
int find(int[] root, int i) {
if (root[i] == i) {
return i;
}
return find(root, root[i]);
}
}
| UTF-8 | Java | 7,038 | java | M785_IsGraphBipartite.java | Java | [
{
"context": " false,循环结束返回 true\n * https://www.cnblogs.com/grandyang/p/8519566.html\n */\n public boolean isBipar",
"end": 1291,
"score": 0.9996620416641235,
"start": 1282,
"tag": "USERNAME",
"value": "grandyang"
}
] | null | [] | package leetcode.middle;
import java.util.Arrays;
import java.util.LinkedList;
/**
* 给定一个无向图graph,当这个图为二分图时返回true。
* <p>
* 二分图定义:
* 如果我们能将一个图的节点集合分割成两个独立的子集A和B,并使图中的每一条边的两个节点一个来自A集合,一个来自B集合,我们就将这个图称为二分图。
* 或
* 如果可以用两种颜色对图中的节点进行着色,并且保证相邻的节点颜色不同,那么这个图就是二分图。
* <p>
* graph将会以邻接表方式给出,graph[i]表示图中与节点i相连的所有节点。每个节点都是一个在0到graph.length-1之间的整数。这图中没有自环和平行边: graph[i] 中不存在i,并且graph[i]中没有重复的值。
* 示例 1:
* 输入: [[1,3], [0,2], [1,3], [0,2]]
* 输出: true
* 解释:
* 无向图如下:
* 0----1
* | |
* | |
* 3----2
* 我们可以将节点分成两组: {0, 2} 和 {1, 3}。
* 示例 2:
* 输入: [[1,2,3], [0,2], [0,1,3], [0,2]]
* 输出: false
* 解释:
* 无向图如下:
* 0----1
* | \ |
* | \ |
* 3----2
* 我们不能将节点分割成两个独立的子集。
* 注意:
* graph 的长度范围为 [1, 100]。
* graph[i] 中的元素的范围为 [0, graph.length - 1]。
* graph[i] 不会包含 i 或者有重复的值。
* 图是无向的: 如果j 在 graph[i]里边, 那么 i 也会在 graph[j]里边。
*/
public class M785_IsGraphBipartite {
/**
* 染色法:DFS
* 将相连的两个顶点染成不同的颜色,一旦在染的过程中发现有两连的两个顶点已经被染成相同的颜色,说明不是二分图。
* 这里我们使用两种颜色,分别用 1 和 -1 来表示,初始时每个顶点用 0 表示未染色.
* 遍历每一个顶点,如果该顶点未被访问过,则调用递归函数,如果返回 false,那么说明不是二分图,则直接返回 false。如果循环退出后没有返回 false,则返回 true。
* 在递归函数中,如果当前顶点已经染色,如果该顶点的颜色和将要染的颜色相同,则返回 true,否则返回 false。如果没被染色,则将当前顶点染色,然后再遍历与该顶点相连的所有的顶点,调用递归函数,如果返回 false 了,则当前递归函数的返回 false,循环结束返回 true
* https://www.cnblogs.com/grandyang/p/8519566.html
*/
public boolean isBipartite(int[][] graph) {
int n = graph.length;
//默认为0,涂色为 1 或 -1
int[] colors = new int[n];
for (int i = 0; i < n; i++) {
if (colors[i] == 0 && !helper(i, 1, graph, colors)) {
return false;
}
}
return true;
}
//第 2 个参数表示该点应涂的颜色
private boolean helper(int i, int color, int[][] graph, int[] colors) {
if (colors[i] != 0) {
return colors[i] == color;
}
colors[i] = color;
for (int neighbor : graph[i]) {
if (!helper(neighbor, -1 * color, graph, colors)) {
return false;
}
}
return true;
}
/**
* 迭代:BFS
* 遍历整个顶点,如果未被染色,则先染色为1,然后使用 BFS 进行遍历,将当前顶点放入队列 queue 中,然后 while 循环 queue 不为空,取出队首元素,遍历其所有相邻的顶点,如果相邻顶点未被染色,则染成和当前顶点相反的颜色,然后把相邻顶点加入 queue 中,否则如果当前顶点和相邻顶点颜色相同,直接返回 false,循环退出后返回 true
*/
public boolean isBipartite2(int[][] graph) {
int n = graph.length;
int[] colors = new int[n];
for (int i = 0; i < graph.length; i++) {
if (colors[i] != 0) {
continue;
}
//没涂色则优先涂1
colors[i] = 1;
LinkedList<Integer> queue = new LinkedList<>();
queue.add(i);
while (queue.size() > 0) {
int node = queue.poll();
//处理改点的邻居节点,涂成和当前节点相反的颜色
for (int neighbor : graph[node]) {
if (colors[neighbor] == colors[node]) {
return false;
}
if (colors[neighbor] == 0) {
colors[neighbor] = -1 * colors[node];
//注意邻居染完色加入队列
queue.add(neighbor);
}
}
}
}
return true;
}
/**
* 并查集
* 并查集,简单来说,就是归类,将同一集合的元素放在一起。
* 开始遍历所有结点,若当前结点没有邻接结点,直接跳过。否则就要开始进行处理.
* 并查集方法的核心就两步,合并跟查询。
* 查询操作:对当前结点和其第一个邻接结点分别调用 find 函数,如果其返回值相同,则意味着其属于同一个集合了,这是不合题意的,直接返回 false。否则我们继续遍历其他的邻接结点,对于每一个新的邻接结点,我们都调用 find 函数,还是判断若返回值跟原结点的相同,return false。
* 否则就要进行合并操作了,根据敌人的敌人就是朋友的原则,所有的邻接结点之间应该属于同一个组,因为就两个组,所以需要将他们都合并起来,合并的时候不管是用 root[parent] = y 还是 root[g[i][j]] = y 都是可以,因为不管直接跟某个结点合并,或者跟其祖宗合并,最终经过 find 函数追踪溯源都会返回相同的值,
*/
public boolean isBipartite3(int[][] graph) {
int n = graph.length;
int[] root = new int[n];
//默认每个节点根节点是自己
for (int i = 0; i < n; i++) {
root[i] = i;
}
for (int i = 0; i < graph.length; i++) {
//注意,若当前节点没有邻居节点则直接跳过
if (graph[i].length == 0) {
continue;
}
//现找当前节点和第一个节点是否属于同一类
int x = find(root, i), y = find(root, graph[i][0]);
//和邻居节点同一类不合题意,直接返回 false
if (x == y) {
return false;
}
for (int j = 1; j < graph[i].length; j++) {
int parent = find(root, graph[i][j]);
if (x == parent) {
return false;
}
//都合并到第一个邻居节点的类中
root[parent] = y;
}
}
return true;
}
int find(int[] root, int i) {
if (root[i] == i) {
return i;
}
return find(root, root[i]);
}
}
| 7,038 | 0.513225 | 0.4968 | 153 | 29.640522 | 29.572248 | 184 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.575163 | false | false | 9 |
8dbddd00672273276154431a2d447861cea4dcee | 37,684,043,076,266 | d12a6b21aa94dbd2b3279e6ccbe2c35fd2298a88 | /JavaLeetCode/src/Sum3.java | 2e60f6a8c9f5412a8ecd62b5caf8a0b18d6065d7 | [] | no_license | a819721810/TangMiao-LeetCode | https://github.com/a819721810/TangMiao-LeetCode | e6fb102448ca81390f1d72a926c64f88f3c1c7f0 | 142a7cb91d08974aba50bad3588a6ca0806b1dfd | refs/heads/master | 2020-12-09T18:39:42.194000 | 2020-06-27T13:18:19 | 2020-06-27T13:18:19 | 233,385,666 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
public class Sum3 {
// static class Solution {
// private List<List<Integer>> oneResult(int[] nums, int target, int start) {
// Map<Integer, Integer> restoreTwoSum = new HashMap<>();
// List<List<Integer>> oneResult = new ArrayList<>();
// for (int i = start; i < nums.length; i++) {
// if (restoreTwoSum.containsKey(target - nums[i])) {
// List<Integer> tempList=new ArrayList<>();
// tempList.add(-target);
// tempList.add(target - nums[i]);
// tempList.add(nums[i]);
// Collections.sort(tempList);
// oneResult.add(tempList);
// continue;
// }
// restoreTwoSum.put(nums[i], nums[i]);
// }
//
// return oneResult;
// }
//
// public List<List<Integer>> threeSum(int[] nums) {
// List<List<Integer>> resultList = new ArrayList<>();
// Set<List<Integer>> resultSet = new HashSet<>();
// for (int i = 0; i < nums.length; i++) {
// List<List<Integer>> temp;
// temp=oneResult(nums,-nums[i],i+1);
// resultSet.addAll(temp);
// }
// resultList.addAll(resultSet);
// return resultList;
// }
// }
static class Solution {
public List<List<Integer>> threeSum(int[] nums) {
Arrays.sort(nums);
List<List<Integer>> result = new ArrayList<>();
final int len = nums.length;
for (int i = 0; i < len; i++) {
int first = i;
if (first > 0 && nums[first] == nums[i - 1]) {
continue;
}
int second = i + 1;
int third = len - 1;
while (second < third) {
if (second > first + 1 && nums[second] == nums[second - 1]) {
second++;
continue;
}
if (nums[first] + nums[second] + nums[third] > 0) {
third--;
} else if (nums[first] + nums[second] + nums[third] < 0) {
second++;
} else {
List<Integer> temp = new ArrayList<>();
temp.add(nums[first]);
temp.add(nums[second]);
temp.add(nums[third]);
result.add(temp);
second++;
third--;
}
}
}
return result;
}
}
public static void main(String[] args) {
Solution s = new Solution();
int[] nums = {-1, 0, 1, 2, -1, -4};
System.out.println(s.threeSum(nums));
}
}
| UTF-8 | Java | 2,923 | java | Sum3.java | Java | [] | null | [] | import java.util.*;
public class Sum3 {
// static class Solution {
// private List<List<Integer>> oneResult(int[] nums, int target, int start) {
// Map<Integer, Integer> restoreTwoSum = new HashMap<>();
// List<List<Integer>> oneResult = new ArrayList<>();
// for (int i = start; i < nums.length; i++) {
// if (restoreTwoSum.containsKey(target - nums[i])) {
// List<Integer> tempList=new ArrayList<>();
// tempList.add(-target);
// tempList.add(target - nums[i]);
// tempList.add(nums[i]);
// Collections.sort(tempList);
// oneResult.add(tempList);
// continue;
// }
// restoreTwoSum.put(nums[i], nums[i]);
// }
//
// return oneResult;
// }
//
// public List<List<Integer>> threeSum(int[] nums) {
// List<List<Integer>> resultList = new ArrayList<>();
// Set<List<Integer>> resultSet = new HashSet<>();
// for (int i = 0; i < nums.length; i++) {
// List<List<Integer>> temp;
// temp=oneResult(nums,-nums[i],i+1);
// resultSet.addAll(temp);
// }
// resultList.addAll(resultSet);
// return resultList;
// }
// }
static class Solution {
public List<List<Integer>> threeSum(int[] nums) {
Arrays.sort(nums);
List<List<Integer>> result = new ArrayList<>();
final int len = nums.length;
for (int i = 0; i < len; i++) {
int first = i;
if (first > 0 && nums[first] == nums[i - 1]) {
continue;
}
int second = i + 1;
int third = len - 1;
while (second < third) {
if (second > first + 1 && nums[second] == nums[second - 1]) {
second++;
continue;
}
if (nums[first] + nums[second] + nums[third] > 0) {
third--;
} else if (nums[first] + nums[second] + nums[third] < 0) {
second++;
} else {
List<Integer> temp = new ArrayList<>();
temp.add(nums[first]);
temp.add(nums[second]);
temp.add(nums[third]);
result.add(temp);
second++;
third--;
}
}
}
return result;
}
}
public static void main(String[] args) {
Solution s = new Solution();
int[] nums = {-1, 0, 1, 2, -1, -4};
System.out.println(s.threeSum(nums));
}
}
| 2,923 | 0.409169 | 0.403011 | 77 | 36.96104 | 20.623049 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.753247 | false | false | 9 |
0f5550282d8871f5c51dfd0444cf32c640e47fdb | 37,374,805,429,046 | fe26ec36d5bea314c080292aeb8b578593aa20f9 | /src/InsecteCreator.java | 1ba08b3df22914f11d8ad39d0342b00d9d55e9a6 | [] | no_license | Zahrachab/refactoring_code_with_GangOfFour | https://github.com/Zahrachab/refactoring_code_with_GangOfFour | 32d9190ab202cf5e9db41968c052203524c4bb07 | c76cbd03f52f9f71a4c8d97de96683006aad38c5 | refs/heads/master | 2020-04-13T04:52:41.043000 | 2019-01-07T13:33:14 | 2019-01-07T13:33:14 | 162,974,013 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import Enum.*;
public class InsecteCreator extends EspeceCreator {
//implémenter le patron Singleton
private static InsecteCreator instance;
private InsecteCreator() {}
public static InsecteCreator getInstance() {
if (instance == null) {
instance = new InsecteCreator();
}
return instance;
}
@Override
public boolean VerifierType(String typeEspece) {
if(typeEspece.equals("Insecte"))
return true;
else return false;
}
@Override
public Espece CreerEspece(String nom, String continents, int dureeVie , RegimeAlimentaire regime, Habitat habitat, String photo, String champSupp)
{
int nbPattes= Integer.parseInt(champSupp);
Insecte insecte= new Insecte(nom,continents,dureeVie,regime,habitat,photo, nbPattes);
return insecte;
}
} | UTF-8 | Java | 869 | java | InsecteCreator.java | Java | [] | null | [] |
import Enum.*;
public class InsecteCreator extends EspeceCreator {
//implémenter le patron Singleton
private static InsecteCreator instance;
private InsecteCreator() {}
public static InsecteCreator getInstance() {
if (instance == null) {
instance = new InsecteCreator();
}
return instance;
}
@Override
public boolean VerifierType(String typeEspece) {
if(typeEspece.equals("Insecte"))
return true;
else return false;
}
@Override
public Espece CreerEspece(String nom, String continents, int dureeVie , RegimeAlimentaire regime, Habitat habitat, String photo, String champSupp)
{
int nbPattes= Integer.parseInt(champSupp);
Insecte insecte= new Insecte(nom,continents,dureeVie,regime,habitat,photo, nbPattes);
return insecte;
}
} | 869 | 0.664747 | 0.664747 | 31 | 27 | 31.436573 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.677419 | false | false | 9 |
a61768d9db9981f0d65e7b7a889c97204eef3ba8 | 37,203,006,741,727 | 2bc95638cf5a4a9dcfa30437ee1e50650e4b90b4 | /user-service/src/test/java/com/gigantes/userservice/api/mapper/UserResourceMapperTest.java | af0d32e1c679d2936712cca2bbad39b56d154351 | [] | no_license | RTS/gigantes | https://github.com/RTS/gigantes | ff93c31e740b1a9426ca38f33bf2ebf28733da4d | e135e8099f77c6d80961e565588cb239850f4ea2 | refs/heads/master | 2021-12-03T06:16:14.003000 | 2021-12-02T22:39:26 | 2021-12-02T22:40:01 | 51,839,620 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gigantes.userservice.api.mapper;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.atMostOnce;
import static org.mockito.Mockito.verify;
import com.gigantes.userservice.api.resource.AddressResource;
import com.gigantes.userservice.api.resource.AddressResource.AddressResourceBuilder;
import com.gigantes.userservice.api.resource.UserResource;
import com.gigantes.userservice.api.resource.UserResource.UserResourceBuilder;
import com.gigantes.userservice.domain.model.AddressModel;
import com.gigantes.userservice.domain.model.AddressModel.AddressModelBuilder;
import com.gigantes.userservice.domain.model.UserModel;
import com.gigantes.userservice.domain.model.UserModel.UserModelBuilder;
import java.time.Instant;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
class UserResourceMapperTest {
@InjectMocks
private UserResourceMapper userResourceMapper;
@Spy
private AddressResourceMapper addressResourceMapper;
@Test
void toUserResource() {
// Given
UserModel userModel = anUserModel();
UserResource expected = anUserResource();
// When
UserResource actual = userResourceMapper.toUserResource(userModel);
// Then
assertThat(actual).isEqualTo(expected);
verify(addressResourceMapper, atMostOnce()).toAddressResource(any(AddressModel.class));
}
@Test
void toUserModel() {
// Given
UserResource userResource = anUserResource();
UserModel expected = anUserModel();
// When
UserModel actual = userResourceMapper.toUserModel(userResource);
// Then
assertThat(actual).isEqualTo(expected);
verify(addressResourceMapper, atMostOnce()).toAddressModel(any(AddressResource.class));
}
private UserResource anUserResource() {
return UserResourceBuilder.builder()
.withId("Id")
.withVersion("Version")
.withCreator("Creator")
.withLastModifiedBy("LastModifiedBy")
.withLastModification(Instant.ofEpochMilli(999999000))
.withCreationDate(Instant.ofEpochMilli(999999000))
.withActive(true)
.withFirstName("FirstName")
.withLastName("LastName")
.withAddresses(List.of(AddressResourceBuilder.builder()
.withNumber("1")
.withName("Name")
.withAddress1("Address1")
.withAddress2("Address2")
.withZipCode("ZipCode")
.withCity("City")
.withCountry("Country")
.build()))
.build();
}
private UserModel anUserModel() {
return UserModelBuilder.builder()
.withId("Id")
.withVersion("Version")
.withCreator("Creator")
.withLastModifiedBy("LastModifiedBy")
.withLastModification(Instant.ofEpochMilli(999999000))
.withCreationDate(Instant.ofEpochMilli(999999000))
.withActive(true)
.withFirstName("FirstName")
.withLastName("LastName")
.withAddresses(List.of(AddressModelBuilder.builder()
.withNumber("1")
.withName("Name")
.withAddress1("Address1")
.withAddress2("Address2")
.withZipCode("ZipCode")
.withCity("City")
.withCountry("Country")
.build()))
.build();
}
} | UTF-8 | Java | 3,543 | java | UserResourceMapperTest.java | Java | [
{
"context": " .withActive(true)\n .withFirstName(\"FirstName\")\n .withLastName(\"LastName\")\n .with",
"end": 2390,
"score": 0.9985370635986328,
"start": 2381,
"tag": "NAME",
"value": "FirstName"
},
{
"context": "withFirstName(\"FirstName\")\n .withLastName(\"LastName\")\n .withAddresses(List.of(AddressResourceB",
"end": 2424,
"score": 0.9987724423408508,
"start": 2416,
"tag": "NAME",
"value": "LastName"
},
{
"context": " .withNumber(\"1\")\n .withName(\"Name\")\n .withAddress1(\"Address1\")\n ",
"end": 2547,
"score": 0.9958236217498779,
"start": 2543,
"tag": "NAME",
"value": "Name"
},
{
"context": " .withActive(true)\n .withFirstName(\"FirstName\")\n .withLastName(\"LastName\")\n .with",
"end": 3161,
"score": 0.9989252686500549,
"start": 3152,
"tag": "NAME",
"value": "FirstName"
},
{
"context": "withFirstName(\"FirstName\")\n .withLastName(\"LastName\")\n .withAddresses(List.of(AddressModelBuil",
"end": 3195,
"score": 0.9988739490509033,
"start": 3187,
"tag": "NAME",
"value": "LastName"
},
{
"context": " .withNumber(\"1\")\n .withName(\"Name\")\n .withAddress1(\"Address1\")\n ",
"end": 3315,
"score": 0.9969242215156555,
"start": 3311,
"tag": "NAME",
"value": "Name"
}
] | null | [] | package com.gigantes.userservice.api.mapper;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.atMostOnce;
import static org.mockito.Mockito.verify;
import com.gigantes.userservice.api.resource.AddressResource;
import com.gigantes.userservice.api.resource.AddressResource.AddressResourceBuilder;
import com.gigantes.userservice.api.resource.UserResource;
import com.gigantes.userservice.api.resource.UserResource.UserResourceBuilder;
import com.gigantes.userservice.domain.model.AddressModel;
import com.gigantes.userservice.domain.model.AddressModel.AddressModelBuilder;
import com.gigantes.userservice.domain.model.UserModel;
import com.gigantes.userservice.domain.model.UserModel.UserModelBuilder;
import java.time.Instant;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
class UserResourceMapperTest {
@InjectMocks
private UserResourceMapper userResourceMapper;
@Spy
private AddressResourceMapper addressResourceMapper;
@Test
void toUserResource() {
// Given
UserModel userModel = anUserModel();
UserResource expected = anUserResource();
// When
UserResource actual = userResourceMapper.toUserResource(userModel);
// Then
assertThat(actual).isEqualTo(expected);
verify(addressResourceMapper, atMostOnce()).toAddressResource(any(AddressModel.class));
}
@Test
void toUserModel() {
// Given
UserResource userResource = anUserResource();
UserModel expected = anUserModel();
// When
UserModel actual = userResourceMapper.toUserModel(userResource);
// Then
assertThat(actual).isEqualTo(expected);
verify(addressResourceMapper, atMostOnce()).toAddressModel(any(AddressResource.class));
}
private UserResource anUserResource() {
return UserResourceBuilder.builder()
.withId("Id")
.withVersion("Version")
.withCreator("Creator")
.withLastModifiedBy("LastModifiedBy")
.withLastModification(Instant.ofEpochMilli(999999000))
.withCreationDate(Instant.ofEpochMilli(999999000))
.withActive(true)
.withFirstName("FirstName")
.withLastName("LastName")
.withAddresses(List.of(AddressResourceBuilder.builder()
.withNumber("1")
.withName("Name")
.withAddress1("Address1")
.withAddress2("Address2")
.withZipCode("ZipCode")
.withCity("City")
.withCountry("Country")
.build()))
.build();
}
private UserModel anUserModel() {
return UserModelBuilder.builder()
.withId("Id")
.withVersion("Version")
.withCreator("Creator")
.withLastModifiedBy("LastModifiedBy")
.withLastModification(Instant.ofEpochMilli(999999000))
.withCreationDate(Instant.ofEpochMilli(999999000))
.withActive(true)
.withFirstName("FirstName")
.withLastName("LastName")
.withAddresses(List.of(AddressModelBuilder.builder()
.withNumber("1")
.withName("Name")
.withAddress1("Address1")
.withAddress2("Address2")
.withZipCode("ZipCode")
.withCity("City")
.withCountry("Country")
.build()))
.build();
}
} | 3,543 | 0.704488 | 0.691504 | 107 | 32.121494 | 22.897459 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.336449 | false | false | 9 |
bc68fa251d01ee0fc7fe96a8066754e625b33567 | 25,761,213,897,856 | 7c77c9a58c606e056b816c9f7697c4c22e857caa | /model/src/main/java/com/brightdairy/personal/model/HttpReqBody/DeleteAddress.java | 3fc044bfacf9587148edffe85012396c5f6babc8 | [
"MIT"
] | permissive | mookaka/brightdairy | https://github.com/mookaka/brightdairy | 633ac617c864a4c10514789e583de14aa9974d09 | 696979849e943e874870ead40caff22af9a29f64 | refs/heads/master | 2020-05-21T19:22:34.583000 | 2016-10-12T02:21:07 | 2016-10-12T02:21:07 | 65,796,932 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.brightdairy.personal.model.HttpReqBody;
/**
* Created by shuangmusuihua on 2016/9/30.
*/
public class DeleteAddress
{
public String contactMechId;
public String partyId;
}
| UTF-8 | Java | 196 | java | DeleteAddress.java | Java | [
{
"context": "iry.personal.model.HttpReqBody;\n\n/**\n * Created by shuangmusuihua on 2016/9/30.\n */\n\npublic class DeleteAddress\n{\n ",
"end": 85,
"score": 0.9980946779251099,
"start": 71,
"tag": "USERNAME",
"value": "shuangmusuihua"
}
] | null | [] | package com.brightdairy.personal.model.HttpReqBody;
/**
* Created by shuangmusuihua on 2016/9/30.
*/
public class DeleteAddress
{
public String contactMechId;
public String partyId;
}
| 196 | 0.739796 | 0.704082 | 11 | 16.818182 | 18.21497 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false | 9 |
dfcd2fd7997fdeb5d9cc675555ce80db0fb430db | 39,092,792,334,792 | b6b4ac0d80d94b2b2b26468cc8857a286f4de6f1 | /src/it/polito/tdp/extflightdelays/model/Model.java | 3a520605f2c8e0e9ead3d9aa9353564a7e948757 | [] | no_license | lcgiorgia96/2018-07-02-B | https://github.com/lcgiorgia96/2018-07-02-B | 623609f6ad81f9d100f0b4457d6eb590b7d0cf61 | 015e492f4862d51889aecd00a3c8a1114fcc7978 | refs/heads/master | 2020-05-26T09:06:56.196000 | 2019-06-25T11:37:09 | 2019-06-25T11:37:09 | 188,179,206 | 0 | 0 | null | true | 2019-05-23T07:00:23 | 2019-05-23T07:00:23 | 2018-07-02T14:57:26 | 2018-07-02T14:57:12 | 4,136 | 0 | 0 | 0 | null | false | false | package it.polito.tdp.extflightdelays.model;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.jgrapht.Graph;
import org.jgrapht.Graphs;
import org.jgrapht.graph.DefaultWeightedEdge;
import org.jgrapht.graph.SimpleWeightedGraph;
import it.polito.tdp.extflightdelays.db.ExtFlightDelaysDAO;
public class Model {
Graph<Airport,DefaultWeightedEdge> grafo;
List<Airport> aer ;
ExtFlightDelaysDAO dao;
Map<Integer,Airport> idMap;
List<Airport> best;
List<Airport> fin;
Airport a;
double totOre;
public Model () {
dao = new ExtFlightDelaysDAO();
fin = new ArrayList<>();
}
public void creaGrafo(int x) {
aer = dao.getAer(x);
idMap = new HashMap<>();
grafo = new SimpleWeightedGraph<>(DefaultWeightedEdge.class);
Graphs.addAllVertices(this.grafo, aer);
for (Airport a: grafo.vertexSet()) {
idMap.put(a.getId(), a);
}
System.out.println(grafo.vertexSet().size());
List<Rotta> rotte = dao.getRotte(idMap);
for (Rotta r: rotte) {
Airport a1 = r.getA1();
Airport a2 = r.getA2();
double peso = r.getMedia();
if (grafo.getEdge(a1, a2)==null) {
Graphs.addEdge(this.grafo, a1, a2, peso);
} else {
grafo.setEdgeWeight(grafo.getEdge(a1, a2), (grafo.getEdgeWeight(grafo.getEdge(a1, a2))+peso)/2);
}
}
System.out.println(grafo.edgeSet().size());
}
public List<Airport> getAer() {
return aer;
}
public List<Airport> getConnessi(Airport a) {
List<Airport> conn = Graphs.neighborListOf(this.grafo, a);
List<Rotta> r = new ArrayList<>();
for (Airport a1: conn) {
r.add(new Rotta(a,a1,grafo.getEdgeWeight(grafo.getEdge(a, a1))));
}
Collections.sort(r);
//fin = new ArrayList<>();
for (Rotta r2: r) {
fin.add(r2.getA2());
}
return fin;
}
public List<Airport> getItinerario(Airport a, int ore) {
best = new LinkedList<>();
List<Airport> parziale = new LinkedList<>();
this.a=a;
totOre=0.0;
trova(a,parziale,ore);
return best;
}
private void trova(Airport a, List<Airport> parziale, int ore) {
List<Airport> connessi = Graphs.neighborListOf(this.grafo, a);
if (totOre > ore) {
return;
}
for (Airport a2 : connessi) {
if (!parziale.contains(a2) && (totOre+2* grafo.getEdgeWeight(grafo.getEdge(a, a2))< ore)) {
totOre += 2* grafo.getEdgeWeight(grafo.getEdge(a, a2));
parziale.add(a2);
trova (a,parziale,ore);
parziale.remove(parziale.size()-1);
}
}
if (tot(parziale) > tot(best)) {
best = new LinkedList<>(parziale);
}
}
private double tot(List<Airport> parziale) {
double tot = 0.0;
for (Airport a2: parziale) {
tot+=2*(grafo.getEdgeWeight(grafo.getEdge(a, a2)));
}
return tot;
}
public double getTotOre() {
return totOre;
}
}
| UTF-8 | Java | 2,857 | java | Model.java | Java | [] | null | [] | package it.polito.tdp.extflightdelays.model;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.jgrapht.Graph;
import org.jgrapht.Graphs;
import org.jgrapht.graph.DefaultWeightedEdge;
import org.jgrapht.graph.SimpleWeightedGraph;
import it.polito.tdp.extflightdelays.db.ExtFlightDelaysDAO;
public class Model {
Graph<Airport,DefaultWeightedEdge> grafo;
List<Airport> aer ;
ExtFlightDelaysDAO dao;
Map<Integer,Airport> idMap;
List<Airport> best;
List<Airport> fin;
Airport a;
double totOre;
public Model () {
dao = new ExtFlightDelaysDAO();
fin = new ArrayList<>();
}
public void creaGrafo(int x) {
aer = dao.getAer(x);
idMap = new HashMap<>();
grafo = new SimpleWeightedGraph<>(DefaultWeightedEdge.class);
Graphs.addAllVertices(this.grafo, aer);
for (Airport a: grafo.vertexSet()) {
idMap.put(a.getId(), a);
}
System.out.println(grafo.vertexSet().size());
List<Rotta> rotte = dao.getRotte(idMap);
for (Rotta r: rotte) {
Airport a1 = r.getA1();
Airport a2 = r.getA2();
double peso = r.getMedia();
if (grafo.getEdge(a1, a2)==null) {
Graphs.addEdge(this.grafo, a1, a2, peso);
} else {
grafo.setEdgeWeight(grafo.getEdge(a1, a2), (grafo.getEdgeWeight(grafo.getEdge(a1, a2))+peso)/2);
}
}
System.out.println(grafo.edgeSet().size());
}
public List<Airport> getAer() {
return aer;
}
public List<Airport> getConnessi(Airport a) {
List<Airport> conn = Graphs.neighborListOf(this.grafo, a);
List<Rotta> r = new ArrayList<>();
for (Airport a1: conn) {
r.add(new Rotta(a,a1,grafo.getEdgeWeight(grafo.getEdge(a, a1))));
}
Collections.sort(r);
//fin = new ArrayList<>();
for (Rotta r2: r) {
fin.add(r2.getA2());
}
return fin;
}
public List<Airport> getItinerario(Airport a, int ore) {
best = new LinkedList<>();
List<Airport> parziale = new LinkedList<>();
this.a=a;
totOre=0.0;
trova(a,parziale,ore);
return best;
}
private void trova(Airport a, List<Airport> parziale, int ore) {
List<Airport> connessi = Graphs.neighborListOf(this.grafo, a);
if (totOre > ore) {
return;
}
for (Airport a2 : connessi) {
if (!parziale.contains(a2) && (totOre+2* grafo.getEdgeWeight(grafo.getEdge(a, a2))< ore)) {
totOre += 2* grafo.getEdgeWeight(grafo.getEdge(a, a2));
parziale.add(a2);
trova (a,parziale,ore);
parziale.remove(parziale.size()-1);
}
}
if (tot(parziale) > tot(best)) {
best = new LinkedList<>(parziale);
}
}
private double tot(List<Airport> parziale) {
double tot = 0.0;
for (Airport a2: parziale) {
tot+=2*(grafo.getEdgeWeight(grafo.getEdge(a, a2)));
}
return tot;
}
public double getTotOre() {
return totOre;
}
}
| 2,857 | 0.662583 | 0.650683 | 133 | 20.481203 | 20.627234 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.18797 | false | false | 9 |
3426ee916573dbbcc8c516e470c64476fdb0e876 | 5,385,889,048,303 | 243eaf02e124f89a21c5d5afa707db40feda5144 | /src/unk/com/tencent/mm/ui/video/w.java | aa30ee4e5c821da1e726ed13e3a59119d26ac989 | [] | no_license | laohanmsa/WeChatRE | https://github.com/laohanmsa/WeChatRE | e6671221ac6237c6565bd1aae02f847718e4ac9d | 4b249bce4062e1f338f3e4bbee273b2a88814bf3 | refs/heads/master | 2020-05-03T08:43:38.647000 | 2013-05-18T14:04:23 | 2013-05-18T14:04:23 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package unk.com.tencent.mm.ui.video;
import android.widget.ImageView;
import android.widget.TextView;
import com.tencent.mm.af.a;
import com.tencent.mm.platformtools.bf;
import com.tencent.mm.sdk.platformtools.ac;
import com.tencent.mm.sdk.platformtools.n;
final class w
implements ac
{
w(VideoRecorderUI paramVideoRecorderUI)
{
}
public final boolean cU()
{
if (VideoRecorderUI.a(this.cZf) == -1L)
VideoRecorderUI.a(this.cZf, bf.tF());
long l = bf.C(VideoRecorderUI.a(this.cZf));
VideoRecorderUI.b(this.cZf).setText(bf.cI((int)(l / 1000L)));
if ((l <= 30000L) && (l >= 20000L))
{
VideoRecorderUI.c(this.cZf).setVisibility(0);
TextView localTextView = VideoRecorderUI.c(this.cZf);
VideoRecorderUI localVideoRecorderUI = this.cZf;
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = Long.valueOf((30000L - l) / 1000L);
localTextView.setText(localVideoRecorderUI.getString(2131166609, arrayOfObject));
}
while (l >= 30000L)
{
n.al("MicroMsg.VideoRecorderUI", "record stop on countdown");
VideoRecorderUI.d(this.cZf).setImageDrawable(a.i(this.cZf, 2130838888));
VideoRecorderUI.e(this.cZf);
VideoRecorderUI.a(this.cZf, -1L);
return false;
VideoRecorderUI.c(this.cZf).setVisibility(8);
}
VideoRecorderUI.a(this.cZf, VideoRecorderUI.f(this.cZf) % 2);
if (VideoRecorderUI.f(this.cZf) == 0)
VideoRecorderUI.d(this.cZf).setImageDrawable(a.i(this.cZf, 2130838888));
while (true)
{
VideoRecorderUI.g(this.cZf);
return true;
VideoRecorderUI.d(this.cZf).setImageDrawable(a.i(this.cZf, 2130838889));
}
}
}
/* Location: /home/danghvu/0day/WeChat/WeChat_4.5_dex2jar.jar
* Qualified Name: com.tencent.mm.ui.video.w
* JD-Core Version: 0.6.2
*/ | UTF-8 | Java | 1,829 | java | w.java | Java | [] | null | [] | package unk.com.tencent.mm.ui.video;
import android.widget.ImageView;
import android.widget.TextView;
import com.tencent.mm.af.a;
import com.tencent.mm.platformtools.bf;
import com.tencent.mm.sdk.platformtools.ac;
import com.tencent.mm.sdk.platformtools.n;
final class w
implements ac
{
w(VideoRecorderUI paramVideoRecorderUI)
{
}
public final boolean cU()
{
if (VideoRecorderUI.a(this.cZf) == -1L)
VideoRecorderUI.a(this.cZf, bf.tF());
long l = bf.C(VideoRecorderUI.a(this.cZf));
VideoRecorderUI.b(this.cZf).setText(bf.cI((int)(l / 1000L)));
if ((l <= 30000L) && (l >= 20000L))
{
VideoRecorderUI.c(this.cZf).setVisibility(0);
TextView localTextView = VideoRecorderUI.c(this.cZf);
VideoRecorderUI localVideoRecorderUI = this.cZf;
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = Long.valueOf((30000L - l) / 1000L);
localTextView.setText(localVideoRecorderUI.getString(2131166609, arrayOfObject));
}
while (l >= 30000L)
{
n.al("MicroMsg.VideoRecorderUI", "record stop on countdown");
VideoRecorderUI.d(this.cZf).setImageDrawable(a.i(this.cZf, 2130838888));
VideoRecorderUI.e(this.cZf);
VideoRecorderUI.a(this.cZf, -1L);
return false;
VideoRecorderUI.c(this.cZf).setVisibility(8);
}
VideoRecorderUI.a(this.cZf, VideoRecorderUI.f(this.cZf) % 2);
if (VideoRecorderUI.f(this.cZf) == 0)
VideoRecorderUI.d(this.cZf).setImageDrawable(a.i(this.cZf, 2130838888));
while (true)
{
VideoRecorderUI.g(this.cZf);
return true;
VideoRecorderUI.d(this.cZf).setImageDrawable(a.i(this.cZf, 2130838889));
}
}
}
/* Location: /home/danghvu/0day/WeChat/WeChat_4.5_dex2jar.jar
* Qualified Name: com.tencent.mm.ui.video.w
* JD-Core Version: 0.6.2
*/ | 1,829 | 0.674139 | 0.628759 | 56 | 31.678572 | 24.810789 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 9 |
6d35caa70ad2f63c7817b7876d37fe4f71dd9eec | 31,198,642,503,979 | c5274714b5ce6fed147b5bd60a9017c778296dec | /src/main/java/sk/tuke/kpi/oop/game/items/Hammer.java | 9db5de54fa6ed8d44fe86e27fe01ccd760cd6220 | [] | no_license | k-paluch/project-ellen | https://github.com/k-paluch/project-ellen | 9bcc1ec36be603a66d5de903b72c58a929b3bbe4 | 3a326194463ff72162bbfc0df15bca912e24298e | refs/heads/master | 2022-12-20T13:27:16.897000 | 2018-12-18T18:12:24 | 2018-12-18T18:12:24 | 293,914,659 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sk.tuke.kpi.oop.game.items;
import sk.tuke.kpi.gamelib.graphics.Animation;
import sk.tuke.kpi.oop.game.Repairable;
public class Hammer extends BreakableTool<Repairable> {
private Animation normalAnimation;
public Hammer(){
super(1);
this.normalAnimation = new Animation("sprites/hammer.png", 16, 16);
setAnimation(this.normalAnimation);
}
public Hammer(int remainingUses){
super(remainingUses);
this.normalAnimation = new Animation("sprites/hammer.png", 16, 16);
setAnimation(this.normalAnimation);
}
@Override
public void useWith(Repairable repairable) {
if ((repairable != null) && (repairable.repair())){
super.useWith(repairable);
}
}
@Override
public Class<Repairable> getUsingActorClass() {
return Repairable.class;
}
}
| UTF-8 | Java | 869 | java | Hammer.java | Java | [] | null | [] | package sk.tuke.kpi.oop.game.items;
import sk.tuke.kpi.gamelib.graphics.Animation;
import sk.tuke.kpi.oop.game.Repairable;
public class Hammer extends BreakableTool<Repairable> {
private Animation normalAnimation;
public Hammer(){
super(1);
this.normalAnimation = new Animation("sprites/hammer.png", 16, 16);
setAnimation(this.normalAnimation);
}
public Hammer(int remainingUses){
super(remainingUses);
this.normalAnimation = new Animation("sprites/hammer.png", 16, 16);
setAnimation(this.normalAnimation);
}
@Override
public void useWith(Repairable repairable) {
if ((repairable != null) && (repairable.repair())){
super.useWith(repairable);
}
}
@Override
public Class<Repairable> getUsingActorClass() {
return Repairable.class;
}
}
| 869 | 0.658228 | 0.647871 | 33 | 25.333334 | 22.944817 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.484848 | false | false | 9 |
eaee03591019dcfe9bc69d73000f5ba88ea5d90b | 11,132,555,250,568 | 5ccf598d3ca1de9ba26cd434f4de76b34230f332 | /src/main/java/br/com/luiza/labs/messagedeliveryspring/app/repositories/MessageRepository.java | c0bf154d487d34e11240d02daf3ded8b2fb6b567 | [
"Apache-2.0"
] | permissive | lucasnata/MessageDelivery | https://github.com/lucasnata/MessageDelivery | 39b957fda3437c1198f433e4e4b95ed668244b58 | 207d634d3469501aa5d6151ff02c431790f07139 | refs/heads/master | 2022-12-08T18:54:15.177000 | 2020-09-10T02:30:46 | 2020-09-10T02:30:46 | 293,187,089 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.luiza.labs.messagedeliveryspring.app.repositories;
import br.com.luiza.labs.messagedeliveryspring.domain.entities.Message;
import br.com.luiza.labs.messagedeliveryspring.domain.vos.MessageStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.math.BigInteger;
import java.util.List;
@Repository
public interface MessageRepository extends JpaRepository<Message, BigInteger> {
List<Message> findByMessageStatus(MessageStatus status);
}
| UTF-8 | Java | 533 | java | MessageRepository.java | Java | [] | null | [] | package br.com.luiza.labs.messagedeliveryspring.app.repositories;
import br.com.luiza.labs.messagedeliveryspring.domain.entities.Message;
import br.com.luiza.labs.messagedeliveryspring.domain.vos.MessageStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.math.BigInteger;
import java.util.List;
@Repository
public interface MessageRepository extends JpaRepository<Message, BigInteger> {
List<Message> findByMessageStatus(MessageStatus status);
}
| 533 | 0.844278 | 0.844278 | 14 | 37.07143 | 29.955835 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.642857 | false | false | 9 |
0882112cf5a70b5df02365c526ee9faac6aeb784 | 24,747,601,562,770 | d0e74ff6e8d37984cea892dfe8508e2b44de5446 | /logistics-wms-city-1.1.3.44.5/logistics-wms-city-manager/src/main/java/com/yougou/logistics/city/manager/BmPrintLogManager.java | efb62d2cdc21d4894ed5c56c269b5e2cff874cb7 | [] | no_license | heaven6059/wms | https://github.com/heaven6059/wms | fb39f31968045ba7e0635a4416a405a226448b5a | 5885711e188e8e5c136956956b794f2a2d2e2e81 | refs/heads/master | 2021-01-14T11:20:10.574000 | 2015-04-11T08:11:59 | 2015-04-11T08:11:59 | 29,462,213 | 1 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yougou.logistics.city.manager;
import java.util.List;
import com.yougou.logistics.base.common.exception.ManagerException;
import com.yougou.logistics.base.manager.BaseCrudManager;
import com.yougou.logistics.city.common.model.SystemUser;
/*
* 请写出类的用途
* @author yougoupublic
* @date Fri Mar 07 17:41:16 CST 2014
* @version 1.0.0
* @copyright (C) 2013 YouGou Information Technology Co.,Ltd
* All Rights Reserved.
*
* The software for the YouGou technology development, without the
* company's written consent, and any other individuals and
* organizations shall not be used, Copying, Modify or distribute
* the software.
*
*/
public interface BmPrintLogManager extends BaseCrudManager {
public List<String> getLabelPrefix(SystemUser user, int qty, String printType, String storeName)
throws ManagerException;
/**
* 获取完整模板的标签
* @param user
* @param printType
* @param dataStr storeNo_storeName_qty_bufferName
* @return
* @throws ManagerException
*/
public Object getLabel4Full(SystemUser user,String printType,String dataStr)throws ManagerException;
} | UTF-8 | Java | 1,169 | java | BmPrintLogManager.java | Java | [
{
"context": "ommon.model.SystemUser;\n\n/*\n * 请写出类的用途 \n * @author yougoupublic\n * @date Fri Mar 07 17:41:16 CST 2014\n * @versio",
"end": 291,
"score": 0.9995887875556946,
"start": 279,
"tag": "USERNAME",
"value": "yougoupublic"
}
] | null | [] | package com.yougou.logistics.city.manager;
import java.util.List;
import com.yougou.logistics.base.common.exception.ManagerException;
import com.yougou.logistics.base.manager.BaseCrudManager;
import com.yougou.logistics.city.common.model.SystemUser;
/*
* 请写出类的用途
* @author yougoupublic
* @date Fri Mar 07 17:41:16 CST 2014
* @version 1.0.0
* @copyright (C) 2013 YouGou Information Technology Co.,Ltd
* All Rights Reserved.
*
* The software for the YouGou technology development, without the
* company's written consent, and any other individuals and
* organizations shall not be used, Copying, Modify or distribute
* the software.
*
*/
public interface BmPrintLogManager extends BaseCrudManager {
public List<String> getLabelPrefix(SystemUser user, int qty, String printType, String storeName)
throws ManagerException;
/**
* 获取完整模板的标签
* @param user
* @param printType
* @param dataStr storeNo_storeName_qty_bufferName
* @return
* @throws ManagerException
*/
public Object getLabel4Full(SystemUser user,String printType,String dataStr)throws ManagerException;
} | 1,169 | 0.743184 | 0.725594 | 35 | 31.514286 | 28.497992 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.514286 | false | false | 9 |
f464110693369ade352bd15441eadfa722a74bae | 18,820,546,752,671 | 263c4eca9bae866f01249057f1ad023e0bd898a4 | /src/main/java/com/emergency/api/utils/PrintableInputStream.java | 41a4dda9e812760e8a567735e24f383305bed27b | [
"MIT"
] | permissive | liupeng826/emergency-api | https://github.com/liupeng826/emergency-api | b0b2737ea72a3004d1b4455f4c846270d88f4683 | 33b4f0ab7d3dec5abe42fe7e2ba19a77a89ea4c8 | refs/heads/master | 2020-01-23T21:46:18.473000 | 2019-10-25T12:15:34 | 2019-10-25T12:15:34 | 75,400,130 | 0 | 0 | MIT | false | 2021-03-22T23:57:22 | 2016-12-02T13:57:09 | 2019-10-25T12:15:36 | 2021-03-22T23:57:20 | 2,661 | 0 | 0 | 1 | Java | false | false | package com.emergency.api.utils;
import java.io.IOException;
import java.io.InputStream;
/**
* 可计算输入流读取数类,对于普通的字节流直接可以用本类来包装,获取当前读取的字节数
* {@link #
* getStreamCount()}
*
* @author liken
* @date 15/3/14
*/
public class PrintableInputStream extends InputStream {
/**
* 每读取一个字节,记录一次, 当流处理完毕之后,再查询该Count的值,就是读取的总字节数
*/
private InputStream delegateInputStream;
private AutoArray array;
private boolean removeNewLine;//是否去掉换行符
public PrintableInputStream(InputStream in) {
this(in, true);
}
public PrintableInputStream(InputStream in, boolean removeNewLine) {
if (in == null) {
throw new NullPointerException("the source inputstream should not be null.");
}
this.delegateInputStream = in;
array = new AutoArray();
this.removeNewLine = removeNewLine;
}
@Override
public int read() throws IOException {
int result = -1;
result = delegateInputStream.read();
if (result != -1) {//如果是一次有效的读取,则计数器 +1
if (removeNewLine) {
if (!isNewLine(result)) {
array.append(result);
}
} else {
array.append(result);
}
}
return result;
}
private boolean isNewLine(int result) {
return result == '\n' || result == '\r';
}
/**
* 获取流的大小
*
* @return
*/
public int getLength() {
return array.getPos();
}
@Override
public String toString() {
if (array.isEmpty()) {
return "";
}
return array.asString();
}
}
| UTF-8 | Java | 1,871 | java | PrintableInputStream.java | Java | [
{
"context": "字节数\n * {@link #\n * getStreamCount()}\n *\n * @author liken\n * @date 15/3/14\n */\npublic class PrintableInputS",
"end": 191,
"score": 0.9995714426040649,
"start": 186,
"tag": "USERNAME",
"value": "liken"
}
] | null | [] | package com.emergency.api.utils;
import java.io.IOException;
import java.io.InputStream;
/**
* 可计算输入流读取数类,对于普通的字节流直接可以用本类来包装,获取当前读取的字节数
* {@link #
* getStreamCount()}
*
* @author liken
* @date 15/3/14
*/
public class PrintableInputStream extends InputStream {
/**
* 每读取一个字节,记录一次, 当流处理完毕之后,再查询该Count的值,就是读取的总字节数
*/
private InputStream delegateInputStream;
private AutoArray array;
private boolean removeNewLine;//是否去掉换行符
public PrintableInputStream(InputStream in) {
this(in, true);
}
public PrintableInputStream(InputStream in, boolean removeNewLine) {
if (in == null) {
throw new NullPointerException("the source inputstream should not be null.");
}
this.delegateInputStream = in;
array = new AutoArray();
this.removeNewLine = removeNewLine;
}
@Override
public int read() throws IOException {
int result = -1;
result = delegateInputStream.read();
if (result != -1) {//如果是一次有效的读取,则计数器 +1
if (removeNewLine) {
if (!isNewLine(result)) {
array.append(result);
}
} else {
array.append(result);
}
}
return result;
}
private boolean isNewLine(int result) {
return result == '\n' || result == '\r';
}
/**
* 获取流的大小
*
* @return
*/
public int getLength() {
return array.getPos();
}
@Override
public String toString() {
if (array.isEmpty()) {
return "";
}
return array.asString();
}
}
| 1,871 | 0.558629 | 0.553818 | 83 | 19.036144 | 19.181093 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.313253 | false | false | 9 |
84883864e87825c0c73592fec21f0bf669757a69 | 1,786,706,408,087 | fe4ff53748d587dfe9a097d9c095e6985de33037 | /MinimumGeneticMutation.java | 917e11214810893791dd95575f844640440ca6f1 | [] | no_license | lamthao1995/LeetCode.com | https://github.com/lamthao1995/LeetCode.com | f8f848d7d537d6e1507c302941cd1db72907a135 | 2bfadac71d16d52956655ebf760d0282e9d7461e | refs/heads/master | 2021-01-15T22:34:41.006000 | 2017-08-21T22:21:04 | 2017-08-21T22:21:04 | 99,902,780 | 6 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class Solution {
public int minMutation(String start, String end, String[] bank) {
if(bank == null || bank.length == 0){
return -1;
}
Set<String> visited = new HashSet();
Set<String> bankSet = new HashSet();
for(String s : bank){
bankSet.add(s);
}
char[] charSet = {'A', 'T', 'G', 'C'};
Queue<String> queue = new LinkedList();
queue.add(start);
int level = 0;
while(!queue.isEmpty()){
int size = queue.size();
while(size-- > 0){
String s = queue.poll();
if(s.equals(end))
return level;
char[] arr = s.toCharArray();
for(int i = 0; i < arr.length; i++){
char tmp = arr[i];
for(char c : charSet){
arr[i] = c;
String newS = new String(arr);
if(!visited.contains(newS) && bankSet.contains(newS)){
queue.add(newS);
visited.add(newS);
}
}
arr[i] = tmp;
}
}
level++;
}
return -1;
}
} | UTF-8 | Java | 1,337 | java | MinimumGeneticMutation.java | Java | [] | null | [] | public class Solution {
public int minMutation(String start, String end, String[] bank) {
if(bank == null || bank.length == 0){
return -1;
}
Set<String> visited = new HashSet();
Set<String> bankSet = new HashSet();
for(String s : bank){
bankSet.add(s);
}
char[] charSet = {'A', 'T', 'G', 'C'};
Queue<String> queue = new LinkedList();
queue.add(start);
int level = 0;
while(!queue.isEmpty()){
int size = queue.size();
while(size-- > 0){
String s = queue.poll();
if(s.equals(end))
return level;
char[] arr = s.toCharArray();
for(int i = 0; i < arr.length; i++){
char tmp = arr[i];
for(char c : charSet){
arr[i] = c;
String newS = new String(arr);
if(!visited.contains(newS) && bankSet.contains(newS)){
queue.add(newS);
visited.add(newS);
}
}
arr[i] = tmp;
}
}
level++;
}
return -1;
}
} | 1,337 | 0.372476 | 0.367988 | 39 | 32.333332 | 16.579773 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.74359 | false | false | 9 |
5c5730fabf5489908f599ff9d48adf38b7976635 | 10,093,173,163,251 | f4d8d803134785c29cedd2694b684da975b85cf1 | /kakao/src/Test3.java | 33a496f96c88b4648624aff0c633150c86e85bb2 | [] | no_license | jinioh88/Runnit | https://github.com/jinioh88/Runnit | db9c5074cc8f59b033ad84633f307b69bceee61f | 706893fd5f12d0f5f6440c23cd508fba49b4341c | refs/heads/master | 2018-10-23T10:34:42.160000 | 2018-09-11T13:23:46 | 2018-09-11T13:23:46 | 145,277,234 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.*;
/*
캐시
*/
public class Test3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int cashsize = sc.nextInt();
String[] cities = {"Jeju", "Pangyo", "Seoul", "NewYork", "LA", "Jeju", "Pangyo", "Seoul", "NewYork", "LA"};
Test3 test = new Test3();
System.out.println(test.solution(cashsize,cities));
}
public int solution(int cacheSize, String[] cities) {
int answer = 0;
Set<String> list = new HashSet<>();
list.add(cities[0]);
for(int i=1;i<cities.length;i++) {
for(int j=0;j<cacheSize;j++) {
if(list.contains(cities[j])) {
answer+=1;
list.add(cities[i]);
break;
} else {
answer+=5;
list.add(cities[i]);
break;
}
}
}
return answer;
}
}
| UTF-8 | Java | 989 | java | Test3.java | Java | [] | null | [] | import java.util.*;
/*
캐시
*/
public class Test3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int cashsize = sc.nextInt();
String[] cities = {"Jeju", "Pangyo", "Seoul", "NewYork", "LA", "Jeju", "Pangyo", "Seoul", "NewYork", "LA"};
Test3 test = new Test3();
System.out.println(test.solution(cashsize,cities));
}
public int solution(int cacheSize, String[] cities) {
int answer = 0;
Set<String> list = new HashSet<>();
list.add(cities[0]);
for(int i=1;i<cities.length;i++) {
for(int j=0;j<cacheSize;j++) {
if(list.contains(cities[j])) {
answer+=1;
list.add(cities[i]);
break;
} else {
answer+=5;
list.add(cities[i]);
break;
}
}
}
return answer;
}
}
| 989 | 0.452792 | 0.443655 | 35 | 27.142857 | 22.70575 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.885714 | false | false | 9 |
6b40ac0464edb62e7e06955511300545c018a001 | 10,445,360,479,768 | 62c401553d2d9590679e0406340610f5ddb7dadb | /src/main/java/com/entities/Product.java | 23ac6557cd190d47e654a7b7dcdc14c1702c0f70 | [] | no_license | BenRub/openu_workshop_client | https://github.com/BenRub/openu_workshop_client | e1fa5ddcbf0db2b216bd3c269fe67eeecbaa5f9f | fb5f56e55ee37121e95772593efafc56ee3917d2 | refs/heads/master | 2020-03-27T00:31:47.111000 | 2018-09-12T21:46:10 | 2018-09-12T21:46:10 | 145,630,572 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.entities;
public class Product extends EntityWithId {
public String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String imageUrl;
public String getImageUrl() { return imageUrl; }
public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; }
public String category;
public String getCategory() { return category; }
public void setCategory(String category) { this.category = category; }
public String vendor;
public String getVendor() { return vendor; }
public void setVendor(String vendor) { this.vendor = vendor; }
public String description;
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public double price;
public double getPrice() { return price; }
public void setPrice(double price) { this.price = price; }
public int unitsInStock;
public int getUnitsInStock() { return unitsInStock; }
public void setUnitsInStock(int unitsInStock) { this.unitsInStock = unitsInStock; }
public int discount;
public int getDiscount() { return discount; }
public void setDiscount(int discount) { this.discount = discount; }
}
| UTF-8 | Java | 1,414 | java | Product.java | Java | [] | null | [] |
package com.entities;
public class Product extends EntityWithId {
public String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String imageUrl;
public String getImageUrl() { return imageUrl; }
public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; }
public String category;
public String getCategory() { return category; }
public void setCategory(String category) { this.category = category; }
public String vendor;
public String getVendor() { return vendor; }
public void setVendor(String vendor) { this.vendor = vendor; }
public String description;
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
public double price;
public double getPrice() { return price; }
public void setPrice(double price) { this.price = price; }
public int unitsInStock;
public int getUnitsInStock() { return unitsInStock; }
public void setUnitsInStock(int unitsInStock) { this.unitsInStock = unitsInStock; }
public int discount;
public int getDiscount() { return discount; }
public void setDiscount(int discount) { this.discount = discount; }
}
| 1,414 | 0.649929 | 0.649929 | 37 | 36.162163 | 28.27425 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.675676 | false | false | 9 |
b1679bb3e51abb9559e36bb0757275b1db93a1d2 | 33,217,277,131,330 | f076d92da1308e8ab0d0ee16733435b867e9119e | /src/main/java/com/example/springatm/service/impl/AtmServiceImpl.java | 35108f18d06bb9ce3005de06bbce6221948f972a | [] | no_license | IvanKrivoruchkoHub/spring-atm | https://github.com/IvanKrivoruchkoHub/spring-atm | 67ee399992c992b63b18d95405c8d01626e7c1b2 | 3a74381d448b85cfa71e479d8a2bb894d0e8dab0 | refs/heads/master | 2022-06-19T01:51:38.584000 | 2020-05-03T22:35:47 | 2020-05-03T22:35:47 | 256,308,093 | 0 | 0 | null | false | 2020-04-30T08:47:27 | 2020-04-16T19:18:19 | 2020-04-16T19:47:01 | 2020-04-30T08:47:26 | 81 | 0 | 0 | 0 | Java | false | false | package com.example.springatm.service.impl;
import com.example.springatm.entity.Atm;
import com.example.springatm.entity.BankAccount;
import com.example.springatm.entity.Banknote;
import com.example.springatm.repository.AtmRepository;
import com.example.springatm.service.AtmService;
import com.example.springatm.service.BankAccountService;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ResponseStatusException;
@Service
public class AtmServiceImpl implements AtmService {
@Autowired
private AtmRepository atmRepository;
@Autowired
private BankAccountService bankAccountService;
@Override
public Atm save(Atm atm) {
return atmRepository.save(atm);
}
@Override
public Atm findById(Long id) {
Optional<Atm> atm = atmRepository.findById(id);
if (atm.isEmpty()) {
throw new ResponseStatusException(
HttpStatus.INTERNAL_SERVER_ERROR,
"Can't find ATM by id = " + id);
}
return atm.get();
}
@Override
public Map<Banknote, Long> getBanknotesFromAtm(BigDecimal sum,
String numberOfAccount, Long atmId) {
BankAccount bankAccount = bankAccountService
.findByNumberOfBankAccount(numberOfAccount);
Atm atm = findById(atmId);
if (bankAccount.getSum().compareTo(sum) < 0) {
throw new ResponseStatusException(
HttpStatus.INTERNAL_SERVER_ERROR,
"Not enough money on bankAccount. You have : " + bankAccount.getSum());
}
BigDecimal sumAtm = getSumFromMapOfBanknotes(atm.getBanknotes());
if (sumAtm.compareTo(sum) < 0) {
throw new ResponseStatusException(
HttpStatus.INTERNAL_SERVER_ERROR,
"Not enough money on atm!");
}
if (!sum.remainder(new BigDecimal(100))
.equals(new BigDecimal(0))) {
throw new ResponseStatusException(
HttpStatus.INTERNAL_SERVER_ERROR,
"Choose the sum that multiple of 100");
}
Map<Banknote, Long> result = new HashMap<>();
List<Banknote> banknoteList = new ArrayList<>(atm.getBanknotes().keySet());
banknoteList.sort(Collections.reverseOrder());
BigDecimal tempSum = sum;
for (Banknote banknote : banknoteList) {
if (tempSum.equals(new BigDecimal(0))) {
break;
}
Long countBanknotes = tempSum
.divideAndRemainder(new BigDecimal(banknote.getValue()))[0].longValue();
if (countBanknotes > atm.getBanknotes().get(banknote)) {
countBanknotes = atm.getBanknotes().get(banknote);
}
result.put(banknote, countBanknotes);
tempSum = tempSum.subtract(new BigDecimal(countBanknotes * banknote.getValue()));
atm.subtractBanknotes(banknote, countBanknotes);
}
bankAccount.subtractMoney(sum);
bankAccountService.save(bankAccount);
save(atm);
return result;
}
private BigDecimal getSumFromMapOfBanknotes(Map<Banknote, Long> mapOfBanknotes) {
BigDecimal result = new BigDecimal(0);
for (Map.Entry<Banknote, Long> banknoteEntry : mapOfBanknotes.entrySet()) {
result = result.add(new BigDecimal(banknoteEntry
.getKey().getValue() * banknoteEntry.getValue()));
}
return result;
}
}
| UTF-8 | Java | 3,862 | java | AtmServiceImpl.java | Java | [] | null | [] | package com.example.springatm.service.impl;
import com.example.springatm.entity.Atm;
import com.example.springatm.entity.BankAccount;
import com.example.springatm.entity.Banknote;
import com.example.springatm.repository.AtmRepository;
import com.example.springatm.service.AtmService;
import com.example.springatm.service.BankAccountService;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ResponseStatusException;
@Service
public class AtmServiceImpl implements AtmService {
@Autowired
private AtmRepository atmRepository;
@Autowired
private BankAccountService bankAccountService;
@Override
public Atm save(Atm atm) {
return atmRepository.save(atm);
}
@Override
public Atm findById(Long id) {
Optional<Atm> atm = atmRepository.findById(id);
if (atm.isEmpty()) {
throw new ResponseStatusException(
HttpStatus.INTERNAL_SERVER_ERROR,
"Can't find ATM by id = " + id);
}
return atm.get();
}
@Override
public Map<Banknote, Long> getBanknotesFromAtm(BigDecimal sum,
String numberOfAccount, Long atmId) {
BankAccount bankAccount = bankAccountService
.findByNumberOfBankAccount(numberOfAccount);
Atm atm = findById(atmId);
if (bankAccount.getSum().compareTo(sum) < 0) {
throw new ResponseStatusException(
HttpStatus.INTERNAL_SERVER_ERROR,
"Not enough money on bankAccount. You have : " + bankAccount.getSum());
}
BigDecimal sumAtm = getSumFromMapOfBanknotes(atm.getBanknotes());
if (sumAtm.compareTo(sum) < 0) {
throw new ResponseStatusException(
HttpStatus.INTERNAL_SERVER_ERROR,
"Not enough money on atm!");
}
if (!sum.remainder(new BigDecimal(100))
.equals(new BigDecimal(0))) {
throw new ResponseStatusException(
HttpStatus.INTERNAL_SERVER_ERROR,
"Choose the sum that multiple of 100");
}
Map<Banknote, Long> result = new HashMap<>();
List<Banknote> banknoteList = new ArrayList<>(atm.getBanknotes().keySet());
banknoteList.sort(Collections.reverseOrder());
BigDecimal tempSum = sum;
for (Banknote banknote : banknoteList) {
if (tempSum.equals(new BigDecimal(0))) {
break;
}
Long countBanknotes = tempSum
.divideAndRemainder(new BigDecimal(banknote.getValue()))[0].longValue();
if (countBanknotes > atm.getBanknotes().get(banknote)) {
countBanknotes = atm.getBanknotes().get(banknote);
}
result.put(banknote, countBanknotes);
tempSum = tempSum.subtract(new BigDecimal(countBanknotes * banknote.getValue()));
atm.subtractBanknotes(banknote, countBanknotes);
}
bankAccount.subtractMoney(sum);
bankAccountService.save(bankAccount);
save(atm);
return result;
}
private BigDecimal getSumFromMapOfBanknotes(Map<Banknote, Long> mapOfBanknotes) {
BigDecimal result = new BigDecimal(0);
for (Map.Entry<Banknote, Long> banknoteEntry : mapOfBanknotes.entrySet()) {
result = result.add(new BigDecimal(banknoteEntry
.getKey().getValue() * banknoteEntry.getValue()));
}
return result;
}
}
| 3,862 | 0.638529 | 0.635422 | 100 | 37.619999 | 24.512764 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.59 | false | false | 9 |
b61e42b0ed446910afaa8d7aee56448da1542ffe | 30,794,915,527,095 | 661ae8b7f1970ee7f5b429fe20bf1031eb7274f8 | /bygovind/AnonymousInnerClass.java | 37b44740fc367883704c84f59794bfa5df992153 | [] | no_license | govindbarika/Java8-New-Features-Example | https://github.com/govindbarika/Java8-New-Features-Example | b1621a31655e1c34d2e33bb2bb61da1788499d23 | 640c493700a07a0146d9b86a6e53effe1ac7b4f2 | refs/heads/master | 2020-04-17T17:02:14.476000 | 2019-01-21T12:12:22 | 2019-01-21T12:12:22 | 166,767,332 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demo.java8.newfeature.bygovind;
/*
abstract class Test{
}*/
interface Test{
void m1();
void m2();
void m3();
}
public class AnonymousInnerClass {
Test t = new Test(){
public void m1(){};
public void m2(){};
public void m3(){};
};
}
| UTF-8 | Java | 287 | java | AnonymousInnerClass.java | Java | [] | null | [] | package com.example.demo.java8.newfeature.bygovind;
/*
abstract class Test{
}*/
interface Test{
void m1();
void m2();
void m3();
}
public class AnonymousInnerClass {
Test t = new Test(){
public void m1(){};
public void m2(){};
public void m3(){};
};
}
| 287 | 0.592335 | 0.567944 | 17 | 15.764706 | 13.193267 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false | 9 |
b42be06a5ad7881fbff8c313c92d643cb3911971 | 17,033,840,352,397 | cf0b2e2fcd3838e470cb4c205dda8cc05ac11628 | /hotils-inject/src/main/java/org/hotilsframework/inject/Provider.java | b8ce0b1fc4f721992dbcbb1d35186514f858f27d | [] | no_license | hireny/hotils | https://github.com/hireny/hotils | b216b2991c7f3ad6447dbcc8433a9a771e8be1e3 | 0b59a3853d5e636a4a499cca8e7799d540ece62b | refs/heads/master | 2021-09-10T02:05:54.275000 | 2021-08-26T14:44:08 | 2021-08-26T14:44:08 | 225,169,822 | 0 | 0 | null | false | 2020-10-13T20:59:23 | 2019-12-01T13:54:30 | 2020-10-01T14:46:35 | 2020-10-13T20:59:22 | 1,962 | 0 | 0 | 2 | Java | false | false | package org.hotilsframework.inject;
import org.hotilsframework.core.factory.ObjectProvider;
import java.util.function.Supplier;
/**
* Bean的提供者
* @author hireny
* @className Provider
* @create 2020-05-12 21:54
*/
public interface Provider<T> extends javax.inject.Provider<T>, Supplier<T>, ObjectProvider {
/**
* 提供一个Bean实例对象
* @return
*/
@Override
T get();
}
| UTF-8 | Java | 418 | java | Provider.java | Java | [
{
"context": "til.function.Supplier;\n\n/**\n * Bean的提供者\n * @author hireny\n * @className Provider\n * @create 2020-05-12 21:5",
"end": 165,
"score": 0.9996463656425476,
"start": 159,
"tag": "USERNAME",
"value": "hireny"
}
] | null | [] | package org.hotilsframework.inject;
import org.hotilsframework.core.factory.ObjectProvider;
import java.util.function.Supplier;
/**
* Bean的提供者
* @author hireny
* @className Provider
* @create 2020-05-12 21:54
*/
public interface Provider<T> extends javax.inject.Provider<T>, Supplier<T>, ObjectProvider {
/**
* 提供一个Bean实例对象
* @return
*/
@Override
T get();
}
| 418 | 0.682741 | 0.652284 | 21 | 17.761906 | 21.738499 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 9 |
fad2cf3b71bd2576693b5e30379ef3be3e2ddea6 | 24,790,551,280,241 | f3cb5d7bab5a0249e4f723672b7344801ebdfa50 | /src/main/java/com/cloudesire/vies_client/ViesVatRegistration.java | d4d0c05284eb2b3918a139fbfa23434bd1a9ae76 | [] | no_license | ClouDesire/vies-client | https://github.com/ClouDesire/vies-client | 24bdedd2e28e93c481c045843fd4a1c5e41d2c21 | 1fb0fd2062c21680aa2d3a3176241b6ead8bde8d | refs/heads/master | 2021-01-13T12:08:21.186000 | 2016-02-19T17:07:45 | 2016-02-19T17:07:45 | 38,247,576 | 1 | 0 | null | true | 2015-06-29T12:54:20 | 2015-06-29T12:54:20 | 2014-07-15T08:51:41 | 2014-03-28T13:17:14 | 172 | 0 | 0 | 0 | null | null | null | package com.cloudesire.vies_client;
import java.io.Serializable;
import java.util.Date;
public class ViesVatRegistration implements Serializable
{
private String country;
private String vatNumber;
private Date requestDate;
private String name;
private String address;
public String getCountry()
{
return country;
}
public void setCountry( String country )
{
this.country = country;
}
public String getVatNumber()
{
return vatNumber;
}
public void setVatNumber( String vatNumber )
{
this.vatNumber = vatNumber;
}
public Date getRequestDate()
{
return requestDate;
}
public void setRequestDate( Date requestDate )
{
this.requestDate = requestDate;
}
public String getName()
{
return name;
}
public void setName( String name )
{
this.name = name;
}
public String getAddress()
{
return address;
}
public void setAddress( String address )
{
this.address = address;
}
@Override
public String toString()
{
return "ViesVatRegistration{" + "country=" + country + ", vatNumber=" + vatNumber + ", requestDate="
+ requestDate + ", name=" + name + ", address=" + address + '}';
}
}
| UTF-8 | Java | 1,342 | java | ViesVatRegistration.java | Java | [] | null | [] | package com.cloudesire.vies_client;
import java.io.Serializable;
import java.util.Date;
public class ViesVatRegistration implements Serializable
{
private String country;
private String vatNumber;
private Date requestDate;
private String name;
private String address;
public String getCountry()
{
return country;
}
public void setCountry( String country )
{
this.country = country;
}
public String getVatNumber()
{
return vatNumber;
}
public void setVatNumber( String vatNumber )
{
this.vatNumber = vatNumber;
}
public Date getRequestDate()
{
return requestDate;
}
public void setRequestDate( Date requestDate )
{
this.requestDate = requestDate;
}
public String getName()
{
return name;
}
public void setName( String name )
{
this.name = name;
}
public String getAddress()
{
return address;
}
public void setAddress( String address )
{
this.address = address;
}
@Override
public String toString()
{
return "ViesVatRegistration{" + "country=" + country + ", vatNumber=" + vatNumber + ", requestDate="
+ requestDate + ", name=" + name + ", address=" + address + '}';
}
}
| 1,342 | 0.594635 | 0.594635 | 70 | 18.171429 | 20.213837 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.328571 | false | false | 9 |
73cef5fb8cb9662486539e7d7f265378d51f85dc | 7,095,285,988,676 | 1f793092ff3ba9fce49e1955ed2e808127b59ba0 | /code01-code/src/day03/demo02method.java | 0b4498b90a36ce3f9cc7daa56a9374497769aaff | [] | no_license | haobye/Java_basic | https://github.com/haobye/Java_basic | 3fa50e3f8cff71fa0f0ef2c73475980830becca1 | d16fe01943429b445e612d9dcf6e2cfefeffaeeb | refs/heads/master | 2021-04-13T19:12:38.489000 | 2020-03-23T01:34:11 | 2020-03-23T01:34:11 | 249,181,069 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package day03;
/*
目标:使用方法的格式输出一个矩形
1.使用for循环先实现结果
2.注意方法的格式
*/
/*
public class demo02method {
public static void main(String[] args) { //快捷方式 psvm
for (int j = 0; j < 5; j++) { //快捷输出方式 5.forj
for (int i = 0; i < 10; i++) {
System.out.print("*"); //去掉ln,这10个在同一行输出
}
System.out.println(); //什么都不输出,起换行作用
}
}
}
*/
public class demo02method {
public static void main(String[] args) { //快捷方式 psvm
printmethod();
}
public static void printmethod() {
for (int j = 0; j < 5; j++) { //快捷输出方式 5.forj
for (int i = 0; i < 10; i++) {
System.out.print("*"); //去掉ln,这10个在同一行输出
}
System.out.println(); //什么都不输出,起换行作用
}
}
}
| UTF-8 | Java | 1,075 | java | demo02method.java | Java | [] | null | [] | package day03;
/*
目标:使用方法的格式输出一个矩形
1.使用for循环先实现结果
2.注意方法的格式
*/
/*
public class demo02method {
public static void main(String[] args) { //快捷方式 psvm
for (int j = 0; j < 5; j++) { //快捷输出方式 5.forj
for (int i = 0; i < 10; i++) {
System.out.print("*"); //去掉ln,这10个在同一行输出
}
System.out.println(); //什么都不输出,起换行作用
}
}
}
*/
public class demo02method {
public static void main(String[] args) { //快捷方式 psvm
printmethod();
}
public static void printmethod() {
for (int j = 0; j < 5; j++) { //快捷输出方式 5.forj
for (int i = 0; i < 10; i++) {
System.out.print("*"); //去掉ln,这10个在同一行输出
}
System.out.println(); //什么都不输出,起换行作用
}
}
}
| 1,075 | 0.439135 | 0.411832 | 34 | 23.735294 | 22.991442 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false | 9 |
e6fe72a8d1426ad55475841eec55a1ac89b7cd3f | 22,127,671,550,848 | d4cfeee2fde0d649770a4435125a9e8431234dcc | /care-reporting/care-reporting-frontend/src/test/java/org/motechproject/carereporting/web/chart/builder/GridBuilderTest.java | 797bde3080cc81bc53bffab252a10d1b97e52212 | [] | no_license | motech-implementations/ananya-care | https://github.com/motech-implementations/ananya-care | 1e3f39081556942546fa8ce9a11cf8b912c63b7b | 683fc3c46a27eaa298f62b8f679f216d2e48997b | refs/heads/master | 2021-01-23T13:59:11.897000 | 2014-09-24T13:39:06 | 2014-09-24T13:39:06 | 16,590,803 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.motechproject.carereporting.web.chart.builder;
import org.junit.Test;
import java.util.Map;
import static org.junit.Assert.assertEquals;
@SuppressWarnings("unchecked")
public class GridBuilderTest {
private static final String PARAM_VERTICAL_LINES = "verticalLines";
private static final String PARAM_HORIZONTAL_LINES = "horizontalLines";
private static final String PARAM_MINOR_VERTICAL_LINES = "minorVerticalLines";
private GridBuilder gridBuilder = new GridBuilder();
@Test
public void testVerticalLines() {
boolean verticalLines = true;
gridBuilder.verticalLines(verticalLines);
Map<String, Object> params = (Map<String, Object>) gridBuilder.build();
assertEquals(verticalLines, params.get(PARAM_VERTICAL_LINES));
}
@Test
public void testHorizontalLines() {
boolean horizontalLines = true;
gridBuilder.horizontalLines(horizontalLines);
Map<String, Object> params = (Map<String, Object>) gridBuilder.build();
assertEquals(horizontalLines, params.get(PARAM_HORIZONTAL_LINES));
}
@Test
public void testMinorVerticaLines() {
boolean minorLines = true;
gridBuilder.minorVerticalLines(minorLines);
Map<String, Object> params = (Map<String, Object>) gridBuilder.build();
assertEquals(minorLines, params.get(PARAM_MINOR_VERTICAL_LINES));
}
}
| UTF-8 | Java | 1,413 | java | GridBuilderTest.java | Java | [] | null | [] | package org.motechproject.carereporting.web.chart.builder;
import org.junit.Test;
import java.util.Map;
import static org.junit.Assert.assertEquals;
@SuppressWarnings("unchecked")
public class GridBuilderTest {
private static final String PARAM_VERTICAL_LINES = "verticalLines";
private static final String PARAM_HORIZONTAL_LINES = "horizontalLines";
private static final String PARAM_MINOR_VERTICAL_LINES = "minorVerticalLines";
private GridBuilder gridBuilder = new GridBuilder();
@Test
public void testVerticalLines() {
boolean verticalLines = true;
gridBuilder.verticalLines(verticalLines);
Map<String, Object> params = (Map<String, Object>) gridBuilder.build();
assertEquals(verticalLines, params.get(PARAM_VERTICAL_LINES));
}
@Test
public void testHorizontalLines() {
boolean horizontalLines = true;
gridBuilder.horizontalLines(horizontalLines);
Map<String, Object> params = (Map<String, Object>) gridBuilder.build();
assertEquals(horizontalLines, params.get(PARAM_HORIZONTAL_LINES));
}
@Test
public void testMinorVerticaLines() {
boolean minorLines = true;
gridBuilder.minorVerticalLines(minorLines);
Map<String, Object> params = (Map<String, Object>) gridBuilder.build();
assertEquals(minorLines, params.get(PARAM_MINOR_VERTICAL_LINES));
}
}
| 1,413 | 0.70913 | 0.70913 | 47 | 29.063829 | 29.182043 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.617021 | false | false | 9 |
9e4534b1cae05085b9e0cc1271218cf40b35e76f | 34,900,904,258,618 | 58c7986241e1f4142c3b3ee3e4cd90e2c519c231 | /app/src/main/java/viewdemo/tumour/com/a51ehealth/view/cache/CacheProviderUtils.java | 9547263031cfc01e2b1163ac6c3b2232599a9408 | [] | no_license | XiFanYin/View | https://github.com/XiFanYin/View | 931ed879e2b8ec3b389873fb962b2044a3659159 | b9ce40a0fefbdf19a22532f0df6965aefd8a1049 | refs/heads/master | 2021-05-04T15:54:10.392000 | 2020-12-02T03:15:20 | 2020-12-02T03:15:20 | 120,241,256 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package viewdemo.tumour.com.a51ehealth.view.cache;
import io.rx_cache2.internal.RxCache;
import io.victoralbertos.jolyglot.GsonSpeaker;
import viewdemo.tumour.com.a51ehealth.view.app.App;
import viewdemo.tumour.com.a51ehealth.view.net.RetrofitUtil;
/**
* Created by Administrator on 2018/2/7.
*/
public class CacheProviderUtils {
private static CacheProviderUtils mInstance;
private final RxCache persistence;
/**
* 单例模式,生成该类对象
*
* @return
*/
public static CacheProviderUtils getInstance() {
if (mInstance == null) {
synchronized (RetrofitUtil.class) {
mInstance = new CacheProviderUtils();
}
}
return mInstance;
}
//构建RxCache的时候将useExpiredDataIfLoaderNotAvailable设置成true,
// 会在数据为空或者发生错误时,忽视EvictProvider为true或者缓存过期的情况,继续使用缓存(前提是之前请求过有缓存)
public CacheProviderUtils() {
persistence = new RxCache.Builder()
.useExpiredDataIfLoaderNotAvailable(true)
.persistence(App.getApplication().getFilesDir(), new GsonSpeaker());
}
public <T> T using(Class<T> cache) {
return persistence.using(cache);
}
}
| UTF-8 | Java | 1,308 | java | CacheProviderUtils.java | Java | [
{
"context": "1ehealth.view.net.RetrofitUtil;\n\n/**\n * Created by Administrator on 2018/2/7.\n */\n\npublic class CacheProviderUtils",
"end": 282,
"score": 0.956486165523529,
"start": 269,
"tag": "USERNAME",
"value": "Administrator"
}
] | null | [] | package viewdemo.tumour.com.a51ehealth.view.cache;
import io.rx_cache2.internal.RxCache;
import io.victoralbertos.jolyglot.GsonSpeaker;
import viewdemo.tumour.com.a51ehealth.view.app.App;
import viewdemo.tumour.com.a51ehealth.view.net.RetrofitUtil;
/**
* Created by Administrator on 2018/2/7.
*/
public class CacheProviderUtils {
private static CacheProviderUtils mInstance;
private final RxCache persistence;
/**
* 单例模式,生成该类对象
*
* @return
*/
public static CacheProviderUtils getInstance() {
if (mInstance == null) {
synchronized (RetrofitUtil.class) {
mInstance = new CacheProviderUtils();
}
}
return mInstance;
}
//构建RxCache的时候将useExpiredDataIfLoaderNotAvailable设置成true,
// 会在数据为空或者发生错误时,忽视EvictProvider为true或者缓存过期的情况,继续使用缓存(前提是之前请求过有缓存)
public CacheProviderUtils() {
persistence = new RxCache.Builder()
.useExpiredDataIfLoaderNotAvailable(true)
.persistence(App.getApplication().getFilesDir(), new GsonSpeaker());
}
public <T> T using(Class<T> cache) {
return persistence.using(cache);
}
}
| 1,308 | 0.668919 | 0.657939 | 48 | 23.666666 | 23.791922 | 84 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | false | false | 9 |
58ec798e7ab6b57a266a68945d6608ca1a62c898 | 15,015,205,695,538 | aac3003e93ba84b683273d04b49f68e2880a16fd | /app/src/main/java/com/example/mappe2_s188886_s344046/restauranter/AlleRestauranterActivity.java | b9292db83fdbdc2a62cfd838fadd826e1c1b2c0b | [] | no_license | oyvind0402/Restaurant-Ordering-App-Android | https://github.com/oyvind0402/Restaurant-Ordering-App-Android | 2b529d33778bb84cf149227d6a54588d34dd16d0 | 8d9e3134339158ae4e086ccbe61f037dad7fc192 | refs/heads/master | 2023-08-22T00:59:01.936000 | 2021-10-31T14:08:42 | 2021-10-31T14:08:42 | 418,572,866 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.mappe2_s188886_s344046.restauranter;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.example.mappe2_s188886_s344046.ForsideActivity;
import com.example.mappe2_s188886_s344046.R;
import com.example.mappe2_s188886_s344046.settings.SettingsActivity;
import com.example.mappe2_s188886_s344046.utils.DBHandler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlleRestauranterActivity extends AppCompatActivity {
private DBHandler db;
ListView listView;
Restaurant restaurant;
Button endreRestaurant, slettRestaurant;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.allerestauranter_layout);
Toolbar myToolbar = (Toolbar) findViewById(R.id.toolbar);
myToolbar.setTitle("");
setSupportActionBar(myToolbar);
endreRestaurant = (Button) findViewById(R.id.endre_restaurant_btn);
slettRestaurant = (Button) findViewById(R.id.slett_restaurant_btn);
db = new DBHandler(getApplicationContext());
listView = (ListView) findViewById(R.id.restaurantListView);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
populateRestaurantList();
}
//Metode for å liste alle restaurantene i listviewet og for å lage lytteren til hvilken restaurant som er valg i listviewet:
public void populateRestaurantList(){
List<Restaurant> restaurantListe = db.finnAlleRestauranter();
//Hvis det finnes noen restauranter:
if(restaurantListe.size() > 0) {
int blue = getResources().getColor(R.color.blue_logo);
endreRestaurant.setEnabled(true);
endreRestaurant.setBackgroundColor(blue);
slettRestaurant.setEnabled(true);
endreRestaurant.setBackgroundColor(blue);
populateRestaurantListView(restaurantListe);
listView.setOnItemClickListener((parent, view, i, id) -> {
HashMap<String, String> hm = (HashMap<String, String>) listView.getItemAtPosition(i);
String restaurantNavn = hm.get("item");
restaurant = db.finnRestaurant(restaurantNavn) ;
});
//Ingen restauranter:
} else {
int grey = getResources().getColor(R.color.gray_logo);
endreRestaurant.setEnabled(false);
endreRestaurant.setBackgroundColor(grey);
slettRestaurant.setEnabled(false);
slettRestaurant.setBackgroundColor(grey);
List<String> placeholderList = new ArrayList<>();
placeholderList.add("Ingen restauranter lagt til enda!");
ArrayAdapter<String> placeholderAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, placeholderList);
listView.setAdapter(placeholderAdapter);
}
}
//Metode for å legge verdier i listen av restauranter og for å lage adapteren som listen skal settes i:
public void populateRestaurantListView(List<Restaurant> list){
List<Map<String, String>> data = new ArrayList<>();
for (Restaurant r : list) {
Map<String, String> datum = new HashMap<>(2);
datum.put("item", r.getNavn());
datum.put("subitem", r.getAdresse() + "\nTelefon: " + r.getTelefon() + "\nType: " + r.getType());
data.add(datum);
}
SimpleAdapter adapter = new SimpleAdapter(this, data,
R.layout.simple_list_item_2_single_choice,
new String[] {"item", "subitem"},
new int[] {R.id.text1,
R.id.text2});
listView.setAdapter(adapter);
}
public void lagreRestaurant(View view){
Intent intent = new Intent(this, LagreRestaurantActivity.class);
startActivity(intent);
finish();
}
public void slettRestaurant(View view){
//Hvis noe er valgt gir vi brukeren mulighet til å si ja eller nei om de vil slette:
if (restaurant != null) {
new AlertDialog.Builder(this).setTitle("Sletting av " + restaurant.getNavn()).setMessage("Er du sikker på at du vil slette " + restaurant.getNavn() + "?").setPositiveButton("Ja", (dialogInterface, i) -> {
db.slettRestaurant(restaurant.getId());
Intent intent = new Intent(getApplicationContext(), AlleRestauranterActivity.class);
startActivity(intent);
finish();
}).setNegativeButton("Nei", (dialogInterface, i) -> Toast.makeText(getApplicationContext(), "Sletting av " + restaurant.getNavn() + " avbrutt.", Toast.LENGTH_SHORT).show()).create().show();
} else {
Toast.makeText(this, "Velg en restaurant!", Toast.LENGTH_SHORT).show();
}
}
public void endreRestaurant(View view){
//Hvis noe er valgt legger vi restaurantId'en i et nøkkel-verdipar:
if (restaurant != null) {
Intent intent = new Intent(this, EndreRestaurantActivity.class);
Bundle bundle = new Bundle();
bundle.putLong("restaurantId", restaurant.getId());
intent.putExtras(bundle);
startActivity(intent);
finish();
} else {
Toast.makeText(this, "Velg en restaurant!", Toast.LENGTH_SHORT).show();
}
}
public void tilForside(View view) {
Intent intent = new Intent(this, ForsideActivity.class);
//Legger til CLEAR_TOP intent flag for å fjerne alt på callstacken.
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
public void tilSettings(View view) {
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
}
}
| UTF-8 | Java | 6,223 | java | AlleRestauranterActivity.java | Java | [] | null | [] | package com.example.mappe2_s188886_s344046.restauranter;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.example.mappe2_s188886_s344046.ForsideActivity;
import com.example.mappe2_s188886_s344046.R;
import com.example.mappe2_s188886_s344046.settings.SettingsActivity;
import com.example.mappe2_s188886_s344046.utils.DBHandler;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlleRestauranterActivity extends AppCompatActivity {
private DBHandler db;
ListView listView;
Restaurant restaurant;
Button endreRestaurant, slettRestaurant;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.allerestauranter_layout);
Toolbar myToolbar = (Toolbar) findViewById(R.id.toolbar);
myToolbar.setTitle("");
setSupportActionBar(myToolbar);
endreRestaurant = (Button) findViewById(R.id.endre_restaurant_btn);
slettRestaurant = (Button) findViewById(R.id.slett_restaurant_btn);
db = new DBHandler(getApplicationContext());
listView = (ListView) findViewById(R.id.restaurantListView);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
populateRestaurantList();
}
//Metode for å liste alle restaurantene i listviewet og for å lage lytteren til hvilken restaurant som er valg i listviewet:
public void populateRestaurantList(){
List<Restaurant> restaurantListe = db.finnAlleRestauranter();
//Hvis det finnes noen restauranter:
if(restaurantListe.size() > 0) {
int blue = getResources().getColor(R.color.blue_logo);
endreRestaurant.setEnabled(true);
endreRestaurant.setBackgroundColor(blue);
slettRestaurant.setEnabled(true);
endreRestaurant.setBackgroundColor(blue);
populateRestaurantListView(restaurantListe);
listView.setOnItemClickListener((parent, view, i, id) -> {
HashMap<String, String> hm = (HashMap<String, String>) listView.getItemAtPosition(i);
String restaurantNavn = hm.get("item");
restaurant = db.finnRestaurant(restaurantNavn) ;
});
//Ingen restauranter:
} else {
int grey = getResources().getColor(R.color.gray_logo);
endreRestaurant.setEnabled(false);
endreRestaurant.setBackgroundColor(grey);
slettRestaurant.setEnabled(false);
slettRestaurant.setBackgroundColor(grey);
List<String> placeholderList = new ArrayList<>();
placeholderList.add("Ingen restauranter lagt til enda!");
ArrayAdapter<String> placeholderAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, placeholderList);
listView.setAdapter(placeholderAdapter);
}
}
//Metode for å legge verdier i listen av restauranter og for å lage adapteren som listen skal settes i:
public void populateRestaurantListView(List<Restaurant> list){
List<Map<String, String>> data = new ArrayList<>();
for (Restaurant r : list) {
Map<String, String> datum = new HashMap<>(2);
datum.put("item", r.getNavn());
datum.put("subitem", r.getAdresse() + "\nTelefon: " + r.getTelefon() + "\nType: " + r.getType());
data.add(datum);
}
SimpleAdapter adapter = new SimpleAdapter(this, data,
R.layout.simple_list_item_2_single_choice,
new String[] {"item", "subitem"},
new int[] {R.id.text1,
R.id.text2});
listView.setAdapter(adapter);
}
public void lagreRestaurant(View view){
Intent intent = new Intent(this, LagreRestaurantActivity.class);
startActivity(intent);
finish();
}
public void slettRestaurant(View view){
//Hvis noe er valgt gir vi brukeren mulighet til å si ja eller nei om de vil slette:
if (restaurant != null) {
new AlertDialog.Builder(this).setTitle("Sletting av " + restaurant.getNavn()).setMessage("Er du sikker på at du vil slette " + restaurant.getNavn() + "?").setPositiveButton("Ja", (dialogInterface, i) -> {
db.slettRestaurant(restaurant.getId());
Intent intent = new Intent(getApplicationContext(), AlleRestauranterActivity.class);
startActivity(intent);
finish();
}).setNegativeButton("Nei", (dialogInterface, i) -> Toast.makeText(getApplicationContext(), "Sletting av " + restaurant.getNavn() + " avbrutt.", Toast.LENGTH_SHORT).show()).create().show();
} else {
Toast.makeText(this, "Velg en restaurant!", Toast.LENGTH_SHORT).show();
}
}
public void endreRestaurant(View view){
//Hvis noe er valgt legger vi restaurantId'en i et nøkkel-verdipar:
if (restaurant != null) {
Intent intent = new Intent(this, EndreRestaurantActivity.class);
Bundle bundle = new Bundle();
bundle.putLong("restaurantId", restaurant.getId());
intent.putExtras(bundle);
startActivity(intent);
finish();
} else {
Toast.makeText(this, "Velg en restaurant!", Toast.LENGTH_SHORT).show();
}
}
public void tilForside(View view) {
Intent intent = new Intent(this, ForsideActivity.class);
//Legger til CLEAR_TOP intent flag for å fjerne alt på callstacken.
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
public void tilSettings(View view) {
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
}
}
| 6,223 | 0.665594 | 0.654168 | 152 | 39.88158 | 34.157516 | 216 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.796053 | false | false | 9 |
ffb1bae04bced7edc912f8bf1e923f3d802b66f0 | 16,999,480,610,335 | e5efd72854264e01c50a07c73369c9a27b617807 | /android-mvc/codebase/eclipse/src/com/mastergaurav/android/app/view/HomeActivity.java | 427a5bbe521c28555a056d863033934cb24b96c7 | [
"Apache-2.0"
] | permissive | gotomypc/Android-MVC | https://github.com/gotomypc/Android-MVC | 24385067f35f2032409108ab0f95ecd6b61bd867 | 5b13892120ec11ce23fe6ed58e580388dabab1eb | refs/heads/master | 2021-01-13T02:23:55.770000 | 2021-01-04T06:46:43 | 2021-01-04T06:46:43 | 3,939,003 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mastergaurav.android.app.view;
import java.util.List;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import com.mastergaurav.android.R;
import com.mastergaurav.android.app.common.CollectionUtils;
import com.mastergaurav.android.common.view.BaseActivity;
public class HomeActivity extends BaseActivity
{
@Override
protected int getContentViewID()
{
return R.layout.layout_screen_complex_list_view_activity;
}
private List<String> items1 = CollectionUtils.asList("One", "Two", "Three", "Four", "Five", "Six");
private List<String> items2 = CollectionUtils.asList("2-One", "2-Two", "2-Three", "2-Four", "2-Five", "2-Six");
private int usedItem = 0;
private MainContentAdapter adapter;
@Override
protected void onAfterCreate(Bundle savedInstanceState)
{
super.onAfterCreate(savedInstanceState);
adapter = new MainContentAdapter(this, items1);
Button btn = (Button) findViewById(R.id.complex_view_activity_refresh_btn);
ListView lv = (ListView) findViewById(R.id.complex_view_activity_list);
lv.setAdapter(adapter);
System.out.println("List View -- have set the adapter");
btn.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
System.out.println("used item: " + usedItem);
usedItem = usedItem == 0 ? 1 : 0;
List<String> data = usedItem == 1 ? items2 : items1;
System.out.println("used data: " + data);
adapter.updateData(data);
}
});
}
@Override
protected void onCreateContent(Bundle savedInstanceState)
{
super.onCreateContent(savedInstanceState);
}
}
| UTF-8 | Java | 1,731 | java | HomeActivity.java | Java | [] | null | [] | package com.mastergaurav.android.app.view;
import java.util.List;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import com.mastergaurav.android.R;
import com.mastergaurav.android.app.common.CollectionUtils;
import com.mastergaurav.android.common.view.BaseActivity;
public class HomeActivity extends BaseActivity
{
@Override
protected int getContentViewID()
{
return R.layout.layout_screen_complex_list_view_activity;
}
private List<String> items1 = CollectionUtils.asList("One", "Two", "Three", "Four", "Five", "Six");
private List<String> items2 = CollectionUtils.asList("2-One", "2-Two", "2-Three", "2-Four", "2-Five", "2-Six");
private int usedItem = 0;
private MainContentAdapter adapter;
@Override
protected void onAfterCreate(Bundle savedInstanceState)
{
super.onAfterCreate(savedInstanceState);
adapter = new MainContentAdapter(this, items1);
Button btn = (Button) findViewById(R.id.complex_view_activity_refresh_btn);
ListView lv = (ListView) findViewById(R.id.complex_view_activity_list);
lv.setAdapter(adapter);
System.out.println("List View -- have set the adapter");
btn.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
System.out.println("used item: " + usedItem);
usedItem = usedItem == 0 ? 1 : 0;
List<String> data = usedItem == 1 ? items2 : items1;
System.out.println("used data: " + data);
adapter.updateData(data);
}
});
}
@Override
protected void onCreateContent(Bundle savedInstanceState)
{
super.onCreateContent(savedInstanceState);
}
}
| 1,731 | 0.71115 | 0.701906 | 60 | 26.85 | 27.031355 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.766667 | false | false | 9 |
429d3b9ab6d68d85e0b55fa7a4791668d30e33d0 | 1,279,900,302,348 | 473b76b1043df2f09214f8c335d4359d3a8151e0 | /benchmark/bigclonebenchdata_completed/18417069.java | 31c9ff26ad4ee3d8a70ad46834a7c6c89be9a941 | [] | no_license | whatafree/JCoffee | https://github.com/whatafree/JCoffee | 08dc47f79f8369af32e755de01c52d9a8479d44c | fa7194635a5bd48259d325e5b0a190780a53c55f | refs/heads/master | 2022-11-16T01:58:04.254000 | 2020-07-13T20:11:17 | 2020-07-13T20:11:17 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
class c18417069 {
public static int getUrl(final String s) {
try {
final URL url = new URL(s);
final BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
int count = 0;
String data = null;
while ((data =(String)(Object) reader.readLine()) != null) {
System.out.printf("Results(%3d) of data: %s\n", count, data);
++count;
}
return count;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}
// Code below this line has been added to remove errors
class MyHelperClass {
}
class URL {
URL(String o0){}
URL(){}
public MyHelperClass openStream(){ return null; }}
class BufferedReader {
BufferedReader(){}
BufferedReader(InputStreamReader o0){}
public MyHelperClass readLine(){ return null; }}
class InputStreamReader {
InputStreamReader(MyHelperClass o0){}
InputStreamReader(){}}
| UTF-8 | Java | 995 | java | 18417069.java | Java | [] | null | [] |
class c18417069 {
public static int getUrl(final String s) {
try {
final URL url = new URL(s);
final BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
int count = 0;
String data = null;
while ((data =(String)(Object) reader.readLine()) != null) {
System.out.printf("Results(%3d) of data: %s\n", count, data);
++count;
}
return count;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}
// Code below this line has been added to remove errors
class MyHelperClass {
}
class URL {
URL(String o0){}
URL(){}
public MyHelperClass openStream(){ return null; }}
class BufferedReader {
BufferedReader(){}
BufferedReader(InputStreamReader o0){}
public MyHelperClass readLine(){ return null; }}
class InputStreamReader {
InputStreamReader(MyHelperClass o0){}
InputStreamReader(){}}
| 995 | 0.603015 | 0.58995 | 41 | 23.195122 | 23.840137 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.414634 | false | false | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.