blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3b45517cc7a8667efd86359a7f5c4bc515f81942 | 824d1cec99bc702561fff297013d04282e5c9f14 | /src/test/java/com/fw/springboot03webrestfulcrud/Springboot03WebRestfulcrudApplicationTests.java | 507ba43b00678131e5582cde3ac60bc1f123aac6 | [] | no_license | fw666/springboot | 5b693ef2e31e0c54acf1416d7cd9af06ab1f57c0 | 3de051f846e21f5c31303fd1bd1279978820bca6 | refs/heads/master | 2020-09-20T21:53:09.342347 | 2019-11-28T08:10:12 | 2019-11-28T08:10:12 | 224,599,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 254 | java | package com.fw.springboot03webrestfulcrud;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Springboot03WebRestfulcrudApplicationTests {
@Test
void contextLoads() {
}
}
| [
"3027569786@qq.com"
] | 3027569786@qq.com |
9c7b0d269b627749a3a3a17fb1726f4cf4fda5b2 | c7b61e13ecaf0529bf3a508523b72c52f7a676e4 | /src/com/pangu/neusoft/tools/StringMethods.java | e13a5b8c92fbec6cd04496d36a63a966a9b72d09 | [] | no_license | locrch/Healthe_chinanet | 0626d787c20ef10e4f0fc219ee9fd0331d48adc3 | a71c4bda012d5a9c770d6f5fac93f2ea8707a727 | refs/heads/master | 2021-01-01T06:05:11.101604 | 2014-03-20T09:31:24 | 2014-03-20T09:31:24 | 18,097,663 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,267 | java | package com.pangu.neusoft.tools;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringMethods {
public static boolean isMobileNO(String mobiles){
Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$");
Matcher m = p.matcher(mobiles);
return m.matches();
}
public static List<Map<String,String>> getPhone(String data){
boolean rs=false;
//((\\d+)-(\\d+))+
String sp="";
Pattern p;
Matcher m;
int i=0;
String regEx3=";|\\s|,";
p=Pattern.compile(regEx3);
String[] r=p.split(data);
List<Map<String,String>> res=new ArrayList<Map<String,String>>();
for(i=0;i<r.length;i++){
p = Pattern.compile("([\\D&&[^\\(\\(]]*)[\\(|\\(]?(\\d*)[\\)|\\)]?[- -]?(\\d+)");
m = p.matcher(r[i]);
while (m.find()) {
Map<String,String> map=new HashMap<String,String>();
// System.out.println(m.group(1));
map.put(m.group(1), m.group(2)+m.group(3));
res.add(map);
}
}
return res;
}
}
| [
"402290527@qq.com"
] | 402290527@qq.com |
8d7dccbf079a99af8e70c40ff1b1f88e7fd27bde | 9b40f5fe31246574942099d66f9f100b65bbdcd9 | /app/src/main/java/com/xgkj/ilive/activity/IndustryActivity.java | 31b2fde7ec4c14f63975ff3dbd2f8f7a9027f9b5 | [] | no_license | liuclub/FixBug_IL | 2891ed0764ca5cbdba47b244b06dc209c041ce8f | 55b9ae1c006e93651c1bf48f4e1495f193b8c82e | refs/heads/master | 2021-09-22T09:32:31.842554 | 2018-09-07T09:28:25 | 2018-09-07T09:28:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,370 | java | package com.xgkj.ilive.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import com.umeng.analytics.MobclickAgent;
import com.xgkj.ilive.R;
import com.xgkj.ilive.adapter.IndustryAdapter;
import com.xgkj.ilive.base.BaseActivity;
import com.xgkj.ilive.mvp.contract.IndustryContract;
import com.xgkj.ilive.mvp.model.IndustryModel;
import com.xgkj.ilive.mvp.presenter.IndustryPresenter;
import com.xgkj.ilive.view.DividerItemDecoration;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
public class IndustryActivity extends BaseActivity implements IndustryContract.View{
@BindView(R.id.industry_list)
RecyclerView industry_list;
@BindView(R.id.industry_back)
ImageView industry_back;
@Override
protected int getLayoutId() {
return R.layout.activity_industry;
}
@Override
protected void init(Bundle savedInstanceState) {
MobclickAgent.setCatchUncaughtExceptions(true);
IndustryPresenter industryPresenter = new IndustryPresenter(this);
industryPresenter.getIndustryList();
}
@OnClick({R.id.industry_back})
public void onClick(View view){
switch (view.getId()){
case R.id.industry_back:
onBackPressed();
break;
}
}
@Override
public void getIndustryFinish(List<IndustryModel.APIDATABean.ListBean> list) {
industry_list.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));
industry_list.addItemDecoration(new DividerItemDecoration(this));
IndustryAdapter industryAdapter = new IndustryAdapter();
industryAdapter.setData(this,list);
industry_list.setAdapter(industryAdapter);
}
public void setIndustry(String id, String title) {
Intent intent = new Intent();
intent.putExtra("id",id);
intent.putExtra("title",title);
setResult(3,intent);
finish();
}
@Override
protected void onPause() {
super.onPause();
MobclickAgent.onPause(this);
}
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onResume(this);
}
}
| [
"liubo0000001"
] | liubo0000001 |
5daa4c918c54c6cde0ffbdf76068b677e7d74f51 | c7ef134002ea58ee9844efe9ef25d3b18cbb4621 | /app/src/main/java/com/example/fluxitdesafio/dao/RandomDao.java | 77898b72a08202df10433a839abd422f6437e944 | [] | no_license | EzeLuna88/FluxItDesafio | c6074a4690e33026aba3a4c85127562273b3b872 | 9e08044bf527ff5993392ff7a3d446feab804a45 | refs/heads/master | 2020-09-12T01:17:25.177492 | 2019-11-19T19:08:00 | 2019-11-19T19:08:00 | 222,253,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,440 | java | package com.example.fluxitdesafio.dao;
import com.example.fluxitdesafio.model.ResultUser;
import com.example.fluxitdesafio.service.RandomService;
import com.example.fluxitdesafio.utils.ResultListener;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class RandomDao {
public static final String BASE_URL = "https://randomuser.me/api/";
private Retrofit retrofit;
private RandomService randomService;
public RandomDao() {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
randomService = retrofit.create(RandomService.class);
}
public void getUsers(String seed, final ResultListener<ResultUser> controllerListener, Integer page) {
Call<ResultUser> call = randomService.getResults(seed, page);
call.enqueue(new Callback<ResultUser>() {
@Override
public void onResponse(Call<ResultUser> call, Response<ResultUser> response) {
ResultUser resultUser = response.body();
controllerListener.onFinish(resultUser);
}
@Override
public void onFailure(Call<ResultUser> call, Throwable t) {
t.printStackTrace();
}
});
}
}
| [
"ezequiel.luna1988@gmail.com"
] | ezequiel.luna1988@gmail.com |
39f9a7ce99acf0fd213943d2241a86a35c4b0a9c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_cf96a78fdc2dc728dc14916ed5d3488bf499268a/MainActivity/13_cf96a78fdc2dc728dc14916ed5d3488bf499268a_MainActivity_s.java | 89f51ed71adaedec62e414e7199c76fb5264a221 | [] | 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 | 29,382 | java | package de.fhb.mi.paperfly;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.SearchManager;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import de.fhb.mi.paperfly.auth.AuthHelper;
import de.fhb.mi.paperfly.auth.LoginActivity;
import de.fhb.mi.paperfly.chat.ChatFragment;
import de.fhb.mi.paperfly.dto.AccountDTO;
import de.fhb.mi.paperfly.navigation.NavItemModel;
import de.fhb.mi.paperfly.navigation.NavKey;
import de.fhb.mi.paperfly.navigation.NavListAdapter;
import de.fhb.mi.paperfly.navigation.NavListAdapter.ViewHolder;
import de.fhb.mi.paperfly.service.RestConsumerException;
import de.fhb.mi.paperfly.service.RestConsumerSingleton;
import de.fhb.mi.paperfly.user.FriendListFragment;
import de.fhb.mi.paperfly.user.UserProfileFragment;
import de.fhb.mi.paperfly.user.UserSearchActivity;
/**
* The Activity with the navigation and some Fragments.
*
* @author Christoph Ott
* @author Andy Klay klay@fh-brandenburg.de
*/
public class MainActivity extends Activity {
private static final String TAG = MainActivity.class.getSimpleName();
private static final String TITLE_LEFT_DRAWER = "Navigation";
private static final String TITLE_RIGHT_DRAWER = "Status";
private static final int REQUESTCODE_QRSCAN = 100;
public static final int REQUESTCODE_SEARCH_USER = 101;
private DrawerLayout drawerLayout;
private ListView drawerRightList;
private ListView drawerLeftList;
private List<String> drawerRightValues;
private ActionBarDrawerToggle drawerToggle;
private CharSequence mTitle;
private UserLoginTask mAuthTask = null;
private UserLogoutTask mLogoutTask = null;
private View progressLayout;
private boolean roomAdded = false;
private int roomNavID;
private String actualRoom;
private GetAccountsInRoomTask mGetAccountsInRoomTask = null;
private List<AccountDTO> usersInRoom = null;
private boolean appStarted = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate");
setContentView(R.layout.activity_main);
initViewsById();
// DUMMY DATA
drawerRightValues = new ArrayList<String>();
// for (int i = 0; i < 50; i++) {
// drawerRightValues.add("User" + i + TITLE_RIGHT_DRAWER);
// }
//fill accounts in room, standard is global
mTitle = getTitle();
drawerToggle = createActionBarDrawerToggle();
// Set the drawer toggle as the DrawerListener
drawerLayout.setDrawerListener(drawerToggle);
// enable ActionBar app icon to behave as action to toggle nav drawer
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
// Set the adapter for the list view
drawerRightList.setAdapter(new ArrayAdapter<String>(this,
R.layout.drawer_list_item, drawerRightValues));
// Set the list's click listener
drawerRightList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
openUserProfile(drawerRightList.getItemAtPosition(position).toString(), false);
drawerLayout.closeDrawers();
}
});
// Set the list's click listener
drawerLeftList.setOnItemClickListener(new DrawerItemClickListener());
generateNavigation();
// navigateTo(NavKey.GLOBAL);
}
@Override
protected void onNewIntent(Intent intent) {
Log.d(TAG, "onNewIntent");
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
// manually launch the real search activity
final Intent searchIntent = new Intent(getApplicationContext(), UserSearchActivity.class);
// add query to the Intent Extras
searchIntent.putExtra(SearchManager.QUERY, query);
searchIntent.setAction(Intent.ACTION_SEARCH);
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
startActivityForResult(searchIntent, REQUESTCODE_SEARCH_USER);
}
}
@Override
protected void onStart() {
super.onStart();
Log.d(TAG, "onStart");
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
boolean loginSuccessful = getIntent().getExtras().getBoolean(LoginActivity.LOGIN_SUCCESFUL);
if (!loginSuccessful) {
showProgress(true);
bundle.clear();
mAuthTask = new UserLoginTask();
mAuthTask.execute();
} else if (!appStarted) {
// if the app was started select GlobalChat
} else if (!appStarted) {
// if the app was started select GlobalChat
navigateTo(NavKey.GLOBAL);
// // TODO select global
//fill accounts in room, standard is global
// mGetAccountsInRoomTask = new GetAccountsInRoomTask();
// mGetAccountsInRoomTask.execute();
appStarted = true;
// TODO select global
appStarted = true;
// TODO select global
}
} else {
showProgress(true);
mAuthTask = new UserLoginTask();
mAuthTask.execute();
}
}
/**
* Shows the progress UI and hides the login form.
*
* @param show true if the progress UI should be shown, false if not
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
int shortAnimTime = getResources().getInteger(android.R.integer.config_longAnimTime);
progressLayout.setVisibility(View.VISIBLE);
progressLayout.animate()
.setDuration(shortAnimTime)
.alpha(show ? 1 : 0)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
progressLayout.setVisibility(show ? View.VISIBLE : View.GONE);
}
});
drawerLayout.setVisibility(View.VISIBLE);
drawerLayout.animate()
.setDuration(shortAnimTime)
.alpha(show ? 0 : 1)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
drawerLayout.setVisibility(show ? View.GONE : View.VISIBLE);
}
});
} else {
// The ViewPropertyAnimator APIs are not available, so simply show
// and hide the relevant UI components.
progressLayout.setVisibility(show ? View.VISIBLE : View.GONE);
drawerLayout.setVisibility(show ? View.GONE : View.VISIBLE);
}
}
/**
* Generates the NavigationList on the left side.
*/
private void generateNavigation() {
Log.d(TAG, "generateNavigation");
NavListAdapter mAdapter = new NavListAdapter(this);
mAdapter.addHeader(this.getResources().getString(R.string.nav_header_general));
mAdapter.addItem(NavKey.MY_ACCOUNT, this.getResources().getString(R.string.nav_item_my_account), R.drawable.ic_action_person);
mAdapter.addItem(NavKey.CHECK_PRESENCE, this.getResources().getString(R.string.nav_item_check_presence), -1);
mAdapter.addItem(NavKey.FRIENDLIST, this.getResources().getString(R.string.nav_item_open_friendlist), android.R.drawable.ic_menu_share);
mAdapter.addHeader(this.getResources().getString(R.string.nav_header_chats));
mAdapter.addItem(NavKey.GLOBAL, this.getResources().getString(R.string.nav_item_global), -1);
mAdapter.addItem(NavKey.ENTER_ROOM, this.getResources().getString(R.string.nav_item_enter_room), android.R.drawable.ic_menu_camera);
drawerLeftList.setAdapter(mAdapter);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Log.d(TAG, "onCreateOptionsMenu");
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return super.onCreateOptionsMenu(menu);
}
// @Override
// public void onResume(){
// super.onResume();
//
// if (((PaperFlyApp) getApplication()).getCurrentChatRoomID() != null) {
// mGetAccountsInRoomTask = new GetAccountsInRoomTask();
// mGetAccountsInRoomTask.execute();
// }
// }
/**
* Initializes all views in the layout.
*/
private void initViewsById() {
Log.d(TAG, "initViewsById");
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
progressLayout = findViewById(R.id.login_status);
drawerRightList = (ListView) findViewById(R.id.right_drawer);
drawerLeftList = (ListView) findViewById(R.id.left_drawer);
}
/**
* Creates a {@link android.support.v4.app.ActionBarDrawerToggle} which can show the navigation.
*
* @return the ActionBarDrawerToggle
*/
private ActionBarDrawerToggle createActionBarDrawerToggle() {
Log.d(TAG, "createActionBarDrawerToggle");
return new ActionBarDrawerToggle(this, drawerLayout,
R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item != null && item.getItemId() == android.R.id.home && drawerToggle.isDrawerIndicatorEnabled()) {
openDrawerAndCloseOther(Gravity.LEFT);
return true;
} else {
return false;
}
}
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
setTitle(mTitle);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
if (drawerLayout.isDrawerOpen(Gravity.RIGHT)) {
getActionBar().setTitle(TITLE_RIGHT_DRAWER);
// this.changeDrawerRight();
}
if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
getActionBar().setTitle(TITLE_LEFT_DRAWER);
}
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
/**
* change values in drawer right, set actual users in room
*/
private void changeDrawerRight() {
drawerRightValues.clear();
List<AccountDTO> usersInRoom = ((PaperFlyApp) getApplication()).getUsersInRoom();
for (AccountDTO current : usersInRoom) {
drawerRightValues.add(current.getUsername());
}
}
};
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
drawerToggle.syncState();
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
Log.d(TAG, "onRestoreInstanceState");
super.onRestoreInstanceState(savedInstanceState);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
Log.d(TAG, "onSaveInstanceState");
super.onSaveInstanceState(outState);
}
@Override
public void onAttachFragment(Fragment fragment) {
Log.d(TAG, "onAttachFragment");
super.onAttachFragment(fragment);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
Log.d(TAG, "onRestoreInstanceState");
super.onConfigurationChanged(newConfig);
drawerToggle.onConfigurationChanged(newConfig);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.d(TAG, "onOptionsItemSelected");
switch (item.getItemId()) {
case android.R.id.home:
drawerToggle.onOptionsItemSelected(item);
return true;
case R.id.action_websockettest:
Intent intent = new Intent(this, WebSocketTestMainActivity.class);
startActivity(intent);
return true;
case R.id.action_settings:
startActivity(new Intent(this, SettingsActivity.class));
return true;
case R.id.action_help:
startActivity(new Intent(this, HelpActivity.class));
return true;
case R.id.action_logout:
deleteFile(AuthHelper.FILE_NAME);
mLogoutTask = new UserLogoutTask();
mLogoutTask.execute();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
/**
* Opens the specified drawer and closes the other one, if it is visible
*
* @param drawerGravity the drawer to be opened
*/
private void openDrawerAndCloseOther(int drawerGravity) {
Log.d(TAG, "openDrawerAndCloseOther");
switch (drawerGravity) {
case Gravity.LEFT:
if (drawerLayout.isDrawerVisible(Gravity.LEFT)) {
drawerLayout.closeDrawer(Gravity.LEFT);
} else if (drawerLayout.isDrawerVisible(Gravity.RIGHT)) {
drawerLayout.closeDrawer(Gravity.RIGHT);
drawerLayout.openDrawer(Gravity.LEFT);
} else {
drawerLayout.openDrawer(Gravity.LEFT);
}
break;
case Gravity.RIGHT:
if (drawerLayout.isDrawerVisible(Gravity.RIGHT)) {
drawerLayout.closeDrawer(Gravity.RIGHT);
} else if (drawerLayout.isDrawerVisible(Gravity.LEFT)) {
drawerLayout.closeDrawer(Gravity.LEFT);
drawerLayout.openDrawer(Gravity.RIGHT);
} else {
drawerLayout.openDrawer(Gravity.RIGHT);
}
break;
}
}
/**
* Opens a new Intent for QR scan.
*
* @return true if the scan was successful, false if not
*/
private boolean doQRScan() {
Log.d(TAG, "doQRScan");
PackageManager pm = this.getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
try {
startActivityForResult(intent, REQUESTCODE_QRSCAN);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, "You have no QR Scanner", Toast.LENGTH_LONG).show();
Log.e(TAG, e.getMessage(), e);
}
return true;
} else {
Toast.makeText(this, "There is no camera for this device.", Toast.LENGTH_SHORT).show();
return false;
}
}
/**
* Creates a new Fragment for FriendList.
*
* @return true if the fragment is shown
*/
private boolean openFriendList() {
Log.d(TAG, "openFriendList");
FragmentManager fragmentManager = getFragmentManager();
Fragment fragmentByTag = fragmentManager.findFragmentByTag(FriendListFragment.TAG);
if (fragmentByTag == null) {
Fragment fragment = new FriendListFragment();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, fragment, FriendListFragment.TAG)
.commit();
} else {
fragmentManager.beginTransaction()
.attach(fragmentByTag)
.commit();
}
return true;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch (requestCode) {
case REQUESTCODE_SEARCH_USER:
Log.d(TAG, "onActivityResult: REQUESTCODE_SEARCH_USER");
if (resultCode == RESULT_OK) {
String user = intent.getStringExtra(UserProfileFragment.ARGS_USER);
openUserProfile(user, false);
}
break;
case REQUESTCODE_QRSCAN:
Log.d(TAG, "onActivityResult: REQUESTCODE_QRSCAN");
if (resultCode == RESULT_OK) {
String room = intent.getStringExtra("SCAN_RESULT");
//TODO gucken ob Raum existiert via. Restconsumer
((PaperFlyApp) getApplication()).setCurrentChatRoomID(room);
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
switchToNewChatRoom(room);
Toast.makeText(this, room, Toast.LENGTH_SHORT).show();
} else if (resultCode == RESULT_CANCELED) {
Toast.makeText(this, "Cancel", Toast.LENGTH_SHORT).show();
}
break;
}
}
/**
* Opens a new fragment for the given chat.
*
* @param room the room to open
*/
private void switchToNewChatRoom(String room) {
FragmentManager fragmentManager = getFragmentManager();
Fragment fragmentByTag = fragmentManager.findFragmentByTag(ChatFragment.TAG_ROOM);
Fragment newFragment = new ChatFragment();
Bundle args = new Bundle();
args.putString(ChatFragment.ARG_CHAT_ROOM, room);
newFragment.setArguments(args);
// if (fragmentByTag == null) {
// Insert the fragment by replacing any existing fragment
fragmentManager.beginTransaction()
.replace(R.id.content_frame, newFragment, ChatFragment.TAG_ROOM)
.commit();
NavListAdapter adapter = (NavListAdapter) drawerLeftList.getAdapter();
if (!roomAdded) {
roomNavID = drawerLeftList.getCheckedItemPosition();
// change navigation drawer
NavItemModel enterRoomNav = adapter.getItem(roomNavID);
enterRoomNav.setKey(NavKey.ROOM);
enterRoomNav.setTitle(room);
enterRoomNav.setIconID(-1);
adapter.addItem(NavKey.ENTER_ROOM, this.getResources().getString(R.string.nav_item_enter_room), android.R.drawable.ic_menu_camera);
drawerLeftList.setAdapter(adapter);
roomAdded = true;
} else {
NavItemModel enterRoomNav = adapter.getItem(roomNavID);
enterRoomNav.setKey(NavKey.ROOM);
enterRoomNav.setTitle(room);
enterRoomNav.setIconID(-1);
adapter.notifyDataSetChanged();
}
actualRoom = room;
// } else {
// // there already was a room selected, that's why there is no need to add a new navItem
// // but remove the old fragment
// fragmentManager.beginTransaction()
// .remove(fragmentByTag)
// .replace(R.id.content_frame, newFragment, ChatFragment.TAG_ROOM)
// .commit();
// }
}
/**
* Switch to the chat room which was earlier selected
*/
private void switchToChatRoom() {
FragmentManager fragmentManager = getFragmentManager();
Fragment fragment = fragmentManager.findFragmentByTag(ChatFragment.TAG);
// Attach fragment that was previously attached
if (fragment != null) {
fragmentManager.beginTransaction()
.attach(fragment)
.commit();
} else {
Fragment newFragment = new ChatFragment();
Bundle args = new Bundle();
args.putString(ChatFragment.ARG_CHAT_ROOM, actualRoom);
newFragment.setArguments(args);
// if (fragmentByTag == null) {
// Insert the fragment by replacing any existing fragment
fragmentManager.beginTransaction()
.replace(R.id.content_frame, newFragment, ChatFragment.TAG_ROOM)
.commit();
}
}
/**
* Opens the global chat in a new fragment.
*/
private void switchToGlobalChat() {
FragmentManager fragmentManager = getFragmentManager();
Fragment fragmentByTag = fragmentManager.findFragmentByTag(ChatFragment.TAG_GLOBAL);
if (fragmentByTag == null) {
Fragment fragment = new ChatFragment();
Bundle args = new Bundle();
args.putString(ChatFragment.ARG_CHAT_ROOM, ChatFragment.ROOM_GLOBAL);
fragment.setArguments(args);
// Insert the fragment by replacing any existing fragment
fragmentManager.beginTransaction()
.replace(R.id.content_frame, fragment, ChatFragment.TAG_GLOBAL)
.commit();
} else {
// attach fragment that was previously attached
fragmentManager.beginTransaction()
.attach(fragmentByTag)
.commit();
}
}
/**
* Swaps fragments in the main content view.
*
* @param navkey the navigation key
*/
private void navigateTo(NavKey navkey) {
Log.d(TAG, "navigateTo: " + navkey);
switch (navkey) {
case ROOM:
switchToChatRoom();
break;
case ENTER_ROOM:
doQRScan();
break;
case GLOBAL:
switchToGlobalChat();
break;
case MY_ACCOUNT:
openUserProfile(((PaperFlyApp) getApplication()).getAccount().getUsername(), true);
break;
case CHECK_PRESENCE:
new InfoDialog().show(getFragmentManager(), TAG);
checkPresence();
break;
case FRIENDLIST:
openFriendList();
break;
}
drawerLayout.closeDrawer(Gravity.LEFT);
}
private void checkPresence() {
mGetAccountsInRoomTask = new GetAccountsInRoomTask();
mGetAccountsInRoomTask.execute();
//Daten umwandeln in String
StringBuilder output = new StringBuilder();
ArrayList<AccountDTO> usersInRoom = new ArrayList<AccountDTO>();
usersInRoom.add(((PaperFlyApp) getApplication()).getAccount());
for (AccountDTO current : usersInRoom) {
output.append(current.getFirstName() + " " + current.getLastName() + "\n");
}
//Daten weiterleiten an andere App
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"some@email.address"});
intent.putExtra(Intent.EXTRA_SUBJECT, "Attendance in room " + ((PaperFlyApp) getApplication()).getCurrentChatRoomID());
intent.putExtra(Intent.EXTRA_TEXT, output.toString());
startActivity(Intent.createChooser(intent, "send Mail"));
}
private void openUserProfile(String user, boolean isMyAccount) {
Log.d(TAG, "openUserProfile");
Fragment fragment = new UserProfileFragment();
Bundle args = new Bundle();
args.putString(UserProfileFragment.ARGS_USER, user);
args.putBoolean(UserProfileFragment.ARGS_MY_ACCOUNT, isMyAccount);
fragment.setArguments(args);
// Insert the fragment by replacing any existing fragment
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, fragment)
.commit();
}
@Override
public void setTitle(CharSequence title) {
mTitle = title;
getActionBar().setTitle(mTitle);
}
/**
* The OnItemClickListener for the navigation.
*/
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView parent, View view, int position, long id) {
Log.d(TAG, "onItemClick Navigation");
ViewHolder vh = (ViewHolder) view.getTag();
drawerLeftList.setSelection(position);
drawerLayout.closeDrawer(Gravity.LEFT);
navigateTo(vh.key);
}
}
/**
* The LoginTask which checks if a token is available.
*/
private class UserLoginTask extends AsyncTask<String, Void, Boolean> {
@Override
protected Boolean doInBackground(String... params) {
return RestConsumerSingleton.getInstance().getConsumer() != null;
}
@Override
protected void onPostExecute(final Boolean success) {
mAuthTask = null;
showProgress(false);
if (success) {
Log.d(TAG, "navigateTo Global");
navigateTo(NavKey.GLOBAL);
// TODO select global
} else {
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
}
}
/**
* The task to logout and delete the saved token.
*/
private class UserLogoutTask extends AsyncTask<Void, Void, Boolean> {
@Override
protected Boolean doInBackground(Void... params) {
try {
RestConsumerSingleton.getInstance().logout();
return true;
} catch (RestConsumerException e) {
e.printStackTrace();
}
return false;
}
@Override
protected void onPostExecute(final Boolean success) {
mAuthTask = null;
if (success) {
finish();
}
}
}
/**
* Represents an asynchronous GetAccountsInRoomTask used to get the accounts in a room
*/
public class GetAccountsInRoomTask extends AsyncTask<String, Void, Boolean> {
@Override
protected Boolean doInBackground(String... params) {
List<AccountDTO> usersInRoom = null;
try {
String roomID = ((PaperFlyApp) getApplication()).getCurrentChatRoomID();
usersInRoom = RestConsumerSingleton.getInstance().getUsersInRoom(roomID);
((PaperFlyApp) getApplication()).setUsersInRoom(usersInRoom);
} catch (RestConsumerException e) {
e.printStackTrace();
}
return usersInRoom != null;
}
@Override
protected void onPostExecute(final Boolean success) {
mGetAccountsInRoomTask = null;
if (success) {
Log.d("onPostExecute", "success");
Toast.makeText(getApplicationContext(), "UserInRoom successful!", Toast.LENGTH_SHORT).show();
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
d5e37905d912df089a6d007ea45419b1f6a6d463 | 8e0d445d9978757629c2a9a73b87ddbe740b5af2 | /源码/POMSProject/src/poms/center/constants/PaymentTypeConstants.java | 8cc1de1655eeb20dda65edd4cdfbbb7393c538b8 | [] | no_license | Clannad-sakamichi/POMSProject | b27530d3c12846fc12f65b78890a69f5d5537f32 | 74eccd68cbb899888b6a654dade37eae055c9e93 | refs/heads/master | 2021-06-22T07:02:39.080977 | 2017-08-15T08:51:46 | 2017-08-15T08:51:46 | 99,522,697 | 0 | 0 | null | 2017-08-07T00:55:01 | 2017-08-07T00:55:01 | null | UTF-8 | Java | false | false | 377 | java | package poms.center.constants;
//支付类型常量
public class PaymentTypeConstants {
public static int CHECK = 1; //支票
public static int CASH_AND_CHECK = 2; //现金+支票
public static int CASH = 3; //现金
public static int CASH_AND_COUPON = 4; //现金+代金券
public static int GIFTCARD = 6; //赠卡
}
| [
"aa497229845@qq.com"
] | aa497229845@qq.com |
de7a5f9448fdc9a0e61e786be64c3be127b96d04 | e0d56b8b779af9f9f8c782e9f18cf7cb870f8b76 | /ToDoListProject/app/src/main/java/watsalacanoa/todolisttest/caldroidStuff/CaldroidAdapter.java | 59bb6b1e0ed956486468a90501d5a102d45625a9 | [] | no_license | sebasexy/intento-fallido-a-la-verga | 4d544acb640f8c77afe67eb453d79b662967aab0 | 094742a223c6431358f07175c40b2b9f63a4f79a | refs/heads/master | 2021-01-23T04:19:51.034549 | 2017-03-25T20:29:49 | 2017-03-25T20:29:49 | 86,185,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,483 | java | package watsalacanoa.todolisttest.caldroidStuff;
/**
* Created by spide on 17/3/2017.
*/
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.roomorama.caldroid.CaldroidFragment;
import com.roomorama.caldroid.CaldroidGridAdapter;
import java.util.HashMap;
import java.util.Map;
import hirondelle.date4j.DateTime;
import watsalacanoa.todolisttest.R;
public class CaldroidAdapter extends CaldroidGridAdapter {
protected HashMap<DateTime, DailyEvent> events = new HashMap<DateTime, DailyEvent>();
public CaldroidAdapter(Context context, int month, int year,
Map<String, Object> caldroidData,
Map<String, Object> extraData) {
super(context, month, year, caldroidData, extraData);
}
public void setEvents(HashMap<DateTime, DailyEvent> events){
this.events = events;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View cellView = convertView;
// For reuse
if (convertView == null) {
cellView = inflater.inflate(R.layout.custom_cell, null);
}
int topPadding = cellView.getPaddingTop();
int leftPadding = cellView.getPaddingLeft();
int bottomPadding = cellView.getPaddingBottom();
int rightPadding = cellView.getPaddingRight();
TextView tv1 = (TextView) cellView.findViewById(R.id.tv1);
TextView tv2 = (TextView) cellView.findViewById(R.id.tv2);
tv1.setTextColor(Color.BLACK);
// Get dateTime of this cell
DateTime dateTime = this.datetimeList.get(position);
Resources resources = context.getResources();
// Set color of the dates in previous / next month
if (dateTime.getMonth() != month) {
tv1.setTextColor(resources
.getColor(com.caldroid.R.color.caldroid_darker_gray));
}
boolean shouldResetDiabledView = false;
boolean shouldResetSelectedView = false;
// Customize for disabled dates and date outside min/max dates
if ((minDateTime != null && dateTime.lt(minDateTime))
|| (maxDateTime != null && dateTime.gt(maxDateTime))
|| (disableDates != null && disableDates.indexOf(dateTime) != -1)) {
tv1.setTextColor(CaldroidFragment.disabledTextColor);
if (CaldroidFragment.disabledBackgroundDrawable == -1) {
cellView.setBackgroundResource(com.caldroid.R.drawable.disable_cell);
} else {
cellView.setBackgroundResource(CaldroidFragment.disabledBackgroundDrawable);
}
if (dateTime.equals(getToday())) {
cellView.setBackgroundResource(com.caldroid.R.drawable.red_border_gray_bg);
}
} else {
shouldResetDiabledView = true;
}
// Customize for selected dates
if (selectedDates != null && selectedDates.indexOf(dateTime) != -1) {
cellView.setBackgroundColor(resources
.getColor(com.caldroid.R.color.caldroid_sky_blue));
tv1.setTextColor(Color.BLACK);
} else {
shouldResetSelectedView = true;
}
if (shouldResetDiabledView && shouldResetSelectedView) {
// Customize for today
if (dateTime.equals(getToday())) {
cellView.setBackgroundResource(com.caldroid.R.drawable.red_border);
} else {
cellView.setBackgroundResource(com.caldroid.R.drawable.cell_bg);
}
}
if (events.containsKey(dateTime)) {
DailyEvent event = events.get(dateTime);
// do whatever you want with cellView
}
tv1.setText("" + dateTime.getDay());
tv2.setText("Hi");
// Somehow after setBackgroundResource, the padding collapse.
// This is to recover the padding
cellView.setPadding(leftPadding, topPadding, rightPadding,
bottomPadding);
// Set custom color if required
setCustomResources(dateTime, cellView, tv1);
return cellView;
}
}
| [
"spider_cbaz_10@hotmail.com"
] | spider_cbaz_10@hotmail.com |
9de13b0290d67753520a40ec781e993aca53c519 | 3d94fe2be59b31ef46534975a6ddebb1972f47b7 | /base-backend/family/src/main/java/com/family/gold/entity/News.java | 82529be3cca2e6660050924c1d987e131e0a698e | [] | no_license | banxue-dev/family-manager | 31de7143bb8c18e014322d2a967742d7f3b2b7c2 | a7b0e84a0244ebc4ec8a6601c29f882c29135407 | refs/heads/master | 2023-07-05T02:11:46.247883 | 2021-08-03T02:08:20 | 2021-08-03T02:08:20 | 299,210,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,075 | java | package com.family.gold.entity;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.family.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* News实体层
* Auther:feng
* Date:2020-09-22 17:59:24
*/
@Table(name = "gold_news")
@ApiModel("黄金的新闻内容")
public class News {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "JDBC")
@Column(name="news_id")
@ApiModelProperty(value = "主键",example="1")
private Integer newsId;
@Column(name="news_title")
@ApiModelProperty(value = "标题")
private String newsTitle;
@Column(name="news_content")
@ApiModelProperty(value = "正文")
private String newsContent;
@Column(name="create_time")
@ApiModelProperty(value = "时间")
private String createTime;
@Column(name="org_code")
@ApiModelProperty(value = "组织code")
private String orgCode;
/**
*主键
*/
public void setNewsId(Integer newsId){
this.newsId=newsId;
}
/**
*主键
*/
public Integer getNewsId(){
return newsId;
}
/**
*标题
*/
public void setNewsTitle(String newsTitle){
this.newsTitle=newsTitle;
}
/**
*标题
*/
public String getNewsTitle(){
return newsTitle;
}
/**
*正文
*/
public void setNewsContent(String newsContent){
this.newsContent=newsContent;
}
/**
*正文
*/
public String getNewsContent(){
return newsContent;
}
/**
*时间
*/
public void setCreateTime(String createTime){
this.createTime=createTime;
}
/**
*时间
*/
public String getCreateTime(){
if(StringUtils.isNotNull(createTime)) {if(createTime.contains(".0")) {return createTime.replace(".0", "");}}return createTime;
}
/**
*组织code
*/
public void setOrgCode(String orgCode){
this.orgCode=orgCode;
}
/**
*组织code
*/
public String getOrgCode(){
return this.orgCode;
}
public String getSourceOrgCode(){
return this.orgCode;
}
}
| [
"37128857+fengchaseyou@users.noreply.github.com"
] | 37128857+fengchaseyou@users.noreply.github.com |
6aea0d3fd1d4a3bc6ae39a8aa1a18d3253b413de | 6534385e1baf3300ba86c6c83d5bf9d86ed16ce8 | /topologicalSort.java | c3bc0c3b37459aba8464246accf397e501ee1f06 | [] | no_license | HopefulWei/Data_Structure_Java | 949fa14e3a6da6b10e7a4987b93ddb0c194cbcd6 | 3fad344f040ddef244c6f4726748f172bb31e9e4 | refs/heads/master | 2020-04-30T06:53:06.907798 | 2019-05-29T15:22:45 | 2019-05-29T15:22:45 | 176,666,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,254 | java | import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
class topologicalSort {
private ArrayList<Integer>[] map;
private int[] ret;
private int[] index;
private int count = 0;
public int[] findOrder(int numCourses, int[][] prerequisites) {
ret=new int[numCourses];
index=new int[numCourses];
map =new ArrayList[numCourses];
for(int i=0;i<numCourses;i++){
map[i]=new ArrayList<Integer>();
}
for(int[] num:prerequisites){
map[num[1]].add(num[0]);
index[num[0]]++;}
pop();
int[] kong = {};
return count == numCourses ? ret : kong;
}
void pop(){
Queue<Integer> queue= new LinkedList<Integer>();
for(int i=0;i<index.length;i++){
if(index[i]==0){
queue.offer(i);
}}
int ind=-1;
while(!queue.isEmpty()){
int cur=queue.poll();
count++;
ret[++ind]=cur;
for(int i=0;i<map[cur].size();i++){
int e = map[cur].get(i);
if(--index[e]==0){
queue.offer(map[cur].get(i));
}}
map[cur].clear();
}
}
} | [
"hopefulwei@gmail.com"
] | hopefulwei@gmail.com |
120f442a738bce5454d7850454edb55ed5821110 | 7df686982c9349761c6c1fca3f8fa8e4ef8d220f | /src/main/java/org/wildfly/extension/elytron/RoleDecoderDefinitions.java | c3965cd9bea2477645040f29569dbd53f8e6dbd1 | [
"Apache-2.0"
] | permissive | jtymel/elytron-subsystem | a186f4e09bb08482bc9d9cbd19f7d8ab22b2e016 | 0e45ff440267cb2edf9827e4155fe9f7955a7b07 | refs/heads/master | 2020-12-30T09:51:10.936466 | 2016-07-21T11:57:36 | 2016-07-21T11:57:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,846 | java | /*
* JBoss, Home of Professional Open Source.
* Copyright 2015 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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.wildfly.extension.elytron;
import static org.wildfly.extension.elytron.Capabilities.ROLE_DECODER_RUNTIME_CAPABILITY;
import static org.wildfly.extension.elytron.ElytronDefinition.commonDependencies;
import org.jboss.as.controller.AbstractAddStepHandler;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.controller.OperationStepHandler;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ResourceDefinition;
import org.jboss.as.controller.RestartParentWriteAttributeHandler;
import org.jboss.as.controller.SimpleAttributeDefinition;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.SimpleResourceDefinition;
import org.jboss.as.controller.capability.RuntimeCapability;
import org.jboss.as.controller.registry.AttributeAccess;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.registry.OperationEntry;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController.Mode;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
import org.wildfly.security.authz.RoleDecoder;
/**
* Container class for the {@link RoleDecoder} definitions.
*
* @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a>
*/
class RoleDecoderDefinitions {
static final SimpleAttributeDefinition ATTRIBUTE = new SimpleAttributeDefinitionBuilder(ElytronDescriptionConstants.ATTRIBUTE, ModelType.STRING, false)
.setAllowExpression(true)
.setMinSize(1)
.setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES)
.build();
static ResourceDefinition getEmptyRoleDecoderDefinition() {
return EmptyResourceDefinition.create(RoleDecoder.class, ElytronDescriptionConstants.EMPTY_ROLE_DECODER, ROLE_DECODER_RUNTIME_CAPABILITY, () -> RoleDecoder.EMPTY);
}
static ResourceDefinition getSimpleRoleDecoderDefinition() {
return new SimpleRoleDecoderDefinition();
}
private static class SimpleRoleDecoderDefinition extends SimpleResourceDefinition {
private static final AbstractAddStepHandler ADD = new SimpleRoleDecoderAddHandler();
private static final OperationStepHandler REMOVE = new TrivialCapabilityServiceRemoveHandler(ADD, ROLE_DECODER_RUNTIME_CAPABILITY);
SimpleRoleDecoderDefinition() {
super(new Parameters(PathElement.pathElement(ElytronDescriptionConstants.SIMPLE_ROLE_DECODER), ElytronExtension.getResourceDescriptionResolver(ElytronDescriptionConstants.SIMPLE_ROLE_DECODER))
.setAddHandler(ADD)
.setRemoveHandler(REMOVE)
.setAddRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
.setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES)
.setCapabilities(ROLE_DECODER_RUNTIME_CAPABILITY));
}
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
resourceRegistration.registerReadWriteAttribute(ATTRIBUTE, null, new WriteAttributeHandler(ElytronDescriptionConstants.SIMPLE_ROLE_DECODER, ATTRIBUTE));
}
}
private static class SimpleRoleDecoderAddHandler extends BaseAddHandler {
private SimpleRoleDecoderAddHandler() {
super(ROLE_DECODER_RUNTIME_CAPABILITY, ATTRIBUTE);
}
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
throws OperationFailedException {
ServiceTarget serviceTarget = context.getServiceTarget();
RuntimeCapability<Void> runtimeCapability = ROLE_DECODER_RUNTIME_CAPABILITY.fromBaseCapability(context.getCurrentAddressValue());
ServiceName roleDecoderName = runtimeCapability.getCapabilityServiceName(RoleDecoder.class);
final String attribute = ATTRIBUTE.resolveModelAttribute(context, model).asString();
TrivialService<RoleDecoder> roleDecoderService = new TrivialService<RoleDecoder>(() -> RoleDecoder.simple(attribute));
ServiceBuilder<RoleDecoder> roleDecoderBuilderBuilder = serviceTarget.addService(roleDecoderName, roleDecoderService);
commonDependencies(roleDecoderBuilderBuilder)
.setInitialMode(Mode.LAZY)
.install();
}
}
private static class WriteAttributeHandler extends RestartParentWriteAttributeHandler {
WriteAttributeHandler(String parentName, AttributeDefinition ... attributes) {
super(parentName, attributes);
}
@Override
protected ServiceName getParentServiceName(PathAddress pathAddress) {
return ROLE_DECODER_RUNTIME_CAPABILITY.fromBaseCapability(pathAddress.getLastElement().getValue()).getCapabilityServiceName(RoleDecoder.class);
}
}
}
| [
"darran.lofthouse@jboss.com"
] | darran.lofthouse@jboss.com |
a8a474ced3a3e95e2e7b12f28fe23a83528ed885 | 0e84b44a516080e24250d4e5a7ea3557ecb4ef4e | /Semester5/Tugas 5/IntentParcelable/app/src/main/java/com/latihan/intentparcelable/MoveForResultActivity.java | f1d7a12930309deb68ac911827c4dde34f9d1f63 | [] | no_license | muhazhariii/PWPB | e379c6a01236ea894fd942c9a1fb746df29be3f8 | cd2450f5afc9ad0c49b171d2010e5c0d9ff75bed | refs/heads/main | 2023-05-01T18:26:51.985249 | 2021-05-09T09:21:14 | 2021-05-09T09:21:14 | 365,712,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,731 | java | package com.latihan.intentparcelable;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
public class MoveForResultActivity extends AppCompatActivity implements View.OnClickListener {
Button btnChoose;
RadioGroup rgNumber;
public static String EXTRA_SELECTED_VALUE = "extra_selected_value";
public static int RESULT_CODE = 110;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_move_for_result);
btnChoose = findViewById(R.id.btn_choose);
rgNumber = findViewById(R.id.rg_number);
btnChoose.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v.getId() == R.id.btn_choose) {
if (rgNumber.getCheckedRadioButtonId() != 0) {
int value = 0;
switch (rgNumber.getCheckedRadioButtonId()) {
case R.id.rb_50:
value = 50;
break;
case R.id.rb_100:
value = 100;
break;
case R.id.rb_150:
value = 150;
break;
case R.id.rb_200:
value = 200;
break;
}
Intent resultIntent = new Intent();
resultIntent.putExtra(EXTRA_SELECTED_VALUE, value);
setResult(RESULT_CODE, resultIntent);
finish();
}
}
}
} | [
"azharimuhamad999@gmail.com"
] | azharimuhamad999@gmail.com |
7c540a91183aaa4d264b91aca71e4bc6dcbc0095 | 0ada5ae17a9dfd72bb1f864d501cf93e92b35024 | /netflix-zuul-api-gateway-server/src/main/java/com/training/microservices/netflixzuulapigatewayserver/ZuulLoggingFilter.java | 80c5c991d759a3b3afd986ed2aa6a7aa13b96f39 | [] | no_license | iscrobertoamc/Spring-microservices | cf23c52dcf1f5d1554f0c4ba9fe9ff2f43a51180 | 784881928292e3c3fa86c7d9f795a4f7b467de3d | refs/heads/master | 2022-11-18T02:19:18.554118 | 2020-07-16T18:09:04 | 2020-07-16T18:09:04 | 277,640,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 913 | java | package com.training.microservices.netflixzuulapigatewayserver;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
@Component
public class ZuulLoggingFilter extends ZuulFilter {
private Logger logger = LoggerFactory.getLogger(ZuulLoggingFilter.class);
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() throws ZuulException {
HttpServletRequest request = RequestContext.getCurrentContext().getRequest();
logger.info("request -> {} request uri -> {}", request, request.getRequestURI());
return null;
}
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 1;
}
}
| [
"roberto.morales@fonyou.com"
] | roberto.morales@fonyou.com |
bdb6808371e1ba9825b213496980619dd3dcf967 | 022384329140fc92d13c3fb23a4bf1e8296194bf | /system-service/src/main/java/com/intest/systemservice/impl/service/RoleService.java | 1b49ed8f6ff93f7d0e9775fafb22bde645121ab7 | [] | no_license | YtstIntest/fota-zt | c10d881fcc2fc22d3f35105350d69c5aeb17cefc | a7c71c693f936c5ba4628d3779a8c8bd8110a69a | refs/heads/master | 2023-01-22T20:38:45.127005 | 2020-11-10T09:12:39 | 2020-11-10T09:12:39 | 311,638,101 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 913 | java | package com.intest.systemservice.impl.service;
import com.intest.common.exception.ResponseBean;
import com.intest.common.result.PagerDataBaseVO;
import com.intest.dao.entity.UserBto;
import com.intest.dao.entity.table.MenuExtend;
import com.intest.systemservice.request.AddRoleRequet;
import com.intest.systemservice.request.DeleteRoleRequet;
import com.intest.systemservice.request.UpdateRoleRequet;
import com.intest.systemservice.response.RoleListResponse;
import java.util.List;
public interface RoleService {
List<MenuExtend> getRolePermissionList();
ResponseBean addRole(AddRoleRequet request);
ResponseBean updateRole(UpdateRoleRequet request, UserBto bto);
ResponseBean deleteRole(List<DeleteRoleRequet> request);
PagerDataBaseVO getRoleTmpInfo(SystemPage model);
ResponseBean selectLoginName( String roleName, String id);
List<RoleListResponse> getRoleList();
}
| [
"xialiang@intest.cn"
] | xialiang@intest.cn |
8f67a42d089058a86a9426ad2b1be36cafdc6ff1 | f5de6a96c63bc5218139b8ddff3860931fba7035 | /src/main/java/com/neo/service/serviceImpl/UpImgServiceImpl.java | 877b35d37ed00fb2cecfd0f81f91eccd4c5ad3e7 | [] | no_license | blueskychengke/spring-boot-oss | 3990652d603ba9fe97e46c6c4c06647fb0f2951c | d0d9b810c1ef6f04d5f92dba1dfb557b7fcbdf13 | refs/heads/master | 2020-04-07T16:10:24.166637 | 2018-11-21T09:02:42 | 2018-11-21T09:02:42 | 158,518,278 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 902 | java | package com.neo.service.serviceImpl;
import com.neo.exception.ImgException;
import com.neo.service.UpImgService;
import com.neo.util.OSSClientUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@Service
public class UpImgServiceImpl implements UpImgService {
public static final Logger logger = LoggerFactory.getLogger(UpImgServiceImpl.class);
@Override
public String updateHead(MultipartFile file) throws ImgException {
if (file == null || file.getSize() <= 0) {
throw new ImgException("file不能为空");
}
OSSClientUtil ossClient=new OSSClientUtil();
String name = ossClient.uploadImg2Oss(file);
String imgUrl = ossClient.getImgUrl(name);
String[] split = imgUrl.split("\\?");
return split[0];
}
}
| [
"chengke_02@163.com"
] | chengke_02@163.com |
2df37be957c709409699c694445588bae3e91640 | 5313c962d3a55d4ee3a28666d1c2c3815249b4a2 | /app/src/main/java/com/example/badweather/gson/Basic.java | f6f0559e637cba49a39c94c1861b04109d0e5080 | [
"Apache-2.0"
] | permissive | iroywang/badweather | d1eba18b4d34955b1c51adc4aedb34ba3125f827 | ce3898bd1d6148d7d844a355878131ea22bc7120 | refs/heads/master | 2022-09-24T19:02:06.117094 | 2022-08-31T00:08:33 | 2022-08-31T00:08:33 | 101,942,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com.example.badweather.gson;
import com.google.gson.annotations.SerializedName;
/**
* Created by iroy on 2017/9/3.
*/
public class Basic {
@SerializedName("city")
public String cityName;
@SerializedName("id")
public String weatherId;
public Update update;
public class Update {
@SerializedName("loc")
public String updateTime;
}
}
| [
"a1175496675@gmail.com"
] | a1175496675@gmail.com |
25b23cec9d170d2982f54fe0b1aa3687ce191111 | 640cbe266cb8f08e94f6af569feb7e83148fcb96 | /userservice/src/main/java/com/fantj/sbmybatis/mapper/UserAuthMapper.java | 7641b2ca541b3f75c7409e785ccf74359d483b66 | [] | no_license | zehaowei/SH-Trade-Wechat-MiniApp | b93c35d1cebad89f8e13f506ed538f0b11e73539 | d8193f6fcea08c2b0b51ab47625340b6b0ac6e38 | refs/heads/master | 2022-05-26T05:53:13.961805 | 2019-05-24T02:55:29 | 2019-05-24T02:55:29 | 177,737,790 | 2 | 0 | null | 2022-05-20T20:57:46 | 2019-03-26T07:39:42 | Java | UTF-8 | Java | false | false | 515 | java | package com.fantj.sbmybatis.mapper;
import com.fantj.sbmybatis.model.UserAuth;
public interface UserAuthMapper {
int deleteByPrimaryKey(Integer id);
int insert(UserAuth record);
int insertSelective(UserAuth record);
UserAuth selectByPrimaryKey(Integer id);
UserAuth selectByTypeAndIdentifier(String identityType, String identifier);
String selectIdentifierByUserId(Integer userId);
int updateByPrimaryKeySelective(UserAuth record);
int updateByPrimaryKey(UserAuth record);
} | [
"weizehao@whu.edu.cn"
] | weizehao@whu.edu.cn |
007f4df2661bdf01ec4e3b4453ed59a1b2c2f4f3 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1111/u-11-111-1111-f6420.java | d7f6b061002b0e83a4a68165fd2b78c601134c92 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
4097210808336 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
e4018e4048866ade6d1e648c96b4121e853ef841 | 13770340b9e7e315bf2535b54273f9e4de1567e8 | /Praktikum3-Collection/src/com/maulana/collection/latihan1/Tugas1.java | 8294183c602e836dec9f489abfcdaf8f0b3010c3 | [] | no_license | maulanabin/ASD-PENS-2021 | 2d4073c18201c3eb9dccc7615f088552ec3f59a3 | 73b8d18ffce5c8c1d123966816bfc9014b823e65 | refs/heads/master | 2023-07-17T11:32:18.052470 | 2021-08-29T03:48:14 | 2021-08-29T03:48:14 | 386,187,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,161 | java | package com.maulana.collection.latihan1;
import java.util.*;
public class Tugas1 {
public static void main(String[] args) {
Set set1 = new HashSet();
set1.add("1");
set1.add("2");
set1.add("3");
set1.add("4");
set1.add("5");
System.out.println("Elemen Himpunan A: " + set1);
Set set2 = new HashSet();
set2.add("5");
set2.add("6");
set2.add("7");
set2.add("8");
set2.add("9");
set2.add("10");
System.out.println("Elemen Himpunan B: " + set2);
Set irisan = new TreeSet(set1);
irisan.retainAll(set2);
System.out.println("A ^ B: " + irisan);
Set gabungan = new TreeSet(set1);
gabungan.addAll(set2);
System.out.println("A U B: " + gabungan);
Set komplemen = new TreeSet(set1);
komplemen.removeAll(set2);
System.out.println("A - B: " + komplemen);
Set subset1 = new TreeSet(set1);
subset1.removeAll(set2);
Set subset2 = new TreeSet(set2);
subset2.removeAll(set1);
System.out.println("A c B: " + subset1 + subset2);
}
}
| [
"2041720132@student.polinema.ac.id"
] | 2041720132@student.polinema.ac.id |
364dbf1a06da453cb08a5e5b97d548eba5da48f0 | 5cfb8619ef0fe3926511fd4873f775cc1b891743 | /app/src/main/java/com/dy/cmls/view/paydialog/PasswordView.java | 376cfe5b2599fbe98915264a05b0b794c3c1362c | [] | no_license | wanglianjun/cmls | 6ba9a0d81c7407105b6c9452f2b38d635f5c283b | 241092f14f61b3dc359440d2d80b7079e885b368 | refs/heads/master | 2020-04-14T23:04:40.643609 | 2019-01-04T14:07:49 | 2019-01-04T14:07:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,444 | java | package com.dy.cmls.view.paydialog;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
/**
* author : Android 轮子哥
* github : https://github.com/getActivity/AndroidProject
* time : 2018/12/2
* desc : 密码遮挡自定义 View
*/
public class PasswordView extends View {
// 密码总个数
public static final int PASSWORD_COUNT = 6;
// 已经输入的密码个数,也就是需要显示的小黑点个数
private int mCurrentIndex = 0;
private Paint mPaint;
private Path mPath;
private Paint mPointPaint;
//密码框边界线的颜色值
private int mStrokeColor = 0xFFECECEC;
//单个密码框的高度
private int mItemWidth = 44;
private int mItemHeight = 41;
//中心黑点的半径大小
private int mPointRadius = 15;
//中心黑点的颜色
private int mPointColor = 0xFF666666;
public PasswordView(Context context) {
super(context);
initialize(context);
}
public PasswordView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initialize(context);
// init();
}
public PasswordView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initialize(context);
// init();
}
/**
* 初始化
*/
private void initialize(Context context) {
mItemWidth = dp2px(mItemWidth);
mItemHeight = dp2px(mItemHeight);
mPaint = new Paint();
mPaint.setAntiAlias(true); //设置抗锯齿
mPaint.setColor(mStrokeColor); //设置颜色
mPaint.setStyle(Paint.Style.STROKE); //设置描边
mPath = new Path();
mPath.moveTo(0, 0);
mPath.lineTo(mItemWidth * PASSWORD_COUNT, 0);
mPath.lineTo(mItemWidth * PASSWORD_COUNT, mItemHeight );
mPath.lineTo(0, mItemHeight);
mPath.close();
mPointPaint = new Paint();
mPointPaint.setAntiAlias(true);
mPointPaint.setStyle(Paint.Style.FILL);
mPointPaint.setColor(mPointColor);
}
private void init() {
mItemWidth = dp2px(mItemWidth);
mItemHeight = dp2px(mItemHeight);
mPaint = new Paint();
mPaint.setAntiAlias(true); //设置抗锯齿
mPaint.setColor(mStrokeColor); //设置颜色
mPaint.setStyle(Paint.Style.STROKE); //设置描边
int radius=dp2px(5);
mPath = new Path();
mPath.moveTo(0, radius);
RectF oval1 = new RectF(0, 0, 2 * radius, 2 * radius);
mPath.arcTo(oval1, 180, 90);
mPath.lineTo(mItemWidth * PASSWORD_COUNT - radius, 0);
RectF oval2 = new RectF(mItemWidth * PASSWORD_COUNT - 2 * radius, 0, mItemWidth * PASSWORD_COUNT, 2 * radius);
mPath.arcTo(oval2, -90, 90);
mPath.lineTo(mItemWidth * PASSWORD_COUNT, mItemHeight - radius);
RectF oval3 = new RectF(mItemWidth * PASSWORD_COUNT - 2 * radius, mItemHeight - 2 * radius, mItemWidth * PASSWORD_COUNT, mItemHeight);
mPath.arcTo(oval3, 0, 90);
mPath.lineTo(radius, mItemHeight);
RectF oval4 = new RectF(0, mItemHeight - 2 * radius, 2 * radius, mItemHeight);
mPath.arcTo(oval4, 90, 90);
mPath.close();
mPointPaint = new Paint();
mPointPaint.setAntiAlias(true);
mPointPaint.setStyle(Paint.Style.FILL);
mPointPaint.setColor(mPointColor);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = measureWidth(widthMeasureSpec);
int height = measureHeight(heightMeasureSpec);
setMeasuredDimension(width, height);
}
private int measureWidth(int measureSpec) {
int mode = MeasureSpec.getMode(measureSpec);
int size = MeasureSpec.getSize(measureSpec);
if (mode == MeasureSpec.EXACTLY) {
return size;
} else {
return mItemWidth * PASSWORD_COUNT;
}
}
private int measureHeight(int measureSpec) {
int mode = MeasureSpec.getMode(measureSpec);
int size = MeasureSpec.getSize(measureSpec);
if (mode == MeasureSpec.EXACTLY) {
return size;
} else {
return mItemHeight;
}
}
public int dp2px(float dp) {
final float scale = getContext().getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}
@Override
protected void onDraw(Canvas canvas) {
mPaint.setStrokeWidth(5);
old(canvas);
// newCanvas(canvas);
}
private void old(Canvas canvas) {
canvas.drawPath(mPath, mPaint);
drawDivide(canvas);
drawBlackPoint(canvas);
}
//有bug
private void newCanvas(Canvas canvas) {
int radius = dp2px(5);
int radius2 = dp2px(5) - 5;
RectF oval1 = new RectF(0, 0, mItemWidth * PASSWORD_COUNT, mItemHeight);
canvas.drawRoundRect(oval1, radius, radius, mPaint);
mPaint.setColor(Color.parseColor("#ffffffff")); //设置颜色
mPaint.setStrokeWidth(dp2px(40));
RectF oval2 = new RectF(5, 5, mItemWidth * PASSWORD_COUNT - 5, mItemHeight - 5);
canvas.drawRoundRect(oval2, radius2, radius2, mPaint);
mPaint.setColor(mStrokeColor); //设置颜色
drawDivide(canvas);
drawBlackPoint(canvas);
}
/**
* 画单个的分割线
*/
private void drawDivide(Canvas canvas) {
mPaint.setStrokeWidth(3);
for (int index = 1; index < PASSWORD_COUNT; index++) {
canvas.drawLine(mItemWidth * index, 0, mItemWidth * index, mItemHeight, mPaint);
}
}
/**
* 绘制中间的小黑点
*/
private void drawBlackPoint(Canvas canvas) {
if (mCurrentIndex == 0) {
return;
}
for (int i = 1; i <= mCurrentIndex; i++) {
canvas.drawCircle(i * mItemWidth - mItemWidth / 2, mItemHeight / 2, mPointRadius, mPointPaint);
}
}
/**
* 改变密码提示小黑点的个数
*/
public void setPassWord(int index) {
mCurrentIndex = index;
invalidate();
}
}
| [
"2495957329@qq.com"
] | 2495957329@qq.com |
46238701d39de9bb4df6c2b64daeb89aeed5cf5c | 3a1c2f01fc4388d187ae1b1a808aac3eb8f9d95f | /subsys/kafka/src/main/java/org/commonjava/indy/subsys/kafka/util/LogbackFormatter.java | 730de9392ce3640dd15dba61831f3b15e600d8a3 | [
"Apache-2.0"
] | permissive | pombredanne/indy | 57ee33893e3b81304efa967b0d821127304d06e2 | 957ac70c68ca36f9b40c5785a2f26972d2c09f71 | refs/heads/master | 2021-01-23T15:04:33.593448 | 2019-11-19T13:02:36 | 2019-11-19T13:02:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,569 | java | /**
* Copyright (C) 2011-2019 Red Hat, Inc. (https://github.com/Commonjava/indy)
*
* 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.commonjava.indy.subsys.kafka.util;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.OutputStreamAppender;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Iterator;
/**
* Created by ruhan on 12/20/18.
*/
public class LogbackFormatter
{
private final Logger logger;
private OutputStreamAppender<ILoggingEvent> appender;
public LogbackFormatter( String loggerName )
{
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
logger = context.getLogger( loggerName );
Iterator<Appender<ILoggingEvent>> it = logger.iteratorForAppenders();
while ( it.hasNext() )
{
Appender a = it.next();
if ( a instanceof OutputStreamAppender )
{
appender = (OutputStreamAppender) a;
return;
}
}
}
public LogbackFormatter( String loggerName, String appenderName )
{
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
logger = context.getLogger( loggerName );
appender = (ConsoleAppender<ILoggingEvent>) logger.getAppender( appenderName );
}
public String format( String message ) throws IOException
{
if ( appender == null )
{
return message;
}
ILoggingEvent logEvent = new LoggingEvent( LogbackFormatter.class.getName(), logger, Level.INFO, message, null,
new Object[0] );
byte[] encode = appender.getEncoder().encode( logEvent );
return new String( encode );
}
}
| [
"jdcasey@commonjava.org"
] | jdcasey@commonjava.org |
ae146e6bf072811eace7862e8d1a60c2a16fe01e | b39f2dede91938129f756d4331cc27b43237699a | /src/main/java/org/todevs/tme/web/rest/CategoryResource.java | 93190233a48d6117c818e992b46673ddf7387610 | [] | no_license | FrankieRM/tracking-my-expenses | 0ba14b97886ec5ea87b326a96a4914735f4e58f8 | 5aa54f76374fbedca4165075bb0b16a05d75f815 | refs/heads/master | 2022-12-25T15:15:23.115327 | 2019-10-26T03:01:02 | 2019-10-26T03:01:02 | 217,644,513 | 1 | 0 | null | 2022-12-16T04:40:41 | 2019-10-26T02:24:18 | Java | UTF-8 | Java | false | false | 5,547 | java | package org.todevs.tme.web.rest;
import org.todevs.tme.domain.Category;
import org.todevs.tme.repository.CategoryRepository;
import org.todevs.tme.web.rest.errors.BadRequestAlertException;
import io.github.jhipster.web.util.HeaderUtil;
import io.github.jhipster.web.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing {@link org.todevs.tme.domain.Category}.
*/
@RestController
@RequestMapping("/api")
public class CategoryResource {
private final Logger log = LoggerFactory.getLogger(CategoryResource.class);
private static final String ENTITY_NAME = "category";
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final CategoryRepository categoryRepository;
public CategoryResource(CategoryRepository categoryRepository) {
this.categoryRepository = categoryRepository;
}
/**
* {@code POST /categories} : Create a new category.
*
* @param category the category to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new category, or with status {@code 400 (Bad Request)} if the category has already an ID.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/categories")
public ResponseEntity<Category> createCategory(@Valid @RequestBody Category category) throws URISyntaxException {
log.debug("REST request to save Category : {}", category);
if (category.getId() != null) {
throw new BadRequestAlertException("A new category cannot already have an ID", ENTITY_NAME, "idexists");
}
Category result = categoryRepository.save(category);
return ResponseEntity.created(new URI("/api/categories/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* {@code PUT /categories} : Updates an existing category.
*
* @param category the category to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated category,
* or with status {@code 400 (Bad Request)} if the category is not valid,
* or with status {@code 500 (Internal Server Error)} if the category couldn't be updated.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PutMapping("/categories")
public ResponseEntity<Category> updateCategory(@Valid @RequestBody Category category) throws URISyntaxException {
log.debug("REST request to update Category : {}", category);
if (category.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
Category result = categoryRepository.save(category);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, category.getId().toString()))
.body(result);
}
/**
* {@code GET /categories} : get all the categories.
*
* @param pageable the pagination information.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of categories in body.
*/
@GetMapping("/categories")
public ResponseEntity<List<Category>> getAllCategories(Pageable pageable) {
log.debug("REST request to get a page of Categories");
Page<Category> page = categoryRepository.findAll(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* {@code GET /categories/:id} : get the "id" category.
*
* @param id the id of the category to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the category, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/categories/{id}")
public ResponseEntity<Category> getCategory(@PathVariable Long id) {
log.debug("REST request to get Category : {}", id);
Optional<Category> category = categoryRepository.findById(id);
return ResponseUtil.wrapOrNotFound(category);
}
/**
* {@code DELETE /categories/:id} : delete the "id" category.
*
* @param id the id of the category to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/categories/{id}")
public ResponseEntity<Void> deleteCategory(@PathVariable Long id) {
log.debug("REST request to delete Category : {}", id);
categoryRepository.deleteById(id);
return ResponseEntity.noContent().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())).build();
}
}
| [
"frodriguezm17@gmail.com"
] | frodriguezm17@gmail.com |
9f8c934f24048156aef2473746aabc78a25112a3 | 6224820df7ca17fd0bafe0f20e2ed3eb9ee032ab | /src/be/stevenroose/abcmdgp/experiment/ABCMDGPConsoleExperiment.java | 321f96d464e92766009830849ca33e2dffcae487 | [
"Apache-2.0"
] | permissive | stevenroose/ABC-MDGP | 90033d9290f74f7edb94c56ddaab14c26450c4ec | 2de7b3fa65161042b033ca71833474a9e9832aee | refs/heads/master | 2021-01-16T18:19:15.921549 | 2020-02-20T11:09:56 | 2020-02-20T11:09:56 | 18,086,510 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,775 | java | package be.stevenroose.abcmdgp.experiment;
import be.stevenroose.abcmdgp.ABC_MDGP;
import be.stevenroose.abcmdgp.abc.NeighbourhoodOperator;
import be.stevenroose.abcmdgp.abc.StochasticNO;
import be.stevenroose.abcmdgp.mdgp.NO1;
import be.stevenroose.abcmdgp.mdgp.NO2a;
import be.stevenroose.abcmdgp.mdgp.NO2b;
import be.stevenroose.abcmdgp.mdgp.NO3;
import com.sun.star.lang.IllegalArgumentException;
import es.optsicom.lib.experiment.ConsoleExperiment;
import es.optsicom.problem.mdgp.MDGPInstance;
import es.optsicom.problem.mdgp.MDGPInstanceLoader;
import es.optsicom.problem.mdgp.MDGPSolution;
import es.optsicom.problem.mdgp.ma.LSGA;
import es.optsicom.problem.mdgp.method.C1_LCW_I_T;
import es.optsicom.problem.mdgp.method.R_LCW;
import es.optsicom.problem.mdgp.method.SO;
public class ABCMDGPConsoleExperiment {
/**
* Use this method just like the main method of mdgp_jors_2011.jar.
*/
public static void main(String[] args) {
ConsoleExperiment expExec = new ConsoleExperiment(
"abc_mdgp.jar",
"http://www.optsicom.es/mdgp/instance_format.txt",
"http://www.optsicom.es/mdgp",
"Maximally Diverse Grouping Problem with Artificial Bee Colony Algorithm",
new MDGPInstanceLoader(),
"The solution will be represented as an integer array. Each array position represents the group number of the element corresponding to position index.");
expExec.putMethod("SO", new SO());
expExec.putMethod("T-LCW", new C1_LCW_I_T());
expExec.putMethod("LCW", new R_LCW());
expExec.putMethod("LSGA", new LSGA());
expExec.putMethod("ABC-NO1", new ABC_MDGP(new NO1(0.1)));
expExec.putMethod("ABC-NO2b", new ABC_MDGP(new NO2b(0.1)));
expExec.putMethod("ABC-NO3", new ABC_MDGP(new NO3(0.1)));
expExec.putMethod("ABC-NO1NO2b", new ABC_MDGP(combo(new NO1(0.1), new NO2b(0.1))));
expExec.putMethod("ABC-NO1NO3", new ABC_MDGP(combo(new NO1(0.1), new NO3(0.1))));
expExec.putMethod("ABC-NO2bNO3", new ABC_MDGP(combo(new NO2b(0.1), new NO3(0.1))));
expExec.putMethod("ABC-NO1NO2bNO3", new ABC_MDGP(combo(new NO1(0.1), new NO2b(0.1), new NO3(0.1))));
expExec.putMethod("ABC-NO2a", new ABC_MDGP(new NO2a(0.1)));
expExec.putMethod("ABC-NO1NO2a", new ABC_MDGP(combo(new NO1(0.1), new NO2a(0.1))));
expExec.putMethod("ABC-NO2aNO3", new ABC_MDGP(combo(new NO2a(0.1), new NO3(0.1))));
expExec.putMethod("ABC-NO1NO2aNO3", new ABC_MDGP(combo(new NO1(0.1), new NO2a(0.1), new NO3(0.1))));
expExec.execMethodWithArgs(args);
}
@SafeVarargs
static private NeighbourhoodOperator<MDGPSolution, MDGPInstance>
combo(NeighbourhoodOperator<MDGPSolution, MDGPInstance>... elems) {
try {
return new StochasticNO<MDGPSolution, MDGPInstance>(elems);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
return null;
}
} | [
"stevenroose@gmail.com"
] | stevenroose@gmail.com |
96f49738c1f404a051e1eee098609f530d47b371 | bace31aab2aa164a0249c271f7cf7ba9a1503d04 | /app/src/main/java/com/tiendas3b/almacen/db/dao/DecreaseMP.java | 42f2a35906afbbb085b8f827dd65986cddfd19bf | [] | no_license | opelayoa/Project | a8fab2a6f759f076fd52989e8917f2c02915096b | 43788f12e3c7ea39a8bab8e35e85b74ff6c9f9fa | refs/heads/master | 2020-04-10T07:33:17.768276 | 2019-01-04T22:02:31 | 2019-01-04T22:02:31 | 160,883,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,326 | java | package com.tiendas3b.almacen.db.dao;
// THIS CODE IS GENERATED BY greenDAO, EDIT ONLY INSIDE THE "KEEP"-SECTIONS
// KEEP INCLUDES - put your custom includes here
// KEEP INCLUDES END
/**
* Entity mapped to table "DECREASE_MP".
*/
public class DecreaseMP {
private Long iclave;
private String description;
private Integer amount;
private Long type;
private Long obs;
private Long obsLog;
private Float cost;
private String obsStr;
private Integer odc;
// KEEP FIELDS - put your custom fields here
// KEEP FIELDS END
public DecreaseMP() {
}
public DecreaseMP(Long iclave, String description, Integer amount, Long type, Long obs, Long obsLog, Float cost, String obsStr, Integer odc) {
this.iclave = iclave;
this.description = description;
this.amount = amount;
this.type = type;
this.obs = obs;
this.obsLog = obsLog;
this.cost = cost;
this.obsStr = obsStr;
this.odc = odc;
}
public Long getIclave() {
return iclave;
}
public void setIclave(Long iclave) {
this.iclave = iclave;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getAmount() {
return amount;
}
public void setAmount(Integer amount) {
this.amount = amount;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public Long getObs() {
return obs;
}
public void setObs(Long obs) {
this.obs = obs;
}
public Long getObsLog() {
return obsLog;
}
public void setObsLog(Long obsLog) {
this.obsLog = obsLog;
}
public Float getCost() {
return cost;
}
public void setCost(Float cost) {
this.cost = cost;
}
public String getObsStr() {
return obsStr;
}
public void setObsStr(String obsStr) {
this.obsStr = obsStr;
}
public Integer getOdc() {
return odc;
}
public void setOdc(Integer odc) {
this.odc = odc;
}
// KEEP METHODS - put your custom methods here
// KEEP METHODS END
}
| [
"od.pelayo@gmail.com"
] | od.pelayo@gmail.com |
9b349d9d3b30006e6da6d5933d2a78caf954c1da | c7542b88d25b941cc8a2fb4f10a2126ed131762f | /Shake_alarm/app/src/main/java/com/example/nishchay/shake_alarm/CurrentAlarms.java | 27eba9464abe752087b0d11c3c4bf5434e3df9e6 | [] | no_license | nagrawal63/ShakeAlarm | e4bdbdbecc7b7535b80d26b9bdd3e2ee50348205 | ceb43241d6989f2a9d17bbfc6f294ab3a9538c3c | refs/heads/master | 2021-08-03T11:08:30.562275 | 2017-05-24T06:03:04 | 2017-05-24T06:03:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,427 | java | package com.example.nishchay.shake_alarm;
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
//This class handles the current alarms activity including list view stuff
public class CurrentAlarms extends Activity implements OnItemClickListener {
//Adapter used for the list view
ArrayAdapter<String> adapter;
protected void onCreate(Bundle savedInstanceState) {
//Checks to see that there are actually alarms currently set
if( Set_Alarm.getAlarmSentenceLength() == 0){
Toast.makeText(getApplicationContext(), "No alarms currently set", Toast.LENGTH_SHORT).show();
finish();
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_current_alarms);
//Sets the listview to the adapter
ListView listOfAlarms = (ListView) findViewById(R.id.listOfAlarms);
adapter = new ArrayAdapter<String>(this, R.layout.alarm_list_entry);
listOfAlarms.setAdapter(adapter);
//Goes through the array list and adds it to the listview
//It parses from 13 to the end of the strings because the first 13 chars are
//the time in millis that the alarms were set for, that allows for proper sorting
for (int i = 0; i < Set_Alarm.getAlarmSentenceLength(); i++ ){
adapter.add( Set_Alarm.getAlarmSentence(i).substring(13, Set_Alarm.getAlarmSentence(i).length()));
}
listOfAlarms.setOnItemClickListener(this);
}
//Listener for clicking on the list view
@Override
public void onItemClick(AdapterView<?> l, View v, int position, long id) {
//The position in the list view of the clicked on item
final int pos = position;
//This creates a pop-up that prompts the user if they want to delete an alarm
new AlertDialog.Builder(this)
.setTitle("Cancel Alarm")
.setMessage("Would you like to cancel this alarm?")
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//If they choose yes then it creates a matching intent as the alarm to cancel it
//and removes the alarm from the list view and both array lists
PendingIntent temp = Set_Alarm.cancelAlarm(pos);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.cancel(temp);
adapter.remove(Set_Alarm.getAlarmSentence(pos).substring(13, Set_Alarm.getAlarmSentence(pos).length()));
Set_Alarm.removeAlarmSentence(pos);
Set_Alarm.removeCampers(pos);
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//If they say no then the pop-up closes and nothing happens
}
})
.show();
}
//A button to return to the first screen of the app
public void backButton (View view){
finish();
}
}
| [
"agrawal.nishchay5@gmail.com"
] | agrawal.nishchay5@gmail.com |
414f59d31f75b3baaf3988aee96ea0209ce67177 | 61c095b7216b9cbb46fa151c5b144040b0eb707a | /app/src/main/java/com/cubosystems/findme/Models/MyAdapter.java | 9821c89d0886bcade97f991d2a49829bf48c099c | [] | no_license | sajadj313/findme | e49e26df82e3322dc583fc295bafe0b9d59774fa | 8e8b14327428c90213a72816a319ed14d6c432c8 | refs/heads/master | 2020-03-25T13:26:33.329803 | 2018-08-07T06:17:23 | 2018-08-07T06:17:23 | 143,825,146 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,322 | java | package com.cubosystems.findme.Models;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.cubosystems.findme.R;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by Administrator on 7/24/2018.
*/
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> {
private HashMap<String,LostPerson> dataHashMap;
private ArrayList<LostPerson> dataset;
private Context context;
public void delete(int position){
dataset.remove(position);
notifyItemRemoved(position);
}
class ViewHolder extends RecyclerView.ViewHolder{
public TextView textView1, textView2, textView3;
ImageView btnFound, btnNotFound;
public ViewHolder(View itemView){
super(itemView);
textView1 = itemView.findViewById(R.id.txt1);
textView2 = itemView.findViewById(R.id.txt2);
textView3 = itemView.findViewById(R.id.txtPersonID);
btnFound = itemView.findViewById(R.id.btnFound);
btnNotFound = itemView.findViewById(R.id.btnNotFound);
btnFound.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String uniqueID = textView3.getText().toString();
//Toast.makeText(context,uniqueID, Toast.LENGTH_SHORT).show();
FirebaseDatabase database = FirebaseDatabase.getInstance();
final DatabaseReference ref = database.getReference("LostPeople").child(uniqueID);
ref.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
LostPerson lp = dataSnapshot.getValue(LostPerson.class);
lp.setStatus("found");
ref.setValue(lp).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
delete(getAdapterPosition());
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
e.printStackTrace();
}
});
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
});
btnNotFound.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
/*View v = ((LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.layout_not_found_alert_dialog,null);
final AlertDialog alertDialog = new AlertDialog.Builder(context).create();
alertDialog.setView(v);
alertDialog.show();*/
String uniqueID = textView3.getText().toString();
//Toast.makeText(context,uniqueID, Toast.LENGTH_SHORT).show();
FirebaseDatabase database = FirebaseDatabase.getInstance();
final DatabaseReference ref = database.getReference("LostPeople").child(uniqueID);
ref.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
LostPerson lp = dataSnapshot.getValue(LostPerson.class);
lp.setStatus("not found");
ref.setValue(lp).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(context, "Updated successfully", Toast.LENGTH_SHORT).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
e.printStackTrace();
}
});
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
});
}
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.lost_person_record,parent,false);
ViewHolder vh = new ViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.textView1.setText(dataset.get(position).getPersonName());
holder.textView2.setText(dataset.get(position).getStationName());
holder.textView3.setText(dataset.get(position).getId());
}
public MyAdapter(ArrayList<LostPerson> myDataset, Context c){
dataset = myDataset;
context = c;
}
@Override
public int getItemCount() {
return dataset.size();
}
}
| [
"sajad.jaward1@gmail.com"
] | sajad.jaward1@gmail.com |
50c592add8b6f97ed121093787fde776b82f1c11 | 56bee454bd28e5841988080cc9dbd0878b9b790d | /src/org/jhotdraw/draw/action/AbstractEditorAction.java | c3eb68abd3caeb08ca59be53aa7e60cc7267c389 | [] | no_license | fkhalil/JHotDraw-7.0.6 | 57d025cc79a66b8e012cc3009a40b32cc4c621a5 | b94a8f2009a32027833b6f3f4b5b642ab51c8986 | refs/heads/master | 2021-04-09T16:29:35.811647 | 2018-03-18T20:28:49 | 2018-03-18T20:28:49 | 125,764,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,602 | java | /*
* @(#)AbstractEditorAction.java 1.1 2006-03-15
*
* Copyright (c) 1996-2006 by the original authors of JHotDraw
* and all its contributors ("JHotDraw.org")
* All rights reserved.
*
* This software is the confidential and proprietary information of
* JHotDraw.org ("Confidential Information"). You shall not disclose
* such Confidential Information and shall use it only in accordance
* with the terms of the license agreement you entered into with
* JHotDraw.org.
*/
package org.jhotdraw.draw.action;
import org.jhotdraw.draw.Drawing;
import org.jhotdraw.draw.DrawingEditor;
import org.jhotdraw.draw.DrawingView;
import org.jhotdraw.util.*;
import javax.swing.*;
import javax.swing.undo.*;
import java.util.*;
import java.beans.*;
/**
* Abstract super class for actions which act on a DrawingEditor.
*
* @author Werner Randelshofer
* @version 1.1 2006-03-15 Support for enabled state of editor added.
* <br>1.0 2003-12-01 Created.
*/
public abstract class AbstractEditorAction extends AbstractAction {
protected DrawingEditor editor;
protected final static ResourceBundleUtil labels =
ResourceBundleUtil.getLAFBundle("org.jhotdraw.draw.Labels", Locale.getDefault());
private PropertyChangeListener propertyChangeHandler = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("enabled")) {
updateEnabledState();
}
}
};
/** Creates a new instance. */
public AbstractEditorAction(DrawingEditor editor) {
this.editor = editor;
if (editor != null) {
editor.addPropertyChangeListener(propertyChangeHandler);
updateEnabledState();
}
}
public void setEditor(DrawingEditor newValue) {
if (editor != null) {
editor.removePropertyChangeListener(propertyChangeHandler);
}
editor = newValue;
if (editor != null) {
editor.addPropertyChangeListener(propertyChangeHandler);
updateEnabledState();
}
}
public void updateEnabledState() {
setEnabled(editor != null && editor.isEnabled());
}
public DrawingEditor getEditor() {
return editor;
}
protected DrawingView getView() {
return editor.getView();
}
protected Drawing getDrawing() {
return getView().getDrawing();
}
protected void fireUndoableEditHappened(UndoableEdit edit) {
getDrawing().fireUndoableEditHappened(edit);
}
}
| [
"fadikhalil230@gmail.com"
] | fadikhalil230@gmail.com |
8006c0cc50420f1add02d3dd12aa8408baa1650d | a795d3046c8d9fed809be646d16eaa0f01bad2d0 | /app/src/main/java/casier/billsplitter/CreateAccount/CreateAccountActivity.java | f0807dcb6795bfd1a0fd44b473b3ea7f8670f183 | [] | no_license | Casier/BillSplitter | d86f670b6989975f7e121ac96fc597873966d42b | 80c22557cfd436fbbfcbb620b29aaf482f6d5f97 | refs/heads/master | 2020-03-23T23:02:30.797433 | 2018-11-17T20:47:26 | 2018-11-17T20:47:26 | 142,212,835 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,308 | java | package casier.billsplitter.CreateAccount;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Toast;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnTextChanged;
import casier.billsplitter.AddBill.UserPickerAdapter;
import casier.billsplitter.FriendSearch.FriendSearchActivity;
import casier.billsplitter.Model.User;
import casier.billsplitter.R;
public class CreateAccountActivity extends Activity {
@BindView(R.id.account_user_picker_recycler)
RecyclerView usersPicker;
@BindView(R.id.account_name)
EditText accountNameEditText;
@BindView(R.id.account_users_search)
EditText userSearch;
@BindView(R.id.user_picker_placeholder)
RelativeLayout placeholder;
private final int ADD_FRIEND = 1;
private CreateAccountPresenter presenter;
private UserPickerAdapter adapter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_account);
ButterKnife.bind(this);
presenter = new CreateAccountPresenter(this);
adapter = new UserPickerAdapter(this, R.layout.row_user_picker, presenter.getUserFriendList());
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(this, 2);
usersPicker.setLayoutManager(layoutManager);
usersPicker.setHasFixedSize(true);
usersPicker.setAdapter(adapter);
checkIfPlaceholder();
}
@OnClick(R.id.button_create_account)
public void onClickCreateAccount() {
String accountName = accountNameEditText.getText().toString();
if (accountName.equals("")) {
Toast.makeText(this, "Veuillez nommer votre compte !", Toast.LENGTH_LONG).show();
return;
}
presenter.createAccount(accountName, adapter.getSelectedUserList());
Intent intent = new Intent();
setResult(1, intent);
finish();
}
@OnTextChanged(R.id.account_users_search)
public void onSearchTextChanged(Editable editable){
adapter.setUserList(presenter.getFilteredUserFriendList(editable.toString()));
adapter.notifyDataSetChanged();
checkIfPlaceholder();
}
@OnClick(R.id.search_clear_text)
public void clearSearch(){
userSearch.setText(""); // trigger onSearchTextChanged
}
public void checkIfPlaceholder(){
if(adapter.getItemCount() == 0){
placeholder.setVisibility(View.VISIBLE);
} else {
placeholder.setVisibility(View.GONE);
}
}
@OnClick(R.id.create_account_add_friend)
public void onAddFriend(){
Intent intent = new Intent(this, FriendSearchActivity.class);
startActivityForResult(intent, ADD_FRIEND);
}
public void updateAdapter(List<User> userList){
adapter.setUserList(userList);
checkIfPlaceholder();
}
}
| [
"arthurmercier01@gmail.com"
] | arthurmercier01@gmail.com |
d93093b9e9b4fbe6101e5ac1ac00ca9fb55a5f96 | 4cd3f2fe9f35ecbb1a692dbb0b914255873c155d | /src/test/java/GildedRoseTest.java | 5e02e5955bfb3917549194f6f59ae46c68ccadf7 | [] | no_license | ojusti/GildedRose | f0421e2eaf8390593e57878842e951b2ae515868 | bcbb215573df00f7a6fd475e27d11924909dd44d | refs/heads/master | 2021-01-22T09:54:18.508167 | 2014-05-31T11:49:44 | 2014-05-31T11:49:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,493 | java | import java.util.Collections;
import org.approvaltests.legacycode.LegacyApprovals;
import org.junit.Before;
import org.junit.Test;
public class GildedRoseTest
{
private String[] items;
private Integer[] qualities;
private Integer[] sellIns;
@Before
public void setUp()
{
items = new String[] { ItemNames._5_DEXTERITY_VEST, ItemNames.AGED_BRIE, ItemNames.SULFURAS_HAND_OF_RAGNAROS, ItemNames.BACKSTAGE_PASSES_TO_A_TAFKAL80ETC_CONCERT, ItemNames.CONJURED_MANA_CAKE };
sellIns = new Integer[15];
for(int i = 0; i < sellIns.length; i++)
{
sellIns[i] = i - 1;
}
qualities = new Integer[] { Quality.legendary(), Quality.max(), Quality.max() - 1, Quality.min() + 1, Quality.min() };
}
@Test
public void lockDown() throws Exception
{
LegacyApprovals.LockDown(this, "updateQuality", items, sellIns, qualities);
}
public String updateQuality(String item, Integer sellIn, Integer quality) throws Exception
{
if(!isCoherent(item, sellIn, quality))
{
return null;
}
GildedRose gildedRose = new GildedRose(Collections.singletonList(new Item(item, sellIn, quality)));
gildedRose.updateQuality();
return gildedRose.toString();
}
private boolean isCoherent(String item, Integer sellIn, Integer quality)
{
return item.equals(ItemNames.SULFURAS_HAND_OF_RAGNAROS) ? quality == Quality.legendary() && sellIn == 0
: quality != Quality.legendary();
}
}
| [
"ojusti@yahoo.fr"
] | ojusti@yahoo.fr |
ca7c1a9227921a3caf4a863da0b33dfa85f75ca6 | e64f598a9fa0933f8483065e191eea08bae986d9 | /src/main/java/boost/util/iterators/IMappingFunction.java | 5db8c0c4cdd1341b8fffc7abe85564358d103696 | [] | no_license | VSergey/JavaBoost | 4ba016953f037f5ef1188a513c06632c34147e9a | 0fc267d08fbd90702a038188b7ac0615a78152eb | refs/heads/master | 2021-01-19T03:42:28.440608 | 2017-01-12T14:12:01 | 2017-01-12T14:12:01 | 63,435,486 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package boost.util.iterators;
/**
* Created by Sergey.Voronezhtsev on 12/1/2017.
*/
public interface IMappingFunction<A, B> {
B apply(A p_a);
}
| [
"sergey.voronezhtsev@trafigura.com"
] | sergey.voronezhtsev@trafigura.com |
18114173e4f7dace92149767e7b329d32ce0958c | f5cd470631d9cca796d3bb5668f3437e1181beac | /src/main/java/com/cvinicius/workshopmongo/services/ObjectNotFoundException.java | 0550d806e1ffd7a53e2ff5efc93a555efb2358c5 | [] | no_license | c-viniciussantos/workshop-spring-boot-mongodb | c9194ead1f26cc231c951f9df92fbf5f061b124e | 580c135b38043d3fd68e562e8221d205f9f04d40 | refs/heads/master | 2022-11-24T12:35:12.228703 | 2020-07-30T20:16:00 | 2020-07-30T20:16:00 | 282,998,112 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package com.cvinicius.workshopmongo.services;
public class ObjectNotFoundException extends RuntimeException{
private static final long serialVersionUID = 1L;
public ObjectNotFoundException(String msg) {
super(msg);
}
}
| [
"c.viniciussantos@outlook.com"
] | c.viniciussantos@outlook.com |
d43c74a08da4bea9e5c258673132d19a5e9aaafc | 900618216c6b3af83e9e5a74bbbc884ccdb16b93 | /CrackingTheCodeJava/src/chapter1/Q3.java | 127e28839796b9179622da92bea1ddedd89759af | [] | no_license | mikeburkat/CrackingTheCodingInterview | c7d9d99e8c4e6330822c2b3f07c3f9c17bab8ba5 | bbd70961285b1874661164d4c04239419068c0f2 | refs/heads/master | 2016-09-05T11:18:48.820120 | 2014-06-11T00:47:42 | 2014-06-11T00:47:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package chapter1;
public class Q3 {
public boolean isPermutation(String one, String two) {
String first = one.toLowerCase();
String second = two.toLowerCase();
if (first.length() != second.length()) {
return false;
}
int charFrequency[] = new int[256];
int temp;
for (int i = 0; i < first.length(); i++) {
temp = first.charAt(i);
charFrequency[temp]++;
}
for (int i = 0; i < second.length(); i++) {
temp = second.charAt(i);
if (charFrequency[temp] == 0) {
return false;
} else {
charFrequency[temp]--;
}
}
return true;
}
public static void main(String[] args) {
Q3 test = new Q3();
System.out.println( test.isPermutation("Elvis", "Lives") );
System.out.println( test.isPermutation("The Meaning of Life ", "The fine game of nil") );
System.out.println( test.isPermutation("this is Wrong!", "test will fail") );
}
}
| [
"mike.burkat@gmail.com"
] | mike.burkat@gmail.com |
329c2ea9abd7866afd9b7ba6111f0bd49679fc4d | 8bcda6f3f24e6d83c83aa079ca24ea3c0b806a31 | /tp-gestionnaire-dossier/src/main/java/fr/isika/cdi9/spring/bean/Gestionnaire.java | dcfdb25e7641e61ddca5dff7a09c61e148a9b154 | [] | no_license | GeoffRichez/TP-Spring | 5f8948b3b9d0fa7cfeaaed030f29982206fd015c | 116b6e4d0a07ddca6e050be70108826b70ae2342 | refs/heads/master | 2023-06-14T14:23:10.401487 | 2021-07-05T12:50:05 | 2021-07-05T12:50:05 | 382,328,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 620 | java | package fr.isika.cdi9.spring.bean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class Gestionnaire {
private String nom;
private String prenom;
@Autowired
private Dossier dossier;
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public Dossier getDossier() {
return dossier;
}
public void setDossier(Dossier dossier) {
this.dossier = dossier;
}
}
| [
"geoff.richez@gmail.com"
] | geoff.richez@gmail.com |
5bb1c5f603c32b032f274d076f8db9ae7bab7a88 | de08918e0706d699c56337a355ca118ceb37bc1e | /src/main/java/com/example/demo/entity/EmpState.java | 7f95a859c12ee54b00440ab3b12c6c9653ec25f0 | [] | no_license | YaFengJin/super | 3344920389f82a0788865b4f7cc2cf98862eb830 | b633718ec17246138c2e97da81314ce4fb88e72d | refs/heads/master | 2020-04-01T20:40:59.364543 | 2018-11-12T01:09:20 | 2018-11-12T01:10:19 | 153,410,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 431 | java | package com.example.demo.entity;
public class EmpState {
private long empStateId;
private String empStateName;
public long getEmpStateId() {
return empStateId;
}
public void setEmpStateId(long empStateId) {
this.empStateId = empStateId;
}
public String getEmpStateName() {
return empStateName;
}
public void setEmpStateName(String empStateName) {
this.empStateName = empStateName;
}
}
| [
"1762683256@qq.com"
] | 1762683256@qq.com |
8ab1f07fae477f8e1eb4b3e27eea40c5069ed4dd | 6ef9071c2e4782b642722aa871e63fa5e52acaef | /src/entidades/Cuota.java | 1204e18aaff17eb4d0a8ec587bc3a56a3df070b3 | [] | no_license | joseluetich/tpDisenoDeSistemas | af167af8888f841d9ab07f456e43dc49bf613ffc | 2a73d351cc03aaaff54dcd913bd02c1a910971d0 | refs/heads/master | 2020-09-03T04:18:15.144206 | 2019-11-04T00:19:02 | 2019-11-04T00:19:02 | 219,384,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | package entidades;
import java.util.Date;
public class Cuota {
int numeroCuota;
Date fechaDeVencimiento;
Float valorActual;
Float valorOriginal;
Pago idPago;
Poliza poliza;
public Cuota() {
}
public Cuota(int numeroCuota, Date fechaDeVencimiento, Float valorActual, Float valorOriginal, Pago idPago, Poliza poliza) {
this.numeroCuota = numeroCuota;
this.fechaDeVencimiento = fechaDeVencimiento;
this.valorActual = valorActual;
this.valorOriginal = valorOriginal;
this.idPago = idPago;
this.poliza = poliza;
}
public int getNumeroCuota() {
return numeroCuota;
}
public void setNumeroCuota(int numeroCuota) {
this.numeroCuota = numeroCuota;
}
public Date getFechaDeVencimiento() {
return fechaDeVencimiento;
}
public void setFechaDeVencimiento(Date fechaDeVencimiento) {
this.fechaDeVencimiento = fechaDeVencimiento;
}
public Float getValorActual() {
return valorActual;
}
public void setValorActual(Float valorActual) {
this.valorActual = valorActual;
}
public Float getValorOriginal() {
return valorOriginal;
}
public void setValorOriginal(Float valorOriginal) {
this.valorOriginal = valorOriginal;
}
}
| [
"josefinaluetich@gmail.com"
] | josefinaluetich@gmail.com |
fd48f2f71c58ad58a78dcb6f0dc2436a125f24cd | 7ea1b578c1cdbba910e76a527537a72167ae5bfb | /my-rest/src/main/java/com/leo/springboot/enable/entity/Bird.java | 2024fb4fd8ae84b9659e4fc934577e02c0d9f2ba | [] | no_license | lzlqq/my-springboot | d277c147d6ba21487f0e54e4abbaf1c9faa44836 | 90312187c25148a7a2c21abe63df56bd0b1ee163 | refs/heads/master | 2022-12-03T00:10:29.801163 | 2022-01-25T09:25:05 | 2022-01-25T09:25:05 | 172,305,396 | 0 | 0 | null | 2022-11-24T04:45:11 | 2019-02-24T06:43:31 | JavaScript | UTF-8 | Java | false | false | 134 | java | package com.leo.springboot.enable.entity;
import org.springframework.stereotype.Component;
@Component
public class Bird{
}
| [
"zhilong.liu@baozun.com"
] | zhilong.liu@baozun.com |
b5325c876a58052504b8b0d2483c5a9cc4b3a3dd | 874dbd880b4feaec066e8715fa0d0ac1ebb45f7a | /android/src/main/kotlin/com/ril/pdf_box/pdfbox/pdmodel/interactive/digitalsignature/visible/PDFTemplateStructure.java | 28aa64d8c69ee0a387feca3b92811c4dc44e109e | [
"MIT"
] | permissive | rajeevjaiswal/pdf_merger | 0cc68a250c7b3925542e0d293d4484791d96abef | 7febb61f3de80df94e49c1a136842316883eb6d4 | refs/heads/master | 2023-06-11T05:42:45.370616 | 2021-07-08T07:30:22 | 2021-07-08T07:30:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,210 | 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.ril.pdf_box.pdfbox.pdmodel.interactive.digitalsignature.visible;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import com.ril.pdf_box.harmony.awt.geom.AffineTransform;
import com.ril.pdf_box.pdfbox.cos.COSArray;
import com.ril.pdf_box.pdfbox.cos.COSDictionary;
import com.ril.pdf_box.pdfbox.cos.COSDocument;
import com.ril.pdf_box.pdfbox.cos.COSName;
import com.ril.pdf_box.pdfbox.pdfwriter.COSWriter;
import com.ril.pdf_box.pdfbox.pdmodel.PDDocument;
import com.ril.pdf_box.pdfbox.pdmodel.PDPage;
import com.ril.pdf_box.pdfbox.pdmodel.PDResources;
import com.ril.pdf_box.pdfbox.pdmodel.common.PDRectangle;
import com.ril.pdf_box.pdfbox.pdmodel.common.PDStream;
import com.ril.pdf_box.pdfbox.pdmodel.graphics.form.PDFormXObject;
import com.ril.pdf_box.pdfbox.pdmodel.graphics.image.PDImageXObject;
import com.ril.pdf_box.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
import com.ril.pdf_box.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
import com.ril.pdf_box.pdfbox.pdmodel.interactive.form.PDAcroForm;
import com.ril.pdf_box.pdfbox.pdmodel.interactive.form.PDField;
import com.ril.pdf_box.pdfbox.pdmodel.interactive.form.PDSignatureField;
/**
* Structure of PDF document with visible signature.
*
* @author Vakhtang Koroghlishvili
*/
public class PDFTemplateStructure
{
private PDPage page;
private PDDocument template;
private PDAcroForm acroForm;
private PDSignatureField signatureField;
private PDSignature pdSignature;
private COSDictionary acroFormDictionary;
private PDRectangle signatureRectangle;
private AffineTransform affineTransform;
private COSArray procSet;
private PDImageXObject image;
private PDRectangle formatterRectangle;
private PDStream holderFormStream;
private PDResources holderFormResources;
private PDFormXObject holderForm;
private PDAppearanceDictionary appearanceDictionary;
private PDStream innterFormStream;
private PDResources innerFormResources;
private PDFormXObject innerForm;
private PDStream imageFormStream;
private PDResources imageFormResources;
private List<PDField> acroFormFields;
private COSName innerFormName;
private COSName imageFormName;
private COSName imageName;
private COSDocument visualSignature;
private PDFormXObject imageForm;
private COSDictionary widgetDictionary;
/**
* Returns document page.
* @return the page
*/
public PDPage getPage()
{
return page;
}
/**
* Sets document page
* @param page
*/
public void setPage(PDPage page)
{
this.page = page;
}
/**
* Gets PDDocument template.
* This represents a digital signature
* that can be attached to a document
* @return the template
*/
public PDDocument getTemplate()
{
return template;
}
/**
* Wets PDDocument template.
* This represents a digital signature
* that can be attached to a document
* @param template
*/
public void setTemplate(PDDocument template)
{
this.template = template;
}
/**
* Gets AcroForm
* @return the AcroForm
*/
public PDAcroForm getAcroForm()
{
return acroForm;
}
/**
* Sets AcroForm
* @param acroForm
*/
public void setAcroForm(PDAcroForm acroForm)
{
this.acroForm = acroForm;
}
/**
* Gets Signature field
* @return the signature field
*/
public PDSignatureField getSignatureField()
{
return signatureField;
}
/**
* Sets signature field
* @param signatureField
*/
public void setSignatureField(PDSignatureField signatureField)
{
this.signatureField = signatureField;
}
/**
* Gets PDSignature
* @return the signature
*/
public PDSignature getPdSignature()
{
return pdSignature;
}
/**
* Sets PDSignatureField
* @param pdSignature
*/
public void setPdSignature(PDSignature pdSignature)
{
this.pdSignature = pdSignature;
}
/**
* Gets Dictionary of AcroForm. Thats <b> /DR </b>
* entry in the AcroForm
* @return the AcroForm's dictionary
*/
public COSDictionary getAcroFormDictionary()
{
return acroFormDictionary;
}
/**
* Acroform have its Dictionary, so we here set
* the Dictionary which is in this location:
* <b> AcroForm/DR <b>
* @param acroFormDictionary
*/
public void setAcroFormDictionary(COSDictionary acroFormDictionary)
{
this.acroFormDictionary = acroFormDictionary;
}
/**
* Gets SignatureRectangle
* @return the rectangle for the signature
*/
public PDRectangle getSignatureRectangle()
{
return signatureRectangle;
}
/**
* Sets SignatureRectangle
* @param singatureRectangle
*/
public void setSignatureRectangle(PDRectangle singatureRectangle)
{
this.signatureRectangle = singatureRectangle;
}
/**
* Gets AffineTransform
* @return the AffineTransform
*/
public AffineTransform getAffineTransform()
{
return affineTransform;
}
/**
* Sets AffineTransform
* @param affineTransform
*/
public void setAffineTransform(AffineTransform affineTransform)
{
this.affineTransform = affineTransform;
}
/**
* Gets ProcSet Array
* @return the PorocSet array
*/
public COSArray getProcSet()
{
return procSet;
}
/**
* Sets ProcSet Array
* @param procSet
*/
public void setProcSet(COSArray procSet)
{
this.procSet = procSet;
}
/**
* Gets the image of visible signature
* @return the image making up the visible signature
*/
public PDImageXObject getImage()
{
return image;
}
/**
* Sets the image of visible signature
* @param image Image XObject
*/
public void setImage(PDImageXObject image)
{
this.image = image;
}
/**
* Gets formatter rectangle
* @return the formatter rectangle
*/
public PDRectangle getFormatterRectangle()
{
return formatterRectangle;
}
/**
* Sets formatter rectangle
* @param formatterRectangle
*/
public void setFormatterRectangle(PDRectangle formatterRectangle)
{
this.formatterRectangle = formatterRectangle;
}
/**
* Sets HolderFormStream
* @return the holder form stream
*/
public PDStream getHolderFormStream()
{
return holderFormStream;
}
/**
* Sets stream of holder form Stream
* @param holderFormStream
*/
public void setHolderFormStream(PDStream holderFormStream)
{
this.holderFormStream = holderFormStream;
}
/**
* Gets Holder form.
* That form is here <b> AcroForm/DR/XObject/{holder form name} </b>
* By default, name stars with FRM. We also add number of form
* to the name.
* @return the holder form
*/
public PDFormXObject getHolderForm()
{
return holderForm;
}
/**
* In the structure, form will be contained by XObject in the <b>AcroForm/DR/ </b>
* @param holderForm
*/
public void setHolderForm(PDFormXObject holderForm)
{
this.holderForm = holderForm;
}
/**
* Gets Holder form resources
* @return the holder form's resources
*/
public PDResources getHolderFormResources()
{
return holderFormResources;
}
/**
* Sets holder form resources
* @param holderFormResources
*/
public void setHolderFormResources(PDResources holderFormResources)
{
this.holderFormResources = holderFormResources;
}
/**
* Gets AppearanceDictionary
* That is <b>/AP</b> entry the appearance dictionary.
* @return the Appearance Dictionary
*/
public PDAppearanceDictionary getAppearanceDictionary()
{
return appearanceDictionary;
}
/**
* Sets AppearanceDictionary
* That is <b>/AP</b> entry the appearance dictionary.
* @param appearanceDictionary
*/
public void setAppearanceDictionary(PDAppearanceDictionary appearanceDictionary)
{
this.appearanceDictionary = appearanceDictionary;
}
/**
* Gets Inner form Stream.
* @return the inner form stream
*/
public PDStream getInnerFormStream()
{
return innterFormStream;
}
/**
* Sets inner form stream
* @param innterFormStream
*/
public void setInnterFormStream(PDStream innterFormStream)
{
this.innterFormStream = innterFormStream;
}
/**
* Gets inner form Resource
* @return the inner form's resources
*/
public PDResources getInnerFormResources()
{
return innerFormResources;
}
/**
* Sets inner form resource
* @param innerFormResources
*/
public void setInnerFormResources(PDResources innerFormResources)
{
this.innerFormResources = innerFormResources;
}
/**
* Gets inner form that is in this location:
* <b> AcroForm/DR/XObject/{holder form name}/Resources/XObject/{inner name} </b>
* By default inner form name starts with "n". Then we add number of form
* to the name.
* @return the inner form
*/
public PDFormXObject getInnerForm()
{
return innerForm;
}
/**
* sets inner form to this location:
* <b> AcroForm/DR/XObject/{holder form name}/Resources/XObject/{destination} </b>
* @param innerForm
*/
public void setInnerForm(PDFormXObject innerForm)
{
this.innerForm = innerForm;
}
/**
* Gets name of inner form
* @return the inner forms's name
*/
public COSName getInnerFormName()
{
return innerFormName;
}
/**
* Sets inner form name
* @param innerFormName
*/
public void setInnerFormName(COSName innerFormName)
{
this.innerFormName = innerFormName;
}
/**
* Gets Image form stream
* @return the image form's stream
*/
public PDStream getImageFormStream()
{
return imageFormStream;
}
/**
* Sets image form stream
* @param imageFormStream
*/
public void setImageFormStream(PDStream imageFormStream)
{
this.imageFormStream = imageFormStream;
}
/**
* Gets image form resources
* @return the image form's resources
*/
public PDResources getImageFormResources()
{
return imageFormResources;
}
/**
* Sets image form resource
* @param imageFormResources
*/
public void setImageFormResources(PDResources imageFormResources)
{
this.imageFormResources = imageFormResources;
}
/**
* Gets Image form. Image form is in this structure:
* <b>/AcroForm/DR/{holder form}/Resources/XObject /{inner form} </b>
* /Resources/XObject/{image form name}.
* @return the image form
*/
public PDFormXObject getImageForm()
{
return imageForm;
}
/**
* Sets Image form. Image form will be in this structure:
* <b>/AcroForm/DR/{holder form}/Resources/XObject /{inner form}
* /Resources/XObject/{image form name}.</b> By default we start
* image form name with "img". Then we add number of image
* form to the form name.
* Sets image form
* @param imageForm
*/
public void setImageForm(PDFormXObject imageForm)
{
this.imageForm = imageForm;
}
/**
* Gets image form name
* @return the image form's name
*/
public COSName getImageFormName()
{
return imageFormName;
}
/**
* Sets image form name
* @param imageFormName
*/
public void setImageFormName(COSName imageFormName)
{
this.imageFormName = imageFormName;
}
/**
* Gets visible signature image name
* @return the visible signature's image name
*/
public COSName getImageName()
{
return imageName;
}
/**
* Sets visible signature image name
* @param imageName
*/
public void setImageName(COSName imageName)
{
this.imageName = imageName;
}
/**
* Gets COSDocument of visible Signature.
* @see com.ril.pdf_box.pdfbox.cos.COSDocument
* @return the visual signature
*/
public COSDocument getVisualSignature()
{
return visualSignature;
}
/**
*
* Sets COSDocument of visible Signature.
* @see com.ril.pdf_box.pdfbox.cos.COSDocument
* @param visualSignature
*/
public void setVisualSignature(COSDocument visualSignature)
{
this.visualSignature = visualSignature;
}
/**
* Gets acroFormFields
* @return the AcroForm fields
*/
public List<PDField> getAcroFormFields()
{
return acroFormFields;
}
/**
* Sets acroFormFields
* @param acroFormFields
*/
public void setAcroFormFields(List<PDField> acroFormFields)
{
this.acroFormFields = acroFormFields;
}
/**
* Gets AP of the created template
* @return the templates Appearance Stream
* @throws IOException
*/
public ByteArrayInputStream getTemplateAppearanceStream() throws IOException
{
COSDocument visualSignature = getVisualSignature();
ByteArrayOutputStream memoryOut = new ByteArrayOutputStream();
COSWriter memoryWriter = new COSWriter(memoryOut);
memoryWriter.write(visualSignature);
ByteArrayInputStream input = new ByteArrayInputStream(memoryOut.toByteArray());
getTemplate().close();
return input;
}
/**
* Gets Widget Dictionary.
*
* @return the widget dictionary
*/
public COSDictionary getWidgetDictionary()
{
return widgetDictionary;
}
/**
* Sets Widget Dictionary.
*
* @param widgetDictionary
*/
public void setWidgetDictionary(COSDictionary widgetDictionary)
{
this.widgetDictionary = widgetDictionary;
}
}
| [
"abhay.dhiman@ril.com"
] | abhay.dhiman@ril.com |
399ad56ea1a4ca82124fc81261bcaea1ffe3def0 | d71e879b3517cf4fccde29f7bf82cff69856cfcd | /ExtractedJars/RT_News_com.rt.mobile.english/javafiles/android/support/v4/view/ViewCompat$ViewCompatApi19Impl.java | 65aaba7317e0e2b7266c1eb34cd60ba83ad55906 | [
"MIT"
] | permissive | Andreas237/AndroidPolicyAutomation | b8e949e072d08cf6c6166c3f15c9c63379b8f6ce | c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a | refs/heads/master | 2020-04-10T02:14:08.789751 | 2019-05-16T19:29:11 | 2019-05-16T19:29:11 | 160,739,088 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,069 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package android.support.v4.view;
import android.view.View;
// Referenced classes of package android.support.v4.view:
// ViewCompat
static class ViewCompat$ViewCompatApi19Impl extends ViewCompat$ViewCompatApi18Impl
{
public int getAccessibilityLiveRegion(View view)
{
return view.getAccessibilityLiveRegion();
// 0 0:aload_1
// 1 1:invokevirtual #22 <Method int View.getAccessibilityLiveRegion()>
// 2 4:ireturn
}
public boolean isAttachedToWindow(View view)
{
return view.isAttachedToWindow();
// 0 0:aload_1
// 1 1:invokevirtual #27 <Method boolean View.isAttachedToWindow()>
// 2 4:ireturn
}
public boolean isLaidOut(View view)
{
return view.isLaidOut();
// 0 0:aload_1
// 1 1:invokevirtual #30 <Method boolean View.isLaidOut()>
// 2 4:ireturn
}
public boolean isLayoutDirectionResolved(View view)
{
return view.isLayoutDirectionResolved();
// 0 0:aload_1
// 1 1:invokevirtual #33 <Method boolean View.isLayoutDirectionResolved()>
// 2 4:ireturn
}
public void setAccessibilityLiveRegion(View view, int i)
{
view.setAccessibilityLiveRegion(i);
// 0 0:aload_1
// 1 1:iload_2
// 2 2:invokevirtual #38 <Method void View.setAccessibilityLiveRegion(int)>
// 3 5:return
}
public void setImportantForAccessibility(View view, int i)
{
view.setImportantForAccessibility(i);
// 0 0:aload_1
// 1 1:iload_2
// 2 2:invokevirtual #41 <Method void View.setImportantForAccessibility(int)>
// 3 5:return
}
ViewCompat$ViewCompatApi19Impl()
{
// 0 0:aload_0
// 1 1:invokespecial #14 <Method void ViewCompat$ViewCompatApi18Impl()>
// 2 4:return
}
}
| [
"silenta237@gmail.com"
] | silenta237@gmail.com |
6f504bb2c31dad105e6cb84d4132b1a83a2f4434 | fdb2cbbd581af365ba381f59cee490c1b4b3b37c | /java/src/quartz_scheduler/com/quartz/smssendmt/model/TblSMSQueue.java | 52f93f8c5f059629eec52097a0931717b3e59412 | [] | no_license | vuquangtin/frameworks | afbb6a024d7b5a77af1e1d4c204f929a9882bd37 | b43f2f188fa5ee6fc692e0eeba839acb1c6a2c4d | refs/heads/master | 2022-12-16T11:11:56.787032 | 2020-08-28T03:39:54 | 2020-08-28T03:39:54 | 233,235,428 | 0 | 1 | null | 2022-12-16T10:32:07 | 2020-01-11T13:23:36 | Java | UTF-8 | Java | false | false | 1,506 | java | package com.quartz.smssendmt.model;
import java.util.Date;
/**
*
*
* @author EMAIL:vuquangtin@gmail.com , tel:0377443333
* @version 1.0.0
* @see <a href="https://github.com/vuquangtin/frameworks">https://github.com/
* vuquangtin/frameworks</a>
*
*/
public class TblSMSQueue implements java.io.Serializable {
private long gid;
private String phone;
private String content;
private int status;
private Date createdAt;
private Date updatedAt;
public TblSMSQueue() {
}
public TblSMSQueue(String phone, String content, int status) {
this.phone = phone;
this.content = content;
this.status = status;
}
public long getGid() {
return gid;
}
public void setGid(long gid) {
this.gid = gid;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
} | [
"vuquangtin@gmail.com"
] | vuquangtin@gmail.com |
1cfd244fd98289865ce036cd5e228db68ddb89cd | 4357010953bc7aef59be36386b8feb241f0fe69a | /app/src/main/java/com/example/adindariztiaputri/creditapplication/DataApplication.java | 4dfa0dfd48d6c8fd362a20892b5eed09275ece39 | [] | no_license | adindariztia/DemoCreditApp | c5f5f9a9ad09dfc710adb9f481f1244514732690 | 32786b441a0694ce3925361a16810a7ecc377735 | refs/heads/master | 2020-04-26T23:05:32.917637 | 2019-03-05T06:56:42 | 2019-03-05T06:56:42 | 173,892,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,915 | java | package com.example.adindariztiaputri.creditapplication;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class DataApplication {
@SerializedName("id")
@Expose
private String id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("phone")
@Expose
private String phone;
@SerializedName("email")
@Expose
private String email;
@SerializedName("dateOfBirth")
@Expose
private String dateOfBirth;
@SerializedName("address")
@Expose
private String address;
@SerializedName("zipCode")
@Expose
private String zipCode;
@SerializedName("ref1Address")
@Expose
private String ref1Address;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(String dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getZipCode() {
return zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
public String getRef1Address() {
return ref1Address;
}
public void setRef1Address(String ref1Address) {
this.ref1Address = ref1Address;
}
}
| [
"adindariztia@gmail.com"
] | adindariztia@gmail.com |
02e53a15d8c31e04268b197b3047d0bfd7c06069 | 7c8896ebd1acab1bcbe3c42f71337be1066e8e34 | /src/main/java/muic/ooc/zork/gameplay/InputAcceptor.java | 4701ac647b8c5947c4c396d8dbdf30a7ef34ea10 | [] | no_license | thecheesynachos/zork_game | 6cc1ca2e373fd3ab062dccc40fe6017b79164cf7 | 40af522b5d41d3cc679a0b10d985513b35473d4d | refs/heads/master | 2020-05-25T21:10:26.449729 | 2019-05-24T15:56:27 | 2019-05-24T15:56:27 | 187,994,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | package muic.ooc.zork.gameplay;
import muic.ooc.zork.command.Command;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class InputAcceptor {
public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public Command receiveInput(GameBag gameBag){
try {
String inputString = in.readLine();
for (Command command : gameBag.getCommandsList()){
if(inputString.startsWith(command.getCommandString())){
return command;
}
}
} catch(Exception e){
System.out.println("There is an error in command reading, please try again.");
}
return null;
}
public Observation processCommand(Command command, GameBag gameBag){
if(command == null){
return new Observation("Me no get your command, try again.");
} else{
Observation ob = command.doCommand(gameBag);
return ob;
}
}
public String receiveInputAsString(){
try{
String inputString = in.readLine();
return inputString;
} catch (Exception e){
return null;
}
}
}
| [
"apivich.hemachandra@gmail.com"
] | apivich.hemachandra@gmail.com |
c8fbf84bab5d882c50f33b0fc398dacf27c5367e | 55f6b77a87e22b22c3db901afd5ded02610a5dc3 | /src/test/java/com/viseo/fake/db/User.java | 2afb7c5bd5c96f2e2f82a4ed95919e7eaee22ec2 | [] | no_license | Viseo/C360-Training | c97fd96aa2a5dec8d8be9c311216cd6484833472 | 9ceebb363007ba62f66497e95ca319a912885e8b | refs/heads/master | 2021-09-06T02:18:49.894040 | 2017-09-01T12:43:21 | 2017-09-01T12:43:21 | 82,817,710 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package com.viseo.fake.db;
import java.io.Serializable;
public class User implements Serializable {
private static final long serialVersionUID = 1L;
long id;
long version;
String firstName;
String lastName;
boolean blocked;
boolean admin;
Address address;
public User(String firstName, String lastName, boolean blocked,
boolean admin) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.blocked = blocked;
this.admin = admin;
}
public User() {
super();
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public boolean isBlocked() {
return blocked;
}
public void setBlocked(boolean blocked) {
this.blocked = blocked;
}
public boolean isAdmin() {
return admin;
}
public void setAdmin(boolean admin) {
this.admin = admin;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
}
| [
"viktor.lesnyak@viseo.com"
] | viktor.lesnyak@viseo.com |
91539c134bf7b51f30e86244cb36d64a8f140186 | c1017aec396da5e2739dafab843bdfa39d38af69 | /junit_train/02-项目/07-stub/MockTirePressureMonitoringSystem-solution/src/tirepressuremonitoringsystem/SensorAdapter.java | e16c815bfde65bd91a11a9d37687f1962040e120 | [] | no_license | gin2010/java | 76b383157c22cc4120ee908ebfbaa07cc3cbf40e | 128ba234d47ae54c8de8673d42abeb9080da4b33 | refs/heads/master | 2020-06-23T06:28:30.131468 | 2019-10-11T07:14:41 | 2019-10-11T07:14:41 | 198,543,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 209 | java | package tirepressuremonitoringsystem;
public class SensorAdapter implements ISensor {
Sensor sensor = new Sensor();
public double popNextPressurePsiValue() {
return sensor.popNextPressurePsiValue();
}
}
| [
"gin2010@yeah.net"
] | gin2010@yeah.net |
04282a5bfa6b586e43f34a3a60301ead2aaf2ce0 | dd73e0a2d8522b559df10249cc98f6644fe7e12b | /eureka-three/src/test/java/com/syz/eureka/EurekaThreeApplicationTests.java | 4abadb845b73033e0a9414b8fb9ee771b1b7f95d | [] | no_license | syzpig/eureka-cluster | 9e25329ab278a8fe0216fa7cb7a35088ad50ced5 | 9bb7244879749ebc1f55292e4b6240ba3d9184e1 | refs/heads/master | 2020-03-17T17:35:00.375655 | 2018-05-17T11:53:10 | 2018-05-17T11:53:10 | 133,793,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package com.syz.eureka;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class EurekaThreeApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"yingzhu.shao@newtouch.cn"
] | yingzhu.shao@newtouch.cn |
6dcd8900321cde538c546f8bd5a1832b7fe730f6 | 800b992074dcc5451ce10caf8a30efdec54e884d | /src/Ch_07/Video07_03/Start/FlowerRecord.java | 9936747a19a16b77f70993871e7d6aaa8a32c56d | [] | no_license | gauthierwakay/data-science-using-java | 37fe2e9b139f8fc3c35cd1404246992da5c616d0 | 284b279b0ccdd58bbc0f4cf30c0d0b8a8749302b | refs/heads/master | 2023-07-18T01:20:45.707587 | 2021-09-03T19:15:28 | 2021-09-03T19:15:28 | 402,875,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 902 | java | package Ch_07.Video07_03.Start;
public class FlowerRecord {
public final Double sepalLength;
public final Double sepalWidth;
public final Double petalLength;
public final Double petalWidth;
public final String species;
public FlowerRecord(Double sepalLength, Double sepalWidth, Double petalLength, Double petalWidth, String species) {
this.sepalLength = sepalLength;
this.sepalWidth = sepalWidth;
this.petalLength = petalLength;
this.petalWidth = petalWidth;
this.species = species;
}
@Override
public String toString() {
return "FlowerRecord{" +
"sepalLength=" + sepalLength +
", sepalWidth=" + sepalWidth +
", petalLength=" + petalLength +
", petalWidth=" + petalWidth +
", species='" + species + '\'' +
'}';
}
}
| [
"jet9seven@gmail.com"
] | jet9seven@gmail.com |
2ac7bcea95ba2926cdcb1e5af2164a1f1e6ffee5 | 0c911c786a61f44abd6ddcca11da8fe071b834be | /src/main/java/com/mycompany/biblio/PrestamoController.java | 814b21a20e2a00dee98a6f50c015500723ce0fbd | [] | no_license | samoyacamp/casa | a49cf1406f76b5f402a773c696a8548bb886d48d | e8d1dbdd27c29ed3a0c6139d5b4051610f2b67f2 | refs/heads/master | 2023-05-01T06:50:46.194959 | 2021-05-16T20:32:34 | 2021-05-16T20:32:34 | 367,979,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,454 | 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.mycompany.biblio;
import com.mycompany.biblio.DAO.LibroDAO;
import com.mycompany.biblio.modelos.Libros;
import com.mycompany.biblio.modelos.Usuario;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.Optional;
import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
/**
*
* @author sergi
*/
public class PrestamoController {
private static Usuario user;
private static LibroDAO ldao;
private Libros librosSel;
@FXML
private ListView listaLibro;
@FXML
private TextField id;
@FXML
private void back() throws SQLException, IOException {
librosSel = (Libros) listaLibro.getSelectionModel().getSelectedItem();
}
public PrestamoController(Usuario u) {
user = u;
conectarBD();
}
private static void conectarBD() {
ldao = new LibroDAO();
try {
ldao.conectar();
} catch (SQLException sqle) {
AlertsUtil.mostrarError("Error al conectar con la base de datos" + sqle.getMessage());
} catch (ClassNotFoundException cnfe) {
AlertsUtil.mostrarError("Error al iniciar la aplicación");
} catch (IOException ioe) {
AlertsUtil.mostrarError("Error al cargar la configuración");
}
}
public void initLists() {
listaLibro.getItems().clear();
try {
conectarBD();
List<Libros> libro = ldao.listLibros();
listaLibro.setItems(FXCollections.observableList(libro));
} catch (SQLException sqle) {
AlertsUtil.mostrarError("Error cargando los datos de la aplicación");
}
}
@FXML
private void pedir() throws SQLException, IOException {
librosSel = (Libros) listaLibro.getSelectionModel().getSelectedItem();
if (librosSel == null) {
AlertsUtil.mostrarError("No se ha seleccionado nigun libro");
return;
}
ldao.pedirLibro(new Libros((Integer.parseInt(id.getText()))));
initLists();
}
}
| [
"74319824+samoyacamp@users.noreply.github.com"
] | 74319824+samoyacamp@users.noreply.github.com |
4662de2a45bc13f772ba55165cc9eca6291efe77 | 332a10e525c1fe67e0a7e801e77a4a0591aa1061 | /src/test/java/com/tao/webfluxlearn/WebfluxLearnApplicationTests.java | d5b0879da867007c402e4b0a8e4516e73f0340f9 | [] | no_license | taozeran/webflux-learn | 2cbf94871664a109178267e3b822c050f6f68d55 | 9dd3a57f028ce403bf173d3d0d5d68b4b650b18c | refs/heads/master | 2020-04-29T21:46:33.228123 | 2019-03-28T06:50:22 | 2019-03-28T06:50:22 | 176,423,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package com.tao.webfluxlearn;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class WebfluxLearnApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"taozeran@show.one"
] | taozeran@show.one |
4d7fdf5ee1585e6626066c5cd98f1de173fcdb7e | ad081c0c77f2c581aad085b0c94f2125e80197f5 | /src/main/java/org/dppc/vv/common/help/NullHelp.java | f4ec660886803240622d4e75173e35e218e8cefe | [] | no_license | lihongweicode/hotel | f2b51e1561125b3a20ac68b0d9d2e0416548b846 | cade1576902dfac8b3937478a86318c7062f6b6d | refs/heads/master | 2022-12-06T11:01:36.401321 | 2019-06-17T08:23:57 | 2019-06-17T08:23:57 | 192,302,300 | 0 | 0 | null | 2022-12-06T00:31:52 | 2019-06-17T08:04:05 | JavaScript | UTF-8 | Java | false | false | 1,011 | java | package org.dppc.vv.common.help;
import java.util.Collection;
/**
* @描述 : 用于空对象处理
* @作者 : Zhao Yun
* @日期 : 2017/01/19
* @时间 : 09:52
*/
public class NullHelp {
public static boolean isNull(Object obj) {
return obj == null ||
(obj instanceof String && isNullStr((String) obj)) ||
(obj instanceof Collection && ((Collection) obj).isEmpty());
}
public static boolean isNullStr(String str) {
str = str.trim();
return str.isEmpty()/* || str.equalsIgnoreCase("null")
|| str.equalsIgnoreCase("undefined")*/;
}
public static void check(Object... obj) throws Exception {
if (obj == null) {
throw new RuntimeException("数组参数不能为空");
}
for (int i = 0; i < obj.length; i++) {
Object o = obj[i];
if (o == null) {
throw new RuntimeException("obj[" + i + "]不能为空");
}
}
}
} | [
"1820994758@qq.com"
] | 1820994758@qq.com |
fc0b4fa6c50a1becb84b17d9d8996c694e7b4247 | 94eed0ec7424c3dbcb0d6fea4385b3c1cf2c7b1a | /android/app/src/main/java/com/mybudget/MainApplication.java | 0efe66dcb5ef0062ce38bc60e8dca1e517dc4ef9 | [] | no_license | ayoung09/myBudget | 39118b4892947fedc4124f954e887693dac9bbc9 | 6d76071b6795425987ceb43c3c3218cba1468ff1 | refs/heads/master | 2021-01-19T21:32:23.127930 | 2017-04-19T20:16:57 | 2017-04-19T20:16:57 | 88,551,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 956 | java | package com.mybudget;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"alexia.kwok@gmail.com"
] | alexia.kwok@gmail.com |
6dcf0e071b6ea5e9f6bd2bf4bfee61bb684e9bfc | dba87418d2286ce141d81deb947305a0eaf9824f | /sources/p052cz/msebera/android/httpclient/protocol/BasicHttpContext.java | c7f81fa58fc71e603994da05075d10947749aec8 | [] | no_license | Sluckson/copyOavct | 1f73f47ce94bb08df44f2ba9f698f2e8589b5cf6 | d20597e14411e8607d1d6e93b632d0cd2e8af8cb | refs/heads/main | 2023-03-09T12:14:38.824373 | 2021-02-26T01:38:16 | 2021-02-26T01:38:16 | 341,292,450 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,153 | java | package p052cz.msebera.android.httpclient.protocol;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import p052cz.msebera.android.httpclient.annotation.ThreadSafe;
import p052cz.msebera.android.httpclient.util.Args;
@ThreadSafe
/* renamed from: cz.msebera.android.httpclient.protocol.BasicHttpContext */
public class BasicHttpContext implements HttpContext {
private final Map<String, Object> map;
private final HttpContext parentContext;
public BasicHttpContext() {
this((HttpContext) null);
}
public BasicHttpContext(HttpContext httpContext) {
this.map = new ConcurrentHashMap();
this.parentContext = httpContext;
}
/* JADX WARNING: Code restructure failed: missing block: B:2:0x000d, code lost:
r1 = r2.parentContext;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public java.lang.Object getAttribute(java.lang.String r3) {
/*
r2 = this;
java.lang.String r0 = "Id"
p052cz.msebera.android.httpclient.util.Args.notNull(r3, r0)
java.util.Map<java.lang.String, java.lang.Object> r0 = r2.map
java.lang.Object r0 = r0.get(r3)
if (r0 != 0) goto L_0x0015
cz.msebera.android.httpclient.protocol.HttpContext r1 = r2.parentContext
if (r1 == 0) goto L_0x0015
java.lang.Object r0 = r1.getAttribute(r3)
L_0x0015:
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: p052cz.msebera.android.httpclient.protocol.BasicHttpContext.getAttribute(java.lang.String):java.lang.Object");
}
public void setAttribute(String str, Object obj) {
Args.notNull(str, "Id");
if (obj != null) {
this.map.put(str, obj);
} else {
this.map.remove(str);
}
}
public Object removeAttribute(String str) {
Args.notNull(str, "Id");
return this.map.remove(str);
}
public void clear() {
this.map.clear();
}
public String toString() {
return this.map.toString();
}
}
| [
"lucksonsurprice94@gmail.com"
] | lucksonsurprice94@gmail.com |
9ee58daf03d565315fcf422345742da74240b6cf | 0ef261ebb0ee0c13642d92f2e6bdc00f72b9fd37 | /src/main/java/org/pratap/ms/domain/package-info.java | 4221e4b470c796127d88b306a776aa112fe3c97c | [] | no_license | OrgPratap/uberExample | 1c64637ffdf5ee3fec3e3d23233b138d31a751c0 | 31169e6c3f9aa15f7790e1700cb6bfe1b4da0457 | refs/heads/master | 2020-03-22T23:35:50.428994 | 2018-07-13T08:22:53 | 2018-07-13T08:22:53 | 140,819,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 61 | java | /**
* JPA domain objects.
*/
package org.pratap.ms.domain;
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
61e462fdf8ad3f925d200b6bb78c237535847bd6 | d52d200110b38bd7b4eb70707694c004b4073780 | /cpos_lib/src/main/java/com/pentasecurity/cpo/mo/model/GetTariffRequestData.java | d18988261f6aea718b8a67c97ab6da37e21317ad | [] | no_license | seycj47/TestApp | e47c98041e8caf1010f44a3cbde17ff5b8479e31 | 8c885340d56d9572ffca887e669f838289e9f9aa | refs/heads/master | 2022-06-12T09:27:16.224341 | 2020-01-20T04:40:08 | 2020-01-20T04:40:08 | 234,249,003 | 0 | 0 | null | 2022-05-20T21:23:41 | 2020-01-16T06:15:18 | Java | UTF-8 | Java | false | false | 1,131 | java | package com.pentasecurity.cpo.mo.model;
import java.util.List;
public class GetTariffRequestData {
private String emaid;
private String chargeType;
private List<Integer> tupleIdList;
private List<PmaxSchedule> pmaxScheduleList;
public GetTariffRequestData(String emaid, String chargeType, List<Integer> tupleIdList, List<PmaxSchedule> pmaxScheduleList) {
super();
this.emaid = emaid;
this.chargeType = chargeType;
this.tupleIdList = tupleIdList;
this.pmaxScheduleList = pmaxScheduleList;
}
public String getEmaid() {
return emaid;
}
public void setEmaid(String emaid) {
this.emaid = emaid;
}
public String getChargeType() {
return chargeType;
}
public void setChargeType(String chargeType) {
this.chargeType = chargeType;
}
public List<Integer> getTupleIdList() {
return tupleIdList;
}
public void setTupleIdList(List<Integer> tupleIdList) {
this.tupleIdList = tupleIdList;
}
public List<PmaxSchedule> getPmaxScheduleList() {
return pmaxScheduleList;
}
public void setPmaxScheduleList(List<PmaxSchedule> pmaxScheduleList) {
this.pmaxScheduleList = pmaxScheduleList;
}
}
| [
"seycj47@gmail.com"
] | seycj47@gmail.com |
232b43c0c7029c99d392387e27bbb9fe3189f307 | 879890c006f5355d97d338c620cdb77271d07a89 | /src/main/java/net/zhaoyu/javapros/j2se/threads/concurrentdesign/stream/PersonMapTask.java | 3795a6967b3601bccf18d9d3e6c9f6ddf141482d | [] | no_license | lovexiaoe/javapros | fe233651cbd5a8363816fbf2993e69f8845313df | 9cc5a355f1ed11b3f52659461574702773f613e5 | refs/heads/master | 2022-12-08T11:04:40.788666 | 2022-11-20T03:54:25 | 2022-11-20T03:54:25 | 82,663,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,373 | java | package net.zhaoyu.javapros.j2se.threads.concurrentdesign.stream;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.RecursiveAction;
/**
* forkjoin任务-对person列表按firstName分组。
*/
public class PersonMapTask extends RecursiveAction {
private static final long serialVersionUID = 6687678520745563790L;
private List<Person> persons;
private ConcurrentHashMap<String, ConcurrentLinkedDeque<Person>> personMap;
public PersonMapTask(List<Person> persons, ConcurrentHashMap<String, ConcurrentLinkedDeque<Person>> personMap) {
this.persons = persons;
this.personMap = personMap;
}
@Override
protected void compute() {
if (persons.size() < 1000) {
for (Person person: persons) {
//如果存在firstName的List,则返回,如果不存在,创建。
ConcurrentLinkedDeque<Person> personList=personMap.computeIfAbsent(person.getFirstName(), name -> {
return new ConcurrentLinkedDeque<>();
});
personList.add(person);
}
return;
}
PersonMapTask child1, child2;
child1 = new PersonMapTask(persons.subList(0, persons.size() / 2), personMap);
child2 = new PersonMapTask(persons.subList(persons.size() / 2, persons.size()), personMap);
//调用所有子任务。
invokeAll(child1, child2);
}
}
| [
"zy4668@126.com"
] | zy4668@126.com |
775a21cb903e075494f17073ef0754f2b4b9a2b8 | b98f5be2877fc829ec9ea54132e46c4a9e8a9381 | /src/main/java/com/concur/unity/profile/Profileable.java | f34e22019ad8f0a9abf90c2c74b3d1af0fedb4db | [] | no_license | Jakegogo/unity | 0a0b1710d722935ccc51a05e7037a1cdf9accc82 | 3e5c069e5caf8a1d05614e0a988ae35df0bb253c | refs/heads/master | 2020-03-08T22:26:08.837785 | 2018-12-30T05:32:52 | 2018-12-30T05:32:52 | 128,430,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | /**
*
*/
package com.concur.unity.profile;
/**
* 性能分析接口
* <li>可输出性能分析结果的</li>
* @author Jake
*
*/
public interface Profileable {
/**
* 输出性能情况
*/
void profile();
}
| [
"335923591@qq.com"
] | 335923591@qq.com |
5c49c0a131abc01ee8490445f62458ca3f789b50 | 2b2c8bc356dc16f9dde835dff0da4e2b30ca4dbc | /src/com/pangff/wjw/db/AdvImgDBHelper.java | 6fa59ba742cf715e020f78a9bfc913fe94c0dab0 | [] | no_license | pffair/wjw | fe863c56c611a3f9e7e32f5018cfc4288eb67d51 | 7cb8f5ee973481b4ef09c10d87ae508df88aff8e | refs/heads/master | 2021-01-10T20:10:06.102739 | 2014-08-04T01:11:44 | 2014-08-04T01:11:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 960 | java | package com.pangff.wjw.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
/**
* 消息中心相关库
* 创建于v5.0
* @author pangff
*/
public class AdvImgDBHelper extends SQLiteOpenHelper {
public final static String DATABASE_NAME = "adv_img.db";
static final String SQL_CREATE_MSGCENTER = "CREATE TABLE IF NOT EXISTS adv_img ("
+ "_id integer PRIMARY key AUTOINCREMENT,id varchar(100),photoUrl text)";
public AdvImgDBHelper(Context context) {
super(context, DATABASE_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(SQL_CREATE_MSGCENTER);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.d("SQLiteOpenHelper", "onUpgrade msgcenter");
db.execSQL("drop table if exists msgcenter");
db.execSQL(SQL_CREATE_MSGCENTER);
}
}
| [
"pangff@gmail.com"
] | pangff@gmail.com |
592b5e8571d5c719a018b6cd112404a85eadb180 | f6c831b8b2e28be60dc3516aacd1062cd6ec02be | /src/test/java/cl/jalmenarez/store/web/rest/errors/ExceptionTranslatorIT.java | bcdf46c611bc0443e5e251ac089f99dbcb115173 | [] | no_license | jalmenarez/petstore | c2c6333a6c100759bb004311f760f7eb679b0a70 | ece3d89a24ee67906cc7672bb2a12167e9259f14 | refs/heads/master | 2022-12-06T09:11:59.254635 | 2020-08-29T17:11:10 | 2020-08-29T17:11:10 | 291,314,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,018 | java | package cl.jalmenarez.store.web.rest.errors;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import cl.jalmenarez.store.PetstoreApp;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
/**
* Integration tests {@link ExceptionTranslator} controller advice.
*/
@WithMockUser
@AutoConfigureMockMvc
@SpringBootTest(classes = PetstoreApp.class)
public class ExceptionTranslatorIT {
@Autowired
private MockMvc mockMvc;
@Test
public void testMethodArgumentNotValid() throws Exception {
mockMvc
.perform(post("/api/exception-translator-test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION))
.andExpect(jsonPath("$.fieldErrors.[0].objectName").value("test"))
.andExpect(jsonPath("$.fieldErrors.[0].field").value("test"))
.andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull"));
}
@Test
public void testMissingServletRequestPartException() throws Exception {
mockMvc
.perform(get("/api/exception-translator-test/missing-servlet-request-part"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testMissingServletRequestParameterException() throws Exception {
mockMvc
.perform(get("/api/exception-translator-test/missing-servlet-request-parameter"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testAccessDenied() throws Exception {
mockMvc
.perform(get("/api/exception-translator-test/access-denied"))
.andExpect(status().isForbidden())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.403"))
.andExpect(jsonPath("$.detail").value("test access denied!"));
}
@Test
public void testUnauthorized() throws Exception {
mockMvc
.perform(get("/api/exception-translator-test/unauthorized"))
.andExpect(status().isUnauthorized())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.401"))
.andExpect(jsonPath("$.path").value("/api/exception-translator-test/unauthorized"))
.andExpect(jsonPath("$.detail").value("test authentication failed!"));
}
@Test
public void testMethodNotSupported() throws Exception {
mockMvc
.perform(post("/api/exception-translator-test/access-denied"))
.andExpect(status().isMethodNotAllowed())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.405"))
.andExpect(jsonPath("$.detail").value("Request method 'POST' not supported"));
}
@Test
public void testExceptionWithResponseStatus() throws Exception {
mockMvc
.perform(get("/api/exception-translator-test/response-status"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.400"))
.andExpect(jsonPath("$.title").value("test response status"));
}
@Test
public void testInternalServerError() throws Exception {
mockMvc
.perform(get("/api/exception-translator-test/internal-server-error"))
.andExpect(status().isInternalServerError())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.500"))
.andExpect(jsonPath("$.title").value("Internal Server Error"));
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
23ac3bd2a6a5926fce92ad7f34abf4712891cdef | 9a1caf23478b99f185766a63f110fd5722c76902 | /PigLatinTranslator/obj/Debug/android/src/md54a9f1f368d02a1340b1feed100cadc52/MainActivity.java | 26b822b9ae3f248ace7da70ebb6496f2104baeda | [] | no_license | JGarnick/235-Term-Project | 88810697af84b2b5e2e17da3b1c843941473802f | 49beddec2238fcb7370ef7f9e08fd5c455ae20ed | refs/heads/master | 2021-01-24T07:27:41.822465 | 2017-06-04T22:28:30 | 2017-06-04T22:28:30 | 93,343,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,474 | java | package md54a9f1f368d02a1340b1feed100cadc52;
public class MainActivity
extends android.app.Activity
implements
mono.android.IGCUserPeer
{
/** @hide */
public static final String __md_methods;
static {
__md_methods =
"n_onCreate:(Landroid/os/Bundle;)V:GetOnCreate_Landroid_os_Bundle_Handler\n" +
"n_onSaveInstanceState:(Landroid/os/Bundle;)V:GetOnSaveInstanceState_Landroid_os_Bundle_Handler\n" +
"";
mono.android.Runtime.register ("PigLatinTranslator.MainActivity, PigLatinTranslator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", MainActivity.class, __md_methods);
}
public MainActivity () throws java.lang.Throwable
{
super ();
if (getClass () == MainActivity.class)
mono.android.TypeManager.Activate ("PigLatinTranslator.MainActivity, PigLatinTranslator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { });
}
public void onCreate (android.os.Bundle p0)
{
n_onCreate (p0);
}
private native void n_onCreate (android.os.Bundle p0);
public void onSaveInstanceState (android.os.Bundle p0)
{
n_onSaveInstanceState (p0);
}
private native void n_onSaveInstanceState (android.os.Bundle p0);
private java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void monodroidClearReferences ()
{
if (refList != null)
refList.clear ();
}
}
| [
"garnick.josh@gmail.com"
] | garnick.josh@gmail.com |
9566fca50e675564fcd3ec1dc11f9f329fdc4f18 | c7e6acdb5f56d05b49da497259bff8875b381ae9 | /testsrc/stc/TaskTest.java | 92419c60a01344c99f68f7ff9a2214333df3a010 | [
"MIT"
] | permissive | singhsong/shiny-spoon | 378d6e9470498f1768613f0f50490b4bbf697cbd | b60c47000440a2aa6cd42e3d919025fb1f2702a4 | refs/heads/master | 2020-03-29T17:27:48.715461 | 2018-10-13T14:49:30 | 2018-10-13T14:49:30 | 150,164,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 587 | java | package stc;
import com.singhblom.*;
import org.junit.jupiter.api.Test;
import java.time.LocalDate;
import static org.junit.jupiter.api.Assertions.*;
class TaskTest {
@Test
void getTaskName()
{
Task testTask = new Task("Test task", "life", LocalDate.parse("2018-01-01"), true);
assertEquals("Test task", testTask.getTaskName());
}
@Test
void setTaskName()
{
}
@Test
void getProjectName() {
}
@Test
void setProjectName() {
}
@Test
void getDueDate() {
}
@Test
void setDueDate() {
}
} | [
"singhsong@gmail.com"
] | singhsong@gmail.com |
3e9c32e8f87bc99ef9eff55fd44d8ae63771f27d | e8b74c9b7965447cf682ceee10e0a86787f31c69 | /TotalShop/src/main/java/com/dao/ReferrerMapper.java | bc6b554960029c1d042ed03dfc300f10e5f3cba1 | [] | no_license | ll9527/test3 | f566b56e2b153e45e200979ba0156bcbcfff6dac | dcda13a9db90225a04cf8986043d377f92744b22 | refs/heads/master | 2020-04-29T02:13:21.802330 | 2019-03-15T06:14:01 | 2019-03-15T06:14:01 | 175,758,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.dao;
import com.entity.Referrer;
public interface ReferrerMapper {
int deleteByPrimaryKey(Integer id);
int insert(Referrer record);
int insertSelective(Referrer record);
Referrer selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Referrer record);
int updateByPrimaryKey(Referrer record);
} | [
"996675473@qq.com"
] | 996675473@qq.com |
e01987e9210d00e270bef883f5e5a895d60e74f0 | eebf344e09a039a4ace8102c5bbcc880b2a3aff4 | /src/main/java/org/qwertech/invest/web/rest/vm/ManagedUserVM.java | 4e78c60c35773fe32b543060a677b50f9ef192b7 | [] | no_license | QwerTech/invest | ae4527117f4f86d258449ff90fc45c6dde5c7060 | 4c7105386343fc9e92bc9acdb09e5e85471eb774 | refs/heads/master | 2021-06-28T07:24:41.133610 | 2018-06-05T21:23:00 | 2018-06-05T21:23:00 | 136,081,432 | 0 | 1 | null | 2020-09-18T16:47:21 | 2018-06-04T20:51:56 | Java | UTF-8 | Java | false | false | 844 | java | package org.qwertech.invest.web.rest.vm;
import org.qwertech.invest.service.dto.UserDTO;
import javax.validation.constraints.Size;
/**
* View Model extending the UserDTO, which is meant to be used in the user management UI.
*/
public class ManagedUserVM extends UserDTO {
public static final int PASSWORD_MIN_LENGTH = 4;
public static final int PASSWORD_MAX_LENGTH = 100;
@Size(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH)
private String password;
public ManagedUserVM() {
// Empty constructor needed for Jackson.
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "ManagedUserVM{" +
"} " + super.toString();
}
}
| [
"pavel_novikov1@epam.com"
] | pavel_novikov1@epam.com |
3345b7347ca0c917df3ac21eeee883bf1f6bd431 | 8a9163ff7f0b12634b3787dcc3b9ca7e087289ae | /app/src/main/java/com/app/erldriver/view/fragment/OrderItemsTabFragment.java | 2edc03da8704e430af4b719c36b0cd9b78474d2d | [] | no_license | rjkalola/Erl-Driver | c5822e4df655110eb3014e5726564e49d9a7e824 | d660ed06733820fa5dd5de32402a2ebe07bab33a | refs/heads/master | 2022-12-27T11:49:13.275988 | 2020-06-28T06:19:44 | 2020-06-28T06:19:44 | 275,514,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,169 | java | package com.app.erldriver.view.fragment;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.app.erldriver.R;
import com.app.erldriver.adapter.ServiceItemsListAdapter;
import com.app.erldriver.callback.SelectItemListener;
import com.app.erldriver.callback.SelectedServiceItemListener;
import com.app.erldriver.databinding.FragmentOrderItemsBinding;
import com.app.erldriver.model.entity.info.ItemInfo;
import com.app.erldriver.model.entity.info.ServiceItemInfo;
import com.app.erldriver.util.AppConstant;
import com.app.erldriver.view.activity.DashBoardActivity;
import com.app.erldriver.view.dialog.AddItemsToCardBottomSheetDialog;
import org.parceler.Parcels;
import java.util.List;
public class OrderItemsTabFragment extends BaseFragment implements View.OnClickListener, SelectItemListener, SelectedServiceItemListener {
private final int LAYOUT_ACTIVITY = R.layout.fragment_order_items;
private FragmentOrderItemsBinding binding;
private Context mContext;
private ServiceItemsListAdapter adapter;
public static final OrderItemsTabFragment newInstance(Bundle bundle) {
OrderItemsTabFragment fragment = new OrderItemsTabFragment();
fragment.setArguments(bundle);
return fragment;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, LAYOUT_ACTIVITY, container, false);
mContext = getActivity();
getBundleData();
return binding.getRoot();
}
private void getBundleData() {
if (getArguments() != null) {
if (Parcels.unwrap(getArguments().getParcelable(AppConstant.IntentKey.SERVICE_ITEMS_DATA)) != null) {
List<ItemInfo> list = Parcels.unwrap(getArguments().getParcelable(AppConstant.IntentKey.SERVICE_ITEMS_DATA));
Log.e("test", "Fragment Size:" + list.size());
setAdapter(list);
}
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
}
}
private void setAdapter(List<ItemInfo> list) {
if (list != null && list.size() > 0) {
binding.rvOrderItemsList.setVisibility(View.VISIBLE);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
binding.rvOrderItemsList.setLayoutManager(linearLayoutManager);
binding.rvOrderItemsList.setHasFixedSize(true);
adapter = new ServiceItemsListAdapter(mContext, list, this);
binding.rvOrderItemsList.setAdapter(adapter);
} else {
binding.rvOrderItemsList.setVisibility(View.GONE);
}
}
@Override
public void onSelectItem(int position, int action) {
showAddItemsToCardBottomSheetDialog(position, adapter.getList().get(position).getServiceList(), adapter.getList().get(position).getImage());
}
@Override
public void onSelectServiceItem(int rootPosition, int itemPosition, int quantity) {
if (getActivity() != null && adapter != null) {
adapter.getList().get(rootPosition).getServiceList().get(itemPosition).setQuantity(quantity);
((DashBoardActivity) getActivity()).refreshTotalItemPrice();
}
Log.e("test", "rootPosition:" + rootPosition);
Log.e("test", "itemPosition:" + itemPosition);
}
public void showAddItemsToCardBottomSheetDialog(int rootPosition, List<ServiceItemInfo> listItems, String itemImage) {
AddItemsToCardBottomSheetDialog addItemsToCardBottomSheetDialog = AddItemsToCardBottomSheetDialog.newInstance(mContext, rootPosition, listItems, itemImage, this);
addItemsToCardBottomSheetDialog.show();
}
public ServiceItemsListAdapter getAdapter() {
return adapter;
}
}
| [
"rjkalola@gmail.com"
] | rjkalola@gmail.com |
0aa55f3e457939df184d764f2829e788d505ab94 | de931f37fca9e926c2a1b263b80ba8e51da0d948 | /A1_BasicExercicies/src/streams/ex1/ex1.java | f08880c0c4d0c03ac3dc6f58aab9ca16fcd8623a | [] | no_license | Diogo1080/Exercicios_Java | 32f11445a4796004ea1cef04a7a61ce8e8b4791b | e1440cb4508c4214b64a663d82127d3bab623498 | refs/heads/main | 2023-02-22T06:51:36.359849 | 2021-01-28T11:37:39 | 2021-01-28T11:37:39 | 311,427,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,426 | java | package streams.ex1;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class ex1 {
public static void main(String[] args) {
FileOutputStream outputStream = null;
FileInputStream inputStream;
String str = "Hey there!";
try {
byte[] strToBytes = str.getBytes();
byte[] buffer = new byte[10];
int numberOfBytesRead = 0;
int endOfFile = -1;
outputStream = new FileOutputStream("MediumExercicies/src/streams/ex1/fileName.md");
outputStream.write(strToBytes);
outputStream.close();
inputStream = new FileInputStream("MediumExercicies/src/streams/ex1/fileName.md");
outputStream = new FileOutputStream("MediumExercicies/src/streams/ex1/filenameCopy.md");
while (numberOfBytesRead != endOfFile) {
outputStream.write(buffer, 0, numberOfBytesRead);
numberOfBytesRead = inputStream.read(buffer);
}
outputStream.close();
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (outputStream != null) {
outputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
| [
"wersade10@gmail.com"
] | wersade10@gmail.com |
2d0debfb237c403af4273eec086e5940c4c55781 | a94bb7b5b31da81b758c2a468747700652be868e | /src/java7/AboutDiamondOperator.java | 80477629f87e073c4823e3f2ebd6f44854b55309 | [] | no_license | Shepardj/Java-Koans | 13f1a64cb8155d312a91f8159df150f0e7b398e1 | e7b385a21fd0068fb8c6e8229c70107f01b990d1 | refs/heads/master | 2021-01-10T19:21:01.216645 | 2015-07-12T07:14:17 | 2015-07-12T07:14:17 | 38,445,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,225 | java | package java7;
import com.sandwich.koan.Koan;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static com.sandwich.koan.constant.KoanConstants.__;
import static com.sandwich.util.Assert.assertEquals;
public class AboutDiamondOperator {
@Koan
public void diamondOperator () {
String[] animals = {"Dog", "Cat", "Tiger", "Elephant", "Zebra"};
//Generic type of array list inferred - empty <> operator
List<String> animalsList = new ArrayList<>(Arrays.asList(animals));
assertEquals(animalsList, animalsList); //not sure how to represent this, tried a few different ways
}
@Koan
public void diamondOperatorInMethodCall () {
String[] animals = {"Dog", "Cat", "Tiger", "Elephant", "Zebra"};
//type of new ArrayList<>() inferred from method parameter
List<String> animalsList = fill(new ArrayList<>());
assertEquals(animalsList, animalsList);//not sure how to represent this, tried a few different ways
}
private List<String> fill(List<String> list){
String[] animals = {"Dog", "Cat", "Tiger", "Elephant", "Zebra"};
list.addAll(Arrays.asList(animals));
return list;
}
}
| [
"jonshepardson@gmail.com"
] | jonshepardson@gmail.com |
6f898d15c00dce64e60a3c7e5d77b651794d0f4d | ade6d665a3dc932ee11309be088ad25aa9b3a93d | /src/com/saily/jdk8/stream3/StreamTest2.java | 3ed926c08ab1a5837986f4ae0a4a46d0c522983c | [] | no_license | sail-y/jdk8 | 17572383dde3bb5cdf66c59b2afdfa4f3431999c | fef6b9df314316bc12132c093274c526df4a3043 | refs/heads/master | 2021-01-22T02:28:11.339702 | 2017-12-12T06:29:25 | 2017-12-12T06:29:25 | 81,052,071 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,643 | java | /*
* Copyright (c) 2017 xiaomaihd and/or its affiliates.All Rights Reserved.
* http://www.xiaomaihd.com
*/
package com.saily.jdk8.stream3;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.IntStream;
import java.util.stream.Stream;
/**
* @author yangfan
* @date 2017/03/30
*/
public class StreamTest2 {
public static void main(String[] args) {
Trader raoul = new Trader("Raoul", "Cambridge");
Trader mario = new Trader("Mario", "Milan");
Trader alan = new Trader("Alan", "Cambridge");
Trader brian = new Trader("Brian", "Cambridge");
List<Transaction> transactions = Arrays.asList(
new Transaction(brian, 2011, 300),
new Transaction(raoul, 2012, 1000),
new Transaction(raoul, 2011, 400),
new Transaction(mario, 2012, 710),
new Transaction(mario, 2012, 700),
new Transaction(alan, 2012, 950)
);
transactions.stream().filter(transaction -> transaction.getYear() == 2011).sorted(Comparator.comparing(Transaction::getValue)).forEach(System.out::println);
System.out.println("-----");
transactions.stream().map(transaction -> transaction.getTrader().getCity()).distinct().forEach(System.out::println);
System.out.println("-----");
transactions.stream().map(Transaction::getTrader).filter(trader -> "Cambridge".equals(trader.getCity())).distinct()
.sorted(Comparator.comparing(Trader::getName)).forEach(System.out::println);
System.out.println("-----");
transactions.stream().map(Transaction::getTrader).map(Trader::getName).distinct().sorted().forEach(System.out::println);
System.out.println("-----");
transactions.stream().map(Transaction::getTrader).filter(trader -> "Milan".equals(trader.getCity())).findAny().ifPresent(System.out::println);
System.out.println("-----");
int sum = transactions.stream().filter(transaction -> "Cambridge".equals(transaction.getTrader().getCity())).mapToInt(Transaction::getValue).sum();
System.out.println(sum);
System.out.println("-----");
transactions.stream().mapToInt(Transaction::getValue).max().ifPresent(System.out::println);
System.out.println("-----");
transactions.stream().mapToInt(Transaction::getValue).min().ifPresent(System.out::println);
System.out.println("-----");
IntStream evenNumbers = IntStream.rangeClosed(1, 100).filter(i -> i % 2 == 0);
System.out.println(evenNumbers.count());
}
}
| [
"yangf@xiaoyucloud.com"
] | yangf@xiaoyucloud.com |
06c8fd18bb73834f6093a1d3d49604d58b5754a6 | 71548d6d405f82a40509c76c42eeea3f90593f1c | /BlueChipLast/src/main/java/idol/controller/IdolSearchController.java | d1e7086852002dfce3c1095f7a4f29ef4620f3ef | [] | no_license | wkd1157/BlueChipLast | dbcf8732d7b7d0dc64f523d50baec89d6b17c461 | e9ebc0e506d347c4e1705ab14dbfa9118ca06755 | refs/heads/master | 2020-03-30T12:10:05.878473 | 2018-10-15T04:21:00 | 2018-10-15T04:21:00 | 151,211,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,936 | java | package idol.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import idol.dao.IdolSearchDao;
import idol.dto.IdolMainDto;
import idol.dto.ProfilePhotoURLDto;
@Controller
public class IdolSearchController {
@Autowired
IdolSearchDao IdolSearchDao;
@RequestMapping("/idolNameSearch.idol")
public ModelAndView IdolNameSearch(@RequestParam String name)
{
ModelAndView model=new ModelAndView();
List<IdolMainDto> IMList= IdolSearchDao.getNameIMList(name);
List<ProfilePhotoURLDto> PPList = IdolSearchDao.getNamePPList(name);
model.addObject("IMList",IMList);
model.addObject("PPList",PPList);
model.setViewName("/1/idollist/idolsearch");
return model;
}
@RequestMapping("/idolEntSearch.idol")
public ModelAndView IdolEntSearch(@RequestParam String name)
{
ModelAndView model=new ModelAndView();
List<IdolMainDto> IMList= IdolSearchDao.getEntIMList(name);
List<ProfilePhotoURLDto> PPList = IdolSearchDao.getEntPPList(name);
model.addObject("IMList",IMList);
model.addObject("PPList",PPList);
model.setViewName("/1/idollist/idolsearch");
return model;
}
@RequestMapping("/idolDebutYearSearch.idol")
public ModelAndView IdolDebutYearSearch(@RequestParam String name)
{
ModelAndView model=new ModelAndView();
List<IdolMainDto> IMList= IdolSearchDao.getDebutYearIMList(name);
List<ProfilePhotoURLDto> PPList = IdolSearchDao.getDebutYearPPList(name);
model.addObject("IMList",IMList);
model.addObject("PPList",PPList);
model.setViewName("/1/idollist/idolsearch");
return model;
}
}
| [
"SeokE@DESKTOP-2CLNU7K"
] | SeokE@DESKTOP-2CLNU7K |
4a51946f30be7cab667bae5c309769149383da86 | 37a37649e7a9acecfd32575cfcb773fa0573b7d1 | /employeeinfo11/src/main/java/com/training/employeeinfo1/controller/EmployeeController.java | c2036da518755c8d4f1fbbbc7cc696d3f8a8379b | [] | no_license | anita2498/Training-Usecase | 5f046ac288dbbdc273a297342c740f2ba104e0dc | 872e12c7cccb4ba68764cdfc6d33a0e8742343dc | refs/heads/main | 2023-04-20T16:11:27.079080 | 2021-05-03T22:02:03 | 2021-05-03T22:02:03 | 355,569,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,574 | java | package com.training.employeeinfo1.controller;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.ExceptionHandler;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.training.employeeinfo1.model.Employee;
import com.training.employeeinfo1.service.EmployeeService;
@RestController
public class EmployeeController {
@Autowired
public EmployeeService employeeService;
public static Logger logger = LoggerFactory.getLogger(EmployeeController.class);
@GetMapping("/employees")
public List<Employee> getAllEmployees() {
logger.info("<ENTER> get all employees");
return employeeService.getAllEmployees();
}
@GetMapping("/employees/latest/{t}")
public List<Employee> getLastModifiedRecords(@PathVariable String t) {
logger.info("<ENTER> get records of last processed");
return employeeService.getLastModifiedRecords(Timestamp.valueOf(t));
}
@GetMapping("/employees/{id}")
public Employee getEmployee(@PathVariable Integer id) {
logger.info("<ENTER> get employee by Id");
return employeeService.getEmployee(id);
}
@PostMapping("/employees")
public void addEmployee(@RequestBody Employee employee) {
logger.info("<ENTER> add an employee");
employeeService.addEmployee(employee);
}
@PutMapping("/employees/{id}")
public void updateEmployee(@RequestBody Employee employee, @PathVariable Integer id) {
logger.info("<ENTER> update an employee");
employeeService.updateEmployee(employee, id);
}
@DeleteMapping("/employees/{id}")
public void deleteEmployee(@PathVariable Integer id) {
logger.info("<ENTER> delete an employee");
employeeService.deleteEmployee(id);
}
@ExceptionHandler
void handleIllegalArgumentException(
IllegalArgumentException e,
HttpServletResponse response) throws IOException {
response.sendError(HttpStatus.BAD_REQUEST.value());
}
}
| [
"anitaputhenpurayil@gmail.com"
] | anitaputhenpurayil@gmail.com |
499e4b062077aaceb02399a192b0074c9d55c07b | ee33c7a796ed6d5793b766177f0245e65f0404be | /prototype/argo/com.fourigin.argo.models/src/main/java/com/fourigin/argo/models/datasource/index/FieldType.java | f3141d89510cd8843f36a6e15e7c762abaf18e4e | [] | no_license | Fourigin-GbR/theseus | 6592cb5e607c2c1c75cc10a4f2629cb042335d37 | db52233ff3e2520122b77a982c8c372ca12e6278 | refs/heads/master | 2021-06-10T15:57:55.707513 | 2021-04-06T08:17:43 | 2021-04-06T08:17:43 | 55,089,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package com.fourigin.argo.models.datasource.index;
public enum FieldType {
TEXT,
NUMBER,
DATE,
PRICE,
LIST_OF_TEXT,
LIST_OF_NUMBER,
LIST_OF_DATE,
LIST_OF_PROCE
}
| [
"vlad.s@gmx.de"
] | vlad.s@gmx.de |
7e45dbc05b4df5bd847b75f56927410897fb128a | d4b1126b3a929b62beae534c204a2defb7fc7bcc | /app/src/main/java/com/hualianzb/sec/ui/fragments/ExportPrivatekeyDialogFragment.java | d7f336449c23eb86cb8f0f46690ae57142901de7 | [] | no_license | crazytomaoto/sec_android | 2ed751e485de4ecbd17cf983e29ab95cf6494467 | 9cf88f93012c0041db04c70d6168dfcd343bc82a | refs/heads/main | 2020-04-11T21:05:44.334682 | 2019-03-26T07:54:59 | 2019-03-26T07:55:17 | 162,094,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,835 | java | package com.hualianzb.sec.ui.fragments;
import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.gyf.barlibrary.ImmersionBar;
import com.hualianzb.sec.R;
import com.hualianzb.sec.commons.constants.Constant;
import com.hualianzb.sec.models.RememberSEC;
import com.hualianzb.sec.ui.activitys.MakeMoneyActicity;
import com.hualianzb.sec.ui.basic.BaseDialogFragment;
import com.hysd.android.platform_huanuo.base.config.PlatformConfig;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
/**
* Date:2019/1/9
* auther:wangtianyun
* 右边DialogFragment
*/
public class ExportPrivatekeyDialogFragment extends BaseDialogFragment {
String address;
@BindView(R.id.tv_private_key)
TextView tv_private_key;
Unbinder unbinder;
private ExporPrivateKeytLinster listterner;
private RememberSEC bean;
// 定义activity必须实现的接口方法
public interface ExporPrivateKeytLinster {
void copyPrivatekey(String str);
}
// 当FRagmen被加载到activity的时候会被回调
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof QrCodeDialogFragment.InfacnCopy) {
listterner = (ExporPrivateKeytLinster) activity; // 2.2 获取到宿主activity并赋值
} else {
throw new IllegalArgumentException("activity must implements ExporPrivateKeytLinster");
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
address = getArguments().getString("address");
Map<String, RememberSEC> map = PlatformConfig.getMap(Constant.SpConstant.WALLET);
bean = map.get(address);
}
@Override
public void onStart() {
super.onStart();
mWindow.setGravity(Gravity.TOP | Gravity.END);
mWindow.setWindowAnimations(R.style.RightDialog);
mWindow.setLayout(mWidth * 2 / 3, mHeight -
ImmersionBar.getNavigationBarHeight(getActivity())
- ImmersionBar.getStatusBarHeight(getActivity()));
}
@Override
protected int setLayoutId() {
return R.layout.layout_dialog_export_priavetkey;
}
@Override
protected void initImmersionBar() {
super.initImmersionBar();
ImmersionBar.with(this)
.statusBarColor(R.color.white).
statusBarDarkFont(true).init();
}
@Override
protected void initData() {
super.initData();
tv_private_key.setText(bean.getPrivateKey());
}
@Override
public void onDestroy() {
super.onDestroy();
((MakeMoneyActicity) getActivity()).getActivityImmersionBar().keyboardEnable(true).init();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// TODO: inflate a fragment view
View rootView = super.onCreateView(inflater, container, savedInstanceState);
unbinder = ButterKnife.bind(this, rootView);
return rootView;
}
@OnClick({R.id.tv_close, R.id.tv_copy})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_close:
getDialog().dismiss();
break;
case R.id.tv_copy:
listterner.copyPrivatekey("1");
getDialog().dismiss();
break;
}
}
//把传递进来的activity对象释放掉
@Override
public void onDetach() {
super.onDetach();
listterner = null;
}
} | [
"h15065349705"
] | h15065349705 |
4eba144deb9b931e23753299feab972fec9f6fbd | c300558503cf75237950b8211a8a164716c0ca6c | /src/Frame/FramePanel/ListAllCourse.java | 82d8b086ec647473139916b0ffc801f105da7370 | [] | no_license | YoussefRashad/Training-Center-System | 8c07c0fc01a6e9f87f61e68ffe297fa174429278 | 5b627eecae07a7103024a49ab7537ed1e239d92c | refs/heads/master | 2020-04-20T20:58:48.848433 | 2019-02-04T14:50:00 | 2019-02-04T14:50:00 | 169,093,676 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,616 | 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 Frame.FramePanel;
import java.util.ArrayList;
import javax.swing.table.DefaultTableModel;
import trainingcentersystem.Course;
/**
*
* @author DELL
*/
public class ListAllCourse extends javax.swing.JPanel {
/**
* Creates new form ListAllCourse
*/
public ListAllCourse() {
initComponents();
AddRowToJTable();
}
private void AddRowToJTable()
{
DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
Object rowData[]=new Object[4];
Course c = new Course();
ArrayList<Course> courses = c.ListAllCourse();
for(Course a : courses)
{
rowData[0]=a.getCourseID();
rowData[1]=a.getCourseName();
rowData[2]=a.getCreditHour();
rowData[3]=a.getDept();
model.addRow(rowData);
}
}
/**
* 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() {
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
setBackground(new java.awt.Color(0, 0, 0));
setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jTable1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jTable1.setFont(new java.awt.Font("Monotype Corsiva", 0, 18)); // NOI18N
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ID Course", "Name Course", "Credit Hour", "Department"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 629, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}
| [
"youssefrashad19@yahoo.co"
] | youssefrashad19@yahoo.co |
dd925f380e63687beb7ecd041221ba4f0d88f9d5 | bcf3e66700367127b88fb323967bfeaca2cc51eb | /src/test/java/ru/sbt/jschool/session9/ExecutionManagerTest.java | 3c72abf88851aa464ed89824f3f406c5e29f4c24 | [] | no_license | zzzadruga/session-9 | dd1449a8edfcef306a1c891505650351ef6312c2 | 1a3542f30d6af306323ecfaefe40ad5b13729e89 | refs/heads/master | 2020-03-11T13:50:18.287379 | 2018-05-22T08:49:51 | 2018-05-22T08:49:51 | 130,036,124 | 0 | 0 | null | 2018-04-18T09:13:52 | 2018-04-18T09:13:51 | null | UTF-8 | Java | false | false | 4,909 | java | package ru.sbt.jschool.session9;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.Assert.assertEquals;
public class ExecutionManagerTest {
@Test
public void completedTaskCountTest() {
ExecutionManager executionManager = new ExecutionManagerImpl();
Context context = executionManager.execute(System.out::println, (Runnable) () -> {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
assertEquals(0, context.getCompletedTaskCount());
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
assertEquals(1, context.getCompletedTaskCount());
}
@Test
public void failedTaskCountTest() {
ExecutionManager executionManager = new ExecutionManagerImpl();
Context context = executionManager.execute(System.out::println, (Runnable) () -> {
try {
TimeUnit.SECONDS.sleep(1);
throw new NullPointerException();
} catch (InterruptedException e) {
e.printStackTrace();
}
});
assertEquals(0, context.getFailedTaskCount());
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
assertEquals(1, context.getFailedTaskCount());
}
@Test
public void interruptedTaskCountTest() {
ExecutionManager executionManager = new ExecutionManagerImpl();
Context context = executionManager.execute(System.out::println, (Runnable) () -> {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
assertEquals(0, context.getInterruptedTaskCount());
context.interrupt();
assertEquals(1, context.getInterruptedTaskCount());
}
@Test
public void finishedTest() {
final AtomicInteger atomicInt = new AtomicInteger(0);
Runnable[] runnables = new Runnable[5];
for (int i = 0; i < 5; i++) {
runnables[i] = () -> {
try {
TimeUnit.SECONDS.sleep(atomicInt.incrementAndGet());
} catch (InterruptedException e) {
e.printStackTrace();
}
};
}
ExecutionManager executionManager = new ExecutionManagerImpl();
Context context = executionManager.execute(System.out::println, runnables);
assertEquals(false, context.isFinished());
try {
TimeUnit.SECONDS.sleep(5);
} catch (InterruptedException e) {
e.printStackTrace();
}
context.interrupt();
assertEquals(true, context.isFinished());
assertEquals(5, context.getCompletedTaskCount() + context.getInterruptedTaskCount());
}
@Test
public void allTaskCountTest() throws InterruptedException {
final AtomicInteger atomicInt = new AtomicInteger(0);
Runnable[] runnables = new Runnable[6];
for (int i = 0; i < 5; i++) {
runnables[i] = () -> {
try {
if (atomicInt.getAndIncrement() < 3) {
TimeUnit.SECONDS.sleep(1);
} else {
TimeUnit.SECONDS.sleep(3);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
};
}
runnables[5] = () -> {
try {
TimeUnit.SECONDS.sleep(1);
throw new NullPointerException();
} catch (InterruptedException e) {
e.printStackTrace();
}
};
ExecutionManager executionManager = new ExecutionManagerImpl();
Context context = executionManager.execute(System.out::println, runnables);
assertEquals(false, context.isFinished());
assertEquals(0, context.getCompletedTaskCount());
assertEquals(0, context.getFailedTaskCount());
assertEquals(0, context.getInterruptedTaskCount());
TimeUnit.SECONDS.sleep(2);
assertEquals(false, context.isFinished());
assertEquals(3, context.getCompletedTaskCount());
assertEquals(1, context.getFailedTaskCount());
assertEquals(0, context.getInterruptedTaskCount());
context.interrupt();
TimeUnit.SECONDS.sleep(2);
assertEquals(false, context.isFinished());
assertEquals(3, context.getCompletedTaskCount());
assertEquals(1, context.getFailedTaskCount());
assertEquals(2, context.getInterruptedTaskCount());
}
}
| [
"zzzadruga@gmail.com"
] | zzzadruga@gmail.com |
3c9259c6028463b4b8dce8f07898b63f71dae915 | 2cb8798f525552d2ee5126811852ae50c4830d72 | /test/org/apache/pig/parser/TestQueryParser.java | 03e7ae3f4b17aa7d961f8556da2e8e1574883982 | [
"Apache-2.0"
] | permissive | pdhung/AutoRollup | 95269ad992739406914b41ba1823fc8ae04a1675 | dce15a4ba1781a93a58e583307845d89e2aa5acb | refs/heads/master | 2021-01-18T08:28:48.553714 | 2015-05-07T15:10:16 | 2015-05-07T15:10:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,662 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.pig.parser;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.antlr.runtime.CharStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.Tree;
import org.apache.pig.ExecType;
import org.apache.pig.PigRunner;
import org.apache.pig.PigServer;
import org.apache.pig.test.Util;
import org.apache.pig.tools.pigstats.PigStats;
import org.junit.Assert;
import org.junit.Test;
public class TestQueryParser {
@Test
public void test() throws IOException, RecognitionException {
CharStream input = new QueryParserFileStream( "test/org/apache/pig/parser/TestParser.pig" );
QueryLexer lexer = new QueryLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
QueryParser parser = new QueryParser(tokens);
QueryParser.query_return result = parser.query();
Tree ast = (Tree)result.getTree();
System.out.println( ast.toStringTree() );
TreePrinter.printTree( (CommonTree)ast, 0 );
Assert.assertEquals( 0, lexer.getNumberOfSyntaxErrors() );
Assert.assertEquals( 0, parser.getNumberOfSyntaxErrors() );
}
@Test
// After PIG-438, realias statement is valid
public void testNegative1() throws IOException, RecognitionException {
shouldPass("A = load 'x'; B=A;");
}
@Test(expected=RecognitionException.class)
public void testNegative2() throws IOException, RecognitionException {
shouldFail("A = load 'x'; B=(A);");
}
@Test(expected=RecognitionException.class)
public void testNegative3() throws IOException, RecognitionException {
shouldFail("A = load 'x';B = (A) as (a:int, b:long);");
}
@Test(expected=RecognitionException.class)
public void testNegative4() throws IOException, RecognitionException {
shouldFail("A = load 'x'; B = ( filter A by $0 == 0 ) as (a:bytearray, b:long);");
}
@Test(expected=RecognitionException.class)
public void testNegative5() throws IOException, RecognitionException {
shouldFail("A = load 'x'; D = group A by $0:long;");
}
@Test(expected=RecognitionException.class)
public void testNegative6() throws IOException, RecognitionException {
shouldFail("A = load '/Users/gates/test/data/studenttab10'; B = foreach A generate $0, 3.0e10.1;");
}
@Test // test error message with file name
public void testNagative7() throws IOException {
File f1 = new File("myscript.pig");
f1.deleteOnExit();
FileWriter fw1 = new FileWriter(f1);
fw1.append("A = loadd '1.txt';");
fw1.close();
String[] args = { "-x", "local", "-c", "myscript.pig" };
PigStats stats = PigRunner.run(args, null);
Assert.assertFalse(stats.isSuccessful());
String expected = "<file myscript.pig, line 1, column 0>";
String msg = stats.getErrorMessage();
Assert.assertFalse(msg == null);
Assert.assertTrue(msg.startsWith(expected));
}
// See PIG-2238
@Test
public void testDependentNullAlias() throws IOException, RecognitionException {
PigServer pigServer = new PigServer(ExecType.LOCAL);
try {
pigServer.registerQuery( "F = limit F 20;store F into 'out';" );
} catch(Exception ex) {
Assert.assertTrue(ex.getMessage().contains("Unrecognized alias F"));
return;
}
Assert.fail();
}
@Test
public void test2() throws IOException, RecognitionException {
shouldPass("A = load '/Users/gates/test/data/studenttab10'; B = foreach A generate ( $0 == 0 ? 1 : 0 );");
}
@Test
public void test3() throws IOException, RecognitionException {
String query = "a = load '1.txt' as (a0);" +
"b = foreach a generate flatten( (bag{tuple(map[])})a0 ) as b0:map[];" +
"c = foreach b generate (long)b0#'key1';";
shouldPass( query );
}
@Test
public void test4() throws IOException, RecognitionException {
String query = "a = load '1.txt' as (name, age, gpa); b = group a by name;" +
"c = foreach b generate group, COUNT(a.age);" +
"store c into 'y';";
shouldPass( query );
}
@Test
public void test5() throws IOException, RecognitionException {
String query = "a = load 'x' as (name, age, gpa);" +
"b = foreach a generate name, age + 2L, 3.125F, 3.4e2;" +
" store b into 'y'; ";
shouldPass( query );
}
@Test
public void test6() throws IOException, RecognitionException {
String query = "a = load '/user/pig/tests/data/singlefile/studentnulltab10k' as (name:chararray, age:int, gpa:double);" +
"b = foreach a generate (int)((int)gpa/((int)gpa - 1)) as norm_gpa:int;" +
"c = foreach b generate (norm_gpa is not null? norm_gpa: 0);" +
"store c into '/user/pig/out/jianyong.1297229709/Types_37.out';";
shouldPass( query );
}
@Test
public void test7() throws IOException, RecognitionException {
String query = "a = load '/user/pig/tests/data/singlefile/studenttab10k';" +
"b = group a by $0;" +
"c = foreach b {c1 = order $1 by * using org.apache.pig.test.udf.orderby.OrdDesc; generate flatten(c1); };" +
"store c into '/user/pig/out/jianyong.1297305352/Order_15.out';";
shouldPass( query );
}
@Test
public void test8() throws IOException, RecognitionException {
String query = "a = load '/user/pig/tests/data/singlefile/studenttab10k';" +
"b = group a by $0;" +
"c = foreach b {c1 = order $1 by $1; generate flatten(c1), MAX($1.$1); };" +
"store c into '/user/pig/out/jianyong.1297305352/Order_17.out';";
shouldPass( query );
}
@Test(expected=RecognitionException.class)
public void testCubeNegative1() throws IOException, RecognitionException {
// cube keyword used as alias
String query = "x = load 'cubedata' as (a, b, c, d); " +
"cube = cube x by (a, b, c);";
shouldFail( query );
}
@Test(expected=RecognitionException.class)
public void testCubeNegative2() throws IOException, RecognitionException {
// syntax error - brackets missing
String query = "x = load 'cubedata' as (a, b, c, d); " +
"y = cube x by a, b, c;";
shouldFail( query );
}
@Test(expected=RecognitionException.class)
public void testCubeNegative3() throws IOException, RecognitionException {
// syntax error - BY missing
String query = "x = load 'cubedata' as (a, b, c, d); " +
"y = cube x (a, b, c);";
shouldFail( query );
}
@Test(expected=RecognitionException.class)
public void testCubeNegative4() throws IOException, RecognitionException {
// syntax error - UDF at the end
String query = "x = load 'cubedata' as (a, b, c, d); " +
"y = cube x by (a, b, c), UDF(c);";
shouldFail( query );
}
@Test(expected=RecognitionException.class)
public void testCubeNegative5() throws IOException, RecognitionException {
// syntax error - specifying just dimensions
String query = "x = load 'cubedata' as (a, b, c, d); " +
"y = cube x by (a, b, c), CUBE(c);";
shouldFail( query );
}
@Test(expected=RecognitionException.class)
public void testCubeNegative6() throws IOException, RecognitionException {
// syntax error - dangling dimension
String query = "x = load 'cubedata' as (a, b, c, d); " +
"y = cube x by CUBE(a, b, c), y, ROLLUP(c);";
shouldFail( query );
}
@Test
public void testCubePositive1() throws IOException, RecognitionException {
// syntactically correct
String query = "x = load 'cubedata' as (a, b, c, d);" +
"y = cube x by cube(a, b, c);" +
"z = foreach y generate flatten(group) as (a, b, c), COUNT(x) as count;" +
"store z into 'cube_output';";
shouldPass( query );
}
@Test
public void testCubePositive2() throws IOException, RecognitionException {
// all columns using *
String query = "x = load 'cubedata' as (a, b, c, d);" +
"y = cube x by rollup(*), rollup($2..$3);" +
"z = foreach y generate flatten(group) as (a, b, c, d), COUNT(x) as count;" +
"store z into 'cube_output';";
shouldPass( query );
}
@Test
public void testCubePositive3() throws IOException, RecognitionException {
// range projection
String query = "x = load 'cubedata' as (a, b, c, d);" +
"y = cube x by cube($0, $1);" +
"z = foreach y generate flatten(group) as (a, b), COUNT(x) as count;" +
"store z into 'cube_output';";
shouldPass( query );
}
@Test
public void test9() throws IOException, RecognitionException {
String query = "a = load 'x' as (u,v);" +
"b = load 'y' as (u,w);" +
"c = join a by u, b by u;" +
"d = foreach c generate a::u, b::u, w;";
shouldPass( query );
}
@Test
public void test10() throws IOException, RecognitionException {
String query = "a = load 'x' as (name, age, gpa);" +
"b = FOREACH C GENERATE group, flatten( ( 1 == 2 ? 2 : 3 ) );" +
" store b into 'y'; ";
shouldPass( query );
}
// 'repl' and such, shouldn't be treated as a constant. So, the following should pass.
@Test
public void test11() throws IOException, RecognitionException {
String query = "a = load 'repl' as (name, age, gpa);" +
"b = FOREACH C GENERATE group, flatten( ( 1 == 2 ? 2 : 3 ) );" +
" store b into 'skewed'; ";
shouldPass( query );
}
@Test
public void testBagType() throws IOException, RecognitionException {
String query = "a = load '1.txt' as ( u : bag{}, v : bag{tuple(x, y)} );" +
"b = load '2.x' as ( t : {}, u : {(r,s)}, v : bag{ T : tuple( x, y ) }, w : bag{(z1, z2)} );" +
"c = load '3.x' as p : int;";
int errorCount = parse( query );
Assert.assertTrue( errorCount == 0 );
}
@Test
public void testFlatten() throws IOException, RecognitionException {
String query = "a = load '1.txt' as ( u, v, w : int );" +
"b = foreach a generate * as ( x, y, z ), flatten( u ) as ( r, s ), flatten( v ) as d, w + 5 as e:int;";
int errorCount = parse( query );
Assert.assertTrue( errorCount == 0 );
}
@Test //PIG-2083
public void testNullInBinCondNoSpace() throws IOException{
String query = "a = load '1.txt' as (a0, a1);" +
"b = foreach a generate (a0==0?null:2);"; //no space around the null keyword, so the lexer doesn't emit a NULL token
PigServer pig = new PigServer(ExecType.LOCAL);
Util.registerMultiLineQuery(pig, query);
pig.explain("b", System.out);
}
@Test
public void testAST() throws IOException, RecognitionException {
CharStream input = new QueryParserFileStream( "test/org/apache/pig/parser/TestAST.pig" );
QueryLexer lexer = new QueryLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
QueryParser parser = new QueryParser(tokens);
QueryParser.query_return result = parser.query();
Tree ast = (Tree)result.getTree();
System.out.println( ast.toStringTree() );
TreePrinter.printTree( (CommonTree)ast, 0 );
Assert.assertEquals( 0, lexer.getNumberOfSyntaxErrors() );
Assert.assertEquals( 0, parser.getNumberOfSyntaxErrors() );
Assert.assertEquals( "QUERY", ast.getText() );
Assert.assertEquals( 5, ast.getChildCount() );
for( int i = 0; i < ast.getChildCount(); i++ ) {
Tree c = ast.getChild( i );
Assert.assertEquals( "STATEMENT", c.getText() );
}
Tree stmt = ast.getChild( 0 );
Assert.assertEquals( "A", stmt.getChild( 0 ).getText() ); // alias
Assert.assertTrue( "LOAD".equalsIgnoreCase( stmt.getChild( 1 ).getText() ) );
stmt = ast.getChild( 1 );
Assert.assertEquals( "B", stmt.getChild( 0 ).getText() ); // alias
Assert.assertTrue( "FOREACH".equalsIgnoreCase( stmt.getChild( 1 ).getText() ) );
stmt = ast.getChild( 2 );
Assert.assertEquals( "C", stmt.getChild( 0 ).getText() ); // alias
Assert.assertTrue( "FILTER".equalsIgnoreCase( stmt.getChild( 1 ).getText() ) );
stmt = ast.getChild( 3 );
Assert.assertEquals( "D", stmt.getChild( 0 ).getText() ); // alias
Assert.assertTrue( "LIMIT".equalsIgnoreCase( stmt.getChild( 1 ).getText() ) );
stmt = ast.getChild( 4 );
Assert.assertTrue( "STORE".equalsIgnoreCase( stmt.getChild( 0 ).getText() ) );
}
@Test
public void testMultilineFunctionArguments() throws RecognitionException, IOException {
final String pre = "STORE data INTO 'testOut' \n" +
"USING PigStorage (\n";
String lotsOfNewLines = "'{\"debug\": 5,\n" +
" \"data\": \"/user/lguo/testOut/ComponentActTracking4/part-m-00000.avro\",\n" +
" \"field0\": \"int\",\n" +
" \"field1\": \"def:browser_id\",\n" +
" \"field3\": \"def:act_content\" }\n '\n";
String [] queries = { lotsOfNewLines,
"'notsplitatall'",
"'see you\nnext line'",
"'surrounded \n by spaces'",
"'\nleading newline'",
"'trailing newline\n'",
"'\n'",
"'repeated\n\n\n\n\n\n\n\n\nnewlines'",
"'also\ris\rsupported\r'"};
final String post = ");";
for(String q : queries) {
shouldPass(pre + q + post);
}
}
private void shouldPass(String query) throws RecognitionException, IOException {
System.out.println("Testing: " + query);
Assert.assertEquals(query + " should have passed", 0, parse(query));
}
private void shouldFail(String query) throws RecognitionException, IOException {
System.out.println("Testing: " + query);
parse( query );
}
private int parse(String query) throws IOException, RecognitionException {
CharStream input = new QueryParserStringStream( query, null );
QueryLexer lexer = new QueryLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
QueryParser parser = QueryParserUtils.createParser(tokens);
QueryParser.query_return result = parser.query();
Tree ast = (Tree)result.getTree();
System.out.println( ast.toStringTree() );
TreePrinter.printTree((CommonTree) ast, 0);
Assert.assertEquals(0, lexer.getNumberOfSyntaxErrors());
return parser.getNumberOfSyntaxErrors();
}
//PIG-2267
public void testThatColNameIsGeneratedProperly() throws IOException {
String query = "a = load '1.txt' as (int,(long,[]),{([])});"
+ "b = foreach a generate val_0, tuple_0, bag_0;"
+ "c = foreach b generate val_0, flatten(tuple_0), flatten(bag_0);"
+ "d = foreach c generate val_0, tuple_0::val_0, bag_0::map_0;";
PigServer pig = new PigServer(ExecType.LOCAL);
Util.registerMultiLineQuery(pig, query);
}
//RANK
@Test
public void testRankPositive1() throws IOException, RecognitionException {
shouldPass("B = rank A;");
}
@Test
public void testRankPositive2() throws IOException, RecognitionException {
shouldPass("B = rank A by x;");
}
@Test
public void testRankPositive3() throws IOException, RecognitionException {
shouldPass("B = rank A by x DESC;");
}
@Test
public void testRankPositive4() throws IOException, RecognitionException {
shouldPass("B = rank A by x, y ASC, w DESC, z ASC;");
}
@Test
public void testRankPositive5() throws IOException, RecognitionException {
String query = "A = load 'data' as (x:int, y:chararray, z:int, rz:chararray);";
query += "B = rank A by x..z;";
shouldPass(query);
}
@Test
public void testRankPositive6() throws IOException, RecognitionException {
String query = "A = load 'data' as (x:int, y:chararray, z:int, rz:chararray);";
query += "B = rank A by *;";
shouldPass(query);
}
@Test
public void testRankPositive7() throws IOException, RecognitionException {
String query = "A = load 'data' as (x:int, y:chararray, z:int, rz:chararray);";
query += "B = rank A by x DESC DENSE;";
shouldPass(query);
}
@Test
public void testRankPositive8() throws IOException, RecognitionException {
String query = "A = load 'data' as (x:int, y:chararray, z:int, rz:chararray);";
query += "B = rank A by x DESC,y ASC DENSE;";
shouldPass(query);
}
@Test
public void testRankPositive9() throws IOException, RecognitionException {
String query = "A = load 'data' as (x:int, y:chararray, z:int, rz:chararray);";
query += "B = rank A by * DENSE;";
shouldPass(query);
}
@Test // PIG-2769
public void testSlowQuery() throws Exception {
String query = "A = load 'A.txt' using PigStorage() AS (m: int);";
query += "B = FOREACH A { days_str = (chararray) (m == 1 ? 31: (m == 2 ? 28: (m == 3 ? 31: (m == 4 ? 30: (m == 5 ? 31: (m == 6 ? 30: (m == 7 ? 31: (m == 8 ? 31: (m == 9 ? 30: (m == 10 ? 31: (m == 11 ? 30:31))))))))))); GENERATE days_str as days_str; }";
query += "store B into 'B';";
shouldPass(query);
}
@Test
public void testFunction1() throws Exception {
shouldPass("B = foreach A generate org.apache.pig.builtin.CONCAT(b, c);");
}
@Test
public void testFunction2() throws Exception {
shouldPass("B = foreach A generate org.apache.pig.builtin.CONCAT(b, c, 'x', 'y');");
}
@Test
public void testFunction3() throws Exception {
shouldPass("B = foreach A generate flatten(myudfs.Swap(name, age)), gpa;");
}
@Test
public void testFilter1() throws Exception {
shouldPass("E = FILTER D BY not IsEmpty(B);");
}
@Test
public void testFilter2() throws Exception {
shouldPass("C = filter B by 2 > 1;");
}
@Test
public void testFilter3() throws Exception {
shouldPass("C = filter B by a is null;");
}
@Test
public void testFilter4() throws Exception {
shouldPass("C = filter B by a is not null;");
}
@Test
public void testGroup1() throws Exception {
shouldPass("B = group A by ( a, $2 );");
}
@Test
public void testCast1() throws Exception {
shouldPass("B = FOREACH A GENERATE (int)$0 + 1;");
}
@Test
public void testCast2() throws Exception {
shouldPass("B = FOREACH A GENERATE (tuple(int,int,float))fld;");
}
@Test
public void testCast3() throws Exception {
shouldPass("B = FOREACH A GENERATE (bag{tuple(long)})fld; ");
}
@Test
public void testCast4() throws Exception {
shouldPass("B = FOREACH A GENERATE (map[])fld;");
}
@Test
public void testCast5() throws Exception {
shouldPass("E = foreach D generate userid, clicks/(double)C.total, cnt;");
}
@Test
public void testCast6() throws Exception {
shouldPass("X = FOREACH B GENERATE group, (chararray)COUNT(A) AS total;");
}
@Test
public void testCast7() throws Exception {
shouldPass("B = FOREACH A GENERATE a + (int)null;");
}
@Test
public void testCast8() throws Exception {
shouldPass("a = load '1.txt' as(map[int]); --Map value is int");
}
@Test
public void testCast9() throws Exception {
shouldPass("b = foreach a generate (map[(i:int)])a0; -- Map value is tuple");
}
@Test
public void testCast10() throws Exception {
shouldPass("b = stream a through `cat` as (m:map[{(i:int,j:chararray)}]); -- Map value is bag");
}
@Test
public void testNull1() throws Exception {
shouldPass("B = FOREACH A GENERATE a, null;");
}
@Test
public void testNull2() throws Exception {
shouldPass("D = FOREACH C GENERATE FLATTEN((IsEmpty(A) ? null : A)), FLATTEN((IsEmpty(B) ? null : B));");
}
@Test
public void testNull3() throws Exception {
shouldPass("B = FOREACH A GENERATE a + null;");
}
@Test
public void testStar1() throws Exception {
shouldPass("B = FOREACH A GENERATE *, MyUDF(name, age);");
}
@Test
public void testStar2() throws Exception {
shouldPass("C = FOREACH A GENERATE name, age, MyUDF(*);");
}
@Test
public void testProjectRange1() throws Exception {
shouldPass("F = foreach IN generate (int)col0, col1 .. col3; ");
}
@Test
public void testProjectRange2() throws Exception {
shouldPass("SORT = order IN by col2 .. col3, col0, col4 ..; ");
}
@Test
public void testProjectRange3() throws Exception {
shouldPass("J = join IN1 by $0 .. $3, IN2 by $0 .. $3; ");
}
@Test
public void testProjectRange4() throws Exception {
shouldPass("g = group l1 by b .. c; ");
}
@Test
public void testProjection1() throws Exception {
shouldPass("b = foreach a generate flatten(group), SUM($1.$2);");
}
@Test
public void testProjection2() throws Exception {
shouldPass("a = group (load '/var/folders/bs/cy3sndf95ng5ljgy5nxs1j080000gn/T/test6322762304144938425txt') by ($0,$1);");
}
@Test
public void testPartition() throws Exception {
shouldPass("B = group A by $0 PARTITION BY org.apache.pig.test.utils.SimpleCustomPartitioner parallel 2;");
}
@Test
public void testBoolean1() throws Exception {
shouldPass("C = foreach B generate group, " +
"((org.apache.pig.test.utils.AccumulatorBagCount(A)>1 and " +
"org.apache.pig.test.utils.AccumulatorBagCount(A)<3)?0:1);");
}
@Test
public void testBoolean2() throws Exception {
shouldPass("C = foreach B generate group, " +
"((org.apache.pig.test.utils.AccumulatorBagCount(A)>3 or " +
"org.apache.pig.test.utils.AccumulatorBagCount(A)<2)?0:1);");
}
@Test
public void testSplit1() throws Exception {
shouldPass("split a into b if id > 3, c if id < 3, d otherwise;");
}
@Test
public void testSplit2() throws Exception {
shouldPass("SPLIT logs INTO logins IF command == 'login', all_quits IF command == 'quit';");
}
}
| [
"hxquangnhat@gmail.com"
] | hxquangnhat@gmail.com |
ea0783c0a14b544ba3a66f88804b1ee585676529 | 88b8fe5b9140d17d2c5a110d2c05c5a0574b1fa9 | /sunyata-game-majiang-core/src/main/java/org/sunyata/game/majiang/core/service/yunfeng/table/src/org/yungege/mj/Program.java | 83dbf8761c792a6eead6cc2c0f05117815b9528b | [] | no_license | sunyata-projects/vertx-game | 9c538000e5b1298eb8f178a1cdaac04724a8b68d | 3f0a0874636b2dc8e681113421496e0cb0837f13 | refs/heads/master | 2021-09-26T18:07:59.892671 | 2017-12-14T12:23:26 | 2017-12-14T12:23:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,321 | java | package org.sunyata.game.majiang.core.service.yunfeng.table.src.org.yungege.mj;
import java.util.HashSet;
import java.util.Random;
public class Program {
public static void print_cards(int[] cards) {
for (int i = 0; i < 9; ++i) {
System.out.print(cards[i]);
System.out.print(",");
}
System.out.println("");
for (int i = 9; i < 18; ++i) {
System.out.print(cards[i]);
System.out.print(",");
}
System.out.println("");
for (int i = 18; i < 27; ++i) {
System.out.print(cards[i]);
System.out.print(",");
}
System.out.println("");
for (int i = 27; i < 34; ++i) {
System.out.print(cards[i]);
System.out.print(",");
}
System.out.println("\n=========================================");
}
static HashSet<Integer> tested = new HashSet<Integer>();
static void check_hu(int[] cards, int max_gui_index) {
for (int i = 0; i < max_gui_index; ++i) {
if (cards[i] > 4)
return;
}
int num = 0;
for (int i = 0; i < 9; ++i) {
num = num * 10 + cards[i];
}
if (tested.contains(num)) {
return;
}
tested.add(num);
for (int i = 0; i < max_gui_index; ++i) {
if (!Hulib.getInstance().get_hu_info(cards, 0, 0)) {
System.out.print("测试失败 i=%d\n" + i);
print_cards(cards);
}
}
}
static void gen_auto_table_sub(int[] cards, int level) {
for (int i = 0; i < 32; ++i) {
int index = -1;
if (i <= 17) {
cards[i] += 3;
} else if (i <= 24) {
index = i - 18;
} else {
index = i - 16;
}
if (index >= 0) {
cards[index] += 1;
cards[index + 1] += 1;
cards[index + 2] += 1;
}
if (level == 4) {
check_hu(cards, 18);
} else {
gen_auto_table_sub(cards, level + 1);
}
if (i <= 17) {
cards[i] -= 3;
} else {
cards[index] -= 1;
cards[index + 1] -= 1;
cards[index + 2] -= 1;
}
}
}
public static void test1() {
System.out.println("测试两种花色\n");
int[] cards = { 0, 0, 0, 1, 1, 1, 0, 2, 0, /* 桶 */ 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 条 */ 0, 0, 0, 0, 0, 0, 0,0,0,/* 字 */ 0, 0, 0, 0, 0, 0, 0 };
gen_auto_table_sub(cards, 1);
// for (int i = 0; i < 18; ++i) {
// cards[i] = 2;
// System.out.print("将 ");
// System.out.println(i);
// gen_auto_table_sub(cards, 1);
// cards[i] = 0;
// }
}
static void test_one() {
TableMgr.getInstance().load();
int guiIndex = 33;
// 1筒,2筒,3筒,4筒,4筒,5筒,5筒,6筒,7筒,7筒,8筒,8筒,9筒,9筒
// int[] cards = { 1, 0, 0, 0, 0, 0, 0, 0, 0,/*桶*/ 1, 1, 1, 2, 1, 1, 2,
// 2, 2,
// /*条*/ 0, 0, 0, 0, 0, 0, 0, 0, 0,/*字*/ 0, 0, 0, 0, 0, 0, 0 };
int[] cards = {
0, 0, 0, 1, 1, 1, 0, 0, 0, /* 桶 */
1, 1, 1, 0, 0, 0, 0, 0, 0, /* 条 */
2, 0, 0, 0, 0, 0, 0, 0, 0, /* 字 */
0, 0, 0, 0, 0, 0, 0 };
System.out.println("测试1种,癞子:" + guiIndex);
print_cards(cards);
long start = System.currentTimeMillis();
if (!Hulib.getInstance().get_hu_info(cards, 34, guiIndex)) {
System.out.print("测试失败\n");
} else {
System.out.print("测试成功\n");
}
System.out.println("use:" + (System.currentTimeMillis() - start));
}
public static void main(String[] args) {
// ak_test();
test_one();
}
private static Random random = new Random();
private static void ak_test()
{
System.out.print("test hulib begin...\n");
TableMgr.getInstance().load();
int lose = 0;
int win = 0;
long start = System.currentTimeMillis();
for (int i = 0 ; i < 1000000 ; i++)
{
int[] cards = new int[34];
int cardNum = 0;
while (cardNum < 14)
{
if(cards[random.nextInt(cards.length)] < 4)
{
cards[random.nextInt(cards.length)]++;
cardNum++;
}
}
int guiIndex = random.nextInt(34);
// System.out.println("测试1种,癞子:" + guiIndex);
// print_cards(cards);
if (!Hulib.getInstance().get_hu_info(cards, 34, guiIndex)) {
// System.out.print("测试失败\n");
lose++;
} else {
// System.out.print("测试成功\n");
// System.out.println("测试1种,癞子:" + guiIndex);
// print_cards(cards);
win++;
}
}
System.out.println("1000000次,use:" + (System.currentTimeMillis() - start)+"ms,成功:"+win+"次,失败:"+lose+"次.");
// System.Console.ReadKey();
}
}
| [
"licl.chevan@ourgame.com"
] | licl.chevan@ourgame.com |
b65758209364294733bf9870fccf1e36f2550696 | 12d2c0fd3fd0d183c74120759898cf42c4b5d74c | /src/main/word2vec/domain/WordEntry.java | 237bc9c4ecd9286ac3c6e87e11594788c8d2e74f | [] | no_license | on1you/NLP | a812c7085b84656169ac3032b4a53fa4cc0debb8 | 0557dbf21e9fccfb1e19a2875a505c70aa22bdce | refs/heads/master | 2020-05-27T12:09:12.264829 | 2014-07-30T09:47:37 | 2014-07-30T09:47:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 598 | java | package main.word2vec.domain;
public class WordEntry implements Comparable<WordEntry> {
public String name;
public float score;
public WordEntry(String name, float score) {
this.name = name;
this.score = score;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return this.name + "\t" + score;
}
@Override
public int compareTo(WordEntry o) {
// TODO Auto-generated method stub
if (this.score < o.score) {
return 1;
} else {
return -1;
}
}
} | [
"liuxueping@172.16.0.129"
] | liuxueping@172.16.0.129 |
87c60af4b8e40e59b8cbff3dde644f474afce21f | d45afe2cd367811ec56643391a2aba747d42f87c | /GraphicComponent_Function/zStuff_Image/AFImagePaint.java | 1c2f11bdf1c621c836fb8ceba802520bdeacf6cd | [] | no_license | JungSangHyeon/2019-Einstein-Desk | 321ed7a9de8321ddaf37c198cf8e762ea560d51b | 612f99e23d5bcd44dddce605f15a0cd357406de2 | refs/heads/master | 2022-12-01T17:48:12.832312 | 2020-07-06T04:15:39 | 2020-07-06T04:15:39 | 275,730,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,013 | java | package zStuff_Image;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import javax.imageio.ImageIO;
import zStuff_Function.AFunction;
public abstract class AFImagePaint extends AFunction implements Serializable{
private static final long serialVersionUID = -2266921661341345665L;
protected boolean mouseOn = false;
protected long imageIndex;
protected Color backGroundColor = Color.WHITE;
public void setBackGroundColor(Color c) {this.backGroundColor=c;}
public void setImage(String fileAddress, boolean save) {
try {
if(save) {imageIndex = ImgStorage.addImage(ImageIO.read(new File(fileAddress)), fileAddress);}
else{imageIndex = ImgStorage.addImage(ImageIO.read(new File(fileAddress)));}}
catch (IOException e) {/*DO NOTHING*/}
}
public void setImage(String fileAddress) {
try {imageIndex = ImgStorage.addImage(ImageIO.read(new File(fileAddress)));}
catch (IOException e) {/*DO NOTHING*/}
}
}
| [
"sh199919@naver.com"
] | sh199919@naver.com |
6d67b6d00e35e77aec00e7206ee691e3453fc268 | 06ca8264b1d34e01703ecf47b29a21a33ba4c673 | /lib/src/main/java/com/example/lib/TestCheckingAccount.java | 0bd9787c5e14973b1985caa991edcfad736b5920 | [] | no_license | chaewoon83/infosys | bdaad869fb25522dbd93ec44d7d1216bb473b41e | 3059d50a601c6335d21bbe6e8828c51498df5c43 | refs/heads/master | 2020-09-08T16:56:28.676957 | 2019-11-12T10:22:56 | 2019-11-12T10:22:56 | 221,189,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 575 | java | package com.example.lib;
public class TestCheckingAccount {
public static void main(String[] args) {
CheckingAccount myCheckAcc = new CheckingAccount(1024, 8000.0);
System.out.println(myCheckAcc.getBalance());
myCheckAcc.deposit(2000);
myCheckAcc.withdraw(15000);
System.out.println(myCheckAcc.getBalance());
myCheckAcc.withdraw(200);
System.out.println(myCheckAcc.getBalance());
myCheckAcc.deposit(7000);
myCheckAcc.withdraw(200);
System.out.println(myCheckAcc.getBalance());
}
}
| [
"balexgood@gmail.com"
] | balexgood@gmail.com |
e8cf9694586c8e0f6ffdc393b1aaad55ec648183 | f4df5178386f83a5e91c3c020fefb9b949d56970 | /src/main/java/database/UploadersDAO.java | 3c76bef02c2169849951ba3ed94564cecec4407b | [] | no_license | ruimendes29/share-your-media | 371b14175376bea791414dce180f91f7f9f98171 | 4998f78ce56d40d828fd2f6fd87eada120947f11 | refs/heads/master | 2023-08-28T19:15:37.451136 | 2021-10-18T15:42:38 | 2021-10-18T15:42:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,165 | java | package database;
import java.util.Arrays;
import java.util.List;
public final class UploadersDAO extends DataAcessObject<String, Uploader> {
private static UploadersDAO singleton = new UploadersDAO();
private UploadersDAO() {
super(new Uploader(), "UPLOAD", Arrays.asList("REGULAR_USER_email", "MEDIAFILE_name", "MEDIAFILE_artist"));
}
public static UploadersDAO getInstance() {
return UploadersDAO.singleton;
}
public List<Uploader> getUploadersOfMediafile(final String name, final String artist) {
return super.find("%", name, artist);
}
public List<Uploader> get(final String name, final String artist) {
return super.find("%", name, artist);
}
public Uploader put(final Uploader u) {
return super.put(u, u.getUploader(), u.getName(), u.getArtist());
}
public Uploader remove(final String uploader, final String name, final String artist) {
return super.remove(uploader, name, artist);
}
public boolean containsKey(final String uploader, final String name, final String artist) {
return super.containsKey(uploader, name, artist);
}
}
| [
"ruifilipe29mendes@gmail.com"
] | ruifilipe29mendes@gmail.com |
e3c58b02b3c2c72faac4a8c3d98ffd2c7b003bfb | f63bb4535e8347ffc73025ed3c58b845eeefc9ce | /mall-portal/src/main/java/com/zscat/mall/portal/service/MemberAttentionService.java | 558021af58c13e07b050ad868b70520b492321cc | [] | no_license | 442114004/mall-dubbo | ed1e6130ab0f14710fb975ac97ba0bf1e40564f9 | 1dfb2d6b262d19a859111d5451464be0b5a3d099 | refs/heads/master | 2020-04-27T16:11:43.405289 | 2019-03-08T05:31:41 | 2019-03-08T05:31:41 | 174,475,739 | 4 | 3 | null | 2019-03-08T05:37:56 | 2019-03-08T05:37:55 | null | UTF-8 | Java | false | false | 507 | java | package com.zscat.mall.portal.service;
import com.zscat.mall.portal.entity.MemberBrandAttention;
import java.util.List;
/**
* 会员关注Service
* Created by zscat on 2018/8/2.
*/
public interface MemberAttentionService {
/**
* 添加关注
*/
int add(MemberBrandAttention memberBrandAttention);
/**
* 取消关注
*/
int delete(Long memberId, Long brandId);
/**
* 获取用户关注列表
*/
List<MemberBrandAttention> list(Long memberId);
}
| [
"zhuan.shen@rjfittime.com"
] | zhuan.shen@rjfittime.com |
4a9a79cbe40974ac2d13e626fcc86bf4c2a3ecf5 | 64a17f8d36ce403e83a1e560dcf08a45dea3c2fe | /terminal-admin/src/main/java/com/ruoyi/web/controller/terminal/TTerminalGpsLogController.java | 6bf592b747cd7ee23a7ad97abcfe03add8b156f6 | [
"MIT"
] | permissive | menghuanlunhui/terminalManage | dff64151a1a8ce35045def303bcc8e156d11c3eb | bb2082cf9c182475c23969ed3640e1eb19dcbe3c | refs/heads/master | 2022-07-29T03:24:51.173883 | 2020-12-21T03:16:25 | 2020-12-21T03:16:25 | 249,753,111 | 1 | 0 | MIT | 2022-07-06T20:48:10 | 2020-03-24T16:00:44 | HTML | UTF-8 | Java | false | false | 4,095 | java | package com.ruoyi.web.controller.terminal;
import java.util.List;
import java.util.UUID;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
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.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.terminal.domain.TTerminalGpsLog;
import com.ruoyi.terminal.service.ITTerminalGpsLogService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 定位卡定位记录Controller
*
* @author ruoyi
* @date 2020-03-25
*/
@Controller
@RequestMapping("/terminal/log")
public class TTerminalGpsLogController extends BaseController
{
private String prefix = "terminal/log";
@Autowired
private ITTerminalGpsLogService tTerminalGpsLogService;
@RequiresPermissions("terminal:log:view")
@GetMapping()
public String log()
{
return prefix + "/log";
}
/**
* 查询定位卡定位记录列表
*/
@RequiresPermissions("terminal:log:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TTerminalGpsLog tTerminalGpsLog)
{
startPage();
List<TTerminalGpsLog> list = tTerminalGpsLogService.selectTTerminalGpsLogList(tTerminalGpsLog);
return getDataTable(list);
}
/**
* 导出定位卡定位记录列表
*/
@RequiresPermissions("terminal:log:export")
@Log(title = "定位卡定位记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TTerminalGpsLog tTerminalGpsLog)
{
List<TTerminalGpsLog> list = tTerminalGpsLogService.selectTTerminalGpsLogList(tTerminalGpsLog);
ExcelUtil<TTerminalGpsLog> util = new ExcelUtil<TTerminalGpsLog>(TTerminalGpsLog.class);
return util.exportExcel(list, "log");
}
/**
* 新增定位卡定位记录
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存定位卡定位记录
*/
@RequiresPermissions("terminal:log:add")
@Log(title = "定位卡定位记录", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TTerminalGpsLog tTerminalGpsLog)
{
tTerminalGpsLog.setSerialId(UUID.randomUUID().toString());
return toAjax(tTerminalGpsLogService.insertTTerminalGpsLog(tTerminalGpsLog));
}
/**
* 修改定位卡定位记录
*/
@GetMapping("/edit/{serialId}")
public String edit(@PathVariable("serialId") String serialId, ModelMap mmap)
{
TTerminalGpsLog tTerminalGpsLog = tTerminalGpsLogService.selectTTerminalGpsLogById(serialId);
mmap.put("tTerminalGpsLog", tTerminalGpsLog);
return prefix + "/edit";
}
/**
* 修改保存定位卡定位记录
*/
@RequiresPermissions("terminal:log:edit")
@Log(title = "定位卡定位记录", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TTerminalGpsLog tTerminalGpsLog)
{
return toAjax(tTerminalGpsLogService.updateTTerminalGpsLog(tTerminalGpsLog));
}
/**
* 删除定位卡定位记录
*/
@RequiresPermissions("terminal:log:remove")
@Log(title = "定位卡定位记录", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tTerminalGpsLogService.deleteTTerminalGpsLogByIds(ids));
}
}
| [
"1372826124@qq.com"
] | 1372826124@qq.com |
c21c172c11d8888a29e79f824675ba283d1c915b | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_swing_DefaultBoundedRangeModel_setMaximum_int.java | 4d68c575cb44d8c3274ff02184249e68e1e3fd83 | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | class javax_swing_DefaultBoundedRangeModel_setMaximum_int{ public static void function() {javax.swing.DefaultBoundedRangeModel obj = new javax.swing.DefaultBoundedRangeModel();obj.setMaximum(971460550);}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
0af5a48ce4f892c924fe5c25cfe4cfc01fdbbe54 | 097df92ce1bfc8a354680725c7d10f0d109b5b7d | /com/amazon/ws/emr/hadoop/fs/shaded/org/apache/http/client/methods/AbstractExecutionAwareRequest$1.java | b2c5a99a63c03e5299643d0555f4be37cd14a94a | [] | no_license | cozos/emrfs-hadoop | 7a1a1221ffc3aa8c25b1067cf07d3b46e39ab47f | ba5dfa631029cb5baac2f2972d2fdaca18dac422 | refs/heads/master | 2022-10-14T15:03:51.500050 | 2022-10-06T05:38:49 | 2022-10-06T05:38:49 | 233,979,996 | 2 | 2 | null | 2022-10-06T05:41:46 | 2020-01-15T02:24:16 | Java | UTF-8 | Java | false | false | 760 | java | package com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.client.methods;
import com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.concurrent.Cancellable;
import com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.conn.ClientConnectionRequest;
class AbstractExecutionAwareRequest$1
implements Cancellable
{
AbstractExecutionAwareRequest$1(AbstractExecutionAwareRequest paramAbstractExecutionAwareRequest, ClientConnectionRequest paramClientConnectionRequest) {}
public boolean cancel()
{
val$connRequest.abortRequest();
return true;
}
}
/* Location:
* Qualified Name: com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.client.methods.AbstractExecutionAwareRequest.1
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"Arwin.tio@adroll.com"
] | Arwin.tio@adroll.com |
f467d3c7ec8dd86ca26cb16740ae806926aa0a21 | 93a82eebc89db6e905bb52505870be1cc689566d | /android_mlkit/app/src/main/java/top/zcwfeng/android_mlkit/java/facedetection/FaceGraphic.java | 78beae053f6e2c52e55f0db7a39564b8a575237a | [] | no_license | zcwfeng/zcw_android_demo | 78cdc86633f01babfe99972b9fde52a633f65af9 | f990038fd3643478dbf4f65c03a70cd2f076f3a0 | refs/heads/master | 2022-07-27T05:32:09.421349 | 2022-03-14T02:56:41 | 2022-03-14T02:56:41 | 202,998,648 | 15 | 8 | null | null | null | null | UTF-8 | Java | false | false | 7,124 | java | // Copyright 2018 Google LLC
//
// 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 top.zcwfeng.android_mlkit.java.facedetection;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import com.google.android.gms.vision.CameraSource;
import com.google.firebase.ml.vision.common.FirebaseVisionPoint;
import com.google.firebase.ml.vision.face.FirebaseVisionFace;
import com.google.firebase.ml.vision.face.FirebaseVisionFaceLandmark;
import top.zcwfeng.android_mlkit.common.GraphicOverlay;
/**
* Graphic instance for rendering face position, orientation, and landmarks within an associated
* graphic overlay view.
*/
public class FaceGraphic extends GraphicOverlay.Graphic {
private static final float FACE_POSITION_RADIUS = 4.0f;
private static final float ID_TEXT_SIZE = 30.0f;
private static final float ID_Y_OFFSET = 50.0f;
private static final float ID_X_OFFSET = -50.0f;
private static final float BOX_STROKE_WIDTH = 5.0f;
private int facing;
private final Paint facePositionPaint;
private final Paint idPaint;
private final Paint boxPaint;
private volatile FirebaseVisionFace firebaseVisionFace;
private final Bitmap overlayBitmap;
public FaceGraphic(GraphicOverlay overlay, FirebaseVisionFace face, int facing, Bitmap overlayBitmap) {
super(overlay);
firebaseVisionFace = face;
this.facing = facing;
this.overlayBitmap = overlayBitmap;
final int selectedColor = Color.WHITE;
facePositionPaint = new Paint();
facePositionPaint.setColor(selectedColor);
idPaint = new Paint();
idPaint.setColor(selectedColor);
idPaint.setTextSize(ID_TEXT_SIZE);
boxPaint = new Paint();
boxPaint.setColor(selectedColor);
boxPaint.setStyle(Paint.Style.STROKE);
boxPaint.setStrokeWidth(BOX_STROKE_WIDTH);
}
/**
* Draws the face annotations for position on the supplied canvas.
*/
@Override
public void draw(Canvas canvas) {
FirebaseVisionFace face = firebaseVisionFace;
if (face == null) {
return;
}
// Draws a circle at the position of the detected face, with the face's track id below.
// An offset is used on the Y axis in order to draw the circle, face id and happiness level in the top area
// of the face's bounding box
float x = translateX(face.getBoundingBox().centerX());
float y = translateY(face.getBoundingBox().centerY());
canvas.drawCircle(x, y - 4 * ID_Y_OFFSET, FACE_POSITION_RADIUS, facePositionPaint);
canvas.drawText("id: " + face.getTrackingId(), x + ID_X_OFFSET, y - 3 * ID_Y_OFFSET, idPaint);
canvas.drawText(
"happiness: " + String.format("%.2f", face.getSmilingProbability()),
x + ID_X_OFFSET * 3,
y - 2 * ID_Y_OFFSET,
idPaint);
if (facing == CameraSource.CAMERA_FACING_FRONT) {
canvas.drawText(
"right eye: " + String.format("%.2f", face.getRightEyeOpenProbability()),
x - ID_X_OFFSET,
y,
idPaint);
canvas.drawText(
"left eye: " + String.format("%.2f", face.getLeftEyeOpenProbability()),
x + ID_X_OFFSET * 6,
y,
idPaint);
} else {
canvas.drawText(
"left eye: " + String.format("%.2f", face.getLeftEyeOpenProbability()),
x - ID_X_OFFSET,
y,
idPaint);
canvas.drawText(
"right eye: " + String.format("%.2f", face.getRightEyeOpenProbability()),
x + ID_X_OFFSET * 6,
y,
idPaint);
}
// Draws a bounding box around the face.
float xOffset = scaleX(face.getBoundingBox().width() / 2.0f);
float yOffset = scaleY(face.getBoundingBox().height() / 2.0f);
float left = x - xOffset;
float top = y - yOffset;
float right = x + xOffset;
float bottom = y + yOffset;
canvas.drawRect(left, top, right, bottom, boxPaint);
// draw landmarks
drawLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.MOUTH_BOTTOM);
drawLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.LEFT_CHEEK);
drawLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.LEFT_EAR);
drawLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.MOUTH_LEFT);
drawLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.LEFT_EYE);
drawBitmapOverLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.NOSE_BASE);
drawLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.RIGHT_CHEEK);
drawLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.RIGHT_EAR);
drawLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.RIGHT_EYE);
drawLandmarkPosition(canvas, face, FirebaseVisionFaceLandmark.MOUTH_RIGHT);
}
private void drawLandmarkPosition(Canvas canvas, FirebaseVisionFace face, int landmarkID) {
FirebaseVisionFaceLandmark landmark = face.getLandmark(landmarkID);
if (landmark != null) {
FirebaseVisionPoint point = landmark.getPosition();
canvas.drawCircle(
translateX(point.getX()),
translateY(point.getY()),
10f, idPaint);
}
}
private void drawBitmapOverLandmarkPosition(Canvas canvas, FirebaseVisionFace face, int landmarkID) {
FirebaseVisionFaceLandmark landmark = face.getLandmark(landmarkID);
if (landmark == null) {
return;
}
FirebaseVisionPoint point = landmark.getPosition();
if (overlayBitmap != null) {
float imageEdgeSizeBasedOnFaceSize = (face.getBoundingBox().width() / 4.0f);
int left = (int) (translateX(point.getX()) - imageEdgeSizeBasedOnFaceSize);
int top = (int) (translateY(point.getY()) - imageEdgeSizeBasedOnFaceSize);
int right = (int) (translateX(point.getX()) + imageEdgeSizeBasedOnFaceSize);
int bottom = (int) (translateY(point.getY()) + imageEdgeSizeBasedOnFaceSize);
canvas.drawBitmap(overlayBitmap,
null,
new Rect(left, top, right, bottom),
null);
}
}
}
| [
"chuanwei.zhang@nextentertain.com"
] | chuanwei.zhang@nextentertain.com |
cd36733cfe25632bf5996b8b3ada0e4ca1b59025 | 6494662446bfb06367bcf0d8ab6adc6bbd4c644e | /vector/src/chatapp/java/com/chatapp/sip/pjsip/recorder/impl/SimpleWavRecorderHandler.java | 18c31fcb6766b1ecc9b7d7097ed309bddff4c883 | [
"Apache-2.0"
] | permissive | arun8984/ChatApp | 859ef33de590b6a87f5dde8418b28f95f3050c2e | b149ab425fe277a89fe8f9835c673bcce4c26b2c | refs/heads/master | 2022-12-05T05:52:04.572533 | 2020-08-27T09:09:30 | 2020-08-27T09:09:30 | 290,681,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,569 | java | /**
* Copyright (C) 2010-2012 Regis Montoya (aka r3gis - www.r3gis.fr)
* This file is part of CSipSimple.
*
* CSipSimple is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* If you own a pjsip commercial license you can also redistribute it
* and/or modify it under the terms of the GNU Lesser General Public License
* as an android library.
*
* CSipSimple is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CSipSimple. If not, see <http://www.gnu.org/licenses/>.
*/
package com.chatapp.sip.pjsip.recorder.impl;
import android.content.Intent;
import android.text.format.DateFormat;
import com.chatapp.sip.api.SipCallSession;
import com.chatapp.sip.api.SipManager;
import com.chatapp.sip.pjsip.recorder.IRecorderHandler;
import com.chatapp.sip.service.SipService.SameThreadException;
import org.pjsip.pjsua.pj_str_t;
import org.pjsip.pjsua.pjsua;
import java.io.File;
import java.io.IOException;
import java.util.Date;
public class SimpleWavRecorderHandler implements IRecorderHandler {
final int way;
final SipCallSession callInfo;
private final int recorderId;
private final String recordingPath;
public SimpleWavRecorderHandler(SipCallSession callInfo, File recordFolder, int way)
throws SameThreadException, IOException {
this.way = way;
this.callInfo = callInfo;
File targetFile = getRecordFile(recordFolder, callInfo.getRemoteContact(), way);
if (targetFile == null) {
throw new IOException("No target file possible");
}
recordingPath = targetFile.getAbsolutePath();
pj_str_t file = pjsua.pj_str_copy(recordingPath);
int[] rcId = new int[1];
int status = pjsua.recorder_create(file, 0, (byte[]) null, 0, 0, rcId);
if (status == pjsua.PJ_SUCCESS) {
recorderId = rcId[0];
} else {
throw new IOException("Pjsip not able to write the file");
}
}
/**
* Get the file to record to for a given remote contact. This will
* implicitly get the current date in file name.
*
* @param remoteContact The remote contact name
* @return The file to store conversation
*/
private File getRecordFile(File dir, String remoteContact, int way) {
if (dir != null) {
// The file name is only to have an unique identifier.
// It should never be used to store datas as may change.
// The app using the recording files should rely on the broadcast
// and on callInfo instead that is reliable.
String datePart = (String) DateFormat.format("yy-MM-dd_kkmmss", new Date());
String remotePart = sanitizeForFile(remoteContact);
String fileName = datePart + "_" + remotePart;
if (way != (SipManager.BITMASK_ALL)) {
fileName += ((way & SipManager.BITMASK_IN) == 0) ? "_out" : "_in";
}
File file = new File(dir.getAbsoluteFile() + File.separator
+ fileName + ".wav");
return file;
}
return null;
}
private String sanitizeForFile(String remoteContact) {
String fileName = remoteContact;
fileName = fileName.replaceAll("[\\.\\\\<>:; \"\'\\*]", "_");
return fileName;
}
@Override
public void startRecording() {
// TODO : treat connect errors ? is it useful? Should we fail gracefully
int wavPort = pjsua.recorder_get_conf_port(recorderId);
if ((way & SipManager.BITMASK_IN) == SipManager.BITMASK_IN) {
int wavConfPort = callInfo.getConfPort();
pjsua.conf_connect(wavConfPort, wavPort);
}
if ((way & SipManager.BITMASK_OUT) == SipManager.BITMASK_OUT) {
pjsua.conf_connect(0, wavPort);
}
}
@Override
public void stopRecording() {
pjsua.recorder_destroy(recorderId);
}
@Override
public void fillBroadcastWithInfo(Intent it) {
it.putExtra(SipManager.EXTRA_FILE_PATH, recordingPath);
it.putExtra(SipManager.EXTRA_SIP_CALL_CALL_WAY, way);
}
}
| [
"nap8984@gmail.com"
] | nap8984@gmail.com |
af4e8d90760859c648c7663d40c474a6907f499b | 288b9387f8a304cb38356bef649656566d86d9a7 | /src/main/java/pages/DetailsPage.java | 60fc62c96c0b1f199908d9d511f55e909de3ca96 | [] | no_license | Anastasia-4831995/practice-18-selenium-final | a04b3a6e7357132f0b94588f238134ee2bfc6ec0 | 07be62f03ed00f4b03481b7c9c839e1c31f66e67 | refs/heads/master | 2023-01-21T11:10:49.495600 | 2020-12-04T08:29:40 | 2020-12-04T08:29:40 | 317,639,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 882 | java | package pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import static org.openqa.selenium.support.PageFactory.initElements;
public class DetailsPage {
@FindBy(css="#wp-tabs-container h2[data.attrid*='title']")
private WebElement name;
@FindBy(css="#wp-tabs-container div[data.attrid*='poslednyaya_versiya'] .LrzXr kno-fv")
private WebElement lastVersion;
@FindBy(css="#wp-tabs-container div[data.attrid*='licenziya'] .LrzXr kno-fv")
private WebElement license;
public DetailsPage(WebDriver driver) {
initElements(driver, this);
}
public String getName() {
return name.getText();
}
public String getLastVersion() {
return lastVersion.getText();
}
public String getLicense() {
return license.getText();
}
}
| [
"polycolorart483@gmail.com"
] | polycolorart483@gmail.com |
ea6f8e176e3fd1f6a437ebc654387576b9812fb5 | 96670d2b28a3fb75d2f8258f31fc23d370af8a03 | /reverse_engineered/sources/com/google/android/gms/maps/internal/IProjectionDelegate.java | bb7fee74800b51a9e972e2e9f1642c887210b2f7 | [] | no_license | P79N6A/speedx | 81a25b63e4f98948e7de2e4254390cab5612dcbd | 800b6158c7494b03f5c477a8cf2234139889578b | refs/heads/master | 2020-05-30T18:43:52.613448 | 2019-06-02T07:57:10 | 2019-06-02T08:15:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,299 | java | package com.google.android.gms.maps.internal;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import com.google.android.gms.dynamic.zzd;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.VisibleRegion;
public interface IProjectionDelegate extends IInterface {
public static abstract class zza extends Binder implements IProjectionDelegate {
private static class zza implements IProjectionDelegate {
private IBinder zzahn;
zza(IBinder iBinder) {
this.zzahn = iBinder;
}
public IBinder asBinder() {
return this.zzahn;
}
public LatLng fromScreenLocation(zzd zzd) throws RemoteException {
LatLng latLng = null;
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.maps.internal.IProjectionDelegate");
obtain.writeStrongBinder(zzd != null ? zzd.asBinder() : null);
this.zzahn.transact(1, obtain, obtain2, 0);
obtain2.readException();
if (obtain2.readInt() != 0) {
latLng = (LatLng) LatLng.CREATOR.createFromParcel(obtain2);
}
obtain2.recycle();
obtain.recycle();
return latLng;
} catch (Throwable th) {
obtain2.recycle();
obtain.recycle();
}
}
public VisibleRegion getVisibleRegion() throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.maps.internal.IProjectionDelegate");
this.zzahn.transact(3, obtain, obtain2, 0);
obtain2.readException();
VisibleRegion visibleRegion = obtain2.readInt() != 0 ? (VisibleRegion) VisibleRegion.CREATOR.createFromParcel(obtain2) : null;
obtain2.recycle();
obtain.recycle();
return visibleRegion;
} catch (Throwable th) {
obtain2.recycle();
obtain.recycle();
}
}
public zzd toScreenLocation(LatLng latLng) throws RemoteException {
Parcel obtain = Parcel.obtain();
Parcel obtain2 = Parcel.obtain();
try {
obtain.writeInterfaceToken("com.google.android.gms.maps.internal.IProjectionDelegate");
if (latLng != null) {
obtain.writeInt(1);
latLng.writeToParcel(obtain, 0);
} else {
obtain.writeInt(0);
}
this.zzahn.transact(2, obtain, obtain2, 0);
obtain2.readException();
zzd zzfc = com.google.android.gms.dynamic.zzd.zza.zzfc(obtain2.readStrongBinder());
return zzfc;
} finally {
obtain2.recycle();
obtain.recycle();
}
}
}
public static IProjectionDelegate zzil(IBinder iBinder) {
if (iBinder == null) {
return null;
}
IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.maps.internal.IProjectionDelegate");
return (queryLocalInterface == null || !(queryLocalInterface instanceof IProjectionDelegate)) ? new zza(iBinder) : (IProjectionDelegate) queryLocalInterface;
}
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
IBinder iBinder = null;
switch (i) {
case 1:
parcel.enforceInterface("com.google.android.gms.maps.internal.IProjectionDelegate");
LatLng fromScreenLocation = fromScreenLocation(com.google.android.gms.dynamic.zzd.zza.zzfc(parcel.readStrongBinder()));
parcel2.writeNoException();
if (fromScreenLocation != null) {
parcel2.writeInt(1);
fromScreenLocation.writeToParcel(parcel2, 1);
} else {
parcel2.writeInt(0);
}
return true;
case 2:
parcel.enforceInterface("com.google.android.gms.maps.internal.IProjectionDelegate");
zzd toScreenLocation = toScreenLocation(parcel.readInt() != 0 ? (LatLng) LatLng.CREATOR.createFromParcel(parcel) : null);
parcel2.writeNoException();
if (toScreenLocation != null) {
iBinder = toScreenLocation.asBinder();
}
parcel2.writeStrongBinder(iBinder);
return true;
case 3:
parcel.enforceInterface("com.google.android.gms.maps.internal.IProjectionDelegate");
VisibleRegion visibleRegion = getVisibleRegion();
parcel2.writeNoException();
if (visibleRegion != null) {
parcel2.writeInt(1);
visibleRegion.writeToParcel(parcel2, 1);
} else {
parcel2.writeInt(0);
}
return true;
case 1598968902:
parcel2.writeString("com.google.android.gms.maps.internal.IProjectionDelegate");
return true;
default:
return super.onTransact(i, parcel, parcel2, i2);
}
}
}
LatLng fromScreenLocation(zzd zzd) throws RemoteException;
VisibleRegion getVisibleRegion() throws RemoteException;
zzd toScreenLocation(LatLng latLng) throws RemoteException;
}
| [
"Gith1974"
] | Gith1974 |
19b4bf44e0048178a7da7fc1d3ed1b32259f8460 | 3a69e29cb0e6285e75b38682600dfdd349124f2d | /src/test/java/org/richfaces/photoalbum/test/manager/ImageManagementTest.java | b7983cc74868b911b528d956a4a0df2ad60ca430 | [] | no_license | michpetrov/richfaces-photoalbum | a777de30e8afc0e366e62a469eac2f6167970835 | 5e43ab125afc8c08a84841c95fa9687a18d0f7a7 | refs/heads/master | 2021-01-15T22:28:46.123139 | 2013-01-16T16:58:38 | 2013-01-16T16:58:38 | 5,479,180 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,496 | java | package org.richfaces.photoalbum.test.manager;
import java.util.Date;
import java.util.List;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.transaction.UserTransaction;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.photoalbum.bean.UserBean;
import org.richfaces.photoalbum.domain.Album;
import org.richfaces.photoalbum.domain.Comment;
import org.richfaces.photoalbum.domain.Image;
import org.richfaces.photoalbum.domain.MetaTag;
import org.richfaces.photoalbum.domain.User;
import org.richfaces.photoalbum.service.IImageAction;
import org.richfaces.photoalbum.service.ImageAction;
import org.richfaces.photoalbum.service.PhotoAlbumException;
import org.richfaces.photoalbum.test.PhotoAlbumTestHelper;
@RunWith(Arquillian.class)
public class ImageManagementTest {
@Deployment
public static Archive<?> createDeployment() {
return ShrinkWrap.create(WebArchive.class, "test.war").addPackage(ImageAction.class.getPackage())
.addPackage(Image.class.getPackage()).addClass(UserBean.class).addClass(PhotoAlbumTestHelper.class)
.addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") // important
.addAsWebInfResource("test-ds.xml").addAsResource("importmin.sql", "import.sql");
}
@Inject
EntityManager em;
@Inject
UserTransaction utx;
@Inject
PhotoAlbumTestHelper helper;
@Inject
IImageAction ia;
@Inject
UserBean userBean;
@Before
public void startTransaction() throws Exception {
utx.begin();
em.joinTransaction();
}
@After
public void commitTransaction() throws Exception {
utx.commit();
}
private List<Comment> getAllCommentsById(long id) {
String fetchAllComments = "select c from Comment c where image_id = :id order by c.id";
return em.createQuery(fetchAllComments, Comment.class).setParameter("id", id).getResultList();
}
@Test
public void isImageAdded() throws Exception {
int originalSize = helper.getAllImages(em).size();
Album album = em.createQuery("select a from Album a where a.id = :id", Album.class).setParameter("id", (long) 0)
.getSingleResult();
Image newImage = new Image();
newImage.setName("839245545_5db77619d5_o.jpg");
newImage.setPath("839245545_5db77619d5_o.jpg");
newImage.setDescription("Animals - 839245545_5db77619d5_o.jpg image");
newImage.setCreated(new Date());
newImage.setAlbum(album);
newImage.setCameraModel("Canon PowerShot SX110 IS");
newImage.setSize(1917);
newImage.setWidth(1024);
newImage.setHeight(768);
newImage.setAllowComments(true);
newImage.setShowMetaInfo(true);
ia.addImage(newImage);
List<Image> images = helper.getAllImages(em);
Assert.assertTrue(images.contains(newImage));
Assert.assertEquals(originalSize + 1, images.size());
}
@Test
public void isCommentAdded() throws Exception {
Image image = helper.getAllImages(em).get(0);
User user = em.createQuery("select u from User u where u.id = :id", User.class).setParameter("id", (long) 1)
.getSingleResult();
int originalSize = helper.getAllComments(em).size();
Comment comment = new Comment();
comment.setAuthor(user);
comment.setDate(new Date());
comment.setMessage("beautiful");
comment.setImage(image);
if (!image.isAllowComments()) {
image.setAllowComments(true);
}
ia.addComment(comment);
Assert.assertTrue(getAllCommentsById(image.getId()).contains(comment));
Assert.assertEquals(originalSize + 1, helper.getAllComments(em).size());
}
@Test
public void isCommentDeleted() throws Exception {
Image image = helper.getAllImages(em).get(0);
int originalSize = helper.getAllComments(em).size();
Comment comment = getAllCommentsById(image.getId()).get(0);
ia.deleteComment(comment);
Assert.assertFalse(getAllCommentsById(image.getId()).contains(comment));
Assert.assertEquals(originalSize - 1, helper.getAllComments(em).size());
}
@Test(expected = PhotoAlbumException.class)
public void isCommentNotAllowed() throws Exception {
Image image = helper.getAllImages(em).get(0);
User user = em.createQuery("select u from User u where u.id = :id", User.class).setParameter("id", (long) 1)
.getSingleResult();
image.setAllowComments(false);
int originalSize = helper.getAllComments(em).size();
Comment comment = new Comment();
comment.setAuthor(user);
comment.setDate(new Date());
comment.setMessage("beautiful");
comment.setImage(image);
ia.addComment(comment);
// the code below should not get executed
Assert.assertFalse(getAllCommentsById(image.getId()).contains(comment));
Assert.assertEquals(originalSize, helper.getAllComments(em).size());
}
@Test
public void isImageEdited() throws Exception {
Image image = helper.getAllImages(em).get(0);
String name = image.getName();
image.setName("edited image");
int originalSize = helper.getAllImages(em).size();
// due to auto-commit this command makes no difference
ia.editImage(image, false);
Image editedImage = helper.getAllImages(em).get(0);
Assert.assertEquals(image.getId(), editedImage.getId());
Assert.assertEquals("original name: " + name, "edited image", editedImage.getName());
Assert.assertEquals(originalSize, helper.getAllImages(em).size());
}
@Test
public void isImageEditedWithMetaTags() throws Exception {
Image image = helper.getAllImages(em).get(0);
List<MetaTag> tags = image.getImageTags();
MetaTag removedTag = tags.get(0);
String metaTagsByImageId = "select m from MetaTag m join m.images i where i.id = :id";
List<MetaTag> _tagsById = em.createQuery(metaTagsByImageId, MetaTag.class).setParameter("id", image.getId())
.getResultList();
Assert.assertTrue(_tagsById.contains(removedTag));
Assert.assertTrue(removedTag.getImages().contains(image));
tags.remove(0);
Assert.assertFalse(tags.contains(removedTag));
removedTag.removeImage(image);
Assert.assertFalse(removedTag.getImages().contains(image));
image.setImageTags(tags);
ia.editImage(image, true);
List<MetaTag> tagsById = em.createQuery(metaTagsByImageId, MetaTag.class).setParameter("id", image.getId())
.getResultList();
Image editedImage = helper.getAllImages(em).get(0);
String tagById = "select m from MetaTag m where id = :id";
MetaTag m = em.createQuery(tagById, MetaTag.class).setParameter("id", removedTag.getId()).getSingleResult();
Assert.assertFalse(tagsById.contains(removedTag));
Assert.assertFalse(m.getImages().contains(editedImage));
}
@Test
public void isIdenticalCountCorrect() throws Exception {
Image image = helper.getAllImages(em).get(1);
Assert.assertEquals(1, ia.getCountIdenticalImages(image.getAlbum(), image.getPath()).intValue());
Image newImage = new Image();
newImage.setName("new Image");
newImage.setPath(image.getPath());
newImage.setDescription("new description");
newImage.setCreated(new Date());
newImage.setAlbum(image.getAlbum());
newImage.setCameraModel("Canon PowerShot SX110 IS");
newImage.setSize(image.getSize());
newImage.setWidth(image.getWidth());
newImage.setHeight(image.getHeight());
newImage.setAllowComments(true);
newImage.setShowMetaInfo(true);
ia.addImage(newImage);
Assert.assertEquals(2, ia.getCountIdenticalImages(image.getAlbum(), image.getPath()).intValue());
}
@Test
public void isMetaTagFoundByName() throws Exception {
MetaTag tag = helper.getAllMetaTags(em).get(0);
Assert.assertEquals(tag, ia.getTagByName(tag.getTag()));
Assert.assertNull(ia.getTagByName("*" + tag.getTag()));
}
@Test
public void areTagsSuggested() throws Exception {
MetaTag tag = helper.getAllMetaTags(em).get(0);
String tagName = tag.getTag();
String[] parts = { tagName.substring(0, 4), tagName.substring(5) };
List<MetaTag> suggestedTags = ia.getTagsLikeString(parts[0]);
Assert.assertTrue("suggestion for '" + parts[0] + "'", suggestedTags.contains(tag));
Assert.assertEquals("suggestion for '" + parts[0] + "'", 1, suggestedTags.size());
suggestedTags = ia.getTagsLikeString(parts[1]);
Assert.assertFalse("suggestion for '" + parts[1] + "'", suggestedTags.contains(tag));
Assert.assertTrue("suggestion for '" + parts[1] + "'", suggestedTags.isEmpty());
}
@Test
public void doesImageWithSamePathExist() throws Exception {
Album album1 = helper.getAllAlbums(em).get(0);
Album album2 = helper.getAllAlbums(em).get(1);
String path = album1.getImages().get(0).getPath();
Assert.assertTrue(ia.isImageWithThisPathExist(album1, path));
Assert.assertFalse(ia.isImageWithThisPathExist(album2, path));
Assert.assertFalse(ia.isImageWithThisPathExist(album1, path + path));
Assert.assertFalse(ia.isImageWithThisPathExist(album2, path + path));
}
@Test
public void areAllUserCommentsFound() throws Exception {
User user = helper.getAllUsers(em).get(1);
List<Comment> userComments = ia.findAllUserComments(user);
Assert.assertEquals(4, userComments.size());
for (Comment c : helper.getAllComments(em)) {
if (c.getAuthor().getId() == user.getId()) {
Assert.assertTrue(userComments.contains(c));
}
}
}
} | [
"mpetrov@redhat.com"
] | mpetrov@redhat.com |
9bacaa756b25ad6fdb42b91a4fc3a3cd2f22bf6c | b13de6d76f3c6b8f0ab2786a07cc25f5badc21e0 | /jsource/ideal/development/analyzers/parameter_target.java | c959c4531d5552ebb72cfb8b14bd25a47d551892 | [
"BSD-3-Clause"
] | permissive | mishadynin/ideal | c4e554538ae6eb711af739ec043640d66f305cae | a512796201e6e26ea750e31561e4c709b55cf268 | refs/heads/master | 2021-04-15T19:55:59.143341 | 2020-05-01T22:50:56 | 2020-05-01T22:50:56 | 249,295,173 | 0 | 0 | BSD-3-Clause | 2020-03-22T23:54:04 | 2020-03-22T23:54:04 | null | UTF-8 | Java | false | false | 1,737 | java | /*
* Copyright 2014-2020 The Ideal Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file or at
* https://developers.google.com/open-source/licenses/bsd
*/
package ideal.development.analyzers;
import ideal.library.elements.*;
import ideal.runtime.elements.*;
import ideal.development.elements.*;
import ideal.development.types.*;
import ideal.development.flavors.*;
import ideal.development.actions.*;
public class parameter_target extends debuggable implements action_target {
public final action_parameters parameters;
private final analysis_context the_context;
private type procedure_type;
public parameter_target(action_parameters parameters, analysis_context the_context) {
this.parameters = parameters;
this.the_context = the_context;
}
public int arity() {
return parameters.arity();
}
public type to_procedure_type() {
if (procedure_type == null) {
common_library library = common_library.get_instance();
list<abstract_value> parameter_list = new base_list<abstract_value>();
parameter_list.append(library.entity_type());
parameter_list.append_all(parameters.to_value_list());
procedure_type = library.procedure_type().bind_parameters(
new type_parameters(parameter_list)).get_flavored(flavors.DEFAULT_FLAVOR);
}
return procedure_type;
}
@Override
public boolean matches(abstract_value the_abstract_value) {
return analyzer_utilities.is_parametrizable(the_abstract_value, parameters.to_type_parameters(),
the_context);
}
@Override
public string to_string() {
return utilities.describe(this, parameters.to_value_string());
}
}
| [
"dynin@google.com"
] | dynin@google.com |
d3e377cc2a53481c26ca62a8c40f7edfdfc4563f | dc723ba04d723b077a723bebb02813b8009f6e9e | /system/test/support/fake-old-platform/src/main/java/com/ssrn/fake_old_platform/StageOneClassificationSearchPageView.java | 4b4d6ae3c6cfc8f66187c34b5bf76fff17858831 | [] | no_license | ngelsevier/preprint | e33247cb589d3de505f219d0242a3738d5455648 | 0a6a57bc962c29e277f105070977867280381d85 | refs/heads/master | 2020-03-20T23:42:53.825949 | 2018-06-19T08:06:36 | 2018-06-19T08:06:36 | 137,859,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package com.ssrn.fake_old_platform;
import io.dropwizard.views.View;
public class StageOneClassificationSearchPageView extends View{
private final String abstractId;
protected StageOneClassificationSearchPageView(String abstractId) {
super("stage-one-classification-search-page.mustache");
this.abstractId = abstractId;
}
public String getAbstractId() {
return abstractId;
}
}
| [
"r.ng@elsevier.com"
] | r.ng@elsevier.com |
75fc0723012982064b3f3a64299559eb1a565bf4 | 32b72e1dc8b6ee1be2e80bb70a03a021c83db550 | /ast_results/jonasoreland_runnerup_/app/src/org/runnerup/tracker/filter/PersistentGpsLoggerListener.java | 51b0d35ce869dd581f27d42a96661d60ebdd63ef | [] | no_license | cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | d90c41a17e88fcd99d543124eeb6e93f9133cb4a | 0564143d92f8024ff5fa6b659c2baebf827582b1 | refs/heads/master | 2020-07-13T13:53:40.297493 | 2019-01-11T11:51:18 | 2019-01-11T11:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,632 | java | // isComment
package org.runnerup.tracker.filter;
import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.location.Location;
import org.runnerup.common.util.Constants;
import org.runnerup.tracker.LocationListenerBase;
public class isClassOrIsInterface extends LocationListenerBase implements Constants {
private final java.lang.Object isVariable;
private SQLiteDatabase isVariable;
private java.lang.String isVariable;
private ContentValues isVariable;
private final boolean isVariable;
public isConstructor(SQLiteDatabase isParameter, String isParameter, ContentValues isParameter, boolean isParameter) {
this.isFieldAccessExpr = new java.lang.Object();
this.isFieldAccessExpr = isNameExpr;
this.isFieldAccessExpr = isNameExpr;
this.isFieldAccessExpr = isNameExpr;
isMethod(isNameExpr);
}
public SQLiteDatabase isMethod() {
return isNameExpr;
}
public void isMethod(SQLiteDatabase isParameter) {
isNameExpr = isNameExpr;
}
public String isMethod() {
return isNameExpr;
}
public void isMethod(String isParameter) {
isNameExpr = isNameExpr;
}
public ContentValues isMethod() {
synchronized (isNameExpr) {
if (isNameExpr == null)
return null;
return new ContentValues(isNameExpr);
}
}
public void isMethod(ContentValues isParameter) {
synchronized (isNameExpr) {
if (isNameExpr == null)
isNameExpr = null;
else
isNameExpr = new ContentValues(isNameExpr);
}
}
public void isMethod(Location isParameter, Double isParameter, Long isParameter, Double isParameter, Integer isParameter, Float isParameter, Float isParameter, Float isParameter) {
ContentValues isVariable;
synchronized (isNameExpr) {
if (isNameExpr == null)
isNameExpr = new ContentValues();
else
isNameExpr = new ContentValues(isNameExpr);
}
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr.isMethod());
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr.isMethod());
if (isNameExpr != null) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr);
}
// isComment
if (isNameExpr.isMethod()) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr.isMethod());
}
if (this.isFieldAccessExpr) {
// isComment
if (isNameExpr.isMethod()) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr.isMethod());
}
if (isNameExpr.isMethod()) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr.isMethod());
}
if (isNameExpr.isMethod()) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr.isMethod());
}
// isComment
if (isNameExpr.isMethod() != null) {
int isVariable = isNameExpr.isMethod().isMethod("isStringConstant", -isIntegerConstant);
if (isNameExpr >= isIntegerConstant) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr);
}
}
// isComment
if (isNameExpr != null) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr);
}
}
if (isNameExpr != null) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr);
}
if (isNameExpr != null) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr);
}
if (isNameExpr != null) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr);
}
if (isNameExpr != null) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr);
}
if (isNameExpr != null) {
isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr);
}
if (isNameExpr != null) {
isNameExpr.isMethod(isNameExpr, null, isNameExpr);
}
}
}
| [
"matheus@melsolucoes.net"
] | matheus@melsolucoes.net |
866d34092d692b81fb2822241438f774df0b8405 | 66bf516fea291aa7da785c90145c73b08b938b4f | /BotaPelota/Lienzo.java | b1661bf82ed3223694d702fcd02093b5d2729f7e | [] | no_license | zazilibarra/Herencia-y-Polimorfismo | ab8f01fd34aa42981042c62913ad0c37ecd347fc | 2220f33343fb4e0c9428ee40517f93b846aaf4ee | refs/heads/master | 2020-05-28T06:51:11.597359 | 2017-03-13T18:09:58 | 2017-03-13T18:09:58 | 82,584,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,334 | java | import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.LinkedList;
import java.awt.Rectangle;
public class Lienzo extends JPanel //implements KeyListener
{
private LinkedList<Pelota> pelotas;
public Lienzo()
{
pelotas = new LinkedList<Pelota>();
pelotas.add(new Pelota(100, 100, 15));
EscuchadorMouse escuchadorMouse = new EscuchadorMouse();
this.addMouseListener(escuchadorMouse);
//this.addKeyListener(this);
}
public void actua()
{
Rectangle r = this.getBounds();
for(Pelota p: pelotas)
{
p.muevete(r);
}
this.repaint();
}
@Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
for(Pelota p: pelotas)
{
p.dibuja(g);
}
}
class EscuchadorMouse extends MouseAdapter
{
@Override
public void mouseClicked(MouseEvent e)
{
int tamRandom = 10 + (int)(Math.random() * 20);
Pelota pelotaNueva = new Pelota(e.getX(), e.getY(), tamRandom);
pelotas.add(pelotaNueva);
}
}
}
| [
"zaziil.97@gmail.com"
] | zaziil.97@gmail.com |
176a9c1f7e8855b055ed4e63597212bd42689455 | ef1ed434451c911de2ae92eef4dc9a2c8728717c | /App/wear/src/main/java/com/cs160/lily/prog02/PoliticanFragment.java | cbb9bb6dd9e94b9115a340cbc6cf2f4889112561 | [] | no_license | cs160-berkeley/prog-02-represent-nguyensomniac | da157e4b91ffd3f2b76822170046061874d85d19 | c25ae959c7de68ffd6a6a81ec4209317493f360b | refs/heads/master | 2020-12-24T19:28:45.341720 | 2016-03-13T08:27:35 | 2016-03-13T08:27:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,254 | java | package com.cs160.lily.prog02;
import android.app.Fragment;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.lily.proj02_shared.Politician;
import com.example.lily.proj02_shared.ImageDownloader;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
/**
* Created by lily on 3/3/16.
*/
public class PoliticanFragment extends Fragment {
private Politician p;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Bundle bundle = getArguments();
p = (Politician)bundle.getSerializable("politician");
byte[] d = (byte[])bundle.getByteArray("image");
View pView = inflater.inflate(R.layout.politician_view, container, false);
LinearLayout politicianImage = (LinearLayout)pView.findViewById(R.id.politician_image);
politicianImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent switchIntent = new Intent(getActivity().getBaseContext(), WatchToPhoneService.class);
ObjectOutputStream oStream;
try {
ByteArrayOutputStream boStream = new ByteArrayOutputStream();
oStream = new ObjectOutputStream(boStream);
oStream.writeObject(p);
oStream.flush();
switchIntent.putExtra("path", "/REPRESENTATIVE");
switchIntent.putExtra("data", Base64.encodeToString(boStream.toByteArray(), Base64.DEFAULT));
getActivity().getBaseContext().startService(switchIntent);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
});
int partyColor = getResources().getIdentifier(
p.getParty().toString(), "color", getActivity().getApplicationContext().getPackageName());
TextView politicianName = (TextView)pView.findViewById(R.id.politician_name);
GradientDrawable partyIcon =
(GradientDrawable)pView.findViewById(R.id.politician_party_symbol).getBackground();
TextView politicianParty =
(TextView)pView.findViewById(R.id.politician_party);
politicianImage.setBackground(new BitmapDrawable(
getActivity().getResources(), BitmapFactory.decodeByteArray(d, 0, d.length)));
politicianName.setText(p.getName());
politicianParty.setText(p.getAffiliation());
politicianParty.setTextColor(ContextCompat.getColor(getActivity().getApplicationContext(), partyColor));
partyIcon.setColor(ContextCompat.getColor(getActivity().getApplicationContext(), partyColor));
return pView;
}
}
| [
"lanchi.v.nguyen@gmail.com"
] | lanchi.v.nguyen@gmail.com |
edc8d66bae53c39abe014e5ca865cf4f6402769f | dcb63282a51f8d265f12e7d30be7139f7d600d90 | /src/BowlingGame.java | edc6580e1ea56f93864d4bcd6bcbeb089bd285e6 | [] | no_license | YukiOnnaSenpai/NoviSad_ExerciseF1 | 7eeeda3a6e3c9ae2e8ef70aaa7a9c3438a37ecdb | 9eb2ccb0699fe19d78605460c1b8ec65ab14a9ab | refs/heads/master | 2021-06-17T09:47:43.196595 | 2017-05-12T11:03:46 | 2017-05-12T11:03:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,675 | java | import java.util.ArrayList;
import java.util.List;
// Before you commit and push write your student ID and finish time here.
// Finish time: 12:49
// Student ID: IT40/2015
public class BowlingGame {
//a bowling game is made of (at least) 10 frames
private List<Frame> frames = new ArrayList<Frame>();
private Frame bonus;
private int result;
public BowlingGame(){}
// adds a frame to the game
public void addFrame(Frame frame){
//to be implemented
frames.add(frame);
}
// Sets the bonus throws at the end of the game
public void setBonus(int firstThrow, int secondThrow) throws BowlingException {
//to be implemented
for(int i = 0; i < frames.size(); i++){
if(frames.get(i).isSpare() == true){
throw new BowlingException();
}
else if(frames.get(i).isStrike() == true){
throw new BowlingException();
}else{
}
}
}
public int bonuses(){
int bonus;
for(int i =0; i < frames.size(); i++){
if(frames.get(i).isSpare() == true){
bonus= frames.get(i+1).getFirstThrow();
return bonus;
}
else if(frames.get(i).isStrike() == true){
bonus = frames.get(i+1).getFirstThrow() + frames.get(i+1).getSecondThrow() +
frames.get(i+2).getFirstThrow() + frames.get(i+2).getSecondThrow();
return bonus;
}
}
return 0;
}
// Returns the game score
public int score(){
//to be implemented: should return game score
for(int i =0; i < frames.size(); i++){
if(frames.get(i).isSpare() == true || frames.get(i).isStrike() == true){
return result += frames.get(i).score() + bonuses();
}
else{
return result += frames.get(i).score();
}
}
return 0;
}
}
| [
"ITC3@ws1.itc03.edu"
] | ITC3@ws1.itc03.edu |
d89364cb77ed51631d12d06ce626ae857b75c008 | 8539e8f1e150124e1a1875213bea2a3509a7502c | /Java/week_4/day_18/Task21_final/Task21/src/main/java/no/noroff/Task21/Task21Application.java | 39df55792b00d30938ddc96f7363b95c18c8d0c1 | [] | no_license | zackkyyy/ExperisAcademy | 31abcc2d4e63ba9598bd8e4f86717938f06bbb14 | a6957e421d42fec9273253d65d6d70e9b8869f3c | refs/heads/master | 2020-08-01T22:51:16.176844 | 2019-03-07T12:37:55 | 2019-03-07T12:37:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 651 | java | package no.noroff.Task21;
import no.noroff.Task21.database.DBHandler;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan
@SpringBootApplication
public class Task21Application {
public static void main(String[] args) {
DBHandler db = new DBHandler();
db.addTests();
SpringApplication.run(Task21Application.class, args);
}
}
| [
"leedevelopement@gmail.com"
] | leedevelopement@gmail.com |
f049f0738f8fd152c22e765cff456b51430cecdb | 92d50e271a78868cb92864bcd314a1c9d80b3f22 | /declarative/persistence/src/main/java/com/blazebit/expression/declarative/persistence/package-info.java | 1bf349337028478175581f2b72900a4634f1e05d | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | joehelm/blaze-expression | 60473eaafe97177059c1531d6fde254aaa1992f6 | 0c5c7dd665cc6ee0eb362aad7bacbe9672de8330 | refs/heads/master | 2022-12-10T00:17:03.600338 | 2020-09-01T15:28:34 | 2020-09-01T15:28:34 | 291,687,438 | 0 | 0 | null | 2020-08-31T10:41:36 | 2020-08-31T10:41:36 | null | UTF-8 | Java | false | false | 748 | java | /*
* Copyright 2019 - 2020 Blazebit.
*
* 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.
*/
/**
* Blaze-Expression Persistence related declarative metadata for domain models.
*/
package com.blazebit.expression.declarative.persistence;
| [
"christian.beikov@gmail.com"
] | christian.beikov@gmail.com |
6d350fdd06af02e53bb22586c65dce3c64d4e334 | e013ec787e57af5c8c798f5714d9f930b76dfd32 | /Solutions/UVA Solutions/10655 - Contemplation! Algebra.java | 0219b27bdcfb25c17e5834208d88c5a01d6717e5 | [] | no_license | omaryasser/Competitive-Programming | da66cb75bf6ed5495454d2f57333b02fe30a5b68 | ba71b23ae3d0c4ef8bbdeff0cd12c3daca19d809 | refs/heads/master | 2021-04-29T00:39:29.663196 | 2019-02-19T04:20:56 | 2019-02-19T04:20:56 | 121,832,844 | 17 | 8 | null | null | null | null | UTF-8 | Java | false | false | 4,887 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
StringBuilder sb = new StringBuilder();
while (true) {
StringTokenizer st = new StringTokenizer(sc.nextLine());
if (st.countTokens() < 3) break;
long p = Integer.parseInt(st.nextToken()) , q = Integer.parseInt(st.nextToken()) , n = Integer.parseInt(st.nextToken());
if (n == 0) sb.append(2 + "\n");
else if (n == 1) sb.append(p + "\n");
else {
long mat [][] = {{2 , p} , {1 , 1}};
long transform [][] = {{0 , - q} , {1 , p}};
sb.append(multiply(mat, matPow(transform, n - 1))[0][1] + "\n");
}
}
out.print(sb);
out.flush();
out.close();
}
static long[][] zero(int n, int m) {
return new long[n][m];
}
static long[][] identity(int n) { // Always square matrix
long[][] x = zero(n, n);
for (int i = 0; i < x.length; i++)
x[i][i]++;
return x;
}
static long matrixTrace(long[][] a) { // sumOfDigonal Values
long ret = 0;
for (int i = 0; i < a.length; i++)
ret += a[i][i];
return ret;
}
static long[][] rotate(long[][] v) { // rotate clockwise
long[][] r = zero(v[0].length, v.length);
for (int i = 0; i < r.length; i++) {
for (int j = 0; j < r.length; j++) {
r[j][v.length - 1 - i] = v[i][j];
}
}
return r;
}
static long[][] transpose(long[][] v) { // rotate clockwise
long[][] r = zero(v[0].length, v.length);
for (int i = 0; i < r.length; i++) {
for (int j = 0; j < r.length; j++) {
r[j][i] = v[i][j];
}
}
return r;
}
static long[][] reflect(long[][] v) { // Reflect Horizontally
long[][] r = zero(v.length, v[0].length);
for (int i = 0; i < r.length; i++) {
for (int k = 0; k < r[i].length; k++) {
r[i][v[0].length - 1 - k] = v[i][k];
}
}
return r;
}
static long[][] add(long[][] a, long[][] b) {
long[][] ret = zero(a.length, a[0].length);
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[i].length; j++) {
ret[i][j] = a[i][j] + b[i][j];
}
}
return ret;
}
static long[][] addIdentity(long[][] a) {
for (int i = 0; i < a.length; i++) {
a[i][i]++;
}
return a;
}
static long[][] multiply(long[][] a, long[][] b) {
long[][] ret = zero(a.length, b[0].length);
// Optimizations here not to enter the last loop of a[i][k] = 0
// Also we can swtich last two loops if b[k][j] has more zeros
// for MOD optimization we use the following
for (int i = 0; i < a.length; ++i) {
for (int k = 0; k < a[0].length; ++k) {
for (int j = 0; j < b[0].length; ++j) {
ret[i][j] += a[i][k] * b[k][j];
}
}
}
return ret;
}
static long[][] matPow(long[][] a, long k) { // N^3 LOG
if (k == 0)
return identity(a.length);
if (k % 2 == 1) {
return multiply(a, matPow(a, k - 1));
}
return matPow(multiply(a, a), k >> 1);
}
static long[][] sumPows(long[][] a, long k) { // Log
if (k == 0) {
return zero(a.length, a.length);
}
if (k % 2 == 1) {
return multiply(a, addIdentity(sumPows(a, k - 1)));
}
return multiply(sumPows(a, k >> 1L), addIdentity(matPow(a, k >> 1L)));
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s) {
br = new BufferedReader(new InputStreamReader(s));
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public String nextLine() throws IOException {
return br.readLine();
}
public double nextDouble() throws IOException {
String x = next();
StringBuilder sb = new StringBuilder("0");
double res = 0, f = 1;
boolean dec = false, neg = false;
int start = 0;
if (x.charAt(0) == '-') {
neg = true;
start++;
}
for (int i = start; i < x.length(); i++)
if (x.charAt(i) == '.') {
res = Long.parseLong(sb.toString());
sb = new StringBuilder("0");
dec = true;
} else {
sb.append(x.charAt(i));
if (dec)
f *= 10;
}
res += Long.parseLong(sb.toString()) / f;
return res * (neg ? -1 : 1);
}
public boolean ready() throws IOException {
return br.ready();
}
public boolean nextEmpty() throws IOException {
String s = nextLine();
st = new StringTokenizer(s);
return s.isEmpty();
}
}
}
| [
"oyaraouf@gmail.com"
] | oyaraouf@gmail.com |
01288bcc4d0529c3983217ca9e972a89d142b1b0 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/transform/DocumentRequiresJsonUnmarshaller.java | 0d571d3a8f0618ada14c70415e64bff484557705 | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 3,499 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.simplesystemsmanagement.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.simplesystemsmanagement.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* DocumentRequires JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DocumentRequiresJsonUnmarshaller implements Unmarshaller<DocumentRequires, JsonUnmarshallerContext> {
public DocumentRequires unmarshall(JsonUnmarshallerContext context) throws Exception {
DocumentRequires documentRequires = new DocumentRequires();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("Name", targetDepth)) {
context.nextToken();
documentRequires.setName(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("Version", targetDepth)) {
context.nextToken();
documentRequires.setVersion(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("RequireType", targetDepth)) {
context.nextToken();
documentRequires.setRequireType(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("VersionName", targetDepth)) {
context.nextToken();
documentRequires.setVersionName(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return documentRequires;
}
private static DocumentRequiresJsonUnmarshaller instance;
public static DocumentRequiresJsonUnmarshaller getInstance() {
if (instance == null)
instance = new DocumentRequiresJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
60b4570ae180feb4ab8996f7acea3e3f094eb0de | e69f35e28bf97fdeccf73dceb183890f73d1a761 | /src/academy/learningprogram/learningprogram.java | a522cf3332dadd23db0e148c1d925180bd6e92ee | [] | no_license | saritachetak/JavaIdentifierExample | e439b01679a917381718cbb49860e0d60236f46a | 47632b5694b61240eb9c1ba54cb982b12a000169 | refs/heads/master | 2020-07-05T21:56:02.746407 | 2019-08-16T20:13:57 | 2019-08-16T20:13:57 | 202,792,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 56 | java | package academy.learningprogram;
public class {
}
| [
"sarita.chetak@gmail.com"
] | sarita.chetak@gmail.com |
8d0f92602ae597336b7c8d4ea1cbfccc13b34570 | b17133cd61c9175373d50f424d9d85f11e7453f9 | /src/java/alg/a_3_2_class/Spiral.java | f607f49e72869cf22f996280bda49c402f9381fc | [] | no_license | Scandinavian0/algorithms | b2be925c14fd1f34dbddbae48ba1841182a9b80e | a8f0ecc2cfacdeab866d1a3df57db3da94d2358c | refs/heads/master | 2023-07-08T06:50:18.462492 | 2021-08-07T10:23:20 | 2021-08-07T10:23:20 | 393,650,399 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,035 | java | package alg.a_3_2_class;
/******************************************************************************
* Compilation: javac Spiral.java
* Execution: java Spiral
* Dependencies: Turtle.java
*
* Plots a logarithmic spiral.
*
* % java Spiral 3 1.0 // equilateral triangle
*
* % java Spiral 3 1.2
*
* % java Spiral 1440 1.00004
*
* % java Spiral 1440 1.0004 // logarithmic spiral
*
******************************************************************************/
public class Spiral {
public static void main(String[] args) {
int n = Integer.parseInt(args[0]); // # sides if decay = 1.0
double decay = Double.parseDouble(args[1]); // decay factor
double angle = 360.0 / n;
double step = Math.sin(Math.toRadians(angle/2.0));
Turtle turtle = new Turtle(0.5, 0.0, angle/2.0);
for (int i = 0; i < 10*n; i++) {
step /= decay;
turtle.goForward(step);
turtle.turnLeft(angle);
}
}
}
| [
"948719668@qq.com"
] | 948719668@qq.com |
156a192384852c71835eeb3933177f1142c67e66 | 1402696c1aff34fd159ec28b019755a32e200273 | /examenHilos-AdrianMena/src/ejer3/Caja.java | 4f3d079a288160e3d33272f79709ce347392cd35 | [] | no_license | DonMed00/Hilos | 15cbcc67c873094fd528b0fc3359a6ab1f126d8a | 325539b71a073a3d22076fbef8dfb40da0be26c5 | refs/heads/master | 2020-08-07T12:41:24.757507 | 2020-02-20T12:50:45 | 2020-02-20T12:50:45 | 213,455,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 906 | java | package ejer3;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
public class Caja {
int number;
boolean taken;
private final ReentrantLock lock = new ReentrantLock(true);
private final Condition condition = lock.newCondition();
private final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
public Caja(int number) {
this.number = number;
this.taken = false;
}
void take() throws InterruptedException {
lock.lock();
while (taken) {
condition.await();
}
taken = true;
lock.unlock();
}
void drop() throws InterruptedException {
lock.lock();
taken = false;
condition.signal();
lock.unlock();
}
}
| [
"xmena97@gmail.com"
] | xmena97@gmail.com |
f36c27aa5ea44fb054a4d1ba8b7f459d0cd9d462 | ace7826bb931d174d25b5d38199f21a6cc3056b7 | /src/main/java/com/ccs/thread/Volatile_synchronized.java | b0487194dc7500bea7262f16332a15ac9d6d12a0 | [] | no_license | suhank/ThreadDemo | 41e5f97e0edcd457b261740231cdc98749ff535b | 3270b264dbb9f31827e0c1809e684aed1809b7d1 | refs/heads/master | 2022-12-20T08:51:27.812745 | 2020-10-14T07:00:16 | 2020-10-14T07:00:16 | 262,680,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java | package com.ccs.thread;
public class Volatile_synchronized implements Runnable {
private volatile int count = 100;
public /*synchronized*/ void run() {
count--;
System.out.println(Thread.currentThread().getName() + " count = " + count);
}
public static void main(String[] args) {
Volatile_synchronized t = new Volatile_synchronized();
for(int i=0; i<100; i++) {
new Thread(t, "THREAD" + i).start();
}
}
}
| [
"sujiansheng@ccssoft.com.cn"
] | sujiansheng@ccssoft.com.cn |
f12d99a3169f610d1c186b3645ff63ffcb5e67d8 | 963599f6f1f376ba94cbb504e8b324bcce5de7a3 | /sources/okhttp3/Dns.java | e5897e2f6ebbb37db842cc5531e0fb8a5bac6492 | [] | no_license | NikiHard/cuddly-pancake | 563718cb73fdc4b7b12c6233d9bf44f381dd6759 | 3a5aa80d25d12da08fd621dc3a15fbd536d0b3d4 | refs/heads/main | 2023-04-09T06:58:04.403056 | 2021-04-20T00:45:08 | 2021-04-20T00:45:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,778 | java | package okhttp3;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import kotlin.Metadata;
@Metadata(mo51341bv = {1, 0, 3}, mo51342d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\bf\u0018\u0000 \u00072\u00020\u0001:\u0001\u0007J\u0016\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u00032\u0006\u0010\u0005\u001a\u00020\u0006H&\u0002\u0007\n\u0005\bF0\u0001¨\u0006\b"}, mo51343d2 = {"Lokhttp3/Dns;", "", "lookup", "", "Ljava/net/InetAddress;", "hostname", "", "Companion", "okhttp"}, mo51344k = 1, mo51345mv = {1, 1, 15})
/* compiled from: Dns.kt */
public interface Dns {
public static final Companion Companion = new Companion((DefaultConstructorMarker) null);
public static final Dns SYSTEM = new Dns$Companion$SYSTEM$1();
List<InetAddress> lookup(String str) throws UnknownHostException;
@Metadata(mo51341bv = {1, 0, 3}, mo51342d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0016\u0010\u0003\u001a\u00020\u00048\u0006X\u0004ø\u0001\u0000¢\u0006\u0002\n\u0000¨\u0006\u0001\u0002\u0007\n\u0005\bF0\u0001¨\u0006\u0005"}, mo51343d2 = {"Lokhttp3/Dns$Companion;", "", "()V", "SYSTEM", "Lokhttp3/Dns;", "okhttp"}, mo51344k = 1, mo51345mv = {1, 1, 15})
/* compiled from: Dns.kt */
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = null;
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
}
| [
"a.amirovv@mail.ru"
] | a.amirovv@mail.ru |
d3aaea2d054c325882965f496d7371eebbcc9e3d | df3383615e14b6eef7346029aa090c75e6f37fb9 | /src/src/org/study/Grxx/Gerenxinxi.java | 83c8323f1c02f975c6f56e92c35d9bfa2bfa2a66 | [] | no_license | sign-s/Sign | 1d8f62df2bbb34d464d11196aa9cd7963ea36b30 | 2a4f37ebbee460646ff4ca292d562c12bbb1edba | refs/heads/master | 2020-05-07T22:05:19.187379 | 2019-05-22T13:14:58 | 2019-05-22T13:14:58 | 180,931,429 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,693 | java | package org.study.Grxx;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jdbc.DbManager;
public class Gerenxinxi extends HttpServlet{
private static final long serialVersionUID = 1L;
public void doPost(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
//防止乱码//Post
req.setCharacterEncoding("utf-8");
//传值
String radio=req.getParameter("radio");
String searchMess=req.getParameter("searchMess");
//Gerencx.jsp传一个姓名吧
String name=req.getParameter("name");
//那我还要传一个专业名称
String zhuanye=req.getParameter("zhuanye");
//那我还要传一个寝室号
String sushehao=req.getParameter("sushehao");
StringBuffer sql = new StringBuffer("SELECT * FROM student");
//判断
if(radio!=null && !radio.isEmpty()) {
if (radio.equals("cosmetic_regNo"))
{
sql.append(" WHERE regNo='" +searchMess+ "'");
}
}
//这里再加一个判断吧
if(radio!=null && !radio.isEmpty()) {
if(radio.equals("cosmetic_name"))
{
sql.append(" WHERE name='" +name+ "'");
}
}
//那不行我还要加一个专业名称
if(radio!=null && !radio.isEmpty()) {
if(radio.equals("cosmetic_className"))
{
sql.append(" WHERE className='" +zhuanye+ "'");
}
}
//我就最后加一个宿舍号
if(radio!=null && !radio.isEmpty()) {
if(radio.equals("cosmetic_DormNumber"))
{
sql.append(" WHERE DormNumber='" +sushehao+ "'");
}
}
//到这里就关闭了
sql.append(";");//关闭
try {//查询
Statement stat = DbManager.connection.createStatement();
ResultSet results = stat.executeQuery(sql.toString());
StringBuffer data = new StringBuffer("{\"cosmetic\":[");
while (results.next()) {
data.append("{\"id\":\"" + results.getString(1)+ "\",\"regNo\":\"" + results.getString(2) + "\",\"name\":\"" + results.getString(3) + "\",\"className\":\"" + results.getString(4) + "\",\"DormNumber\":\"" + results.getInt(5) + "\",\"img\":\"" + results.getString(6) + "\"},");
}
if (data.charAt(data.length() - 1) == ',') {
data.deleteCharAt(data.length() - 1);
}
data.append("]}");
System.out.println(data);
req.setAttribute("data", data);
req.getRequestDispatcher("Gerencx.jsp").forward(req, resp);
}
catch (SQLException e) {
e.printStackTrace();
}
}
} | [
"21117202@qq.com"
] | 21117202@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.