blob_id
stringlengths 40
40
| language
stringclasses 1
value | repo_name
stringlengths 5
132
| path
stringlengths 2
382
| src_encoding
stringclasses 34
values | length_bytes
int64 9
3.8M
| score
float64 1.5
4.94
| int_score
int64 2
5
| detected_licenses
listlengths 0
142
| license_type
stringclasses 2
values | text
stringlengths 9
3.8M
| download_success
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
c86da7d021199f85540133a66290a0ba5bc9d6c9
|
Java
|
SinoryWu/DaoqiManagement1.0
|
/app/src/main/java/com/example/daoqimanagement/bean/PartnerPrepareListResponse.java
|
UTF-8
| 8,834
| 2.171875
| 2
|
[] |
no_license
|
package com.example.daoqimanagement.bean;
import java.util.List;
public class PartnerPrepareListResponse {
/**
* code : 0
* data : {"current_page":1,"data":[{"hospitalid":1,"protectTime":null,"prepareId":20,"status":1,"productName":"八戒睡眠-购买设备","hospitalName":"杭州市第一人民医院","truename":"荔枝面","hospitalPic":"/upload/20210224/fc640e8f7f2cf3155e5415c5f83a3a8d.jpg","scheduleNum":0}],"first_page_url":"http://47.98.205.142:9510/v1/team/prepareList?page=1","from":1,"last_page":1,"last_page_url":"http://47.98.205.142:9510/v1/team/prepareList?page=1","next_page_url":null,"path":"http://47.98.205.142:9510/v1/team/prepareList","per_page":15,"prev_page_url":null,"to":1,"total":1}
* msg : ok
*/
private int code;
private DataBeanX data;
private String msg;
@Override
public String toString() {
return "PartnerPrepareListResponse{" +
"code=" + code +
", data=" + data +
", msg='" + msg + '\'' +
'}';
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public DataBeanX getData() {
return data;
}
public void setData(DataBeanX data) {
this.data = data;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public static class DataBeanX {
@Override
public String toString() {
return "DataBeanX{" +
"current_page=" + current_page +
", first_page_url='" + first_page_url + '\'' +
", from=" + from +
", last_page=" + last_page +
", last_page_url='" + last_page_url + '\'' +
", next_page_url=" + next_page_url +
", path='" + path + '\'' +
", per_page=" + per_page +
", prev_page_url=" + prev_page_url +
", to=" + to +
", total=" + total +
", data=" + data +
'}';
}
/**
* current_page : 1
* data : [{"hospitalid":1,"protectTime":null,"prepareId":20,"status":1,"productName":"八戒睡眠-购买设备","hospitalName":"杭州市第一人民医院","truename":"荔枝面","hospitalPic":"/upload/20210224/fc640e8f7f2cf3155e5415c5f83a3a8d.jpg","scheduleNum":0}]
* first_page_url : http://47.98.205.142:9510/v1/team/prepareList?page=1
* from : 1
* last_page : 1
* last_page_url : http://47.98.205.142:9510/v1/team/prepareList?page=1
* next_page_url : null
* path : http://47.98.205.142:9510/v1/team/prepareList
* per_page : 15
* prev_page_url : null
* to : 1
* total : 1
*/
private int current_page;
private String first_page_url;
private int from;
private int last_page;
private String last_page_url;
private Object next_page_url;
private String path;
private int per_page;
private Object prev_page_url;
private int to;
private int total;
private List<DataBean> data;
public int getCurrent_page() {
return current_page;
}
public void setCurrent_page(int current_page) {
this.current_page = current_page;
}
public String getFirst_page_url() {
return first_page_url;
}
public void setFirst_page_url(String first_page_url) {
this.first_page_url = first_page_url;
}
public int getFrom() {
return from;
}
public void setFrom(int from) {
this.from = from;
}
public int getLast_page() {
return last_page;
}
public void setLast_page(int last_page) {
this.last_page = last_page;
}
public String getLast_page_url() {
return last_page_url;
}
public void setLast_page_url(String last_page_url) {
this.last_page_url = last_page_url;
}
public Object getNext_page_url() {
return next_page_url;
}
public void setNext_page_url(Object next_page_url) {
this.next_page_url = next_page_url;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public int getPer_page() {
return per_page;
}
public void setPer_page(int per_page) {
this.per_page = per_page;
}
public Object getPrev_page_url() {
return prev_page_url;
}
public void setPrev_page_url(Object prev_page_url) {
this.prev_page_url = prev_page_url;
}
public int getTo() {
return to;
}
public void setTo(int to) {
this.to = to;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean {
/**
* hospitalid : 1
* protectTime : null
* prepareId : 20
* status : 1
* productName : 八戒睡眠-购买设备
* hospitalName : 杭州市第一人民医院
* truename : 荔枝面
* hospitalPic : /upload/20210224/fc640e8f7f2cf3155e5415c5f83a3a8d.jpg
* scheduleNum : 0
*/
private int hospitalid;
private String protectTime;
private int prepareId;
private int status;
private String productName;
private String hospitalName;
private String truename;
private String hospitalPic;
private int scheduleNum;
@Override
public String toString() {
return "DataBean{" +
"hospitalid=" + hospitalid +
", protectTime=" + protectTime +
", prepareId=" + prepareId +
", status=" + status +
", productName='" + productName + '\'' +
", hospitalName='" + hospitalName + '\'' +
", truename='" + truename + '\'' +
", hospitalPic='" + hospitalPic + '\'' +
", scheduleNum=" + scheduleNum +
'}';
}
public int getHospitalid() {
return hospitalid;
}
public void setHospitalid(int hospitalid) {
this.hospitalid = hospitalid;
}
public String getProtectTime() {
return protectTime;
}
public void setProtectTime(String protectTime) {
this.protectTime = protectTime;
}
public int getPrepareId() {
return prepareId;
}
public void setPrepareId(int prepareId) {
this.prepareId = prepareId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getHospitalName() {
return hospitalName;
}
public void setHospitalName(String hospitalName) {
this.hospitalName = hospitalName;
}
public String getTruename() {
return truename;
}
public void setTruename(String truename) {
this.truename = truename;
}
public String getHospitalPic() {
return hospitalPic;
}
public void setHospitalPic(String hospitalPic) {
this.hospitalPic = hospitalPic;
}
public int getScheduleNum() {
return scheduleNum;
}
public void setScheduleNum(int scheduleNum) {
this.scheduleNum = scheduleNum;
}
}
}
}
| true
|
f0716fd04365b9247f7d590a5ae13b845387e141
|
Java
|
husainahmad/wings
|
/src/java/com/wings/web/struts/forms/JobsheetsoForm.java
|
UTF-8
| 10,384
| 1.835938
| 2
|
[] |
no_license
|
package com.wings.web.struts.forms;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
/**
* Form for jobsheetso.
*
* @author <a href="http://boss.bekk.no/boss/middlegen/"/>Middlegen</a>
*
* @struts.form name="jobsheetsoForm"
*/
public class JobsheetsoForm extends ActionForm {
private final static SimpleDateFormat FORMAT = new SimpleDateFormat("dd/MM/yyyy");
private java.lang.Integer _idJobSheetSo = null;
private java.lang.Integer _idJobSheet = null;
private java.lang.String _shippingLine = null;
private java.lang.String _shippingLineName = null;
private java.lang.String _feederVessel = null;
private java.lang.String _mvessel = null;
private java.lang.String _termMbl = null;
private java.lang.String _termHbl = null;
private java.lang.String _origin = null;
private java.lang.String _destination = null;
private java.util.Date _etdorigin = null;
private java.util.Date _etadestination = null;
private java.lang.String _mbl = null;
private java.lang.String _trucking = null;
private java.lang.String _commodity = null;
private java.lang.String _dnNo;
private java.lang.String _billTo;
private java.lang.String _cnNo;
private java.lang.String _billToDebit = null;
/**
* Standard constructor.
*/
public JobsheetsoForm() {
}
/**
* Returns the idJobSheetSo
*
* @return the idJobSheetSo
*/
public java.lang.Integer getIdJobSheetSo() {
return _idJobSheetSo;
}
/**
* Sets the idJobSheetSo
*
* @param idJobSheetSo the new idJobSheetSo value
*/
public void setIdJobSheetSo(java.lang.Integer idJobSheetSo) {
_idJobSheetSo = idJobSheetSo;
}
/**
* Returns the idJobSheet
*
* @return the idJobSheet
*/
public java.lang.Integer getIdJobSheet() {
return _idJobSheet;
}
/**
* Sets the idJobSheet
*
* @param idJobSheet the new idJobSheet value
*/
public void setIdJobSheet(java.lang.Integer idJobSheet) {
_idJobSheet = idJobSheet;
}
/**
* Returns the shippingLine
*
* @return the shippingLine
*/
public java.lang.String getShippingLine() {
return _shippingLine;
}
/**
* Sets the shippingLine
*
* @param shippingLine the new shippingLine value
*/
public void setShippingLine(java.lang.String shippingLine) {
_shippingLine = shippingLine;
}
/**
* Returns the feederVessel
*
* @return the feederVessel
*/
public java.lang.String getFeederVessel() {
return _feederVessel;
}
/**
* Sets the feederVessel
*
* @param feederVessel the new feederVessel value
*/
public void setFeederVessel(java.lang.String feederVessel) {
_feederVessel = feederVessel;
}
/**
* Returns the mvessel
*
* @return the mvessel
*/
public java.lang.String getMvessel() {
return _mvessel;
}
/**
* Sets the mvessel
*
* @param mvessel the new mvessel value
*/
public void setMvessel(java.lang.String mvessel) {
_mvessel = mvessel;
}
/**
* Returns the termMbl
*
* @return the termMbl
*/
public java.lang.String getTermMbl() {
return _termMbl;
}
/**
* Sets the termMbl
*
* @param termMbl the new termMbl value
*/
public void setTermMbl(java.lang.String termMbl) {
_termMbl = termMbl;
}
/**
* Returns the termHbl
*
* @return the termHbl
*/
public java.lang.String getTermHbl() {
return _termHbl;
}
/**
* Sets the termHbl
*
* @param termHbl the new termHbl value
*/
public void setTermHbl(java.lang.String termHbl) {
_termHbl = termHbl;
}
/**
* Returns the origin
*
* @return the origin
*/
public java.lang.String getOrigin() {
return _origin;
}
/**
* Sets the origin
*
* @param origin the new origin value
*/
public void setOrigin(java.lang.String origin) {
_origin = origin;
}
/**
* Returns the destination
*
* @return the destination
*/
public java.lang.String getDestination() {
return _destination;
}
/**
* Sets the destination
*
* @param destination the new destination value
*/
public void setDestination(java.lang.String destination) {
_destination = destination;
}
/**
* Returns the etdorigin
*
* @return the etdorigin
*/
public java.util.Date getEtdorigin() {
return _etdorigin;
}
/**
* Returns the etdorigin as a String
*
* @return the etdorigin as a String
*/
public String getEtdoriginAsString() {
if( getEtdorigin() != null ) {
return getFORMAT().format(getEtdorigin());
}
else {
return "";
}
}
/**
* Sets the etdorigin
*
* @param etdorigin the new etdorigin value
*/
public void setEtdorigin(java.util.Date etdorigin) {
_etdorigin = etdorigin;
}
/**
* Sets the etdorigin as a String.
*
* @param etdorigin the new etdorigin value as a String
*/
public void setEtdoriginAsString(String etdorigin) {
try {
setEtdorigin(new java.util.Date(getFORMAT().parse(etdorigin).getTime()));
} catch (ParseException pe) {
//setEtdorigin(new java.util.Date((new java.util.Date()).getTime()));
setEtdorigin(null);
}
}
/**
* Returns the etadestination
*
* @return the etadestination
*/
public java.util.Date getEtadestination() {
return _etadestination;
}
/**
* Returns the etadestination as a String
*
* @return the etadestination as a String
*/
public String getEtadestinationAsString() {
if( getEtadestination() != null ) {
return getFORMAT().format(getEtadestination());
}
else {
return "";
}
}
/**
* Sets the etadestination
*
* @param etadestination the new etadestination value
*/
public void setEtadestination(java.util.Date etadestination) {
_etadestination = etadestination;
}
/**
* Sets the etadestination as a String.
*
* @param etadestination the new etadestination value as a String
*/
public void setEtadestinationAsString(String etadestination) {
try {
setEtadestination(new java.util.Date(getFORMAT().parse(etadestination).getTime()));
} catch (ParseException pe) {
//setEtadestination(new java.util.Date((new java.util.Date()).getTime()));
setEtadestination(null);
}
}
/**
* Returns the mbl
*
* @return the mbl
*/
public java.lang.String getMbl() {
return _mbl;
}
/**
* Sets the mbl
*
* @param mbl the new mbl value
*/
public void setMbl(java.lang.String mbl) {
_mbl = mbl;
}
/**
* Returns the trucking
*
* @return the trucking
*/
public java.lang.String getTrucking() {
return _trucking;
}
/**
* Sets the trucking
*
* @param trucking the new trucking value
*/
public void setTrucking(java.lang.String trucking) {
_trucking = trucking;
}
/**
* Validate the properties that have been set from this HTTP request,
* and return an <code>ActionErrors</code> object that encapsulates any
* validation errors that have been found. If no errors are found, return
* <code>null</code> or an <code>ActionErrors</code> object with no
* recorded error messages.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
*/
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
// test for nullity
if(getIdJobSheetSo() == null) {
errors.add("idJobSheetSo", new ActionError("error.idJobSheetSo.required"));
}
if(getIdJobSheet() == null) {
errors.add("idJobSheet", new ActionError("error.idJobSheet.required"));
}
// TODO test format/data
return errors;
}
public java.lang.String getCommodity() {
return _commodity;
}
public void setCommodity(java.lang.String commodity) {
this._commodity = commodity;
}
private java.util.Date _sinDate = null;
public String getSinDateAsString() {
if( getSinDate() != null ) {
return getFORMAT().format(getSinDate());
}
else {
return "";
}
}
public void setSinDateAsString(String sinDate) {
try {
setSinDate(new java.util.Date(getFORMAT().parse(sinDate).getTime()));
} catch (ParseException pe) {
//setSinDate(new java.util.Date((new java.util.Date()).getTime()));
setSinDate(null);
}
}
public java.util.Date getSinDate() {
return _sinDate;
}
public void setSinDate(java.util.Date sinDate) {
this._sinDate = sinDate;
}
public java.lang.String getDnNo() {
return _dnNo;
}
public void setDnNo(java.lang.String dnNo) {
this._dnNo = dnNo;
}
public java.lang.String getBillTo() {
return _billTo;
}
public void setBillTo(java.lang.String billTo) {
this._billTo = billTo;
}
public java.lang.String getCnNo() {
return _cnNo;
}
public void setCnNo(java.lang.String cnNo) {
this._cnNo = cnNo;
}
public static SimpleDateFormat getFORMAT() {
return FORMAT;
}
public java.lang.String getBillToDebit() {
return _billToDebit;
}
public void setBillToDebit(java.lang.String billToDebit) {
this._billToDebit = billToDebit;
}
/**
* @return the _shippingLineName
*/
public java.lang.String getShippingLineName() {
return _shippingLineName;
}
/**
* @param shippingLineName the _shippingLineName to set
*/
public void setShippingLineName(java.lang.String shippingLineName) {
this._shippingLineName = shippingLineName;
}
}
| true
|
df1c63da65ccc8524d6c6378fb0b782eac076f3e
|
Java
|
omochi/IronCake-Android-Module
|
/src/main/java/com/omochimetaru/ironcake/Activity.java
|
UTF-8
| 2,196
| 2.328125
| 2
|
[] |
no_license
|
package com.omochimetaru.ironcake;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
/**
* Created by omochi on 2014/01/24.
*/
/*
onCreateでapplicationのLaunch,
eglDisplayの初期化
onCreateのユーザサイドで画面configを設定しておく
onSurfaceTextureAvailableで、
設定されたconfigでeglContext, eglSurfaceを生成、
ユーザサイドにGLの初期化を通知
onSurfaceTextureChangedで、
eglSurfaceを再生成
ユーザサイドに画面サイズの変更を通知
onSurfaceTextureDestroyedで、
eglContext, eglSurfaceを解放
ユーザサイドにGLの終了を通知
onDestroyでeglDisplayの解放
*/
public abstract class Activity extends android.app.Activity implements SurfaceHolder.Callback {
static {
System.loadLibrary("IronCake");
}
private long application;
private SurfaceView surfaceView;
//ネイティブ化してオーバライドするように
protected abstract long controllerConstruct();
private native void didCreate();
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
surfaceView = new SurfaceView(this);
surfaceView.getHolder().setFormat(PixelFormat.RGBA_8888);
surfaceView.getHolder().addCallback(this);
setContentView(surfaceView);
didCreate();
}
private native void willDestroy();
@Override
protected void onDestroy(){
willDestroy();
super.onDestroy();
}
private native void didResume();
@Override
protected void onResume(){
super.onResume();
didResume();
}
private native void willPause();
@Override
protected void onPause(){
willPause();
super.onPause();
}
@Override
public native void surfaceCreated(SurfaceHolder surfaceHolder);
@Override
public native void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height);
@Override
public native void surfaceDestroyed(SurfaceHolder surfaceHolder);
}
| true
|
c4b8a1eb191ceaead6db15d29d0777331d7b5af8
|
Java
|
Vishal904/Machine-Learning
|
/Java Projects/HibernateProject/src/main/java/EditPost.java
|
UTF-8
| 2,647
| 2.59375
| 3
|
[] |
no_license
|
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(urlPatterns = "/editpost.do")
public class EditPost extends HttpServlet {
private static SessionFactory factory;
int postid;
/**
* method to update the query
* @param postid
* @param title
* @param description
*/
private void updatePost(int postid, String title, String description) {
Session session = null;
Transaction tx = null;
try {
factory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
session = factory.openSession();
tx = session.beginTransaction();
Post post = (Post) session.get(Post.class,postid);
post.setPosttitle(title);
post.setDescription(description);
session.update(post);
tx.commit();
}catch (Exception e) {
if(tx != null) tx.rollback();
e.printStackTrace();
}finally {
session.close();
}
}
/**
* method to handle request to edit post jsp and call the addpost method to addNewPost for the user
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setAttribute("title",request.getParameter("title"));
request.setAttribute("description",request.getParameter("description"));
postid = Integer.parseInt(request.getParameter("postid"));
request.getRequestDispatcher("/WEB-INF/views/editpost.jsp").forward(request,response);
}
/**
* method to move back to post listing of an user
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String title = request.getParameter("title");
String description = request.getParameter("description");
updatePost(postid, title, description);
response.sendRedirect("userposts.do");
}
}
| true
|
a4c9a804e3a5ae61853773d89f75592b1b63f65b
|
Java
|
atthisaccount/SPay-inner-workings
|
/boot.oat_files/arm64/dex/out1/com/broadcom/fm/fmreceiver/IFmReceiverCallback.java
|
UTF-8
| 7,719
| 2.140625
| 2
|
[] |
no_license
|
package com.broadcom.fm.fmreceiver;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
public interface IFmReceiverCallback extends IInterface {
public static abstract class Stub extends Binder implements IFmReceiverCallback {
private static final String DESCRIPTOR = "com.broadcom.fm.fmreceiver.IFmReceiverCallback";
static final int TRANSACTION_onRdsAFEvent = 4;
static final int TRANSACTION_onRdsDataEvent = 2;
static final int TRANSACTION_onRdsPIECCEvent = 5;
static final int TRANSACTION_onRdsRTPlusEvent = 3;
static final int TRANSACTION_onStatusEvent = 1;
private static class Proxy implements IFmReceiverCallback {
private IBinder mRemote;
Proxy(IBinder remote) {
this.mRemote = remote;
}
public IBinder asBinder() {
return this.mRemote;
}
public String getInterfaceDescriptor() {
return Stub.DESCRIPTOR;
}
public void onStatusEvent(int freq, int rssi, int snr, boolean radioIsOn, int rdsProgramType, String rdsProgramService, String rdsRadioText, String rdsProgramTypeName, boolean isMute) throws RemoteException {
int i = 1;
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
_data.writeInt(freq);
_data.writeInt(rssi);
_data.writeInt(snr);
_data.writeInt(radioIsOn ? 1 : 0);
_data.writeInt(rdsProgramType);
_data.writeString(rdsProgramService);
_data.writeString(rdsRadioText);
_data.writeString(rdsProgramTypeName);
if (!isMute) {
i = 0;
}
_data.writeInt(i);
this.mRemote.transact(1, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
public void onRdsDataEvent(int rdsDataType, int rdsIndex, String rdsText) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
_data.writeInt(rdsDataType);
_data.writeInt(rdsIndex);
_data.writeString(rdsText);
this.mRemote.transact(2, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
public void onRdsRTPlusEvent(int contentType1, int startPos1, int additionalLen1, int contentType2, int startPos2, int additionalLen2) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
_data.writeInt(contentType1);
_data.writeInt(startPos1);
_data.writeInt(additionalLen1);
_data.writeInt(contentType2);
_data.writeInt(startPos2);
_data.writeInt(additionalLen2);
this.mRemote.transact(3, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
public void onRdsAFEvent(int afreq) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
_data.writeInt(afreq);
this.mRemote.transact(4, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
public void onRdsPIECCEvent(int pi, int ecc) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(Stub.DESCRIPTOR);
_data.writeInt(pi);
_data.writeInt(ecc);
this.mRemote.transact(5, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
}
public Stub() {
attachInterface(this, DESCRIPTOR);
}
public static IFmReceiverCallback asInterface(IBinder obj) {
if (obj == null) {
return null;
}
IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
if (iin == null || !(iin instanceof IFmReceiverCallback)) {
return new Proxy(obj);
}
return (IFmReceiverCallback) iin;
}
public IBinder asBinder() {
return this;
}
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
switch (code) {
case 1:
data.enforceInterface(DESCRIPTOR);
onStatusEvent(data.readInt(), data.readInt(), data.readInt(), data.readInt() != 0, data.readInt(), data.readString(), data.readString(), data.readString(), data.readInt() != 0);
reply.writeNoException();
return true;
case 2:
data.enforceInterface(DESCRIPTOR);
onRdsDataEvent(data.readInt(), data.readInt(), data.readString());
reply.writeNoException();
return true;
case 3:
data.enforceInterface(DESCRIPTOR);
onRdsRTPlusEvent(data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt(), data.readInt());
reply.writeNoException();
return true;
case 4:
data.enforceInterface(DESCRIPTOR);
onRdsAFEvent(data.readInt());
reply.writeNoException();
return true;
case 5:
data.enforceInterface(DESCRIPTOR);
onRdsPIECCEvent(data.readInt(), data.readInt());
reply.writeNoException();
return true;
case 1598968902:
reply.writeString(DESCRIPTOR);
return true;
default:
return super.onTransact(code, data, reply, flags);
}
}
}
void onRdsAFEvent(int i) throws RemoteException;
void onRdsDataEvent(int i, int i2, String str) throws RemoteException;
void onRdsPIECCEvent(int i, int i2) throws RemoteException;
void onRdsRTPlusEvent(int i, int i2, int i3, int i4, int i5, int i6) throws RemoteException;
void onStatusEvent(int i, int i2, int i3, boolean z, int i4, String str, String str2, String str3, boolean z2) throws RemoteException;
}
| true
|
64b6e338cc40e9aa4e9c1d62d8b1f50f3b0b8269
|
Java
|
mrbing47/KPIT
|
/app/src/main/java/garg/sarthik/kpit/POJO/Order.java
|
UTF-8
| 2,660
| 2.390625
| 2
|
[] |
no_license
|
package garg.sarthik.kpit.POJO;
import android.os.Parcel;
import android.os.Parcelable;
public class Order implements Parcelable {
//Order will be in the format of -> YYYYMMDDHHMMSS-SR
String orderId;
String bookedTime;
String arrivalTime;
String bookingStatus;
String userId;
int slots;
int penalty;
Location location;
public Order() {
}
public Order(String orderId, String bookedTime, String arrivalTime, String bookingStatus, int slots, int penalty, Location location, String userId) {
this.orderId = orderId;
this.bookedTime = bookedTime;
this.arrivalTime = arrivalTime;
this.bookingStatus = bookingStatus;
this.slots = slots;
this.penalty = penalty;
this.location = location;
this.userId = userId;
}
protected Order(Parcel in) {
orderId = in.readString();
bookedTime = in.readString();
arrivalTime = in.readString();
bookingStatus = in.readString();
userId = in.readString();
slots = in.readInt();
penalty = in.readInt();
location = in.readParcelable(Location.class.getClassLoader());
}
public static final Creator<Order> CREATOR = new Creator<Order>() {
@Override
public Order createFromParcel(Parcel in) {
return new Order(in);
}
@Override
public Order[] newArray(int size) {
return new Order[size];
}
};
public String getOrderId() {
return orderId;
}
public String getBookedTime() {
return bookedTime;
}
public String getArrivalTime() {
return arrivalTime;
}
public String getBookingStatus() {
return bookingStatus;
}
public int getSlots() {
return slots;
}
public int getPenalty() {
return penalty;
}
public Location getLocation() {
return location;
}
public void setBookingStatus(String bookingStatus) {
this.bookingStatus = bookingStatus;
}
public void setPenalty(int penalty) {
this.penalty = penalty;
}
public String getUserId() {
return userId;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(orderId);
dest.writeString(bookedTime);
dest.writeString(arrivalTime);
dest.writeString(bookingStatus);
dest.writeString(userId);
dest.writeInt(slots);
dest.writeInt(penalty);
dest.writeParcelable(location, flags);
}
}
| true
|
eb569bde05dd05cfa7e8a17c7b7adec54cd68efa
|
Java
|
loveuu715/ZFDemo
|
/app/src/main/java/com/loveuu/vv/api/core/ApiService.java
|
UTF-8
| 6,422
| 2.265625
| 2
|
[] |
no_license
|
package com.loveuu.vv.api.core;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.loveuu.vv.api.ICallback;
import com.loveuu.vv.api.JsonParser;
import com.loveuu.vv.utils.LogUtil;
import rx.Observable;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
/**
* Created by VV on 2016/9/22.
*/
public class ApiService {
private static final String TAG = "ApiService";
/**
* 获取列表
*
* @param responseObservable
* @param clazz
* @param callback
*/
public static <T> Subscription applySchedulersForList(Observable<T> responseObservable, final Class<?> clazz, Object tag, final ICallback callback) {
Subscription subscription = responseObservable.subscribeOn(Schedulers.io())//改变call的线程
.observeOn(AndroidSchedulers.mainThread())//改变onNext的线程
.subscribe(new HttpSubscriber<T>() {
@Override
public void onStart() {
LogUtil.i(TAG, "- - -开始请求- - -");
}
@Override
public void onMyNext(String jsonStr) {
LogUtil.i(TAG, "- - -请求数据:===>" + jsonStr);
if (callback != null)
callback.onSuccess(JsonParser.jsonStrToListBean(jsonStr, clazz));
}
@Override
public void onMyError(int errorCode, String errorMsg) {
LogUtil.e(TAG, "- - -请求失败:====>|errorCode : " + errorCode + "|<==errorMsg : " + errorMsg + "|");
if (callback != null)
callback.onError(errorCode, errorMsg);
}
@Override
public void onMyCompleted() {
LogUtil.i(TAG, "- - -请求完成- - -");
}
@Override
public void onDataEmpty() {
if (callback != null)
callback.onEmpty();
}
});
if (tag != null)
ApiStack.getInstance().enqueue(subscription, tag);
return subscription;
}
/**
* 获取对象
*
* @param responseObservable
* @param clazz
* @param callback
* @param <T>
*/
public static <T> Subscription applySchedulersObject(Observable<T> responseObservable, final Class<?> clazz, Object tag, final ICallback callback) {
Subscription subscription = responseObservable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new HttpSubscriber<T>() {
@Override
public void onStart() {
LogUtil.i(TAG, "- - -开始请求- - -");
}
@Override
public void onMyNext(String jsonStr) {
LogUtil.i(TAG, "- - -请求数据:===>" + jsonStr);
if (callback != null)
callback.onSuccess(JsonParser.jsonStrToBean(jsonStr, clazz));
}
@Override
public void onMyError(int errorCode, String errorMsg) {
LogUtil.e(TAG, "- - -请求失败:====>|errorCode : " + errorCode + "|<==errorMsg : " + errorMsg + "|");
if (callback != null)
callback.onError(errorCode, errorMsg);
}
@Override
public void onMyCompleted() {
LogUtil.i(TAG, "- - -请求完成- - - ");
}
@Override
public void onDataEmpty() {
if (callback != null)
callback.onEmpty();
}
});
if (tag != null)
ApiStack.getInstance().enqueue(subscription, tag);
return subscription;
}
/**
* 自定义解析器
*
* @param responseObservable
* @param callback
* @param <T>
*/
public static <T> Subscription applySchedulersCustome(Observable<T> responseObservable, Object tag, final ICallback<String> callback) {
Subscription subscription = responseObservable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new HttpSubscriber<T>() {
@Override
public void onStart() {
LogUtil.i(TAG, "- - -开始请求- - -");
}
@Override
public void onNext(T t) {
try {
onMyNext(ApiManager.objectMapper.writeValueAsString(t));
} catch (JsonProcessingException e) {
e.printStackTrace();
onMyError(HttpSubscriber.LOCAL_ERROR_CODE, e.getMessage());
}
}
@Override
public void onMyNext(String jsonStr) {
LogUtil.i(TAG, "- - -请求数据:===>" + jsonStr);
if (callback != null)
callback.onSuccess(jsonStr);
}
@Override
public void onMyError(int errorCode, String errorMsg) {
LogUtil.e(TAG, "- - -请求失败:====>|errorCode : " + errorCode + "|<==errorMsg : " + errorMsg + "|");
if (callback != null)
callback.onError(errorCode, errorMsg);
}
@Override
public void onMyCompleted() {
LogUtil.i(TAG, "- - -请求完成- - - ");
}
@Override
public void onDataEmpty() {
if (callback != null)
callback.onEmpty();
}
});
if (tag != null)
ApiStack.getInstance().enqueue(subscription, tag);
return subscription;
}
}
| true
|
86ae1ae1f7f853d674f6cb5332a5a20926688f60
|
Java
|
Trovy/health
|
/health_parent/health_dao/src/main/java/com/trovy/health/dao/CheckItemDao.java
|
UTF-8
| 374
| 1.945313
| 2
|
[] |
no_license
|
package com.trovy.health.dao;
import com.trovy.health.pojo.CheckItem;
import java.util.List;
/**
* @Author: Trovy
* @Date: 2020/10/23 10:18
*/
public interface CheckItemDao {
/**
* 查询所有检查项
* @return
*/
List<CheckItem> findAll();
/**
* 添加检查项
* @param checkItem
*/
void add(CheckItem checkItem);
}
| true
|
223ab6d090527fa01ed247435eb1203265e2c28b
|
Java
|
JetBrains/MPS
|
/languages/languageDesign/editor/source_gen/jetbrains/mps/lang/editor/editor/AttributeStyleClassItem_SubstituteMenu.java
|
UTF-8
| 3,662
| 1.570313
| 2
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
package jetbrains.mps.lang.editor.editor;
/*Generated by MPS */
import jetbrains.mps.nodeEditor.menus.substitute.SubstituteMenuBase;
import jetbrains.mps.lang.editor.menus.EditorMenuDescriptorBase;
import jetbrains.mps.smodel.SNodePointer;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import jetbrains.mps.lang.editor.menus.MenuPart;
import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuItem;
import jetbrains.mps.openapi.editor.menus.substitute.SubstituteMenuContext;
import java.util.ArrayList;
import jetbrains.mps.lang.editor.menus.substitute.ConstraintsFilteringSubstituteMenuPartDecorator;
import jetbrains.mps.lang.editor.menus.substitute.ReferenceScopeSubstituteMenuPart;
import jetbrains.mps.lang.editor.menus.ConceptMenusPart;
import java.util.Collection;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import jetbrains.mps.lang.editor.menus.substitute.DefaultSubstituteMenuLookup;
import jetbrains.mps.smodel.language.LanguageRegistry;
import org.jetbrains.mps.openapi.language.SConcept;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SReferenceLink;
public class AttributeStyleClassItem_SubstituteMenu extends SubstituteMenuBase {
public AttributeStyleClassItem_SubstituteMenu() {
super(false, new EditorMenuDescriptorBase("default substitute menu for AttributeStyleClassItem. Generated from implicit smart reference attribute.", new SNodePointer("r:00000000-0000-4000-0000-011c8959029e(jetbrains.mps.lang.editor.structure)", "3982520150122341378")));
}
@NotNull
@Override
protected List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> getParts(final SubstituteMenuContext _context) {
List<MenuPart<SubstituteMenuItem, SubstituteMenuContext>> result = new ArrayList<MenuPart<SubstituteMenuItem, SubstituteMenuContext>>();
result.add(new ConstraintsFilteringSubstituteMenuPartDecorator(new SMP_ReferenceScope_c5cn0h_a(), CONCEPTS.AttributeStyleClassItem$Ec));
result.add(new SMP_Subconcepts_c5cn0h_b());
return result;
}
public class SMP_ReferenceScope_c5cn0h_a extends ReferenceScopeSubstituteMenuPart {
public SMP_ReferenceScope_c5cn0h_a() {
super(CONCEPTS.AttributeStyleClassItem$Ec, LINKS.attribute$PnEb, new EditorMenuDescriptorBase("reference scope substitute menu part", null));
}
}
public class SMP_Subconcepts_c5cn0h_b extends ConceptMenusPart<SubstituteMenuItem, SubstituteMenuContext> {
public SMP_Subconcepts_c5cn0h_b() {
super(new EditorMenuDescriptorBase("include menus for all the direct subconcepts of " + "AttributeStyleClassItem", null));
}
@Override
protected Collection<SAbstractConcept> getConcepts(final SubstituteMenuContext _context) {
return getDirectDescendants(_context, CONCEPTS.AttributeStyleClassItem$Ec);
}
@Override
protected Collection<SubstituteMenuItem> createItemsForConcept(SubstituteMenuContext context, SAbstractConcept concept) {
return context.createItems(new DefaultSubstituteMenuLookup(LanguageRegistry.getInstance(context.getEditorContext().getRepository()), concept));
}
}
private static final class CONCEPTS {
/*package*/ static final SConcept AttributeStyleClassItem$Ec = MetaAdapterFactory.getConcept(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x3744c0f9eae0a402L, "jetbrains.mps.lang.editor.structure.AttributeStyleClassItem");
}
private static final class LINKS {
/*package*/ static final SReferenceLink attribute$PnEb = MetaAdapterFactory.getReferenceLink(0x18bc659203a64e29L, 0xa83a7ff23bde13baL, 0x3744c0f9eae0a402L, 0x3744c0f9eae0b8d3L, "attribute");
}
}
| true
|
ca63d7ee010cf4bc0a9574f6daca8191d7eb5010
|
Java
|
guptamudit1992/Healthcare_DocnPat
|
/app/src/main/java/com/careons/app/Patient/Enums/AlbumTag.java
|
UTF-8
| 360
| 2.3125
| 2
|
[] |
no_license
|
package com.careons.app.Patient.Enums;
public enum AlbumTag {
Bills("Bills"),
Medicines("Medicines"),
LabReports("Lab Reports"),
Prescription("Prescription"),
Others("Others");
private final String albumTag;
AlbumTag(String s) {
albumTag = s;
}
public String getAlbumTag() {
return albumTag;
}
}
| true
|
1d9d7156b98fa443b0d3c791c5b3f65543c9d7d9
|
Java
|
xtayicy/Dubbo
|
/dubbo-provider/src/main/java/harry/dubbo/service/impl/DemoService.java
|
UTF-8
| 455
| 2.109375
| 2
|
[] |
no_license
|
package harry.dubbo.service.impl;
import org.springframework.stereotype.Service;
import harry.dubbo.entity.Computer;
import harry.dubbo.entity.User;
import harry.dubbo.service.IDemoService;
/**
*
* @author harry
*
*/
@Service
public class DemoService implements IDemoService {
public User queryUser(Integer id) {
User user = new User(id,"tom");
user.setComputer(new Computer(id, "computer"));
return user;
}
}
| true
|
edeabb395e376f6f6a747011554f5b560238c6e1
|
Java
|
ch-egli/logbook2
|
/logbook-service/src/main/java/ch/egli/training/repository/BenutzerRepository.java
|
UTF-8
| 640
| 1.953125
| 2
|
[] |
no_license
|
package ch.egli.training.repository;
import ch.egli.training.model.Benutzer;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Repository for entity Benutzer.
*
* @author Christian Egli
* @since 2/1/16.
*/
public interface BenutzerRepository extends CrudRepository<Benutzer, Long> {
Benutzer findByBenutzername(String benutzername);
List<Benutzer> findAllByOrderByIdAsc();
@Modifying
@Transactional
public void deleteByBenutzername(String benutzername);
}
| true
|
5dbc185afda67c61099d1e91de0ab018583d9281
|
Java
|
piyushagade/Coding-Interview-Preparation
|
/HashMaps/Practice.java
|
UTF-8
| 4,266
| 3.46875
| 3
|
[] |
no_license
|
public class Practice{
// MARK: Copy LinkedList with random pointers
public Node copyListWithRandomPointers(Node head){
HashMap<Node, Node> map = new HashMap();
for(Node cur = head; cur != null; cur = cur.next)
map.put(cur, new Node(Cur.value));
for(Node cur = head; cur != null; cur = cur.next){
map.get(cur).next = map.get(cur.next);
map.get(cur).random = map.get(cur.random);
}
return map.get(head);
}
// MARK: Group anagrams (Friendly words)
public List<List<String>> groupAnagrams(String[] words){
List<List<String>> result = new ArrayList<>();
HashMap<String, ArrayList<String>> map = new HashMap<>();
for(String word : words){
char[] chars = word.toCharArray();
chars.sort();
String key = String.valueOf(chars);
if(!map.containsKey(key))
map.put(key, new ArrayList<>());
map.get(key).add(word);
}
return result;
}
// MARK: Validate an anagram
public boolean validAnagram(String word1, word2){
int[] hash = new int[256];
for(char c : words1.toCharArray())
hash[c]++;
for(char c : word2.toCharArray())
hash[c]--;
for(int frequency : hash)
if(frequency != 0)
return false;
return true;
}
// MARK: Find repeated substrings of length 10 DNA subsequences
public List<String> repeatedSequence(String s){
HashSet<String> seen = new HashSet<>();
HashSet<String> repeated = new HashSet<>();
for(int i = 0; i < s.length() - 9; i++){
if(!seen.add(s.substring(i, i + 10)))
repeated.add(s.substring(i, i + 10));
}
return new ArrayList(repeated);
}
// MARK: Top k frequent elements in an array
public List<Integer> topKFrequent(int[] nums, int k){
List<Integer> result = new ArrayList<>();
PriorityQueue<Map.Entry<Integer, Integer>> pq =
new PriorityQueue((a,b) -> (b.getValue() - a.getValue()));
for(int i = 0; i < nums.length; i++){
map.put(nums[i], map.getOrDefault(nums[i], 0) + 1);
}
for(Map.Entry<Integer, Integer> entry : map.entrySet()){
pq.offer(entry);
}
for(int i = 0; i < k; i++){
result.add(pq.poll().getKey());
}
return result;
}
// MARK: Count the number of primes up to the integer n
public int countPrimes(int n){
boolean[] notPrimes = new boolean[n + 1];
for(int i = 0; i < n; i++)
notPrimes[i] = false;
notPrimes[0] = true;
notPrimes[1] = true;
for(int i = 2; i <= n; i++){
if(!notPrimes[i]){
count++;
for(int j = 2; i * j <= n; j++){
notPrimes[i * j] = true;
}
}
}
return count;
}
// MARK: Isomorphic strings
public boolean isomorphicStrings(String word1, String word2){
HashMap<Character, Character> map = new HashMap<>();
for(int i = 1; i <=2; i++){
for(int j = 0; j = word1.length(); j++){
if(map.containsKey(word1.charAt(j) && map.get(word1.charAt(j)) != word2.charAt(j))
return false;
map.put(word1.charAt(j), word2.charAt(j));
}
String temp = word1;
word1 = word2;
word2 = temp;
map = new HashMap<>();
}
return true;
}
// MARK: Island Perimeter
public int islandPerimeter(int[][] matrix){
int rows = matrix.length;
int cols = matrix[0].length;
int lands = 0;
int neighbours = 0;
for(int i = 0; i < rows; i++){
for(int j = 0; j < cols; j++){
land++;
if(i < rows - 1 && matrix[i + 1][j] == 1)
neighbours++;
if(j < cols - 1 && matrix[i][j + 1] == 1)
neighbours++;
}
}
return 4 * lands - 2 * neighbours;
}
// MARK: Word pattern
}
| true
|
d7e1cbb68010361b3aa8aad5d78b6b2cd4995cdd
|
Java
|
DhanviDesai/CodeShop
|
/app/src/main/java/com/example/codeshop/CheckOutActivity.java
|
UTF-8
| 1,922
| 2.296875
| 2
|
[] |
no_license
|
package com.example.codeshop;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.example.codeshop.model.ProductModel;
import com.google.gson.Gson;
import java.util.ArrayList;
public class CheckOutActivity extends AppCompatActivity {
private RecyclerView recyclerView;
private TextView total,proceedPay;
private ProductAdapter adapter;
private int totalCount;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_check_out);
init();
ArrayList<ProductModel> products = MainActivity.products;
adapter = new ProductAdapter(this,products);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
for(ProductModel product: products){
totalCount += Integer.parseInt(product.getProdPrice())*product.getQuantity();
}
total.setText("\u20b9 "+totalCount);
proceedPay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String data = new Gson().toJson(products);
Intent i = new Intent(CheckOutActivity.this,CodeActivity.class);
i.putExtra("Data",data);
startActivity(i);
}
});
}
public void init(){
recyclerView = findViewById(R.id.checkoutRecycler);
total = findViewById(R.id.textView3);
proceedPay = findViewById(R.id.textView4);
totalCount = 0;
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
}
| true
|
8193fab1bba15d23534a5a172681c8824910759b
|
Java
|
musicalwave/artbureau
|
/web/src/main/java/com/itsoft/ab/controllers/tm/AdminController.java
|
UTF-8
| 4,114
| 2.21875
| 2
|
[] |
no_license
|
package com.itsoft.ab.controllers.tm;
import com.itsoft.ab.beans.AuthMaster;
import com.itsoft.ab.beans.JournalMaster;
import com.itsoft.ab.beans.UserMaster;
import com.itsoft.ab.exceptions.ApplicationException;
import com.itsoft.ab.model.JClientsModel;
import com.itsoft.ab.model.JLessonTransfer;
import com.itsoft.ab.model.SimpleModel;
import com.itsoft.ab.persistence.JournalMapper;
import com.itsoft.ab.sys.ECode;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Created with IntelliJ IDEA.
* User: itertychnyi
* Date: 18.02.14
* Time: 21:11
*/
@Controller
public class AdminController {
Logger LOG = Logger.getLogger(AdminController.class);
@Autowired
private AuthMaster authMaster;
@Autowired
private JournalMapper journalMapper;
@Autowired
private UserMaster userMaster;
@Autowired
private JournalMaster journalMaster;
@RequestMapping(value="/tm/admin", method = RequestMethod.GET)
public String home(Model m){
m = authMaster.setModel(m);
return "/tm/admin/index";
}
@RequestMapping(value="/tm/transfer", method = RequestMethod.POST)
public String transfer(@ModelAttribute SimpleModel date, Model m){
m = authMaster.setModel(m);
try {
java.util.Date d = new SimpleDateFormat("dd-MM-yyyy").parse(date.getName());
List<JLessonTransfer> data = journalMapper.getDateTransfers(new java.sql.Date(d.getTime()));
for(JLessonTransfer j : data){
j.setFromDateS(new SimpleDateFormat("dd MMMM yyyy").format(j.getFromDate()));
j.setToDateS(new SimpleDateFormat("dd MMMM yyyy").format(j.getToDate()));
j.setActDateS(new SimpleDateFormat("dd MMMM yyyy").format(j.getActDate()));
}
m.addAttribute("lessons", data);
m.addAttribute("date", new SimpleModel());
return "/tm/admin/transfer";
} catch (ParseException e) {
throw new ApplicationException(ECode.ERROR415);
}
}
@RequestMapping(value="/tm/transfer", method = RequestMethod.GET)
public String transferDefault(Model m){
m = authMaster.setModel(m);
m.addAttribute("lessons", new ArrayList<JLessonTransfer>());
m.addAttribute("date", new SimpleModel());
return "/tm/admin/transfer";
}
@RequestMapping(value="/tm/clients", method = RequestMethod.POST)
public String client(@ModelAttribute SimpleModel date, Model m){
m = authMaster.setModel(m);
try {
Date fromDate = new SimpleDateFormat("dd-MM-yyyy").parse(date.getName());
//Получаем следующий день
Calendar calendar = new GregorianCalendar();
calendar.setTime(fromDate);
calendar.add(Calendar.DATE, 1);
Date toDate = calendar.getTime();
m.addAttribute("clients", journalMaster.getDateClients(fromDate, toDate));
m.addAttribute("date", date);
return "/tm/admin/clients";
} catch (ParseException e) {
throw new ApplicationException(ECode.ERROR415);
}
}
@RequestMapping(value="/tm/clients", method = RequestMethod.GET)
public String clientsDefault(Model m){
m = authMaster.setModel(m);
m.addAttribute("clients", new ArrayList<JClientsModel>());
m.addAttribute("date", new SimpleModel());
return "/tm/admin/clients";
}
@RequestMapping(value="/tm/staff", method = RequestMethod.GET)
public String staff(Model m){
m = authMaster.setModel(m);
m.addAttribute("users", userMaster.getAllUsers());
return "/tm/admin/staff";
}
}
| true
|
cd3ccaff2ae99adc416d1cad75ca41abde09183a
|
Java
|
Alibay74/AppleProject
|
/src/ClassOne.java
|
UTF-8
| 171
| 1.898438
| 2
|
[] |
no_license
|
public class ClassOne {
public static void main(String[] args) {
System.out.println("Hello");
System.out.println("Hello Alibay");
System.out.println("Hello Alibay Aitov");
}
}
| true
|
a776cba3b342dbd2ccc08d9ccaaa9bedd5351e8d
|
Java
|
mendor71/mhelper
|
/src/main/java/ru/pack/csps/entity/InvestRequests.java
|
UTF-8
| 10,220
| 1.828125
| 2
|
[] |
no_license
|
package ru.pack.csps.entity;
/**
* Created by Mendor on 24.10.2017.
*/
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.springframework.hateoas.ResourceSupport;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlTransient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
*
* @author Mendor
*/
@Entity
@Table(name = "invest_requests")
/*@XmlRootElement
@NamedQueries({
@NamedQuery(name = "InvestRequests.findAll", query = "SELECT i FROM InvestRequests i")
, @NamedQuery(name = "InvestRequests.findByIrId", query = "SELECT i FROM InvestRequests i WHERE i.irId = :irId")
, @NamedQuery(name = "InvestRequests.findByIrInvestAmount", query = "SELECT i FROM InvestRequests i WHERE i.irInvestAmount = :irInvestAmount")
, @NamedQuery(name = "InvestRequests.findByIrRefundAmount", query = "SELECT i FROM InvestRequests i WHERE i.irRefundAmount = :irRefundAmount")
, @NamedQuery(name = "InvestRequests.findByIrLoanTerm", query = "SELECT i FROM InvestRequests i WHERE i.irLoanTerm = :irLoanTerm")
, @NamedQuery(name = "InvestRequests.findByIrLoanDeadline", query = "SELECT i FROM InvestRequests i WHERE i.irLoanDeadline = :irLoanDeadline")
, @NamedQuery(name = "InvestRequests.findByIrCurrentInvestAmount", query = "SELECT i FROM InvestRequests i WHERE i.irCurrentInvestAmount = :irCurrentInvestAmount")
, @NamedQuery(name = "InvestRequests.findByIrDivided", query = "SELECT i FROM InvestRequests i WHERE i.irDivided = :irDivided")
, @NamedQuery(name = "InvestRequests.findActiveByUserIdAndStateId", query = "SELECT i FROM InvestRequests i " +
"JOIN i.irInitUserId u " +
"JOIN i.irStatId st " +
"WHERE u.userId = :userId AND st.stateId = :stateId")
, @NamedQuery(name = "InvestRequests.findActiveByUserIdAndNotEqualToStateId", query = "SELECT i FROM InvestRequests i " +
"JOIN i.irInitUserId u " +
"JOIN i.irStatId st " +
"WHERE u.userId = :userId AND st.stateId != :stateId")
})
@NamedNativeQueries({
@NamedNativeQuery(resultClass = InvestRequests.class, name = "Native.InvestRequests.findForMe_H", query = "select " +
"* " +
"from invest_requests ir " +
"where " +
"ir.ir_loan_term between :loanTerm - :appTermRange and :loanTerm + :appTermRange " +
"and ir.ir_invest_amount >= :loanAmount " +
//"and ir.ir_refund_amount >= :refundAmount " +
"and :userAge between ir.ir_age_limit_min and ir.ir_age_limit_max " +
"and :userRate >= ir.ir_min_user_rate " +
//"and ir.ir_region_criteria = :userRegionCriteria " +
"and not exists (select * from invest_loan_requests where ilr_inv_req_id = ir.ir_id ) limit 5")
, @NamedNativeQuery(resultClass = InvestRequests.class, name = "Native.InvestRequests.findForMe_L", query = "select " +
"* " +
"from invest_requests ir " +
"where " +
"ir.ir_loan_term between :loanTerm - :appTermRange and :loanTerm + :appTermRange " +
"and ir.ir_invest_amount < :loanAmount " +
//"and ir.ir_refund_amount <= :refundAmount " +
"and :userAge between ir.ir_age_limit_min and ir.ir_age_limit_max " +
"and :userRate >= ir.ir_min_user_rate " +
//"and ir.ir_region_criteria = :userRegionCriteria " +
"and not exists (select * from invest_loan_requests where ilr_inv_req_id = ir.ir_id ) limit 5")
})*/
public class InvestRequests extends ResourceSupport implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ir_id")
private Long irId;
@Column(name = "ir_invest_amount")
private Double irInvestAmount;
@Column(name = "ir_refund_amount")
private Double irRefundAmount;
@Column(name = "ir_loan_term")
private Integer irLoanTerm;
@Column(name = "ir_loan_deadline")
@Temporal(TemporalType.TIMESTAMP)
private Date irLoanDeadline;
@Column(name = "ir_reg_created")
@Temporal(TemporalType.TIMESTAMP)
private Date irRegCreated;
@Column(name = "ir_current_invest_amount")
private Double irCurrentInvestAmount;
@Column(name = "ir_divided")
private Boolean irDivided;
@Column(name = "ir_age_limit_min")
private Integer irAgeLimitMin;
@Column(name = "ir_age_limit_max")
private Integer irAgeLimitMax;
@Column(name = "ir_min_user_rate")
private Double irMinUserRate;
@Column(name = "ir_region_criteria")
private Integer irRegionCriteria;
@Column(name = "ir_max_parts")
private Integer irMaxParts;
@OneToMany(mappedBy = "irParentId", fetch = FetchType.LAZY)
private List<InvestRequests> investRequestsList;
@JoinColumn(name = "ir_parent_id", referencedColumnName = "ir_id")
@ManyToOne(fetch = FetchType.LAZY)
private InvestRequests irParentId;
@JoinColumn(name = "ir_stat_id", referencedColumnName = "state_id")
@Fetch(FetchMode.JOIN)
@ManyToOne
private States irStateId;
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@JoinColumn(name = "ir_init_user_id", referencedColumnName = "user_id")
@ManyToOne(fetch = FetchType.LAZY)
private Users irInitUserId;
public InvestRequests() {
}
public InvestRequests(Long irId) {
this.irId = irId;
}
public Long getIrId() {
return irId;
}
public void setIrId(Long irId) {
this.irId = irId;
}
public Double getIrInvestAmount() {
return irInvestAmount;
}
public void setIrInvestAmount(Double irInvestAmount) {
this.irInvestAmount = irInvestAmount;
}
public Double getIrRefundAmount() {
return irRefundAmount;
}
public void setIrRefundAmount(Double irRefundAmount) {
this.irRefundAmount = irRefundAmount;
}
public Integer getIrLoanTerm() {
return irLoanTerm;
}
public void setIrLoanTerm(Integer irLoanTerm) {
this.irLoanTerm = irLoanTerm;
}
@JsonFormat(pattern="yyyy-MM-dd")
public Date getIrLoanDeadline() {
return irLoanDeadline;
}
public void setIrLoanDeadline(Date irLoanDeadline) {
this.irLoanDeadline = irLoanDeadline;
}
public Double getIrCurrentInvestAmount() {
return irCurrentInvestAmount;
}
public void setIrCurrentInvestAmount(Double irCurrentInvestAmount) {
this.irCurrentInvestAmount = irCurrentInvestAmount;
}
public Boolean getIrDivided() {
return irDivided;
}
public void setIrDivided(Boolean irDivided) {
this.irDivided = irDivided;
}
@XmlTransient
public List<InvestRequests> getInvestRequestsList() {
return investRequestsList;
}
public void setInvestRequestsList(List<InvestRequests> investRequestsList) {
this.investRequestsList = investRequestsList;
}
public InvestRequests getIrParentId() {
return irParentId;
}
public void setIrParentId(InvestRequests irParentId) {
this.irParentId = irParentId;
}
public States getIrStateId() {
return irStateId;
}
public void setIrStateId(States irStatId) {
this.irStateId = irStatId;
}
public Users getIrInitUserId() {
return irInitUserId;
}
public void setIrInitUserId(Users irInitUserId) {
this.irInitUserId = irInitUserId;
}
public Integer getIrMaxParts() {
return irMaxParts;
}
public void setIrMaxParts(Integer irMaxParts) {
this.irMaxParts = irMaxParts;
}
@JsonFormat(pattern="yyyy-MM-dd")
public Date getIrRegCreated() {
return irRegCreated;
}
public void setIrRegCreated(Date irRegCreated) {
this.irRegCreated = irRegCreated;
}
public Integer getIrAgeLimitMin() {
return irAgeLimitMin;
}
public void setIrAgeLimitMin(Integer irAgeLimitMin) {
this.irAgeLimitMin = irAgeLimitMin;
}
public Integer getIrAgeLimitMax() {
return irAgeLimitMax;
}
public void setIrAgeLimitMax(Integer irAgeLimitMax) {
this.irAgeLimitMax = irAgeLimitMax;
}
public Double getIrMinUserRate() {
return irMinUserRate;
}
public void setIrMinUserRate(Double minUserRate) {
this.irMinUserRate = minUserRate;
}
public Integer getIrRegionCriteria() {
return irRegionCriteria;
}
public void setIrRegionCriteria(Integer irRegionCriteria) {
this.irRegionCriteria = irRegionCriteria;
}
@Override
public int hashCode() {
int hash = 0;
hash += (irId != null ? irId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof InvestRequests)) {
return false;
}
InvestRequests other = (InvestRequests) object;
if ((this.irId == null && other.irId != null) || (this.irId != null && !this.irId.equals(other.irId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "InvestRequests{" +
"irId=" + irId +
", irInvestAmount=" + irInvestAmount +
", irRefundAmount=" + irRefundAmount +
", irLoanTerm=" + irLoanTerm +
", irLoanDeadline=" + irLoanDeadline +
", irCurrentInvestAmount=" + irCurrentInvestAmount +
", irDivided=" + irDivided +
", investRequestsList=" + investRequestsList +
", irParentId=" + irParentId +
", irStateId=" + irStateId +
", irInitUserId=" + irInitUserId +
'}';
}
}
| true
|
d428d5cc5b0625e04a8d0a628709e27bc297084d
|
Java
|
denghang1989/demo
|
/plugin_didi/src/main/java/dhcc/cn/com/plugin_didi/MainActivity.java
|
UTF-8
| 1,103
| 2.09375
| 2
|
[] |
no_license
|
package dhcc.cn.com.plugin_didi;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import com.didi.virtualapk.PluginManager;
import java.io.File;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
File file = new File(Environment.getExternalStorageDirectory(),"plugin.apk");
if (file.exists()) {
long length = file.length();
Log.d(TAG, "onCreate: "+length);
}
PluginManager.getInstance(this).loadPlugin(file);
Intent intent = new Intent();
intent.setClassName("dhcc.cn.com.plugin_demo", "dhcc.cn.com.plugin_demo.MainActivity");
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| true
|
f33aadb37349b366e001793117c549c2155062f2
|
Java
|
bankass79/programmingExercices2
|
/src/LinearSearch.java
|
UTF-8
| 1,242
| 3.796875
| 4
|
[] |
no_license
|
import javax.swing.JOptionPane;
public class LinearSearch {
/** Main method */
public static void main(String[] args) {
int[] list = new int[10];
// Declare and initialized output string
String output = "";
// Create the list randomly and display it
System.out.println("The list is ");
for (int i =0; i < list.length; i++) {
list[i] = (int)(Math.random() * 100);
System.out.print(list[i] + " ");
}
// Prompt the user to enter a key
String keyString = JOptionPane.showInputDialog(null,
"Enter a key:",
"Input", JOptionPane.QUESTION_MESSAGE);
// Convert string into integer
int key = Integer.parseInt(keyString);
// Search for key
int index = linearSearch(key, list);
if (index != -1)
System.out.println("\nThe key is found at subscript " + index);
else
System.out.println("\nThe key " + key + " is not found in the list");
System.exit(0);
}
/** The method for finding a key in the list */
public static int linearSearch(int key, int[] list) {
for (int i = 0; i < list.length; i++)
if (key == list[i])
return i;
return -1;
}
}
| true
|
026a53b2fd810f62b58952b9e04117e15cc3e7be
|
Java
|
bryanjglass/wake
|
/src/main/java/wake/repository/WebSocketTraceRepository.java
|
UTF-8
| 692
| 2.203125
| 2
|
[] |
no_license
|
package wake.repository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import wake.model.Trace;
import java.time.Instant;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class WebSocketTraceRepository implements TraceRepository {
@Autowired
private SimpMessagingTemplate messagingTemplate;
@Override
public List<Trace> findAll() {
return Collections.emptyList();
}
@Override
public void add(Map<String, Object> map) {
messagingTemplate.convertAndSend("/topic/traces" + map.get("path"), new Trace(Instant.now(), map));
}
}
| true
|
16ac27fd1a3df02ea7e0405f262974fabba85ecd
|
Java
|
RyanWRowland/numeral-system-converter
|
/Numeral System Converter/task/src/converter/Main.java
|
UTF-8
| 663
| 3.296875
| 3
|
[] |
no_license
|
package converter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int sourceRadix = 0;
String sourceNumber = "";
int targetRadix = 0;
try {
sourceRadix = Integer.parseInt(scanner.nextLine());
sourceNumber = scanner.nextLine();
targetRadix = Integer.parseInt(scanner.nextLine());
} catch (Exception e) {
System.out.println("Error: " + e);
return;
}
System.out.println(NumeralSystemConverter.convert(sourceRadix, sourceNumber, targetRadix));
}
}
| true
|
e59a414be37ead8f01042738281fdfc524e1f618
|
Java
|
qiaoyansong/graduation_design_background
|
/src/main/java/com/qiaoyansong/controller/SeekHelpController.java
|
UTF-8
| 2,274
| 2.078125
| 2
|
[] |
no_license
|
package com.qiaoyansong.controller;
import com.qiaoyansong.entity.background.PageHelper;
import com.qiaoyansong.entity.background.ResponseEntity;
import com.qiaoyansong.entity.background.SearchCondition;
import com.qiaoyansong.entity.background.SeekHelp;
import com.qiaoyansong.service.SeekHelpService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/**
* @author :Qiao Yansong
* @date :Created in 2021/3/24 17:33
* description:
*/
@RestController
@RequestMapping(path = "/seekHelp")
public class SeekHelpController {
@Autowired
private SeekHelpService seekHelpService;
private static final Logger log = LoggerFactory.getLogger(SeekHelpController.class);
@RequestMapping(path = "/submit", method = RequestMethod.POST)
public ResponseEntity seekHelpSubmit(@Valid @RequestBody SeekHelp seekHelp, BindingResult bindingResult){
log.info("进入SeekHelpController.seekHelpSubmit");
return this.seekHelpService.submit(seekHelp);
}
@RequestMapping(path = "/agree/{id}", method = RequestMethod.GET)
public ResponseEntity agreeSeekHelp(@Valid @NotNull(message = "不能为空") @PathVariable("id") String id) {
return this.seekHelpService.agree(id);
}
@RequestMapping(path = "/refuse/{id}", method = RequestMethod.GET)
public ResponseEntity refuseSeekHelp(@Valid @NotNull(message = "不能为空") @PathVariable("id") String id) {
return this.seekHelpService.refuse(id);
}
@RequestMapping(path = "/getDetail/{id}", method = RequestMethod.GET)
public ResponseEntity getSeekHelpInfoById(@Valid @NotNull(message = "不能为空") @PathVariable("id") String id) {
return this.seekHelpService.getSeekHelpInfoById(id);
}
@RequestMapping(path = "/listall")
@ResponseBody
public ResponseEntity seekHelpList(@Valid @RequestBody PageHelper<SearchCondition> pageHelper, BindingResult bindingResult){
log.info("进入NewsController.getNews");
return this.seekHelpService.listAll(pageHelper);
}
}
| true
|
f155ea35b3bffcfe12352678b12c69efd6e952b9
|
Java
|
wugeo0824/nickel_android
|
/app/src/main/java/com/media2359/nickel/history/HistoryMVPAdapter.java
|
UTF-8
| 2,252
| 2.34375
| 2
|
[] |
no_license
|
package com.media2359.nickel.history;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.media2359.nickel.R;
import com.media2359.nickel.model.NickelTransfer;
import com.media2359.nickel.ui.viewholder.TransactionHistoryViewHolder;
import java.util.Collections;
import java.util.List;
/**
* Created by Xijun on 25/4/16.
*/
public class HistoryMVPAdapter extends RecyclerView.Adapter<TransactionHistoryViewHolder> {
List<NickelTransfer> transactionsList = Collections.emptyList();
Context context;
public interface HistoryItemClickListener {
void OnItemClick(RecyclerView.ViewHolder viewHolder, NickelTransfer transaction);
}
private HistoryItemClickListener historyItemClickListener;
public HistoryMVPAdapter(Context context, HistoryItemClickListener historyItemClickListener) {
this.context = context;
this.historyItemClickListener = historyItemClickListener;
}
@Override
public TransactionHistoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View historyView = inflater.inflate(R.layout.item_transaction_history, parent, false);
TransactionHistoryViewHolder normalArticleViewHolder = new TransactionHistoryViewHolder(historyView);
return normalArticleViewHolder;
}
@Override
public void onBindViewHolder(final TransactionHistoryViewHolder holder, int position) {
final NickelTransfer transaction = transactionsList.get(position);
holder.bindItem(transaction);
holder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
historyItemClickListener.OnItemClick(holder, transaction);
}
});
}
@Override
public int getItemCount() {
return transactionsList.size();
}
public void setTransactionsList(List<NickelTransfer> transactionsList) {
this.transactionsList = transactionsList;
notifyDataSetChanged();
}
}
| true
|
b4b0a28e8e238727f07a31db1ee8e3541e0b1e72
|
Java
|
pangkai59/dp_boot
|
/src/main/java/net/chenlin/dp/modules/goods/manager/impl/GoodsInformManagerImpl.java
|
UTF-8
| 1,461
| 1.875
| 2
|
[] |
no_license
|
package net.chenlin.dp.modules.goods.manager.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.modules.goods.dao.GoodsInformMapper;
import net.chenlin.dp.modules.goods.entity.GoodsInformEntity;
import net.chenlin.dp.modules.goods.manager.GoodsInformManager;
/**
* 系统通知管理
*
* @author ZhouChenglin
* @email yczclcn@163.com
* @url www.chenlintech.com
* @date 2019年4月19日 下午2:53:48
*/
@Component("goodsInformManager")
public class GoodsInformManagerImpl implements GoodsInformManager {
@Autowired
private GoodsInformMapper goodsInformMapper;
@Override
public List<GoodsInformEntity> listGoodsInform(Page<GoodsInformEntity> page, Query search) {
return goodsInformMapper.listForPage(page, search);
}
@Override
public int saveGoodsInform(GoodsInformEntity goodsInform) {
return goodsInformMapper.save(goodsInform);
}
@Override
public GoodsInformEntity getGoodsInformById(Long id) {
GoodsInformEntity goodsInform = goodsInformMapper.getObjectById(id);
return goodsInform;
}
@Override
public int updateGoodsInform(GoodsInformEntity goodsInform) {
return goodsInformMapper.update(goodsInform);
}
@Override
public int batchRemove(Long[] id) {
int count = goodsInformMapper.batchRemove(id);
return count;
}
}
| true
|
f52302f9c00540cf72cc334355107d670acb84be
|
Java
|
whdnjsdyd111/backup
|
/이것이자바다/src/챕터11_기본API클래스/ㅎ_Date와Calendar클래스/ㄴ_Calendar클래스/PrintTimeZone.java
|
UHC
| 1,430
| 3.4375
| 3
|
[] |
no_license
|
package é11_⺻APIŬ._DateCalendarŬ._CalendarŬ;
import java.util.TimeZone;
public class PrintTimeZone {
// ٸ ð뿡 شϴ ¥ ð ϱ ؼ ؾұ?
// ̱/ν ¥ ð ϱ ؼ ؾ ұ?
// ü ð븦 ٸ ð ٲٴ ͵ ,
// Calendar Ŭ ε ٸ getInstance() ҵ带 ̿ϸ ϰ ٸ ð Calendar ִ.
// ˰ ð java.util.TimeZone ü Calendar.getInstance() ҵ Ű Ѱָ ȴ.
// TimeZone timeZone = TimeZone.getTimeZone("America/Los_Angeles");
// Calendar now = Calendar.getInstance( timeZone );
// TimeZone.getInstance() ҵ Ű TimeZone Ŭ ҵ
// getAvailableIDs() ȣϿ ð ڿ ϳ ϸ ȴ.
// getAvailableIDs() ҵ Ÿ String 迭̱ α ̿ؼ ð ڿ ִ.
public static void main(String[] args) {
String[] availableIDs = TimeZone.getAvailableIDs();
for(String id : availableIDs) {
System.out.println(id);
}
}
}
| true
|
b6d28e54620628049fab33ecb731679d2d8e7d68
|
Java
|
gigauser/lsp
|
/src/main/java/com/home/ls/spring/config/SpringJavaConfiguration.java
|
UTF-8
| 973
| 1.960938
| 2
|
[] |
no_license
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.home.ls.spring.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import com.home.ls.service.IpLocationResolveService;
import com.home.ls.service.IpLocationResolveServiceImpl;
import com.home.ls.service.LocationDao;
import com.home.ls.service.LocationDaoRemoteImpl;
/**
*Java based Spring config
*
* @author hchen
*/
@Component
@Configuration
public class SpringJavaConfiguration {
@Bean
public LocationDao LocationManager() {
return new LocationDaoRemoteImpl();
}
@Bean
public IpLocationResolveService ipResolverService() {
return new IpLocationResolveServiceImpl(LocationManager());
}
}
| true
|
c42fed8a0c22ffd8994b53a2c3c97d6ff225acb0
|
Java
|
stone-wall/pklite
|
/runelite-client/src/main/java/net/runelite/client/plugins/friendtagging/FriendTaggingPlugin.java
|
UTF-8
| 8,969
| 1.726563
| 2
|
[
"BSD-2-Clause"
] |
permissive
|
/*
* Copyright (c) 2019. PKLite - All Rights Reserved
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
* Proprietary and confidential. Refer to PKLite License file for more information on
* full terms of this copyright and to determine what constitutes authorized use.
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
*
*/
package net.runelite.client.plugins.friendtagging;
import com.google.common.base.Strings;
import com.google.common.collect.ObjectArrays;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import javax.inject.Inject;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.*;
import net.runelite.api.events.*;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.game.chatbox.ChatboxTextInput;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.util.Text;
import org.apache.commons.lang3.ArrayUtils;
@Slf4j
@PluginDescriptor(
name = "Friend Tagging",
description = "Tag people on your friends list.",
tags = {"PVP", "friend", "finder", "pk", "pklite"},
loadWhenOutdated = true
)
public class FriendTaggingPlugin extends Plugin
{
public static ConcurrentHashMap<String, String> taggedFriends = new ConcurrentHashMap<>();
private static final String CONFIG_GROUP = "friendtagging";
private static final int CHARACTER_LIMIT = 30;
private static final String KEY_PREFIX = "tag_";
private static final String ADD_TAG = "Add Tag";
private static final String DELETE_TAG = "Delete Tag";
private WidgetMenuOption friendsTabMenuOption = new WidgetMenuOption("Copy to", "clipboard",
WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB);
private WidgetMenuOption ignoreTabMenuOption = new WidgetMenuOption("Copy to", "clipboard",
WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB);
private WidgetMenuOption friendTabResizableOption = new WidgetMenuOption("Copy to", "clipboard",
WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB);
private WidgetMenuOption ignoreTabResizableOption = new WidgetMenuOption("Copy to", "clipboard",
WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB);
@Inject
private Client client;
@Inject
private ConfigManager configManager;
@Inject
private MenuManager menuManager;
@Inject
private ChatboxPanelManager chatboxPanelManager;
@Override
protected void startUp() throws Exception
{
menuManager.addManagedCustomMenu(friendsTabMenuOption);
menuManager.addManagedCustomMenu(ignoreTabMenuOption);
menuManager.addManagedCustomMenu(friendTabResizableOption);
menuManager.addManagedCustomMenu(ignoreTabResizableOption);
loadFriendTags();
}
@Override
protected void shutDown() throws Exception
{
menuManager.removeManagedCustomMenu(friendsTabMenuOption);
menuManager.removeManagedCustomMenu(ignoreTabMenuOption);
menuManager.removeManagedCustomMenu(friendTabResizableOption);
menuManager.removeManagedCustomMenu(ignoreTabResizableOption);
}
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event)
{
final int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message"))
{
// Friends have color tags
String friendName = Text.removeTags(event.getTarget());
// Build "Add Note" or "Edit Note" menu entry
final MenuEntry entry = new MenuEntry();
entry.setOption(friendName == null || getTag(friendName) == null ? ADD_TAG : DELETE_TAG);
entry.setType(MenuAction.RUNELITE.getId());
entry.setTarget(event.getTarget()); //Preserve color codes here
entry.setParam0(event.getActionParam0());
entry.setParam1(event.getActionParam1());
// Add menu entry
final MenuEntry[] menuEntries = ObjectArrays.concat(client.getMenuEntries(), entry);
client.setMenuEntries(menuEntries);
}
}
@Subscribe
public void onRemovedFriend(RemovedFriend event)
{
final String displayName = event.getName().trim().toLowerCase();
deleteTag(displayName);
}
@Subscribe
public void onNameableNameChanged(NameableNameChanged event)
{
final Nameable nameable = event.getNameable();
if (nameable instanceof Friend)
{
// Migrate a friend's note to their new display name
final Friend friend = (Friend) nameable;
if (friend.getName() != null && friend.getPrevName() != null)
{
migrateFriendTag(friend.getName(), friend.getPrevName());
}
}
}
@Subscribe
public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
if (event.getWidget().getId() == WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB.getId() &&
Text.standardize(event.getMenuTarget()).equals(Text.standardize("clipboard")))
{
friendIgnoreToClipboard();
}
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (WidgetInfo.TO_GROUP(event.getWidgetId()) == WidgetInfo.FRIENDS_LIST.getGroupId())
{
if (Strings.isNullOrEmpty(event.getMenuTarget()))
{
return;
}
final String sanitizedTarget = Text.removeTags(event.getMenuTarget());
if (event.getMenuOption().equals(ADD_TAG))
{
event.consume();
final ChatboxTextInput build = chatboxPanelManager.openTextInput("Enter the tag").value("")
.onDone((content) ->
{
if (content == null)
{
return;
}
content = Text.removeTags(content).trim();
setTag(sanitizedTarget, content);
}).build();
}
if (event.getMenuOption().equals(DELETE_TAG))
{
event.consume();
client.getLogger().info(sanitizedTarget);
taggedFriends.forEach((k, v) -> client.getLogger().info(k + ": ", v));
deleteTag(sanitizedTarget);
}
}
}
/**
* Gets a tag from the currently loaded tags
*
* @param name the username of the player
* @return the text of the tag
*/
@NonNull
private String getTag(String name)
{
name = name.trim().toLowerCase();
String keyName = KEY_PREFIX + name;
return taggedFriends.get(keyName);
}
/**
* Sets a tag for a friend
*
* @param name the username of the player to tag
* @param tag the text of the tag
*/
private void setTag(String name, String tag)
{
client.getLogger().info("SETTING " + name + ": " + tag);
name = name.trim().toLowerCase();
String keyName = KEY_PREFIX + name;
if (tag.length() <= CHARACTER_LIMIT)
{
taggedFriends.put(keyName, tag);
configManager.setConfiguration(CONFIG_GROUP, keyName, tag);
}
}
/**
* Deletes a friends tag
*
* @param name the username of the friend to delete the tag for
*/
private void deleteTag(String name)
{
name = name.trim().toLowerCase();
String keyName = KEY_PREFIX + name;
configManager.unsetConfiguration(CONFIG_GROUP, keyName);
taggedFriends.remove(keyName);
}
/**
* Loads all of the friend tags for use with player indicators
*/
private void loadFriendTags()
{
String prefix = CONFIG_GROUP + "." + KEY_PREFIX;
for (String key : configManager.getConfigurationKeys(prefix))
{
key = key.replace(CONFIG_GROUP + ".", "");
String result = configManager.getConfiguration(CONFIG_GROUP, key);
if (Objects.nonNull(result) && !result.equals(""))
{
taggedFriends.put(key, configManager.getConfiguration(CONFIG_GROUP, key));
}
}
}
/**
* Migrate a friend note to a new display name, and remove the previous one.
* If current name already has a note, or previous name had none, do nothing.
*/
private void migrateFriendTag(String currentDisplayName, String prevDisplayName)
{
final String currentTag = getTag(currentDisplayName);
if (currentTag == null)
{
final String prevTag = getTag(prevDisplayName);
if (prevTag != null)
{
setTag(prevDisplayName, "");
setTag(currentDisplayName, prevTag);
}
}
}
/**
* This method combines the list of usernames on local players friend/ignore list into a comma delimited string
* and then copies it to the clipboard.
*/
private void friendIgnoreToClipboard()
{
StringBuilder friendsList = new StringBuilder();
Friend[] friends = client.getFriends();
Ignore[] ignores = client.getIgnores();
String[] friendsIgnores = ArrayUtils.addAll(Arrays.stream(friends).map(Friend::getName).toArray(String[]::new),
Arrays.stream(ignores).map(Ignore::getName).toArray(String[]::new));
HashSet<String> names = new HashSet<>(Arrays.asList(friendsIgnores));
names.forEach(n -> friendsList.append(n.toLowerCase()).append(","));
StringSelection namesSelection = new StringSelection(friendsList.toString());
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(namesSelection, namesSelection);
}
}
| true
|
eb4d5acbc8d6780e864e1880dfdddb71570c0e18
|
Java
|
MerzCheung/springcloud_demo
|
/serice-feign/src/main/java/com/example/demo/FeignServiceHystrix.java
|
UTF-8
| 438
| 2.125
| 2
|
[] |
no_license
|
package com.example.demo;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author merz
* @Description: 熔断处理
* @date 2019/3/19 21:07
*/
@Component
public class FeignServiceHystrix implements FeignExampleService {
@Override
public String hello(@RequestParam(value = "name") String name) {
return "sorry "+name+",service has fail!";
}
}
| true
|
cb13677e9869996634adaf07c2b4adabb029ae99
|
Java
|
basusingh/NSS-PGDAV-College
|
/database_preference/DatabaseManagement_Registration.java
|
UTF-8
| 1,053
| 2.1875
| 2
|
[] |
no_license
|
package com.basusingh.nsspgdav.database_preference;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by Basu Singh on 10/11/2016.
*/
public class DatabaseManagement_Registration extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
protected static final String DATABASE_NAME = "RegistrationDatabase";
public DatabaseManagement_Registration(Context context){
super(context, DATABASE_NAME, null, DATABASE_VERSION );
}
@Override
public void onCreate(SQLiteDatabase db){
String sql = "CREATE TABLE mRegistration " +
"( id INTEGER PRIMARY KEY, " +
"heading TEXT, " +
"time_stamp TEXT, " +
"imageurl TEXT ) ";
db.execSQL(sql);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldV, int newV){
String sql = "DROP TABLE IF EXISTS mRegistration";
db.execSQL(sql);
onCreate(db);
}
}
| true
|
b7d1678f40afd898dc26b0876bb765dbc1c9cb06
|
Java
|
zhang1998/browser
|
/second/quark/src/main/java/com/uc/weex/component/c/a/q.java
|
UTF-8
| 1,789
| 1.773438
| 2
|
[] |
no_license
|
package com.uc.weex.component.c.a;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import com.uc.imagecodec.export.IPictureView;
import com.uc.weex.component.c.a.a.a;
/* compiled from: ProGuard */
public abstract class q implements OnTouchListener, d {
protected final p a = new p();
protected final a b;
protected final m c;
protected final o d;
protected final k e;
protected l f;
protected e g = new g();
protected f h = new h();
protected float i;
protected float j;
protected float k;
protected abstract n a();
protected abstract void a(View view, float f);
protected abstract void a(View view, float f, MotionEvent motionEvent);
protected abstract j b();
protected abstract float c();
public q(a aVar) {
this.b = aVar;
this.e = new k(this, -2.0f);
this.d = new o(this, 2.0f, IPictureView.DEFAULT_MIN_SCALE);
this.c = new m(this);
this.f = this.c;
d().setOnTouchListener(this);
d().setOverScrollMode(2);
}
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case 1:
case 3:
return this.f.b();
case 2:
return this.f.a(motionEvent);
default:
return false;
}
}
public final void a(e eVar) {
this.g = eVar;
}
public final void a(f fVar) {
this.h = fVar;
}
public final View d() {
return this.b.a();
}
protected final void a(l lVar) {
l lVar2 = this.f;
this.f = lVar;
this.f.a(lVar2);
}
public final void a(float f) {
this.i = f;
}
}
| true
|
a3d7604f2ffd9fbff26a06ddbae96be54382fa08
|
Java
|
nantianyan/ExtMQTT
|
/p2pmqtt/src/main/java/com/cmteam/p2pmqtt/P2PMqttSyncRequest.java
|
UTF-8
| 2,000
| 2.453125
| 2
|
[] |
no_license
|
package com.cmteam.p2pmqtt;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by 阳旭东 on 2017/9/20.
*/
public class P2PMqttSyncRequest extends P2PMqttRequest{
private static final String TAG = "SimpleSyncRequest";
private final Object mRequestLock = new Object();
private boolean mIsComplete = false;
private P2PMqtt.ResultCode mResult = P2PMqtt.ResultCode.ERROR_None;
public P2PMqttSyncRequest() {
super();
}
public P2PMqttSyncRequest(String whoareyou, String methodName, String methodParams) {
super(whoareyou, methodName, methodParams, true);
}
@Override
public P2PMqtt.ResultCode onResult(JSONObject jrpc) {
mResult = mListener.onResult(jrpc);
notifyComplete();
return mResult;
}
//@hide, package private
private void notifyComplete(){
Log.d(TAG, "notify complete");
mIsComplete = true;
synchronized (this.mRequestLock) {
this.mRequestLock.notifyAll();
}
}
@Override
public boolean waitComplete(){
int waitCount = 0;
while(true) {
synchronized (this.mRequestLock) {
try {
Log.d(TAG, "start waiting request to be completed.");
this.mRequestLock.wait(this.getTimeOutMs());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if(mIsComplete) {
Log.d(TAG, "request completed.");
mIsComplete = false; // reset
if (mResult == P2PMqtt.ResultCode.ERROR_None)
return true;
else {
return false;
}
}
waitCount++;
if(waitCount == 10) {
//throw new RuntimeException("request time out !");
return false;
}
}
}
}
| true
|
ab70fdd350ef9bfade2e587c425224c4c304262d
|
Java
|
Emysly/Department_model
|
/src/com/emysilva/util/CourseUtil.java
|
UTF-8
| 1,591
| 2.734375
| 3
|
[] |
no_license
|
package com.emysilva.util;
import java.util.Date;
public class CourseUtil {
private String name;
private int level;
private String department;
private String teacher;
private Date scheduledTime;
public CourseUtil(String name, int level, String department, String teacher, Date scheduledTime) {
this.name = name;
this.level = level;
this.department = department;
this.teacher = teacher;
this.scheduledTime = scheduledTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getTeacher() {
return teacher;
}
public void setTeacher(String teacher) {
this.teacher = teacher;
}
public Date getScheduledTime() {
return scheduledTime;
}
public void setScheduledTime(Date scheduledTime) {
this.scheduledTime = scheduledTime;
}
@Override
public String toString() {
return "CourseModel{" +
"name='" + name + '\'' +
", level=" + level +
", department='" + department + '\'' +
", teacher='" + teacher + '\'' +
", scheduledTime=" + scheduledTime +
'}';
}
}
| true
|
73a402063c0f5b014ae42a45a64e4d74dee679ac
|
Java
|
ariyue/alsfrm
|
/AlsFramework-2.0.1/als-frm-2.0.0/com/als/frm/bas/ddl/RstMsgType.java
|
UTF-8
| 281
| 2.109375
| 2
|
[] |
no_license
|
package com.als.frm.bas.ddl;
/**
* web请求返回消息类型
* @author Vincent
*
*/
public enum RstMsgType {
info,//标准信息
warning,//警示
error,//错误
question;//疑问
public static void main(String[] args) {
System.out.println(RstMsgType.info);
}
}
| true
|
69ad99534783d818339214999d1d6ce86c0742cf
|
Java
|
kenteg/BirdsStore
|
/src/com/luxoft/gui/StoreForm.java
|
UTF-8
| 4,427
| 2.515625
| 3
|
[] |
no_license
|
package com.luxoft.gui;
import com.luxoft.birdsstore.BirdsStore;
import com.luxoft.birdsstore.DAO.DAOGoods;
import com.luxoft.birdsstore.DAO.DAOGoodsFileImpl;
import com.luxoft.birdsstore.DAO.DAOOrder;
import com.luxoft.birdsstore.DAO.DAOOrderFileImpl;
import com.luxoft.birdsstore.Store;
import com.luxoft.birdsstore.model.*;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.*;
import static javafx.scene.input.KeyCode.J;
/**
* @author Khrishpens Viktor
* created Ноябрь 23 2016
*/
public class StoreForm extends JFrame{
private JTable table1;
private JPanel panel1;
private JList list1;
private JList list2;
private JTextField firstNameField;
private JTextField lastNameField;
private JTextField emailField;
private JButton addToShoppingCartButton;
private JButton payButton;
private JButton addNewGoodButton;
private JTextField editType;
private JTextField editPrice;
private JLabel labelTotal;
private JList list3;
private Vector<Goods> goodsList;
private ShoppingCart tempCart=null;
private Vector<Goods> shoppingCartList;
private Vector<Order> orders;
public StoreForm(){
super("BirdStore");
Store birdStore = init();
addNewGoodButton.addActionListener(e -> {
OnAddNewGood(birdStore);
});
addToShoppingCartButton.addActionListener(e -> {
OnAddInShopCart();
});
payButton.addActionListener(e -> {
OnPayOrder(birdStore);
});
table1.getSelectionModel().addListSelectionListener(e -> {
OnTableSelectChanged();
});
}
private void OnTableSelectChanged() {
Goods[] array = new Goods[orders.get(table1.getSelectedRow()).getShoppingCart().getItems().size()];
orders.get(table1.getSelectedRow()).getShoppingCart().getItems().toArray(array);
list3.setListData(array);
}
private void OnPayOrder(Store birdStore) {
Buyer tempBuyer = new Buyer(firstNameField.getText(),lastNameField.getText(),emailField.getText(),new ShoppingCart(tempCart));
Order tempOrder = new Order(tempBuyer,tempBuyer.getShoppingCart());
birdStore.addOrder(tempOrder);
DAOOrder daoOrder = new DAOOrderFileImpl();
daoOrder.WriteToStorage(tempOrder);
orders = new Vector<Order>(birdStore.getOrders());
//tablemodel
shoppingCartList.clear();
tempCart.getItems().clear();
tempCart.clearTotalPrice();
list2.setListData(shoppingCartList);
list2.updateUI();
table1.updateUI();
}
private void OnAddInShopCart() {
if(tempCart==null){
tempCart = new ShoppingCart();
}
tempCart.add(goodsList.get(list1.getSelectedIndex()));
shoppingCartList = new Vector<Goods>(tempCart.getItems());
labelTotal.setText(tempCart.getTotalPrice());
list2.setListData(shoppingCartList);
list2.updateUI();
}
private void OnAddNewGood(Store birdStore) {
birdStore.addItem(new Bird(editType.getText(), Money.dollars(editPrice.getText())));
goodsList = new Vector<Goods>(birdStore.getItems());
DAOGoods flStrg = new DAOGoodsFileImpl();
flStrg.WriteInStorage(new Bird(editType.getText(),Money.dollars(editPrice.getText())));
list1.setListData(goodsList);
list1.updateUI();
}
private Store init() {
setContentPane(panel1);
Goods bird1 = new Bird("Eagle", Money.dollars("100"));
Goods bird2 = new Bird("Parrot", Money.dollars("50.5"));
Store birdStore = BirdsStore.getInstance();
birdStore.addItem(bird1);
birdStore.addItem(bird2);
table1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
goodsList = new Vector<Goods>(birdStore.getItems());
orders = new Vector<Order>(birdStore.getOrders());
list1.setListData(goodsList);
table1.setModel(new OrderTableModel(birdStore.getOrders()));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setLocationRelativeTo(null);
setVisible(true);
return birdStore;
}
}
| true
|
556bd2b1c8fbc3e15d9e6e06ab4680a7c744afe0
|
Java
|
dbs-leipzig/gradoop
|
/gradoop-temporal/src/main/java/org/gradoop/temporal/model/impl/functions/tpgm/TemporalGraphHeadToGraphHead.java
|
UTF-8
| 1,936
| 2.25
| 2
|
[
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
/*
* Copyright © 2014 - 2021 Leipzig University (Database Research Group)
*
* 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.gradoop.temporal.model.impl.functions.tpgm;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.java.functions.FunctionAnnotation;
import org.gradoop.common.model.api.entities.GraphHeadFactory;
import org.gradoop.common.model.impl.pojo.EPGMGraphHead;
import org.gradoop.temporal.model.impl.pojo.TemporalGraphHead;
import java.util.Objects;
/**
* Initializes a {@link EPGMGraphHead} from a {@link TemporalGraphHead} instance by discarding the temporal
* information.
*/
@FunctionAnnotation.ForwardedFields("id;label;properties")
public class TemporalGraphHeadToGraphHead implements MapFunction<TemporalGraphHead, EPGMGraphHead> {
/**
* Used to reduce instantiations.
*/
private final EPGMGraphHead reuse;
/**
* Creates a new instance of this map function.
*
* @param graphHeadFactory A factory used to create EPGM graph heads.
*/
public TemporalGraphHeadToGraphHead(GraphHeadFactory<EPGMGraphHead> graphHeadFactory) {
reuse = Objects.requireNonNull(graphHeadFactory).createGraphHead();
}
@Override
public EPGMGraphHead map(TemporalGraphHead graphHead) {
reuse.setId(graphHead.getId());
reuse.setLabel(graphHead.getLabel());
reuse.setProperties(graphHead.getProperties());
return reuse;
}
}
| true
|
363544f65729bae15f0de82b655aea4002cf727d
|
Java
|
JonathanGiovanny/SpringBootJWTBase
|
/src/main/java/com/jjo/h2/dto/HTypeDTO.java
|
UTF-8
| 181
| 1.664063
| 2
|
[] |
no_license
|
package com.jjo.h2.dto;
import javax.validation.constraints.NotNull;
import lombok.Data;
@Data
public class HTypeDTO {
private Integer id;
@NotNull
private String name;
}
| true
|
01cec2fb90574268fc0586458324d74b13708b95
|
Java
|
nidsarora/RiskGameTeam8
|
/src/risk/view/RiskPlayerDominationViewObserver.java
|
UTF-8
| 2,192
| 2.578125
| 3
|
[] |
no_license
|
package risk.view;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import risk.model.RiskPlayerModel;
public class RiskPlayerDominationViewObserver implements Observer {
JPanel playerDominationViewPanel;
JTextArea playerDominationViewTextArea;
JFrame playerDominationViewFrame;
StringBuilder playerDominationViewTextAreaString = new StringBuilder();
private static RiskPlayerDominationViewObserver instance = new RiskPlayerDominationViewObserver();
private RiskPlayerDominationViewObserver() {
}
public static RiskPlayerDominationViewObserver getInstance() {
if (instance == null)
instance = new RiskPlayerDominationViewObserver();
return instance;
}
public void generatePhaseView() {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int height = screenSize.height * 1 / 3;
int width = screenSize.width * 2 / 3;
JScrollPane scrollPane;
playerDominationViewFrame = new JFrame();
playerDominationViewFrame.setTitle("Player Domination View");
playerDominationViewFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
playerDominationViewFrame.setPreferredSize(new Dimension(width, height));
playerDominationViewPanel = new JPanel();
playerDominationViewTextArea = new JTextArea("", 25, 40);
playerDominationViewTextArea.setEditable(false);
scrollPane = new JScrollPane(playerDominationViewTextArea);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
playerDominationViewPanel.add(scrollPane);
playerDominationViewFrame.add(playerDominationViewPanel);
playerDominationViewFrame.setResizable(true);
playerDominationViewFrame.pack();
playerDominationViewFrame.setVisible(true);
}
@Override
public void update(Observable object, Object argument) {
playerDominationViewTextArea.setText(((RiskPlayerModel)object).getPlayerDominationViewContent());
playerDominationViewFrame.repaint();
}
}
| true
|
3fdd4b96cb903dcd8383aadb35b5c34f1761873c
|
Java
|
yswname/TP226POM
|
/JavaWebShopping/src/main/java/cn/com/demo/javaweb/shopping/entity/SpCatalogue.java
|
UTF-8
| 713
| 1.929688
| 2
|
[] |
no_license
|
package cn.com.demo.javaweb.shopping.entity;
public class SpCatalogue {
private int ctId;
private String ctName;
private String ctRemark;
private Integer ctParentId;
public int getCtId() {
return ctId;
}
public void setCtId(int ctId) {
this.ctId = ctId;
}
public String getCtName() {
return ctName;
}
public void setCtName(String ctName) {
this.ctName = ctName;
}
public String getCtRemark() {
return ctRemark;
}
public void setCtRemark(String ctRemark) {
this.ctRemark = ctRemark;
}
public Integer getCtParentId() {
return ctParentId;
}
public void setCtParentId(Integer ctParentId) {
this.ctParentId = ctParentId;
}
}
| true
|
9a5e48f4a00b8c90d114b98db622fa8000156fa0
|
Java
|
wangjiahua1/myRedWineStore
|
/redwineshop/src/main/java/com/igeek/service/imp/MessageServiceImpl.java
|
UTF-8
| 566
| 2.0625
| 2
|
[] |
no_license
|
package com.igeek.service.imp;
import com.igeek.dao.MessageDao;
import com.igeek.domain.Message;
import com.igeek.service.MessageService;
import com.igeek.utils.BeanFactory;
import java.util.List;
/**
* Created by LENOVO on 2019/10/17.
*/
public class MessageServiceImpl implements MessageService {
MessageDao dao = (MessageDao) BeanFactory.getBean("messagedao");
@Override
public List<Message> findFiveMessage() {
return dao.findFiveMessage();
}
@Override
public void addMessage(Message m) {
dao.addMessage(m);
}
}
| true
|
d48c5d846aaa058473f22ecf6fe6dfa244a86717
|
Java
|
thvphuc246/BakingApp
|
/app/src/main/java/com/example/vinhphuc/bakingapp/presentation/recipe_details/RecipeDetailsPresenter.java
|
UTF-8
| 1,386
| 2.515625
| 3
|
[] |
no_license
|
package com.example.vinhphuc.bakingapp.presentation.recipe_details;
import com.example.vinhphuc.bakingapp.data.model.Recipe;
import com.example.vinhphuc.bakingapp.presentation.base.BasePresenter;
import static com.google.common.base.Preconditions.checkNotNull;
public class RecipeDetailsPresenter
extends BasePresenter<RecipeDetailsContract.View>
implements RecipeDetailsContract.Presenter {
private Recipe mCurrentRecipe;
public RecipeDetailsPresenter(Recipe currentRecipe) {
this.mCurrentRecipe = checkNotNull(currentRecipe);
}
@Override
public void attachView(RecipeDetailsContract.View mvpView) {
super.attachView(mvpView);
loadRecipeName();
loadIngredients();
loadSteps();
}
@Override
public void loadRecipeName() {
getView().showRecipeNameInAppBar(mCurrentRecipe.getName());
}
@Override
public void loadIngredients() {
getView().showIngredients(mCurrentRecipe.getIngredients());
}
@Override
public void loadSteps() {
getView().showSteps(mCurrentRecipe.getSteps());
}
@Override
public void loadStepData(int stepId) {
getView().showStepsDetailInContainer(stepId);
}
@Override
public void navigateToStepDetails(int stepId) {
checkViewAttached();
getView().showStepDetails(stepId);
}
}
| true
|
91b7792ec30ffb0b17f637e1271aa940dc1a137d
|
Java
|
tateconlon/TerrainGenerator
|
/src/renderEngine/Loader.java
|
UTF-8
| 4,728
| 2.71875
| 3
|
[] |
no_license
|
package renderEngine;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
import models.RawModel;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
public class Loader {
private List<Integer> vaos = new ArrayList<Integer>();
private List<Integer> vbos = new ArrayList<Integer>();
private List<Integer> terrainVbos = new ArrayList<Integer>();
private List<Integer> textures = new ArrayList<Integer>();
public RawModel loadtoVAO (float[] positions, float[] textureCoordinates, float[] normals, int[] indicies) {
int vaoID = createVAO();
bindIndiciesBuffer(indicies, false);
storeDataInAttributeList(0, 3, positions, false);
storeDataInAttributeList(1, 2, textureCoordinates, false);
storeDataInAttributeList(2, 3, normals, false);
unbindVAO();
return new RawModel(vaoID, indicies.length);
}
public RawModel replaceTerrainVAO(int vaoID, float[] positions, float[] textureCoordinates, float[] normals, int[] indicies) {
GL30.glDeleteVertexArrays(vaoID);
vaos.remove(vaos.indexOf(vaoID));
for(int vbo : terrainVbos) {
GL15.glDeleteBuffers(vbo);
}
int newVaoID = createVAO();
bindIndiciesBuffer(indicies, true);
storeDataInAttributeList(0, 3, positions, true);
storeDataInAttributeList(1, 2, textureCoordinates, true);
storeDataInAttributeList(2, 3, normals, true);
unbindVAO();
return new RawModel(newVaoID, indicies.length);
}
public int loadTexture(String fileName) {
Texture texture = null;
try {
texture = TextureLoader.getTexture("PNG", new FileInputStream("res/"+fileName+".png"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
int textureID = texture.getTextureID();
textures.add(textureID);
return textureID;
}
public void cleanUp() {
for(int vao : vaos) {
GL30.glDeleteVertexArrays(vao);
}
for(int vbo : vbos) {
GL15.glDeleteBuffers(vbo);
}
for(int texture : textures) {
GL11.glDeleteTextures(texture);
}
}
//Create VAO, bind (activate) it and return it's ID so we can reference it
private int createVAO(){
int vaoID = GL30.glGenVertexArrays();
vaos.add(vaoID);
GL30.glBindVertexArray(vaoID);
return vaoID;
}
private void storeDataInAttributeList(int attributeNumber, int coordinateSize, float[] data, boolean terrain) {
int vboID = GL15.glGenBuffers(); //Create VBO, return ID
if(terrain) {
terrainVbos.add(vboID);
} else {
vbos.add(vboID);
}
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboID); //Bind VBO to modify it, VBO type is Array Buffer, pass ID to bind given VBO
FloatBuffer buffer = storeDataInFloatBuffer(data);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW); //It's an array Buffer, with data in FloatBuffer buffer, and we don't want to edit the buffer ever again, aka data is static (GL_STATIC_DRAW)
GL20.glVertexAttribPointer(attributeNumber, coordinateSize, GL11.GL_FLOAT, false, 0, 0); //AttributeListNumber, # of coords per vertex (x,y,z) = 3 TextureCoordinates - (u,v) = 2 , data is floats, data normalized? no, distance (buffer) between verticies in array (none), data offset (start at beginning) = 0
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); //Unbinds VBO
}
//VBOs use FloatBuffers
private FloatBuffer storeDataInFloatBuffer(float[] data){
FloatBuffer buffer = BufferUtils.createFloatBuffer(data.length);
buffer.put(data);
buffer.flip(); //flip sets up the buffer so it could be read
return buffer;
}
private void bindIndiciesBuffer(int[] indicies, boolean terrain) {
int vboID = GL15.glGenBuffers();
if(terrain) {
terrainVbos.add(vboID);
} else {
vbos.add(vboID);
}
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboID); //ELEMENT_ARRAY_BUFFER let's openGL know it's the indicies buffer (it's doesn't contain data)
IntBuffer buffer = storeDataInIntBuffer(indicies);
GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW); //Binding an index buffer binds it to the currently bound VAO, so unbinding it remvoes it from the VAO
//Don't unbind Index Buffer!
}
private IntBuffer storeDataInIntBuffer(int[] data) {
IntBuffer buffer = BufferUtils.createIntBuffer(data.length);
buffer.put(data);
buffer.flip(); //so it can be read
return buffer;
}
//Unbinds currently bound VAO
private void unbindVAO(){
GL30.glBindVertexArray(0);
}
}
| true
|
f521197c984c9d21e7e80e88490f71876f2306f1
|
Java
|
szzsa/keepalive-core
|
/src/main/java/ro/szzsa/keepalive/RequestProvider.java
|
UTF-8
| 146
| 1.78125
| 2
|
[
"MIT"
] |
permissive
|
package ro.szzsa.keepalive;
import ro.szzsa.keepalive.model.Request;
/**
*
*/
public interface RequestProvider {
Request getRequest();
}
| true
|
fd8b0045d2b463d2e44750005666ce5b4a3fa7b5
|
Java
|
Linusdalin/Pukka3
|
/src/data/dataBaseLayer/RemoteSQL/RemoteObjectInterface.java
|
UTF-8
| 278
| 1.804688
| 2
|
[] |
no_license
|
package data.dataBaseLayer.RemoteSQL;
/**
* Created with IntelliJ IDEA.
* User: Linus
* Date: 2015-06-30
* Time: 19:02
* To change this template use File | Settings | File Templates.
*/
public interface RemoteObjectInterface {
String[] getValues();
}
| true
|
38ae659c733b6a238acbe5af591c58431028806a
|
Java
|
SunjinPeng2017/furniture-be
|
/src/main/java/com/sun/furniture/Application.java
|
UTF-8
| 2,564
| 2.1875
| 2
|
[] |
no_license
|
package com.sun.furniture;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.log4j.Logger;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
/**
* <b><code>Application</code></b>
* <p/>
* 程序入口
* <p/>
*/
@SpringBootApplication(scanBasePackages = {"com.sun.*"})
@MapperScan("com.sun.furniture.mapper")
public class Application {
/**
* The Log.
*/
private static final Logger LOG = Logger.getLogger(Application.class);
/**
* DataSource配置
*
* @return the data source
*/
@Bean
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
return new DataSource();
}
/**
* 提供SqlSession
*
* @return the sql session factory
* @throws Exception the exception
*/
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
/* DateSource */
sqlSessionFactoryBean.setDataSource(dataSource());
/* Mapper */
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mapper/*.xml"));
/* TypeHandler */
return sqlSessionFactoryBean.getObject();
}
/**
* Transaction manager platform transaction manager.
*
* @return the platform transaction manager
*/
@Bean
public PlatformTransactionManager transactionManager() {
DataSourceTransactionManager manager = new DataSourceTransactionManager(dataSource());
manager.setRollbackOnCommitFailure(false);
return manager;
}
/**
* The entry point of application.
*
* @param args the input arguments
*/
public static void main(String[] args) {
LOG.info("Application Start!");
SpringApplication.run(Application.class, args);
}
}
| true
|
7869f1bc5a48ec025357ebfd3771e3b92be8920a
|
Java
|
devicedrivendev/apitest
|
/src/main/java/com/dd/service/HttpApi.java
|
UTF-8
| 835
| 2.296875
| 2
|
[] |
no_license
|
package com.dd.service;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.PreDestroy;
import java.io.IOException;
@Service
public class HttpApi {
private static final Logger logger = LoggerFactory.getLogger(HttpApi.class.getSimpleName());
private CloseableHttpClient httpClient = HttpClients.createDefault();
public <T> T getData(String url, Class<T> responseClass) throws IOException {
HttpGet request = new HttpGet(url);
// Implement the code
return null;
}
@PreDestroy
public void destroy() throws IOException {
httpClient.close();
}
}
| true
|
a2cebe189be2602e3187aa6b07ba338d3d33d318
|
Java
|
davidrud135/Quizzer
|
/src/main/java/controllers/QuizzesListController.java
|
UTF-8
| 5,540
| 2.375
| 2
|
[] |
no_license
|
package controllers;
import com.google.gson.reflect.TypeToken;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Cursor;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Window;
import models.ApiResponseStatusCodes;
import models.Quiz;
import services.AuthService;
import services.QuizService;
import shared.AppDocumentsPaths;
import utils.GeneralUtils;
import utils.GsonWrapper;
import java.io.IOException;
import java.lang.reflect.Type;
import java.net.URISyntaxException;
import java.net.http.HttpResponse;
import java.util.ArrayList;
public class QuizzesListController {
private ArrayList<Quiz> quizzes;
@FXML
private VBox quizzesVBox;
@FXML
private VBox loadingVBox;
@FXML
void initialize() throws URISyntaxException {
quizzesVBox.managedProperty().bind(quizzesVBox.visibleProperty());
loadingVBox.managedProperty().bind(loadingVBox.visibleProperty());
setLoadingState(true);
QuizService
.getUserQuizzes(AuthService.getCurrUser().getId())
.thenAcceptAsync(this::handleCurrUserQuizzesRequestResponse);
}
@FXML
void onNavigateToMainWindow() throws IOException {
GeneralUtils.openWindow(AppDocumentsPaths.MAIN, getCurrWindow());
}
private void handleCurrUserQuizzesRequestResponse(HttpResponse<String> resp) {
Platform.runLater(() -> {
try {
if (resp.statusCode() == ApiResponseStatusCodes.GET_USER_QUIZZES_SUCCESSFUL) {
Type quizzesType = new TypeToken<ArrayList<Quiz>>() {
}.getType();
quizzes = GsonWrapper.getInstance().fromJson(resp.body(), quizzesType);
generateQuizzesList();
setLoadingState(false);
return;
}
GeneralUtils.openInfoModal("Sorry, an error occurred while getting quizzes.", getCurrWindow());
} catch (IOException e) {
e.printStackTrace();
}
});
}
private void generateQuizzesList() {
quizzesVBox.getChildren().clear();
if (quizzes.isEmpty()) {
var noQuizzesLabel = new Label("You have not created any quizzes yet.");
quizzesVBox.setAlignment(Pos.CENTER);
quizzesVBox.getChildren().add(noQuizzesLabel);
return;
}
for (Quiz quiz : quizzes) {
var quizHBox = new HBox();
var titleHBox = new HBox();
var actionsHBox = new HBox();
var quizTitleLabel = new Label(quiz.getTitle());
var copyQuizIdBtn = new Button();
var removeQuizBtn = new Button();
removeQuizBtn.setFocusTraversable(false);
removeQuizBtn.getStyleClass().add("danger-btn");
removeQuizBtn.setText("Remove");
removeQuizBtn.setId(quiz.getId());
removeQuizBtn.setOnAction((event) -> {
var confirmMessage = String.format("Are you sure you want to remove quiz \'%s?\'", quiz.getTitle());
var isConfirmed = false;
try {
isConfirmed = GeneralUtils.openConfirmModal(confirmMessage, getCurrWindow());
if (isConfirmed) {
QuizService.removeQuiz(quiz.getId()).thenAcceptAsync((resp) -> {
try {
if (resp.statusCode() == ApiResponseStatusCodes.REMOVE_QUIZ_SUCCESSFUL) {
QuizService
.getUserQuizzes(AuthService.getCurrUser().getId())
.thenAcceptAsync(this::handleCurrUserQuizzesRequestResponse);
return;
}
GeneralUtils.openInfoModal("Couldn't remove the quiz.", getCurrWindow());
} catch (Exception e) {
e.printStackTrace();
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
});
quizHBox.getStyleClass().add("quiz-box");
copyQuizIdBtn.getStyleClass().add("primary-btn");
copyQuizIdBtn.setId(quiz.getId());
copyQuizIdBtn.setFocusTraversable(false);
copyQuizIdBtn.setCursor(Cursor.HAND);
copyQuizIdBtn.setText("Copy ID");
copyQuizIdBtn.setOnAction((event) -> GeneralUtils.copyToClipboard(copyQuizIdBtn.getId()));
HBox.setHgrow(titleHBox, Priority.ALWAYS);
titleHBox.setAlignment(Pos.CENTER_LEFT);
titleHBox.getChildren().add(quizTitleLabel);
actionsHBox.setSpacing(10);
actionsHBox.getChildren().addAll(copyQuizIdBtn, removeQuizBtn);
quizHBox.getChildren().addAll(titleHBox, actionsHBox);
quizzesVBox.getChildren().add(quizHBox);
}
}
private Window getCurrWindow() {
return quizzesVBox.getScene().getWindow();
}
private void setLoadingState(boolean isLoading) {
quizzesVBox.setVisible(!isLoading);
loadingVBox.setVisible(isLoading);
}
}
| true
|
391d0a27017cc7208f5da27062a2c5f1840545d3
|
Java
|
zd87/tournament
|
/tournament/src/tournament/App.java
|
UTF-8
| 1,270
| 3.296875
| 3
|
[] |
no_license
|
package tournament;
import java.util.ArrayList;
import java.util.List;
public class App {
public static void main(String[] args) {
// create individual matches
IndividualMatch indMatchOne = new IndividualMatch(
new Player("Superman"), new Player("Batman"));
IndividualMatch indMatchTwo = new IndividualMatch(
new Player("Iron man"), new Player("Antman"));
// create teams
Team teamOne = new Team("The X-men", Utils.randomNames(11));
Team teamTwo = new Team("Avengers", Utils.randomNames(11));
Team teamThree = new Team("Freaks", Utils.randomNames(11));
Team teamFour = new Team("Geeks", Utils.randomNames(11));
// create collective matches
CollectiveMatch collMatchOne = new CollectiveMatch(teamOne, teamTwo);
CollectiveMatch collMatchTwo = new CollectiveMatch(teamThree, teamFour);
// create list of matches
List<Match> tournament = new ArrayList<>();
tournament.add(indMatchOne);
tournament.add(indMatchTwo);
tournament.add(collMatchOne);
tournament.add(collMatchTwo);
// Games begin
// Half time break!
Utils.setHalfTimeScore(tournament);
// Games go on
// Games are over!
Utils.setFinalScore(tournament);
// printing scores
for (Match match : tournament) {
match.showResult();
}
}
}
| true
|
7af07031f71992717ef03d2a6b6fdc811a8e28e8
|
Java
|
ayushmanmishra98/handson-assignments
|
/case-study/case-study/src/com/org/exception/NotFound.java
|
UTF-8
| 159
| 2.140625
| 2
|
[] |
no_license
|
package com.org.exception;
public class NotFound extends Exception{
public NotFound() {
super("Not Found");
}
public NotFound(String msg) {
super(msg);
}
}
| true
|
078fe4fb2b357bc663880fbd83e50344b4c52514
|
Java
|
XGKerwin/X_ETC_54_64
|
/app/src/main/java/com/example/x_etc_54_64/activity/Activity_clwz2.java
|
UTF-8
| 8,141
| 1.945313
| 2
|
[] |
no_license
|
package com.example.x_etc_54_64.activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.example.x_etc_54_64.R;
import com.example.x_etc_54_64.bean.CLWZ;
import com.example.x_etc_54_64.bean.CXJG;
import com.example.x_etc_54_64.bean.WZZL;
import com.example.x_etc_54_64.net.OkHttpLo;
import com.example.x_etc_54_64.net.OkHttpTo;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class Activity_clwz2 extends AppCompatActivity {
private List<String> strings;
private ImageView caidan;
private TextView title;
private ListView listview;
private List<CLWZ> clwzList;
private List<WZZL> wzzlList;
private TextView txtDidian;
private TextView txtMes;
private ImageView imgZuo;
private ImageView img1;
private ImageView img2;
private ImageView imgYou;
private TextView txtWeizhang;
private TextView txtFakuan;
private TextView txtKoufen;
private List<CXJG> cxjgList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_clwz2);
strings = getIntent().getStringArrayListExtra("1");
initView();
getinit();
getOKHttp();
btn();
}
private int pos = 0;
private void btn() {
imgYou.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (pos == weizhang-1){
}else {
pos = pos+1;
getshow();
}
}
});
imgZuo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (pos == 0){
}else {
pos = pos-1;
getshow();
}
}
});
}
private void getshow() {
CXJG cxjg = cxjgList.get(pos);
txtDidian.setText(cxjg.getDidian());
txtMes.setText(cxjg.getMsg());
switch (cxjg.getNumber()){
case "1":
img1.setImageResource(R.drawable.weizhang1);
img2.setImageResource(R.drawable.weizhang10);
break;
case "2":
img1.setImageResource(R.drawable.weizhang2);
img2.setImageResource(R.drawable.weizhang9);
break;
case "3":
img1.setImageResource(R.drawable.weizhang3);
img2.setImageResource(R.drawable.weizhang8);
break;
case "4":
img1.setImageResource(R.drawable.weizhang4);
img2.setImageResource(R.drawable.weizhang7);
break;
case "5":
img1.setImageResource(R.drawable.weizhang5);
img2.setImageResource(R.drawable.weizhang6);
break;
case "6":
img1.setImageResource(R.drawable.weizhang6);
img2.setImageResource(R.drawable.weizhang5);
break;
case "7":
img1.setImageResource(R.drawable.weizhang7);
img2.setImageResource(R.drawable.weizhang4);
break;
case "8":
img1.setImageResource(R.drawable.weizhang8);
img2.setImageResource(R.drawable.weizhang3);
break;
case "9":
img1.setImageResource(R.drawable.weizhang9);
img2.setImageResource(R.drawable.weizhang2);
break;
case "10":
img1.setImageResource(R.drawable.weizhang10);
img2.setImageResource(R.drawable.weizhang1);
break;
}
}
private void getOKHttp() {
//{"UserName":"user1"}
if (clwzList == null){
clwzList = new ArrayList<>();
}else {
clwzList.clear();
}
new OkHttpTo()
.setUrl("get_all_car_peccancy")
.setJsonObject("UserName","user1")
.setOkHttpLo(new OkHttpLo() {
@Override
public void onResponse(JSONObject jsonObject) {
clwzList.addAll((Collection<? extends CLWZ>) new Gson().fromJson(jsonObject.optJSONArray("ROWS_DETAIL").toString(),
new TypeToken<List<CLWZ>>(){}.getType()));
getokhttp2();
}
@Override
public void onFailure(IOException obj) {
}
}).start();
}
private void getokhttp2() {
if (wzzlList == null){
wzzlList = new ArrayList<>();
}else {
wzzlList.clear();
}
//{"UserName":"user1"}
new OkHttpTo()
.setUrl("get_pessancy_infos")
.setJsonObject("UserName","user1")
.setOkHttpLo(new OkHttpLo() {
@Override
public void onResponse(JSONObject jsonObject) {
wzzlList.addAll((Collection<? extends WZZL>) new Gson().fromJson(jsonObject.optJSONArray("ROWS_DETAIL").toString(),
new TypeToken<List<WZZL>>(){}.getType()));
show();
}
@Override
public void onFailure(IOException obj) {
}
}).start();
}
private int weizhang = 0;
private void show() {
if (cxjgList == null){
cxjgList = new ArrayList<>();
}else {
cxjgList.clear();
}
int fakuam = 0;
int koufen = 0;
for (int i=0;i<strings.size();i++){
String s = strings.get(i);
for (int i1 = 0; i1< clwzList.size(); i1++){
CLWZ clwz = clwzList.get(i1);
if (s.equals(clwz.getId())){
for (int i2=0;i2<wzzlList.size();i2++){
WZZL wzzl = wzzlList.get(i2);
if (clwz.getInfoid().equals(wzzl.getInfoid())){
weizhang = strings.size();
int fk = Integer.parseInt(wzzl.getFine());
int kf = Integer.parseInt(wzzl.getDeduct());
fakuam += fk;
koufen += kf;
txtWeizhang.setText("违章:"+weizhang);
txtFakuan.setText("罚款:"+fakuam);
txtKoufen.setText("扣分"+koufen);
CXJG cxjg = new CXJG(clwz.getId(),wzzl.getRoad(),wzzl.getMessage());
cxjgList.add(cxjg);
}
}
}
}
}
}
private void getinit() {
title.setText("查询结果");
caidan.setImageResource(R.drawable.back);
caidan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
private void initView() {
caidan = findViewById(R.id.caidan);
title = findViewById(R.id.title);
listview = findViewById(R.id.listview);
txtDidian = findViewById(R.id.txt_didian);
txtMes = findViewById(R.id.txt_mes);
imgZuo = findViewById(R.id.img_zuo);
img1 = findViewById(R.id.img_1);
img2 = findViewById(R.id.img_2);
imgYou = findViewById(R.id.img_you);
txtWeizhang = findViewById(R.id.txt_weizhang);
txtFakuan = findViewById(R.id.txt_fakuan);
txtKoufen = findViewById(R.id.txt_koufen);
}
}
| true
|
50e7391f23c53306895005cbd2ae91c9ffdbacc8
|
Java
|
malvitvik/selenium-autotests-google
|
/src/main/java/cucumber/pages/GoogleHome.java
|
UTF-8
| 694
| 2.34375
| 2
|
[] |
no_license
|
package cucumber.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.springframework.stereotype.Component;
@Component
public class GoogleHome extends Page {
private By bySearchField = By.name("q");
public GoogleHome open() {
open(getUrl());
LOG.debug("Google Home is opened by url: " + getUrl());
return this;
}
public SearchResultsPage doSearch(String searchPhrase) {
WebElement searchField = $(bySearchField);
searchField.sendKeys(searchPhrase);
searchField.submit();
LOG.debug("Google Home: do search by phrase: " + searchPhrase);
return new SearchResultsPage();
}
}
| true
|
4610b610b59601435813760757b7080977b8843d
|
Java
|
kalyan-anna/aws-fake-sqs-dev-impl
|
/src/test/java/com/example/SqsQueueServiceTest.java
|
UTF-8
| 2,094
| 2.28125
| 2
|
[] |
no_license
|
package com.example;
import com.amazonaws.services.sqs.AmazonSQSClient;
import com.amazonaws.services.sqs.model.CreateQueueResult;
import com.amazonaws.services.sqs.model.ListQueuesResult;
import com.amazonaws.services.sqs.model.Message;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.Collections;
import java.util.Optional;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
public class SqsQueueServiceTest extends BaseTestClass {
private SqsQueueService queueService;
@Mock
private AmazonSQSClient sqs;
@Before
public void before() {
queueService = new SqsQueueService(sqs);
when(sqs.createQueue(anyString())).thenReturn(new CreateQueueResult().withQueueUrl("dummyQUrl"));
}
@Test
public void push_shouldInvokeSendMessageOnSQS() {
queueService.push("dummyQ", "dummyMessage");
verify(sqs, times(1)).sendMessage(anyString(), anyString());
}
@Test
public void pull_shouldInvokeReceiveMessageOnSQS() {
when(sqs.receiveMessage(anyString())).thenReturn(new ReceiveMessageResult().withMessages(new Message()));
when(sqs.listQueues(anyString())).thenReturn(new ListQueuesResult().withQueueUrls("qUrl"));
queueService.pull("qUrl");
verify(sqs, times(1)).receiveMessage(anyString());
}
@Test
public void pull_shouldReturnEmptyOptional_whenThereIsNoMessageInQueue() {
when(sqs.listQueues(anyString())).thenReturn(new ListQueuesResult().withQueueUrls("qUrl"));
when(sqs.receiveMessage(anyString())).thenReturn(new ReceiveMessageResult().withMessages(Collections.emptyList()));
Optional<Message> message = queueService.pull("qUrl");
assertThat(message.isPresent(), is(false));
}
@Test
public void delete_shouldInvokeDeleteMessageOnSQS() {
queueService.delete("qUrl", "receiptHandler");
verify(sqs, times(1)).deleteMessage(anyString(), anyString());
}
}
| true
|
583c3307b1091762764a5cc7cf86457df10082d2
|
Java
|
CVXIV/springboot
|
/src/main/java/com/example/springboot/Mail/AuthMail.java
|
UTF-8
| 3,350
| 2.3125
| 2
|
[] |
no_license
|
package com.example.springboot.Mail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.mail.MailProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.messaging.MessagingException;
import org.springframework.stereotype.Component;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@Component
@EnableConfigurationProperties(MailProperties.class)
public class AuthMail {
private static final String template = "mail.ftl";
private static final int codeLength=4;
private static final Map<String,String> checkCode=new ConcurrentHashMap<>();
private final FreeMarkerConfigurer freeMarkerConfigurer;
private final JavaMailSender javaMailSender;
private final MailProperties mailProperties;
@Autowired
public AuthMail(FreeMarkerConfigurer freeMarkerConfigurer, JavaMailSender javaMailSender, MailProperties mailProperties){
this.freeMarkerConfigurer=freeMarkerConfigurer;
this.javaMailSender=javaMailSender;
this.mailProperties=mailProperties;
}
public void sendMail(String email) throws Exception {
Map<String, Object> map = new HashMap<>();
String code=getRandomCode();
map.put("email", email);
map.put("code",code);
String text = this.getTextByTemplate(map);
this.send(email, text);
checkCode.put(email,code);
}
private String getTextByTemplate(Map<String, Object> model) throws Exception {
return FreeMarkerTemplateUtils
.processTemplateIntoString(this.freeMarkerConfigurer.getConfiguration().getTemplate(AuthMail.template), model);
}
private void send(String email, String text) throws MessagingException, UnsupportedEncodingException, javax.mail.MessagingException {
MimeMessage message = this.javaMailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8");
InternetAddress from = new InternetAddress();
from.setAddress(this.mailProperties.getUsername());
from.setPersonal("验证码", "UTF-8");
helper.setFrom(from);
helper.setTo(email);
helper.setSubject("验证码邮件");
helper.setText(text, true);
this.javaMailSender.send(message);
}
private String getRandomCode() {
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < codeLength; ++i) {
sb.append(random.nextInt(10));
}
return sb.toString();
}
public boolean checkCode(String code,String email){
String result=checkCode.get(email);
if(result==null||!result.equals(code)){
return false;
}else {
checkCode.remove(email);
return true;
}
}
}
| true
|
8d5054ffcb397e5c27aa84a80236a950cfde1466
|
Java
|
kmssankar/DesignPatterns
|
/src/org/designpattern/behavioral/command/HRMApplication.java
|
UTF-8
| 403
| 2.53125
| 3
|
[] |
no_license
|
package org.designpattern.behavioral.command;
public class HRMApplication {
String application = "Peoplesoft HRM for NA";
int namedUsers = 200;
public void licenseSoftware()
{
System.out.println( application + " licensed to " + namedUsers + " namedUsers !");
}
public void DeploySoftware()
{
System.out.println( application + " deployed in Oracle cloud!" );
}
}
| true
|
73cbf1a8bc3a82131f3392d172d4bdd535d18daa
|
Java
|
lucasestevesr/sistema-monitoramento-ru
|
/Sistema/MonitoramentoRU/src/main/java/ufjf/dcc025/monitoramentoru/model/MonitorarLotacao.java
|
UTF-8
| 2,138
| 2.546875
| 3
|
[] |
no_license
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ufjf.dcc025.monitoramentoru.model;
import javax.swing.JOptionPane;
import ufjf.dcc025.monitoramentoru.dao.BancoDeDadosUsuario;
/**
*
* @author Your Name <lucas.esteves@engenharia.ufjf.br>
*/
public class MonitorarLotacao {
private final int lotacaoMaxima = 10;
int contPessoas;
public void monitorar(String diaSemana, String hora) {
if ("Escolha".equals(diaSemana) || "Escolha".equals(hora)) {
JOptionPane.showMessageDialog(null, "Erro: os campos de dia e/ou hora estão vazios. Por favor,preencha-os corretamente");
} else {
for (int i = 0; i < BancoDeDadosUsuario.getRefeicoes().size(); i++) {
if (BancoDeDadosUsuario.getRefeicoes().get(i).getDiaSemana().equals(diaSemana)) {
if (BancoDeDadosUsuario.getRefeicoes().get(i).getHorario().equals(hora)) {
if (BancoDeDadosUsuario.getRefeicoes().get(i).getTipo().equals("Agendamento")) {
contPessoas++;
}
}
}
}
JOptionPane.showMessageDialog(null, "A lotacao do RU " + diaSemana + " das " + hora + "\né de " + (contPessoas * 100 / lotacaoMaxima) + "% da capacidade máxima");
}
}
// for (int i = 0; i < usuarios.size(); i++) {
// Usuario usuario = usuarios.get(i);
// if (usuario.getIdentificador().equals(identificador) && usuario.getSenha().equals(senha)) {
// setUsuarioLogado(usuario);
// return true;
// }
// }
public MonitorarLotacao() {
this.contPessoas = contPessoas;
}
public int getLotacaoMaxima() {
return lotacaoMaxima;
}
public int getContPessoas() {
return contPessoas;
}
public void setContPessoas(int contPessoas) {
this.contPessoas = contPessoas;
}
}
| true
|
e1b649837e35a06f507998e6ebd6d18a19b2c588
|
Java
|
mmiglia/thesis-ug
|
/thesis-ug/src/main/java/web/TaskResource.java
|
UTF-8
| 3,313
| 2.765625
| 3
|
[] |
no_license
|
package web;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.CookieParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import valueobject.SingleTask;
import businessobject.TaskManager;
/**
* Task Resource is responsible for GETTING the task from the server.
* This class uses mainly method of TaskManager class
*/
@Path("/{username}/task")
public class TaskResource {
private static Logger log = LoggerFactory.getLogger(TaskResource.class);
/**
* Create new task to the database
* @param userid unique UUID of the user
* @param toAdd SingleTask instance
* @return true upon successful addition
*/
@POST
@Path("/add")
@Consumes("application/xml")
public void createTask(@PathParam("username") String userid,
@CookieParam("sessionid") String sessionid, SingleTask toAdd) {
log.info("Request to create task from user " + userid + ", session "+ sessionid);
TaskManager.getInstance().createTask(userid, toAdd);
}
/**
* Get all tasks of this user
* @param userid user id of the user
* @param sessionid session token acquired by login
* @return list of tasks from this user
*/
@GET
@Path("/all")
@Produces("application/xml")
public List<SingleTask> getAllTasks(@PathParam("username") String userid,
@CookieParam("sessionid") String sessionid) {
log.info("Request to get all tasks from user " + userid + ", session "
+ sessionid);
return TaskManager.getInstance().retrieveAllTask(userid);
}
/**
* get first few top 5 priority tasks
* @param userid user id of the user
* @param sessionid session token acquired by login
* @return list of top priority tasks
*/
@GET
@Path("/first")
@Produces("application/xml")
public List<SingleTask> getFirstTasks(@PathParam("username") String userid,
@CookieParam("sessionid") String sessionid) {
log.info("Request to get first important tasks from user " + userid
+ ", session " + sessionid);
return TaskManager.getInstance().getFirstTasks(userid);
}
/**
* Update the task identified by newTask.ID in the database
* @param userid user id of the user
* @param sessionid session token acquired by login
* @param newTask SingleTask object that will replace the old task
*/
@POST
@Path("update")
@Consumes("application/xml")
public void updateTasks(@PathParam("username") String userid,
@CookieParam("sessionid") String sessionid, SingleTask newTask) {
log.info("Request to update task from user " + userid + ", session " + sessionid);
TaskManager.getInstance().updateTask(userid, newTask);
}
/**
* remove task specified by UUID
*
* @param taskID
* UUID of a task to be removed
* @param userid user id of the user
* @param sessionid session token acquired by login
* @return 0 for unsuccessful, 1 for successful
*/
@POST
@Path("/erase")
@Consumes("application/xml")
public void removeTasks(String taskID,
@PathParam("username") String userid,
@CookieParam("sessionid") String sessionid) {
log.info("Request to remove task " + taskID + " from user " + userid
+ ", session " + sessionid);
TaskManager.getInstance().removeTask(userid, taskID);
}
}
| true
|
0d07e0297d1d89b8dfea79c22bfc4d58e1c8aceb
|
Java
|
Team5830/Infinite-Recharge-Robot
|
/src/main/java/frc/robot/misc/SensorReset.java
|
UTF-8
| 544
| 2.328125
| 2
|
[
"MIT"
] |
permissive
|
/**
* @author Hunter Pugh
*/
package frc.robot.misc;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
public class SensorReset {
public void ResetSensors(){
//Place sensor reset code here. Some examples:
//RobotContainer.ahrs.enableBoardlevelYawReset(true);
//RobotContainer.ahrs.reset();
//RobotContainer.armEncoder.reset();
//RobotContainer.manipulatorEncoder.reset();
System.out.println("Sensors Reset");
SmartDashboard.putBoolean("Reset Sensors", false);
}
}
| true
|
d856694e044815b18248584bf2e32f13c84def65
|
Java
|
md-sabbir-ullah/FirebaseCloudPushNotification-Android
|
/app/src/main/java/esenteq/project/pushnotificationapp/MainActivity.java
|
UTF-8
| 5,174
| 2.140625
| 2
|
[] |
no_license
|
package esenteq.project.pushnotificationapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthUserCollisionException;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
public class MainActivity extends AppCompatActivity {
//1.Notification Channel
//2.Notification Builder
//3.Notification Manager
public static final String CHANNEL_ID = "push_notification";
private static final String CHANNEL_NAME = "Push Notification";
private static final String CHANNEL_DESC = "Push Notification Application";
private EditText et_email, et_pass;
private ProgressBar progbar_login;
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAuth = FirebaseAuth.getInstance();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
NotificationChannel channel =
new NotificationChannel(CHANNEL_ID,CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
channel.setDescription(CHANNEL_DESC);
NotificationManager manager = getSystemService(NotificationManager.class);
manager.createNotificationChannel(channel);
}
et_email = findViewById(R.id.et_emailID);
et_pass = findViewById(R.id.et_passwordID);
progbar_login = findViewById(R.id.progbar_loginpageID);
progbar_login.setVisibility(View.INVISIBLE);
findViewById(R.id.btn_signupID).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
createUser();
}
});
}
private void createUser(){
final String email = et_email.getText().toString().trim();
final String pass = et_pass.getText().toString().trim();
if(email.isEmpty()){
et_email.setError("Email Required!");
et_email.requestFocus();
return;
}
if(pass.isEmpty()){
et_pass.setError("Password Required!");
et_pass.requestFocus();
return;
}
if(pass.length()<6){
et_pass.setError("Atleast 6 char required!");
et_pass.requestFocus();
return;
}
progbar_login.setVisibility(View.VISIBLE);
mAuth.createUserWithEmailAndPassword(email,pass)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
startProfileActivity();
}
else{
if(task.getException() instanceof FirebaseAuthUserCollisionException){
userLogin(email,pass);
}
else{
progbar_login.setVisibility(View.INVISIBLE);
Toast.makeText(MainActivity.this, task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
});
}
private void userLogin(String email, String password){
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
startProfileActivity();
}
else{
progbar_login.setVisibility(View.INVISIBLE);
Toast.makeText(MainActivity.this, task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
protected void onStart() {
super.onStart();
if(mAuth.getCurrentUser() != null){
startProfileActivity();
}
}
private void startProfileActivity(){
Intent intent = new Intent(this, ProfileActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
}
| true
|
9a0d7b02de9355bcf40451a3c4ad12c84c54c478
|
Java
|
genalt/training_cp
|
/uva/old_java/MaxRectangleSubmatrix/src/MaxRectangleSubmatrix.java
|
UTF-8
| 770
| 3.109375
| 3
|
[] |
no_license
|
public class MaxRectangleSubmatrix {
static int getOneSubmatrix(int[][] matrix) {
int r = matrix.length;
int c = matrix[0].length;
int max_area = 0;
for (int i = 1; i < r; ++i)
for (int j = 0; j < c; ++j)
if (matrix[i][j] != 0)
matrix[i][j] += matrix[i -1][j];
/*
for (int i = 0; i < r; ++i) {
for (int j = 0; j < c; ++j)
System.out.print(matrix[i][j] + " ");
System.out.println();
}
*/
return 0;
}
public static void main(String[] args) {
int[][] matrix = {{0, 0, 0, 1, 1},
{1, 0, 0, 1, 0}
};
getOneSubmatrix(matrix);
}
}
| true
|
ab27fe48ace05068c85d7c75207f4ecc64e34052
|
Java
|
onebroccoli/Algorithm_Java
|
/src/Q407_Trapping_Rain_Water_II.java
|
UTF-8
| 841
| 3.328125
| 3
|
[] |
no_license
|
/*
Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining.
Example 1:
Input: heightMap = [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]]
Output: 4
Explanation: After the rain, water is trapped between the blocks.
We have two small pounds 1 and 3 units trapped.
The total volume of water trapped is 4.
Example 2:
Input: heightMap = [[3,3,3,3,3],[3,2,2,2,3],[3,2,1,2,3],[3,2,2,2,3],[3,3,3,3,3]]
Output: 10
Constraints:
m == heightMap.length
n == heightMap[i].length
1 <= m, n <= 200
0 <= heightMap[i][j] <= 2 * 104
*/
/*
https://docs.google.com/document/d/1jxuNRT_3uJCKFUdCEyRllsyg_3dy0FnQ5orCldfHRNs/edit
laicode answer
*/
//public class Q407_Trapping_Rain_Water_II {
// public trapRainWater(int[][] heightMap){
//
// }
//}
| true
|
9ded4024d6742a6e10221b6bed1d4cb5a5d12eaf
|
Java
|
pepinocj/SADG
|
/SADG_BackEnd/src/backEnd/RegularMode.java
|
UTF-8
| 1,063
| 3.015625
| 3
|
[] |
no_license
|
package backEnd;
import java.util.ArrayList;
import java.util.Map;
public class RegularMode extends GameMode {
@Override
public Map<String, Integer> assignSongs(SongPicker songPicker,GameState gameState) {
ArrayList<Person> players = gameState.getPlayers();
int nbOfSongsNeeded = players.size()/2;
System.out.println("nb of songs needed = " + nbOfSongsNeeded);
ArrayList<Integer> songs = songPicker.pickSongs(nbOfSongsNeeded, gameState.level, gameState.genre);
System.out.println("we picked these songs: ");
for(Integer song : songs){
System.out.println(song);
}
System.out.println("We picked these songs: " + songs.toString());
songs.addAll(songs);
assert(players.size() == songs.size());
Map<String,Integer> playerSongMap = assignToPlayers(songs, players);
return playerSongMap;
}
@Override
public MatchType handleScore(String pers1, String pers2, GameState currentState) {
boolean result = super.regularMatch(pers1, pers2, currentState);
if (result){return MatchType.SUCCESS;}
else {return MatchType.FAIL;}
}
}
| true
|
b06455ddaf83f84aceaef4d2c7432f8911e104da
|
Java
|
shum979/ProjectCat
|
/src/main/java/com/sparkTech/cat/AppContext.java
|
UTF-8
| 1,500
| 2.84375
| 3
|
[] |
no_license
|
package com.sparkTech.cat;
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
/**
* Created by Shubham A Gupta on 02-May-18.
*/
public class AppContext {
private static Properties properties = null;
private static AppContext instance = null;
private AppContext(String filePath){
if (properties == null){
properties = new Properties();
loadProperties(filePath);
}
}
public static AppContext getInstance(String filePath) {
if(instance == null){
instance = new AppContext(filePath);
}
return instance;
}
public String getValue(String key){
return properties.getProperty(key);
}
public Set<String> getAllValuesContaining(String string) {
Set<String> allKeys = new TreeSet<>();
Set<Object> objects = properties.keySet();
for (Object obj : objects) {
String str = obj.toString();
if (str.startsWith(string)) {
allKeys.add(str);
}
}
return allKeys;
}
private static void loadProperties(String filePath) {
try {
BufferedReader bufferedReader = Files.newBufferedReader(Paths.get(filePath));
properties.load(bufferedReader);
} catch (IOException e) {
e.printStackTrace();
}
}
}
| true
|
16c49bf322137679cb7fb9b85ffd5015ca82b837
|
Java
|
yanbinwa/serviceManagerCommon
|
/src/main/java/yanbinwa/common/file/FileWatcherImpl.java
|
UTF-8
| 5,237
| 3.21875
| 3
|
[] |
no_license
|
package yanbinwa.common.file;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
/*
* 监控多个文件的创建,修改和删除,并通过callback发送结果
* (返回应该是一个Map,key为文件,value为其文件的状态)
*
* 内部结构是一个Map,key为文件,value为该文件的修改时间,初始时间是-1,会定期去遍历所有register的
* 文件
*
* 1. 如果初始时间为-1,则要查看文件是否存在,如果存在了,说明该文件被创建了,发送create状态
*
* 2. 如果初始时间不为-1,则查看文件是否存在,如果不存在了,说明该文件被销毁了,发送delete状态
*
* 3. 如果初始时间不为-1,并且文件存在,查看其修改时间,如果与初始时间不一致,说明文件被改动了,发送change状态
*
*/
public class FileWatcherImpl implements FileWatcher
{
private static final Logger logger = Logger.getLogger(FileWatcherImpl.class);
private Map<String, Long> fileNameToChangeTimestamp = new HashMap<String, Long>();
FileWatcherCallback callback = null;
boolean isRunning = false;
Thread fileWatcherThread = null;
public FileWatcherImpl(FileWatcherCallback callback)
{
this.callback = callback;
}
@Override
public void registerFile(String filePath)
{
fileNameToChangeTimestamp.put(filePath, INIT_FILE_CHANGE_TIMESTAMP);
}
@Override
public void unRegisterFile(String filePath)
{
fileNameToChangeTimestamp.remove(filePath);
}
@Override
public void start()
{
if (!isRunning)
{
logger.info("start FileWatcher");
isRunning = true;
fileWatcherThread = new Thread(new Runnable(){
@Override
public void run()
{
watcherFiles();
}
});
fileWatcherThread.start();
}
else
{
logger.info("FileWatcher is already start");
}
}
@Override
public void stop()
{
if (isRunning)
{
logger.info("stop FileWatcher");
isRunning = false;
fileWatcherThread.interrupt();
fileWatcherThread = null;
fileNameToChangeTimestamp.clear();
if (callback != null)
{
callback.handleFileWatcherClose();
}
}
else
{
logger.info("FileWatcher is already stop");
}
}
private void watcherFiles()
{
logger.info("start to watcher file");
while(isRunning)
{
Map<String, FileStatus> watchResult = new HashMap<String, FileStatus>();
for (Map.Entry<String, Long> entry : fileNameToChangeTimestamp.entrySet())
{
String filePath = entry.getKey();
long fileChangeTimestamp = entry.getValue();
if (fileChangeTimestamp == INIT_FILE_CHANGE_TIMESTAMP)
{
boolean ret = isFileExist(filePath);
if (ret)
{
long lastChangeTimestamp = getFileLastChangeTimestamp(filePath);
fileNameToChangeTimestamp.put(filePath, lastChangeTimestamp);
watchResult.put(filePath, FileStatus.CREATE);
}
}
else
{
boolean ret = isFileExist(filePath);
if (!ret)
{
fileNameToChangeTimestamp.put(filePath, INIT_FILE_CHANGE_TIMESTAMP);
watchResult.put(filePath, FileStatus.DELETE);
}
else
{
long lastChangeTimestamp = getFileLastChangeTimestamp(filePath);
if (lastChangeTimestamp != fileChangeTimestamp)
{
fileNameToChangeTimestamp.put(filePath, lastChangeTimestamp);
watchResult.put(filePath, FileStatus.CHANGE);
}
}
}
}
if (!watchResult.isEmpty() && callback != null)
{
callback.handleFileStatueChange(watchResult);
}
try
{
Thread.sleep(FILE_WATCHER_INTERVAL);
}
catch (InterruptedException e)
{
if (!isRunning)
{
logger.info("fileWatcherThread is interepter");
}
else
{
logger.error(e.getMessage());
}
}
}
}
private boolean isFileExist(String filePath)
{
File f = new File(filePath);
return f.exists();
}
private long getFileLastChangeTimestamp(String filePath)
{
File f = new File(filePath);
return f.lastModified();
}
}
| true
|
9d5d54d3201c71435d25cf21c5fb5fc296e41189
|
Java
|
codemenivo/Java-Basics-2019-may
|
/src/Lec_02_SimpleOperationsAndCalculations/Pro01_USDToBGN.java
|
UTF-8
| 419
| 3.375
| 3
|
[] |
no_license
|
package Lec_02_SimpleOperationsAndCalculations;
import java.util.Scanner;
public class Pro01_USDToBGN {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Въведете сумата в USD: ");
double usd = Double.parseDouble(scanner.nextLine());
double bgn = usd * 1.79545;
System.out.printf("%.2f", bgn);
}
}
| true
|
85c1decf515dbf5b198c984f64926d3db198c655
|
Java
|
wang-shun/rainiee-core
|
/modules/bid/bid-experience-console-service/src/main/java/com/dimeng/p2p/modules/bid/console/service/entity/BidReturn.java
|
UTF-8
| 374
| 1.75
| 2
|
[] |
no_license
|
/**
*
*/
package com.dimeng.p2p.modules.bid.console.service.entity;
/**
* 投资、流标、放款返回对象
*
* @author guopeng
*
*/
public class BidReturn {
/**
* 投资返回订单ID
*/
public int[] bidOrderIds;
/**
* 体验金投资返回ID
*/
public String experOrderIds;
/**
* 加息券放款订单ID
*/
public String couponOrderIds;
}
| true
|
feab8dadf413d0c66b2e603f47009b61ac635850
|
Java
|
osudroid/osu-droid
|
/AndEngine/src/org/anddev/andengine/util/SAXUtils.java
|
UTF-8
| 6,614
| 2.546875
| 3
|
[
"Apache-2.0"
] |
permissive
|
package org.anddev.andengine.util;
import org.xml.sax.Attributes;
/**
* (c) 2010 Nicolas Gramlich
* (c) 2011 Zynga Inc.
*
* @author Nicolas Gramlich
* @since 22:02:09 - 21.07.2010
*/
public class SAXUtils {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
// ===========================================================
// Constructors
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
// ===========================================================
// Methods
// ===========================================================
public static String getAttribute(final Attributes pAttributes, final String pAttributeName, final String pDefaultValue) {
final String value = pAttributes.getValue("", pAttributeName);
return (value != null) ? value : pDefaultValue;
}
public static String getAttributeOrThrow(final Attributes pAttributes, final String pAttributeName) {
final String value = pAttributes.getValue("", pAttributeName);
if(value != null) {
return value;
} else {
throw new IllegalArgumentException("No value found for attribute: '" + pAttributeName + "'");
}
}
public static boolean getBooleanAttribute(final Attributes pAttributes, final String pAttributeName, final boolean pDefaultValue) {
final String value = pAttributes.getValue("", pAttributeName);
return (value != null) ? Boolean.parseBoolean(value) : pDefaultValue;
}
public static boolean getBooleanAttributeOrThrow(final Attributes pAttributes, final String pAttributeName) {
return Boolean.parseBoolean(SAXUtils.getAttributeOrThrow(pAttributes, pAttributeName));
}
public static byte getByteAttribute(final Attributes pAttributes, final String pAttributeName, final byte pDefaultValue) {
final String value = pAttributes.getValue("", pAttributeName);
return (value != null) ? Byte.parseByte(value) : pDefaultValue;
}
public static byte getByteAttributeOrThrow(final Attributes pAttributes, final String pAttributeName) {
return Byte.parseByte(SAXUtils.getAttributeOrThrow(pAttributes, pAttributeName));
}
public static short getShortAttribute(final Attributes pAttributes, final String pAttributeName, final short pDefaultValue) {
final String value = pAttributes.getValue("", pAttributeName);
return (value != null) ? Short.parseShort(value) : pDefaultValue;
}
public static short getShortAttributeOrThrow(final Attributes pAttributes, final String pAttributeName) {
return Short.parseShort(SAXUtils.getAttributeOrThrow(pAttributes, pAttributeName));
}
public static int getIntAttribute(final Attributes pAttributes, final String pAttributeName, final int pDefaultValue) {
final String value = pAttributes.getValue("", pAttributeName);
return (value != null) ? Integer.parseInt(value) : pDefaultValue;
}
public static int getIntAttributeOrThrow(final Attributes pAttributes, final String pAttributeName) {
return Integer.parseInt(SAXUtils.getAttributeOrThrow(pAttributes, pAttributeName));
}
public static long getLongAttribute(final Attributes pAttributes, final String pAttributeName, final long pDefaultValue) {
final String value = pAttributes.getValue("", pAttributeName);
return (value != null) ? Long.parseLong(value) : pDefaultValue;
}
public static long getLongAttributeOrThrow(final Attributes pAttributes, final String pAttributeName) {
return Long.parseLong(SAXUtils.getAttributeOrThrow(pAttributes, pAttributeName));
}
public static float getFloatAttribute(final Attributes pAttributes, final String pAttributeName, final float pDefaultValue) {
final String value = pAttributes.getValue("", pAttributeName);
return (value != null) ? Float.parseFloat(value) : pDefaultValue;
}
public static float getFloatAttributeOrThrow(final Attributes pAttributes, final String pAttributeName) {
return Float.parseFloat(SAXUtils.getAttributeOrThrow(pAttributes, pAttributeName));
}
public static double getDoubleAttribute(final Attributes pAttributes, final String pAttributeName, final double pDefaultValue) {
final String value = pAttributes.getValue("", pAttributeName);
return (value != null) ? Double.parseDouble(value) : pDefaultValue;
}
public static double getDoubleAttributeOrThrow(final Attributes pAttributes, final String pAttributeName) {
return Double.parseDouble(SAXUtils.getAttributeOrThrow(pAttributes, pAttributeName));
}
public static void appendAttribute(final StringBuilder pStringBuilder, final String pName, final boolean pValue) {
SAXUtils.appendAttribute(pStringBuilder, pName, String.valueOf(pValue));
}
public static void appendAttribute(final StringBuilder pStringBuilder, final String pName, final byte pValue) {
SAXUtils.appendAttribute(pStringBuilder, pName, String.valueOf(pValue));
}
public static void appendAttribute(final StringBuilder pStringBuilder, final String pName, final short pValue) {
SAXUtils.appendAttribute(pStringBuilder, pName, String.valueOf(pValue));
}
public static void appendAttribute(final StringBuilder pStringBuilder, final String pName, final int pValue) {
SAXUtils.appendAttribute(pStringBuilder, pName, String.valueOf(pValue));
}
public static void appendAttribute(final StringBuilder pStringBuilder, final String pName, final long pValue) {
SAXUtils.appendAttribute(pStringBuilder, pName, String.valueOf(pValue));
}
public static void appendAttribute(final StringBuilder pStringBuilder, final String pName, final float pValue) {
SAXUtils.appendAttribute(pStringBuilder, pName, String.valueOf(pValue));
}
public static void appendAttribute(final StringBuilder pStringBuilder, final String pName, final double pValue) {
SAXUtils.appendAttribute(pStringBuilder, pName, String.valueOf(pValue));
}
public static void appendAttribute(final StringBuilder pStringBuilder, final String pName, final String pValue) {
pStringBuilder.append(' ').append(pName).append('=').append('\"').append(pValue).append('\"');
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
| true
|
f4654d9d7cc173f1a55694495a7b907ef55be393
|
Java
|
zhongxingyu/Seer
|
/Diff-Raw-Data/13/13_22ecdb6b8a51111943b198676a499bec794dee63/AlarmsScheduler/13_22ecdb6b8a51111943b198676a499bec794dee63_AlarmsScheduler_t.java
|
UTF-8
| 7,839
| 2.1875
| 2
|
[] |
no_license
|
/*
* Copyright (C) 2012 Yuriy Kulikov yuriy.kulikov.87@gmail.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 com.better.alarm.model;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import com.better.alarm.model.interfaces.Intents;
import com.github.androidutils.logger.Logger;
public class AlarmsScheduler implements IAlarmsScheduler {
private static final boolean DBG = true;
static final String ACTION_FIRED = "com.better.alarm.ACTION_FIRED";
static final String EXTRA_ID = "intent.extra.alarm";
static final String EXTRA_TYPE = "intent.extra.type";
private class ScheduledAlarm implements Comparable<ScheduledAlarm> {
public final int id;
public final Calendar calendar;
public final CalendarType type;
public ScheduledAlarm(int id, Calendar calendar, CalendarType type) {
this.id = id;
this.calendar = calendar;
this.type = type;
}
@Override
public boolean equals(Object o) {
if (((ScheduledAlarm) o).id == id && ((ScheduledAlarm) o).type == type) return true;
else return false;
}
@Override
public int compareTo(ScheduledAlarm another) {
return this.calendar.compareTo(another.calendar);
}
}
private final Context mContext;
private final PriorityQueue<ScheduledAlarm> queue;
private final Logger log;
public AlarmsScheduler(Context context, Logger logger) {
mContext = context;
queue = new PriorityQueue<ScheduledAlarm>();
this.log = logger;
}
@Override
public void removeAlarm(int id) {
ScheduledAlarm previousHead = queue.peek();
for (Iterator<ScheduledAlarm> iterator = queue.iterator(); iterator.hasNext();) {
ScheduledAlarm scheduledAlarm = iterator.next();
if (scheduledAlarm.id == id) {
log.d("removing a ScheduledAlarm " + id + " type = " + scheduledAlarm.type.toString());
iterator.remove();
}
}
ScheduledAlarm currentHead = queue.peek();
if (previousHead != currentHead) {
setNextRTCAlert();
}
}
private void setNextRTCAlert() {
if (!queue.isEmpty()) {
// TODO problems happen because we remove, we have to keep. Remove
// only when it is in the past
// or removed by someone
ScheduledAlarm scheduledAlarm = queue.peek();
setUpRTCAlarm(scheduledAlarm.id, scheduledAlarm.calendar, scheduledAlarm.type);
} else {
removeRTCAlarm();
}
notifyListeners();
}
/**
* TODO the whole mechanism has to be revised. Currently we can only know
* when next alarm is scheduled and we do not know what is the reason for
* that. Maybe create a separate component for that or notify from the alarm
* SM. Actually notify this component from SM :-) and he can notify the
* rest.
*/
private void notifyListeners() {
Intent intent = new Intent();
if (queue.isEmpty()) {
intent.setAction(Intents.ACTION_ALARMS_UNSCHEDULED);
} else if (queue.peek().type != CalendarType.AUTOSILENCE) {
ScheduledAlarm scheduledAlarm = queue.peek();
intent.setAction(Intents.ACTION_ALARM_SCHEDULED);
intent.putExtra(Intents.EXTRA_ID, scheduledAlarm.id);
// TODO add type to the intent
mContext.sendBroadcast(intent);
} else {
// now this means that alarm in the closest future is AUTOSILENCE
ScheduledAlarm scheduledAlarm = findNextNormalAlarm();
if (scheduledAlarm != null) {
intent.setAction(Intents.ACTION_ALARM_SCHEDULED);
intent.putExtra(Intents.EXTRA_ID, scheduledAlarm.id);
} else {
intent.setAction(Intents.ACTION_ALARMS_UNSCHEDULED);
}
}
mContext.sendBroadcast(intent);
}
private ScheduledAlarm findNextNormalAlarm() {
// this means we have to find the next normal, snooze or prealarm
// since iterator does not have a specific order, and we cannot
// peek(i), remove elements one by one
ScheduledAlarm nextNormalAlarm = null;
ArrayList<ScheduledAlarm> temporaryCollection = new ArrayList<AlarmsScheduler.ScheduledAlarm>(queue.size());
while (!queue.isEmpty()) {
ScheduledAlarm scheduledAlarm = queue.poll();
temporaryCollection.add(scheduledAlarm);
if (scheduledAlarm.type != CalendarType.AUTOSILENCE) {
// that is our client
nextNormalAlarm = scheduledAlarm;
break;
}
}
// Put back everything what we have removed
queue.addAll(temporaryCollection);
return nextNormalAlarm;
}
private void removeRTCAlarm() {
AlarmManager am = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
PendingIntent sender = PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_FIRED),
PendingIntent.FLAG_CANCEL_CURRENT);
am.cancel(sender);
}
private void setUpRTCAlarm(int id, Calendar calendar, CalendarType type) {
AlarmManager am = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
DateFormat df = DateFormat.getDateTimeInstance();
log.d("Set alarm " + id + " on " + df.format(calendar.getTime()));
if (DBG && calendar.before(Calendar.getInstance()))
throw new RuntimeException("Attempt to schedule alarm in the past: " + df.format(calendar.getTime()));
Intent intent = new Intent(ACTION_FIRED);
intent.putExtra(EXTRA_ID, id);
intent.putExtra(EXTRA_TYPE, type.name());
PendingIntent sender = PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
}
@Override
public void setAlarm(int id, Map<CalendarType, Calendar> activeCalendars) {
ScheduledAlarm previousHead = queue.peek();
for (Iterator<ScheduledAlarm> iterator = queue.iterator(); iterator.hasNext();) {
if (iterator.next().id == id) {
iterator.remove();
}
}
for (Entry<CalendarType, Calendar> entry : activeCalendars.entrySet()) {
ScheduledAlarm scheduledAlarm = new ScheduledAlarm(id, entry.getValue(), entry.getKey());
if (queue.contains(scheduledAlarm)) {
queue.remove(scheduledAlarm);
}
queue.add(scheduledAlarm);
}
ScheduledAlarm currentHead = queue.peek();
if (previousHead != currentHead) {
setNextRTCAlert();
}
}
}
| true
|
c1651362c98822ee70b40c7ab036a78402a9ff6b
|
Java
|
ramkondadasu/HrOnlineReports
|
/src/main/java/texas/dot/hronline/services/PsEducDegreeDataHistMvwService.java
|
UTF-8
| 629
| 1.617188
| 2
|
[] |
no_license
|
package texas.dot.hronline.services;
import java.util.List;
import org.springframework.data.repository.query.Param;
import texas.dot.hronline.domain.PsEducDegreeDataHistMvw;
public interface PsEducDegreeDataHistMvwService {
List<PsEducDegreeDataHistMvw> findAllRecords();
List<PsEducDegreeDataHistMvw> findByEmplid(@Param("rep17employeeid") String rep17employeeid);
List<PsEducDegreeDataHistMvw> findByBUEmp(@Param("businessUnit17") String businessUnit17,@Param("rep17employeeid") String rep17employeeid);
List<PsEducDegreeDataHistMvw> findBySearchBU(@Param("businessUnit17") String businessUnit17);
}
| true
|
0a434c872af59bd894b33b3d3f18e8a4164213a2
|
Java
|
YayeAwa/BASECOL-VAMDC
|
/TAP-PLUG-BASECOL2012/.svn/pristine/0a/0a434c872af59bd894b33b3d3f18e8a4164213a2.svn-base
|
UTF-8
| 709
| 2.140625
| 2
|
[] |
no_license
|
package org.vamdc.basecol.mapping;
import org.apache.cayenne.exp.Expression;
import org.apache.cayenne.exp.ExpressionFactory;
import org.vamdc.dictionary.Restrictable;
import org.vamdc.tapservice.querymapper.KeywordMapperImpl;
import org.vamdc.tapservice.vss2.RestrictExpression;
public class CollisionCodeMapper extends KeywordMapperImpl{
public CollisionCodeMapper(Restrictable key) {
super(key);
}
@Override
protected Expression buildExpression(RestrictExpression restrictor,String pathSpec){
for (Object value: restrictor.getValues()){
if (value instanceof String && "inel".contains((String) value))
return ExpressionFactory.expTrue();
}
return ExpressionFactory.expFalse();
}
}
| true
|
83837a411d38a5d544d428f603cbe77167fff48e
|
Java
|
benediktwerner/UNO
|
/src/de/benedikt_werner/UNO/HumanPlayer.java
|
UTF-8
| 2,842
| 3.5625
| 4
|
[] |
no_license
|
package de.benedikt_werner.UNO;
import java.util.Scanner;
public class HumanPlayer extends PlayerController {
private Scanner in = new Scanner(System.in);
public static void main(String[] args) {
Player[] players = new Player[2];
players[0] = new Player("Bene", HumanPlayer.class);
players[1] = new Player("Computer", AdvancedAIController.class);
Game game = new Game(players);
game.start();
}
public HumanPlayer(Player player) {
super(player);
}
@Override
public Card requestCard() {
Log.print("-------------------------");
Log.print("It's your turn " + player.getName());
Log.print(player.getHand());
Log.print("Stack: " + player.getTopCard());
int input;
while (true) {
Log.print("Choose a card to play: ");
input = in.nextInt();
if (0 <= input && input < player.getHand().size() && player.isPlayable(player.getHand().get(input))) {
return player.getHand().get(input);
}
else {
Log.print("Invalid card!");
}
}
}
@Override
public Card requestTakeCards(int count) {
Log.print("-------------------------");
Log.print("It's your turn " + player.getName());
Log.print("You have to draw " + count + " cards or play a TAKE TWO or WILD TAKE FOUR card:");
CardStack takeCards = new CardStack();
for (Card card : player.getHand()) {
if (card.number == Card.TAKE_TWO || card.number == Card.WILD_FOUR) {
takeCards.addCard(card);
}
}
Log.print("-1: Take cards");
Log.print(takeCards);
if (takeCards.isEmpty()) {
Log.print("You don't have any TAKE TWO or WILD TAKE FOUR cards!");
return null;
}
int input;
while (true) {
Log.print("Choose a play: ");
input = in.nextInt();
if (input == -1) {
return null;
}
if (0 <= input && input < takeCards.size()) {
return takeCards.get(input);
}
else {
Log.print("Invalid play!");
}
}
}
@Override
public String requestWildColor() {
Log.print("Choose your wild color from these:");
for (int i = 0; i < Card.colors.length; i++)
Log.print(i + ": " + Card.colors[i]);
int input;
while (true) {
Log.print("Choose wild color: ");
input = in.nextInt();
if (0 <= input && input < Card.colors.length) {
return Card.colors[input];
}
else {
Log.print("Invalid color!");
}
}
}
}
| true
|
45c766cd8ce9aab0c780194fdcfef3beb7126a5b
|
Java
|
alfredjava/ibk-pys-aperturatc-v2-ms
|
/src/test/java/pe/com/interbank/pys/aperturatcv2/microservices/server/ServerCustomizerTest.java
|
UTF-8
| 457
| 1.976563
| 2
|
[] |
no_license
|
package pe.com.interbank.pys.aperturatcv2.microservices.server;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.Test;
public class ServerCustomizerTest {
@Test
public void serverCustomizerConstructTest(){
Server server = new Server();
server.addBean(new QueuedThreadPool());
ServerCustomizer serverCustomizer = new ServerCustomizer();
serverCustomizer.customize(server);
}
}
| true
|
ab794e83330db134859f3d6f2f5449a35bb0ddbe
|
Java
|
saurabhbhagat123/crudapi
|
/src/main/java/com/rest/service/PersonService.java
|
UTF-8
| 2,085
| 2.515625
| 3
|
[] |
no_license
|
package com.rest.service;
import com.rest.entity.Person;
import com.rest.exception.PersonAlreadyExistException;
import com.rest.exception.PersonNotFoundException;
import com.rest.repository.PersonRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
@Slf4j
public class PersonService {
@Autowired
private PersonRepository personRepository;
public Person createPerson(Person person){
log.info("createPerson called ");
Optional<Person> personOptional = personRepository.findById(person.getId());
if(personOptional.isPresent()){
throw new PersonAlreadyExistException("Person with ID "+person.getId()+" already exists");
}
return personRepository.save(person);
}
public Person getPersonById(int id){
log.info("getPersonById called ");
Optional<Person> personOptional = personRepository.findById(id);
if(!personOptional.isPresent()){
throw new PersonNotFoundException("Person with ID "+id+" not found");
}
return personOptional.get();
}
public Person updatePerson(Person person,int id){
log.info("updatePerson called ");
Optional<Person> personOptional = personRepository.findById(id);
if(!personOptional.isPresent()){
throw new PersonNotFoundException("Person with ID "+id+" not found");
}
person.setId(id);
return personRepository.save(person);
}
public void deletePerson(int id){
log.info("deletePerson called ");
Optional<Person> personOptional = personRepository.findById(id);
if(!personOptional.isPresent()){
throw new PersonNotFoundException("Person with ID "+id+" not found");
}
personRepository.deleteById(id);
}
public List<Person> getAllPerson(){
log.info("getAllPerson called ");
return personRepository.findAll();
}
}
| true
|
65fa5bd43cb4d9875d563798f112425b5e7e25e9
|
Java
|
SadykUlan/prof
|
/app/src/main/java/com/example/ulan/prof/MainActivity.java
|
UTF-8
| 2,657
| 1.921875
| 2
|
[] |
no_license
|
package com.example.ulan.prof;
import android.content.Intent;
import android.graphics.Bitmap;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
Button btnnum,email1,email2, btninf;
TextView name;
ImageView prof;
Bitmap bitmap;
RadioGroup rg;
RadioButton rb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.glav);
addListenerOnButton();
rg = (RadioGroup)findViewById(R.id.radiogroup);
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
if (i == R.id.firstpage) {
name.setText("Ulan Sadyk");
btnnum.setText("+7 707 25 04 996");
email1.setText("ulan_sadykov@mail.ru");
email2.setText("Aidarly");
//address.setText("Abay st. 163");
prof.setImageResource(R.drawable.prof_ulan);
}
if (i == R.id.secondpage) {
name.setText("Omirbek Madina");
btnnum.setText("+7 707 245 68 43");
email1.setText("madina_omir@mail.ru");
email2.setText("Altynsarin");
prof.setImageResource(R.drawable.prof_mad);
}
}
});
}
private void addListenerOnButton() {
btnnum = (Button) findViewById(R.id.btninf);
name = (TextView) findViewById(R.id.name);
email1 = (Button) findViewById(R.id.email1);
email2 = (Button) findViewById(R.id.email2);
//address = (Button)findViewById(R.id.address);
prof = (ImageView) findViewById(R.id.imageView);
btnnum.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
final Intent intent = new Intent("com.example.ulan.prof.MainActivity");
intent.putExtra("key1", name.getText());
intent.putExtra("key2", btnnum.getText());
// intent.putExtra("key3", prof.getResources().getDrawable());
startActivity(intent);
}
}
);
}
}
| true
|
9bb0542b0cd8619fca90f0f2cb19510d5ca2aff9
|
Java
|
ultradns/java_rest_api_client
|
/src/main/java/com/ultradns/ultra/rest/dto/SecurityGroup.java
|
UTF-8
| 3,967
| 2.4375
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.ultradns.ultra.rest.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import java.util.List;
/**
* The Class SecurityGroup.
*/
@JsonInclude(Include.NON_NULL)
public class SecurityGroup {
/**
* The name.
*/
private String name;
/**
* The entries.
*/
@JsonInclude(Include.NON_EMPTY)
private List<SecurityGroupEntry> entries;
/**
* The exceptions.
*/
private SecurityExceptionList exceptions;
/**
* The user count in a group.
*/
private Integer usersCount;
/**
* Instantiates a new security group.
*
* @param name the name
* @param entries the entries
* @param exceptions the exceptions
*/
public SecurityGroup(String name, List<SecurityGroupEntry> entries, SecurityExceptionList exceptions) {
super();
this.name = name;
this.entries = entries;
this.exceptions = exceptions;
}
/**
* Instantiates a new security group.
*
* @param name the name
* @param entries the entries
* @param exceptions the exceptions
*/
public SecurityGroup(String name, List<SecurityGroupEntry> entries, SecurityExceptionList exceptions,
Integer usersCount) {
super();
this.name = name;
this.entries = entries;
this.exceptions = exceptions;
this.usersCount = usersCount;
}
/**
* Instantiates a new security group.
*/
public SecurityGroup() {
super();
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) {
this.name = name;
}
/**
* Gets the exceptions.
*
* @return the exceptions
*/
public SecurityExceptionList getExceptions() {
return exceptions;
}
/**
* Sets the exceptions.
*
* @param exceptions the new exceptions
*/
public void setExceptions(SecurityExceptionList exceptions) {
this.exceptions = exceptions;
}
/**
* Gets the entries.
*
* @return the entries
*/
public List<SecurityGroupEntry> getEntries() {
return entries;
}
/**
* Sets the entries.
*
* @param entries the new entries
*/
public void setEntries(List<SecurityGroupEntry> entries) {
this.entries = entries;
}
@Override
public int hashCode() {
return Objects.hashCode(getEntries(), getExceptions(), getName(), getUsersCount());
}
@Override
public boolean equals(Object obj) {
boolean isEqual = true;
if (!(obj instanceof SecurityGroup)) {
return false;
}
final SecurityGroup other = (SecurityGroup) obj;
isEqual = Objects.equal(getEntries(), other.getEntries())
&& Objects.equal(getExceptions(), other.getExceptions()) && Objects.equal(getName(), other.getName())
&& Objects.equal(getUsersCount(), other.getUsersCount());
return isEqual;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("name", getName()).add("entries", getEntries())
.add("exceptions", getExceptions()).add("usersCount", getUsersCount()).toString();
}
/**
* Returns user count in a group.
*
* @return user count.
*/
public Integer getUsersCount() {
return usersCount;
}
/**
* Set user count in a group.
*
* @param usersCount
* The user count.
*/
public void setUsersCount(Integer usersCount) {
this.usersCount = usersCount;
}
}
| true
|
125cbe5dd2a4a5f916155a81fe01d94cca45ce23
|
Java
|
shahadat-sust/bms
|
/bms-admin/src/main/java/com/bms/admin/controller/setup/GroupController.java
|
UTF-8
| 5,552
| 2.015625
| 2
|
[] |
no_license
|
package com.bms.admin.controller.setup;
import java.util.List;
import java.util.Locale;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.bms.admin.controller.BaseController;
import com.bms.admin.model.ResponseModel;
import com.bms.common.BmsException;
import com.bms.service.BmsSqlException;
import com.bms.service.data.permission.GroupData;
import com.bms.service.soa.permission.IGroupService;
@Controller
@RequestMapping(value = "/group")
@Scope("request")
public class GroupController extends BaseController {
private final Logger logger = Logger.getLogger(this.getClass().getName());
private IGroupService groupService;
@RequestMapping(value = "", method = RequestMethod.GET)
public String group(Model model) throws BmsSqlException, BmsException {
List<GroupData> groupList = groupService.getAllGroups();
model.addAttribute("groupList", groupList);
return "setup/group";
}
@RequestMapping(value = "/fetch/{groupId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseModel<GroupData> getGroupList(@PathVariable long groupId) {
ResponseModel<GroupData> responseModel = new ResponseModel<GroupData>();
try {
if(groupId > 0) {
GroupData groupData = groupService.getGroupById(groupId);
responseModel.addData(groupData);
} else {
List<GroupData> groupList = groupService.getAllGroups();
responseModel.addDatas(groupList);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
responseModel.setStatus(false);
responseModel.addError(getMessageSource().getMessage("error.returned", new Object[] { e.getMessage() }, Locale.getDefault()));
}
return responseModel;
}
@RequestMapping(value = "/create", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseModel<GroupData> createGroup(@RequestBody GroupData groupData) {
ResponseModel<GroupData> responseModel = new ResponseModel<GroupData>();
try {
if(groupService.getGroupById(groupData.getId()) != null) {
responseModel.setStatus(false);
responseModel.addError(getMessageSource().getMessage("error.duplicate.entry", new Object[] { "id" }, Locale.getDefault()));
return responseModel;
}
boolean isAvailable = groupService.isAvailable(groupData.getId(), groupData.getName());
if(!isAvailable) {
responseModel.setStatus(false);
responseModel.addError(getMessageSource().getMessage("error.duplicate.entry", new Object[] { "name" }, Locale.getDefault()));
return responseModel;
}
boolean status = groupService.create(groupData, getLoginUserData().getId());
if(status) {
responseModel.setStatus(true);
responseModel.addData(groupData);
} else {
responseModel.setStatus(false);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
responseModel.setStatus(false);
responseModel.addError(getMessageSource().getMessage("error.returned", new Object[] { e.getMessage() }, Locale.getDefault()));
}
return responseModel;
}
@RequestMapping(value = "/update", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseModel<GroupData> updateGroup(@RequestBody GroupData groupData) {
ResponseModel<GroupData> responseModel = new ResponseModel<GroupData>();
try {
boolean isAvailable = groupService.isAvailable(groupData.getId(), groupData.getName());
if(!isAvailable) {
responseModel.setStatus(false);
responseModel.addError(getMessageSource().getMessage("error.duplicate.entry", new Object[] { "name" }, Locale.getDefault()));
return responseModel;
}
boolean status = groupService.update(groupData, getLoginUserData().getId());
if(status) {
GroupData data = groupService.getGroupById(groupData.getId());
responseModel.setStatus(true);
responseModel.addData(data);
} else {
responseModel.setStatus(false);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
responseModel.setStatus(false);
responseModel.addError(getMessageSource().getMessage("error.returned", new Object[] { e.getMessage() }, Locale.getDefault()));
}
return responseModel;
}
@RequestMapping(value = "/delete/{groupId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody ResponseModel<GroupData> deleteGroup(@PathVariable long groupId) {
ResponseModel<GroupData> responseModel = new ResponseModel<GroupData>();
try {
responseModel.setStatus(groupService.delete(groupId));
} catch (Exception e) {
logger.error(e.getMessage(), e);
responseModel.setStatus(false);
responseModel.addError(getMessageSource().getMessage("error.returned", new Object[] { e.getMessage() }, Locale.getDefault()));
}
return responseModel;
}
@Autowired
@Qualifier("groupService")
public void setGroupService(IGroupService groupService) {
this.groupService = groupService;
}
}
| true
|
2c81fe6eab18f12885d46fc5bd3590918a9940ac
|
Java
|
gerrymclarnon/PlayerManager-Retired-Trialist
|
/src/net/playermanager/games/services/PlayersService.java
|
UTF-8
| 2,050
| 2.515625
| 3
|
[] |
no_license
|
package net.playermanager.games.services;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import net.playermanager.games.dao.DAO;
import net.playermanager.games.dao.PlayerDAO;
import net.playermanager.games.model.Player;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
@Service("playersService")
public class PlayersService extends AbstractService< Player > {
//@Autowired
private PlayerDAO playerDAO;
public PlayersService() {
super();
}
@Autowired
@Qualifier(value="playerDAO")
public void init(DAO<Player> dao) {
setDao(dao);
}
public List<Player> getPlayers() {
List<Player> players = new ArrayList<Player>();
players.addAll(playerDAO.getAll());
return players;
}
public String getCount() {
int count = playerDAO.getAll().size();
return String.valueOf(count);
}
public Player create(String number, String firstName, String lastName)
throws IOException {
Player player = new Player();
player.setSquadNumber(number);
player.setFirstName(firstName);
player.setLastName(lastName);
playerDAO.save(player);
securityService.updateAcl(player);
return player;
}
// @PreAuthorize("hasPermission(#arg0, 'net.playermanager.games.model.Player', 'WRITE')")
// public Player getPlayer(Long id) {
// Player player = playerDAO.getById(id);
// if (player == null)
// throw new RuntimeException("Get: Player with " + id + " not found");
// return player;
// }
public Player getPlayer(String uri) {
Player player = playerDAO.getByUri(uri);
if (player == null)
throw new RuntimeException("Get: Player with " + uri + " not found");
return player;
}
public void deleteById(Long id) {
Player player = playerDAO.getById(id);
if (player == null) {
throw new RuntimeException("Delete: Todo with " + id + " not found");
}
playerDAO.deleteById(id);
}
}
| true
|
6a03530049af78a5931c938285d5afb56c7fc678
|
Java
|
AdrianLeyva/theater_system
|
/src/model/persistence/dao/contracts/ShowDao.java
|
UTF-8
| 366
| 2.140625
| 2
|
[] |
no_license
|
package model.persistence.dao.contracts;
import model.persistence.Shows;
import java.util.List;
public interface ShowDao {
void register(Shows show) throws Exception;
void modify(Shows show) throws Exception;
void delete(Shows show) throws Exception;
List<Shows> listShows() throws Exception;
List<Shows> findById(int id) throws Exception;
}
| true
|
d227daae7a5b4cbdc62e1adec4d9f1f677cf795b
|
Java
|
ParaSwarm/House-Lannister
|
/app/src/main/java/edu/uco/houselannister/saveasingle/domain/Ethnicity.java
|
UTF-8
| 650
| 2.75
| 3
|
[] |
no_license
|
package edu.uco.houselannister.saveasingle.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Random;
public enum Ethnicity implements Serializable {
WHITE,
HISPANIC,
BLACK,
NATIVE,
ASIAN,
OTHER,
NONSPECIFIC;
public static Ethnicity getRandom() {
Random r = new Random();
return values()[r.nextInt(values().length)];
}
public static ArrayList<Ethnicity> getRandoms(int number) {
ArrayList<Ethnicity> list = new ArrayList<>();
for(int i = 0; i <= number; i++){
list.add(Ethnicity.getRandom());
}
return list;
}
}
| true
|
c6063b1d6a9146495ba103c9ed9d71655c7cf240
|
Java
|
Cliffe97/Multithread-Version-of-Unix-Shell-with_File_System-
|
/src/cs131/pa1/filter/concurrent/ConcurrentFilter.java
|
UTF-8
| 1,801
| 3.140625
| 3
|
[] |
no_license
|
package cs131.pa1.filter.concurrent;
//import java.util.LinkedList;
//import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import cs131.pa1.filter.Filter;
public abstract class ConcurrentFilter extends Filter implements Runnable{
// protected boolean flag;
protected boolean done = false;
protected LinkedBlockingQueue<String> input;
protected LinkedBlockingQueue<String> output;
@Override
public void run() {
process();
done = true;
}
@Override
public void setPrevFilter(Filter prevFilter) {
prevFilter.setNextFilter(this);
}
@Override
public void setNextFilter(Filter nextFilter) {
if (nextFilter instanceof ConcurrentFilter){
ConcurrentFilter sequentialNext = (ConcurrentFilter) nextFilter;
this.next = sequentialNext;
sequentialNext.prev = this;
if (this.output == null){
this.output = new LinkedBlockingQueue<String>();
}
sequentialNext.input = this.output;
} else {
throw new RuntimeException("Should not attempt to link dissimilar filter types.");
}
}
public void process(){
// Run while loop until the input will not have any further input and prev is done
while (true) {
if (prev.isDone() && input.isEmpty()) {
done = true;
break;
}
if (!input.isEmpty()) {
String line = "";
try {
line = input.take();
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
String processedLine = processLine(line);
if (processedLine != null){
output.put(processedLine);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
// return whether the thread finishes or not
@Override
public boolean isDone() {
return done ;
}
protected abstract String processLine(String line);
}
| true
|
1454c360a82b18df8f6a7fb0c5609d5d3b517fcd
|
Java
|
seventy-eight/web
|
/utilities/src/main/java/org/seventyeight/utils/EncodingUtils.java
|
UTF-8
| 2,018
| 3.109375
| 3
|
[] |
no_license
|
package org.seventyeight.utils;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
/**
* @author cwolfgang
*/
public class EncodingUtils {
private static String DEFAULT_ENCODING = "UTF-8";
public static String decode( String s ) {
return decode( s, DEFAULT_ENCODING );
}
public static String decode( String s, String encoding ) {
int i = s.indexOf( '%' );
if( i < 0 ) return s;
try {
// to properly handle non-ASCII characters, decoded bytes need to be stored and translated in bulk.
// this complex set up is necessary for us to work gracefully if 's' already contains decoded non-ASCII chars.
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StringBuilder buf = new StringBuilder( s.substring( 0, i ) );
char c, upper, lower;
for( int m = s.length(); i < m; i++ ) {
c = s.charAt( i );
if( c == '%' ) {
try {
upper = s.charAt( ++i );
lower = s.charAt( ++i );
baos.write( fromHex( upper ) * 16 + fromHex( lower ) );
} catch( IndexOutOfBoundsException ignore ) {
// malformed %HH.
}
} else {
if( baos.size() > 0 ) {
buf.append( new String( baos.toByteArray(), encoding ) );
baos.reset();
}
buf.append( c );
}
}
if( baos.size() > 0 ) {
buf.append( new String( baos.toByteArray(), encoding ) );
}
return buf.toString();
} catch( UnsupportedEncodingException e ) {
throw new AssertionError( e );
}
}
private static int fromHex( char upper ) {
return ( ( upper & 0xF ) + ( ( upper & 0x40 ) != 0 ? 9 : 0 ) );
}
}
| true
|
3ff56f47c6f25f04b07ca3798bcc8d730c914ff8
|
Java
|
P79N6A/icse_20_user_study
|
/methods/Method_1005831.java
|
UTF-8
| 57
| 1.851563
| 2
|
[] |
no_license
|
public static void clear(){
THREAD_OBJECT.set(null);
}
| true
|
313b42db21f07c2b45997a98b220e69eaa7d9c02
|
Java
|
guishijin/onvif4java
|
/onvifclient/src/org/onvif/ver10/schema/IPAddressFilter.java
|
UTF-8
| 4,833
| 1.8125
| 2
|
[] |
no_license
|
package org.onvif.ver10.schema;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
/**
* <p>
* Java class for IPAddressFilter complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* <complexType name="IPAddressFilter">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Type" type="{http://www.onvif.org/ver10/schema}IPAddressFilterType"/>
* <element name="IPv4Address" type="{http://www.onvif.org/ver10/schema}PrefixedIPv4Address" maxOccurs="unbounded" minOccurs="0"/>
* <element name="IPv6Address" type="{http://www.onvif.org/ver10/schema}PrefixedIPv6Address" maxOccurs="unbounded" minOccurs="0"/>
* <element name="Extension" type="{http://www.onvif.org/ver10/schema}IPAddressFilterExtension" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "IPAddressFilter", propOrder = { "type", "iPv4Address",
"iPv6Address", "extension" })
public class IPAddressFilter {
@XmlElement(name = "Type", required = true)
protected IPAddressFilterType type;
@XmlElement(name = "IPv4Address")
protected List<PrefixedIPv4Address> iPv4Address;
@XmlElement(name = "IPv6Address")
protected List<PrefixedIPv6Address> iPv6Address;
@XmlElement(name = "Extension")
protected IPAddressFilterExtension extension;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the type property.
*
* @return possible object is {@link IPAddressFilterType }
*
*/
public IPAddressFilterType getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is {@link IPAddressFilterType }
*
*/
public void setType(IPAddressFilterType value) {
this.type = value;
}
/**
* Gets the value of the iPv4Address property.
*
* <p>
* This accessor method returns a reference to the live list, not a
* snapshot. Therefore any modification you make to the returned list will
* be present inside the JAXB object. This is why there is not a
* <CODE>set</CODE> method for the iPv4Address property.
*
* <p>
* For example, to add a new item, do as follows:
*
* <pre>
* getIPv4Address().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PrefixedIPv4Address }
*
*
*/
public List<PrefixedIPv4Address> getIPv4Address() {
if (iPv4Address == null) {
iPv4Address = new ArrayList<PrefixedIPv4Address>();
}
return this.iPv4Address;
}
/**
* Gets the value of the iPv6Address property.
*
* <p>
* This accessor method returns a reference to the live list, not a
* snapshot. Therefore any modification you make to the returned list will
* be present inside the JAXB object. This is why there is not a
* <CODE>set</CODE> method for the iPv6Address property.
*
* <p>
* For example, to add a new item, do as follows:
*
* <pre>
* getIPv6Address().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PrefixedIPv6Address }
*
*
*/
public List<PrefixedIPv6Address> getIPv6Address() {
if (iPv6Address == null) {
iPv6Address = new ArrayList<PrefixedIPv6Address>();
}
return this.iPv6Address;
}
/**
* Gets the value of the extension property.
*
* @return possible object is {@link IPAddressFilterExtension }
*
*/
public IPAddressFilterExtension getExtension() {
return extension;
}
/**
* Sets the value of the extension property.
*
* @param value
* allowed object is {@link IPAddressFilterExtension }
*
*/
public void setExtension(IPAddressFilterExtension value) {
this.extension = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed
* property on this class.
*
* <p>
* the map is keyed by the name of the attribute and the value is the string
* value of the attribute.
*
* the map returned by this method is live, and you can add new attribute by
* updating the map directly. Because of this design, there's no setter.
*
*
* @return always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}
| true
|
9ed52992220864a6b5acf2c59f0f085a94905ca3
|
Java
|
BerNarDoMelow/BSJ
|
/webapp-ejb/webapp-ejb-web-client/src/main/java/presentation/web/model/VendedorToSaleModel.java
|
UTF-8
| 640
| 2.125
| 2
|
[] |
no_license
|
package presentation.web.model;
import facade.handlers.IVendedorServiceRemote;
public class VendedorToSaleModel extends Model{
/**
*
*/
private static final long serialVersionUID = 1L;
private IVendedorServiceRemote VendedorService;
private int saleid;
private int number;
public void setVendedorService(IVendedorServiceRemote VendedorService) {
this.VendedorService = VendedorService;
}
public void setNumber(int number) {
this.number = number;
}
public void setSaleid(int saleid) {
this.saleid = saleid;
}
public int getNumber() {
return number;
}
public int getSaleId() {
return saleid;
}
}
| true
|
8aa0cc68b0401c6a1a5013b43c8acc47d0461ffe
|
Java
|
Ailsafr/LeetCode
|
/src/solution/list/LinkedListCycle.java
|
GB18030
| 1,981
| 4.0625
| 4
|
[] |
no_license
|
package solution.list;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* @author By RuiCUI
* 2018-03-30
* Easy
* Question 141:Linked List Cycle
* Given a linked list, determine if it has a cycle in it.
* Follow up:
* Can you solve it without using extra space?
*/
public class LinkedListCycle {
/**
* Լдķ һ´֮ܵǰôҲ벻ͨ><
* ʱ临ӶȣO(n)
* ռ临ӶȣO(n)
* @param head
* @return
*/
public static boolean hasCycle(ListNode head) {
if(head==null||head.next==null){
return false;
}
Map<Object,Object> map = new HashMap<Object,Object>();
while(head.next!=null){
if(map.get(head)!=null){
return true;
}
map.put(head, head);
head = head.next;
}
return false;
}
/**
* 1--Hash Table
* ʱ临ӶȣO(n)
* ռ临ӶȣO(n)
* @param head
* @return
*/
public boolean hasCycle1(ListNode head) {
Set<ListNode> nodesSeen = new HashSet<>();
while (head != null) {
if (nodesSeen.contains(head)) {
return true;
} else {
nodesSeen.add(head);
}
head = head.next;
}
return false;
}
/**
* 2--Two Pointers
* ʱ临ӶȣO(n)
* ռ临ӶȣO(1)
* @param head
* @return
*/
public boolean hasCycle2(ListNode head) {
if (head == null || head.next == null) {
return false;
}
ListNode slow = head;
ListNode fast = head.next;
while (slow != fast) {
if (fast == null || fast.next == null) {
return false;
}
slow = slow.next;
fast = fast.next.next;
}
return true;
}
public static void main(String[] args) {
ListNode l1 = new ListNode(1);
l1.next = new ListNode(2);
l1.next.next = new ListNode(4);
l1.next.next.next = l1;
System.out.println(hasCycle(l1));
}
}
| true
|
66d1df8a8b7e94cecd5054113a0cdb81cb65a3d8
|
Java
|
forcedotcom/SalesforceMobileSDK-Android
|
/native/NativeSampleApps/AppConfigurator/src/com/salesforce/samples/appconfigurator/ui/ConfigureAppFragment.java
|
UTF-8
| 8,803
| 1.523438
| 2
|
[
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] |
permissive
|
/*
* Copyright (c) 2014-present, salesforce.com, inc.
* All rights reserved.
* Redistribution and use of this software in source and binary forms, with or
* without modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of salesforce.com, inc. nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission of salesforce.com, inc.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.salesforce.samples.appconfigurator.ui;
import android.app.Activity;
import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.RestrictionEntry;
import android.content.RestrictionsManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.salesforce.samples.appconfigurator.AppConfiguratorAdminReceiver;
import com.salesforce.samples.appconfigurator.AppConfiguratorState;
import com.salesforce.samples.appconfigurator.R;
import java.util.List;
/**
* This fragment provides UI and functionality to configure target application
* sample.
*/
public class ConfigureAppFragment extends Fragment implements View.OnClickListener {
// UI Components
private TextView mTextStatus;
private TextView mTextXmlValues;
private Button mButtonSave;
private Button mButtonShowXml;
private EditText mLoginServers;
private EditText mLoginServersLabels;
private EditText mRemoteAccessConsumerKey;
private EditText mOauthRedirectURI;
private EditText mCertAlias;
private EditText[] mEditTexts;
private CheckBox mOnlyShowAuthorizedHosts;
private EditText mIDPAppURLScheme;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_configure_app, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
mTextStatus = (TextView) view.findViewById(R.id.status);
mLoginServers = (EditText) view.findViewById(R.id.login_servers);
mLoginServersLabels = (EditText) view.findViewById(R.id.login_servers_labels);
mRemoteAccessConsumerKey = (EditText) view.findViewById(R.id.remote_access_consumer_key);
mOauthRedirectURI = (EditText) view.findViewById(R.id.oauth_redirect_uri);
mCertAlias = (EditText) view.findViewById(R.id.cert_alias);
mButtonSave = (Button) view.findViewById(R.id.save);
mButtonSave.setOnClickListener(this);
mEditTexts = new EditText[] {
mLoginServers, mLoginServersLabels, mRemoteAccessConsumerKey,
mOauthRedirectURI, mCertAlias
};
mTextXmlValues = (TextView) view.findViewById(R.id.text_view_xml);
mTextXmlValues.setMovementMethod(new ScrollingMovementMethod());
mButtonShowXml = (Button) view.findViewById(R.id.show_xml);
mButtonShowXml.setOnClickListener(this);
mOnlyShowAuthorizedHosts = (CheckBox) view.findViewById(R.id.only_allowed_servers);
mIDPAppURLScheme = (EditText) view.findViewById(R.id.idp_app_url_scheme);
}
@Override
public void onResume() {
super.onResume();
updateUi(getActivity());
}
@Override
public void onClick(View view) {
AppConfiguratorState state = AppConfiguratorState.getInstance(getActivity());
switch (view.getId()) {
case R.id.save:
boolean isCertAuthEnabled = false;
if (mCertAlias.getText() != null && !mCertAlias.getText().toString().trim().isEmpty()) {
isCertAuthEnabled = true;
}
boolean showOnlyAllowedServers = mOnlyShowAuthorizedHosts.isChecked();
state.saveConfigurations(getActivity(),
mLoginServers.getText().toString(),
mLoginServersLabels.getText().toString(),
mRemoteAccessConsumerKey.getText().toString(),
mOauthRedirectURI.getText().toString(),
isCertAuthEnabled,
mCertAlias.getText().toString(),
showOnlyAllowedServers,
mIDPAppURLScheme.getText().toString());
Toast.makeText(getActivity(), R.string.saved, Toast.LENGTH_SHORT).show();
break;
case R.id.show_xml:
RestrictionsManager manager =
(RestrictionsManager) getActivity().getSystemService(Context.RESTRICTIONS_SERVICE);
List<RestrictionEntry> restrictions = manager.getManifestRestrictions(state.getTargetApp());
final StringBuilder stringBuilder = new StringBuilder();
for (final RestrictionEntry re : restrictions) {
stringBuilder.append(re + "\n");
}
mTextXmlValues.setText(stringBuilder.toString());
break;
}
}
private void updateUi(Activity activity) {
AppConfiguratorState state = AppConfiguratorState.getInstance(activity);
PackageManager packageManager = activity.getPackageManager();
int status = -1; // ready
try {
ApplicationInfo info = packageManager.getApplicationInfo(state.getTargetApp(), PackageManager.GET_UNINSTALLED_PACKAGES);
DevicePolicyManager devicePolicyManager = (DevicePolicyManager) activity.getSystemService(Activity.DEVICE_POLICY_SERVICE);
if ((info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
// Need to reinstall the sample app
status = R.string.status_need_reinstall;
} else if (devicePolicyManager.isApplicationHidden(AppConfiguratorAdminReceiver.getComponentName(activity), state.getTargetApp())) {
// The app is installed but hidden in this profile
status = R.string.status_not_activated;
}
} catch (PackageManager.NameNotFoundException e) {
status = R.string.status_not_installed;
}
if (status < 0) {
mLoginServers.setText(state.getLoginServers());
mLoginServersLabels.setText(state.getLoginServersLabels());
mRemoteAccessConsumerKey.setText(state.getRemoteAccessConsumerKey());
mOauthRedirectURI.setText(state.getOauthRedirectURI());
mCertAlias.setText(state.getCertAlias());
mTextStatus.setVisibility(View.GONE);
for (EditText editText : mEditTexts) {
editText.setVisibility(View.VISIBLE);
}
mButtonSave.setVisibility(View.VISIBLE);
mButtonShowXml.setVisibility(View.VISIBLE);
mOnlyShowAuthorizedHosts.setChecked(state.shouldOnlyShowAuthorizedHosts());
mIDPAppURLScheme.setText(state.getIDPAppURLScheme());
} else {
mTextStatus.setText(status);
mTextStatus.setVisibility(View.VISIBLE);
for(EditText editText : mEditTexts) {
editText.setVisibility(View.GONE);
}
mButtonSave.setVisibility(View.GONE);
mButtonShowXml.setVisibility(View.GONE);
mOnlyShowAuthorizedHosts.setChecked(false);
}
}
}
| true
|
28a0259fad7f66bd42652c37fb31382ab42b746d
|
Java
|
Leozhi-nian/LeetCode
|
/src/com/leozhi/topic912/Solution02.java
|
UTF-8
| 571
| 2.5625
| 3
|
[] |
no_license
|
package com.leozhi.topic912;
/**
* @author leozhi
* 选择排序
* 通过
* 1179ms
*/
public class Solution02 {
public int[] sortArray(int[] nums) {
int minIndex, temp;
for (int i = 0; i < nums.length; i++) {
minIndex = i;
for (int j = i + 1; j < nums.length; j++) {
if (nums[minIndex] > nums[j]) {
minIndex = j;
}
}
temp = nums[i];
nums[i] = nums[minIndex];
nums[minIndex] = temp;
}
return nums;
}
}
| true
|
43c8d5e0844b564ab9f716cadca46dd36ce4a865
|
Java
|
song12138/sysmanager
|
/src/main/java/com/company/smartwater/utils/JsonUtil.java
|
UTF-8
| 1,296
| 2.546875
| 3
|
[] |
no_license
|
package com.company.smartwater.utils;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.ObjectWriter;
import org.codehaus.jackson.type.TypeReference;
import java.io.IOException;
public class JsonUtil {
public static String convertObject2Json(Object o){
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
try {
String jsonStr = ow.writeValueAsString(o);
return jsonStr.replaceAll("\\r\\n", "");
} catch (Exception e) {
}
return null;
}
public static <T> T convertJson2Object(String json, Class<T> clasz){
T ob = null;
try {
ob = new ObjectMapper().readValue(json, clasz);
} catch (JsonParseException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return ob;
}
public static <T> T convertJson2Object(String json, TypeReference<T> type){
T ob = null;
try {
ob = new ObjectMapper().readValue(json, type);
} catch (JsonParseException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return ob;
}
}
| true
|
ee77b87538819ed3a933239772d97a6dffc8ca90
|
Java
|
Venkteshkavi/Algorithms-DataStructures-Efficient-Practices
|
/Trees/convertTreetoGreaterBST.java
|
UTF-8
| 1,562
| 3.46875
| 3
|
[] |
no_license
|
import java.util.LinkedList;
import java.util.Queue;
public class convertBSTtoGreaterTree {
public class Node{
int data;
Node left;
Node right;
Node(int data){
this.data = data;
this.left = left;
this.right = right;
}
}
public static Node convertToGBST(Node root) {
if(root == null)
return null;
int sum = 0;
helper(root,sum);
return root;
}
public static int helper(Node root,int sum) {
if(root == null)
return sum;
int r = helper(root.right,sum);
root.data = root.data + Math.max(r, sum);
sum = root.data;
int l = helper(root.left,sum);
return l;
}
static void printLevelOrder(Node root) {
if(root == null)
return;
Queue<Node> q = new LinkedList<>();
q.offer(root);
while(true) {
int nodeCount = q.size();
if(nodeCount==0)
break;
while(nodeCount>0) {
Node temp = q.poll();
System.out.print(temp.data+" ");
if(temp.left!=null)
q.add(temp.left);
if(temp.right!=null)
q.add(temp.right);
nodeCount--;
}
System.out.println();
}
}
public static void main(String[] args) {
convertBSTtoGreaterTree obj = new convertBSTtoGreaterTree();
Node root = obj.new Node(50);
root.left = obj.new Node(30);
root.right = obj.new Node(70);
root.left.left = obj.new Node(20);
root.left.right = obj.new Node(40);
root.right.left = obj.new Node(60);
root.right.left.right = obj.new Node(65);
root.right.right = obj.new Node(80);
printLevelOrder(root);
convertToGBST(root);
System.out.println("#######");
printLevelOrder(root);
}
}
| true
|
8165ea6d0655982cfdac1b26f980aff7544a7233
|
Java
|
maruoci/webdemo
|
/src/main/java/com/bluesky/web/service/CustomerService.java
|
UTF-8
| 1,407
| 2.234375
| 2
|
[] |
no_license
|
package com.bluesky.web.service;
import com.bluesky.web.helper.DatabaseHelper;
import com.bluesky.web.model.Customer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by 55 on 2016/8/22.
*/
public class CustomerService {
private static final Logger LOGGER = LoggerFactory.getLogger("LOG_INFO");
/**
* 获取列表
* @return
*/
public List<Customer> getCustomerList(){
String sql = "SELECT * FROM customer";
return DatabaseHelper.findList(Customer.class,sql,null);
}
/**
* 获取对象
* @param id
* @return
*/
public Customer getCustomer(long id){
return null;
}
/**
* 增
* @param fieldMap
* @return
*/
public boolean createCustomer(Map<String,Object> fieldMap){
return DatabaseHelper.executeInsert(Customer.class,fieldMap);
}
public boolean deleteCustomer(long id){
return DatabaseHelper.deleteEntity(Customer.class,id);
}
public boolean updateCustomer(long id , Map<String,Object> fieldMap){
return DatabaseHelper.updateEntity(Customer.class,id,fieldMap);
}
}
| true
|
cb9124775a0acbf669d1d4c8712839067de725e2
|
Java
|
javaCopyer/pay
|
/pay-agent/src/main/java/com/minghui/pay/agent/core/initialize/ApplicationInitializationBean.java
|
UTF-8
| 876
| 1.890625
| 2
|
[] |
no_license
|
package com.minghui.pay.agent.core.initialize;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.minghui.pay.agent.core.notify.helper.TestDisruptorHelper;
/**
*
* <p>Title: ApplicationInitializationBean.java</p>
* <p>Description: </p>
* @author sky
* @date 2019年3月23日
* @version 1.0
*/
@Component
public class ApplicationInitializationBean implements InitializingBean, DisposableBean{
@Autowired
private TestDisruptorHelper testDisruptorHelper;
@Override
public void destroy() throws Exception {
testDisruptorHelper.shutdown();
}
@Override
public void afterPropertiesSet() throws Exception {
testDisruptorHelper.init();
}
}
| true
|
7e44c1ce3c0651b9ddda5e60a8158e307819e71b
|
Java
|
QiLinXue/project-euler
|
/Java/Problem021.java
|
UTF-8
| 1,196
| 3.828125
| 4
|
[] |
no_license
|
/*
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220.
Evaluate the sum of all the amicable numbers under 10000.
*/
// 07/26/2018: 243996100 ns
class Problem021{
public static void main(String[] args) {
long startTime = System.nanoTime();
//Start Code
int sum=0;
for(int i=1; i<10000; i++) if(isAmicable(i)) sum+=i;
System.out.println(sum);
//End Code
long endTime = System.nanoTime();
long totalTime = endTime - startTime;
System.out.println(totalTime);
}
static boolean isAmicable(int n){
int sum = 1;
for(int i=2; i<n; i++) if(n % i == 0) sum+=i;
int nDivisorSums = sum;
sum = 1;
for(int i=2; i<nDivisorSums; i++) if(nDivisorSums % i == 0) sum+=i;
return n==sum && nDivisorSums!=n;
}
}
| true
|
1757935a0b6cad5595639d016a46afa73aad3e78
|
Java
|
Axel-Girard/WebServiceJava
|
/domaine/src/main/java/demo/ddd/domaine/cb/services/Service.java
|
UTF-8
| 619
| 2.453125
| 2
|
[
"Apache-2.0"
] |
permissive
|
package demo.ddd.domaine.cb.services;
import demo.ddd.domaine.cb.exceptions.FunctionalException;
import demo.ddd.domaine.cb.rg.RegleGestion;
import demo.ddd.domaine.cb.services.IDomaineService;
public class Service implements IDomaineService {
RegleGestion rg = new RegleGestion();
@Override
public void validerPaiement(String numCard, Double price,
Integer crytogramme, String date) throws Exception {
try{
rg.isCardOk(numCard,crytogramme,date);
treatmentCard(price, numCard );
}catch(FunctionalException ex){
throw ex;
}
}
public void treatmentCard(Double price, String numCard) {
}
}
| true
|
45bf011dc2231220bb8515c002145c59cf44e40c
|
Java
|
Sachin4200/github
|
/SportsBackend/src/main/java/com/niit/sportsbackend/dao/ProductDao.java
|
UTF-8
| 368
| 2.1875
| 2
|
[] |
no_license
|
package com.niit.sportsbackend.dao;
import java.util.List;
import com.niit.sportsbackend.model.Product;
public interface ProductDao
{
public boolean addProduct(Product product);
public boolean deleteProduct(int productId);
public boolean updateProduct(Product product);
public Product getProductById(int productId);
public List<Product> getAllProducts();
}
| true
|
ca9264a2cff646e846aaa0e91135dc97b2f9190f
|
Java
|
a-korzhov/multiplex
|
/src/main/java/andrew/korzhov/multiplex/service/ScreeningService.java
|
UTF-8
| 452
| 1.882813
| 2
|
[] |
no_license
|
package andrew.korzhov.multiplex.service;
import andrew.korzhov.multiplex.web.response.AvailableSeats;
import andrew.korzhov.multiplex.web.response.MovieInfo;
import java.time.LocalDateTime;
import java.util.List;
public interface ScreeningService {
List<MovieInfo> getScreeningsByInterval(LocalDateTime min, LocalDateTime max);
List<Long> updateScreening(int day);
AvailableSeats getAvailableSeats(Long screeningId, int rowNumber);
}
| true
|
0c829f5c1111aa14465ac0f11cc65e573fb23183
|
Java
|
alex-quiterio/quoruns-protocol
|
/src/main/java/anacom/shared/exceptions/phone/NoMadeCommunication.java
|
UTF-8
| 429
| 2.453125
| 2
|
[] |
no_license
|
package anacom.shared.exceptions.phone;
public class NoMadeCommunication extends PhoneException {
private static final long serialVersionUID = 4787732662636390207L;
/**
* Empty constructor
*/
public NoMadeCommunication() {}
/**
* Constructor of NullMadeCommunication
* @param number the number of the Phone that caused the exception
*/
public NoMadeCommunication(String number) {
super(number);
}
}
| true
|
31955aa71d8eff8ba1c73e1696debd3cb2f1afaa
|
Java
|
wow3065/spring-boot
|
/src/main/java/org/liudk/annotation/user/UserService.java
|
UTF-8
| 219
| 1.65625
| 2
|
[] |
no_license
|
package org.liudk.annotation.user;
import java.util.List;
/**
* Created by dengke.liu on 2016/08/12.
*/
public interface UserService {
//public void saveUser(User user);
public List<User> selectAllUser();
}
| true
|
15de16a655710b23bf93921bdd51bc0442fed0ce
|
Java
|
cami-la/threads1-alura
|
/src/site/camila/cursoalura/threads1/classes/ImprimeString.java
|
UTF-8
| 185
| 2.265625
| 2
|
[] |
no_license
|
package site.camila.cursoalura.threads1.classes;
public class ImprimeString implements Runnable {
@Override
public void run() {
System.out.println("Imprimindo na thread");
}
}
| true
|
7d5ed11fb3d7bd1b13354300fec74c0b4078e755
|
Java
|
Game-Designing/Custom-Football-Game
|
/sources/com/google/android/gms/common/api/internal/zaav.java
|
UTF-8
| 1,669
| 1.578125
| 2
|
[
"MIT"
] |
permissive
|
package com.google.android.gms.common.api.internal;
import android.os.Bundle;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.Api.AnyClient;
import com.google.android.gms.common.api.Api.Client;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.internal.BaseImplementation.ApiMethodImpl;
import java.util.Collections;
public final class zaav implements zabd {
/* renamed from: a */
private final zabe f19812a;
public zaav(zabe zabe) {
this.f19812a = zabe;
}
/* renamed from: a */
public final void mo27590a() {
for (Client disconnect : this.f19812a.f19844f.values()) {
disconnect.disconnect();
}
this.f19812a.f19852n.f19828q = Collections.emptySet();
}
/* renamed from: b */
public final <A extends AnyClient, R extends Result, T extends ApiMethodImpl<R, A>> T mo27592b(T t) {
this.f19812a.f19852n.f19820i.add(t);
return t;
}
/* renamed from: a */
public final <A extends AnyClient, T extends ApiMethodImpl<? extends Result, A>> T mo27589a(T t) {
throw new IllegalStateException("GoogleApiClient is not connected yet.");
}
public final boolean disconnect() {
return true;
}
public final void connect() {
this.f19812a.mo27609e();
}
public final void onConnected(Bundle bundle) {
}
/* renamed from: a */
public final void mo27591a(ConnectionResult connectionResult, Api<?> api, boolean z) {
}
public final void onConnectionSuspended(int i) {
}
}
| true
|
6b0fc589895559f25ac07d74736684828259ceb7
|
Java
|
chocoai/TXEYXXK
|
/weixin_fruit/src/main/java/com/fruit/web/mapper/system/count/SystemLogMapper.java
|
UTF-8
| 563
| 1.898438
| 2
|
[
"Apache-2.0"
] |
permissive
|
package com.fruit.web.mapper.system.count;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import com.fruit.web.model.SystemLog;
public interface SystemLogMapper {
@Delete("DELETE FROM system_log WHERE create_time>=#{begin_time} AND create_time <=#{end_time}")
public void cleanLogByDate(@Param("begin_time") String begin,@Param("end_time") String end);
public long listCount(Map<String, Object> params);
public List<SystemLog> list(Map<String, Object> params);
}
| true
|
0e05e65cb65c5d9d66cb7da1abb23fca795e2c42
|
Java
|
tuotu/TestNG
|
/TestNG/src/main/java/gen/mappers/commonproducts/WithdrawDetailConfigDAO.java
|
UTF-8
| 2,592
| 2.125
| 2
|
[] |
no_license
|
/**
*
* A dao interface provides methods to access database
* Dont modify any generated method!
* If you want to add a new method , plesae dont add mbggenerated annotation marked comment.
*
* @Filename WithdrawDetailConfigDAO.java
*
* @Description
*
* @Author bohr.qiu
*
* @Email qzhanbo@yiji.com
*
*/
package gen.mappers.commonproducts;
import gen.doproject.commonproducts.WithdrawDetailConfigDO;
import gen.doproject.commonproducts.WithdrawDetailConfigDOExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface WithdrawDetailConfigDAO {
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
int countByExample(WithdrawDetailConfigDOExample example);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
int deleteByExample(WithdrawDetailConfigDOExample example);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
int deleteByPrimaryKey(Long id);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
int insert(WithdrawDetailConfigDO record);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
int insertSelective(WithdrawDetailConfigDO record);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
List<WithdrawDetailConfigDO> selectByExample(WithdrawDetailConfigDOExample example);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
WithdrawDetailConfigDO selectByPrimaryKey(Long id);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
int updateByExampleSelective(@Param("record") WithdrawDetailConfigDO record, @Param("example") WithdrawDetailConfigDOExample example);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
int updateByExample(@Param("record") WithdrawDetailConfigDO record, @Param("example") WithdrawDetailConfigDOExample example);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(WithdrawDetailConfigDO record);
/**
* corresponds to the database table withdraw_detail_config
*
* @mbggenerated
*/
int updateByPrimaryKey(WithdrawDetailConfigDO record);
}
| true
|
c250e4fc61484d3745b3d7ea990e600c3f44425a
|
Java
|
Nepisat/Equivalent-Exchange-2-Reloaded
|
/src/main/java/ic2/core/block/wiring/TileEntityLuminatorOLD.java
|
UTF-8
| 10,607
| 2.015625
| 2
|
[] |
no_license
|
package ic2.core.block.wiring;
import ic2.api.Direction;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergyConductor;
import ic2.api.energy.tile.IEnergySink;
import ic2.core.ExplosionIC2;
import ic2.core.IC2;
import ic2.core.Ic2Items;
import ic2.core.block.wiring.TileEntityLuminatorOLD$1;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.EnumSkyBlock;
import net.minecraftforge.common.MinecraftForge;
public class TileEntityLuminatorOLD extends TileEntity implements IEnergySink, IEnergyConductor
{
public int energy = 0;
public int mode = 0;
public boolean powered = false;
public int ticker = 0;
public int maxInput = 32;
public boolean addedToEnergyNet = false;
private boolean loaded = false;
public void readFromNBT(NBTTagCompound nbttagcompound)
{
super.readFromNBT(nbttagcompound);
this.energy = nbttagcompound.getShort("energy");
this.mode = nbttagcompound.getShort("mode");
this.powered = nbttagcompound.getBoolean("powered");
}
public void writeToNBT(NBTTagCompound nbttagcompound)
{
super.writeToNBT(nbttagcompound);
nbttagcompound.setShort("energy", (short)this.energy);
nbttagcompound.setShort("mode", (short)this.mode);
nbttagcompound.setBoolean("poweredy", this.powered);
}
public void validate()
{
super.validate();
IC2.addSingleTickCallback(super.worldObj, new TileEntityLuminatorOLD$1(this));
}
public void invalidate()
{
super.invalidate();
if (this.loaded)
{
this.onUnloaded();
}
}
public void onChunkUnload()
{
super.onChunkUnload();
if (this.loaded)
{
this.onUnloaded();
}
}
public void onLoaded()
{
if (IC2.platform.isSimulating() && !this.addedToEnergyNet)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
this.addedToEnergyNet = true;
}
this.loaded = true;
}
public void onUnloaded()
{
if (IC2.platform.isSimulating() && this.addedToEnergyNet)
{
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
this.addedToEnergyNet = false;
}
}
public final boolean canUpdate()
{
return false;
}
public boolean enableUpdateEntity()
{
return IC2.platform.isSimulating();
}
public void updateEntity()
{
++this.ticker;
if (this.ticker % 20 == 0)
{
if (this.ticker % 160 == 0)
{
System.out.println("Consume for Mode: " + this.mode);
byte consume = 5;
switch (this.mode)
{
case 1:
boolean var2 = true;
case 2:
consume = 40;
default:
if (consume > this.energy)
{
this.energy = 0;
this.powered = false;
System.out.println("Out of energy");
}
else
{
System.out.println("Energized");
this.energy -= consume;
this.powered = true;
}
this.updateLightning();
}
}
if (this.powered)
{
this.burnMobs();
}
}
}
public float getLightLevel()
{
if (this.powered)
{
System.out.println("get powered");
}
System.out.println("get unpowered");
return 0.9375F;
}
public void switchStrength()
{
this.mode = (this.mode + 1) % 3;
this.updateLightning();
}
public void updateLightning()
{
System.out.println("Update Lightning");
super.worldObj.updateLightByType(EnumSkyBlock.Sky, super.xCoord, super.yCoord, super.zCoord);
super.worldObj.updateLightByType(EnumSkyBlock.Block, super.xCoord, super.yCoord, super.zCoord);
}
public boolean isAddedToEnergyNet()
{
return this.addedToEnergyNet;
}
public boolean acceptsEnergyFrom(TileEntity emitter, Direction direction)
{
return true;
}
public boolean emitsEnergyTo(TileEntity receiver, Direction direction)
{
return true;
}
public double getConductionLoss()
{
return 0.0D;
}
public int getInsulationEnergyAbsorption()
{
return this.maxInput;
}
public int getInsulationBreakdownEnergy()
{
return this.maxInput + 1;
}
public int getConductorBreakdownEnergy()
{
return this.maxInput + 1;
}
public void removeInsulation()
{
System.out.println("REmove Insulation");
this.poof();
}
public void removeConductor()
{
System.out.println("REmove Confuctor");
this.poof();
}
public int demandsEnergy()
{
return this.getMaxEnergy() - this.energy;
}
public int injectEnergy(Direction directionFrom, int amount)
{
if (amount > this.maxInput)
{
System.out.println("Injecting > " + this.maxInput);
this.poof();
return 0;
}
else if (this.energy >= this.getMaxEnergy())
{
return amount;
}
else
{
this.energy += amount;
return 0;
}
}
public int getMaxSafeInput()
{
return this.maxInput;
}
public int getMaxEnergy()
{
switch (this.mode)
{
case 1:
return 20;
case 2:
return 80;
default:
return 10;
}
}
public void poof()
{
super.worldObj.setBlock(super.xCoord, super.yCoord, super.zCoord, 0, 0, 7);
ExplosionIC2 explosion = new ExplosionIC2(super.worldObj, (Entity)null, 0.5D + (double)super.xCoord, 0.5D + (double)super.yCoord, 0.5D + (double)super.zCoord, 0.5F, 0.85F, 2.0F);
explosion.doExplosion();
}
public void burnMobs()
{
int x = super.xCoord;
int y = super.yCoord;
int z = super.zCoord;
boolean xplus = false;
boolean xminus = false;
boolean yplus = false;
boolean yminus = false;
boolean zplus = false;
boolean zminus = false;
if (super.worldObj.getBlockId(x + 1, y, z) == 0 || super.worldObj.getBlockId(x + 1, y, z) == Block.glass.blockID || super.worldObj.getBlockId(x + 1, y, z) == Ic2Items.reinforcedGlass.itemID)
{
xplus = true;
}
if (super.worldObj.getBlockId(x - 1, y, z) == 0 || super.worldObj.getBlockId(x - 1, y, z) == Block.glass.blockID || super.worldObj.getBlockId(x - 1, y, z) == Ic2Items.reinforcedGlass.itemID)
{
xminus = true;
}
if (super.worldObj.getBlockId(x, y + 1, z) == 0 || super.worldObj.getBlockId(x, y + 1, z) == Block.glass.blockID || super.worldObj.getBlockId(x, y + 1, z) == Ic2Items.reinforcedGlass.itemID)
{
yplus = true;
}
if (super.worldObj.getBlockId(x, y - 1, z) == 0 || super.worldObj.getBlockId(x, y - 1, z) == Block.glass.blockID || super.worldObj.getBlockId(x, y - 1, z) == Ic2Items.reinforcedGlass.itemID)
{
yminus = true;
}
if (super.worldObj.getBlockId(x, y, z + 1) == 0 || super.worldObj.getBlockId(x, y, z + 1) == Block.glass.blockID || super.worldObj.getBlockId(x, y, z + 1) == Ic2Items.reinforcedGlass.itemID)
{
zplus = true;
}
if (super.worldObj.getBlockId(x, y, z - 1) == 0 || super.worldObj.getBlockId(x, y, z - 1) == Block.glass.blockID || super.worldObj.getBlockId(x, y, z - 1) == Ic2Items.reinforcedGlass.itemID)
{
zminus = true;
}
byte xplusI = 0;
byte xminusI = 0;
byte yplusI = 0;
byte yminusI = 0;
byte zplusI = 0;
byte zminusI = 0;
if (xplus)
{
xplusI = 3;
}
else if (yplus || yminus || zplus || zminus)
{
xplusI = 1;
}
if (xminus)
{
xminusI = 3;
}
else if (yplus || yminus || zplus || zminus)
{
xminusI = 1;
}
if (yplus)
{
yplusI = 3;
}
else if (xplus || xminus || zplus || zminus)
{
yplusI = 1;
}
if (yminus)
{
yminusI = 3;
}
else if (xplus || xminus || zplus || zminus)
{
yminusI = 1;
}
if (zplus)
{
zplusI = 3;
}
else if (yplus || yminus || xplus || xminus)
{
zplusI = 1;
}
if (zminus)
{
zminusI = 3;
}
else if (yplus || yminus || xplus || xminus)
{
zminusI = 1;
}
int var27 = x - xminusI;
int var30 = y - yminusI;
int var31 = z - zminusI;
int var26 = x + xplusI;
int var28 = y + yplusI;
int var29 = z + zplusI;
AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
List list1 = super.worldObj.getEntitiesWithinAABBExcludingEntity((Entity)null, boundingBox.addCoord((double)x, (double)y, (double)z).expand(3.0D, 3.0D, 3.0D));
for (int l = 0; l < list1.size(); ++l)
{
Entity ent = (Entity)list1.get(l);
if (ent instanceof EntityMob)
{
double ex = ent.posX;
double ey = ent.posY;
double ez = ent.posZ;
if (ex >= (double)var27 && ex <= (double)(var26 + 1) && ey >= (double)var30 && ey <= (double)(var28 + 2) && ez >= (double)var31 && ez <= (double)(var29 + 1))
{
ent.setFire(10);
}
}
}
}
}
| true
|