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
ac0b39de5278f8e05a8d898909d2703b763d6e51
b76b825dc2d08077ce8b2282036b6e6a1b7abdd8
/EasyStorage/app/src/main/java/com/mad/easystorage/activity/CargoEditActivity.java
66ad771be1ac4849da662d8e8910338043be7363
[]
no_license
human2l/Easy-Storage
c38dad91bdc411d83070b943b6337dc07557ab34
ac23eaf4f2790531dcff1292298e94c999be8649
refs/heads/master
2020-06-23T22:10:28.963672
2019-07-25T08:48:06
2019-07-25T08:48:06
198,768,463
0
0
null
null
null
null
UTF-8
Java
false
false
13,396
java
package com.mad.easystorage.activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.provider.MediaStore; import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import com.mad.easystorage.application.MyApplication; import com.mad.easystorage.constants.Constants; import com.mad.easystorage.R; import com.mad.easystorage.model.Cargo; import com.mad.easystorage.model.Storage; import java.io.ByteArrayOutputStream; /** * handls all of the mCargo editing functions. */ public class CargoEditActivity extends AppCompatActivity { private Cargo mCargo; private Storage mStorage; private TextView mCargoEditNameTv; private EditText mCargoEditPriceEt; private EditText mCargoEditAmountEt; private EditText mCargoEditDescriptionEt; private TextView mCargoEditBarcodeTv; private ImageView mCargoEditPictureIv; private ProgressBar mCargoEditPb; private Button mCargoEditTakePictureBtn; private Button mCargoEditScanBarcodeBtn; private Button mConfirmBtn; private boolean mWarned = false; private Bitmap mCargoImageBitmap; /** * When the activity first created, bind java field with xml. Set onClickListener to the EditText. * * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { Log.i(Constants.LOGTAG, "onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_cargo_edit); MyApplication.getInstance().addActivity(this); //Get data from CargoDetailsActivity. Intent intent = getIntent(); Bundle bundle = intent.getExtras(); mCargo = (Cargo) bundle.getSerializable(Constants.CARGO); mStorage = (Storage) bundle.getSerializable(Constants.STORAGE); mCargoEditNameTv = (TextView) findViewById(R.id.cargo_edit_name); mCargoEditPriceEt = (EditText) findViewById(R.id.cargo_edit_price); mCargoEditAmountEt = (EditText) findViewById(R.id.cargo_edit_amount); mCargoEditDescriptionEt = (EditText) findViewById(R.id.cargo_edit_description); mCargoEditPictureIv = (ImageView) findViewById(R.id.cargo_edit_image_view); mCargoEditPb = (ProgressBar) findViewById(R.id.cargo_edit_progress_bar); mCargoEditBarcodeTv = (TextView) findViewById(R.id.cargo_edit_barcode); mCargoEditTakePictureBtn = (Button) findViewById(R.id.cargo_edit_take_picture); mCargoEditScanBarcodeBtn = (Button) findViewById(R.id.cargo_edit_scan); mCargoEditNameTv.setText(mCargo.getName()); mCargoEditPriceEt.setText(mCargo.getPrice() + ""); mCargoEditAmountEt.setText(mCargo.getAmount() + ""); mCargoEditDescriptionEt.setText(mCargo.getDescription()); showCargoImage(mCargo); mCargoEditBarcodeTv.setText(mCargo.getBarcode()); mCargoEditTakePictureBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { takePicture(); } }); mCargoEditScanBarcodeBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { scanBarcode(); } }); mConfirmBtn = (Button) findViewById(R.id.cargo_edit_confirm); mConfirmBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editCargo(); } }); mCargoEditPriceEt.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!mWarned) editWarning(); } }); mCargoEditAmountEt.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!mWarned) editWarning(); } }); mCargoEditDescriptionEt.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!mWarned) editWarning(); } }); } /** * Pop up an AlertDialog when user try to edit key attributes of mCargo. */ private void editWarning() { Log.i(Constants.LOGTAG, "editWarning"); new AlertDialog.Builder(CargoEditActivity.this).setTitle(R.string.warning) .setIconAttribute(android.R.attr.alertDialogIcon) .setMessage(R.string.edit_warning_message) .setPositiveButton(R.string.ok, null) .create().show(); mWarned = true; } /** * response to show the mCargo picture to the user. * @param cargo parse in current mCargo */ private void showCargoImage(Cargo cargo) { Log.i(Constants.LOGTAG, "showCargoImage"); String mUserId = FirebaseAuth.getInstance().getCurrentUser().getUid(); FirebaseStorage dataStorage = FirebaseStorage.getInstance(); StorageReference dataStorageRef = dataStorage.getReferenceFromUrl(Constants.DATA_STORAGE_REFERENCE); String name = cargo.getName(); StorageReference cargoRef = dataStorageRef.child(Constants.IMAGES).child(mUserId).child(name + Constants.JPG_POSTFIX); cargoRef.getBytes(Constants.ONE_MEGABYTE).addOnSuccessListener(new OnSuccessListener<byte[]>() { @Override public void onSuccess(byte[] bytes) { mCargoImageBitmap = BitmapFactory.decodeByteArray(bytes, Constants.DECODE_BYTE_ARRAY_OFFSET, bytes.length); if (mCargoImageBitmap != null) { Log.i(Constants.LOGTAG, "showCargoImage, useTrueImage"); mCargoEditPictureIv.setImageBitmap(mCargoImageBitmap); } else { Log.i(Constants.LOGTAG, "showCargoImage, useDefaultImage, null"); mCargoEditPictureIv.setImageResource(R.drawable.default_image); } mCargoEditPb.setVisibility(View.GONE); mCargoEditPictureIv.setVisibility(View.VISIBLE); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // Handle any errors Log.i(Constants.LOGTAG, "showCargoImage, useDefaultImage, failure"); mCargoEditPictureIv.setImageResource(R.drawable.default_image); mCargoEditPb.setVisibility(View.GONE); mCargoEditPictureIv.setVisibility(View.VISIBLE); } }); } /** * handles take picture function of mCargo by starting imageIntent. */ private void takePicture() { Log.i(Constants.LOGTAG, "takePicture"); Intent imageIntent = new Intent(); imageIntent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(imageIntent, Constants.IMAGE_REQUEST); } /** * This method handles scan barcode function of mCargo by starting ScannerActivity. */ private void scanBarcode() { Log.i(Constants.LOGTAG, "scanBarcode"); Intent scanIntent = new Intent(CargoEditActivity.this, ScannerActivity.class); startActivityForResult(scanIntent, Constants.SCAN_REQUEST); } /** * Handle the data received from imageIntent and ScannerActivity. * * @param requestCode corresponding requestCode * @param resultCode corresponding resultCode * @param data data received */ @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.i(Constants.LOGTAG, "onActivityResult"); super.onActivityResult(requestCode, resultCode, data); if (requestCode == Constants.IMAGE_REQUEST && resultCode == RESULT_OK) { Log.i(Constants.LOGTAG, "onActivityResult, imageRequest"); Bundle extras = data.getExtras(); mCargoImageBitmap = (Bitmap) extras.get(Constants.DATA); mCargoEditPictureIv.setImageBitmap(mCargoImageBitmap); } if (requestCode == Constants.SCAN_REQUEST && resultCode == RESULT_OK) { Log.i(Constants.LOGTAG, "onActivityResult, scanRequest"); Bundle extras = data.getExtras(); String barcode = (String) extras.get(Constants.DATA); mCargoEditBarcodeTv.setText(barcode); } } /** * handles the edit mCargo function. */ private void editCargo() { Log.i(Constants.LOGTAG, "editCargo"); String name = mCargo.getName(); Double price; int amount; String description; String barcode; try { price = Double.valueOf(mCargoEditPriceEt.getText().toString()); amount = Integer.valueOf(mCargoEditAmountEt.getText().toString()); description = mCargoEditDescriptionEt.getText().toString(); barcode = mCargoEditBarcodeTv.getText().toString(); } catch (NumberFormatException e) { Log.i(Constants.LOGTAG, "editCargo, invalidInputType"); Toast.makeText(CargoEditActivity.this, R.string.invalid_input_type, Toast.LENGTH_LONG).show(); return; } for (Cargo cargo : mStorage.getCargoList()) { if ((cargo.getBarcode() != null && cargo.getBarcode().equals(barcode) && !barcode.equals("")) && !cargo.getName().equals(name)) { Log.i(Constants.LOGTAG, "editCargo, barcodeAlreadyExist"); Toast.makeText(CargoEditActivity.this, R.string.barcode_already_exist, Toast.LENGTH_LONG).show(); return; } } mStorage.remove(mCargo); mCargo.setPrice(price); mCargo.setAmount(amount); mCargo.setDescription(description); if (!barcode.equals("")) { Log.i(Constants.LOGTAG, "editCargo, hasBarcode"); mCargo.setBarcode(barcode); } mStorage.add(mCargo); if (mCargoImageBitmap != null) { Log.i(Constants.LOGTAG, "editCargo, hasImageBitmap"); uploadCargoImage(mCargo.getName(), mCargoImageBitmap); } Log.i(Constants.LOGTAG, "editCargo, cargoEditSuccessfully"); Toast.makeText(CargoEditActivity.this, R.string.cargo_has_been_edited, Toast.LENGTH_LONG).show(); Intent intent = getIntent(); intent.putExtra(Constants.CARGO, mCargo); intent.putExtra(Constants.STORAGE, mStorage); intent.putExtra(Constants.BITMAP, mCargoImageBitmap); Log.i(Constants.LOGTAG, "editCargo, setResult"); setResult(Constants.EDIT_RESULT, intent); finish(); } /** * upload the image to Firebase Storage * @param name parse in mCargo's name * @param cargoImageBitmap parse in mCargo image bitmap */ private void uploadCargoImage(String name, Bitmap cargoImageBitmap) { Log.i(Constants.LOGTAG, "uploadCargoImage"); String mUserId = FirebaseAuth.getInstance().getCurrentUser().getUid(); StorageReference dataStorageRef = FirebaseStorage.getInstance().getReferenceFromUrl(Constants.DATA_STORAGE_REFERENCE); StorageReference dataCargoRef = dataStorageRef.child(Constants.IMAGES).child(mUserId).child(name + Constants.JPG_POSTFIX); ByteArrayOutputStream baos = new ByteArrayOutputStream(); cargoImageBitmap.compress(Bitmap.CompressFormat.JPEG, Constants.COMPRESS_QUALITY, baos); byte[] data = baos.toByteArray(); UploadTask uploadTask = dataCargoRef.putBytes(data); uploadTask.addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { Log.i(Constants.LOGTAG, "uploadCargoImage, uploadFailed"); Toast.makeText(CargoEditActivity.this, R.string.image_upload_fails, Toast.LENGTH_SHORT) .show(); } }).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { Log.i(Constants.LOGTAG, "uploadCargoImage, uploadSuccessfully"); Toast.makeText(CargoEditActivity.this, R.string.image_upload_successfully, Toast.LENGTH_SHORT) .show(); } }); } }
[ "human2lkai@gmail.com" ]
human2lkai@gmail.com
df6f2c8e751bd3da8746db1c87f1d6c2459b887a
69b48cac56c6939fc024e8e79b476a7991334c3b
/src/main/java/com/exdev/cc/dao/CustomerDAO.java
0950f3d3af2a4706ca5cfb5b3f5a0d72c2614eef
[]
no_license
aymanerwi/bareeqapp
ec752a18190da1dfe8618d804b0f0d9b90fee3e1
b720fed82f52468d43043654d332d9db617f7a79
refs/heads/master
2021-01-20T08:37:49.969912
2017-10-11T06:37:38
2017-10-11T06:37:38
101,519,478
0
0
null
null
null
null
UTF-8
Java
false
false
1,237
java
package com.exdev.cc.dao; import java.util.List; import javax.persistence.NoResultException; import com.exdev.cc.model.Customer; import com.exdev.cc.model.User; public class CustomerDAO extends BaseDAO { public CustomerDAO() { // TODO Auto-generated constructor stub } @Override public Object find(int id) { return em.find(Customer.class, id); } @Override public List<Object> list() { return em.createNamedQuery("Customer.findAll").getResultList(); } @Override public List<Object> list(int start, int max) { return em.createNamedQuery("Customer.findAll").setFirstResult(start).setMaxResults(max).getResultList(); } @Override public List<Object> list(String query) { // TODO Auto-generated method stub return em.createNamedQuery("Customer.search").setParameter("query", "%".concat(query).concat("%")) .getResultList(); } @Override public List<Object> list(String string, int start, int max) { // TODO Auto-generated method stub return null; } public Customer findByMobileNo(String mobileNo) { try { return (Customer) em.createNamedQuery("Customer.findByMobileNo").setParameter("mobileNo", mobileNo) .getSingleResult(); } catch (NoResultException e) { return null; } } }
[ "erwi@outlook.com" ]
erwi@outlook.com
a8f4c1cf4246677c0fdc835f9c411fad27eebc97
d481e7549dc336ab7c81c80b481e805ae23d2bbd
/src/project/GUI/DraggableNodeOP.java
f39cc4bad4c485dd762253ac81a2cdac4f9d6c37
[]
no_license
MarekPetr/Blocks
e92c41d177ca631de95ca110340834638bb7dd93
678e4b3f0edd6489d3ea884e01f8896b079b8eb7
refs/heads/master
2020-03-06T22:51:57.514772
2018-04-24T18:15:11
2018-04-24T18:15:11
127,116,150
0
0
null
null
null
null
UTF-8
Java
false
false
1,036
java
package project.GUI; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.control.TextField; import javafx.scene.input.*; public class DraggableNodeOP extends DraggableNode { @FXML private TextField value; public DraggableNodeOP() { super(); } @Override public FXMLLoader setResource() { return new FXMLLoader( getClass().getResource("/DraggableNodeOP.fxml")); } @Override public void buildInputHandlers() { setTextField(value); } private void setTextField(TextField field) { field.textProperty().addListener((observable, oldValue, newValue) -> { if (!newValue.matches("\\d*")) { field.setText(newValue.replaceAll("[^\\d]", "")); } }); field.setOnKeyPressed(ke -> { if (ke.getCode().equals(KeyCode.ENTER)) { System.out.printf("operand value saved\n"); this.requestFocus(); } }); } }
[ "petr.marek18@gmail.com" ]
petr.marek18@gmail.com
865901d851912d8f8ab26c2341bffabd85cb4f83
57af205469d7e1c106b94057fb4570510a7a0af5
/src/main/java/cn/xdaima/kiso/exception/InitializationError.java
6642d7ef40a1ad8034a0b4d510bb73a4947b7995
[]
no_license
sunhao28256/kiso-web
40c5f74892ca3c9e51d5e1c267c849f2844a9a86
265dcc65864854aaceefe6a07f5330e543ded744
refs/heads/master
2021-01-10T03:10:35.643997
2015-12-13T13:08:44
2015-12-13T13:08:44
47,919,434
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package cn.xdaima.kiso.exception; public class InitializationError extends Error { /** */ private static final long serialVersionUID = 1L; public InitializationError() { super(); } public InitializationError(String message) { super(message); } public InitializationError(String message, Throwable cause) { super(message, cause); } public InitializationError(Throwable cause) { super(cause); } }
[ "sunhao5@jd.com" ]
sunhao5@jd.com
70dc99ed2d523e11218b8c372d96a8679e82aa6d
dfbe085e22b0136d7b73bf7e11f8f744bce8a8ce
/Stationery_shop/src/com/wzl/model/Shop.java
933416988f8b137fc8d6369a79e817c6f54777c4
[]
no_license
1026674574/-
35176184e28da6e6106375cb2dc01beb1c6e542a
428048a5e26ccb2869dc955241fd52e08506fc24
refs/heads/main
2023-01-20T07:01:45.218035
2020-11-30T03:07:18
2020-11-30T03:07:18
317,091,694
1
0
null
null
null
null
UTF-8
Java
false
false
1,131
java
package com.wzl.model; public class Shop { private int sh_id; private float sh_price; private String sh_name; private String sh_picpth; private String sh_text; private Type type; public int getSh_id() { return sh_id; } public void setSh_id(int sh_id) { this.sh_id = sh_id; } public float getSh_price() { return sh_price; } public void setSh_price(float sh_price) { this.sh_price = sh_price; } public String getSh_name() { return sh_name; } public void setSh_name(String sh_name) { this.sh_name = sh_name; } public String getSh_picpth() { return sh_picpth; } public void setSh_picpth(String sh_picpth) { this.sh_picpth = sh_picpth; } public String getSh_text() { return sh_text; } public void setSh_text(String sh_text) { this.sh_text = sh_text; } public Type getType() { return type; } public void setType(Type type) { this.type = type; } }
[ "noreply@github.com" ]
1026674574.noreply@github.com
1b05385cd84cec096835bff05b437ce6fc2727d2
61c4c37f974b5bf529924db100506dfc766a13a4
/src/main/java/com/jones/controller/deptController.java
36594eac592c072dc05450b83e830d9960bfef2a
[]
no_license
joneskkk2017/DDNOTE
fde5f95c6f8d92c7723b6228fc90c98c856c6d9b
78e9c52047508c11c7724fe0d9556f643f812eb7
refs/heads/master
2022-12-22T05:25:15.406277
2019-10-24T00:38:15
2019-10-24T00:38:15
217,177,004
0
0
null
null
null
null
UTF-8
Java
false
false
3,569
java
package com.jones.controller; import com.jones.model.Depart; import com.jones.service.DepartService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; /** * deptController * * @author JoNeS * @date */ @Controller public class deptController { @Autowired private DepartService departService; /** * description 添加部门 * * @param depart * @return java.lang.String */ @RequestMapping("/admin/addDept.html") public String addDept(Depart depart){ departService.addForNotMatch(new Object[]{"departname"},new Object[]{depart.getDepartname()}); return "redirect:/admin/deptManager.html"; } /** * description 弹出编辑部门框并加载对应信息 * * @param id  * @param request * @return java.lang.String */ @ResponseBody @RequestMapping(value = "/admin/updateDept.html",method = RequestMethod.GET,produces = "text/html;charset=UTF-8") public String updateResource(Integer id, HttpServletRequest request){ Depart depart = departService.selectOne(id); String path = request.getContextPath(); return "<div class=\"modal-header\">\n" + " <button type=\"button\" class=\"close\" data-dismiss=\"modal\"><span>&times;</span></button>\n" + " <h4 class=\"modal-title\" id=\"myModal2\">编辑部门</h4>\n" + " </div>\n" + " <div class=\"modal-body\">\n" + " <form id=\"updateDeptForm\" action=\""+path+"/admin/updateDept.html\" method=\"post\">\n" + " <input type='hidden' name='id' value='"+depart.getId()+"' />"+ " <div class=\"form-group\" >\n" + " <label>资源描述:</label>\n" + " <input id=\"inp2\" type=\"text\" name=\"departname\" class=\"form-control\" value=\""+depart.getDepartname()+"\" />\n" + " </div>\n" + " </form>\n" + " </div> " + " <div class=\"modal-footer\">\n" + " <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">关闭</button>\n" + " <button onclick=\"updateDeptFormSubmit()\" type=\"button\" class=\"btn btn-primary\">编辑部门</button>\n" + " </div>"; } /** * description 提交更新部门 * * @param depart * @return java.lang.String */ @RequestMapping(value = "/admin/updateDept.html",method = RequestMethod.POST) public String updateDept(Depart depart){ departService.update(depart); return "redirect:/admin/deptManager.html"; } /** * description 删除部门及其关联信息 * * @param id * @return java.lang.String */ @RequestMapping(value = "/admin/delDept.html",method = RequestMethod.GET) public String delDept(Integer id){ departService.delDeptUserRes(id); departService.delete(id); return "redirect:/admin/deptManager.html"; } }
[ "610447598@qq.com" ]
610447598@qq.com
a614e5c389a71c73b08acb1252f040de2a7f1ae0
1e29729c9d077befafd8c579b0a2b837d7994114
/app/src/main/java/com/example/getaride/Fragments/DriverSettings.java
71ecd320b828af3cba3a8f166f99e0fbbaa9a474
[]
no_license
Sachindra2002/Get-a-Ride
4ea9e25e6e528eb91e758c67606adf50ae56f468
d2b4e723f613ce98a29bbcf9c4b39d01056501df
refs/heads/master
2023-03-17T13:58:56.030387
2021-03-11T13:07:38
2021-03-11T13:07:38
325,083,132
0
1
null
null
null
null
UTF-8
Java
false
false
5,379
java
package com.example.getaride.Fragments; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.example.getaride.R; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class DriverSettings extends Fragment implements View.OnClickListener { EditText phoneNumber, vehicleType, vehicleNumber; String phonenumber, vehicletype, vehiclenumber, key; Button update; DatabaseReference databaseReference; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_driverprofilesettings, container, false); phoneNumber = v.findViewById(R.id.driversettingsnumber); vehicleType = v.findViewById(R.id.driversettingsvehicletype); vehicleNumber = v.findViewById(R.id.driversettingsvehiclenumber); update = v.findViewById(R.id.updateddriverprofile); update.setOnClickListener(this); FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); String userid = user.getUid(); DatabaseReference ref = FirebaseDatabase.getInstance().getReference("Users"); ref.child(userid).addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { phonenumber = dataSnapshot.child("phone").getValue().toString(); vehicletype = dataSnapshot.child("vehicleType").getValue().toString(); vehiclenumber = dataSnapshot.child("vehicleNumber").getValue().toString(); key = dataSnapshot.getKey(); phoneNumber.setText(phonenumber); vehicleType.setText(vehicletype); vehicleNumber.setText(vehiclenumber); } @Override public void onCancelled(@NonNull DatabaseError error) { } }); return v; } @Override public void onClick(View v) { switch (v.getId()) { case R.id.updateddriverprofile: updateProfile(); break; } } private void updateProfile() { databaseReference = FirebaseDatabase.getInstance().getReference("Users"); String number = phoneNumber.getText().toString(); String vehicletype = vehicleType.getText().toString(); String vehiclenumber = vehicleNumber.getText().toString(); if(number.isEmpty()) { phoneNumber.setError("Phone number Cannot be Empty!"); phoneNumber.requestFocus(); return; } if(vehicletype.isEmpty()) { vehicleType.setError("Vehicle Type Cannot be Empty!"); vehicleType.requestFocus(); return; } if(vehiclenumber.isEmpty()) { vehicleNumber.setError("Vehicle number Cannot be Empty!"); vehicleNumber.requestFocus(); return; } if(isPhoneNumberChanged()) { Toast.makeText(getContext(), "Data has been updated", Toast.LENGTH_SHORT).show(); }else { Toast.makeText(getContext(), "Data cannot be updated", Toast.LENGTH_SHORT).show(); } if(isVehicleTypeChanged()) { Toast.makeText(getContext(), "Data has been updated", Toast.LENGTH_SHORT).show(); }else { Toast.makeText(getContext(), "Data cannot be updated", Toast.LENGTH_SHORT).show(); } if(isVehicleNumberChanged()) { Toast.makeText(getContext(), "Data has been updated", Toast.LENGTH_SHORT).show(); }else { Toast.makeText(getContext(), "Data cannot be updated", Toast.LENGTH_SHORT).show(); } } private boolean isVehicleNumberChanged() { if(!phonenumber.equals(phoneNumber.getText().toString())) { databaseReference.child(key).child("phone").setValue(phoneNumber.getText().toString()); return true; }else { return false; } } private boolean isVehicleTypeChanged() { if(!phonenumber.equals(phoneNumber.getText().toString())) { databaseReference.child(key).child("vehicleType").setValue(vehicleType.getText().toString()); return true; }else { return false; } } private boolean isPhoneNumberChanged() { if(!phonenumber.equals(phoneNumber.getText().toString())) { databaseReference.child(key).child("vehicleNumber").setValue(vehicleNumber.getText().toString()); return true; }else { return false; } } }
[ "52739523+Sachindra2002@users.noreply.github.com" ]
52739523+Sachindra2002@users.noreply.github.com
6238658e526e56295c0f28883cdf5eea038dc527
b8c994eb6f65826e6d7858231d2095f6255ba6ec
/src/main/java/pages/booking/Confirmation.java
b4b638e3db7791b8fc1bc50929ab43d59824ac34
[]
no_license
vladwyane/hs-test-millenium
d405151fbba11582432095fe72b95e4653c9a14c
96b08b42a1089db7e0e61ccea7b02a51ebdf0822
refs/heads/master
2020-03-29T16:40:17.847915
2018-10-22T13:29:55
2018-10-22T13:29:55
150,123,954
0
0
null
null
null
null
UTF-8
Java
false
false
3,229
java
package pages.booking; import blocks.booking.BookingDetail; import blocks.booking.SuccessMessageBlock; import data.DateTime; import data.LocationsData; import data.ServicesData; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.FindBy; import pages.BasePage; import ru.yandex.qatools.htmlelements.element.HtmlElement; import java.io.IOException; /** * Created by bigdrop on 9/14/2018. */ public class Confirmation extends BasePage { public Confirmation(WebDriver driver) { super(driver); } private SuccessMessageBlock successMessageBlock; private BookingDetail bookingDetail; @FindBy(xpath = "//div[@data-id='modalBookingErrors']//h3") private HtmlElement titleInfoPopup; @FindBy(xpath = "//div[@data-id='modalBookingErrors']//div[contains(@id, 'booking-error-described')]") private HtmlElement errorDescribe; @Override public void open() { } public void checkingSuccessBooking(LocationsData locationsData, ServicesData servicesData, String therapist, DateTime dateTime) throws IOException { waitUntilElementAppeared(successMessageBlock); bookingDetail.generateBookingFile(); softAssert.assertEquals(successMessageBlock.getSuccessHeading().getText(), "CONGRATULATIONS!"); softAssert.assertEquals(successMessageBlock.getAddToCalendarBut().getText(), "ADD TO CALENDAR"); softAssert.assertEquals(successMessageBlock.getBookAnotherAppBut().getText(), "BOOK ANOTHER APPOINTMENT"); softAssert.assertTrue(bookingDetail.containsLocation(locationsData.getShortLocationName()), "Location " + locationsData.getShortLocationName() + " not found"); softAssert.assertTrue(bookingDetail.containsService(servicesData.getServiceName()), "Service " + servicesData.getServiceName() + " not found"); softAssert.assertTrue(bookingDetail.containsTherapist(therapist), "Therapist " + therapist + " not found"); softAssert.assertTrue(bookingDetail.containsDuration(servicesData.getDuration()), "Duration " + servicesData.getDuration() + " not found"); softAssert.assertTrue(bookingDetail.containsDate(dateTime.getDate()), "Date " + dateTime.getDate() + " not found"); softAssert.assertAll(); } public void checkingErrorBooking() { waitUntilElementAppeared(titleInfoPopup); softAssert.assertEquals(titleInfoPopup.getText(), "Errors"); softAssert.assertTrue(isElementPresent(errorDescribe), "Error describe text not found"); softAssert.assertAll(); } public void checkingSuccessLMDBooking() { waitUntilElementAppeared(successMessageBlock); softAssert.assertEquals(successMessageBlock.getSuccessHeading().getText(), "CONGRATULATIONS!"); softAssert.assertEquals(successMessageBlock.getAddToCalendarBut().getText(), "ADD TO CALENDAR"); softAssert.assertEquals(successMessageBlock.getBookAnotherAppBut().getText(), "BOOK ANOTHER APPOINTMENT"); softAssert.assertEquals(successMessageBlock.getDownloadFormBut().getText(), "DOWNLOAD INTAKE FORM"); softAssert.assertTrue(isElementPresent(successMessageBlock.getBarCode()), "Bar code not found"); softAssert.assertAll(); } }
[ "ellina.frolova@bigdropinc.com" ]
ellina.frolova@bigdropinc.com
59462250373550a00cd7f69d375a963bc5c79557
bd86132ab52b09c4f159b694940bdfd9587c554a
/app/src/main/java/com/example/aijaz/map2/GetNearByPlaces.java
8f4930440a79621c8a32608cf2782350e41f65b6
[]
no_license
suragys/Map2
96b7fde8743d53df0d06a25a75f14f62ec554c09
00e3b1770be4782bc8c0df36c5414ec1f21527cb
refs/heads/master
2020-12-24T19:51:04.105187
2017-03-27T13:38:17
2017-03-27T13:38:17
86,217,539
0
0
null
null
null
null
UTF-8
Java
false
false
3,925
java
package com.example.aijaz.map2; import android.location.Location; import android.os.AsyncTask; import android.util.Log; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import java.util.ArrayList; import java.util.HashMap; import java.util.List; /** * Created by navneet on 23/7/16. */ public class GetNearByPlaces extends AsyncTask<Object, String, String> { String googlePlacesData; GoogleMap mMap; String url; Location myLocation; ArrayList<NearByTransit> nearByTransitArrayList; @Override protected String doInBackground(Object... params) { try { Log.d("GetBikeAndTransitRoutes", "doInBackground entered"); mMap = (GoogleMap) params[0]; url = (String) params[1]; myLocation = (Location) params[2]; nearByTransitArrayList = (ArrayList<NearByTransit>) params[3]; DownloadUrl downloadUrl = new DownloadUrl(); googlePlacesData = downloadUrl.readUrl(url); Log.d("GooglePlacesReadTask", "doInBackground Exit"); } catch (Exception e) { Log.d("GooglePlacesReadTask", e.toString()); } return googlePlacesData; } @Override protected void onPostExecute(String result) { Log.d("GooglePlacesReadTask", "onPostExecute Entered"); List<HashMap<String, String>> nearbyPlacesList = null; DataParser dataParser = new DataParser(); nearbyPlacesList = dataParser.parse(result); ShowNearbyPlaces(nearbyPlacesList); Log.d("GooglePlacesReadTask", "onPostExecute Exit"); } private void ShowNearbyPlaces(List<HashMap<String, String>> nearbyPlacesList) { Log.e("SIZE of nearby list====", "" + nearbyPlacesList.size()); for (int i = 0; i < nearbyPlacesList.size(); i++) { Log.d("onPostExecute", "Entered into showing locations"); MarkerOptions markerOptions = new MarkerOptions(); HashMap<String, String> googlePlace = nearbyPlacesList.get(i); double lat = Double.parseDouble(googlePlace.get("lat")); double lng = Double.parseDouble(googlePlace.get("lng")); String placeName = googlePlace.get("place_name"); String vicinity = googlePlace.get("vicinity"); // LatLng latLng = new LatLng(lat, lng); // markerOptions.position(latLng); // markerOptions.title(placeName + " : " + vicinity); // mMap.addMarker(markerOptions); // markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)); // //move map camera // mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); // mMap.animateCamera(CameraUpdateFactory.zoomTo(15)); LatLng origin = new LatLng(myLocation.getLatitude(),myLocation.getLongitude()); LatLng dest = new LatLng(lat,lng); // Getting URL to the Google Directions API String url = Utility.getUrl(origin, dest,"bicycling",0); Object[] DataTransfer = new Object[3]; DataTransfer[0] = mMap; DataTransfer[1] = url; NearByTransit nearByTransit = new NearByTransit(origin,dest); nearByTransitArrayList.add(nearByTransit); Log.d("On_get_nearby_places", "added nearByTransit" + nearByTransitArrayList.size()); DataTransfer[2] = nearByTransit; FetchUrl FetchUrl = new FetchUrl(); // Start downloading json data from Google Directions API // FetchUrl.execute(DataTransfer); //move map camera mMap.moveCamera(CameraUpdateFactory.newLatLng(origin)); mMap.animateCamera(CameraUpdateFactory.zoomTo(11)); } } }
[ "suragysms@gmail.com" ]
suragysms@gmail.com
2de585600d8b709c505b91775d074a3444ad27d3
14eeb49612d4b4bbdf30491889f5f8a5adc748c8
/src/service/InsertDealService.java
77aa3d8288cf1d03c79270c75e5d883abba358d4
[]
no_license
wangnaiwen/BabyTest
c2e4521f5bc7561c9bed8b0477c9092a8330e9e9
8c331b53fd7d27deb0b4b90185dedc18ce708678
refs/heads/master
2020-06-16T23:37:10.145824
2017-06-03T16:52:23
2017-06-03T16:52:23
75,057,758
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package service; import dao.DealDAO; import domain.Deal; import service.dao.BaseDealServiceDAO; import service.dao.InsertDealServiceDAO; public class InsertDealService extends BaseDealServiceDAO implements InsertDealServiceDAO{ @Override public boolean insertDeal(Deal deal) { DealDAO dealDAO = getDealDAO(); return dealDAO.insertDeal(deal); } }
[ "1464524269@qq.com" ]
1464524269@qq.com
80bc3d493885c7580aafebb0eacc166a9fe43b95
9dac5aa50e779718dbc8eb08c9cd5888792b0c34
/src/main/java/br/com/zupedu/lucasmiguins/proposta/model/AvisoViagem.java
51ed9e6889d9d130146b1db22a5d0a0441aa8701
[ "Apache-2.0" ]
permissive
miguins/orange-talents-05-template-proposta
4051663d4fd82ff1c741d1519e273c8a112ba90d
10fb97b665c0deadae49734935def3a9e6a6738c
refs/heads/main
2023-05-25T03:16:03.943920
2021-06-11T15:47:00
2021-06-11T15:47:00
373,178,927
0
0
Apache-2.0
2021-06-02T13:32:03
2021-06-02T13:32:02
null
UTF-8
Java
false
false
1,506
java
package br.com.zupedu.lucasmiguins.proposta.model; import com.fasterxml.jackson.annotation.JsonFormat; import javax.persistence.*; import javax.validation.constraints.Future; import javax.validation.constraints.FutureOrPresent; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.time.LocalDate; import java.time.LocalDateTime; @Entity public class AvisoViagem { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotBlank private String destino; @NotNull @Future @JsonFormat(pattern = "dd/MM/yyyy", shape = JsonFormat.Shape.STRING) private LocalDate dataTermino; @NotNull @FutureOrPresent @JsonFormat(pattern = "dd/MM/yyyy", shape = JsonFormat.Shape.STRING) private LocalDate dataInicio; @NotNull private LocalDateTime dataCriacao; @NotBlank private String ipCliente; @NotBlank private String userAgenteCliente; @NotNull @ManyToOne private Cartao cartao; @Deprecated public AvisoViagem() { } public AvisoViagem(String destino, LocalDate dataTermino, LocalDate dataInicio, String ipCliente, String userAgenteCliente, Cartao cartao) { this.destino = destino; this.dataTermino = dataTermino; this.dataInicio = dataInicio; this.ipCliente = ipCliente; this.userAgenteCliente = userAgenteCliente; this.cartao = cartao; this.dataCriacao = LocalDateTime.now(); } }
[ "lucasmiguins@gmail.com" ]
lucasmiguins@gmail.com
b216771cdcf047a841e0ec8737f04831d32bfbff
6323c3e32937feeca36904c9d89ba729cbe5ebca
/integratedemo/src/controller/TeacherGetInfoController.java
fbba144577eaeefe17287129283676063516c7da
[]
no_license
HouMM/Test
bd682d2a3effcfe80944d5f2b39ac28ce1249ce4
67bd69e881efeed4a545bd572d9a933e938e401e
refs/heads/master
2021-01-21T16:14:35.380683
2017-05-20T10:35:33
2017-05-20T10:35:33
91,881,096
0
0
null
null
null
null
UTF-8
Java
false
false
1,680
java
package controller; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import pojo.TeacherClassInfo; import service.TeacherClassInfoManager; import utils.SearchTearchClassTable; @ResponseBody @Controller public class TeacherGetInfoController { @Autowired private TeacherClassInfoManager teacherClassInfoManager; @RequestMapping(value="/get_teacherRealInfo",method=RequestMethod.GET) public List<TeacherClassInfo> getRealClassInfo(@RequestParam(value="teacherId", required = false)String teacherId, @RequestParam(value="identifycode", required=false) String identifyCode) { List<TeacherClassInfo> list_teacherclassInfo = teacherClassInfoManager.queryteacherClassInfo("20160", teacherId); if (list_teacherclassInfo.size() == 0) { list_teacherclassInfo = new ArrayList<>(); List<List<String>> classDetail = SearchTearchClassTable.teacherGetRealClassesInfo(teacherId, identifyCode); if (classDetail != null) { List<String> list_title = classDetail.get(0); for (int i = 0; i < classDetail.get(1).size(); i++) { TeacherClassInfo t1 = new TeacherClassInfo("20160", teacherId, list_title.get(0), classDetail.get(1).get(i)); list_teacherclassInfo.add(t1); } teacherClassInfoManager.addteacherClassInfo(list_teacherclassInfo); } } return list_teacherclassInfo; } }
[ "sunshine_love@stu.xjtu.edu.cn" ]
sunshine_love@stu.xjtu.edu.cn
34673fa41c61f5d69a95ea6eb4e30ebb3d3cd7a1
97413c628ca2f9ff47568f474024140ed7683055
/14/ColorWords/src/ColorWords.java
22fee5ec0cc8e4918d13ad067e5c780a296037d8
[]
no_license
Jiayuann/demos-java
197749bfac21f08a4707e9ed470ed4e98349458f
cd9bb2dbd53ec69f3ef288b3771c0266ab53863e
refs/heads/master
2021-06-15T14:44:20.463951
2016-10-11T00:56:34
2016-10-11T00:56:34
null
0
0
null
null
null
null
GB18030
Java
false
false
2,475
java
import java.awt.*; import java.applet.*; public class ColorWords extends Applet implements Runnable { // 有线程运行接口 String str = null; int d = 1; int h = 18; int v = 18; Thread thread = null; // 设置一个线程 char[] ch; int p = 0; Image image; Graphics gphics; Color[] color; private Font f; // 字体 private FontMetrics fm; // 字模 public void init() { str = "天行健,君子以自强不息";// 设置七彩文字内容 this.setSize(500, 200);// 设置Applet的大小 setBackground(Color.white);// 设置背景颜色 ch = new char[str.length()]; ch = str.toCharArray();// 将字符串中的各个字符保存到数组中 image = createImage(getSize().width, getSize().height); gphics = image.getGraphics(); f = new Font("华文行楷", Font.BOLD, 30); fm = getFontMetrics(f);// 获得指定字体的字体规格 gphics.setFont(f);// 设置组件的字体 float hue; // 颜色的色元 color = new Color[str.length()]; for (int i = 0; i < str.length(); i++) { hue = ((float) i) / ((float) str.length()); color[i] = new Color(Color.HSBtoRGB(hue, 0.8f, 1.0f)); // 颜色分配 } } public void start() { if (thread == null) { // 如果线程为空,则 thread = new Thread(this); // 开始新的线程 thread.start(); // 开始 } } // 终止线程 public void stop() { if (thread != null) { // 如果线程不为空,则 thread.stop(); // 终止线程,使它 thread = null; // 为空 } } // 运行线程 public void run() { while (thread != null) { try { thread.sleep(200); // 让线程沉睡200毫秒 } catch (InterruptedException e) { } repaint(); // 重新绘制界面 } } public void update(Graphics g) { // 重写update方法,解决闪烁问题 int x, y; double angle; gphics.setColor(Color.white); gphics.fillRect(0, 0, getSize().width, getSize().height); p += d; p %= 7;// 主要控制字的速度,被除数越小,速度越快 // System.out.println(p+" p1"); for (int i = 0; i < str.length(); i++) { angle = ((p - i * d) % 7) / 4.0 * Math.PI;// 主要控制弧度的,被除数越小,弧度越大 x = 30 + fm.getMaxAdvance() * i + (int) (Math.cos(angle) * h);// 求x坐标值 y = 80 + (int) (Math.sin(angle) * v); //求y坐标值 gphics.setColor(color[(p + i) % str.length()]); gphics.drawChars(ch, i, 1, x, y); } paint(g); } public void paint(Graphics g) { g.drawImage(image, 0, 0, this); } }
[ "jiayuan_hu@hotmail.com" ]
jiayuan_hu@hotmail.com
2b8ad87c384af5b7f97afaff81336b69bb9bb28a
3e979c7a7d3732cd739c9e3dfbb22f074f591ec4
/src/test/java/edu/bit/ex/controller/CommonControllerTests.java
a2612089a1c270ed8ec2eae6d31be54150f5c860
[]
no_license
kangsungjin92/Branches
68195e1ae32b77c1359cec06367a602a1bbceb1a
fe26060ae77cd4d920bbf4c82bc1de6d0d7adf00
refs/heads/master
2023-04-25T13:48:51.993254
2021-05-12T11:54:24
2021-05-12T11:54:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
980
java
package edu.bit.ex.controller; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import lombok.extern.slf4j.Slf4j; @Slf4j @ExtendWith(SpringExtension.class) @SpringBootTest @AutoConfigureMockMvc public class CommonControllerTests { @Autowired private MockMvc mockMvc; @Test public void getMappingTest() throws Exception { // 메인 페이지 mockMvc.perform(MockMvcRequestBuilders.get("/main")).andExpect(MockMvcResultMatchers.status().isOk()); } }
[ "natorque5552@naver.com" ]
natorque5552@naver.com
1c2f11ee2c5edc5ae47751725d4d336dc636715a
2b9d327741894ba0c5bf48ed6efff00fdadb67ef
/ratpack-core/src/main/java/ratpack/server/internal/ServerCapturer.java
1890446752c8dba42ac1728e60aea7ae759f6028
[ "Apache-2.0" ]
permissive
rhart/ratpack
c1896c3871e7fde2b82e7a590ceadf4d64e75882
e88ae09f4de1a6c03d509408107c2ad7b223f35d
refs/heads/master
2021-01-24T23:34:27.559874
2015-04-13T10:33:28
2015-04-13T10:33:28
33,863,377
1
0
null
2015-04-13T10:56:44
2015-04-13T10:56:44
null
UTF-8
Java
false
false
2,603
java
/* * Copyright 2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ratpack.server.internal; import ratpack.func.Function; import ratpack.func.Block; import ratpack.registry.Registries; import ratpack.registry.Registry; import ratpack.server.RatpackServer; import java.util.Optional; public abstract class ServerCapturer { private static final ThreadLocal<Overrides> OVERRIDES_HOLDER = ThreadLocal.withInitial(Overrides::new); private static final ThreadLocal<RatpackServer> SERVER_HOLDER = new ThreadLocal<>(); private ServerCapturer() { } public static class Overrides { private int port = -1; private Function<? super Registry, ? extends Registry> registryFunction = Function.constant(Registries.empty()); private Boolean development; public Overrides port(int port) { this.port = port; return this; } public Overrides registry(Function<? super Registry, ? extends Registry> registryFunction) { this.registryFunction = registryFunction; return this; } public Overrides development(boolean development) { this.development = development; return this; } public int getPort() { return port; } public Function<? super Registry, ? extends Registry> getRegistryFunction() { return registryFunction; } public Boolean isDevelopment() { return development; } } public static Optional<RatpackServer> capture(Block bootstrap) throws Exception { return capture(new Overrides(), bootstrap); } public static Optional<RatpackServer> capture(Overrides overrides, Block bootstrap) throws Exception { OVERRIDES_HOLDER.set(overrides); try { bootstrap.execute(); } finally { OVERRIDES_HOLDER.remove(); } RatpackServer ratpackServer = SERVER_HOLDER.get(); SERVER_HOLDER.remove(); return Optional.ofNullable(ratpackServer); } public static Overrides capture(RatpackServer server) throws Exception { SERVER_HOLDER.set(server); return OVERRIDES_HOLDER.get(); } }
[ "ld@ldaley.com" ]
ld@ldaley.com
0460b1949d12659a893fa5141bd2006a27b0725e
bab68dbc04dee75669a0e26fc013815f52eaef38
/lib_base/src/main/java/com/wl/pluto/lib_base/http/OkHttpUrlLoader.java
e4036fbe67ac26174d676e5e94c193a648f62a4f
[]
no_license
pluto8172/AndPlout
8041069e690f177a43915d894df7ce8fafcefa78
54dcca2a0d4f4af61292555a191fb44bb3c03a5b
refs/heads/master
2020-07-29T20:23:19.350115
2019-09-21T09:06:00
2019-09-21T09:07:25
209,947,355
0
0
null
null
null
null
UTF-8
Java
false
false
3,166
java
/* * Copyright 2017 JessYan * * 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.wl.pluto.lib_base.http; import androidx.annotation.NonNull; import com.bumptech.glide.load.Options; import com.bumptech.glide.load.model.GlideUrl; import com.bumptech.glide.load.model.ModelLoader; import com.bumptech.glide.load.model.ModelLoaderFactory; import com.bumptech.glide.load.model.MultiModelLoaderFactory; import java.io.InputStream; import okhttp3.Call; import okhttp3.OkHttpClient; /** * A simple model loader for fetching media over http/https using OkHttp. */ public class OkHttpUrlLoader implements ModelLoader<GlideUrl, InputStream> { private final Call.Factory client; // Public API. @SuppressWarnings("WeakerAccess") public OkHttpUrlLoader(@NonNull Call.Factory client) { this.client = client; } @Override public boolean handles(@NonNull GlideUrl url) { return true; } @Override public LoadData<InputStream> buildLoadData(@NonNull GlideUrl model, int width, int height, @NonNull Options options) { return new LoadData<>(model, new OkHttpStreamFetcher(client, model)); } /** * The default factory for {@link OkHttpUrlLoader}s. */ // Public API. @SuppressWarnings("WeakerAccess") public static class Factory implements ModelLoaderFactory<GlideUrl, InputStream> { private static volatile Call.Factory internalClient; private final Call.Factory client; private static Call.Factory getInternalClient() { if (internalClient == null) { synchronized (Factory.class) { if (internalClient == null) { internalClient = new OkHttpClient(); } } } return internalClient; } /** * Constructor for a new Factory that runs requests using a static singleton client. */ public Factory() { this(getInternalClient()); } /** * Constructor for a new Factory that runs requests using given client. * * @param client this is typically an instance of {@code OkHttpClient}. */ public Factory(@NonNull Call.Factory client) { this.client = client; } @NonNull @Override public ModelLoader<GlideUrl, InputStream> build(MultiModelLoaderFactory multiFactory) { return new OkHttpUrlLoader(client); } @Override public void teardown() { // Do nothing, this instance doesn't own the client. } } }
[ "wanlong2713@163.com" ]
wanlong2713@163.com
b616ee924bd98be1aca457a6f23d8d355075c9ff
b51c8e632de4b4432663ed46c32342d6e768ddc6
/kMeanClustering/src/kMeanClustering/kMeans.java
3cbf98afdaa463e7a6957482338618f3ba7b7aa9
[]
no_license
shoaib30/DataMining-Lab
a7c8b0c56f5f44096827f7afa6ffe87b31766a0d
60105bde6debefce1297bde51bb22855da237b50
refs/heads/master
2021-01-17T16:23:44.123584
2018-07-31T17:18:54
2018-07-31T17:18:54
68,882,225
0
3
null
null
null
null
UTF-8
Java
false
false
1,772
java
package kMeanClustering; import java.io.IOException; import java.util.ArrayList; public class kMeans { ArrayList<Record>records; Centroid C[]; kMeans() throws IOException { System.out.println("Enter filename: "); ReadDataset rd = new ReadDataset("data.csv",","); records = rd.getRecords(); C = new Centroid[3]; initCluster(); } void initCluster() { C[0] = new Centroid(records.get(0).attr1,records.get(0).attr2); C[1] = new Centroid(records.get(3).attr1,records.get(3).attr2); C[2] = new Centroid(records.get(6).attr1,records.get(6).attr2); } Centroid[] generateCluster() { //generates new cluster and returns new centroids System.out.println("\nGenerating Cluster"); int numberOfRecordsInCluster[] = new int[3]; int newCentroidValue[][] = new int[3][2]; for(Record r: records) { r.calculateDistFromCentroid(C); numberOfRecordsInCluster[r.cluster]++; newCentroidValue[r.cluster][0] += r.attr1; newCentroidValue[r.cluster][1] += r.attr2; r.printDist(); } Centroid newCentroids[] = new Centroid[3]; for(int i=0; i<3; i++){ newCentroids[i] = new Centroid(newCentroidValue[i][0] / (numberOfRecordsInCluster[i]*1.0) , newCentroidValue[i][1] / (numberOfRecordsInCluster[i]*1.0)); } System.out.println("Counts:- "); for(int i=0; i<newCentroids.length; i++){ System.out.println(i + "->" +numberOfRecordsInCluster[i]); } System.out.println("Cntroids:- "); for(int i=0; i<newCentroids.length; i++){ newCentroids[i].printCentroid(); } return newCentroids; } public static void main(String[] args) throws IOException { kMeans km = new kMeans(); while(true){ Centroid newCent[] = km.generateCluster(); if(Centroid.compareCentroid(km.C, newCent)) { break; } km.C=newCent; } } }
[ "shoaib30@gmail.com" ]
shoaib30@gmail.com
b80f9ae1460c1905303c0168be14d5290d9fba15
66b0b2dbdf000affc0411a8019d64dda8990d6c3
/and/hardware/SoundBasic/SoundBasic/app/src/test/java/to/msn/wings/soundbasic/ExampleUnitTest.java
2e4d6455df23f531a6ac952654fce6ac7cbe7222
[]
no_license
takagotch/and
e6bf811e194f47d7e2b30079c308380f7d118929
dfba108b0a1eb965a71ee2c559ac1666a7a6af57
refs/heads/master
2021-09-15T20:02:34.048548
2018-06-09T18:43:20
2018-06-09T18:43:20
109,402,630
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package to.msn.wings.soundbasic; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "dyaccb@gmail.com" ]
dyaccb@gmail.com
1cf2a8d789d1197158f3963cf47f8ff43243cbbf
2ce63244cb67bd340cd7e16a9f768991279cb954
/microservice-web/src/main/java/com/zxhl/filters/log/LogFilter.java
6d91d0e8e2d14522a1344bd037f715a36335b0f9
[]
no_license
double0115/springcloud_demo
a457dc2709e4eeedbafba1f50fcf7ee4481c04e6
5e5d73e8985ed2f48d9032dc8bcb46bdf0cdcb23
refs/heads/master
2020-03-27T12:39:36.412488
2018-08-29T08:10:56
2018-08-29T08:10:56
146,559,970
0
0
null
null
null
null
UTF-8
Java
false
false
2,197
java
package com.zxhl.filters.log; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.FilterReply; import com.zxhl.utils.IPCommon; import com.zxhl.utils.StringUtil; import org.slf4j.MDC; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.regex.Matcher; import java.util.regex.Pattern; public class LogFilter extends Filter<ILoggingEvent> { public static String getValue(String str,String key){ String value = ""; try { String regex2 = "\"" + key + "\":\"(.*?)\","; Matcher matcher = Pattern.compile(regex2).matcher(str); while (matcher.find()) { value = matcher.group(1); break; } } catch (Exception ex){ // LOGGER.error("日志提取错误:"+ CommonUtil.getExceptionAllinformation(ex)); } return value; } @Override public FilterReply decide(ILoggingEvent event) { if(StringUtil.isNullOrEmpty(event.getMessage()) || (event.getMessage().indexOf("\"taskId\"")<0)){ MDC.put("host", ""); MDC.put("clienthost", ""); return null; } HttpServletRequest request=getServletContext(); String host= IPCommon.getClientAddr(request); String hostName= null; try { hostName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { } MDC.put("host", hostName); MDC.put("clienthost", host); return null; } private HttpServletRequest getServletContext(){ RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes(); if (requestAttributes != null) { return ((ServletRequestAttributes) requestAttributes).getRequest(); } return null; } }
[ "huangrong0115@163.com" ]
huangrong0115@163.com
0067a697f76973e48ef900abe4997ef72ef6b200
c5efbb658746cc0f467322e954f3de72bea4f8f5
/parent/wmeovg/src/main/java/org/david/rain/wmproxy/module/config/entity/ClientInfo.java
7aad5b916253e40782d11b1334dff27aa920f5d2
[]
no_license
xfworld/rain
2eb24d7d858da27df6cac102e6834e523cd0454c
ec45611543916617c695b1e5a2e35f2d43601381
refs/heads/master
2022-08-31T22:59:07.065108
2022-08-11T06:51:47
2022-08-11T06:51:47
71,985,629
0
0
null
2022-08-11T08:42:56
2016-10-26T09:04:07
JavaScript
UTF-8
Java
false
false
752
java
package org.david.rain.wmproxy.module.config.entity; import org.david.rain.wmproxy.module.config.entity.base.BaseClientInfo; import org.david.rain.wmproxy.module.sys.entity.User; import java.util.Date; public class ClientInfo extends BaseClientInfo { private static final long serialVersionUID = 1L; public ClientInfo() { super(); initialize(); } public ClientInfo(Integer id) { super(id); initialize(); } public ClientInfo(Integer id, String cid, String name, String privateKey, String clientIp, Byte priority, String rootUrl, Date createtime, Byte status,User user) { super(id, cid, name, privateKey, clientIp, priority, rootUrl, createtime, status, user); initialize(); } @Override protected void initialize() { } }
[ "any.see@qq.com" ]
any.see@qq.com
0c82fe7931ba3dfbc59d5f4bf0677e82eb13e254
bc7ca7f21e8e2fe4b678238f9776dc073dd790f5
/eap3.0/src/yssoft/views/Bm_targetView.java
6e4cd9c1d621ee6db5b6fbf618ccf84a1f943c78
[]
no_license
delovt/zenyu
a1f482e33102a3b45884c26f9add58988ab77fbf
d152a2dcd270c3afabc16110acd15d7947610cda
refs/heads/master
2020-12-28T08:36:42.677340
2018-01-10T05:58:22
2018-01-10T05:58:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,782
java
package yssoft.views; /** * * 项目名称:yssoft * 类名称:AC_fieldsView * 类描述:AC_fieldsView视图 * 创建人:刘磊 * 创建时间:2012-2-9 11:48:30 * 修改人:刘磊 * 修改时间:2012-2-9 11:48:30 * 修改备注:无 * @version 1.0 * */ import yssoft.services.Ibm_targetService; import yssoft.utils.ToXMLUtil; import yssoft.vos.BmTargetVO; import java.util.List; public class Bm_targetView { private Ibm_targetService ibm_targetService; public void setIbm_targetService(Ibm_targetService ibm_targetService) { this.ibm_targetService = ibm_targetService; } public String get_all_bm_target(){ List funLi1st = this.ibm_targetService.get_all_bm_target(); if(funLi1st!=null&&funLi1st.size()>0) { return ToXMLUtil.createTree(funLi1st, "iid", "ipid", "-1"); } return null; } public String add_bm_target(BmTargetVO bmTargetVO){ String result ="sucess"; try{ //保存功能注册信息 Object resultObj = this.ibm_targetService.add_bm_target(bmTargetVO); result = resultObj.toString(); } catch(Exception ex){ result ="fail"; } return result; } public String update_bm_target(BmTargetVO bmTargetVO){ String result ="sucess!"; try{ //保存功能注册信息 @SuppressWarnings("unused") Object resultObj = this.ibm_targetService.update_bm_target(bmTargetVO); } catch(Exception ex){ result ="fail"; } return result; } public String delete_bm_target_byiid(int iid){ String result ="sucess"; try{ //保存功能注册信息 @SuppressWarnings("unused") Object resultObj = this.ibm_targetService.delete_bm_target_byiid(iid); } catch(Exception ex){ result ="fail"; } return result; } }
[ "ld@qq.com" ]
ld@qq.com
9a906d71c1e2f8fff673dd51fb905f70d5247707
e60d7652bacb7a2cff2c40f60b5544b2fb9aab10
/target/generated-sources/entity-codegen/extensions/pc/internal/domain/policy/period/impl/PolicyPeriodExtImpl.java
708dafdbcbfc8d5011123aa1ce1436285b0b54da
[]
no_license
ezsaidi/configuration
19fa3bf70982529e5cdf5d7f3d99eb7b0d7971d5
e22a485d1f5376005c72fd073a474fa685fcf6a6
refs/heads/master
2022-04-12T05:15:58.490259
2018-07-11T00:18:50
2018-07-11T00:18:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
208
java
package extensions.pc.internal.domain.policy.period.impl; import extensions.pc.internal.domain.policy.period.gen.PolicyPeriodExtStub; public class PolicyPeriodExtImpl extends PolicyPeriodExtStub { }
[ "riteshvishu@hotmail.com" ]
riteshvishu@hotmail.com
e44c15da46f60e93868fedb77ebc771904fd6a9f
1096a19d296af8ac4f4a76dd9fc2d749b156f353
/app/src/androidTest/java/com/example/ameen/tictactoe/ApplicationTest.java
542912117d08a98a18653fba6d66e9dc6d2d18af
[]
no_license
amiqat/Tic_Tac_Toe_Ass-3
87899b7859c5263749acea29c0efe75bf853772d
14561eb87c1195d32936c769acb937f354ef5fa3
refs/heads/master
2016-09-05T12:56:11.890092
2015-04-27T17:47:29
2015-04-27T17:47:29
34,114,358
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package com.example.ameen.tictactoe; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "amiqat2@gmail.com" ]
amiqat2@gmail.com
eb28bc14c851e7d595976f68edb238620c46de80
46946342fed948e9f65e22328d14c8f13b857ae1
/picture_selector_library/src/main/java/com/luck/picture/lib/permissions/PermissionChecker.java
1fc4fad6ce09b79f44e3947c60ac3affa567d932
[]
no_license
UersNOer/AllInLinkApp
a1805816198d12e9d491c8f8af1a58fcc091c4ff
1a75da52e53921060a934bdb653d29708cb1d87d
refs/heads/master
2023-07-09T22:48:05.180754
2021-08-13T06:59:17
2021-08-13T06:59:17
394,186,337
2
0
null
2021-08-13T06:59:18
2021-08-09T07:04:41
Java
UTF-8
Java
false
false
1,016
java
package com.luck.picture.lib.permissions; import android.app.Activity; import android.content.Context; import android.content.pm.PackageManager; import androidx.annotation.NonNull; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; /** * @author:luck * @date:2019-11-20 19:07 * @describe:权限检查 */ public class PermissionChecker { /** * 检查是否有某个权限 * * @param ctx * @param permission * @return */ public static boolean checkSelfPermission(Context ctx, String permission) { return ContextCompat.checkSelfPermission(ctx.getApplicationContext(), permission) == PackageManager.PERMISSION_GRANTED; } /** * 动态申请多个权限 * * @param activity * @param code */ public static void requestPermissions(Activity activity, @NonNull String[] permissions, int code) { ActivityCompat.requestPermissions(activity, permissions, code); } }
[ "842919219@qq.com" ]
842919219@qq.com
f873595a6ac68c20dc16f70f1d1f14f783b4632a
0a854147dcc55bbf7c6d31d966ce74204997d508
/src/com/beiang/airdog/net/business/ihomer/AddHomerPair.java
5beb1cdf2725397e9410ac9cdf2f4f07de3945ab
[]
no_license
longzekai/BeiAngAir_V5.0-Es
f25d4541285c574a70cd66a77364080201dc9b97
b57f2fe3f8431345042e9b1174ffac3766fa8463
refs/heads/master
2022-02-14T20:50:39.997530
2015-11-07T03:44:22
2015-11-07T03:44:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,380
java
package com.beiang.airdog.net.business.ihomer; import com.android.volley.Request.Method; import com.beiang.airdog.net.business.ihomer.AddHomerPair.ReqAddHome; import com.beiang.airdog.net.business.ihomer.AddHomerPair.RspAddHomer; import com.beiang.airdog.net.httpcloud.aync.ServerDefinition.APIServerAdrs; import com.beiang.airdog.net.httpcloud.aync.ServerDefinition.APIServerMethod; import com.beiang.airdog.net.httpcloud.aync.abs.AbsReqMsg; import com.beiang.airdog.net.httpcloud.aync.abs.AbsSmartNetReqRspPair; import com.beiang.airdog.net.httpcloud.aync.abs.BaseMsg.ReqMsgBase; import com.beiang.airdog.net.httpcloud.aync.abs.BaseMsg.RspMsgBase; import com.beiang.airdog.net.httpcloud.aync.abs.ReqCbk; import com.google.gson.JsonSerializer; import com.google.gson.annotations.SerializedName; /*** * 添加家庭 * * @author LSD * */ public class AddHomerPair extends AbsSmartNetReqRspPair<ReqAddHome, RspAddHomer> { public void sendRequest(String name, ReqCbk<RspMsgBase> cbk) { ReqAddHome req = new ReqAddHome(name); sendMsg(req, cbk); } public static class ReqAddHome extends AbsReqMsg { @SerializedName("params") public AddHomePama pama = new AddHomePama(); public ReqAddHome(String name) { // TODO Auto-generated constructor stub pama.name = name; } public static class AddHomePama { public String name; } @Override public String getReqMethod() { // TODO Auto-generated method stub return APIServerMethod.IHOMER_AddHome.getMethod(); } } public static class RspAddHomer extends RspMsgBase { @SerializedName("data") public Data data; public static class Data { public long home_id; } } @Override public int getHttpMethod() { // TODO Auto-generated method stub return Method.POST; } @Override public String getUri() { // TODO Auto-generated method stub return APIServerAdrs.IHOMER; } @Override public Class<RspAddHomer> getResponseType() { // TODO Auto-generated method stub return RspAddHomer.class; } @Override public JsonSerializer<ReqAddHome> getExcludeJsonSerializer() { // TODO Auto-generated method stub return null; } @Override public boolean sendMsg(ReqMsgBase req, ReqCbk<RspMsgBase> cbk) { // TODO Auto-generated method stub return sendMsg(req, cbk, req.getTag()); } }
[ "renwfy@126.com" ]
renwfy@126.com
68f05443c636d21fcff1f3d345f2e4e10256c385
9f16970cf668a449e30753f7bb14b0c33145e003
/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/cache/AuthenticationContextCacheEntry.java
50845ef0512c2e7ee1685fad2366f8cfe73e6348
[ "Apache-2.0" ]
permissive
wso2-incubator/identity-framework
826b46740eeb4d3ac57365cd05e0a36e5f7f5b19
697fa2ecf9a734b14deed1433a2dc3e30cd5b74c
refs/heads/master
2021-08-01T01:54:05.088207
2021-07-27T14:29:35
2021-07-27T14:29:35
50,912,217
1
2
Apache-2.0
2021-07-27T15:16:05
2016-02-02T10:16:00
Java
UTF-8
Java
false
false
1,620
java
/* * Copyright (c) 2013, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.wso2.carbon.identity.application.authentication.framework.cache; import org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext; import org.wso2.carbon.identity.application.common.cache.CacheEntry; public class AuthenticationContextCacheEntry extends CacheEntry { private static final long serialVersionUID = 7922084944228568186L; AuthenticationContext context; String loggedInUser; public AuthenticationContextCacheEntry(AuthenticationContext authenticationContext) { this.context = authenticationContext; } public AuthenticationContext getContext() { return context; } public void setContext(AuthenticationContext context) { this.context = context; } public String getLoggedInUser() { return loggedInUser; } public void setLoggedInUser(String loggedInUser) { this.loggedInUser = loggedInUser; } }
[ "pulasthi7@gmail.com" ]
pulasthi7@gmail.com
051318ab918a21763351d1aa2bcac9dbac9cfd36
b662890aef659ce5b3a04992ea3e2f82356d3109
/src/main/java/br/com/harpalab/getip/util/CodeGenerationUtil.java
c2027977b383c811278e85138d56e94425a7fd78
[]
no_license
denisppinheiro/service-get-ip
2df2f35167c656736752ec5bfbcb6c3d3a57dc08
54bb6c88d6e037d5ab60b2c780ddbad4e44ec3ad
refs/heads/master
2021-04-28T16:03:54.543547
2018-02-19T00:41:09
2018-02-19T00:41:09
122,004,217
0
0
null
null
null
null
UTF-8
Java
false
false
1,731
java
package br.com.harpalab.getip.util; import br.com.harpalab.getip.domain.ClientIpInfo; import java.util.HashMap; import java.util.Map; import javax.xml.bind.DatatypeConverter; public class CodeGenerationUtil { public static final String VERSION_V1 = "v1"; private CodeGenerationUtil() {} public static String getIpAndInfoCodeGenerationKey(ClientIpInfo ipInfo) { String ipAndInfoCodeGenerationKey = ipInfo.getIp(); for (String key : ipInfo.getInfo().keySet()) { ipAndInfoCodeGenerationKey += "_" + key + ":" + ipInfo.getInfo().get(key); } return ipAndInfoCodeGenerationKey; } public static ClientIpInfo getIpAndInfoFromCode(String code) { ClientIpInfo clientIpInfo = new ClientIpInfo(); if (code != null) { String[] ipInfo = code.split("_"); if (ipInfo.length > 0) { String ip = ipInfo[0]; clientIpInfo.setIp(ip); Map<String, String> infoMap = new HashMap<>(); for (int i=1; i<ipInfo.length; i++) { String info = ipInfo[i]; String[] infoKeyValue = info.split(":"); String infoKey = infoKeyValue[0]; String infoValue = infoKeyValue[1]; infoMap.put(infoKey, infoValue); } clientIpInfo.setInfo(infoMap); } } return clientIpInfo; } public static String encodeV1(String code) { return new String(DatatypeConverter.printBase64Binary(code.getBytes())); } public static String decodeV1(String code) { return new String(DatatypeConverter.parseBase64Binary(code)); } }
[ "denisppinheiro@gmail.com" ]
denisppinheiro@gmail.com
551600021a85a3117ba50a03bc42eb2cd6030bbf
b5ffcedddf1bd0dc66ab7c1cfe88b5011cda9d3d
/src/Main.java
afbcf0d618648695a8f3d90a39402fc113ff3856
[]
no_license
Rodmul/HashTableAlg
057419350f0666749359a845496f9a0a8807ce09
3cee0274aa640761e89367d590d2e5127171b34d
refs/heads/master
2023-06-03T00:03:22.813883
2021-06-27T14:06:22
2021-06-27T14:06:22
380,708,412
0
0
null
null
null
null
UTF-8
Java
false
false
6,145
java
import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Main { private static HashX[] hashArray; public static void main(String[] args) throws FileNotFoundException { File file = new File("input.txt"); Scanner scanner = new Scanner(file); int p, q, n; q = scanner.nextInt(); p = scanner.nextInt(); n = scanner.nextInt(); hashArray = new HashX[q]; for (int i = 0; i < q; i++) { hashArray[i] = new HashX(" ", -2); } String currentAction; String currentKey; int currentValue; for (int i = n; i > 0; i--) { currentAction = scanner.next(); currentKey = scanner.next(); if (i != n){ System.out.println(" "); } switch (currentAction) { case "PUT": currentValue = Integer.parseInt(scanner.next()); System.out.print("key=" + currentKey + " "); System.out.print("hash=" + hashFunc(currentKey, p, q) + " "); put(hashFunc(currentKey, p, q), currentValue, currentKey); break; case "GET": System.out.print("key=" + currentKey + " "); System.out.print("hash=" + hashFunc(currentKey, p, q) + " "); get(hashFunc(currentKey, p, q), currentKey); break; case "DEL": System.out.print("key=" + currentKey + " "); System.out.print("hash=" + hashFunc(currentKey, p, q) + " "); delete(hashFunc(currentKey, p, q), currentKey); break; } } } private static int hashFunc(String key, int p, int q) { long sum = 0; char[] temp = key.toCharArray(); for (int i = 0; i < key.length(); i++) { sum += (temp[i] - 'a' + 1) * Math.pow(p, i); } sum %= q; return (int) sum; } private static void put(int hash, int value, String key) { System.out.print("operation=PUT "); System.out.print("result="); if (hashArray[hash].value == -2 || hashArray[hash].value == -1 || hashArray[hash].key.equals(key)) { hashArray[hash].value = value; hashArray[hash].key = key; System.out.print("inserted "); System.out.print("value=" + value); } else { int start = hash++; if (hash == hashArray.length){ hash = 0; } while (start != hash && hashArray[hash].value != -2) { if (hashArray[hash].value == -1) { break; } hash = (hash + 1) % hashArray.length; } if (start == hash) { System.out.print("overflow"); } else { System.out.print("collision "); System.out.print("linear_probing=" + hash + " "); System.out.print("value=" + value); hashArray[hash].value = value; hashArray[hash].key = key; } } } private static void get(int hash, String key) { System.out.print("operation=GET "); System.out.print("result="); if (hashArray[hash].key.equals(key)) { System.out.print("found "); System.out.print("value=" + hashArray[hash].value); } else if (!hashArray[hash].key.equals(" ")) { System.out.print("collision "); int start = hash++; if (hash == hashArray.length){ hash = 0; } while (start != hash) { if (hashArray[hash].key.equals(key)) { System.out.print("linear_probing=" + hash + " "); System.out.print("value=" + hashArray[hash].value); break; } if (hashArray[hash].value == -2){ break; } hash = (hash + 1) % hashArray.length; } if (start == hash) { System.out.print("linear_probing=" + Math.abs(hash - 1) + " "); System.out.print("value=no_key"); } if (hashArray[hash].value == -2){ System.out.print("linear_probing=" + hash + " "); System.out.print("value=no_key"); } } else { System.out.print("no_key"); } } private static void delete(int hash, String key) { System.out.print("operation=DEL "); System.out.print("result="); if (hashArray[hash].key.equals(key)) { hashArray[hash].value = -1; hashArray[hash].key = "Tombstone"; System.out.print("removed"); } else if (!hashArray[hash].key.equals(" ")) { System.out.print("collision "); int start = hash++; if (hash == hashArray.length){ hash = 0; } while (start != hash) { if (hashArray[hash].key.equals(key)) { System.out.print("linear_probing=" + hash + " "); System.out.print("value=removed"); break; } if (hashArray[hash].value == -2){ break; } hash = (hash + 1) % hashArray.length; } if (start == hash) { System.out.print("linear_probing=" + Math.abs(hash - 1) + " "); System.out.print("value=no_key"); } if (hashArray[hash].value == -2){ System.out.print("linear_probing=" + hash + " "); System.out.print("value=no_key"); } } else { System.out.print("no_key"); } } } class HashX { String key; int value; HashX(String key, int value) { this.key = key; this.value = value; } }
[ "alex.tyulin@gmail.com" ]
alex.tyulin@gmail.com
6b7792b6f42843b2c5890db6238abc119a00a2d4
913b6b317bb2a8937a1641d74d481b1c672dac7c
/app/src/main/java/konek/com/konekandroid/ListEventActivity.java
ab35df53077b1fee7d41e0980bffaf01705d4a8b
[]
no_license
riyan10dec/Konek2
037fd09f731dd39d09380b75ae697626dcb30c88
46ce8069f573adb5a32ec6270e8c8e50163df2d7
refs/heads/master
2021-01-19T09:12:14.887330
2017-02-15T15:20:20
2017-02-15T15:20:20
82,074,265
0
0
null
null
null
null
UTF-8
Java
false
false
3,791
java
package konek.com.konekandroid; import android.content.ReceiverCallNotAllowedException; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import adapters.EventListAdapter; import adapters.RecyclerViewDataAdapter; import model.EditorsPick; import model.Event; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; public class ListEventActivity extends AppCompatActivity { private EndlessRecyclerViewScrollListener scrollListener; private String editorsPickId; RecyclerView eventsRecyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_default_event); String title = (String) getIntent().getExtras().getString("title"); editorsPickId = (String) getIntent().getExtras().getString("editorsPickId"); TextView titleTextView = (TextView) findViewById(R.id.itemTitleDefault); titleTextView.setText(title); //load events eventsRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_list_default); //initialize item final List<Event> eventList = loadNextDataFromApi(0); final EventListAdapter eventListAdapter = new EventListAdapter(eventList); eventsRecyclerView.setAdapter(eventListAdapter); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); eventsRecyclerView.setLayoutManager(linearLayoutManager); scrollListener = new EndlessRecyclerViewScrollListener(linearLayoutManager) { @Override public void onLoadMore(int page, int totalItemsCount, RecyclerView view) { List<Event> eventList2 = loadNextDataFromApi(page); final int curSize = eventListAdapter.getItemCount(); eventList.addAll(eventList2); view.post(new Runnable() { @Override public void run() { eventListAdapter.notifyItemRangeInserted(curSize, eventList.size() - 1); } }); } }; eventsRecyclerView.addOnScrollListener(scrollListener); } public List<Event> loadNextDataFromApi(int page){ String result = ""; try{ OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(15, TimeUnit.SECONDS) .build(); Request request = new Request.Builder() .url(getText(R.string.eventListRequest).toString().replace("@id",editorsPickId).replace("@page",Integer.toString(page))) .header("id",getText(R.string.loginid).toString()) .header("x-access-token",getText(R.string.token).toString()) .build(); Response response = client.newCall(request).execute(); result = response.body().string(); } catch (Exception e){ Toast.makeText(this,e.getMessage(),Toast.LENGTH_SHORT); } Gson gson = new GsonBuilder().create(); Type type = new TypeToken<List<EditorsPick>>(){}.getType(); final ArrayList<EditorsPick> editorsPicks = gson.fromJson(result,type); return editorsPicks.get(0).getAllItemsInSection(); } }
[ "riyan10dec2@gmail.com" ]
riyan10dec2@gmail.com
0a7e96fb810e5842d9096c1bfe639f4c19647317
01390266d70fe2384e67f35ba45cafa5aad906b4
/Corpore-Fit/src/main/java/services/NutritionistService.java
e9902ffbbe91efdf76ee1a2d182aad75e0cb5f67
[]
no_license
DPADDFFL/Corpore-Fit
8d2626d5ddeb2d79b188934728ab5f2b5932fe52
565cb0d8e6062eee16dc733b3df875355eae0251
refs/heads/master
2020-04-07T21:47:03.692742
2018-11-22T19:08:18
2018-11-22T19:08:18
158,740,762
0
1
null
null
null
null
UTF-8
Java
false
false
9,652
java
package services; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.transaction.Transactional; import org.joda.time.LocalTime; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.encoding.Md5PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.util.Assert; import org.springframework.validation.BindingResult; import org.springframework.validation.Validator; import repositories.NutritionistRepository; import security.Authority; import security.LoginService; import security.UserAccount; import domain.Appointment; import domain.ArticleRating; import domain.DayName; import domain.DaySchedule; import domain.Diet; import domain.Nutritionist; import domain.User; import forms.RegisterNutritionist; @Service @Transactional public class NutritionistService { @Autowired private NutritionistRepository nutritionistRepository; @Autowired private UserAccountService userAccountService; @Autowired private Validator validator; @Autowired private AdministratorService adminService; public Nutritionist create() { final UserAccount userAccount = this.userAccountService.create(); final Authority authority = new Authority(); authority.setAuthority(Authority.NUTRITIONIST); userAccount.addAuthority(authority); final Nutritionist result; result = new Nutritionist(); result.setUserAccount(userAccount); final List<DaySchedule> schedule = new ArrayList<DaySchedule>(); final DaySchedule monday = new DaySchedule(); monday.setDay(DayName.MONDAY); final DaySchedule tuesday = new DaySchedule(); tuesday.setDay(DayName.TUESDAY); final DaySchedule wednesday = new DaySchedule(); wednesday.setDay(DayName.WEDNESDAY); final DaySchedule thursday = new DaySchedule(); thursday.setDay(DayName.THURSDAY); final DaySchedule friday = new DaySchedule(); friday.setDay(DayName.FRIDAY); final DaySchedule saturday = new DaySchedule(); saturday.setDay(DayName.SATURDAY); schedule.add(monday); schedule.add(tuesday); schedule.add(wednesday); schedule.add(thursday); schedule.add(friday); schedule.add(saturday); final List<ArticleRating> ratings = new ArrayList<ArticleRating>(); result.setValidated(false); result.setBanned(false); result.setSchedule(schedule); result.setArticleRatings(ratings); return result; } public Nutritionist save(final Nutritionist nutritionist) { Nutritionist result; Assert.notNull(nutritionist); Assert.notNull(nutritionist.getUserAccount().getUsername()); Assert.notNull(nutritionist.getUserAccount().getPassword()); if (nutritionist.getId() == 0) { String passwordHashed = null; final Md5PasswordEncoder encoder = new Md5PasswordEncoder(); passwordHashed = encoder.encodePassword(nutritionist .getUserAccount().getPassword(), null); nutritionist.getUserAccount().setPassword(passwordHashed); } result = this.nutritionistRepository.save(nutritionist); return result; } public void delete(final Nutritionist nutritionist) { Assert.isTrue(nutritionist.getId() != 0); Assert.isTrue(this.findByPrincipal().equals(nutritionist)); this.nutritionistRepository.delete(nutritionist); Assert.isTrue(!this.nutritionistRepository.findAll().contains( nutritionist)); } public Nutritionist addDaySchedule(final String day, final String morningStart, final String morningEnd, final String afternoonStart, final String afternoonEnd) { final Nutritionist nutritionist = this.findByPrincipal(); Assert.isTrue(morningStart.matches("\\d{2}:00|\\d{2}:30")); Assert.isTrue(morningEnd.matches("\\d{2}:00|\\d{2}:30")); Assert.isTrue(afternoonStart.matches("\\d{2}:00|\\d{2}:30")); Assert.isTrue(afternoonEnd.matches("\\d{2}:00|\\d{2}:30")); final LocalTime mStart = LocalTime.parse(morningStart); final LocalTime mEnd = LocalTime.parse(morningEnd); final LocalTime aStart = LocalTime.parse(afternoonStart); final LocalTime aEnd = LocalTime.parse(afternoonEnd); Assert.notNull(morningStart); Assert.notNull(morningEnd); Assert.notNull(afternoonStart); Assert.notNull(afternoonEnd); Assert.isTrue(mStart.isBefore(mEnd) && aStart.isBefore(aEnd)); Assert.isTrue(mStart.isBefore(aStart) && mStart.isBefore(aEnd) && mEnd.isBefore(aStart) && mEnd.isBefore(aEnd)); final DaySchedule daySchedule = new DaySchedule(); daySchedule.setMorningStart(morningStart); daySchedule.setMorningEnd(morningEnd); daySchedule.setAfternoonStart(afternoonStart); daySchedule.setAfternoonEnd(afternoonEnd); final List<DaySchedule> schedule = nutritionist.getSchedule(); switch (day) { case "MONDAY": daySchedule.setDay(DayName.MONDAY); schedule.set(0, daySchedule); break; case "TUESDAY": daySchedule.setDay(DayName.TUESDAY); schedule.set(1, daySchedule); break; case "WEDNESDAY": daySchedule.setDay(DayName.WEDNESDAY); schedule.set(2, daySchedule); break; case "THURSDAY": daySchedule.setDay(DayName.THURSDAY); schedule.set(3, daySchedule); break; case "FRIDAY": daySchedule.setDay(DayName.FRIDAY); schedule.set(4, daySchedule); break; case "SATURDAY": daySchedule.setDay(DayName.SATURDAY); schedule.set(5, daySchedule); break; default: break; } nutritionist.setSchedule(schedule); this.nutritionistRepository.save(nutritionist); return nutritionist; } public Nutritionist reconstructRegister( final RegisterNutritionist nutritionist, final BindingResult binding) { final Nutritionist result; Assert.isTrue(nutritionist.isAcceptedTerms()); Assert.isTrue(nutritionist.getPassword().equals( nutritionist.getRepeatedPassword())); result = this.create(); result.setEmail(nutritionist.getEmail()); result.setName(nutritionist.getName()); result.setPhone(nutritionist.getPhone()); result.setCurriculum(nutritionist.getCurriculum()); result.setSurname(nutritionist.getSurname()); result.setOfficeAddress(nutritionist.getOfficeAddress()); result.setAddress(nutritionist.getAddress()); result.setBirthdate((nutritionist.getBirthdate())); result.setPhoto(nutritionist.getPhoto()); result.getUserAccount().setUsername(nutritionist.getUsername()); result.getUserAccount().setPassword(nutritionist.getPassword()); result.setDiets(new ArrayList<Diet>()); result.setAppointments(new ArrayList<Appointment>()); this.validator.validate(result, binding); return result; } public Nutritionist reconstruct(final Nutritionist nutritionist, final BindingResult binding) { Nutritionist nutritionistStored; if (nutritionist.getId() != 0) { nutritionistStored = this.nutritionistRepository .findOne(nutritionist.getId()); nutritionist.setId(nutritionistStored.getId()); nutritionist.setUserAccount(nutritionistStored.getUserAccount()); nutritionist.setVersion(nutritionistStored.getVersion()); nutritionist.setArticleRatings(nutritionistStored .getArticleRatings()); nutritionist.setSchedule(nutritionistStored.getSchedule()); nutritionist.setBanned(nutritionistStored.isBanned()); nutritionist.setValidated(nutritionistStored.isValidated()); nutritionist.setDiets(nutritionistStored.getDiets()); nutritionist.setAppointments(nutritionistStored.getAppointments()); } this.validator.validate(nutritionist, binding); return nutritionist; } public Nutritionist findOne(final int nutritionistId) { Nutritionist result; result = this.nutritionistRepository.findOne(nutritionistId); Assert.notNull(result); return result; } public Nutritionist findOneToEdit(final int nutritionistId) { Nutritionist result; result = this.findOne(nutritionistId); Assert.isTrue(this.findByPrincipal().equals(result)); return result; } public Nutritionist findByPrincipal() { Nutritionist result; final UserAccount userAccount = LoginService.getPrincipal(); Assert.notNull(userAccount); result = this.findByNutritionistAccount(userAccount); Assert.notNull(result); return result; } public Nutritionist findByNutritionistAccount(final UserAccount userAccount) { Assert.notNull(userAccount); Nutritionist result; result = this.nutritionistRepository .findByNutritionistAccountId(userAccount.getId()); Assert.notNull(result); return result; } public Nutritionist findByNutritionistAccountId(final int nutritionistId) { Nutritionist result; result = this.nutritionistRepository .findByNutritionistAccountId(nutritionistId); return result; } public void flush() { this.nutritionistRepository.flush(); } public Collection<Nutritionist> findValidated() { return this.nutritionistRepository.findValidated(); } public Collection<Nutritionist> findNotValidated() { Assert.notNull(this.adminService.findByPrincipal()); return this.nutritionistRepository.findNotValidated(); } public Nutritionist validate(final int nutritionistId) { Assert.notNull(this.adminService.findByPrincipal()); Assert.isTrue(nutritionistId != 0); Nutritionist result; result = this.findOne(nutritionistId); Assert.isTrue(!result.isValidated()); final List<DaySchedule> days = result.getSchedule(); for (final DaySchedule ds : days) { Assert.notNull(ds.getMorningStart()); Assert.notNull(ds.getMorningEnd()); Assert.notNull(ds.getAfternoonStart()); Assert.notNull(ds.getAfternoonEnd()); } result.setValidated(true); final Nutritionist validated = this.save(result); return validated; } public Collection<User> getAssigners(int nutritionistId) { return this.nutritionistRepository.getAssigners(nutritionistId); } }
[ "lrp_ruspeg@hotmail.com" ]
lrp_ruspeg@hotmail.com
786c9ce253a676d982745e5fa7073af0f31776ec
28da2b5924bbb183f9abbd5815bf9e5902352489
/src-ui/org/pentaho/di/ui/core/widget/ControlSpaceKeyAdapter.java
60ce38fa09ced85e976e6868fa2f923ea5ee1457
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
jianjunchu/etl_designer_30
079ed1bcd2b208cf3bb86842a12c815f1db49204
996951c4b0ab9d89bffdb550161c2f3871bcf03e
refs/heads/master
2023-08-09T09:19:43.992255
2023-07-20T23:22:35
2023-07-20T23:22:35
128,722,775
3
4
Apache-2.0
2018-04-18T06:07:17
2018-04-09T06:08:53
Java
UTF-8
Java
false
false
8,505
java
/******************************************************************************* * * Pentaho Data Integration * * Copyright (C) 2002-2012 by Pentaho : http://www.pentaho.com * ******************************************************************************* * * 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.pentaho.di.ui.core.widget; import java.util.Arrays; import org.eclipse.jface.window.DefaultToolTip; import org.eclipse.jface.window.ToolTip; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.pentaho.di.core.Const; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.ui.core.PropsUI; import org.pentaho.di.ui.core.gui.GUIResource; public class ControlSpaceKeyAdapter extends KeyAdapter { private static Class<?> PKG = ControlSpaceKeyAdapter.class; // for i18n purposes, needed by Translator2!! $NON-NLS-1$ private static final PropsUI props = PropsUI.getInstance(); private GetCaretPositionInterface getCaretPositionInterface; private InsertTextInterface insertTextInterface; private VariableSpace variables; private Control control; /** * @param space * @param control a Text or CCombo box object */ public ControlSpaceKeyAdapter(final VariableSpace space, final Control control) { this(space, control, null, null); } /** * * @param space * @param control a Text or CCombo box object * @param getCaretPositionInterface * @param insertTextInterface */ public ControlSpaceKeyAdapter(VariableSpace space, final Control control, final GetCaretPositionInterface getCaretPositionInterface, final InsertTextInterface insertTextInterface) { this.variables = space; this.control = control; this.getCaretPositionInterface = getCaretPositionInterface; this.insertTextInterface = insertTextInterface; } /** * PDI-1284 * in chinese window, Ctrl-SPACE is reversed by system for input chinese character. * use Ctrl-ALT-SPACE instead. * @param e * @return */ private boolean isHotKey(KeyEvent e) { if (System.getProperty("user.language").equals("zh")) return e.character == ' ' && ((e.stateMask & SWT.CONTROL) != 0) && ((e.stateMask & SWT.ALT) != 0); // Detect Command-space on Mac OS X to fix PDI-4319 else if (System.getProperty("os.name").startsWith("Mac OS X")) return e.character == ' ' && ((e.stateMask & SWT.MOD1) != 0) && ((e.stateMask & SWT.ALT) == 0); else return e.character == ' ' && ((e.stateMask & SWT.CONTROL) != 0) && ((e.stateMask & SWT.ALT) == 0); } public void keyPressed(KeyEvent e) { // CTRL-<SPACE> --> Insert a variable if (isHotKey(e)) { e.doit = false; // textField.setData(TRUE) indicates we have transitioned from the textbox to list mode... // This will be set to false when the list selection has been processed // and the list is being disposed of. control.setData(Boolean.TRUE); final int position; if (getCaretPositionInterface != null) position = getCaretPositionInterface.getCaretPosition(); else position = -1; // Drop down a list of variables... // Rectangle bounds = control.getBounds(); Point location = GUIResource.calculateControlPosition(control); final Shell shell = new Shell(control.getShell(), SWT.NONE); shell.setSize(bounds.width, 200); shell.setLocation(location.x, location.y + bounds.height); shell.setLayout(new FillLayout()); final List list = new List(shell, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); props.setLook(list); list.setItems(getVariableNames(variables)); final DefaultToolTip toolTip = new DefaultToolTip(list, ToolTip.RECREATE, true); toolTip.setImage(GUIResource.getInstance().getImageVariable()); toolTip.setHideOnMouseDown(true); toolTip.setRespectMonitorBounds(true); toolTip.setRespectDisplayBounds(true); toolTip.setPopupDelay(350); list.addSelectionListener(new SelectionAdapter() { // Enter or double-click: picks the variable // public synchronized void widgetDefaultSelected(SelectionEvent e) { applyChanges(shell, list, control, position, insertTextInterface); } // Select a variable name: display the value in a tool tip // public void widgetSelected(SelectionEvent event) { if (list.getSelectionCount() <= 0) return; String name = list.getSelection()[0]; String value = variables.getVariable(name); Rectangle shellBounds = shell.getBounds(); String message = BaseMessages.getString(PKG, "TextVar.VariableValue.Message", name, value); if (name.startsWith(Const.INTERNAL_VARIABLE_PREFIX)) message += BaseMessages.getString(PKG, "TextVar.InternalVariable.Message"); toolTip.setText(message); toolTip.hide(); toolTip.show(new Point(shellBounds.width, 0)); } }); list.addKeyListener(new KeyAdapter() { public synchronized void keyPressed(KeyEvent e) { if (e.keyCode == SWT.CR && ((e.keyCode & SWT.CONTROL) == 0) && ((e.keyCode & SWT.SHIFT) == 0)) { applyChanges(shell, list, control, position, insertTextInterface); } } }); list.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent event) { shell.dispose(); if (!control.isDisposed()) control.setData(Boolean.FALSE); } }); shell.open(); } ; } private static final void applyChanges(Shell shell, List list, Control control, int position, InsertTextInterface insertTextInterface) { String extra = "${" + list.getSelection()[0] + "}"; if (insertTextInterface != null) { insertTextInterface.insertText(extra, position); } else { if (control.isDisposed()) return; if (list.getSelectionCount() <= 0) return; if (control instanceof Text) { ((Text)control).insert(extra); } else if (control instanceof CCombo) { CCombo combo = (CCombo)control; combo.setText(extra); // We can't know the location of the cursor yet. All we can do is overwrite. } else if (control instanceof StyledTextComp) { ((StyledTextComp)control).insert(extra); } else if (control instanceof StyledText) { ((StyledText)control).insert(extra); } } if (!shell.isDisposed()) shell.dispose(); if (!control.isDisposed()) control.setData(Boolean.FALSE); } public static final String[] getVariableNames(VariableSpace space) { String variableNames[] = space.listVariables(); Arrays.sort(variableNames); // repeat a few entries at the top, for convenience... // String[] array = new String[variableNames.length+2]; int index=0; array[index++]= Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY; array[index++]= Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY; for (String name : variableNames) array[index++] = name; return array; } public void setVariables(VariableSpace vars){ variables = vars; } }
[ "jianjunchu@gmail.com" ]
jianjunchu@gmail.com
0c0bf80bb28a7efc3df8330bd1575dad43a76eff
f63b921c464598e14a819d674430362781a5d64e
/02.Model2MVCShop(Refactor & Page Navigation)/src/com/model2/mvc/service/user/dao/UserDao.java
ecd7d23d4add486a32f3831dea6d56a287d50a68
[]
no_license
SangaChoi/02.Model2MVCShop
f9a62e59ff98716f04d04e99dab837026d4172d7
a64aadc79a4df5cdd8168e3068a0aba06fb10f7f
refs/heads/master
2020-04-26T09:17:22.993146
2018-11-01T12:24:59
2018-11-01T12:24:59
173,450,243
0
0
null
null
null
null
UHC
Java
false
false
5,423
java
package com.model2.mvc.service.user.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.List; import com.model2.mvc.common.Search; import com.model2.mvc.common.util.DBUtil; import com.model2.mvc.service.domain.User; public class UserDao { ///Field ///Constructor public UserDao() { } ///Method public void insertUser(User user) throws Exception { Connection con = DBUtil.getConnection(); String sql = "INSERT "+ "INTO USERS "+ "VALUES (?,?,?,'user',?,?,?,?,SYSDATE)"; PreparedStatement pStmt = con.prepareStatement(sql); pStmt.setString(1, user.getUserId()); pStmt.setString(2, user.getUserName()); pStmt.setString(3, user.getPassword()); pStmt.setString(4, user.getSsn()); pStmt.setString(5, user.getPhone()); pStmt.setString(6, user.getAddr()); pStmt.setString(7, user.getEmail()); pStmt.executeUpdate(); pStmt.close(); con.close(); } public User findUser(String userId) throws Exception { Connection con = DBUtil.getConnection(); String sql = "SELECT "+ "user_id , user_name , password , role , cell_phone , addr , email , reg_date " + "FROM users WHERE user_id = ?"; PreparedStatement pStmt = con.prepareStatement(sql); pStmt.setString(1, userId); ResultSet rs = pStmt.executeQuery(); User user = null; while (rs.next()) { user = new User(); user.setUserId(rs.getString("user_id")); user.setUserName(rs.getString("user_name")); user.setPassword(rs.getString("password")); user.setRole(rs.getString("role")); user.setPhone(rs.getString("cell_phone")); user.setAddr(rs.getString("addr")); user.setEmail(rs.getString("email")); user.setRegDate(rs.getDate("reg_date")); } rs.close(); pStmt.close(); con.close(); return user; } public Map<String , Object> getUserList(Search search) throws Exception { Map<String , Object> map = new HashMap<String, Object>(); Connection con = DBUtil.getConnection(); // Original Query 구성 String sql = "SELECT user_id , user_name , email FROM users "; if (search.getSearchCondition() != null) { if ( search.getSearchCondition().equals("0") && !search.getSearchKeyword().equals("") ) { sql += " WHERE user_id = '" + search.getSearchKeyword()+"'"; } else if ( search.getSearchCondition().equals("1") && !search.getSearchKeyword().equals("")) { sql += " WHERE user_name ='" + search.getSearchKeyword()+"'"; } } sql += " ORDER BY user_id"; System.out.println("UserDAO::Original SQL :: " + sql); //==> TotalCount GET int totalCount = this.getTotalCount(sql); System.out.println("UserDAO :: totalCount :: " + totalCount); //==> CurrentPage 게시물만 받도록 Query 다시구성 sql = makeCurrentPageSql(sql, search); PreparedStatement pStmt = con.prepareStatement(sql); ResultSet rs = pStmt.executeQuery(); System.out.println(search); List<User> list = new ArrayList<User>(); while(rs.next()){ User user = new User(); user.setUserId(rs.getString("user_id")); user.setUserName(rs.getString("user_name")); user.setEmail(rs.getString("email")); list.add(user); } //==> totalCount 정보 저장 map.put("totalCount", new Integer(totalCount)); //==> currentPage 의 게시물 정보 갖는 List 저장 map.put("list", list); rs.close(); pStmt.close(); con.close(); return map; } public void updateUser(User vo) throws Exception { System.out.println("*************DAO updateUser() 시작"); Connection con = DBUtil.getConnection(); String sql = "UPDATE users "+ "SET user_name = ?, cell_phone = ? , addr = ? , email = ? "+ "WHERE user_id = ?"; PreparedStatement pStmt = con.prepareStatement(sql); pStmt.setString(1, vo.getUserName()); pStmt.setString(2, vo.getPhone()); pStmt.setString(3, vo.getAddr()); pStmt.setString(4, vo.getEmail()); pStmt.setString(5, vo.getUserId()); pStmt.executeUpdate(); pStmt.close(); con.close(); System.out.println("*************DAO updateUser() 끝"); } // 게시판 Page 처리를 위한 전체 Row(totalCount) return private int getTotalCount(String sql) throws Exception { sql = "SELECT COUNT(*) "+ "FROM ( " +sql+ ") countTable"; Connection con = DBUtil.getConnection(); PreparedStatement pStmt = con.prepareStatement(sql); ResultSet rs = pStmt.executeQuery(); int totalCount = 0; if( rs.next() ){ totalCount = rs.getInt(1); } pStmt.close(); con.close(); rs.close(); return totalCount; } // 게시판 currentPage Row 만 return private String makeCurrentPageSql(String sql , Search search){ sql = "SELECT * "+ "FROM ( SELECT inner_table. * , ROWNUM AS row_seq " + " FROM ( "+sql+" ) inner_table "+ " WHERE ROWNUM <="+search.getCurrentPage()*search.getPageSize()+" ) " + "WHERE row_seq BETWEEN "+((search.getCurrentPage()-1)*search.getPageSize()+1) +" AND "+search.getCurrentPage()*search.getPageSize(); System.out.println("UserDAO :: make SQL :: "+ sql); return sql; } }
[ "tkddk92@naver.com" ]
tkddk92@naver.com
f66fa85fb3b1bc95989c6099df144274321012dc
78c3452da814a7da5a5586717dbdece1b6388fec
/app/src/main/java/com/cainiaoalliance/mPieChart.java
1358a807896911557733519b018590d16c18f76a
[]
no_license
g-curry/CainiaoAlliance
680acc61fc5d86bc6f376625c8fe5d618190aede
a63be1294dbb1159f9f1317a82bf355fb4bd7a98
refs/heads/master
2020-06-09T21:18:38.886260
2019-12-03T08:49:03
2019-12-03T08:49:03
193,507,650
0
0
null
null
null
null
UTF-8
Java
false
false
5,479
java
package com.cainiaoalliance; import android.content.Intent; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.DisplayMetrics; import android.util.Log; import com.github.mikephil.charting.charts.PieChart; import com.github.mikephil.charting.components.Legend; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.data.PieData; import com.github.mikephil.charting.data.PieDataSet; import com.github.mikephil.charting.formatter.ValueFormatter; import com.github.mikephil.charting.utils.ColorTemplate; import com.github.mikephil.charting.utils.ViewPortHandler; import java.util.ArrayList; import java.util.LinkedList; public class mPieChart extends AppCompatActivity { public PieChart mChart; private LinkedList<MessageBean> records = new LinkedList<>(); private String date; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_m_pie_chart); Intent intent = getIntent(); String action = intent.getAction(); if(action.equals("one")){ date = intent.getStringExtra("key"); Log.e("Intent传值", "onCreate: -----------OneActivity:"+ date ); } records = GlobalUtil.getInstance().databaseHelper.readMessage(date); int count = records.size(); mChart = (PieChart) findViewById(R.id.mPieChart); PieData mPieData = getPieData(count, 100); showChart(mChart, mPieData); } private void showChart(PieChart pieChart, PieData pieData) { pieChart.setHoleColorTransparent(true); //半径 pieChart.setHoleRadius(40f); //半透明圈 pieChart.setTransparentCircleRadius(44f); //pieChart.setHoleRadius(0)//实心圆 //饼状图中间可以添加文字 pieChart.setDrawCenterText(true); pieChart.setDrawHoleEnabled(true); //初始旋转角度 pieChart.setRotationAngle(90); //可以手动旋转 pieChart.setRotationEnabled(true); //显示成百分比 pieChart.setUsePercentValues(true); int count = records.size(); if (count != 0){ //饼状图中间的文字 pieChart.setCenterText("销售种类及占比"); } else { pieChart.setCenterText(""); } pieChart.setCenterTextColor(Color.BLUE); pieChart.setCenterTextSize(15f); pieChart.setCenterTextSizePixels(40f); //设置数据 pieChart.setData(pieData); //显示日期 pieChart.setDescription(date); //设置文字字号 pieChart.setDescriptionTextSize(20f); //设置比例图 Legend mLegend = pieChart.getLegend(); //最右边显示 mLegend.setPosition(Legend.LegendPosition.RIGHT_OF_CHART); mLegend.setXEntrySpace(7f); mLegend.setYEntrySpace(5f); //设置动画 pieChart.animateXY(1000, 1000); } //分成几部分 private PieData getPieData(int count, float range) { records = GlobalUtil.getInstance().databaseHelper.readMessage(date); count = records.size(); ArrayList<String> xValues = new ArrayList<String>(); ArrayList<Entry> yValues = new ArrayList<Entry>(); int record_size = 0; double yData; for (MessageBean record : records) { xValues.add(record.getName()); yData = Double.parseDouble(record.getSum()); yValues.add(new Entry((float) yData, record_size)); record_size++; } // double yData1; // double yGetData; // for (MessageBean record : records) { // for(int i=0; i < xValues.size(); i++) { // if (xValues.get(i) != record.getName()){ // xValues.add(record.getName()); // yData = Double.parseDouble(record.getSum()); // yValues.add(new Entry((float) yData, record_size)); // } // else{ // yGetData = Double.parseDouble(String.valueOf(yValues.get(i))); // yData1 = Double.parseDouble(record.getSum()) + yGetData; // yValues.add(new Entry((float) yData1, record_size)); // } // } // record_size++; // } //y轴的集合/*显示在比例图上*/ PieDataSet pieDataSet = new PieDataSet(yValues,"今日销售种类"); //设置个饼状图之间的距离 pieDataSet.setSliceSpace(1f); pieDataSet.setColors(ColorTemplate.COLORFUL_COLORS); //设置圆盘文字颜色 pieDataSet.setValueTextColor(Color.WHITE); pieDataSet.setValueTextSize(15f); //设置是否显示区域百分比的值 //设置数据样式 pieDataSet.setValueFormatter(new ValueFormatter() { @Override public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) { return ""+(int)value+"%"; } }); DisplayMetrics metrics = getResources().getDisplayMetrics(); float px = 5 * (metrics.densityDpi / 160f); // 选中态多出的长度 pieDataSet.setSelectionShift(px); PieData pieData = new PieData(xValues,pieDataSet); return pieData; } }
[ "ghua.curry@gmail.com" ]
ghua.curry@gmail.com
1cd2dd1e06fec7c3a1ff4d5ba0135bfa1ddc11b2
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/14/14_13514fe5ece7ba837434342eb15b0f5237d257c8/InputNumber/14_13514fe5ece7ba837434342eb15b0f5237d257c8_InputNumber_t.java
b6ee83a577b35cb40d3bf55fa61bc5e3eebc7326
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
7,958
java
/* * Copyright 2012 PrimeFaces Extensions. * * 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. * * $Id$ */ package org.primefaces.extensions.component.inputnumber; import java.util.ArrayList; import java.util.List; import javax.el.ValueExpression; import javax.faces.application.ResourceDependencies; import javax.faces.application.ResourceDependency; import javax.faces.component.UINamingContainer; import javax.faces.component.html.HtmlInputText; import javax.faces.context.FacesContext; import org.primefaces.component.api.Widget; /** * InputNumber * * @author Mauricio Fenoglio / last modified by $Author$ * @version $Revision$ * @since 0.3 */ @ResourceDependencies({ @ResourceDependency(library = "primefaces", name = "primefaces.css"), @ResourceDependency(library = "primefaces", name = "jquery/jquery.js"), @ResourceDependency(library = "primefaces", name = "primefaces.js"), @ResourceDependency(library = "primefaces-extensions", name = "primefaces-extensions.js"), @ResourceDependency(library = "primefaces-extensions", name = "inputnumber/inputnumber.js") }) public class InputNumber extends HtmlInputText implements Widget { public static final String COMPONENT_FAMILY = "org.primefaces.extensions.component"; private static final String DEFAULT_RENDERER = "org.primefaces.extensions.component.InputNumberRenderer"; private static final String OPTIMIZED_PACKAGE = "org.primefaces.extensions.component."; public final static String INPUTNUMBER_INPUT_WRAPPER_CLASS = "ui-helper-hidden"; public final static String INPUTNUMBER_CLASS = "ui-inputNum ui-widget"; /** * PropertyKeys * * @author Mauricio Fenoglio / last modified by $Author: * fenoloco@gmail.com $ * @version $Revision$ * @since 0.3 */ protected enum PropertyKeys { widgetVar, decimalSeparator, thousandSeparator, symbol, symbolPosition, minValue, maxValue, roundMethod, decimalPlaces; String toString; PropertyKeys(String toString) { this.toString = toString; } PropertyKeys() { } @Override public String toString() { return ((this.toString != null) ? this.toString : super.toString()); } } public InputNumber() { setRendererType(DEFAULT_RENDERER); } @Override public String getFamily() { return COMPONENT_FAMILY; } public String getWidgetVar() { return (String) getStateHelper().eval(PropertyKeys.widgetVar, null); } public void setWidgetVar(final String widgetVar) { setAttribute(PropertyKeys.widgetVar, widgetVar); } public String getDecimalSeparator() { return (String) getStateHelper().eval(PropertyKeys.decimalSeparator, ""); } public void setDecimalSeparator(final String decimalSeparator) { setAttribute(PropertyKeys.decimalSeparator, decimalSeparator); } public String getThousandSeparator() { return (String) getStateHelper().eval(PropertyKeys.thousandSeparator, null); } public void setThousandSeparator(final String thousandSeparator) { setAttribute(PropertyKeys.thousandSeparator, thousandSeparator); } public String getSymbol() { return (String) getStateHelper().eval(PropertyKeys.symbol, ""); } public void setSymbol(final String symbol) { setAttribute(PropertyKeys.symbol, symbol); } public String getSymbolPosition() { return (String) getStateHelper().eval(PropertyKeys.symbolPosition, ""); } public void setSymbolPosition(final String symbolPosition) { setAttribute(PropertyKeys.symbolPosition, symbolPosition); } public String getMinValue() { return (String) getStateHelper().eval(PropertyKeys.minValue, ""); } public void setMinValue(final String minValue) { setAttribute(PropertyKeys.minValue, minValue); } public String getMaxValue() { return (String) getStateHelper().eval(PropertyKeys.maxValue, ""); } public void setMaxValue(final String maxValue) { setAttribute(PropertyKeys.maxValue, maxValue); } public String getRoundMethod() { return (String) getStateHelper().eval(PropertyKeys.roundMethod, ""); } public void setRoundMethod(final String roundMethod) { setAttribute(PropertyKeys.roundMethod, roundMethod); } public String getDecimalPlaces() { return (String) getStateHelper().eval(PropertyKeys.decimalPlaces, ""); } public void setDecimalPlaces(final String decimalPlaces) { setAttribute(PropertyKeys.decimalPlaces, decimalPlaces); } public String resolveWidgetVar() { final FacesContext context = FacesContext.getCurrentInstance(); final String userWidgetVar = (String) getAttributes().get(org.primefaces.extensions.component.inputnumber.InputNumber.PropertyKeys.widgetVar.toString()); if (userWidgetVar != null) { return userWidgetVar; } return "widget_" + getClientId(context).replaceAll("-|" + UINamingContainer.getSeparatorChar(context), "_"); } public void setAttribute(final org.primefaces.extensions.component.inputnumber.InputNumber.PropertyKeys property, final Object value) { getStateHelper().put(property, value); @SuppressWarnings("unchecked") List<String> setAttributes = (List<String>) this.getAttributes().get("javax.faces.component.UIComponentBase.attributesThatAreSet"); if (setAttributes == null) { final String cname = this.getClass().getName(); if (cname != null && cname.startsWith(OPTIMIZED_PACKAGE)) { setAttributes = new ArrayList<String>(6); this.getAttributes().put("javax.faces.component.UIComponentBase.attributesThatAreSet", setAttributes); } } if (setAttributes != null && value == null) { final String attributeName = property.toString(); final ValueExpression ve = getValueExpression(attributeName); if (ve == null) { setAttributes.remove(attributeName); } else if (!setAttributes.contains(attributeName)) { setAttributes.add(attributeName); } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
474a0452402d21d8ebbff641b9eb8484a81e8872
3f46b86e2c96af585cfe19beeb28de8d5675dbec
/client/src/main/java/com/dungcuthethao/client/service/impl/GiaTriThuocTinhSanPhamServiceImpl.java
666a9d8ffa2f3bccbef94cc342cb559c2769ec95
[]
no_license
Phuoc2k/Remake_WebsiteDungCuTheThaoBySpringboot
3a53aabab7e3cd142aaf0da1d7d53ad1660bdce6
655de4af8bb866fc1b6a5db90f6b2a15a8e24d8d
refs/heads/main
2023-06-16T04:08:25.242354
2021-07-09T15:01:22
2021-07-09T15:01:22
381,300,140
0
0
null
null
null
null
UTF-8
Java
false
false
1,098
java
package com.dungcuthethao.client.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import com.dungcuthethao.client.entity.GiaTriThuocTinhSanPham; import com.dungcuthethao.client.service.IGiaTriThuocTinhSanPhamService; @Service public class GiaTriThuocTinhSanPhamServiceImpl implements IGiaTriThuocTinhSanPhamService{ @Autowired private RestTemplate rest; @Override public void saveGTTTSP(GiaTriThuocTinhSanPham giaTriThuocTinhSanPham) { rest.postForEntity("giatrithuoctinhsanpham", giaTriThuocTinhSanPham, GiaTriThuocTinhSanPham.class); } @Override public void updateGTTTSP(GiaTriThuocTinhSanPham gtttsanPham) { rest.put("giatrithuoctinhsanpham", GiaTriThuocTinhSanPham.class); } @Override public GiaTriThuocTinhSanPham findByIdSanPhamAndIDThuocTinh(Long idSP, Long idTT) { // TODO Auto-generated method stub return rest.getForObject("giatrithuoctinhsanpham/sanpham&&thuoctinh?idSP="+idSP+"&&idTT="+idTT, GiaTriThuocTinhSanPham.class); } }
[ "duongdiem20@gmail.com" ]
duongdiem20@gmail.com
1bb838f966514314b2d856ce538f3b2d88d93cbf
ab259fd20745d2ce83f5d38f29b9f390a05ba79e
/sale/src/test/java/com/mapreduce/sale/AppTest.java
738399c7de08c7dc90bc28084cca50449790b7fe
[]
no_license
simingwu/bigdata-sale
1f76e0579a27e717da0feaa705776d4e99b181c2
e4c38b37abd2f876c93b037653734f56e74a613e
refs/heads/master
2022-05-07T13:50:18.549625
2019-08-16T06:25:23
2019-08-16T06:25:23
202,670,315
0
0
null
2022-04-12T21:56:04
2019-08-16T06:21:34
Java
UTF-8
Java
false
false
684
java
package com.mapreduce.sale; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "noreply@github.com" ]
simingwu.noreply@github.com
770dfb906bcf371f098acf3262dc1bf7f79146d2
8e6c202d220389fd0fad02dc43e02b689a114563
/代理模式.java
9a937df48bbc8af742e8b856290584c75e6e10dc
[]
no_license
taoweitao-125/model
b2503ac20b81628ae2d6becba4376f4e76f12731
9bc1db290f296a9e0e0a392ca4cedc4729ac71c4
refs/heads/main
2023-03-17T08:22:29.789986
2021-03-09T00:52:31
2021-03-09T00:52:31
345,839,070
0
0
null
null
null
null
UTF-8
Java
false
false
287
java
package modlu; /** * @author xiaogege * @描述: * @date 2021/3/9 * @time 8:47 */ class Sourse{ public void doSomething(){ } } public class 代理模式 { public Sourse sourse; public void doSomething() { sourse.doSomething(); } }
[ "noreply@github.com" ]
taoweitao-125.noreply@github.com
a65194534a26863ee289256070013e4eb4388c8a
7de429599facde83f5d586621f272a2ff0aab006
/src/main/java/com/jonnymatts/prometheus/jmx/verification/MBeanVerificationException.java
8ca5058da445589d71b5bfa207c5baa0d6317cde
[]
no_license
jonnymatts/prometheus-jmx-exporter
b2d67c11d943b1c5bc735e3311ac089c43cab8a8
3b263702ab3c98b03b46915c6beeff691bae8726
refs/heads/master
2021-01-23T01:17:33.146322
2017-06-22T21:24:18
2017-06-22T21:24:18
92,863,223
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package com.jonnymatts.prometheus.jmx.verification; public class MBeanVerificationException extends RuntimeException { public MBeanVerificationException(String message) { super(message); } public MBeanVerificationException(String message, Throwable cause) { super(message, cause); } }
[ "jonoamatts@gmail.com" ]
jonoamatts@gmail.com
8bd1d5324350cf5df3206a9e78da58252a40a5e4
96b8af6f1d72f2678fb20f90ffeb95f69518450f
/app/src/androidTest/java/com/hie2j/wuziqi/ExampleInstrumentedTest.java
9dcc4c44f4d4864095b13272cadca64d09d78989
[]
no_license
Jacob-hie/Wuziqi
b293a8fb2e9a0e6a19815546b5c68f2d4c4f7a7b
c4c6fb56a415d135ab9eec4801cc2b15b76a80d4
refs/heads/master
2020-05-27T06:29:26.283144
2019-05-25T05:02:33
2019-05-25T05:02:33
188,522,738
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
package com.hie2j.wuziqi; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.hie2j.wuziqi", appContext.getPackageName()); } }
[ "634865739@qq.com" ]
634865739@qq.com
8b9228bf4c6117d76890177c2284c69fec2f929b
90923df9e8310c3608e016df79273f93bf22c6df
/app/src/main/java/com/jingcai/jc_11x5/util/NetUtil.java
245467fc249d7efbbc3bf17aa16000e77d2881ca
[]
no_license
Meliodas001/Jc-11x5-dsfx-mobile
e92a6317c772650190926ca66e273c03770eefe6
1afee07e63aac7a1fdc6afe6b1d01882751de14d
refs/heads/master
2021-03-06T11:26:54.716551
2020-03-28T08:33:08
2020-03-28T08:33:08
246,197,605
0
0
null
null
null
null
UTF-8
Java
false
false
1,939
java
package com.jingcai.jc_11x5.util; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * Created by yangsen on 2016/7/13. * 网络相关的工具类 */ public class NetUtil { private NetUtil() { /* cannot be instantiated */ throw new UnsupportedOperationException("cannot be instantiated"); } /** * 判断网络是否连接 * * @param context * @return */ public static boolean isConnected(Context context) { ConnectivityManager connectivity = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (null != connectivity) { NetworkInfo info = connectivity.getActiveNetworkInfo(); if (null != info && info.isConnected()) { if (info.getState() == NetworkInfo.State.CONNECTED) { return true; } } } return false; } /** * 判断是否是wifi连接 */ public static boolean isWifi(Context context) { ConnectivityManager cm = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (cm == null) return false; return cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI; } /** * 打开网络设置界面 */ public static void openSetting(Activity activity) { Intent intent = new Intent("/"); ComponentName cm = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings"); intent.setComponent(cm); intent.setAction("android.intent.action.VIEW"); activity.startActivityForResult(intent, 0); } }
[ "5634362+txywan@user.noreply.gitee.com" ]
5634362+txywan@user.noreply.gitee.com
af9f9d9f8b28fa89ac649e6b3e1c24110a8bc578
0ca5ccc5de2400af15a19d1d77e94f66b51e30a6
/109 - Convert Sorted List to Binary Search Tree.java
6078aaf5cc2d57def589256ccaf1bc9aa54c5b6b
[]
no_license
doctorbean/Leetcode
c03ec1bfa7812fea779d582a9ffea1800e189166
dd0d749188c8e7ef846a1f5b8d33ff6a39ded36e
refs/heads/master
2022-07-03T06:43:48.993611
2020-05-13T21:24:21
2020-05-13T21:24:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,005
java
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { ListNode node; public TreeNode sortedListToBST(ListNode head) { if (head == null) { return null; } node = head; int n = 0; while (head != null) { n += 1; head = head.next; } return balanced(0, n - 1); } private TreeNode balanced(int lo, int hi) { if (lo > hi) { return null; } int mi = lo + (hi - lo) / 2; TreeNode left = balanced(lo, mi - 1); TreeNode t = new TreeNode(node.val); node = node.next; TreeNode right = balanced(mi + 1, hi); t.left = left; t.right = right; return t; } }
[ "i@cee.moe" ]
i@cee.moe
33f964f1123ffa7cdb83a689c76b9493f053b010
5c3fe426d0113499073694231b7383f9a3c5ed53
/sqlbuilder/src/main/java/site/autzone/sqlbee/sql/query/builder/FirstResultConfigurer.java
ac1a64725676061329a0fdf93f40589bae8f178b
[ "MIT" ]
permissive
lanjiachuan/sqlbee
e38bca1f1b6426e6cfab58a2a1cf377bf511cd49
f162235c1eeb3fec878660e93a326416dbd743c4
refs/heads/master
2020-11-26T05:16:14.691303
2019-12-10T05:53:07
2019-12-10T05:53:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
700
java
package site.autzone.sqlbee.sql.query.builder; import site.autzone.sqlbee.model.Value; public class FirstResultConfigurer extends AbstractConditionConfigurer { private Value firstResultValue; public FirstResultConfigurer firstResult(Integer firstResult) { this.firstResultValue = new Value(firstResult, Value.TYPE.INT.name()); return this; } @Override public void doConfigure(SqlQueryBuilder parent) { //管理到builder firstResultValue = (Value) parent.manageValue(firstResultValue); //字符串设置到builder中 parent.setFirstResultKey(firstResultValue.toText()); } @Override public void doConditionConfigure(SqlQueryBuilder parent) { //已经重写父类方法 } }
[ "xiaowj@unitechs.com" ]
xiaowj@unitechs.com
0c65df7c4a4f659f1e2574c3bc59395a668521c6
9045e18752318ee728c658eb4ed056212139cec3
/src/main/java/com/simis/dao/impl/UserDaoImpl.java
707295d4efe175a2c39a464a480389381d9b9748
[]
no_license
lzefforts/simis
55c520862d0ecdebbba7adc1f2dba9c1bc5e4152
ed259dccd8cc369f4409db5c26a38c9c3efe2848
refs/heads/master
2021-01-23T05:10:13.968612
2018-11-22T00:18:05
2018-11-22T00:18:05
92,958,316
0
0
null
2018-08-27T08:59:20
2017-05-31T15:04:08
JavaScript
UTF-8
Java
false
false
1,251
java
package com.simis.dao.impl; import com.simis.base.impl.BaseHibernateDaoImpl; import com.simis.dao.UserDao; import com.simis.model.CustomerModel; import com.simis.model.UserModel; import org.springframework.stereotype.Repository; import java.util.HashMap; import java.util.Map; /** * Created by 一拳超人 */ @Repository("userDao") public class UserDaoImpl extends BaseHibernateDaoImpl implements UserDao { @Override public UserModel queryByUserName(String userName) { StringBuilder hql = new StringBuilder("from UserModel where userName =:userName and systemState=1"); Map<String,Object> params = new HashMap<>(); params.put("userName",userName); return (UserModel)this.queryUniquneObject(hql.toString(),params); } @Override public boolean validateUser(String userName, String passWord) { StringBuilder hql = new StringBuilder("from UserModel where userName =:userName and passWord =:passWord and systemState=1"); Map<String,Object> params = new HashMap<>(); params.put("userName",userName); params.put("passWord",passWord); if(this.queryUniquneObject(hql.toString(),params) == null){ return false; } return true; } }
[ "lzefforts@126.com" ]
lzefforts@126.com
04eda5d36d5f8f8171eb5e11d40bb9a03cc14bb9
2af2265873e22fe58c80446ec93543e41acec350
/src/main/model/ManageAccountsModel.java
418aaebface85c1c8fcbb9c792f1e1956da032bc
[]
no_license
ConorChristensen-RMIT/Desk-Booking-Application
e156b3bea444012fa760868d75378d89fdaacfae
08282d5d1ffe152195395ca59e63ab368a3e98e2
refs/heads/master
2023-06-01T20:05:47.706781
2021-06-22T03:59:52
2021-06-22T03:59:52
379,134,942
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package main.model; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; /* Model class for ManageAccountsController class * Uses Singleton Facade DBManagement. * Generates and sets passwords as required in the Landing Page. * Gets secret question and answers as required in the Landing Page */ public class ManageAccountsModel { DBManagement db = DBManagement.getInstance(); Connection connection; Statement statement; ResultSet results; public ManageAccountsModel(){ connection = db.connect(); statement = db.getStatement(); } public ArrayList<EmployeeModel> getCurrentEmployees(){ ArrayList<EmployeeModel> current_employees = new ArrayList<>(); String query = "SELECT id FROM Profile WHERE isAdmin = 0;"; try{ results = statement.executeQuery(query); while (results.next()){ EmployeeModel employee = new EmployeeModel(results.getInt(1)); current_employees.add(employee); } } catch (SQLException | EmployeeDoesNotExist throwables) { throwables.printStackTrace(); } db.finallyTableRead(results, statement); return current_employees; } }
[ "s3815282@student.rmit.edu.au" ]
s3815282@student.rmit.edu.au
42fa45151b6a459c9df8b06332581a40628d000b
be825a2807fd07f18f997caf9fc20f9273260327
/metrics/src/main/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystem.java
3c1242fe715796631170d8c58bbd13531c2ca423
[ "Apache-2.0" ]
permissive
vinistevam/pantheon
a74c411e7c6495fb74f24544dbc6c83e6ae4c393
a0f55c765d7b3f6ce657a137fb629b718ffe088d
refs/heads/master
2020-04-15T10:22:07.814727
2019-03-28T07:03:56
2019-03-28T07:03:56
164,593,547
0
0
Apache-2.0
2019-01-25T14:11:14
2019-01-08T07:47:17
Java
UTF-8
Java
false
false
2,684
java
/* * Copyright 2018 ConsenSys AG. * * 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 tech.pegasys.pantheon.metrics.noop; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.Observation; import tech.pegasys.pantheon.metrics.OperationTimer; import tech.pegasys.pantheon.metrics.OperationTimer.TimingContext; import java.util.Collections; import java.util.List; import java.util.function.Supplier; import java.util.stream.Stream; import io.prometheus.client.Collector; public class NoOpMetricsSystem implements MetricsSystem { public static final Counter NO_OP_COUNTER = new NoOpCounter(); private static final TimingContext NO_OP_TIMING_CONTEXT = () -> 0; private static final OperationTimer NO_OP_TIMER = () -> NO_OP_TIMING_CONTEXT; public static final LabelledMetric<OperationTimer> NO_OP_LABELLED_TIMER = label -> NO_OP_TIMER; public static final LabelledMetric<Counter> NO_OP_LABELLED_COUNTER = label -> NO_OP_COUNTER; public static final Collector NO_OP_COLLECTOR = new Collector() { @Override public List<MetricFamilySamples> collect() { return Collections.emptyList(); } }; @Override public LabelledMetric<Counter> createLabelledCounter( final MetricCategory category, final String name, final String help, final String... labelNames) { return NO_OP_LABELLED_COUNTER; } @Override public LabelledMetric<OperationTimer> createLabelledTimer( final MetricCategory category, final String name, final String help, final String... labelNames) { return NO_OP_LABELLED_TIMER; } @Override public void createGauge( final MetricCategory category, final String name, final String help, final Supplier<Double> valueSupplier) {} @Override public Stream<Observation> getMetrics(final MetricCategory category) { return Stream.empty(); } @Override public Stream<Observation> getMetrics() { return Stream.empty(); } }
[ "noreply@github.com" ]
vinistevam.noreply@github.com
3b530e689e490ae51cf6b75887ff7ca772f6f87f
a091f93d8abc3a6f9c1004a6acca71cacb642070
/src/main/java/training360/guinessapp/recorder/RecorderController.java
87574f049f199a86b093fb66636a1beb50df380b
[]
no_license
ipp203/sv2021-jvjbf-kepesitovizsga
debadcf8958c73dd2f954e3dc8b15d496924ba37
2f7d2a347e1bd5500eba82e4579834745ddf7e47
refs/heads/master
2023-07-21T18:52:26.414572
2021-09-06T13:04:02
2021-09-06T13:04:02
403,573,706
0
0
null
null
null
null
UTF-8
Java
false
false
893
java
package training360.guinessapp.recorder; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import training360.guinessapp.dto.RecorderCreateCommand; import training360.guinessapp.dto.RecorderDto; import training360.guinessapp.dto.RecorderShortDto; import javax.validation.Valid; import java.util.List; @RestController public class RecorderController { private final RecoderService service; public RecorderController(RecoderService service) { this.service = service; } @PostMapping("/api/recorders") @ResponseStatus(HttpStatus.CREATED) public RecorderDto createRecorder(@Valid @RequestBody RecorderCreateCommand command) { return service.createRecorder(command); } @GetMapping("/api/recorders") public List<RecorderShortDto> listRecorders() { return service.listRecorders(); } }
[ "ipp203@freemail.hu" ]
ipp203@freemail.hu
cec8dbd168893150fd09a5bf1893aa8bd6194613
db470cf91ff17b02dafe23aeee90b43b22910b53
/src/models/Item.java
cd11343ad0cc7ec7cdbabcedaeab538d3b20b44e
[]
no_license
PabloGauna/SuperHoy
7144719a9e13c00da965a3354119097af2d7cec8
70873d13ed8611f30b019ac22e6cc560f12ccdc4
refs/heads/master
2020-06-08T18:03:48.317800
2019-07-03T02:32:25
2019-07-03T02:32:25
193,278,296
0
0
null
null
null
null
UTF-8
Java
false
false
734
java
package models; public class Item { private int id; public int getId() { return id; } private String descripcion; private float precio; private String foto; public Item(int itemId, String itemDescripcion, float itemPrecio, String itemFoto) { super(); id = itemId; descripcion = itemDescripcion; precio = itemPrecio; foto = itemFoto; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public float getPrecio() { return precio; } public void setPrecio(float precio) { this.precio = precio; } public String getFoto() { return foto; } public void setFoto(String foto) { this.foto = foto; } }
[ "pablo.gauna@outlook.com.ar" ]
pablo.gauna@outlook.com.ar
d64458811e78323558fa16fb290c38f629178bde
5a76688b22768e3a6cb71eef6f6283ae4ce710e8
/ObjectOrientedPrinciples/src/com/qa/unicorn/Unicorn.java
beac3a89aacef06e4fcf44af347df960ad5e530d
[]
no_license
solomonboundy1/JavaReposQA
7778f2ba17987f426cb0d279f57867391abb1752
a865422d8e825e46380a8c56ca6dddfd5008cf2a
refs/heads/main
2023-08-24T07:12:02.929150
2021-10-21T09:05:00
2021-10-21T09:05:00
414,130,080
0
0
null
null
null
null
UTF-8
Java
false
false
992
java
package com.qa.unicorn; import com.qa.mythological.MythologicalCreature; // We need to specify that Unicorn inherits Mythological Creature public class Unicorn extends MythologicalCreature { private int hornSize; private boolean wings; private String colour; public Unicorn(int hornSize, boolean wings, String colour) { super(); this.hornSize = hornSize; this.wings = wings; this.colour = colour; } // Over ride the magicPower method // Override here is optional, but good practice for devs to know it is being overridden @Override public String magicPower() { return "*sparkles* neeeeiiiggghhhhh"; } public int getHornSize() { return hornSize; } public void setHornSize(int hornSize) { this.hornSize = hornSize; } public boolean isWings() { return wings; } public void setWings(boolean wings) { this.wings = wings; } public String getColour() { return colour; } public void setColour(String colour) { this.colour = colour; } }
[ "solomonboundy2017@gmail.com" ]
solomonboundy2017@gmail.com
4a7d086c63339f588cea3eb914d4bd4977e085cc
1725d222de24eac0c38de00d3b00d5f27b87c38d
/ my-tel-util/MHub.Lib/src/com/szxys/mhub/base/communication/webservice/WebUtils.java
389d49912ce21f2e41b7120dc347e6e3508a0dd3
[]
no_license
flyfire/my-tel-util
76e7776e3777056f50a59d9105e5e90d1db851b2
837149c71819272313c1367a09b29509ebd8522f
refs/heads/master
2021-01-10T11:42:08.005663
2014-02-19T05:55:31
2014-02-19T05:55:31
46,967,698
0
0
null
null
null
null
UTF-8
Java
false
false
4,928
java
package com.szxys.mhub.base.communication.webservice; import java.nio.ByteBuffer; /** * 工具类,用来提供字节序转换等操作工具 * * @author sujinyi **/ public class WebUtils { /** * 将short转为低字节在前,高字节在后的byte数组,向web端上传输数据时使用 * * @param n * short * @return byte[] */ public static byte[] toLH(short n) { byte[] b = new byte[2]; b[0] = (byte) (n & 0xff); b[1] = (byte) (n >> 8 & 0xff); return b; } /** * 将short转为高字节在前,低字节在后的byte数组,接收web端数据时使用 * * @param n * short * @return byte[] */ public static byte[] toHH(short n) { byte[] b = new byte[2]; b[1] = (byte) (n & 0xff); b[0] = (byte) (n >> 8 & 0xff); return b; } /** * 将int转为低字节在前,高字节在后的byte数组,向web端上传输数据时使用 * * @param n * int * @return byte[] */ public static byte[] toLH(int n) { byte[] b = new byte[4]; b[0] = (byte) (n & 0xff); b[1] = (byte) (n >> 8 & 0xff); b[2] = (byte) (n >> 16 & 0xff); b[3] = (byte) (n >> 24 & 0xff); return b; } /** * 将int转为高字节在前,低字节在后的byte数组,接收web端数据时使用 * * @param n * int * @return byte[] */ public static byte[] toHH(int n) { byte[] b = new byte[4]; b[3] = (byte) (n & 0xff); b[2] = (byte) (n >> 8 & 0xff); b[1] = (byte) (n >> 16 & 0xff); b[0] = (byte) (n >> 24 & 0xff); return b; } /** * 将低字节数组转换为int,接收web端数据时使用 * * @param byte[] * @return int */ public static int lBytesToInt(byte[] b) { int s = 0; for (int i = 0; i < 3; i++) { if (b[3 - i] >= 0) { s = s + b[3 - i]; } else { s = s + 256 + b[3 - i]; } s = s * 256; } if (b[0] >= 0) { s = s + b[0]; } else { s = s + 256 + b[0]; } return s; } /** * 将byte数组中的元素倒序排列 * * @param b * :需要转序的字节数组 * @return byte[] :转换后的字节数组 */ public static byte[] bytesReverseOrder(byte[] b) { int length = b.length; byte[] result = new byte[length]; for (int i = 0; i < length; i++) { result[length - i - 1] = b[i]; } return result; } /** * 将byte数组中的元素倒序排列 * * @param l * :需要转序的long * @return byte[] :转换后的字节数组 */ public static byte[] longReverseOrder(long l) { byte[] bytes = new byte[8]; ByteBuffer byteBuffer = ByteBuffer.allocate(8); byteBuffer.putLong(l); bytes = bytesReverseOrder(byteBuffer.array()); return bytes; } /** * 高字节数组到short的转换 * @param b byte[] * @return short */ public static short hBytesToShort(byte[] b) { int s = 0; if (b[0] >= 0) { s = s + b[0]; } else { s = s + 256 + b[0]; } s = s * 256; if (b[1] >= 0) { s = s + b[1]; } else { s = s + 256 + b[1]; } short result = (short)s; return result; } /** * 低字节数组到short的转换 * @param b byte[] * @return short */ public static short lBytesToShort(byte[] b) { int s = 0; if (b[1] >= 0) { s = s + b[1]; } else { s = s + 256 + b[1]; } s = s * 256; if (b[0] >= 0) { s = s + b[0]; } else { s = s + 256 + b[0]; } short result = (short)s; return result; } public static int getInt(byte[] bb, int index) { return (int) ((((bb[index + 0] & 0xff) << 24) | ((bb[index + 1] & 0xff) << 16) | ((bb[index + 2] & 0xff) << 8) | ((bb[index + 3] & 0xff) << 0))); } public static int getReverseBytesInt(byte[] bb, int index) { return (int) ((((bb[index + 3] & 0xff) << 24) | ((bb[index + 2] & 0xff) << 16) | ((bb[index + 1] & 0xff) << 8) | ((bb[index + 0] & 0xff) << 0))); } public static long getLong(byte[] bb, int index) { return ((((long) bb[index + 0] & 0xff) << 56) | (((long) bb[index + 1] & 0xff) << 48) | (((long) bb[index + 2] & 0xff) << 40) | (((long) bb[index + 3] & 0xff) << 32) | (((long) bb[index + 4] & 0xff) << 24) | (((long) bb[index + 5] & 0xff) << 16) | (((long) bb[index + 6] & 0xff) << 8) | (((long) bb[index + 7] & 0xff) << 0)); } public static long getReverseBytesLong(byte[] bb, int index) { return ((((long) bb[index + 7] & 0xff) << 56) | (((long) bb[index + 6] & 0xff) << 48) | (((long) bb[index + 5] & 0xff) << 40) | (((long) bb[index + 4] & 0xff) << 32) | (((long) bb[index + 3] & 0xff) << 24) | (((long) bb[index + 2] & 0xff) << 16) | (((long) bb[index + 1] & 0xff) << 8) | (((long) bb[index + 0] & 0xff) << 0)); } }
[ "TOMCAT.YANG@gmail.com" ]
TOMCAT.YANG@gmail.com
482fb9340132ca27547a2602ed0c0a898ec87a5c
b965692e5f6482d9e3d626bce348429104bf717d
/EmailClient/Client/MainWindow.java
1a4ebb7e35dffa7811c5ba4cb07987a56b3f9af5
[]
no_license
georgeciobanu/computernetworkslab
2d4ca6732bc24db08e1fc9d458873437b70ba46d
c07eebf4370bdd0234b9d7e67d52fa4f3e2be67a
refs/heads/master
2016-09-06T06:52:35.046987
2009-02-20T03:14:02
2009-02-20T03:14:02
41,826,431
0
0
null
null
null
null
UTF-8
Java
false
false
14,494
java
import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.net.Socket; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.text.Position.Bias; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; import common.Email; import common.Folder; import common.MessageTypes; import common.ObjectSender; import common.myContainer; /** * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI * Builder, which is free for non-commercial use. If Jigloo is being used * commercially (ie, by a corporation, company or business for any purpose * whatever) then you should purchase a license for each developer using Jigloo. * Please visit www.cloudgarden.com for details. Use of Jigloo implies * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR * ANY CORPORATE OR COMMERCIAL PURPOSE. */ public class MainWindow extends javax.swing.JDialog { private JPanel jPanel1; private JButton NewFolderButton; private JButton MoveMessageButton; private JButton DeleteFolderButton; private JButton ComposeButton; private JTable EmailTable; private JTree FolderTree; private JPanel jPanel3; private JPanel jPanel2; private Socket toGateway = null; private Folder[] folders = null; private Email[] emails = null; private String SMTPuser, SMTPhost; private String SMTPport; /** * Auto-generated main method to display this JDialog */ public MainWindow(JFrame frame, Socket socket, String SMTPHost, String SMTPUser, String SMTPPort) { super(); toGateway = socket; SMTPuser = SMTPUser; SMTPhost = SMTPHost; SMTPport = SMTPPort; initGUI(); refreshData(); } private void refreshData() { // rebuild the gui based on received data getDataFromGateway(); DefaultMutableTreeNode top = new DefaultMutableTreeNode(folders[0]); GenerateTree(folders, top); FolderTree = new JTree(top); jPanel1.add(FolderTree, BorderLayout.CENTER); FolderTree.setPreferredSize(new java.awt.Dimension(186, 316)); FolderTree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent evt) { FolderTreeValueChanged(evt); } }); String[] columns = { "Number", "Subject", "From", "Date" }; EmailTable.setModel(new DefaultTableModel(parseEmailList(emails, "Inbox"), columns)); EmailTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { EmailTableMouseClicked(evt); } }); TableModel model = new DefaultTableModel( parseEmailList(emails, "Inbox"), columns) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; EmailTable.setModel(model); } private void createNode(DefaultMutableTreeNode top, String[] path, int pos, Folder folder) { int i = 0; if (((Folder) (top.getUserObject())).toString().equalsIgnoreCase( path[path.length - 2])) { DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(folder); top.add(newNode); return; } else { for (i = 0; i < top.getChildCount(); i++) { if (((Folder) ((DefaultMutableTreeNode) top.getChildAt(i)) .getUserObject()).toString().equalsIgnoreCase( path[pos + 1])) break; } if (i < top.getChildCount()) createNode((DefaultMutableTreeNode) top.getChildAt(i), path, pos + 1, folder); } } private DefaultMutableTreeNode GenerateTree(Folder[] folders, DefaultMutableTreeNode top) { for (int i = 1; i < folders.length; i++) { DefaultMutableTreeNode newNode = new DefaultMutableTreeNode( folders[i]); String[] path = folders[i].getFldName().split("[.]"); // Need to add info to path elements for (int j = 0; j < path.length; j++) { for (int k = 0; k < folders.length; k++) { if (folders[k].getFolderSimplename().equals(path[j])) { path[j] = folders[k].toString(); break; } } } createNode(top, path, 0, folders[i]); } return top; } private String[][] parseEmailList(Email[] emailList, String folder) { if (emailList == null) return new String[1][1]; String[][] emails = new String[emailList.length][4]; for (int i = 0; i < emailList.length; i++) { if (emailList[i] != null) { if (emailList[i].isDeleted() == false) { emails[i][0] = emailList[i].getEmailNumber().toString(); emails[i][1] = emailList[i].getSubject(); // TODO: Use the stuff Saleh added here if (folder == "Sent") { emails[i][2] = emailList[i].getTo(); } else { emails[i][2] = emailList[i].getFrom().toString(); } if (emailList[i].getDate()!= null) emails[i][3] = emailList[i].getDate().toString(); } } } return emails; } private void getDataFromGateway() { // send the request for the list of folders String[] command = { "GET_FOLDER_LIST" }; ObjectSender.SendObject(command, MessageTypes.CLIENT_COMMAND, getToGateway()); myContainer container = ObjectSender.WaitForObject(getToGateway()); if (container.getMsgType() == MessageTypes.FOLDER_LIST) { folders = (Folder[]) container.getPayload(); } int length = folders.length-1; Folder [] tmpFolders = new Folder[folders.length]; for (int i = 0; i < folders.length; i++){ tmpFolders[i] = folders[length-i]; } folders = tmpFolders; command = new String[] { "GET_EMAIL_LIST", "INBOX" }; ObjectSender.SendObject(command, MessageTypes.CLIENT_COMMAND, getToGateway()); myContainer container2 = ObjectSender.WaitForObject(getToGateway()); if (container2.getMsgType() == MessageTypes.MESSAGE_LIST) { emails = (Email[]) container2.getPayload(); } // else throw new IOException(); } private void initGUI() { try { { getContentPane().setLayout(null); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { thisWindowClosing(evt); } }); } { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); getContentPane().add(jPanel1); jPanel1.setBounds(0, 37, 186, 316); jPanel1.setLayout(jPanel1Layout); { // FolderTree = new JTree(); // jPanel1.add(FolderTree, BorderLayout.CENTER); // FolderTree.setPreferredSize(new java.awt.Dimension(186, // 316)); } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); getContentPane().add(jPanel2); jPanel2.setBounds(186, 37, 418, 316); jPanel2.setLayout(jPanel2Layout); { TableModel jTable1Model = new DefaultTableModel( new String[][] { { "One", "Two" }, { "Three", "Four" } }, new String[] { "Column 1", "Column 2" }); EmailTable = new JTable(); jPanel2.add(EmailTable, BorderLayout.CENTER); EmailTable.setModel(jTable1Model); EmailTable .setPreferredSize(new java.awt.Dimension(418, 316)); } } { jPanel3 = new JPanel(); FlowLayout jPanel3Layout = new FlowLayout(); jPanel3Layout.setAlignment(FlowLayout.LEFT); getContentPane().add(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3.setBounds(0, 0, 604, 31); { ComposeButton = new JButton(); jPanel3.add(ComposeButton); ComposeButton.setText("Compose"); ComposeButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { ComposeButtonMouseClicked(evt); } }); } { NewFolderButton = new JButton(); jPanel3.add(NewFolderButton); NewFolderButton.setText("New Folder"); NewFolderButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { NewFolderButtonMouseClicked(evt); } }); } { DeleteFolderButton = new JButton(); jPanel3.add(DeleteFolderButton); DeleteFolderButton.setText("Delete Folder"); DeleteFolderButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { DeleteFolderButtonMouseClicked(evt); } }); } { MoveMessageButton = new JButton(); jPanel3.add(MoveMessageButton); MoveMessageButton.setText("Move Message"); MoveMessageButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { MoveMessageButtonMouseClicked(evt); } }); } } this.setSize(612, 387); } catch (Exception e) { e.printStackTrace(); } } public Socket getToGateway() { return toGateway; } public void setToGateway(Socket gateway) { toGateway = gateway; } private void EmailTableMouseClicked(MouseEvent evt) { if (evt.getClickCount() > 1) {// double click String[] command = { "GET_EMAIL", EmailTable.getValueAt(EmailTable.getSelectedRow(), 0) .toString() }; ObjectSender.SendObject(command, MessageTypes.CLIENT_COMMAND, getToGateway()); myContainer container = ObjectSender.WaitForObject(getToGateway()); if (container.getMsgType() == MessageTypes.MESSAGE) { ViewMessageDialog messageBody = new ViewMessageDialog(null, EmailTable.getValueAt(EmailTable.getSelectedRow(), 1) .toString(), (Email) container.getPayload()); messageBody.setModalityType(ModalityType.APPLICATION_MODAL); messageBody.setVisible(true); } } } private void thisWindowClosing(WindowEvent evt) { System.out.println("this.windowClosing, event=" + evt); System.exit(0); } private void FolderTreeValueChanged(TreeSelectionEvent evt) { System.out.println("FolderTree.valueChanged, event=" + evt); if ((TreePath) evt.getNewLeadSelectionPath() == null) return; DefaultMutableTreeNode currentNode = ((DefaultMutableTreeNode) evt .getNewLeadSelectionPath().getLastPathComponent()); Folder current = (Folder) currentNode.getUserObject(); String[] command = { "GET_EMAIL_LIST", current.getFldName() }; ObjectSender.SendObject(command, MessageTypes.CLIENT_COMMAND, getToGateway()); myContainer container2 = ObjectSender.WaitForObject(getToGateway()); if (container2.getMsgType() == MessageTypes.MESSAGE_LIST) { emails = (Email[]) container2.getPayload(); } String[] columns = { "Number", "Subject", "From", "Date" }; TableModel model = new DefaultTableModel( parseEmailList(emails, "Inbox"), columns) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; EmailTable.setModel(model); } private void ComposeButtonMouseClicked(MouseEvent evt) { System.out.println("ComposeButton.mouseClicked, event=" + evt); ComposeDialog compose = new ComposeDialog(null, getToGateway(), SMTPhost, SMTPuser, SMTPport); compose.setModal(true); compose.setVisible(true); } private void NewFolderButtonMouseClicked(MouseEvent evt) { System.out.println("NewFolderButton.mouseClicked, event=" + evt); if (FolderTree.getSelectionCount() != 1) { JOptionPane.showMessageDialog(null, "Please select only one parent folder"); } else { String name = JOptionPane .showInputDialog("Please enter the folder name"); String path = ((Folder) ((DefaultMutableTreeNode) FolderTree .getSelectionPath().getLastPathComponent()).getUserObject()) .getFldName() + "." + name; String[] command = new String[] { "CREATE_FOLDER", path }; ObjectSender.SendObject(command, MessageTypes.CLIENT_COMMAND, getToGateway()); myContainer container = ObjectSender.WaitForObject(getToGateway()); if (container.getMsgType() == MessageTypes.CONFIRMATION_OK) { getDataFromGateway(); DefaultMutableTreeNode top = ((DefaultMutableTreeNode) FolderTree .getModel().getRoot()); top.removeAllChildren(); GenerateTree(folders, top); ((DefaultTreeModel) FolderTree.getModel()).reload(top); } else JOptionPane.showMessageDialog(null, "Could not create folder"); } } private void DeleteFolderButtonMouseClicked(MouseEvent evt) { System.out.println("NewFolderButton.mouseClicked, event=" + evt); if (FolderTree.getSelectionCount() != 1) { JOptionPane.showMessageDialog(null, "Please select only one parent folder"); } else { String path = ((Folder) ((DefaultMutableTreeNode) FolderTree .getSelectionPath().getLastPathComponent()).getUserObject()) .getFldName(); String[] command = new String[] { "DELETE_FOLDER", path }; ObjectSender.SendObject(command, MessageTypes.CLIENT_COMMAND, getToGateway()); myContainer container = ObjectSender.WaitForObject(getToGateway()); if (container.getMsgType() == MessageTypes.CONFIRMATION_OK) { getDataFromGateway(); DefaultMutableTreeNode top = ((DefaultMutableTreeNode) FolderTree .getModel().getRoot()); top.removeAllChildren(); GenerateTree(folders, top); ((DefaultTreeModel) FolderTree.getModel()).reload(top); } else JOptionPane.showMessageDialog(null, "Could not create folder"); } } private void MoveMessageButtonMouseClicked(MouseEvent evt) { System.out.println("MoveMessageButton.mouseClicked, event=" + evt); if (EmailTable.getSelectedRowCount() == 1) { String selectedEmail = (String) EmailTable.getValueAt(EmailTable .getSelectedRow(), 0); if (((TreePath) FolderTree.getSelectionPath() == null)) return; String emailPath = ((Folder) ((DefaultMutableTreeNode) FolderTree .getSelectionPath().getLastPathComponent()).getUserObject()) .getFldName(); MoveEmailDialog moveEmail = new MoveEmailDialog(null, (String) EmailTable.getValueAt(EmailTable.getSelectedRow(), 0), emailPath, (DefaultMutableTreeNode) FolderTree .getModel().getRoot(), toGateway); // moveEmail.setModal(true); moveEmail.setVisible(true); } else JOptionPane.showMessageDialog(null, "Please select ONE message first"); } }
[ "geo.ciobanu@1f5ead6c-f651-11dd-9d1d-173cc1d06e3c" ]
geo.ciobanu@1f5ead6c-f651-11dd-9d1d-173cc1d06e3c
6e76633291994611bfc7480caf63a7f0767077e2
eddddc17e87455790a7ed090b66dd96a2267fc09
/android-fragments/app/src/main/java/net/sgoliver/android/fragments/DetalleActivity.java
01e2f9098674b7d508b528162dd0121fdc6cd7a1
[]
no_license
admjc02/curso-android-src-as
673a0e4ed29d543bfb37c9232928b36fee4cb3c0
6eff95796b3e1d0bed9aa7fef2d398aab9709148
refs/heads/master
2022-03-10T14:37:07.648993
2022-03-08T03:30:55
2022-03-08T03:30:55
93,887,846
0
0
null
2017-06-09T18:48:10
2017-06-09T18:48:10
null
UTF-8
Java
false
false
615
java
package net.sgoliver.android.fragments; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; public class DetalleActivity extends AppCompatActivity { public static final String EXTRA_TEXTO = "net.sgoliver.android.fragments.EXTRA_TEXTO"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detalle); FragmentDetalle detalle = (FragmentDetalle)getSupportFragmentManager() .findFragmentById(R.id.FrgDetalle); detalle.mostrarDetalle(getIntent().getStringExtra(EXTRA_TEXTO)); } }
[ "sgoliver.net@gmail.com" ]
sgoliver.net@gmail.com
fe221f5ed6cd09583c6703a6503a8a23a632962c
72f6bc5c0361106b75a5172747df7d5c5d1d3fc8
/examples/templatedesign/java/JasperTemplateDesignReport3.java
223784d343a50b6769bba3b55e854156e163a12c
[]
no_license
ghacupha/dynamicreports-documentation
58445512c43db6191bc07e9d0f2b29f8711a903f
e9c2ea5e5fcfa6daf30c72b640d062324d3dd680
refs/heads/master
2023-03-19T08:08:13.653814
2021-03-15T19:14:39
2021-03-15T19:14:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,941
java
/** * DynamicReports - Free Java reporting library for creating reports dynamically * * Copyright (C) 2010 - 2018 Ricardo Mariaca * http://www.dynamicreports.org * * This file is part of DynamicReports. * * DynamicReports is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * DynamicReports 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 DynamicReports. If not, see <http://www.gnu.org/licenses/>. */ package net.sf.dynamicreports.examples.templatedesign; import static net.sf.dynamicreports.report.builder.DynamicReports.*; import java.io.InputStream; import net.sf.dynamicreports.examples.Templates; import net.sf.dynamicreports.report.exception.DRException; import net.sf.jasperreports.engine.JRDataSource; import net.sf.jasperreports.engine.JREmptyDataSource; /** * @author Ricardo Mariaca (r.mariaca@dynamicreports.org) */ public class JasperTemplateDesignReport3 { public JasperTemplateDesignReport3() { build(); } private void build() { InputStream is = JasperTemplateDesignReport3.class.getResourceAsStream("templatedesign3.jrxml"); try { report() .setTemplateDesign(is) .title(Templates.createTitleComponent("JasperTemplateDesign3")) .setDataSource(createDataSource()) .show(); } catch (DRException e) { e.printStackTrace(); } } private JRDataSource createDataSource() { return new JREmptyDataSource(2); } public static void main(String[] args) { new JasperTemplateDesignReport3(); } }
[ "jan.moxter@innobix.com" ]
jan.moxter@innobix.com
3f4eea0e73d431b792654ec08d0db487b75f38ba
2763e3287c0824b6c9ead6eeec3acb65242da817
/src/view/client/devCardsPopUp/MonopolyController.java
37ca5fc537afc707be748d0551e35aa1086a8036
[]
no_license
ndrsllwngr/DichteFideleLurche
d14b6414afdc1d4e27d5de12fddee764bc6560bd
d25cd5150e0948d51ab5124fa2ed0ff0f57d229f
refs/heads/master
2020-04-20T01:46:44.705418
2019-02-05T10:01:29
2019-02-05T10:01:29
168,554,389
1
0
null
null
null
null
UTF-8
Java
false
false
1,233
java
package view.client.devCardsPopUp; import controller.Register; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.stage.Stage; import network.client.ClientWriter; import java.net.URL; import java.util.ResourceBundle; public class MonopolyController implements Initializable { @FXML ComboBox<String> comboResource; @FXML Button confirmButton; @Override public void initialize(URL location, ResourceBundle resources) { comboResource.getItems().addAll("Lumber", "Brick", "Grain", "Wool", "Ore"); } /** * if a resource is selected, monopolycard will be play. else: nothing will happen */ @FXML public void send(){ Register.getAudioClips().getClick().play(); if(!comboResource.getSelectionModel().isEmpty()){ Stage s = (Stage) confirmButton.getScene().getWindow(); new ClientWriter().sendMonopol(comboResource.getSelectionModel().getSelectedItem()); s.close(); } else { Stage s = (Stage) confirmButton.getScene().getWindow(); s.close(); } } }
[ "andreas.ellwanger@campus.lmu.de" ]
andreas.ellwanger@campus.lmu.de
5699f2d6982a4ff4bc011926da99f17b59e63363
1298857e666ff323a1fda20f8a96c3c33fa15744
/app/src/main/java/com/zhiyicx/zycx/sociax/adapter/SociaxListAdapter.java
3627b78c2e244e0ebc8eedf39f90bcd5e77ffdd6
[]
no_license
CatherineFXX/qingke-1
b4bdd246f22e6e7ba6577436fc26c6baa19ce098
6edf34e9a74672f120f9e81aa49ee88f93fb1063
refs/heads/master
2021-01-22T18:42:28.094627
2015-12-27T10:48:45
2015-12-27T10:48:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
26,711
java
package com.zhiyicx.zycx.sociax.adapter; import android.annotation.SuppressLint; import android.content.Context; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.Toast; import com.zhiyicx.zycx.R; import com.zhiyicx.zycx.net.NetComTools; import com.zhiyicx.zycx.sociax.android.Thinksns; import com.zhiyicx.zycx.sociax.android.ThinksnsAbscractActivity; import com.zhiyicx.zycx.sociax.api.ApiUsers; import com.zhiyicx.zycx.sociax.component.LoadingView; import com.zhiyicx.zycx.sociax.concurrent.Worker; import com.zhiyicx.zycx.sociax.exception.ApiException; import com.zhiyicx.zycx.sociax.exception.DataInvalidException; import com.zhiyicx.zycx.sociax.exception.ListAreEmptyException; import com.zhiyicx.zycx.sociax.exception.VerifyErrorException; import com.zhiyicx.zycx.sociax.modle.ListData; import com.zhiyicx.zycx.sociax.modle.Posts; import com.zhiyicx.zycx.sociax.modle.SociaxItem; import com.zhiyicx.zycx.sociax.unit.Anim; public abstract class SociaxListAdapter extends BaseAdapter { protected static final String TAG = "SociaxListAdapter"; protected ListData<SociaxItem> list; protected ThinksnsAbscractActivity context; protected LayoutInflater inflater; public static final int LIST_FIRST_POSITION = 0; protected static View refresh; protected static Worker thread; protected ActivityHandler handler; protected ResultHandler resultHander; protected static String Type; public static final int REFRESH_HEADER = 0; public static final int REFRESH_FOOTER = 1; public static final int REFRESH_NEW = 2; public static final int SEARCH_NEW = 3; public static final int UPDATA_LIST = 4; public static final int UPDATA_LIST_ID = 5; public static final int UPDATA_LIST_TYPE = 6; public static final int SEARCH_NEW_BY_ID = 7; public static final int PAGE_COUNT = 20; private static LoadingView loadingView; public static final int FAV_STATE = 8; protected boolean isSelectButtom; public boolean hasRefreshFootData; public boolean isHideFootToast = false; public boolean isShowToast = true; // 是否显示提示 public boolean isCleanAllData = false; // 是否清楚list中所有数据 public int lastNum; public String isRefreshActivity; public ImageView animView; public NetComTools mNetComTools; public int mHeadImageSize; //public ImageFetcher mHeadImageFetcher, mContentImageFetcher; private static final String IMAGE_CACHE_DIR = "thumbs"; private static final String CONTET_IMAGE_CACHE_DIR = "cthumbs"; public SociaxListAdapter(ThinksnsAbscractActivity context, ListData<SociaxItem> list) { this.list = list; this.context = context; this.inflater = LayoutInflater.from(context); try { refresh = this.context.getCustomTitle().getRight(); } catch (Exception e) { Log.d(TAG, "sociaxlistadapter construct method get rigth res of custom title error " + e.toString()); } SociaxListAdapter.thread = new Worker( (Thinksns) context.getApplicationContext(), Type + " Refresh"); handler = new ActivityHandler(thread.getLooper(), context); resultHander = new ResultHandler(); mHeadImageSize = context.getResources().getDimensionPixelSize(R.dimen.header_width_hight); mNetComTools = NetComTools.getInstance(context); } /** * List列表头部刷新 * * @param obj * @return * @throws VerifyErrorException * @throws ApiException * @throws ListAreEmptyException * @throws DataInvalidException */ public abstract ListData<SociaxItem> refreshHeader(SociaxItem obj) throws VerifyErrorException, ApiException, ListAreEmptyException, DataInvalidException; /** * List列表更多刷新 * * @param obj * @return * @throws VerifyErrorException * @throws ApiException * @throws ListAreEmptyException * @throws DataInvalidException */ public abstract ListData<SociaxItem> refreshFooter(SociaxItem obj) throws VerifyErrorException, ApiException, ListAreEmptyException, DataInvalidException; /** * List列表刷新 * * @param count * @return * @throws VerifyErrorException * @throws ApiException * @throws ListAreEmptyException * @throws DataInvalidException */ public abstract ListData<SociaxItem> refreshNew(int count) throws VerifyErrorException, ApiException, ListAreEmptyException, DataInvalidException; public ListData<SociaxItem> searchNew(String key) throws ApiException { return null; } ; public ListData<SociaxItem> searchNew(int key) throws ApiException { return null; } ; public ListData<SociaxItem> refreshNew(int count, String key) throws VerifyErrorException, ApiException, ListAreEmptyException, DataInvalidException { return null; } public ListData<SociaxItem> refreshNew(SociaxItem obj) throws VerifyErrorException, ApiException, ListAreEmptyException, DataInvalidException { return null; } public Object refresState(int key) throws ApiException { return null; } public Context getContext() { return this.context; } public SociaxItem getFirst() { return this.list.size() == 0 ? null : this.list .get(LIST_FIRST_POSITION); } public SociaxItem getLast() { return this.list.get(this.list.size() - 1); } @Override public int getCount() { return this.list.size(); } @Override public SociaxItem getItem(int position) { return this.list.get(position); } /** * 头部追加信息 * * @param list */ public void addHeader(ListData<SociaxItem> list) { if (null != list) { if (list.size() == 20) { this.list.clear(); this.list.addAll(list); // 修改适配器绑定的数组后 this.notifyDataSetChanged(); Toast.makeText(context, com.zhiyicx.zycx.R.string.refresh_success, Toast.LENGTH_SHORT).show(); } else if (list.size() == 0) { if (this.list.size() > 20) { ListData<SociaxItem> tempList = new ListData<SociaxItem>(); for (int i = 0; i < 20 - list.size(); i++) { tempList.add(this.list.get(i)); } this.list.clear(); this.list.addAll(tempList); } Toast.makeText(context, com.zhiyicx.zycx.R.string.refresh_error, Toast.LENGTH_SHORT).show(); } else { ListData<SociaxItem> tempList = new ListData<SociaxItem>(); for (int i = 0; i < 20 - list.size() && i < this.list.size(); i++) { tempList.add(this.list.get(i)); } this.list.clear(); for (int i = 1; i <= list.size(); i++) { this.list.add(0, list.get(list.size() - i)); } this.list.addAll(this.list.size(), tempList); // 修改适配器绑定的数组后 this.notifyDataSetChanged(); Toast.makeText(context, com.zhiyicx.zycx.R.string.refresh_success, Toast.LENGTH_SHORT).show(); } } } /** * 删除Item * * @param position */ public void deleteItem(int position) { if (list.size() > 0) this.list.remove(position - 1); this.notifyDataSetChanged(); } /** * 底部追加信息 * * @param list */ public void addFooter(ListData<SociaxItem> list) { if (null != list) { if (list.size() > 0) { hasRefreshFootData = true; this.list.addAll(list); lastNum = this.list.size(); this.notifyDataSetChanged(); } } if (list == null || list.size() == 0 || list.size() < 20) { context.getListView().hideFooterView(); } if (this.list.size() == 0 && isShowToast) { Toast.makeText(context, com.zhiyicx.zycx.R.string.refresh_error, Toast.LENGTH_SHORT).show(); } } public void changeListData(ListData<SociaxItem> list) { if (null != list) { if (list.size() > 0) { hasRefreshFootData = true; this.list = list; lastNum = this.list.size(); this.notifyDataSetChanged(); } } if (list == null || list.size() == 0 || list.size() < 20) { context.getListView().hideFooterView(); } if (this.list.size() == 0 && isShowToast) { Toast.makeText(context, com.zhiyicx.zycx.R.string.refresh_error, Toast.LENGTH_SHORT).show(); } } public void changeListDataNew(ListData<SociaxItem> list) { if (null != list) { if (list.size() > 0) { hasRefreshFootData = true; this.list = list; lastNum = this.list.size(); this.notifyDataSetChanged(); } else { this.list.clear(); this.notifyDataSetChanged(); } } if (list == null || list.size() == 0 || list.size() < 20) { context.getListView().hideFooterView(); } if (this.list.size() == 0) { Toast.makeText(context, com.zhiyicx.zycx.R.string.refresh_error, Toast.LENGTH_SHORT).show(); } } @Override public void notifyDataSetChanged() { super.notifyDataSetChanged(); } @Override public long getItemId(int position) { return position; } /** * 头部刷新 */ public void doRefreshHeader() { if (!((Thinksns) this.context.getApplicationContext()).isNetWorkOn()) { Toast.makeText(context, "网络设置不正确,请设置网络", Toast.LENGTH_SHORT).show(); context.getListView().headerHiden(); return; } SociaxListAdapter.thread = new Worker( (Thinksns) context.getApplicationContext(), Type + " Refresh"); handler = new ActivityHandler(thread.getLooper(), context); resultHander = new ResultHandler(); // 得到头部右部分 refresh = this.context.getCustomTitle().getRight(); if (refresh != null) { refresh.clearAnimation(); // 设置头部右边刷新 // Anim.refreshMiddle(context, refresh); if (null != isRefreshActivity && isRefreshActivity.equals("ThinksnsMyWeibo")) Anim.refresh( context, refresh, com.zhiyicx.zycx.R.drawable.spinner_black_60); if (null != isRefreshActivity && isRefreshActivity.equals("ThinksnsTopicActivity")) Anim.refresh( context, refresh, com.zhiyicx.zycx.R.drawable.spinner_black_60); if (null != isRefreshActivity && isRefreshActivity.equals("ThinksnsSiteList")) Anim.refresh( context, refresh, com.zhiyicx.zycx.R.drawable.spinner_black_60); refresh.setClickable(false); } context.getListView().headerRefresh(); context.getListView().headerShow(); Message msg = handler.obtainMessage(); /* * if(this.getFirst() == null){ msg.what = REFRESH_NEW; }else{ */ msg.obj = this.getFirst(); msg.what = REFRESH_HEADER; // } Log.d(TAG, "doRefreshHeader ....."); handler.sendMessage(msg); } public void doRefreshFooter() { if (!((Thinksns) this.context.getApplicationContext()).isNetWorkOn()) { Toast.makeText(context, "网络设置不正确,请设置网络", Toast.LENGTH_SHORT).show(); return; } SociaxListAdapter.thread = new Worker( (Thinksns) context.getApplicationContext(), Type + " Refresh"); handler = new ActivityHandler(thread.getLooper(), context); resultHander = new ResultHandler(); context.getListView().footerShow(); if (refresh != null) { // Anim.refreshMiddle(context, refresh); refresh.setClickable(false); } if (this.list.size() == 0) { return; } Message msg = handler.obtainMessage(); msg.obj = this.getLast(); msg.what = REFRESH_FOOTER; handler.sendMessage(msg); } protected void cacheHeaderPageCount() { ListData<SociaxItem> cache = new ListData<SociaxItem>(); for (int i = 0; i < PAGE_COUNT; i++) { cache.add(0, this.list.get(i)); } Thinksns.setLastWeiboList(cache); } public void refreshNewWeiboList() { if (refresh != null) { // 设置加载适配器的时候头部右边的动画 // Anim.refreshMiddle(context, refresh); if (null != isRefreshActivity && isRefreshActivity.equals("ThinksnsMyWeibo")) Anim.refresh( context, refresh, com.zhiyicx.zycx.R.drawable.spinner_black_60); refresh.setClickable(false); } Message msg = handler.obtainMessage(); msg.what = REFRESH_NEW; handler.sendMessage(msg); } public void doUpdataList() { Message msg = handler.obtainMessage(); msg.what = UPDATA_LIST; handler.sendMessage(msg); } public void doUpdataList(String type) { if (type.equals("taskCate")) { loadingView = (LoadingView) context.findViewById(LoadingView.ID); if (loadingView != null) loadingView.show((View) context.getListView()); if (context.getOtherView() != null) { loadingView.show(context.getOtherView()); } } Message msg = handler.obtainMessage(); msg.what = UPDATA_LIST; handler.sendMessage(msg); } public void doUpdataListById() { Message msg = handler.obtainMessage(); msg.what = UPDATA_LIST_ID; handler.sendMessage(msg); } public void doUpdataListByType(SociaxItem sociaxItem) { loadingView = (LoadingView) context.findViewById(LoadingView.ID); if (loadingView != null) loadingView.show((View) context.getListView()); if (context.getOtherView() != null) { loadingView.show(context.getOtherView()); } Message msg = handler.obtainMessage(); msg.obj = sociaxItem; msg.what = UPDATA_LIST_ID; handler.sendMessage(msg); } public void doSearchNew(String key) { Message msg = handler.obtainMessage(); msg.what = SEARCH_NEW; msg.obj = key; handler.sendMessage(msg); } public void doSearchNewById(int key) { Message msg = handler.obtainMessage(); msg.what = SEARCH_NEW_BY_ID; msg.arg1 = key; handler.sendMessage(msg); } public void updateState(int key) { Message msg = handler.obtainMessage(); msg.what = FAV_STATE; msg.arg1 = key; handler.sendMessage(msg); } private class ActivityHandler extends Handler { private Context context = null; public ActivityHandler(Looper looper, Context context) { super(looper); this.context = context; } @Override public void handleMessage(Message msg) { super.handleMessage(msg); ListData<SociaxItem> newData = null; Message mainMsg = new Message(); mainMsg.what = ResultHandler.ERROR; try { switch (msg.what) { case REFRESH_HEADER: newData = refreshHeader((SociaxItem) msg.obj); Log.d(TAG, "refresh header ...."); break; case REFRESH_FOOTER: newData = refreshFooter((SociaxItem) msg.obj); Log.d(TAG, "refresh footer ...."); break; case REFRESH_NEW: Log.d(TAG, "refresh new ...."); newData = refreshNew(PAGE_COUNT); break; case SEARCH_NEW: Log.d(TAG, "seache new ...."); newData = searchNew((String) msg.obj); break; case SEARCH_NEW_BY_ID: Log.d(TAG, "seache new ...."); newData = searchNew(msg.arg1); break; case UPDATA_LIST: Log.d(TAG, "updata list ...."); newData = refreshNew(PAGE_COUNT); break; case UPDATA_LIST_ID: Log.d(TAG, "updata list ...."); newData = refreshNew((SociaxItem) msg.obj); break; case UPDATA_LIST_TYPE: Log.d(TAG, "updata list ...."); newData = refreshNew((SociaxItem) msg.obj); break; case FAV_STATE: mainMsg.arg2 = ((Posts) (refresState(mId))).getFavorite(); break; } mainMsg.what = ResultHandler.SUCCESS; mainMsg.obj = newData; mainMsg.arg1 = msg.what; } catch (VerifyErrorException e) { Log.d("SociaxListAdapter class ", e.toString()); mainMsg.obj = e.getMessage(); } catch (ApiException e) { Log.d("SociaxListAdapter class ", e.toString()); mainMsg.what = 2; mainMsg.obj = e.getMessage(); } catch (ListAreEmptyException e) { Log.d("SociaxListAdapter class ", e.toString()); mainMsg.obj = e.getMessage(); } catch (DataInvalidException e) { Log.d("SociaxListAdapter class ", e.toString()); mainMsg.obj = e.getMessage(); } resultHander.sendMessage(mainMsg); } } @SuppressLint("HandlerLeak") private class ResultHandler extends Handler { private static final int SUCCESS = 0; private static final int ERROR = 1; public ResultHandler() { } @SuppressWarnings("unchecked") @Override public void handleMessage(Message msg) { context.getListView().setLastRefresh(System.currentTimeMillis()); if (msg.what == SUCCESS) { switch (msg.arg1) { case REFRESH_NEW: addFooter((ListData<SociaxItem>) msg.obj); Log.d(TAG, "refresh new load ...."); break; case REFRESH_HEADER: addHeader((ListData<SociaxItem>) msg.obj); context.getListView().headerHiden(); Log.d(TAG, "refresh header load ...."); break; case REFRESH_FOOTER: addFooter((ListData<SociaxItem>) msg.obj); context.getListView().footerHiden(); Log.d(TAG, "refresh heiden load ...."); break; case SEARCH_NEW: changeListDataNew((ListData<SociaxItem>) msg.obj); context.getListView().footerHiden(); Log.d(TAG, "refresh heiden load ...."); break; case SEARCH_NEW_BY_ID: changeListDataNew((ListData<SociaxItem>) msg.obj); context.getListView().footerHiden(); Log.d(TAG, "refresh heiden load ...."); break; case UPDATA_LIST: changeListData((ListData<SociaxItem>) msg.obj); context.getListView().footerHiden(); Log.d(TAG, "refresh heiden load ...."); break; case UPDATA_LIST_ID: changeListDataNew((ListData<SociaxItem>) msg.obj); context.getListView().footerHiden(); Log.d(TAG, "refresh heiden load ...."); break; case UPDATA_LIST_TYPE: changeListDataNew((ListData<SociaxItem>) msg.obj); context.getListView().footerHiden(); Log.d(TAG, "refresh heiden load ...."); break; case FAV_STATE: context.updateView(mUpdateView, msg.arg2); break; } } else { /*if (!isHideFootToast) Toast.makeText(context, (String) msg.obj, Toast.LENGTH_SHORT).show();*/ context.getListView().headerHiden(); context.getListView().footerHiden(); } Anim.cleanAnim(animView); // 清除动画 if (loadingView != null) loadingView.hide((View) context.getListView()); if (context.getOtherView() != null) { loadingView.hide(context.getOtherView()); } if (refresh != null) cleanRightButtonAnim(refresh); } } /** * 清除动画 * * @param v */ protected void cleanRightButtonAnim(View v) { v.setClickable(true); // v.setBackgroundResource(context.getCustomTitle().getRightResource()); v.clearAnimation(); } /** * 加载数据 */ public void loadInitData() { if (!((Thinksns) this.context.getApplicationContext()).isNetWorkOn()) { Toast.makeText(context, R.string.net_fail, Toast.LENGTH_SHORT) .show(); return; } if (this.getCount() == 0) { ListData<SociaxItem> cache = Thinksns.getLastWeiboList(); if (cache != null) { this.addHeader(cache); } else { loadingView = (LoadingView) context .findViewById(LoadingView.ID); if (loadingView != null) loadingView.show((View) context.getListView()); if (context.getOtherView() != null) { loadingView.show(context.getOtherView()); } refreshNewWeiboList(); } } } private int mId; private int mState; private View mUpdateView; public void loadInitData(View updateView, int id, int state) { if (!((Thinksns) this.context.getApplicationContext()).isNetWorkOn()) { Toast.makeText(context, R.string.net_fail, Toast.LENGTH_SHORT) .show(); return; } mId = id; mState = state; mUpdateView = updateView; if (this.getCount() == 0) { ListData<SociaxItem> cache = Thinksns.getLastWeiboList(); if (cache != null) { this.addHeader(cache); } else { loadingView = (LoadingView) context .findViewById(LoadingView.ID); if (loadingView != null) loadingView.show((View) context.getListView()); if (context.getOtherView() != null) { loadingView.show(context.getOtherView()); } refreshNewWeiboList(); updateState(mId); } } } public int getMyUid() { Thinksns app = thread.getApp(); return Thinksns.getMy().getUid(); } public ApiUsers getApiUsers() { Thinksns app = thread.getApp(); return app.getUsers(); } public int getMySite() { Thinksns app = thread.getApp(); if (Thinksns.getMySite() == null) { return 0; } else { return Thinksns.getMySite().getSite_id(); } } public void clearList() { if (list == null || list.isEmpty()) return; list.clear(); } /* public void initHeadImageFetcher() { int headImageSize = context.getResources().getDimensionPixelSize( R.dimen.header_width_hight); ImageCacheParams cacheParams = new ImageCacheParams(context, IMAGE_CACHE_DIR); // Set memory cache to 25% of mem class cacheParams.setMemCacheSizePercent(context, 0.25f); mHeadImageFetcher = new ImageFetcher(context, headImageSize); mHeadImageFetcher.setLoadingImage(R.drawable.header); mHeadImageFetcher.addImageCache(cacheParams); mHeadImageFetcher.setExitTasksEarly(false); } public void initContentImageFetcher() { int contentImageSize = 100; ImageCacheParams cacheParams = new ImageCacheParams(context, IMAGE_CACHE_DIR); ImageCacheParams contentCacheParams = new ImageCacheParams(context, CONTET_IMAGE_CACHE_DIR); // Set memory cache to 25% of mem class cacheParams.setMemCacheSizePercent(context, 0.25f); mContentImageFetcher = new ImageFetcher(context, contentImageSize); mContentImageFetcher.setLoadingImage(R.drawable.bg_loading); mContentImageFetcher.addImageCache(contentCacheParams); mContentImageFetcher.setExitTasksEarly(false); } */ }
[ "1465963174@qq.com" ]
1465963174@qq.com
8c1b73aaf2607ea920053de51fd3067a54292ffd
0b392be11abed1d17e72ff2f5a854b458787b9e1
/20200729_1차프로젝트(노크라임)/src/DAO.java
46d07b4cb187d54b916c7ccf7622ca11a55a4ddf
[]
no_license
SongminOh/java-study
726dd3bc57707196d5bc0d97e0aa522d8870b07e
15e58effbf6a4b19ac32ac3dffb8444fab34c951
refs/heads/master
2022-11-27T17:48:53.880625
2020-07-31T16:30:45
2020-07-31T16:30:45
284,075,047
0
0
null
null
null
null
UHC
Java
false
false
6,691
java
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; public class DAO { // 필드 ---> DAO클래스 전역에 닿을 수 있게 생성 private Connection conn = null; private PreparedStatement psmt = null; private ResultSet rs = null; // 데이터베이스와 연결하는 메소드 생성 private void getConnection() { String url = "jdbc:oracle:thin:@localhost:1521:xe"; String user = "kc"; String password = "kc"; try { // 1.드라이버 동적로딩 Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection(url, user, password); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } // 데이터베이스 자원을 반납하는 닫기 메소드 private void close() { try { if (rs != null) rs.close(); if (psmt != null) psmt.close(); if (conn != null) conn.close(); } catch (SQLException e) { e.printStackTrace(); } } // Database Access Object // 로그인 public VO login(VO vo) { try { getConnection(); String sql = "select pw from member where id = ? and pw = ?"; psmt = conn.prepareStatement(sql); psmt.setString(1, vo.getId()); psmt.setString(2, vo.getPw()); rs = psmt.executeQuery(); if (rs.next()) { String dbpw = rs.getString(1); if (dbpw.equals(vo.getPw())) { } else { vo = null; // 잘못된 비번 } } else { // 미등록 아이디 vo = null; } } catch (SQLException e) { e.printStackTrace(); } finally { close(); } return vo; } // 회원가입 메소드 public int insert(VO vo) { int cnt = 0; try { getConnection(); String sql = "insert into member values(?,?,?,?)"; psmt = conn.prepareStatement(sql); psmt.setString(1, vo.getId()); psmt.setString(2, vo.getPw()); psmt.setString(3, vo.getName()); psmt.setString(4, vo.getEmail()); cnt = psmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { close(); } return cnt; } // 회원정보 수정 메소드 public int update(updateVO updatevo) { int cnt = 0; try { getConnection(); if (updatevo.getclick().equals("password")) { String sql = "update member set pw = ? where id = ? and pw = ?"; psmt = conn.prepareStatement(sql); psmt.setString(1, updatevo.getNewPwEmail()); psmt.setString(2, updatevo.getId()); psmt.setString(3, updatevo.getPw()); } else if (updatevo.getclick().equals("email")) { String sql = "update member set email = ? where id = ? and pw = ?"; psmt = conn.prepareStatement(sql); psmt.setString(1, updatevo.getNewPwEmail()); psmt.setString(2, updatevo.getId()); psmt.setString(3, updatevo.getPw()); } else if(updatevo.getclick().equals("passwordemail")) { String sql = "update member set pw = ?, email = ? where id = ? and pw = ?"; psmt = conn.prepareStatement(sql); psmt.setString(1, updatevo.getNewPw()); psmt.setString(2, updatevo.getNewEmail()); psmt.setString(3, updatevo.getId()); psmt.setString(4, updatevo.getPw()); } cnt = psmt.executeUpdate(); // cnt ===> '영향을 받은 행의 개수' } catch (SQLException e) { e.printStackTrace(); } finally { close(); } return cnt; } // 회원정보 탈퇴 메소드 public int delete(VO vo) { int cnt = 0; try { getConnection(); String sql = "DELETE FROM member WHERE id = ? and pw = ?"; // ?자리에 id나pw 적으면 id,pw라는 문자열이 들어가는 것 psmt = conn.prepareStatement(sql); psmt.setString(1, vo.getId()); psmt.setString(2, vo.getPw()); cnt = psmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { close(); } return cnt; } // 메소드명 -> allSelect() // 리턴타입은 여러분들이 생각해보세요! // 내부에서 출력 x public ArrayList<VO> allSelect() { ArrayList<VO> list = new ArrayList<VO>(); try { getConnection(); String sql = "SELECT * FROM member"; psmt = conn.prepareStatement(sql); rs = psmt.executeQuery(); while (rs.next()) { String id = rs.getString(1); String pw = rs.getString(2); String name = rs.getString(3); String email = rs.getString(4); VO vo = new VO(id, pw, name, email); // 1~4가져와서 vo로 묶음 list.add(vo); // 리스트에 vo 담아서 } } catch (SQLException e) { e.printStackTrace(); } finally { close(); } // System.out.println(list.get(0).getId()); return list; // 반환해줌 } //제보테이블용 public ArrayList<tipoff_VO> allSelect1() { ArrayList<tipoff_VO> list = new ArrayList<tipoff_VO>(); try { getConnection(); String sql = "SELECT * FROM tip_info"; psmt = conn.prepareStatement(sql); rs = psmt.executeQuery(); while (rs.next()) { String tip_info_id = rs.getString(1); String cr_loc_id = rs.getNString(2); String cr_date = rs.getString(3); String cr_type_id = rs.getString(4); String evidence = rs.getString(5); String cr_name = rs.getString(6); tipoff_VO vo = new tipoff_VO(tip_info_id, cr_loc_id, cr_date, cr_type_id, evidence, cr_name); // 1~4가져와서 vo로 묶음 list.add(vo); // 리스트에 vo 담아서 } } catch (SQLException e) { e.printStackTrace(); } finally { close(); } return list; // 반환해줌 } //관리자의 회원강제탈퇴용 public int deleteMember(String id) { int cnt = 0; try { getConnection(); //드라이버 로딩 String sql = "DELETE FROM member WHERE id = ?"; // ?자리에 id나pw 적으면 id,pw라는 문자열이 들어가는 것 psmt = conn.prepareStatement(sql); // psmt.setString(1, id); //아이디만 가져와서 비교하면 되기때문) cnt = psmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { close(); } return cnt; } public int sending_tipoff(String tip_info_id, String cr_type_id, String cr_date,String cr_loc_id, String cr_name) { int cnt = 0; try { getConnection(); //드라이버 로딩 String sql = "INSERT INTO crime VALUES(?,?,?,?,?)"; // ?자리에 TIPOFF 테이블에 들어갈 제보정보 삽입 psmt = conn.prepareStatement(sql); // psmt.setString(1, cr_loc_id); psmt.setString(2, cr_date); psmt.setString(3, cr_type_id); psmt.setString(4, tip_info_id); psmt.setString(5, cr_name); cnt = psmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { close(); } return cnt; } }
[ "ohsong93@gmail.com" ]
ohsong93@gmail.com
a9474b1fe399921bc7a335c12f97c085d77f0f82
039b6cd3566b7c4bf706fd58901c16d92e86dedd
/workspace_for_wordpress_spring/adventurehunter-1/src/main/java/club/adventurehunter/repository/UserServiceRepository.java
ba4d383fc37606172c4429e62733d6b274d3858e
[]
no_license
shes6006/spring-adventurehunter
7b58071025337418eb86456ceeae01867cd15b0e
ca479d4d33a17da928733f4e8730de7f4e83f6dd
refs/heads/master
2023-05-23T16:30:21.586864
2021-06-16T04:34:38
2021-06-16T04:34:38
377,047,571
0
0
null
null
null
null
UTF-8
Java
false
false
1,117
java
package club.adventurehunter.repository; import java.util.Optional; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import club.adventurehunter.domain.UserBean; @Service @Transactional public class UserServiceRepository { @Autowired private UserRepository CustomerRepository = null; // private CustomerDAO customerDao = null; public UserBean login(String username, String password) { Optional<UserBean> optional = CustomerRepository.findById(username); if (optional.isEmpty()) { UserBean bean = optional.get(); //從optional拿出bean if (password != null && password.length() != 0) { String pass = bean.getUser_pass(); if (pass.equals(password)) { return bean; } } } return null; } public boolean changePassword(String username, String oldPassword, String newPassword) { UserBean bean = this.login(username, oldPassword); if (bean != null) { bean.setUser_pass(newPassword); bean = CustomerRepository.save(bean); return true; } return false; } }
[ "eoschu6006@gmail.com" ]
eoschu6006@gmail.com
fb5d6c6d18f3c84f59abc1ce5bff4509879c830d
ed506d4395488ac6e397f0e13ef99557c5439a94
/HealthCareApp/src/com/example/healthcareapp/model/QuestionnaireDetailsItem.java
41b2cf426ac14a2e59f0ab502f4b8ceb3efdf201
[]
no_license
4nakin/Healthcare-App
452f7ce7b46b5e461378be57fdc186e30434e18d
7b92fd5dc847afa134f6e0cb9f64b444770d78db
refs/heads/master
2021-01-22T10:18:51.989116
2013-09-25T17:06:39
2013-09-25T17:06:39
13,920,473
0
1
null
null
null
null
UTF-8
Java
false
false
1,637
java
package com.example.healthcareapp.model; public class QuestionnaireDetailsItem { public static final int NORMAL = 0; public static final int EDITABLE = 1; private int mQuestionID; private String mQuestion; private int mType; private String mAnswerText; private boolean isTrue; public QuestionnaireDetailsItem() { } /** * * @param mQuestionID */ public QuestionnaireDetailsItem(int mQuestionID) { super(); this.mQuestionID = mQuestionID; } /** * @return the mQuestionID */ public int getQuestionID() { return mQuestionID; } /** * @param mQuestionID the mQuestionID to set */ public void setQuestionID(int mQuestionID) { this.mQuestionID = mQuestionID; } /** * @return the mQuestion */ public String getQuestion() { return mQuestion; } /** * @param mQuestion the mQuestion to set */ public void setQuestion(String mQuestion) { this.mQuestion = mQuestion; } /** * @return the mType */ public int getType() { return mType; } /** * @param mType the mType to set */ public void setType(int mType) { this.mType = mType; } /** * @return the isTrue */ public boolean isTrue() { return isTrue; } /** * @param isTrue the isTrue to set */ public void setTrue(boolean isTrue) { this.isTrue = isTrue; } /** * @return the mAnswerText */ public String getAnswerText() { return mAnswerText; } /** * @param mAnswerText the mAnswerText to set */ public void setAnswerText(String mAnswerText) { this.mAnswerText = mAnswerText; } }
[ "strider2023@gmail.com" ]
strider2023@gmail.com
1d3c7badf680f723155ca6d597e75a8f28dd420f
baaba7561bc1c13da46b6f79f7d8238d1707e115
/leetcode/src/leetcode/easy/Sqrt69.java
775b3dca1e35aafffe4c0405412b7016c8138b36
[]
no_license
winterthinklinux/AlgorithmForOffer
6e981509c1c63177288b0b494ba7c1d498ca245c
6caac75ef40f1d30f0914a22b2bf56e006d5a988
refs/heads/master
2021-01-19T22:27:17.138530
2017-05-04T08:19:24
2017-05-04T08:19:24
88,765,442
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package leetcode.easy; public class Sqrt69 { //Implement int sqrt(int x). //Compute and return the square root of x. public int mySqrt(int x) { return 0; } }
[ "2237075053@qq.com" ]
2237075053@qq.com
5bd540dfb4f74013a5a3931f79b41cc7c2e341be
af5e3e6f3b4cd2b5b9aeaa66374643f9e06342cb
/grain-search-web/src/test/java/com/only/grain/search/GrainSearchWebApplicationTests.java
0e9d5b8ff17c036315f15b6e7c801b62b49fac90
[]
no_license
only-ns/Grain
ec313360f5d4c23cd9c16e20166e013aa36f198c
442f71a78aa94c1530033f7371c81a20ab502e6f
refs/heads/master
2022-09-20T11:08:16.168531
2020-02-08T06:13:36
2020-02-08T06:13:36
228,981,651
0
0
null
2022-09-01T23:17:57
2019-12-19T05:28:26
CSS
UTF-8
Java
false
false
341
java
package com.only.grain.search; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @SpringBootTest @RunWith(SpringRunner.class) class GrainSearchWebApplicationTests { @Test void contextLoads() { } }
[ "1477336020@qq.com" ]
1477336020@qq.com
0173693536f111cd1afaee4b07791577f066c0e1
46fd49c0714d0a7777743b44e73223f61cee8a4e
/spring-boot-tests/spring-boot-ymbj-tests/spring-boot-autoconfig-order-tests/src/main/java/com/ymbj/autoconfig/annoorder/AnnoAutoConfiguration1.java
92c5f3d25a3bdd508673872fd6f9b9abf8bc01e7
[ "Apache-2.0" ]
permissive
Touchpeach/spring-boot-2.1.0.RELEASE
f7b6086f1a943d2c3c4e9e29487a16449b503634
29a7a8fbd248ba5d3ff39dcfe37decbb2f333a8f
refs/heads/master
2023-08-06T19:01:47.042281
2021-10-10T15:29:43
2021-10-10T15:29:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,299
java
package com.ymbj.autoconfig.annoorder; import com.ymbj.ordertest.autoconfig.annoorderbean.AutoConfigurationAnnoBean1; import com.ymbj.ordertest.autoconfig.annoorderbean.AutoConfigurationAnnoBean11; import org.springframework.boot.autoconfigure.AutoConfigureOrder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; /** * 1,AutoConfiguration1,AutoConfiguration2和ZAutoConfiguration跟MainApplication不在同一个package(包括子package), * 因此需要通过spring.factories配置方式通过spi方式来加载这些配置类 * 2, */ @AutoConfigureOrder(Ordered.LOWEST_PRECEDENCE) @Configuration public class AnnoAutoConfiguration1 { public AnnoAutoConfiguration1() { System.out.println("=========annoorder.AnnoAutoConfiguration1 Constructor============"); } @Bean public AutoConfigurationAnnoBean1 autoConfigurationAnnoBean1() { System.out.println("=========annoorder.AutoConfigurationAnnoBean1============"); return new AutoConfigurationAnnoBean1(); } @Bean public AutoConfigurationAnnoBean11 autoConfigurationAnnoBean11() { System.out.println("=========annoorder.AutoConfigurationAnnoBean11============"); return new AutoConfigurationAnnoBean11(); } }
[ "13570990660@163.com" ]
13570990660@163.com
18bf33fa6828e484f8eb08ad87ea337ff1297ac2
c3eaac04f8c9ed71f0b78f72addbc24227c9c38a
/addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/lessons_55/tests/GroupCreationTests.java
e76f1b53ef7dccc4ea197b9ded895e7634e4d0f8
[ "Apache-2.0" ]
permissive
freeitgroupe/qa_crm
cf4695ae9f59ba472ab484c4be4a68d9f883c0bf
8c83f8cea3cf0f3bbc2970019838bf4f66ac97a4
refs/heads/main
2023-04-19T22:40:51.911379
2021-04-27T20:45:31
2021-04-27T20:45:31
311,136,256
0
0
null
null
null
null
UTF-8
Java
false
false
2,101
java
package ru.stqa.pft.addressbook.lessons_55.tests; import org.testng.Assert; import org.testng.annotations.Test; import ru.stqa.pft.addressbook.lessons_55.model.GroupData; import ru.stqa.pft.addressbook.lessons_55.model.Groups; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; public class GroupCreationTests extends TestBase { //Тест для создания группы @Test public void testGroupCreation() throws Exception { //переход а страницу группы app.goTo().groupPage(); //список групп до создания теста Groups before = app.group().all(); //Создадим переменную типа GroupData GroupData group = new GroupData().withName("test4"); //создание группы app.group().create(group); //Список групп Groups after = app.group().all(); //Проверяем количество групп до и после создания теста Assert.assertEquals(after.size(), before.size() + 1); //Проверка assertThat(app.group().count(), equalTo(before.size()+1)); assertThat(after, equalTo( before.withAdded(group.withId(after.stream().mapToInt((g) -> g.getId()).max().getAsInt())))); } //Тест для создания группы @Test public void testBadGroupCreation() throws Exception { //переход а страницу группы app.goTo().groupPage(); //список групп до создания теста Groups before = app.group().all(); //Создадим переменную типа GroupData GroupData group = new GroupData().withName("test'"); //создание группы app.group().create(group); //Проверка предварительная assertThat(app.group().count(), equalTo(before.size())); //Список групп Groups after = app.group().all(); assertThat(after, equalTo(before)); } }
[ "freeitgroupe@gmail.com" ]
freeitgroupe@gmail.com
dd57ec9a631c94349ec69470848c7af4a436b9df
c4d1992bbfe4552ad16ff35e0355b08c9e4998d6
/releases/2.0.0RC/src/java/org/apache/poi/util/IOUtils.java
17fbfb46eb8c17a23651d1cfa6f915bb067d2735
[]
no_license
BGCX261/zkpoi-svn-to-git
36f2a50d2618c73e40f24ddc2d3df5aadc8eca30
81a63fb1c06a2dccff20cab1291c7284f1687508
refs/heads/master
2016-08-04T08:42:59.622864
2015-08-25T15:19:51
2015-08-25T15:19:51
41,594,557
0
1
null
null
null
null
UTF-8
Java
false
false
3,007
java
/* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ package org.apache.poi.util; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public final class IOUtils { private IOUtils() { // no instances of this class } /** * Reads all the data from the input stream, and returns the bytes read. */ public static byte[] toByteArray(InputStream stream) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[4096]; int read = 0; while (read != -1) { read = stream.read(buffer); if (read > 0) { baos.write(buffer, 0, read); } } return baos.toByteArray(); } /** * Helper method, just calls <tt>readFully(in, b, 0, b.length)</tt> */ public static int readFully(InputStream in, byte[] b) throws IOException { return readFully(in, b, 0, b.length); } /** * Same as the normal <tt>in.read(b, off, len)</tt>, but tries to ensure * that the entire len number of bytes is read. * <p> * If the end of file is reached before any bytes are read, returns -1. If * the end of the file is reached after some bytes are read, returns the * number of bytes read. If the end of the file isn't reached before len * bytes have been read, will return len bytes. */ public static int readFully(InputStream in, byte[] b, int off, int len) throws IOException { int total = 0; while (true) { int got = in.read(b, off + total, len - total); if (got < 0) { return (total == 0) ? -1 : total; } total += got; if (total == len) { return total; } } } /** * Copies all the data from the given InputStream to the OutputStream. It * leaves both streams open, so you will still need to close them once done. */ public static void copy(InputStream inp, OutputStream out) throws IOException { byte[] buff = new byte[4096]; int count; while ((count = inp.read(buff)) != -1) { if (count > 0) { out.write(buff, 0, count); } } } }
[ "you@example.com" ]
you@example.com
5323134c65b21a183132e444e0f21bc6bddc8ff5
18e32529e4ea89f331428610a19f0947db87ad0e
/mfLife/mfh-comn-android/src/main/java/com/mfh/comna/bizz/init/InitService.java
76cce4d4bb0f5240ec6ba3a635ca20c07a15e599
[]
no_license
Clearlove2015/mfh-app-framework
3487bec55fb0417fc975540188a7050646fbf74c
13805e789bd6ecfc877679d2b2e191eca24805b6
refs/heads/master
2021-05-10T16:27:45.441442
2015-09-19T13:22:30
2015-09-19T13:22:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,041
java
package com.mfh.comna.bizz.init; import android.content.Context; import com.mfh.comn.config.UConfig; import com.mfh.comn.upgrade.UpgradeConfigParseHelper; import com.mfh.comna.comn.database.dao.BaseDbDao; import com.mfh.comna.comn.logic.AsyncTaskCallBack; import com.mfh.comna.comn.logic.BaseService; import com.mfh.comna.comn.logic.DataSyncStrategy; import com.mfh.comna.comn.logic.ServiceFactory; import com.mfh.comna.network.NetFactory; import com.mfh.comna.network.NetStateService; import com.mfh.comna.comn.database.upgrade.SqlliteUpgradeSupport; import net.tsz.afinal.http.AjaxParams; /** * 系统初始化服务,所有启动时需要的检测和初始化工作放在此处 * * @author zhangyz created on 2013-5-9 * @since Framework 1.0 */ public class InitService extends BaseService { public static InitService getService(Context context) { return ServiceFactory.getService(InitService.class, context); } @Override protected Class getDaoClass() { return null; } @Override public DataSyncStrategy getDataSyncStrategy() { return null; } /** * 系统初始化过程 * @param context * @author zhangyz created on 2013-5-9 */ public void init (Context context) { ///data/data/<package name>/shares_prefs /*SharedPreferences sp = context.getSharedPreferences("itm.cfg.xml", Context.MODE_APPEND); System.out.println(sp.getString("itm.ip", "192.168.0.1")); Editor editor = sp.edit(); editor.putString("itm.ip", "localhost"); editor.commit();*/ NetStateService.registerReceiver(); checkDb(context); initOther(); } /** * 检测和初始化数据库 * * @author zhangyz created on 2013-5-7 */ protected void checkDb(Context context) { //com.dinsc.comn.utils.SyncUtil.copyDatabase(context, com.dins.itm.comn.Constants.DBNAME); String dbName = uconfig.getDomain(UConfig.CONFIG_COMMON).getString(UConfig.CONFIG_PARAM_DB_NAME, "mfh.db"); String dbPath = uconfig.getDomain(UConfig.CONFIG_COMMON).getString(UConfig.CONFIG_PARAM_DB_PATH);//"/storage/sdcard0/dinsItm" UpgradeConfigParseHelper helper = new UpgradeConfigParseHelper(); UConfig uc = uconfig.getDomain(UConfig.CONFIG_DBUPGRADE); SqlliteUpgradeSupport support = new SqlliteUpgradeSupport(); boolean bCreate = BaseDbDao.initDao(context, dbName, dbPath); if (bCreate) { helper.doDbUpdate(uc, support, bCreate); } else { helper.doDbUpdate(uc, support); } } /** * getSync可以在后台线程中调用; * 但get只需在UI主线程中调用,因为内部已经开启了其他子线程并采用了异步。 * * @author zhangyz created on 2013-5-15 */ protected void checkNetInBack() { AjaxParams params = new AjaxParams(); params.put("loginName", "sys"); params.put("pwd", "123456"); params.put("needXml", "true"); String ret = (String)NetFactory.getHttp().getSync("http://192.168.1.200:8080/glp/priv/queryUser.action",params); System.out.println(ret); } /** * 检查网络 * @param context */ public void checkNet(Context context) { AjaxParams params = new AjaxParams(); params.put("loginName", "sys"); params.put("pwd", "123456"); params.put("needXml", "true"); NetFactory.getHttp().get("http://192.168.1.200:8080/glp/priv/queryUser.action", params, new AsyncTaskCallBack<String>(context) { @Override protected void doSuccess(String rawValue) { System.out.println(rawValue); } }); } /** * 其他必要的初始化工作 * * @author zhangyz created on 2013-5-9 */ protected void initOther() { } }
[ "zhangzn@manfenjiayuan.com" ]
zhangzn@manfenjiayuan.com
6efba979627df714a09a1bb31da7679c5b35e496
bb22b860365e49d06b1e2ff279f1b1699413f19f
/CucumberAssessmentProject_JUNIT/src/main/java/pages/actions/HomePageActions.java
cc45c887169f07a4c300e13e7e262b1bde585666
[]
no_license
kamboj-swati/Automation-Project-Belong
3308c529b24fd3bb8d53df358f9fe45bd5ead025
f27a203cc83d23ff34a7945957d040e77e1e2f1b
refs/heads/master
2021-07-11T07:36:39.989790
2019-09-01T16:24:34
2019-09-01T16:24:34
205,691,671
0
0
null
2020-10-13T15:43:28
2019-09-01T14:56:26
Java
UTF-8
Java
false
false
894
java
package pages.actions; import org.junit.Assert; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.WebDriverWait; import pages.locators.HomePageLocator; import utils.SeleniumDriver; public class HomePageActions { HomePageLocator homePageLocator = null; /** constructor to initialize elements on Home page using Page factory pattern * @author Swati kamboj */ public HomePageActions() { this.homePageLocator = new HomePageLocator(); PageFactory.initElements(SeleniumDriver.getDriver(), homePageLocator); } /** Method to click on the SignIn button * @author Swati kamboj */ public void clickOnSignInLink() { homePageLocator.signInLink.click(); } }
[ "swati_ynr_27@yahoo.com" ]
swati_ynr_27@yahoo.com
611119e08ee8518ac2dd6d0c282d519408b5cd08
4604447e6662be9723054a2aa9fea8de1f6cb90b
/src/comp1110/homework/J02/SimpleInt.java
d1444aa9fb841617cbcab6e0f9bdad69cdec6134
[]
no_license
FelixWu111/comp1110-homework
06dbbebadcbe850f98c92eba03aeaef35840cf6e
b06e2a417681e0e99de0cd3145a8bb2514de8202
refs/heads/master
2023-01-24T09:14:51.111840
2018-09-18T02:36:51
2018-09-18T02:36:51
313,220,964
1
1
null
null
null
null
UTF-8
Java
false
false
295
java
package comp1110.homework.J02; public class SimpleInt { public static void main(String[] args) { int i = 0; System.out.println(i); i+=3; System.out.println(i); i*=2; System.out.println(i); i/=3; System.out.println(i); } }
[ "u6250866@anu.edu.au" ]
u6250866@anu.edu.au
361e58702ccc9f10aa99cb21f9ddda051736bf1c
574891841173b90c964531214ed75e7719f1c5d4
/hartke-core-lighting/src/main/java/ch/ethz/inf/vs/hypermedia/hartke/lighting/block/BulletinBoardFuture.java
cff77e5074952bde48ace321d01822ba6092c33d
[]
no_license
mkovatsc/iot-hypermedia
a458d13efe6ef7d0bf3b7f01b078ff11c3060fe8
c34801163871af525ed05580ca9e5a35b4248b40
refs/heads/master
2021-01-10T06:06:43.589404
2017-06-19T00:24:59
2017-06-19T00:24:59
53,579,618
1
1
null
null
null
null
UTF-8
Java
false
false
1,829
java
/******************************************************************************* * Copyright (c) 2016 Institute for Pervasive Computing, ETH Zurich. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.html. * * Contributors: * Matthias Kovatsch - creator and main architect * Yassin N. Hassan - architect and implementation * Klaus Hartke - CoRE Lighting specification *******************************************************************************/ package ch.ethz.inf.vs.hypermedia.hartke.lighting.block; import ch.ethz.inf.vs.hypermedia.hartke.lighting.model.BulletinBoard; import ch.ethz.inf.vs.hypermedia.hartke.lighting.model.ThingDescription; import java.util.Collection; import java.util.concurrent.ExecutionException; /** * Created by ynh on 26/09/15. */ public class BulletinBoardFuture extends CoREAppResourceFuture<BulletinBoard> { public Collection<ThingDescription> getThingDescriptions() throws ExecutionException, InterruptedException { return get().getEmbeddedStream("item", ThingDescription.class); } public ThingDescriptionFuture getThingByName(String name) { ThingDescriptionFuture thing = new ThingDescriptionFuture(); thing.addParent(this); thing.setPreProcess(() -> { ThingDescription item = getThingDescriptions() .stream() .sequential() .filter(x -> x.getName().equals(name)) .findFirst() .get(); thing.setFromSource(item, getUrl(), this); }); return thing; } }
[ "kovatsch@inf.ethz.ch" ]
kovatsch@inf.ethz.ch
6f3b0cc8ac42d81e55e2d2b60c0b584626d6ce0c
cbfc2857096eaaf9160896f7bb153c87b4cf3a24
/ramd-api/src/main/java/ramd/Checkable.java
eee898ef2888cefbaf02b004fa6be93f356b795d
[]
no_license
SevenYoung/ramd
0027c7ecd6262cc63c69120780b689d9bf4c88e2
afe3baee2653a7a17d09b3df0be760cf5dd98c25
refs/heads/master
2021-01-15T11:33:14.083929
2015-07-12T08:54:45
2015-07-12T08:54:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,099
java
package ramd; import java.lang.reflect.Method; public abstract class Checkable<C extends Checkable>{ /** * Verify the existence of certain method in this class. * @param mth method name. * @param prototype method's parameter types. * @return method object or null if there's no matching. */ public Method check(String mth, Class[] prototype) { for (Method m : this.getClass().getMethods()) { if (!m.getName().equals(mth)) continue; Class[] ptypes = m.getParameterTypes(); if (ptypes.length != prototype.length) continue; int i = 0; for (; i < ptypes.length; i++) if (!ptypes[i].isAssignableFrom(prototype[i])) break; if (i < ptypes.length) continue; return m; } return null; } /** * Provides a way to create a non-trivial instance through reflection. * Usage: CheckableClass ins = CheckableClass.newInstance().build() * @return created instance of class C */ abstract C build(); }
[ "waffle.bai@gmail.com" ]
waffle.bai@gmail.com
60277abe7666359100de2de3fba5d35c4123d974
de4eacce4af6021cf9213114091e5f6ea3639c88
/BinaryTree/HeightOfTree.java
f59f6d8efc490e9d80b122f02b238423b988daec
[]
no_license
ruhci28/DsAlgoJava
36f2bd0e33728af0d7485a453883ae9cf0d9a9d3
5bfbb15db8d325cb61a6c4435ab630a4a579ab33
refs/heads/main
2023-01-29T22:17:13.717946
2020-12-15T15:08:37
2020-12-15T15:08:37
300,815,737
0
0
null
null
null
null
UTF-8
Java
false
false
509
java
package BinaryTree; public class HeightOfTree { public static void main(String[] args) { BinaryTreeIntro tree = new BinaryTreeIntro(); tree.root = new Node(1); tree.root.left = new Node(2); tree.root.right = new Node(3); tree.root.left.left = new Node(4); tree.root.left.right = new Node(5); tree.root.left.right.left = new Node(6); tree.root.left.right.left.right = new Node(7); System.out.println(tree.height(tree.root)); } }
[ "59759735+ruhci28@users.noreply.github.com" ]
59759735+ruhci28@users.noreply.github.com
d2610f792ebe5d9ee9c283b01ccb3bdfd43462a9
87c3928a268110665a5bf18bbf84eb4251baad4d
/src/main/java/shop/ShopItem.java
690aa6e3612e286a8e2e665b7856c338ce4e70dd
[]
no_license
AK-UGlas/Odd_music_shop
e3dfa5840e5181a2b896f0f0b5a557f32d93b694
ff64587582016b4975db94b948d58d192c68ad4e
refs/heads/main
2023-06-04T15:33:10.117337
2021-06-21T07:53:00
2021-06-21T07:53:00
378,755,707
0
0
null
null
null
null
UTF-8
Java
false
false
565
java
package shop; import behaviours.ISell; public abstract class ShopItem implements ISell { private double buyingPrice; private double sellingPrice; public ShopItem(double buyingPrice, double sellingPrice) { this.buyingPrice = buyingPrice; this.sellingPrice = sellingPrice; } public double getBuyingPrice() { return buyingPrice; } public double getSellingPrice() { return sellingPrice; } public double calculateMarkup() { return this.getSellingPrice() - this.getBuyingPrice(); } }
[ "allenkelly278@gmail.com" ]
allenkelly278@gmail.com
43c0997074baaa00e5ecdc6f2cc7f96a785895d3
9dbee14bb2916b217f4dbaf84040a6eb88dabb03
/src/com/gmail/ptimofejev/SumTask.java
99f0687bce8f3f1873ac5d8e989edffb50182c7c
[]
no_license
VinnieJ-2k20/Homework62
1927c849879eb75006dbb6e51f8788d54eb38cc0
6afd43f5c4382597255f543fcab7d093f01b1057
refs/heads/master
2021-02-08T15:11:30.715917
2020-03-01T14:34:36
2020-03-01T14:34:36
244,164,612
0
0
null
null
null
null
UTF-8
Java
false
false
1,059
java
package com.gmail.ptimofejev; public class SumTask implements Runnable { private int[] numbers; private int startIndex; private int endIndex; private int sum; public SumTask(int[] numbers, int startIndex, int endIndex, int sum) { this.numbers = numbers; this.startIndex = startIndex; this.endIndex = endIndex; this.sum = sum; } public int[] getNumbers() { return numbers; } public void setNumbers(int[] numbers) { this.numbers = numbers; } public int getStartIndex() { return startIndex; } public void setStartIndex(int startIndex) { this.startIndex = startIndex; } public int getEndIndex() { return endIndex; } public void setEndIndex(int endIndex) { this.endIndex = endIndex; } public int getSum() { return sum; } public void setSum(int sum) { this.sum = sum; } @Override public void run() { for (int i = startIndex; i < endIndex; i++) { sum += numbers[i]; } System.out.println(Thread.currentThread().getName() + ": " + sum); } }
[ "60885495+VinnieJ-2k20@users.noreply.github.com" ]
60885495+VinnieJ-2k20@users.noreply.github.com
f12bd6d1992d490700d9d6c1d097f2e59398481a
ea08d24c6e3f4612d2297bf46af472ce3a3ca5f2
/src/main/java/com/ogc/standard/dto/req/XN629404Req.java
a5eb41c2cab63a7b7b412ed8f34fc4ca9d890f5a
[]
no_license
ibisTime/xn-sjd
22e1baeafe1655881247dd9681b0e4c332c0790e
a3646841fe6bebc644394b73ecf861a9f41d1af1
refs/heads/master
2020-03-29T04:52:11.346497
2018-12-21T04:26:10
2018-12-21T04:26:10
149,553,058
0
1
null
null
null
null
UTF-8
Java
false
false
1,087
java
package com.ogc.standard.dto.req; import org.hibernate.validator.constraints.NotBlank; /** * 上架预售产品 * @author: silver * @since: Nov 3, 2018 10:12:58 AM * @history: */ public class XN629404Req extends BaseReq { private static final long serialVersionUID = -6875342580769258538L; // 编号 @NotBlank private String code; // 位置 private String location; // 序号 @NotBlank private String orderNo; // 更新人 private String updater; public String getCode() { return code; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getOrderNo() { return orderNo; } public void setOrderNo(String orderNo) { this.orderNo = orderNo; } public String getUpdater() { return updater; } public void setUpdater(String updater) { this.updater = updater; } public void setCode(String code) { this.code = code; } }
[ "silver@192.168.1.168" ]
silver@192.168.1.168
71b7ea02dccb65f8157a7184abef54c521de482b
10ed26886054ca1f6a53cd28b1a05d72cf130f52
/app/src/main/java/com/forbitbd/automation/ui/signup/SignUpActivity.java
e82b9a71a962083c26a7c35a0f53b404b8e5ddfb
[]
no_license
sohel2178/Automation_Android
bc736785c29ca49460585f800c142a1dcb63a5f3
f0b2d27339a853cc88a11658a6152f5f38f617ec
refs/heads/master
2022-04-05T16:01:18.344869
2020-02-19T06:24:15
2020-02-19T06:24:15
229,426,738
0
0
null
null
null
null
UTF-8
Java
false
false
3,874
java
package com.forbitbd.automation.ui.signup; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.forbitbd.androidutils.utils.Constant; import com.forbitbd.androidutils.utils.PrebaseActivity; import com.forbitbd.automation.R; import com.forbitbd.automation.ui.login.dialog.DialogClickListener; import com.forbitbd.automation.ui.login.dialog.InfoDialog; import com.google.android.material.textfield.TextInputLayout; public class SignUpActivity extends PrebaseActivity implements View.OnClickListener,SignUpContract.View{ private TextView tvSignUp,tvLogin; private SignUpPresenter mPresenter; private TextInputLayout tiEmail,tiPassword; private EditText etEmail,etPassword; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_sign_up); mPresenter = new SignUpPresenter(this); initView(); } private void initView() { tvSignUp = findViewById(R.id.sign_up); tvLogin = findViewById(R.id.login); tvSignUp.setOnClickListener(this); tvLogin.setOnClickListener(this); etEmail = findViewById(R.id.email); etPassword = findViewById(R.id.password); tiEmail = findViewById(R.id.ti_email); tiPassword = findViewById(R.id.ti_password); } @Override public void onClick(View view) { switch (view.getId()){ case R.id.sign_up: String email = etEmail.getText().toString().trim(); String password = etPassword.getText().toString().trim(); boolean valid = mPresenter.validate(email,password); if(!valid){ return; } mPresenter.signUp(email,password); break; case R.id.login: startLoginActivity(); break; } } @Override public void clearPreError() { tiEmail.setErrorEnabled(false); tiPassword.setErrorEnabled(false); } @Override public void showErrorMessage(String message, int fieldId) { switch (fieldId){ case 1: etEmail.requestFocus(); tiEmail.setError(message); break; case 2: etPassword.requestFocus(); tiPassword.setError(message); break; } } @Override public void startLoginActivity() { onBackPressed(); } @Override public void showToast(String message, int type) { Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); } @Override public void showDialog() { showProgressDialog(); } @Override public void hideDialog() { hideProgressDialog(); } @Override public void showSignupSuceesDialog() { InfoDialog infoDialog =InfoDialog.getInstance(); Bundle bundle = new Bundle(); bundle.putString(Constant.CONTENT,"We send a verification mail to your Email. Please verify and then Login"); infoDialog.setListener(new DialogClickListener() { @Override public void positiveButtonClick() { SignUpActivity.this.onBackPressed(); } }); infoDialog.setArguments(bundle); infoDialog.show(getSupportFragmentManager(),"JJJJJ"); } @Override public void complete() { hideProgressDialog(); finish(); } }
[ "sohel.ahmed2178@gmail.com" ]
sohel.ahmed2178@gmail.com
99221a77124bd65137a2b9787e79da2d8d782a42
cd9a4b7fe22a29602cc88a30edd632cb5cb90b9c
/app/src/main/java/com/hades/example/android/resource/bitmap/three_level_cache/RecyclingImageView.java
49ce89a8cce878dd9446fd58aa4993c836619467
[ "Apache-2.0" ]
permissive
YingVickyCao/android-about-demos
3a843a1d9f1b73e447371f130051952ac220a6b1
76dba2f6fe93dc8d1e1c1545c1657c21711f48b9
refs/heads/main
2023-08-14T11:53:30.286509
2023-07-27T14:14:05
2023-07-27T14:14:05
212,703,639
0
0
Apache-2.0
2023-07-27T14:13:45
2019-10-03T23:57:08
Java
UTF-8
Java
false
false
1,167
java
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hades.example.android.resource.bitmap.three_level_cache; import android.content.Context; import android.util.AttributeSet; import android.widget.ImageView; public class RecyclingImageView extends ImageView { public RecyclingImageView(Context context) { super(context); } public RecyclingImageView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onDetachedFromWindow() { setImageDrawable(null); super.onDetachedFromWindow(); } }
[ "ying.vicky.cao@outlook.com" ]
ying.vicky.cao@outlook.com
58266ff86430713bbc5d4827de26acc7c0de2c29
eb330bd70cd53261c133b8863088f9821c3e215d
/src/main/java/ua/epam/spring/hometask/service/impl/EventServiceImpl.java
5ae9be0fe05d55cf19a37dec33dd76f9edd486c4
[]
no_license
dishwalla/Spring-core-HW3
823299850e5019f93075b128b1de387c6712db1e
94c72ac50b346c6aa8581eec89e807cbc861facb
refs/heads/master
2021-07-21T15:40:15.879478
2017-10-26T22:23:11
2017-10-26T22:23:11
108,471,688
0
0
null
null
null
null
UTF-8
Java
false
false
1,115
java
package ua.epam.spring.hometask.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ua.epam.spring.hometask.dao.EventRepository; import ua.epam.spring.hometask.domain.Event; import ua.epam.spring.hometask.service.EventService; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Collection; /** * Created by dish on 01.10.17. */ @Component public class EventServiceImpl implements EventService { @Autowired private EventRepository eventRepository; @Override public Event getByName(String name) { return eventRepository.getByName(name); } @Override public Event save(Event event) { return eventRepository.save(event); } @Override public void remove(Event event) { eventRepository.remove(event); } @Override public Event getById(Long id) { return eventRepository.getById(id); } @Override public Collection<Event> getAll() { return eventRepository.getAll(); } }
[ "dishwalla.freak@gmail.com" ]
dishwalla.freak@gmail.com
2cdb9f49c2efcc94c2031f64c043ebf41447ccbe
ba0735f1114703fbd76183fd7f47d580ac8ef92d
/qiyu-blog-springboot/src/main/java/com/luqiyu/qiyublogspringboot/controller/ChatRecordController.java
12c3bdb6e919609a884435cfc8a8687ae1d08160
[]
no_license
nobugplzzz/blog
0267cf676c3ea0ddf9c1a9123f5de9506a706c0d
8b3802bef6791ba65b8dca3ffb418f90e03d23eb
refs/heads/main
2023-05-30T04:20:24.899112
2021-06-22T08:36:54
2021-06-22T08:36:54
375,305,400
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package com.luqiyu.qiyublogspringboot.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * <p> * 前端控制器 * </p> * * @author luqiyu * @since 2021-06-20 */ @RestController @RequestMapping("/chatRecord") public class ChatRecordController { }
[ "316882012@qq.com" ]
316882012@qq.com
24e4fd62c7dccd482571336ebcc82f521b7a8377
39e0a6a9fa94bccf63710dd876b34cd76999c70e
/primefactors/v14/PrimeFactorsTest.java
2972787599c116a73e523c2879fd1b12db59257e
[]
no_license
hnlee/kata
d0eb6b30a17d309457059904282899e47cded324
9205ace590d864489b3a7aaf6cff888de05336f3
refs/heads/master
2020-05-21T16:43:13.536057
2017-01-13T06:39:06
2017-01-13T06:39:06
63,959,834
0
1
null
2016-09-02T19:20:04
2016-07-22T14:31:18
Java
UTF-8
Java
false
false
1,110
java
import org.junit.Test; import static org.junit.Assert.assertEquals; import java.util.List; import java.util.Arrays; public class PrimeFactorsTest { @Test public void testOne() { List<Integer> list = Arrays.asList(); assertEquals(list, PrimeFactors.generate(1)); } @Test public void testTwo() { List<Integer> list = Arrays.asList(2); assertEquals(list, PrimeFactors.generate(2)); } @Test public void testThree() { List<Integer> list = Arrays.asList(3); assertEquals(list, PrimeFactors.generate(3)); } @Test public void testFour() { List<Integer> list = Arrays.asList(2, 2); assertEquals(list, PrimeFactors.generate(4)); } @Test public void testSix() { List<Integer> list = Arrays.asList(2, 3); assertEquals(list, PrimeFactors.generate(6)); } @Test public void testEight() { List<Integer> list = Arrays.asList(2, 2, 2); assertEquals(list, PrimeFactors.generate(8)); } @Test public void testNine() { List<Integer> list = Arrays.asList(3, 3); assertEquals(list, PrimeFactors.generate(9)); } }
[ "hanalee07@gmail.com" ]
hanalee07@gmail.com
eb427d2327716902295f78c52df4f5a5e41ce181
055d5d046a30a72a15c54c9c31427ebc5798f820
/src/main/java/com/excise/_14_pool/FixedThreadPoolDemo.java
5da3c6be50ebf0c667c818c9d83391950ac7b571
[]
no_license
zhiyang-liu/thread-demo
01f861f56e04835ebc3312b6314d9e17a8df82f9
6cf3888a30c15894240355a96ba5e0ab49212bf5
refs/heads/master
2021-06-27T14:42:16.696852
2020-12-08T07:39:56
2020-12-08T07:39:56
179,789,979
0
0
null
2020-12-08T07:40:37
2019-04-06T04:51:36
Java
UTF-8
Java
false
false
1,566
java
package com.excise._14_pool; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * newFixedThreadPool(int)返回一个固定数量的线程池。当有新任务提交时,若线程池有空闲线程则分配,若没有任务会暂存在一个队列中,等待出现空闲线程 * newSingleThreadExecutor()返回只有一个线程的线程池。当有多余任务提交时候,会保存在队列按照先入先出等待执行 * newCachedThreadPool()返回可根据实际情况调整线程数量的线程池。有复用优先使用可复用的,没有新建,所有线程处理完任务后会返回线程池进行复用 * newSingleThreadScheduledExecutor()线程池大小为1。没有空闲加入队列,扩展了在给定时间执行某任务,或者周期性执行 * newScheduledThreadPool(int)同上,但可以指定线程数量 */ public class FixedThreadPoolDemo { public static class MyTask implements Runnable { @Override public void run() { System.out.println(System.currentTimeMillis() + ":Thread ID:" + Thread.currentThread().getId()); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } public static void main(String[] args) { MyTask task = new MyTask(); ExecutorService es = Executors.newFixedThreadPool(5); for (int i = 0; i < 10; i++) { es.submit(task); } } }
[ "liuzhiyang@baidu.com" ]
liuzhiyang@baidu.com
aefb27c136fd5e48abf46676a1dd11a3ba3622cb
cfe2234cc71c45cae071dc68e24e1cdefdaf1137
/src/main/java/algorithms/LRUCache.java
e846def2ee96337508611eac988e4362c54a0c4a
[ "MIT" ]
permissive
nking/shared
4b0a63f5b974f6c9c18d737a626a417d38888eed
648568d2583f6947ebbe251f357f7635004dd096
refs/heads/master
2023-07-08T20:06:18.815096
2023-04-25T23:45:42
2023-04-25T23:45:42
95,153,277
1
0
null
null
null
null
UTF-8
Java
false
false
1,825
java
package algorithms; import java.util.LinkedHashMap; import java.util.Map; /** * a simple wrapping of java's LinkedHashMap in order to implement a "least * recently accessed cache". * * @author nichole @param <K> @param <V> */ public class LRUCache<K, V> extends LinkedHashMap<K, V> { private static final long serialVersionUID = 1800104040800209030L; private static final boolean accessOrder = true; private final int initialCapacity; /** * */ public LRUCache() { super(3, 0.75f, accessOrder); this.initialCapacity = 3; } /** * @param initialCapacity */ public LRUCache(int initialCapacity) { super(initialCapacity, 0.75f, accessOrder); this.initialCapacity = initialCapacity; } /** * @param initialCapacity @param loadFactor */ public LRUCache(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor, accessOrder); this.initialCapacity = initialCapacity; } /** * @param initialCapacity @param loadFactor @param accessOrder */ public LRUCache(int initialCapacity, float loadFactor, boolean accessOrder) { super(initialCapacity, loadFactor, accessOrder); if (!accessOrder) { throw new IllegalArgumentException("for the Least Recently Accessed Cache, need accessOrder=true"); } this.initialCapacity = initialCapacity; } /** * @param m */ public LRUCache(Map<? extends K, ? extends V> m) { super(3, 0.75f, accessOrder); this.initialCapacity = 3; putAll(m); } @Override protected boolean removeEldestEntry(Map.Entry<K, V> eldest) { return size() > initialCapacity; } }
[ "nichole@climbwithyourfeet.com" ]
nichole@climbwithyourfeet.com
723172b53dcc41ab13c7ff53a4dfa36f18d8a525
6c337917dcd9ae6f367b55343838bf8d330a7c26
/app/src/main/java/in/sirda/sirdanb/NoticeImage.java
199d529b5a7ab62ef187089e12af5dd901e0400d
[]
no_license
kkchaudhary11/Sirda-DNB-Android-app
98f3d6a1531485e277645cc4c89886f847d6e9d3
21905ac8b929ace76339ff294f5c02b5f700b46e
refs/heads/master
2020-07-03T22:12:10.110864
2016-11-19T18:23:52
2016-11-19T18:23:52
74,226,175
0
0
null
null
null
null
UTF-8
Java
false
false
5,747
java
package in.sirda.sirdanb; import android.annotation.SuppressLint; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.imagedownloader.BasicImageDownloader; import java.io.File; public class NoticeImage extends AppCompatActivity { private static final String TAG_PID = "pid"; private final int RES_ERROR = R.drawable.error_orange; private final int RES_PLACEHOLDER = R.drawable.placeholder_grey; String add = Constants.SrvAdd; File myImageFile; String id; private ImageView imgDisplay; private String name = "temp"; @SuppressLint({"SetTextI18n", "CutPasteId"}) @SuppressWarnings("ConstantConditions") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); id = getIntent().getStringExtra("pid"); final String url = add + "uploads/" + id; setContentView(R.layout.notice); imgDisplay = (ImageView) findViewById(R.id.imgResult); imgDisplay.setImageResource(RES_PLACEHOLDER); final TextView tvPercent = (TextView) findViewById(R.id.tvPercent); final ProgressBar pbLoading = (ProgressBar) findViewById(R.id.pbImageLoading); final BasicImageDownloader downloader = new BasicImageDownloader(new BasicImageDownloader.OnImageLoaderListener() { @Override public void onError(BasicImageDownloader.ImageError error) { Toast.makeText(NoticeImage.this, "Unable to download image", Toast.LENGTH_LONG).show(); error.printStackTrace(); imgDisplay.setImageResource(RES_ERROR); tvPercent.setVisibility(View.GONE); pbLoading.setVisibility(View.GONE); } @Override public void onProgressChange(int percent) { pbLoading.setProgress(percent); tvPercent.setText(percent + "%"); } @Override public void onComplete(Bitmap result) { /* save the image - I'm gonna use JPEG */ Bitmap.CompressFormat mFormat = Bitmap.CompressFormat.JPEG; /* don't forget to include the extension into the file name */ myImageFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "Sirda" + File.separator + name + "." + mFormat.name().toLowerCase()); BasicImageDownloader.writeToDisk(myImageFile, result, new BasicImageDownloader.OnBitmapSaveListener() { @Override public void onBitmapSaved() { imgDisplay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + myImageFile.getAbsolutePath()), "image/*"); startActivity(intent); } }); } @Override public void onBitmapSaveError(BasicImageDownloader.ImageError error) { Toast.makeText(NoticeImage.this, "Error code " + error.getErrorCode() + ": " + error.getMessage(), Toast.LENGTH_LONG).show(); error.printStackTrace(); } }, mFormat, true); tvPercent.setVisibility(View.GONE); pbLoading.setVisibility(View.GONE); imgDisplay.setImageBitmap(result); imgDisplay.startAnimation(AnimationUtils.loadAnimation(NoticeImage.this, android.R.anim.fade_in)); } }); downloader.download(url, true); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_notice, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case R.id.download: Intent i = new Intent(this, ImageDownload.class); i.putExtra(TAG_PID, id); startActivity(i); return true; case R.id.share: Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + myImageFile.getAbsolutePath())); shareIntent.setType("image/jpeg"); startActivity(Intent.createChooser(shareIntent, id)); return true; default: return super.onOptionsItemSelected(item); } } }
[ "kkchaudhary11@gmail.com" ]
kkchaudhary11@gmail.com
c8f4e0ecffc705c8a8ccb6be6b3b721efdfce7a0
0444f90d1f74cfae54039700385606f2dff48256
/src/com/lata/capdemos/enums/Department.java
8493f4135868dea86850cbf08a01a2e402539940
[]
no_license
lataverma18/CapBatch2
bbeaf7d1d99d93165ca88ad134b326d0650cae21
52b458c596c9dfb08c8ae32694b299a00445aa41
refs/heads/main
2023-06-15T18:53:03.198864
2021-07-21T04:15:59
2021-07-21T04:15:59
379,932,156
0
0
null
null
null
null
UTF-8
Java
false
false
90
java
package com.lata.capdemos.enums; public enum Department { IT,PAYROLL,TRAINING; }
[ "noreply@github.com" ]
lataverma18.noreply@github.com
380f9462ddafe565d7cff0a30f1311986be6a1f2
7adbb855aec7d738b77a4e283c46be98fe845e9d
/src/main/java/nl/bsoft/rest/restdemo01/domain/Account.java
4e3418fa034290ea0a264b99da3e8a64be0e62b9
[ "MIT" ]
permissive
bvpelt/restdemo
541a76767f478ade3c5058d49c2656b13874505a
40ebca894aa69508b8be4a1d5fbc91e79f3e4a1d
refs/heads/master
2020-03-16T03:26:23.922764
2018-06-02T18:22:39
2018-06-02T18:22:39
132,487,716
0
0
null
null
null
null
UTF-8
Java
false
false
1,153
java
package nl.bsoft.rest.restdemo01.domain; import org.springframework.hateoas.ResourceSupport; import javax.persistence.*; import java.io.Serializable; @Entity @Table(name = "account") public class Account extends ResourceSupport implements Serializable { private static final long serialVersionUID = 1L; @Id //@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "accountSequence") @SequenceGenerator(name = "accountSequence", sequenceName = "account_seq") @Column(name = "account_id") private Long accountId; @Column(name = "account_name") private String name; @Column(name = "account_email") private String email; public String getName() { return name; } public void setName(String name) { this.name = name; } public Long getAccountId() { return accountId; } public void setAccountId(Long accountId) { this.accountId = accountId; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
[ "bart.vanpelt@gmail.com" ]
bart.vanpelt@gmail.com
f4505e3ff050b61545de6ed283fa7c4ea3f94241
eb847a83c42d9bc19a3b2a63634f9787a3a81556
/bysj_mjh/src/com/bysj/jxc/out/model/OutInfo.java
f8eb10aa4d385ada3d41ad2451a4826aaf3e7c8f
[]
no_license
MiaoJiHui/bysj_mjh
3fec48afa1bb282413d36f84300f637d1254ba7a
5c71a763b5fa62a5b15d201da0ff66f717bde43f
refs/heads/master
2020-12-25T17:34:23.274755
2016-08-22T23:29:41
2016-08-22T23:29:41
40,529,175
4
0
null
null
null
null
UTF-8
Java
false
false
1,341
java
package com.bysj.jxc.out.model; import java.util.Date; public class OutInfo { private Integer id; private String goods_id; private String goods_name; private Integer count; private String storage_id; private Date out_date; private String charge_man; private String remark; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getGoods_id() { return goods_id; } public void setGoods_id(String goods_id) { this.goods_id = goods_id; } public String getGoods_name() { return goods_name; } public void setGoods_name(String goods_name) { this.goods_name = goods_name; } public Integer getCount() { return count; } public void setCount(Integer count) { this.count = count; } public String getStorage_id() { return storage_id; } public void setStorage_id(String storage_id) { this.storage_id = storage_id; } public Date getOut_date() { return out_date; } public void setOut_date(Date out_date) { this.out_date = out_date; } public String getCharge_man() { return charge_man; } public void setCharge_man(String charge_man) { this.charge_man = charge_man; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } }
[ "j_495744643@qq.com" ]
j_495744643@qq.com
0f5b2e02fc6176602dc9631c8bb7d1d903764df1
a29c2e18af6b73b803cb9846a0a265a13fbaf0d9
/src/main/java/pl/szymonwrobel/tms/services/LogFileReaderService.java
4efc8a099b0e3b34dffce1014b8a40241592c057
[]
no_license
sparrov/tms
b183f95c2e950d1413e392e8fef83c219445d168
d87c1abd4b7d6d4606c5f5dc2a67abe4cdc0d1e1
refs/heads/main
2023-03-01T06:17:31.316190
2021-02-04T18:58:39
2021-02-04T18:58:39
328,125,982
1
0
null
null
null
null
UTF-8
Java
false
false
1,580
java
package pl.szymonwrobel.tms.services; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; @Service public class LogFileReaderService { private static final Logger LOGGER = LoggerFactory.getLogger(LogFileReaderService.class); private final String PATH = "tms.log"; private FileReader fileReader = null; private String line = ""; public LogFileReaderService() throws FileNotFoundException { } public List<String> readLogFile() throws FileNotFoundException { try { fileReader = new FileReader(PATH); } catch (FileNotFoundException e) { LOGGER.error("Bląd otwarcia pliku!"); System.exit(1); } BufferedReader bufferFileReader = new BufferedReader(fileReader); List<String> listOfReadLines = new ArrayList<>(); try { while ((line = bufferFileReader.readLine()) != null) { if (line.contains("Service]")) listOfReadLines.add(line); } } catch (IOException ioException) { LOGGER.error("Bląd odczytu pliku!"); System.exit(2); } try { fileReader.close(); } catch (IOException e) { LOGGER.error("Błąd zamkniecia pliku!"); System.exit(3); } return listOfReadLines; } }
[ "sparrov@gmail.com" ]
sparrov@gmail.com
71896fa049f99620c3c7c12fc893ec02ea917f52
df0d95db7a3951071d454dfc0d02863a804013b4
/SGA-EJB/src/main/java/mx/com/gm/sga/persistencia/PersonaDao.java
f4ef029d0c6c3346feadf0bd8e3aae4832a0b8e2
[]
no_license
andresmontoyab/J2EE
6d3e254af9446fd7f84b66d0142a2a64146dfef6
e5df40ad6e20ba81ccd91a51e75cdf4df024539a
refs/heads/master
2022-06-27T16:07:51.201547
2019-06-13T22:28:32
2019-06-13T22:28:32
191,646,048
0
0
null
2022-06-21T01:16:33
2019-06-12T21:17:25
Java
UTF-8
Java
false
false
549
java
package mx.com.gm.sga.persistencia; import mx.com.gm.sga.domain.Persona; import java.util.List; public interface PersonaDao { List<Persona> findAllPersonas(); Persona findPersonaById(Persona persona); Persona findPersonaByEmail(Persona persona); void insertPersona(Persona persona); void updatePersona(Persona persona); void deletePersona(Persona persona); List<Persona> findAllPersonasCriteria(); Persona findPersonaByIdCriteria(Persona persona); Persona findPersonaByIdCriteriaPredicate(Persona persona); }
[ "and.montoya18@gmail.com" ]
and.montoya18@gmail.com
cf6058af3d1e7076aad1f613de2090a2ec75db64
e503530e2ef37a9846611ed7c6b15029cb336f2a
/期末大作业/app/src/androidTest/java/com/example/homeworkend/ExampleInstrumentedTest.java
4c63d7f95686db8427951a0d1b756cf677bbf7f0
[]
no_license
baoguangshuai/phone
6658278e05f244352856f063acedb7b3fcf391bd
f770603efaf3ccfde1e9feba4d30c7dde7a600ad
refs/heads/main
2023-02-01T08:54:41.854848
2020-12-19T03:37:51
2020-12-19T03:37:51
314,956,454
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.example.homeworkend; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.homeworkend", appContext.getPackageName()); } }
[ "baoguangshuai1@126.com" ]
baoguangshuai1@126.com
866cd618fc31b5bc456842f0efdc91100de2c4d0
7e0833032ad6ecdedf9b03b637ec2ad5a6f46207
/src/main/java/com/hashmap/assessment/model/Database.java
b10af7d94148596baa859194ecb684fa8384c2a0
[]
no_license
MedhaSharma98/java-assessment
1f3cb2d8466cb538c0ca1da1068a987d03e0a9c5
5da15d0075ac81a2ad09b549cfdd074b5f1e3561
refs/heads/master
2020-04-26T19:55:42.930221
2019-04-03T08:06:10
2019-04-03T08:06:10
173,791,364
0
0
null
null
null
null
UTF-8
Java
false
false
1,174
java
package com.hashmap.assessment.model; import com.hashmap.assessment.model.employee.Employee; import com.hashmap.assessment.model.employee.role.Admin; import com.hashmap.assessment.model.holiday.Holiday; import com.hashmap.assessment.model.leave.LeaveType; import lombok.EqualsAndHashCode; import lombok.Getter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Getter @EqualsAndHashCode public class Database { private List<Employee> employeeList; private List<Admin> adminList; private List<Holiday> holidaysList; private Map<LeaveType,Integer> defaultLeavesOfPermmanentEmployee; private Map<LeaveType,Integer> defaultLeavesOfProbationEmployee; private Map<String, Map<LeaveType,Integer>> employeeLeaves; public Database(){ employeeList= new ArrayList<Employee>(); adminList=new ArrayList<Admin>(); holidaysList=new ArrayList<Holiday>(); defaultLeavesOfPermmanentEmployee=new HashMap<LeaveType,Integer>(); defaultLeavesOfProbationEmployee=new HashMap<LeaveType,Integer>(); employeeLeaves=new HashMap<String, Map<LeaveType,Integer>>(); } }
[ "medhasharma9999@gmail.com" ]
medhasharma9999@gmail.com
4b8aeed584ef9bc2135f4fc3c78effbc8f39684a
73d7bb98e8bdcf0196718e7a2729f2a4435afdaf
/src/test/java/com/inetBanking/utilities/ReadConfig.java
193f737b45c610c3d4ea906034bbc67e972eb27a
[]
no_license
Siddeh/inetBankingV1
f2854a6c6394bb178e1873b299a15f30f0b22f44
c37d06154ace3475ff75151fdbde88dac5dc6f42
refs/heads/master
2023-08-13T16:30:42.464752
2021-09-13T15:54:04
2021-09-13T15:54:04
405,568,917
0
0
null
null
null
null
UTF-8
Java
false
false
1,219
java
package com.inetBanking.utilities; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Properties; public class ReadConfig { Properties pro; //constructor to load config file public ReadConfig() { File src=new File("./Configuration\\config.properties"); try { FileInputStream fis=new FileInputStream(src); pro=new Properties(); pro.load(fis); } catch (Exception e) { // TODO Auto-generated catch block System.out.println("Exception is "+e.getMessage()); } } //Methods to get Values from Config proprties public String getApplicationUrl() { String url=pro.getProperty("baseUrl"); return url; } public String getUserName() { String username=pro.getProperty("userName"); return username; } public String getPassword() { String password=pro.getProperty("password"); return password; } public String getChromePath() { String chromePath=pro.getProperty("chromepath"); return chromePath; } public String getIePath() { String iepath=pro.getProperty("iepath"); return iepath; } public String getFirePath() { String firepath=pro.getProperty("firepath"); return firepath; } }
[ "siddesha094@gmail.com" ]
siddesha094@gmail.com
50e791952a2ea1634513058ec10ea97a72c43888
2a20984ee8a7a5fbf2351c560312f04de17f7485
/src/fr/badblock/bukkit/games/uhcmodifier/overrided_blocks/OBlockDeadBush.java
d915f52e76f527fe28be8020a2b888a26482f9f0
[]
no_license
xMalware/BadBlock-UHCModifier
b9d79973c73b5312ef931c838fab49619482c28e
4eb29e76956a12f008e6f38e36fadadcf28d0ced
refs/heads/master
2020-07-23T01:27:50.731624
2019-09-09T20:36:17
2019-09-09T20:36:17
207,399,757
0
0
null
null
null
null
UTF-8
Java
false
false
664
java
package fr.badblock.bukkit.games.uhcmodifier.overrided_blocks; import java.util.Random; import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_8_R3.BlockDeadBush; import net.minecraft.server.v1_8_R3.IBlockData; import net.minecraft.server.v1_8_R3.Item; import net.minecraft.server.v1_8_R3.Items; public class OBlockDeadBush extends BlockDeadBush { public OBlockDeadBush() { this.c(0.0F); this.a(Block.h); this.c("deadbush"); } @Override public Item getDropType(IBlockData iblockdata, Random random, int i) { return Items.BREAD; } @Override public int getDropCount(int i, Random random) { return 2; } }
[ "xmalware2@gmail.com" ]
xmalware2@gmail.com
1f96c0bbe93c151429da098c75c110d3253ddf16
919b48a31ab1561cc6104c7fc108d30b050785e0
/DashCon/src/sri/servlet/MettlerToledoPollServlet.java
ce16db1a104f20216bc38ca3feeb591eb00350f1
[ "Apache-2.0" ]
permissive
sri-leidos/SRI-Dashboard
8fc4cbfb05e33951160c5c940213a40e012226e0
6dce69c142e532642734edb8e9fd7e2d8f2ecf06
refs/heads/master
2021-01-20T17:46:27.224146
2016-09-19T18:39:32
2016-09-19T18:39:32
68,629,452
0
0
null
null
null
null
UTF-8
Java
false
false
5,284
java
package sri.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriBuilder; import sri.data.WeightReport; import com.sun.grizzly.comet.CometContext; import com.sun.grizzly.comet.CometEngine; import com.sun.grizzly.comet.CometEvent; import com.sun.grizzly.comet.CometHandler; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; public class MettlerToledoPollServlet extends HttpServlet { private WeightReport wr; private class WeightHandler implements CometHandler<HttpServletResponse> { private HttpServletResponse response; public void onEvent(CometEvent event) throws IOException { if (CometEvent.NOTIFY == event.getType()) { String json = "{ " + "\"siteId\":\"" + wr.getSiteId() + "\"," + "\"axleCount\":\"" + wr.getAxleCount() + "\"," + "\"timestamp\":\"" + wr.getTimestamp() + "\"," + "\"sequenceNumber\":\"" + wr.getSequenceNumber() + "\"," + "\"grossWeight\":\"" + wr.getGrossWeight() + "\"," + "\"massUnit\":\"" + wr.getMassUnit()+ "\"," + "\"status\":\"" + wr.getStatus() + "\"," + "\"scaleType\":\"" + wr.getScaleType() + "\"," + "\"reason\":\"" + wr.getReason() + "\"" + " }"; response.addHeader("X-JSON", json); PrintWriter writer = response.getWriter(); writer.write(json); writer.flush(); event.getCometContext().resumeCometHandler(this); } } public void onInitialize(CometEvent event) throws IOException { } public void onInterrupt(CometEvent event) throws IOException { String json = "{ " + "\"siteId\":\"" + wr.getSiteId() + "\"," + "\"axleCount\":\"" + wr.getAxleCount() + "\"," + "\"timestamp\":\"" + wr.getTimestamp() + "\"," + "\"sequenceNumber\":\"" + wr.getSequenceNumber() + "\"," + "\"grossWeight\":\"" + wr.getGrossWeight() + "\"," + "\"massUnit\":\"" + wr.getMassUnit()+ "\"," + "\"status\":\"" + wr.getStatus() + "\"," + "\"scaleType\":\"" + wr.getScaleType() + "\"," + "\"reason\":\"" + wr.getReason() + "\"" + " }"; response.addHeader("X-JSON", json); PrintWriter writer = response.getWriter(); writer.write(json); writer.flush(); } public void onTerminate(CometEvent event) throws IOException { } public void attach(HttpServletResponse attachment) { this.response = attachment; } } private static final long serialVersionUID = 1L; private String contextPath = null; @Override public void init(ServletConfig config) throws ServletException { super.init(config); wr = new WeightReport(); ServletContext context = config.getServletContext(); contextPath = context.getContextPath() + "/mettPoll"; CometEngine engine = CometEngine.getEngine(); CometContext cometContext = engine.register(contextPath); cometContext.setExpirationDelay(5 * 30 * 1000); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { WeightHandler handler = new WeightHandler(); handler.attach(res); CometEngine engine = CometEngine.getEngine(); CometContext context = engine.getCometContext(contextPath); context.addCometHandler(handler); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { if (req.getParameter("siteId") != null) { wr = new WeightReport(); wr.setSiteId(Integer.valueOf(req.getParameter("siteId"))); wr.setAxleCount(Integer.valueOf(req.getParameter("axleCount"))); wr.setTimestamp(req.getParameter("timestamp")); wr.setSequenceNumber(Integer.valueOf(req.getParameter("sequenceNumber"))); wr.setGrossWeight(Integer.valueOf(req.getParameter("grossWeight"))); wr.setMassUnit(req.getParameter("massUnit")); wr.setStatus(req.getParameter("status")); wr.setScaleType(req.getParameter("scaleType")); wr.setReason(req.getParameter("reason")); } postWeight(wr); CometEngine engine = CometEngine.getEngine(); CometContext context = engine.getCometContext(contextPath); context.notify(null); PrintWriter writer = res.getWriter(); writer.write("success"); writer.flush(); } public void postWeight(WeightReport weight) { String URL = "http://localhost:8080/DashCon/resources/weight"; ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource webResource = client.resource(UriBuilder.fromUri(URL) .build()); ClientResponse response = webResource.type( MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class, weight); System.out.println("Response: " + response.getStatus()); if( response.getStatus() == 204 ) { System.out.println("Success!"); } else { System.out.println(response.getEntity(String.class)); } } }
[ "rothattack@gmail.com" ]
rothattack@gmail.com
d42e99d3349fb782172e998611a31f9a36c5ea13
84bce56a5557e6230b3f221c0fb5eb420084871b
/framework/alchemymodel/SettingsPageModel.java
952b0277991e738f52d1e18148c522a15c480aa6
[]
no_license
zafor99/serviceatlas
8e42c9e5a161e34e188cd09af9ab39103f79318d
922ffdd223d1d8b206efb63e0a1a42083fe1bd9c
refs/heads/master
2022-11-29T17:23:47.411796
2019-07-28T19:57:47
2019-07-28T19:57:47
94,845,828
0
0
null
2022-11-24T07:02:22
2017-06-20T03:28:52
Java
UTF-8
Java
false
false
750
java
package framework.alchemymodel; import com.experitest.client.Client; import com.rational.test.ft.script.RationalTestScript; /** * Description : Super class for script helper * * @author fahmed1 * @since September 17, 2014 */ public class SettingsPageModel extends DeviceModelBase { public SettingsPageModel(Client client) { super(client); // TODO Auto-generated constructor stub } public ElementObject logOutButton(){ return new ElementObject("NATIVE", "xpath=//*[@text='Log out']", 0); } public ElementObject cancelButton(){ return new ElementObject("NATIVE", "xpath=//*[@text='Cancel']", 0); } public ElementObject singOutButton(){ return new ElementObject("NATIVE", "xpath=//*[@text='Sign Out']", 0); } }
[ "zafor99@gmail.com" ]
zafor99@gmail.com
b9ad2cf773e3c1557f8d7d74e43b4f2abb8e79d7
a3e5d85764ebb04bd995cb8f094925efebe55995
/app/src/main/java/com/lambency/lambency_client/Activities/FilterActivity.java
71334641ec9ef04682328017483b90fe0a3ad377
[]
no_license
kvosbur/Lambency-Client
8b263c5039e5f687e55e18a7acbc71f699d10992
3c438b71fa0dd86da840d747ab2c002653f25a0f
refs/heads/master
2021-03-22T03:01:29.847616
2018-04-19T19:50:38
2018-04-19T19:50:38
118,684,006
4
1
null
null
null
null
UTF-8
Java
false
false
5,435
java
package com.lambency.lambency_client.Activities; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.EventLog; import android.view.MenuItem; import android.widget.EditText; import com.google.android.gms.location.LocationServices; import com.lambency.lambency_client.Adapters.FilterTabsAdapter; import com.lambency.lambency_client.Adapters.SearchTabsAdapter; import com.lambency.lambency_client.Fragments.FilterDistanceFragment; import com.lambency.lambency_client.Models.EventFilterModel; import com.lambency.lambency_client.Models.OrganizationFilterModel; import com.lambency.lambency_client.Models.UserModel; import com.lambency.lambency_client.R; import java.sql.Timestamp; import java.util.Date; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by Evan on 3/22/2018. */ public class FilterActivity extends BaseActivity { //@BindView(R.id.toolbarFilter) //Toolbar toolbar; @BindView(R.id.tabLayoutFilter) TabLayout tabLayout; @BindView(R.id.viewPagerFilter) ViewPager viewPager; Context context; FilterTabsAdapter searchTabsAdapter; static boolean isOrg; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_filter); ButterKnife.bind(this); this.context = this; //setSupportActionBar(toolbar); boolean filterOrg = false; Bundle b = getIntent().getExtras(); if(b != null){ String val = b.getString("OrgFilter"); if(val != null && val.compareTo("true") == 0) { filterOrg = true; } } isOrg = filterOrg; if(isOrg) { EventFilterModel.currentFilter.setTitle("org"); } else { EventFilterModel.currentFilter.setTitle("event"); } ActionBar actionBar = getSupportActionBar(); actionBar.setTitle("Filter Options"); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setElevation(0); tabLayout.addTab(tabLayout.newTab().setText("Distance")); if(!filterOrg) { tabLayout.addTab(tabLayout.newTab().setText("Date")); } tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); searchTabsAdapter = new FilterTabsAdapter(getSupportFragmentManager(), tabLayout.getTabCount(), this); viewPager.setAdapter(searchTabsAdapter); tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { //Does not work... color still doesn't switch tabLayout.setScrollPosition(tab.getPosition(), 0f, true); viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: EditText altAddr = findViewById(R.id.newTextAddr); if(isOrg) { OrganizationFilterModel.currentFilter.setLocation(altAddr.getText().toString()); if(OrganizationFilterModel.currentFilter.getLocation().compareTo("") == 0) { OrganizationFilterModel.currentFilter.setLocation(null); } } else { EventFilterModel.currentFilter.setLocation(altAddr.getText().toString()); if(EventFilterModel.currentFilter.getLocation().compareTo("") == 0) { EventFilterModel.currentFilter.setLocation(null); } if(EventFilterModel.currentFilter.getStartStamp() == null) { EventFilterModel.currentFilter.setStartStamp(new Timestamp(new Date().getTime())); } } /* if(isOrg) { OrganizationFilterModel.currentFilter.setDistanceMiles(EventFilterModel.currentFilter.getDistanceMiles()); OrganizationFilterModel.currentFilter.setLocation(EventFilterModel.currentFilter.getLocation()); OrganizationFilterModel.currentFilter.setLatitude(EventFilterModel.currentFilter.getLatitude()); OrganizationFilterModel.currentFilter.setLongitude(EventFilterModel.currentFilter.getLongitude()); } */ //finish(); Intent intent = new Intent(context, SearchActivity.class); if(isOrg) { intent.putExtra("org", "true"); } startActivity(intent); } return super.onOptionsItemSelected(item); } }
[ "ehoneyse@purdue.edu" ]
ehoneyse@purdue.edu
9fb53e3661c0b7fe4d05f87198ccc41be904dce3
f54548ee127a6018393a14099c4259927f0bbe30
/src/hw08/HashSet.java
2c8c80125be96b1daca050007218453430e0fdc6
[]
no_license
davidxie95/CS46B
980ce9b9a7a964c0a3c5e4f513137c374cffc2e9
9e4f6aa145882b16facb2b39576b1314eba3e367
refs/heads/master
2021-05-02T12:12:02.709193
2018-02-08T09:43:04
2018-02-08T09:43:04
120,737,548
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package hw08; //FORBIDDEN java.util.Hash public class HashSet { Node[] Data; private static final int INITIAL_SIZE = 23; public HashSet() { Data = new Node[INITIAL_SIZE]; } public void add(Object NewData) { HashSet_Methods.add(NewData, Data); } public int contains(Object SearchData) { return HashSet_Methods.contains(SearchData, Data); } public boolean containsBool(Object SearchData) { return (HashSet_Methods.contains(SearchData, Data) == -1) ? false : true; } public void remove(Object RemoveData) { HashSet_Methods.remove(RemoveData, Data); } public double calculateLoad() { return HashSet_Methods.calculateLoad(Data); } public void reallocate() { Data = HashSet_Methods.resize(Data); } }
[ "noreply@github.com" ]
davidxie95.noreply@github.com
3c0b10c25d1ca4eb285561841d95e027596f85a1
49ce1a640f315fe04b52bd0f3b583e7aa563a788
/src/p13/lecture/A04Generic.java
9a56866a72f4105d8938107021b1403d22b3873d
[]
no_license
lim950914/java20210325
3decd232b3c2228f4c5e6c7fd1bd955939d0a986
47bb0555410f9b178d6d92ec40b7236fca4613e0
refs/heads/master
2023-07-10T09:10:28.691318
2021-08-06T00:05:46
2021-08-06T00:05:46
351,269,331
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
package p13.lecture; public class A04Generic { public static void main(String[] args) { Generic4<String, Integer, Double> g4 = new Generic4<>(); g4.setField1("java"); g4.setField2(99); g4.setField3(3.14); String s = g4.getField1(); int i = g4.getField2(); double d = g4.getField3(); } } class Generic4<T, S, U> { private T field1; private S field2; private U field3; public T getField1() { return field1; } public void setField1(T field1) { this.field1 = field1; } public S getField2() { return field2; } public void setField2(S field2) { this.field2 = field2; } public U getField3() { return field3; } public void setField3(U field3) { this.field3 = field3; } }
[ "dlackswn2222@naver.com" ]
dlackswn2222@naver.com
398715194e9c0763e03a2c7eafc01bd58ba719df
46577474beb29b57604ab2887f56c388f4faa3c0
/eventPlanner/src/main/java/com/anz/eventplanner/dao/TaskDAOImpl.java
bbe31227869b51c53c3945be2f4d4a42283aa4d4
[]
no_license
Amuthalakshmi/eventPlanner
7e0ec2cc2ab3d61bb75234f60c1d28607613178e
d665f58d1445984ba835ac8bb8c203dc775b2e42
refs/heads/master
2021-01-20T04:54:10.806426
2017-06-10T05:48:29
2017-06-10T05:48:29
89,747,139
0
0
null
2017-06-10T05:48:29
2017-04-28T21:47:01
Java
UTF-8
Java
false
false
1,116
java
package com.anz.eventplanner.dao; import java.util.Collection; import java.util.List; import org.springframework.stereotype.Repository; import com.anz.eventplanner.model.Task; @Repository("taskDAO") public class TaskDAOImpl extends AbstractDAO<Integer, Task> implements TaskDAO { @Override public Task findById(int taskId) { Task task = getByKey(taskId); return task; } @Override public void saveTask(Task task) { persist(task); } @Override public void deleteTaskById(int taskId) { Task task = (Task) getEntityManager().createQuery("SELECT t FROM Task t WHERE t.taskId = :taskId ") .setParameter("taskId", taskId).getSingleResult(); delete(task); } @SuppressWarnings("unchecked") @Override public List<Task> findAllTask() { List<Task> tasks = (List<Task>) getEntityManager().createQuery("SELECT t FROM Task t GROUP BY t.tastStatus ORDER BY t.taskId").getResultList(); return tasks; } protected void initializeCollection(Collection<?> collection) { if (collection == null) { return; } collection.iterator().hasNext(); } }
[ "ammu.veera@gmail.com" ]
ammu.veera@gmail.com
4ed6ce09708f650b033db7626922f0f02ea60fc2
19fabe58d520ec04762e59d1e939be3177c4cf75
/CareerEventForRuby/src/main/java/com/otpp/domain/date/MonthOfYear.java
fd25373888a0d479860404ecc85b5be9ff23ec82
[]
no_license
amaltson/dev-days-2012
8d58234cd3025d854f191fa680c8c903ddba6fdb
f0cce5083ef56135b80011e3838f94accd3452b0
refs/heads/master
2016-09-06T07:42:24.818703
2012-05-30T15:58:48
2012-05-30T15:58:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,546
java
package com.otpp.domain.date; public enum MonthOfYear { JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER; /** * Returns the month of year object corresponding to the index passed in this date. * Null is returned * Months are 1 indexed where 1 = January, 2 = February ... 12 = December * * @return a {@link MonthOfYear} representing the month if it is a specific date. Undefined if it is a past date or future * date. */ public static MonthOfYear getMonthOfYear(int monthIndex) { switch (monthIndex) { case 1: return MonthOfYear.JANUARY; case 2: return MonthOfYear.FEBRUARY; case 3: return MonthOfYear.MARCH; case 4: return MonthOfYear.APRIL; case 5: return MonthOfYear.MAY; case 6: return MonthOfYear.JUNE; case 7: return MonthOfYear.JULY; case 8: return MonthOfYear.AUGUST; case 9: return MonthOfYear.SEPTEMBER; case 10: return MonthOfYear.OCTOBER; case 11: return MonthOfYear.NOVEMBER; case 12: return MonthOfYear.DECEMBER; default: throw new IllegalArgumentException("Invalid month index " + monthIndex + " entered. Must be between 1 and 12."); } } }
[ "derekh4@gmail.com" ]
derekh4@gmail.com
2cd46ac50e63620defe6deacd4c12d7893e21828
f9d599086445bb82d5a7ce12c51d93715f6e3a48
/后端/rentproject/src/main/java/com/example/rentproject/model/WorkOrder.java
acf5441d96a254a34f225c42b9e70507737eb581
[]
no_license
youabcd/Rent-System
2c9f129cfe01746ddf087246b1b6660c36da51af
4f8463ad9e5daf92704c7c06014cb8e600dbc413
refs/heads/master
2022-10-24T00:05:47.764463
2020-06-14T11:54:12
2020-06-14T11:54:12
260,133,031
1
0
null
null
null
null
UTF-8
Java
false
false
8,714
java
package com.example.rentproject.model; import java.sql.ResultSet; import java.util.*; /* * WorkOrderId,RenterId,RoomId,RepairmanId,ServiceId,WorkOrderDate,WorkOrderItem,WorkOrderState,WorkOrderPictures,WorkOrderLevel */ // 工单 public class WorkOrder { private String id; private String renterId; private String roomId; private String repairmanId; private String serviceId; private String date; private String item; // 顾客的描述内容 - 顾客的评价 private String state; // 工单状态 waiting finished returned 等待 已回复 已评价 private ArrayList<String> pictures; // 分隔符"-" private int level; // 租客的评价等级 1-5 0为未评价 public WorkOrder(String id,String renterId,String roomId,String repairmanId,String serviceId,String date,String item,String state,String pictures,int level) { this.id=id; this.renterId = renterId; this.roomId=roomId; this.repairmanId=repairmanId; this.serviceId=serviceId; this.date=date; this.item=item; this.state=state; this.pictures = Room.stringToList(pictures); this.level = level; } /* * 租客提出的工单,新建工单 */ public WorkOrder(String renterId,String roomId,String item) { this.id = WorkOrder.getNextId(); this.renterId = renterId; this.roomId=roomId; this.repairmanId = null; this.serviceId = Room.findRoomById(roomId).getServiceId(); this.date = DateModel.now(); this.addRenterItem(item); this.state = "waiting"; this.pictures = new ArrayList<String>(); this.level = 0; } /* * check属性的方法 * * */ public static boolean checkId(String id) { return id.length() <= 50 && id.length() >= 1 && findWorkOrderById(id)==null; } public static boolean checkRenterId(String repairmanId) { return repairmanId.length() <= 50 && repairmanId.length() >= 1 && Repairman.findRepairmanById(repairmanId)!=null; } public static boolean checkRoomId(String roomId) { return roomId.length() <= 50 && roomId.length() >= 1 && Room.findRoomById(roomId)!=null; } public static boolean checkServiceId(String serviceId) { return serviceId.length() <= 50 && serviceId.length() >= 1 && Service.findServiceById(serviceId)!=null; } public static boolean checkItem(String item) { return item.length() >= 1 && item.length() <= 2000; } public static boolean checkDate(String date) { return DateModel.CheckDate(date) >= 0; } public static boolean checkState(String state) { return state.equals("finished") || state.equals("waiting"); } public static boolean checkLevel(int level) { return level<=5 && level>=0; } /* * 查找WorkOrder的方法 * * */ // 所有工单 public static ArrayList<WorkOrder> findAllWorkOrder(){ ArrayList<WorkOrder> ret = new ArrayList<WorkOrder>(); try { ResultSet rs = Repository.getInstance().doSqlSelectStatement("SELECT * FROM WorkOrder"); while(rs.next()) { WorkOrder r = new WorkOrder( rs.getString("WorkOrderId"),rs.getString("RenterId"),rs.getString("RoomId"),rs.getString("RepairmanId"),rs.getString("ServiceId"), rs.getString("WorkOrderDate"),rs.getString("WorkOrderItem"),rs.getString("WorkOrderState"),rs.getString("WorkOrderPictures"),rs.getInt("WorkOrderLevel")); ret.add(r); } rs.close(); }catch(Exception e) { // SQL Exception // e.printStackTrace(); } return ret; } public static WorkOrder findWorkOrderById(String id) { try{ return Repository.getInstance().selectFromWorkOrder("WorkOrderId", id, "total").get(0); }catch(Exception e) { return null; } } public static ArrayList<WorkOrder> findWorkOrderByRepairmanId(String repairmanId){ return Repository.getInstance().selectFromWorkOrder("RepairmanId", repairmanId, "total"); } public static ArrayList<WorkOrder> findWorkOrderByRoomId(String roomId){ return Repository.getInstance().selectFromWorkOrder("RoomId", roomId, "total"); } public static ArrayList<WorkOrder> findWorkOrderByRenterId(String renterId){ return Repository.getInstance().selectFromWorkOrder("RenterId", renterId, "total"); } public static ArrayList<WorkOrder> findWorkOrderByServiceId(String serviceId){ return Repository.getInstance().selectFromWorkOrder("ServiceId", serviceId, "total"); } public static ArrayList<WorkOrder> findWorkOrderByDate(String date){ return Repository.getInstance().selectFromWorkOrder("WorkOrderDate", date, "total"); } /* * 插入WorkOrder的方法 * * */ public static boolean addNewWorkOrder(WorkOrder wo) { return Repository.getInstance().insertIntoWorkOrder(wo); } /* * 删除WorkOrder的方法 * * */ public static boolean deleteWorkOrder(WorkOrder wo) { return Repository.getInstance().deleteWorkOrder(wo); } public boolean addPictures(String id) { return this.pictures.add(id); } // 更新 public boolean updateState() { return Repository.getInstance().updateWorkOrder(this, "WorkOrderState", this.state); } public boolean updateItem() { return Repository.getInstance().updateWorkOrder(this, "WorkOrderItem", this.item); } /* * 添加回复,投诉 */ public boolean addRenterItem(String s) { this.item = s; return this.updateItem(); } public boolean addRepairmanItem(String r) { this.item += "-" + r; return this.updateItem(); } public boolean addReturnItem(String r) { this.state = "returned"; this.item += "-" + r; return this.updateItem() && this.updateState(); } /* * get和set方法 * * * * */ public String getId() { return id; } public void setId(String id) { this.id = id; } public String getRoomId() { return roomId; } public void setRoomId(String roomId) { this.roomId = roomId; } public String getRepairmanId() { return repairmanId; } public void setRepairmanId(String repairmanId) { this.repairmanId = repairmanId; } public String getServiceId() { return serviceId; } public void setServiceId(String serviceId) { this.serviceId = serviceId; } public String getDate() { return DateModel.formatDate(date.substring(0,10).replace("-", "/")); } public void setDate(String date) { this.date = date; } public String getItem() { return item; } public void setItem(String item) { this.item = item; } public String getState() { return state; } public void setState(String state) { this.state = state; } // 获取用户报修内容 public String getRenterItem() { if(this.item.contains("-")) { return this.item.substring(0,this.item.indexOf("-")); } return this.item; } // 获取师傅回复内容 public String getRepairmanItem() { String s = this.item; try { if(s.contains("-")) { s = s.substring(s.indexOf("-") + 1); return s; } else { return ""; } }catch(Exception e) { return ""; } } // 获取评价内容 public String getReturnItem() { try { String s = this.item.substring(this.item.indexOf("-") + 1); if(s.contains("-")) { return s.substring(s.indexOf("-")+1); } return s; }catch(Exception e) { return ""; } } /* * 获取下一个工单id */ public static String getNextId() { try { ResultSet rs = Repository.getInstance().doSqlSelectStatement("SELECT WorkOrderId FROM WorkOrder WHERE WorkOrderId >= " + "All( SELECT WorkOrderId FROM WorkOrder )"); if(rs.next()) { return String.valueOf(Integer.valueOf(rs.getString("WorkOrderId"))+1); } return "1001"; } catch (Exception e) { e.printStackTrace(); return ""; } } /* * toString类似的方法 * * * */ public String toTupleInString() { if(this.repairmanId!=null) { return "('"+id+"','"+renterId+"','"+roomId+"','"+repairmanId+"','"+serviceId+"','"+date+"','"+item+"','"+state+"','"+Room.listToString(pictures)+"','"+level+"')"; } else { return "('"+id+"','"+renterId+"','"+roomId+"',"+null+",'"+serviceId+"','"+date+"','"+item+"','"+state+"','"+Room.listToString(pictures)+"','"+level+"')"; } } public ArrayList<String> getPictures() { return pictures; } public void setPictures(ArrayList<String> pictures) { this.pictures = pictures; } public int getLevel() { return level; } public void setLevel(int level) { this.level = level; } public String getRenterId() { return renterId; } public void setRenterId(String renterId) { this.renterId = renterId; } }
[ "noreply@github.com" ]
youabcd.noreply@github.com
0840c9849a95db923705d2b2385a7fd8f74f80f4
54eb2dc1d95e27052ccb0ec21cabf57303d6dc91
/event-api/src/main/java/org/trustedanalytics/atk/event/Instant.java
471d2e6bc1f3c8f159002f1b633ab92561886baf
[ "Apache-2.0" ]
permissive
trustedanalytics/atk-event
05addb233fa76d0296ebc4b0649ea66003334fce
b368cb4d683b9864a4423e3429519aae57105c4e
refs/heads/master
2021-01-10T01:58:54.601025
2016-09-26T14:51:35
2016-09-26T14:51:35
43,382,603
1
2
null
null
null
null
UTF-8
Java
false
false
1,436
java
/* // Copyright (c) 2015 Intel Corporation  // // 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.trustedanalytics.atk.event; import java.util.Date; /** * Encapsulates system data that were current at a particular moment in time */ class Instant { private final String threadName; private final String user; private final Date date; private final long threadId; Instant() { date = new Date(); user = System.getProperty("user.name"); threadId = Thread.currentThread().getId(); threadName = Thread.currentThread().getName(); } public String getThreadName() { return threadName; } public String getUser() { return user; } public Date getDate() { return date; } public long getThreadId() { return threadId; } }
[ "atk-headless@intel.com" ]
atk-headless@intel.com
8809c1a3498b4ecc44cf82f3aab8e9fc02bf56df
cf878d9f56897647ff071d16b42a4184beb90003
/rsocket-client-greeting/src/test/java/unit/jpdemo/reactivegreeting/rsocketclientgreeting/controller/RSocketClientRestControllerTest.java
80a17293adb2dbb59531c722317db6a7d2b97258
[]
no_license
JPDemo/reactive-greeting
b0aff23bbb216271ec9a0c7dd9db6ec1ff027f7c
b489d52f9e117d856063439b50835e98e28c9747
refs/heads/main
2023-01-20T03:27:57.272775
2020-10-31T10:40:43
2020-10-31T10:40:43
304,449,868
1
0
null
2020-11-19T13:18:16
2020-10-15T21:16:08
Java
UTF-8
Java
false
false
5,678
java
package jpdemo.reactivegreeting.rsocketclientgreeting.controller; import jpdemo.reactivegreeting.rsocketclientgreeting.adaptor.GreetingAdaptor; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.reactive.server.WebTestClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.util.Arrays; import java.util.List; import static org.hamcrest.CoreMatchers.equalTo; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verifyNoInteractions; @WebFluxTest(controllers = RSocketClientRestController.class) @ActiveProfiles("test") class RSocketClientRestControllerTest { @Autowired private WebTestClient webClient; @MockBean private GreetingAdaptor mockAdaptor; @Test void connection() { verifyNoInteractions(mockAdaptor); webClient.get() .uri(uriBuilder -> uriBuilder.path("").build()) .exchange() // then .expectStatus() .isOk() .expectBody(String.class) .value(equalTo("Welcome to greeting rsocket rest client")); } @Test void connection2() { verifyNoInteractions(mockAdaptor); webClient.get() .uri(uriBuilder -> uriBuilder.path("/").build()) .exchange() // then .expectStatus() .isOk() .expectBody(String.class) .value(equalTo("Welcome to greeting rsocket rest client /endpoint")); } @Test @DisplayName("Greeting defaults to request name of World") void greetingRequestResponse() { // given String name = "World"; String mockGreeting = "Hello World"; var mockResponse = Mono.just(mockGreeting); given(mockAdaptor.greetingRequestResponse(name)).willReturn(mockResponse); // when webClient.get() .uri(uriBuilder -> uriBuilder.path("/request").build()) .exchange() // then .expectStatus() .isOk() .expectBody(String.class) .value(equalTo(mockGreeting)) ; //then Mockito.verify(mockAdaptor).greetingRequestResponse(name); } @Test void greetingChannel() { //given String mockGreeting1 = "Hey Thor"; String mockGreeting2 = "Hola Odin"; var mockGreetings = Arrays.asList(mockGreeting1,mockGreeting2); var mockResponse = Flux.fromIterable(mockGreetings); given(mockAdaptor.greetingChannel()).willReturn(mockResponse); // when webClient.get() .uri(uriBuilder -> uriBuilder.path("/channel").build()) .exchange() // then .expectStatus() .isOk() .expectBodyList(String.class) //TODO: This should be 2. Not sure why not being treated as a list .value(List::size,equalTo(1)) //.value(response1 -> response1.get(0),equalTo(mockGreeting1)) //.value(response2 -> response2.get(1),equalTo(mockGreeting2)) ; //then Mockito.verify(mockAdaptor).greetingChannel(); } @Test void greetingLog() { // given String name = "LogName"; // when // when webClient.get() .uri(uriBuilder -> uriBuilder.path("/log").queryParam("name", name).build()) .exchange() // then .expectStatus() .isOk() .expectBody() .isEmpty() ; //then Mockito.verify(mockAdaptor).logGreeting(name); } @Test void randomGreetings() { // given String mockGreeting1 = "Hey Thor"; String mockGreeting2 = "Hola Odin"; var mockGreetings = Arrays.asList(mockGreeting1,mockGreeting2); var mockResponse = Flux.fromIterable(mockGreetings); given(mockAdaptor.randomGreetingsStream()).willReturn(mockResponse); // when webClient.get() .uri(uriBuilder -> uriBuilder.path("/stream").build()) .exchange() // then .expectStatus() .isOk() .expectBodyList(String.class) //TODO: This should be 2. Not sure why not being treated as a list .value(List::size,equalTo(1)) //.value(response1 -> response1.get(0),equalTo(mockGreeting1)) //.value(response2 -> response2.get(1),equalTo(mockGreeting2)) ; } @Test void randomGreeting() { // given String mockGreeting = "Hello World"; var mockResponse = Mono.just(mockGreeting); given(mockAdaptor.randomGreetingRequest()).willReturn(mockResponse); // when webClient.get() .uri(uriBuilder -> uriBuilder.path("/random").build()) .exchange() // then .expectStatus() .isOk() .expectBody(String.class) .value(equalTo(mockGreeting)) ; //then Mockito.verify(mockAdaptor).randomGreetingRequest(); } }
[ "jmpdev@outlook.com" ]
jmpdev@outlook.com
705070265c64eba7fbfa1d95e4d4110449263d25
a754a46bf8b5d5c95b2d9706ebb2d27ce1c13bfa
/src/kh/com/c/service/impl/KhMemberServiceImpl.java
9169372f3a5f157f1afbde1f5ea940b6d76ea50f
[]
no_license
jun8804/mystudy
3d2a2666537ed835c5de481a3ed6cdb36dd2a891
d93bc1c58454583983d4cccad9b38190400f9115
refs/heads/master
2020-04-04T03:01:44.553304
2018-11-02T07:02:09
2018-11-02T07:02:09
155,704,759
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package kh.com.c.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import kh.com.c.dao.KhMemberDao; import kh.com.c.dao.impl.KhMemberDaoImpl; import kh.com.c.model.MemberDto; import kh.com.c.service.KhMemberService; @Service public class KhMemberServiceImpl implements KhMemberService { @Autowired // <- DI(의존성) : spring framework KhMemberDao khMemberDao; // = new KhMemberDaoImpl(); @Override public boolean addmember(MemberDto mem) throws Exception { return khMemberDao.addmember(mem); } @Override public MemberDto login(MemberDto mem) throws Exception { return khMemberDao.login(mem); } }
[ "user2@KH_C" ]
user2@KH_C
b8ba91f121b7e122333a48a0cee80161277c8116
18e25013428dae7ab9e25c294c9c7465be1fa00f
/apm-collector/apm-collector-analysis/analysis-metric/metric-provider/src/main/java/org/apache/skywalking/apm/collector/analysis/metric/provider/worker/service/refmetric/ServiceReferenceMetricCopy.java
825ebd1a070fe8039b5fb6d9db57e95a782412a2
[ "Apache-2.0" ]
permissive
szsuyuji/incubator-skywalking
c5c4fde3401e8cff1042a46e66a6242b8b6bb0b2
121d0125a2654554fcadabcb46247ee23b8ef2ff
refs/heads/master
2020-03-07T08:46:53.438396
2018-04-11T02:31:24
2018-04-11T02:31:24
127,388,446
2
0
Apache-2.0
2018-04-11T02:31:25
2018-03-30T06:05:45
Java
UTF-8
Java
false
false
3,678
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package org.apache.skywalking.apm.collector.analysis.metric.provider.worker.service.refmetric; import org.apache.skywalking.apm.collector.storage.table.service.ServiceReferenceMetric; /** * @author peng-yongsheng */ public class ServiceReferenceMetricCopy { public static ServiceReferenceMetric copy(ServiceReferenceMetric serviceReferenceMetric) { ServiceReferenceMetric newServiceReferenceMetric = new ServiceReferenceMetric(); newServiceReferenceMetric.setId(serviceReferenceMetric.getId()); newServiceReferenceMetric.setMetricId(serviceReferenceMetric.getMetricId()); newServiceReferenceMetric.setSourceValue(serviceReferenceMetric.getSourceValue()); newServiceReferenceMetric.setFrontApplicationId(serviceReferenceMetric.getFrontApplicationId()); newServiceReferenceMetric.setFrontInstanceId(serviceReferenceMetric.getFrontInstanceId()); newServiceReferenceMetric.setFrontServiceId(serviceReferenceMetric.getFrontServiceId()); newServiceReferenceMetric.setBehindApplicationId(serviceReferenceMetric.getBehindApplicationId()); newServiceReferenceMetric.setBehindInstanceId(serviceReferenceMetric.getBehindInstanceId()); newServiceReferenceMetric.setBehindServiceId(serviceReferenceMetric.getBehindServiceId()); newServiceReferenceMetric.setTransactionCalls(serviceReferenceMetric.getTransactionCalls()); newServiceReferenceMetric.setTransactionDurationSum(serviceReferenceMetric.getTransactionDurationSum()); newServiceReferenceMetric.setTransactionErrorCalls(serviceReferenceMetric.getTransactionErrorCalls()); newServiceReferenceMetric.setTransactionErrorDurationSum(serviceReferenceMetric.getTransactionErrorDurationSum()); newServiceReferenceMetric.setBusinessTransactionCalls(serviceReferenceMetric.getBusinessTransactionCalls()); newServiceReferenceMetric.setBusinessTransactionDurationSum(serviceReferenceMetric.getBusinessTransactionDurationSum()); newServiceReferenceMetric.setBusinessTransactionErrorCalls(serviceReferenceMetric.getBusinessTransactionErrorCalls()); newServiceReferenceMetric.setBusinessTransactionErrorDurationSum(serviceReferenceMetric.getBusinessTransactionErrorDurationSum()); newServiceReferenceMetric.setMqTransactionCalls(serviceReferenceMetric.getMqTransactionCalls()); newServiceReferenceMetric.setMqTransactionDurationSum(serviceReferenceMetric.getMqTransactionDurationSum()); newServiceReferenceMetric.setMqTransactionErrorCalls(serviceReferenceMetric.getMqTransactionErrorCalls()); newServiceReferenceMetric.setMqTransactionErrorDurationSum(serviceReferenceMetric.getMqTransactionErrorDurationSum()); newServiceReferenceMetric.setTimeBucket(serviceReferenceMetric.getTimeBucket()); return newServiceReferenceMetric; } }
[ "8082209@qq.com" ]
8082209@qq.com