blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ae2159b554760ed7ec257298625bf79fc3b1402f | d9bb642cb49027478c9832731d2f65d94185f21b | /demo/src/main/java/com/chengfu/android/fuplayer/demo/MediaGroupListAdapter.java | 7635469933031f44a1ead265fb4f340eb75efdd5 | []
| no_license | fulvmei/FuPlayer | 2500a9e4a19a7ed7cb454078d2954bed0e1ee134 | 0ba51b3132e031f2a9412ff174d27920ead3ab95 | refs/heads/main | 2023-07-21T07:34:22.417641 | 2023-07-17T01:54:50 | 2023-07-17T01:54:50 | 168,075,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,147 | java | package com.chengfu.android.fuplayer.demo;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;
import com.chengfu.android.fuplayer.demo.bean.Media;
import com.chengfu.android.fuplayer.demo.bean.MediaGroup;
import java.util.List;
public class MediaGroupListAdapter extends BaseExpandableListAdapter {
private List<MediaGroup> mediaGroupList;
public MediaGroupListAdapter(List<MediaGroup> mediaGroupList) {
this.mediaGroupList = mediaGroupList;
}
@Override
public int getGroupCount() {
return mediaGroupList.size();
}
@Override
public int getChildrenCount(int groupPosition) {
return getGroup(groupPosition).getMediaList().size();
}
@Override
public MediaGroup getGroup(int groupPosition) {
return mediaGroupList.get(groupPosition);
}
@Override
public Media getChild(int groupPosition, int childPosition) {
return getGroup(groupPosition).getMediaList().get(childPosition);
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public boolean hasStableIds() {
return true;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
GroupViewHolder groupViewHolder;
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_expand_group, parent, false);
groupViewHolder = new GroupViewHolder();
groupViewHolder.tvTitle = convertView.findViewById(R.id.label_group_normal);
convertView.setTag(groupViewHolder);
} else {
groupViewHolder = (GroupViewHolder) convertView.getTag();
}
groupViewHolder.tvTitle.setText(getGroup(groupPosition).getName());
return convertView;
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
ChildViewHolder childViewHolder;
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_expand_child, parent, false);
childViewHolder = new ChildViewHolder();
childViewHolder.tvTitle = (TextView) convertView.findViewById(R.id.label_expand_child);
convertView.setTag(childViewHolder);
} else {
childViewHolder = (ChildViewHolder) convertView.getTag();
}
childViewHolder.tvTitle.setText(getChild(groupPosition, childPosition).getName());
return convertView;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
private static class GroupViewHolder {
TextView tvTitle;
}
private static class ChildViewHolder {
TextView tvTitle;
}
}
| [
"[email protected]"
]
| |
b303f811bb80a78591661d3a88af32a22fd22c93 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Lang/8/org/apache/commons/lang3/StringUtils_replaceEach_3924.java | b452379f6f3ca2b33ac7227e507b757aa61aa853 | []
| no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 12,307 | java |
org apach common lang3
oper link java lang string
code safe
empti isempti blank isblank
check string text
trim strip
remov lead trail whitespac
equal
compar string safe
start startswith
check string start prefix safe
end endswith
check string end suffix safe
index indexof index lastindexof
safe index check
index indexofani index lastindexofani index indexofanybut index lastindexofanybut
index set string
containsonli containsnon containsani
string charact
substr left mid
safe substr extract
substr substringbefor substr substringaft substr substringbetween
substr extract rel string
split join
split string arrai substr vice versa
remov delet
remov part string
replac overlai
search string replac string
chomp chop
remov part string
left pad leftpad pad rightpad center repeat
pad string
upper case uppercas lower case lowercas swap case swapcas capit uncapit
string
count match countmatch
count number occurr string
alpha isalpha numer isnumer whitespac iswhitespac ascii printabl isasciiprint
check charact string
default string defaultstr
protect input string
revers revers delimit reversedelimit
revers string
abbrevi
abbrevi string ellipsi
differ
compar string report differ
levenshtein distanc levenshteindist
number need chang string
code string util stringutil defin word relat
string handl
code
empti length string code
space space charact code
whitespac charact defin link charact whitespac iswhitespac
trim charact link string trim
code string util stringutil handl code input string quietli
code input code
code code return
detail vari method
side effect code handl
code null pointer except nullpointerexcept consid bug
code string util stringutil
method give sampl code explain oper
symbol code input includ code
thread safe threadsaf
java lang string
version
string util stringutil
replac occurr string string
code refer pass method
search string string replac replac
pre
string util stringutil replac replaceeach
string util stringutil replac replaceeach
string util stringutil replac replaceeach aba aba
string util stringutil replac replaceeach aba string aba
string util stringutil replac replaceeach aba string aba
string util stringutil replac replaceeach aba string aba
string util stringutil replac replaceeach aba string string
string util stringutil replac replaceeach aba string string aba
string util stringutil replac replaceeach abcd string string wcte
repeat
string util stringutil replac replaceeach abcd string string dcte
string util stringutil replac replaceeach abcd string string tcte
string util stringutil replac replaceeach abcd string string illeg state except illegalstateexcept
pre
param text
text search replac
param search list searchlist
string search
param replac list replacementlist
string replac
param repeat replac repeatedli
replac time live timetol
param time live timetol
circular refer endless
loop
text replac process code
string input
illeg state except illegalstateexcept
search repeat endless loop due
output input
illeg argument except illegalargumentexcept
length arrai
size
string replac replaceeach
string text string search list searchlist string replac list replacementlist repeat time live timetol
mchyzer perform note creat object major goal
perform request creat har measur
text text length search list searchlist
search list searchlist length replac list replacementlist replac list replacementlist length
text
recurs
time live timetol
illeg state except illegalstateexcept abort protect stack overflow error stackoverflowerror
output loop input
search length searchlength search list searchlist length
replac length replacementlength replac list replacementlist length
make length equal
search length searchlength replac length replacementlength
illeg argument except illegalargumentexcept search replac arrai length match
search length searchlength
replac length replacementlength
track match
match repl index nomorematchesforreplindex search length searchlength
index index match found
text index textindex
replac index replaceindex
temp index tempindex
index replac arrai replac search string found
note logic duplic start
search length searchlength
match repl index nomorematchesforreplindex search list searchlist
search list searchlist length replac list replacementlist
temp index tempindex text index indexof search list searchlist
search
temp index tempindex
match repl index nomorematchesforreplindex
text index textindex temp index tempindex text index textindex
text index textindex temp index tempindex
replac index replaceindex
note logic end
search string found
text index textindex
text
start
good guess size result buffer bit
increas
count replac text element larger text replac
search list searchlist length
search list searchlist replac list replacementlist
greater replac list replacementlist length search list searchlist length
greater
increas greater assum match
upper bound increas java
increas math min increas text length
string builder stringbuild buf string builder stringbuild text length increas
text index textindex
start text index textindex
buf append text charat
buf append replac list replacementlist replac index replaceindex
start text index textindex search list searchlist replac index replaceindex length
text index textindex
replac index replaceindex
temp index tempindex
find earliest match
note logic duplic start
search length searchlength
match repl index nomorematchesforreplindex search list searchlist
search list searchlist length replac list replacementlist
temp index tempindex text index indexof search list searchlist start
search
temp index tempindex
match repl index nomorematchesforreplindex
text index textindex temp index tempindex text index textindex
text index textindex temp index tempindex
replac index replaceindex
note logic duplic end
text length textlength text length
start text length textlength
buf append text charat
string result buf string tostr
repeat
result
replac replaceeach result search list searchlist replac list replacementlist repeat time live timetol
| [
"[email protected]"
]
| |
c3bca36f8fc98e298edad5b3064a06d7972bb1f2 | 609f3c79388aaa22cfa72ff61691eea59cad9d3d | /app/src/main/java/com/example/mycontactlist/MainActivity.java | 06e1cbfeb11816d99ad997f2aff6cc245f41e81c | []
| no_license | Asad-Ahmed-Yusuf/Contact-App | 18527821110923f0aa7465d7d8837835b67e005b | a238d601b829569ef1de950fcf9832fce2817077 | refs/heads/master | 2023-04-08T02:56:25.570079 | 2021-03-23T00:25:49 | 2021-03-23T00:25:49 | 350,517,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,635 | java | package com.example.mycontactlist;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentManager;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.telephony.PhoneNumberFormattingTextWatcher;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.text.format.DateFormat;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.Calendar;
public class MainActivity extends AppCompatActivity implements DatePickerDialog.SaveDateListener {
private Contact currentContact;
final int PERMISSION_REQUEST_PHONE = 102;
final int PERMISSION_REQUEST_CAMERA = 103;
final int PERMISSION_REQUEST_TEXT = 104;
final int CAMERA_REQUEST = 1888;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initListButton();
initMapButton();
initSettingsButton();
initToggleButton();
setForEditing(false);
initChangeDateButton();
initTextChangedEvents();
initSaveButton();
initCallFunction();
initTextFunction();
initImageButton();
Bundle extras = getIntent().getExtras();
if(extras != null) {
initContact(extras.getInt("contactId"));
}
else {
currentContact = new Contact();
}
}
private void initListButton() {
ImageButton ibList = findViewById(R.id.imageButtonList);
ibList.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, ContactListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
}
private void initMapButton() {
ImageButton ibList = findViewById(R.id.imageButtonMap);
ibList.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, ContactMapActivity.class);
if (currentContact.getContactID() == -1) {
Toast.makeText(getBaseContext(), "Contact must be saved before it can be mapped", Toast.LENGTH_LONG).show();
}
else {
intent.putExtra("contactid", currentContact.getContactID());
}
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
}
private void initSettingsButton() {
ImageButton ibList = findViewById(R.id.imageButtonSettings);
ibList.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, ContactSettingsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
}
private void initToggleButton() {
final ToggleButton editToggle = findViewById(R.id.toggleButtonEdit);
editToggle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setForEditing(editToggle.isChecked());
}
});
}
private void initCallFunction() {
EditText editPhone = (EditText) findViewById(R.id.editHome);
editPhone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
checkPhonePermission(currentContact.getPhoneNumber());
}
});
EditText editCell = (EditText) findViewById(R.id.editCell);
editCell.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
checkPhonePermission(currentContact.getCellNumber());
}
});
}
private void initTextFunction() {
EditText editPhone = (EditText) findViewById(R.id.editHome);
editPhone.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View arg0) {
checkTextPermission(currentContact.getPhoneNumber());
return false;
}
});
EditText editCell = (EditText) findViewById(R.id.editCell);
editCell.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View arg0) {
checkTextPermission(currentContact.getCellNumber());
return false;
}
});
}
private void checkPhonePermission(String phoneNumber) {
if (Build.VERSION.SDK_INT >= 23) {
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.CALL_PHONE)) {
Snackbar.make(findViewById(R.id.activity_main), "MyContactList requires this permission to place a call from the app.", Snackbar.LENGTH_INDEFINITE).setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View view) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CALL_PHONE },PERMISSION_REQUEST_PHONE);
}
})
.show();
} else {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CALL_PHONE},PERMISSION_REQUEST_PHONE);
}
} else {
callContact(phoneNumber);
}
} else {
callContact(phoneNumber);
}
}
private void checkTextPermission(String phoneNumber) {
if (Build.VERSION.SDK_INT >= 23) {
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.SEND_SMS) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.SEND_SMS)) {
Snackbar.make(findViewById(R.id.activity_main), "MyContactList requires this permission to place a call from the app.", Snackbar.LENGTH_INDEFINITE).setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View view) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.SEND_SMS },PERMISSION_REQUEST_TEXT);
}
})
.show();
} else {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.SEND_SMS},PERMISSION_REQUEST_TEXT);
}
} else {
textContact(phoneNumber);
}
} else {
textContact(phoneNumber);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
switch (requestCode) {
case PERMISSION_REQUEST_PHONE: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(MainActivity.this, "You may now call from this app.", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MainActivity.this, "You will not be able to make calls “ +“from this app", Toast.LENGTH_LONG).show();
}
break;
}
case PERMISSION_REQUEST_TEXT: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(MainActivity.this, "You may now text from this app.", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MainActivity.this, "You will not be able to send texts from this app", Toast.LENGTH_LONG).show();
}
break;
}
case PERMISSION_REQUEST_CAMERA: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
takePhoto();
} else {
Toast.makeText(MainActivity.this, "You will not be able to save contact pictures from this app", Toast.LENGTH_LONG).show();
}
return;
}
}
}
public void takePhoto(){
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST) {
if (resultCode == RESULT_OK) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
Bitmap scaledPhoto = Bitmap.createScaledBitmap(photo,144,144,true);
ImageButton imageContact = (ImageButton) findViewById(R.id.imageContact);
imageContact.setImageBitmap(scaledPhoto);
currentContact.setPicture(scaledPhoto);
}
}
}
private void callContact(String phoneNumber) {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + phoneNumber));
if ( Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getBaseContext(), Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
return ;
}
else {
startActivity(intent);
}
}
private void textContact(String phoneNumber) {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("smsto:" + phoneNumber));
if ( Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getBaseContext(), Manifest.permission.SEND_SMS) != PackageManager.PERMISSION_GRANTED) {
return ;
}
else {
startActivity(intent);
}
}
private void setForEditing(boolean enabled) {
EditText editName = findViewById(R.id.editName);
EditText editAddress = findViewById(R.id.editAddress);
EditText editCity = findViewById(R.id.editCity);
EditText editState = findViewById(R.id.editState);
EditText editZipCode = findViewById(R.id.editZipcode);
EditText editPhone = findViewById(R.id.editHome);
EditText editCell = findViewById(R.id.editCell);
EditText editEmail = findViewById(R.id.editEMail);
Button buttonChange = findViewById(R.id.buttonBirthday);
Button buttonSave = findViewById(R.id.buttonSave);
editName.setEnabled(enabled);
editAddress.setEnabled(enabled);
editCity.setEnabled(enabled);
editState.setEnabled(enabled);
editZipCode.setEnabled(enabled);
editEmail.setEnabled(enabled);
buttonChange.setEnabled(enabled);
buttonSave.setEnabled(enabled);
if (enabled) {
editName.requestFocus();
editPhone.setInputType(InputType.TYPE_CLASS_PHONE);
editCell.setInputType(InputType.TYPE_CLASS_PHONE);
}
else {
ScrollView s = findViewById(R.id.scrollView);
s.fullScroll(ScrollView.FOCUS_UP);
editPhone.setInputType(InputType.TYPE_NULL);
editCell.setInputType(InputType.TYPE_NULL);
}
ImageButton picture = findViewById(R.id.imageContact);
picture.setEnabled(enabled);
}
private void initImageButton() {
ImageButton ib = findViewById(R.id.imageContact);
ib.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= 23) {
if (ContextCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, android.Manifest.permission.CAMERA)) {
Snackbar.make(findViewById(R.id.activity_main), "The app needs permission to take pictures.", Snackbar.LENGTH_INDEFINITE).setAction("Ok", new View.OnClickListener() {
@Override
public void onClick(View view) {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{ android.Manifest.permission.CAMERA}, PERMISSION_REQUEST_CAMERA);
}
})
.show();
} else {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{android.Manifest.permission.CAMERA}, PERMISSION_REQUEST_CAMERA);
}
}
else {
takePhoto();
}
} else {
takePhoto();
}
}
});
}
private void initChangeDateButton() {
Button changeDate = findViewById(R.id.buttonBirthday);
changeDate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FragmentManager fm = getSupportFragmentManager();
DatePickerDialog datePickerDialog = new DatePickerDialog();
datePickerDialog.show(fm, "DatePick");
}
});
}
private void initTextChangedEvents(){
final EditText etContactName = findViewById(R.id.editName);
// textwatches is added , TextWatcher is an object that, when attached to a widget that allows editing.
etContactName.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
currentContact.setContactName(etContactName.getText().toString());
}
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
// Auto-generated method stub
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
// Auto-generated method stub
}
});
final EditText etStreetAddress = findViewById(R.id.editAddress);
etStreetAddress.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
currentContact.setStreetAddress(etStreetAddress.getText().toString());
}
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
// Auto-generated method stub
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
// Auto-generated method stub
}
});
final EditText etCity = findViewById(R.id.editCity);
etCity.addTextChangedListener(new TextWatcher() {
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void afterTextChanged(Editable editable) {
currentContact.setCity(etCity.getText().toString());
}
});
final EditText etState = findViewById(R.id.editState);
etState.addTextChangedListener(new TextWatcher() {
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void afterTextChanged(Editable editable) {
currentContact.setState(etState.getText().toString());
}
});
final EditText etZip = findViewById(R.id.editZipcode);
etZip.addTextChangedListener(new TextWatcher() {
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void afterTextChanged(Editable editable) {
currentContact.setZipCode(etZip.getText().toString());
}
});
final EditText etPhone = findViewById(R.id.editHome);
etPhone.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
currentContact.setPhoneNumber(etPhone.getText().toString());
}
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
// Auto-generated method stub
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
// Auto-generated method stub
}
});
final EditText etCell = findViewById(R.id.editCell);
etCell.addTextChangedListener(new TextWatcher() {
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void afterTextChanged(Editable editable) {
currentContact.setCellNumber(etCell.getText().toString());
}
});
final EditText etEMail = findViewById(R.id.editEMail);
etEMail.addTextChangedListener(new TextWatcher() {
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
public void afterTextChanged(Editable editable) {
currentContact.setEMail(etEMail.getText().toString());
}
});
etPhone.addTextChangedListener(new PhoneNumberFormattingTextWatcher());
etCell.addTextChangedListener(new PhoneNumberFormattingTextWatcher());
}
private void initSaveButton() {
Button saveButton = findViewById(R.id.buttonSave);
saveButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
boolean wasSuccessful;
hideKeyboard();
ContactDataSource ds = new ContactDataSource(MainActivity.this);
try {
ds.open();
if (currentContact.getContactID() == -1) {
wasSuccessful = ds.insertContact(currentContact);
if (wasSuccessful) {
int newId = ds.getLastContactId();
currentContact.setContactID(newId);
}
}
else {
wasSuccessful = ds.updateContact(currentContact);
}
ds.close();
}
catch (Exception e) {
wasSuccessful = false;
}
if (wasSuccessful) {
ToggleButton editToggle = findViewById(R.id.toggleButtonEdit);
editToggle.toggle();
setForEditing(false);
}
}
});
}
private void hideKeyboard() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
EditText editName = findViewById(R.id.editName);
imm.hideSoftInputFromWindow(editName.getWindowToken(), 0);
EditText editAddress = findViewById(R.id.editAddress);
imm.hideSoftInputFromWindow(editAddress.getWindowToken(), 0);
EditText et = findViewById(R.id.editCity);
imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
et = findViewById(R.id.editState);
imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
et = findViewById(R.id.editZipcode);
imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
et = findViewById(R.id.editHome);
imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
et = findViewById(R.id.editCell);
imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
et = findViewById(R.id.editEMail);
imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
}
private void initContact(int id) {
ContactDataSource ds = new ContactDataSource(MainActivity.this);
try {
ds.open();
currentContact = ds.getSpecificContact(id);
ds.close();
}
catch (Exception e) {
Toast.makeText(this, "Load Contact Failed", Toast.LENGTH_LONG).show();
}
EditText editName = findViewById(R.id.editName);
EditText editAddress = findViewById(R.id.editAddress);
EditText editCity = findViewById(R.id.editCity);
EditText editState = findViewById(R.id.editState);
EditText editZipCode = findViewById(R.id.editZipcode);
EditText editPhone = findViewById(R.id.editHome);
EditText editCell = findViewById(R.id.editCell);
EditText editEmail = findViewById(R.id.editEMail);
TextView birthDay = findViewById(R.id.textBirthday);
editName.setText(currentContact.getContactName());
editAddress.setText(currentContact.getStreetAddress());
editCity.setText(currentContact.getCity());
editState.setText(currentContact.getState());
editZipCode.setText(currentContact.getZipCode());
editPhone.setText(currentContact.getPhoneNumber());
editCell.setText(currentContact.getCellNumber());
editEmail.setText(currentContact.getEMail());
birthDay.setText(DateFormat.format("MM/dd/yyyy",
currentContact.getBirthday().getTimeInMillis()).toString());
ImageButton picture = findViewById(R.id.imageContact);
if (currentContact.getPicture() != null) {
picture.setImageBitmap(currentContact.getPicture());
}
else {
picture.setImageResource(R.drawable.photoicon);
}
}
@Override
public void didFinishDatePickerDialog(Calendar selectedTime) {
TextView birthDay = findViewById(R.id.textBirthday);
birthDay.setText(DateFormat.format("MM/dd/yyyy", selectedTime));
currentContact.setBirthday(selectedTime);
}
} | [
"[email protected]"
]
| |
d7526c22f350104ce396ed8fe6691b9f5db09395 | 140025f455f65e54868d31aae733432e2c9eab43 | /src/java/WS/dao/PedidoDao.java | ce6bee36633bd5164598415771b5f3d228ee7192 | []
| no_license | keciosantos/LTP2 | ea1058c3fff8967a56cbbd29e0cf398981fc4d27 | bb0b8ce7010041e95accd5ed4c6e0fbf03c9f0ab | refs/heads/master | 2021-01-22T02:14:10.508272 | 2017-06-18T16:39:28 | 2017-06-18T16:39:28 | 92,343,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,650 | java | package WS.dao;
import WS.entity.Pedido;
import WS.util.HibernateUtil;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.Transaction;
public class PedidoDao {private Session sessao;
private Transaction trans;
public void addPedido(Pedido pe){
try {
Pedido pedido = new Pedido();
pedido.setId(pe.getId());
pedido.setCliente(pe.getCliente());
pedido.setItens(pe.getItens());
Session se = HibernateUtil.getSession().openSession();
//Transaction trans = se.beginTransaction();
se.save(pedido);
trans.commit();
} catch (Exception e) {
//e.printStackTrace();
}
}
public void removePedido(Pedido c){
try {
sessao = HibernateUtil.getSession().getCurrentSession();
trans = sessao.beginTransaction();
sessao.delete(c);
trans.commit();
} catch (Exception e) {
e.printStackTrace();
}finally{
sessao.close();
}
}
public List<Pedido> getList() {
Session sessao = HibernateUtil.getSession().openSession();
Transaction trans = sessao .beginTransaction();
Criteria cri = sessao .createCriteria(Pedido.class);
//this.list = cri.list();
return cri.list();
}
public void salvar(Pedido pedido){
throw new UnsupportedOperationException("Not supported yet.");
}
}
| [
"keciosantos@keciosantos-Note"
]
| keciosantos@keciosantos-Note |
7ff44c3f73ec4a349a627d234a3130a75c10234d | 95949acd7402b27d261d16ff9e877a5f4deeccac | /module_webrtc/src/main/java/com/maxvision/tech/webrtc/ui/ChatRoomActivity.java | 16ecd0098f495787915cc1a0e35c7a177095b635 | []
| no_license | yuhongwen-coder/pad_2.4 | 22b0f6567ba37dd702e7a4813096a7e3acf171f6 | a5be3505284409d6cd2e9973d5e72f8e81e28522 | refs/heads/main | 2023-07-26T11:01:06.265652 | 2021-08-31T06:11:54 | 2021-08-31T06:11:54 | 401,587,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,558 | java | package com.maxvision.tech.webrtc.ui;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.maxvision.tech.webrtc.R;
import com.maxvision.tech.webrtc.bean.MemberBean;
import com.maxvision.tech.webrtc.manager.IViewCallback;
import com.maxvision.tech.webrtc.manager.PeerConnectionHelper;
import com.maxvision.tech.webrtc.manager.ProxyVideoSink;
import com.maxvision.tech.webrtc.manager.WebRTCManager;
import com.maxvision.tech.webrtc.utils.PermissionUtil;
import org.webrtc.EglBase;
import org.webrtc.MediaStream;
import org.webrtc.RendererCommon;
import org.webrtc.SurfaceViewRenderer;
import org.webrtc.VideoTrack;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 群聊界面
* 支持 9 路同時通信
*/
public class ChatRoomActivity extends AppCompatActivity implements IViewCallback {
private FrameLayout wr_video_view;
private WebRTCManager manager;
private Map<String, SurfaceViewRenderer> _videoViews = new HashMap<>();
private Map<String, ProxyVideoSink> _sinks = new HashMap<>();
private List<MemberBean> _infos = new ArrayList<>();
private VideoTrack _localVideoTrack;
private int mScreenWidth;
private EglBase rootEglBase;
public static void openActivity(Activity activity) {
Intent intent = new Intent(activity, ChatRoomActivity.class);
activity.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat_room);
initView();
initVar();
ChatRoomFragment chatRoomFragment = new ChatRoomFragment();
replaceFragment(chatRoomFragment);
startCall();
}
private void initView() {
wr_video_view = findViewById(R.id.wr_video_view);
}
private void initVar() {
// 设置宽高比例
WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE);
if (manager != null) {
mScreenWidth = manager.getDefaultDisplay().getWidth();
}
wr_video_view.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mScreenWidth));
rootEglBase = EglBase.create();
}
private void startCall() {
manager = WebRTCManager.getInstance();
manager.setCallback(this);
if (!PermissionUtil.isNeedRequestPermission(ChatRoomActivity.this)) {
manager.joinRoom(getApplicationContext(), rootEglBase);
}
}
@Override
public void onSetLocalStream(MediaStream stream, String userId) {
List<VideoTrack> videoTracks = stream.videoTracks;
if (videoTracks.size() > 0) {
_localVideoTrack = videoTracks.get(0);
}
runOnUiThread(() -> {
addView(userId, stream);
});
}
@Override
public void onAddRemoteStream(MediaStream stream, String userId) {
runOnUiThread(() -> {
addView(userId, stream);
});
}
@Override
public void onCloseWithId(String userId) {
runOnUiThread(() -> {
removeView(userId);
});
}
private void addView(String id, MediaStream stream) {
SurfaceViewRenderer renderer = new SurfaceViewRenderer(ChatRoomActivity.this);
renderer.init(rootEglBase.getEglBaseContext(), null);
renderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
renderer.setMirror(true);
// set render
ProxyVideoSink sink = new ProxyVideoSink();
sink.setTarget(renderer);
if (stream.videoTracks.size() > 0) {
stream.videoTracks.get(0).addSink(sink);
}
_videoViews.put(id, renderer);
_sinks.put(id, sink);
_infos.add(new MemberBean(id));
wr_video_view.addView(renderer);
int size = _infos.size();
for (int i = 0; i < size; i++) {
MemberBean memberBean = _infos.get(i);
SurfaceViewRenderer renderer1 = _videoViews.get(memberBean.getId());
if (renderer1 != null) {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
layoutParams.height = getWidth(size);
layoutParams.width = getWidth(size);
layoutParams.leftMargin = getX(size, i);
layoutParams.topMargin = getY(size, i);
renderer1.setLayoutParams(layoutParams);
}
}
}
private void removeView(String userId) {
ProxyVideoSink sink = _sinks.get(userId);
SurfaceViewRenderer renderer = _videoViews.get(userId);
if (sink != null) {
sink.setTarget(null);
}
if (renderer != null) {
renderer.release();
}
_sinks.remove(userId);
_videoViews.remove(userId);
_infos.remove(new MemberBean(userId));
wr_video_view.removeView(renderer);
int size = _infos.size();
for (int i = 0; i < _infos.size(); i++) {
MemberBean memberBean = _infos.get(i);
SurfaceViewRenderer renderer1 = _videoViews.get(memberBean.getId());
if (renderer1 != null) {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
layoutParams.height = getWidth(size);
layoutParams.width = getWidth(size);
layoutParams.leftMargin = getX(size, i);
layoutParams.topMargin = getY(size, i);
renderer1.setLayoutParams(layoutParams);
}
}
}
private int getWidth(int size) {
if (size <= 4) {
return mScreenWidth / 2;
} else if (size <= 9) {
return mScreenWidth / 3;
}
return mScreenWidth / 3;
}
private int getX(int size, int index) {
if (size <= 4) {
if (size == 3 && index == 2) {
return mScreenWidth / 4;
}
return (index % 2) * mScreenWidth / 2;
} else if (size <= 9) {
if (size == 5) {
if (index == 3) {
return mScreenWidth / 6;
}
if (index == 4) {
return mScreenWidth / 2;
}
}
if (size == 7 && index == 6) {
return mScreenWidth / 3;
}
if (size == 8) {
if (index == 6) {
return mScreenWidth / 6;
}
if (index == 7) {
return mScreenWidth / 2;
}
}
return (index % 3) * mScreenWidth / 3;
}
return 0;
}
private int getY(int size, int index) {
if (size < 3) {
return mScreenWidth / 4;
} else if (size < 5) {
if (index < 2) {
return 0;
} else {
return mScreenWidth / 2;
}
} else if (size < 7) {
if (index < 3) {
return mScreenWidth / 2 - (mScreenWidth / 3);
} else {
return mScreenWidth / 2;
}
} else if (size <= 9) {
if (index < 3) {
return 0;
} else if (index < 6) {
return mScreenWidth / 3;
} else {
return mScreenWidth / 3 * 2;
}
}
return 0;
}
@Override // 屏蔽返回键
public boolean onKeyDown(int keyCode, KeyEvent event) {
return keyCode == KeyEvent.KEYCODE_BACK || super.onKeyDown(keyCode, event);
}
@Override
protected void onDestroy() {
exit();
super.onDestroy();
}
private void replaceFragment(Fragment fragment) {
FragmentManager manager = getSupportFragmentManager();
manager.beginTransaction()
.replace(R.id.wr_container, fragment)
.commit();
}
// 切换摄像头
public void switchCamera() {
manager.switchCamera();
}
// 挂断
public void hangUp() {
exit();
this.finish();
}
// 静音
public void toggleMic(boolean enable) {
manager.toggleMute(enable);
}
// 免提
public void toggleSpeaker(boolean enable) {
manager.toggleSpeaker(enable);
}
// 打开关闭摄像头
public void toggleCamera(boolean enableCamera) {
if (_localVideoTrack != null) {
_localVideoTrack.setEnabled(enableCamera);
}
}
private void exit() {
manager.exitRoom();
for (SurfaceViewRenderer renderer : _videoViews.values()) {
renderer.release();
}
for (ProxyVideoSink sink : _sinks.values()) {
sink.setTarget(null);
}
_videoViews.clear();
_sinks.clear();
_infos.clear();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
for (int i = 0; i < permissions.length; i++) {
Log.i(PeerConnectionHelper.TAG, "[Permission] " + permissions[i] + " is " + (grantResults[i] == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));
if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
finish();
break;
}
}
manager.joinRoom(getApplicationContext(), rootEglBase);
}
}
| [
"[email protected]"
]
| |
98c3f31e93bf8a98402b14248a6dabeadf127680 | 84da47b45739fe1ff110b954f73ed12808f3b2f7 | /src/com/stickersthecat/BrewTools/Player/PlayerObj.java | faee866af25fe6774f503b85207568cace04b636 | [
"Apache-2.0"
]
| permissive | Stickers-the-Cat/BrewTools | 17a2f89ef645d9a4bb119cbc619acf5fe6a03643 | 54bce3a5cb8501065f21bc248561908fed1b7c04 | refs/heads/master | 2020-04-30T19:56:32.038116 | 2019-03-22T09:44:24 | 2019-03-22T09:44:24 | 177,052,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 73 | java | package com.stickersthecat.BrewTools.Player;
public class PlayerObj {
}
| [
"[email protected]"
]
| |
f122dbdadfc6d712216c76a9c3413c894bbb1329 | dbb9a275810e26b9ed93e983f9f0e845eb0f9315 | /plato-model/src/main/java/eu/scape_project/planning/model/sensitivity/ExtremeWeightModifier.java | f2bc778c905f7bdc6b4e1ca934788cb1153f72d0 | [
"Apache-2.0"
]
| permissive | openpreserve/plato | 524519487e525a8af3ccdb73f7db337de37786db | 10d9fc276c23c773a6a346af8312e48c50ac8755 | refs/heads/master | 2022-07-21T04:36:35.362929 | 2015-05-22T18:30:14 | 2015-05-22T18:30:14 | 4,406,463 | 2 | 2 | Apache-2.0 | 2022-07-07T22:53:28 | 2012-05-22T12:35:23 | Java | UTF-8 | Java | false | false | 2,647 | java | /*******************************************************************************
* Copyright 2006 - 2012 Vienna University of Technology,
* Department of Software Technology and Interactive Systems, IFS
*
* 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.
*
* This work originates from the Planets project, co-funded by the European Union under the Sixth Framework Programme.
******************************************************************************/
package eu.scape_project.planning.model.sensitivity;
import eu.scape_project.planning.model.tree.TreeNode;
/**
* This implementation of IWeightModifier makes the weights of the children more extreme.
* E.g. if you have two children with A=0.2 and B=0.8 this modifier will change them to
* A=0.1 and B=0.9 (drag them even more apart).
* @author Jan Zarnikov
*
*/
public class ExtremeWeightModifier implements IWeightModifier {
public boolean performModification(TreeNode node) {
int nodeCount = node.getChildren().size();
double mean = 1/ ((double) nodeCount);
// make everything thats below mean even smaller and everything above even bigger
for(TreeNode child : node.getChildren()) {
double oldWeight = child.getWeight();
if(oldWeight == 0 || oldWeight == 1) {
continue;
}
// TODO: optimize this!
if(oldWeight < mean) {
double deltaWeight = oldWeight;
double newWeight = oldWeight - deltaWeight/2;
child.setWeight(newWeight);
} else if (oldWeight > mean) {
double deltaWeight = 1 - oldWeight;
double newWeight = oldWeight + deltaWeight/2;
child.setWeight(newWeight);
}
// note that after this, the weights might not be normalized (sum!=1)
// this doesn't matter since they will be normalized by the test anyway
// (as specified by the interface IWeightModifier)
}
return false;
}
}
| [
"[email protected]"
]
| |
4532a05776567907af8b5b9a1b36a367e21169bf | 4037095f90014feb30c033242faa672580e107b6 | /src/main/java/com/assetmanagement/entity/Brand.java | cdea48049fc3b4cf18eaaeb57e8291c935a941ed | []
| no_license | YashikaWick/BIT-project | c114186112b331ebc9ab5a7c545beebe2550725d | dca035af3f48ceee424a5f78556c4648f2eec58a | refs/heads/master | 2022-04-08T03:45:58.886279 | 2020-02-10T08:40:33 | 2020-02-10T08:40:33 | 234,938,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,941 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.assetmanagement.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author Acer
*/
@Entity
@Table(name = "brand")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Brand.findAll", query = "SELECT b FROM Brand b")})
public class Brand implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Column(name = "name")
@Pattern(regexp = "^[\\$_a-zA-Z]+[\\$_\\w\\W]*$", message = "Invalid Brand name")
private String name;
@Column(name = "description")
@Pattern(regexp = "^.*$", message = "Invalid Description")
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "brandId", fetch = FetchType.LAZY)
@JsonIgnore
private List<Asset> assetList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "brandId", fetch = FetchType.LAZY)
@JsonIgnore
private List<Brandcategory> brandcategoryList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "brandId", fetch = FetchType.LAZY)
@JsonIgnore
private List<Model> modelList;
public Brand() {
}
public Brand(Integer id) {
this.id = id;
}
public Brand(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@XmlTransient
public List<Asset> getAssetList() {
return assetList;
}
public void setAssetList(List<Asset> assetList) {
this.assetList = assetList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Brand)) {
return false;
}
Brand other = (Brand) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.assetmanagement.entity.Brand[ id=" + id + " ]";
}
@XmlTransient
public List<Brandcategory> getBrandcategoryList() {
return brandcategoryList;
}
public void setBrandcategoryList(List<Brandcategory> brandcategoryList) {
this.brandcategoryList = brandcategoryList;
}
@XmlTransient
public List<Model> getModelList() {
return modelList;
}
public void setModelList(List<Model> modelList) {
this.modelList = modelList;
}
}
| [
"[email protected]"
]
| |
5504bd84e5768f99d4bde2bba5eafb895fe5168c | bcf5c2eba825b04df13d64307b04837bf2995d9c | /feign-api/src/main/java/com/jzc/spring/cloud/api/ICommentApi.java | dd9a3be4320d22fe03a2af760afa778403a24da3 | []
| no_license | jiango0/j-cloud | b31b420d2ef3bf6e1e9f4844033ec5b0617925bc | 9300442b1fb1d27e885186a9d44b336bf2592459 | refs/heads/master | 2021-09-01T14:07:03.387109 | 2017-12-22T07:39:32 | 2017-12-22T07:39:32 | 114,340,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package com.jzc.spring.cloud.api;
import com.jzc.spring.cloud.entity.Comment;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
@FeignClient("feign-provider")
@RequestMapping(value="comment")
public interface ICommentApi {
@RequestMapping(value = "{kid}", method = RequestMethod.GET)
Comment detail(@PathVariable(value = "kid") Long kid);
@RequestMapping(value = "list", method = RequestMethod.GET)
List<Comment> list();
}
| [
"[email protected]"
]
| |
23110dbf16a5bb68c12ad9a99e30df5447d75b27 | 428aece39a20b44088ce9f06f3f1367c66f34cb8 | /src/main/java/com/zhou/bot/zhoubottest/config/DataSourceType.java | 82a4daed0ea92c634593aea2d73bb129f5923057 | []
| no_license | 15001945421/zhouboot | 8fbab2076f6d612085ca1110707c629cebd96acc | e7dc7c676958352c5b98d4d6dce39adcebc16017 | refs/heads/master | 2023-08-10T00:35:33.394960 | 2019-10-05T08:44:02 | 2019-10-05T08:44:02 | 166,496,837 | 1 | 0 | null | 2023-07-20T23:28:55 | 2019-01-19T02:18:04 | Java | UTF-8 | Java | false | false | 674 | java | package com.zhou.bot.zhoubottest.config;
/**
* @ClassName DataSourceType
* @Description 主备标识枚举值
* @Author ZhouYouMing
* @Date 2019/1/15 18:06
*/
public enum DataSourceType {
read("read", "从库"),
write("write", "主库");
private String type;
private String name;
DataSourceType(String type, String name) {
this.type = type;
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
]
| |
8c041550d333f1c27f52ceed6e5c8269d420f844 | b861c5ed82877bde2cd523bdc84cda55a1fb7a28 | /app/src/main/java/jp/techacademy/fukushi/kouchi/calcapp/MainActivity.java | 7da0ba8e38c9876ac68e82406af79a460c2bd367 | []
| no_license | qyz02004/CalcApp | 22d143ce93aecc9f1439f414efe81131aa4e060c | 1345c1d338722a7e93b9ada55686359c0356fe0e | refs/heads/master | 2021-05-11T17:34:44.445817 | 2018-01-17T11:50:22 | 2018-01-17T11:50:22 | 117,800,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,553 | java | package jp.techacademy.fukushi.kouchi.calcapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
EditText mEditText1;
EditText mEditText2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mEditText1 = (EditText)findViewById(R.id.editText1);
// 入力を数字、小数点に制限、先頭だけマイナスを許可
mEditText1.setInputType( InputType.TYPE_CLASS_NUMBER
| InputType.TYPE_NUMBER_FLAG_DECIMAL
| InputType.TYPE_NUMBER_FLAG_SIGNED);
mEditText2 = (EditText)findViewById(R.id.editText2);
// 入力を数字、小数点に制限、先頭だけマイナスを許可
mEditText2.setInputType( InputType.TYPE_CLASS_NUMBER
| InputType.TYPE_NUMBER_FLAG_DECIMAL
| InputType.TYPE_NUMBER_FLAG_SIGNED);
// ボタンにリスナーを設定
setButton( R.id.plusButton, onClick_Button );
setButton( R.id.minusButton, onClick_Button );
setButton( R.id.multiButton, onClick_Button );
setButton( R.id.divButton, onClick_Button );
}
// ボタンにリスナーを設定
private void setButton( int id, View.OnClickListener onClickListener ){
Button button = (Button)findViewById(id);
button.setOnClickListener(onClickListener);
}
// ボタンをクリックした時の処理
private View.OnClickListener onClick_Button = new View.OnClickListener(){
@Override
public void onClick(View v) {
String str1 = mEditText1.getText().toString();
String str2 = mEditText2.getText().toString();
// 入力文字がカラでなければ実行
if ( !str1.isEmpty() && !str2.isEmpty()) {
Intent intent = new Intent(MainActivity.this, SubActivity.class);
intent.putExtra("VALUE1", str1);
intent.putExtra("VALUE2", str2);
// 押下されたボタンを取得
Button button = (Button) v;
// ボタンの表示テキストを設定
intent.putExtra("CALC", button.getText());
startActivity(intent);
}
}
};
}
| [
"[email protected]"
]
| |
0b3db9009d92425899f6b3f8bdd80c879985b2ca | ccfdaf1893a39de66429c885319ad048d955f60b | /zzw-service/zzw-common/zzw-common-core/src/main/java/com/zzw/common/core/util/ResponseUtil.java | a1fcd62efacee96c3dff26a7cdf069e4c8b8bbe8 | []
| no_license | kotlin2018/JuanBlog | 4e70faa0ee5003ab3715c404fbd7dfadfb6a637d | 4cf097396cdec64f8b0e9a0958a942b8e0e5a17f | refs/heads/master | 2022-12-09T17:34:06.814920 | 2020-09-09T06:21:43 | 2020-09-09T06:21:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 714 | java | package com.zzw.common.core.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zzw.common.core.rest.baseVO.R;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class ResponseUtil {
public static void out(HttpServletResponse response, R r) {
ObjectMapper mapper = new ObjectMapper();
response.setStatus(HttpStatus.OK.value());
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
try {
mapper.writeValue(response.getWriter(), r);
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
0b9f3e79434ce39d81f9ec76e69dd2fa7f018ce3 | e409c548cd030380ff747d5e413b522982ce1e73 | /src/main/java/com/sphenon/basics/expression/classes/ActivityClass_Conditional.java | 1c83f91fef5a5cc1d8dbb8170a3152b695015989 | [
"Apache-2.0"
]
| permissive | 616c/java-com.sphenon.components.basics.expression | dd0fafe178f9d56b24f90768d3fbda5d49bce661 | 2ab5d5d49415cdab3b238334593b6505f5ee438b | refs/heads/master | 2020-03-22T05:45:53.319355 | 2018-07-06T14:30:50 | 2018-07-06T14:30:50 | 139,588,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,736 | java | package com.sphenon.basics.expression.classes;
/****************************************************************************
Copyright 2001-2018 Sphenon GmbH
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.
*****************************************************************************/
import com.sphenon.basics.context.*;
import com.sphenon.basics.context.classes.*;
import com.sphenon.basics.message.*;
import com.sphenon.basics.notification.*;
import com.sphenon.basics.exception.*;
import com.sphenon.basics.customary.*;
import com.sphenon.basics.expression.*;
import com.sphenon.basics.expression.returncodes.*;
import java.util.Vector;
public class ActivityClass_Conditional implements ActivityClass_Block, ContextAware {
public ActivityClass_Conditional(CallContext context) {
}
public ActivityClass_Conditional(CallContext context, Scope scope, com.sphenon.basics.expression.parsed.Expression begin_code, com.sphenon.basics.expression.parsed.Expression before_condition, com.sphenon.basics.expression.parsed.Expression before_code, com.sphenon.basics.expression.parsed.Expression after_code, com.sphenon.basics.expression.parsed.Expression after_condition, com.sphenon.basics.expression.parsed.Expression end_code) {
this.scope = scope;
this.begin_code = begin_code;
this.before_condition = before_condition;
this.before_code = before_code;
this.after_code = after_code;
this.after_condition = after_condition;
this.end_code = end_code;
}
protected Vector<ActivityClass> childs;
public Vector<ActivityClass> getChilds (CallContext context) {
return this.childs;
}
public void setChilds (CallContext context, Vector<ActivityClass> childs) {
this.childs = childs;
}
public void addChild (CallContext context, ActivityClass child) {
if (this.childs == null) {
this.childs = new Vector<ActivityClass>();
}
this.childs.add(child);
}
protected com.sphenon.basics.expression.parsed.Expression begin_code;
public com.sphenon.basics.expression.parsed.Expression getBeginCode (CallContext context) {
return this.begin_code;
}
public void setBeginCode (CallContext context, com.sphenon.basics.expression.parsed.Expression begin_code) {
this.begin_code = begin_code;
}
protected com.sphenon.basics.expression.parsed.Expression before_condition;
public com.sphenon.basics.expression.parsed.Expression getBeforeCondition (CallContext context) {
return this.before_condition;
}
public void setBeforeCondition (CallContext context, com.sphenon.basics.expression.parsed.Expression before_condition) {
this.before_condition = before_condition;
}
protected com.sphenon.basics.expression.parsed.Expression before_code;
public com.sphenon.basics.expression.parsed.Expression getBeforeCode (CallContext context) {
return this.before_code;
}
public void setBeforeCode (CallContext context, com.sphenon.basics.expression.parsed.Expression before_code) {
this.before_code = before_code;
}
protected com.sphenon.basics.expression.parsed.Expression after_code;
public com.sphenon.basics.expression.parsed.Expression getAfterCode (CallContext context) {
return this.after_code;
}
public void setAfterCode (CallContext context, com.sphenon.basics.expression.parsed.Expression after_code) {
this.after_code = after_code;
}
protected com.sphenon.basics.expression.parsed.Expression after_condition;
public com.sphenon.basics.expression.parsed.Expression getAfterCondition (CallContext context) {
return this.after_condition;
}
public void setAfterCondition (CallContext context, com.sphenon.basics.expression.parsed.Expression after_condition) {
this.after_condition = after_condition;
}
protected com.sphenon.basics.expression.parsed.Expression end_code;
public com.sphenon.basics.expression.parsed.Expression getEndCode (CallContext context) {
return this.end_code;
}
public void setEndCode (CallContext context, com.sphenon.basics.expression.parsed.Expression end_code) {
this.end_code = end_code;
}
// scope here is used in shell loop doEvaluation, since in case
// of block with immediate execution the scope from the creation
// is needed, which is stored here
protected Scope scope;
public Scope getScope (CallContext context) {
return this.scope;
}
public void setScope (CallContext context, Scope scope) {
this.scope = scope;
}
public Activity instantiate(CallContext context, Scope scope) throws EvaluationFailure {
Activity_Conditional a = new Activity_Conditional(context, this, scope);
return a;
}
static protected Class_ActivityInterface activity_interface;
public ActivityInterface getInterface (CallContext context) {
if (activity_interface == null) {
activity_interface = new Class_ActivityInterface(context);
}
return activity_interface;
}
public String toString(CallContext context) {
return "conditional";
}
}
| [
"[email protected]"
]
| |
406e3267c4b109630b9dcf7324701ab31ba2c6b8 | c4cc18af2e22d43c8d3dcc131e357ead7a26f486 | /httpchannel-captcha/httpchannel-captcha-captchatrader/src/main/java/com/captchatrader/exception/ImageTooLargeException.java | f4eeb2f8bcb9000e52124038206c7cf5778c8eac | [
"Apache-2.0"
]
| permissive | Rogiel/httpchannel | 9ea55847e6a622a37af7666ab66ab8f4ea232289 | 00133750ebbfb91cb9e3fc0e80755c72b659a2cb | refs/heads/master | 2021-05-26T21:33:07.286543 | 2013-12-18T21:00:37 | 2013-12-18T21:00:37 | 2,206,005 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,006 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.captchatrader.exception;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public class ImageTooLargeException extends CaptchaTraderException {
private static final long serialVersionUID = 1L;
/**
*
*/
public ImageTooLargeException() {
// TODO Auto-generated constructor stub
}
/**
* @param message
*/
public ImageTooLargeException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
/**
* @param cause
*/
public ImageTooLargeException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
/**
* @param message
* @param cause
*/
public ImageTooLargeException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
/**
* @param message
* @param cause
* @param enableSuppression
* @param writableStackTrace
*/
public ImageTooLargeException(String message, Throwable cause,
boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
// TODO Auto-generated constructor stub
}
}
| [
"[email protected]"
]
| |
0c54d32f8d376b50f279077e3308776a4a655e2f | 76f3ca599529f413b1a87288feb36424d09277a7 | /BookManager/src/com/rainbowpro/dao/UserDao.java | 84fafcc4e70a9562fca04e55a81d8d449a0d7e12 | []
| no_license | Rainbow-Chua/learningcode | 2098e5aeacc197067582e03114a6d4c204b5cad9 | 7a25e50e9d5601f66c92e46824975addaacd2fb5 | refs/heads/master | 2021-01-23T18:44:38.040267 | 2017-12-26T03:44:37 | 2017-12-26T03:44:37 | 102,804,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 895 | java | package com.rainbowpro.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.rainbowpro.model.User;
/**
* user dao class
* @author Useradmin
*
*/
public class UserDao {
/**
* Login check
* @param con
* @param user
* @return resultUser
* @throws Exception
*/
public User login(Connection con, User user)throws Exception{
User resultUser = null;
String sql = "select * from t_user where userName = ? and password = ?;";
PreparedStatement pstmt = con.prepareStatement(sql);
pstmt.setString(1, user.getUserName());
pstmt.setString(2, user.getPassword());
ResultSet rs = pstmt.executeQuery();
if(rs.next()){
resultUser = new User();
resultUser.setId(rs.getInt("id"));
resultUser.setUserName(rs.getString("userName"));
resultUser.setPassword(rs.getString("password"));
}
return resultUser;
}
}
| [
"[email protected]"
]
| |
b30245c8ca8b40592b8161c605e18128fc36b0a3 | 4b8436c771edad9497afa9c2fd7038c4498f54b1 | /src/test/java/com/example/testpitang/TestPitangApplicationTests.java | 990dcd45899fdcb2e051e5be25a11839f48aba7a | []
| no_license | GeFFz/crud-java-11 | 463992e803c8465a956efc6f12a5b1769da30e0e | f1bddd0f69548400d64407185cfc4673ca9368bd | refs/heads/master | 2022-12-07T03:15:23.511057 | 2020-08-24T16:33:30 | 2020-08-24T16:33:30 | 288,479,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.example.testpitang;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class TestPitangApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
]
| |
1624fe707705fcc3ce960ddc7723254a449b112c | b11d81df740afc67fd6d878a46ca389c4c45a351 | /src/main/java/com/wz/netty/decoder/line/NioServer.java | 5104f4a8d0c5b016007dd556fecf08c9e9c46393 | []
| no_license | ustcwangzi/netty-demo | bc73267a760926c50efa905a9f3148ecd793eb7e | 476c2353b42eeabe80e40d497b7bb471366fd50c | refs/heads/master | 2021-01-20T06:04:42.598570 | 2017-07-15T03:32:20 | 2017-07-15T03:32:20 | 89,838,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,934 | java | package com.wz.netty.decoder.line;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.codec.LineBasedFrameDecoder;
import io.netty.handler.codec.string.StringDecoder;
/**
* Created by wangzi on 2017/5/3.
*/
public class NioServer {
private static final int port = 8080;
public void bind(int port) throws Exception {
// 配置服务端的NIO线程组
EventLoopGroup bossGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).option(ChannelOption.SO_BACKLOG, 1024)
.childHandler(new ChildChannelHandler());
// 绑定端口,同步等待成功
ChannelFuture f = b.bind(port).sync();
// 等待服务端监听端口关闭
f.channel().closeFuture().sync();
} finally {
// 优雅退出,释放线程池资源
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
private class ChildChannelHandler extends ChannelInitializer<SocketChannel> {
@Override
protected void initChannel(SocketChannel arg0) throws Exception {
arg0.pipeline().addLast(new LineBasedFrameDecoder(1024));
arg0.pipeline().addLast(new StringDecoder());
arg0.pipeline().addLast(new NioServerHandler());
}
}
public static void main(String[] args) throws Exception{
new NioServer().bind(port);
}
}
| [
"wangzi"
]
| wangzi |
42f6974783ed5a287edbbdd786869194c708f430 | db21df74b76b4849576701fab59f3ae2364b5876 | /Main.java | e1de6063f2b536f2587058d75c32ee4d6c3bb18f | []
| no_license | davemar42/orden1 | d6b7034cfd22b7d90fa17ffc0f0a73cbde5c300f | c26e189bf60024369468af12959f614b8f57f8d3 | refs/heads/main | 2023-06-10T14:28:53.932573 | 2021-07-01T07:57:34 | 2021-07-01T07:57:34 | 381,954,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
public static void main(String[]args){
Double mayornota=0.0;
Double menornota=0.0;
int i;
Double nota=0.0;
int repeticiones;
ArrayList miarrar=new ArrayList();
Scanner entrada= new Scanner(System.in);
System.out.println("Cuantas notas");
repeticiones=entrada.nextInt();
for(i = 1 ; i<= repeticiones ; i++){
System.out.println("ingrese nota");
nota=entrada.nextDouble();
miarrar.add(nota);
if(i==1){
mayornota=nota;
menornota=nota;
}
if(nota<menornota)
menornota=nota;
if(nota>mayornota)
mayornota=nota;
}
System.out.println("el mayores es " +mayornota);
System.out.println("la menor nota es "+menornota);
Comparator<Double>comparador= Collections.reverseOrder();
Collections.sort(miarrar,comparador);
System.out.println(miarrar);
}
}
| [
"[email protected]"
]
| |
18cc421465051639c7da62465b6bd425a542b476 | e3b093c2766067311a26db779d73f4225e4416c2 | /servigest-backend/src/main/java/com/lluis/ServiGest/repositorios/AparatoTipoDAO.java | 048ee830127f0336bc7bf65922a7ecec53f494d9 | []
| no_license | lluisasturies/ServiGestApp | fbd3ba4f0c9f41fd6d380a2629e23a8a199d7e47 | 4d64f9b652561cb9557f5c3a0e746793ef7855ea | refs/heads/master | 2023-02-01T21:41:31.944587 | 2020-12-16T14:16:03 | 2020-12-16T14:16:03 | 318,443,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.lluis.ServiGest.repositorios;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.lluis.ServiGest.pojos.AparatoTipo;
@Repository
public interface AparatoTipoDAO extends CrudRepository<AparatoTipo,Integer> {
boolean existsByNombre(String nombre);
}
| [
"[email protected]"
]
| |
8bd4515dc75bbf8d2f0abdd2a3e0a2eb35a72502 | c5440f1be4d8c46f5bdde7354175a1d7fe3ff6b4 | /BackEnd/src/main/java/com/ecommerce/EasyCart/Service/CustomerService.java | 26bb3a7dfb2d518129061178206fb2011a5ebe78 | []
| no_license | karthika768/Angular-Easycart | 66d0474bcc4e57b17b36a04f0b4405123d9ba485 | 1fe85c7ca44f065c2c1cc72a1eae0b092b0c63e8 | refs/heads/main | 2023-08-24T00:56:39.725808 | 2021-10-26T12:58:11 | 2021-10-26T12:58:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 983 | java | package com.ecommerce.EasyCart.Service;
import java.util.Collection;
import org.springframework.validation.Errors;
import com.ecommerce.EasyCart.Forms.CustomerForm;
import com.ecommerce.EasyCart.Forms.CustomerLoginForm;
import com.ecommerce.EasyCart.View.CustomerLoginView;
import com.ecommerce.EasyCart.View.CustomerView;
import com.ecommerce.EasyCart.Entity.Customer;
import com.ecommerce.EasyCart.Exception.BadRequestException;
import com.ecommerce.EasyCart.Exception.NotFoundException;
import java.util.Optional;
public interface CustomerService {
CustomerView add(CustomerForm form);
CustomerView currentCustomer();
Customer getCustomer();
CustomerLoginView login(CustomerLoginForm form, Errors errors) throws BadRequestException;
CustomerLoginView refresh(String refreshToken) throws BadRequestException;
Collection<Customer> list();
void delete(Integer customerId);
CustomerView update(Integer customerId,CustomerForm form) throws NotFoundException;
}
| [
"[email protected]"
]
| |
42eb670c9a904e89067a5cc96eb8b12737819938 | 96b8cd0dd88c2f5ce36842bb4b0f5e58979f3830 | /src/test/java/in/lingtan/Util/EmailValidatorTestCase.java | 2bd453f0288bb24dedaa8baa726a785072e50478 | []
| no_license | Lingtan1112/payrollapp-api | 2ee7a0f2a0cef8640a4c20c4aaa2637c03c688a3 | 0e6231e7d70464c2d08b4d10df59324e9b5f7e89 | refs/heads/main | 2023-07-14T13:27:18.765108 | 2021-08-19T16:52:03 | 2021-08-19T16:52:03 | 398,008,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package in.lingtan.Util;
import static org.junit.Assert.*;
import org.junit.Test;
import in.lingtan.exceptions.InValidEmailIDException;
import in.lingtan.util.EmailValidator;
public class EmailValidatorTestCase {
@Test
public void validEmailIdIsTested() throws InValidEmailIDException {
String emailId = "[email protected]";
boolean isValidMail = EmailValidator.isValidEmailId( emailId , "Invalid EmailId");
assertTrue(isValidMail);
}
@Test
public void inValidEmailIdIsTested() {
try {
String emailId = "lingtan.navisanthonisamygmail.com";
boolean isValidMail = EmailValidator.isValidEmailId(emailId, "Invalid Email-ID format");
assertFalse(isValidMail);
} catch (Exception e) {
assertEquals("Invalid Email-ID format", e.getMessage());
}
}
}
| [
"[email protected]"
]
| |
d05d318bb271b7493d1b69834af5e931323ca324 | 1e346f7c7b0e391824b624875eb6807bb132f478 | /SWE200/Group4_Lab4_AP/test/weapon/TestScope.java | 8d15abfb4c8e41a399bb880c70487c7216385971 | []
| no_license | Adondriel/CollegePortfolio | b7097635709407aa9ec645d6cc03d9290fb91a3d | 0dca2bb0a75225b69aca6b9234e80cedfe19d0d1 | refs/heads/master | 2021-01-21T14:07:55.940612 | 2016-03-24T16:52:37 | 2016-03-24T16:52:37 | 38,413,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | package weapon;
import static org.junit.Assert.*;
import org.junit.Test;
import weapon.Attachment;
import weapon.GenericWeapon;
import weapon.Pistol;
import weapon.Scope;
import weapon.Weapon;
/**
* @author Benjamin Uleau
*
*/
public class TestScope
{
/**
* Test the functionality of all weapons that have the scope as the first attachment
*/
@Test
public void test()
{
//The weapon used for testing
Pistol p=new Pistol();
assertEquals(10, p.calcDmg(5));
//The attachment that wraps the pistol
Attachment s=new Scope(p);
assertEquals(18, s.calcDmg(5));
Pistol p2=new Pistol();
assertEquals(2, p2.calcDmg(25));
Attachment s2=new Scope(p2);
assertEquals(7, s2.calcDmg(27));
}
}
| [
"[email protected]"
]
| |
b7a9e0c089c06697a869199cbc61d74a01c57ae6 | d90b58307a5676140e9477199465d2af76b890db | /quiz/src/main/java/ru/otus/quiz/service/InteractionService.java | e75d62b71ebb0fb0e89af2fcd634db6509b260fc | []
| no_license | dostrovskiy/2021-03-otus-spring-dostrovskiy | 52e7e61bf3b31725bc507a3c6523631f29edea34 | 2be32a31f6cb39c0d7372cf20f9a4681674e6777 | refs/heads/main | 2023-07-09T06:30:27.720103 | 2021-08-20T06:03:13 | 2021-08-20T06:03:13 | 352,016,247 | 3 | 0 | null | 2021-08-20T06:03:14 | 2021-03-27T08:04:00 | Java | UTF-8 | Java | false | false | 159 | java | package ru.otus.quiz.service;
public interface InteractionService {
void say(String message);
String ask(String message);
void finish();
}
| [
"[email protected]"
]
| |
7f40032191cc721e7c98647bbebbff288a44b680 | 141b4bbcf20bd0b04448b9451294bb18f7d3a7df | /src/test/java/ru/ci/admin/web/rest/UserResourceIT.java | 427bf84f6c9e729d7cff2b9f4f7b2ebafa1b83c6 | []
| no_license | algkazakov/ci-admin | 41be9e7a86eadcd53499ec681fc55c87e6353340 | e611f798b813222a795b3bdae632202ca95f1e93 | refs/heads/master | 2022-12-21T22:43:22.468583 | 2020-01-26T15:34:17 | 2020-01-26T15:34:17 | 236,332,286 | 0 | 0 | null | 2022-12-16T04:43:37 | 2020-01-26T15:34:01 | Java | UTF-8 | Java | false | false | 26,109 | java | package ru.ci.admin.web.rest;
import ru.ci.admin.CiadminApp;
import ru.ci.admin.domain.Authority;
import ru.ci.admin.domain.User;
import ru.ci.admin.repository.UserRepository;
import ru.ci.admin.security.AuthoritiesConstants;
import ru.ci.admin.service.MailService;
import ru.ci.admin.service.UserService;
import ru.ci.admin.service.dto.UserDTO;
import ru.ci.admin.service.mapper.UserMapper;
import ru.ci.admin.web.rest.errors.ExceptionTranslator;
import ru.ci.admin.web.rest.vm.ManagedUserVM;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.CacheManager;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import java.time.Instant;
import java.util.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Integration tests for the {@link UserResource} REST controller.
*/
@SpringBootTest(classes = CiadminApp.class)
public class UserResourceIT {
private static final String DEFAULT_LOGIN = "johndoe";
private static final String UPDATED_LOGIN = "jhipster";
private static final Long DEFAULT_ID = 1L;
private static final String DEFAULT_PASSWORD = "passjohndoe";
private static final String UPDATED_PASSWORD = "passjhipster";
private static final String DEFAULT_EMAIL = "johndoe@localhost";
private static final String UPDATED_EMAIL = "jhipster@localhost";
private static final String DEFAULT_FIRSTNAME = "john";
private static final String UPDATED_FIRSTNAME = "jhipsterFirstName";
private static final String DEFAULT_LASTNAME = "doe";
private static final String UPDATED_LASTNAME = "jhipsterLastName";
private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50";
private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40";
private static final String DEFAULT_LANGKEY = "en";
private static final String UPDATED_LANGKEY = "fr";
@Autowired
private UserRepository userRepository;
@Autowired
private MailService mailService;
@Autowired
private UserService userService;
@Autowired
private UserMapper userMapper;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
@Autowired
private CacheManager cacheManager;
private MockMvc restUserMockMvc;
private User user;
@BeforeEach
public void setup() {
cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear();
cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE).clear();
UserResource userResource = new UserResource(userService, userRepository, mailService);
this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter)
.build();
}
/**
* Create a User.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which has a required relationship to the User entity.
*/
public static User createEntity(EntityManager em) {
User user = new User();
user.setLogin(DEFAULT_LOGIN + RandomStringUtils.randomAlphabetic(5));
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL);
user.setFirstName(DEFAULT_FIRSTNAME);
user.setLastName(DEFAULT_LASTNAME);
user.setImageUrl(DEFAULT_IMAGEURL);
user.setLangKey(DEFAULT_LANGKEY);
return user;
}
@BeforeEach
public void initTest() {
user = createEntity(em);
user.setLogin(DEFAULT_LOGIN);
user.setEmail(DEFAULT_EMAIL);
}
@Test
@Transactional
public void createUser() throws Exception {
int databaseSizeBeforeCreate = userRepository.findAll().size();
// Create the User
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setLogin(DEFAULT_LOGIN);
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail(DEFAULT_EMAIL);
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isCreated());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate + 1);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(testUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
}
@Test
@Transactional
public void createUserWithExistingId() throws Exception {
int databaseSizeBeforeCreate = userRepository.findAll().size();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(1L);
managedUserVM.setLogin(DEFAULT_LOGIN);
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail(DEFAULT_EMAIL);
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// An entity with an existing ID cannot be created, so this API call must fail
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void createUserWithExistingLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeCreate = userRepository.findAll().size();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setLogin(DEFAULT_LOGIN);// this login should already be used
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail("anothermail@localhost");
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Create the User
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void createUserWithExistingEmail() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeCreate = userRepository.findAll().size();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setLogin("anotherlogin");
managedUserVM.setPassword(DEFAULT_PASSWORD);
managedUserVM.setFirstName(DEFAULT_FIRSTNAME);
managedUserVM.setLastName(DEFAULT_LASTNAME);
managedUserVM.setEmail(DEFAULT_EMAIL);// this email should already be used
managedUserVM.setActivated(true);
managedUserVM.setImageUrl(DEFAULT_IMAGEURL);
managedUserVM.setLangKey(DEFAULT_LANGKEY);
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Create the User
restUserMockMvc.perform(post("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void getAllUsers() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
// Get all the users
restUserMockMvc.perform(get("/api/users?sort=id,desc")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN)))
.andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME)))
.andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME)))
.andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL)))
.andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL)))
.andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY)));
}
@Test
@Transactional
public void getUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull();
// Get the user
restUserMockMvc.perform(get("/api/users/{login}", user.getLogin()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.login").value(user.getLogin()))
.andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME))
.andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME))
.andExpect(jsonPath("$.email").value(DEFAULT_EMAIL))
.andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL))
.andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY));
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull();
}
@Test
@Transactional
public void getNonExistingUser() throws Exception {
restUserMockMvc.perform(get("/api/users/unknown"))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeUpdate = userRepository.findAll().size();
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin(updatedUser.getLogin());
managedUserVM.setPassword(UPDATED_PASSWORD);
managedUserVM.setFirstName(UPDATED_FIRSTNAME);
managedUserVM.setLastName(UPDATED_LASTNAME);
managedUserVM.setEmail(UPDATED_EMAIL);
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(UPDATED_IMAGEURL);
managedUserVM.setLangKey(UPDATED_LANGKEY);
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isOk());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeUpdate);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY);
}
@Test
@Transactional
public void updateUserLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeUpdate = userRepository.findAll().size();
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin(UPDATED_LOGIN);
managedUserVM.setPassword(UPDATED_PASSWORD);
managedUserVM.setFirstName(UPDATED_FIRSTNAME);
managedUserVM.setLastName(UPDATED_LASTNAME);
managedUserVM.setEmail(UPDATED_EMAIL);
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(UPDATED_IMAGEURL);
managedUserVM.setLangKey(UPDATED_LANGKEY);
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isOk());
// Validate the User in the database
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeUpdate);
User testUser = userList.get(userList.size() - 1);
assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN);
assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME);
assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME);
assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL);
assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL);
assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY);
}
@Test
@Transactional
public void updateUserExistingEmail() throws Exception {
// Initialize the database with 2 users
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("jhipster");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
anotherUser.setEmail("jhipster@localhost");
anotherUser.setFirstName("java");
anotherUser.setLastName("hipster");
anotherUser.setImageUrl("");
anotherUser.setLangKey("en");
userRepository.saveAndFlush(anotherUser);
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin(updatedUser.getLogin());
managedUserVM.setPassword(updatedUser.getPassword());
managedUserVM.setFirstName(updatedUser.getFirstName());
managedUserVM.setLastName(updatedUser.getLastName());
managedUserVM.setEmail("jhipster@localhost");// this email should already be used by anotherUser
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(updatedUser.getImageUrl());
managedUserVM.setLangKey(updatedUser.getLangKey());
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
}
@Test
@Transactional
public void updateUserExistingLogin() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("jhipster");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
anotherUser.setEmail("jhipster@localhost");
anotherUser.setFirstName("java");
anotherUser.setLastName("hipster");
anotherUser.setImageUrl("");
anotherUser.setLangKey("en");
userRepository.saveAndFlush(anotherUser);
// Update the user
User updatedUser = userRepository.findById(user.getId()).get();
ManagedUserVM managedUserVM = new ManagedUserVM();
managedUserVM.setId(updatedUser.getId());
managedUserVM.setLogin("jhipster");// this login should already be used by anotherUser
managedUserVM.setPassword(updatedUser.getPassword());
managedUserVM.setFirstName(updatedUser.getFirstName());
managedUserVM.setLastName(updatedUser.getLastName());
managedUserVM.setEmail(updatedUser.getEmail());
managedUserVM.setActivated(updatedUser.getActivated());
managedUserVM.setImageUrl(updatedUser.getImageUrl());
managedUserVM.setLangKey(updatedUser.getLangKey());
managedUserVM.setCreatedBy(updatedUser.getCreatedBy());
managedUserVM.setCreatedDate(updatedUser.getCreatedDate());
managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy());
managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate());
managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(put("/api/users")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(managedUserVM)))
.andExpect(status().isBadRequest());
}
@Test
@Transactional
public void deleteUser() throws Exception {
// Initialize the database
userRepository.saveAndFlush(user);
int databaseSizeBeforeDelete = userRepository.findAll().size();
// Delete the user
restUserMockMvc.perform(delete("/api/users/{login}", user.getLogin())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isNoContent());
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull();
// Validate the database is empty
List<User> userList = userRepository.findAll();
assertThat(userList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void getAllAuthorities() throws Exception {
restUserMockMvc.perform(get("/api/users/authorities")
.accept(TestUtil.APPLICATION_JSON_UTF8)
.contentType(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$").value(hasItems(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)));
}
@Test
@Transactional
public void testUserEquals() throws Exception {
TestUtil.equalsVerifier(User.class);
User user1 = new User();
user1.setId(1L);
User user2 = new User();
user2.setId(user1.getId());
assertThat(user1).isEqualTo(user2);
user2.setId(2L);
assertThat(user1).isNotEqualTo(user2);
user1.setId(null);
assertThat(user1).isNotEqualTo(user2);
}
@Test
public void testUserDTOtoUser() {
UserDTO userDTO = new UserDTO();
userDTO.setId(DEFAULT_ID);
userDTO.setLogin(DEFAULT_LOGIN);
userDTO.setFirstName(DEFAULT_FIRSTNAME);
userDTO.setLastName(DEFAULT_LASTNAME);
userDTO.setEmail(DEFAULT_EMAIL);
userDTO.setActivated(true);
userDTO.setImageUrl(DEFAULT_IMAGEURL);
userDTO.setLangKey(DEFAULT_LANGKEY);
userDTO.setCreatedBy(DEFAULT_LOGIN);
userDTO.setLastModifiedBy(DEFAULT_LOGIN);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
User user = userMapper.userDTOToUser(userDTO);
assertThat(user.getId()).isEqualTo(DEFAULT_ID);
assertThat(user.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(user.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(user.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(user.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(user.getActivated()).isEqualTo(true);
assertThat(user.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(user.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
assertThat(user.getCreatedBy()).isNull();
assertThat(user.getCreatedDate()).isNotNull();
assertThat(user.getLastModifiedBy()).isNull();
assertThat(user.getLastModifiedDate()).isNotNull();
assertThat(user.getAuthorities()).extracting("name").containsExactly(AuthoritiesConstants.USER);
}
@Test
public void testUserToUserDTO() {
user.setId(DEFAULT_ID);
user.setCreatedBy(DEFAULT_LOGIN);
user.setCreatedDate(Instant.now());
user.setLastModifiedBy(DEFAULT_LOGIN);
user.setLastModifiedDate(Instant.now());
Set<Authority> authorities = new HashSet<>();
Authority authority = new Authority();
authority.setName(AuthoritiesConstants.USER);
authorities.add(authority);
user.setAuthorities(authorities);
UserDTO userDTO = userMapper.userToUserDTO(user);
assertThat(userDTO.getId()).isEqualTo(DEFAULT_ID);
assertThat(userDTO.getLogin()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
assertThat(userDTO.getLastName()).isEqualTo(DEFAULT_LASTNAME);
assertThat(userDTO.getEmail()).isEqualTo(DEFAULT_EMAIL);
assertThat(userDTO.isActivated()).isEqualTo(true);
assertThat(userDTO.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL);
assertThat(userDTO.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
assertThat(userDTO.getCreatedBy()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getCreatedDate()).isEqualTo(user.getCreatedDate());
assertThat(userDTO.getLastModifiedBy()).isEqualTo(DEFAULT_LOGIN);
assertThat(userDTO.getLastModifiedDate()).isEqualTo(user.getLastModifiedDate());
assertThat(userDTO.getAuthorities()).containsExactly(AuthoritiesConstants.USER);
assertThat(userDTO.toString()).isNotNull();
}
@Test
public void testAuthorityEquals() {
Authority authorityA = new Authority();
assertThat(authorityA).isEqualTo(authorityA);
assertThat(authorityA).isNotEqualTo(null);
assertThat(authorityA).isNotEqualTo(new Object());
assertThat(authorityA.hashCode()).isEqualTo(0);
assertThat(authorityA.toString()).isNotNull();
Authority authorityB = new Authority();
assertThat(authorityA).isEqualTo(authorityB);
authorityB.setName(AuthoritiesConstants.ADMIN);
assertThat(authorityA).isNotEqualTo(authorityB);
authorityA.setName(AuthoritiesConstants.USER);
assertThat(authorityA).isNotEqualTo(authorityB);
authorityB.setName(AuthoritiesConstants.USER);
assertThat(authorityA).isEqualTo(authorityB);
assertThat(authorityA.hashCode()).isEqualTo(authorityB.hashCode());
}
}
| [
"[email protected]"
]
| |
b55ae6564d81b029b0212c8e934d59e109bb32fa | 4b334995c1ae09aeee86de651c086c55abf93d5f | /src/main/java/com/ssdgroupc/app/security/UserDetailsImpl.java | bc0aad56232979d1a6907b69818b0f5ed09392fc | []
| no_license | iam-amanxz/phantom-tours-api-spring-boot | 4bba3e608fe7b78f79466b4e1f7cff702a0b6119 | 2d74a8885f3b7f085bad75ab72acca823aec3e11 | refs/heads/master | 2022-11-15T11:24:51.107370 | 2020-07-08T18:23:42 | 2020-07-08T18:23:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,442 | java | package com.ssdgroupc.app.security;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ssdgroupc.app.entity.User;
/**
* Date: May 26-2020 UserDetails Implementation.
*
* @author aman
* @version 1.0
* @category Security
*
*/
public class UserDetailsImpl implements UserDetails {
private static final long serialVersionUID = 1L;
private Long id;
private String username;
private String email;
@JsonIgnore
private String password;
private Collection<? extends GrantedAuthority> authorities;
public UserDetailsImpl(Long id, String username, String email, String password,
Collection<? extends GrantedAuthority> authorities) {
this.id = id;
this.username = username;
this.email = email;
this.password = password;
this.authorities = authorities;
}
/**
* Method to build a UserDetailsImpl
*
* @param takes in user object
* @return returns a new instance of UserDetailsImpl class.
*/
public static UserDetailsImpl build(User user) {
List<GrantedAuthority> authorities = user.getRoles().stream()
.map(role -> new SimpleGrantedAuthority(role.getName().name()))
.collect(Collectors.toList());
return new UserDetailsImpl(
user.getId(),
user.getUsername(),
user.getEmail(),
user.getPassword(),
authorities);
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return authorities;
}
public Long getId() {
return id;
}
public String getEmail() {
return email;
}
@Override
public String getPassword() {
return password;
}
@Override
public String getUsername() {
return username;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
UserDetailsImpl user = (UserDetailsImpl) o;
return Objects.equals(id, user.id);
}
}
| [
"[email protected]"
]
| |
a236b4281a6af8480053e4e55e89d417a06c6768 | 9ce88fd760b412d3f8473521b96e126614c9824e | /Day13/作业代码/MyApplication/app/src/main/java/com/example/myapplication/RecordFragment/startedFragment.java | 01c2b381019db60d86719d9762cf2e7390566283 | []
| no_license | xin321536/HomeWork | 711b80f3c76a7918be499379b3a90577d0670ff8 | e57e94392505e6f7078514634aeac1a2618ec170 | refs/heads/master | 2022-11-09T22:30:34.016113 | 2020-06-18T16:06:44 | 2020-06-18T16:06:44 | 268,250,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | package com.example.myapplication.RecordFragment;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.myapplication.R;
/**
* A simple {@link Fragment} subclass.
*/
public class startedFragment extends Fragment {
public startedFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_started, container, false);
}
}
| [
"[email protected]"
]
| |
71ef33f8733f63b218cbed75740df764244b99b1 | ca70c8a7f75c11fb573471f4433477122648d0a3 | /doitjava/src/chapter10/Queue.java | 589c44a432db132c7426e3fdb60ab588df777f42 | []
| no_license | wangwooseuk/doitjava | 1853f54866511be27ba7554ef58f928b9e2f0aa9 | 3b1384fa1a328e3fcd13d1748b8ced105980063c | refs/heads/master | 2023-01-08T08:54:23.514376 | 2020-11-08T04:32:28 | 2020-11-08T04:32:28 | 286,651,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 118 | java | package chapter10;
public interface Queue {
void enQueue(String title);
String deQueue();
int getSize();
}
| [
"[email protected]"
]
| |
7b69ed4932d108c0812ba03229927d3fea6f9af0 | 51b9968c679562a1775dabf69993b2954925e7ec | /learning/src/test/me/surendra/leetcode/dynamic_programming/PascalTriangleIITest.java | 0f823ac158e4cd02c1fa7863914ac94da9cc5c93 | []
| no_license | SurendraShukla/Java | 1a80b3cb85fa50ba7605d6e75a4d66b506ac5c2f | b2573da68736dec9e1772e4dd62605044630e49e | refs/heads/master | 2023-06-09T06:00:30.104814 | 2023-05-30T05:33:18 | 2023-05-30T05:33:18 | 71,692,069 | 0 | 0 | null | 2022-12-27T14:41:29 | 2016-10-23T09:00:18 | Java | UTF-8 | Java | false | false | 1,798 | java | package me.surendra.leetcode.dynamic_programming;
import me.surendra.TestUtil;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
public class PascalTriangleIITest {
private List<Integer> callMethod(final int rowIndex) {
return new PascalTriangleII().getRow(rowIndex);
}
@Test
public void test0() {
final List<Integer> expected = Arrays.asList(1);
final List<Integer> actual = callMethod(0);
TestUtil.assertion(expected, actual);
}
@Test
public void test1() {
final List<Integer> expected = Arrays.asList(1,1);
final List<Integer> actual = callMethod(1);
TestUtil.assertion(expected, actual);
}
@Test
public void test3() {
final List<Integer> expected = Arrays.asList(1,2,1);
final List<Integer> actual = callMethod(2);
TestUtil.assertion(expected, actual);
}
@Test
public void test4() {
final List<Integer> expected = Arrays.asList(1,3,3,1);
final List<Integer> actual = callMethod(3);
TestUtil.assertion(expected, actual);
}
@Test
public void test5() {
final List<Integer> expected = Arrays.asList(1,4,6,4,1);
final List<Integer> actual = callMethod(4);
TestUtil.assertion(expected, actual);
}
@Test
public void test33() {
final List<Integer> expected = Arrays.asList(1,33,528,5456,40920,237336,1107568,4272048,13884156,38567100,92561040,193536720,354817320,573166440,818809200,1037158320,1166803110,1166803110,1037158320,818809200,573166440,354817320,193536720,92561040,38567100,13884156,4272048,1107568,237336,40920,5456,528,33,1);
final List<Integer> actual = callMethod(33);
TestUtil.assertion(expected, actual);
}
}
| [
"[email protected]"
]
| |
87a66042ff04ee361205cd0e4d2dcb8c97fc1c47 | b688ea96bd27e511d91de22f8f9a21c1d8d06222 | /extra.java | 1a0aeef7abcc9344bb6bdb61129aeaf8db85880b | []
| no_license | Ptyler649/myjava | 730ac11ae3c4d3f9a24890daea08630232f76f48 | 3d45b38703c79bbc65a63d2c2a826c9be5977f78 | refs/heads/master | 2021-12-07T14:34:31.885484 | 2018-05-25T15:38:20 | 2018-05-25T15:38:20 | 9,947,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 460 | java | package myjava;
import java.io.*;
public class extra{
public String myinput()
{
String myin = "";
System.out.println("input");
BufferedReader myread = new BufferedReader(new InputStreamReader(System.in));
try
{
myin = myread.readLine();
}
catch(Exception e)
{
e.printStackTrace();
}
return myin;
}
public void mywrite(String filename)
{
System.out.println("write a file: "+filename);
BufferedWriter mywrite = null;
}
}
| [
"[email protected]"
]
| |
8431eca948033417fe67c49330f33d74a0aa0f4b | d691d8d1d6759babd5bd9e20c2b4aacd5e38def6 | /End-To-End-Testing/src/test/java/com/nop/uat/reg/testcases/TC001_LoginTest.java | 0a3f788fe63932fba6072ab777a6399f4b7992f7 | []
| no_license | GnaneswaraKalyan/Practice-Sessions | 8ea5a691622457fb862e4ce1af598fa0649d9821 | b7f9e026c5f16c6b0c76e76fe1679cf0b62186b4 | refs/heads/master | 2022-08-06T15:03:18.969034 | 2020-02-16T05:11:22 | 2020-02-16T05:11:22 | 240,328,817 | 0 | 0 | null | 2022-06-29T17:57:36 | 2020-02-13T18:11:51 | HTML | UTF-8 | Java | false | false | 1,885 | java | package com.nop.uat.reg.testcases;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.ObjectRepository.HomepageObjects;
import com.ObjectRepository.LoginPageObjects;
import com.nop.uat.reg.base.TestBase;
import com.nop.uat.reg.pages.Dashboard;
import com.nop.uat.reg.pages.Homepage;
import com.nop.uat.reg.pages.LoginPage;
import com.nop.uat.reg.utilies.Actionclass;
import com.nop.uat.reg.utilies.TestUtil;
public class TC001_LoginTest extends TestBase {
static LoginPageObjects loginPage;
static LoginPage lp;
static Dashboard dashboard;
static Actionclass actions;
static TestUtil utils;
static TestBase tb;
static HomepageObjects home;
@BeforeClass
public static void setUp() {
initialization();
lp = new LoginPage();
loginPage = new LoginPageObjects();
dashboard = new Dashboard();
actions = new Actionclass();
home = new HomepageObjects();
}
@Test(priority = 1)
public static void validateloginTest() throws Exception {
highlightElement(lp.webTitle);
Thread.sleep(3000);
System.out.println("Is Displayed");
}
@Test
public static void loginTest() throws Throwable {
Thread.sleep(2000);
actions.javascriptEnterText(loginPage.email_txtbx, pro.getProperty("username"));
}
@Test(priority = 3)
public static void homeTest() throws Throwable {
loginTest();
highlightElement(home.nop_Logo);
Thread.sleep(3000);
highlightElement(home.NopCommerce_News);
Thread.sleep(3000);
highlightElement(home.Common_statistics);
Thread.sleep(3000);
highlightElement(home.nop_Logout);
Thread.sleep(3000);
}
@AfterClass
public static void teardown() {
quit();
}
}
| [
"[email protected]"
]
| |
b73e4e7edfc934188c45653700cc47cda6dff400 | d1a0351ac31786b39e26bbb56bbdcb188d40145e | /src/day6PackA/A.java | 75a6d04ae73ebf558c2e5bddc6837203d1c93f8d | []
| no_license | olNYXlo/CLT-Batch-6 | d72419c8cbea2cb637703eb89c59f00ff4a5a677 | 1158efe47ef21eb5a5d1de36d6d91b44a275ade1 | refs/heads/master | 2022-02-02T04:10:40.317916 | 2020-01-03T08:18:16 | 2020-01-03T08:18:16 | 197,702,923 | 0 | 0 | null | 2022-01-07T00:17:43 | 2019-07-19T04:38:58 | Java | UTF-8 | Java | false | false | 356 | java | package day6PackA;
public class A {
private int num1 = 10;
int num2 = 20;
protected int num3 = 30;
public int num4 = 40;
void accessA() {// declared within class
System.out.println(num1);
System.out.println(num2);
System.out.println(num3);
System.out.println(num4);
}
public static void main(String[] args){
}
}
| [
"[email protected]"
]
| |
792afc650ddb7f2bbb4bcc61be8a805ad3555c8b | 4aae34d37572688d34c224e6b812ef4a3b633b55 | /LTISystem/WEB-INF/src/com/lti/compiledstrategy/TempTestingMap663.java | af17ebe5fb63bb04aa4bf5891c468d68ccfda3d7 | []
| no_license | cpedia/xjany-jee-1 | 9300eabfc263e1f3a4346fccdceaed5c3b606f6d | 2a9791b248c4f58c8113dbff2d32b8023244a0ec | refs/heads/master | 2016-08-11T14:58:30.434979 | 2013-04-11T03:22:40 | 2013-04-11T03:22:40 | 55,684,098 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,445 | java | package com.lti.compiledstrategy;
import com.lti.Exception.Security.NoPriceException;
import com.lti.Exception.Strategy.ParameterException;
import com.lti.Exception.Strategy.VariableException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.math.*;
import com.lti.service.bo.*;
import java.util.*;
import com.lti.type.*;
import com.lti.type.finance.*;
import com.lti.type.executor.*;
import com.lti.util.*;
import com.tictactec.ta.lib.*;
import com.lti.util.simulator.ParameterUtil;
@SuppressWarnings({ "deprecation", "unused" })
public class TempTestingMap663 extends SimulateStrategy{
public TempTestingMap663(){
super();
StrategyID=663L;
StrategyClassID=3L;
}
//----------------------------------------------------
//parameters
//----------------------------------------------------
private String[] CandidateAsset;
public void setCandidateAsset(String[] CandidateAsset){
this.CandidateAsset=CandidateAsset;
}
public String[] getCandidateAsset(){
return this.CandidateAsset;
}
private double RiskyAllocation;
public void setRiskyAllocation(double RiskyAllocation){
this.RiskyAllocation=RiskyAllocation;
}
public double getRiskyAllocation(){
return this.RiskyAllocation;
}
private double MoneyAllocation;
public void setMoneyAllocation(double MoneyAllocation){
this.MoneyAllocation=MoneyAllocation;
}
public double getMoneyAllocation(){
return this.MoneyAllocation;
}
@SuppressWarnings("deprecation")
public void fetchParameters()throws ParameterException{
Map<String,String> parameters=SimulateParameters;
//curAsset=parameters.get("curAsset");
CandidateAsset=(String[])ParameterUtil.fetchParameter("String[]","CandidateAsset", "Large Growth,Large Value,SHORT TERM,Muni Ohio,CASH,CASH,CASH,CD", parameters);
RiskyAllocation=(Double)ParameterUtil.fetchParameter("double","RiskyAllocation", "70", parameters);
MoneyAllocation=(Double)ParameterUtil.fetchParameter("double","MoneyAllocation", "10", parameters);
}
//----------------------------------------------------
//variables
//----------------------------------------------------
public String getVariables(){
StringBuffer sb=new StringBuffer();
return sb.toString();
}
public void writeObject(ObjectOutputStream stream) throws IOException{
}
public void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException{
}
//----------------------------------------------------
//user defined functions
//----------------------------------------------------
public Map<String,Double> AssetPercentageAllocation(String[] CandidateAsset, double RiskyAllocation, double MoneyAllocation) throws Exception {
int a1=0;int a2=0;int a0=0;int aa=0;
int[] A = new int[CandidateAsset.length];
Map<String,Double> amap=new HashMap<String,Double>();
/*�CandidateAsset d�
*/
List <String> Candidate=new ArrayList<String>();
for (int i=0;i<CandidateAsset.length;i++){
boolean boo=true;
for (int j=0;j<Candidate.size();j++){
if (CandidateAsset[i].equals(Candidate.get(j))) {boo=false;}
}
if (boo) Candidate.add(CandidateAsset[i]);
}
for(int i =0; i< Candidate.size(); i++){
if(isUpperOrSameClass("EQUITY", Candidate.get(i)) || isUpperOrSameClass("HIGH YIELD BOND", Candidate.get(i)) || isUpperOrSameClass("HIGH YIELD BONDS", Candidate.get(i)))
{A[i] = 1; a1+=1;}
if(isUpperOrSameClass("FIXED INCOME", Candidate.get(i)) && !isUpperOrSameClass("HIGH YIELD BOND", Candidate.get(i)) && !isUpperOrSameClass("HIGH YIELD BONDS", Candidate.get(i)))
{A[i] = 2; a2 +=1;}
if(isUpperOrSameClass("CASH", Candidate.get(i)))
{A[i] = 0; a0 +=1;}
}
if ((a1==0)&&(RiskyAllocation!=0)) {printToLog("No candidate Risky_Assets!");}
if ((a2==0)&&((100-RiskyAllocation-MoneyAllocation)!=0)) {printToLog("No candidate Stable_Assets!");}
for (int i=0; i<Candidate.size(); i++){
if (A[i]==1){
amap.put(Candidate.get(i),new Double(1.0/a1));
printToLog(Candidate.get(i)+(double)(1.0/a1));
}
else if (A[i]==2){
amap.put(Candidate.get(i),new Double(1.0/a2));
printToLog(Candidate.get(i)+(double)(1.0/a2));
}
else if ((A[i]==0)&&(a0!=0))
{amap.put(Candidate.get(i),new Double(1.0/a0));
printToLog(Candidate.get(i)+(double)(1.0/a0));}
}
if (a0==0){amap.put("CASH",new Double(MoneyAllocation));}
return amap;
}
//----------------------------------------------------
//initialize code
//----------------------------------------------------
@SuppressWarnings({ "deprecation", "unchecked" })
public void init() throws Exception{
Map<String,Double> amap=AssetPercentageAllocation(CandidateAsset,RiskyAllocation,MoneyAllocation);
}
//----------------------------------------------------
//re-initialize code
//----------------------------------------------------
@SuppressWarnings({ "deprecation", "unchecked" })
public void reinit() throws Exception{
}
//----------------------------------------------------
//action code
//----------------------------------------------------
@SuppressWarnings({ "deprecation", "unchecked" })
public void action() throws Exception{
if(new Boolean(true).equals(false)){
}
else{
;
}
}
public double getVersion(){
return version;
}
}
// | [
"[email protected]"
]
| |
c9db04bbb4fa2502ac43bc3ac1cc642484cd98df | d1c92da3f513efa54834cd674bcf97739707178a | /recommendation-command-service/src/main/java/com/stackroute/squad/services/RolesServiceImpl.java | 53db747e4316e074124e9b9a3c482ecb1377da12 | []
| no_license | adithyaGowda/latestSquad | 4e5eb16879225f1f96e94cc46784e0d1cd7282b2 | fe759ce9e17a8e45a352497b4ba96cb2676d4487 | refs/heads/master | 2023-01-12T07:43:10.641767 | 2019-09-30T12:25:29 | 2019-09-30T12:25:29 | 211,853,945 | 0 | 0 | null | 2023-01-07T10:14:19 | 2019-09-30T12:24:46 | Java | UTF-8 | Java | false | false | 1,259 | java | package com.stackroute.squad.services;
import com.stackroute.squad.domain.Roles;
import com.stackroute.squad.repository.RolesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Service indicates annotated class is a service which hold business logic in the Service layer
*/
@Service
public class RolesServiceImpl implements RolesService {
RolesRepository rolesRepository;
/**
* Constructor based Dependency injection to inject rolRepository here
*/
@Autowired
public RolesServiceImpl(RolesRepository rolesRepository) {
this.rolesRepository = rolesRepository;
}
/**
* Implementation of the method to save the roles
*/
@Override
public Roles save(Roles roles) {
return rolesRepository.save(roles);
}
/**
* Implementation of the method to get all the roles
*/
@Override
public List<Roles> getAllRoles() {
List<Roles> allRoles = (List<Roles>) rolesRepository.findAll();
return allRoles;
}
/**
* Implementation of the method to update the roles
*/
@Override
public Roles updateRoles(Roles roles) {
Roles updateRoles = rolesRepository.save(roles);
return updateRoles;
}
}
| [
"[email protected]"
]
| |
9a646078f7d9a1f88cb92f1f9c8920002bcd7cd8 | 14322737417e5048ba126d7474f212f548817fc7 | /src/main/java/com/hyulib/hyreader/domain/HyreaderAttendRowMapper.java | f04477f6d0fca79d4cd22b6e21118aa0ebdb1cad | []
| no_license | sklee2/libapp | da538a73f6bcdb1c91e819e7b7ba21fa189fb273 | 2d5d157dbda204ec1febab077ccd0e4a08ee4b32 | refs/heads/master | 2021-01-10T03:21:34.123078 | 2017-03-21T06:55:19 | 2017-03-21T06:55:19 | 49,401,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package com.hyulib.hyreader.domain;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Created by sklee on 2016. 1. 6..
*/
public class HyreaderAttendRowMapper implements RowMapper<HyreaderAttend> {
@Override
public HyreaderAttend mapRow(ResultSet rs, int rowNum) throws SQLException{
HyreaderAttend hyreaderAttend = new HyreaderAttend();
hyreaderAttend.setCategory(rs.getString("category"));
hyreaderAttend.setEvent_name(rs.getString("event_name"));
hyreaderAttend.setPoint(rs.getInt("point"));
hyreaderAttend.setPoint_type(rs.getString("point_type"));
hyreaderAttend.setTerm(rs.getString("term"));
hyreaderAttend.setUser_id(rs.getString("user_id"));
hyreaderAttend.setYear(rs.getString("year"));
return hyreaderAttend;
}
}
| [
"[email protected]"
]
| |
9c49b0ea9acb0e40d09e5c35a9ccfa35e4d29fac | 4eb69fffe43bb6eaf2d50dc3a3656bbfc2e33ca3 | /haowu-interface/src/main/java/com/haowu/interfacetest/QQBInterface.java | fefc9267b1987de39a572a0aa3d9e4f1026cc986 | []
| no_license | snowINsummer/limn | aaf278f82e7af4d6b40fe5e8f80f60425f0d58ae | 2a64d66d372fde61c22cd9bd02dfc58301050b74 | refs/heads/master | 2020-12-25T22:20:13.075966 | 2014-11-05T09:15:59 | 2014-11-05T09:15:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,099 | java | package com.haowu.interfacetest;
import java.util.HashMap;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
import com.limn.tool.common.Common;
import com.limn.tool.common.Print;
import com.limn.tool.external.JSONReader;
import com.limn.tool.httpclient.StructureMethod;
/**
*
* 抢钱包APP
*
* /hoss-society/app4/agent/client.do 推荐接口
* /hoss-society/app4/login/agentlogin.do 登录
* @author limn
*
*/
public class QQBInterface {
HttpClient client = new HttpClient();
SystemInterface sif = null;
private String key = null;
public QQBInterface(String ip, int port){
client.getHostConfiguration().setHost(ip, port, "http");
}
public void loginSystem(){
sif = new SystemInterface("www.haowu.com", 80);
sif.login("haowuwang", "haowuwangbestwu");
}
/**
* 登录
* @param username 手机号
* @param password 密码
*/
public boolean login(String username, String password){
NameValuePair[] param = {
new NameValuePair("user_name", username),
new NameValuePair("user_pass", password),
};
PostMethod postMethod = StructureMethod.getPostMethod(param,
"/hoss-society/app4/login/agentlogin.do");
String jsonResutls = StructureMethod.execute(client, postMethod);
HashMap<String,Object> map = JSONReader.getMapFromJson(jsonResutls);
if(map.get("status").equals("1")){
key = (String) map.get("key");
Print.log("登录成功", 1);
return true;
}else{
Print.log("登录失败", 2);
return false;
}
}
/**
* 推荐客户
* @param clientName 客户名称
* @param clientPhone 客户手机号
* @param housesID housesID
* @param housesName housesName
*/
public void recommend(String clientName, String clientPhone, String housesID, String housesName){
JSONObject data_houses = new JSONObject();
data_houses.put("houses_id", housesID);
data_houses.put("houses_name", housesName);
data_houses.put("type", "0");
JSONArray array = new JSONArray();
array.add(data_houses);
JSONObject node = new JSONObject();
node.put("data_houses", array);
node.put("name", clientName);
node.put("phone", clientPhone);
NameValuePair[] param = {
new NameValuePair("key", key),
new NameValuePair("data_json", node.toString()),
};
PostMethod postMethod = StructureMethod.getPostMethod(param,
"/hoss-society/app4/agent/client.do");
String jsonResutls = StructureMethod.execute(client, postMethod);
System.out.println(jsonResutls);
}
/**
* 获取活动列表
* @param cityID
* @param mac
* @return
*/
public String getActivitesByCityID(String cityID,String mac){
NameValuePair[] param2 = { new NameValuePair("cityId", cityID),
new NameValuePair("key", ""), new NameValuePair("mac", mac),
new NameValuePair("page", "0"), new NameValuePair("size", "25") };
PostMethod postMethod2 = StructureMethod.getPostMethod(param2,
"/hoss-society/app4/activity/getActivities.do");
String jsonResutls = StructureMethod.execute(client, postMethod2);
return jsonResutls;
}
/**
* 注册
* @param iphone
* @param mac
* @param cityID
* @param username
* @param password
* @return
*/
public String register(String iphone,String mac,String username,String password){
NameValuePair[] param = {
new NameValuePair("account_phone", iphone),
new NameValuePair("mac", mac),
new NameValuePair("download_code", "")
};
PostMethod postMethod = StructureMethod.getPostMethod(param,
"/hoss-society/app4/account/reg/verify.do");
String jsonResutls = StructureMethod.execute(client, postMethod);
System.out.println(jsonResutls);
Common.wait(2000);
String ver = sif.getCodeByPhone(iphone);
System.out.println(ver);
NameValuePair[] param1 = {
new NameValuePair("account_phone", iphone),
new NameValuePair("verify", ver),
};
PostMethod postMethod1 = StructureMethod.getPostMethod(param1,
"/hoss-society/app4/account/reg/yz.do");
jsonResutls = StructureMethod.execute(client, postMethod1);
System.out.println(jsonResutls);
NameValuePair[] param3 = {
new NameValuePair("account_name", username),
new NameValuePair("account_password", password),
new NameValuePair("account_phone", iphone),
new NameValuePair("checkStatus", "-1"),
new NameValuePair("download_code", ""),
new NameValuePair("mac", "mac")
};
PostMethod postMethod3 = StructureMethod.getPostMethod(param3,
"/hoss-society/app4/account/reg.do");
jsonResutls = StructureMethod.execute(client, postMethod3);
System.out.println(jsonResutls);
return (String) JSONReader.getMapFromJson(jsonResutls).get("status");
}
public void setCity(String CityID){
NameValuePair[] param = {
new NameValuePair("cityId", CityID),
new NameValuePair("key", key)
};
PostMethod postMethod = StructureMethod.getPostMethod(param,
"/hoss-society/app4/login/bindBrokerCity.do");
String jsonResutls = StructureMethod.execute(client, postMethod);
System.out.println(jsonResutls);
}
/**
* 获取总金额
*/
public String getCash(){
NameValuePair[] param = {
new NameValuePair("key", key),
new NameValuePair("page", "0"),
new NameValuePair("size", "25"),
new NameValuePair("type", "0")
};
PostMethod postMethod = StructureMethod.getPostMethod(param,
"/hoss-society/app4/wallets/cashBackList.do");
String jsonResutls = StructureMethod.execute(client, postMethod);
HashMap<String,Object> map = JSONReader.getMapFromJson(jsonResutls);
return map.get("balance").toString();
}
/**
* 修改城市ID
* @param cityID
* @param phone
*/
public void changeCity(String cityID , String phone){
NameValuePair[] param = {
new NameValuePair("key", key),
new NameValuePair("newCityId", cityID),
new NameValuePair("phone", phone)
};
PostMethod postMethod = StructureMethod.getPostMethod(param,
"/hoss-society/app4/change/changeCity.do");
StructureMethod.execute(client, postMethod);
}
public String shareActivites(String activityId){
NameValuePair[] param = {
new NameValuePair("key", key),
new NameValuePair("activityId", activityId),
new NameValuePair("shareStatus", "1"),
new NameValuePair("way", "2")
};
PostMethod postMethod = StructureMethod.getPostMethod(param,
"/hoss-society/app4/change/changeCity.do");
return StructureMethod.execute(client, postMethod);
}
/**
* 实例
* @param args
*/
public static void main(String[] args){
QQBInterface qqbif = new QQBInterface("http://ios1.haowu.com", 83);
qqbif.login("13810000002", "a111111");
qqbif.recommend("aa", "13697898451", "12959", "limn-5");
}
}
| [
"[email protected]"
]
| |
e8fc9f5e5ec1bbe82d851f496428cf74d86d888f | 441161234507c1172e4f76c8e605886f7d6cce47 | /Bolum2/src/bolum2/Soru13.java | 77464171c9520476e611b042821f6f1ca119fa2f | []
| no_license | nurselininprizmasi/javaCalisma | 3adda0312a6e6ce3b9707c90f6dada776ad85522 | 8a4191817d5a939f2e0a41013d4a1b857b72c8b2 | refs/heads/master | 2021-01-10T05:48:51.911702 | 2016-08-16T15:01:21 | 2016-08-16T15:01:21 | 45,256,894 | 0 | 0 | null | null | null | null | ISO-8859-9 | Java | false | false | 512 | java | package bolum2;
import java.util.Scanner;
public class Soru13 {
public static void main(String[] args) {
String cumle;
Scanner giris = new Scanner(System.in);
System.out.println(" Boşluk içeren bir cumle giriniz..");
cumle = giris.nextLine();
giris.close();
cumle=cumle.toUpperCase();
System.out.println(cumle);
System.out.println("Cümlede yer alan karakter sayısı " +cumle.length());
System.out.println("İlk boşluğun bulundupu konum: "+cumle.indexOf(" "));
}
}
| [
"[email protected]"
]
| |
175228dc6086280c65c65b48820326a9861afbcc | fe678c5e9d078a928d7bd21da8a10a6d2fa84e3a | /src/test/java/com/mottledog/TestExcelUtil.java | 0a19e30bafc83f18ccc0e259e7ebc2781755e68b | [
"Apache-2.0"
]
| permissive | levitian/DailyReport | 71d861db77d000d6ea7dd3846fc6d94342b654de | 33610612654e23b0c277ab56cc33e3db6539fbe2 | refs/heads/master | 2021-01-10T08:39:41.976095 | 2015-12-23T10:30:36 | 2015-12-23T10:30:36 | 47,452,963 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 56 | java | package com.mottledog;
public class TestExcelUtil {
}
| [
"[email protected]"
]
| |
3d74d2d14b592bec440f80422eebc7c1371da00f | ffb26624c13916655f897c32bc0f32a290282192 | /Klijent/src/com/comtrade/view/panel/PanelSlika.java | 799d592bdb18e7bd9d9e0181769b826361fada57 | []
| no_license | ztrampic/AirportComtrade | 37d1afb7407aaeb7e3aec1c90a7eff079969a5e3 | 92a62785aa3a8b7cc94aa8cff468d6db1dbb9520 | refs/heads/master | 2020-04-28T11:56:57.484549 | 2019-03-13T18:01:59 | 2019-03-13T18:01:59 | 175,260,084 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package com.comtrade.view.panel;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
public class PanelSlika extends JPanel {
private BufferedImage slika;
public PanelSlika(){
setSize(400,400);
setVisible(true);
ucitajSliku("/slika10panel.png");
}
private void ucitajSliku(String string) {
try {
slika = ImageIO.read((PanelSlika.class.getResource(string)));
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(slika, 0, 0, this);
}
}
| [
"[email protected]"
]
| |
5d679117285694f1ba4b68085aba370a7139d5cd | 4aa7a3f72b6631d4c7759c25e1e8e6fd72315fb9 | /src/main/java/jp/sf/fess/form/admin/WizardForm.java | 8d06857b9c91281ee429360a0b0a1c9bfbe4e119 | [
"Apache-2.0"
]
| permissive | shatake/fess | 3ff98491e797b16d43f9b43e96e0885849cdd1ce | abf020ecb03e3b27f8933b8ba8c1a5ea63d9e3db | refs/heads/master | 2020-12-26T10:18:16.033857 | 2014-10-30T12:56:01 | 2014-10-30T12:56:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | /*
* Copyright 2009-2014 the CodeLibs Project and the Others.
*
* 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 jp.sf.fess.form.admin;
import java.io.Serializable;
import org.seasar.struts.annotation.IntRange;
import org.seasar.struts.annotation.LongRange;
import org.seasar.struts.annotation.Maxbytelength;
import org.seasar.struts.annotation.Required;
public class WizardForm implements Serializable {
private static final long serialVersionUID = 1L;
@Maxbytelength(maxbytelength = 200, target = "crawlingConfig,crawlingConfigNext")
public String crawlingConfigName;
@Required(target = "crawlingConfig,crawlingConfigNext")
@Maxbytelength(maxbytelength = 1000)
public String crawlingConfigPath;
@LongRange(min = 0, max = Long.MAX_VALUE, target = "crawlingConfig,crawlingConfigNext")
public String maxAccessCount;
@IntRange(min = 0, max = Integer.MAX_VALUE, target = "crawlingConfig,crawlingConfigNext")
public String depth;
public WizardForm() {
maxAccessCount = "10000";
depth = null;
}
}
| [
"[email protected]"
]
| |
3b6c4ffea91030ee9734abcfac4ca10c9c8209ca | b38f7dfd0a03a5d976748d17e9a1a5bb1f19cfe4 | /BaseLibrary/src/main/java/com/java/baselibrary/ui/fragment/BaseMvpFragment.java | 9412632f8ae88513c575e9eb1d699831cbdbe06a | []
| no_license | skydragonboy/JavaMall | 2fc603f069f47d3885eea7bf06a1e585c071dc64 | ef50ac2a3af71ed3466622c84f836f1887f0edbf | refs/heads/master | 2020-04-01T16:38:35.960829 | 2018-10-31T10:32:04 | 2018-10-31T10:32:04 | 153,390,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package com.java.baselibrary.ui.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.java.baselibrary.common.BaseApplication;
import com.java.baselibrary.injection.component.ActivityComponent;
import com.java.baselibrary.injection.component.DaggerActivityComponent;
import com.java.baselibrary.injection.module.ActivityModule;
import com.java.baselibrary.presenter.BasePresenter;
import com.java.baselibrary.presenter.view.BaseView;
import javax.inject.Inject;
/**
* Created by Pan on 2018/10/15.
*/
public abstract class BaseMvpFragment<T extends BasePresenter> extends BaseFragment implements BaseView {
@Inject
public T mPresenter;
public ActivityComponent mActivityComponent;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
initActivityInjection();
injectComponent();
return super.onCreateView(inflater, container, savedInstanceState);
}
protected abstract void injectComponent();
@Override
public void showLoding() {
}
@Override
public void hideLoading() {
}
@Override
public void onError() {
}
private void initActivityInjection() {
mActivityComponent = DaggerActivityComponent
.builder().appComponent(((BaseApplication) (getActivity().getApplication())).appComponent)
.activityModule(new ActivityModule(getActivity()))
.build();
}
}
| [
"[email protected]"
]
| |
992a0a074011e6127ed04f8c7de0cfe272a717e1 | 1bbcb88192cc77b841ae15369ed55cacf500184c | /src/main/java/com/bootdo/fanfan/web/controller/CommodityController.java | 94530ec39dd8cccc046449dd28ad1ec2f6ad565d | []
| no_license | yjfgh5t/fanfan.web.manager | 5564e0d389ae81a19c023aaefcec015d8d7e6405 | 38648a91eaa4f7c3824fab6a6b9b1e7a87f2b8f6 | refs/heads/master | 2021-04-06T13:49:14.225296 | 2018-12-02T09:16:41 | 2018-12-02T09:16:41 | 124,379,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,209 | java | package com.bootdo.fanfan.web.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.bootdo.common.controller.BaseController;
import com.bootdo.fanfan.domain.CommodityCategoryDO;
import com.bootdo.fanfan.domain.CommodityDO;
import com.bootdo.fanfan.service.CommodityCategoryService;
import com.bootdo.fanfan.service.CommodityService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import com.bootdo.common.utils.R;
/**
*
*
* @author jy
* @email [email protected]
* @date 2018-03-30 22:53:17
*/
@Controller
@RequestMapping("/fanfan/commodit")
public class CommodityController extends BaseController {
@Autowired
private CommodityService commodityService;
@Autowired
private CommodityCategoryService commodityCategoryService;
@GetMapping()
@RequiresPermissions("fanfan:commodit:commodit")
String Commodit(){
return "fanfan/commodit/commodit";
}
@ResponseBody
@GetMapping("/list")
@RequiresPermissions("fanfan:commodit:commodit")
public PageUtils list(@RequestParam Map<String, Object> params){
//查询列表数据
Query query = new Query(params);
query.put("sort","`order`");
query.put("order","asc");
query.put("customerId",getUserId());
List<CommodityDO> commoditList = commodityService.list(query);
int total = commodityService.count(query);
PageUtils pageUtils = new PageUtils(commoditList, total);
return pageUtils;
}
@GetMapping("/add")
@RequiresPermissions("fanfan:commodit:add")
String add(ModelMap modelMap){
//查询分类列表
Map<String,Object> queryParams = new HashMap<>();
queryParams.put("customer_id",this.getUserId().intValue());
List<CommodityCategoryDO> categoryDOList = commodityCategoryService.list(queryParams);
modelMap.put("categoryTypes",categoryDOList);
return "fanfan/commodit/add";
}
@GetMapping("/edit/{id}")
@RequiresPermissions("fanfan:commodit:edit")
String edit(@PathVariable("id") Integer id,Model model){
CommodityDO commodit =null;
if(id>0) {
commodit = commodityService.get(id);
}
if(commodit==null){
commodit = new CommodityDO();
commodit.setId(id);
}
model.addAttribute("commodit", commodit);
//查询分类列表
Map<String,Object> queryParams = new HashMap<>();
queryParams.put("customer_id",this.getUserId().intValue());
List<CommodityCategoryDO> categoryDOList = commodityCategoryService.list(queryParams);
model.addAttribute("categoryTypes",categoryDOList);
return "fanfan/commodit/edit";
}
/**
* 保存
*/
@ResponseBody
@PostMapping("/save")
@RequiresPermissions("fanfan:commodit:add")
public R save( CommodityDO commodit){
if(commodityService.save(commodit)>0){
return R.ok();
}
return R.error();
}
/**
* 修改
*/
@ResponseBody
@RequestMapping("/update")
@RequiresPermissions("fanfan:commodit:edit")
public R update( CommodityDO commodit){
if(commodit.getId()==0) {
commodit.setCustomerId(getUserId().intValue());
commodit.setDelete(0);
commodityService.save(commodit);
}else {
commodityService.update(commodit);
}
return R.ok();
}
/**
* 删除
*/
@PostMapping( "/remove")
@ResponseBody
@RequiresPermissions("fanfan:commodit:remove")
public R remove( Integer id){
if(commodityService.remove(id)>0){
return R.ok();
}
return R.error();
}
/**
* 删除
*/
@PostMapping( "/batchRemove")
@ResponseBody
@RequiresPermissions("fanfan:commodit:batchRemove")
public R remove(@RequestParam("ids[]") Integer[] ids){
commodityService.batchRemove(ids);
return R.ok();
}
}
| [
"[email protected]"
]
| |
437cccba8b3ddf1fb855ffc104103d851e4cc4fc | c1e758c98c2dd56ddd0c79ecd261881f65bc2868 | /src/basicweb/IEDriver.java | 8c372fe117abb7131cd61e07f5a49eda69a7cfbc | []
| no_license | rahuldeyfb33/Selenium-WebUI_Functions | 466b93e3b75459f8a747f73aeebda848153b4078 | b2156c97e5a6b0bc8ac5bddfd90082bbb3dae4e9 | refs/heads/master | 2022-12-11T18:33:24.170557 | 2020-08-22T16:16:12 | 2020-08-22T16:16:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | package basicweb;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class IEDriver {
public static void main(String[] args) {
// http://selenium-release.storage.googleapis.com/index.html
String baseURL = "http://www.google.com";
WebDriver driver;
System.setProperty("webdriver.ie.driver", "C:\\Users\\rahul.dey\\workspace\\libs\\drivers\\IEDriverServer.exe");
driver = new InternetExplorerDriver();
driver.get(baseURL);
}
} | [
"[email protected]"
]
| |
8c14c52a06147356796f737b405d8fd1b34d6efe | 82caa866ba1a9d39a8c6dbfccef590dd425c6eb0 | /DosyaOkumaYazma/src/DogumGunu.java | de24a9184a98d0e5d0acaeb68eb0d255867c63cf | []
| no_license | dogan48/Java | 690d8c34ffbf42ebfc2350f448d92d159519c761 | 03283e6a22312cc2d217f9d2fd0c540769e6832a | refs/heads/master | 2019-07-15T11:59:58.255429 | 2018-11-14T20:34:39 | 2018-11-14T20:34:39 | 61,987,985 | 0 | 0 | null | null | null | null | ISO-8859-9 | Java | false | false | 476 | java | import java.util.Scanner;
public class DogumGunu {
public static void main(String[] args) {
int ay=0, gun=0;
Scanner scan = new Scanner( System.in);
System.out.println("Gün ve Ay giriniz:");
gun = scan.nextInt();
ay = scan.nextInt();
if(gun == 24 && ay ==7)
for(int i = 1; i<=61; i++)
System.out.println("Bizim Tayfa olarak "
+ "Ali Kemal Özkan'ın doğum gününü kutlarız!!!");
else
System.out.println("Yok Birşey...");
}
}
| [
"dogan48"
]
| dogan48 |
5a6f6ddc7b6a360e90072aecf8e996a6c01204b6 | 6888a877b5e49791af7046fd295b9e597d22492a | /subprojects/gradle-core/src/main/groovy/org/gradle/api/internal/artifacts/publish/maven/deploy/DeployableFilesInfo.java | 088f45b55aa49ad5461b2b9131698e0d663ff727 | []
| no_license | peas/gradle | c98d655efbb86c636c0a31bf09047325f39bba63 | 42c18c115912d891da9843ee9a785dfdd2e363f6 | refs/heads/master | 2021-01-17T23:02:04.476863 | 2010-08-04T08:40:09 | 2010-08-04T08:40:09 | 825,368 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,394 | java | /*
* Copyright 2009 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.gradle.api.internal.artifacts.publish.maven.deploy;
import java.io.File;
import java.util.Set;
/**
* @author Hans Dockter
*/
public class DeployableFilesInfo {
private File pomFile;
private File artifactFile;
private Set<ClassifierArtifact> classifierArtifacts;
public DeployableFilesInfo(File pomFile, File artifactFile, Set<ClassifierArtifact> classifierArtifacts) {
this.pomFile = pomFile;
this.artifactFile = artifactFile;
this.classifierArtifacts = classifierArtifacts;
}
public File getPomFile() {
return pomFile;
}
public File getArtifactFile() {
return artifactFile;
}
public Set<ClassifierArtifact> getClassifierArtifacts() {
return classifierArtifacts;
}
}
| [
"[email protected]"
]
| |
8c526526a86d6016bb054751eeef371642bb4009 | cabd7955be92c6bc547f68adb461af7c0c141149 | /src/main/java/com/example/demo/transform/DynamicClassloader.java | 698474a33bcc9d4d21c71d93d2e2e102bfb1a8e9 | []
| no_license | jiangzl0325/Contact2Json | 519dfd78ceefabe19745086a579521693bbff128 | 61f22585b0676434ca1cab6fddb7257192da2944 | refs/heads/master | 2023-01-11T11:04:11.008109 | 2019-08-09T09:57:26 | 2019-08-09T09:57:26 | 197,753,867 | 0 | 0 | null | 2023-01-04T05:03:22 | 2019-07-19T10:31:11 | Java | UTF-8 | Java | false | false | 93 | java | package com.example.demo.transform;
public class DynamicClassloader extends ClassLoader{
}
| [
"[email protected]"
]
| |
b941907b9bc6a663ac191dab7296b621578f0d34 | 7916ad6069a554a4594b529dc71cb5b520276eb9 | /slog/src/test/java/com/sxh/slog/ExampleUnitTest.java | e41fc1b31c67edbff79405e9732bf14a7d4ef20b | []
| no_license | Justysxh/SLog | 7eeb9b369823287088441425ce1aecf37545f618 | 204a4c35a10714429d8928a1363454472f400aee | refs/heads/master | 2021-01-10T22:47:50.556112 | 2016-10-09T04:18:27 | 2016-10-09T04:18:27 | 70,375,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | package com.sxh.slog;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest
{
@Test
public void addition_isCorrect() throws Exception
{
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
c1f680c337a38c3a08b7d094b8285e65052553dc | 3c4b0accf46c1fd92ca1a76347571bbe9570b354 | /src/by/bsuir/webproj/containers/Chocolate.java | 83b0b383101d5e70318fc327f8bacfe235237966 | []
| no_license | piskun-aleksei/4_XML-XSD_Piskun_CandiesParseProj | 61a1fed0b24d4b3f7ba4a11a61dd865fd38ebefc | d7e68fe83882003ebfdd14039005d388489c80c6 | refs/heads/master | 2021-01-17T19:22:57.321721 | 2016-06-19T17:27:37 | 2016-06-19T17:27:37 | 61,491,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,150 | java | package by.bsuir.webproj.containers;
import javax.xml.bind.annotation.*;
/**
* Created by Алексей on 05.04.2016.
*/
public class Chocolate extends Candy{
private ChocolateIngredients ingredients;
public Chocolate(){
ingredients = new ChocolateIngredients();
}
public ChocolateIngredients getIngredients() {
return ingredients;
}
@Override
public String toString() {
return "Chocolate{\n name = " + getName() + "\n type = " + getType() + "\n energy = " + getEnergy() +
"\n value{\n proteins = " + getValue().getProteins() + "\n fats = " + getValue().getFats() +
"\n carbohydrates = "
+ getValue().getCarbohydrates() + "\n }\n production = " + getProduction() + "\n ingredients{\n water = " +
getIngredients().getWater() + "\n sugar = " + getIngredients().getSugar() + "\n cocoa = "
+ getIngredients().getCocoa() +
"\n }\n}";
}
public void setIngredients(ChocolateIngredients ingredients) {
this.ingredients = ingredients;
}
}
| [
"[email protected]"
]
| |
c0da1eaad13acff287586752c9ce57b54e34e5e3 | bb5c8f2c5bfd18c79309ca3c909bc91674ef66de | /daily/src/main/java/org/tomato/daily/io/aio/ClientWriteHandler.java | 52103fd1f3c3e31bc34f824c8158cb214135acef | []
| no_license | caoliang369/tomato | a1b9cb4142268d4a64a5c00e0c14ecf223f1c23f | 550493405a96652c39c6de1bf9d234cd89e0dc33 | refs/heads/master | 2021-01-22T04:24:05.515702 | 2017-02-16T08:22:17 | 2017-02-16T08:22:17 | 81,539,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,047 | java | package org.tomato.daily.io.aio;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.CompletionHandler;
import java.util.concurrent.CountDownLatch;
public class ClientWriteHandler implements CompletionHandler<Integer, ByteBuffer> {
private CountDownLatch latch;
private AsynchronousSocketChannel channel;
public ClientWriteHandler(AsynchronousSocketChannel channel, CountDownLatch latch){
this.latch =latch;
this.channel = channel;
}
public void completed(Integer result, ByteBuffer buffer) {
if(buffer.hasRemaining()){
channel.write(buffer, buffer, this);
}else{
ByteBuffer readBuffer = ByteBuffer.allocate(1024);
channel.read(readBuffer, readBuffer, new ClientReadHandler(channel, latch));
}
}
public void failed(Throwable exc, ByteBuffer buffer) {
System.err.println("数据发送失败...");
try {
channel.close();
latch.countDown();
} catch (IOException e) {
}
}
}
| [
"[email protected]"
]
| |
2fa0e85d9f6d4f4f66795e17477f6f93d701c78d | 197b159c853ff5bcffc4abd9cde771ca3f92cd7a | /src/main/java/com/lgrochal/socialapp/model/FollowEvent.java | 6a7dffacedd2744f8c518e7ffa6cafbe73c40b6b | []
| no_license | lgrochal/code-challenge | 2e36c9d76ec1b15890e2eec05a4a8db4a48a828e | 04b335ac01a2c950b4cd970ae4a5eff454d39839 | refs/heads/master | 2021-01-21T13:11:15.343567 | 2017-05-19T14:10:47 | 2017-05-19T14:10:47 | 91,808,639 | 0 | 0 | null | 2017-05-19T13:27:08 | 2017-05-19T13:27:08 | null | UTF-8 | Java | false | false | 1,132 | java | package com.lgrochal.socialapp.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import java.sql.Time;
import java.sql.Timestamp;
@Entity
public class FollowEvent {
@Id
@GeneratedValue
private Long id;
//TODO improve mapprings
@ManyToOne
private User follower;
@ManyToOne
private User following;
private Timestamp createdDate;
@PrePersist
public void setCreatedDate(){
this.createdDate = new Timestamp(new java.util.Date().getTime());
}
public FollowEvent(){}
public FollowEvent follower(User follower){
this.follower = follower;
return this;
}
public FollowEvent follow(User following){
this.following = following;
return this;
}
public User getFollower(){
return this.follower;
}
public User getFollowing(){
return this.following;
}
}
| [
"[email protected]"
]
| |
379d77fd8c38cf2eac5730e868d14e7cdb86a43d | be2ba637a6135abf28e693650d5399fb3fdaf780 | /app/src/main/java/com/example/c2n/signUp1/presenter/SignUp1Presenter.java | f0d48ef7f3e4c16f69f01ef9edc2e459615b5853 | []
| no_license | devrath123/C2NRetailer | fcca842c9f97b32bbf42ea33aa0ce8f4260ee6fc | 38fec2e3ede5bdb527c6b72bb5acc94a7a90e3c8 | refs/heads/master | 2022-02-26T02:16:06.675820 | 2019-10-06T10:16:08 | 2019-10-06T10:16:08 | 197,916,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,406 | java | package com.example.c2n.signUp1.presenter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Log;
import com.example.c2n.core.mapper.CustomerDataModelToBooleanViewModelMapper;
import com.example.c2n.core.mapper.RetailerDataModelToBooleanViewModelMapper;
import com.example.c2n.core.model.UserDataModelListToUsernameViewModelMapper;
import com.example.c2n.core.model1.CustomerDataModel;
import com.example.c2n.core.model1.RetailerDataModel;
import com.example.c2n.signUp1.domain.ValidateCustomerEmailUseCase;
import com.example.c2n.signUp1.domain.ValidateRetailerEmailUseCase;
import com.example.c2n.signUp1.util.SignUpValidator;
import java.util.List;
import javax.inject.Inject;
/**
* Created by roshan.nimje on 05-06-2018.
*/
public class SignUp1Presenter {
SignUpValidator signUpValidator;
RetailerDataModelToBooleanViewModelMapper retailerDataModelToBooleanViewModelMapper;
CustomerDataModelToBooleanViewModelMapper customerDataModelToBooleanViewModelMapper;
ValidateRetailerEmailUseCase validateRetailerEmailUseCase;
ValidateCustomerEmailUseCase validateCustomerEmailUseCase;
Context context;
SignUp1View signUp1View;
@Inject
public SignUp1Presenter(RetailerDataModelToBooleanViewModelMapper retailerDataModelToBooleanViewModelMapper, CustomerDataModelToBooleanViewModelMapper customerDataModelToBooleanViewModelMapper, ValidateRetailerEmailUseCase validateRetailerEmailUseCase, ValidateCustomerEmailUseCase validateCustomerEmailUseCase, UserDataModelListToUsernameViewModelMapper userDataModelListToUsernameViewModelMapper, SignUpValidator signUpValidator) {
this.retailerDataModelToBooleanViewModelMapper = retailerDataModelToBooleanViewModelMapper;
this.customerDataModelToBooleanViewModelMapper = customerDataModelToBooleanViewModelMapper;
this.validateRetailerEmailUseCase = validateRetailerEmailUseCase;
this.validateCustomerEmailUseCase = validateCustomerEmailUseCase;
this.signUpValidator = signUpValidator;
}
public void bind(SignUp1View signUp1View, Context context) {
this.signUp1View = signUp1View;
this.context = context;
}
public void validateEmail() {
if (signUpValidator.isValidEmail(signUp1View.getUserEmail()))
isUserEmailUnique();
else
signUp1View.showEmailError("Enter correct Email Id");
}
@SuppressLint("RxLeakedSubscription")
public void isUserEmailUnique() {
if (signUp1View.getUserType().equals("R")) {
validateRetailerEmailUseCase.execute(null, context)
.doOnSubscribe(disposable -> {
signUp1View.showEmailProgress(true);
})
.subscribe(this::handleRetailerResponse, throwable -> handleRetailerResponseError(throwable));
} else if (signUp1View.getUserType().equals("C")) {
validateCustomerEmailUseCase.execute(null, context)
.doOnSubscribe(disposable -> {
signUp1View.showEmailProgress(true);
})
.subscribe(this::handleCustomerResponse, throwable -> handleCustomerResponseError(throwable));
}
}
private void handleCustomerResponseError(Throwable throwable) {
signUp1View.showEmailProgress(false);
Log.d("SignUp1Presenter", "Error : " + throwable.getMessage());
}
private void handleCustomerResponse(List<CustomerDataModel> customerDataModels) {
signUp1View.showEmailProgress(false);
Log.d("SignUp1Presenter", "Success : " + customerDataModels.size());
signUp1View.isUserExist(customerDataModelToBooleanViewModelMapper.mapCustomerDataModelListToEmailBoolean(customerDataModels, signUp1View.getUserEmail()));
}
private void handleRetailerResponseError(Throwable throwable) {
signUp1View.showEmailProgress(false);
Log.d("SignUp1Presenter", "Error : " + throwable.getMessage());
}
private void handleRetailerResponse(List<RetailerDataModel> retailerDataModels) {
signUp1View.showEmailProgress(false);
Log.d("SignUp1Presenter", "Success : " + retailerDataModels.size());
signUp1View.isUserExist(retailerDataModelToBooleanViewModelMapper.mapRetailerDataModelListToEmailBoolean(retailerDataModels, signUp1View.getUserEmail()));
}
}
| [
"[email protected]"
]
| |
3c585eef5e7a9e9acd19b09b9dc96e4221bdb6d5 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/protocal/protobuf/bqs.java | 22133c57c737496d599e00cf83c320d0462ec972 | []
| no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 3,408 | java | package com.tencent.mm.protocal.protobuf;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.LinkedList;
public final class bqs
extends com.tencent.mm.bx.a
{
public bve ACr;
public LinkedList<FinderObject> ZIQ;
public bqs()
{
AppMethodBeat.i(257622);
this.ZIQ = new LinkedList();
AppMethodBeat.o(257622);
}
public final int op(int paramInt, Object... paramVarArgs)
{
AppMethodBeat.i(257628);
if (paramInt == 0)
{
paramVarArgs = (i.a.a.c.a)paramVarArgs[0];
if (this.ACr != null)
{
paramVarArgs.qD(1, this.ACr.computeSize());
this.ACr.writeFields(paramVarArgs);
}
paramVarArgs.e(2, 8, this.ZIQ);
AppMethodBeat.o(257628);
return 0;
}
if (paramInt == 1) {
if (this.ACr == null) {
break label406;
}
}
label406:
for (paramInt = i.a.a.a.qC(1, this.ACr.computeSize()) + 0;; paramInt = 0)
{
int i = i.a.a.a.c(2, 8, this.ZIQ);
AppMethodBeat.o(257628);
return paramInt + i;
if (paramInt == 2)
{
paramVarArgs = (byte[])paramVarArgs[0];
this.ZIQ.clear();
paramVarArgs = new i.a.a.a.a(paramVarArgs, unknownTagHandler);
for (paramInt = com.tencent.mm.bx.a.getNextFieldNumber(paramVarArgs); paramInt > 0; paramInt = com.tencent.mm.bx.a.getNextFieldNumber(paramVarArgs)) {
if (!super.populateBuilderWithField(paramVarArgs, this, paramInt)) {
paramVarArgs.kFT();
}
}
AppMethodBeat.o(257628);
return 0;
}
if (paramInt == 3)
{
Object localObject1 = (i.a.a.a.a)paramVarArgs[0];
bqs localbqs = (bqs)paramVarArgs[1];
paramInt = ((Integer)paramVarArgs[2]).intValue();
Object localObject2;
switch (paramInt)
{
default:
AppMethodBeat.o(257628);
return -1;
case 1:
paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject1 = (byte[])paramVarArgs.get(paramInt);
localObject2 = new bve();
if ((localObject1 != null) && (localObject1.length > 0)) {
((bve)localObject2).parseFrom((byte[])localObject1);
}
localbqs.ACr = ((bve)localObject2);
paramInt += 1;
}
AppMethodBeat.o(257628);
return 0;
}
paramVarArgs = ((i.a.a.a.a)localObject1).aMP(paramInt);
i = paramVarArgs.size();
paramInt = 0;
while (paramInt < i)
{
localObject1 = (byte[])paramVarArgs.get(paramInt);
localObject2 = new FinderObject();
if ((localObject1 != null) && (localObject1.length > 0)) {
((FinderObject)localObject2).parseFrom((byte[])localObject1);
}
localbqs.ZIQ.add(localObject2);
paramInt += 1;
}
AppMethodBeat.o(257628);
return 0;
}
AppMethodBeat.o(257628);
return -1;
}
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes2.jar
* Qualified Name: com.tencent.mm.protocal.protobuf.bqs
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
]
| |
8e496d55f143ddf554b0f4595dac03ce3e3efc8a | ef0c1514e9af6de3ba4a20e0d01de7cc3a915188 | /sdk/synapse/azure-resourcemanager-synapse/src/samples/java/com/azure/resourcemanager/synapse/generated/PrivateEndpointConnectionsListSamples.java | 02bbc1c2523037a53584ca015b3b93f478eb3aeb | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"CC0-1.0",
"BSD-3-Clause",
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-generic-cla"
]
| permissive | Azure/azure-sdk-for-java | 0902d584b42d3654b4ce65b1dad8409f18ddf4bc | 789bdc6c065dc44ce9b8b630e2f2e5896b2a7616 | refs/heads/main | 2023-09-04T09:36:35.821969 | 2023-09-02T01:53:56 | 2023-09-02T01:53:56 | 2,928,948 | 2,027 | 2,084 | MIT | 2023-09-14T21:37:15 | 2011-12-06T23:33:56 | Java | UTF-8 | Java | false | false | 925 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.synapse.generated;
/** Samples for PrivateEndpointConnections List. */
public final class PrivateEndpointConnectionsListSamples {
/*
* x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/stable/2021-06-01/examples/ListPrivateEndpointConnections.json
*/
/**
* Sample code: List private endpoint connections in workspace.
*
* @param manager Entry point to SynapseManager.
*/
public static void listPrivateEndpointConnectionsInWorkspace(
com.azure.resourcemanager.synapse.SynapseManager manager) {
manager
.privateEndpointConnections()
.list("ExampleResourceGroup", "ExampleWorkspace", com.azure.core.util.Context.NONE);
}
}
| [
"[email protected]"
]
| |
30630b4193ef5c346ddd56fb3003d7dbccea540a | 6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386 | /google/iam/admin/v1/google-cloud-iam-admin-v1-java/proto-google-cloud-iam-admin-v1-java/src/main/java/com/google/iam/admin/v1/CreateServiceAccountRequest.java | 5cdb5332bbfba08a5fcfecccf328ee87f2f6bd80 | [
"Apache-2.0"
]
| permissive | oltoco/googleapis-gen | bf40cfad61b4217aca07068bd4922a86e3bbd2d5 | 00ca50bdde80906d6f62314ef4f7630b8cdb6e15 | refs/heads/master | 2023-07-17T22:11:47.848185 | 2021-08-29T20:39:47 | 2021-08-29T20:39:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 36,792 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/iam/admin/v1/iam.proto
package com.google.iam.admin.v1;
/**
* <pre>
* The service account create request.
* </pre>
*
* Protobuf type {@code google.iam.admin.v1.CreateServiceAccountRequest}
*/
public final class CreateServiceAccountRequest extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:google.iam.admin.v1.CreateServiceAccountRequest)
CreateServiceAccountRequestOrBuilder {
private static final long serialVersionUID = 0L;
// Use CreateServiceAccountRequest.newBuilder() to construct.
private CreateServiceAccountRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private CreateServiceAccountRequest() {
name_ = "";
accountId_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new CreateServiceAccountRequest();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private CreateServiceAccountRequest(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
java.lang.String s = input.readStringRequireUtf8();
name_ = s;
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
accountId_ = s;
break;
}
case 26: {
com.google.iam.admin.v1.ServiceAccount.Builder subBuilder = null;
if (serviceAccount_ != null) {
subBuilder = serviceAccount_.toBuilder();
}
serviceAccount_ = input.readMessage(com.google.iam.admin.v1.ServiceAccount.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(serviceAccount_);
serviceAccount_ = subBuilder.buildPartial();
}
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.iam.admin.v1.IamProto.internal_static_google_iam_admin_v1_CreateServiceAccountRequest_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.iam.admin.v1.IamProto.internal_static_google_iam_admin_v1_CreateServiceAccountRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.iam.admin.v1.CreateServiceAccountRequest.class, com.google.iam.admin.v1.CreateServiceAccountRequest.Builder.class);
}
public static final int NAME_FIELD_NUMBER = 1;
private volatile java.lang.Object name_;
/**
* <pre>
* Required. The resource name of the project associated with the service
* accounts, such as `projects/my-project-123`.
* </pre>
*
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code>
* @return The name.
*/
@java.lang.Override
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
}
}
/**
* <pre>
* Required. The resource name of the project associated with the service
* accounts, such as `projects/my-project-123`.
* </pre>
*
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for name.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int ACCOUNT_ID_FIELD_NUMBER = 2;
private volatile java.lang.Object accountId_;
/**
* <pre>
* Required. The account id that is used to generate the service account
* email address and a stable unique id. It is unique within a project,
* must be 6-30 characters long, and match the regular expression
* `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
* </pre>
*
* <code>string account_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The accountId.
*/
@java.lang.Override
public java.lang.String getAccountId() {
java.lang.Object ref = accountId_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
accountId_ = s;
return s;
}
}
/**
* <pre>
* Required. The account id that is used to generate the service account
* email address and a stable unique id. It is unique within a project,
* must be 6-30 characters long, and match the regular expression
* `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
* </pre>
*
* <code>string account_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The bytes for accountId.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getAccountIdBytes() {
java.lang.Object ref = accountId_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
accountId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int SERVICE_ACCOUNT_FIELD_NUMBER = 3;
private com.google.iam.admin.v1.ServiceAccount serviceAccount_;
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
* @return Whether the serviceAccount field is set.
*/
@java.lang.Override
public boolean hasServiceAccount() {
return serviceAccount_ != null;
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
* @return The serviceAccount.
*/
@java.lang.Override
public com.google.iam.admin.v1.ServiceAccount getServiceAccount() {
return serviceAccount_ == null ? com.google.iam.admin.v1.ServiceAccount.getDefaultInstance() : serviceAccount_;
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
*/
@java.lang.Override
public com.google.iam.admin.v1.ServiceAccountOrBuilder getServiceAccountOrBuilder() {
return getServiceAccount();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!getNameBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
}
if (!getAccountIdBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, accountId_);
}
if (serviceAccount_ != null) {
output.writeMessage(3, getServiceAccount());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getNameBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
}
if (!getAccountIdBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, accountId_);
}
if (serviceAccount_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, getServiceAccount());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.iam.admin.v1.CreateServiceAccountRequest)) {
return super.equals(obj);
}
com.google.iam.admin.v1.CreateServiceAccountRequest other = (com.google.iam.admin.v1.CreateServiceAccountRequest) obj;
if (!getName()
.equals(other.getName())) return false;
if (!getAccountId()
.equals(other.getAccountId())) return false;
if (hasServiceAccount() != other.hasServiceAccount()) return false;
if (hasServiceAccount()) {
if (!getServiceAccount()
.equals(other.getServiceAccount())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
hash = (37 * hash) + ACCOUNT_ID_FIELD_NUMBER;
hash = (53 * hash) + getAccountId().hashCode();
if (hasServiceAccount()) {
hash = (37 * hash) + SERVICE_ACCOUNT_FIELD_NUMBER;
hash = (53 * hash) + getServiceAccount().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.iam.admin.v1.CreateServiceAccountRequest prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* The service account create request.
* </pre>
*
* Protobuf type {@code google.iam.admin.v1.CreateServiceAccountRequest}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:google.iam.admin.v1.CreateServiceAccountRequest)
com.google.iam.admin.v1.CreateServiceAccountRequestOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.iam.admin.v1.IamProto.internal_static_google_iam_admin_v1_CreateServiceAccountRequest_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.iam.admin.v1.IamProto.internal_static_google_iam_admin_v1_CreateServiceAccountRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.iam.admin.v1.CreateServiceAccountRequest.class, com.google.iam.admin.v1.CreateServiceAccountRequest.Builder.class);
}
// Construct using com.google.iam.admin.v1.CreateServiceAccountRequest.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
name_ = "";
accountId_ = "";
if (serviceAccountBuilder_ == null) {
serviceAccount_ = null;
} else {
serviceAccount_ = null;
serviceAccountBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.iam.admin.v1.IamProto.internal_static_google_iam_admin_v1_CreateServiceAccountRequest_descriptor;
}
@java.lang.Override
public com.google.iam.admin.v1.CreateServiceAccountRequest getDefaultInstanceForType() {
return com.google.iam.admin.v1.CreateServiceAccountRequest.getDefaultInstance();
}
@java.lang.Override
public com.google.iam.admin.v1.CreateServiceAccountRequest build() {
com.google.iam.admin.v1.CreateServiceAccountRequest result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.iam.admin.v1.CreateServiceAccountRequest buildPartial() {
com.google.iam.admin.v1.CreateServiceAccountRequest result = new com.google.iam.admin.v1.CreateServiceAccountRequest(this);
result.name_ = name_;
result.accountId_ = accountId_;
if (serviceAccountBuilder_ == null) {
result.serviceAccount_ = serviceAccount_;
} else {
result.serviceAccount_ = serviceAccountBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.iam.admin.v1.CreateServiceAccountRequest) {
return mergeFrom((com.google.iam.admin.v1.CreateServiceAccountRequest)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.iam.admin.v1.CreateServiceAccountRequest other) {
if (other == com.google.iam.admin.v1.CreateServiceAccountRequest.getDefaultInstance()) return this;
if (!other.getName().isEmpty()) {
name_ = other.name_;
onChanged();
}
if (!other.getAccountId().isEmpty()) {
accountId_ = other.accountId_;
onChanged();
}
if (other.hasServiceAccount()) {
mergeServiceAccount(other.getServiceAccount());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.iam.admin.v1.CreateServiceAccountRequest parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.iam.admin.v1.CreateServiceAccountRequest) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object name_ = "";
/**
* <pre>
* Required. The resource name of the project associated with the service
* accounts, such as `projects/my-project-123`.
* </pre>
*
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code>
* @return The name.
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* Required. The resource name of the project associated with the service
* accounts, such as `projects/my-project-123`.
* </pre>
*
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code>
* @return The bytes for name.
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* Required. The resource name of the project associated with the service
* accounts, such as `projects/my-project-123`.
* </pre>
*
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code>
* @param value The name to set.
* @return This builder for chaining.
*/
public Builder setName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
name_ = value;
onChanged();
return this;
}
/**
* <pre>
* Required. The resource name of the project associated with the service
* accounts, such as `projects/my-project-123`.
* </pre>
*
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code>
* @return This builder for chaining.
*/
public Builder clearName() {
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
* <pre>
* Required. The resource name of the project associated with the service
* accounts, such as `projects/my-project-123`.
* </pre>
*
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }</code>
* @param value The bytes for name to set.
* @return This builder for chaining.
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
name_ = value;
onChanged();
return this;
}
private java.lang.Object accountId_ = "";
/**
* <pre>
* Required. The account id that is used to generate the service account
* email address and a stable unique id. It is unique within a project,
* must be 6-30 characters long, and match the regular expression
* `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
* </pre>
*
* <code>string account_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The accountId.
*/
public java.lang.String getAccountId() {
java.lang.Object ref = accountId_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
accountId_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* Required. The account id that is used to generate the service account
* email address and a stable unique id. It is unique within a project,
* must be 6-30 characters long, and match the regular expression
* `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
* </pre>
*
* <code>string account_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The bytes for accountId.
*/
public com.google.protobuf.ByteString
getAccountIdBytes() {
java.lang.Object ref = accountId_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
accountId_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* Required. The account id that is used to generate the service account
* email address and a stable unique id. It is unique within a project,
* must be 6-30 characters long, and match the regular expression
* `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
* </pre>
*
* <code>string account_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
* @param value The accountId to set.
* @return This builder for chaining.
*/
public Builder setAccountId(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
accountId_ = value;
onChanged();
return this;
}
/**
* <pre>
* Required. The account id that is used to generate the service account
* email address and a stable unique id. It is unique within a project,
* must be 6-30 characters long, and match the regular expression
* `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
* </pre>
*
* <code>string account_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
* @return This builder for chaining.
*/
public Builder clearAccountId() {
accountId_ = getDefaultInstance().getAccountId();
onChanged();
return this;
}
/**
* <pre>
* Required. The account id that is used to generate the service account
* email address and a stable unique id. It is unique within a project,
* must be 6-30 characters long, and match the regular expression
* `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
* </pre>
*
* <code>string account_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
* @param value The bytes for accountId to set.
* @return This builder for chaining.
*/
public Builder setAccountIdBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
accountId_ = value;
onChanged();
return this;
}
private com.google.iam.admin.v1.ServiceAccount serviceAccount_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.iam.admin.v1.ServiceAccount, com.google.iam.admin.v1.ServiceAccount.Builder, com.google.iam.admin.v1.ServiceAccountOrBuilder> serviceAccountBuilder_;
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
* @return Whether the serviceAccount field is set.
*/
public boolean hasServiceAccount() {
return serviceAccountBuilder_ != null || serviceAccount_ != null;
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
* @return The serviceAccount.
*/
public com.google.iam.admin.v1.ServiceAccount getServiceAccount() {
if (serviceAccountBuilder_ == null) {
return serviceAccount_ == null ? com.google.iam.admin.v1.ServiceAccount.getDefaultInstance() : serviceAccount_;
} else {
return serviceAccountBuilder_.getMessage();
}
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
*/
public Builder setServiceAccount(com.google.iam.admin.v1.ServiceAccount value) {
if (serviceAccountBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
serviceAccount_ = value;
onChanged();
} else {
serviceAccountBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
*/
public Builder setServiceAccount(
com.google.iam.admin.v1.ServiceAccount.Builder builderForValue) {
if (serviceAccountBuilder_ == null) {
serviceAccount_ = builderForValue.build();
onChanged();
} else {
serviceAccountBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
*/
public Builder mergeServiceAccount(com.google.iam.admin.v1.ServiceAccount value) {
if (serviceAccountBuilder_ == null) {
if (serviceAccount_ != null) {
serviceAccount_ =
com.google.iam.admin.v1.ServiceAccount.newBuilder(serviceAccount_).mergeFrom(value).buildPartial();
} else {
serviceAccount_ = value;
}
onChanged();
} else {
serviceAccountBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
*/
public Builder clearServiceAccount() {
if (serviceAccountBuilder_ == null) {
serviceAccount_ = null;
onChanged();
} else {
serviceAccount_ = null;
serviceAccountBuilder_ = null;
}
return this;
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
*/
public com.google.iam.admin.v1.ServiceAccount.Builder getServiceAccountBuilder() {
onChanged();
return getServiceAccountFieldBuilder().getBuilder();
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
*/
public com.google.iam.admin.v1.ServiceAccountOrBuilder getServiceAccountOrBuilder() {
if (serviceAccountBuilder_ != null) {
return serviceAccountBuilder_.getMessageOrBuilder();
} else {
return serviceAccount_ == null ?
com.google.iam.admin.v1.ServiceAccount.getDefaultInstance() : serviceAccount_;
}
}
/**
* <pre>
* The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
* create. Currently, only the following values are user assignable:
* `display_name` and `description`.
* </pre>
*
* <code>.google.iam.admin.v1.ServiceAccount service_account = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.iam.admin.v1.ServiceAccount, com.google.iam.admin.v1.ServiceAccount.Builder, com.google.iam.admin.v1.ServiceAccountOrBuilder>
getServiceAccountFieldBuilder() {
if (serviceAccountBuilder_ == null) {
serviceAccountBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.iam.admin.v1.ServiceAccount, com.google.iam.admin.v1.ServiceAccount.Builder, com.google.iam.admin.v1.ServiceAccountOrBuilder>(
getServiceAccount(),
getParentForChildren(),
isClean());
serviceAccount_ = null;
}
return serviceAccountBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.iam.admin.v1.CreateServiceAccountRequest)
}
// @@protoc_insertion_point(class_scope:google.iam.admin.v1.CreateServiceAccountRequest)
private static final com.google.iam.admin.v1.CreateServiceAccountRequest DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.iam.admin.v1.CreateServiceAccountRequest();
}
public static com.google.iam.admin.v1.CreateServiceAccountRequest getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<CreateServiceAccountRequest>
PARSER = new com.google.protobuf.AbstractParser<CreateServiceAccountRequest>() {
@java.lang.Override
public CreateServiceAccountRequest parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new CreateServiceAccountRequest(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<CreateServiceAccountRequest> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<CreateServiceAccountRequest> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.iam.admin.v1.CreateServiceAccountRequest getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
]
| bazel-bot-development[bot]@users.noreply.github.com |
81cb2ca854ba7991b59b8a0744f49d4a1dc9b158 | 2b5da176ade6ec54d34ddd79fede48eaf385740d | /spring-jdbc/src/main/java/com/pkma/spring/main/PlayerMainApplication.java | ac900e0807edc64ef9414a5260dc766a2d2fb8fe | []
| no_license | akulakarni/training | 708347510051bb5cb09c92b922b9f6e5c97b6fcc | 1d3c2bdb13a9c0c9fd28010fd16f6878a73d5f62 | refs/heads/master | 2020-03-11T07:42:09.787470 | 2018-04-17T07:40:12 | 2018-04-17T07:40:12 | 129,864,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,571 | java | /**
*
*/
package com.pkma.spring.main;
import java.sql.SQLException;
import java.util.List;
import org.h2.tools.Server;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.pkma.spring.dao.PlayerDAOUsingJDBCTemplate;
import com.pkma.spring.dao.SequenceDao;
import com.pkma.spring.model.Player;
public class PlayerMainApplication {
public static void main(final String[] args) throws SQLException {
final AbstractApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
// start the TCP Server
final Server server = Server.createTcpServer(args).start();
final SequenceDao sequenceDao = (SequenceDao) context.getBean("sequenceDao");
final PlayerDAOUsingJDBCTemplate playerDAOUsingJDBCTemplate = (PlayerDAOUsingJDBCTemplate) context
.getBean("playerDAOUsingJDBCTemplate");
// This will get all palyers from DB..using row mapper
final List<Player> players = playerDAOUsingJDBCTemplate.getPlayerUsingBeanPropertyRowMapper();
for (final Player player : players) {
System.out.println(player);
}
/*
* // This will fetch player with the given id final Player player = playerDAOUsingJDBCTemplate.getPlayer(10);
* System.out.println(player);
*
* // This will create player with the given user input final int playerId =
* sequenceDao.getPlayerId("player_Q1"); final Player createPlayer = new Player(playerId, "Mesut Ozil", 26,
* "Arsenal", "Atacking Midfielder", "Germany", 8, 1, 1);
*
* playerDAOUsingJDBCTemplate.createPlayer(createPlayer);
*
* // This will get all palyers from DB final List<Player> newlyCreatedPlayers =
* playerDAOUsingJDBCTemplate.getAllPlayers(); System.out.println(newlyCreatedPlayers);
*
* // This will create player with the given user input final Player updatePlayer = new Player(playerId,
* "Mesut Ozil", 27, "FC Schalke", "Atacking Midfielder", "Germany", 8, 1, 1);
*
* playerDAOUsingJDBCTemplate.updatePlayer(updatePlayer);
*
* // This will get all palyers from DB final List<Player> newlyUpdatedPlayers =
* playerDAOUsingJDBCTemplate.getAllPlayers(); System.out.println(newlyUpdatedPlayers);
*/
// stop the TCP Server
server.stop();
}
}
| [
"[email protected]"
]
| |
91d477eda0eadd619a00316a477052ac10b9dbdb | c096300c1877bc7ccc1896493cc65be63094dcff | /src/main/java/com/chy/easyExcel2/ExcelListener2.java | 25bc78144881b40e2d8eb11c832921182c863bff | []
| no_license | huaiyanchen/testExcel | 4a720f93fd67d3aca70e04e054d17494ed8ec42c | 1c8fdca5f40de3175fa3311b49cfd856b2e839aa | refs/heads/master | 2023-02-11T17:35:54.415197 | 2021-01-12T08:49:55 | 2021-01-12T08:49:55 | 328,848,111 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | package com.chy.easyExcel2;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
public class ExcelListener2 extends AnalysisEventListener<Object> {
private static final Logger LOGGER = LoggerFactory.getLogger(ExcelListener2.class);
//一行一行读取excel内容
//读取表头内容
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
System.out.println("表头:" + headMap);
}
@Override
public void invoke(Object data, AnalysisContext context) {
LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data));
System.out.println(data);
//TODO
}
//读取完成之后
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
}
}
| [
"[email protected]"
]
| |
17c12aa19686245b922919c68187e1aeec893288 | a4053c1e3fe0939ac6adaf74117c73d1ac607eef | /src/main/java/NoRepeatSubstringOptimum.java | 25d70c355311ba880de94b69a40499c2afe5f0e4 | []
| no_license | pragyanta-dhal/educative-playground | 6db4a623195b6cba45f881149d89ca1d6cda06d0 | 914e1aa5cd5a6e2fac53dbb97f32c844f64660b3 | refs/heads/main | 2023-04-11T18:29:29.002659 | 2021-05-03T19:37:24 | 2021-05-03T19:37:24 | 364,039,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,691 | java | import java.util.*;
public class NoRepeatSubstringOptimum {
public static int findLength(String str) {
int windowStart = 0, maxLength = 0;
Map<Character, Integer> charIndexMap = new HashMap<>();
// try to extend the range [windowStart, windowEnd]
for (int windowEnd = 0; windowEnd < str.length(); windowEnd++) {
char rightChar = str.charAt(windowEnd);
// if the map already contains the 'rightChar', shrink the window from the beginning so that
// we have only one occurrence of 'rightChar'
if (charIndexMap.containsKey(rightChar)) {
// this is tricky; in the current window, we will not have any 'rightChar' after its previous index
// and if 'windowStart' is already ahead of the last index of 'rightChar', we'll keep 'windowStart'
windowStart = Math.max(windowStart, charIndexMap.get(rightChar) + 1);
//windowStart = charIndexMap.get(rightChar)+1;
}
// charIndexMap.clear();
charIndexMap.put(rightChar, windowEnd); // insert the 'rightChar' into the map
maxLength = Math.max(maxLength, windowEnd - windowStart + 1); // remember the maximum length so far
}
return maxLength;
}
public static void main(String[] args) {
System.out.println("Length of the longest substring: " + NoRepeatSubstringOptimum.findLength("abccae"));
System.out.println("Length of the longest substring: " + NoRepeatSubstringOptimum.findLength("aabccbb"));
System.out.println("Length of the longest substring: " + NoRepeatSubstringOptimum.findLength("abbbb"));
}
}
| [
"[email protected]"
]
| |
6eafea338c7fd2610da95690ffa997c1b26277b9 | 3057dc3e793e4413b43b298d444374c03f888910 | /src/main/java/ch/certe/optimization/maintenancesolver/common/app/CommonApp.java | 1fdc069be1502972ee1f6182bb3d5c5e9b1809e2 | []
| no_license | nalet/bfh-bachelor-thesis | f02ff2c79d2de4c58bff51248624eabe95511570 | 414d1854586f275197ba8a210f5da1ed509b02bd | refs/heads/master | 2021-05-11T05:37:04.517731 | 2018-02-23T08:04:10 | 2018-02-23T08:04:10 | 117,963,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,489 | java | /*
* Copyright 2010 Red Hat, Inc. and/or its affiliates.
*
* 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 ch.certe.optimization.maintenancesolver.common.app;
import java.awt.Component;
import javax.swing.WindowConstants;
import org.optaplanner.core.api.domain.solution.PlanningSolution;
import org.optaplanner.core.api.solver.Solver;
import org.optaplanner.core.api.solver.SolverFactory;
import ch.certe.optimization.maintenancesolver.common.business.SolutionBusiness;
import ch.certe.optimization.maintenancesolver.common.persistence.AbstractSolutionExporter;
import ch.certe.optimization.maintenancesolver.common.persistence.AbstractSolutionImporter;
import ch.certe.optimization.maintenancesolver.common.persistence.SolutionDao;
import ch.certe.optimization.maintenancesolver.common.swingui.SolutionPanel;
import ch.certe.optimization.maintenancesolver.common.swingui.SolverAndPersistenceFrame;
import org.optaplanner.swing.impl.SwingUncaughtExceptionHandler;
import org.optaplanner.swing.impl.SwingUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @param <Solution_> the solution type, the class with the {@link PlanningSolution} annotation
*/
public abstract class CommonApp<Solution_> extends LoggingMain {
protected static final Logger logger = LoggerFactory.getLogger(CommonApp.class);
/**
* Some examples are not compatible with every native LookAndFeel.
* For example, NurseRosteringPanel is incompatible with Mac.
*/
public static void prepareSwingEnvironment() {
SwingUncaughtExceptionHandler.register();
SwingUtils.fixateLookAndFeel();
}
protected final String name;
protected final String description;
protected final String solverConfig;
protected final String iconResource;
protected SolverAndPersistenceFrame<Solution_> solverAndPersistenceFrame;
protected SolutionBusiness<Solution_> solutionBusiness;
protected CommonApp(String name, String description, String solverConfig, String iconResource) {
this.name = name;
this.description = description;
this.solverConfig = solverConfig;
this.iconResource = iconResource;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getIconResource() {
return iconResource;
}
public void init() {
init(null, true);
}
public void init(Component centerForComponent, boolean exitOnClose) {
solutionBusiness = createSolutionBusiness();
solverAndPersistenceFrame = new SolverAndPersistenceFrame<>(solutionBusiness, createSolutionPanel());
solverAndPersistenceFrame.setDefaultCloseOperation(exitOnClose ? WindowConstants.EXIT_ON_CLOSE : WindowConstants.DISPOSE_ON_CLOSE);
solverAndPersistenceFrame.init(centerForComponent);
solverAndPersistenceFrame.setVisible(true);
}
public SolutionBusiness<Solution_> createSolutionBusiness() {
SolutionBusiness<Solution_> solutionBusiness = new SolutionBusiness<>(this);
solutionBusiness.setSolutionDao(createSolutionDao());
solutionBusiness.setImporters(createSolutionImporters());
solutionBusiness.setExporter(createSolutionExporter());
solutionBusiness.updateDataDirs();
solutionBusiness.setSolver(createSolver());
return solutionBusiness;
}
protected Solver<Solution_> createSolver() {
SolverFactory<Solution_> solverFactory = SolverFactory.createFromXmlResource(solverConfig);
return solverFactory.buildSolver();
}
protected abstract SolutionPanel<Solution_> createSolutionPanel();
protected abstract SolutionDao createSolutionDao();
protected AbstractSolutionImporter[] createSolutionImporters() {
return new AbstractSolutionImporter[]{};
}
protected AbstractSolutionExporter createSolutionExporter() {
return null;
}
}
| [
"[email protected]"
]
| |
ae607ce4052bbcf35458255fe1a6d3a817cb1638 | 10a933371eab88dfe8fa86cc492165167475fb8f | /spMVC_progamer/src/main/java/com/biz/progamer/controller/BoardController.java | 9dfcec3ab5eff369207dd40ce3340e0188963cad | []
| no_license | dbtls1000/Team-Project | 7dbba0c1585309e472d5ebf39f84d240f77a8ae9 | 1170bc7b5a016f164f4f125a72e1b4221a0250d1 | refs/heads/master | 2022-12-27T07:28:13.797106 | 2019-08-22T06:49:36 | 2019-08-22T06:49:36 | 196,510,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,994 | java | package com.biz.progamer.controller;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.biz.progamer.model.BoardVO;
import com.biz.progamer.service.BoardService;
@Controller
@RequestMapping(value="/board")
public class BoardController {
@Autowired
BoardService bService;
@RequestMapping(value="/list",method=RequestMethod.GET)
public String list(Model model) {
List<BoardVO> bList = bService.selectAll();
model.addAttribute("BLIST",bList);
model.addAttribute("BODY","BOARD_LIST");
return "home";
}
@RequestMapping(value="/write",method=RequestMethod.GET)
public String write(@ModelAttribute("boardVO") BoardVO boardVO, Model model) {
LocalDateTime ldt = LocalDateTime.now();
String curDate = ldt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")).toString();
String curTime = ldt.format(DateTimeFormatter.ofPattern("HH-mm-ss")).toString();
boardVO.setB_date(curDate);
boardVO.setB_time(curTime);
model.addAttribute("boardVO",boardVO);
model.addAttribute("BODY","BOARD_WRITE");
return "home";
}
@RequestMapping(value="/write",method=RequestMethod.POST)
public String writeiup(@ModelAttribute BoardVO boardVO, Model model) {
int ret = bService.insert(boardVO);
return "redirect:/board/list";
}
@RequestMapping(value="/view",method=RequestMethod.GET)
public String view(@RequestParam long b_seq,Model model) {
BoardVO boardVO = bService.findBySeq(b_seq);
model.addAttribute("BVIEW",boardVO);
model.addAttribute("BODY","BOARD_VIEW");
return "home";
}
}
| [
"[email protected]"
]
| |
d245fd049e92b35835e3bfa2b79154692360299f | e5426b0fe9314a191c47d7856d3e3b461acb9cee | /src/main/java/by/nintendo/datajpa/exception/NoSuchUserException.java | 2f2fc11e7deecb7a8ed5b690b6d890683bfe4d95 | []
| no_license | NastaUrsha/data-jpa-master | 4719f44accac02c2453b6b7559638f87d015576e | 1afb6afd9c11436dd92c081f73118b734d2d1137 | refs/heads/master | 2023-05-12T23:09:10.500485 | 2021-06-02T14:42:00 | 2021-06-02T14:42:00 | 373,188,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | package by.nintendo.datajpa.exception;
public class NoSuchUserException extends RuntimeException{
public NoSuchUserException(String message) {
super(message);
}
public NoSuchUserException(String message, Throwable cause) {
super(message, cause);
}
public NoSuchUserException(Throwable cause) {
super(cause);
}
protected NoSuchUserException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"[email protected]"
]
| |
4b5e9c19d10395fccab28c1180df7ee3b83dc277 | f7cdd0886badb169d4f39db11885e51bc3234db6 | /src/com/houarizegai/gestioncommercial/java/database/models/Client.java | 292e9d6aa83b52b433ed053c36d7bde75cddf0b7 | [
"MIT"
]
| permissive | Bhoye05/GestionCommercial | b0801d8c76be9116d4539400ef839e5f0278b245 | 77a61ff68e4e4f5254f9753e791c47fe494c2d34 | refs/heads/master | 2020-05-01T02:39:15.746837 | 2018-12-16T11:17:05 | 2018-12-16T11:17:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,342 | java | package com.houarizegai.gestioncommercial.java.database.models;
import java.util.Date;
public class Client {
private int numClient;
private String societe;
private String civilite;
private String nomClient;
private String prenom;
private String adresse;
private String codePostal;
private String ville;
private String pays;
private String telephone;
private String mobile;
private String fax;
private String email;
private int type;
private boolean livreMemeAdresse;
private boolean factureMemeAdresse;
private boolean exemptTva;
private String saisiPar;
private Date saisiLe;
private String auteurModif;
private Date dateModif;
private String observations;
public Client() {
}
public Client(int numClient, String societe, String civilite, String nomClient, String prenom, String adresse, String codePostal, String ville, String pays, String telephone, String mobile, String fax, String email, int type, boolean livreMemeAdresse, boolean factureMemeAdresse, boolean exemptTva, String saisiPar, Date saisiLe, String auteurModif, Date dateModif, String observations) {
this.numClient = numClient;
this.societe = societe;
this.civilite = civilite;
this.nomClient = nomClient;
this.prenom = prenom;
this.adresse = adresse;
this.codePostal = codePostal;
this.ville = ville;
this.pays = pays;
this.telephone = telephone;
this.mobile = mobile;
this.fax = fax;
this.email = email;
this.type = type;
this.livreMemeAdresse = livreMemeAdresse;
this.factureMemeAdresse = factureMemeAdresse;
this.exemptTva = exemptTva;
this.saisiPar = saisiPar;
this.saisiLe = saisiLe;
this.auteurModif = auteurModif;
this.dateModif = dateModif;
this.observations = observations;
}
public int getNumClient() {
return numClient;
}
public void setNumClient(int numClient) {
this.numClient = numClient;
}
public String getSociete() {
return societe;
}
public void setSociete(String societe) {
this.societe = societe;
}
public String getCivilite() {
return civilite;
}
public void setCivilite(String civilite) {
this.civilite = civilite;
}
public String getNomClient() {
return nomClient;
}
public void setNomClient(String nomClient) {
this.nomClient = nomClient;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public String getAdresse() {
return adresse;
}
public void setAdresse(String adresse) {
this.adresse = adresse;
}
public String getCodePostal() {
return codePostal;
}
public void setCodePostal(String codePostal) {
this.codePostal = codePostal;
}
public String getVille() {
return ville;
}
public void setVille(String ville) {
this.ville = ville;
}
public String getPays() {
return pays;
}
public void setPays(String pays) {
pays = pays;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getFax() {
return fax;
}
public void setFax(String fax) {
this.fax = fax;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public boolean isLivreMemeAdresse() {
return livreMemeAdresse;
}
public void setLivreMemeAdresse(boolean livreMemeAdresse) {
this.livreMemeAdresse = livreMemeAdresse;
}
public boolean isFactureMemeAdresse() {
return factureMemeAdresse;
}
public void setFactureMemeAdresse(boolean factureMemeAdresse) {
this.factureMemeAdresse = factureMemeAdresse;
}
public boolean isExemptTva() {
return exemptTva;
}
public void setExemptTva(boolean exemptTva) {
this.exemptTva = exemptTva;
}
public String getSaisiPar() {
return saisiPar;
}
public void setSaisiPar(String saisiPar) {
this.saisiPar = saisiPar;
}
public Date getSaisiLe() {
return saisiLe;
}
public void setSaisiLe(Date saisiLe) {
this.saisiLe = saisiLe;
}
public String getAuteurModif() {
return auteurModif;
}
public void setAuteurModif(String auteurModif) {
this.auteurModif = auteurModif;
}
public Date getDateModif() {
return dateModif;
}
public void setDateModif(Date dateModif) {
this.dateModif = dateModif;
}
public String getObservations() {
return observations;
}
public void setObservations(String observations) {
this.observations = observations;
}
}
| [
"[email protected]"
]
| |
c03ef6d6b9d1b9e308396969ab7c0f6be411ecc7 | bb0e47467744cedef8fbe61a8e191e7162f5a102 | /src/main/java/ee/iapb61/idu0200/dao/DaoConstants.java | af56a9cf6b1a8ed6a9ff3e3f69fe24ff3c9310cc | []
| no_license | janisar/remonditeenus | a34f90c7163c9e102259d674283d7f1b28acf5a5 | e7693f7fdb30ff1b1220d82aeffa3a9821e571ff | refs/heads/master | 2020-06-09T00:14:53.785086 | 2015-06-10T13:59:34 | 2015-06-10T13:59:34 | 37,200,229 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java | package ee.iapb61.idu0200.dao;
public interface DaoConstants {
public final String JDBC_DRIVER = "org.postgresql.Driver";
}
| [
"[email protected]"
]
| |
23cc544a6a1ff78483694b75babb24cf8755686e | ae0b55f2ec0f01d66f936e413e720d118c85962a | /src/main/java/br/com/docproc/exception/RegistroJaCadastradoException.java | c4b72b28e8839b3a20a631cbdfae94450e94eb5b | []
| no_license | felipe-sbatista/docProc | f10ec358400a02effbbe3aa9bb623c91627769dd | 18a75b33df2728951defd5533e4c5b778e51f217 | refs/heads/master | 2020-04-02T08:10:55.324391 | 2018-10-28T20:18:49 | 2018-10-28T20:18:49 | 154,232,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package br.com.docproc.exception;
public class RegistroJaCadastradoException extends Exception {
public RegistroJaCadastradoException(String s) {
super(s);
}
}
| [
"[email protected]"
]
| |
4e790c890865cb413e10029ff904ea0a035631b3 | 2b7c0e00bdfc0c8a516323c89d7bc482153bd5dc | /.original/maqetta-Release10.0.2/maqetta.core.server/src/org/maqetta/server/Validator.java | 9677d5e35daa138fc76a13eed1467b55a4cf62ab | [
"BSD-3-Clause",
"AFL-2.1",
"MIT"
]
| permissive | skylark-integration/skylark-maqetta | 771e00504a3740a56c761e92444fde3ba441ab31 | 2a1799f3910717ab000af6dc6813fd1dc40e8276 | refs/heads/master | 2021-05-17T07:09:49.770010 | 2020-03-28T13:47:33 | 2020-03-28T13:47:33 | 250,688,718 | 0 | 0 | MIT | 2020-03-28T03:31:49 | 2020-03-28T01:29:17 | JavaScript | UTF-8 | Java | false | false | 760 | java | package org.maqetta.server;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.AddressException;
import java.util.regex.Pattern;
import org.davinci.server.review.Version;
public class Validator {
// pattern matches that used in "Register for Maqetta" dialog
private static Pattern userNamePattern = Pattern.compile("^\\w(\\w|[.@]){4,20}$");
public static boolean isEmail(String email) {
try {
new InternetAddress(email).validate();
} catch(AddressException ex) {
return false;
}
return true;
}
public static boolean isValidISOTimeStamp(String timeStamp) {
return Version.isValidISOTimeStamp(timeStamp);
}
public static boolean isUserName(String name) {
return userNamePattern.matcher(name).matches();
}
}
| [
"[email protected]"
]
| |
efa473e6f5abda1e01a767f7b7b17bc3603695b9 | 8891434a3719f0e3d0bf9271c6acae0083f28e97 | /gmall-api/src/main/java/com/atguigu/gmall/constant/OrderStatusEnume.java | 4997a0db7ad93dffd8aaafa0bab78cceb711c286 | []
| no_license | dyp075388/gmall-parent | 07fc73ccace1f1bc5f1b8054882f41c213def3f6 | be02ab8823382f2aaf7e86e0fdc5c9080eac4490 | refs/heads/master | 2022-04-25T02:25:44.284526 | 2020-04-26T10:35:29 | 2020-04-26T10:35:29 | 263,834,539 | 1 | 1 | null | 2020-05-14T06:31:56 | 2020-05-14T06:31:55 | null | UTF-8 | Java | false | false | 633 | java | package com.atguigu.gmall.constant;
public enum OrderStatusEnume {
/**
* 订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单
*/
UNPAY(0,"待付款"),PAYED(1,"已支付,待发货"),SENDED(2,"已发货")
,CLOSED(4,"已关闭"),FINISHED(3,"已完成"),UNVAILED(5,"无效订单");
private Integer code;
private String msg;
OrderStatusEnume(Integer code,String msg){
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
| [
"[email protected]"
]
| |
36f10c707d9799bb895780c51749b2bd66a10dc1 | 19e2498369aaca74907b1b5dfc53507fb50bc072 | /eSportsApp/src/main/java/com/example/eSportsApp/apis/PlayerService.java | 7cb894d1b1ecf9c7f8c69768ba7c35b7fa6d1e56 | []
| no_license | MonicaAbreu/May2019Program | 2117bb024e5c91377b9a7190588861fce5d719c8 | fab864a39718b06becb25b6d2475cd497cbe181f | refs/heads/master | 2020-06-18T18:03:43.880574 | 2019-07-26T13:22:18 | 2019-07-26T13:22:18 | 196,393,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,733 | java | package com.example.eSportsApp.apis;
import javax.transaction.Transactional;
import javax.ws.rs.BeanParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import com.example.eSportsApp.entities.Player;
import com.example.eSportsApp.entities.Team;
import com.example.eSportsApp.repositories.PlayerRepository;
@Component
@Scope("singleton")
@Path("/players/")
public class PlayerService {
@Autowired
private PlayerRepository playerRepository;
@Autowired
private TeamService teamService;
public PlayerService() {
System.out.println("Player Service created");
}
@POST //HTTP method to send the form data
@Path("/register") //URL pattern
@Consumes(MediaType.APPLICATION_FORM_URLENCODED) //form data
@Produces(MediaType.APPLICATION_JSON) //JSON data
public Player registerOrUpdatePlayer(@BeanParam Player player) {
System.out.println(player);
player = playerRepository.save(player);
System.out.println("Player registered " + player);
return player;
}
@Path("/find/{playerId}")
@GET //HTTP method used to call the API
@Produces(MediaType.APPLICATION_JSON)
public Player findByPlayerId(@PathParam("playerId") int playerId) {
try {
return playerRepository.findById(playerId).get();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@DELETE //delete HTTP Method
@Path("/delete/{playerId}")
public void deleteByPlayerId(@PathParam("playerId") int playerId) {
playerRepository.deleteById(playerId);
}
//spring ensures that db session is open until all the operations in this method across repositories are completed
//used to fetch all collections which are initialised using Lazy initialisation
@Transactional
@POST //HTTP method
@Path("/assign/team") //URL
@Consumes(MediaType.APPLICATION_FORM_URLENCODED) //input format
@Produces(MediaType.APPLICATION_JSON) //output format
public Player assignTeam(@FormParam("playerId") int playerId,
@FormParam("teamId") int teamId) {
try {
Player player = findByPlayerId(playerId);
Team team = teamService.findByTeamId(teamId);
team.getMembers().add(player);
player.setCurrentTeam(team);
player = registerOrUpdatePlayer(player);
return player;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
| [
"[email protected]"
]
| |
f637c0149d96d8519ba8d6c2c000e361d858645e | 535e4c3575d742eb5d1f015ceaee23a4b9519934 | /src/minecraft/net/minecraft/src/BlockSand.java | 71edc467a7be4e4bbf8ae34183afcee7e3772e0b | []
| no_license | OldSchoolMinecraft/Client | 755084ee085f8c01533c405f1afdaeb72308d1e9 | 7677dffda63539ab0c4f278359909d70d3c667b2 | refs/heads/master | 2022-08-26T20:05:26.206172 | 2020-02-26T22:32:01 | 2020-02-26T22:32:01 | 235,854,371 | 0 | 3 | null | 2020-02-04T03:19:11 | 2020-01-23T18:02:20 | Java | UTF-8 | Java | false | false | 2,477 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
// Source File Name: SourceFile
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// Block, Material, World, EntityFallingSand,
// BlockFire
public class BlockSand extends Block
{
public BlockSand(int i, int j)
{
super(i, j, Material.sand);
}
public void onBlockAdded(World world, int i, int j, int k)
{
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
}
public void updateTick(World world, int i, int j, int k, Random random)
{
tryToFall(world, i, j, k);
}
private void tryToFall(World world, int i, int j, int k)
{
int l = i;
int i1 = j;
int j1 = k;
if(canFallBelow(world, l, i1 - 1, j1) && i1 >= 0)
{
byte byte0 = 32;
if(fallInstantly || !world.checkChunksExist(i - byte0, j - byte0, k - byte0, i + byte0, j + byte0, k + byte0))
{
world.setBlockWithNotify(i, j, k, 0);
for(; canFallBelow(world, i, j - 1, k) && j > 0; j--) { }
if(j > 0)
{
world.setBlockWithNotify(i, j, k, blockID);
}
} else
{
EntityFallingSand entityfallingsand = new EntityFallingSand(world, (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, blockID);
world.entityJoinedWorld(entityfallingsand);
}
}
}
public int tickRate()
{
return 3;
}
public static boolean canFallBelow(World world, int i, int j, int k)
{
int l = world.getBlockId(i, j, k);
if(l == 0)
{
return true;
}
if(l == Block.fire.blockID)
{
return true;
}
Material material = Block.blocksList[l].blockMaterial;
if(material == Material.water)
{
return true;
}
return material == Material.lava;
}
public static boolean fallInstantly = false;
}
| [
"[email protected]"
]
| |
a8f76eb37afacdc023627df81a5a98ceaeaeddb9 | f75ef4a2a9392054b3cce8dbdb0801010c73beb8 | /Labs/Objective9Lab3.java | bd39e03170e37cddda7ac6a319f179007ea6f677 | []
| no_license | Panthro22/SDPre | f97e9cfe9d790330eac1d24ecf59e74a9d8c69ad | 9e659167f1685c5d98c0b2624fb09b3769f3fa9f | refs/heads/main | 2023-07-26T10:56:06.844839 | 2021-09-11T18:49:27 | 2021-09-11T18:49:27 | 404,956,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 791 | java | import java.util.Scanner;
public class Objective9Lab3 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int selection;
while(true){
printMenu();
selection = scanner.nextInt();
if(selection == 1){
System.out.println("Hello World");
}
else if(selection == 2){
System.out.println("Pizza, Bananas cream pie, Coconuts milk");
}
else{
System.out.println("Goodbye");
break;
}
}
scanner.close();
}
public static void printMenu() {
System.out.println("_____Menu_____");
System.out.println("1: Say Hello");
System.out.println("2: List My favorite foods");
System.out.println("3: Exit");
System.out.println();
}
}
| [
"[email protected]"
]
| |
fa34295bd7f6351bcc12cc769f9b7ac4192e569c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/18/18_434fa7fb0d95a0ebc258e761990f66b4eb7dd7ca/MoveProblemCollector/18_434fa7fb0d95a0ebc258e761990f66b4eb7dd7ca_MoveProblemCollector_t.java | 59091f76387073e955c78a2adcb0cbc36f48faee | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 10,212 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2007 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
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. 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
* nbbuild/licenses/CDDL-GPL-2-CP. 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):
*
* The Original Software is NetBeans. The Initial Developer of the Original
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
* Microsystems, Inc. All Rights Reserved.
*
* 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 do not 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 org.netbeans.modules.javafx.refactoring.impl.scanners;
import com.sun.javafx.api.tree.ClassDeclarationTree;
import com.sun.javafx.api.tree.ExpressionTree;
import com.sun.javafx.api.tree.FunctionInvocationTree;
import com.sun.javafx.api.tree.InstantiateTree;
import com.sun.javafx.api.tree.JavaFXTreePathScanner;
import com.sun.javafx.api.tree.MemberSelectTree;
import com.sun.javafx.api.tree.ObjectLiteralPartTree;
import com.sun.javafx.api.tree.TypeClassTree;
import com.sun.javafx.api.tree.UnitTree;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javafx.code.JavafxFlags;
import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import org.netbeans.api.javafx.source.ClassIndex;
import org.netbeans.api.javafx.source.CompilationController;
import org.netbeans.modules.javafx.refactoring.impl.plugins.MoveRefactoringPlugin;
import org.netbeans.modules.refactoring.api.Problem;
import org.openide.util.NbBundle;
/**
*
* @author Jaroslav Bachorik <[email protected]>
*/
public class MoveProblemCollector<R, P> extends JavaFXTreePathScanner<R, P> {
private interface MoveProblemCallback {
Problem createProblem(String oldPkgName, String newPkgName, String srcTypeName, String targetTypeName, String feature);
}
private String myPkgName;
private Problem problem = null;
private CompilationController cc;
private Set<String> movedClasses;
private Map<String, String> renameMap;
public <R, P> MoveProblemCollector(CompilationController cc, Set<String> movedClasses, Map<String, String> renameMap) {
this.cc = cc;
this.movedClasses = movedClasses;
this.renameMap = renameMap;
}
final protected String getPackageName() {
return myPkgName;
}
final protected TypeMirror getClassType() {
return currentClass;
}
final public Problem getProblem() {
return problem;
}
@Override
public R visitCompilationUnit(UnitTree node, P p) {
ExpressionTree packageNameTree = node.getPackageName();
myPkgName = packageNameTree != null ? packageNameTree.toString() : "";
return super.visitCompilationUnit(node, p);
}
private TypeMirror currentClass = null;
@Override
public R visitClassDeclaration(ClassDeclarationTree node, P p) {
TypeElement te = (TypeElement)cc.getTrees().getElement(getCurrentPath());
currentClass = te.asType();
return super.visitClassDeclaration(node, p);
}
@Override
public R visitTypeClass(TypeClassTree node, P p) {
Element e = cc.getTrees().getElement(getCurrentPath());
problem = chainProblems(problem, checkVisibilty(e, new MoveProblemCallback() {
public Problem createProblem(String oldPkgName, String newPkgName, String srcTypeName, String targetTypeName, String feature) {
return new Problem(true, NbBundle.getMessage(MoveRefactoringPlugin.class, "ERR_AccessesPackagePrivateClass", new String[]{srcTypeName, targetTypeName, newPkgName}));
}
}));
return super.visitTypeClass(node, p);
}
@Override
public R visitInstantiate(InstantiateTree node, P p) {
TypeElement clzElement = (TypeElement)cc.getTrees().getElement(getCurrentPath());
problem = chainProblems(problem,
checkVisibilty(clzElement, new MoveProblemCallback() {
public Problem createProblem(String oldPkgName, String newPkgName, String srcTypeName, String targetTypeName, String feature) {
return new Problem(true, NbBundle.getMessage(MoveRefactoringPlugin.class, "ERR_AccessesPackagePrivateClass", new String[]{srcTypeName, targetTypeName, newPkgName}));
}
})
);
return super.visitInstantiate(node, p);
}
@Override
public R visitObjectLiteralPart(ObjectLiteralPartTree node, P p) {
Element e = cc.getTrees().getElement(getCurrentPath());
problem = chainProblems(problem, checkVisibilty(e, new MoveProblemCallback() {
public Problem createProblem(String oldPkgName, String newPkgName, String srcTypeName, String targetTypeName, String feature) {
return new Problem(true, NbBundle.getMessage(MoveRefactoringPlugin.class, "ERR_AccessesPackagePrivateFeature", new String[]{srcTypeName, feature, targetTypeName}));
}
}));
return super.visitObjectLiteralPart(node, p);
}
@Override
public R visitMemberSelect(MemberSelectTree node, P p) {
Element e = cc.getTrees().getElement(getCurrentPath());
if (e != null && e.getKind() == ElementKind.FIELD) {
problem = chainProblems(problem, checkVisibilty(e, new MoveProblemCallback() {
public Problem createProblem(String oldPkgName, String newPkgName, String srcTypeName, String targetTypeName, String feature) {
return new Problem(true, NbBundle.getMessage(MoveRefactoringPlugin.class, "ERR_AccessesPackagePrivateFeature", new String[]{srcTypeName, feature, targetTypeName}));
}
}));
}
return super.visitMemberSelect(node, p);
}
@Override
public R visitMethodInvocation(FunctionInvocationTree node, P p) {
Element e = cc.getTrees().getElement(getCurrentPath());
problem = chainProblems(problem, checkVisibilty(e, new MoveProblemCallback() {
public Problem createProblem(String oldPkgName, String newPkgName, String srcTypeName, String targetTypeName, String feature) {
return new Problem(true, NbBundle.getMessage(MoveRefactoringPlugin.class, "ERR_AccessesPackagePrivateFeature", new String[]{srcTypeName, feature, targetTypeName}));
}
}));
return super.visitMethodInvocation(node, p);
}
private Problem checkVisibilty(Element e, MoveProblemCallback callback) {
if (e == null) return null;
if (isAffected(e)) {
boolean packageAccess = true;
String feature = e.toString();
String targetTypeName = null;
while (e != null && e.getKind() != ElementKind.PACKAGE) {
if (targetTypeName == null && e.getKind() == ElementKind.CLASS) {
targetTypeName = e.asType().toString();
if (isProtected(e) && cc.getTypes().isSubtype(e.asType(), currentClass)) {
packageAccess = false;
}
}
e = e.getEnclosingElement();
}
if (e != null && !movedClasses.contains(targetTypeName) && packageAccess) {
String pkgName = ((PackageElement)e).getQualifiedName().toString();
String newPkgName = renameMap.get(pkgName);
return callback.createProblem(pkgName, newPkgName, currentClass.toString(), targetTypeName, feature);
}
}
return null;
}
private boolean isProtected(Element e) {
return (((Symbol)e).flags_field & Flags.PROTECTED) == 0L;
}
private boolean isAffected(Element e) {
return (((Symbol)e).flags_field & (JavafxFlags.PACKAGE_ACCESS | Flags.PROTECTED)) != 0L;
}
private static Problem chainProblems(Problem p,Problem p1) {
Problem problem;
if (p==null) return p1;
if (p1==null) return p;
problem=p;
while(problem.getNext()!=null) {
problem=problem.getNext();
}
problem.setNext(p1);
return p;
}
}
| [
"[email protected]"
]
| |
16c300575268404cd1f28c59d1ee9c7c63404fa9 | 878c2f5e259c7b362647111b4da277262620e2e5 | /app/src/main/java/com/codepath/nytimessearch/network/RestAPIBuilder.java | 62e4baad5ba498f30f37662d9532e79196c72a18 | [
"Apache-2.0"
]
| permissive | qianqian121/NYTimesSearch | e11ed9ee04cbab9403b95028b242d553e26479f2 | ea5a16364b53b51bb0d5a178dd623e65cc792547 | refs/heads/master | 2020-04-02T20:50:30.205016 | 2016-08-01T04:28:54 | 2016-08-01T04:28:54 | 64,190,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,653 | java | package com.codepath.nytimessearch.network;
import android.util.Log;
import com.codepath.nytimessearch.models.Filter;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by gary on 08/02/16.
*/
public class RestAPIBuilder {
public static RestAPI buildRetrofitService() {
OkHttpClient client = new OkHttpClient().newBuilder().addInterceptor(chain -> {
Log.d("TAG", "here");
HttpUrl url = chain.request().url().newBuilder().addQueryParameter("api-key", RestAPI.API_KEY).build();
Request request = chain.request().newBuilder().url(url).build();
return chain.proceed(request);
}).build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(RestAPI.API_ENDPOINT)
// Data converter
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.client(client)
.build();
return retrofit.create(RestAPI.class);
}
public static RestAPI buildRetrofitService(Filter filter, String query, int page) {
OkHttpClient client = new OkHttpClient().newBuilder().addInterceptor(chain -> {
Log.d("TAG", "here");
HttpUrl url = null;
if (filter.getBeginDate().isEmpty()) {
if (filter.getNewsDeskQuery().isEmpty()) {
url = chain.request().url().newBuilder()
.addQueryParameter("api-key", RestAPI.API_KEY)
.addQueryParameter("q", query)
.addQueryParameter("page", String.valueOf(page))
.build();
} else {
url = chain.request().url().newBuilder()
.addQueryParameter("api-key", RestAPI.API_KEY)
.addQueryParameter("q", query)
.addQueryParameter("page", String.valueOf(page))
.addQueryParameter("fp", filter.getNewsDeskQuery())
.build();
}
} else {
if (filter.getNewsDeskQuery().isEmpty()) {
url = chain.request().url().newBuilder()
.addQueryParameter("api-key", RestAPI.API_KEY)
.addQueryParameter("q", query)
.addQueryParameter("begin_date", filter.getBeginDate())
.addQueryParameter("page", String.valueOf(page))
.build();
} else {
url = chain.request().url().newBuilder()
.addQueryParameter("api-key", RestAPI.API_KEY)
.addQueryParameter("q", query)
.addQueryParameter("begin_date", filter.getBeginDate())
.addQueryParameter("page", String.valueOf(page))
.addQueryParameter("fp", filter.getNewsDeskQuery())
.build();
}
}
Request request = chain.request().newBuilder().url(url).build();
return chain.proceed(request);
}).build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(RestAPI.API_ENDPOINT)
// Data converter
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.client(client)
.build();
return retrofit.create(RestAPI.class);
}
} | [
"[email protected]"
]
| |
146361f89366e19506bf1592051af735384b0358 | 9208ba403c8902b1374444a895ef2438a029ed5c | /sources/org/fourthline/cling/model/message/header/ContentTypeHeader.java | ba57c81acdc6025df749374c9cc490df404f37b8 | []
| no_license | MewX/kantv-decompiled-v3.1.2 | 3e68b7046cebd8810e4f852601b1ee6a60d050a8 | d70dfaedf66cdde267d99ad22d0089505a355aa1 | refs/heads/main | 2023-02-27T05:32:32.517948 | 2021-02-02T13:38:05 | 2021-02-02T13:44:31 | 335,299,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,176 | java | package org.fourthline.cling.model.message.header;
import org.eclipse.jetty.http.MimeTypes;
import org.seamless.util.MimeType;
public class ContentTypeHeader extends UpnpHeader<MimeType> {
public static final MimeType DEFAULT_CONTENT_TYPE = MimeType.valueOf(MimeTypes.TEXT_XML);
public static final MimeType DEFAULT_CONTENT_TYPE_UTF8 = MimeType.valueOf("text/xml;charset=\"utf-8\"");
public ContentTypeHeader() {
setValue(DEFAULT_CONTENT_TYPE);
}
public ContentTypeHeader(MimeType mimeType) {
setValue(mimeType);
}
public ContentTypeHeader(String str) throws InvalidHeaderException {
setString(str);
}
public void setString(String str) throws InvalidHeaderException {
setValue(MimeType.valueOf(str));
}
public String getString() {
return ((MimeType) getValue()).toString();
}
public boolean isUDACompliantXML() {
return isText() && ((MimeType) getValue()).getSubtype().equals(DEFAULT_CONTENT_TYPE.getSubtype());
}
public boolean isText() {
return getValue() != null && ((MimeType) getValue()).getType().equals(DEFAULT_CONTENT_TYPE.getType());
}
}
| [
"[email protected]"
]
| |
9f7633e7149cc2ab2c11ab8a38bd6888289f23d3 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.browser-base/sources/defpackage/C0940Pi1.java | 14086fbea649d2b5da4f33a25eb3f7e43f18c871 | []
| no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 736 | java | package defpackage;
import android.view.View;
import org.chromium.chrome.browser.firstrun.ToSAndUMAFirstRunFragment;
/* renamed from: Pi1 reason: default package and case insensitive filesystem */
/* compiled from: chromium-OculusBrowser.apk-stable-281887347 */
public final /* synthetic */ class C0940Pi1 extends AbstractC0823Nl {
/* renamed from: a reason: collision with root package name */
public final ToSAndUMAFirstRunFragment f8709a;
public C0940Pi1(ToSAndUMAFirstRunFragment toSAndUMAFirstRunFragment) {
this.f8709a = toSAndUMAFirstRunFragment;
}
@Override // org.chromium.base.Callback
public void onResult(Object obj) {
View view = (View) obj;
this.f8709a.h1();
}
}
| [
"[email protected]"
]
| |
fa827d26d8c3fa12b6df3480a872cc7752d21d4d | f48d1084ba2e8e68a77ab897a35c0607cff27375 | /ExemploCheckBox/app/src/test/java/kurtslucas/com/exemplocheckbox/ExampleUnitTest.java | 0423b290d9f7ae41f27dba2d93b884b2dbd55171 | []
| no_license | kurtslucas/curso_android | 5457cb2766351cc01406fb30e7d9480914f75a7f | 20565458f54a41836f7a7856c5d7eec803968ddc | refs/heads/master | 2022-02-13T05:43:35.016388 | 2019-08-15T00:52:48 | 2019-08-15T00:52:48 | 105,367,745 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package kurtslucas.com.exemplocheckbox;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
712690f26809aba08b6a514c0e212173127cf1a1 | 4e75e634ff3f6a2e536ff39685c504e87a83fdca | /src/main/java/com/enao/team2/quanlynhanvien/exception/UnauthorizedException.java | aab5bf12d33ec38809ff69d2eb135e37c4c4adeb | []
| no_license | truongquangkhai99/ThucTapEnao-QuanLyNhanVien | 03ca732f95708d120192d09b34c3fec7905702f2 | d3e504ba1d8d0f949043e5780c580b8acf448bad | refs/heads/master | 2022-12-28T08:27:09.224933 | 2020-10-16T04:43:18 | 2020-10-16T04:43:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package com.enao.team2.quanlynhanvien.exception;
public class UnauthorizedException extends RuntimeException {
public UnauthorizedException(String msg) {
super(msg);
}
} | [
"[email protected]"
]
| |
dba5efe11ab5a19a1e875e381030767f442716f9 | dc7880448b0841820a90636475b016695e962447 | /gateway/src/main/java/com/gate/myapp/security/UserNotActivatedException.java | 1a5140b8bb93c635095a5841a63857c28097ddd1 | []
| no_license | vinoth-sarsha/jhipster | e4d3f9465add69586ce54d74f0e204d79571b6ce | c80a86d13b91eb2502e3db73da72e20f3af30f57 | refs/heads/master | 2022-12-24T21:11:27.324008 | 2019-06-24T15:24:27 | 2019-06-24T15:24:27 | 193,525,815 | 0 | 0 | null | 2022-12-16T04:52:55 | 2019-06-24T14:53:37 | Java | UTF-8 | Java | false | false | 510 | java | package com.gate.myapp.security;
import org.springframework.security.core.AuthenticationException;
/**
* This exception is thrown in case of a not activated user trying to authenticate.
*/
public class UserNotActivatedException extends AuthenticationException {
private static final long serialVersionUID = 1L;
public UserNotActivatedException(String message) {
super(message);
}
public UserNotActivatedException(String message, Throwable t) {
super(message, t);
}
}
| [
"[email protected]"
]
| |
b7dc64e350e7c51b4fc40c74b6ced138f869e91a | 60af6b1be035603fc2d022f1567dfe58a3b42bc9 | /jspMybatis/src/member/util/MemberUtil.java | e0c5357497a005d325ffd42623c0faca521f489e | []
| no_license | ksm962/hkit201 | 51dd574553f0c68d63131779ac564f3aa88dd3ff | 758e4f2a93c8652f6230ba0ea24ea036fb8b47a5 | refs/heads/main | 2023-04-05T08:12:41.001901 | 2021-03-28T15:17:26 | 2021-03-28T15:17:26 | 351,337,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | package member.util;
public class MemberUtil extends common.Util{
public String[] searchCheck(String search_option, String search_data) {
String[] result = new String[2];
if(search_option == null|| search_option.trim().equals("")) {
search_option="";
}
search_option = search_option.trim();
if(search_option.equals("")) {
}else if(search_option.equals("id")) {
}else if(search_option.equals("name")) {
}else if(search_option.equals("gender")) {
}else if(search_option.equals("id_name_gender")) {
}else {
search_option="";
}
if(search_data ==null || search_data.trim().equals("")) {
search_data="";
}
search_data=search_data.trim();
if(search_option.equals("")|| search_data.equals("")) {
search_option="";
search_data="";
}
result[0]=search_option;
result[1]=search_data;
return result;
}
}
| [
"[email protected]"
]
| |
1b53dcaa36fc35172f9bc5abc93bcbb1b2f08fbb | 237385c898077c28a3cd595e40473e2a4e7bbca8 | /core/src/main/java/ttaomae/connectn/gui/BoardPanel.java | 1745973ea8d8b7f7b3797c1765f5288bda59611b | [
"BSD-2-Clause"
]
| permissive | davidTeraoka/ConnectN | 4084f84a6d73d11acd4d9b9be2709883b2ec4565 | 3562e864321697bf0aa43efa32c7a779cd7e5587 | refs/heads/master | 2021-05-27T19:04:26.980533 | 2014-06-05T01:44:30 | 2014-06-05T01:44:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,126 | java | package ttaomae.connectn.gui;
import javafx.geometry.Insets;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import ttaomae.connectn.Board;
import ttaomae.connectn.BoardListener;
/**
* A panel for displaying a Connect-N board. The Board being displayed can be
* changed and the spacing of the pieces will be adjusted to fit evenly in the
* panel.
*
* @author Todd Taomae
*/
public class BoardPanel extends GridPane implements BoardListener
{
private Board board;
private int pieceRadius;
/**
* Sets the gaps between spaces and padding on all edges of the board based
* on the size of this panel and the size of the board.
*/
private void setGapsAndPadding()
{
int panelWidth = (int)this.getPrefWidth();
int panelHeight = (int)this.getPrefHeight();
// the width and height measured in radii
// 2*n radius for pieces + n+1 radius for gaps and padding
int radiusWidths = 3 * this.board.getWidth() + 1;
int radiusHeights = 3 * this.board.getHeight() + 1;
this.pieceRadius = Math.min(panelWidth / radiusWidths, panelHeight / radiusHeights);
// (size of the panel - total size of pieces) / (total number of gaps/padding)
int totalPieceWidth = 2 * this.board.getWidth() * this.pieceRadius;
int horizontalGap = (panelWidth - totalPieceWidth) / (this.board.getWidth() + 1);
int totalPieceHeight = 2 * this.board.getHeight() * this.pieceRadius;
int verticalGap = (panelHeight - totalPieceHeight) / (this.board.getHeight() + 1);
int totalGapWidth = (this.board.getWidth() - 1) * horizontalGap;
int horizontalPadding = (panelWidth - totalPieceWidth - totalGapWidth);
int leftPadding = horizontalPadding / 2;
// add padding % 2 to account for odd numbered padding
int rightPadding = leftPadding + (horizontalPadding % 2);
int totalGapHeight = (this.board.getHeight() - 1) * verticalGap;
int verticalPadding = (panelHeight - totalPieceHeight - totalGapHeight);
int bottomPadding = verticalPadding / 2;
// add padding % 2 to account for odd numbered padding
int topPadding = bottomPadding + (verticalPadding % 2);
this.setHgap(horizontalGap);
this.setVgap(verticalGap);
this.setPadding(new Insets(topPadding, rightPadding, bottomPadding, leftPadding));
}
/**
* Updates this BoardPanel each time the underlying board is changed.
*/
@Override
public void boardChanged()
{
this.update();
}
/**
* Updates this panel to reflect the current state of the underlying Board.
*/
public void update()
{
javafx.application.Platform.runLater(new Runnable() {
@Override
public void run()
{
BoardPanel.this.getChildren().clear();
for (int y = 0; y < BoardPanel.this.board.getHeight(); y++) {
for (int x = 0; x < BoardPanel.this.board.getWidth(); x++) {
Circle circle;
int row = BoardPanel.this.board.getHeight() - y - 1;
switch (BoardPanel.this.board.getPieceAt(x, row)) {
case BLACK:
circle = new Circle(BoardPanel.this.pieceRadius, Color.BLACK);
break;
case RED:
circle = new Circle(BoardPanel.this.pieceRadius, Color.RED);
break;
default:
circle = new Circle(BoardPanel.this.pieceRadius, Color.WHITE);
}
BoardPanel.this.add(circle, x, y);
}
}
}
});
}
/**
* Returns the column of the underlying Board corresponding to a horizontal
* position on this panel.
*
* @param x horizontal position on this panel
* @return the column of the underlying Board corresponding to the
* horizontal position
*
*/
public int getBoardColumn(double x)
{
double halfGap = this.getHgap() / 2;
double leftPadding = this.getPadding().getLeft() - halfGap;
double rightPadding = this.getPadding().getRight() - halfGap;
// outside of board
if (x < (leftPadding) || x > (this.getWidth() - rightPadding)) {
return -1;
}
double boardWidth = this.getWidth() - leftPadding - rightPadding;
double pieceWidth = boardWidth / this.board.getWidth();
double boardX = x - leftPadding;
int column = (int) (boardX / pieceWidth);
return column;
}
/**
* Sets the underlying Board to a new Board.
*
* @param board the new Board
*/
public void setBoard(Board board)
{
this.board = board;
this.board.addBoardListener(this);
this.setGapsAndPadding();
this.update();
}
}
| [
"[email protected]"
]
| |
52940b3d1d24b5eedd9b762ba1458607714878b0 | c818ce63677c64872dd4a1830d4b907afeef391f | /src/DeBugDemo.java | eb63f78648b43babba62a18d34fcf04379f9de87 | []
| no_license | parieses/studyJava | 1c40e486968dcb305c24e751853e9831360fc3e2 | 39b23804bd870636c73cf774029e22b4f3269877 | refs/heads/master | 2022-09-16T15:35:54.417527 | 2020-05-26T10:38:37 | 2020-05-26T10:38:37 | 254,811,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | public class DeBugDemo {
public static void main(String[] args) {
int a = 10;
int b = 20;
int c = 30;
int sum = a + b + c;
System.out.println(sum);
}
}
| [
"[email protected]"
]
| |
c4fa5a249fed94d97a6de9d9ef8d3a6a7d27b842 | ad5699e09dbd5945638e2ca051e3e8b6d40fe4fd | /app/src/main/java/com/everday/useapp/utils/NetWorkUtils.java | b1800d21386fd552bc146f75ec49b2e290ed5c4f | []
| no_license | EverdayAndroid/UseApp | e66ec178fc437225a225c2c0bf233e7e25a1872a | 5cd219eabe45e57c5b9fb6216e85c7226f89c34e | refs/heads/master | 2020-07-12T11:48:21.510383 | 2019-11-12T00:09:35 | 2019-11-12T00:09:35 | 204,812,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,302 | java | package com.everday.useapp.utils;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* data 2019/6/28
* author Everday
* email [email protected]
* desc 校验网络信息
**/
public class NetWorkUtils {
public static final int NETWORK_NO = -1; // no network
public static final int NETWORK_WIFI = 1; // wifi network
public static final int NETWORK_2G = 2; // "2G" networks
public static final int NETWORK_3G = 3; // "3G" networks
public static final int NETWORK_4G = 4; // "4G" networks
public static final int NETWORK_UNKNOWN = 5; // unknown network
private static final int NETWORK_TYPE_GSM = 16;
private static final int NETWORK_TYPE_TD_SCDMA = 17;
private static final int NETWORK_TYPE_IWLAN = 18;
private static Context mContext;
public static void init(Context context) {
mContext = context;
}
/**
* 打开网络设置界面
* <p>3.0以下打开设置界面</p>
*/
public static void openWirelessSettings() {
if (android.os.Build.VERSION.SDK_INT > 10) {
mContext.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
} else {
mContext.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
}
}
/**
* 获取活动网络信息
*
* @return NetworkInfo
*/
private static NetworkInfo getActiveNetworkInfo() {
ConnectivityManager cm = (ConnectivityManager) mContext
.getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetworkInfo();
}
/**
* 判断网络是否可用
* <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
*
* @return {@code true}: 可用<br>{@code false}: 不可用
*/
public static boolean isAvailable() {
NetworkInfo info = getActiveNetworkInfo();
return info != null && info.isAvailable();
}
/**
* 判断网络是否连接
* <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
*
* @return {@code true}: 是<br>{@code false}: 否
*/
public static boolean isConnected() {
NetworkInfo info = getActiveNetworkInfo();
return info != null && info.isConnected();
}
/**
* 判断网络是否是4G
* <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
*
* @return {@code true}: 是<br>{@code false}: 不是
*/
public static boolean is4G() {
NetworkInfo info = getActiveNetworkInfo();
return info != null && info.isAvailable() && info.getSubtype() == TelephonyManager.NETWORK_TYPE_LTE;
}
/**
* 判断wifi是否连接状态
* <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
*
* @return {@code true}: 连接<br>{@code false}: 未连接
*/
public static boolean isWifiConnected() {
ConnectivityManager cm = (ConnectivityManager) mContext
.getSystemService(Context.CONNECTIVITY_SERVICE);
return cm != null && cm.getActiveNetworkInfo() != null
&& cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI;
}
/**
* 获取移动网络运营商名称
* <p>如中国联通、中国移动、中国电信</p>
*
* @return 移动网络运营商名称
*/
public static String getNetworkOperatorName() {
TelephonyManager tm = (TelephonyManager) mContext
.getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getNetworkOperatorName() : null;
}
/**
* 获取移动终端类型
*
* @return 手机制式
* <ul>
* <li>{@link TelephonyManager#PHONE_TYPE_NONE } : 0 手机制式未知</li>
* <li>{@link TelephonyManager#PHONE_TYPE_GSM } : 1 手机制式为GSM,移动和联通</li>
* <li>{@link TelephonyManager#PHONE_TYPE_CDMA } : 2 手机制式为CDMA,电信</li>
* <li>{@link TelephonyManager#PHONE_TYPE_SIP } : 3</li>
* </ul>
*/
public static int getPhoneType() {
TelephonyManager tm = (TelephonyManager) mContext
.getSystemService(Context.TELEPHONY_SERVICE);
return tm != null ? tm.getPhoneType() : -1;
}
/**
* 获取当前的网络类型(WIFI,2G,3G,4G)
* <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
*
* @return 网络类型
* <ul>
* <li>{@link #NETWORK_WIFI } = 1;</li>
* <li>{@link #NETWORK_4G } = 4;</li>
* <li>{@link #NETWORK_3G } = 3;</li>
* <li>{@link #NETWORK_2G } = 2;</li>
* <li>{@link #NETWORK_UNKNOWN} = 5;</li>
* <li>{@link #NETWORK_NO } = -1;</li>
* </ul>
*/
public static int getNetWorkType() {
int netType = NETWORK_NO;
NetworkInfo info = getActiveNetworkInfo();
if (info != null && info.isAvailable()) {
if (info.getType() == ConnectivityManager.TYPE_WIFI) {
netType = NETWORK_WIFI;
} else if (info.getType() == ConnectivityManager.TYPE_MOBILE) {
switch (info.getSubtype()) {
case NETWORK_TYPE_GSM:
case TelephonyManager.NETWORK_TYPE_GPRS:
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_IDEN:
netType = NETWORK_2G;
break;
case NETWORK_TYPE_TD_SCDMA:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_UMTS:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
case TelephonyManager.NETWORK_TYPE_EHRPD:
case TelephonyManager.NETWORK_TYPE_HSPAP:
netType = NETWORK_3G;
break;
case NETWORK_TYPE_IWLAN:
case TelephonyManager.NETWORK_TYPE_LTE:
netType = NETWORK_4G;
break;
default:
String subtypeName = info.getSubtypeName();
if (subtypeName.equalsIgnoreCase("TD-SCDMA")
|| subtypeName.equalsIgnoreCase("WCDMA")
|| subtypeName.equalsIgnoreCase("CDMA2000")) {
netType = NETWORK_3G;
} else {
netType = NETWORK_UNKNOWN;
}
break;
}
} else {
netType = NETWORK_UNKNOWN;
}
}
return netType;
}
/**
* 获取当前的网络类型(WIFI,2G,3G,4G)
* <p>依赖上面的方法</p>
*
* @return 网络类型名称
* <ul>
* <li>NETWORK_WIFI </li>
* <li>NETWORK_4G </li>
* <li>NETWORK_3G </li>
* <li>NETWORK_2G </li>
* <li>NETWORK_UNKNOWN</li>
* <li>NETWORK_NO </li>
* </ul>
*/
public static String getNetWorkTypeName() {
switch (getNetWorkType()) {
case NETWORK_WIFI:
return "NETWORK_WIFI";
case NETWORK_4G:
return "NETWORK_4G";
case NETWORK_3G:
return "NETWORK_3G";
case NETWORK_2G:
return "NETWORK_2G";
case NETWORK_NO:
return "NETWORK_NO";
default:
return "NETWORK_UNKNOWN";
}
}
}
| [
"[email protected]"
]
| |
781c016e619b9f23ea733c6ad3674e5cca2b71b2 | 619acd4f6bfe9248d05573446799a37cadfd6ed9 | /AnisulIslamJavaSwing/JavaSwing/src/layout_manager/CardLayoutDemo5.java | 1b2f8e1c8a43dcbb12a1d78eddf7178388354d78 | []
| no_license | Wahid259/Anisu-lslam | d959a1790fbc24040e1257803057d4c614ee5022 | acba827e6a5226f962362de927d78ac756e62db7 | refs/heads/master | 2023-01-06T14:37:41.739499 | 2020-10-28T12:26:35 | 2020-10-28T12:26:35 | 308,007,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,596 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package layout_manager;
import java.awt.CardLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
/**
*
* @author HP
*/
public class CardLayoutDemo5 extends JFrame implements ActionListener{
private Container c;
private CardLayout cl;
private JButton btn1, btn2, btn3;
CardLayoutDemo5()
{
initComponents();
}
public void initComponents()
{
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBounds(100,100,300,300);
this.setTitle("CardLayout demo");
c = this.getContentPane();
cl = new CardLayout(10,10);
c.setLayout(cl);
btn1 = new JButton("1");
btn2 = new JButton("2");
btn3 = new JButton("3");
c.add(btn1,"first");
c.add(btn2,"second");
c.add(btn3,"third");
btn1.addActionListener(this);
btn2.addActionListener(this);
btn3.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent ae) {
cl.last(c);
//sact er ta dhakabe
}
public static void main(String[] args) {
CardLayoutDemo5 frame = new CardLayoutDemo5();
frame.setVisible(true);
}
}
| [
"[email protected]"
]
| |
0cfd888ee74ad2cf2d6ec36da1b00ef059d48dfd | 8a9de0a9d3a4b3bde68222c08cc12efd1446e929 | /src/main/java/com/schwarzsword/pip/coursework/config/SwaggerConfig.java | 43153d384ccd205d71d2f684994666a1bed55352 | []
| no_license | schwarzsword/coursework | 962d08884544c7574a866d455ddbd6f2941cb3b9 | ca6b0f15fbf117f787e2a844fd2ae851f34f6c85 | refs/heads/master | 2020-04-15T22:27:59.314065 | 2019-01-23T06:54:35 | 2019-01-23T06:54:35 | 165,073,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | package com.schwarzsword.pip.coursework.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
} | [
"[email protected]"
]
| |
13f60d14429da5670a3f016e93bce52e403b1d73 | 671daf60cdb46250214da19132bb7f21dbc29612 | /android/src/com/android/tools/idea/avdmanager/emulatorcommand/ColdBootNowEmulatorCommandBuilder.java | bf173bf3a843e51bf312b1f60b9a54642b43cea1 | [
"Apache-2.0"
]
| permissive | JetBrains/android | 3732f6fe3ae742182c2684a13ea8a1e6a996c9a1 | 9aa80ad909cf4b993389510e2c1efb09b8cdb5a0 | refs/heads/master | 2023-09-01T14:11:56.555718 | 2023-08-31T16:50:03 | 2023-08-31T16:53:27 | 60,701,247 | 947 | 255 | Apache-2.0 | 2023-09-05T12:44:24 | 2016-06-08T13:46:48 | Kotlin | UTF-8 | Java | false | false | 1,204 | java | /*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tools.idea.avdmanager.emulatorcommand;
import com.android.sdklib.internal.avd.AvdInfo;
import com.intellij.execution.configurations.GeneralCommandLine;
import java.nio.file.Path;
import org.jetbrains.annotations.NotNull;
public final class ColdBootNowEmulatorCommandBuilder extends EmulatorCommandBuilder {
public ColdBootNowEmulatorCommandBuilder(@NotNull Path emulator, @NotNull AvdInfo avd) {
super(emulator, avd);
}
@Override
void addSnapshotParameters(@NotNull GeneralCommandLine command) {
command.addParameter("-no-snapshot-load");
}
}
| [
"[email protected]"
]
| |
a6b073da1be8208dc96ed48080ee744681d188c1 | c45219e0ac40dcb705b55a932ac5f9a6bef81fe9 | /transport-project-service/src/main/java/com/mkrt4an/service/DriverService.java | 08f3f141466d8636fde63cb039c77f3ed5f19df5 | []
| no_license | mkrt4an/transport-project | f05a13392e0aed56aaaa07f4eb6c3b1bc965c5ae | 4c7bae98dec013b8a2b17a9b39bf29b2290f1d11 | refs/heads/master | 2021-01-11T03:16:07.038586 | 2016-11-01T21:13:05 | 2016-11-01T21:13:05 | 71,077,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,431 | java | package com.mkrt4an.service;
import com.mkrt4an.dao.*;
import com.mkrt4an.entity.DriverEntity;
import com.mkrt4an.entity.RoutePointEntity;
import javax.inject.Inject;
import java.util.List;
//import static com.mkrt4an.utils.EntityManagerHelper.getEntityManager;
/**
* Created by 123 on 02.10.2016.
*/
public class DriverService {
@Inject
DriverDao driverDao;
public DriverService() {}
//Find by id
public DriverEntity findById(String id) {
// DriverDao driverDao = new DriverDao(getEntityManager());
return driverDao.findDriverById(Integer.parseInt(id));
}
//Delete by id
public void deleteById(String id){
// DriverDao driverDao = new DriverDao(getEntityManager());
driverDao.deleteDriver(driverDao.findDriverById(Integer.parseInt(id)));
}
// Find all drivers
public List<DriverEntity> findAllDrivers() {
// DriverDao driverDao = new DriverDao(getEntityManager());
return driverDao.getAllDrivers() ;
}
//Get driver info
public String getDriverInfo(Integer driverId) {
// DriverDao driverDao = new DriverDao(getEntityManager());
DriverEntity driverEntity = driverDao.findDriverById(driverId);
StringBuffer codriverList = new StringBuffer();
List<DriverEntity> driverEntityList = driverEntity.getOrder().getDriverList();
for (DriverEntity entity : driverEntityList) {
if (entity == driverEntity) {continue;}
codriverList.append(entity.getId());
codriverList.append(", ");
}
codriverList.deleteCharAt(codriverList.length() - 2);
StringBuffer routePointList = new StringBuffer();
for (RoutePointEntity entity : driverEntity.getOrder().getRoutePointList()) {
routePointList.append(entity.getOrdinal() + " - " + entity.getCity() + ", ");
}
routePointList.deleteCharAt(routePointList.length() - 2);
return "id: " + driverEntity.getId() + "\n" +
"co-id: " + codriverList + "\n" +
"Truck regNumber: " + driverEntity.getOrder().getCurrentTruck().getRegNumber() + "\n" +
"Order number: " + driverEntity.getOrder().getId() + "\n" +
"RoutePointList: " + routePointList;
}
// Get list of avaible drivers for order
public List<DriverEntity> getAvaibleDriverForOrder() {
return null;
}
}
| [
"[email protected]"
]
| |
39a58aef51646b0e37045a0dc11b0a7fff1afe97 | 0c3e34463e41d7a910e4fb22ee55dc1970289832 | /Submission/FinalVersion/src/main/java/com/group8/view/editRestaurant/RestaurantEditView.java | e711673d2641062c1d9d4130282b19bb9cd31135 | []
| no_license | SEM-PP-GROUP8/RestaurantFinder | a232c73711afad4239d3361d010157bce7796b32 | bc41db0e5857b53abc943610120190694456041f | refs/heads/master | 2016-09-06T19:36:09.110136 | 2015-01-16T15:30:09 | 2015-01-16T15:30:09 | 28,887,091 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,545 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.group8.view.editRestaurant;
import com.group8.controller.RestaurantEditController;
import javax.swing.JButton;
public class RestaurantEditView extends javax.swing.JFrame {
private RestaurantEditController controller = null;
public RestaurantEditView() {
initComponents();
}
public RestaurantEditView(RestaurantEditController controller) {
this.controller = controller;
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
restaurantSearchableList = new com.group8.view.editRestaurant.RestaurantSearchableList(controller);
restaurantButtons = new RestaurantButtons(controller);
restaurantSchedule1 = new com.group8.view.editRestaurant.RestaurantSchedule(controller);
restaurantDetails2 = new com.group8.view.editRestaurant.RestaurantDetails(controller);
returnButton = new javax.swing.JButton();
logoLabel = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setLocation(new java.awt.Point(200, 50));
setMaximumSize(new java.awt.Dimension(900, 600));
setMinimumSize(new java.awt.Dimension(900, 600));
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
restaurantSearchableList.setPreferredSize(new java.awt.Dimension(250, 355));
getContentPane().add(restaurantSearchableList, new org.netbeans.lib.awtextra.AbsoluteConstraints(5, 80, -1, -1));
getContentPane().add(restaurantButtons, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 10, -1, -1));
restaurantSchedule1.setOpaque(false);
restaurantSchedule1.setPreferredSize(new java.awt.Dimension(310, 300));
getContentPane().add(restaurantSchedule1, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 80, 310, -1));
getContentPane().add(restaurantDetails2, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 80, -1, -1));
returnButton.setText("<- Back");
returnButton.setPreferredSize(new java.awt.Dimension(100, 40));
returnButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
returnButtonActionPerformed(evt);
}
});
getContentPane().add(returnButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(790, 460, -1, -1));
logoLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/group8/view/images/logo.jpg"))); // NOI18N
getContentPane().add(logoLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(790, 510, 100, -1));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/group8/view/images/[email protected]"))); // NOI18N
jLabel1.setLabelFor(this);
jLabel1.setPreferredSize(new java.awt.Dimension(900, 600));
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 900, -1));
pack();
}// </editor-fold>//GEN-END:initComponents
private void returnButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_returnButtonActionPerformed
controller.closeView();
}//GEN-LAST:event_returnButtonActionPerformed
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
controller.closeView();
}//GEN-LAST:event_formWindowClosing
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel logoLabel;
private com.group8.view.editRestaurant.RestaurantButtons restaurantButtons;
private com.group8.view.editRestaurant.RestaurantDetails restaurantDetails2;
private com.group8.view.editRestaurant.RestaurantSchedule restaurantSchedule1;
private com.group8.view.editRestaurant.RestaurantSearchableList restaurantSearchableList;
private javax.swing.JButton returnButton;
// End of variables declaration//GEN-END:variables
public RestaurantButtons getRestaurantButtons() {
return restaurantButtons;
}
public RestaurantDetails getRestaurantDetails2() {
return restaurantDetails2;
}
public RestaurantSearchableList getRestaurantSearchableList() {
return restaurantSearchableList;
}
public RestaurantSchedule getRestaurantSchedule1() {
return restaurantSchedule1;
}
public JButton getReturnButton() {
return returnButton;
}
}
| [
"[email protected]"
]
| |
2e0e32f60418785f12fc9b3299a88ad5352e8e71 | 9dd95376d81225b17f86f536278493a24131b2e0 | /src/com/demo/io/example2/IOExample2.java | 11a11bc05ab014b7e910401be243aa0291037db7 | []
| no_license | epr0/06AdvancedJava | 8768fa0c7e506b777706020b92ba3cd3868590f1 | 9c5a2041852aa5b9bca54329110a03be965b8b16 | refs/heads/master | 2023-08-08T09:21:23.179497 | 2021-01-28T17:10:10 | 2021-01-28T17:10:10 | 257,977,634 | 0 | 0 | null | 2023-07-23T12:52:33 | 2020-04-22T17:51:01 | Java | UTF-8 | Java | false | false | 681 | java | package com.demo.io.example2;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class IOExample2 {
public static void main(String[] args) {
File file = new File("/Users/epro/Downloads/Courses SDA/06 Advanced java/DemoProject/src/com/demo/io/example1/data.txt");
System.out.println("Lets write some content to a file");
try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file, true))) {
String fileLine = "\nAdded new line!";
bufferedWriter.write(fileLine);
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
b5d17aed15eb7c6040bb72084d415f30eb2b67f9 | 1dced079671699fb3e69a080178fa9a8fc6f2359 | /mojo/src/javax/microedition/lcdui/Display.java | 422af2897783af04b8501d7cfddfe10475cb4e80 | []
| no_license | dougxc/SquawkNG | 7dc93a7fd2ebafaea4cf021e942f984ab8d494ea | 60ebfc59d2a479e671160679a78b1d2ddc30ab65 | refs/heads/master | 2022-12-22T05:02:18.384927 | 2020-09-29T09:54:49 | 2020-09-29T09:54:49 | 299,572,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,147 | java | package javax.microedition.lcdui;
import mojo.*;
public class Display {
public static final int WIDTH = Main.WIDTH;
public static final int HEIGHT = Main.HEIGHT;
private static Display instance = new Display();
private static MojoScreen screen = Main.getScreen();
private static SoftButtonPanel sbp = screen.getSoftButtonPanel();
private Displayable current;
private Displayable previous;
public static Display getDisplay(javax.microedition.midlet.MIDlet m) {
return instance;
}
public static Display getDisplay() {
return instance;
}
public void setCurrent(Alert alert, Displayable nextDisplayable) {
if ((alert == null) || (nextDisplayable == null)) {
throw new NullPointerException();
}
if (nextDisplayable instanceof Alert) {
throw new IllegalArgumentException();
}
setCurrent(alert);
previous = nextDisplayable;
}
public void setCurrent(Displayable d) {
if (d instanceof Alert) previous = current;
screen.remove(0);
screen.add(d.proxy, 0);
screen.invalidate();
screen.validate();
d.proxy.requestFocus();
current = d;
sbp.reset(current);
current.repaint();
}
void clearAlert() {
setCurrent(previous);
}
public Displayable getCurrent() {
return current;
}
public int numColors() {
return 256;
}
public boolean isColor() {
return true;
}
public void commandAction(int id) {
java.util.Vector cmds;
CommandListener listener;
Command c;
if (current == null) return;
c = SoftButtonMenu.getInstance().getCommand();
if (id == c.getID()) {
SoftButtonMenu.getInstance().commandAction(c, current);
}
if ((listener = current.getCommandListener()) == null) return;
cmds = current.getCommands();
for (int i=0; i<cmds.size(); i++) {
c = (Command)cmds.elementAt(i);
if (c.getID() == id) {
listener.commandAction(c, current);
}
}
current.proxy.requestFocus();
}
}
| [
"[email protected]"
]
| |
5b46bff1832a135b5085c1e71a04c182f7d5a7fd | aeaabdc0dbaee0006fc2180b83e350ea3d81bba2 | /src/test/java/cyber_bnb/utilities/ConfigurationReader.java | ec74daab1158dcd8306a4e619b4f9464a7a08159 | []
| no_license | hdanaci/Online7-Cyber__bnb | 37c5893aa75e925cdcfdb349c0a84f4be5b0db75 | 9bddd4aa4b7bdab0e570ee22dea15911d753b268 | refs/heads/master | 2020-03-26T17:12:01.549572 | 2018-08-20T03:58:02 | 2018-08-20T03:58:02 | 145,147,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | package cyber_bnb.utilities;
import java.io.FileInputStream;
import java.util.Properties;
public class ConfigurationReader {
private static Properties configFile;
static {
try {
String path = "configuration.properties";
FileInputStream input = new FileInputStream(path);
configFile = new Properties();
configFile.load(input);
input.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static String getProperty(String keyName) {
return configFile.getProperty(keyName);
}
}
| [
"[email protected]"
]
| |
5faecd436064cfea64b2df0b72015fa77bef7690 | 4cba61b25166511d85f94023a4b5fd1dc98303cc | /app/src/main/java/com/usc/mylab/util/SystemUiHiderBase.java | ed049763566921a332fb9292772927ff946f99b4 | []
| no_license | Kanchanapratha/Android_MyLabApp | 44b110876177a4d558725cd8adeffa24f3579c82 | a91402fba86f51edc855f2da0c8928b842958300 | refs/heads/master | 2020-05-21T13:23:18.118418 | 2014-01-27T05:29:20 | 2014-01-27T05:29:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,046 | java | package com.usc.mylab.util;
import android.app.Activity;
import android.view.View;
import android.view.WindowManager;
/**
* A base implementation of {@link com.usc.mylab.util.SystemUiHider}. Uses APIs available in all
* API levels to show and hide the status bar.
*/
public class SystemUiHiderBase extends SystemUiHider {
/**
* Whether or not the system UI is currently visible. This is a cached value
* from calls to {@link #hide()} and {@link #show()}.
*/
private boolean mVisible = true;
/**
* Constructor not intended to be called by clients. Use
* {@link com.usc.mylab.util.SystemUiHider#getInstance} to obtain an instance.
*/
protected SystemUiHiderBase(Activity activity, View anchorView, int flags) {
super(activity, anchorView, flags);
}
@Override
public void setup() {
if ((mFlags & FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES) == 0) {
mActivity.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
}
@Override
public boolean isVisible() {
return mVisible;
}
@Override
public void hide() {
if ((mFlags & FLAG_FULLSCREEN) != 0) {
mActivity.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
mOnVisibilityChangeListener.onVisibilityChange(false);
mVisible = false;
}
@Override
public void show() {
if ((mFlags & FLAG_FULLSCREEN) != 0) {
mActivity.getWindow().setFlags(
0,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
mOnVisibilityChangeListener.onVisibilityChange(true);
mVisible = true;
}
}
| [
"[email protected]"
]
| |
aab82fc18f85d96d284fcefef8700f29d01a68ac | 164554caae3e3c6457993319e2787d978647504e | /app/src/main/java/com/nlscan/android/tempertest/TemperModel.java | 4232441e88d20ee4dab797a44f9b948f48dfa425 | []
| no_license | YoungLee3000/TemperTest | 020980b1c6945e96c132fe1cc77dce65b8b2b452 | cf3d096df3d776028c0aa84f0ad46bfa37230963 | refs/heads/master | 2023-02-25T08:53:46.927421 | 2021-02-02T01:36:11 | 2021-02-02T01:36:11 | 335,134,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package com.nlscan.android.tempertest;
public class TemperModel {
public native double[] currentTemper();
public native void closeSerial();
public native void initSerial();
static {
System.loadLibrary("temperGet");
}
}
| [
"[email protected]"
]
| |
511f64cab4b680133f249424b1fbeddd87e43393 | 230b1d19c8f8714bba5d1eb84c1dc0e2ab3e31eb | /kfroute-parent/kfroute-model/src/main/java/cn/melinkr/platform/kfroute/ServerPortConfig.java | cd776430996bab5af8f45f02890a0497642fc5b3 | []
| no_license | kfroute/kfroute-parent | e13e94bdad4d91437a0b2398750a5a78208f0bbf | b9e04ca1be43ce3cc82f1acccadf6082e27e4494 | refs/heads/master | 2020-05-30T10:43:02.461473 | 2015-08-31T06:00:13 | 2015-08-31T06:00:13 | 41,658,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 78 | java | package cn.melinkr.platform.kfroute;
public class ServerPortConfig {
}
| [
"[email protected]"
]
| |
8a3aed31587901c9ebf325a558f4657506e2b6a7 | 17fe33846765fd4815fc651b3ab6bb7b91ad989f | /app/src/main/java/com/pencilbox/netknight/utils/EncodeUtils.java | a45fdbf08b3adf836192dc2deec43b52b2b73076 | [
"Apache-2.0"
]
| permissive | 447857062/vpn | 834a6b293aed45300ace54ec3380d01363dc90aa | 923706675e7ea78ffbc52e685cafa481c834ab28 | refs/heads/master | 2020-03-22T11:19:40.186802 | 2018-07-06T09:28:37 | 2018-07-06T09:28:37 | 139,963,567 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java | package com.pencilbox.netknight.utils;
/**
* Created by pencil-box on 16/6/23.
*/
public class EncodeUtils {
/**
* 字节转换为bit
* @param b
* @return
*/
public static String byte2bits(byte b){
StringBuffer sb = new StringBuffer();
int offset = 1<<7;
int i= 7;
while(i>=0) {
sb.append((offset & b)>>i);
offset>>=1;
i--;
}
return sb.toString();
}
/**
* 十进制转换为16进制字符串
* @param value
* @return
*/
public static String int2hex(int value){
return Integer.toHexString(value);
}
/**
* 十六进制转换为Integer
* @param hexValue
* @return
*/
public static int hex2int(String hexValue){
return Integer.valueOf(hexValue,16);
}
}
| [
"[email protected]"
]
| |
da5dc848affec0701c909af0f958afe7a9848cb0 | 1f29f7842e30d6265fb9dbb302fe9414755e7403 | /src/main/java/com/eurodyn/okstra/ArtGeokunststoffType.java | 20574df44d3de0546fb723c5f6176ea5cba47183 | []
| no_license | dpapageo/okstra-2018-classes | b4165aea3c84ffafaa434a3a1f8cf0fff58de599 | fb908eabc183725be01c9f93d39268bb8e630f59 | refs/heads/master | 2021-03-26T00:22:28.205974 | 2020-03-16T09:16:31 | 2020-03-16T09:16:31 | 247,657,881 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,610 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2020.03.09 at 04:49:50 PM EET
//
package com.eurodyn.okstra;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Art_GeokunststoffType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Art_GeokunststoffType">
* <complexContent>
* <extension base="{http://www.opengis.net/gml/3.2}AbstractFeatureType">
* <sequence>
* <element name="Kennung" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="Langtext" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Art_GeokunststoffType", propOrder = {
"kennung",
"langtext"
})
public class ArtGeokunststoffType
extends AbstractFeatureType
{
@XmlElement(name = "Kennung", required = true)
protected String kennung;
@XmlElement(name = "Langtext", required = true)
protected String langtext;
/**
* Gets the value of the kennung property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getKennung() {
return kennung;
}
/**
* Sets the value of the kennung property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setKennung(String value) {
this.kennung = value;
}
/**
* Gets the value of the langtext property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLangtext() {
return langtext;
}
/**
* Sets the value of the langtext property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLangtext(String value) {
this.langtext = value;
}
}
| [
"[email protected]"
]
| |
0097943817771567a9b24e7c86eaea549fd2abab | 5b82e2f7c720c49dff236970aacd610e7c41a077 | /QueryReformulation-master 2/data/processed/IElementReference.java | 03928d12192c38218b86554a490799827556046c | []
| no_license | shy942/EGITrepoOnlineVersion | 4b157da0f76dc5bbf179437242d2224d782dd267 | f88fb20497dcc30ff1add5fe359cbca772142b09 | refs/heads/master | 2021-01-20T16:04:23.509863 | 2016-07-21T20:43:22 | 2016-07-21T20:43:22 | 63,737,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,084 | java | /***/
package org.eclipse.ui.commands;
import java.util.Map;
import org.eclipse.ui.menus.UIElement;
/**
* the ICommandService will return a reference for all callbacks that are
* registered. This reference can be used to unregister the specific callback.
* <p>
* Similar in functionality to an IHandlerActivation. This interface should
* not be implemented or extended by clients.
* </p>
*
* @since 3.3
*/
public interface IElementReference {
/**
* The command id that this callback was registered against.
*
* @return The command id. Will not be <code>null</code>.
*/
public String getCommandId();
/**
* The callback that was registered.
*
* @return Adapts to provide appropriate user feedback. Will not be
* <code>null</code>.
*/
public UIElement getElement();
/**
* Parameters that help scope this callback registration. For example, it
* can include parameters from the ParameterizedCommand. Callers should not
* change the map that is returned.
*
* @return scoping parameters. Will not be <code>null</code>.
*/
public Map getParameters();
}
| [
"[email protected]"
]
| |
1a03573d1d94a9ce96091b4d08a73bb8342011c4 | 0e6906888c4352b656c1ffcdce25faf4963016a8 | /webapp/src/main/java/org/renjin/ci/source/index/UseVisitor.java | ad82298cd23c52d95f95a3dfb436f61076150509 | []
| no_license | bedatadriven/renjin-packages | 84472db29464d6df9d8085b2a8807daa6e0d07c5 | 3a69d8354142542cdb2aa63854771ace0d180e64 | refs/heads/master | 2023-07-01T06:53:44.537804 | 2021-07-31T13:06:54 | 2021-07-31T13:06:54 | 384,443,609 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,517 | java | package org.renjin.ci.source.index;
import com.google.common.collect.Sets;
import org.renjin.sexp.*;
import java.util.HashSet;
import java.util.Set;
public class UseVisitor extends SexpVisitor<Set<String>> {
public static final Set<String> IGNORE = Sets.newHashSet(
"function", "if", "for", "repeat", "while", "break", "return",
"next", "continue", "+", "-", "/", "*", "!", "(", "{",
"$", "[", "[[", "&", "&&", "|", "||", ":",
"<-", "=",
">", ">=", "<", "<=", "==", "!=", "c");
private Set<String> usedFunctions = new HashSet<>();
@Override
public void visit(ExpressionVector vector) {
for (SEXP sexp : vector) {
sexp.accept(this);
}
}
@Override
public Set<String> getResult() {
return usedFunctions;
}
@Override
public void visit(Closure closure) {
closure.getBody().accept(this);
closure.getFormals().accept(this);
}
@Override
public void visit(FunctionCall call) {
maybeIndexUse(call);
call.getFunction().accept(this);
call.getArguments().accept(this);
}
@Override
public void visit(PairList.Node pairList) {
for (PairList.Node node : pairList.nodes()) {
node.getValue().accept(this);
}
}
private void maybeIndexUse(FunctionCall call) {
SEXP function = call.getFunction();
if(function instanceof Symbol) {
String functionName = ((Symbol) function).getPrintName();
if(!IGNORE.contains(functionName)) {
usedFunctions.add(functionName);
}
}
}
}
| [
"[email protected]"
]
| |
a18c9292cac43ffdab9f4630c27de6f28eb36dc7 | f81b3e84a32008ff430defa3c7a3ee877043baad | /PSP/src/cajeras/caj1/Cajeras.java | cf624f1ceca5dd80cf0759040ee186817cd4c25b | []
| no_license | juanra1997/PSP | 4f53a0859a26c59b370e43e5bd3eefa6b429aa4b | 692ca38187d59af851461da6bd2a7ba676e75d00 | refs/heads/master | 2020-03-29T19:03:36.908916 | 2019-03-12T12:26:00 | 2019-03-12T12:26:00 | 150,245,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package cajeras.caj1;
public class Cajeras extends Thread {
private Clientes cli;
public Cajeras (String s) {
super(s);
}
@Override
public void run(){
System.out.println("<<<<<<<<<<<<<<<<< Iniciando Hilo "+getName());
/*int cont=0;
while(cont<20){
dormir(1000);
System.out.println(
}*/
}
public void dormir(long t){
try{
sleep(t);
}catch(InterruptedException e){
System.err.println("Error: "+e.getMessage());
}
}
} | [
"[email protected]"
]
| |
e7d2068085db4c75261abf667c394f1615cf2ea8 | 499697bf14beb9a4377d34c618edc76f786cc014 | /src/io/github/ramizdemiurge/frames/Splashframe.java | 269d843820450d033c5ac301144454945bcab6b9 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
]
| permissive | ramizdemiurge/sne | 76bbc2671ebe4148a5fc6f18c4a622bca9c3ccfc | 0725a5aa6c17ce230a2bdbb9f6dab41eb4eadf91 | refs/heads/master | 2021-01-19T22:47:39.563000 | 2017-05-20T12:37:34 | 2017-05-20T12:37:34 | 46,810,001 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,037 | java | package io.github.ramizdemiurge.frames;
/*
* @author ramizdemiurge :: metamorphosis
* @author Ramiz Abdullayev
* @version 1.3.0.0
* @website https://github.com/ramizdemiurge/sne
*
* Copyright 2015 Ramiz Abdullayev
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import javax.swing.*;
public class Splashframe
{
public static void main(int a)
{
JWindow window = new JWindow();
//Image duduk = new ImageIcon(this.getClass().getResouce("/splash.gif")).getImage();
window.getContentPane().add(new JLabel("", new ImageIcon(Splashframe.class.getResource("/io/github/ramizdemiurge/img/SNE_logo.gif")), SwingConstants.CENTER));
window.setBounds(500, 150, 402, 302);
window.setLocationRelativeTo(null);
window.setAlwaysOnTop(true);
window.setVisible(true);
try
{
Thread.sleep(a);
} catch (InterruptedException e)
{
e.printStackTrace();
}
window.setVisible(false);
/*
JFrame frame = new JFrame();
frame.add(new JLabel("Welcome"));
frame.setVisible(true);
frame.setSize(300,100); */
window.dispose();
MFrame.main(null);
}
public void make(int msec)
{
main(msec);
}
}
| [
"[email protected]"
]
| |
bfc48dd96be27a9899679cb73559aa7f5df88583 | 433952ebe2a4217d8fb184865be2a8a8f003fc21 | /src/main/java/com/api/mock/simulator/responseModels/package-info.java | a0588d7ea9151823080b26ce9953e34b19604450 | []
| no_license | ravivamsi/apisimulator | 681ec24d25cbd1439ee024906afb3edeb456bcb1 | 43e1c0255202d53ec0911a26959dd15ef0ea5cf6 | refs/heads/master | 2020-03-12T08:00:39.189610 | 2018-04-25T03:53:09 | 2018-04-25T03:53:09 | 130,518,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 90 | java | /**
*
*/
/**
* @author vamsiravi
*
*/
package com.api.mock.simulator.responseModels; | [
"[email protected]"
]
| |
7ed2c82932549a5265b988f043acdc71f8d63784 | 3734990cecefbc6e7b45fe8795d3f45fea89f221 | /database/src/test/java/com/example/mu/AppTest.java | 9037a7af2b795f646531d59073a685e4f1c80a54 | []
| no_license | oliversalmon/imcs-demo | 43732279b0192a547b002014b64bc4a004fd2478 | 66f746b2fdb6e98451308ac8ad852a6f834e545f | refs/heads/master | 2021-01-20T07:37:50.604842 | 2019-01-11T11:46:44 | 2019-01-11T11:46:44 | 90,020,587 | 7 | 8 | null | 2019-01-18T17:19:41 | 2017-05-02T10:26:21 | Java | UTF-8 | Java | false | false | 642 | java | package com.example.mu;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"[email protected]"
]
| |
fcf787963cabc0b3fbd7583345a5f5ec979cb495 | 672a48f7fdd9dab4224b3c504e34fed1c170a8f5 | /src/test/tpdifficulty/tp/tpHitObject.java | a1c7fae23823492ba71de1f7efa1fe6e2b5314e6 | [
"Apache-2.0"
]
| permissive | yuki4dev/osu-droid | f1402df178a326705bb8e024c28a0310991c6f13 | 892695ca197cb0a09ab13d9b5fb1951fe65e6f93 | refs/heads/master | 2023-03-14T13:44:36.928214 | 2023-02-24T05:58:09 | 2023-02-24T05:58:09 | 260,174,517 | 0 | 0 | Apache-2.0 | 2020-04-30T09:55:12 | 2020-04-30T09:55:11 | null | UTF-8 | Java | false | false | 7,128 | java | package test.tpdifficulty.tp;
import android.graphics.PointF;
import test.tpdifficulty.hitobject.HitObject;
import test.tpdifficulty.hitobject.HitObjectType;
import test.tpdifficulty.hitobject.Slider;
/**
* Created by Fuuko on 2015/5/30.
*/
public class tpHitObject implements Comparable<tpHitObject> {
// Factor by how much speed / aim strain decays per second. Those values are results of tweaking a lot and taking into account general feedback.
public static double[] DECAY_BASE = {0.3, 0.15}; // Opinionated observation: Speed is easier to maintain than accurate jumps.
private static double ALMOST_DIAMETER = 90; // Almost the normed diameter of a circle (104 osu pixel). That is -after- position transforming.
// Pseudo threshold values to distinguish between "singles" and "streams". Of course the border can not be defined clearly, therefore the algorithm
// has a smooth transition between those values. They also are based on tweaking and general feedback.
private static double STREAM_SPACING_TRESHOLD = 110;
private static double SINGLE_SPACING_TRESHOLD = 125;
// Scaling values for weightings to keep aim and speed difficulty in balance. Found from testing a very large map pool (containing all ranked maps) and keeping the
// average values the same.
private static double[] SPACING_WEIGHT_SCALING = {1400, 26.25};
// In milliseconds. The smaller the value, the more accurate sliders are approximated. 0 leads to an infinite loop, so use something bigger.
private static int LAZY_SLIDER_STEP_LENGTH = 1;
public HitObject BaseHitObject;
public double[] Strains = {1, 1};
private PointF NormalizedStartPosition;
private PointF NormalizedEndPosition;
private float LazySliderLengthFirst = 0;
private float LazySliderLengthSubsequent = 0;
public tpHitObject(HitObject BaseHitObject, float CircleRadius) {
this.BaseHitObject = BaseHitObject;
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
float ScalingFactor = (52.0f / CircleRadius);
NormalizedStartPosition = new PointF(BaseHitObject.getPos().x * ScalingFactor, BaseHitObject.getPos().y * ScalingFactor);
if (BaseHitObject.getType() == HitObjectType.Slider) {
PointF endPos = ((Slider) BaseHitObject).getPoss().get(((Slider) BaseHitObject).getPoss().size() - 1);
NormalizedEndPosition = new PointF(endPos.x * ScalingFactor, endPos.y * ScalingFactor);
} else {
NormalizedEndPosition = new PointF(BaseHitObject.getPos().x * ScalingFactor, BaseHitObject.getPos().y * ScalingFactor);
}
}
// Caution: The subjective values are strong with this one
private static double SpacingWeight(double distance, DifficultyType Type) {
switch (Type) {
case Speed:
{
double Weight;
if (distance > SINGLE_SPACING_TRESHOLD) {
Weight = 2.5;
} else if (distance > STREAM_SPACING_TRESHOLD) {
Weight = 1.6 + 0.9 * (distance - STREAM_SPACING_TRESHOLD) / (SINGLE_SPACING_TRESHOLD - STREAM_SPACING_TRESHOLD);
} else if (distance > ALMOST_DIAMETER) {
Weight = 1.2 + 0.4 * (distance - ALMOST_DIAMETER) / (STREAM_SPACING_TRESHOLD - ALMOST_DIAMETER);
} else if (distance > ALMOST_DIAMETER / 2) {
Weight = 0.95 + 0.25 * (distance - (ALMOST_DIAMETER / 2)) / (ALMOST_DIAMETER / 2);
} else {
Weight = 0.95;
}
return Weight;
}
case Aim:
return Math.pow(distance, 0.99);
// Should never happen.
default:
return 0;
}
}
public void CalculateStrains(tpHitObject PreviousHitObject) {
CalculateSpecificStrain(PreviousHitObject, DifficultyType.Speed);
CalculateSpecificStrain(PreviousHitObject, DifficultyType.Aim);
}
private void CalculateSpecificStrain(tpHitObject PreviousHitObject, DifficultyType Type) {
double Addition = 0;
double TimeElapsed = BaseHitObject.getStartTime() - PreviousHitObject.BaseHitObject.getStartTime();
double Decay = Math.pow(DECAY_BASE[Type.value()], TimeElapsed / 1000);
if (BaseHitObject.getType() == HitObjectType.Spinner) {
// Do nothing for spinners
} else if (BaseHitObject.getType() == HitObjectType.Slider) {
switch (Type) {
case Speed:
// For speed strain we treat the whole slider as a single spacing entity, since "Speed" is about how hard it is to click buttons fast.
// The spacing weight exists to differentiate between being able to easily alternate or having to single.
Addition =
SpacingWeight(PreviousHitObject.LazySliderLengthFirst +
PreviousHitObject.LazySliderLengthSubsequent * PreviousHitObject.BaseHitObject.getRepeat() +
DistanceTo(PreviousHitObject), Type) *
SPACING_WEIGHT_SCALING[Type.value()];
break;
case Aim:
// For Aim strain we treat each slider segment and the jump after the end of the slider as separate jumps, since movement-wise there is no difference
// to multiple jumps.
Addition =
(
SpacingWeight(PreviousHitObject.LazySliderLengthFirst, Type) +
SpacingWeight(PreviousHitObject.LazySliderLengthSubsequent, Type) * PreviousHitObject.BaseHitObject.getRepeat() +
SpacingWeight(DistanceTo(PreviousHitObject), Type)
) *
SPACING_WEIGHT_SCALING[Type.value()];
break;
}
} else if (BaseHitObject.getType() == HitObjectType.Normal) {
Addition = SpacingWeight(DistanceTo(PreviousHitObject), Type) * SPACING_WEIGHT_SCALING[Type.value()];
}
// Scale addition by the time, that elapsed. Filter out HitObjects that are too close to be played anyway to avoid crazy values by division through close to zero.
// You will never find maps that require this amongst ranked maps.
Addition /= Math.max(TimeElapsed, 50);
Strains[Type.value()] = PreviousHitObject.Strains[Type.value()] * Decay + Addition;
}
public double DistanceTo(tpHitObject other) {
// Scale the distance by circle size.
return Math.sqrt(Math.pow((NormalizedStartPosition.x - other.NormalizedEndPosition.x), 2) +
Math.pow((NormalizedStartPosition.y - other.NormalizedEndPosition.y), 2));
}
public int compareTo(tpHitObject o1) {
return this.BaseHitObject.getStartTime() - o1.BaseHitObject.getStartTime();
}
}
| [
"[email protected]"
]
| |
035007da3f8d03c84bddd4d07932b6ecaf48e2d3 | 732863b9b59e125172d7a1bec0f3f36674d61e15 | /src/main/java/com/techmaster/sparrow/imports/extraction/ExcelExtractorUtil.java | 77c5cbb0c3c55095547592dc04ab96342fc71040 | []
| no_license | hillangat/sparrow | e5f74b943f3db0820b9639892845e329deea3cbe | a09f794988bdcd46598edde9a84907d5d37ddbce | refs/heads/master | 2020-04-08T06:01:44.528453 | 2018-12-11T04:40:51 | 2018-12-11T04:40:51 | 159,065,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,760 | java | package com.techmaster.sparrow.imports.extraction;
import com.techmaster.sparrow.util.SparrowUtil;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
public class ExcelExtractorUtil {
private static final Logger logger = LoggerFactory.getLogger(ExcelExtractorUtil.class);
// private extractor
private ExcelExtractorUtil() {
super();
}
private static ExcelExtractorUtil extractorUtil = null;
static {
if(extractorUtil == null){
synchronized (ExcelExtractorUtil.class) {
extractorUtil = new ExcelExtractorUtil();
}
}
}
public static ExcelExtractorUtil getInstance(){
return extractorUtil;
}
public static List<String> validateSheets(List<String> sheets, Workbook workbook){
List<String> messages = new ArrayList<>();
for(String sheetName : sheets){
Sheet sheet = workbook.getSheet(sheetName);
if(sheet == null){
messages.add("Sheet '" + sheetName + "' does not exist!");
}
}
return messages;
}
public int getLastRowNumber(String sheetName, Workbook workbook){
if(sheetName == null) throw new IllegalArgumentException("Sheet name provided is null >> " + sheetName);
Sheet sheet =workbook.getSheet(sheetName);
int lastRow = sheet.getLastRowNum();
logger.debug("Obtained the last row number (" + lastRow + ") from the sheet >> " + sheetName);
return lastRow;
}
public Row getLastRow(String sheetName, Workbook workbook){
Sheet sheet = workbook.getSheet(sheetName);
int lastRowNum = getLastRowNumber(sheetName, workbook);
Row row = sheet.getRow(lastRowNum);
return row;
}
public static Cell getLastCell(int rowNum, Sheet sheet){
Row row = sheet.getRow(rowNum);
int cellNum = 0;
if(row != null){
Iterator<Cell> cellItr = row.cellIterator();
while(cellItr.hasNext())
cellNum++;
}else{
throw new IllegalArgumentException("No row found of the row number given in the sheet passed in.");
}
Cell cell = row.getCell(cellNum);
return cell;
}
public static Cell getLastCell(Row row){
int cellNum = 0;
if(row != null){
Iterator<Cell> cellItr = row.cellIterator();
while(cellItr.hasNext())
cellNum++;
}
Cell cell = row.getCell(cellNum);
return cell;
}
public String[] extractHeaders(String sheetName, Workbook workbook) {
Sheet sheet = workbook.getSheet(sheetName);
Row headerRow = sheet.getRow(0);
String[] headers = new String[0];
int lastRow = headerRow.getLastCellNum();
for(int i=0; i<lastRow ; i++){
Cell header = headerRow.getCell(i);
if(header == null){
logger.info("header is null. i=(" + i + ")" );
}
String name = header.getStringCellValue();
name = name == null ? null : name.trim();
headers = SparrowUtil.initArrayAndInsert(headers, name);
}
return headers;
}
public String[] validateHeaders(String[] inputHeaders, String[] validHeaders) {
if(inputHeaders == null || inputHeaders.length < 1 || validHeaders == null || validHeaders.length < 1)
throw new IllegalArgumentException("Either headers in the sheet >> " + inputHeaders + " or Headers with which to validate >> " + validHeaders);
String[] errors = new String[0];
for(String validHeader : validHeaders){
boolean isFound = false;
for(String input : inputHeaders){
if(input.equalsIgnoreCase(validHeader)){
isFound = true;
break;
}
}
if(!isFound){
errors = SparrowUtil.initArrayAndInsert(errors, validHeader);
}
}
return errors;
}
public Object getCellValue(Cell cell) {
XSSFCell hcell = (XSSFCell)cell;
Object obj = null;
if(cell != null){
int type = hcell.getCellType();
if(type== HSSFCell.CELL_TYPE_STRING){
obj = hcell.getStringCellValue();
}else if(type== HSSFCell.CELL_TYPE_NUMERIC){
obj = hcell.getNumericCellValue();
}else if(type== HSSFCell.CELL_TYPE_BOOLEAN){
obj = hcell.getBooleanCellValue();
}else if(type== HSSFCell.CELL_TYPE_ERROR){
obj = hcell.getErrorCellValue();
}else if(type== HSSFCell.CELL_TYPE_BLANK){
obj = "";
}
}
return obj;
}
public void writeCell(Object object, Cell cell) {
if(cell != null){
/*
if(object == null){
String obj = null;
cell.setCellValue(obj);
}else
*/
if(object instanceof Long){
Long lng = (Long)object;
Double doubleValue = lng.doubleValue();
cell.setCellValue(doubleValue);
}else if(object instanceof Double){
Double doubleVal = (Double)object;
cell.setCellValue(doubleVal);
}else if(object instanceof String){
String strVal = String.valueOf(object);
cell.setCellValue(strVal);
}else if(object instanceof Integer){
Integer integer = (Integer)object;
Double doubleVal = Double.parseDouble(String.valueOf(integer));
cell.setCellValue(doubleVal);
}else if(object instanceof java.util.Date || object instanceof java.sql.Date){
java.util.Date jDate = null;
if(object instanceof java.sql.Date){
java.sql.Date sDate = (java.sql.Date)object;
Long time = sDate.getTime();
jDate = new java.util.Date(time);
}else{
jDate = (java.util.Date)object;
}
cell.setCellValue(jDate);
}else if(object instanceof Calendar ){
Calendar calendar = (Calendar)object;
cell.setCellValue(calendar);
}else if(object instanceof RichTextString){
RichTextString rTxtStr = (RichTextString) object;
cell.setCellValue(rTxtStr);
}else if(object instanceof Boolean ){
Boolean boolean_ = (Boolean)object;
cell.setCellValue(boolean_);
}
}
}
}
| [
"[email protected]"
]
| |
21be0056840dfcea46d83a748beae0d19c979005 | 1a1eaec5c892025a1d475d702ed16560de8ed2d9 | /petshow-core/src/main/java/br/com/petshow/role/ComEventoRole.java | 56b54cc395e4fdd6a23dadbe07621965015aff5d | []
| no_license | petsoftware/PETSHOW-CORE | ed641cdc3a1274a9831b2f9e681f24e987c051dd | 92519035e8f7aaa5481e0680da9b95497d329101 | refs/heads/master | 2021-01-12T06:55:41.642865 | 2020-05-15T14:21:21 | 2020-05-15T14:21:21 | 76,862,485 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,120 | java | package br.com.petshow.role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.petshow.dao.ComEventoDAO;
import br.com.petshow.exceptions.ExceptionNotFoundRecord;
import br.com.petshow.exceptions.ExceptionValidation;
import br.com.petshow.model.ComCheckInPetshop;
import br.com.petshow.model.ComEvento;
/**
*
* @author antoniorafael
*
*/
@Service
public class ComEventoRole extends SuperClassRole<ComEvento> {
@Autowired
private ComEventoDAO comEventoDAO;
public ComEvento insert(ComEvento entidade) throws ExceptionValidation{
return (ComEvento) this.comEventoDAO.insert(entidade);
}
public void delete(long codigo) throws ExceptionValidation,ExceptionNotFoundRecord {
this.comEventoDAO.delete(codigo);
}
public ComEvento update(ComEvento entidade) throws ExceptionValidation{
return (ComEvento) this.comEventoDAO.update(entidade);
}
public ComEvento find(long codigo) throws ExceptionValidation {
return this.comEventoDAO.find(codigo);
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.