blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 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 689M ⌀ | 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 131 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 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
21d06fb728b4521fb448d21ecaf6eb5f07b4489b | 904d748e0c6d8661517ee53ff4e0d8ec4855e382 | /app/src/main/java/com/vswa/ui/settings/SettingsFragment.java | f8e794fbcd9afa1d9659064bb14cfd9950f03e04 | [] | no_license | MikZ1369/VSWA | f941b9fcf5376771946b68d783f704f6084ea567 | 0c5e047b8ac755fbcfdb33ca7a1a0e04760d8645 | refs/heads/master | 2023-03-29T17:25:09.161673 | 2021-03-06T17:16:17 | 2021-03-06T17:16:17 | 289,244,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,944 | java | package com.vswa.ui.settings;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Fragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.vswa.R;
import com.vswa.ui.main.MainActivity;
public class SettingsFragment extends Fragment {
private SettingsProvider provider;
private TextView currentThemeNameTextView;
private LinearLayout setThemeLinearLayout;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_settings, container, false);
currentThemeNameTextView = view.findViewById(R.id.fragment_set_current_theme_name);
setThemeLinearLayout = view.findViewById(R.id.fragment_set_LL_theme);
provider = new SettingsProvider(getActivity(), (MainActivity) getActivity(), this);
provider.onBindView();
setThemeLinearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
provider.openSetThemeFrame();
}
});
return view;
}
public void setCurrentThemeName(String name) {
currentThemeNameTextView.setText(name);
}
public void createThemeSetAlertDialog(int checkedItem) {
new AlertDialog.Builder(getContext(), R.style.LightAlertDialog).setSingleChoiceItems(R.array.themes_name,
checkedItem, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
provider.setThemeKey(i);
dialogInterface.dismiss();
provider.restartActivity();
}
}).show();
}
}
| [
"kreker209mr@yandex.ru"
] | kreker209mr@yandex.ru |
f35acce12142e6a99a4acdd8c04d825e7a7f464c | 8a22690873a0a449a855d25f1c6c0fc70a5e4bb2 | /app/src/main/java/com/xiandao/android/ui/activity/RepairsDetailActivity.java | 30dcbad57313e00f7bb280b7165c226dab21527f | [] | no_license | cfsc-android/CFL-Old | a595b6efeaf61e9f413cfd99985eb3a63427f4dc | bf24fbc996089d38cb6c09d584aa5d0fd9bd83a5 | refs/heads/master | 2022-04-15T23:56:54.473896 | 2020-03-31T04:40:44 | 2020-03-31T04:40:44 | 245,079,056 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,875 | java | package com.xiandao.android.ui.activity;
import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Spannable;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.andview.refreshview.utils.LogUtils;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.xiandao.android.R;
import com.xiandao.android.entity.eventbus.EventBusMessage;
import com.xiandao.android.entity.smart.BaseEntity;
import com.xiandao.android.entity.smart.OrderDetailsEntity;
import com.xiandao.android.entity.smart.ResourceEntity;
import com.xiandao.android.entity.smart.WorkflowProcessesEntity;
import com.xiandao.android.entity.smart.WorkflowType;
import com.xiandao.android.http.JsonParse;
import com.xiandao.android.http.MyCallBack;
import com.xiandao.android.http.XUtils;
import com.xiandao.android.ui.BaseActivity;
import com.xiandao.android.ui.fragment.WorkflowActionFragment;
import com.xiandao.android.utils.FileManagement;
import com.xiandao.android.utils.FilePathUtil;
import com.xiandao.android.view.NoUnderlineSpan;
import com.xiandao.android.view.imagepreview.ImagePreviewListAdapter;
import com.xiandao.android.view.imagepreview.ImageViewInfo;
import com.xiandao.android.view.imagepreview.PreviewBuilder;
import com.zhihu.matisse.Matisse;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.xutils.common.util.LogUtil;
import org.xutils.event.annotation.ContentView;
import org.xutils.event.annotation.Event;
import org.xutils.event.annotation.ViewInject;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import androidx.annotation.Nullable;
import top.zibin.luban.CompressionPredicate;
import top.zibin.luban.Luban;
import top.zibin.luban.OnCompressListener;
import static com.xiandao.android.base.Config.BASE_URL;
import static com.xiandao.android.base.Config.FILE;
import static com.xiandao.android.base.Config.PHOTO_DIR_NAME;
import static com.xiandao.android.base.Config.SD_APP_DIR_NAME;
import static com.xiandao.android.base.Config.WORKORDER;
/**
* 此类描述的是:我的报修详情activity
*
* @author TanYong
* create at 2017/5/9 16:50
*/
@ContentView(R.layout.activity_repairs_detail_layout)
public class RepairsDetailActivity extends BaseActivity {
@ViewInject(R.id.toolbar_tv_title)
TextView toolbar_title;
@ViewInject(R.id.toolbar_tv_action)
TextView toolbar_tv_action;
@ViewInject(R.id.toolbar_btn_action)
ImageButton toolbar_btn_action;
@ViewInject(R.id.order_detail_user_avatar)
private ImageView order_detail_user_avatar;
@ViewInject(R.id.order_detail_user_name)
private TextView order_detail_user_name;
@ViewInject(R.id.order_detail_user_room)
private TextView order_detail_user_room;
@ViewInject(R.id.order_detail_order_type)
private TextView order_detail_order_type;
@ViewInject(R.id.order_detail_address)
private TextView order_detail_address;
@ViewInject(R.id.order_detail_contact)
private TextView order_detail_contact;
@ViewInject(R.id.order_detail_contact_tel)
private TextView order_detail_contact_tel;
@ViewInject(R.id.order_detail_remark_text)
private TextView order_detail_remark_text;
@ViewInject(R.id.order_detail_remark_time)
private TextView order_detail_remark_time;
@ViewInject(R.id.order_detail_workflow_ll)
private LinearLayout order_detail_workflow_ll;
@ViewInject(R.id.order_detail__srl)
private SmartRefreshLayout order_detail__srl;
private String orderId;
private List<WorkflowProcessesEntity> data=new ArrayList<>();
private NoUnderlineSpan mNoUnderlineSpan;
private FragmentManager fragmentManager;
private WorkflowActionFragment workflowActionFragment;
public static final int REQUEST_CODE_CHOOSE=0x001;
public String resourceKey;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
toolbar_title.setText("工单详情");
toolbar_btn_action.setVisibility(View.GONE);
toolbar_tv_action.setText("进度");
toolbar_tv_action.setVisibility(View.VISIBLE);
fragmentManager=getSupportFragmentManager();
orderId=getIntent().getExtras().getString("order_id");
getData();
mNoUnderlineSpan = new NoUnderlineSpan();
EventBus.getDefault().register(this);
order_detail__srl.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshLayout) {
getData();
}
});
}
@Event({R.id.toolbar_btn_back,R.id.toolbar_tv_action})
private void onClickEvent(View v){
switch (v.getId()){
case R.id.toolbar_btn_back:
finish();
break;
case R.id.toolbar_tv_action:
Bundle bundle=new Bundle();
bundle.putSerializable("workflowProcessesList", (Serializable) data);
openActivity(WorkflowStepActivity.class,bundle);
break;
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void Event(EventBusMessage message){
if("WorkflowActionRefresh".equals(message.getMessage())){
getData();
}
}
@Override
protected void onDestroy() {
EventBus.getDefault().unregister(this);
super.onDestroy();
}
private void getData(){
startProgressDialog("");
Map<String,String> map=new HashMap<>();
map.put("type", WorkflowType.Order.getType());
XUtils.Get(BASE_URL+WORKORDER+"/workflow/api/detail/"+orderId,map,new MyCallBack<String>(){
@Override
public void onSuccess(String result) {
super.onSuccess(result);
LogUtils.d(result);
BaseEntity<OrderDetailsEntity> baseEntity= JsonParse.parse(result, OrderDetailsEntity.class);
if(baseEntity.isSuccess()){
initView(baseEntity.getResult());
List<WorkflowProcessesEntity> workflowList=baseEntity.getResult().getProcesses();
WorkflowProcessesEntity lastWorkflow=workflowList.get(workflowList.size()-1);
initAction(lastWorkflow);
if(lastWorkflow.getOperationInfos()!=null&&lastWorkflow.getOperationInfos().size()>0){
workflowList.remove(workflowList.size()-1);
}
initWorkFlow(workflowList);
data.clear();
data.addAll(workflowList);
}else{
showToast(baseEntity.getMessage());
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
super.onError(ex, isOnCallback);
showToast(ex.getMessage());
}
@Override
public void onFinished() {
super.onFinished();
stopProgressDialog();
}
});
}
private void initWorkFlow(List<WorkflowProcessesEntity> list){
if(list.size()>0){
order_detail_workflow_ll.removeAllViews();
for (int i = 0; i < list.size(); i++) {
View v = LayoutInflater.from(this).inflate(R.layout.item_workflow_list,null);
ImageView item_workflow_avatar=v.findViewById(R.id.item_workflow_avatar);
TextView item_workflow_user_name=v.findViewById(R.id.item_workflow_user_name);
TextView item_workflow_user_role=v.findViewById(R.id.item_workflow_user_role);
TextView item_workflow_tel=v.findViewById(R.id.item_workflow_tel);
TextView item_workflow_content=v.findViewById(R.id.item_workflow_content);
RecyclerView item_workflow_pic=v.findViewById(R.id.item_workflow_pic);
TextView item_workflow_node=v.findViewById(R.id.item_workflow_node);
TextView item_workflow_time=v.findViewById(R.id.item_workflow_time);
WorkflowProcessesEntity item=list.get(i);
if(TextUtils.isEmpty(item.getAvatarUrl())){
Glide.with(this)
.load(R.drawable.ic_launcher)
.circleCrop()
.error(R.drawable.ic_no_img)
.into(item_workflow_avatar);
}else{
Glide.with(this)
.load(item.getAvatarUrl())
.circleCrop()
.error(R.drawable.ic_no_img)
.into(item_workflow_avatar);
}
item_workflow_user_name.setText(item.getHandlerName());
item_workflow_user_role.setText(item.getBriefDesc());
if (!TextUtils.isEmpty(item.getHandlerMobile())) {
item_workflow_tel.setText(item.getHandlerMobile());
} else {
item_workflow_tel.setVisibility(View.GONE);
}
if (item_workflow_tel.getText() instanceof Spannable) {
Spannable s = (Spannable) item_workflow_tel.getText();
s.setSpan(mNoUnderlineSpan, 0, s.length(), Spanned.SPAN_MARK_MARK);
}
item_workflow_content.setText(item.getRemark());
item_workflow_node.setText(item.getNodeName());
item_workflow_time.setText(item.getCreateTime());
List<ResourceEntity> picData=item.getResourceValues();
if(picData!=null&&picData.size()>0){
final List<ImageViewInfo> data=new ArrayList<>();
for (int j = 0; j < picData.size(); j++) {
data.add(new ImageViewInfo(picData.get(j).getUrl()));
}
final ImagePreviewListAdapter imageAdapter=new ImagePreviewListAdapter(this,R.layout.item_workflow_image_perview_list,data);
final GridLayoutManager mGridLayoutManager = new GridLayoutManager(this,4);
item_workflow_pic.setLayoutManager(mGridLayoutManager);
item_workflow_pic.setAdapter(imageAdapter);
item_workflow_pic.addOnItemTouchListener(new com.chad.library.adapter.base.listener.OnItemClickListener() {
@Override
public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) {
for (int k = mGridLayoutManager.findFirstVisibleItemPosition(); k < adapter.getItemCount(); k++) {
View itemView = mGridLayoutManager.findViewByPosition(k);
Rect bounds = new Rect();
if (itemView != null) {
ImageView imageView = itemView.findViewById(R.id.iiv_item_image_preview);
imageView.getGlobalVisibleRect(bounds);
}
//计算返回的边界
imageAdapter.getItem(k).setBounds(bounds);
}
PreviewBuilder.from(RepairsDetailActivity.this)
.setImgs(data)
.setCurrentIndex(position)
.setSingleFling(true)
.setType(PreviewBuilder.IndicatorType.Number)
.start();
}
});
}
order_detail_workflow_ll.addView(v);
}
order_detail_workflow_ll.setVisibility(View.VISIBLE);
}else{
order_detail_workflow_ll.setVisibility(View.GONE);
}
}
private void initView(OrderDetailsEntity workOrder){
if(TextUtils.isEmpty(workOrder.getCreatorAvatarUrl())){
Glide.with(this)
.load(R.drawable.icon_user_default)
.error(R.drawable.ic_no_img)
.circleCrop()
.into(order_detail_user_avatar);
}else{
Glide.with(this)
.load(workOrder.getCreatorAvatarUrl())
.error(R.drawable.ic_no_img)
.circleCrop()
.into(order_detail_user_avatar);
}
order_detail_user_name.setText(workOrder.getCreateName());
order_detail_user_room.setText(workOrder.getBriefDesc());
order_detail_order_type.setText(workOrder.getWorkTypeName());
order_detail_address.setText(getString(R.string.address_value,workOrder.getProjectName(),workOrder.getPhaseName(),workOrder.getBriefDesc()));
order_detail_contact.setText(workOrder.getHouseholdName());
if (!TextUtils.isEmpty(workOrder.getHouseholdMobile())) {
order_detail_contact_tel.setText(workOrder.getHouseholdMobile());
} else {
order_detail_contact_tel.setVisibility(View.GONE);
}
if (order_detail_contact_tel.getText() instanceof Spannable) {
Spannable s = (Spannable) order_detail_contact_tel.getText();
s.setSpan(mNoUnderlineSpan, 0, s.length(), Spanned.SPAN_MARK_MARK);
}
order_detail_remark_text.setText(workOrder.getProblemDesc());
order_detail_remark_time.setText(workOrder.getCreateTime());
}
private void initAction(WorkflowProcessesEntity lastWorkflow){
FragmentTransaction transaction=fragmentManager.beginTransaction();
if(lastWorkflow.getAssigneeId().equals(FileManagement.getUserInfoEntity().getId())
&&(lastWorkflow.getOperationInfos()!=null&&lastWorkflow.getOperationInfos().size()>0)) {
Bundle bundle = new Bundle();
bundle.putString("businessId", orderId);
bundle.putString("action", lastWorkflow.getNodeName());
bundle.putSerializable("workflowType", WorkflowType.Order);
bundle.putSerializable("operationInfos", (Serializable) lastWorkflow.getOperationInfos());
if(workflowActionFragment !=null){
workflowActionFragment =new WorkflowActionFragment().newInstance(bundle);
transaction.replace(R.id.order_detail_workflow_action_fl, workflowActionFragment).commit();
}else{
workflowActionFragment =new WorkflowActionFragment().newInstance(bundle);
transaction.add(R.id.order_detail_workflow_action_fl, workflowActionFragment).commit();
}
}else{
if(workflowActionFragment !=null){
transaction.remove(workflowActionFragment).commit();
}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==REQUEST_CODE_CHOOSE&&resultCode==RESULT_OK){
//图片路径 同样视频地址也是这个 根据requestCode
List<Uri> pathList = Matisse.obtainResult(data);
List<String> _List = new ArrayList<>();
for (Uri _Uri : pathList)
{
String _Path = FilePathUtil.getPathByUri(this,_Uri);
File _File = new File(_Path);
LogUtil.d("压缩前图片大小->" + _File.length() / 1024 + "k");
_List.add(_Path);
}
compress(_List);
}
}
//压缩图片
private void compress(List<String> list){
String _Path = FilePathUtil.createPathIfNotExist("/" + SD_APP_DIR_NAME + "/" + PHOTO_DIR_NAME);
LogUtil.d("_Path->" + _Path);
Luban.with(this)
.load(list)
.ignoreBy(100)
.setTargetDir(_Path)
.filter(new CompressionPredicate() {
@Override
public boolean apply(String path) {
return !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif"));
}
})
.setCompressListener(new OnCompressListener() {
@Override
public void onStart() {
LogUtil.d(" 压缩开始前调用,可以在方法内启动 loading UI");
}
@Override
public void onSuccess(File file) {
LogUtil.d(" 压缩成功后调用,返回压缩后的图片文件");
LogUtil.d("压缩后图片大小->" + file.length() / 1024 + "k");
LogUtil.d("getAbsolutePath->" + file.getAbsolutePath());
uploadPic(file.getAbsolutePath());
// mUploadPic(file.getAbsolutePath());
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
}
}).launch();
}
//上传照片
private void uploadPic(final String path){
Map<String,String> requestMap=new HashMap<>();
requestMap.put("resourceKey",resourceKey);
Map<String,File> fileMap=new HashMap<>();
fileMap.put("UploadFile",new File(path));
XUtils.UpLoadFile(BASE_URL+FILE+"files-anon", requestMap,fileMap,new MyCallBack<String>(){
@Override
public void onSuccess(String result) {
super.onSuccess(result);
LogUtils.d(result);
workflowActionFragment.setPicData(new ImageViewInfo(path));
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
super.onError(ex, isOnCallback);
showToast(ex.getMessage());
}
});
}
}
| [
"zengxiaolong@chanfine.com"
] | zengxiaolong@chanfine.com |
db196ee0635789e23b8563787cfb47a97d132638 | c4b108bd009c0261bdf8f8fe9d265a10f60b9f51 | /app/src/main/java/stu/xuronghao/ledger/handler/consts/ColorsHandler.java | f4b16117176bbc2bb00528f9c131c6268487f33f | [] | no_license | DyingWallet/Ledger_App | aef127e37758d1ef4a3e632b066113ecadbf1796 | 9ab4fe289a349780a0d679adb6542260f5a3426a | refs/heads/master | 2023-05-20T08:28:22.771992 | 2021-06-09T18:00:45 | 2021-06-09T18:00:45 | 278,330,106 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,782 | java | package stu.xuronghao.ledger.handler.consts;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import stu.xuronghao.ledger.R;
public class ColorsHandler {
private static final int[] colors = {R.color.themePink, R.color.wightBlue,
R.color.lightEarth, R.color.deepPink, R.color.indigo};
public static final String THEME_PINK = "#EC97B6";
public static final String ROSE_RED = "#FA6594";
public static final String LIGHT_BLUE = "#DEEFFF";
public static final String LIGHT_EARTHY = "#FFEADC";
public static final String DEEP_PINK = "#C8839C";
public static final String INDIGO = "#B5C9D9";
//注意,如果要对类型数组进行增减操作,需要同步对图标数组,颜色数组进行对应操作
private static final String[] colorStr = {ROSE_RED, LIGHT_BLUE, LIGHT_EARTHY, DEEP_PINK, INDIGO};
private static final Map<String, String> colorMap;
static {
colorMap = new HashMap<>();
colorMap.put("餐饮", ROSE_RED);
colorMap.put("交通", LIGHT_BLUE);
colorMap.put("服饰", LIGHT_EARTHY);
colorMap.put("日用", DEEP_PINK);
colorMap.put("工资", ROSE_RED);
colorMap.put("奖金", LIGHT_BLUE);
colorMap.put("补贴", LIGHT_EARTHY);
colorMap.put("红包", DEEP_PINK);
colorMap.put("其他", INDIGO);
}
private ColorsHandler() {
}
public static String[] getColorStr(int length) {
return Arrays.copyOfRange(colorStr, 0, length);
}
public static int[] getColors() {
return colors;
}
public static int getTypeColor(int index) {
return colors[index];
}
public static String getTypeColor(String type) {
return colorMap.get(type);
}
}
| [
"ronghao.xu@enmotech.com"
] | ronghao.xu@enmotech.com |
6cd8495f50cb55d476755b2c76e7c6edbe6ca577 | 1d0dd1e76219e07d4a4a58bc5e65bb293352d624 | /sticker/src/main/java/com/lsw/sticker/StickerIconEvent.java | 0526d66e04ec52bcf5028b7b9146ee7bd0cd80a2 | [] | no_license | SweeneyLiu/StickerView | 1154828fcea7e47ac5f234b26172a76bd9080716 | 114362492609157e8421bde7c42a9b557256a69c | refs/heads/master | 2022-12-31T18:53:47.759875 | 2020-10-21T12:20:36 | 2020-10-21T12:20:36 | 306,015,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package com.lsw.sticker;
import android.view.MotionEvent;
/**
* @author wupanjie
*/
public interface StickerIconEvent {
void onActionDown(StickerView stickerView, MotionEvent event);
void onActionMove(StickerView stickerView, MotionEvent event);
void onActionUp(StickerView stickerView, MotionEvent event);
}
| [
"liushuwei@kuaishou.com"
] | liushuwei@kuaishou.com |
45eea857c61b900668fa5e247deff59cae7c5724 | 0f5aba24e58d0ca130f267caa6e6635d51c1a840 | /src/main/java/MathOperations.java | 83f0ce847ee148a83c6fbd7501e9745996a2acdf | [] | no_license | rojjos/Rogis_JavaLabs | 85d9ba909225f30045132af37b23199138967184 | 0c13b37787b043ceb431fd86cdb8f56059152d5b | refs/heads/master | 2021-01-10T04:23:51.242804 | 2016-01-25T19:36:45 | 2016-01-25T19:36:45 | 50,058,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,618 | java | /**
* Created by rogi on 1/18/16.
*/
public class MathOperations {
private int number;
private String operationType;
private int result;
public boolean setNumber(int num) {
this.number = num;
if (num > 0) {
return true;
} else {
return false;
}
}
public int getNumber() {
return this.number;
}
public boolean setOperationType(String operationType) {
this.operationType = operationType;
if (operationType.equals("sum") || operationType.equals("product")) {
return true;
} else {
return false;
}
}
public String getOperationType() {
return operationType;
}
public boolean performOperation() {
if (operationType.equals("sum")) {
Sum();
return true;
}else if(operationType.equals("product")) {
Product();
return true;
}else {
return false;
}
}
private void Sum() {
result = 0;
for (int i=1; i <= number; i++ ){
result += i;
}
}
private void Product() {
result = 1;
for (int i=2; i <= number; result *= i, i++);
}
public String getValidOperationType() {
return "Sum or Product";
}
public int getResult() {
return result;
}
}
| [
"rogi@Zipcoder26s-MacBook-Pro.local"
] | rogi@Zipcoder26s-MacBook-Pro.local |
ce9c9806b7502224a3d1a96be52afcb00504e984 | fc616decdc01ebfdad7d825041cd658ce6a34f47 | /src/main/java/live/dao/LiveDAO.java | 80ea680717094b444cccdf742fdb7ba43d30ce09 | [] | no_license | panye7606/live | 0489ef971c00664914a276c798e6fc7a58079ba6 | 796f9ab76c32c168f6c1f9bb535a7f691afd6485 | refs/heads/master | 2020-04-24T23:02:48.823987 | 2017-07-03T11:10:33 | 2017-07-03T11:10:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package live.dao;
import live.model.Live;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface LiveDAO {
List<Live> getLives();
boolean add(Live live);
Live getById(int id);
boolean update(Live live);
boolean delete(int id);
}
| [
"zhuangshunhe@zhiping.com"
] | zhuangshunhe@zhiping.com |
65628ac8673c8691fad72db3c1c72c939f159989 | c082f84c1549631e7b9cc0ffc4b89d0c19288436 | /JavaBasicAndOOPsProgram/src/ConstructorProgram/C/parameterrizedMain.java | 9e4efa2f34ee149cb4d48054b26823fab06e08c3 | [] | no_license | AurangzebAnsari/BasicProgram | 08469b4a56104a090e58f9d96de352f9173b05fc | b8e16ab9f7142c52771d1c78bd9f706364949561 | refs/heads/master | 2020-01-23T21:35:29.371780 | 2017-01-15T11:52:29 | 2017-01-15T11:52:29 | 74,697,256 | 0 | 0 | null | 2017-01-06T14:09:37 | 2016-11-24T18:36:25 | Java | UTF-8 | Java | false | false | 220 | java | package ConstructorProgram.C;
public class parameterrizedMain {
public static void main(String args[])
{
ParameterizedConstructor p=new ParameterizedConstructor(1,95904,330,"Amit Kumar","Sunil Kumar");
}
} | [
"ansari95904@gmail.com"
] | ansari95904@gmail.com |
1222a30d8580f30c671c2b6d41ee076dbe28553f | b871a27ba4465aed100792a593394e63d3f25060 | /src/cn/probuing/dao/impl/CustomerDaoImpl.java | c0577a5c026081ed7a13dd63fe343314e46934c4 | [] | no_license | pobuing/ssh_crm | 9d5cc5b1529918bb6abd9b38012cc7aa3eff8a84 | a9bb1633aa657e72d75acfeea36e54d3b7badd0a | refs/heads/master | 2020-03-20T08:43:33.399628 | 2018-07-04T04:33:43 | 2018-07-04T04:33:43 | 137,317,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,015 | java | package cn.probuing.dao.impl;
import cn.probuing.dao.CustomerDao;
import cn.probuing.domain.Customer;
import org.hibernate.HibernateException;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.springframework.orm.hibernate5.HibernateCallback;
import java.util.List;
public class CustomerDaoImpl extends BaseDaoImpl<Customer> implements CustomerDao {
@Override
public List<Object[]> getIndustryCount() {
List list = getHibernateTemplate().execute(new HibernateCallback<List>() {
String sql = "SELECT bd.dict_item_name,COUNT(*) " +
"FROM cst_customer c,base_dict bd " +
"where c.cust_industry=bd.dict_id " +
"GROUP BY c.cust_industry";
@Override
public List doInHibernate(Session session) throws HibernateException {
SQLQuery sqlQuery = session.createSQLQuery(sql);
return sqlQuery.list();
}
});
return list;
}
}
| [
"330261819@qq.com"
] | 330261819@qq.com |
665896c96fb7851b7658b167e9112caa78541c4e | d753a32cf2356dfb85aac42ecc80b2dfcaf89b79 | /CDMConverter/src/main/java/uk/ac/bristol/CDMConverter/Encoding/FHIRInstance.java | f9d5dd34cf7508e218bbe87ae08bf8d6078e162a | [] | no_license | philipharfield/CDMConverter | 31ca9098c3f69f66ed418aef7331e27b675dd372 | 821874d30b7132e03efd6647beb88c9c2cc95fdd | refs/heads/master | 2021-12-15T02:14:31.322505 | 2019-09-18T13:11:17 | 2019-09-18T13:11:17 | 209,262,413 | 0 | 0 | null | 2021-12-14T21:33:56 | 2019-09-18T08:51:01 | Java | UTF-8 | Java | false | false | 2,107 | java | package uk.ac.bristol.CDMConverter.Encoding;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.parser.IParser;
import com.modeliosoft.modelio.javadesigner.annotations.objid;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import uk.ac.bristol.CDMConverter.Exceptions.JSONConfigException;
import uk.ac.bristol.CDMConverter.Translation.ITranslatorManager;
import uk.ac.bristol.CDMConverter.Translation.TranslatorManagerFactory;
@objid ("1854ea1d-3aa8-44d4-9cbd-46ef27935026")
public class FHIRInstance implements IEncodingInstance {
@objid ("667fffc7-f8b2-486e-8abc-f8316d6a817d")
final Logger logger = LogManager.getLogger();
@objid ("ba361897-6f78-4c68-9b76-903e430a7efc")
private IParser parser;
@objid ("da7aeaa7-a937-45d7-8a43-69aecaf6cc0c")
private String directory;
@objid ("bc492892-a5b3-49a6-98cb-4306c7d4d392")
public FHIRInstance(String directory, String fhirFormat) {
this.directory = directory;
if (fhirFormat.contains("JSON")) {
parser = FhirContext.forR4().newJsonParser();
} else {
// Else, default to XML
parser = FhirContext.forR4().newXmlParser();
}
}
@objid ("1d7fb9b3-3649-4b71-8db7-ca72afdd4129")
public ITranslatorManager getTranslatorTo(IEncodingInstance targetEI) throws JSONConfigException {
return TranslatorManagerFactory.getTranslatorManagerFHIRTo(targetEI);
}
@objid ("f7a13f64-2afc-4fc9-9e25-9e38d0b51d16")
public ITranslatorManager getTranslatorFromFHIR() throws JSONConfigException {
throw new JSONConfigException("Not possible to convert FHIR into FHIR");
}
@objid ("4387c586-947a-464b-9723-144bb4d88aa6")
public ITranslatorManager getTranslatorFromOMOP() {
return TranslatorManagerFactory.getOMOPToFHIRManager();
}
@objid ("326f6492-c470-484a-9903-f3db075a46c6")
public IParser getParser() {
return parser;
}
public String getDirectory() {
return directory;
}
}
| [
"ph18633@IT070742.users.bris.ac.uk"
] | ph18633@IT070742.users.bris.ac.uk |
58e34edf7b6750872a13281e5c7d9784ce3144e3 | 3d9225a1afe3a334eb8698b4d143d7369a5dd502 | /src/chapter3/programmingExercises/E5.java | 3b024ceb273cfa3f746a5bebfb01ab74ade7e55a | [] | no_license | KarenChincoya/LPOO_P1_01 | bec0d946057f0d471d771450cb9fd928da17a79c | 4a3cbc4a10409b82e5c9431016eb96641084e681 | refs/heads/master | 2021-04-27T00:27:39.594491 | 2018-03-04T19:14:19 | 2018-03-04T19:14:19 | 121,468,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | 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 chapter3.programmingExercises;
/**
*
* @author Karen Velasco
*/
import ejerciciosTodos.GasPrices;
import java.util.Scanner;
public class E5 {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Input the price per barrel: ");
Double price = input.nextDouble();
GasPrices g = new GasPrices();
g.main(price);
}
}
| [
"karenchincoya@gmail.com"
] | karenchincoya@gmail.com |
b97ffb0f53f751e6d2ab6780cc1bb8f4d1187789 | 07f432b383b08eb3fee3010077756380bd7c1c47 | /src/main/java/com/xiaobai/smsev/sys/dao/MenuMapper.java | ab9ab86ee6aa5ddc8007bba0b9ae436cfeb69395 | [] | no_license | superzhangxiaobai/SMSEV | 25bf4747061558d6b2318088107657c2d5b54466 | fd8cbec3f7034c7cc9e63be0ee1747266752ea04 | refs/heads/master | 2022-10-23T06:30:28.014199 | 2019-06-26T05:45:37 | 2019-06-26T05:45:37 | 193,836,904 | 0 | 0 | null | 2022-10-12T20:28:30 | 2019-06-26T05:42:41 | Java | UTF-8 | Java | false | false | 3,594 | java | package com.xiaobai.smsev.sys.dao;
import com.xiaobai.smsev.sys.entity.MenuInfo;
import com.xiaobai.smsev.sys.entity.SysParam;
//import org.apache.ibatis.annotations.InsertProvider;
//import org.apache.ibatis.annotations.Options;
//import org.apache.ibatis.annotations.Select;
//import org.apache.ibatis.annotations.SelectProvider;
//import org.apache.ibatis.jdbc.SQL;
import java.util.List;
public interface MenuMapper {
// @Select("select * from t_menu where roleid=#{roleid}")
List<MenuInfo> getListByRoleid(Long roleid);
// @Select(" select menu.* from t_user userinfo, t_user_role user_role, t_role role, t_role_menu role_menu, t_menu menu" +
// " where userinfo.id=user_role.userid and user_role.roleid=role.id and role.id=role_menu.roleid and role_menu.menuid=menu.id" +
// " and userid=#{userid}")
List<MenuInfo> getListByUserid(Long userid);
// @SelectProvider(type = DaoProvider.class, method = "find")
//@Select(" select menu.* from t_menu menu where isEnable=#{isEnable,jdbcType=BIT} ")
List<MenuInfo> getAll(SysParam param);
// @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
// @InsertProvider(type=DaoProvider.class,method = "insert")
int insert(MenuInfo menu);
// @InsertProvider(type=DaoProvider.class,method = "update")
int update(MenuInfo menu);
class DaoProvider {
private static final String tablename="t_menu";
public String find(SysParam param) {
String sql = "SELECT menu.* FROM t_menu menu where 1=1 ";
if(param.getId()!=null){
sql += " and id = #{id, jdbcType=VARCHAR}";
}
if(param.getPid()!=null){
sql+=" and pid = #{pid, jdbcType=INT}";
}
sql+=" and isEnable = #{isEnable, jdbcType=BIT}";
return sql;
}
// public String insert(MenuInfo param){
// SQL sql = new SQL(); //SQL语句对象,所在包:org.apache.ibatis.jdbc.SQL
// sql.INSERT_INTO(tablename);
// if(param.getMenuname() != null){
// sql.VALUES("menuname", "#{menuname}");
// }
// if(param.getUrl() != null){
// sql.VALUES("url", "#{url}");
// }
// if(param.getPid() != null){
// sql.VALUES("pid", "#{pid}");
// }
// if(param.getIcon() != null){
// sql.VALUES("icon", "#{icon}");
// }
// sql.VALUES("isEnable", "#{isEnable,jdbcType=BIT}");
// sql.VALUES("createtime", "#{createtime,jdbcType=DATE}");
// sql.VALUES("creator", "#{createtime,jdbcType=VARCHAR}");
// return sql.toString();
// }
// public String update(MenuInfo param){
// return new SQL(){{
// UPDATE(tablename);
// if (!StringUtils.isEmpty(param.getMenuname())) {
// SET("menuname"," #{menuname,jdbcType=VARCHAR}");
// }
// if (!StringUtils.isEmpty(param.getUrl())) {
// SET("url"," #{url,jdbcType=VARCHAR}");
// }
// if (param.getPid()!=null) {
// SET("pid","#{pid,jdbcType=VARCHAR}");
// }
// SET("isEnable", "#{isEnable,jdbcType=BIT}");
// SET("updatetime", "#{createtime,jdbcType=DATE}");
// SET("updator", "#{createtime,jdbcType=VARCHAR}");
// WHERE("id = #{id,jdbcType=INT}" );
// }}.toString();
// }
}
}
| [
"921623993@qq.com"
] | 921623993@qq.com |
b24855fe5091a94e140bcdf9473af7fd3b7e6cae | 8793867db7904f36d2a4dc6afdcb505020add61a | /src/test/java/uk/co/swilson/advent/Day07Test.java | 39c272eb5a8ffb3a81f6f6657c3b05808b44abb2 | [] | no_license | swilson96/advent-of-code-2020 | d4872c118a8943af8627a7c237196038689ade89 | 38d026e292aacff3f7cdf0aa2d8482f87cf1aa6b | refs/heads/main | 2023-02-08T12:26:28.795402 | 2020-12-31T14:46:51 | 2020-12-31T14:46:51 | 318,088,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,137 | java | package uk.co.swilson.advent;
import org.junit.jupiter.api.Test;
import uk.co.swilson.advent.day07.BagIterator;
import uk.co.swilson.advent.day07.Day07;
import uk.co.swilson.advent.day07.Rule;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
public class Day07Test {
private static final String EXAMPLE_INPUT = "light red bags contain 1 bright white bag, 2 muted yellow bags.\n" +
"dark orange bags contain 3 bright white bags, 4 muted yellow bags.\n" +
"bright white bags contain 1 shiny gold bag.\n" +
"muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.\n" +
"shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.\n" +
"dark olive bags contain 3 faded blue bags, 4 dotted black bags.\n" +
"vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.\n" +
"faded blue bags contain no other bags.\n" +
"dotted black bags contain no other bags.";
public static final String SECOND_EXAMPLE = "shiny gold bags contain 2 dark red bags.\n" +
"dark red bags contain 2 dark orange bags.\n" +
"dark orange bags contain 2 dark yellow bags.\n" +
"dark yellow bags contain 2 dark green bags.\n" +
"dark green bags contain 2 dark blue bags.\n" +
"dark blue bags contain 2 dark violet bags.\n" +
"dark violet bags contain no other bags.";
@Test
public void parseRule() {
var rule = new Rule("dark orange bags contain 3 bright white bags, 4 muted yellow bags.");
assertThat(rule.parent).isEqualTo("dark orange");
assertThat(rule.children.size()).isEqualTo(2);
assertThat(rule.children.get(0).name).isEqualTo("bright white");
assertThat(rule.children.get(1).name).isEqualTo("muted yellow");
}
@Test
public void parseRuleForNoBags() {
var rule = new Rule("faded blue bags contain no other bags.");
assertThat(rule.parent).isEqualTo("faded blue");
assertThat(rule.children.size()).isEqualTo(0);
}
@Test
public void example() {
var solver = new Day07();
var result = solver.solvePartOne(EXAMPLE_INPUT);
assertThat(result).isEqualTo(4);
}
@Test
public void partTwoExample() {
var solver = new Day07();
var result = solver.solvePartTwo(EXAMPLE_INPUT);
assertThat(result).isEqualTo(32);
}
@Test
public void partTwoExampleTwo() {
var solver = new Day07();
var result = solver.solvePartTwo(SECOND_EXAMPLE);
assertThat(result).isEqualTo(126);
}
@Test
public void partTwoExampleTwoSingleIteration() {
var result = new BagIterator(SECOND_EXAMPLE);
assertThat(result.countBagsInSingleBag("dark violet")).isEqualTo(0);
}
@Test
public void partTwoExampleTwoDoubleIteration() {
var result = new BagIterator(SECOND_EXAMPLE);
assertThat(result.countBagsInSingleBag("dark blue")).isEqualTo(2);
}
}
| [
"sjw@paratusltd.com"
] | sjw@paratusltd.com |
c05330ecbdd4b9f8eb91b3322a29313bfee7922d | 04d83501ed2b1c49b97d7d2baa29ae47f927369d | /wiki/tags/1.0.6/jamwiki-web/src/main/java/org/jamwiki/search/LuceneSearchEngine.java | cc712e41ba3a5b07f635153de4930e64328f005e | [] | no_license | Eljah/jamwiki | a207fac211a5d7977d175d26352771f51a4d2560 | 466275bd61bde092e1d0bb9d3c2491fb3b6968a3 | refs/heads/master | 2021-01-10T17:13:14.829006 | 2013-03-20T05:41:42 | 2013-03-20T05:41:42 | 46,241,623 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,115 | java | /**
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the latest version of the GNU Lesser General
* Public License as published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program (LICENSE.txt); if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.jamwiki.search;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.Searcher;
import org.apache.lucene.search.TopScoreDocCollector;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.highlight.Highlighter;
import org.apache.lucene.search.highlight.InvalidTokenOffsetsException;
import org.apache.lucene.search.highlight.QueryScorer;
import org.apache.lucene.search.highlight.SimpleHTMLEncoder;
import org.apache.lucene.search.highlight.SimpleHTMLFormatter;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
import org.jamwiki.Environment;
import org.jamwiki.SearchEngine;
import org.jamwiki.WikiBase;
import org.jamwiki.model.SearchResultEntry;
import org.jamwiki.model.Topic;
import org.jamwiki.model.VirtualWiki;
import org.jamwiki.utils.WikiLogger;
/**
* An implementation of {@link org.jamwiki.SearchEngine} that uses
* <a href="http://lucene.apache.org/java/">Lucene</a> to perform searches of
* Wiki content.
*/
public class LuceneSearchEngine implements SearchEngine {
/** Where to log to */
private static final WikiLogger logger = WikiLogger.getLogger(LuceneSearchEngine.class.getName());
/** Directory for search index files */
private static final String SEARCH_DIR = "search";
/** Id stored with documents to indicate the searchable topic name */
private static final String ITYPE_TOPIC = "topic";
/** Id stored with documents to indicate the searchable content. */
private static final String ITYPE_CONTENT = "content";
/** Id stored with documents to indicate the raw Wiki markup */
private static final String ITYPE_CONTENT_PLAIN = "content_plain";
/** Id stored with documents to indicate the topic name. */
private static final String ITYPE_TOPIC_PLAIN = "topic_plain";
/** Lucene compatibility version. */
private static final Version USE_LUCENE_VERSION = Version.LUCENE_30;
/** Maximum number of results to return per search. */
// FIXME - make this configurable
private static final int MAXIMUM_RESULTS_PER_SEARCH = 200;
/** Flag indicating whether or not to commit search index changes immediately. */
private boolean autoCommit = true;
/** Store Searchers (once opened) for re-use for performance reasons. */
private Map<String, Searcher> searchers = new HashMap<String, Searcher>();
/** Store Writers (once opened) for re-use for performance reasons. */
private Map<String, IndexWriter> indexWriters = new HashMap<String, IndexWriter>();
/**
* Add a topic to the search index.
*
* @param topic The Topic object that is to be added to the index.
*/
public void addToIndex(Topic topic) {
try {
long start = System.currentTimeMillis();
IndexWriter writer = this.retrieveIndexWriter(topic.getVirtualWiki(), false);
this.addToIndex(writer, topic);
this.commit(writer, this.autoCommit);
if (logger.isDebugEnabled()) {
logger.debug("Add to search index for topic " + topic.getName() + " in " + ((System.currentTimeMillis() - start) / 1000.000) + " s.");
}
} catch (Exception e) {
logger.error("Exception while adding topic " + topic.getName(), e);
}
}
/**
* Add a topic to the search index.
*
* @param topic The Topic object that is to be added to the index.
*/
private void addToIndex(IndexWriter writer, Topic topic) throws IOException {
Document standardDocument = createStandardDocument(topic);
writer.addDocument(standardDocument);
this.resetIndexSearcher(topic.getVirtualWiki());
}
/**
* Force a flush of any pending commits to the search index.
*
* @param virtualWiki The virtual wiki for which pending updates are being
* committed.
*/
public void commit(String virtualWiki) {
try {
this.commit(this.retrieveIndexWriter(virtualWiki, false), true);
} catch (IOException e) {
logger.error("Exception while committing pending changes for virtual wiki " + virtualWiki, e);
}
}
/**
* Commit pending changes to the writer only if the commitNow value is true.
* This is primarily a utility method for working with the autoCommit flag.
*/
private void commit(IndexWriter writer, boolean commitNow) throws IOException {
if (commitNow) {
writer.commit();
}
}
/**
* Create a basic Lucene document to add to the index. This document
* is suitable to be parsed with the StandardAnalyzer.
*/
private Document createStandardDocument(Topic topic) {
String topicContent = topic.getTopicContent();
if (topicContent == null) {
topicContent = "";
}
Document doc = new Document();
// store topic name and content for later retrieval
doc.add(new Field(ITYPE_TOPIC_PLAIN, topic.getName(), Field.Store.YES, Field.Index.NOT_ANALYZED));
doc.add(new Field(ITYPE_CONTENT_PLAIN, topicContent, Field.Store.YES, Field.Index.NO));
// index topic name and content for search purposes
doc.add(new Field(ITYPE_TOPIC, new StringReader(topic.getName())));
doc.add(new Field(ITYPE_CONTENT, new StringReader(topicContent)));
return doc;
}
/**
* Remove a topic from the search index.
*
* @param topic The topic object that is to be removed from the index.
*/
public void deleteFromIndex(Topic topic) {
try {
long start = System.currentTimeMillis();
// delete the current document
IndexWriter writer = this.retrieveIndexWriter(topic.getVirtualWiki(), false);
this.deleteFromIndex(writer, topic);
this.commit(writer, this.autoCommit);
if (logger.isDebugEnabled()) {
logger.debug("Delete from search index for topic " + topic.getName() + " in " + ((System.currentTimeMillis() - start) / 1000.000) + " s.");
}
} catch (Exception e) {
logger.error("Exception while adding topic " + topic.getName(), e);
}
}
/**
* Remove a topic from the search index.
*
* @param topic The topic object that is to be removed from the index.
*/
private void deleteFromIndex(IndexWriter writer, Topic topic) throws IOException {
writer.deleteDocuments(new Term(ITYPE_TOPIC_PLAIN, topic.getName()));
this.resetIndexSearcher(topic.getVirtualWiki());
}
/**
* Find all documents that contain a specific search term, ordered by relevance.
* This method supports all Lucene search query syntax.
*
* @param virtualWiki The virtual wiki for the topic.
* @param text The search term being searched for.
* @return A list of SearchResultEntry objects for all documents that
* contain the search term.
*/
public List<SearchResultEntry> findResults(String virtualWiki, String text) {
StandardAnalyzer analyzer = new StandardAnalyzer(USE_LUCENE_VERSION);
List<SearchResultEntry> results = new ArrayList<SearchResultEntry>();
logger.trace("search text: " + text);
try {
BooleanQuery query = new BooleanQuery();
QueryParser qp;
qp = new QueryParser(USE_LUCENE_VERSION, ITYPE_TOPIC, analyzer);
query.add(qp.parse(text), Occur.SHOULD);
qp = new QueryParser(USE_LUCENE_VERSION, ITYPE_CONTENT, analyzer);
query.add(qp.parse(text), Occur.SHOULD);
Searcher searcher = this.retrieveIndexSearcher(virtualWiki);
// rewrite the query to expand it - required for wildcards to work with highlighter
Query rewrittenQuery = searcher.rewrite(query);
// actually perform the search
TopScoreDocCollector collector = TopScoreDocCollector.create(MAXIMUM_RESULTS_PER_SEARCH, true);
searcher.search(rewrittenQuery, collector);
Highlighter highlighter = new Highlighter(new SimpleHTMLFormatter("<span class=\"highlight\">", "</span>"), new SimpleHTMLEncoder(), new QueryScorer(rewrittenQuery));
ScoreDoc[] hits = collector.topDocs().scoreDocs;
for (int i = 0; i < hits.length; i++) {
int docId = hits[i].doc;
Document doc = searcher.doc(docId);
String summary = retrieveResultSummary(doc, highlighter, analyzer);
SearchResultEntry result = new SearchResultEntry();
result.setRanking(hits[i].score);
result.setTopic(doc.get(ITYPE_TOPIC_PLAIN));
result.setSummary(summary);
results.add(result);
}
} catch (Exception e) {
logger.error("Exception while searching for " + text, e);
}
return results;
}
/**
* Get the path, which holds all index files
*/
private File getSearchIndexPath(String virtualWiki) throws IOException {
File parent = new File(Environment.getValue(Environment.PROP_BASE_FILE_DIR), SEARCH_DIR);
try {
if (System.getProperty("org.apache.lucene.lockdir") == null) {
// set the Lucene lock directory. this defaults to java.io.tmpdir,
// which may not be writable on some systems.
System.setProperty("org.apache.lucene.lockdir", parent.getPath());
}
} catch (Exception e) {
// probably a security exception
logger.warn("Unable to specify Lucene lock directory, default will be used: " + e.getMessage());
}
File child = new File(parent.getPath(), "index" + virtualWiki + File.separator);
if (!child.exists()) {
// create the search instance
child.mkdirs();
IndexWriter writer = new IndexWriter(FSDirectory.open(child), new StandardAnalyzer(USE_LUCENE_VERSION), true, IndexWriter.MaxFieldLength.LIMITED);
writer.close();
}
return child;
}
/**
* Refresh the current search index by re-visiting all topic pages.
*
* @throws Exception Thrown if any error occurs while re-indexing the Wiki.
*/
public void refreshIndex() throws Exception {
List<VirtualWiki> allWikis = WikiBase.getDataHandler().getVirtualWikiList();
Topic topic;
for (VirtualWiki virtualWiki : allWikis) {
long start = System.currentTimeMillis();
int count = 0;
IndexWriter writer = null;
try {
writer = this.retrieveIndexWriter(virtualWiki.getName(), true);
List<String> topicNames = WikiBase.getDataHandler().getAllTopicNames(virtualWiki.getName(), false);
// FIXME - parsing all documents will be intolerably slow with even a
// moderately large Wiki
for (String topicName : topicNames) {
topic = WikiBase.getDataHandler().lookupTopic(virtualWiki.getName(), topicName, false, null);
if (topic == null) {
logger.info("Unable to rebuild search index for topic: " + topicName);
continue;
}
// note: no delete is necessary since a new index is being created
this.addToIndex(writer, topic);
count++;
}
} catch (Exception ex) {
logger.error("Failure while refreshing search index", ex);
} finally {
try {
if (writer != null) {
writer.optimize();
}
} catch (Exception e) {
logger.error("Exception during optimize", e);
}
try {
if (writer != null) {
writer.close();
}
} catch (Exception e) {
logger.error("Exception during close", e);
}
}
if (logger.isInfoEnabled()) {
logger.info("Rebuilt search index for " + virtualWiki.getName() + " (" + count + " documents) in " + ((System.currentTimeMillis() - start) / 1000.000) + " seconds");
}
}
}
/**
* Call this method after a search index is updated to reset the searcher.
*/
private void resetIndexSearcher(String virtualWiki) throws IOException {
Searcher searcher = searchers.get(virtualWiki);
if (searcher != null) {
searchers.remove(virtualWiki);
searcher.close();
}
}
/**
* For performance reasons cache the IndexSearcher for re-use.
*/
private Searcher retrieveIndexSearcher(String virtualWiki) throws IOException {
Searcher searcher = searchers.get(virtualWiki);
if (searcher == null) {
searcher = new IndexSearcher(this.retrieveIndexWriter(virtualWiki, false).getReader());
searchers.put(virtualWiki, searcher);
}
return searcher;
}
/**
* For performance reasons create a cache of writers. Since writers are not being
* re-initialized then commit() must be called to explicitly flush data to the index,
* otherwise it will be flushed on a programmatic basis by Lucene.
*/
private IndexWriter retrieveIndexWriter(String virtualWiki, boolean create) throws IOException {
IndexWriter indexWriter = indexWriters.get(virtualWiki);
if (create && indexWriter != null) {
// if the writer is going to blow away the existing index and create a new one then it
// should not be cached. instead, close any open writer, create a new one, and return.
indexWriter.close();
indexWriters.remove(virtualWiki);
indexWriter = null;
}
if (indexWriter == null) {
FSDirectory fsDirectory = FSDirectory.open(getSearchIndexPath(virtualWiki));
indexWriter = new IndexWriter(fsDirectory, new StandardAnalyzer(USE_LUCENE_VERSION), create, IndexWriter.MaxFieldLength.LIMITED);
if (!create) {
indexWriters.put(virtualWiki, indexWriter);
}
}
return indexWriter;
}
/**
*
*/
private String retrieveResultSummary(Document document, Highlighter highlighter, StandardAnalyzer analyzer) throws InvalidTokenOffsetsException, IOException {
String content = document.get(ITYPE_CONTENT_PLAIN);
TokenStream tokenStream = analyzer.tokenStream(ITYPE_CONTENT_PLAIN, new StringReader(content));
String summary = highlighter.getBestFragments(tokenStream, content, 3, "...");
if (StringUtils.isBlank(summary) && !StringUtils.isBlank(content)) {
summary = StringEscapeUtils.escapeHtml(content.substring(0, Math.min(200, content.length())));
if (Math.min(200, content.length()) == 200) {
summary += "...";
}
}
return summary;
}
/**
*
*/
public void setAutoCommit(boolean autoCommit) {
this.autoCommit = autoCommit;
}
/**
*
*/
public void shutdown() throws IOException {
for (Searcher searcher : this.searchers.values()) {
searcher.close();
}
for (IndexWriter indexWriter : this.indexWriters.values()) {
indexWriter.close();
}
}
/**
*
*/
public void updateInIndex(Topic topic) {
try {
long start = System.currentTimeMillis();
IndexWriter writer = this.retrieveIndexWriter(topic.getVirtualWiki(), false);
this.deleteFromIndex(writer, topic);
this.addToIndex(writer, topic);
this.commit(writer, this.autoCommit);
if (logger.isDebugEnabled()) {
logger.debug("Update search index for topic " + topic.getName() + " in " + ((System.currentTimeMillis() - start) / 1000.000) + " s.");
}
} catch (Exception e) {
logger.error("Exception while updating topic " + topic.getName(), e);
}
}
}
| [
"wrh2@f65b7e76-0091-dd46-87ae-4bc0c949c03e"
] | wrh2@f65b7e76-0091-dd46-87ae-4bc0c949c03e |
65b08493885d5cb92b655ec52c6ea62911daa066 | 8bb7e6df3fb6b7056cf77d2d36abed2d5e337a0f | /SmartHomeApplication/src/main/java/com/tjetc/controller/AdminOrderController.java | 6121b436e796d49f62b1c62f277e2190fb974012 | [] | no_license | 1004032560/SmartHomeWebSite | dd6421d4939df5ce01c98cef5bdbe853c7256a47 | a1ea251f2213b9e0a297d08536a2f85294c00f0c | refs/heads/main | 2023-04-29T06:03:36.144098 | 2021-05-20T02:39:55 | 2021-05-20T02:39:55 | 318,965,574 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,450 | java | package com.tjetc.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.github.pagehelper.PageInfo;
import com.tjetc.domain.Orderitem;
import com.tjetc.domain.Orders;
import com.tjetc.service.OrderService;
@Controller
@RequestMapping("/adminOrder")
public class AdminOrderController {
@Autowired
private OrderService orderService;
@RequestMapping("/list")
public String list(String orderId,String curPage,Model model) {
orderId = orderId==null?"":orderId;
System.out.println(orderId);
System.out.println(curPage);
int currentPage = curPage==null?1:Integer.parseInt(curPage);
int pageSize = 5;
PageInfo<Orders> pageInfo = orderService.list(orderId,currentPage,pageSize);
model.addAttribute("page",pageInfo);
model.addAttribute("orderId",orderId);
return "admin/order/list";
}
@RequestMapping("/findOrderItem")
public String findOrderItem(String id,Model model) {
List<Orderitem> list = orderService.list(id);
model.addAttribute("list",list);
return "admin/order/orderItem";
}
@RequestMapping("/send/{id}")
public String send(@PathVariable("id") String id) {
orderService.updateState(id, 3);
return "redirect:/adminOrder/list";
}
}
| [
"1004032560@qq.com"
] | 1004032560@qq.com |
d45cc26ac5dbf6b06b1e381497565a7dd53e74a0 | d32910ac69630ca07f743a757935fb75c61363ba | /backend/MatNam/src/main/java/com/POM/MatNam/Board/Controller/BoardController.java | 28aaa4324aa3daabd86e4954851524a054a4c64c | [] | no_license | dmdekf/S03_PerfectMeet_02 | de08af5964609ccfc2228c538c2c82aa696c2913 | 54e3c5c5a9aa09b29a6429c12ae1dbc3cf2e51a0 | refs/heads/backend | 2023-04-08T05:16:04.093459 | 2021-04-01T13:55:47 | 2021-04-01T13:55:47 | 353,714,886 | 0 | 0 | null | 2021-04-01T13:56:37 | 2021-04-01T13:47:05 | Vue | UTF-8 | Java | false | false | 3,228 | java | package com.POM.MatNam.Board.Controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.POM.MatNam.Board.DAO.BoardDao;
import com.POM.MatNam.Board.DTO.Board;
import com.POM.MatNam.Board.Response.BasicResponse;
import io.swagger.annotations.ApiOperation;
@RestController
@CrossOrigin(origins = { "*" })
@RequestMapping("feature/board")
public class BoardController {
@Autowired
BoardDao boardDao;
@ApiOperation(value="수정하기", response = BoardController.class)
@PutMapping("/update")
public Object like(@RequestBody Board request) throws Exception {
Optional<Board> board = boardDao.findById(request.getId());
ResponseEntity response = null;
final BasicResponse result = new BasicResponse();
if (board.isPresent()) {
Board b = board.get();
b.setSubject(request.getSubject());
b.setContent(request.getContent());
boardDao.save(b);
result.status = true;
result.data = "success";
response = new ResponseEntity<>(result, HttpStatus.OK);
return response;
}
result.status = false;
result.data = "fail to Update";
response = new ResponseEntity<>(result, HttpStatus.BAD_REQUEST);
return response;
}
@ApiOperation(value = "모든 게시글의 정보를 반환한다.", response = List.class)
@GetMapping("list")
public List<Board> getBoardList() throws Exception {
System.out.println("뭐가 실행이 되는거지? getBoardList()");
List<Board> list = boardDao.findAll();
return list;
}
@ApiOperation(value = "게시글번호에 해당하는 게시글의 정보를 반환한다.", response = BoardController.class)
@GetMapping("/list/{id}")
public Object detailBoard(@PathVariable int id) {
System.out.println(id);
Optional<Board> board = boardDao.findById(id);
return board;
}
@ApiOperation(value = "새로운 게시글 정보를 입력한다. 그리고 DB입력 성공여부에 따라 'success' 또는 'fail' 문자열을 반환한다.", response = String.class)
@PostMapping("/write")
public Board writeBoard(@RequestBody Board board) {
return boardDao.save(board);
}
@ApiOperation(value = "게시글번호에 해당하는 게시글의 정보를 삭제한다.", response = String.class)
@DeleteMapping("delete/{id}")
public Optional<Board> deleteBoard(@PathVariable("id") int id) {
Optional<Board> boardId = boardDao.findById(id);
boardDao.deleteById(id);
return null;
}
}
| [
"wjsgudwls89@gmail.com"
] | wjsgudwls89@gmail.com |
418ffbda7771a03b3de1408474ec012ff4409589 | 87b192aa3864f9b780381b2b7d9c9db31ad92d11 | /oop/src/com/visa/prj/client/ProductClient.java | bcbe7b36bb825bbdf3783d74e0c5e582bf78d717 | [] | no_license | ishani33/JavaTraining | 9315e866edab31336180673b4e628ca402a6c186 | 29815ee2bedfa513734db314366e239246dce01d | refs/heads/master | 2022-12-22T16:09:20.712223 | 2019-08-23T10:55:59 | 2019-08-23T10:55:59 | 199,440,775 | 0 | 0 | null | 2022-12-16T00:41:38 | 2019-07-29T11:34:59 | Java | UTF-8 | Java | false | false | 1,872 | java | package com.visa.prj.client;
import java.lang.reflect.Method;
import com.visa.prj.entity.Mobile;
import com.visa.prj.entity.Product;
import com.visa.prj.entity.Tv;
public class ProductClient {
public static void main(String[] args) {
//new Product(); ---> this fails because Product class is abstract
Product[] products = new Product[5]; // Array of 4 Pointers
products[0] = new Tv(133,"Sony Bravia",135000.00,"LED");
products[1] = new Mobile(453, "MotoG", 12999.00, "4G");
products[2] = new Tv(634,"Onida Thunder",3500.00,"CRT");
products[3] = new Mobile(621, "iPhone XR", 99999.00, "4G");
products[4] = new Mobile(844, "Oppo", 9999.00, "4G");
printExpensive(products);
printInfo(products);
printInfoOCP(products);
}
private static void printInfoOCP(Product[] products) {
for(Product p : products) {
Method[] methods = p.getClass().getMethods();
for(Method m: methods) {
if(m.getName().startsWith("get")) {
try {
Object ret = m.invoke(p);
System.out.println(ret);
} catch(Exception ex) {
System.out.println(ex);
}
}
}
}
}
private static void printInfo(Product[] products) {
for(Product p : products) {
System.out.println(p.getName()+ "," +p.getPrice());
if(p.getClass() == Tv.class) {
Tv t = (Tv)p;
System.out.println(t.getConnectivity());
}
else if(p instanceof Mobile) {
Mobile m = (Mobile)p;
System.out.println(m.getConnectivity());
}
System.out.println("*******");
}
}
//OCP (Open- Closed Principle)
private static void printExpensive(Product[] products) {
for(int i=0; i<products.length;i++) {
if(products[i].isExpensive()) { //dynamic binding, polymorphic
System.out.println(products[i].getName()+ " is expensive!!!");
} else {
System.out.println(products[i].getName()+ " is not expensive!!!");
}
}
}
}
| [
"ishanichauhan781@gmail.com"
] | ishanichauhan781@gmail.com |
341826cb46506c48cc697661c02a8e272802e11a | 8a3750c8441e6307fea3a485a3c8e19f544e9492 | /src/main/java/dev/rosewood/rosechat/hook/channel/rosechat/RoseChatChannel.java | eddd3a6bbae985ff5f7753d77fc96773be8f4baa | [] | no_license | Rosewood-Development/RoseChat | e00f167c8c5dc802c2c928877555e13e69eb813b | f3cae75fb0e0566d9781f9d8bfde85d90eeb3751 | refs/heads/master | 2023-08-16T18:08:16.243312 | 2023-06-14T15:21:32 | 2023-06-14T15:21:32 | 241,836,139 | 11 | 3 | null | 2023-07-02T01:17:19 | 2020-02-20T08:53:31 | Java | UTF-8 | Java | false | false | 23,994 | java | package dev.rosewood.rosechat.hook.channel.rosechat;
import dev.rosewood.rosechat.RoseChat;
import dev.rosewood.rosechat.api.RoseChatAPI;
import dev.rosewood.rosechat.api.event.PostParseMessageEvent;
import dev.rosewood.rosechat.chat.PlayerData;
import dev.rosewood.rosechat.hook.channel.ChannelProvider;
import dev.rosewood.rosechat.hook.channel.condition.ConditionalChannel;
import dev.rosewood.rosechat.manager.ConfigurationManager.Setting;
import dev.rosewood.rosechat.message.DeletableMessage;
import dev.rosewood.rosechat.message.MessageDirection;
import dev.rosewood.rosechat.message.MessageUtils;
import dev.rosewood.rosechat.message.RosePlayer;
import dev.rosewood.rosechat.message.wrapper.MessageRules;
import dev.rosewood.rosechat.message.wrapper.RoseMessage;
import dev.rosewood.rosegarden.hook.PlaceholderAPIHook;
import dev.rosewood.rosegarden.utils.StringPlaceholders;
import me.clip.placeholderapi.PlaceholderAPI;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.chat.ComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.regex.Matcher;
public class RoseChatChannel extends ConditionalChannel {
// Channel Settings
protected int radius;
protected boolean autoJoin;
protected boolean visibleAnywhere;
protected boolean joinable;
protected boolean keepFormatOverBungee;
protected List<String> worlds;
protected List<String> servers;
public RoseChatChannel(ChannelProvider provider) {
super(provider);
}
@Override
public void onLoad(String id, ConfigurationSection config) {
super.onLoad(id, config);
// Set settings specifically for RoseChat Channels
this.radius = config.contains("radius") ? config.getInt("radius") : -1;
this.autoJoin = config.contains("auto-join") && config.getBoolean("auto-join");
this.visibleAnywhere = config.contains("visible-anywhere") && config.getBoolean("visible-anywhere");
this.joinable = !config.contains("joinable") || config.getBoolean("joinable");
this.keepFormatOverBungee = config.contains("keep-format") && config.getBoolean("keep-format");
this.worlds = config.contains("worlds") ? config.getStringList("worlds") : new ArrayList<>();
this.servers = config.contains("servers") ? config.getStringList("servers") : new ArrayList<>();
}
@Override
public boolean onLogin(Player player) {
return this.getJoinCondition(player) && (this.autoJoin && (this.worlds.isEmpty() || this.worlds.contains(player.getWorld().getName())));
}
@Override
public boolean onWorldJoin(Player player, World from, World to) {
if (this.worlds.isEmpty() || !this.autoJoin) return false;
// No point in joining again if the new world is linked too.
if ((from != null && this.worlds.contains(from.getName())) && this.worlds.contains(to.getName())) return false;
// Join the channel if the world is linked to the channel.
return this.getJoinCondition(player) && this.worlds.contains(to.getName());
}
@Override
public boolean onWorldLeave(Player player, World from, World to) {
if (this.worlds.isEmpty() || !this.autoJoin) return false;
// No point in leaving if the new world is linked too.
if (this.worlds.contains(from.getName()) && this.worlds.contains(to.getName())) return false;
// Leave the channel if the world is linked to the channel.
return this.worlds.contains(from.getName());
}
/**
* Retrieves a list of players who should receive spy messages.
* @param condition A {@link Predicate<Player>} to test against, to see if the player should receive a spy message.
* @return A {@link List<Player>} of players who should receive a spy message.
*/
public List<Player> getSpies(Predicate<Player> condition) {
List<UUID> channelSpies = RoseChatAPI.getInstance().getPlayerDataManager().getChannelSpies();
List<Player> spies = new ArrayList<>();
for (UUID uuid : channelSpies) {
Player player = Bukkit.getPlayer(uuid);
if (player == null) continue;
if (condition.test(player))
spies.add(player);
}
return spies;
}
/**
* Retrieves a list of players who should receive messages when visible-anywhere is enabled.
* @param sender The {@link RosePlayer} who is sending the message.
* @param world The {@link World} to get the players from, will be null if the world is not needed.
* @return A {@link List<Player>} of recipients.
*/
public List<Player> getVisibleAnywhereRecipients(RosePlayer sender, World world) {
List<Player> recipients = new ArrayList<>();
if (world == null) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (this.getReceiveCondition(sender, player)) recipients.add(player);
}
return recipients;
} else {
for (Player player : world.getPlayers()) {
if (this.getReceiveCondition(sender, player)) recipients.add(player);
}
return recipients;
}
}
/**
* Retrieves a list of players who should receive messages when visible-anywhere is not enabled.
* @param sender The {@link RosePlayer} who is sending the message.
* @param world The {@link World} to get the players from, will be null if the world is not needed.
* @return A {@link List<Player>} of recipients.
*/
public List<Player> getMemberRecipients(RosePlayer sender, World world) {
List<Player> recipients = new ArrayList<>();
for (UUID member : this.members) {
Player player = Bukkit.getPlayer(member);
if (player != null) recipients.add(player);
}
return recipients;
}
protected void sendToPlayer(RoseMessage message, RosePlayer receiver, MessageDirection direction, String format, String discordId) {
message = new RoseMessage(message);
PlayerData receiverData = RoseChatAPI.getInstance().getPlayerData(receiver.getUUID());
// Don't send the message if the receiver can't receive it.
if (!this.canReceiveMessage(receiver, receiverData, message.getSender().getUUID())) return;
// Send the message to the player asynchronously.
RoseMessage finalMessage = message;
RoseChat.MESSAGE_THREAD_POOL.submit(() -> {
// If the message is not a json message, parse normally or parse from discord if an id is available.
if (direction != MessageDirection.FROM_BUNGEE_RAW) {
receiver.send(discordId == null ? finalMessage.parse(receiver, format) : finalMessage.parseMessageFromDiscord(receiver, format, discordId));
} else {
// Parse the json message.
// Replace %other placeholders.
String jsonMessage = finalMessage.getMessage();
if (PlaceholderAPIHook.enabled()) {
Matcher matcher = PlaceholderAPI.getPlaceholderPattern().matcher(jsonMessage);
while (matcher.find()) {
jsonMessage = jsonMessage.replace(matcher.group(), matcher.group().replace("other_", ""));
}
}
// Serialize the json message and set the components.
BaseComponent[] parsedMessage = ComponentSerializer.parse(receiver.isPlayer() ? PlaceholderAPIHook.applyPlaceholders(receiver.asPlayer(), jsonMessage) : jsonMessage);
finalMessage.setComponents(parsedMessage);
//Call the post parse message event for the correct viewer if the message was sent over bungee
PostParseMessageEvent postParseMessageEvent = new PostParseMessageEvent(finalMessage, finalMessage.getSender(), MessageDirection.PLAYER_TO_SERVER);
Bukkit.getPluginManager().callEvent(postParseMessageEvent);
receiver.send(finalMessage.toComponents());
receiverData.getMessageLog().addDeletableMessage(new DeletableMessage(finalMessage.getUUID(), ComponentSerializer.toString(finalMessage.toComponents()),
false, discordId));
}
// Play the tag sound to the player.
if (receiver.isPlayer() && finalMessage.getTaggedPlayers().contains(receiver.getUUID())) {
Player player = receiver.asPlayer();
if (finalMessage.getTagSound() != null && (receiverData != null && receiverData.hasTagSounds()))
player.playSound(player.getLocation(), finalMessage.getTagSound(), 1.0f, 1.0f);
}
});
}
private void sendToDiscord(RoseMessage message, MessageDirection direction) {
RoseChatAPI api = RoseChatAPI.getInstance();
// Send the message to discord, if not sent from discord.
// Json messages are unsupported
if (direction != MessageDirection.FROM_DISCORD && direction != MessageDirection.FROM_BUNGEE_RAW) {
if (api.getDiscord() != null && this.getDiscordChannel() != null) {
RoseChat.MESSAGE_THREAD_POOL.submit(() -> {
MessageUtils.sendDiscordMessage(message, this, this.getDiscordChannel());
});
}
}
}
private void sendToBungee(RoseMessage message, MessageDirection direction) {
RoseChatAPI api = RoseChatAPI.getInstance();
// Send the message over bungee, if the message was not sent from bungee.
if (direction != MessageDirection.FROM_BUNGEE_SERVER && direction != MessageDirection.FROM_BUNGEE_RAW && api.isBungee() && direction != MessageDirection.FROM_DISCORD) {
for (String server : this.servers) {
if (this.keepFormatOverBungee) {
RoseChat.MESSAGE_THREAD_POOL.submit(() -> {
api.getBungeeManager()
.sendChannelMessage(message.getSender(), server, this.getId(), message.getUUID(), true,
ComponentSerializer.toString(message.parseBungeeMessage(message.getSender(), this.getFormat())));
});
} else {
api.getBungeeManager().sendChannelMessage(message.getSender(), server, this.getId(), message.getUUID(), false, message.getMessage());
}
}
}
}
private void send(RoseMessage message, MessageDirection direction, String format, String discordId) {
// Send message to the player
this.sendToPlayer(message, message.getSender(), direction, format, discordId);
// Send message to Discord
RoseMessage discordMessage = new RoseMessage(message);
discordMessage.getMessageRules().ignoreMessageLogging();
this.sendToDiscord(discordMessage, direction);
// Send message to Bungee
RoseMessage bungeeMessage = new RoseMessage(message);
bungeeMessage.getMessageRules().ignoreMessageLogging();
this.sendToBungee(bungeeMessage, direction);
List<Player> currentSpies = new ArrayList<>();
// Use the settings to decide who to send the message to.
if (this.visibleAnywhere) {
if (this.radius != -1 && message.getSender().isPlayer()) {
// Visible Anywhere + Radius - Send to players in the radius, without them being in the channel.
// If the radius setting is enabled, and the sender is a player, then send the message.
Location senderLocation = message.getSender().asPlayer().getLocation();
if (senderLocation.getWorld() == null) return;
// Loop through all the players in the world.
for (Player player : this.getVisibleAnywhereRecipients(message.getSender(), senderLocation.getWorld())) {
if (!message.getSender().isConsole() && message.getSender().getUUID().equals(player.getUniqueId())) continue;
// Send the message if the player is within the distance.
if (player.getLocation().distance(senderLocation) <= this.radius) {
this.sendToPlayer(message, new RosePlayer(player), direction, format, discordId);
}
}
// Allow spies who are not in the same world to see the message.
Predicate<Player> condition = player -> !player.getWorld().getName().equals(senderLocation.getWorld().getName())
|| (player.getWorld().getName().equals(senderLocation.getWorld().getName()) && player.getLocation().distance(senderLocation) >= this.radius);
currentSpies.addAll(this.getSpies(condition));
} else if (!this.worlds.isEmpty()){
// Visible Anywhere + World - Send to players in the world, without them being in the channel.
for (String worldStr : this.worlds) {
World world = Bukkit.getWorld(worldStr);
if (world == null) continue;
// Loop through all the players in the world.
for (Player player : this.getVisibleAnywhereRecipients(message.getSender(), world)) {
if (!message.getSender().isConsole() && message.getSender().getUUID().equals(player.getUniqueId())) continue;
this.sendToPlayer(message, new RosePlayer(player), direction, format, discordId);
}
}
// Allow spies who are not in the same world to see the message.
Predicate<Player> condition = player -> !this.worlds.contains(player.getWorld().getName());
currentSpies.addAll(this.getSpies(condition));
} else {
// ONLY Visible Anywhere Enabled - Send to all players.
List<Player> players = this.getVisibleAnywhereRecipients(message.getSender(), null);
for (Player player : players) {
if (!message.getSender().isConsole() && message.getSender().getUUID().equals(player.getUniqueId())) continue;
this.sendToPlayer(message, new RosePlayer(player), direction, format, discordId);
}
for (UUID uuid : RoseChatAPI.getInstance().getPlayerDataManager().getChannelSpies()) {
Player player = Bukkit.getPlayer(uuid);
if (player == null) continue;
if (!players.contains(player)) currentSpies.add(player);
}
}
// Send the message to all the spies who will not receive the message by being in the channel.
for (Player spy : currentSpies) {
if (spy == null) continue;
if (!message.getSender().isConsole() && message.getSender().getUUID().equals(spy.getUniqueId())) continue;
this.sendToPlayer(message, new RosePlayer(spy), direction, Setting.CHANNEL_SPY_FORMAT.getString(), discordId);
}
} else {
if (this.radius != -1 && message.getSender().isPlayer()) {
// Not Visible Anywhere and Radius - Send to all members in the radius, only if they are in the channel.
Location senderLocation = message.getSender().asPlayer().getLocation();
if (senderLocation.getWorld() == null) return;
// Sender to all members of the channel.
for (Player player : this.getMemberRecipients(message.getSender(), null)) {
if (!message.getSender().isConsole() && message.getSender().getUUID().equals(player.getUniqueId())) continue;
if (player.getWorld().getName().equals(senderLocation.getWorld().getName())
&& player.getLocation().distance(senderLocation) <= this.radius) {
this.sendToPlayer(message, new RosePlayer(player), direction, format, discordId);
}
}
// Allow spies to see the message if they aren't in the world or distance.
Predicate<Player> condition = player -> !this.members.contains(player.getUniqueId()) ||
(this.members.contains(player.getUniqueId()) && (!player.getWorld().getName().equals(senderLocation.getWorld().getName())
|| (player.getWorld().getName().equals(senderLocation.getWorld().getName()) && player.getLocation().distance(senderLocation) > this.radius)));
currentSpies.addAll(this.getSpies(condition));
} else if (!this.worlds.isEmpty()) {
// Not Visible Anywhere + World - Player must be in the channel AND the world to see the message
for (Player player : this.getMemberRecipients(message.getSender(), null)) {
if (!message.getSender().isConsole() && message.getSender().getUUID().equals(player.getUniqueId())) continue;
if (this.worlds.contains(player.getWorld().getName())) {
this.sendToPlayer(message, new RosePlayer(player), direction, format, discordId);
}
}
Predicate<Player> condition = player -> !this.members.contains(player.getUniqueId())
|| (this.members.contains(player.getUniqueId()) && !this.worlds.contains(player.getWorld().getName()));
currentSpies.addAll(this.getSpies(condition));
} else {
// Not Visible Anywhere - Send to the members
for (Player player : this.getMemberRecipients(message.getSender(), null)) {
if (!message.getSender().isConsole() && message.getSender().getUUID().equals(player.getUniqueId())) continue;
this.sendToPlayer(message, new RosePlayer(player), direction, format, discordId);
}
Predicate<Player> condition = player -> !this.members.contains(player.getUniqueId());
currentSpies.addAll(this.getSpies(condition));
}
// Send the message to all the spies who will not receive the message by being in the channel.
for (Player spy : currentSpies) {
if (spy == null || (message.getSender().isConsole() && message.getSender().getUUID().equals(spy.getUniqueId()))) continue;
this.sendToPlayer(message, new RosePlayer(spy), direction, Setting.CHANNEL_SPY_FORMAT.getString(), discordId);
}
}
}
@Override
public void send(RosePlayer sender, String message) {
// Create the rules for this message.
MessageRules rules = new MessageRules().applyAllFilters().applySenderChatColor();
// Parses the first message synchronously
// Allows for creating a token storage.
RoseMessage roseMessage = new RoseMessage(sender, this, message);
roseMessage.applyRules(rules);
// Check if the message is allowed to be sent.
if (roseMessage.isBlocked()) {
if (roseMessage.getFilterType() != null)
roseMessage.getFilterType().sendWarning(sender);
return;
}
BaseComponent[] parsedConsoleMessage = roseMessage.parse(new RosePlayer(Bukkit.getConsoleSender()), this.getFormat());
// Send the parsed message to the console
Bukkit.getConsoleSender().spigot().sendMessage(parsedConsoleMessage);
// Send the message to the members.
this.send(roseMessage, MessageDirection.PLAYER_TO_SERVER, this.getFormat(), null);
}
@Override
public void send(RoseMessage message, String discordId) {
// Send the message from discord, with the correct format.
this.send(message, MessageDirection.FROM_DISCORD, Setting.DISCORD_TO_MINECRAFT_FORMAT.getString(), discordId);
}
@Override
public void send(RosePlayer sender, String message, UUID messageId) {
MessageRules rules = new MessageRules().applyAllFilters().applySenderChatColor();
RoseMessage roseMessage = new RoseMessage(sender, this, message);
roseMessage.applyRules(rules);
roseMessage.setUUID(messageId);
this.send(roseMessage, MessageDirection.FROM_BUNGEE_SERVER, this.getFormat(), null);
}
@Override
public void sendJson(RosePlayer sender, String message, UUID messageId) {
// Don't apply rules as they've already been applied.
RoseMessage roseMessage = new RoseMessage(sender, this, message);
roseMessage.setUUID(messageId);
this.send(roseMessage, MessageDirection.FROM_BUNGEE_RAW, this.getFormat(), null);
}
@Override
public void flood(String message) {
RoseChatAPI api = RoseChatAPI.getInstance();
// Flood the channel on the linked servers.
if (api.isBungee()) {
for (String server : this.servers)
api.getBungeeManager().sendChannelMessage(new RosePlayer("", ""), server, this.getId(), null, false, message);
}
// Send to all players who can see the channel.
if (this.visibleAnywhere) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (!player.hasPermission("rosechat.channel." + this.getId())) continue;
player.sendMessage(message);
}
return;
}
// Send to all players in the worlds
if (!this.worlds.isEmpty()) {
for (String worldStr : this.worlds) {
World world = Bukkit.getWorld(worldStr);
if (world == null) continue;
for (Player player : world.getPlayers()) {
if (!player.hasPermission("rosechat.channel." + this.getId())) continue;
player.sendMessage(message);
}
return;
}
}
// Send to all members.
for (UUID uuid : this.members) {
Player player = Bukkit.getPlayer(uuid);
if (player != null) {
player.sendMessage(message);
}
}
}
@Override
public List<UUID> getMembers() {
return this.members;
}
@Override
public String getId() {
return this.id;
}
@Override
public List<String> getServers() {
return this.servers;
}
@Override
public boolean canJoinByCommand(Player player) {
return player.hasPermission("rosechat.channelbypass")
|| (player.hasPermission("rosechat.channel." + this.getId()) && this.joinable && this.getJoinCondition(player));
}
@Override
public StringPlaceholders.Builder getInfoPlaceholders(RosePlayer sender, String trueValue, String falseValue, String nullValue) {
return super.getInfoPlaceholders(sender, trueValue, falseValue, nullValue)
.addPlaceholder("radius", this.radius == -1 ? nullValue : this.radius)
.addPlaceholder("discord", this.getDiscordChannel() == null ? nullValue : this.getDiscordChannel())
.addPlaceholder("auto-join", this.autoJoin ? trueValue : falseValue)
.addPlaceholder("visible-anywhere", this.visibleAnywhere ? trueValue : falseValue)
.addPlaceholder("joinable", this.joinable ? trueValue : falseValue)
.addPlaceholder("keep-format", this.keepFormatOverBungee ? trueValue : falseValue)
.addPlaceholder("worlds", this.worlds.isEmpty() ? nullValue : this.worlds.toString())
.addPlaceholder("servers", this.servers.isEmpty() ? nullValue : this.servers.toString());
}
}
| [
"lyliowy@gmail.com"
] | lyliowy@gmail.com |
7420e6d4349dde8bf34b91decc96463efb5c3e3d | 5a23a036b6dfe44fa70615bea7ea79bbdbc5f6d3 | /app/src/main/java/com/example/framgiamaidaidien/hearttwitteranimation/ui/StarButtonView.java | 4a75cb61dece57843ec1a46fd990f651f5b1f1df | [] | no_license | luckyluke1994/HeartTwitterAnimation | 447aba263c15d53c6ac33c8e82608129b451704d | 930e819360c48fc46efb82b342d4f046bbd6d74b | refs/heads/master | 2021-01-12T04:05:04.403848 | 2016-12-28T02:35:47 | 2016-12-28T06:32:27 | 77,496,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,351 | java | package com.example.framgiamaidaidien.hearttwitteranimation.ui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.example.framgiamaidaidien.hearttwitteranimation.R;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* Created by FRAMGIA\mai.dai.dien on 28/12/2016.
*/
public class StarButtonView extends FrameLayout implements View.OnClickListener {
private static final DecelerateInterpolator DECCELERATE_INTERPOLATOR = new DecelerateInterpolator();
private static final AccelerateDecelerateInterpolator ACCELERATE_DECELERATE_INTERPOLATOR = new AccelerateDecelerateInterpolator();
private static final OvershootInterpolator OVERSHOOT_INTERPOLATOR = new OvershootInterpolator(4);
@Bind(R.id.ivStar)
ImageView ivStar;
@Bind(R.id.vDotsView)
DotsView vDotsView;
@Bind(R.id.vCircle)
CircleView vCircle;
private boolean isChecked;
private AnimatorSet animatorSet;
public StarButtonView(Context context) {
super(context);
init();
}
public StarButtonView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public StarButtonView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public StarButtonView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
private void init() {
LayoutInflater.from(getContext()).inflate(R.layout.view_star_button, this, true);
ButterKnife.bind(this);
setOnClickListener(this);
}
@Override
public void onClick(View v) {
isChecked = !isChecked;
ivStar.setImageResource(isChecked ? R.drawable.ic_star_rate_on : R.drawable.ic_star_rate_off);
if (animatorSet != null) {
animatorSet.cancel();
}
if (isChecked) {
ivStar.animate().cancel();
ivStar.setScaleX(0);
ivStar.setScaleY(0);
vCircle.setInnerCircleRadiusProgress(0);
vCircle.setOuterCircleRadiusProgress(0);
vDotsView.setCurrentProgress(0);
animatorSet = new AnimatorSet();
ObjectAnimator outerCircleAnimator = ObjectAnimator.ofFloat(vCircle, CircleView.OUTER_CIRCLE_RADIUS_PROGRESS, 0.1f, 1f);
outerCircleAnimator.setDuration(250);
outerCircleAnimator.setInterpolator(DECCELERATE_INTERPOLATOR);
ObjectAnimator innerCircleAnimator = ObjectAnimator.ofFloat(vCircle, CircleView.INNER_CIRCLE_RADIUS_PROGRESS, 0.1f, 1f);
innerCircleAnimator.setDuration(200);
innerCircleAnimator.setStartDelay(200);
innerCircleAnimator.setInterpolator(DECCELERATE_INTERPOLATOR);
ObjectAnimator starScaleYAnimator = ObjectAnimator.ofFloat(ivStar, ImageView.SCALE_Y, 0.2f, 1f);
starScaleYAnimator.setDuration(350);
starScaleYAnimator.setStartDelay(250);
starScaleYAnimator.setInterpolator(OVERSHOOT_INTERPOLATOR);
ObjectAnimator starScaleXAnimator = ObjectAnimator.ofFloat(ivStar, ImageView.SCALE_X, 0.2f, 1f);
starScaleXAnimator.setDuration(350);
starScaleXAnimator.setStartDelay(250);
starScaleXAnimator.setInterpolator(OVERSHOOT_INTERPOLATOR);
ObjectAnimator dotsAnimator = ObjectAnimator.ofFloat(vDotsView, DotsView.DOTS_PROGRESS, 0, 1f);
dotsAnimator.setDuration(900);
dotsAnimator.setStartDelay(50);
dotsAnimator.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);
animatorSet.playTogether(
outerCircleAnimator,
innerCircleAnimator,
starScaleYAnimator,
starScaleXAnimator,
dotsAnimator
);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animation) {
vCircle.setInnerCircleRadiusProgress(0);
vCircle.setOuterCircleRadiusProgress(0);
vDotsView.setCurrentProgress(0);
ivStar.setScaleX(1);
ivStar.setScaleY(1);
}
@Override
public void onAnimationEnd(Animator animation) {
Log.d("=============", "outer"+vCircle.getOuterCircleRadiusProgress());
Log.d("=============", "inner"+vCircle.getInnerCircleRadiusProgress());
}
});
animatorSet.start();
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
ivStar.animate().scaleX(0.7f).scaleY(0.7f).setDuration(150).setInterpolator(DECCELERATE_INTERPOLATOR);
setPressed(true);
break;
case MotionEvent.ACTION_MOVE:
float x = event.getX();
float y = event.getY();
boolean isInside = (x > 0 && x < getWidth() && y > 0 && y < getHeight());
if (isPressed() != isInside) {
setPressed(isInside);
}
break;
case MotionEvent.ACTION_UP:
ivStar.animate().scaleX(1).scaleY(1).setInterpolator(DECCELERATE_INTERPOLATOR);
if (isPressed()) {
performClick();
setPressed(false);
}
break;
}
return true;
}
}
| [
"mddien1994@gmail.com"
] | mddien1994@gmail.com |
b81c1eaf8c6885cb5a564a8ac7dc79bb48a9d854 | 6b6a5679d0aa96157556d46172be57b51c1f8a2e | /OlaJdbc/src/org/libertas/dao/CidadeDao.java | 3d61c6bda8ad29c50c9a2b17be009800bee5f262 | [] | no_license | Marques-Alexandre/Relacionamento_Hibernate | 6c43905f94eaed0183dbcbc53b7b7026ee333854 | ee3be110ee83d3fa16dc99ba49ba979e3ee65075 | refs/heads/master | 2023-03-21T15:43:27.762521 | 2021-03-22T15:45:12 | 2021-03-22T15:45:12 | 350,398,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,099 | java | package org.libertas.dao;
import java.util.Collection;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
import org.libertas.exerciciorelacionamento.Cidade;
public class CidadeDao {
private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("ConexaoHibernate");
private static EntityManager em = emf.createEntityManager();
public List<Cidade> listar() {
Query query = em.createQuery("SELECT p FROM Cidade p");
List<Cidade> lista = query.getResultList();
return lista;
}
public void inserir(Cidade p ) {
em.getTransaction().begin();
em.persist(p);
em.getTransaction().commit();
}
public void alterar(Cidade p) {
em.getTransaction().begin();
em.merge(p);
em.getTransaction().commit();
}
public void excluir(Cidade p) {
em.getTransaction().begin();
em.remove(em.merge(p));
em.getTransaction().commit();
}
public Cidade consultar(int id) {
Cidade p = em.find(Cidade.class, id);
return p;
}
}
| [
"64232193+Marques-Alexandre@users.noreply.github.com"
] | 64232193+Marques-Alexandre@users.noreply.github.com |
7c13306892dd3f0e1515a5a48767ae6dc37065a6 | 975e2d6777f807195ebbe4af2dc3c6742271965b | /app/src/main/java/com/example/gmusic/Activitys/MainActivity.java | 1235f9fa6635cc36e6809e2f09d5b946676a2eab | [] | no_license | Yujinginging/GMusic | afc30d3d4a8e91b1c01737f5c565c279628a83f4 | 781972b9b502a3db19208169002a9d12693160f1 | refs/heads/master | 2020-09-15T16:19:48.101202 | 2019-11-22T23:15:09 | 2019-11-22T23:15:09 | 223,501,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,199 | java | package com.example.gmusic.Activitys;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.gmusic.Fragments.Frontpage;
import com.example.gmusic.R;
public class MainActivity extends AppCompatActivity {
private ImageView imageView;
private TextView tv1,tv2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = (ImageView)findViewById(R.id.imageView2);
tv1 = (TextView) findViewById(R.id.textView);
tv2 = (TextView) findViewById(R.id.tv_register);
//show front page
toFrontPage();
}
//directly jump to the front page
public void toFrontPage()
{
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fm.beginTransaction();
fragmentTransaction.replace(R.id.frameLayout, new Frontpage());
fragmentTransaction.commit();
}
}
| [
"gyj9907@gmail.com"
] | gyj9907@gmail.com |
bbfdeff191aac1f4e96077c93649a2a178dd12ab | 79f97ad715f29c0925ac05840db0410cc5c1857c | /algorithm/src/main/java/com/rotatingmind/math/ConsecutiveSumOfNumber.java | 9182130820dc0b5a7edbbc4c4e901a4658f2353a | [] | no_license | sandeeptiwari/RotatingMind | 545dbd5602500f3d23f2d2e5c847491b73a11f5d | a3dd7d46a384fc36f86233cbab5772f21c5257bf | refs/heads/master | 2023-06-21T13:51:05.499580 | 2022-10-27T16:26:08 | 2022-10-27T16:26:08 | 56,872,057 | 1 | 1 | null | 2023-06-14T23:40:42 | 2016-04-22T17:05:55 | Java | UTF-8 | Java | false | false | 3,574 | java | package com.rotatingmind.math;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class ConsecutiveSumOfNumber {
/**
* Consecutive Sum = (i -1).j + j.(j+1)/2
* where j = total number in progression;
* i = first term of progression
* @param args
*/
public static void main(String[] args) {
ConsecutiveSumOfNumber obj = new ConsecutiveSumOfNumber();
Scanner sc = new Scanner(System.in);
int cases = sc.nextInt();
while(cases >= 1) {
int N = sc.nextInt();
int[] arr = obj.getMostConsecutiveSeq(N);
int len = arr.length;
for (int i = 0; i < len; i++) {
System.out.print(arr[i] + " ");
}
cases--;
}
}
/**
*
* @param num
* @return
*/
public List<Groups> getAllPossibleCombination(int num) {
List<Groups> groups = new ArrayList<>();
for (int i = 1, j=1; i < num - 1; j++) {
int value = getConsecutiveSum(i, j);
if(value == 21) {
Groups group = new Groups();
group.setFirstTerm(i);
group.setNumberOfTerms(j - i);
i++;
j = i;
groups.add(group);
} else if(j >= num) {
i++;
j = i;
}
}
return groups;
}
public int getConsecutiveSum(int firstNum, int n) {
return (firstNum - 1) * n + n * (n + 1) / 2;
}
public double getNthTerm(int sum, int a) {
double b = (a << 1) - 1;
double ac = sum << 1;
double twoTimeFirstTerm = a << 1;
double rootValue = Math.sqrt(b * b + 4 * ac);
Double value1 = (-b + rootValue) / twoTimeFirstTerm;
Double value2 = (-b - rootValue) / twoTimeFirstTerm;
return Math.abs(value1) % 1 == 0 ? Math.abs(value1.intValue()) : Math.abs(value2.intValue());
}
public List<Groups> getNumberOfConsecutiveGroup(int N) {
List<Groups> groups = new ArrayList<>();
int n = 1;
int a = N << 1;
while(a - (n * n) + n > 0) {
int twiceOfn = n << 1;
float firstTerm = (a - (n * n) + n) / (float)twiceOfn;
if(firstTerm % 1 == 0 && firstTerm != N) {
Groups group = new Groups();
group.setFirstTerm((int)firstTerm);
group.setNumberOfTerms(n);
groups.add(group);
}
n++;
}
return groups;
}
public int[] getMostConsecutiveSeq(int N) {
int n = 1;
int sum = N << 1;
List<int[]> combinations = new ArrayList<>();
while((sum - (n * n) + n) > 0) {
int arr[] = new int[2];
int a = n << 1;
float firstTerm = (sum - (n * n) + n) / (float)a;
if (firstTerm % 1 == 0 && firstTerm != N) {
if(combinations.size() == 0) {
arr[0] = (int)firstTerm;
arr[1] = n;
} else if (combinations.get(0)[1] < n){
arr[0] = (int)firstTerm;
arr[1] = n;
}
combinations.add(0, arr);
}
n++;
}
int first = combinations.get(0)[0];
int len = combinations.get(0)[1] + first;
int a[] = new int[combinations.get(0)[1]];
for(int i = first, j = 0; i < len; i++) {
a[j++] = i;
}
return a;
}
}
| [
"sandeep15mca@gmail.com"
] | sandeep15mca@gmail.com |
f8b34f5de38d2c9775cb13f6e6e2cbef2f6d781d | 5bc5aea757126b6c84422a840ef084e41686b580 | /RemoveCar.java | bdbff5166b858b413e88f680b01427c6497af382 | [] | no_license | sohomghosh/Automated_Car_Rental_System | 6ad8cf6bd0ec466e98a74c03f255039ceb8c8c4a | bf220767afb53c9d225d473aa529d3bd1e022622 | refs/heads/master | 2020-12-11T22:17:44.870950 | 2016-01-06T02:52:37 | 2016-01-06T02:52:37 | 49,107,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,265 | java | package p1;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.GridLayout;
import java.util.ArrayList;
public class RemoveCar extends JFrame implements ActionListener
{
private JLabel l1,l2;
private JTextField tid,tno;
private JButton brem,bdis,bback;
public RemoveCar()
{
super("Removing Car Window...");
ArrayList<RegData> list4 = new ArrayList<RegData>();
Container c=getContentPane();
c.setLayout(new GridLayout(4,2));
tno=new JTextField(20);
brem=new JButton("Remove Car/s");
brem.addActionListener(this);
bback=new JButton("Back");
bback.addActionListener(this);
bdis=new JButton("Display Car List");
bdis.addActionListener(this);
Font f=new Font("Chiller",Font.BOLD,27);
l1=new JLabel("to go back to admin->");
l1.setFont(f);
l1.setForeground(Color.GREEN);
Font f1=new Font("Chiller",Font.BOLD,27);
l2=new JLabel("Car Number");
l2.setFont(f1);
l2.setForeground(Color.RED);
ImageIcon keyhand=new ImageIcon("cross.jpg");
ImageIcon ret=new ImageIcon("r1.jpg");
c.add(new JLabel(keyhand));c.add(new JLabel(ret));
c.add(l2);c.add(tno);
c.add(brem);c.add(bdis);
c.add(l1);c.add(bback);
setSize(475, 475);
setLocation(465, 175);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
String no;
@Override
public void actionPerformed(ActionEvent arg)
{
no=tno.getText();
SearchCar scr = new SearchCar();
int a = scr.searchNo(no);
if(arg.getSource()==brem)
{
if(a == -1)
{
JOptionPane.showMessageDialog(this, "No registered Car in that number");
tno.setText("");
}
else
{
new DeleteCar(a);
JOptionPane.showMessageDialog(this, "Car deleted From List Successfully...");
tno.setText("");
}
}
if(arg.getSource()==bdis)
{
new DisplayCarList();
}
if(arg.getSource()==bback)
{
new Administration("Welcome to admin...");
setVisible(false);
}
}
}
| [
"sohom1ghosh@gmail.com"
] | sohom1ghosh@gmail.com |
a11da2063466fc42e8b6d08291ba4c6a0d09ef9f | 58cf956f645ed51dedbfa41d8ba4e3d5bdac637a | /src/main/java/com/tracker/app/repository/UserRepository.java | e179a970c3eaee48a48a449f1f521b7b02b22114 | [] | no_license | pratikshakulkarni/TicketTracker | 7efba19520ab0a3f691c4dc14181fa3f97031dae | 433dbd1b646f69c1b26d64da6941d38d0c5dbc4d | refs/heads/master | 2023-03-30T10:37:44.208211 | 2021-04-06T22:24:22 | 2021-04-06T22:24:22 | 333,092,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.tracker.app.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.tracker.app.model.User;
@Repository("userRepository")
public interface UserRepository extends JpaRepository<User, Integer> {
public User findByEmail(String email);
}
| [
"Kulkarnipratiksha1997@gmail.com"
] | Kulkarnipratiksha1997@gmail.com |
d4ba971a92f5afe0abe4547e6e8c6dd014e2b85e | 197b967a025647545fc674a42c05dbf448c7ecc7 | /src/main/java/edu/cmu/gizmo/management/taskmanager/TaskManager.java | 89fa6e6f77b27ae3817f99998fcd2401b62a2f0c | [] | no_license | vakhal/gp | 8a2df80a5d01f0297d7317b0ca283a3c1dbe0160 | feb0ffa7fdda7ed997f914de783ad278f541e89e | refs/heads/master | 2021-05-04T21:46:28.132651 | 2018-02-02T16:35:02 | 2018-02-02T16:35:02 | 119,974,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,709 | java | /*
* TaskManager.java 1.0 2012-06-29
*/
package edu.cmu.gizmo.management.taskmanager;
import edu.cmu.gizmo.management.robot.Robot;
import edu.cmu.gizmo.management.robot.RobotFactory;
import edu.cmu.gizmo.management.robot.RobotFactory.RobotModel;
import edu.cmu.gizmo.management.robot.RobotTaskProxy;
import edu.cmu.gizmo.management.taskbus.GizmoTaskBus;
import edu.cmu.gizmo.management.taskbus.messages.*;
import edu.cmu.gizmo.management.taskmanager.TaskExecutor.TaskParameter;
import edu.cmu.gizmo.management.taskmanager.TaskExecutor.TaskType;
import edu.cmu.gizmo.management.taskmanager.TaskStatus.TaskStatusValue;
import edu.cmu.gizmo.management.taskmanager.exceptions.TaskConfigurationIncompleteException;
import edu.cmu.gizmo.management.taskmanager.taskplanner.RobotFocusedTaskPlanEvaluator;
import edu.cmu.gizmo.management.taskmanager.taskplanner.TaskPlan;
import edu.cmu.gizmo.management.taskmanager.taskplanner.TaskPlanner;
import javax.jms.*;
import java.util.Observable;
import java.util.Observer;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
/**
* The main task manager. The responsibilities of the Task Manager include
* starting tasks, ending tasks, and conflict management
*
* @author Arpita Shrivastava
* @verson 1.0 2012-060-29
*/
public class TaskManager implements Observer, MessageListener {
/**
* the task planner responsible for managing task conflicts
*/
private final TaskPlanner taskPlanner;
/**
* The connection to the task bus.
*/
private final GizmoTaskBus bus;
/**
* task messages fielded by the TaskManager
*/
private final String[] subscriptions = {
TaskMessage.LOAD_TASK,
TaskMessage.CANCEL_TASK
};
/**
* The CoBot 3 robot.
*/
public Robot robot;
/**
* provide a task interface to the robot
*/
private RobotTaskProxy robotTaskProxy;
/**
* the list of running tasks.
*/
private ConcurrentHashMap<Integer, TaskExecutor> runningTasks;
/**
* The task input channel.
*/
private MessageConsumer input;
/**
* The pool of task IDs.
*/
private Integer taskIdPool;
/**
* Create a new TaskManager.
*/
public TaskManager() {
bus = GizmoTaskBus.connect();
taskPlanner = new TaskPlanner(new RobotFocusedTaskPlanEvaluator());
if (bus == null) {
System.out
.println("[TaskManager] Could not connect to the Task bus");
} else {
// connect to the bus
input = bus.getTaskConsumer(subscriptions);
try {
input.setMessageListener(this);
} catch (final JMSException e) {
e.printStackTrace();
}
taskIdPool = 0;
runningTasks = new ConcurrentHashMap<Integer, TaskExecutor>();
robotTaskProxy = null;
robot = null;
/*
* start a new thread to connect the robot ... in the future this
* will become more sophisticated
*/
new Thread(new Runnable() {
@Override
public void run() {
// connect the robot and task proxy
robot =
RobotFactory.newRobot(RobotModel.COBOT3);
robotTaskProxy =
RobotFactory.newTaskProxy(RobotModel.COBOT3);
if (robotTaskProxy == null) {
throw new
NullPointerException(
"RobotTaskProxy could not be connected!");
}
new Thread((Runnable) robotTaskProxy).start();
System.out.println("[TaskManager] Starting Task proxy: " +
robotTaskProxy.getClass());
}
}).start();
}
}
/**
* The main method for the <code>TaskManager</code>
*
* @param args the arguments
*/
public static void main(final String[] args) {
new TaskManager();
}
/**
* Load a new task. This method loads the new task and creates the task
* executor. The newly created task executor is not yet running.
*
* @param rsvp the new <code>TaskReservation</code>
* @return the created <code>TaskExecutor</code> or null.
*/
public TaskExecutor loadNewTask(final TaskReservation rsvp) {
// connect to the robot - this blocks until the robot is *first*
// connected
while (robot == null) {
try {
Thread.sleep(1000);
} catch (final InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
}
if (rsvp == null) {
return null;
}
/*
* Get taskType and taskPlan from the Scheduling database associated
* with the taskId
*/
final TaskExecutor.TaskType taskType = rsvp.getTaskExeType();
final String task = rsvp.getTaskPlan();
try {
final ConcurrentHashMap<TaskParameter, Object> config = new ConcurrentHashMap<TaskParameter, Object>();
// increment the task ID pool to keep tasks unique
final Integer thisTaskId = taskIdPool.intValue();
config.put(TaskParameter.ROBOT, robot);
config.put(TaskParameter.TYPE, taskType);
config.put(TaskParameter.TASK, task);
config.put(TaskParameter.ID, thisTaskId);
config.put(TaskParameter.RESERVATION, rsvp);
// handle task ID wrapping
taskIdPool = ((taskIdPool + 1) == Integer.MAX_VALUE) ? 1
: taskIdPool + 1;
return new TaskExecutor(config);
} catch (final TaskConfigurationIncompleteException e) {
// we need to handle this better
e.printStackTrace();
} catch (final Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Start a new task. This method configures and starts a task.
*
* @param rsvp the rsvp
*/
public synchronized void startNewTask(final TaskExecutor newTaskExe) {
/*
* Start a new task executor and set it running
*/
System.out.println("[TaskManager] Starting new "
+ newTaskExe.getReservation().getTaskName() + " task ("
+ newTaskExe.getTaskId() + ") from "
+ newTaskExe.getReservation().getTaskRequester());
runningTasks.put(newTaskExe.getTaskId(), newTaskExe);
newTaskExe.addObbserver(this);
// start the new task as a separate thread
new Thread(newTaskExe).start();
}
/*
* (non-Javadoc)
*
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
@Override
public synchronized void update(final Observable o, final Object update) {
try {
final TaskStatus status = (TaskStatus) update;
if (!bus.isConnected()) {
return;
}
final Integer tid = status.getTaskId();
final MessageProducer taskControlPub = bus.getTaskProducer();
// inform the client that the task is complete
if (status.getStatus() == TaskStatusValue.COMPLETE) {
System.out.println("[TaskManager] Task Complete");
final TaskCompleteMessage tcm = new TaskCompleteMessage(tid);
taskControlPub.send(bus.generateMessage(tcm,
TaskMessage.TASK_COMPLETE));
runningTasks.remove(tid);
}
/*
* If the submitted executor is READY then it has been accepted The
* READY message should include the task-specific settings for the
* task, such as the I/O connections.
*/
else if (status.getStatus() == TaskStatusValue.READY) {
System.out
.println("[TaskManager] new Task ready (" + tid + ")");
final TaskExecutor exe = runningTasks.get(tid);
final TaskReservation rsvp = exe.getReservation();
Vector<TaskInputMap> routes = null;
// if this is a scripted task then send the I/O plan
if (exe.getTaskType() == TaskType.SCRIPT_TASK) {
if (status.getStatusMessage() instanceof Vector<?>) {
routes = (Vector<TaskInputMap>) status.getStatusMessage();
for (TaskInputMap r : routes) {
System.out.println("[TaskManager] I/O Map: " + r.toString());
}
}
} else {
// no settings
routes = null;
}
final TaskReadyMessage ready = new TaskReadyMessage(tid,
rsvp, routes);
taskControlPub.send(
bus.generateMessage(ready,
TaskMessage.TASK_READY));
}
/*
* The task is in error. Currently this just ends the task
*/
else if (status.getStatus() == TaskStatusValue.ERROR) {
System.out.println("[TaskManager] ERROR: "
+ status.getStatusMessage());
final CancelTaskMessage cancel =
new CancelTaskMessage(
status.getTaskId(),
TaskRequester.TASK_MANAGER,
(String) status.getStatusMessage()); // this is the reason that the task was canceled
taskControlPub.send(bus.generateMessage(cancel,
TaskMessage.CANCEL_TASK));
}
/*
* The task has been terminated
*/
else if (status.getStatus() == TaskStatusValue.CANCELED) {
System.out.println("[TaskManager] Task terminated ("
+ status.getTaskId() + ")");
final CancelTaskMessage cancel =
new CancelTaskMessage(
status.getTaskId(),
TaskRequester.TASK_MANAGER,
(String) status.getStatusMessage()); // this is the reason that the task was canceled
taskControlPub.send(bus.generateMessage(cancel,
TaskMessage.CANCEL_TASK));
}
bus.releaseProducer(taskControlPub);
} catch (final JMSException e) {
e.printStackTrace();
}
}
/*
* (non-Javadoc)
*
* @see javax.jms.MessageListener#onMessage(javax.jms.Message)
*/
@Override
public synchronized void onMessage(final Message busMessage) {
try {
final ObjectMessage om = (ObjectMessage) busMessage;
final TaskMessage message = (TaskMessage) om.getObject();
// handle the message
handleTaskMessage(message);
} catch (final JMSException e) {
e.printStackTrace();
}
}
/**
* Handle message from the task bus.
*
* @param message the input message to the Task Manager
*/
public final synchronized void handleTaskMessage(final TaskMessage message) {
/*
* Load a new task. The steps for loading a new task are as follows:
*
* 1. evaluate any conflicts and produce a plan 2. execute the plan,
* which may involve killing other tasks 3. profit!
*/
if (message.getMessageType() == TaskMessage.LOAD_TASK) {
final LoadTaskMessage newTaskReq = (LoadTaskMessage) message;
// create an executor for this new task
final TaskExecutor newTaskExe =
loadNewTask(newTaskReq.getReservation());
if (newTaskExe != null) {
// evaluate the new task request to determine if it can be run
final TaskPlan executionPlan =
taskPlanner.evaluate(newTaskExe, runningTasks.values());
/*
* check to see if the new task was
* accepted - it is in the list of tasks to start
*/
if (executionPlan.getBirthList().contains(newTaskExe)) {
System.out.println("[TaskManager] New task accepted: "
+ newTaskExe.getReservation().getTaskName()
+ "(" + newTaskExe.getTaskId() + ")");
// execute the task
executeTaskPlan(executionPlan);
} else {
// the new task was rejected!
final MessageProducer taskPub = bus.getTaskProducer();
try {
taskPub.send(
bus.generateMessage(
new RejectTaskMessage(
newTaskExe.getReservation(),
"New task could not be accepted"),
TaskMessage.REJECT_TASK)
);
} catch (JMSException e) {
e.printStackTrace();
}
bus.releaseProducer(taskPub);
}
} else {
System.out.println(
"[TaskManager] Could not start new task because it is null");
}
}
/*
* Cancel a running task
*/
else if (message.getMessageType() == TaskMessage.CANCEL_TASK) {
final CancelTaskMessage cancel = (CancelTaskMessage) message;
// Cancel the task if the request is not from the task manager
if (cancel.getRequester() != TaskRequester.TASK_MANAGER) {
if (runningTasks.containsKey(cancel.getTaskId())) {
final TaskExecutor task =
runningTasks.get(cancel.getTaskId());
task.terminate(cancel.getReason()); // kill the task
}
}
}
}
/**
* Executing a task plan means killing the things to kill and starting the
* things to start
*
* @param plan the <code>TaskPlan</code> to execute.
*/
public void executeTaskPlan(final TaskPlan plan) {
// kill the old tasks
for (final TaskExecutor toKill : plan.getKillList()) {
toKill.terminate(plan.getKillReason());
}
// start the new tasks
for (final TaskExecutor toLive : plan.getBirthList()) {
startNewTask(toLive);
}
}
/**
* Unload the task manager by ending all tasks, closing bus connections, and
* shutting down the robot task proxy (if it is running).
*/
public synchronized void unload() {
// kill everything
for (TaskExecutor exe : runningTasks.values()) {
exe.terminate("Sorry, the Gizmo Task Manager is unloading");
}
if (robotTaskProxy != null) {
robotTaskProxy.uninstallTaskProxy();
}
bus.releaseConsumer(input);
bus.disconnect();
}
/**
* The list of entities asking for tasks.
*/
public static enum TaskRequester {
/**
* The task client.
*/
TASK_CLIENT,
/**
* The robot proxy.
*/
ROBOT_CLIENT,
/**
* The task manager
*/
TASK_MANAGER
}
} | [
"chukaev@live.ru"
] | chukaev@live.ru |
7c854a3494052cc3960bed51c51a6e420c948faa | d8654ddb8df6789a5c2d867804b8f40aa6c1a88b | /WebTTKhoaHoc/src/com/dainguyen/Model/Student.java | 676dc9c306a1bc7d153e528b43b2e2eeba74bf42 | [] | no_license | nguyendai217/WebKhoaHoc | be7a328761e958f3cd454a34732fd05ad23f7872 | e920c0f910bfb30e32e09fc219428e7f7acb66b9 | refs/heads/master | 2022-04-21T10:51:47.350694 | 2020-04-25T11:13:19 | 2020-04-25T11:13:19 | 257,814,922 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,503 | java | package com.dainguyen.Model;
public class Student {
private int sc_id;
private String name;
private String birthday;
private String sex;
private String phonenumber;
private String mail;
private String avatar;
private float point;
private boolean confirm;
private String registeredClass;
private String registeredCourse;
public Student() {}
public Student(int sc_id, String name, String birthday, String sex, String phonenumber, String mail,
String avatar, float point, boolean confirm) {
this.sc_id = sc_id;
this.name = name;
this.birthday = birthday;
this.sex = sex;
this.phonenumber = phonenumber;
this.mail = mail;
this.avatar = avatar;
this.point = point;
this.confirm = confirm;
}
public Student(int sc_id, String name, String phonenumber, String mail,
String avatar, boolean confirm, String registeredClass, String registeredCourse) {
this.sc_id = sc_id;
this.name = name;
this.phonenumber = phonenumber;
this.mail = mail;
this.avatar = avatar;
this.confirm = confirm;
this.registeredClass = registeredClass;
this.registeredCourse = registeredCourse;
}
public int getSc_id() {
return sc_id;
}
public void setSc_id(int sc_id) {
this.sc_id = sc_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getPhonenumber() {
return phonenumber;
}
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public float getPoint() {
return point;
}
public void setPoint(float point) {
this.point = point;
}
public boolean isConfirm() {
return confirm;
}
public void setConfirm(boolean confirm) {
this.confirm = confirm;
}
public String getRegisteredClass() {
return registeredClass;
}
public void setRegisteredClass(String registeredClass) {
this.registeredClass = registeredClass;
}
public String getRegisteredCourse() {
return registeredCourse;
}
public void setRegisteredCourse(String registeredCourse) {
this.registeredCourse = registeredCourse;
}
}
| [
"DaiNguyen@192.168.1.16"
] | DaiNguyen@192.168.1.16 |
5067ec8dd87af2cdedef1a0995e35a2745ce8bcc | 2c02fde7f81ecbdcabe695197220928b43cabcd0 | /pinyougou-shop-web/src/main/java/com/pinyougou/shop/controller/OrderController.java | 90c98ef85de3dad9a29542b7699a97fee75b55ab | [] | no_license | guanxin0227/git-pinYouGouProject | 5d834a9347146210e0877dc887b9715f07d48ffa | 5b0e586b3752664890b8db3ed1d9d41dc50505c4 | refs/heads/master | 2022-12-28T23:39:59.428142 | 2020-03-27T11:30:54 | 2020-03-27T11:30:54 | 238,388,202 | 0 | 0 | null | 2022-12-16T08:58:44 | 2020-02-05T07:01:02 | JavaScript | UTF-8 | Java | false | false | 3,188 | java | package com.pinyougou.shop.controller;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import com.pinyougou.http.Result;
import com.pinyougou.model.Order;
import com.pinyougou.sellergoods.service.OrderService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/order")
public class OrderController {
@Reference
private OrderService orderService;
/***
* 根据ID批量删除
* @param ids
* @return
*/
@RequestMapping(value = "/delete")
public Result delete(@RequestBody List<Long> ids){
try {
//根据ID删除数据
int dcount = orderService.deleteByIds(ids);
if(dcount>0){
return new Result(true,"删除成功");
}
} catch (Exception e) {
e.printStackTrace();
}
return new Result(false,"删除失败");
}
/***
* 修改信息
* @param order
* @return
*/
@RequestMapping(value = "/update",method = RequestMethod.POST)
public Result modify(@RequestBody Order order){
try {
//根据ID修改Order信息
int mcount = orderService.updateOrderById(order);
if(mcount>0){
return new Result(true,"修改成功");
}
} catch (Exception e) {
e.printStackTrace();
}
return new Result(false,"修改失败");
}
/***
* 根据ID查询Order信息
* @param id
* @return
*/
@RequestMapping(value = "/{id}",method = RequestMethod.GET)
public Order getById(@PathVariable(value = "id")long id){
//根据ID查询Order信息
Order order = orderService.getOneById(id);
return order;
}
/***
* 增加Order数据
* @param order
* 响应数据:success
* true:成功 false:失败
* message
* 响应的消息
*
*/
@RequestMapping(value = "/add",method = RequestMethod.POST)
public Result add(@RequestBody Order order){
try {
//执行增加
int acount = orderService.add(order);
if(acount>0){
//增加成功
return new Result(true,"增加成功");
}
} catch (Exception e) {
e.printStackTrace();
}
return new Result(false,"增加失败");
}
/***
* 分页查询数据
* 获取JSON数据
* @return
*/
@RequestMapping(value = "/list",method = RequestMethod.POST)
public PageInfo<Order> list(@RequestBody Order order,@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
return orderService.getAll(order,page, size);
}
/***
* 查询所有
* 获取JSON数据
* @return
*/
@RequestMapping(value = "/list",method = RequestMethod.GET)
public List<Order> list() {
return orderService.getAll();
}
}
| [
"CST123456"
] | CST123456 |
8f04361a86e4bc611d1a3c7ccee949a47b44756b | f1a4e131a1301419ec1d361139bc43401fb204a4 | /baselib/src/main/java/com/yanb/daqsoft/baselib/mvvmbase/base/BaseApplication.java | 4388a112e421097654d17568131d5208320a4179 | [] | no_license | 1976222027/BaseAndroid | a18cd1e094ee25343e7872cd4f84b77bf54af23a | ce13d42828b7e06becdbba37f3e54d6ed7c801e4 | refs/heads/master | 2020-07-08T13:07:29.969732 | 2019-08-21T09:56:17 | 2019-08-21T09:56:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,176 | java | package com.yanb.daqsoft.baselib.mvvmbase.base;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.support.annotation.NonNull;
import com.yanb.daqsoft.baselib.mvvmbase.utils.Utils;
/**
* Created by goldze on 2017/6/15.
*/
public class BaseApplication extends Application {
private static Application sInstance;
@Override
public void onCreate() {
super.onCreate();
setApplication(this);
}
/**
* 当主工程没有继承BaseApplication时,可以使用setApplication方法初始化BaseApplication
*
* @param application
*/
public static synchronized void setApplication(@NonNull Application application) {
sInstance = application;
//初始化工具类
Utils.init(application);
//注册监听每个activity的生命周期,便于堆栈式管理
application.registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
AppManager.getAppManager().addActivity(activity);
}
@Override
public void onActivityStarted(Activity activity) {
}
@Override
public void onActivityResumed(Activity activity) {
}
@Override
public void onActivityPaused(Activity activity) {
}
@Override
public void onActivityStopped(Activity activity) {
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
}
@Override
public void onActivityDestroyed(Activity activity) {
AppManager.getAppManager().removeActivity(activity);
}
});
}
/**
* 获得当前app运行的Application
*/
public static Application getInstance() {
if (sInstance == null) {
throw new NullPointerException("please inherit BaseApplication or call setApplication.");
}
return sInstance;
}
}
| [
"760375443@qq.com"
] | 760375443@qq.com |
c104caf3dcbf6b198a486bb4ecf075c3b4c84f0c | 167bf4c3133382d6d2db14467aff3b7403ab6a9a | /src/test/java/module/rest/auxiliaries/AuxiliaryGetRestTest.java | b9048acc5b0d1be10e0f3c44b313120464426d1d | [] | no_license | auxpro/rest | 47ccbcde0a21c6eea8ea2b1fcac654544b54265f | 60fa93f68af52a8e650e97bff84403952bbf8086 | refs/heads/master | 2016-08-12T02:50:00.562360 | 2016-05-07T22:16:19 | 2016-05-07T22:16:19 | 54,881,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,600 | java | package module.rest.auxiliaries;
import javax.ws.rs.core.Response;
import org.ap.web.rest.entity.user.AuxiliaryBean;
import org.ap.web.rest.servlet.auxiliaries.AuxiliariesServlet;
import org.junit.Test;
import junit.framework.TestCase;
import module.rest.RestTestBase;
import tools.AssertHelper;
import tools.TestData;
public class AuxiliaryGetRestTest extends RestTestBase {
public AuxiliaryGetRestTest() {
super(AuxiliariesServlet.PATH);
}
/* TEST CASES */
/* Negative Testing */
// users/{userId} GET
@Test
public void testI_getUser_getUnknownAuxiliairy() throws Exception {
Response rsp = prepare("/dummy", userAdmin.getName(), userAdmin.getPassword()).get();
TestCase.assertEquals(404, rsp.getStatus());
TestCase.assertTrue(rsp.hasEntity());
}
@Test
public void testI_getUser_asUnknownUser() throws Exception {
Response rsp = prepare("/" + userAux1.getName(), "dummy", "dummy").get();
TestCase.assertEquals(401, rsp.getStatus());
TestCase.assertFalse(rsp.hasEntity());
}
@Test
public void testI_getUser_invalidPassword() throws Exception {
Response rsp = prepare("/" + userAux1.getName(), userAux1.getName(), "dummy").get();
TestCase.assertEquals(401, rsp.getStatus());
TestCase.assertFalse(rsp.hasEntity());
}
/* Positive Testing */
// users/{userId} GET
@Test
public void testV_getAuxiliaryResponse() throws Exception {
Response rsp = prepare("/" + userAux1.getName(), userAdmin.getName(), userAdmin.getPassword()).get();
TestCase.assertEquals(200, rsp.getStatus());
TestCase.assertTrue(rsp.hasEntity());
}
@Test
public void testV_getAuxiliaryObject_AsAdmin() throws Exception {
AuxiliaryBean userAux = prepare("/" + userAux1.getName(), userAdmin.getName(), userAdmin.getPassword()).get(AuxiliaryBean.class);
AssertHelper.assertAuxiliary(userAux1, userAux);
}
@Test
public void testV_getAuxiliaryObject_AsSelf() throws Exception {
AuxiliaryBean userAux = prepare("/" + userAux1.getName(), userAux1.getName(), userAux1.getPassword()).get(AuxiliaryBean.class);
AssertHelper.assertAuxiliary(userAux1, userAux);
}
@Test
public void testV_getAuxiliaryObject_AsOther() throws Exception {
AuxiliaryBean userAux2 = TestData.getAuxiliaryFromJson("users_aux2.json");
AuxiliaryBean userAux = prepare("/" + userAux1.getName(), userAux2.getName(), userAux2.getPassword()).get(AuxiliaryBean.class);
// Informations are private
userAux1.setName(null);
userAux1.setPassword(null);
userAux1.setEmail(null);
userAux1.setActive(false);
userAux1.setTutoSkipped(false);
AssertHelper.assertAuxiliary(userAux1, userAux);
}
}
| [
"ash.uncover@gmail.com"
] | ash.uncover@gmail.com |
5a50b279853515eb5247b1750871091b2da1ecad | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/Jsoup-87/org.jsoup.nodes.Element/BBC-F0-opt-40/tests/28/org/jsoup/nodes/Element_ESTest_scaffolding.java | 31e718126dfe74456b971d3dca33d1c205e5d6b9 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 17,982 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Fri Oct 22 21:24:21 GMT 2021
*/
package org.jsoup.nodes;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class Element_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.jsoup.nodes.Element";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.dir", "/experiment");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Element_ESTest_scaffolding.class.getClassLoader() ,
"org.jsoup.nodes.Document$QuirksMode",
"org.jsoup.parser.HtmlTreeBuilderState$18",
"org.jsoup.select.StructuralEvaluator$ImmediateParent",
"org.jsoup.parser.HtmlTreeBuilderState$19",
"org.jsoup.helper.ChangeNotifyingArrayList",
"org.jsoup.parser.HtmlTreeBuilderState$16",
"org.jsoup.parser.HtmlTreeBuilderState$17",
"org.jsoup.parser.HtmlTreeBuilderState$14",
"org.jsoup.parser.HtmlTreeBuilderState$15",
"org.jsoup.select.Evaluator$IndexEvaluator",
"org.jsoup.select.Evaluator$IsOnlyOfType",
"org.jsoup.nodes.Entities$CoreCharset",
"org.jsoup.nodes.Element",
"org.jsoup.parser.HtmlTreeBuilderState$12",
"org.jsoup.parser.HtmlTreeBuilderState$13",
"org.jsoup.parser.HtmlTreeBuilderState$10",
"org.jsoup.parser.HtmlTreeBuilderState$11",
"org.jsoup.select.NodeTraversor",
"org.jsoup.select.Evaluator$MatchesOwn",
"org.jsoup.select.CombiningEvaluator$And",
"org.jsoup.parser.Token$EndTag",
"org.jsoup.nodes.Document",
"org.jsoup.parser.HtmlTreeBuilder",
"org.jsoup.nodes.FormElement",
"org.jsoup.select.StructuralEvaluator",
"org.jsoup.select.Evaluator$IndexEquals",
"org.jsoup.select.Selector$SelectorParseException",
"org.jsoup.parser.Token$Tag",
"org.jsoup.nodes.XmlDeclaration",
"org.jsoup.parser.Token$Doctype",
"org.jsoup.parser.HtmlTreeBuilderState$23",
"org.jsoup.parser.HtmlTreeBuilderState$24",
"org.jsoup.select.Evaluator$Tag",
"org.jsoup.parser.HtmlTreeBuilderState$21",
"org.jsoup.nodes.Document$OutputSettings$Syntax",
"org.jsoup.parser.HtmlTreeBuilderState$22",
"org.jsoup.parser.HtmlTreeBuilderState$20",
"org.jsoup.parser.Token$1",
"org.jsoup.internal.StringUtil",
"org.jsoup.parser.Tokeniser",
"org.jsoup.nodes.Comment",
"org.jsoup.select.Evaluator$IndexGreaterThan",
"org.jsoup.nodes.LeafNode",
"org.jsoup.select.Selector",
"org.jsoup.select.Evaluator$AttributeWithValueEnding",
"org.jsoup.select.StructuralEvaluator$ImmediatePreviousSibling",
"org.jsoup.select.Collector$FirstFinder",
"org.jsoup.nodes.Node",
"org.jsoup.parser.HtmlTreeBuilderState",
"org.jsoup.select.Evaluator$AttributeStarting",
"org.jsoup.nodes.DataNode",
"org.jsoup.nodes.Attributes",
"org.jsoup.parser.XmlTreeBuilder",
"org.jsoup.nodes.Document$OutputSettings",
"org.jsoup.select.CombiningEvaluator",
"org.jsoup.select.Evaluator$ContainsData",
"org.jsoup.internal.Normalizer",
"org.jsoup.nodes.Attributes$Dataset$EntrySet",
"org.jsoup.nodes.Attributes$Dataset",
"org.jsoup.helper.Validate",
"org.jsoup.select.Evaluator$CssNthEvaluator",
"org.jsoup.parser.Token$Comment",
"org.jsoup.select.Evaluator$IsFirstOfType",
"org.jsoup.nodes.Element$NodeList",
"org.jsoup.parser.TokeniserState$56",
"org.jsoup.parser.TokeniserState$57",
"org.jsoup.parser.TokeniserState$58",
"org.jsoup.parser.TokeniserState$59",
"org.jsoup.parser.TokeniserState$52",
"org.jsoup.parser.TokeniserState$53",
"org.jsoup.parser.TreeBuilder",
"org.jsoup.parser.TokeniserState$54",
"org.jsoup.parser.TokeniserState$55",
"org.jsoup.nodes.PseudoTextElement",
"org.jsoup.parser.TokeniserState$50",
"org.jsoup.parser.TokeniserState$51",
"org.jsoup.parser.Parser",
"org.jsoup.select.Evaluator$IsEmpty",
"org.jsoup.select.Evaluator$AttributeWithValueMatching",
"org.jsoup.select.Evaluator$IsNthChild",
"org.jsoup.select.Evaluator$Class",
"org.jsoup.parser.TokeniserState$67",
"org.jsoup.nodes.Node$OuterHtmlVisitor",
"org.jsoup.parser.TokeniserState$63",
"org.jsoup.parser.TokeniserState$64",
"org.jsoup.parser.TokeniserState$65",
"org.jsoup.parser.Token",
"org.jsoup.parser.TokeniserState$66",
"org.jsoup.parser.TokeniserState$60",
"org.jsoup.select.Evaluator$AttributeKeyPair",
"org.jsoup.parser.TokeniserState$61",
"org.jsoup.parser.TokeniserState$62",
"org.jsoup.select.Evaluator$IsNthLastOfType",
"org.jsoup.parser.Tag",
"org.jsoup.parser.Token$Character",
"org.jsoup.select.Evaluator$IsLastOfType",
"org.jsoup.select.Evaluator$Attribute",
"org.jsoup.select.NodeFilter$FilterResult",
"org.jsoup.nodes.Entities",
"org.jsoup.select.Evaluator$AttributeWithValueContaining",
"org.jsoup.select.Elements",
"org.jsoup.parser.Token$CData",
"org.jsoup.nodes.Element$2",
"org.jsoup.select.Evaluator$AllElements",
"org.jsoup.nodes.Element$1",
"org.jsoup.nodes.TextNode",
"org.jsoup.select.Evaluator$AttributeWithValue",
"org.jsoup.select.Evaluator$AttributeWithValueNot",
"org.jsoup.parser.ParseErrorList",
"org.jsoup.nodes.BooleanAttribute",
"org.jsoup.SerializationException",
"org.jsoup.select.CombiningEvaluator$Or",
"org.jsoup.select.Evaluator$ContainsText",
"org.jsoup.select.Evaluator$Id",
"org.jsoup.select.Evaluator$IsNthOfType",
"org.jsoup.select.Collector",
"org.jsoup.select.Collector$Accumulator",
"org.jsoup.nodes.Attributes$Dataset$DatasetIterator",
"org.jsoup.parser.XmlTreeBuilder$1",
"org.jsoup.parser.CharacterReader",
"org.jsoup.select.Evaluator$IsFirstChild",
"org.jsoup.select.StructuralEvaluator$Root",
"org.jsoup.select.NodeVisitor",
"org.jsoup.parser.TokeniserState$2",
"org.jsoup.parser.TokeniserState$12",
"org.jsoup.parser.TokeniserState$1",
"org.jsoup.parser.TokeniserState$13",
"org.jsoup.nodes.Attributes$1",
"org.jsoup.parser.TokeniserState$14",
"org.jsoup.parser.TokeniserState$15",
"org.jsoup.select.Evaluator$AttributeWithValueStarting",
"org.jsoup.parser.Token$StartTag",
"org.jsoup.parser.Token$EOF",
"org.jsoup.parser.TokeniserState$10",
"org.jsoup.parser.TokeniserState$11",
"org.jsoup.nodes.DocumentType",
"org.jsoup.parser.TokeniserState$9",
"org.jsoup.parser.TokeniserState$8",
"org.jsoup.parser.TokeniserState$7",
"org.jsoup.parser.TokeniserState$6",
"org.jsoup.parser.TokeniserState$5",
"org.jsoup.parser.TokeniserState$4",
"org.jsoup.select.QueryParser",
"org.jsoup.parser.TokeniserState$3",
"org.jsoup.nodes.NodeUtils",
"org.jsoup.select.Evaluator$Matches",
"org.jsoup.select.Evaluator$IsOnlyChild",
"org.jsoup.parser.TokeniserState$16",
"org.jsoup.parser.TokeniserState$17",
"org.jsoup.parser.TokeniserState$18",
"org.jsoup.parser.TokeniserState$19",
"org.jsoup.nodes.Entities$1",
"org.jsoup.parser.TokeniserState$23",
"org.jsoup.UncheckedIOException",
"org.jsoup.parser.TokeniserState$24",
"org.jsoup.parser.TokeniserState$25",
"org.jsoup.parser.TokeniserState$26",
"org.jsoup.parser.TokeniserState$20",
"org.jsoup.parser.TokeniserState$21",
"org.jsoup.parser.TokeniserState$22",
"org.jsoup.parser.TokenQueue",
"org.jsoup.select.NodeFilter",
"org.jsoup.parser.ParseSettings",
"org.jsoup.select.Evaluator$ContainsOwnText",
"org.jsoup.parser.TokeniserState$27",
"org.jsoup.parser.TokeniserState",
"org.jsoup.parser.TokeniserState$28",
"org.jsoup.parser.TokeniserState$29",
"org.jsoup.parser.TokeniserState$34",
"org.jsoup.select.Evaluator$IndexLessThan",
"org.jsoup.parser.TokeniserState$35",
"org.jsoup.parser.TokeniserState$36",
"org.jsoup.parser.TokeniserState$37",
"org.jsoup.parser.TokeniserState$30",
"org.jsoup.parser.TokeniserState$31",
"org.jsoup.parser.TokeniserState$32",
"org.jsoup.parser.TokeniserState$33",
"org.jsoup.nodes.Entities$EscapeMode",
"org.jsoup.select.Evaluator$MatchText",
"org.jsoup.select.Evaluator",
"org.jsoup.Connection",
"org.jsoup.select.Evaluator$IsRoot",
"org.jsoup.parser.TokeniserState$38",
"org.jsoup.parser.TokeniserState$39",
"org.jsoup.nodes.CDataNode",
"org.jsoup.parser.TokeniserState$45",
"org.jsoup.parser.TokeniserState$46",
"org.jsoup.parser.TokeniserState$47",
"org.jsoup.parser.TokeniserState$48",
"org.jsoup.select.Evaluator$IsLastChild",
"org.jsoup.parser.TokeniserState$41",
"org.jsoup.select.Evaluator$IsNthLastChild",
"org.jsoup.parser.TokeniserState$42",
"org.jsoup.parser.TokeniserState$43",
"org.jsoup.parser.TokeniserState$44",
"org.jsoup.parser.TokeniserState$40",
"org.jsoup.parser.Token$TokenType",
"org.jsoup.parser.HtmlTreeBuilderState$2",
"org.jsoup.parser.HtmlTreeBuilderState$1",
"org.jsoup.parser.HtmlTreeBuilderState$4",
"org.jsoup.nodes.Attribute",
"org.jsoup.parser.HtmlTreeBuilderState$3",
"org.jsoup.parser.HtmlTreeBuilderState$9",
"org.jsoup.parser.HtmlTreeBuilderState$6",
"org.jsoup.parser.TokeniserState$49",
"org.jsoup.parser.HtmlTreeBuilderState$5",
"org.jsoup.parser.HtmlTreeBuilderState$8",
"org.jsoup.parser.HtmlTreeBuilderState$7"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(Element_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.jsoup.nodes.Node",
"org.jsoup.nodes.Element",
"org.jsoup.helper.ChangeNotifyingArrayList",
"org.jsoup.nodes.Element$NodeList",
"org.jsoup.nodes.Element$1",
"org.jsoup.nodes.Element$2",
"org.jsoup.helper.Validate",
"org.jsoup.parser.Tag",
"org.jsoup.parser.ParseSettings",
"org.jsoup.select.NodeFilter$FilterResult",
"org.jsoup.internal.StringUtil",
"org.jsoup.nodes.Document$OutputSettings$Syntax",
"org.jsoup.nodes.Attributes",
"org.jsoup.nodes.Document",
"org.jsoup.internal.Normalizer",
"org.jsoup.parser.Parser",
"org.jsoup.nodes.NodeUtils",
"org.jsoup.parser.TreeBuilder",
"org.jsoup.parser.HtmlTreeBuilder",
"org.jsoup.parser.Token",
"org.jsoup.parser.Token$Tag",
"org.jsoup.parser.Token$StartTag",
"org.jsoup.parser.Token$TokenType",
"org.jsoup.parser.Token$EndTag",
"org.jsoup.parser.ParseErrorList",
"org.jsoup.nodes.Node$OuterHtmlVisitor",
"org.jsoup.select.NodeTraversor",
"org.jsoup.parser.HtmlTreeBuilderState",
"org.jsoup.parser.Tokeniser",
"org.jsoup.parser.TokeniserState",
"org.jsoup.parser.Token$Character",
"org.jsoup.parser.Token$Doctype",
"org.jsoup.parser.Token$Comment",
"org.jsoup.parser.Token$EOF",
"org.jsoup.parser.HtmlTreeBuilderState$24",
"org.jsoup.nodes.LeafNode",
"org.jsoup.nodes.TextNode",
"org.jsoup.nodes.Entities$1",
"org.jsoup.select.Evaluator",
"org.jsoup.select.Evaluator$AttributeKeyPair",
"org.jsoup.select.Evaluator$AttributeWithValueNot",
"org.jsoup.select.Elements",
"org.jsoup.select.Evaluator$AttributeWithValue",
"org.jsoup.nodes.FormElement",
"org.jsoup.nodes.CDataNode",
"org.jsoup.nodes.Attribute",
"org.jsoup.select.Collector",
"org.jsoup.select.Collector$Accumulator",
"org.jsoup.nodes.Attributes$Dataset",
"org.jsoup.nodes.Attributes$Dataset$EntrySet",
"org.jsoup.nodes.Attributes$Dataset$DatasetIterator",
"org.jsoup.nodes.Attributes$1",
"org.jsoup.select.Evaluator$AttributeStarting",
"org.jsoup.nodes.PseudoTextElement",
"org.jsoup.select.Evaluator$Id",
"org.jsoup.parser.XmlTreeBuilder",
"org.jsoup.select.Evaluator$AttributeWithValueEnding",
"org.jsoup.select.Selector",
"org.jsoup.select.QueryParser",
"org.jsoup.parser.TokenQueue",
"org.jsoup.select.Evaluator$Tag",
"org.jsoup.select.Selector$SelectorParseException",
"org.jsoup.nodes.XmlDeclaration",
"org.jsoup.parser.XmlTreeBuilder$1",
"org.jsoup.select.Evaluator$ContainsOwnText",
"org.jsoup.select.Evaluator$IndexEvaluator",
"org.jsoup.select.Evaluator$IndexLessThan",
"org.jsoup.select.Evaluator$AttributeWithValueMatching",
"org.jsoup.select.Evaluator$Matches",
"org.jsoup.select.Evaluator$ContainsText",
"org.jsoup.select.Evaluator$AttributeWithValueContaining",
"org.jsoup.select.Evaluator$MatchesOwn",
"org.jsoup.select.Evaluator$Class",
"org.jsoup.select.Evaluator$IndexGreaterThan",
"org.jsoup.select.Evaluator$AllElements",
"org.jsoup.parser.ParseError",
"org.jsoup.parser.HtmlTreeBuilderState$Constants",
"org.jsoup.select.Collector$FirstFinder",
"org.jsoup.select.Evaluator$IndexEquals",
"org.jsoup.nodes.DataNode",
"org.jsoup.nodes.Comment",
"org.jsoup.nodes.Node$1",
"org.jsoup.select.Evaluator$AttributeWithValueStarting",
"org.jsoup.select.Evaluator$Attribute",
"org.jsoup.select.CombiningEvaluator",
"org.jsoup.select.CombiningEvaluator$And",
"org.jsoup.nodes.DocumentType",
"org.jsoup.select.StructuralEvaluator$Root",
"org.jsoup.select.StructuralEvaluator",
"org.jsoup.select.StructuralEvaluator$ImmediateParent",
"org.jsoup.select.Evaluator$IsEmpty",
"org.jsoup.select.StructuralEvaluator$Parent",
"org.jsoup.select.Evaluator$CssNthEvaluator",
"org.jsoup.select.Evaluator$IsNthChild",
"org.jsoup.select.Evaluator$IsLastChild",
"org.jsoup.select.Evaluator$IsNthOfType",
"org.jsoup.select.Evaluator$IsFirstOfType",
"org.jsoup.select.Evaluator$IsOnlyOfType",
"org.jsoup.Jsoup",
"org.jsoup.select.StructuralEvaluator$ImmediatePreviousSibling",
"org.jsoup.select.Evaluator$IsRoot",
"org.jsoup.select.Evaluator$IsOnlyChild",
"org.jsoup.nodes.BooleanAttribute",
"org.jsoup.select.Evaluator$TagEndsWith",
"org.jsoup.select.Evaluator$IsFirstChild",
"org.jsoup.select.Evaluator$ContainsData",
"org.jsoup.select.StructuralEvaluator$PreviousSibling",
"org.jsoup.select.Evaluator$IsNthLastChild",
"org.jsoup.select.Evaluator$IsNthLastOfType",
"org.jsoup.SerializationException",
"org.jsoup.select.Evaluator$IsLastOfType",
"org.jsoup.parser.Token$CData",
"org.jsoup.nodes.Document$OutputSettings",
"org.jsoup.nodes.Entities",
"org.jsoup.parser.CharacterReader",
"org.jsoup.nodes.Entities$EscapeMode",
"org.jsoup.nodes.Entities$CoreCharset"
);
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
8e029b07252d4a4394bc03c3fd8ca132cb0b4582 | 6675a1a9e2aefd5668c1238c330f3237b253299a | /2.15/dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/menu/action/GetModulesAction.java | fb3a83ae7353f0ec5359505ca73b7cf641d40cd6 | [
"BSD-3-Clause"
] | permissive | hispindia/dhis-2.15 | 9e5bd360bf50eb1f770ac75cf01dc848500882c2 | f61f791bf9df8d681ec442e289d67638b16f99bf | refs/heads/master | 2021-01-12T06:32:38.660800 | 2016-12-27T07:44:32 | 2016-12-27T07:44:32 | 77,379,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,165 | java | package org.hisp.dhis.webportal.menu.action;
/*
* Copyright (c) 2004-2014, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.webportal.module.Module;
import org.hisp.dhis.webportal.module.ModuleManager;
import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
/**
* @author Lars Helge Overland
*/
public class GetModulesAction
implements Action
{
@Autowired
private ModuleManager manager;
@Autowired
private CurrentUserService currentUserService;
private List<Module> modules;
public List<Module> getModules()
{
return modules;
}
@Override
public String execute()
throws Exception
{
modules = manager.getAccessibleMenuModulesAndApps();
User user = currentUserService.getCurrentUser();
if ( user != null && user.getApps() != null && !user.getApps().isEmpty() )
{
final List<String> userApps = user.getApps();
Collections.sort( modules, new Comparator<Module>()
{
@Override
public int compare( Module m1, Module m2 )
{
Integer i1 = userApps.indexOf( m1.getName() );
Integer i2 = userApps.indexOf( m2.getName() );
return i1 != -1 ? ( i2 != -1 ? i1.compareTo( i2 ) : -1 ) : 1;
}
} );
}
return SUCCESS;
}
}
| [
"[sagarb.4488@gmail.com]"
] | [sagarb.4488@gmail.com] |
7ba71cfa0b2de1ac2c464ace2b968b1c32f4af68 | 889334ad3c51a8625d5d42c43644d7b56cfb73f4 | /rvs2.0/src/com/osh/rvs/service/CustomerService.java | 6e6a2340f2cff4876813e27e977a0dcd9d42514f | [
"Apache-2.0"
] | permissive | fangke-ray/RVS-OGZ | 80ffc3092cbbadb0e9c9b07f2186c049e37308b6 | 7f251143806252566561053bf351e8f1cf666357 | refs/heads/master | 2023-05-25T07:08:39.226063 | 2023-05-09T07:35:00 | 2023-05-09T07:35:00 | 157,845,028 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 7,070 | java | package com.osh.rvs.service;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionManager;
import org.apache.struts.action.ActionForm;
import com.osh.rvs.bean.LoginData;
import com.osh.rvs.bean.master.CustomerEntity;
import com.osh.rvs.common.ReverseResolution;
import com.osh.rvs.common.RvsConsts;
import com.osh.rvs.form.master.CustomerForm;
import com.osh.rvs.mapper.CommonMapper;
import com.osh.rvs.mapper.data.MaterialMapper;
import com.osh.rvs.mapper.master.CustomerMapper;
import framework.huiqing.bean.message.MsgInfo;
import framework.huiqing.common.util.CommonStringUtil;
import framework.huiqing.common.util.copy.BeanUtil;
import framework.huiqing.common.util.copy.CopyOptions;
import framework.huiqing.common.util.message.ApplicationMessage;
public class CustomerService {
public List<String> getAutoComplete(SqlSession conn) {
CustomerMapper mapper = conn.getMapper(CustomerMapper.class);
List<String> ret = new ArrayList<>();
List<CustomerEntity> retEntities = mapper.getAllCustomers();
for (CustomerEntity retEntity : retEntities) {
ret.add(retEntity.getName());
}
return ret;
}
public String getCustomerStudiedId(String customer_name, Integer ocm,
SqlSession conn) throws Exception {
String customer_id = ReverseResolution.getCustomerByName(customer_name,
conn);
if (customer_id == null) {
CustomerMapper mapper = conn.getMapper(CustomerMapper.class);
CommonMapper cmapper = conn.getMapper(CommonMapper.class);
CustomerEntity condi = new CustomerEntity();
condi.setName(customer_name);
condi.setOcm(ocm);
condi.setUpdated_by("0"); // SYSTEM
mapper.insertCustomer(condi);
customer_id = cmapper.getLastInsertID();
// FseBridgeUtil.createCustomer(customer_id, customer_name, "" + ocm);
}
return customer_id;
}
/**
* 一览
*
* @param form
* @param conn
* @return
*/
public List<CustomerForm> search(ActionForm form, SqlSession conn) {
CustomerEntity entity = new CustomerEntity();
BeanUtil.copyToBean(form, entity, CopyOptions.COPYOPTIONS_NOEMPTY);
CustomerMapper dao = conn.getMapper(CustomerMapper.class);
List<CustomerEntity> list = dao.search(entity);
List<CustomerForm> returnForms = new ArrayList<CustomerForm>();
if (list.size() > 0) {
BeanUtil.copyToFormList(list, returnForms,CopyOptions.COPYOPTIONS_NOEMPTY, CustomerForm.class);
return returnForms;
} else {
return null;
}
}
/**
* 检查客户名称是否存在
* @param form
* @param conn
* @param errors
*/
public void checkNameIsExist(ActionForm form, SqlSession conn, List<MsgInfo> errors){
CustomerEntity entity = new CustomerEntity();
BeanUtil.copyToBean(form, entity, CopyOptions.COPYOPTIONS_NOEMPTY);
CustomerMapper dao = conn.getMapper(CustomerMapper.class);
int result=dao.checkNameIsExist(entity);
if(result>=1){//存在
MsgInfo error = new MsgInfo();
error.setComponentid("add_name");
error.setErrcode("dbaccess.recordDuplicated");
error.setErrmsg(ApplicationMessage.WARNING_MESSAGES.getMessage("dbaccess.recordDuplicated", "客户名称"+entity.getName()));
errors.add(error);
}
}
/**
* 新建客户
* @param form
* @param conn
* @param request
*/
public void insert(ActionForm form,SqlSessionManager conn,HttpServletRequest request)throws Exception{
CustomerEntity entity = new CustomerEntity();
BeanUtil.copyToBean(form, entity, CopyOptions.COPYOPTIONS_NOEMPTY);
LoginData loginData = (LoginData) request.getSession().getAttribute(RvsConsts.SESSION_USER);
String operator_id = loginData.getOperator_id();// 最后更新人
entity.setUpdated_by(operator_id);
CustomerMapper dao = conn.getMapper(CustomerMapper.class);
dao.insert(entity);
}
/**
* 更新时候check 是否为当前ID,
* @param form
* @param conn
* @param errors
*/
public void checkIdIsCurrent(ActionForm form, SqlSession conn, List<MsgInfo> errors){
CustomerEntity entity = new CustomerEntity();
BeanUtil.copyToBean(form, entity, CopyOptions.COPYOPTIONS_NOEMPTY);
CustomerMapper dao = conn.getMapper(CustomerMapper.class);
String currentID=dao.checkIdIsCurrent(entity);
if(!CommonStringUtil.isEmpty(currentID)){//不为空
if(!currentID.equals(entity.getCustomer_id())){//不是当前ID
int result=dao.checkNameIsExist(entity);
if(result>=1){//存在
MsgInfo error = new MsgInfo();
error.setComponentid("add_name");
error.setErrcode("dbaccess.recordDuplicated");
error.setErrmsg(ApplicationMessage.WARNING_MESSAGES.getMessage("dbaccess.recordDuplicated", "客户名称"+entity.getName()));
errors.add(error);
}
}
}
}
/**
* 更新
* @param form
* @param request
* @param conn
*/
public void update(ActionForm form,SqlSessionManager conn,HttpServletRequest request){
CustomerEntity entity = new CustomerEntity();
BeanUtil.copyToBean(form, entity, CopyOptions.COPYOPTIONS_NOEMPTY);
LoginData loginData = (LoginData) request.getSession().getAttribute(RvsConsts.SESSION_USER);
String operator_id = loginData.getOperator_id();// 最后更新人
entity.setUpdated_by(operator_id);
CustomerMapper dao = conn.getMapper(CustomerMapper.class);
dao.update(entity);
}
/**
* 查询归并目标
* @param form
* @param conn
* @return
*/
public List<CustomerForm> searchMergeTarget(CustomerForm form,SqlSession conn){
CustomerEntity entity = new CustomerEntity();
BeanUtil.copyToBean(form, entity, CopyOptions.COPYOPTIONS_NOEMPTY);
CustomerMapper dao = conn.getMapper(CustomerMapper.class);
List<CustomerEntity> list = dao.searchMergeTarget(entity);
List<CustomerForm> returnForms = new ArrayList<CustomerForm>();
if (list.size() > 0) {
BeanUtil.copyToFormList(list, returnForms,CopyOptions.COPYOPTIONS_NOEMPTY, CustomerForm.class);
return returnForms;
} else {
return null;
}
}
/**
* 归并
* @param form
* @param conn
* @param request
*/
public void merge(ActionForm form,SqlSessionManager conn,HttpServletRequest request){
CustomerEntity entity = new CustomerEntity();
BeanUtil.copyToBean(form, entity, CopyOptions.COPYOPTIONS_NOEMPTY);
LoginData loginData = (LoginData) request.getSession().getAttribute(RvsConsts.SESSION_USER);
String operator_id = loginData.getOperator_id();// 最后更新人
entity.setUpdated_by(operator_id);
CustomerMapper customerDao = conn.getMapper(CustomerMapper.class);
MaterialMapper materialDao=conn.getMapper(MaterialMapper.class);
customerDao.deleteOriginal(entity);//删除归并源
materialDao.updateCustomerId(entity.getTarget_customer_id(), entity.getOriginal_customer_id());//将归并源客户替换成归并目标客户
Integer original_vip=entity.getOriginal_vip();
Integer targer_vip=entity.getTarger_vip();
if(original_vip==1 && targer_vip!=1){//归并源是VIP 归并目标不是VIP
customerDao.updateTargetToVip(entity);
}
}
}
| [
"43032093+fangke-ray@users.noreply.github.com"
] | 43032093+fangke-ray@users.noreply.github.com |
6f6827c95e0c6bf132c2f9621c3648d51ad495fd | 53012173cfbdd80a1c68ed3cb60f79595960b078 | /Projeto/src/model/entidades/Login.java | 015c0e8818ddaa6c61f6e42d5617e765b373d28b | [] | no_license | rlucena92/ProjetoONGFinal | e961217cf7ebd8e4a9e6be45d9c012ac18077d70 | 03615c884efa195ef22fff4770c2732d0a5988ca | refs/heads/main | 2023-05-06T19:11:20.284126 | 2021-06-05T02:37:38 | 2021-06-05T02:37:38 | 374,003,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,130 | java | package model.entidades;
import model.PerfilAcessoEnum;
public class Login {
private String login;
private String senha;
private PerfilAcessoEnum perfilAcessoEnum;
public Login() {
}
public Login(String login, String senha, PerfilAcessoEnum perfilAcessoEnum) {
super();
this.login = login;
this.senha = senha;
this.perfilAcessoEnum = perfilAcessoEnum;
}
/**
* @return the login
*/
public String getLogin() {
return login;
}
/**
* @param login the login to set
*/
public void setLogin(String login) {
this.login = login;
}
/**
* @return the senha
*/
public String getSenha() {
return senha;
}
/**
* @param senha the senha to set
*/
public void setSenha(String senha) {
this.senha = senha;
}
/**
* @return the perfilAcessoEnum
*/
public PerfilAcessoEnum getPerfilAcessoEnum() {
return perfilAcessoEnum;
}
/**
* @param perfilAcessoEnum the perfilAcessoEnum to set
*/
public void setPerfilAcessoEnum(PerfilAcessoEnum perfilAcessoEnum) {
this.perfilAcessoEnum = perfilAcessoEnum;
}
}
| [
"noreply@github.com"
] | rlucena92.noreply@github.com |
34f01807cf52f562b2399e9a6c04fd8cf451400f | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/JetBrains--intellij-community/533588c5e872d761fc51236515f956befea4c846/before/LocalHistoryComponent.java | 6c6e73c8bb194528bad06e172f9587abdc7266b2 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,692 | java | package com.intellij.history.integration;
import com.intellij.history.*;
import com.intellij.history.utils.LocalHistoryLog;
import com.intellij.history.core.ILocalVcs;
import com.intellij.history.core.LocalVcs;
import com.intellij.history.core.ThreadSafeLocalVcs;
import com.intellij.history.core.tree.Entry;
import com.intellij.history.core.storage.Storage;
import com.intellij.ide.startup.StartupManagerEx;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.ex.VirtualFileManagerEx;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.TestOnly;
import java.io.File;
public class LocalHistoryComponent extends LocalHistory implements ProjectComponent {
private Project myProject;
private StartupManagerEx myStartupManager;
private ProjectRootManagerEx myRootManager;
private VirtualFileManagerEx myFileManager;
private CommandProcessor myCommandProcessor;
private LocalHistoryConfiguration myConfiguration;
private Storage myStorage;
private ILocalVcs myVcs;
private LocalVcs myVcsImpl;
private LocalHistoryService myService;
private IdeaGateway myGateway;
private boolean isInitialized;
@TestOnly
public static LocalHistoryComponent getComponentInstance(Project p) {
return (LocalHistoryComponent)p.getComponent(LocalHistory.class);
}
// todo bad method - extend interface instead
public static ILocalVcs getLocalVcsFor(Project p) {
return getComponentInstance(p).getLocalVcs();
}
@TestOnly
public static LocalVcs getLocalVcsImplFor(Project p) {
return getComponentInstance(p).getLocalVcsImpl();
}
public LocalHistoryComponent(Project p,
StartupManager sm,
ProjectRootManagerEx rm,
VirtualFileManagerEx fm,
CommandProcessor cp,
LocalHistoryConfiguration c) {
myProject = p;
myStartupManager = (StartupManagerEx)sm;
myRootManager = rm;
myFileManager = fm;
myCommandProcessor = cp;
myConfiguration = c;
}
public void initComponent() {
if (isDefaultProject()) return;
myStartupManager.registerPreStartupActivity(new Runnable() {
public void run() {
init();
}
});
}
protected void init() {
initVcs();
initService();
isInitialized = true;
}
protected void initVcs() {
myStorage = new Storage(getStorageDir());
myVcsImpl = new LocalVcs(myStorage);
myVcs = new ThreadSafeLocalVcs(myVcsImpl);
}
protected void initService() {
myGateway = new IdeaGateway(myProject);
myService = new LocalHistoryService(myVcs,
myGateway,
myConfiguration,
myStartupManager,
myRootManager,
myFileManager,
myCommandProcessor);
}
public File getStorageDir() {
File vcsDir = new File(getSystemPath(), "LocalHistory");
return new File(vcsDir, myProject.getLocationHash());
}
protected String getSystemPath() {
return PathManager.getSystemPath();
}
public void save() {
if (!isInitialized) return;
myVcs.save();
}
public void disposeComponent() {
if (!isInitialized) return;
myVcs.purgeObsoleteAndSave(myConfiguration.PURGE_PERIOD);
closeVcs();
closeService();
cleanupStorageAfterTestCase();
isInitialized = false;
}
protected void cleanupStorageAfterTestCase() {
if (isUnitTestMode()) FileUtil.delete(getStorageDir());
}
protected boolean isUnitTestMode() {
return ApplicationManagerEx.getApplicationEx().isUnitTestMode();
}
public void closeVcs() {
if (!isInitialized) return;
myStorage.close();
}
protected void closeService() {
if (!isInitialized) return;
myService.shutdown();
}
protected boolean isDefaultProject() {
return myProject.isDefault();
}
@Override
protected LocalHistoryAction startAction(String name) {
if (!isInitialized) return LocalHistoryAction.NULL;
return myService.startAction(name);
}
@Override
protected void putUserLabel(String name) {
if (!isInitialized) return;
myGateway.registerUnsavedDocuments(myVcs);
myVcs.putUserLabel(name);
}
@Override
protected void putUserLabel(VirtualFile f, String name) {
if (!isInitialized) return;
myGateway.registerUnsavedDocuments(myVcs);
myVcs.putUserLabel(f.getPath(), name);
}
@Override
protected void putSystemLabel(String name, int color) {
if (!isInitialized) return;
myGateway.registerUnsavedDocuments(myVcs);
myVcs.putSystemLabel(name, color);
}
@Override
protected Checkpoint putCheckpoint() {
if (!isInitialized) return new Checkpoint.NullCheckpoint();
return new CheckpointImpl(myGateway, myVcs);
}
@Override
protected byte[] getByteContent(VirtualFile f, FileRevisionTimestampComparator c) {
if (!isInitialized) return null;
if (!isUnderControl(f)) return null;
return myVcs.getByteContent(f.getPath(), c);
}
@Override
protected boolean isUnderControl(VirtualFile f) {
if (!isInitialized) return false;
return myGateway.getFileFilter().isAllowedAndUnderContentRoot(f);
}
@Override
protected boolean hasUnavailableContent(VirtualFile f) {
if (!isInitialized) return false;
if (!isUnderControl(f)) return false;
// TODO IDEADEV-21269 bug hook
if (!f.isValid()) {
LocalHistoryLog.LOG.warn("File is invalid: " + f);
return false;
}
Entry entry = myVcs.findEntry(f.getPath());
// TODO hook for IDEADEV-26645
if (entry == null) {
LocalHistoryLog.LOG.warn("Entry does not exist for " + f);
return false;
}
return entry.hasUnavailableContent();
}
@NonNls
@NotNull
public String getComponentName() {
return "Local History";
}
public ILocalVcs getLocalVcs() {
return myVcs;
}
@TestOnly
public LocalVcs getLocalVcsImpl() {
return myVcsImpl;
}
public void projectOpened() {
}
public void projectClosed() {
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
26fe758e5733cb294ef0eac84fab42b1715ec002 | df1ba0c172971e0d4d9590e2e99fd5e48f3d5fe3 | /fiware-connector/influx-orion-adapter/src/main/java/com/vnaskos/adapter/api/UrlSpace.java | 37b8028e6bd114df81c424e4d83c53d53c641815 | [] | no_license | vnaskos/IDS | d5a2bb3af186d4865a1531650a73f4603f53cfb6 | d1a1fec9b3fe7628f5502c19136440f03d735524 | refs/heads/master | 2020-09-28T01:47:04.805439 | 2020-01-08T18:06:06 | 2020-01-08T18:06:06 | 226,659,769 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 64 | java | package com.vnaskos.adapter.api;
public interface UrlSpace {
}
| [
"vnaskos@gmail.com"
] | vnaskos@gmail.com |
0b61c1d4375580b3367a060a8d8f8f728368b335 | 226c417614b3b7ef12554591dfa401398fcf7dd7 | /app/src/main/java/com/kylelawson/talkingtoddlers/TopBarActivity.java | e4742822c435e7462ce887a23a2567bbe14f3c64 | [] | no_license | kylelawson/TalkingToddlers | 7b7a5f2977bb5ad411407ee441eea284ded20682 | 9f4859412c56f72cd4c1006dbe57824aa6b24fc3 | refs/heads/master | 2020-12-03T19:49:36.039872 | 2016-08-30T21:50:38 | 2016-08-30T21:50:38 | 66,962,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,640 | java | package com.kylelawson.talkingtoddlers;
import android.app.Fragment;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Switch;
public class TopBarActivity extends Fragment {
Switch text_toggle;
SharedPreferences textingState = getActivity().getSharedPreferences("TEXTING", Context.MODE_PRIVATE);
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = inflater.inflate(R.layout.activity_top_bar, container, false);
text_toggle = (Switch) getActivity().findViewById(R.id.texting_toggle);
if(textingState != null){
if(textingState.getInt("STATE", 0 ) != 0){
text_toggle.setChecked(true);
}else{
text_toggle.setChecked(false);
}
}
text_toggle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(textingState.getInt("STATE", 0) == 0){
SharedPreferences.Editor editor = textingState.edit();
editor.putInt("STATE", 1).apply();
text_toggle.setChecked(true);
}else{
SharedPreferences.Editor editor = textingState.edit();
editor.putInt("STATE", 0).apply();
text_toggle.setChecked(false);
}
}
});
return view;
}
}
| [
"kylelawson@mail4me.com"
] | kylelawson@mail4me.com |
b36601fadc9c2fbe53739e3c91b17423a52901f4 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/JacksonXml-4/com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider/BBC-F0-opt-90/tests/20/com/fasterxml/jackson/dataformat/xml/ser/XmlSerializerProvider_ESTest.java | 018ab0ce90193895d99f977068e74ad82430dde6 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 77,096 | java | /*
* This file was automatically generated by EvoSuite
* Fri Oct 22 02:11:40 GMT 2021
*/
package com.fasterxml.jackson.dataformat.xml.ser;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.ctc.wstx.api.WriterConfig;
import com.ctc.wstx.sw.AsciiXmlWriter;
import com.ctc.wstx.sw.ISOLatin1XmlWriter;
import com.ctc.wstx.sw.NonNsStreamWriter;
import com.ctc.wstx.sw.SimpleNsStreamWriter;
import com.ctc.wstx.sw.XmlWriter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.SimpleObjectIdResolver;
import com.fasterxml.jackson.core.JsonEncoding;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.core.base.GeneratorBase;
import com.fasterxml.jackson.core.io.IOContext;
import com.fasterxml.jackson.core.json.ReaderBasedJsonParser;
import com.fasterxml.jackson.core.json.WriterBasedJsonGenerator;
import com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer;
import com.fasterxml.jackson.core.util.BufferRecycler;
import com.fasterxml.jackson.core.util.ByteArrayBuilder;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.PropertyName;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.cfg.BaseSettings;
import com.fasterxml.jackson.databind.cfg.ConfigOverrides;
import com.fasterxml.jackson.databind.deser.DefaultDeserializationContext;
import com.fasterxml.jackson.databind.introspect.BasicBeanDescription;
import com.fasterxml.jackson.databind.introspect.ClassIntrospector;
import com.fasterxml.jackson.databind.introspect.SimpleMixInResolver;
import com.fasterxml.jackson.databind.jsontype.NamedType;
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
import com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver;
import com.fasterxml.jackson.databind.node.BooleanNode;
import com.fasterxml.jackson.databind.ser.BeanSerializerFactory;
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
import com.fasterxml.jackson.databind.ser.SerializerFactory;
import com.fasterxml.jackson.databind.type.CollectionType;
import com.fasterxml.jackson.databind.type.MapLikeType;
import com.fasterxml.jackson.databind.type.MapType;
import com.fasterxml.jackson.databind.type.ReferenceType;
import com.fasterxml.jackson.databind.type.TypeBindings;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.databind.util.RootNameLookup;
import com.fasterxml.jackson.databind.util.TokenBuffer;
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
import com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider;
import com.fasterxml.jackson.dataformat.xml.util.XmlRootNameLookup;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedOutputStream;
import java.io.PipedReader;
import java.io.SequenceInputStream;
import java.io.Writer;
import java.math.RoundingMode;
import java.util.Enumeration;
import javax.xml.namespace.QName;
import org.codehaus.stax2.util.StreamWriterDelegate;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.evosuite.runtime.mock.java.io.MockFileOutputStream;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class XmlSerializerProvider_ESTest extends XmlSerializerProvider_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
MapperFeature[] mapperFeatureArray0 = new MapperFeature[4];
MapperFeature mapperFeature0 = MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES;
mapperFeatureArray0[0] = mapperFeature0;
mapperFeatureArray0[1] = mapperFeatureArray0[0];
MapperFeature mapperFeature1 = MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS;
mapperFeatureArray0[2] = mapperFeature1;
mapperFeatureArray0[3] = mapperFeatureArray0[0];
SerializationConfig serializationConfig1 = serializationConfig0.without(mapperFeatureArray0);
DefaultSerializerProvider defaultSerializerProvider0 = xmlSerializerProvider0.createInstance(serializationConfig1, (SerializerFactory) null);
assertNotSame(defaultSerializerProvider0, xmlSerializerProvider0);
}
@Test(timeout = 4000)
public void test01() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig0, (SerializerFactory) null);
QName qName0 = xmlSerializerProvider1._rootNameFromConfig();
assertNull(qName0);
}
@Test(timeout = 4000)
public void test02() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
ObjectMapper objectMapper0 = new ObjectMapper();
TokenBuffer tokenBuffer0 = new TokenBuffer(objectMapper0, false);
ToXmlGenerator toXmlGenerator0 = xmlSerializerProvider0._asXmlGenerator(tokenBuffer0);
assertNull(toXmlGenerator0);
}
@Test(timeout = 4000)
public void test03() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream(" +k", true);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, " +k", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 2, objectMapper0, simpleNsStreamWriter0);
xmlSerializerProvider0._serializeXmlNull(toXmlGenerator0);
QName qName0 = QName.valueOf(" +k");
xmlSerializerProvider0._startRootArray(toXmlGenerator0, qName0);
ToXmlGenerator toXmlGenerator1 = xmlSerializerProvider0._asXmlGenerator(toXmlGenerator0);
assertEquals((-1), toXmlGenerator1.getOutputBuffered());
}
@Test(timeout = 4000)
public void test04() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 2);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(asciiXmlWriter0, "fc", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 566, (-13), objectMapper0, nonNsStreamWriter0);
ToXmlGenerator toXmlGenerator1 = xmlSerializerProvider0._asXmlGenerator(toXmlGenerator0);
assertFalse(toXmlGenerator1.canWriteObjectId());
}
@Test(timeout = 4000)
public void test05() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("n.1xHh?J3vnDB1H'B&", false);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "n.1xHh?J3vnDB1H'B&", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 0, objectMapper0, simpleNsStreamWriter0);
ToXmlGenerator toXmlGenerator1 = xmlSerializerProvider0._asXmlGenerator(toXmlGenerator0);
assertTrue(toXmlGenerator1.canWriteFormattedNumbers());
}
@Test(timeout = 4000)
public void test06() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
RoundingMode roundingMode0 = RoundingMode.HALF_EVEN;
IOContext iOContext0 = new IOContext(bufferRecycler0, roundingMode0, false);
JsonFactory jsonFactory0 = new JsonFactory();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, (-1112));
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "JSON", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, (-1112), 0, objectMapper0, simpleNsStreamWriter0);
ToXmlGenerator toXmlGenerator1 = xmlSerializerProvider0._asXmlGenerator(toXmlGenerator0);
assertEquals(57343, GeneratorBase.SURR2_LAST);
}
@Test(timeout = 4000)
public void test07() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("n.1xHh?J3vnDB1H'B&", false);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "n.1xHh?J3vnDB1H'B&", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 0, objectMapper0, simpleNsStreamWriter0);
QName qName0 = new QName("n.1xHh?J3vnDB1H'B&", "n.1xHh?J3vnDB1H'B&");
xmlSerializerProvider0._initWithRootName(toXmlGenerator0, qName0);
try {
xmlSerializerProvider0.serializeValue((JsonGenerator) toXmlGenerator0, (Object) null, (JavaType) null, xmlSerializerProvider0.DEFAULT_NULL_KEY_SERIALIZER);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// javax.xml.stream.XMLStreamException: Unbound namespace URI ''
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test08() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
PropertyName propertyName0 = PropertyName.USE_DEFAULT;
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName0);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("ZJp&o5'x", true);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "ZJp&o5'x", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "ZJp&o5'x", true);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
Class<JsonSerializer> class0 = JsonSerializer.class;
char[] charArray0 = new char[8];
asciiXmlWriter0.writeRawAscii(charArray0, 1742, (-538));
JavaType javaType0 = TypeFactory.unknownType();
NamedType namedType0 = new NamedType(class0, "ZJp&o5'x");
// Undeclared exception!
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) namedType0, javaType0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// -538
//
verifyException("com.ctc.wstx.sw.EncodingXmlWriter", e);
}
}
@Test(timeout = 4000)
public void test09() throws Throwable {
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider((XmlRootNameLookup) null);
JsonFactory jsonFactory0 = new JsonFactory();
PipedOutputStream pipedOutputStream0 = new PipedOutputStream();
JsonEncoding jsonEncoding0 = JsonEncoding.UTF16_LE;
JsonGenerator jsonGenerator0 = jsonFactory0.createGenerator((OutputStream) pipedOutputStream0, jsonEncoding0);
try {
xmlSerializerProvider0.serializeValue(jsonGenerator0, (Object) jsonFactory0, (JavaType) null);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// XmlMapper does not with generators of type other than ToXmlGenerator; got: com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
//
verifyException("com.fasterxml.jackson.databind.JsonMappingException", e);
}
}
@Test(timeout = 4000)
public void test10() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, (ConfigOverrides) null);
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyName propertyName1 = propertyName0.withNamespace("s2");
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName1);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
JsonFactory jsonFactory0 = new JsonFactory((ObjectCodec) null);
BufferRecycler bufferRecycler0 = jsonFactory0._getBufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, (Object) null, true);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter((XmlWriter) null, "s2", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(nonNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2133, 36, (ObjectCodec) null, streamWriterDelegate0);
// Undeclared exception!
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) bufferRecycler0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Can not set default namespace for non-namespace writer.
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test11() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("n.1xHh?J3vnDB1H'B&", false);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "n.1xHh?J3vnDB1H'B&", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 0, objectMapper0, simpleNsStreamWriter0);
QName qName0 = new QName("n.1xHh?J3vnDB1H'B&", "n.1xHh?J3vnDB1H'B&", "n.1xHh?J3vnDB1H'B&");
xmlSerializerProvider0._initWithRootName(toXmlGenerator0, qName0);
try {
xmlSerializerProvider0.serializeValue((JsonGenerator) toXmlGenerator0, (Object) null);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// javax.xml.stream.XMLStreamException: Unbound namespace URI ''
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test12() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
try {
xmlSerializerProvider0.serializeValue((JsonGenerator) null, (Object) null);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// [no message for java.lang.NullPointerException]
//
verifyException("com.fasterxml.jackson.databind.JsonMappingException", e);
}
}
@Test(timeout = 4000)
public void test13() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BeanSerializerFactory beanSerializerFactory0 = BeanSerializerFactory.instance;
// Undeclared exception!
try {
xmlSerializerProvider0.createInstance((SerializationConfig) null, beanSerializerFactory0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.SerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test14() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
// Undeclared exception!
try {
xmlSerializerProvider0._startRootArray((ToXmlGenerator) null, (QName) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test15() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 2);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(asciiXmlWriter0, "fc", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 566, (-13), objectMapper0, nonNsStreamWriter0);
QName qName0 = new QName("fc", "fc", "fc");
// Undeclared exception!
try {
xmlSerializerProvider0._startRootArray(toXmlGenerator0, qName0);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// No element/attribute name specified when trying to output element
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator", e);
}
}
@Test(timeout = 4000)
public void test16() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("\"@&_Yb&J8/mL&_@M81");
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, ">H`?*:.zg@dQGTN$", writerConfig0);
char[] charArray0 = new char[7];
asciiXmlWriter0.writeRawAscii(charArray0, (-1), (-1));
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1, 0, objectMapper0, simpleNsStreamWriter0);
QName qName0 = new QName("\"@&_Yb&J8/mL&_@M81", "", "org.hibernate.repackage.cglib");
xmlSerializerProvider0._initWithRootName(toXmlGenerator0, qName0);
// Undeclared exception!
try {
xmlSerializerProvider0._startRootArray(toXmlGenerator0, qName0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// -1
//
verifyException("com.ctc.wstx.sw.EncodingXmlWriter", e);
}
}
@Test(timeout = 4000)
public void test17() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("n.1xHh?J3vnDB1H'B&", false);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "n.1xHh?J3vnDB1H'B&", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 3, 0, objectMapper0, simpleNsStreamWriter0);
xmlSerializerProvider0._serializeXmlNull(toXmlGenerator0);
QName qName0 = new QName("n.1xHh?J3vnDB1H'B&", "n.1xHh?J3vnDB1H'B&");
xmlSerializerProvider0._initWithRootName(toXmlGenerator0, qName0);
xmlSerializerProvider0._startRootArray(toXmlGenerator0, qName0);
try {
xmlSerializerProvider0._startRootArray(toXmlGenerator0, qName0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// javax.xml.stream.XMLStreamException: Unbound namespace URI 'n.1xHh?J3vnDB1H'B&'
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test18() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter((XmlWriter) null, "+ u[k", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 1183, (ObjectCodec) null, simpleNsStreamWriter0);
// Undeclared exception!
try {
xmlSerializerProvider0._serializeXmlNull(toXmlGenerator0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test19() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
JsonFactory jsonFactory0 = new JsonFactory();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 70);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "JSON", writerConfig0);
char[] charArray0 = new char[9];
asciiXmlWriter0.writeRawAscii(charArray0, 51, (-1713));
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 1, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
xmlSerializerProvider0._serializeXmlNull(toXmlGenerator0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// -1713
//
verifyException("com.ctc.wstx.sw.EncodingXmlWriter", e);
}
}
@Test(timeout = 4000)
public void test20() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
RoundingMode roundingMode0 = RoundingMode.UP;
IOContext iOContext0 = new IOContext(bufferRecycler0, roundingMode0, false);
PipedReader pipedReader0 = new PipedReader();
ObjectMapper objectMapper0 = new ObjectMapper();
CharsToNameCanonicalizer charsToNameCanonicalizer0 = CharsToNameCanonicalizer.createRoot();
ReaderBasedJsonParser readerBasedJsonParser0 = new ReaderBasedJsonParser(iOContext0, 818, pipedReader0, objectMapper0, charsToNameCanonicalizer0);
ByteArrayBuilder byteArrayBuilder0 = readerBasedJsonParser0._getByteArrayBuilder();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1830, 1830, objectMapper0, simpleNsStreamWriter0);
toXmlGenerator0.writeRawValue("expected element <");
try {
xmlSerializerProvider0._serializeXmlNull(toXmlGenerator0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test21() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
try {
xmlSerializerProvider0._serializeXmlNull((JsonGenerator) null);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// [no message for java.lang.NullPointerException]
//
verifyException("com.fasterxml.jackson.databind.JsonMappingException", e);
}
}
@Test(timeout = 4000)
public void test22() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
// Undeclared exception!
try {
xmlSerializerProvider0._rootNameFromConfig();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test23() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 2);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter(asciiXmlWriter0, "fc", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 566, (-13), objectMapper0, nonNsStreamWriter0);
QName qName0 = new QName("-t% -J,", "Unexpected xml version '");
// Undeclared exception!
try {
xmlSerializerProvider0._initWithRootName(toXmlGenerator0, qName0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// Can not set default namespace for non-namespace writer.
//
verifyException("com.ctc.wstx.sw.BaseStreamWriter", e);
}
}
@Test(timeout = 4000)
public void test24() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("\"@&_Yb&J8/mL&_@M81");
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, ">H`?*:.zg@dQGTN$", writerConfig0);
char[] charArray0 = new char[7];
asciiXmlWriter0.writeRawAscii(charArray0, (-1), (-1));
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1, 'Z', objectMapper0, simpleNsStreamWriter0);
QName qName0 = new QName("\"@&_Yb&J8/mL&_@M81", "", "org.hibernate.repackage.cglib");
// Undeclared exception!
try {
xmlSerializerProvider0._initWithRootName(toXmlGenerator0, qName0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// -1
//
verifyException("com.ctc.wstx.sw.EncodingXmlWriter", e);
}
}
@Test(timeout = 4000)
public void test25() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
SimpleObjectIdResolver simpleObjectIdResolver0 = new SimpleObjectIdResolver();
IOContext iOContext0 = new IOContext(bufferRecycler0, simpleObjectIdResolver0, true);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("QD4BG0'{{^", false);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "*Po%^BMV_uQ", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 841, objectMapper0, simpleNsStreamWriter0);
xmlSerializerProvider0._serializeXmlNull(toXmlGenerator0);
QName qName0 = new QName("QD4BG0'{{^", "null", "*Po%^BMV_uQ");
ToXmlGenerator toXmlGenerator1 = new ToXmlGenerator(iOContext0, 2, 1, (ObjectCodec) null, simpleNsStreamWriter0);
try {
xmlSerializerProvider0._initWithRootName(toXmlGenerator1, qName0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test26() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
// Undeclared exception!
try {
xmlSerializerProvider0._asXmlGenerator((JsonGenerator) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test27() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0, true);
JsonFactory jsonFactory0 = new JsonFactory();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0);
DeserializationFeature deserializationFeature0 = DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY;
DeserializationFeature[] deserializationFeatureArray0 = new DeserializationFeature[9];
deserializationFeatureArray0[0] = deserializationFeature0;
deserializationFeatureArray0[1] = deserializationFeature0;
deserializationFeatureArray0[2] = deserializationFeature0;
deserializationFeatureArray0[3] = deserializationFeatureArray0[1];
deserializationFeatureArray0[4] = deserializationFeature0;
deserializationFeatureArray0[5] = deserializationFeature0;
deserializationFeatureArray0[6] = deserializationFeature0;
deserializationFeatureArray0[7] = deserializationFeature0;
deserializationFeatureArray0[8] = deserializationFeature0;
ObjectReader objectReader0 = objectMapper0.reader(deserializationFeature0, deserializationFeatureArray0);
WriterBasedJsonGenerator writerBasedJsonGenerator0 = new WriterBasedJsonGenerator(iOContext0, 0, objectReader0, (Writer) null);
try {
xmlSerializerProvider0._asXmlGenerator(writerBasedJsonGenerator0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// XmlMapper does not with generators of type other than ToXmlGenerator; got: com.fasterxml.jackson.core.json.WriterBasedJsonGenerator
//
verifyException("com.fasterxml.jackson.databind.JsonMappingException", e);
}
}
@Test(timeout = 4000)
public void test28() throws Throwable {
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, (ConfigOverrides) null);
XmlSerializerProvider xmlSerializerProvider0 = null;
try {
xmlSerializerProvider0 = new XmlSerializerProvider((XmlSerializerProvider) null, serializationConfig0, (SerializerFactory) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.SerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test29() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BeanSerializerFactory beanSerializerFactory0 = BeanSerializerFactory.instance;
XmlSerializerProvider xmlSerializerProvider1 = null;
try {
xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, (SerializationConfig) null, beanSerializerFactory0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.SerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test30() throws Throwable {
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider((XmlRootNameLookup) null);
Enumeration<InputStream> enumeration0 = (Enumeration<InputStream>) mock(Enumeration.class, new ViolatedAssumptionAnswer());
doReturn(false).when(enumeration0).hasMoreElements();
SequenceInputStream sequenceInputStream0 = new SequenceInputStream(enumeration0);
// Undeclared exception!
try {
xmlSerializerProvider0.serializeValue((JsonGenerator) null, (Object) sequenceInputStream0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test31() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyName propertyName1 = propertyName0.withNamespace("");
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName1);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
QName qName0 = xmlSerializerProvider1._rootNameFromConfig();
assertNotNull(qName0);
}
@Test(timeout = 4000)
public void test32() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
PropertyName propertyName0 = PropertyName.NO_NAME;
PropertyName propertyName1 = propertyName0.withNamespace("ZJp&/5'x");
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName1);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("h6_\"<=;J*E^");
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, " in content after '<' (malformed start element?).", writerConfig0);
JsonFactory jsonFactory0 = new JsonFactory(objectMapper0);
BufferRecycler bufferRecycler0 = jsonFactory0._getBufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "h6_\"<=;J*E^", false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2736, 3, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) serializationConfig0, (JavaType) null, (JsonSerializer<Object>) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.TypeUtil", e);
}
}
@Test(timeout = 4000)
public void test33() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
JsonFactory jsonFactory0 = new JsonFactory();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder();
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "JSON", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1285, 0, objectMapper0, simpleNsStreamWriter0);
xmlSerializerProvider0._serializeXmlNull(toXmlGenerator0);
xmlSerializerProvider0._startRootArray(toXmlGenerator0, (QName) null);
// Undeclared exception!
try {
xmlSerializerProvider0._initWithRootName(toXmlGenerator0, (QName) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test34() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
PropertyName propertyName0 = PropertyName.NO_NAME;
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName0);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("ZJp&/5'x");
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "ZJp&/5'x", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "ZJp&/5'x", false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
Class<BasicBeanDescription> class0 = BasicBeanDescription.class;
Class<ToXmlGenerator> class1 = ToXmlGenerator.class;
JavaType javaType0 = TypeFactory.unknownType();
TypeBindings typeBindings0 = TypeBindings.createIfNeeded(class1, javaType0);
JavaType[] javaTypeArray0 = new JavaType[3];
javaTypeArray0[0] = javaType0;
MapType mapType0 = MapType.construct(class0, typeBindings0, javaType0, javaTypeArray0, javaType0, javaTypeArray0[0]);
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) null, (JavaType) mapType0, xmlSerializerProvider0.DEFAULT_NULL_KEY_SERIALIZER);
// Undeclared exception!
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) writerConfig0, javaTypeArray0[2], xmlSerializerProvider0.DEFAULT_NULL_KEY_SERIALIZER);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.TypeUtil", e);
}
}
@Test(timeout = 4000)
public void test35() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
ObjectMapper objectMapper0 = new ObjectMapper();
JavaType javaType0 = TypeFactory.unknownType();
TokenBuffer tokenBuffer0 = new TokenBuffer(objectMapper0, false);
JsonSerializer<Object> jsonSerializer0 = xmlSerializerProvider0.getDefaultNullValueSerializer();
xmlSerializerProvider0.serializeValue((JsonGenerator) tokenBuffer0, (Object) xmlRootNameLookup0, javaType0, jsonSerializer0);
assertTrue(javaType0.isConcrete());
}
@Test(timeout = 4000)
public void test36() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
ObjectMapper objectMapper0 = new ObjectMapper();
JavaType javaType0 = TypeFactory.unknownType();
TokenBuffer tokenBuffer0 = new TokenBuffer(objectMapper0, true);
Class<RoundingMode> class0 = RoundingMode.class;
NamedType namedType0 = new NamedType(class0, "(iSe+@{>Kfgl");
JsonSerializer<Object> jsonSerializer0 = xmlSerializerProvider0.getUnknownTypeSerializer(class0);
try {
xmlSerializerProvider0.serializeValue((JsonGenerator) tokenBuffer0, (Object) namedType0, javaType0, jsonSerializer0);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// [no message for java.lang.NullPointerException]
//
verifyException("com.fasterxml.jackson.databind.JsonMappingException", e);
}
}
@Test(timeout = 4000)
public void test37() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
ObjectMapper objectMapper0 = new ObjectMapper();
Class<BooleanNode> class0 = BooleanNode.class;
TypeBindings typeBindings0 = TypeBindings.emptyBindings();
JavaType javaType0 = TypeFactory.unknownType();
JavaType[] javaTypeArray0 = new JavaType[0];
CollectionType collectionType0 = CollectionType.construct(class0, typeBindings0, javaType0, javaTypeArray0, javaType0);
ReferenceType referenceType0 = ReferenceType.upgradeFrom(collectionType0, javaType0);
TokenBuffer tokenBuffer0 = new TokenBuffer(objectMapper0, true);
Object object0 = new Object();
// Undeclared exception!
try {
xmlSerializerProvider0.serializeValue((JsonGenerator) tokenBuffer0, object0, (JavaType) referenceType0, (JsonSerializer<Object>) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.SerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test38() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
PropertyName propertyName0 = PropertyName.NO_NAME;
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName0);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("ZJp&/5'x");
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "ZJp&/5'x", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "ZJp&/5'x", false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
JavaType javaType0 = TypeFactory.unknownType();
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) writerConfig0, javaType0, xmlSerializerProvider0.DEFAULT_NULL_KEY_SERIALIZER);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Null key for a Map not allowed in JSON (use a converting NullKeySerializer?)
//
verifyException("com.fasterxml.jackson.databind.JsonMappingException", e);
}
}
@Test(timeout = 4000)
public void test39() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
PropertyName propertyName0 = PropertyName.NO_NAME;
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName0);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("ZJp&/5'x");
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "ZJp&/5'x", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "ZJp&/5'x", true);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
Class<JsonSerializer> class0 = JsonSerializer.class;
JavaType javaType0 = TypeFactory.unknownType();
TypeBindings typeBindings0 = TypeBindings.createIfNeeded(class0, javaType0);
MapType mapType0 = MapType.construct(class0, typeBindings0, javaType0, (JavaType[]) null, javaType0, javaType0);
// Undeclared exception!
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) iOContext0, (JavaType) mapType0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.SerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test40() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
RoundingMode roundingMode0 = RoundingMode.FLOOR;
IOContext iOContext0 = new IOContext(bufferRecycler0, roundingMode0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("~k3DXvT9lW_i", false);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "nb\"ugET'w~k_o", writerConfig0);
BeanSerializerFactory beanSerializerFactory0 = BeanSerializerFactory.instance;
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig0, beanSerializerFactory0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 0, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) toXmlGenerator0, (JavaType) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.XmlRootNameLookup", e);
}
}
@Test(timeout = 4000)
public void test41() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
PropertyName propertyName0 = PropertyName.USE_DEFAULT;
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName0);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("ZJp&o5'x", true);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "ZJp&o5'x", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "ZJp&o5'x", true);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
Class<JsonSerializer> class0 = JsonSerializer.class;
JavaType javaType0 = TypeFactory.unknownType();
NamedType namedType0 = new NamedType(class0, "ZJp&o5'x");
// Undeclared exception!
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) namedType0, javaType0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.SerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test42() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
ObjectMapper objectMapper0 = new ObjectMapper();
BufferRecycler bufferRecycler0 = new BufferRecycler();
TokenBuffer tokenBuffer0 = new TokenBuffer(objectMapper0, true);
TypeFactory typeFactory0 = TypeFactory.defaultInstance();
Class<TypeIdResolver> class0 = TypeIdResolver.class;
MapLikeType mapLikeType0 = typeFactory0.constructRawMapLikeType(class0);
// Undeclared exception!
try {
xmlSerializerProvider0.serializeValue((JsonGenerator) tokenBuffer0, (Object) bufferRecycler0.BYTE_WRITE_ENCODING_BUFFER, (JavaType) mapLikeType0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.SerializerProvider", e);
}
}
@Test(timeout = 4000)
public void test43() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream(" +k", true);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, " +k", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, simpleMixInResolver0, false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 0, objectMapper0, simpleNsStreamWriter0);
xmlSerializerProvider0.serializeValue((JsonGenerator) toXmlGenerator0, (Object) null, (JavaType) null);
ToXmlGenerator toXmlGenerator1 = new ToXmlGenerator(iOContext0, 1, 1, objectMapper0, simpleNsStreamWriter0);
try {
xmlSerializerProvider0.serializeValue((JsonGenerator) toXmlGenerator1, (Object) null, (JavaType) null);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.StaxUtil", e);
}
}
@Test(timeout = 4000)
public void test44() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
RoundingMode roundingMode0 = RoundingMode.FLOOR;
IOContext iOContext0 = new IOContext(bufferRecycler0, roundingMode0, false);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("~k3DXvT9lW_i", false);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, true);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "nb\"ugET'w~k_o", writerConfig0);
BeanSerializerFactory beanSerializerFactory0 = BeanSerializerFactory.instance;
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig0, beanSerializerFactory0);
JsonInclude.Value jsonInclude_Value0 = BeanProperty.EMPTY_INCLUDE;
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 0, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) jsonInclude_Value0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.cfg.MapperConfig", e);
}
}
@Test(timeout = 4000)
public void test45() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, (ConfigOverrides) null);
PropertyName propertyName0 = PropertyName.NO_NAME;
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName0);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
JsonFactory jsonFactory0 = new JsonFactory((ObjectCodec) null);
BufferRecycler bufferRecycler0 = jsonFactory0._getBufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, (Object) null, true);
WriterConfig writerConfig0 = WriterConfig.createJ2MEDefaults();
NonNsStreamWriter nonNsStreamWriter0 = new NonNsStreamWriter((XmlWriter) null, "s2", writerConfig0);
StreamWriterDelegate streamWriterDelegate0 = new StreamWriterDelegate(nonNsStreamWriter0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2133, 36, (ObjectCodec) null, streamWriterDelegate0);
// Undeclared exception!
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) bufferRecycler0);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.databind.cfg.MapperConfig", e);
}
}
@Test(timeout = 4000)
public void test46() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
ObjectMapper objectMapper0 = new ObjectMapper();
JsonFactory jsonFactory0 = new JsonFactory(objectMapper0);
ObjectMapper objectMapper1 = new ObjectMapper(jsonFactory0, xmlSerializerProvider0, (DefaultDeserializationContext) null);
Class<Integer> class0 = Integer.class;
try {
objectMapper1.convertValue((Object) xmlSerializerProvider0, class0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// (was java.lang.NullPointerException) (through reference chain: com.fasterxml.jackson.dataformat.xml.ser.XmlSerializerProvider[\"annotationIntrospector\"])
//
verifyException("com.fasterxml.jackson.databind.ObjectMapper", e);
}
}
@Test(timeout = 4000)
public void test47() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, xmlRootNameLookup0, false);
JsonFactory jsonFactory0 = new JsonFactory();
ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0);
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(bufferRecycler0, 2);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "JSON", writerConfig0);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 1285, 0, objectMapper0, simpleNsStreamWriter0);
xmlSerializerProvider0.serializeValue((JsonGenerator) toXmlGenerator0, (Object) null);
assertTrue(toXmlGenerator0.canWriteFormattedNumbers());
}
@Test(timeout = 4000)
public void test48() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
DefaultSerializerProvider defaultSerializerProvider0 = xmlSerializerProvider0.createInstance(serializationConfig0, (SerializerFactory) null);
ObjectMapper objectMapper0 = new ObjectMapper();
ByteArrayBuilder byteArrayBuilder0 = new ByteArrayBuilder(0);
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
ISOLatin1XmlWriter iSOLatin1XmlWriter0 = new ISOLatin1XmlWriter(byteArrayBuilder0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(iSOLatin1XmlWriter0, "", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, bufferRecycler0.BYTE_READ_IO_BUFFER, true);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 0, 690, objectMapper0, simpleNsStreamWriter0);
// Undeclared exception!
try {
defaultSerializerProvider0.serializeValue((JsonGenerator) toXmlGenerator0, (Object) toXmlGenerator0, (JavaType) null, xmlSerializerProvider0.DEFAULT_NULL_KEY_SERIALIZER);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("com.fasterxml.jackson.dataformat.xml.util.XmlRootNameLookup", e);
}
}
@Test(timeout = 4000)
public void test49() throws Throwable {
XmlRootNameLookup xmlRootNameLookup0 = new XmlRootNameLookup();
StdSubtypeResolver stdSubtypeResolver0 = new StdSubtypeResolver();
SimpleMixInResolver simpleMixInResolver0 = new SimpleMixInResolver((ClassIntrospector.MixInResolver) null);
RootNameLookup rootNameLookup0 = new RootNameLookup();
ConfigOverrides configOverrides0 = new ConfigOverrides();
SerializationConfig serializationConfig0 = new SerializationConfig((BaseSettings) null, stdSubtypeResolver0, simpleMixInResolver0, rootNameLookup0, configOverrides0);
XmlSerializerProvider xmlSerializerProvider0 = new XmlSerializerProvider(xmlRootNameLookup0);
PropertyName propertyName0 = PropertyName.NO_NAME;
SerializationConfig serializationConfig1 = serializationConfig0.withRootName(propertyName0);
XmlSerializerProvider xmlSerializerProvider1 = new XmlSerializerProvider(xmlSerializerProvider0, serializationConfig1, (SerializerFactory) null);
ObjectMapper objectMapper0 = new ObjectMapper();
MockFileOutputStream mockFileOutputStream0 = new MockFileOutputStream("ZJp&/5'x");
WriterConfig writerConfig0 = WriterConfig.createFullDefaults();
AsciiXmlWriter asciiXmlWriter0 = new AsciiXmlWriter(mockFileOutputStream0, writerConfig0, false);
SimpleNsStreamWriter simpleNsStreamWriter0 = new SimpleNsStreamWriter(asciiXmlWriter0, "ZJp&/5'x", writerConfig0);
BufferRecycler bufferRecycler0 = new BufferRecycler();
IOContext iOContext0 = new IOContext(bufferRecycler0, "ZJp&/5'x", false);
ToXmlGenerator toXmlGenerator0 = new ToXmlGenerator(iOContext0, 2, 2, objectMapper0, simpleNsStreamWriter0);
Class<BasicBeanDescription> class0 = BasicBeanDescription.class;
Class<ToXmlGenerator> class1 = ToXmlGenerator.class;
JavaType javaType0 = TypeFactory.unknownType();
TypeBindings typeBindings0 = TypeBindings.createIfNeeded(class1, javaType0);
JavaType[] javaTypeArray0 = new JavaType[3];
javaTypeArray0[0] = javaType0;
MapType mapType0 = MapType.construct(class0, typeBindings0, javaType0, javaTypeArray0, javaType0, javaTypeArray0[0]);
try {
xmlSerializerProvider1.serializeValue((JsonGenerator) toXmlGenerator0, (Object) stdSubtypeResolver0, (JavaType) mapType0, xmlSerializerProvider0.DEFAULT_NULL_KEY_SERIALIZER);
fail("Expecting exception: IOException");
} catch(IOException e) {
//
// Null key for a Map not allowed in JSON (use a converting NullKeySerializer?)
//
verifyException("com.fasterxml.jackson.databind.JsonMappingException", e);
}
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
5094fa8ca0a180e546122a6063347fa58e506a8f | 870d958013e27ed0d9f76046fd983ec3d4e13f05 | /Chart/src/main/component/chart/data/NullMetaData.java | cd25b494a157d1070b481beb64aab9dcfa8864b3 | [] | no_license | philolight/swingChart | 782e1a9a0b48afe3fc3eb88cc93740a9a37ee15b | df3bd5090c32a8c41ac1fa21346367ef2765cc7d | refs/heads/master | 2021-04-28T14:02:07.288436 | 2018-02-18T13:49:04 | 2018-02-18T13:49:04 | 121,955,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package main.component.chart.data;
public class NullMetaData implements IMetaDataSet{
double []valueSet = {};
@Override public String getName(int index) { return "NULL"; }
@Override public int size() { return 0; }
@Override public double[] get(int i) { return valueSet; }
@Override public void onUpdateData() {}
@Override public double getMinBetween(int leftIndex, int rightIndex) { return 0; }
@Override public double getMaxBetween(int leftIndex, int rightIndex) { return 0; }
@Override public double getGlobalMin() { return 0; }
@Override public double getGlobalMax() { return 0; }
@Override public int getSetSize() { return 0; }
@Override public void setName(int i, String name) {}
@Override public void reset() {}
}
| [
"philolight@gmail.com"
] | philolight@gmail.com |
2c989286e71664f349e21e187587d90541ca58ad | c7f71080d7d1942409d2e2406284e4b3f17ff96e | /src/com/ln/design/j2ee/composite_entity/Client.java | c59b10cf8551767df04c1be6c9e72df2e1b621fe | [] | no_license | HowardHub/designPatterns | 05509d39134e2f91200f7493b6f6b893438e77ae | 98008952b08b01cf00384cbb942776cf6c68defc | refs/heads/master | 2023-02-14T16:51:28.681154 | 2021-01-14T08:11:03 | 2021-01-14T08:11:03 | 329,544,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package com.ln.design.j2ee.composite_entity;
/**
* @Description TODO
* @Author HeZhipeng
* @Date 2021/1/14 15:05
**/
public class Client {
private CompositeEntity compositeEntity = new CompositeEntity();
public void printData() {
for (int i = 0; i < compositeEntity.getData().length; i++) {
System.out.println("Data: " + compositeEntity.getData()[i]);
}
}
public void setData(String data1, String data2) {
compositeEntity.setData(data1, data2);
}
}
| [
"hezp@guotailimin.com"
] | hezp@guotailimin.com |
ac93b1731296ff904d922d1777f72597b41751fe | 9f6e72892519d8d38ed31c7a12d6099b02a1c9dc | /src/main/java/org/recap/report/FSSubmitCollectionSuccessReportGenerator.java | 9390896ff9cb0c09f8247d7910b187912823495c | [
"MIT",
"Apache-2.0"
] | permissive | srinduri04/Phase4-SCSB-Doc | 0e5a17ee159d0c5073c20dca0535a94198c62cf3 | 145c5b1fbafd18d4421ce92fb5dda58ea83ce4f0 | refs/heads/master | 2023-08-15T09:03:12.700847 | 2021-05-11T14:12:24 | 2021-05-11T14:12:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,104 | java | package org.recap.report;
import org.apache.camel.ProducerTemplate;
import org.recap.RecapConstants;
import org.recap.model.csv.SubmitCollectionReportRecord;
import org.recap.model.jpa.ReportEntity;
import org.recap.util.SubmitCollectionReportGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by rajeshbabuk on 20/7/17.
*/
@Component
public class FSSubmitCollectionSuccessReportGenerator implements ReportGeneratorInterface {
@Autowired
private ProducerTemplate producerTemplate;
@Override
public boolean isInterested(String reportType) {
return reportType.equalsIgnoreCase(RecapConstants.SUBMIT_COLLECTION_SUCCESS_REPORT) ? true : false;
}
@Override
public boolean isTransmitted(String transmissionType) {
return transmissionType.equalsIgnoreCase(RecapConstants.FILE_SYSTEM) ? true : false;
}
@Override
public String generateReport(String fileName, List<ReportEntity> reportEntityList) {
String generatedFileName;
List<SubmitCollectionReportRecord> submitCollectionReportRecordList = new ArrayList<>();
SubmitCollectionReportGenerator submitCollectionReportGenerator = new SubmitCollectionReportGenerator();
for(ReportEntity reportEntity : reportEntityList) {
List<SubmitCollectionReportRecord> submitCollectionReportRecords = submitCollectionReportGenerator.prepareSubmitCollectionRejectionRecord(reportEntity);
submitCollectionReportRecordList.addAll(submitCollectionReportRecords);
}
producerTemplate.sendBodyAndHeader(RecapConstants.FS_SUBMIT_COLLECTION_SUCCESS_REPORT_Q, submitCollectionReportRecordList, "fileName", fileName);
DateFormat df = new SimpleDateFormat(RecapConstants.DATE_FORMAT_FOR_FILE_NAME);
generatedFileName = fileName + "-" + df.format(new Date()) + ".csv";
return generatedFileName;
}
}
| [
"rajeshbabu.k@htcindia.com"
] | rajeshbabu.k@htcindia.com |
68099d3f378cf80013b5962b1a164b58c6c39a9c | d546169f0b068d06e374f64c371ef2a3e0360b32 | /src/main/java/com/atom/crud/controller/EmployeeController.java | dc438d7a1b7375976fa370762329750ea509ec57 | [] | no_license | atomzhang0379/ssmTest | 2f803a8b177c3e961593b767722c084a14b76041 | 41ef9d37e461de5cab217dc7c6aa54fcb1534746 | refs/heads/master | 2020-03-12T23:43:08.846840 | 2018-04-24T15:00:16 | 2018-04-24T15:00:16 | 130,872,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,643 | java | package com.atom.crud.controller;
import com.atom.crud.bean.Employee;
import com.atom.crud.bean.Massages;
import com.atom.crud.service.EmployeeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
public class EmployeeController {
@Autowired
EmployeeService employeeService;
public Massages massages;
@RequestMapping("/emps")
@ResponseBody
public Massages getEmpsWithJson(@RequestParam(value="pn",defaultValue = "1")Integer pn, Model model){
PageHelper.startPage(pn,5);
// 紧跟的查询就是一个分页查询
List<Employee> emps = employeeService.getAll();
// 将pageinfo交给页面,里面封装了详细的分页信息,包括查询出来的数据,连续显示的页数
PageInfo pageInfo = new PageInfo(emps,5);
return Massages.Success().add("pageInfo",pageInfo);
}
public String getEmps(@RequestParam(value="pn",defaultValue = "1")Integer pn, Model model){
// 引入分页,传入页码,以及每页的大小
PageHelper.startPage(pn,5);
// 紧跟的查询就是一个分页查询
List<Employee> emps = employeeService.getAll();
// 将pageinfo交给页面,里面封装了详细的分页信息,包括查询出来的数据,连续显示的页数
PageInfo pageInfo = new PageInfo(emps,5);
model.addAttribute("pageInfo",pageInfo);
return "list";
}
// 添加员工
@RequestMapping(value = "/saveEmp",method = RequestMethod.POST)
@ResponseBody
public Massages saveEmp(@Valid Employee employee, BindingResult bindingResult){
if (bindingResult.hasErrors()){
Map<String,Object> map = new HashMap<String, Object>();
List<FieldError> fieldErrors = bindingResult.getFieldErrors();
for (FieldError fieldError: fieldErrors) {
System.out.println("错误的字段名"+fieldError.getField());
System.out.println("错误的信息"+fieldError.getDefaultMessage());
map.put(fieldError.getField(),fieldError.getDefaultMessage());
}
return Massages.fail().add("errorFields",map);
}else {
int result = employeeService.saveEmp(employee);
return Massages.Success().add("num",result);
}
}
// 检查员工姓名
@RequestMapping(value = "/checkUser")
@ResponseBody
public Massages checkUser(@RequestParam("userName") String userName){
// 判断用户名的是否合法
String regist = "(^[a-zA-Z0-9_-]{6,16}$)|(^[\\u2E80-\\u9FFF]{2,5})";
if (!userName.matches(regist)){
return Massages.fail().add("va_msg","用户名必须是6-16位的字母数字 组合或者3-6位中文");
}
boolean boo = employeeService.checkUser(userName);
if (boo){
return Massages.Success();
}else{
return Massages.fail().add("va_msg","用户名不可用");
}
}
}
| [
"atomzhang0379"
] | atomzhang0379 |
7e8060d6dc8aaed740e97d6b47965456e22a1c44 | c9545e651ab1008f6e77c1d7e84b27081bfa51fa | /Projetos/ACBrLib/Demos/Java/NCMs/Demo/ACBrLibNCMMT.Demo/src/com/acbr/ncm/demo/ACBrLibNCMDemo.java | ce47a56ea989444e78ef4fb46cc146de3cd086d6 | [] | no_license | celioinvictos/ACBR | 169b5760c6fb7395fddeccec040d7a3166efef9f | cade9caaa8a541524b5f3c0db36bfe16ad0f8487 | refs/heads/master | 2023-06-16T20:03:00.197499 | 2023-05-17T14:27:13 | 2023-06-02T14:12:36 | 137,206,154 | 0 | 0 | null | 2022-02-02T12:18:48 | 2018-06-13T11:27:25 | Pascal | UTF-8 | Java | false | false | 1,276 | 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.acbr.ncm.demo;
import javax.swing.ImageIcon;
import javax.swing.UIManager;
/**
*
* @author celso
*/
public class ACBrLibNCMDemo {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
FrmMain frmMain = new FrmMain();
frmMain.setIconImage(new ImageIcon(getClass().getResource("/resources/images/acbr_icon.png")).getImage());
//frmMain.setResizable(false);
//frmMain.setLocationRelativeTo(null);
frmMain.setVisible(true);
}
});
}
}
| [
"celio@invictos.com.br"
] | celio@invictos.com.br |
88e16eaf9e2890a28ea8865f2f3c73b03456da7c | 6b3c3885a7ff7159a7d836d9437a8ccf7f4f513c | /Exerc4/src/Aluno.java | c12a545d668c47b6f1c962b87f3ba1635527d5d7 | [] | no_license | samuelrsouza/Lista-2--Estrutura-de-Dados | 7e25b9e8f7fca5fbd0fadc20c74a2b44fde520ea | b5049bee4763e01d24212f3d76fab29952237a49 | refs/heads/main | 2023-01-18T18:57:52.217946 | 2020-11-15T22:31:13 | 2020-11-15T22:31:13 | 313,134,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | public class Aluno {
String aluno;
String matricula;
Double rendimento;
String nomeCurso;
Aluno prox;
Aluno anterior;
public Aluno(String aluno,String matricula,Double rendimento,String nomeCurso){
this.aluno = aluno;
this.matricula = matricula;
this.rendimento = rendimento;
this.nomeCurso = nomeCurso;
}
public String toString(){
return("Nome do aluno: "+this.aluno+ "\nMatricula: "+this.matricula+"\nCurso: "+this.nomeCurso+ "\nRendimento do aluno: "+this.rendimento + "\n...................." );
}
} | [
"noreply@github.com"
] | samuelrsouza.noreply@github.com |
2b46a571b1e322057d4ff7e8a579a4f1bcaefd42 | 7b0521dfb4ec76ee1632b614f32ee532f4626ea2 | /src/main/java/alcoholmod/Mathioks/MiscChars/SpawnTrayaurus.java | 61df9662540e298936aad029a9f1b234de2b284c | [] | no_license | M9wo/NarutoUnderworld | 6c5be180ab3a00b4664fd74f6305e7a1b50fe9fc | 948065d8d43b0020443c0020775991b91f01dd50 | refs/heads/master | 2023-06-29T09:27:24.629868 | 2021-07-27T03:18:08 | 2021-07-27T03:18:08 | 389,832,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,228 | java | package alcoholmod.Mathioks.MiscChars;
import alcoholmod.Mathioks.AlcoholMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
public class SpawnTrayaurus {
public static void mainRegistry() {
registerEntity();
}
public static void registerEntity() {
createEntity(EntityTrayaurus.class, "ModelTrayaurus Mob", 328965, 11207941);
}
public static void createEntity(Class entityClass, String entityName, int solidColor, int spotColor) {
int randomId = EntityRegistry.findGlobalUniqueEntityId();
EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId);
EntityRegistry.registerModEntity(entityClass, entityName, randomId, AlcoholMod.modInstance, 64, 1, true);
EntityRegistry.addSpawn(entityClass, 1, 0, 1, EnumCreatureType.creature, new BiomeGenBase[] { BiomeGenBase.desert });
createEgg(randomId, solidColor, spotColor);
}
private static void createEgg(int randomid, int solidColor, int spotColor) {
EntityList.entityEggs.put(Integer.valueOf(randomid), new EntityList.EntityEggInfo(randomid, solidColor, spotColor));
}
}
| [
"mrkrank2023@gmail.com"
] | mrkrank2023@gmail.com |
12d41b9b7c93fcb3e15c0d2ad1d552fc8dac8267 | ba55269057e8dc503355a26cfab3c969ad7eb278 | /POSNirvanaServerCommon/src/com/nirvanaxp/services/jaxrs/packets/OrderPaymentWithBatchDetailPacket.java | a66b0c61f1752b337a943741af34a30a2e0b02b0 | [
"Apache-2.0"
] | permissive | apoorva223054/SF3 | b9db0c86963e549498f38f7e27f65c45438b2a71 | 4dab425963cf35481d2a386782484b769df32986 | refs/heads/master | 2022-03-07T17:13:38.709002 | 2020-01-29T05:19:06 | 2020-01-29T05:19:06 | 236,907,773 | 0 | 0 | Apache-2.0 | 2022-02-09T22:46:01 | 2020-01-29T05:10:51 | Java | UTF-8 | Java | false | false | 637 | java | package com.nirvanaxp.services.jaxrs.packets;
import javax.xml.bind.annotation.XmlRootElement;
import com.nirvanaxp.types.entities.orders.BatchDetail;
@XmlRootElement(name = "OrderWithBatchDetailPacket")
public class OrderPaymentWithBatchDetailPacket extends PostPacket{
private String[] orderPaymentIds;
private String batchId;
public String[] getOrderPaymentIds() {
return orderPaymentIds;
}
public void setOrderPaymentIds(String[] orderPaymentIds) {
this.orderPaymentIds = orderPaymentIds;
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId;
}
}
| [
"naman223054@gmail.com"
] | naman223054@gmail.com |
610c6eaef0645d93e19d371d9c3998d4339c6ba4 | c35c47d59fbafe61ea4617de89fe109ab418f47e | /src/life/topicCircle/dao/impl/TopicContentPraiseDaoHibernate5.java | 35cac39942e38ffe037ef4ffb8c9daa6b4bf7481 | [] | no_license | cpt1234/gitLoveZZU | 11ca4d2c5035487877a75e7d21e90897720b6538 | ea2aaec5719ea04baaea7891c3096304cbe13974 | refs/heads/master | 2021-07-16T14:09:35.972622 | 2018-04-12T06:41:29 | 2018-04-12T06:41:29 | 95,945,255 | 0 | 0 | null | 2018-04-12T06:41:30 | 2017-07-01T05:56:40 | Java | UTF-8 | Java | false | false | 361 | java | package life.topicCircle.dao.impl;
import org.springframework.stereotype.Repository;
import com.zzu.common.dao.impl.BaseDaoHibernate5;
import life.topicCircle.dao.TopicContentPraiseDao;
@Repository(value="topicContentPraiseDaoHibernate5")
public class TopicContentPraiseDaoHibernate5 <T> extends BaseDaoHibernate5<T> implements TopicContentPraiseDao<T> {
}
| [
"weiqi.han@qq.com"
] | weiqi.han@qq.com |
923ab5d3236f7f284269755d4f664cdf05a693f1 | f57995ae92becfaf76834748088bf2ac0a847c0f | /src/test/java/com/TestCases/Admin/FeesAndTaxes_NavigationTestCases.java | a94c3a411d38b1d591c2d8ad14f887dcf9f16552 | [] | no_license | viveksingh1992/tdd-smoke-automation | e75d23aee3f0d0fdcfc0af4c773a0f46f8031076 | b0b70cad9d29415d00eb3240efb17c94e8a1a263 | refs/heads/master | 2020-05-04T21:35:18.391770 | 2019-04-04T11:13:57 | 2019-04-04T11:13:57 | 179,482,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,219 | java | package com.TestCases.Admin;
import org.apache.log4j.xml.DOMConfigurator;
import org.testng.Assert;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import com.Actions.Admin.FeesAndTaxes_FeesActions;
import com.utilities.Environment;
import com.utilities.Log;
import com.utilities.TestBase;
import com.utilities.TestStatistics;
import com.utilities.WebDriverUtils;
@Listeners(com.utilities.TestStatistics.class)
public class FeesAndTaxes_NavigationTestCases extends TestBase {
@Test(retryAnalyzer = TestStatistics.class)
public static void FeesNavigationTest() throws Exception {
DOMConfigurator.configure("Log4j.xml");
try {
Log.startTestCase("Fees page navigation test");
tempTest = report.startTest("Fees page navigation test");
boolean status = FeesAndTaxes_FeesActions.FeesNavigation();
Assert.assertTrue(status);
Log.info(Environment.ReadExcelData("Global_Validater", 1, 1));
Log.endTestCase("Fees page navigation test");
} catch (Exception e) {
WebDriverUtils.TakeScreenShot();
Log.error(e);
Log.info(Environment.ReadExcelData("Global_Validater", 2, 1));
Log.endTestCase("Fees page navigation test");
Assert.fail(e.getMessage());
}
}
}
| [
"vsingh@DMIINDIA.LOCAL"
] | vsingh@DMIINDIA.LOCAL |
ebcadf044aca4441c5ab6309c9bd1f9b2c54b912 | ec74f84fa309aabb6212c4ff1b778737a88b246a | /app/src/main/java/solutions/theta/notificationsdemo/NotificationActivity.java | 8a3916a6efafab2f9f8bcea62c4bf12cb7986750 | [] | no_license | waseemabbas8/NotificationsDemo | 1ea85838c033c76761f9069ab3c0088400b9a4b9 | 77cff9416c8e464d99ae6fe7a542f020aa4439c6 | refs/heads/master | 2020-04-08T15:38:14.437795 | 2018-11-28T10:19:23 | 2018-11-28T10:19:23 | 159,486,293 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,826 | java | package solutions.theta.notificationsdemo;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class NotificationActivity extends AppCompatActivity {
Button mbtn;
EditText mtitle;
EditText msubject;
EditText mbody;
int mNotificationid=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notification);
mbtn=(Button)findViewById(R.id.button);
mbody=(EditText) findViewById(R.id.edbody);
msubject=(EditText) findViewById(R.id.etsubject);
mtitle=(EditText) findViewById(R.id.ettitle);
}
public void shownotification(View view) {
long v[]=new long[]{100,100};
NotificationManager mnotificationManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
String mt=mtitle.getText().toString();
String ms=msubject.getText().toString();
String mb=mbody.getText().toString();
Notification mnotification=new Notification.Builder(getApplicationContext()).setContentTitle(mt).setContentText(mb).setSubText(ms).setSmallIcon(R.mipmap.ic_launcher).setVibrate(v).build();
mnotification.sound= Uri.parse("android.resource://"+getPackageName()+"/raw/tune");
mnotification.flags |=Notification.FLAG_AUTO_CANCEL;
// mnotification.flags |=Notification.DEFAULT_VIBRATE;
mnotificationManager.notify(mNotificationid,mnotification);
mNotificationid++;
}
} | [
"wajutt8@gmail.com"
] | wajutt8@gmail.com |
0c71bd365d3f9a0ae3c67b5ea86734cd58c0692f | 827c7688645b4243020fba5a420ac6d284080ac2 | /src/java/com/Model/ConceptoPagos.java | b4c02f1ec6edcedcb3b9e10f80369eaa18361dcc | [] | no_license | abelflz/ProyectoWebIntegracionOS | a5191e0bdadf5a6b133faa0abda853200bdf0e12 | 81ac9168eb4acc2275956479022ef23bbf10f897 | refs/heads/master | 2021-01-02T09:18:38.005048 | 2017-08-10T01:21:40 | 2017-08-10T01:21:40 | 99,190,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 927 | java | package com.Model;
public class ConceptoPagos {
private int Id;
private String Descripcion, Estado;
public ConceptoPagos() {
}
public ConceptoPagos(String Descripcion, String Estado) {
this.Descripcion = Descripcion;
this.Estado = Estado;
}
public ConceptoPagos(int Id, String Descripcion, String Estado) {
this.Id = Id;
this.Descripcion = Descripcion;
this.Estado = Estado;
}
public int getId() {
return Id;
}
public void setId(int Id) {
this.Id = Id;
}
public String getDescripcion() {
return Descripcion;
}
public void setDescripcion(String Descripcion) {
this.Descripcion = Descripcion;
}
public String getEstado() {
return Estado;
}
public void setEstado(String Estado) {
this.Estado = Estado;
}
}
| [
"abelf@Abel-PC"
] | abelf@Abel-PC |
8f222669e7d3cefe838f7bf9d8a0dd45b385fe3d | 44898589036c36664fb6ebabadae69910ee0206a | /src/Idle.java | 06c14506b9d2bfdf9de0254346150cc378136a06 | [] | no_license | SSP16SCM59S/Model-Driven-Architecture | c1419cabbbc27192853e9c26b9f9fba2635d21a3 | 2b9397902ab0ac212fc81236e5e7e81bf75d2d6a | refs/heads/master | 2020-12-24T18:51:04.307957 | 2016-05-03T01:47:26 | 2016-05-03T01:47:26 | 57,872,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | import java.io.*;
import java.util.*;
public class Idle extends States{
public Idle(EFSM e,AbstractFactory a,Datastore d)
{
super(e,a,d);//sets new parameters
}
public void login()
{
obj.newState(2);//State is changed to CheckPin
}
public void wrongLogin()
{
obj1.wrongIdMessage();//Displays a message if id is incorrect
}
}
| [
"sshanka5@hawk.iit.edu"
] | sshanka5@hawk.iit.edu |
c70f9ed106938a8a714d3a4d75f081c97b90a271 | e08480e55f4a8fc02abe72d9eac36bb8f1064ed5 | /jvm/src/main/java/com/imooc/monitor_tuning/MonitorTuningApplication.java | c3b1f908d3c4ffce4e40ae5a2188cb921452fa67 | [] | no_license | jwnc/rocket | c851388eff02520c011614fa312c6cc2054fcf7d | 8e997c3939bfd7f8611b98eb711c70d2acf3a2db | refs/heads/master | 2020-03-30T06:26:18.651687 | 2019-01-29T12:35:05 | 2019-01-29T12:35:05 | 150,861,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 706 | java | package com.imooc.monitor_tuning;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
public class MonitorTuningApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(MonitorTuningApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(MonitorTuningApplication.class);
}
}
| [
"nengcai.wang@ucarinc.com"
] | nengcai.wang@ucarinc.com |
10ea4d37735e4d453e169c08d7ebc04187672293 | 7cca8fd271a7cc7d923e3ce13d2251b52c7cf386 | /src/main/java/aop/App.java | 24b355ead655d832f2d0109a3bfdc352f2da1e1b | [] | no_license | wxwall/aop | db03ec45b036f5f0cb0bfd70af75c93afe735b4b | 44c2bc15358dc07a670167615b9e3c554128e153 | refs/heads/master | 2020-03-19T08:00:44.345939 | 2018-12-29T04:20:17 | 2018-12-29T04:20:17 | 136,168,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package aop;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args ){
Animals dogImpl = new DogImpl();
AOPHandle aop = new AOPHandle(dogImpl);
ClassLoader classLoader = dogImpl.getClass().getClassLoader();
Animals dog = AnimalsFactory.getAnimals(classLoader,dogImpl.getClass().getInterfaces(),aop);
dog.getName();
}
}
| [
"wxwall@126.com"
] | wxwall@126.com |
3a7944f3b1ac77c3f7161f6413e0d1be9344e62b | 4f203b369bd0fa3f184569a2d17691f053be6518 | /mumSched/src/main/java/com/mumSched/services/BlockService.java | 16b7191ede423613e520f8bcc01d7ccd905658d6 | [] | no_license | LominatGebreselassie/MUM-schedule | 87db31de39c1ce15c00224e4b06028d1757bfaa3 | 5e47c0ed6c53da5afb77eecc3f5e218c441ed1f2 | refs/heads/master | 2020-04-07T15:36:17.023856 | 2018-11-21T17:46:49 | 2018-11-21T17:46:49 | 158,492,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,201 | java | package com.mumSched.services;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mumSched.model.Block;
import com.mumSched.model.Entry;
import com.mumSched.repository.BlockRepository;
@Service
public class BlockService{
@Autowired
private BlockRepository blockRepository;
@Autowired
private EntryService entryService;
public void saveBlock(Block block, Long entry_id) {
Entry currentEntry = entryService.getEntry(new Long(entry_id));
block.setEntry(currentEntry);
currentEntry.getBlocks().add(block);
entryService.saveEntry(currentEntry);
}
public Block getBlock(String blockMonth) {
return blockRepository.findBlockByBlockMonth(blockMonth);
}
public List<Block> getAllBlock() {
return (List<Block>) blockRepository.findAll();
}
public Block getBlockById(Long id) {
return blockRepository.findOne(id);
}
public void deleteBlock(Long id) {
blockRepository.delete(id);
}
public void updateBlock(Block block) {
blockRepository.save(block);
}
public List<Block> getAllBlocksByEntryId(Long id){
return blockRepository.findByEntryId(id);
}
}
| [
"lominatgebreselassie27"
] | lominatgebreselassie27 |
cfa3632a6f75fb06640eeff20f278174ee971236 | 44401164cd19b07850942d16e013e20c9ddf3b0d | /src/main/java/pages/DBValidation.java | f32f2b66cd1fd85211c6b0f1aea27a57e7f6921f | [] | no_license | premmarvin/projectone | 5695eeec673b2963a29635f204607e93e625e934 | 177137c89f27fca65056cd527491a0a7cbdb09b6 | refs/heads/master | 2021-08-22T15:58:48.624671 | 2017-11-30T15:30:49 | 2017-11-30T15:30:49 | 112,606,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,865 | java | package pages;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.openqa.selenium.remote.RemoteWebDriver;
import com.relevantcodes.extentreports.LogStatus;
import supportFiles.ExtentManager;
public class DBValidation extends ExtentManager{
RemoteWebDriver driver;
//Connection URL Syntax: "jdbc:mysql://ipaddress:portnumber/db_name"
/*
* For Staging
*
* public static String dbUrl = "jdbc:mysql://192.168.4.79 :3306/iplisting";
*
* public static String username = "ipuserpp";
*
*
* public static String password = "PPdbtest";
*/
public static String dbUrl = "jdbc:mysql://192.168.4.79 :3306/iplisting";
//Database Username
public static String username = "ipuserpp";
//Database Password
public static String password = "PPdbtest";
public static String first_name;
public static String last_name;
public static String pancard;
public static String hl_user_id;
public static String email;
public static String mobileno;
//String host="192.168.4.79";
public DBValidation(RemoteWebDriver driver){
this.driver=driver;
}
public DBValidation dbvalues() throws SQLException, ClassNotFoundException{
//Connection URL Syntax: "jdbc:mysql://ipaddress:portnumber/db_name"
/*String dbUrl = "jdbc:mysql://192.168.4.79 :3306/iplisting";
//Database Username
String username = "ipuserpp";
//Database Password
String password = "PPdbtest";
//String host="192.168.4.79";
*/
//Query to Execute
//String query1 = "select * from iphomeloan_user_details where hl_user_id = 389;";
String query1 = "select * from iphomeloan_user_details order by hl_user_id desc limit 1;";
//String query2 = "select * from iphomeloan_application where hl_user_id = 389;";
//Load mysql jdbc driver
Class.forName("com.mysql.jdbc.Driver");
//Create Connection to DB
Connection con = DriverManager.getConnection(dbUrl,username,password);
//Create Statement Object
Statement stmt = con.createStatement();
// Execute the SQL Query. Store results in ResultSet
ResultSet rs= stmt.executeQuery(query1);
if(rs.next()){
hl_user_id=rs.getString(1);
System.out.println("hl_user_id"+" : "+hl_user_id);
}
String query2 = "select * from iphomeloan_application where hl_user_id =" + hl_user_id+";";
ResultSet rs2= stmt.executeQuery(query2);
// While Loop to iterate through all data and print results
while (rs2.next()){
first_name=rs2.getString(3);
last_name=rs2.getString(7);
pancard=rs2.getString(10);
email=rs2.getString(16);
mobileno=rs2.getString(18);
/*String profession = rs.getString(6);
String employment_type = rs.getString(7);
System. out.println(profession+" "+employment_type); */
System. out.println("hl_user_id"+ " " +hl_user_id);
System. out.println("first_name"+ " " +first_name);
System. out.println("last_name"+ " " +last_name);
System. out.println("pancard"+ " " +pancard);
System. out.println("email"+ " " +email);
System. out.println("mobileno"+ " " +mobileno);
}
// closing DB Connection
con.close();
return this;
}
public DBValidation UIandDBComparision(){
System. out.println("hl_user_id"+ " " +hl_user_id);
System. out.println("first_name"+ " " +first_name);
System. out.println("last_name"+ " " +last_name);
System. out.println("pancard"+ " " +pancard);
System. out.println("HomeLoanPersonalDetail.FName"+ " " +HomeLoanPersonalDetail.FName);
if(HomeLoanPersonalDetail.FName.equalsIgnoreCase(first_name)&& HomeLoanOffers.emailId.equalsIgnoreCase(email)&&HomeLoanOffers.mobileNumber.equalsIgnoreCase(mobileno)){
System.out.println("FName" + HomeLoanPersonalDetail.FName +", "+ "first_name"+first_name );
test.log(LogStatus.INFO, "Value passed in Application is captured in DB"+"," +"Application Reference"+": "+HomeLoanPersonalDetail.FName+" ,"+" DB Reference"+": "+first_name);
test.log(LogStatus.INFO, "Application Reference"+": "+HomeLoanOffers.emailId+" ,"+" DB Reference"+": "+email);
test.log(LogStatus.INFO, "Application Reference"+": "+HomeLoanOffers.mobileNumber+" ,"+" DB Reference"+": "+mobileno);
}
else{
System.out.println("Not Equal");
}
return this;
}
public DBValidation closeBrowsers(){
driver.quit();
return this;
}
}
| [
"prem.murthy16@gmail.com"
] | prem.murthy16@gmail.com |
578e829d1121a147e647f2b421e84e130e32439b | 6f71386cd5368ba6d25a0c87a8fdd8d2809a509f | /backend/backend/src/main/java/top/allviewit/backstage/myorder/MyOrderController.java | ce1276643c719b365fa08d0ce11aa206ab1c1a17 | [] | no_license | kouke0305/goodgoodxxh | fdaf8e21aeb2cc38179a0908073bba9acf4a3212 | f41c353ba8221adae6841f806421b1c7d87f462d | refs/heads/master | 2020-08-18T11:09:55.827126 | 2019-11-01T01:52:35 | 2019-11-01T01:52:35 | 215,782,398 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,419 | java | package top.allviewit.backstage.myorder;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import top.allviewit.backstage.common.RedisOperator;
import top.allviewit.backstage.common.RespModel;
/**
* @Auther: wubing
* @Date: 2019/3/18 16:48
* @Description:
*/
@RestController
@RequestMapping("myOrder")
public class MyOrderController {
@Autowired
private RedisOperator redis;
@Autowired
private RabbitTemplate rabbitTemplate;
@Autowired
private MyOrderDao myOrderDao;
@RequestMapping("list")
public RespModel getList(@RequestParam(value = "page", defaultValue = "1") Long page,
@RequestParam(value = "pageSize", defaultValue = "50") Long pageSize,
@RequestParam(value = "phone", required = false) String phone) {
PageQuery query = new PageQuery();
query.setPageSize(pageSize);
query.setPageNumber(page);
query.setPara("phone", phone);
myOrderDao.selectOrderByPhone(query);
return new RespModel(true, "我的订单列表", query);
}
}
| [
"万一"
] | 万一 |
1ee022481692df826bc0a5c83519be897c7f0a36 | 6973a9ceb7543b864c35aa3a5f2421c24581cb5d | /src/main/java/com/codetaylor/mc/artisanworktables/modules/toolbox/ModuleToolboxConfigAPIWrapper.java | ebec349969acb0ca121ae09ccec63a307ecc9f66 | [
"Apache-2.0"
] | permissive | copygirl/artisan-worktables | 76bd3256669e207c6fc6d852b11c6e6c8879ccb0 | 7b0b21cb1186536577252ffc2be938d4a2027570 | refs/heads/master | 2022-09-19T09:36:43.241570 | 2020-05-24T17:31:35 | 2020-05-24T17:31:35 | 268,714,742 | 0 | 0 | NOASSERTION | 2020-06-02T06:03:16 | 2020-06-02T06:03:15 | null | UTF-8 | Java | false | false | 1,144 | java | package com.codetaylor.mc.artisanworktables.modules.toolbox;
import com.codetaylor.mc.artisanworktables.api.internal.config.IModuleToolboxConfig;
public class ModuleToolboxConfigAPIWrapper
implements IModuleToolboxConfig {
@Override
public boolean enableModule() {
return ModuleToolboxConfig.ENABLE_MODULE;
}
@Override
public boolean isToolboxEnabled() {
return ModuleToolboxConfig.TOOLBOX.ENABLED;
}
@Override
public boolean isToolboxRestrictedToToolsOnly() {
return ModuleToolboxConfig.TOOLBOX.RESTRICT_TO_TOOLS_ONLY;
}
@Override
public boolean doesToolboxKeepContentsWhenBroken() {
return ModuleToolboxConfig.TOOLBOX.KEEP_CONTENTS_WHEN_BROKEN;
}
@Override
public boolean isMechanicalToolboxEnabled() {
return ModuleToolboxConfig.MECHANICAL_TOOLBOX.ENABLED;
}
@Override
public boolean isMechanicalToolboxRestrictedToToolsOnly() {
return ModuleToolboxConfig.MECHANICAL_TOOLBOX.RESTRICT_TO_TOOLS_ONLY;
}
@Override
public boolean doesMechanicalToolboxKeepContentsWhenBroken() {
return ModuleToolboxConfig.MECHANICAL_TOOLBOX.KEEP_CONTENTS_WHEN_BROKEN;
}
}
| [
"jason@codetaylor.com"
] | jason@codetaylor.com |
8e08bf928286ca3c9255002543687a3ecdd268d6 | e702d5b937dc74d64cb07e60b2f8b1b745cf0984 | /src/cha_3_2/BST_plus_height_recur.java | 8821198c120bf7b6a8e59adafda87efd77de1a05 | [] | no_license | tzcsky/Algorithms_4th | e7bd31d6a856e2fa1f343611372f2bf0a847b9f0 | 8a69c1ff63b5ea7f713c1ff21cdede7574f3f935 | refs/heads/master | 2021-07-24T12:50:12.081721 | 2017-11-05T15:11:25 | 2017-11-05T15:11:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,898 | java | package cha_3_2;
import edu.princeton.cs.algs4.Queue;
import edu.princeton.cs.algs4.StdIn;
import edu.princeton.cs.algs4.StdOut;
public class BST_plus_height_recur<Key extends Comparable<Key>, Value> {
private Node root;
private class Node {
private Key key;
private Value val;
private Node left, right;
private int N;
public Node(Key key, Value val, int N) {
this.key = key;
this.val = val;
this.N = N;
}
}
public int size() {
return size(root);
}
private int size(Node node) {
if (node == null)
return 0;
else
return node.N;
}
public Value get(Key key) {
return get(root, key);
}
private Value get(Node x, Key key) {
if (x == null)
return null;
int cmp = key.compareTo(x.key);
if (cmp < 0)
return get(x.left, key);
if (cmp > 0)
return get(x.right, key);
else
return x.val;
}
public void put(Key key, Value val) {
root = put(root, key, val);
}
private Node put(Node x, Key key, Value val) {
if (x == null)
return new Node(key, val, 1);
int cmp = key.compareTo(x.key);
if (cmp < 0)
x.left = put(x.left, key, val);
else if (cmp > 0)
x.right = put(x.right, key, val);
else
x.val = val;
x.N = size(x.left) + size(x.right) + 1;
return x;
}
public Key min() {
return min(root).key;
}
private Node min(Node x) {
if (x.left == null)
return x;
else
return min(x.left);
}
public Key max() {
return max(root).key;
}
private Node max(Node x) {
if (x.right == null)
return x;
else
return max(x.right);
}
public Key floor(Key key) {
Node x = floor(root, key);
if (x == null)
return null;
return x.key;
}
private Node floor(Node x, Key key) {
if (x == null)
return null;
int cmp = key.compareTo(x.key);
if (cmp < 0)
return floor(x.left, key);
if (cmp == 0)
return x;
Node t = floor(x.right, key);
if (t != null)
return t;
else
return x;
}
public Key ceiling(Key key) {
Node x = ceiling(root, key);
if (x == null)
return null;
return x.key;
}
private Node ceiling(Node x, Key key) {
if (x == null)
return null;
int cmp = key.compareTo(x.key);
if (cmp > 0)
return floor(x.right, key);
if (cmp == 0)
return x;
Node t = floor(x.left, key);
if (t != null)
return t;
else
return x;
}
public Key select(int k) {
return select(root, k).key;
}
private Node select(Node x, int k) {
if (x == null)
return null;
int t = size(x.left);
if (t > k)
return select(x.left, k);
if (t < k)
return select(x.right, k - t - 1);
else
return x;
}
public int rank(Key key) {
return rank(root, key);
}
private int rank(Node x, Key key) {
if (x == null)
return 0;
int cmp = key.compareTo(x.key);
if (cmp < 0)
return rank(x.left, key);
if (cmp > 0)
return 1 + size(x.left) + rank(x.right, key);
else
return size(x.left);
}
public void deletemin() {
root = deletemin(root);
}
private Node deletemin(Node x) {
if (x.left == null)
return x.right;
x.left = deletemin(x.left);
x.N = size(x.left) + size(x.right) + 1;
return x;
}
public void deletemax() {
root = deletemax(root);
}
private Node deletemax(Node x) {
if (x.right == null)
return x.left;
x.right = deletemax(x.right);
x.N = size(x.left) + size(x.right) + 1;
return x;
}
public void delete(Key key) {
root = delete(root, key);
}
private Node delete(Node x, Key key) {
if (x == null)
return null;
int cmp = key.compareTo(x.key);
if (cmp < 0)
x.left = delete(x.left, key);
if (cmp > 0)
x.right = delete(x.right, key);
else {
if (x.right == null)
return x.left;
if (x.left == null)
return x.right;
Node t = x;
x = min(t.right);
x.right = deletemin(t.right);
x.left = t.left;
}
x.N = size(x.left) + size(x.right) + 1;
return x;
}
public Iterable<Key> keys() {
return keys(min(), max());
}
public Iterable<Key> keys(Key lo, Key hi) {
Queue<Key> queue = new Queue<Key>();
keys(root, queue, lo, hi);
return queue;
}
public int height() {
return height(root);
}
private int height(Node x) {
if (x == null)
return -1;
return 1 + Math.max(height(x.left), height(x.right));
}
private void keys(Node x, Queue<Key> queue, Key lo, Key hi) {
if (x == null)
return;
int cmplo = lo.compareTo(x.key);
int cmphi = hi.compareTo(x.key);
if (cmplo < 0)
keys(x.left, queue, lo, hi);
if (cmplo <= 0 && cmphi >= 0)
queue.enqueue(x.key);
if (cmphi > 0)
keys(x.right, queue, lo, hi);
}
public static void main(String[] args) {
BST_plus_height_recur<String, Integer> st = new BST_plus_height_recur<String, Integer>();
for (int i = 0; !StdIn.isEmpty(); i++) {
String key = StdIn.readString();
st.put(key, i);
}
for (String s : st.keys()) {
StdOut.println(s + " " + st.get(s));
}
StdOut.println("The height of the BST is: " + st.height());
}
}
| [
"limingjianbd@gmail.com"
] | limingjianbd@gmail.com |
8d7739bb1e8925dc52bfc1ac28b912ff286609b5 | 8cf0c3d6a0ac636d0abccfe494cab9ef7b0b1deb | /hazelcast-jet/hazelcast-jet-sql/src/main/java/com/hazelcast/jet/sql/impl/connector/map/MetadataPortableResolver.java | 13f666892d4d771cac707523af5d8a1f82a4d872 | [
"Apache-2.0"
] | permissive | delftdata/s-query | f6d22236f1cdcde2eba2ca3741ad8e64b93ac223 | a8197e64b9630263d5a7a29cfa47e8a5f8c75e54 | refs/heads/master | 2023-08-31T16:41:48.796212 | 2021-11-03T20:18:22 | 2021-11-03T20:18:22 | 416,636,860 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,070 | java | /*
* Copyright (c) 2008-2020, Hazelcast, Inc. 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.
* 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.hazelcast.jet.sql.impl.connector.map;
import com.hazelcast.internal.serialization.InternalSerializationService;
import com.hazelcast.jet.sql.impl.connector.keyvalue.KvMetadata;
import com.hazelcast.jet.sql.impl.connector.keyvalue.KvMetadataResolver;
import com.hazelcast.jet.sql.impl.inject.PortableUpsertTargetDescriptor;
import com.hazelcast.jet.sql.impl.schema.MappingField;
import com.hazelcast.nio.serialization.ClassDefinition;
import com.hazelcast.nio.serialization.FieldDefinition;
import com.hazelcast.nio.serialization.FieldType;
import com.hazelcast.sql.impl.QueryException;
import com.hazelcast.sql.impl.extract.GenericQueryTargetDescriptor;
import com.hazelcast.sql.impl.extract.QueryPath;
import com.hazelcast.sql.impl.schema.TableField;
import com.hazelcast.sql.impl.schema.map.MapTableField;
import com.hazelcast.sql.impl.type.QueryDataType;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import static com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_CLASS_ID;
import static com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_CLASS_VERSION;
import static com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_KEY_FACTORY_ID;
import static com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_VALUE_CLASS_ID;
import static com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_VALUE_CLASS_VERSION;
import static com.hazelcast.jet.sql.impl.connector.SqlConnector.OPTION_VALUE_FACTORY_ID;
import static com.hazelcast.jet.sql.impl.connector.SqlConnector.PORTABLE_FORMAT;
import static com.hazelcast.jet.sql.impl.connector.keyvalue.KvMetadataResolvers.extractFields;
import static com.hazelcast.jet.sql.impl.connector.keyvalue.KvMetadataResolvers.maybeAddDefaultField;
import static java.lang.Integer.parseInt;
final class MetadataPortableResolver implements KvMetadataResolver {
static final MetadataPortableResolver INSTANCE = new MetadataPortableResolver();
private MetadataPortableResolver() {
}
@Override
public String supportedFormat() {
return PORTABLE_FORMAT;
}
@Override
public List<MappingField> resolveAndValidateFields(
boolean isKey,
List<MappingField> userFields,
Map<String, String> options,
InternalSerializationService serializationService
) {
ClassDefinition classDefinition = resolveClassDefinition(isKey, options, serializationService);
return resolveFields(isKey, userFields, classDefinition);
}
List<MappingField> resolveFields(
boolean isKey,
List<MappingField> userFields,
ClassDefinition clazz
) {
Set<Entry<String, FieldType>> fieldsInClass = resolvePortable(clazz).entrySet();
Map<QueryPath, MappingField> userFieldsByPath = extractFields(userFields, isKey);
if (!userFields.isEmpty()) {
// the user used explicit fields in the DDL, just validate them
for (Entry<String, FieldType> classField : fieldsInClass) {
QueryPath path = new QueryPath(classField.getKey(), isKey);
QueryDataType type = resolvePortableType(classField.getValue());
MappingField mappingField = userFieldsByPath.get(path);
if (mappingField != null && !type.getTypeFamily().equals(mappingField.type().getTypeFamily())) {
throw QueryException.error("Mismatch between declared and resolved type: " + mappingField.name());
}
}
return new ArrayList<>(userFieldsByPath.values());
} else {
List<MappingField> fields = new ArrayList<>();
for (Entry<String, FieldType> classField : fieldsInClass) {
QueryPath path = new QueryPath(classField.getKey(), isKey);
QueryDataType type = resolvePortableType(classField.getValue());
String name = classField.getKey();
fields.add(new MappingField(name, type, path.toString()));
}
return fields;
}
}
private static Map<String, FieldType> resolvePortable(ClassDefinition classDefinition) {
Map<String, FieldType> fields = new LinkedHashMap<>();
for (int i = 0; i < classDefinition.getFieldCount(); i++) {
FieldDefinition fieldDefinition = classDefinition.getField(i);
fields.putIfAbsent(fieldDefinition.getName(), fieldDefinition.getType());
}
return fields;
}
@SuppressWarnings("checkstyle:ReturnCount")
private static QueryDataType resolvePortableType(FieldType type) {
switch (type) {
case BOOLEAN:
return QueryDataType.BOOLEAN;
case BYTE:
return QueryDataType.TINYINT;
case SHORT:
return QueryDataType.SMALLINT;
case CHAR:
return QueryDataType.VARCHAR_CHARACTER;
case UTF:
return QueryDataType.VARCHAR;
case INT:
return QueryDataType.INT;
case LONG:
return QueryDataType.BIGINT;
case FLOAT:
return QueryDataType.REAL;
case DOUBLE:
return QueryDataType.DOUBLE;
default:
return QueryDataType.OBJECT;
}
}
@Override
public KvMetadata resolveMetadata(
boolean isKey,
List<MappingField> resolvedFields,
Map<String, String> options,
InternalSerializationService serializationService
) {
ClassDefinition clazz = resolveClassDefinition(isKey, options, serializationService);
return resolveMetadata(isKey, resolvedFields, clazz);
}
KvMetadata resolveMetadata(
boolean isKey,
List<MappingField> resolvedFields,
ClassDefinition clazz
) {
Map<QueryPath, MappingField> externalFieldsByPath = extractFields(resolvedFields, isKey);
List<TableField> fields = new ArrayList<>();
for (Entry<QueryPath, MappingField> entry : externalFieldsByPath.entrySet()) {
QueryPath path = entry.getKey();
QueryDataType type = entry.getValue().type();
String name = entry.getValue().name();
fields.add(new MapTableField(name, type, false, path));
}
maybeAddDefaultField(isKey, resolvedFields, fields);
return new KvMetadata(
fields,
GenericQueryTargetDescriptor.DEFAULT,
new PortableUpsertTargetDescriptor(
clazz.getFactoryId(),
clazz.getClassId(),
clazz.getVersion()
)
);
}
private ClassDefinition resolveClassDefinition(
boolean isKey,
Map<String, String> options,
InternalSerializationService serializationService
) {
String factoryIdProperty = isKey ? OPTION_KEY_FACTORY_ID : OPTION_VALUE_FACTORY_ID;
String factoryId = options.get(factoryIdProperty);
String classIdProperty = isKey ? OPTION_KEY_CLASS_ID : OPTION_VALUE_CLASS_ID;
String classId = options.get(classIdProperty);
String classVersionProperty = isKey ? OPTION_KEY_CLASS_VERSION : OPTION_VALUE_CLASS_VERSION;
String classVersion = options.getOrDefault(classVersionProperty, "0");
if (factoryId == null || classId == null || classVersion == null) {
throw QueryException.error(
"Unable to resolve table metadata. Missing ['"
+ factoryIdProperty + "'|'"
+ classIdProperty + "'|'"
+ classVersionProperty
+ "'] option(s)");
}
ClassDefinition classDefinition = serializationService
.getPortableContext()
.lookupClassDefinition(parseInt(factoryId), parseInt(classId), parseInt(classVersion));
if (classDefinition == null) {
throw QueryException.error(
"Unable to find class definition for factoryId: " + factoryId
+ ", classId: " + classId + ", classVersion: " + classVersion
);
}
return classDefinition;
}
}
| [
"jim.verheijde@hotmail.com"
] | jim.verheijde@hotmail.com |
91cfbca50caced0394ece2884cde7a4fcb04a1e9 | 8fee4aae026894659dad2a302a0553331e697b98 | /app/src/main/java/cn/xcom/helper/activity/SaleFindActivity.java | 72cb0ed4341c0dfb180dabf1f20edaf9e28bdba7 | [] | no_license | Badreamm/bang | 70e78bb1f60a34d4858e1989db478036543c7981 | 67d2869b54a62d915c000aa52477e58d0ca63c82 | refs/heads/master | 2021-01-22T23:10:23.144373 | 2017-08-18T02:09:52 | 2017-08-18T02:09:52 | 92,800,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,367 | java | package cn.xcom.helper.activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jcodecraeer.xrecyclerview.ProgressStyle;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import butterknife.ButterKnife;
import cn.xcom.helper.HelperApplication;
import cn.xcom.helper.R;
import cn.xcom.helper.adapter.SaleAdapter;
import cn.xcom.helper.bean.Front;
import cn.xcom.helper.constant.NetConstant;
import cn.xcom.helper.utils.SingleVolleyRequest;
import cn.xcom.helper.utils.StringPostRequest;
import cn.xcom.helper.utils.ToastUtil;
import cn.xcom.helper.utils.ToastUtils;
import cn.xcom.helper.view.DividerItemDecoration;
/**
* Created by Administrator on 2017/4/5 0005.
*/
public class SaleFindActivity extends BaseActivity implements View.OnClickListener {
public ImageView img_back;
public XRecyclerView lv_find;
public TextView tv_find;
public EditText et_find;
private SaleAdapter saleAdapter;
private String keyWord;
private List<Front> addlist = new ArrayList<>();
private String currentType = "0";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sale_find);
ButterKnife.bind(this);
lv_find = (XRecyclerView) findViewById(R.id.list_find);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
lv_find.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);
lv_find.setLoadingMoreProgressStyle(ProgressStyle.BallRotate);
lv_find.setLayoutManager(linearLayoutManager);
lv_find.addItemDecoration(new DividerItemDecoration(this
, DividerItemDecoration.VERTICAL_LIST));
lv_find.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override
public void onRefresh() {
getNewData(currentType, keyWord);
}
@Override
public void onLoadMore() {
getMore(currentType, keyWord);
}
});
saleAdapter = new SaleAdapter(addlist, SaleFindActivity.this);
initView();
getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}
private void initView() {
img_back = (ImageView) findViewById(R.id.sale_back);
img_back.setOnClickListener(this);
tv_find = (TextView) findViewById(R.id.tv_find);
tv_find.setOnClickListener(this);
et_find = (EditText) findViewById(R.id.sfa_search_edt);
et_find.setOnClickListener(this);
keyWord = getIntent().getStringExtra("keyword");
if (!HelperApplication.getInstance().saleBack) {
getNewData(currentType, keyWord);
}
HelperApplication.getInstance().saleBack = false;
}
private void getNewData(String type, String keyWord) {
String url = NetConstant.GOODSLIST;
StringPostRequest request = new StringPostRequest(url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
try {
Log.d("=====显示111", "" + s);
JSONObject jsonObject = new JSONObject(s);
String state = jsonObject.getString("status");
if (state.equals("success")) {
String jsonObject1 = jsonObject.getString("data");
Gson gson = new Gson();
addlist.clear();
List<Front> fronts = gson.fromJson(jsonObject1,
new TypeToken<ArrayList<Front>>() {
}.getType());
Log.e("========fragment", "" + addlist.size());
addlist.addAll(fronts);
saleAdapter = new SaleAdapter(addlist, SaleFindActivity.this);
lv_find.setAdapter(saleAdapter);
// ToastUtils.showToast(mContext, "刷新成功");
} else {
addlist.clear();
saleAdapter.notifyDataSetChanged();
}
} catch (JSONException e) {
e.printStackTrace();
}
lv_find.refreshComplete();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
ToastUtils.showToast(getApplication(), "网络连接错误,请检查您的网络");
lv_find.refreshComplete();
}
});
request.putValue("city", HelperApplication.getInstance().mDistrict);
request.putValue("type", type);
request.putValue("beginid", "0");
request.putValue("keyword", keyWord);
SingleVolleyRequest.getInstance(getApplication()).addToRequestQueue(request);
}
private void getMore(String type, String keyWord) {
String url = NetConstant.GOODSLIST;
StringPostRequest request = new StringPostRequest(url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
try {
JSONObject jsonObject = new JSONObject(s);
Log.d("---goodslist", jsonObject.toString());
String state = jsonObject.getString("status");
if (state.equals("success")) {
String jsonObject1 = jsonObject.getString("data");
Gson gson = new Gson();
List<Front> fronts = gson.fromJson(jsonObject1,
new TypeToken<ArrayList<Front>>() {
}.getType());
addlist.addAll(fronts);
} else if (state.equals("error")) {
lv_find.noMoreLoading();
}
} catch (JSONException e) {
e.printStackTrace();
}
lv_find.loadMoreComplete();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
ToastUtils.showToast(getApplication(), "网络连接错误,请检查您的网络");
lv_find.loadMoreComplete();
}
});
request.putValue("city", HelperApplication.getInstance().mDistrict);
Front front = addlist.get(addlist.size() - 1);
Log.d("---front", front.getId() + "" + "city" + HelperApplication.getInstance().mDistrict + "type" + type + "keyword");
request.putValue("type", type);
request.putValue("beginid", front.getId());
request.putValue("keyword", keyWord);
SingleVolleyRequest.getInstance(getApplication()).addToRequestQueue(request);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.sale_back:
finish();
break;
case R.id.tv_find:
keyWord = et_find.getText().toString();
if (keyWord.equals("")) {
ToastUtil.showShort(SaleFindActivity.this, "请输入要搜索的内容");
} else {
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(SaleFindActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
getNewData(currentType, keyWord);
}
break;
case R.id.sfa_search_edt:
break;
}
}
}
| [
"hzh494299@gmail.com"
] | hzh494299@gmail.com |
bc977f3d961500b0f15c70735637c7e43b3beea5 | 531b37395b041f7598570d7455c70a03a65045ea | /src/Lotteria/BigRibBurger.java | fc15bb7bef2d73dc5c964a196d08ce938dcb9b22 | [] | no_license | noinel/eqwqe | 82a909c20319962f0fc1cabb9f9d28fa77a645ac | 2be72dc33a1f5801fe9f7b84692a9b1618426736 | refs/heads/master | 2020-04-28T02:20:56.834377 | 2019-03-11T00:42:39 | 2019-03-11T00:42:39 | 174,895,020 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 568 | java | package Lotteria;
//접근 지정자 public 어디에서든 찾을 수 있음
//접근 지정자private 자기클래스 내에서만 찾을 수 있음
//접근 지정자가 없으면, 같은 패키지내에서만 찾을 수 있음
public class BigRibBurger implements Menu{
//
private int price;
private String desc;
public BigRibBurger() {
}
public BigRibBurger(int price, String desc) {
this.price = price;
this.desc = desc;
}
public int getPrice() {
return price;
}
public String getDesc() {
return desc;
}
}
| [
"noreply@github.com"
] | noinel.noreply@github.com |
f7fdf5e60b8e5585956ce939f215b63d298b831b | 57bf34bdb6ae31fdff8b8c87e73ba27d8916610b | /src/main/java/chapter9/ex12/Adventure.java | 94c3958a7284ed1c6f108cfd84d40d7a54d1199f | [] | no_license | Nazar910/PhilosophyOfJavaProjects | ecbe207f79b1eecb4b5e954f91c7522831aa62cb | 610a1ed6d39e30ee4ec9a8522d40554d86195004 | refs/heads/master | 2021-03-22T03:04:28.243593 | 2017-02-25T10:23:49 | 2017-02-25T10:23:49 | 80,540,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | package chapter9.ex12;
/**
* Created by pyvov on 07.01.2017.
*/
interface CanFight {
void fight();
}
interface CanSwim {
void swim();
}
interface CanFly {
void fly();
}
interface CanClimb {
void climb();
}
class ActionCharacter {
public void fight() {
}
}
class Hero extends ActionCharacter
implements CanFight, CanSwim, CanFly, CanClimb {
public void fly() {
}
public void swim() {
}
public void climb() {
}
}
public class Adventure {
public static void t(CanFight x) { x.fight(); }
public static void u(CanSwim x) { x.swim(); }
public static void v(CanFly x) { x.fly(); }
public static void c(CanClimb x) { x.climb(); }
public static void w(ActionCharacter x) { x.fight(); }
public static void main(String[] args) {
Hero h = new Hero();
t(h);
u(h);
v(h);
w(h);
c(h);
}
}
| [
"pyvovarnazar@gmail.com"
] | pyvovarnazar@gmail.com |
ecb9550c34e914b7ff47bc08931994a8758cdc1e | 5ecd15baa833422572480fad3946e0e16a389000 | /framework/MCS-Open/subsystems/runtime/main/impl/java/com/volantis/mcs/protocols/widgets/renderers/BlockDefaultRenderer.java | e3c8f39b2391fdfff34b2796ff46c62852d9c3da | [] | no_license | jabley/volmobserverce | 4c5db36ef72c3bb7ef20fb81855e18e9b53823b9 | 6d760f27ac5917533eca6708f389ed9347c7016d | refs/heads/master | 2021-01-01T05:31:21.902535 | 2009-02-04T02:29:06 | 2009-02-04T02:29:06 | 38,675,289 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,332 | java | /*
This file is part of Volantis Mobility Server.
Volantis Mobility Server 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.
Volantis Mobility Server 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 Volantis Mobility Server. If not, see <http://www.gnu.org/licenses/>.
*/
/* ----------------------------------------------------------------------------
* (c) Volantis Systems Ltd 2006.
* ----------------------------------------------------------------------------
*/
package com.volantis.mcs.protocols.widgets.renderers;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Stack;
import com.volantis.mcs.context.MarinerPageContext;
import com.volantis.mcs.localization.LocalizationFactory;
import com.volantis.mcs.protocols.MCSAttributes;
import com.volantis.mcs.protocols.ProtocolException;
import com.volantis.mcs.protocols.VolantisProtocol;
import com.volantis.mcs.protocols.widgets.ActionName;
import com.volantis.mcs.protocols.widgets.EventName;
import com.volantis.mcs.protocols.widgets.PropertyName;
import com.volantis.mcs.protocols.widgets.attributes.BlockAttributes;
import com.volantis.mcs.protocols.widgets.attributes.FetchAttributes;
import com.volantis.mcs.protocols.widgets.attributes.LoadAttributes;
import com.volantis.mcs.protocols.widgets.attributes.RefreshAttributes;
import com.volantis.mcs.protocols.widgets.internal.attributes.BlockContainerAttributes;
import com.volantis.mcs.protocols.widgets.internal.attributes.EffectBlockAttributes;
import com.volantis.mcs.protocols.widgets.internal.renderers.EffectBlockDefaultRenderer;
import com.volantis.mcs.themes.StylePropertyDetails;
import com.volantis.mcs.themes.properties.DisplayKeywords;
import com.volantis.mcs.utilities.MarinerURL;
import com.volantis.mcs.runtime.scriptlibrarymanager.WidgetScriptModules;
import com.volantis.styling.StylingFactory;
import com.volantis.synergetics.log.LogDispatcher;
/**
* Widget renderer for Container widget suitable for HTML protocols.
*/
public class BlockDefaultRenderer extends WidgetDefaultRenderer {
/**
* Array of supported action names.
*/
private static final ActionName[] SUPPORTED_ACTION_NAMES =
{
ActionName.SHOW,
ActionName.HIDE,
ActionName.CLEAR_CONTENT,
ActionName.SHOW_CONTENT,
ActionName.HIDE_CONTENT,
};
/**
* Array of supported property names.
*/
private static final PropertyName[] SUPPORTED_PROPERTY_NAMES =
{
PropertyName.STATUS,
PropertyName.CONTENT_STATUS,
PropertyName.CONTENT,
PropertyName.DISPLAYED_CONTENT,
PropertyName.LOAD,
PropertyName.FETCH,
PropertyName.REFRESH,
};
/**
* Array of supported event names.
*/
private static final EventName[] SUPPORTED_EVENT_NAMES =
{
EventName.HIDING,
EventName.HIDDEN,
EventName.SHOWING,
EventName.SHOWN,
EventName.CONTENT_HIDING,
EventName.CONTENT_HIDDEN,
EventName.CONTENT_SHOWING,
EventName.CONTENT_SHOWN,
};
/**
* Used for logging.
*/
private static final LogDispatcher logger =
LocalizationFactory.createLogger(EffectBlockDefaultRenderer.class);
private EffectBlockAttributes outerEffectBlockAttributes;
private EffectBlockAttributes innerEffectBlockAttributes;
private BlockContainerAttributes blockContainerAttributes;
private Stack blockIdStack = new Stack();
private boolean containsBlockContent;
// Javadoc inherited.
public void doRenderOpen(VolantisProtocol protocol,
MCSAttributes attributes) throws ProtocolException {
// If protocol does not support Framework Client, render the div element only.
if (!isWidgetSupported(protocol)) {
return;
}
require(WidgetScriptModules.BASE_BB_BLOCK, protocol, attributes);
if (attributes.getId() == null) {
attributes.setId(protocol.getMarinerPageContext().generateUniqueFCID());
}
// Open outer EffectBlock widget, which will be used to show/hide this
// Block widget.
outerEffectBlockAttributes = new EffectBlockAttributes();
outerEffectBlockAttributes.copy(attributes);
outerEffectBlockAttributes.setId(protocol.getMarinerPageContext().generateUniqueFCID());
getWidgetDefaultModule(protocol)
.getWidgetRenderer(outerEffectBlockAttributes)
.renderOpen(protocol, outerEffectBlockAttributes);
// Open inner EffectBlock widget, which will be used to show/hide the
// content of this Block widgets.
innerEffectBlockAttributes = new EffectBlockAttributes();
innerEffectBlockAttributes.setId(protocol.getMarinerPageContext().generateUniqueFCID());
innerEffectBlockAttributes.setStyles(StylingFactory.getDefaultInstance()
.createInheritedStyles(
protocol.getMarinerPageContext().getStylingEngine()
.getStyles(), DisplayKeywords.BLOCK));
getWidgetDefaultModule(protocol)
.getWidgetRenderer(innerEffectBlockAttributes)
.renderOpen(protocol, innerEffectBlockAttributes);
// Open BlockContainer widget, which will be used to change the content
// of this Block widget.
blockContainerAttributes = new BlockContainerAttributes();
blockContainerAttributes.setId(protocol.getMarinerPageContext().generateUniqueFCID());
blockContainerAttributes.setStyles(StylingFactory.getDefaultInstance()
.createInheritedStyles(
protocol.getMarinerPageContext().getStylingEngine()
.getStyles(), DisplayKeywords.BLOCK));
getWidgetDefaultModule(protocol)
.getWidgetRenderer(blockContainerAttributes)
.renderOpen(protocol, blockContainerAttributes);
openingBlock(attributes.getId());
}
// Javadoc inherited.
public void doRenderClose(VolantisProtocol protocol,
MCSAttributes attributes) throws ProtocolException {
if (!isWidgetSupported(protocol)) {
return;
}
// require AJAX script module
BlockAttributes blockAttributes = (BlockAttributes)attributes;
if ( blockAttributes.getRefreshAttributes() != null || blockAttributes.getLoadAttributes() != null || blockAttributes.getFetchAttributes() != null ) {
require(WidgetScriptModules.BASE_AJAX, protocol, attributes);
}
closingBlock();
// If this Block contains a BlockContent child element,
// the inner effect block should be rendered with Display.BLOCK style,
// and not Display.NONE.
if (!containsBlockContent) {
innerEffectBlockAttributes.getStyles().getPropertyValues()
.setComputedAndSpecifiedValue(StylePropertyDetails.DISPLAY, DisplayKeywords.NONE);
}
// Close BlockContent, BlockContainer, EffectBlock and Div elements.
getWidgetDefaultModule(protocol)
.getWidgetRenderer(blockContainerAttributes)
.renderClose(protocol, blockContainerAttributes);
getWidgetDefaultModule(protocol)
.getWidgetRenderer(innerEffectBlockAttributes)
.renderClose(protocol, innerEffectBlockAttributes);
getWidgetDefaultModule(protocol)
.getWidgetRenderer(outerEffectBlockAttributes)
.renderClose(protocol, outerEffectBlockAttributes);
// Render JavaScript
StringBuffer buffer = new StringBuffer();
if (attributes.getId() != null) {
buffer.append("$RW(")
.append(createJavaScriptString(attributes.getId()))
.append(",");
addCreatedWidgetId(attributes.getId());
}
buffer.append("new Widget.Block(")
.append(createJavaScriptWidgetReference(outerEffectBlockAttributes.getId()))
.append(",")
.append(createJavaScriptWidgetReference(innerEffectBlockAttributes.getId()))
.append(",")
.append(createJavaScriptWidgetReference(blockContainerAttributes.getId()));
addUsedWidgetId(outerEffectBlockAttributes.getId());
addUsedWidgetId(innerEffectBlockAttributes.getId());
addUsedWidgetId(blockContainerAttributes.getId());
// initialize and add action widget if exists inside XDIME element
boolean delimited = false;
buffer.append(",{");
if(((BlockAttributes)attributes).getFetchAttributes() != null) {
require(WidgetScriptModules.BASE_BB_FETCH, protocol, attributes);
// render javascript constructor
FetchAttributes fetchAttrs = ((BlockAttributes)attributes).getFetchAttributes();
buffer.append("fetch: new Widget.BlockFetch({src: '");
buffer.append(fetchAttrs.getSrc() + "'");
// add localization of installed MCS
buffer.append(", pageBase : '/").append(protocol.getMarinerPageContext()
.getVolantisBean().getPageBase()).append("'");
if(fetchAttrs.getTransformation() != null) {
buffer.append(", transformation: '");
MarinerPageContext pageContext = protocol.getMarinerPageContext();
// get MarinerURL to page with xsl
MarinerURL marinerURL = pageContext.getRequestURL(true);
URI path = null;
try {
path = new URI(marinerURL.getExternalForm());
} catch (URISyntaxException e) {
throw new IllegalStateException("URI to xsl transformation template is invalid");
}
URI fullPath = path.resolve(fetchAttrs.getTransformation());
buffer.append(fullPath.toString() + "'");
}
if(fetchAttrs.getService() != null) {
buffer.append(", service: '");
buffer.append(fetchAttrs.getService() + "'");
}
if(fetchAttrs.getWhen() != null) {
buffer.append(", when: '");
buffer.append(fetchAttrs.getWhen() + "'");
}
if(fetchAttrs.getTransformCache() != null) {
buffer.append(", transformCache: '");
buffer.append(fetchAttrs.getTransformCache() + "'");
}
if(fetchAttrs.getTransformCompile() != null) {
buffer.append(", transformCompile: '");
buffer.append(fetchAttrs.getTransformCompile() + "'");
}
buffer.append("})");
delimited = true;
}
if(((BlockAttributes)attributes).getLoadAttributes() != null) {
require(WidgetScriptModules.BASE_BB_LOAD, protocol, attributes);
if(delimited) {
buffer.append(",");
}
LoadAttributes loadAttrs = ((BlockAttributes)attributes).getLoadAttributes();
buffer.append("load: new Widget.BlockLoad({src: '");
buffer.append(loadAttrs.getSrc() + "'");
if(loadAttrs.getWhen() != null) {
buffer.append(", when: '");
buffer.append(loadAttrs.getWhen() + "'");
}
buffer.append("})");
delimited = true;
}
if(((BlockAttributes)attributes).getRefreshAttributes() != null) {
require(WidgetScriptModules.BASE_BB_REFRESH, protocol, attributes);
if(delimited) {
buffer.append(",");
}
RefreshAttributes refreshAttrs = ((BlockAttributes)attributes).getRefreshAttributes();
buffer.append("refresh: new Widget.BlockRefresh({src: '");
buffer.append(refreshAttrs.getSrc() + "'");
if(refreshAttrs.getInterval() != null) {
buffer.append(", interval: '");
buffer.append(refreshAttrs.getInterval() + "'");
}
buffer.append("})");
delimited = true;
}
buffer.append("})");
// Render closing parentheses for Widget.Register invokation
if (attributes.getId() != null) {
buffer.append(")");
}
// Write JavaScript Container to DOM.
try {
getJavaScriptWriter().write(buffer.toString());
} catch (IOException e) {
throw new ProtocolException(e);
}
}
// Javadoc inherited
protected ActionName[] getSupportedActionNames() {
return SUPPORTED_ACTION_NAMES;
}
// Javadoc inherited
protected PropertyName[] getSupportedPropertyNames() {
return SUPPORTED_PROPERTY_NAMES;
}
// Javadoc inherited
protected EventName[] getSupportedEventNames() {
return SUPPORTED_EVENT_NAMES;
}
private void openingBlock(String id) {
blockIdStack.push(id);
containsBlockContent = false;
}
private String closingBlock() {
return (String) blockIdStack.pop();
}
protected String openingBlockContent() {
String blockId = blockIdStack.isEmpty() ? null : (String) blockIdStack.peek();
blockIdStack.push(null);
return blockId;
}
protected String closingBlockContent() {
blockIdStack.pop();
String blockId = blockIdStack.isEmpty() ? null : (String) blockIdStack.peek();
// If BlockContent in closing directly within the Block widget,
// indicate that flag on following flag, so that in renderClose()
// method some action may be taken.
if (blockId != null) {
containsBlockContent = true;
}
return blockId;
}
// Javadoc inherited
public boolean shouldRenderContents(VolantisProtocol protocol, MCSAttributes attributes) throws ProtocolException {
return isWidgetSupported(protocol);
}
}
| [
"iwilloug@b642a0b7-b348-0410-9912-e4a34d632523"
] | iwilloug@b642a0b7-b348-0410-9912-e4a34d632523 |
a3c127f4246bbefa5d9b2d75f5d71f1d99f3f807 | 1fe8a845a8153d13bf71dc4cc0a2f276516e00c2 | /dist/src/test/java/io/camunda/zeebe/shared/management/ControlledActorClockEndpointTest.java | b6c8b736782710d8c827d640de3689cad6e22f30 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | insad/zeebe | 24f96e9ee2bed339d82cf3f76a4271cbbd7cfb40 | 616fc32f070db1b3599e5de2a4c178c6369ca7bd | refs/heads/develop | 2023-03-23T10:11:43.985012 | 2021-12-23T04:11:54 | 2021-12-23T04:11:54 | 142,211,089 | 0 | 0 | null | 2019-09-23T09:47:10 | 2018-07-24T20:44:37 | Java | UTF-8 | Java | false | false | 4,455 | java | /*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Licensed under the Zeebe Community License 1.1. You may not use this file
* except in compliance with the Zeebe Community License 1.1.
*/
package io.camunda.zeebe.shared.management;
import static org.assertj.core.api.Assertions.assertThat;
import io.camunda.zeebe.shared.management.ActorClockEndpoint.Response;
import io.camunda.zeebe.util.sched.clock.ControlledActorClock;
import java.time.Duration;
import java.time.Instant;
import org.assertj.core.api.Assertions;
import org.assertj.core.api.InstanceOfAssertFactory;
import org.assertj.core.api.ObjectAssert;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
final class ControlledActorClockEndpointTest {
private final InstanceOfAssertFactory<Response, ObjectAssert<Response>> responseType =
new InstanceOfAssertFactory<>(Response.class, Assertions::assertThat);
private final ActorClockEndpoint endpoint =
new ActorClockEndpoint(new ControlledActorClockService(new ControlledActorClock()));
@BeforeEach
private void resetClock() {
endpoint.resetTime();
}
@Test
void canRetrieveCurrentClock() {
final var response = endpoint.getCurrentClock();
assertThat(response.getStatus()).isEqualTo(200);
}
@Test
void canPinMutableClock() {
// given
final var millis = 1635672964533L;
// when
final var response = endpoint.modify("pin", millis, null);
// then
assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getBody())
.asInstanceOf(responseType)
.satisfies((body) -> assertThat(body.epochMilli).isEqualTo(millis))
.isNotNull();
}
@Test
void canOffsetMutableClock() {
// given
final var marginOfError = Duration.ofMinutes(1);
final var offset = Duration.ofMinutes(10);
// when
final var response = endpoint.modify("add", null, offset.toMillis());
// then
// The clock should have at least advanced by the offset we've specified + margin of error.
final var offsetMinimum = Instant.now().plus(offset.minus(marginOfError));
// The clock shouldn't have advanced by more than the offset we've specified + margin of error.
final var offsetMaximum = Instant.now().plus(offset.plus(marginOfError));
assertThat(response.getStatus()).isEqualTo(200);
assertThat(response.getBody())
.isNotNull()
.asInstanceOf(responseType)
// This can be flaky, but only if the test thread is sleeping for more than the margin of
// error.
.satisfies((body) -> assertThat(body.instant).isBetween(offsetMinimum, offsetMaximum));
}
@Test
void offsetClockDoesAdvance() throws InterruptedException {
// given
final var offset = 10000L;
final var firstResponse = endpoint.modify("add", null, offset);
assertThat(firstResponse.getBody()).isNotNull();
final var firstMillis = ((Response) firstResponse.getBody()).epochMilli;
// when
Thread.sleep(100);
final var secondResponse = endpoint.getCurrentClock();
assertThat(secondResponse.getBody()).isNotNull();
final var secondMillis = secondResponse.getBody().epochMilli;
// then
assertThat(firstMillis).isLessThan(secondMillis);
}
@Test
void pinnedClockDoesNotAdvance() throws InterruptedException {
// given
final var millis = 1635672964533L;
final var firstResponse = endpoint.modify("pin", millis, null);
assertThat(firstResponse.getStatus()).isEqualTo(200);
assertThat(firstResponse.getBody())
.isNotNull()
.asInstanceOf(responseType)
.satisfies((body) -> assertThat(body.epochMilli).isEqualTo(millis));
// when
Thread.sleep(100);
final var secondResponse = endpoint.getCurrentClock();
// then
assertThat(secondResponse.getBody()).isNotNull();
assertThat(secondResponse.getBody().epochMilli).isEqualTo(millis);
}
@Test
void instantMatchesEpochMilli() {
// when
final var response = endpoint.getCurrentClock();
assertThat(response.getBody()).isNotNull();
final var millis = response.getBody().epochMilli;
final var instant = response.getBody().instant;
// then
assertThat(Instant.ofEpochMilli(millis)).isEqualTo(instant);
}
}
| [
"ole.schoenburg@gmail.com"
] | ole.schoenburg@gmail.com |
b97eb28d41c9c4ad04b211cb261199a15c19ee44 | 927568a3afc68ef038f0d4cd9402ce0004d6227d | /Lesson05/edu/uwex/apc390/lesson5_3/Rectangle.java | a4cfc3f931484ef2392ef151a559a68f82413d78 | [] | no_license | tonyva/apc390 | 1686a4700c89b5e729fee5b87e0c5dba5b2de7c2 | 9665d67ba23b033ef1bbcad7df141b7da0132974 | refs/heads/master | 2020-03-31T23:47:05.787603 | 2018-10-12T00:09:09 | 2018-10-12T00:09:09 | 152,669,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package edu.uwex.apc390.lesson5_3;
public class Rectangle extends Shape {
private final float length, width;
public Rectangle(float l, float w) {
length = l;
width = w;
computeArea();
}
public String toString() {
return "Rectangle with sides " + length + ", " + width;
}
@Override
protected void computeArea() {
area = length * width;
}
}
| [
"anthony.varghese@uwrf.edu"
] | anthony.varghese@uwrf.edu |
607a8730b9e357c8df457a1889231721de9e572f | fa32b68d8e90a3e5ad348d7c97d2f2373a4a9730 | /Javaplace/SpringBoot/ch01-springboot-helloword/src/main/java/com/nguyenxb/boot/config/MyConfig1.java | fb2cf78a4a41e1e2c7e804c8642bfb0e57e548f9 | [] | no_license | nguyenxb/learn-java | 6d89e364941f0deb84a835e7e722aa66ccb72f17 | a9b1bc74f911947d1f2ee03910a687cd3bd6b692 | refs/heads/master | 2023-07-30T08:25:38.520461 | 2021-09-16T05:09:11 | 2021-09-16T05:09:11 | 407,021,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 908 | java | package com.nguyenxb.boot.config;
import com.nguyenxb.boot.bean.Car;
import com.nguyenxb.boot.bean.Pet;
import com.nguyenxb.boot.bean.User;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
@ConditionalOnBean(name="tom22")
@Configuration
public class MyConfig1 {
@Bean
public Pet tom(){
return new Pet() ;
}
@Bean
public User user01(){
return new User("asd",12) ;
}
}
| [
"nguyenxb@qq.com"
] | nguyenxb@qq.com |
434a80ca36c3e44aaabbe4d82542aef64de55f73 | 10a49a9e668af611cbd0919fc6f7d7f3a8847a8d | /app/src/main/java/com/example/booksmart/viewmodels/ListingDetailViewModel.java | 1665c80dcdd73bd8066ecc98c4a661c35872a30b | [] | no_license | lauracastrovenegas/Booksmart | 07cbc1a89bce58e472c63accbfd85f51516681e4 | 7ef7619843888cb0bbb9cda86d894352c46bf238 | refs/heads/master | 2023-07-16T05:32:05.586518 | 2021-08-13T17:09:09 | 2021-08-13T17:09:09 | 383,911,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | package com.example.booksmart.viewmodels;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.booksmart.models.Item;
import com.example.booksmart.ui.profile.ProfileFragment;
public class ListingDetailViewModel extends ViewModel {
private MutableLiveData<Item> selected = new MutableLiveData<Item>();
private MutableLiveData<Fragment> previousFragment = new MutableLiveData<>();
public void select(Item item){
selected.setValue(item);
}
public LiveData<Item> getSelected() {
return selected;
}
public void setPreviousFragment(Fragment fragment) {
previousFragment.setValue(fragment);
}
public LiveData<Fragment> getPreviousFragment(){
return previousFragment;
}
} | [
"laurasofi1024@gmail.com"
] | laurasofi1024@gmail.com |
d3f930c9b99d1e1cfe7f96b47b9518a6995c5ce7 | a2d16082a387f6e80c81e5bb32e7fec3bb825d0e | /BS04InstanceOfApp/src/com/mahmud/BS04InstanceOfAppPackage/package-info.java | b8e162ccce64a6f362ae83d339c2da58d8303558 | [] | no_license | csemahmud/Java_SE | 7ab11fb9591b1c4c9fc29af548f20614a362023a | b4047dafb1201cf77521e7f0646915718dbef80d | refs/heads/master | 2021-01-19T03:59:19.907566 | 2017-04-05T18:40:17 | 2017-04-05T18:40:17 | 87,342,760 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 102 | java | /**
*
*/
/**
* @author Mahmudul Hasan Khan CSE
*
*/
package com.mahmud.BS04InstanceOfAppPackage; | [
"cse.mahmudul@gmail.com"
] | cse.mahmudul@gmail.com |
61a5644e85d7ce597f31e793ceb0c162d1205610 | 87132e18b7ebe8dfef3408af4005bdfffec797f9 | /src/com/riotapps/word/hooks/PlayerService.java | 5011d8f4615e0a0a95ded4f4bf8abd4762c3e867 | [] | no_license | rendyramon/WordAndroid | 7b6ee894b8ea8d9b0d381dff5921bfc3a455d271 | 6a3adb118aab023ead80a7a3503787bc738cd1c9 | refs/heads/master | 2021-01-18T16:11:24.891293 | 2013-04-08T01:49:55 | 2013-04-08T01:49:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46,947 | java | package com.riotapps.word.hooks;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.json.JSONException;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.riotapps.word.R;
import com.riotapps.word.utils.ApplicationContext;
import com.riotapps.word.utils.Constants;
import com.riotapps.word.utils.DesignByContractException;
import com.riotapps.word.utils.Check;
import com.riotapps.word.utils.Storage;
import com.riotapps.word.utils.Utils;
import com.riotapps.word.ui.DialogManager;
import com.riotapps.word.ui.GameStateService;
import com.riotapps.word.utils.ImageCache;
import com.riotapps.word.utils.ImageFetcher;
import com.riotapps.word.utils.Logger;
import com.riotapps.word.utils.NetworkConnectivity;
import com.riotapps.word.utils.Validations;
import com.facebook.model.GraphUser;
import com.facebook.android.FacebookError;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
////make this class static
@SuppressLint({ "NewApi"})
public class PlayerService {
private static final String TAG = PlayerService.class.getSimpleName();
public static String getAuthTokenFromLocal(){
SharedPreferences settings = Storage.getSharedPreferences();
String storedToken = settings.getString(Constants.USER_PREFS_AUTH_TOKEN, "");
settings = null;
return storedToken;
}
public static String setupConnectViaEmail(Context ctx, String email, String nickname, String password) throws DesignByContractException{
Gson gson = new Gson();
NetworkConnectivity connection = new NetworkConnectivity(ApplicationContext.getAppContext());
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
nickname = nickname.trim();
email = email.trim();
password = password.trim();
//check funky characters in nickname [a-zA-Z0-9\-#\.\(\)\/%&\s]
Check.Require(email.length() > 0, ctx.getString(R.string.validation_email_required));
Check.Require(nickname.length() > 0, ctx.getString(R.string.validation_nickname_required));
Check.Require(password.length() > 0, ctx.getString(R.string.validation_password_required));
Check.Require(password.length() >= 4, ctx.getString(R.string.validation_password_too_short));
Check.Require(Validations.validateEmail(email.trim()) == true, ctx.getString(R.string.validation_email_invalid));
Check.Require(Validations.validateNickname(nickname.trim()) == true, ctx.getString(R.string.validation_nickname_invalid));
TransportCreatePlayer player = new TransportCreatePlayer();
player.setEmail(email);
player.setNickname(nickname);
player.setGcmRegistrationId(PlayerService.getRegistrationId());
player.setPassword(password);
return gson.toJson(player);
}
public static String setupConnectViaFB(Context ctx, String fb, String email, String firstName, String lastName) throws DesignByContractException{
Gson gson = new Gson();
NetworkConnectivity connection = new NetworkConnectivity(ApplicationContext.getAppContext());
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
//check funky characters in nickname [a-zA-Z0-9\-#\.\(\)\/%&\s]
Check.Require(email.length() > 0, ctx.getString(R.string.validation_email_required));
Check.Require(Validations.validateEmail(email.trim()) == true, ctx.getString(R.string.validation_email_invalid));
TransportCreateFBPlayer player = new TransportCreateFBPlayer();
player.setEmail(email);
player.setFb(fb);
player.setGcmRegistrationId(PlayerService.getRegistrationId());
player.setFirstName(firstName);
player.setLastName(lastName);
return gson.toJson(player);
}
public static String setupAuthTokenCheck(Context ctx, String authToken) throws DesignByContractException{
Gson gson = new Gson();
NetworkConnectivity connection = new NetworkConnectivity(ApplicationContext.getAppContext());
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
Check.Require(authToken.length() > 0, ctx.getString(R.string.validation_auth_token_required));
SharedPreferences settings = Storage.getSharedPreferences();
String completedDate = settings.getString(Constants.USER_PREFS_LATEST_COMPLETED_GAME_DATE, Constants.DEFAULT_COMPLETED_GAMES_DATE);
String lastAlertActivationDate = settings.getString(Constants.USER_PREFS_LATEST_COMPLETED_GAME_DATE, Constants.DEFAULT_LAST_ALERT_ACTIVATION_DATE);
// TransportAuthToken player = new TransportAuthToken();
// player.setToken(authToken);
// player.setGcmRegistrationId(PlayerService.getRegistrationId(ctx));
// player.setCompletedGameDate(new Date(completedDate));
// player.setLastAlertActivationDate(lastAlertActivationDate);
//return gson.toJson(player);
return setupAuthTokenCheck(ctx, authToken, completedDate, lastAlertActivationDate, PlayerService.getRegistrationId());
}
public static String setupAuthTokenCheck(Context ctx, String authToken, String completedDate,
String lastAlertActivationDate, String registrationId) throws DesignByContractException{
Gson gson = new Gson();
NetworkConnectivity connection = new NetworkConnectivity(ApplicationContext.getAppContext());
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
Check.Require(authToken.length() > 0, ctx.getString(R.string.validation_auth_token_required));
TransportAuthToken player = new TransportAuthToken();
player.setToken(authToken);
player.setGcmRegistrationId(registrationId);
player.setCompletedGameDate(new Date(completedDate));
player.setLastAlertActivationDate(lastAlertActivationDate);
return gson.toJson(player);
}
public static String setupAuthTokenCheckWithGame(Context ctx, String authToken, String gameId) throws DesignByContractException{
Gson gson = new Gson();
NetworkConnectivity connection = new NetworkConnectivity(ApplicationContext.getAppContext());
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
Check.Require(authToken.length() > 0, ctx.getString(R.string.validation_auth_token_required));
SharedPreferences settings = Storage.getSharedPreferences();
String completedDate = settings.getString(Constants.USER_PREFS_LATEST_COMPLETED_GAME_DATE, Constants.DEFAULT_COMPLETED_GAMES_DATE);
String lastAlertActivationDate = settings.getString(Constants.USER_PREFS_LATEST_COMPLETED_GAME_DATE, Constants.DEFAULT_LAST_ALERT_ACTIVATION_DATE);
TransportAuthTokenWithGame player = new TransportAuthTokenWithGame();
player.setToken(authToken);
player.setGameId(gameId);
player.setGcmRegistrationId(PlayerService.getRegistrationId());
player.setCompletedGameDate(new Date(completedDate));
player.setLastAlertActivationDate(lastAlertActivationDate);
return gson.toJson(player);
}
public static String setupGameListCheck(Context ctx, String authToken, Date lastRefreshDate) throws DesignByContractException{
Gson gson = new Gson();
NetworkConnectivity connection = new NetworkConnectivity(ApplicationContext.getAppContext());
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
Check.Require(authToken.length() > 0, ctx.getString(R.string.validation_auth_token_required));
SharedPreferences settings = Storage.getSharedPreferences();
String completedDate = settings.getString(Constants.USER_PREFS_LATEST_COMPLETED_GAME_DATE, Constants.DEFAULT_COMPLETED_GAMES_DATE);
TransportGameListCheck player = new TransportGameListCheck();
player.setToken(authToken);
player.setCompletedGameDate(new Date(completedDate));
player.setLastRefreshDate(lastRefreshDate);
return gson.toJson(player);
}
public static String setupAccountUpdate(Context ctx, String email, String nickname) throws DesignByContractException{
Gson gson = new Gson();
Player player = PlayerService.getPlayerFromLocal();
NetworkConnectivity connection = new NetworkConnectivity(ctx);
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
//check funky characters in nickname [a-zA-Z0-9\-#\.\(\)\/%&\s]
Check.Require(email.length() > 0, ctx.getString(R.string.validation_email_required));
Check.Require(nickname.length() > 0, ctx.getString(R.string.validation_nickname_required));
Check.Require(Validations.validateEmail(email.trim()) == true, ctx.getString(R.string.validation_email_invalid));
Check.Require(Validations.validateNickname(nickname.trim()) == true, ctx.getString(R.string.validation_nickname_invalid));
TransportUpdateAccount updateAccount = new TransportUpdateAccount();
updateAccount.setEmail(email);
updateAccount.setNickname(nickname);
updateAccount.setToken(player.getAuthToken());
updateAccount.setGcmRegistrationId(PlayerService.getRegistrationId());
return gson.toJson(updateAccount);
}
public static String setupFBAccountUpdate(Context ctx, String nickname) throws DesignByContractException{
Gson gson = new Gson();
Player player = PlayerService.getPlayerFromLocal();
NetworkConnectivity connection = new NetworkConnectivity(ctx);
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
//check funky characters in nickname [a-zA-Z0-9\-#\.\(\)\/%&\s]
Check.Require(nickname.length() > 0, ctx.getString(R.string.validation_nickname_required));
Check.Require(Validations.validateNickname(nickname.trim()) == true, ctx.getString(R.string.validation_nickname_invalid));
TransportFBUpdateAccount updateAccount = new TransportFBUpdateAccount();
updateAccount.setNickname(nickname);
updateAccount.setToken(player.getAuthToken());
updateAccount.setGcmRegistrationId(PlayerService.getRegistrationId());
return gson.toJson(updateAccount);
}
public static boolean checkAlertAlreadyShown(Context context, String alertId, String alertActivationDate){
Gson gson = new Gson();
SharedPreferences settings = Storage.getSharedPreferences();
String json = settings.getString(Constants.USER_PREFS_ALERT_CHECK, "[]");
Type type = new TypeToken<List<String>>() {}.getType();
List<String> alerts = gson.fromJson(json, type);
if (alerts.contains(alertId)){
return true;
}
else {
alerts.add(alertId);
json = gson.toJson(alerts, type);
SharedPreferences.Editor editor = settings.edit();
editor.putString(Constants.USER_PREFS_ALERT_CHECK, json);
editor.putString(Constants.USER_PREFS_ALERT_CHECK_DATE, alertActivationDate);
// Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// If so, call apply()
editor.apply();
// if not
} else {
// Call commit()
editor.commit();
}
return false;
}
}
public static boolean checkFirstTimeGameSurfaceAlertAlreadyShown(Context context){
SharedPreferences settings = Storage.getSharedPreferences();
if (settings.getBoolean(Constants.USER_PREFS_FIRST_TIME_GAME_SURFACE_ALERT_CHECK, false) == false) {
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean(Constants.USER_PREFS_FIRST_TIME_GAME_SURFACE_ALERT_CHECK,true);
// Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// If so, call apply()
editor.apply();
// if not
} else {
// Call commit()
editor.commit();
}
Logger.d(TAG, "checkFirstTimeAlertAlreadyShown=false");
return false;
}
else{
Logger.d(TAG, "checkFirstTimeAlertAlreadyShown=true");
return true;
}
}
public static void updateRegistrationId(Context context, String gcmRegistrationId){
SharedPreferences settings = Storage.getSharedPreferences();
SharedPreferences.Editor editor = settings.edit();
editor.putString(Constants.USER_PREFS_GCM_REGISTRATION_ID, gcmRegistrationId);
// Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// If so, call apply()
editor.apply();
// if not
} else {
// Call commit()
editor.commit();
}
}
public static String getRegistrationId(){
SharedPreferences settings = Storage.getSharedPreferences();
return settings.getString(Constants.USER_PREFS_GCM_REGISTRATION_ID, "");
}
public static void saveFacebookFriendsFromJSONResponse(Context ctx, List<GraphUser> users) throws FacebookError, JSONException{
List<FBFriend> fbFriends = new ArrayList<FBFriend>();
for(GraphUser user : users){
//Logger.d(TAG, "saveFacebookFriendsFromJSONResponse user=" + user.getId() + " " + user.getName());
FBFriend fbFriend = new FBFriend();
fbFriend.setId(user.getId());
fbFriend.setName(user.getName());
fbFriends.add(fbFriend);
}
FBFriends friendsList = new FBFriends();
friendsList.setFriends(fbFriends);
Gson gson = new Gson();
// Type fooType = new TypeToken<Foo<Bar>>() {}.getType();
// gson.toJson(foo, fooType);
String friendJSON = gson.toJson(friendsList, FBFriends.class);
SharedPreferences settings = Storage.getSharedPreferences();
SharedPreferences.Editor editor = settings.edit();
// Logger.w(TAG, "saveFacebookFriendsFromJSONResponse fbFriends=" + friendJSON.length());
//String json1 = gson.toJson(friendJSON);
editor.putString(Constants.USER_PREFS_FRIENDS_JSON, friendJSON);
// Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// If so, call apply()
editor.apply();
// if not
} else {
// Call commit()
editor.commit();
}
// String friendsLocal = settings.getString(Constants.USER_PREFS_FRIENDS_JSON, Constants.EMPTY_JSON_ARRAY);
friendsList = null;
fbFriends = null;
friendJSON = null;
gson = null;
// Logger.w(TAG, "saveFacebookFriendsFromJSONResponse friendsLocal=" + friendsLocal.length());
}
public static String setupFindPlayersByFB(Context ctx) throws DesignByContractException{
Gson gson = new Gson();
NetworkConnectivity connection = new NetworkConnectivity(ctx);
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
Player player = PlayerService.getPlayerFromLocal();
Check.Require(player.getAuthToken().length() > 0, ctx.getString(R.string.msg_not_connected));
TransportFindByFB fbFriends = new TransportFindByFB();
fbFriends.setToken(player.getAuthToken());
SharedPreferences settings = Storage.getSharedPreferences();
String friendsLocal = settings.getString(Constants.USER_PREFS_FRIENDS_JSON, Constants.EMPTY_JSON_ARRAY);
// friendsLocal.
// Logger.d(TAG, "setupFindPlayersByFB friendsLocal=" + friendsLocal.length());
// Logger.d(TAG, "setupFindPlayersByFB friendsLocal=" + friendsLocal);//new StringBuffer(friendsLocal).reverse().toString());
FBFriends friends = gson.fromJson(friendsLocal, FBFriends.class);
// Logger.d(TAG, "setupFindPlayersByFB friends=" + friends.getFriends().size());
// for(FBFriend fb : friends.getFriends()){
for(FBFriend fb : friends.getFriends()){
fbFriends.addToFBList(fb.getId());
}
return gson.toJson(fbFriends);
}
public static String setupPasswordChange(Context ctx, String password, String passwordConfirm) throws DesignByContractException{
Gson gson = new Gson();
NetworkConnectivity connection = new NetworkConnectivity(ctx);
//are we connected to the web?
Player player = PlayerService.getPlayerFromLocal();
password = password.trim();
passwordConfirm = passwordConfirm.trim();
// Logger.d(TAG, "setupPasswordChange pwd=" + password + " confirm=" + passwordConfirm);
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
Check.Require(player.getAuthToken().length() > 0, ctx.getString(R.string.validation_email_required));
Check.Require(password.trim().length() > 0, ctx.getString(R.string.validation_new_password_not_provided));
Check.Require(password.trim().length() >= 4, ctx.getString(R.string.validation_password_too_short));
Check.Require(password.equals(passwordConfirm), ctx.getString(R.string.validation_password_confirmation_failed));
TransportPasswordChange pwdChg = new TransportPasswordChange();
pwdChg.setToken(player.getAuthToken());
pwdChg.setPassword(password);
return gson.toJson(pwdChg);
}
public static String setupAuthTokenTransport(Context ctx) throws DesignByContractException{
Gson gson = new Gson();
NetworkConnectivity connection = new NetworkConnectivity(ctx);
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
Player player = PlayerService.getPlayerFromLocal();
Check.Require(player != null, ctx.getString(R.string.msg_no_local_player));
Check.Require(player.getAuthToken().length() > 0, ctx.getString(R.string.msg_no_local_player_token));
TransportAuthToken token = new TransportAuthToken();
token.setToken(player.getAuthToken());
return gson.toJson(token);
}
public static void clearImageCache(FragmentActivity context){
ImageCache cache = ImageCache.findOrCreateCache(context, Constants.IMAGE_CACHE_DIR);
cache.clearCaches();
}
public static void clearLocalStorageAndCache(FragmentActivity context){
Storage.getSharedPreferences().edit().clear().commit();
Storage.getSharedPreferences(Constants.GAME_STATE).edit().clear().commit();
clearImageCache(context);
}
public static void logout(FragmentActivity context){
clearLocalStorageAndCache(context);
Intent intent = new Intent(context, com.riotapps.word.Welcome.class);
context.startActivity(intent);
}
public static String setupFindPlayerByNickname(Context ctx, String nickname) throws DesignByContractException{
nickname = nickname.trim();
NetworkConnectivity connection = new NetworkConnectivity(ctx);
//are we connected to the web?
Check.Require(connection.checkNetworkConnectivity() == true, ctx.getString(R.string.msg_not_connected));
Check.Require(nickname.length() > 0, ctx.getString(R.string.validation_nickname_required_for_search));
//validate there are not funky characters in the string
String url = String.format(Constants.REST_FIND_PLAYER_BY_NICKNAME, URLEncoder.encode(nickname));
return url;
}
public static void loadPlayerInHeader(final FragmentActivity context){
loadPlayerInHeader(context, true);
}
public static void loadPlayerInHeader(final FragmentActivity context, Boolean activateGravatarOnClick){
Player player = PlayerService.getPlayerFromLocal();
int playerImage = context.getResources().getInteger(com.riotapps.word.R.integer.player_image_width);
ImageFetcher imageLoader = new ImageFetcher(context, playerImage, playerImage, 0);
imageLoader.setImageCache(ImageCache.findOrCreateCache(context, Constants.IMAGE_CACHE_DIR));
ImageView ivContextPlayer = (ImageView) context.findViewById(R.id.ivHeaderContextPlayer);
//android.util.Logger.i(TAG, "FindPlayerResults: playerImage=" + player.getImageUrl());
imageLoader.loadImage(player.getImageUrl(), ivContextPlayer); //default image
if (activateGravatarOnClick == true){
if (player.isFacebookUser() == false){
ivContextPlayer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, com.riotapps.word.Gravatar.class);
context.startActivity(intent);
}
});
}
}
ImageView ivContextPlayerBadge = (ImageView) context.findViewById(R.id.ivHeaderContextPlayerBadge);
int contextPlayerBadgeId = context.getResources().getIdentifier("com.riotapps.word:drawable/" + player.getBadgeDrawable(), null, null);
ivContextPlayerBadge.setImageResource(contextPlayerBadgeId);
TextView tvHeaderContextPlayerName = (TextView) context.findViewById(R.id.tvHeaderContextPlayerName);
tvHeaderContextPlayerName.setText(player.getNameWithMaxLength(25));
TextView tvHeaderContextPlayerWins = (TextView) context.findViewById(R.id.tvHeaderContextPlayerWins);
if (player.getNumWins() == 1){
tvHeaderContextPlayerWins.setText(context.getString(R.string.header_1_win));
}
else {
tvHeaderContextPlayerWins.setText(String.format(context.getString(R.string.header_num_wins), player.getNumWins()));
}
player = null;
}
public static void putPlayerToLocal(Player player){
Gson gson = new Gson();
SharedPreferences settings = Storage.getSharedPreferences();
SharedPreferences.Editor editor = settings.edit();
editor.putString(Constants.USER_PREFS_PLAYER_JSON, gson.toJson(player));
// Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// If so, call apply()
editor.apply();
// if not
} else {
// Call commit()
editor.commit();
}
ApplicationContext appContext = (ApplicationContext)ApplicationContext.getAppContext().getApplicationContext();
appContext.setPlayer(player);
gson = null;
}
public static Player getPlayerFromLocal(){
Gson gson = new Gson();
Type type = new TypeToken<Player>() {}.getType();
SharedPreferences settings = Storage.getSharedPreferences();
// Logger.w(TAG, "getPlayerFromLocal player=" + settings.getString(Constants.USER_PREFS_PLAYER_JSON, Constants.EMPTY_JSON));
Player player = gson.fromJson(settings.getString(Constants.USER_PREFS_PLAYER_JSON, Constants.EMPTY_JSON), type);
return player;
}
public static Player handleCreatePlayerResponse(String result){// InputStream iStream){
return handlePlayerResponse(result);
}
public static Player handleChangePasswordResponse(String result){// InputStream iStream){
return handlePlayerResponse(result);
}
public static Player handleUpdateAccountResponse(String result){// InputStream iStream){
return handlePlayerResponse(result);
}
public static Player handleAuthByTokenResponse(String result){// InputStream iStream){
return handlePlayerResponse(result);
}
private static Player handlePlayerResponse(String result){//InputStream iStream){
Gson gson = new Gson(); //wrap json return into a single call that takes a type
Logger.d(TAG, "handlePlayerResponse result=" + result.length() + " " + result);
Player storedPlayer = getPlayerFromLocal();
List<Opponent> localOpponents = new ArrayList<Opponent>();
if (storedPlayer != null && storedPlayer.getOpponents() != null){
localOpponents = storedPlayer.getOpponents();
}
Type type = new TypeToken<Player>() {}.getType();
Player player = gson.fromJson(result, type);
///save player info to shared preferences
//userId and auth_token ...email and password should have been stored before this call
SharedPreferences settings = Storage.getSharedPreferences();
SharedPreferences.Editor editor = settings.edit();
// Logger.w(TAG, "handlePlayerResponse auth=" + player.getAuthToken() + " " + gson.toJson(player));
Date completedDate = new Date(settings.getString(Constants.USER_PREFS_LATEST_COMPLETED_GAME_DATE, Constants.DEFAULT_COMPLETED_GAMES_DATE));
// Logger.d(TAG,"handlePlayerResponse about to check completed games");
if (player.getCompletedGames().size() > 0) {
//reset the rolling latest completion date to last completed game's date. this makes the response from the server as small as possible
for (Game game : player.getCompletedGames()) {
game.setShowCompletionAlert(true);
if (completedDate.before(game.getCompletionDate())){
completedDate = game.getCompletionDate();
}
}
}
Logger.d(TAG,"handlePlayerResponse about to getPlayerFromLocal");
//manage the local completed games list, only keep 10 max in the list. roll off older games.
//do this before the player is stored locally
if (storedPlayer != null){
//Logger.d(TAG,"handlePlayerResponse starting completed games, num stored=" + storedPlayer.getCompletedGames().size() + " num incoming=" + player.getCompletedGames().size());
if (storedPlayer.getCompletedGames().size() + player.getCompletedGames().size() > Constants.NUM_LOCAL_COMPLETED_GAMES_TO_STORE){
//more than x games are found in combined list. remove earliest to get the list down to x number
//Logger.d(TAG,"handlePlayerResponse about to loop completed games from server");
List<Game> combinedGames = storedPlayer.getCompletedGames();
for (Game game : player.getCompletedGames()) {
//Logger.d(TAG,"handlePlayerResponse about to inner loop completed games from local - gameId=" + game.getId() + " completed date =" + game.getCompletionDate().toString());
//dont add game if it already happens to be here
boolean add = true;
for (Game innerGame : combinedGames) {
// Logger.d(TAG,"handlePlayerResponse inside inner loop completed games - innerGame.getId()=" + innerGame.getId());
if (innerGame.getId().equals(game.getId())){
Logger.d(TAG,"handlePlayerResponse inside inner loop do not add to list");
add = false;
//update stored game's last chat date, just in case its changed
innerGame.setLastChatDate(game.getLastChatDate());
break;
}
}
if (add) {
// Logger.d(TAG,"handlePlayerResponse inside loop completed games- adding game=" + game.getId());
combinedGames.add(game);
}
}
//Logger.d(TAG,"handlePlayerResponse sorting completed games, num=" + combinedGames.size());
Collections.sort(combinedGames);
//Logger.d(TAG,"handlePlayerResponse about to truncate games at end");
//combinedGames.subList(Constants.NUM_LOCAL_COMPLETED_GAMES_TO_STORE + 1, combinedGames.size()).clear();
if (combinedGames.size() > Constants.NUM_LOCAL_COMPLETED_GAMES_TO_STORE){
for(int i = combinedGames.size() - 1; i >= Constants.NUM_LOCAL_COMPLETED_GAMES_TO_STORE ; i--){
combinedGames.remove(i);
}
}
//Logger.d(TAG,"handlePlayerResponse afer truncation completed games, num=" + combinedGames.size());
player.setCompletedGames(combinedGames);
}
}
//remove game state for completed games
for (Game game : player.getCompletedGames()){
GameStateService.clearGameState(game.getId());
}
//now set activegames by turn
//also set activeGamesYourTurn and OpponentTurn
List<Game> yourTurn = new ArrayList<Game>();
List<Game> opponentTurn = new ArrayList<Game>();
for (Game game : player.getActiveGames()) {
Boolean isYourTurn = false;
for (PlayerGame pg : game.getPlayerGames()){
if (pg.getPlayerId().equals(player.getId()) && pg.isTurn()){
yourTurn.add(game);
isYourTurn = true;
break;
}
}
if (!isYourTurn){
opponentTurn.add(game);
}
}
//Logger.d(TAG,"handlePlayerResponse setting active games opponentTurn=" + opponentTurn.size() + " yourTurn=" + yourTurn.size());
player.setActiveGamesOpponentTurn(opponentTurn);
player.setActiveGamesYourTurn(yourTurn);
//no need to duplicate the data that is in activeGamesYourTurn and activeGamesOpponentTurn
//so let's clear this out
player.getActiveGames().clear();
//if opponent list comes from the server, move it to local opponents list, otherwise local opponents
//list should already be populated
// Logger.d(TAG, "handlePlayerResponse numOpponents=" + player.getOpponents().size() );
if (player.getOpponents_() != null && player.getOpponents_().size() > 0){
//get opponents from storedPlayer
// Logger.d(TAG,"handlePlayerResponse pulling opponents from server to local");
player.getOpponents().clear();
//pull real opponents list from server list
//loop through to save non-referenced objects
for (Opponent o : player.getOpponents_()){
// Logger.d(TAG,"handlePlayerResponse looping opponents player=" + o.getPlayer().getId());
Opponent opponent = new Opponent();
//attribute :n_g
//child :player do
// attribute :id, :fb, :f_n, :l_n, :n_n, :gravatar, :n_w
opponent.setNumGames(o.getNumGames());
opponent.setStatus(o.getStatus());
Player p = new Player();
p.setId(o.getPlayer().getId());
p.setNickname(o.getPlayer().getNickname());
p.setFirstName(o.getPlayer().getFirstName());
p.setLastName(o.getPlayer().getLastName());
p.setGravatar(o.getPlayer().getGravatar());
p.setFB(o.getPlayer().getFB());
p.setNumWins(o.getPlayer().getNumWins());
opponent.setPlayer(p);
player.getOpponents().add(opponent);
}
//player.setOpponents(player.getOpponents_());
//clear out server list just to save on local storage space and gson processing
player.getOpponents_().clear();
}
else {
//if opponents are not loaded from server, make sure to pull them in from local storage
player.setOpponents(localOpponents);
}
Player currentPlayer = new Player();
currentPlayer.setId(player.getId());
currentPlayer.setNickname(player.getNickname());
currentPlayer.setFirstName(player.getFirstName());
currentPlayer.setLastName(player.getLastName());
currentPlayer.setGravatar(player.getGravatar());
currentPlayer.setFB(player.getFB());
currentPlayer.setNumWins(player.getNumWins());
//Logger.d(TAG, "loading players from opponent list activegames=" + player.getActiveGamesYourTurn().size());
//since the players are no longer being sent as part of playerGame, load the Player properties for playerGames and playedWords from opponents list
//if the playerId does not exist in the opponents list, create a placeholder player
for (Game game : player.getActiveGamesYourTurn()){
for (PlayerGame pg : game.getPlayerGames()){
// Logger.d(TAG, "getActiveGamesYourTurn game=" +game.getId() + " pg.getPlayerId()" + pg.getPlayerId());
pg.setPlayer(getPlayerFromOpponentList(player.getOpponents(), currentPlayer, pg.getPlayerId()));
//pg.setPlayer(null);
}
}
//Logger.d(TAG, "loading players from opponent list opponent games=" + player.getActiveGamesOpponentTurn().size());
for (Game game : player.getActiveGamesOpponentTurn()){
for (PlayerGame pg : game.getPlayerGames()){
//Logger.d(TAG, "getActiveGamesOpponentTurn game=" +game.getId() + " pg.getPlayerId()" + pg.getPlayerId());
pg.setPlayer(getPlayerFromOpponentList(player.getOpponents(), currentPlayer, pg.getPlayerId()));
//pg.setPlayer(null);
}
}
//Logger.d(TAG, "loading players from opponent list - completed=" + player.getCompletedGames().size());
for (Game game : player.getCompletedGames()){
for (PlayerGame pg : game.getPlayerGames()){
//Logger.d(TAG, "getCompletedGames game=" +game.getId() + " pg.getPlayerId()" + pg.getPlayerId());
pg.setPlayer(getPlayerFromOpponentList(player.getOpponents(), currentPlayer, pg.getPlayerId()));
//pg.setPlayer(null);
}
}
// Logger.d(TAG, "loading players getNotificationGame");
if (player.getNotificationGame() != null){
for (PlayerGame pg : player.getNotificationGame().getPlayerGames()){
//Logger.d(TAG, "getNotificationGame game=" + player.getNotificationGame().getId() + " pg.getPlayerId()" + pg.getPlayerId());
pg.setPlayer(getPlayerFromOpponentList(player.getOpponents(), currentPlayer, pg.getPlayerId()));
// pg.setPlayer(null);
}
}
//Logger.w(TAG, "handlePlayerResponse num active and opponent=" + player.getActiveGamesYourTurn().size() + " " + player.getActiveGamesOpponentTurn().size());
long now = Utils.convertNanosecondsToMilliseconds(System.nanoTime());
editor.putLong(Constants.USER_PREFS_PLAYER_CHECK_TIME, now);
editor.putString(Constants.USER_PREFS_LATEST_COMPLETED_GAME_DATE, completedDate.toGMTString());
editor.putString(Constants.USER_PREFS_AUTH_TOKEN, player.getAuthToken());
editor.putString(Constants.USER_PREFS_USER_ID, player.getId());
editor.putString(Constants.USER_PREFS_PLAYER_JSON, gson.toJson(player));
ApplicationContext appContext = (ApplicationContext)ApplicationContext.getAppContext().getApplicationContext();
appContext.setPlayer(player);
// Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// If so, call apply()
editor.apply();
// if not
} else {
// Call commit()
editor.commit();
}
Logger.d(TAG, "handlePlayerResponse numOpponents=" + player.getOpponents().size() );
//Logger.w(TAG, "player=" + gson.toJson(player));
storedPlayer = null;
localOpponents = null;
gson = null;
result = null;
return player;
}
public static Player handleAuthResponse(String result){//InputStream iStream){
Gson gson = new Gson(); //wrap json return into a single call that takes a type
//Logger.w(TAG, "handlePlayerResponse incoming json=" + IOHelper.streamToString(iStream));
// Reader reader = new InputStreamReader(iStream); //serverResponseObject.response.getEntity().getContent());
Logger.d(TAG, "handleAuthResponse result=" + result.length() + " " + result);
Player storedPlayer = getPlayerFromLocal();
Type type = new TypeToken<Player>() {}.getType();
Player player = gson.fromJson(result, type);
///save player info to shared preferences
//userId and auth_token ...email and password should have been stored before this call
SharedPreferences settings = Storage.getSharedPreferences();
SharedPreferences.Editor editor = settings.edit();
// Logger.w(TAG, "handlePlayerResponse auth=" + player.getAuthToken() + " " + gson.toJson(player));
Date completedDate = new Date(settings.getString(Constants.USER_PREFS_LATEST_COMPLETED_GAME_DATE, Constants.DEFAULT_COMPLETED_GAMES_DATE));
Logger.d(TAG,"handlePlayerResponse about to getPlayerFromLocal");
//manage the local completed games list, only keep 10 max in the list. roll off older games.
//do this before the player is stored locally
storedPlayer.setId(player.getId());
storedPlayer.setNickname(player.getNickname());
storedPlayer.setFirstName(player.getFirstName());
storedPlayer.setLastName(player.getLastName());
storedPlayer.setGravatar(player.getGravatar());
storedPlayer.setFB(player.getFB());
storedPlayer.setNumWins(player.getNumWins());
storedPlayer.setAuthToken(player.getAuthToken());
storedPlayer.setEmail(player.getEmail());
storedPlayer.setNoInterstitialAdsOption(player.isNoInterstitialAdsOption());
storedPlayer.setLastRefreshDate(player.getLastRefreshDate());
long now = Utils.convertNanosecondsToMilliseconds(System.nanoTime());
editor.putLong(Constants.USER_PREFS_PLAYER_CHECK_TIME, now);
editor.putString(Constants.USER_PREFS_LATEST_COMPLETED_GAME_DATE, completedDate.toGMTString());
editor.putString(Constants.USER_PREFS_AUTH_TOKEN, storedPlayer.getAuthToken());
editor.putString(Constants.USER_PREFS_USER_ID, storedPlayer.getId());
editor.putString(Constants.USER_PREFS_PLAYER_JSON, gson.toJson(storedPlayer));
// Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// If so, call apply()
editor.apply();
// if not
} else {
// Call commit()
editor.commit();
}
player = null;
gson = null;
result = null;
return storedPlayer;
}
public static Player getPlayerFromOpponentList(List<Opponent> opponents, Player player, String opponentId){
// Logger.d(TAG, "getPlayerFromOpponentList opponentId=" + opponentId);
Player opponent = null;
if (opponentId.equals(player.getId())){ //because the player has a playerGame record as well
opponent = player;
}
else {
for (Opponent o : opponents){
// Logger.d(TAG, "getPlayerFromOpponentList opponentLoopId=" + o.getPlayer().getId());
if (o.getPlayer().getId().equals(opponentId)){
opponent = new Player();
opponent.setId(o.getPlayer().getId());
opponent.setNickname(o.getPlayer().getNickname());
opponent.setFirstName(o.getPlayer().getFirstName());
opponent.setLastName(o.getPlayer().getLastName());
opponent.setGravatar(o.getPlayer().getGravatar());
opponent.setFB(o.getPlayer().getFB());
opponent.setNumWins(o.getPlayer().getNumWins());
// opponent = o.getPlayer();
break;
}
}
if (opponent == null) {
opponent = new Player();
opponent.setId(opponentId);
opponent.setNickname("ws_" + opponentId.substring(15, opponentId.length()));
opponent.setFB("");
opponent.setFirstName("");
opponent.setLastName("");
opponent.setNumWins(0);
opponent.setGravatar(Utils.md5("nobody__@riotapps.com"));
//figure out unknown gravatar link
}
}
return opponent;
}
public static Player updateAuthToken(final Context ctx, String authToken){
Gson gson = new Gson();
SharedPreferences settings = Storage.getSharedPreferences();
SharedPreferences.Editor editor = settings.edit();
Player player = getPlayerFromLocal();
player.setAuthToken(authToken);
editor.putString(Constants.USER_PREFS_AUTH_TOKEN, player.getAuthToken());
editor.putString(Constants.USER_PREFS_USER_ID, player.getId());
editor.putString(Constants.USER_PREFS_PLAYER_JSON, gson.toJson(player));
// Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// If so, call apply()
editor.apply();
// if not
} else {
// Call commit()
editor.commit();
}
Logger.d(TAG,"updateAuthToken");
return player;
}
// @SuppressWarnings("unchecked")
public static FBFriends findRegisteredFBFriendsResponse(final Context ctx, String result){
Gson gson = new Gson();
// Reader reader = new InputStreamReader(iStream); //serverResponseObject.response.getEntity().getContent());
Type type = new TypeToken<List<Player>>() {}.getType();
List<Player> players = gson.fromJson(result, type);
// for (Player player : players){
// Logger.d(TAG, "findRegisteredFBFriendsResponse name=" + player.getFirstName() + "fb=" + player.getFB());
// }
SharedPreferences settings = Storage.getSharedPreferences();
SharedPreferences.Editor editor = settings.edit();
String friendsLocal = settings.getString(Constants.USER_PREFS_FRIENDS_JSON, Constants.EMPTY_JSON_ARRAY);
FBFriends friends = gson.fromJson(friendsLocal, FBFriends.class);
// Logger.d(TAG, "findRegisteredFBFriendsResponse friends=" + friends.getFriends().size());
//loop through friends with inner loop that tries to match friend with registered player coming back from server
for(FBFriend fb : friends.getFriends()){
for (Player player : players){
if (fb.getId().equals(player.getFB())){
fb.setPlayerId(player.getId());
fb.setNumWins(player.getNumWins());
// Logger.d(TAG, "findRegisteredFBFriendsResponse fb=" + fb.getId() + " " + fb.getName() + " numWins=" + fb.getNumWins());
}
}
}
//friends.getFriends().get(40).setPlayerId("123");
//adding AlphabetIndexer, so do not sort already registered users to the top
//these users may be displayed in separate UI at some point
Collections.sort(friends.getFriends(), new FBFriendComparator());
editor.putLong(Constants.USER_PREFS_FRIENDS_LAST_REGISTERED_CHECK_TIME, Utils.convertNanosecondsToMilliseconds(System.nanoTime()));
editor.putString(Constants.USER_PREFS_FRIENDS_JSON, gson.toJson(friends));
// Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// If so, call apply()
editor.apply();
// if not
} else {
// Call commit()
editor.commit();
}
return friends;
// Logger.d(TAG,"updateAuthToken");
// return player;
}
public static FBFriends getLocalFBFriends(Context ctx){
Gson gson = new Gson();
SharedPreferences settings = Storage.getSharedPreferences();
String friendsLocal = settings.getString(Constants.USER_PREFS_FRIENDS_JSON, Constants.EMPTY_JSON_ARRAY);
return gson.fromJson(friendsLocal, FBFriends.class);
}
public static String getBadgeDrawable(int numWins){
if (numWins == -1) {
return Constants.BADGE_INVITED;
}
if (numWins == 0) {
return Constants.BADGE_0;
}
if (numWins >= 1 && numWins <= 4) {
return Constants.BADGE_1_4;
}
if (numWins >= 5 && numWins <= 9) {
return Constants.BADGE_5_9;
}
if (numWins >= 10 && numWins <= 14) {
return Constants.BADGE_10_14;
}
if (numWins >= 15 && numWins <= 19) {
return Constants.BADGE_15_19;
}
if (numWins >= 20 && numWins <= 24) {
return Constants.BADGE_20_24;
}
if (numWins >= 25 && numWins <= 29) {
return Constants.BADGE_25_29;
}
if (numWins >= 30 && numWins <= 39) {
return Constants.BADGE_30_39;
}
if (numWins >= 40 && numWins <= 49) {
return Constants.BADGE_40_49;
}
if (numWins >= 50 && numWins <= 59) {
return Constants.BADGE_50_59;
}
if (numWins >= 60 && numWins <= 69) {
return Constants.BADGE_60_69;
}
if (numWins >= 70 && numWins <= 79) {
return Constants.BADGE_70_79;
}
if (numWins >= 80 && numWins <= 89) {
return Constants.BADGE_80_89;
}
if (numWins >= 90 && numWins <= 99) {
return Constants.BADGE_90_99;
}
if (numWins >= 100 && numWins <= 124) {
return Constants.BADGE_100_124;
}
if (numWins >= 125 && numWins <= 149) {
return Constants.BADGE_125_149;
}
if (numWins >= 150 && numWins <= 174) {
return Constants.BADGE_150_174;
}
if (numWins >= 175 && numWins <= 199) {
return Constants.BADGE_175_199;
}
if (numWins >= 200 && numWins <= 224) {
return Constants.BADGE_200_224;
}
if (numWins >= 225 && numWins <= 249) {
return Constants.BADGE_225_249;
}
if (numWins >= 250 && numWins <= 274) {
return Constants.BADGE_250_274;
}
if (numWins >= 275 && numWins <= 299) {
return Constants.BADGE_275_299;
}
if (numWins >= 300 && numWins <= 349) {
return Constants.BADGE_300_349;
}
if (numWins >= 350 && numWins <= 399) {
return Constants.BADGE_350_399;
}
if (numWins >= 400 && numWins <= 449) {
return Constants.BADGE_400_449;
}
if (numWins >= 450 && numWins <= 499) {
return Constants.BADGE_450_499;
}
if (numWins >= 500) { // stop here for now
return Constants.BADGE_500_599;
}
if (numWins >= 500 && numWins <= 599) {
return Constants.BADGE_500_599;
}
if (numWins >= 600 && numWins <= 699) {
return Constants.BADGE_600_699;
}
if (numWins >= 700 && numWins <= 799) {
return Constants.BADGE_700_799;
}
if (numWins >= 800 && numWins <= 899) {
return Constants.BADGE_800_899;
}
if (numWins >= 900 && numWins <= 999) {
return Constants.BADGE_900_999;
}
if (numWins >= 1000) { // && numWins <= 1249) {
return Constants.BADGE_1000_1249;
}
if (numWins >= 1250 && numWins <= 1499) {
return Constants.BADGE_1250_1499;
}
if (numWins >= 1500 && numWins <= 1749) {
return Constants.BADGE_1500_1749;
}
if (numWins >= 1750 && numWins <= 1999) {
return Constants.BADGE_1750_1999;
}
if (numWins >= 2000 && numWins <= 2499) {
return Constants.BADGE_2000_2499;
}
if (numWins >= 2500 && numWins <= 2999) {
return Constants.BADGE_2500_2999;
}
if (numWins >= 3000 && numWins <= 3999) {
return Constants.BADGE_3000_3999;
}
if (numWins >= 4000 && numWins <= 4999) {
return Constants.BADGE_4000_4999;
}
if (numWins >= 5000) {
return Constants.BADGE_5000;
}
//fallthrough
return Constants.BADGE_0;
}
public static Player handleFindPlayerByNicknameResponse(final Context ctx, String result){// InputStream iStream){
try {
Gson gson = new Gson(); //wrap json return into a single call that takes a type
// Reader reader = new InputStreamReader(iStream); //serverResponseObject.response.getEntity().getContent());
Type type = new TypeToken<Player>() {}.getType();
Player player = gson.fromJson(result, type);
result = null;
return player;
}
catch (Exception e) {
//getRequest.abort();
Logger.w("PlayerService", "Error for HandleCreatePlayerResponse= " + e.getMessage());
DialogManager.SetupAlert(ctx, "HandleCreatePlayerResponse", e.getMessage(), 0);
// Toast t = Toast.makeText(ctx, e.getMessage(), Toast.LENGTH_LONG); //change this to real error handling
// t.show();
}
return null;
}
}
| [
"hunter@riotapps.com"
] | hunter@riotapps.com |
f05cd8e50df4f78364e5c332a6692e8c3a19b633 | 439a4b35faf9d15c3d1d4cf73f905b29ee573b5b | /src/main/java/com/obdobion/argument/criteria/EnumCriteria.java | 481c2e809171bca530a58cd4ae741e01264546a4 | [
"MIT"
] | permissive | fedups/com.obdobion.argument | 1adb27df9e704e61ad9a084d3bd4fc3682b427e7 | 9679aebbeedaef4e592227842fa0e91410708a67 | refs/heads/master | 2020-04-05T15:16:10.339821 | 2017-07-31T13:30:41 | 2017-07-31T13:30:41 | 34,991,703 | 1 | 0 | null | 2016-10-24T01:33:52 | 2015-05-03T16:02:23 | Java | UTF-8 | Java | false | false | 1,077 | java | package com.obdobion.argument.criteria;
import java.util.List;
/**
* Comment from a testcase in InstantiatorTest.java.
*
* This is the only known time when --enumlist is actually needed. Otherwise the
* list of possible enum names can be determined from either the instance
* variable type of the instanceClass argument. In this case, neither of these
* can be used to know that an enum is involved and the enumlist provide a set
* of values that the input will be normalized, verified too.
*
* @author Chris DeGreef fedupforone@gmail.com
*/
public class EnumCriteria<E> extends ListCriteria<E>
{
/**
* <p>
* Constructor for EnumCriteria.
* </p>
*
* @param listOfValidValues a {@link java.util.List} object.
*/
public EnumCriteria(final List<E> listOfValidValues)
{
super(listOfValidValues);
}
/** {@inheritDoc} */
@Override
public EnumCriteria<E> clone() throws CloneNotSupportedException
{
final EnumCriteria<E> clone = (EnumCriteria<E>) super.clone();
return clone;
}
}
| [
"fedupforone@gmail.com"
] | fedupforone@gmail.com |
955cd28617ce8794e2a022aa2addb526a291631f | 3ecd24389cedadaec02a0abf8bb87aa48dff2d78 | /src/main/java/com/zlkj/admin/service/impl/DepartmentServiceImpl.java | f82c5728d8cd3170015658b47b723691d7e1858d | [] | no_license | zlkjzxj/xzlt-project | 060227eecd44acef8234e1b0ea5f138ec7d435e9 | 6734da46343406508a6b29b206824e594c0aa054 | refs/heads/master | 2022-06-26T12:56:43.988731 | 2019-05-30T08:25:10 | 2019-05-30T08:25:10 | 186,393,365 | 0 | 0 | null | 2022-06-21T01:07:34 | 2019-05-13T09:57:19 | JavaScript | UTF-8 | Java | false | false | 1,891 | java | package com.zlkj.admin.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zlkj.admin.entity.Department;
import com.zlkj.admin.dao.DepartmentMapper;
import com.zlkj.admin.service.IDepartmentService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 系统用户表 服务实现类
* </p>
*
* @author Auto Generator
* @since 2018-07-16
*/
@Service
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements IDepartmentService {
@Resource
private DepartmentMapper departmentMapper;
@Override
public List<Integer> getAllChildrenDepartment(int id) {
Department department = new Department();
EntityWrapper<Department> wrapper = new EntityWrapper<>(department);
wrapper.eq("pid", id);
List<Department> departmentList = departmentMapper.selectList(wrapper);
List<Integer> ids = new ArrayList<>();
getChilds(departmentList, ids);
return ids;
}
@Override
public List<Department> findDepartmentHasNOChildren() {
return departmentMapper.findDepartmentHasNOChildren();
}
public void getChilds(List<Department> list, List<Integer> ids) {
if (!list.isEmpty()) {
for (Department d : list) {
ids.add(d.getId());
Department department = new Department();
EntityWrapper<Department> wrapper = new EntityWrapper<>(department);
wrapper.eq("pid", d.getId());
List<Department> departmentList = departmentMapper.selectList(wrapper);
if (!departmentList.isEmpty()) {
getChilds(departmentList, ids);
}
}
}
}
} | [
"zlkjzxj@163.com"
] | zlkjzxj@163.com |
6bd259759d14df5cc3a9f63ef093f271700e3082 | e804d969504cb9a5517c73da3dae2be800f4c1af | /Android/Lead/app/src/main/java/com/orbital/lead/model/EnumMessageType.java | a01977a285bcd4ccc866e8843e50178bef1af1c9 | [
"MIT"
] | permissive | orbitaljt/LEAD | 857def4c490d735c0c4c2de18ff34d3c7a0b9249 | f29fac84153d5e97c5fd25cae94959228bac2479 | refs/heads/master | 2020-05-31T14:52:36.173752 | 2015-08-18T13:39:54 | 2015-08-18T13:39:54 | 35,644,137 | 0 | 0 | null | 2015-08-18T12:45:22 | 2015-05-15T00:19:08 | PHP | UTF-8 | Java | false | false | 152 | java | package com.orbital.lead.model;
/**
* Created by joseph on 15/6/2015.
*/
public enum EnumMessageType {
SUCCESS, FAILURE, HAS_RECORD, NO_RECORD
}
| [
"the_only_light@hotmail.com"
] | the_only_light@hotmail.com |
1390df01a526bc0e7584d0a70af9f535c8f300b2 | 0e54302635e38ce40934be6272190411ff392a18 | /javaseDemo/src/main/java/observerPattern/GUIFrame.java | 834f72ee4811371e6fbbc2a5d18dd430dc220557 | [] | no_license | Zzzzpeng/java-demo | 0e1c870ab3d79cc46bbdb70b162c7c479cf0eb98 | 4e3eec2cb56c453a5268e3e4667328046bd6999c | refs/heads/master | 2022-12-25T07:32:35.386895 | 2020-03-24T15:28:51 | 2020-03-24T15:28:51 | 249,739,471 | 0 | 0 | null | 2022-12-16T05:00:55 | 2020-03-24T15:05:18 | Java | UTF-8 | Java | false | false | 1,401 | java | package observerPattern;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class GUIFrame extends JFrame {
public GUIFrame() throws InterruptedException {
setTitle("星形啊");
setVisible(true);
setSize(500,500);
MyMouseListener myMouseListener = new MyMouseListener();
MyMouseListener myMouseListener1 = new MyMouseListener();
MyMouseListener myMouseListener2 = new MyMouseListener();
addMouseListener(myMouseListener);
addMouseListener(myMouseListener1);
addMouseListener(myMouseListener2);
// while (true){
// Thread.sleep(1000);
// }
removeMouseListener(myMouseListener2);
// JButton jButton = new JButton("点我");
// jButton.addActionListener(new ActionListener() {
// @Override
// public void actionPerformed(ActionEvent e) {
//
// }
// });
// jButton.addActionListener(new MyActionListener());
}
public static void main(String[] args) throws InterruptedException {
new GUIFrame();
}
}
class MyActionListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("嘻嘻嘻");
}
}
| [
"chenzeipeng@126com"
] | chenzeipeng@126com |
34b29f3b997b3a833f90db1cde361296e21b1c50 | 9a234a23e75a4da14087de2aaffe0d85e781de9e | /plugins/QAPlugin/src/eu/prestoprime/model/ext/qa/TransmissionTechnologyType.java | db479f87fca7e7396e1a559a2d54b0e388d1063b | [] | no_license | eurix/p4 | fb7acdb265fe42010d892754910cacf703079b6c | be59827c43bf86b0629bb7dcc464e81d534ff865 | refs/heads/master | 2020-12-26T03:21:54.970003 | 2013-07-29T15:35:34 | 2013-07-29T15:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,218 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.07.24 at 11:42:28 PM CEST
//
package eu.prestoprime.model.ext.qa;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>
* Java class for TransmissionTechnologyType complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* <complexType name="TransmissionTechnologyType">
* <complexContent>
* <extension base="{urn:mpeg:mpeg7:schema:2004}ControlledTermUseType">
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TransmissionTechnologyType")
public class TransmissionTechnologyType extends ControlledTermUseType implements Serializable {
private final static long serialVersionUID = 1L;
}
| [
"prestoprime@eurixgroup.com"
] | prestoprime@eurixgroup.com |
08982b2108f5b33688f70042caf728842cfb2c6c | 5e44cc39276ffb0263a7691e7bf276cd09917417 | /WeatherApp/app/src/main/java/darko/com/weatherapp/util/TouchHelper.java | d1b25d640991a5ae705257267d6e458425b3d444 | [] | no_license | darkovski88/WeatherApp | 14e767805b90890b33c072909d6227b36644f85d | 2685b39528562ea76dc717af37854de4944929e6 | refs/heads/master | 2016-08-11T13:26:24.862620 | 2016-02-01T15:35:48 | 2016-02-01T15:35:48 | 50,848,837 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 906 | java | package darko.com.weatherapp.util;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import darko.com.weatherapp.adapters.CityAdapter;
/**
* Created by Petkovski on 01.02.2016.
*/
public class TouchHelper extends ItemTouchHelper.SimpleCallback {
private CityAdapter cityAdapter;
public TouchHelper(CityAdapter cityAdapter){
super(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT);
this.cityAdapter = cityAdapter;
}
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
//TODO: Not implemented here
return false;
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
cityAdapter.remove(viewHolder.getAdapterPosition());
}
} | [
"darko.petkovski@gmail.com"
] | darko.petkovski@gmail.com |
7c87c746bfec509432da12d6b8565f4553543194 | 4650e367bb3a4a3bf0a7f77b1582c4b3b984a413 | /src/main/java/com/mongo/test/dao/IUserDao.java | 47b92a527fdf8b453282a56f80d760d48557a309 | [] | no_license | L1ANN/Mongo_demo | 90aaa437ae257f64c980fb971bbd09ae6a46b163 | 271415064d916ea84e7da6cd2aec38e2db5cf8d8 | refs/heads/master | 2020-03-29T18:45:21.212216 | 2018-09-26T06:50:09 | 2018-09-26T06:50:09 | 150,229,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package com.mongo.test.dao;
import com.mongo.test.dao.IBaseDao;
import com.mongo.test.entity.UserInfo;
/**
* @Author:L1ANN
* @Description:
* @Date:Created in 下午1:12 2018/9/25
* @Modified By:
*/
public interface IUserDao extends IBaseDao<UserInfo> {
}
| [
"lianpengfei02@meituan.com"
] | lianpengfei02@meituan.com |
0aa099e7a5fd278501e5e7c323858623a36b223b | da14d4ef190857cfe895d65f04036cfd23b26cb2 | /Main.java | 71b4984f13be45713ab8dc6cfdf6ddfd96a928c1 | [] | no_license | JohnyRLk/java_owoce | 4f90d18c59dfdb7c390839c640aa84f675b0ec3c | df18be1dd79081f93bd38ff8599304781223f09e | refs/heads/master | 2022-12-07T06:22:37.925144 | 2020-08-30T22:22:02 | 2020-08-30T22:22:02 | 291,560,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,915 | java |
import java.util.*;
public class Main {
public Owoc[] koszyk = new Owoc[20];
public static void main(String[] args) {
Random rand = new Random();
Owoc[] koszyk = new Owoc[20];
for (int i = 0; i < 20; i++) {
koszyk[i] = new Owoc();
koszyk[i].kaliber = rand.nextInt(10);
koszyk[i].waga = rand.nextInt(10) * 1.1;
System.out.println(koszyk[i].kaliber);
System.out.println(koszyk[i].waga);
}
mySort(koszyk);
}
public static Owoc[][][] mySort(Owoc[] koszyk) {
Owoc[][][] toRet = new Owoc[3][koszyk.length][koszyk.length];
Owoc[] bubSortArr = koszyk.clone();
for (int i = 0; i < bubSortArr.length - 1; i++) {
for (int j = 0; j < bubSortArr.length - i - 1; j++)
if (bubSortArr[j].kaliber > bubSortArr[j + 1].kaliber
|| (bubSortArr[j].kaliber == bubSortArr[j + 1].kaliber
&& bubSortArr[j].waga > bubSortArr[j + 1].waga)) {
Owoc temp = bubSortArr[j];
bubSortArr[j] = bubSortArr[j + 1];
bubSortArr[j + 1] = temp;
}
toRet[0][i] = bubSortArr.clone();
}
Owoc[] selectionSort = koszyk.clone();
for (int i = 0; i < selectionSort.length - 1; i++) {
for (int j = i + 1; j < selectionSort.length; j++)
if (selectionSort[j].kaliber < selectionSort[i].kaliber
|| (selectionSort[j].kaliber == selectionSort[i].kaliber
&& selectionSort[j].waga > selectionSort[i].waga)) {
Owoc temp = selectionSort[j];
selectionSort[j] = selectionSort[i];
selectionSort[i] = temp;
}
toRet[1][i] = selectionSort.clone();
}
Owoc[] insertionSort = koszyk.clone();
for (int i = 1; i < insertionSort.length; ++i) {
Owoc key = insertionSort[i];
int j = i - 1;
while (j >= 0 && (insertionSort[j].kaliber > key.kaliber
|| (insertionSort[j].kaliber == key.kaliber && insertionSort[j].waga > key.waga))) {
insertionSort[j + 1] = insertionSort[j];
j = j - 1;
}
insertionSort[j + 1] = key;
toRet[2][i] = insertionSort.clone();
}
for (int v = 1; v < toRet.length; v++) {
for (int w = 1; w < toRet[v].length; w++) {
for (int e = 1; e < toRet[v][w].length; e++) {
System.out.println(toRet[v][w][e]);
}
}
}
return toRet;
}
}
class Owoc {
int kaliber;
double waga;
@Override
public String toString() {
return "Owoc+" + kaliber + " " + waga;
}
}
| [
"jan.rycielski@gmail.com"
] | jan.rycielski@gmail.com |
54ec6e9d5c564ea88cea73dc14488dbde1566f8f | fe3b413795fd263d7c6b5509779343a0ced0e869 | /Day-3/Components in a graph/Solution.java | f052dc436303083986d6bdcd221a1412eb949e77 | [] | no_license | lionelsamrat10/Hackerrank-HandsOn-Solutions | 0dae0969f2d2fc80b8a5db41db7b553e03bccb0a | 97cf47de0c232d10b53dc5dc4a7b5e4eec6d3c43 | refs/heads/main | 2023-03-27T01:27:23.392219 | 2021-03-27T09:26:46 | 2021-03-27T09:26:46 | 349,897,415 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,053 | java | //Author: Samrat Mitra
//Used Union Find Algorithm
import java.io.*;
import java.util.*;
public class Solution{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
UF uf = new UF();
uf.init(2 * n);
for(int i=1; i<=n; i++){
int g = sc.nextInt();
int b = sc.nextInt();
//Find the union
uf.union(g, b);
}
int maxSize = Integer.MIN_VALUE, minSize = Integer.MAX_VALUE;
//As there are 2*n number of nodes in the graph
for(int i=1; i<=2*n; i++){
int p = uf.find(i);
int s = uf.size[p];
if(s > 1){
if(minSize > s){
minSize = s;
}
if(maxSize < s){
maxSize = s;
}
}
}
//Print the minimum and maximum values
System.out.println(minSize + " " + maxSize);
}
//Static inner class for implementing Union Find Algorithm
static class UF{
//MAXN is initialized with 30001, because number of nodes cannot exceed 2 * 15000 = 30000
final static int MAXN = 30001;
int parent[] = new int[MAXN];
int size[] = new int[MAXN];
//init method
public void init(int n) {
for (int i = 1; i <= n; i++) {
parent[i] = i;
size[i] = 1;
}
}
//method to find the union
public void union(int u, int v){
int i = find(u);
int j = find(v);
if(i == j){
//Means disconnected vertex
return;
}
parent[i] = j;
size[j] += size[i];
}
//find() method
public int find(int u){
if(parent[u] == u){
return u;
}else{
return parent[u] = find(parent[u]);
}
}
}
}
| [
"noreply@github.com"
] | lionelsamrat10.noreply@github.com |
fba44bb321c33abfecb594797c5ede195a85563a | de58f3607b567eed507251d4060648a53d6f37e7 | /3.JavaMultithreading/src/com/javarush/task/task29/task2909/user/User.java | e2a22f3703cca89cff6b9917f7f26225b1c1924b | [] | no_license | sorrelcat/javarush | f984ec782095e7608114ea7f52c65cd6a21264c2 | 13a0c8638ec95269eb9c281843cda27e976f7d9f | refs/heads/master | 2021-07-19T18:25:14.809877 | 2017-10-25T18:03:00 | 2017-10-25T18:03:00 | 105,542,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,989 | java | package com.javarush.task.task29.task2909.user;
public class User {
private String name;
private String surname;
private int age;
private Address address;
private boolean man;
public boolean isMan() {
return man;
}
public void setMan(boolean man) {
this.man = man;
}
private Work work;
public User(String name, String surname, int age) {
this.name = name;
this.surname = surname;
this.age = age;
this.man = false;
}
public void printInfo() {
System.out.println("Имя: " + name);
System.out.println("Фамилия: " + surname);
}
public void printAdditionalInfo() {
if (this.getAge() < 16)
System.out.println("Пользователь моложе 16 лет");
else
System.out.println("Пользователь старше 16 лет");
}
public String getCountry() {
return address.getCountry();
}
public void setCountry(String country) {
address.setCountry(country);
}
public String getCity() {
return address.getCity();
}
public void setCity(String city) {
address.setCity(city);
}
public String getBoss() {
Work work = this.getWork();
return work.getBoss();
}
public String getAddress() {
return address.getCountry() + " " + address.getCity() + " " + address.getHouse();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Work getWork() {
return work;
}
public void setWork(Work work) {
this.work = work;
}
} | [
"o.schest@gmail.com"
] | o.schest@gmail.com |
de66e348d8bbc915b4edd7096ba4cbcca8e94c09 | c25aca8ee5894cc8d0ac6e7c60ac12a308bf5fa7 | /src/main/java/com/github/karsl/filmrepository/repository/LanguageRepository.java | 584d1ccb02bc3ee98c810653a8c86329c07268db | [
"BSD-3-Clause"
] | permissive | karsl/film-repository | 8048bff153e73373adf4090d3bd5bc74d63f0fae | 7939ecc3cb51ce605e2456d030594632107b5454 | refs/heads/main | 2023-02-11T18:05:41.247896 | 2021-01-13T21:25:05 | 2021-01-13T21:25:05 | 329,414,990 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 250 | java | package com.github.karsl.filmrepository.repository;
import com.github.karsl.filmrepository.model.Language;
import org.springframework.data.jpa.repository.JpaRepository;
public interface LanguageRepository extends JpaRepository<Language, Long> {
}
| [
"kaan.arslan@ceng.deu.edu.tr"
] | kaan.arslan@ceng.deu.edu.tr |
a214018745beb6c2114556c03dee6850ec181498 | b651d84ed4503f84c1c013e742601c2b90949080 | /src/main/java/com/foolish/idempotent/service/impl/TestServiceImpl.java | 7af89b52fef8094b22dfbad78d8bdb6ee2a017b1 | [] | no_license | lxlx704034204/idempotent | 43fa1dbfba82855c6d1ed7b674a0dc1791dafdce | 13a1f526b42a1e744afc9f229d24208982aa4919 | refs/heads/master | 2022-05-28T01:43:10.693509 | 2020-04-29T07:27:49 | 2020-04-29T07:27:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.foolish.idempotent.service.impl;
import com.foolish.idempotent.service.TestService;
import org.springframework.stereotype.Service;
/**
* @description:
* @author:chaoxianfei
* @date:2020/4/29 14:48
*/
@Service
public class TestServiceImpl implements TestService {
@Override
public String testIdempotence() {
return "测试重复提交的方法!";
}
}
| [
"862977812@qq.com"
] | 862977812@qq.com |
4b57a2a653286ced2450535753b3367d6cb2de9c | c5182ecd2dab04331a71182a7f639a7d99511fc7 | /src/main/java/api/model/enums/Layout.java | f17b7f804b0679c173a48e162402041de4e044a1 | [] | no_license | marcosantoniofilho16/hack-backend | b14e312eb4d88d486f9c1df8ecb8445af96f0897 | 2e7aef1c98016039068cf23b4e59e2af3d038bd9 | refs/heads/master | 2023-05-28T22:45:17.783635 | 2021-06-09T15:02:30 | 2021-06-09T15:02:30 | 375,386,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 61 | java | package api.model.enums;
public enum Layout {
DEFAULT
}
| [
"marcosantonio.filho16@gmail.com"
] | marcosantonio.filho16@gmail.com |
6f668486947e161275c43e14a738a982e96159a4 | d1f6c596adce4b2960f2b108c349c770d355139d | /src/threadpool/FixedThreadPoolTest.java | 91facc9a35947f7d2cbb469a38545d45072f0d27 | [] | no_license | hcute/juc | f83f63d46e5a743e488a111efa56bf168642303a | 828c340fc1a5bb18e4958399002f59f865f4067c | refs/heads/master | 2022-06-27T03:05:28.079984 | 2020-05-10T23:26:33 | 2020-05-10T23:26:33 | 257,430,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package threadpool;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 演示newFixedThreadPool
* - 里面的workQueue采用的是LinkedBlockingQueue 的无界队列
* - 随着任务的增多会导致oom错误
*/
public class FixedThreadPoolTest {
public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(4);
for (int i = 0; i < 1000; i++) {
executorService.execute(new Task());
}
}
}
class Task implements Runnable{
@Override
public void run() {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName());
}
}
| [
"hcute.hoo@gmail.com"
] | hcute.hoo@gmail.com |
80c3a6eb6b2146c52b3f61a31d65f4c53fed0059 | 3e99b657f308b4b264ca5be909e32646c581dfe0 | /Java Assignments/Simple Functions/src/PerfectNumbers.java | 28f1dc84d6ac0da7fd3146709cd7f3aff75f6508 | [] | no_license | RobJLeonard/CollegeWork | cf1f0a299257845ec4d95c4b791f02cde239c17c | f374d5b2e5d65a6fbfcdaabd374917997c0a7f40 | refs/heads/master | 2021-08-23T22:18:19.675061 | 2017-12-06T20:53:31 | 2017-12-06T20:53:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,213 | java | public class PerfectNumbers {
public static final int MAX_NUMBER = 10000;
public static void main (String args[])
{
for (int number = 1; (number <= MAX_NUMBER); number++)
{
if (isPerfectNumber(number))
{
System.out.println( "The number " + number + " is a perfect number." );
}
}
}
// Check if the passed number is a perfect number (i.e. if the sum of
// its divisors equals the number itself).
private static boolean isPerfectNumber( int number )
{
int sumOfDivisors = 0;
int currentDivisor = 1;
while ((currentDivisor != number) && (currentDivisor != -1))
{
sumOfDivisors += currentDivisor;
currentDivisor = getNextDivisor( currentDivisor, number );
}
return (number == sumOfDivisors);
}
// Given a number and a divisor, find and return the next highest
// divisor of the number. If there is no such divisor return -1.
private static int getNextDivisor ( int lastDivisor, int number )
{
if ((lastDivisor > 0) && (lastDivisor < number) &&
(number % lastDivisor == 0))
{
int divisor = lastDivisor;
do {
divisor++;
} while (number % divisor != 0);
return divisor;
}
return -1;
}
} | [
"noreply@github.com"
] | RobJLeonard.noreply@github.com |
e8ac00ef47a3a4ff8e06e21990e43bd7a7db04f1 | b323d49966089b13d5eb418c9c278d0c631e1be1 | /UserStudy-Pilot1/src/Task_B.java | 3c82baa3cddbdd80e110044cebc099fbc2d52b21 | [
"MIT"
] | permissive | mkery/Moonstone-ErrorHandlingJava | 346942ad74c17045175a43a25d06a9c33b0425a7 | 88d498624c9f5fa4482e29f45e4287ca2aa4bdb4 | refs/heads/master | 2020-04-04T21:19:55.581795 | 2018-11-05T21:03:12 | 2018-11-05T21:03:12 | 156,282,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,144 | java | import java.util.Collection;
import Environment.*;
public class Task_B {
/*
* You're reviewing code for a game. This method was written to fend off all
* attacking monsters. Verify that it works as intended and make appropriate
* changes to the exception handling code where necessary.
*/
// TODO: Leave out?
void fightMonsters(Horde horde) {
Knight knight = new Knight();
try {
Collection<Monster> monsters = horde.getMonsters();
while (!monsters.isEmpty()) {
try {
for (Monster monster : monsters) {
knight.attack(monster);
}
} catch (CounterAttackException e) {
knight.parry();
}
monsters.removeIf(monster -> monster.getHealth() == 0);
horde.processFightRound(knight);
}
} catch (KnightDiedException e) {
throw new AssertionError("Programmer error: The knight should not die in this method", e);
}
System.out.println("The king prevailed");
}
}
| [
"mkery@cs.cmu.edu"
] | mkery@cs.cmu.edu |
621c1b981ee54786900a35ddaca2a888f3370e70 | 97e2f1123b654432b890313646f7b343cf2e7f0c | /Product/Production/Services/DocumentRetrieveCore/src/main/java/gov/hhs/fha/nhinc/docretrieve/messaging/builder/DocumentRetrieveRequestBuilder.java | 1703d5ddacaf9e927f294e77347ff49e1155624a | [
"BSD-3-Clause"
] | permissive | gravesmedical/CONNECT | 007b51606db74d357beb0a245d31e405bcd8f626 | ef9aaa984794bd796f3a80a4e895143854cb4ba7 | refs/heads/CONNECT_integration | 2021-01-14T10:06:23.300988 | 2015-10-09T12:43:07 | 2015-10-09T12:43:07 | 44,042,024 | 1 | 0 | null | 2015-10-11T06:40:38 | 2015-10-11T06:40:38 | null | UTF-8 | Java | false | false | 2,647 | java | /*
* Copyright (c) 2009-2015, United States Government, as represented by the Secretary of Health and Human Services.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the United States Government nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE UNITED STATES GOVERNMENT BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package gov.hhs.fha.nhinc.docretrieve.messaging.builder;
import gov.hhs.fha.nhinc.messaging.builder.Builder;
import ihe.iti.xds_b._2007.RetrieveDocumentSetRequestType;
/**
*
* @author achidamb
*/
public interface DocumentRetrieveRequestBuilder extends Builder {
/**
* The DocumentRetrieve Request will be returned
*
* @return RetrieveDocumentSetRequestType DocumentRetrieve Request
*/
public RetrieveDocumentSetRequestType getMessage();
/**
* sets the HCID for the DocumentRetrieve Request
*
* @param hcid HomeCommunityId
*/
public void setHCID(String hcid);
/**
* sets the RepositoryId of the DocumentRetrieve Request
*
* @param repositoryId
*/
public void setRepositoryId(String repositoryId);
/**
* sets the documentUniqueId of the DocumentRetrieve Request to be retrieved
*
* @param documentId
*/
public void setDocumentId(String documentId);
}
| [
"achidamb@ACHIDAMB-F05745.cgifederal.com"
] | achidamb@ACHIDAMB-F05745.cgifederal.com |
46a53359debc9ed6639fe465440fd063cd2fb7f9 | 5740c5fb37e8ca256e3d607c2fe58bc4e4d12a99 | /src/main/java/com/sparkTutorial/rdd/UppercaseWord1.java | 094f0107e6a2fca03564f6b4c93913386227d420 | [] | no_license | karthiknom7/spark-session | 4c89a3cddd1dcd08699a4ae02791f3f7c844fef1 | 6528ff152691d050319e9d0fb4081018d74f9e99 | refs/heads/master | 2021-01-14T20:46:35.882460 | 2020-03-15T17:13:36 | 2020-03-15T17:13:36 | 242,752,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,211 | java | package com.sparkTutorial.rdd;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.storage.StorageLevel;
import java.util.Arrays;
import java.util.List;
public class UppercaseWord1 {
public static void main(String[] args) throws Exception {
// Create a Java Spark Context.
Logger.getLogger("org").setLevel(Level.ERROR);
SparkConf conf = new SparkConf().setAppName("uppercase").setMaster("local[2]");
JavaSparkContext sc = new JavaSparkContext(conf);
List<String> wordsList = Arrays.asList("advancements", "attacks", "trade", "American", "war", "Obama", "people", "steamboat");
JavaRDD<String> words = sc.parallelize(wordsList);
/*
1) Convert each word to upper case
2) Count the number of words starts with 'A'
*/
JavaRDD<String> stringJavaRDD = words.map(String::toUpperCase);
long count = stringJavaRDD.filter(word -> {
return word.startsWith("");
}).count();
System.out.println(count);
}
}
| [
"karthikn@thoughtworks.com"
] | karthikn@thoughtworks.com |
83d6bd61d7615a91e9a830b7aee137c9d0801071 | e89277ec3c1b5980eed8c19939a65f2b80f2b60d | /tests/objectmacro/java/back/cycle/SequentialCase.java | 0f7fa6edbcf8215076ece2b30f1971b65c4d5838 | [
"Apache-2.0"
] | permissive | SableCC/sablecc | b844c4e918fd09096075f1ec49f55b76e6c5b51f | 378fc74a2e8213567149a6c676d79d7630e87640 | refs/heads/master | 2023-03-11T03:44:14.785650 | 2018-09-13T01:10:02 | 2018-09-13T01:10:02 | 328,567 | 107 | 18 | Apache-2.0 | 2018-09-13T01:11:52 | 2009-10-06T14:42:08 | Java | UTF-8 | Java | false | false | 4,317 | java | /* This file is part of SableCC ( http://sablecc.org ).
*
* See the NOTICE file distributed with this work for copyright information.
*
* 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 back.cycle;
import graph_generator.DynamicJavaExecutor;
import graph_generator.GraphGenerator;
import javax.tools.JavaFileObject;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Arrays;
public class SequentialCase {
private static BufferedWriter writer;
private static Integer class_num = 0;
static {
try {
writer = new BufferedWriter(new FileWriter("ResultSequentialNaive.txt", true));
}
catch (IOException e) {
e.printStackTrace();
}
}
public static void main(
String[] args)throws IOException {
String package_name = SequentialCase.class.getPackage().getName();
String class_name = "LineCase";
String content = GraphGenerator.sequentialCase(package_name, class_name, 1000);
compileAndRun(package_name, class_name, content, true);
runTest(250, package_name, class_name);
runTest(500, package_name, class_name);
runTest(750, package_name, class_name);
runTest(1000, package_name, class_name);
runTest(1250, package_name, class_name);
runTest(1500, package_name, class_name);
runTest(1750, package_name, class_name);
runTest(2000, package_name, class_name);
runTest(2250, package_name, class_name);
runTest(2500, package_name, class_name);
runTest(2750, package_name, class_name);
runTest(3000, package_name, class_name);
runTest(3250, package_name, class_name);
runTest(3500, package_name, class_name);
runTest(3750, package_name, class_name);
runTest(4000, package_name, class_name);
runTest(4250, package_name, class_name);
runTest(4500, package_name, class_name);
runTest(4750, package_name, class_name);
runTest(5000, package_name, class_name);
runTest(6000, package_name, class_name);
writer.write("\n");
writer.close();
System.out.println();
System.out.println();
}
private static long compileAndRun(
String package_name,
String class_name,
String mainContent,
boolean warm_up){
JavaFileObject mainFile = DynamicJavaExecutor.getJavaFileObject(package_name, class_name, mainContent);
Iterable<? extends JavaFileObject> files = Arrays.asList(mainFile);
if (warm_up) {
if(DynamicJavaExecutor.compile(files)){
for(int i = 0; i < 100; i++){
DynamicJavaExecutor.run(package_name, class_name);
}
}
}
else{
if(DynamicJavaExecutor.compile(files)){
return DynamicJavaExecutor.run(package_name, class_name);
}
}
return 0;
}
private static void runTest(
int nb_nodes,
String package_name,
String class_name) throws IOException{
long total_time = 0;
System.out.println("=========== SEQUENTIAL for " + nb_nodes + " nodes ==============");
for(int i = class_num; i < class_num + 30; i++){
String content = GraphGenerator.sequentialCase(package_name, class_name + i, nb_nodes);
total_time += compileAndRun(package_name, class_name + i, content, false);
}
class_num += 30;
writer.write( total_time / 30 + "\n");
System.out.println("Total time taken : " + total_time + " ns");
System.out.println("Average total time taken : " + total_time / 30 + " ns");
}
}
| [
"egagnon@j-meg.com"
] | egagnon@j-meg.com |
124ef9af78af15d8a703d91e9cdcc36626d712fb | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i19664.java | bd0374142804d28fe473e43195d5adad8feece32 | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 69 | java | package number_of_direct_superinterfaces;
public interface i19664 {} | [
"vincentlee.dolbydigital@yahoo.com"
] | vincentlee.dolbydigital@yahoo.com |
8063b288984737c5b276811fd8310c1bfe79adc5 | 3d6833978344bd46b8f453ead8fd282c72a4f66f | /src/main/java/com/example/spay/greendao/entity/City.java | 06cd993c243221c0fe10008318f174be938e28f7 | [] | no_license | huanglonghu/spay | c64765d72a6ea547ce38deb787241bd0df21f861 | 095389e1f42b91121ca1ec342ae292ab69679b3e | refs/heads/master | 2021-03-17T09:48:26.595320 | 2020-03-25T10:08:34 | 2020-03-25T10:08:34 | 246,981,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,281 | java | package com.example.spay.greendao.entity;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Generated;
/**
* Created by Administrator on 2018/8/9.
*/
@Entity(nameInDb = "T_City", createInDb = false)
public class City {
@Property(nameInDb = "CitySort")
@Id(autoincrement = true)
private long citySort;
@Property(nameInDb = "ProID")
private int proId;
@Property(nameInDb = "CityName")
private String cityName;
@Generated(hash = 1900800873)
public City(long citySort, int proId, String cityName) {
this.citySort = citySort;
this.proId = proId;
this.cityName = cityName;
}
@Generated(hash = 750791287)
public City() {
}
public long getCitySort() {
return this.citySort;
}
public void setCitySort(long citySort) {
this.citySort = citySort;
}
public int getProId() {
return this.proId;
}
public void setProId(int proId) {
this.proId = proId;
}
public String getCityName() {
return this.cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
} | [
"952204748@qq.com"
] | 952204748@qq.com |
0d2d5c40aeb02cb131f91d9ecb91fd9324871504 | 72b97938777c088c260637d7fa3fd2f120367efd | /src/com/example/sea_battle/adapter/LobbyAdapter.java | 82d147d09fcba310d0972e105572ba59352465d9 | [] | no_license | MihailovJava/SeaBattle | a2879e56a45c53eafc7faca2e8c3373039099052 | dd45d238d906c9efc03b815a3a3d2d5e8a535640 | refs/heads/master | 2020-04-09T14:57:44.055465 | 2015-03-03T15:57:17 | 2015-03-03T15:57:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,362 | java | package com.example.sea_battle.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.example.sea_battle.R;
import droidbro.seacore.Game;
import java.util.List;
/**
* Created by Nixy on 18.01.2015.
*/
public class LobbyAdapter extends ArrayAdapter<Game>{
int layoutid;
LayoutInflater mInflater;
public LobbyAdapter(Context context, int recource, List<Game> objects) {
super(context, recource, objects);
layoutid = recource;
mInflater = (LayoutInflater) context.getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View layout = mInflater.inflate(layoutid,parent,false);
TextView gameName = (TextView) layout.findViewById(R.id.game_name);
TextView playersCount = (TextView) layout.findViewById(R.id.players_count);
Game game = getItem(position);
gameName.setText(game.getGameName());
playersCount.setText(getContext().getString(R.string.playersCountTextViewText)+" "+String.valueOf(game.getPlayers().size()));
layout.setTag(R.integer.gameID_tag,game);
return layout;
}
}
| [
"kpoleg@list.ru"
] | kpoleg@list.ru |
1dd4dd9bb15d5db0712f4de72b4c2273a92b2433 | ba44486481a811b362556d920a3aa209b4d8cd9c | /app/src/main/java/com/igw/igw/utils/statusbarutils/StatusBarUtil.java | 25de17864ce3a680a9cd5f9f616b7cde29eb6894 | [] | no_license | StormLeiTeam/igw2 | 1cdde677e0441babbffbaa788eeec8b43c733a4c | 59aecce475a92d8358bf459fddff841a0e67f74b | refs/heads/master | 2023-02-26T10:56:18.204890 | 2021-02-01T15:11:28 | 2021-02-01T15:11:28 | 255,221,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,143 | java | package com.igw.igw.utils.statusbarutils;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.support.annotation.IntDef;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class StatusBarUtil {
public final static int TYPE_MIUI = 0;
public final static int TYPE_FLYME = 1;
public final static int TYPE_M = 3;//6.0
@IntDef({TYPE_MIUI,
TYPE_FLYME,
TYPE_M})
@Retention(RetentionPolicy.SOURCE)
@interface ViewType {
}
/**
* 修改状态栏颜色,支持4.4以上版本
*
* @param colorId 颜色
*/
public static void setStatusBarColor(Activity activity, int colorId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.setStatusBarColor(colorId);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//使用SystemBarTintManager,需要先将状态栏设置为透明
setTranslucentStatus(activity);
SystemBarTintManager systemBarTintManager = new SystemBarTintManager(activity);
systemBarTintManager.setStatusBarTintEnabled(true);//显示状态栏
systemBarTintManager.setStatusBarTintColor(colorId);//设置状态栏颜色
}
}
/**
* 设置状态栏透明
*/
@TargetApi(19)
public static void setTranslucentStatus(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//5.x开始需要把颜色设置透明,否则导航栏会呈现系统默认的浅灰色
Window window = activity.getWindow();
View decorView = window.getDecorView();
//两个 flag 要结合使用,表示让应用的主体内容占用系统状态栏的空间
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(option);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
//导航栏颜色也可以正常设置
// window.setNavigationBarColor(Color.TRANSPARENT);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = activity.getWindow();
WindowManager.LayoutParams attributes = window.getAttributes();
int flagTranslucentStatus = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
attributes.flags |= flagTranslucentStatus;
//int flagTranslucentNavigation = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
//attributes.flags |= flagTranslucentNavigation;
window.setAttributes(attributes);
}
}
/**
* 代码实现android:fitsSystemWindows
*
* @param activity
*/
public static void setRootViewFitsSystemWindows(Activity activity, boolean fitSystemWindows) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
ViewGroup winContent = (ViewGroup) activity.findViewById(android.R.id.content);
if (winContent.getChildCount() > 0) {
ViewGroup rootView = (ViewGroup) winContent.getChildAt(0);
if (rootView != null) {
rootView.setFitsSystemWindows(fitSystemWindows);
}
}
}
}
/**
* 设置状态栏深色浅色切换
*/
public static boolean setStatusBarDarkTheme(Activity activity, boolean dark) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
setStatusBarFontIconDark(activity, TYPE_M, dark);
} else if (OSUtils.isMiui()) {
setStatusBarFontIconDark(activity, TYPE_MIUI, dark);
} else if (OSUtils.isFlyme()) {
setStatusBarFontIconDark(activity, TYPE_FLYME, dark);
} else {//其他情况
return false;
}
return true;
}
return false;
}
/**
* 设置 状态栏深色浅色切换
*/
public static boolean setStatusBarFontIconDark(Activity activity, @ViewType int type,boolean dark) {
switch (type) {
case TYPE_MIUI:
return setMiuiUI(activity, dark);
case TYPE_FLYME:
return setFlymeUI(activity, dark);
case TYPE_M:
default:
return setCommonUI(activity,dark);
}
}
//设置6.0 状态栏深色浅色切换
public static boolean setCommonUI(Activity activity, boolean dark) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
View decorView = activity.getWindow().getDecorView();
if (decorView != null) {
int vis = decorView.getSystemUiVisibility();
if (dark) {
vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
} else {
vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
}
if (decorView.getSystemUiVisibility() != vis) {
decorView.setSystemUiVisibility(vis);
}
return true;
}
}
return false;
}
//设置Flyme 状态栏深色浅色切换
public static boolean setFlymeUI(Activity activity, boolean dark) {
try {
Window window = activity.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags");
darkFlag.setAccessible(true);
meizuFlags.setAccessible(true);
int bit = darkFlag.getInt(null);
int value = meizuFlags.getInt(lp);
if (dark) {
value |= bit;
} else {
value &= ~bit;
}
meizuFlags.setInt(lp, value);
window.setAttributes(lp);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
//设置MIUI 状态栏深色浅色切换
public static boolean setMiuiUI(Activity activity, boolean dark) {
try {
Window window = activity.getWindow();
Class<?> clazz = activity.getWindow().getClass();
@SuppressLint("PrivateApi") Class<?> layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
int darkModeFlag = field.getInt(layoutParams);
Method extraFlagField = clazz.getDeclaredMethod("setExtraFlags", int.class, int.class);
extraFlagField.setAccessible(true);
if (dark) { //状态栏亮色且黑色字体
extraFlagField.invoke(window, darkModeFlag, darkModeFlag);
} else {
extraFlagField.invoke(window, 0, darkModeFlag);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
//获取状态栏高度
public static int getStatusBarHeight(Context context) {
int result = 0;
int resourceId = context.getResources().getIdentifier(
"status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = context.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
}
| [
"zq329051@outlook.com"
] | zq329051@outlook.com |
41db614da492cb35642b51384443a9bf735cdc8f | c8d2266872675aa5e2bfce39deaf052d15160278 | /build/decompiled/com/amap/api/mapcore/util/ik.java | 29b88f8550885ef73c1e279e80c3f335614c78b4 | [] | no_license | baoxin/fluttify-core-example | 3d586d4aa3ff1b5798c330fb69a34d326823c9cf | 2ef109064c816d72182fdc294e3cb504896f2577 | refs/heads/master | 2022-04-25T05:16:46.237390 | 2019-08-28T07:46:52 | 2019-08-28T07:48:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,185 | java | package com.amap.api.mapcore.util;
import android.content.Context;
import java.io.File;
import java.lang.reflect.Constructor;
public class ik {
public static <T> T a(Context var0, hf var1, String var2, Class var3, Class[] var4, Object[] var5) throws gt {
ip var6 = b(var0, var1);
Object var7 = a(var6, var2, var4, var5);
if (var7 != null) {
return var7;
} else {
var7 = a(var3, var4, var5);
if (var7 != null) {
return var7;
} else {
throw new gt("获取对象错误");
}
}
}
public static void a(Context var0, String var1) {
try {
il.b().a().submit(new ik$1(var0, var1));
} catch (Throwable var3) {
in.a(var3, "InstanceFactory", "rollBack");
}
}
public static boolean a(Context var0, hf var1) {
try {
String var2 = ig.a(var0);
File var3 = new File(var2);
if (!var3.exists()) {
return false;
} else {
String var4 = ig.b(var0, var1.a(), var1.b());
File var5 = new File(var4);
if (var5.exists()) {
return true;
} else {
ig.a(var0, var5, var1);
return false;
}
}
} catch (Throwable var6) {
in.a(var6, "IFactory", "isdowned");
return false;
}
}
public static Class a(Context var0, hf var1, String var2) {
ip var3 = b(var0, var1);
try {
if (a(var3)) {
Class var4 = var3.loadClass(var2);
return var4;
} else {
return null;
}
} catch (Throwable var5) {
in.a(var5, "InstanceFactory", "loadpn");
return null;
}
}
private static ip b(Context var0, hf var1) {
ip var2 = null;
try {
if (var0 == null) {
return null;
}
if (a(var0, var1)) {
var2 = il.b().a(var0, var1);
}
} catch (Throwable var4) {
in.a(var4, "IFactory", "gIns1");
}
return var2;
}
private static boolean a(ip var0) {
return var0 != null && var0.a() && var0.d;
}
private static <T> T a(ip var0, String var1, Class[] var2, Object[] var3) {
try {
if (a(var0)) {
Class var4 = var0.loadClass(var1);
if (var4 != null) {
Constructor var5 = var4.getDeclaredConstructor(var2);
var5.setAccessible(true);
Object var6 = var5.newInstance(var3);
return var6;
}
}
} catch (Throwable var7) {
in.a(var7, "IFactory", "getWrap");
}
return null;
}
private static <T> T a(Class var0, Class[] var1, Object[] var2) {
try {
if (var0 == null) {
return null;
} else {
Constructor var3 = var0.getDeclaredConstructor(var1);
var3.setAccessible(true);
Object var4 = var3.newInstance(var2);
return var4;
}
} catch (Throwable var5) {
in.a(var5, "IFactory", "gIns2()");
return null;
}
}
}
| [
"382146139@qq.com"
] | 382146139@qq.com |
5e3d44110a54c70a54e0157e4e066771fca06069 | d298bd65b53ebdd6663f2396a714f1a16bb82a38 | /src/Rectangle.java | fa6948241c89c581b654a8d0f066ba3dead7abd8 | [] | no_license | sailaja-oss/Practise | ba6f011c71b75bd80cabac16516128fce81f609e | 53cabf438b4d12b255cf995cb0671c51eab124eb | refs/heads/master | 2023-09-06T07:26:07.190503 | 2021-11-09T07:24:03 | 2021-11-09T07:24:03 | 399,890,689 | 0 | 0 | null | 2021-11-09T07:24:04 | 2021-08-25T16:43:17 | Java | UTF-8 | Java | false | false | 122 | java | public class Rectangle extends Shape{
public double getArea()
{
return getHeight() * getWidth();
}
}
| [
"sailajar@maveric-systems.com"
] | sailajar@maveric-systems.com |
fd16646f9fab4851a5a19bb01758d2e4b872baa1 | a91904e68396603ca96c549bb464773ca17f206c | /src/test/java/com/dualion/controldiners/web/rest/UserResourceIntTest.java | 5139c127a2ad91a687141c6b0482bee954591c72 | [] | no_license | Dualion/ControlDiners | bbf0f74786d4e2f42d2ea2b82b110dd1c4227908 | afe4228eca076bac0830bad75e81ec14b0df415e | refs/heads/master | 2021-01-13T14:29:15.945496 | 2016-11-06T14:24:56 | 2016-11-06T14:24:56 | 72,856,434 | 0 | 1 | null | 2020-09-18T15:14:39 | 2016-11-04T14:46:28 | Java | UTF-8 | Java | false | false | 2,927 | java | package com.dualion.controldiners.web.rest;
import com.dualion.controldiners.ControlDinersApp;
import com.dualion.controldiners.domain.User;
import com.dualion.controldiners.repository.UserRepository;
import com.dualion.controldiners.service.UserService;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the UserResource REST controller.
*
* @see UserResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ControlDinersApp.class)
public class UserResourceIntTest {
@Inject
private UserRepository userRepository;
@Inject
private UserService userService;
private MockMvc restUserMockMvc;
/**
* Create a User.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which has a required relationship to the User entity.
*/
public static User createEntity(EntityManager em) {
User user = new User();
user.setLogin("test");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setEmail("test@test.com");
user.setFirstName("test");
user.setLastName("test");
user.setLangKey("en");
em.persist(user);
em.flush();
return user;
}
@Before
public void setup() {
UserResource userResource = new UserResource();
ReflectionTestUtils.setField(userResource, "userRepository", userRepository);
ReflectionTestUtils.setField(userResource, "userService", userService);
this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource).build();
}
@Test
public void testGetExistingUser() throws Exception {
restUserMockMvc.perform(get("/api/users/admin")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.lastName").value("Administrator"));
}
@Test
public void testGetUnknownUser() throws Exception {
restUserMockMvc.perform(get("/api/users/unknown")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isNotFound());
}
}
| [
"jordicanalsros@gmail.com"
] | jordicanalsros@gmail.com |
ac2887b72125289af0bdbc4e6d8c83ba2ab4abb6 | a8ca7f60e772062f8ef72709f5c102ee03843290 | /src/main/java/com/zerra/client/presence/Presence.java | b429ea8a3a6dd669f3a8d1203e15c98fd85ba4b8 | [] | no_license | StackDoubleFlow/Zerra | 444d587b0af9f71a4434e20ca24e93c69140c8ee | 44dced1c1f2722c4c1fe6c76c760c967984a53ad | refs/heads/master | 2020-04-16T12:37:55.313860 | 2019-01-14T23:28:07 | 2019-01-14T23:28:07 | 165,589,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,334 | java | package com.zerra.client.presence;
import com.zerra.client.Zerra;
import club.minnced.discord.rpc.DiscordEventHandlers;
import club.minnced.discord.rpc.DiscordRPC;
import club.minnced.discord.rpc.DiscordRichPresence;
public class Presence
{
private static DiscordRPC lib;
private static DiscordRichPresence drp;
private DiscordEventHandlers handlers;
String appId;
public Presence()
{
lib = DiscordRPC.INSTANCE;
appId = "532051034453966858"; //TODO: We may need to hide this.
handlers = new DiscordEventHandlers();
handlers.ready = (user) -> { Zerra.logger().info("Discord Rich Presence is ready!"); };
lib.Discord_Initialize(appId, handlers, true, null);
drp = new DiscordRichPresence();
// in a worker thread
new Thread(() ->
{
while (!Thread.currentThread().isInterrupted() && Zerra.getInstance() != null)
{
lib.Discord_RunCallbacks();
try
{
Thread.sleep(2000);
} catch (InterruptedException ignored)
{
}
}
}, "DRP-Callback-Handler").start();
}
public void setPresence(String details, String imageKeyLarge, String imageKeySmall)
{
drp.startTimestamp = System.currentTimeMillis() / 1000; // epoch second
drp.details = details;
drp.largeImageKey = imageKeyLarge;
drp.smallImageKey = imageKeySmall;
lib.Discord_UpdatePresence(drp);
}
}
| [
"arpaesis@gmail.com"
] | arpaesis@gmail.com |
51b16e185613af7ae3d120c53ed3fa0f424bcc06 | 562309065fd71f85ec1d46cf85b78d0681ad5da6 | /aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/APNSPushNotificationTemplate.java | 5afb94e1335f5f1451a0def65fc26822d8f4b45e | [
"Apache-2.0"
] | permissive | omalley/aws-sdk-java | 95c50a142becc12e81cb1859845f776a8fd167fe | 5bafd0d6c4a979bc55fcf6709e93c9983bd2d1e6 | refs/heads/master | 2022-03-31T04:56:33.580748 | 2019-11-07T01:24:19 | 2019-11-07T01:24:19 | 220,286,579 | 0 | 0 | Apache-2.0 | 2019-11-07T16:57:22 | 2019-11-07T16:57:21 | null | UTF-8 | Java | false | false | 23,290 | java | /*
* Copyright 2014-2019 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.pinpoint.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* Specifies channel-specific content and settings for a message template that can be used in push notifications that
* are sent through the APNs (Apple Push Notification service) channel.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-2016-12-01/APNSPushNotificationTemplate"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class APNSPushNotificationTemplate implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The action to occur if a recipient taps a push notification that's based on the message template. Valid values
* are:
* </p>
* <ul>
* <li>
* <p>
* OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default
* action.
* </p>
* </li>
* <li>
* <p>
* DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the
* deep-linking features of the iOS platform.
* </p>
* </li>
* <li>
* <p>
* URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you
* specify.
* </p>
* </li>
* </ul>
*/
private String action;
/**
* <p>
* The message body to use in push notifications that are based on the message template.
* </p>
*/
private String body;
/**
* <p>
* The URL of an image or video to display in push notifications that are based on the message template.
* </p>
*/
private String mediaUrl;
/**
* <p>
* The key for the sound to play when the recipient receives a push notification that's based on the message
* template. The value for this key is the name of a sound file in your app's main bundle or the Library/Sounds
* folder in your app's data container. If the sound file can't be found or you specify default for the value, the
* system plays the default alert sound.
* </p>
*/
private String sound;
/**
* <p>
* The title to use in push notifications that are based on the message template. This title appears above the
* notification message on a recipient's device.
* </p>
*/
private String title;
/**
* <p>
* The URL to open in the recipient's default mobile browser, if a recipient taps a push notification that's based
* on the message template and the value of the Action property is URL.
* </p>
*/
private String url;
/**
* <p>
* The action to occur if a recipient taps a push notification that's based on the message template. Valid values
* are:
* </p>
* <ul>
* <li>
* <p>
* OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default
* action.
* </p>
* </li>
* <li>
* <p>
* DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the
* deep-linking features of the iOS platform.
* </p>
* </li>
* <li>
* <p>
* URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you
* specify.
* </p>
* </li>
* </ul>
*
* @param action
* The action to occur if a recipient taps a push notification that's based on the message template. Valid
* values are:</p>
* <ul>
* <li>
* <p>
* OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the
* default action.
* </p>
* </li>
* <li>
* <p>
* DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the
* deep-linking features of the iOS platform.
* </p>
* </li>
* <li>
* <p>
* URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you
* specify.
* </p>
* </li>
* @see Action
*/
public void setAction(String action) {
this.action = action;
}
/**
* <p>
* The action to occur if a recipient taps a push notification that's based on the message template. Valid values
* are:
* </p>
* <ul>
* <li>
* <p>
* OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default
* action.
* </p>
* </li>
* <li>
* <p>
* DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the
* deep-linking features of the iOS platform.
* </p>
* </li>
* <li>
* <p>
* URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you
* specify.
* </p>
* </li>
* </ul>
*
* @return The action to occur if a recipient taps a push notification that's based on the message template. Valid
* values are:</p>
* <ul>
* <li>
* <p>
* OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the
* default action.
* </p>
* </li>
* <li>
* <p>
* DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the
* deep-linking features of the iOS platform.
* </p>
* </li>
* <li>
* <p>
* URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you
* specify.
* </p>
* </li>
* @see Action
*/
public String getAction() {
return this.action;
}
/**
* <p>
* The action to occur if a recipient taps a push notification that's based on the message template. Valid values
* are:
* </p>
* <ul>
* <li>
* <p>
* OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default
* action.
* </p>
* </li>
* <li>
* <p>
* DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the
* deep-linking features of the iOS platform.
* </p>
* </li>
* <li>
* <p>
* URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you
* specify.
* </p>
* </li>
* </ul>
*
* @param action
* The action to occur if a recipient taps a push notification that's based on the message template. Valid
* values are:</p>
* <ul>
* <li>
* <p>
* OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the
* default action.
* </p>
* </li>
* <li>
* <p>
* DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the
* deep-linking features of the iOS platform.
* </p>
* </li>
* <li>
* <p>
* URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you
* specify.
* </p>
* </li>
* @return Returns a reference to this object so that method calls can be chained together.
* @see Action
*/
public APNSPushNotificationTemplate withAction(String action) {
setAction(action);
return this;
}
/**
* <p>
* The action to occur if a recipient taps a push notification that's based on the message template. Valid values
* are:
* </p>
* <ul>
* <li>
* <p>
* OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the default
* action.
* </p>
* </li>
* <li>
* <p>
* DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the
* deep-linking features of the iOS platform.
* </p>
* </li>
* <li>
* <p>
* URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you
* specify.
* </p>
* </li>
* </ul>
*
* @param action
* The action to occur if a recipient taps a push notification that's based on the message template. Valid
* values are:</p>
* <ul>
* <li>
* <p>
* OPEN_APP - Your app opens or it becomes the foreground app if it was sent to the background. This is the
* default action.
* </p>
* </li>
* <li>
* <p>
* DEEP_LINK - Your app opens and displays a designated user interface in the app. This setting uses the
* deep-linking features of the iOS platform.
* </p>
* </li>
* <li>
* <p>
* URL - The default mobile browser on the recipient's device opens and loads the web page at a URL that you
* specify.
* </p>
* </li>
* @return Returns a reference to this object so that method calls can be chained together.
* @see Action
*/
public APNSPushNotificationTemplate withAction(Action action) {
this.action = action.toString();
return this;
}
/**
* <p>
* The message body to use in push notifications that are based on the message template.
* </p>
*
* @param body
* The message body to use in push notifications that are based on the message template.
*/
public void setBody(String body) {
this.body = body;
}
/**
* <p>
* The message body to use in push notifications that are based on the message template.
* </p>
*
* @return The message body to use in push notifications that are based on the message template.
*/
public String getBody() {
return this.body;
}
/**
* <p>
* The message body to use in push notifications that are based on the message template.
* </p>
*
* @param body
* The message body to use in push notifications that are based on the message template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public APNSPushNotificationTemplate withBody(String body) {
setBody(body);
return this;
}
/**
* <p>
* The URL of an image or video to display in push notifications that are based on the message template.
* </p>
*
* @param mediaUrl
* The URL of an image or video to display in push notifications that are based on the message template.
*/
public void setMediaUrl(String mediaUrl) {
this.mediaUrl = mediaUrl;
}
/**
* <p>
* The URL of an image or video to display in push notifications that are based on the message template.
* </p>
*
* @return The URL of an image or video to display in push notifications that are based on the message template.
*/
public String getMediaUrl() {
return this.mediaUrl;
}
/**
* <p>
* The URL of an image or video to display in push notifications that are based on the message template.
* </p>
*
* @param mediaUrl
* The URL of an image or video to display in push notifications that are based on the message template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public APNSPushNotificationTemplate withMediaUrl(String mediaUrl) {
setMediaUrl(mediaUrl);
return this;
}
/**
* <p>
* The key for the sound to play when the recipient receives a push notification that's based on the message
* template. The value for this key is the name of a sound file in your app's main bundle or the Library/Sounds
* folder in your app's data container. If the sound file can't be found or you specify default for the value, the
* system plays the default alert sound.
* </p>
*
* @param sound
* The key for the sound to play when the recipient receives a push notification that's based on the message
* template. The value for this key is the name of a sound file in your app's main bundle or the
* Library/Sounds folder in your app's data container. If the sound file can't be found or you specify
* default for the value, the system plays the default alert sound.
*/
public void setSound(String sound) {
this.sound = sound;
}
/**
* <p>
* The key for the sound to play when the recipient receives a push notification that's based on the message
* template. The value for this key is the name of a sound file in your app's main bundle or the Library/Sounds
* folder in your app's data container. If the sound file can't be found or you specify default for the value, the
* system plays the default alert sound.
* </p>
*
* @return The key for the sound to play when the recipient receives a push notification that's based on the message
* template. The value for this key is the name of a sound file in your app's main bundle or the
* Library/Sounds folder in your app's data container. If the sound file can't be found or you specify
* default for the value, the system plays the default alert sound.
*/
public String getSound() {
return this.sound;
}
/**
* <p>
* The key for the sound to play when the recipient receives a push notification that's based on the message
* template. The value for this key is the name of a sound file in your app's main bundle or the Library/Sounds
* folder in your app's data container. If the sound file can't be found or you specify default for the value, the
* system plays the default alert sound.
* </p>
*
* @param sound
* The key for the sound to play when the recipient receives a push notification that's based on the message
* template. The value for this key is the name of a sound file in your app's main bundle or the
* Library/Sounds folder in your app's data container. If the sound file can't be found or you specify
* default for the value, the system plays the default alert sound.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public APNSPushNotificationTemplate withSound(String sound) {
setSound(sound);
return this;
}
/**
* <p>
* The title to use in push notifications that are based on the message template. This title appears above the
* notification message on a recipient's device.
* </p>
*
* @param title
* The title to use in push notifications that are based on the message template. This title appears above
* the notification message on a recipient's device.
*/
public void setTitle(String title) {
this.title = title;
}
/**
* <p>
* The title to use in push notifications that are based on the message template. This title appears above the
* notification message on a recipient's device.
* </p>
*
* @return The title to use in push notifications that are based on the message template. This title appears above
* the notification message on a recipient's device.
*/
public String getTitle() {
return this.title;
}
/**
* <p>
* The title to use in push notifications that are based on the message template. This title appears above the
* notification message on a recipient's device.
* </p>
*
* @param title
* The title to use in push notifications that are based on the message template. This title appears above
* the notification message on a recipient's device.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public APNSPushNotificationTemplate withTitle(String title) {
setTitle(title);
return this;
}
/**
* <p>
* The URL to open in the recipient's default mobile browser, if a recipient taps a push notification that's based
* on the message template and the value of the Action property is URL.
* </p>
*
* @param url
* The URL to open in the recipient's default mobile browser, if a recipient taps a push notification that's
* based on the message template and the value of the Action property is URL.
*/
public void setUrl(String url) {
this.url = url;
}
/**
* <p>
* The URL to open in the recipient's default mobile browser, if a recipient taps a push notification that's based
* on the message template and the value of the Action property is URL.
* </p>
*
* @return The URL to open in the recipient's default mobile browser, if a recipient taps a push notification that's
* based on the message template and the value of the Action property is URL.
*/
public String getUrl() {
return this.url;
}
/**
* <p>
* The URL to open in the recipient's default mobile browser, if a recipient taps a push notification that's based
* on the message template and the value of the Action property is URL.
* </p>
*
* @param url
* The URL to open in the recipient's default mobile browser, if a recipient taps a push notification that's
* based on the message template and the value of the Action property is URL.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public APNSPushNotificationTemplate withUrl(String url) {
setUrl(url);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAction() != null)
sb.append("Action: ").append(getAction()).append(",");
if (getBody() != null)
sb.append("Body: ").append(getBody()).append(",");
if (getMediaUrl() != null)
sb.append("MediaUrl: ").append(getMediaUrl()).append(",");
if (getSound() != null)
sb.append("Sound: ").append(getSound()).append(",");
if (getTitle() != null)
sb.append("Title: ").append(getTitle()).append(",");
if (getUrl() != null)
sb.append("Url: ").append(getUrl());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof APNSPushNotificationTemplate == false)
return false;
APNSPushNotificationTemplate other = (APNSPushNotificationTemplate) obj;
if (other.getAction() == null ^ this.getAction() == null)
return false;
if (other.getAction() != null && other.getAction().equals(this.getAction()) == false)
return false;
if (other.getBody() == null ^ this.getBody() == null)
return false;
if (other.getBody() != null && other.getBody().equals(this.getBody()) == false)
return false;
if (other.getMediaUrl() == null ^ this.getMediaUrl() == null)
return false;
if (other.getMediaUrl() != null && other.getMediaUrl().equals(this.getMediaUrl()) == false)
return false;
if (other.getSound() == null ^ this.getSound() == null)
return false;
if (other.getSound() != null && other.getSound().equals(this.getSound()) == false)
return false;
if (other.getTitle() == null ^ this.getTitle() == null)
return false;
if (other.getTitle() != null && other.getTitle().equals(this.getTitle()) == false)
return false;
if (other.getUrl() == null ^ this.getUrl() == null)
return false;
if (other.getUrl() != null && other.getUrl().equals(this.getUrl()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode());
hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode());
hashCode = prime * hashCode + ((getMediaUrl() == null) ? 0 : getMediaUrl().hashCode());
hashCode = prime * hashCode + ((getSound() == null) ? 0 : getSound().hashCode());
hashCode = prime * hashCode + ((getTitle() == null) ? 0 : getTitle().hashCode());
hashCode = prime * hashCode + ((getUrl() == null) ? 0 : getUrl().hashCode());
return hashCode;
}
@Override
public APNSPushNotificationTemplate clone() {
try {
return (APNSPushNotificationTemplate) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.pinpoint.model.transform.APNSPushNotificationTemplateMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
78663ae85ff2934894ad89508ce2161217bbe29d | 83cc2009c312b34f2baf4f5bebc1f6ad84979fd0 | /cloudalibaba-provider-payment9002/src/main/java/com/okgo/springcloud/alibaba/controller/PaymentController.java | f387b1766da53943f6d0365f6e84af0e224a777a | [
"Apache-2.0"
] | permissive | enjoycode10/cloud2020 | e9e9b2574ac725287eb3c02e55f6419e4da53720 | 81aadeae2049b9e225614ca7b8eb29adc701bddd | refs/heads/master | 2022-12-07T02:40:15.676715 | 2020-08-09T15:52:45 | 2020-08-09T15:52:45 | 279,918,778 | 0 | 0 | Apache-2.0 | 2020-07-30T15:29:27 | 2020-07-15T16:22:11 | Java | UTF-8 | Java | false | false | 648 | java | package com.okgo.springcloud.alibaba.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
/**
* @auther Shawn
* @create 2020-04-06 14:13
*/
@RestController
public class PaymentController
{
@Value("${server.port}")
private String serverPort;
@GetMapping(value = "/payment/nacos/{id}")
public String getPayment(@PathVariable("id") Integer id)
{
return "nacos registry, serverPort: "+ serverPort+"\t id"+id;
}
}
| [
"enjoycode10@gmail.com"
] | enjoycode10@gmail.com |
0a275215148cbf7af74257389fdc8c6161aacf31 | 4e60080edbc173c4067fd8de50c4f3485f2f4cea | /android/src/com/nerddaygames/rupert/stockscreener/AndroidLauncher.java | cfff04b0e75c440ce2e24ddda18e21fd49f3dd0b | [] | no_license | Nerddaygames/StockScreener | 81e47284f86dd1855d8b55a862e7f2739296d14e | 699143f1ed8564912d3fe48146818bb33ad04832 | refs/heads/master | 2021-05-01T16:42:22.235480 | 2018-02-10T20:25:46 | 2018-02-10T20:25:46 | 121,051,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package com.nerddaygames.rupert.stockscreener;
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.nerddaygames.rupert.stockscreener.StockScreenerMain;
public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new StockScreenerMain(), config);
}
}
| [
"Nerddaygames@gmail.com"
] | Nerddaygames@gmail.com |
8dc8521e7cd1ef108642ec6e8c2d41ae182a1c03 | 0d62f094ba4f7e73323229038abe925cc0890bd9 | /locale/src/test/java/org/sacredscripturefoundation/commons/locale/LocalizedNameComparatorTest.java | 92ed18642a89caf5d848278d9425bfd8ddb19cbd | [
"Apache-2.0"
] | permissive | SacredScriptureFoundation/commons | 2c063c89ef5a44ac16618927d9f7db33ff28a9fe | f451e2b9e55fea7eb553bbf95db7fdcb05b3b95e | refs/heads/master | 2021-01-02T09:21:10.251479 | 2015-12-27T03:35:04 | 2015-12-27T03:35:04 | 24,386,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,841 | java | /*
* Copyright (c) 2013, 2014 Sacred Scripture Foundation.
* "All scripture is given by inspiration of God, and is profitable for
* doctrine, for reproof, for correction, for instruction in righteousness:
* That the man of God may be perfect, throughly furnished unto all good
* works." (2 Tim 3:16-17)
*
* 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.sacredscripturefoundation.commons.locale;
import static org.junit.Assert.assertTrue;
import org.sacredscripturefoundation.commons.Named;
import java.util.Arrays;
import java.util.Locale;
import org.junit.Before;
import org.junit.Test;
/**
* Unit tests for {@link LocalizedNameComparator}.
*
* @author Paul Benedict
* @since 1.0
*/
public class LocalizedNameComparatorTest {
private static class MockLocalizedNamed implements LocaleProvider, Named {
private final Locale locale;
private final String name;
public MockLocalizedNamed(Locale locale, String name) {
this.locale = locale;
this.name = name;
}
@Override
public Locale getLocale() {
return locale;
}
@Override
public String getName() {
return name;
}
}
private LocalizedNameComparator<MockLocalizedNamed> comparator;
private LocaleDisplayProvider displayProvider;
@Before
public void setUp() throws Exception {
displayProvider = new LocaleDisplayProvider();
}
@Test
public void testCompare() {
final Locale userLocale = new Locale("es");
LocaleContextHolder.setLocale(userLocale);
comparator = new LocalizedNameComparator<MockLocalizedNamed>(displayProvider);
MockLocalizedNamed[] entities = new MockLocalizedNamed[5];
entities[0] = new MockLocalizedNamed(new Locale("en"), "Edición Estándar Revisada - Versión Católica");
entities[1] = new MockLocalizedNamed(new Locale("iw"), "El Texto Masoretic");
entities[2] = new MockLocalizedNamed(new Locale("la"), "Nova Vulgata");
entities[3] = new MockLocalizedNamed(new Locale("en"), "Version del Rey Jaime");
entities[4] = new MockLocalizedNamed(new Locale("la"), "Vulgata Clementina");
Arrays.sort(entities, comparator);
Locale previousLocale = null;
String previousName = null;
for (MockLocalizedNamed e : entities) {
final Locale currentLocale = e.getLocale();
final String currentName = e.getName();
if (previousLocale != null) {
// Verify the locales are in ascending order
String previousLang = displayProvider.getLanguage(previousLocale.getLanguage(), userLocale);
String currentLang = displayProvider.getLanguage(currentLocale.getLanguage(), userLocale);
assertTrue(previousLang.compareTo(currentLang) <= 0);
// Names should be alphabetical within a locale
if (previousLang.equals(currentLang)) {
assertTrue(previousName.compareTo(currentName) < 0);
}
}
previousLocale = currentLocale;
previousName = currentName;
}
}
}
| [
"pbenedict@sacredscripturefoundation.org"
] | pbenedict@sacredscripturefoundation.org |
fce01aabeda5365e9d780a92e430181f7b7bf88f | 64d0c34fa6295fe3c9523996e586998600985ec0 | /Data Structure lab codes/Stack/Stack.java | 46e288f57813b5d273c50e500675abbed5a2736b | [] | no_license | Monal5031/Programming | 94b19d56eaf373bb4ad8a1643fcdfb9d5e17a907 | 9e8c9c72ea49aec965b7c57645fbea9f8b8d2979 | refs/heads/master | 2020-06-13T09:03:28.417092 | 2017-10-31T17:37:04 | 2017-10-31T17:37:04 | 77,475,153 | 0 | 1 | null | 2017-10-31T17:40:04 | 2016-12-27T18:32:05 | C++ | UTF-8 | Java | false | false | 2,748 | 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.
*/
/**
*
* @author user
*/
import java.util.*
import java.io.*
class StackList < T >
{
protected int top = -1
protected T[] arr
protected int size
public StackList()
{
this.size = 1
this.top = 0
arr = (T[])new Object[this.size]
}
public StackList(int size)
{
this.size = size
arr = (T[])new Object[size]
this.top = 0
}
public void push(T element)
{
if(this.size <= arr.length)
arr = Arrays.copyOf(arr, 2*this.size)
this.arr[top] = element
this.top++
this.size++
}
public T pop()
{
if(size < 0)
throw new ArrayIndexOutOfBoundsException("Stack Empty")
this.top--
this.size--
return arr[top]
}
public int getSize()
{
return this.size-1
}
public void printStack()
{
for(int i=top-1
i >= 0
i--)
{
String s = new String("|"+arr[i]+" ")
System.out.println(s+"|")
System.out.print("|")
for(int j=0
j < s.length()-2
j++)
System.out.print("--")
System.out.println("|")
}
}
public boolean isEmpty()
{
return (top == 0 | |top == -1)
}
}
public class Stack
{
public static void main(String[]args)throws Exception
{
StackList list = new StackList();
Scanner scan = new Scanner(System.in);
int passer = 1;
while(passer == 1)
{
System.out.println(
"1.check Empty status\n2.Push\n3.POP\n4.Print size of stack\n5.Print whole stack");
System.out.println("Enter choice");
switch(scan.nextInt())
{
case 1:
System.out.println("Stack empty status="+list.isEmpty());
break;
case 2:
System.out.println("Enter the element to be pushed");
list.push(scan.nextInt());
break;
case 3:
System.out.println("Element popped is:"+list.pop());
break;
case 4:
System.out.println("Size of stack is:"+list.getSize());
break;
case 5:
list.printStack();
break; }
System.out.println("Do you wish to continue? 1-->Yes 0--->No");
passer = scan.nextInt(); }
}
}
| [
"monalshadi16@gmail.com"
] | monalshadi16@gmail.com |
3cd4bba1140b4a039a96419d390bae661d9b1d0c | 447520f40e82a060368a0802a391697bc00be96f | /apks/banking_set2_qark/com.advantage.RaiffeisenBank/classes_dex2jar/com/thinkdesquared/banking/widget/content/WidgetDataStore.java | 150cf0e8a76993e99795c98b8f109022140e788f | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 3,826 | java | package com.thinkdesquared.banking.widget.content;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.reflect.TypeToken;
import com.thinkdesquared.banking.constants.AIBASConstants;
import com.thinkdesquared.banking.helpers.LogHelper;
import com.thinkdesquared.banking.models.WidgetServiceResponse;
import com.thinkdesquared.banking.utilities.StringUtils;
import java.lang.reflect.Type;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Map;
public class WidgetDataStore
implements AIBASConstants
{
private static Context mContext;
private static WidgetDataStore mySingleton = null;
private Map<Integer, WidgetServiceResponse> responses = new HashMap();
private WidgetDataStore() {}
public static WidgetDataStore getInstance(Context paramContext)
{
try
{
mContext = paramContext.getApplicationContext();
if (mySingleton == null)
{
mySingleton = new WidgetDataStore();
mySingleton.restoreData();
}
WidgetDataStore localWidgetDataStore = mySingleton;
return localWidgetDataStore;
}
finally {}
}
private void persistData()
{
try
{
SharedPreferences.Editor localEditor = mContext.getSharedPreferences("WidgetData", 0).edit();
localEditor.putString("responses", new Gson().toJson(this.responses));
localEditor.commit();
return;
}
finally
{
localObject = finally;
throw localObject;
}
}
private void restoreData()
{
try
{
SharedPreferences localSharedPreferences = mContext.getSharedPreferences("WidgetData", 0);
GsonBuilder localGsonBuilder = new GsonBuilder();
localGsonBuilder.registerTypeAdapter(Object.class, new NumberDeserializer());
Gson localGson = localGsonBuilder.create();
String str = localSharedPreferences.getString("responses", null);
if (!StringUtils.isEmpty(str)) {
this.responses = ((Map)localGson.fromJson(str, new TypeToken() {}.getType()));
}
return;
}
finally
{
localObject = finally;
throw localObject;
}
}
public void addResponse(int paramInt, WidgetServiceResponse paramWidgetServiceResponse)
{
LogHelper.d(LogHelper.createTag(getClass()), "addResponse");
this.responses.put(Integer.valueOf(paramInt), paramWidgetServiceResponse);
persistData();
}
public void clear(int paramInt)
{
this.responses.remove(Integer.valueOf(paramInt));
}
public WidgetServiceResponse getResponse(int paramInt)
{
return (WidgetServiceResponse)this.responses.get(Integer.valueOf(paramInt));
}
public static class NumberDeserializer
implements JsonDeserializer<Object>
{
public NumberDeserializer() {}
public Object deserialize(JsonElement paramJsonElement, Type paramType, JsonDeserializationContext paramJsonDeserializationContext)
throws JsonParseException
{
try
{
Number localNumber = NumberFormat.getInstance().parse(paramJsonElement.getAsJsonPrimitive().getAsString());
localObject = localNumber;
}
catch (Exception localException)
{
for (;;)
{
LogHelper.e(localException.getMessage());
Object localObject = null;
}
}
if (localObject == null) {
localObject = paramJsonDeserializationContext.deserialize(paramJsonElement, paramType);
}
return localObject;
}
}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.