blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
bc1ce612c72a8ef8461e23b8b38be24eaf8fc87b
5713b4b6bd7a346eacb405117a53a7b66fe1f6fe
/src/com/sxt/po/BoxVarInfo.java
6cc0b53236484747c21faa28116d2392a5389166
[]
no_license
geekcarl/SmartLock-web
518c8d52e234d752e65bc309e612ccdce21589f6
5fb6f7414d7e87c160c129f4604d916aa0f90dbd
refs/heads/master
2022-02-25T16:42:54.802963
2019-08-31T14:28:20
2019-08-31T14:28:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,113
java
package com.sxt.po; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import org.codehaus.jackson.annotate.JsonBackReference; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; @Entity @JsonIgnoreProperties(value={"boxInfo"}) public class BoxVarInfo { private int id; private BoxInfo boxInfo; private Date last_heard; private Date power_on; private String last_controller_msg; private int pose_initial_x; private int pose_initial_y; private int pose_initial_z; @Id @GeneratedValue public int getId() { return id; } public void setId(int id) { this.id = id; } @OneToOne(fetch=FetchType.LAZY) @JoinColumn(name="box_id") public BoxInfo getBoxInfo() { return boxInfo; } public void setBoxInfo(BoxInfo boxInfo) { this.boxInfo = boxInfo; } @NotFound(action=NotFoundAction.IGNORE) public Date getLast_heard() { return last_heard; } public void setLast_heard(Date lastHeard) { last_heard = lastHeard; } public Date getPower_on() { return power_on; } public void setPower_on(Date powerOn) { power_on = powerOn; } @Column(updatable=false) public String getLast_controller_msg() { return last_controller_msg; } public void setLast_controller_msg(String lastControllerMsg) { last_controller_msg = lastControllerMsg; } @Column(updatable=false) public int getPose_initial_x() { return pose_initial_x; } public void setPose_initial_x(int poseInitialX) { pose_initial_x = poseInitialX; } @Column(updatable=false) public int getPose_initial_y() { return pose_initial_y; } public void setPose_initial_y(int poseInitialY) { pose_initial_y = poseInitialY; } @Column(updatable=false) public int getPose_initial_z() { return pose_initial_z; } public void setPose_initial_z(int poseInitialZ) { pose_initial_z = poseInitialZ; } }
[ "aaazengxx@163.com" ]
aaazengxx@163.com
3004fa601f52bfb0a923b47dd0749e05964410e7
d0f23c3c9c49bd193a75a1eb3a8072071080feb4
/web/WEB-INF/src/org/pgist/packages/PackagePollAction.java
0132e681e39f1a8e51f76d0069d4ace6ccacd2b1
[]
no_license
pgistgrp/cvo
e3dedebf40208239f4be3d4f535ced048f69f2f9
5a2dd6526a8eb14164b451bc08d54e953025299d
refs/heads/master
2021-01-23T12:10:12.857574
2008-03-10T06:16:02
2008-03-10T06:16:02
38,912,047
0
0
null
null
null
null
UTF-8
Java
false
false
4,579
java
package org.pgist.packages; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.pgist.users.User; import org.pgist.util.WebUtils; import org.pgist.system.SystemService; /** * Participants use this action to vote on the clustered packages.<br> * * The action accepts two parameters: * <ul> * <li>voteSuiteId - int, an id of a PackageVoteSuite object</li> * <li>pkgSuiteId - int, the id of a PackageSuite object</li> * <li>projSuiteId - the id of a specified PackageSuite object</li> * <li>fundSuiteId - the id of a specified FundingSuite object</li> * <li>critSuiteId - the id of a specified CriteriaSuite object</li> * <li>voteSuiteId - the id of a specified voteSuite object</li> * </ul> * * <p>According to whether the current user voted or not in the current phase, the action forwards to different page. * <p>If the current user not voted * <ul> * <li>request contains the following attributes: * <ul> * <li>voteSuite - a PackageVoteSuite object</li> * </ul> * </li> * <li>it will forward to the jsp page specified in struts-config.xml as "view";</li> * </ul> * * <p>otherwise * <ul> * <li>request contains the following attributes: * <ul> * <li>voteSuite - a PackageVoteSuite object</li> * <li>pVoteSuites - a Previous Vote Suites without the active one in it</li> * </ul> * </li> * <li>forward to "results"</li> * </ul> * * @author John */ public class PackagePollAction extends Action { private PackageService packageService; private SystemService systemService; public void setPackageService(PackageService packageService) { this.packageService = packageService; } public void setSystemService(SystemService systemService) { this.systemService = systemService; } /* * ------------------------------------------------------------------------ */ public ActionForward execute( ActionMapping mapping, ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response ) throws Exception { String tempPackageSuiteId = request.getParameter("pkgSuiteId"); String tempProjSuiteId = request.getParameter("projSuiteId"); String tempFundSuiteId = request.getParameter("fundSuiteId"); String tempCritSuiteId = request.getParameter("critSuiteId"); Long packSuite = new Long(tempPackageSuiteId); Long projSuite = new Long(tempProjSuiteId); Long fundSuite = new Long(tempFundSuiteId); Long critSuite = new Long(tempCritSuiteId); String tempVoteSuiteId = request.getParameter("voteSuiteId"); Long voteSuiteId = new Long(tempVoteSuiteId); PackageVoteSuite vSuite = packageService.getPackageVoteSuite(voteSuiteId); //Grade it User user = packageService.getUser(WebUtils.currentUser()); request.setAttribute("voteSuite", vSuite); request.setAttribute("pkgSuiteId", packSuite); request.setAttribute("projSuiteId", projSuite); request.setAttribute("fundSuiteId", fundSuite); request.setAttribute("critSuiteId", critSuite); request.setAttribute("totalUsers", systemService.getAllUsers().size()); System.out.println("***vsuiteId Poll:" + vSuite.getId()); if(vSuite.userVoted(user)) { PackageSuite pkgSuite = packageService.getPackageSuite(packSuite); Set<PackageVoteSuite> voteSuites = pkgSuite.getVoteSuites(); Set<PackageVoteSuite> pVoteSuites = new HashSet<PackageVoteSuite>(); Iterator<PackageVoteSuite> iVS = voteSuites.iterator(); PackageVoteSuite tempVS; while(iVS.hasNext()) { tempVS = iVS.next(); if(tempVS.getId() != vSuite.getId()) { pVoteSuites.add(tempVS); } } request.setAttribute("pVoteSuites", pVoteSuites); request.setAttribute("PGIST_SERVICE_SUCCESSFUL", true); return mapping.findForward("results"); } else { request.setAttribute("PGIST_SERVICE_SUCCESSFUL", true); return mapping.findForward("view"); } //return mapping.findForward("results"); }//execute() } //class PackagePollAction
[ "" ]
17fe08f7961c8237d65496222ab0a3a9b08964fe
f3871c478c1afcb57362300856ae9aa125e6b06d
/src/com/matrix/utility/DBUtility.java
88922b223776e14555509cb0d3ef141a89f67aea
[]
no_license
lyndontavares/matrix-angularjs-java-jdbc
7c11253076bf2987564928c9ae86a6533b95f49f
dc609efc1d7c88b80e7aa545519de9e98c580e98
refs/heads/master
2021-01-10T21:23:18.177534
2015-05-10T18:57:20
2015-05-10T18:57:20
35,383,333
0
0
null
null
null
null
UTF-8
Java
false
false
1,403
java
package com.matrix.utility; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class DBUtility { private static Connection connection = null; public static Connection getConnection() { if (connection != null) return connection; else { try { Properties prop = new Properties(); InputStream inputStream = DBUtility.class.getClassLoader().getResourceAsStream("/config.properties"); prop.load(inputStream); String driver = prop.getProperty("driver"); String url = prop.getProperty("url"); String user = prop.getProperty("user"); String password = prop.getProperty("password"); Class.forName(driver); connection = DriverManager.getConnection(url, user, password); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return connection; } } }
[ "integraldominio@gmail.com" ]
integraldominio@gmail.com
9b87c65713e10f94cff72bbd5bdab17ba13cf292
2e30d3287e1868e160126144400d42154623226e
/app/src/main/java/com/lampineapp/graphics/gradientbar/GradientProgressBar.java
690168dd6769885ea54c73e29c14a39b8bb3ffc2
[]
no_license
f1t3/LampineApp
ad03d11a103b77566e25ac7755c08400785a096a
7431dc75191e87e3334d87918d6e505122ca7ef3
refs/heads/master
2023-03-27T23:39:28.088146
2021-03-22T15:39:14
2021-03-22T15:39:14
291,948,615
0
0
null
null
null
null
UTF-8
Java
false
false
2,173
java
package com.lampineapp.graphics.gradientbar; import android.animation.ArgbEvaluator; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.View; public class GradientProgressBar extends View { private final static String TAG = GradientProgressBar.class.getSimpleName(); private int mH = 100, mW = 100; private double mProgress = 0.5; private int[] mColors = {0,0}; private Canvas mCanvas; private GradientBarFrame mOutlineFrame; private GradientBarFrame mProgressFrame; public GradientProgressBar(Context context, AttributeSet attrs) { super(context, attrs); mCanvas= new Canvas(); mOutlineFrame = new GradientBarFrame(); mProgressFrame = new GradientBarFrame(); } public GradientProgressBar setGradientColorRange(int[] colors) { mColors = colors; setProgress(mProgress); return this; } public GradientProgressBar setProgress(double progress) { if (progress > 1) { progress = 1; } mProgress = progress; // TODO: Search for correct interval in colors array int colorAtProgress = (int) new ArgbEvaluator().evaluate((float)mProgress, mColors[0], mColors[1]); mProgressFrame.setFillingGradientColors(new int[]{mColors[0], colorAtProgress}); mProgressFrame.onSizeChanged((int)(mH + (mW-mH)*mProgress), mH); invalidate(); return this; } public GradientProgressBar setOutlineWidth(int width) { mOutlineFrame.OUTLINE_W = width; mProgressFrame.OUTLINE_W = width; return this; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { if (w < h) { w = h; } mW = w; mH = h; super.onSizeChanged(w, h, oldw, oldh); mOutlineFrame.onSizeChanged(w, h); mProgressFrame.onSizeChanged((int)(h + (w-h)*mProgress), h); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); mProgressFrame.draw(canvas); mOutlineFrame.draw(canvas); } }
[ "andgset@gmail.com" ]
andgset@gmail.com
6b96ef29350016a19a0dda5f5a2c4bacad153d53
0da247e0ebc19f22c43be030ba19107072596605
/src/main/java/tdl/datapoint/coverage/processing/S3BucketEvent.java
8af8e1d74bc89eea5ae6b8e075af741ff678eacd
[]
no_license
julianghionoiu/dpnt-coverage
355ebb164301b25190137d4658c8fb1641b66a48
58c87d5dd20ce2a0f1d06d159db68a3efbe2a1a0
refs/heads/master
2023-06-10T02:06:17.576896
2023-05-25T22:19:23
2023-05-25T22:19:23
118,891,315
0
0
null
2019-03-31T18:17:27
2018-01-25T09:23:39
Java
UTF-8
Java
false
false
2,160
java
package tdl.datapoint.coverage.processing; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.util.List; import java.util.Map; public class S3BucketEvent { private String bucket; private String key; private S3BucketEvent(String bucket, String key) { this.bucket = bucket; this.key = key; } @SuppressWarnings("unchecked") public static S3BucketEvent from(Map<String, Object> request, ObjectMapper jsonObjectMapper) throws IOException { if (request == null) { throw new IllegalArgumentException("No input provided"); } Map<String, Object> record = ((List<Map<String, Object>>) mapGet(request, "Records")).get(0); Map<String, Object> sns = (Map<String, Object>) mapGet(record, "Sns"); String jsonS3Payload = (String) mapGet(sns, "Message"); JsonNode s3EventTree = jsonObjectMapper.readTree(jsonS3Payload); JsonNode s3Object = s3EventTree.get("Records").get(0).get("s3"); String bucket = s3Object.get("bucket").get("name").asText(); String key = s3Object.get("object").get("key").asText(); return new S3BucketEvent(bucket, key); } private static Object mapGet(Map<String, Object> map, String key) { if (map == null) { throw new IllegalArgumentException("No input provided. Map is \"null\"."); } Object o = map.get(key); if (o == null) { throw new IllegalArgumentException(String.format("Key \"%s\" not found in map.", key)); } return o; } public String getBucket() { return bucket; } public String getKey() { return key; } public String getChallengeId() { return key.split("/")[0]; } public String getParticipantId() { return key.split("/")[1]; } @Override public String toString() { return "S3BucketEvent{" + "bucket='" + bucket + '\'' + ", key='" + key + '\'' + '}'; } }
[ "iulian.ghionoiu@gmail.com" ]
iulian.ghionoiu@gmail.com
83e26c090dc775b4dc6681607f40498f8d13eb0f
6b77fd1586cb0261ffc57b5137d9682ac24ab7cb
/app/src/main/java/com/BFMe/BFMBuyer/ugc/adapter/AllTopicAdapter.java
31c7410bbb010bde100b5bf8a00fc3ff03f0c19e
[]
no_license
YanXinDong/myMall
47d6e34b549791da675d35a16955fb7765ee2d91
df0a328947f91db5457c451ff793640752adf08f
refs/heads/master
2020-04-07T15:48:13.237578
2018-11-22T08:02:15
2018-11-22T08:02:15
158,501,537
0
0
null
null
null
null
UTF-8
Java
false
false
10,895
java
package com.BFMe.BFMBuyer.ugc.adapter; import android.content.Context; import android.graphics.drawable.Drawable; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import com.BFMe.BFMBuyer.R; import com.BFMe.BFMBuyer.ugc.bean.SubTopic; import com.BFMe.BFMBuyer.ugc.bean.SubTopicList; import com.BFMe.BFMBuyer.utils.UiUtils; import com.BFMe.BFMBuyer.view.CircularImageView; import com.bumptech.glide.Glide; import java.util.ArrayList; import java.util.List; import static com.bumptech.glide.Glide.with; /** * Description:全部话题adapter * Created by :闫信董 * Company :白富美(北京)网络科技有限公司 * Date :2017/6/6 15:46 */ public class AllTopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private static final int TOPIC_INFO = 1; //用户信息 private static final int TOPIC_LIST = 2; //话题列表 private SubTopic mSubTopic = new SubTopic(); private List<SubTopicList.TopicsListBean> mTopicsList = new ArrayList<>(); private Context mContext; // private float itemWidth;//获取瀑布流需要的item宽度 public AllTopicAdapter(Context context, SubTopic subTopic, List<SubTopicList.TopicsListBean> topicsList) { mContext = context; if(subTopic != null && topicsList != null ) { mSubTopic = subTopic; mTopicsList.clear(); mTopicsList.addAll(topicsList); } } @Override public int getItemViewType(int position) { if(position == 0) { return TOPIC_INFO; }else { return TOPIC_LIST; } } @Override public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) { super.onViewAttachedToWindow(holder); ViewGroup.LayoutParams lp = holder.itemView.getLayoutParams(); if (lp != null && lp instanceof StaggeredGridLayoutManager.LayoutParams && holder.getLayoutPosition() <= 1) { StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) lp; p.setFullSpan(true); } } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { RecyclerView.ViewHolder viewHolder = null; View view; switch (viewType){ case TOPIC_INFO: view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_topic_info, parent,false); viewHolder = new TopicInfoViewHolder(view); break; case TOPIC_LIST: view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_ucg_recommend_topic_list, parent,false); viewHolder = new TopicListViewHolder(view); break; } return viewHolder; } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (getItemViewType(position)){ case TOPIC_INFO: TopicInfoViewHolder topicInfoViewHolder = (TopicInfoViewHolder) holder; topicInfoViewHolder.setData(); break; case TOPIC_LIST: TopicListViewHolder topicListViewHolder = (TopicListViewHolder) holder; topicListViewHolder.setData(); break; } } @Override public int getItemCount() { return mTopicsList.size() + 1; } public void cleanData() { mSubTopic = null; mTopicsList.clear(); } public void addData(SubTopic subTopic, List<SubTopicList.TopicsListBean> topicsList) { if (subTopic != null && topicsList != null && topicsList.size() > 0) { mSubTopic = subTopic; mTopicsList.addAll(topicsList); notifyDataSetChanged(); } } public void addData(int position, List<SubTopicList.TopicsListBean> topicsList) { if (topicsList != null && topicsList.size() > 0) { mTopicsList.addAll(position, topicsList); notifyItemChanged(position); } } private class TopicInfoViewHolder extends RecyclerView.ViewHolder{ private RelativeLayout rl_topic_title; private ImageView iv_topic_icon; private TextView tv_topic_info; private TextView tv_subscription; private TextView tv_participation; private CheckBox cb_subscription; private Context mContext; private TopicInfoViewHolder(View itemView) { super(itemView); rl_topic_title = (RelativeLayout) itemView.findViewById(R.id.rl_topic_title); iv_topic_icon = (ImageView) itemView.findViewById(R.id.iv_topic_icon); tv_topic_info = (TextView) itemView.findViewById(R.id.tv_topic_info); tv_subscription = (TextView) itemView.findViewById(R.id.tv_subscription); tv_participation = (TextView) itemView.findViewById(R.id.tv_participation); cb_subscription = (CheckBox) itemView.findViewById(R.id.cb_subscription); mContext = itemView.getContext(); } public void setData() { final SubTopic.TopicsListBean topicsInfo = mSubTopic.getTopicsList(); Glide .with(mContext) .load(topicsInfo.getImageUrl()) .into(iv_topic_icon); tv_topic_info.setText(topicsInfo.getContent()); tv_subscription.setText(mContext.getString(R.string.subscription)+" "+topicsInfo.getSubscribeCount()); tv_participation.setText(mContext.getString(R.string.participation)+" "+topicsInfo.getParticipateCount()); if(topicsInfo.getIsSubscribe() == 1) { cb_subscription.setChecked(true); cb_subscription.setText(mContext.getString(R.string.subscription_ture)); }else { cb_subscription.setChecked(false); cb_subscription.setText(mContext.getString(R.string.subscription)); } cb_subscription.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { subTopicOnClickListner.subscriptionOnClick(v,tv_subscription,topicsInfo); } }); rl_topic_title.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { subTopicOnClickListner.topicTitleOnClick(topicsInfo.getId()); } }); } } private class TopicListViewHolder extends RecyclerView.ViewHolder{ private RelativeLayout rl_recommend_topic; private ImageView iv_icon; private TextView tv_info; private CircularImageView civ_head_icon; private TextView tv_user_name; private CheckBox cb_collect; private Context mContext; private TopicListViewHolder(View itemView) { super(itemView); rl_recommend_topic = (RelativeLayout) itemView.findViewById(R.id.rl_recommend_topic); iv_icon = (ImageView) itemView.findViewById(R.id.iv_icon); tv_info = (TextView) itemView.findViewById(R.id.tv_info); civ_head_icon = (CircularImageView) itemView.findViewById(R.id.civ_head_icon); tv_user_name = (TextView) itemView.findViewById(R.id.tv_user_name); cb_collect = (CheckBox) itemView.findViewById(R.id.cb_collect); mContext = itemView.getContext(); } public void setData() { SubTopicList.TopicsListBean topicsList = mTopicsList.get(getLayoutPosition() - 2); Drawable drawable = mContext.getResources().getDrawable(R.drawable.collect_select); drawable.setBounds(0,0, UiUtils.dip2px(18),UiUtils.dip2px(18)); cb_collect.setCompoundDrawables(drawable,null,null,null); // // if (itemWidth == 0) {//获取瀑布流需要的item宽度 // itemWidth = (ScreenUtils.getScreenWidth(mContext) - UiUtils.dip2px(5) * 4) / 2; // } // float scale = itemWidth / topicsList.getImageWidth(); // // ViewGroup.LayoutParams layoutParams = iv_icon.getLayoutParams(); // layoutParams.width = (int) itemWidth; // layoutParams.height = (int) (scale * topicsList.getImageHeight()); // iv_icon.setLayoutParams(layoutParams); with(mContext) .load(topicsList.getImageUrl()) .centerCrop() .dontTransform() .into(iv_icon); tv_info.setText(topicsList.getContent()); with(mContext) .load(topicsList.getUserImage()) .centerCrop() .dontTransform() .into(civ_head_icon); tv_user_name.setText(topicsList.getUserName()); cb_collect.setChecked(topicsList.getIsPrase() == 1); // cb_collect.setText(topicsList.getParseCount() + ""); setListener(topicsList); } private void setListener(final SubTopicList.TopicsListBean topicsList) { rl_recommend_topic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { subTopicOnClickListner.detailsOnClick(topicsList.getId()); } }); civ_head_icon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { subTopicOnClickListner.userTopicOnClick(topicsList.getEncryptUserId()); } }); cb_collect.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { subTopicOnClickListner.topicLikeOnClick(v,topicsList); } }); } } private SubTopicOnClickListner subTopicOnClickListner; public interface SubTopicOnClickListner{ void subscriptionOnClick(View v, TextView tv_subscription, SubTopic.TopicsListBean topicInfo); void detailsOnClick(long id); void userTopicOnClick(String encryptUserId); void topicLikeOnClick(View v,SubTopicList.TopicsListBean topicInfo); void topicTitleOnClick(long id); } public void setSubTopicOnClickListner(SubTopicOnClickListner subTopicOnClickListner) { this.subTopicOnClickListner = subTopicOnClickListner; } }
[ "lystring@126.com" ]
lystring@126.com
8cf0c2b344dba1d8c484719a2b3b1faed91441e1
67d27ac394bd1f8cc06bd0dd21dfbcab31f40d48
/GArticulo/src/main/java/serpis/ad/ArticuloView.java
b03069e0c1c47b6c549ca7b42d74af146c0f1b4d
[]
no_license
AngelmoranT/ad
9b16d83b2f0fdf7dbe6860ddbadc1bdc09e2ac74
987a8257da3a0df9b83033366d953e2f3604994d
refs/heads/master
2021-09-06T10:12:39.665942
2018-02-05T11:34:14
2018-02-05T11:34:14
105,754,757
0
0
null
null
null
null
UTF-8
Java
false
false
51
java
package serpis.ad; public class ArticuloView { }
[ "morantvalls@hotmail.com" ]
morantvalls@hotmail.com
61b14fb1b271ef00ec5741ffe7a21cf441f925d1
c6fcf0e580e6b34ea3ef2ce4d00272a3c6707f61
/src/com/worker/logInWorker/LoginWorker.java
71e948138c798c7d51c43c47c5194dcf4fbe29dc
[]
no_license
URJACK/ISAProgramming
4a7bf89fc648d130cbec32023f0df0185ca2822b
9974e6dcb946c90f5b6256228c8bfe0dab0c13d0
refs/heads/master
2021-01-23T16:36:26.589125
2017-06-16T09:25:13
2017-06-16T09:25:13
93,303,366
1
0
null
null
null
null
UTF-8
Java
false
false
242
java
package com.worker.logInWorker; import com.json.Info_Status; import javax.servlet.http.HttpServletRequest; /** * Created by FuFangzhou on 2017/6/2. */ public interface LoginWorker { int work(HttpServletRequest rq, Info_Status is); }
[ "316585692@qq.com" ]
316585692@qq.com
6a6959c926a7ec107c284ddf6ee82a65dbab99a1
2a1ab6e3ea1fed54a9c24b95f9d7a7a492f8c513
/mis/src/string/handling/StringHandling.java
b8ab736b66453b6cc3ba51b97a11501ad92f0d49
[]
no_license
anirudhit/java-assessment
a8cebf62f24aaee1fe0fe31c9f4dc6640f9cbfa5
fc4484038e8d6c29ea55b62a2a8637b219876d27
refs/heads/master
2023-01-14T18:07:07.996522
2020-03-23T04:35:16
2020-03-23T04:35:16
241,181,789
0
0
null
2023-01-07T16:08:42
2020-02-17T18:44:16
Java
UTF-8
Java
false
false
2,225
java
package string.handling; public class StringHandling { public static void main(String[] args)throws java.lang.Exception { // This will be stored in the string pool String str1 = "Anirudh"; String str2 = "Anirudh"; System.out.println("Display str1 and str2: "); str1.concat("Bellamkonda"); System.out.println(str1); System.out.println(str2); System.out.println("Address of str1 and str2: "); System.out.println(Integer.toHexString(str1.hashCode())); System.out.println(Integer.toHexString(str2.hashCode())); // This will be stored in the heap memory String st1 = new String("Abhijith"); String st2 = new String("Anirudh"); System.out.println("Display st1 and st2: "); System.out.println(st1); System.out.println(st2); System.out.println("Address of st1 and st2: "); System.out.println(Integer.toHexString(st1.hashCode())); System.out.println(Integer.toHexString(st2.hashCode())); //String buffer StringBuffer sb1; sb1 = new StringBuffer("Anirudh"); System.out.println(sb1); System.out.println(Integer.toHexString(sb1.hashCode())); sb1.append(" Bellamkonda"); System.out.println(sb1); System.out.println(Integer.toHexString(sb1.hashCode())); StringBuffer sb2 = new StringBuffer("Anirudh"); System.out.println(sb2); System.out.println(Integer.toHexString(sb2.hashCode())); sb2.deleteCharAt(0); System.out.println(sb2); //String builder StringBuilder sbd1 = new StringBuilder("Bellamkonda"); System.out.println(sbd1.toString().toLowerCase()); System.out.println(sbd1.length()); // Equality check String ss1 = "Ani"; String ss2 = "Ani"; System.out.println("Equality check 1: "); System.out.println(ss1 == ss2); String ss3 = new String("Ani"); String ss4 = new String("Ani"); System.out.println("Equality check 2: "); System.out.println(ss3 == ss4); System.out.println("Equality check 3: "); System.out.println(ss2 == ss3); // Used intern to map ss5 from heap memory to String pool String ss5 = new String("Ani").intern(); System.out.println("Equality check 4: "); System.out.println(ss2 == ss5); System.out.println("Equality check 5: "); System.out.println(ss3 == ss5); } }
[ "anirudhit@outlook.com" ]
anirudhit@outlook.com
793e59d09f5b1ec2a2b95bcdc48dc6735ef87850
d50de43b5feace4b72c19dab0782bf9d93cb889b
/src/main/java/com/example/spring/quartz/constant/QuartzConstant.java
77a0125b5ed5bd136253f07ef2406d6ec914dbfb
[]
no_license
jxxchallenger/quartz-sample
b89793060ee52e9832d2a25f2b6d1fc85db0b481
8b0af7278931532f6330c732eb2fab4575cde3aa
refs/heads/master
2020-05-04T17:07:34.900100
2019-04-03T13:47:35
2019-04-03T13:47:35
179,299,326
0
0
null
null
null
null
UTF-8
Java
false
false
172
java
package com.example.spring.quartz.constant; public class QuartzConstant { public static final String QUARTZ_SPRING_CONTEXT_KEY = "applicationContextJobDataKey"; }
[ "jxxchallenger@foxmail.com" ]
jxxchallenger@foxmail.com
248b2775502f619673e65964ed2720572ea55227
dfbd00514d5994629c9441e76c780fbdd3aa51de
/springbootdemo/src/main/java/com/example/springbootdemo/HelloWorldController.java
21e1c9dadea56965d29e16490e994ad6c624159a
[]
no_license
AnkitaPB/SpringbootDemo
83ca24f216c1e0ded9b5b8d2ae28d99fff87a7bc
a65f4c44ac907f326e84966afbc4fdf790a38045
refs/heads/master
2020-03-14T00:19:57.116790
2018-04-27T23:49:07
2018-04-27T23:49:07
131,354,467
0
0
null
null
null
null
UTF-8
Java
false
false
1,281
java
package com.example.springbootdemo; import javax.ws.rs.POST; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.example.springbootdemo.bean.HelloWordBean; @RestController public class HelloWorldController { @Autowired UserDAOService service; @RequestMapping(method=RequestMethod.GET, path = "/hello") public String helloWorld() { return "Hello Ankita"; } @GetMapping(path="/hello-word-bean") public HelloWordBean getHelloWordBean() { return new HelloWordBean("hi"); } @GetMapping(path="/hello-word-bean/{name}") public HelloWordBean getHelloWordBeanUsingPathVar(@PathVariable String name) { return new HelloWordBean(name); } @PostMapping(path="/user") public void createMessage(@RequestBody User user) { User createdUser=service.save(user); } }
[ "kolheankita15@gmail.com" ]
kolheankita15@gmail.com
574fac6b2de6a6d4d13fabde03d06c35a0ce1cad
d0bc667fad438ddf185d06f316a12ce61f85f2ad
/src/test/java/com/ldchotels/domain/PmsBuchTest.java
ca3fb15439709384cb987582d51774cd5152dafc
[]
no_license
jdwa/Elsa
c0e2c70e12959c968d018e6fb13dc853350c1a75
3c5219cbd41e907c5c4946e4b86a387a72c2239c
refs/heads/master
2023-03-30T15:59:54.560226
2021-04-07T03:07:27
2021-04-07T03:07:27
296,534,313
0
0
null
null
null
null
UTF-8
Java
false
false
724
java
package com.ldchotels.domain; import static org.assertj.core.api.Assertions.assertThat; import com.ldchotels.protel.domain.PmsBuch; import com.ldchotels.web.rest.TestUtil; import org.junit.jupiter.api.Test; public class PmsBuchTest { @Test public void equalsVerifier() throws Exception { TestUtil.equalsVerifier(PmsBuch.class); PmsBuch pmsBuch1 = new PmsBuch(); pmsBuch1.setId(1L); PmsBuch pmsBuch2 = new PmsBuch(); pmsBuch2.setId(pmsBuch1.getId()); assertThat(pmsBuch1).isEqualTo(pmsBuch2); pmsBuch2.setId(2L); assertThat(pmsBuch1).isNotEqualTo(pmsBuch2); pmsBuch1.setId(null); assertThat(pmsBuch1).isNotEqualTo(pmsBuch2); } }
[ "weichente@gmail.com" ]
weichente@gmail.com
0383eea6129292dab6943bb4d1e951393157ca04
66ae55ef25f03d9a621188be842d648392678019
/Staging/html/src/htmlTestCase1/TC_43098.java
bd539286e3717b05ddb6ba31e3100129f8ad9ef5
[]
no_license
nrunwal/learngit
5eb88f4fcfa0b2c8aeb25ad425b3d12426e70de6
a26dea61efea65135f7dace7735dd9c385472c44
refs/heads/master
2020-04-02T21:49:54.609033
2018-10-26T10:14:51
2018-10-26T10:14:51
154,812,722
0
0
null
null
null
null
UTF-8
Java
false
false
2,342
java
package htmlTestCase1; import java.io.IOException; import org.jdom2.JDOMException; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.sikuli.script.Screen; import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import utill.Generic; /** * @author ankjoshi * @see :The test should say: got: false, wanted: false * */ public class TC_43098 extends Generic{ static String TC_Name = "TC_43098"; static String actImagePath=""; static String expImage=""; @BeforeMethod public void tc_Start() throws JDOMException, IOException{ Xml.elementHandler(TC_Name); Generic.setCurrentTestBaselinePath(TC_Name); } @AfterMethod public void tc_end(ITestResult result) throws Throwable{ if(result.getStatus() == ITestResult.FAILURE) { String methodName=result.getName().toString().trim(); Generic.appendxml(expImage,actImagePath,methodName); System.out.println("\n***********Test Failed***********"); } System.out.println("\n\nDone Executing ----------------------"+TC_Name+"----------------------\n\n"); } @Test public static void tc_43098() throws Exception{ Screen screen = new Screen(); try { String testCase = "Check Policy File 5 "; String url = "http://ats.macromedia.com/Players/ATS/ATS9AS2/Shipping/html/Security/PolicyFileStrictness/CheckPolicyFile5.html"; String title = "CheckPolicyFile5"; System.out.println("\n\n---------------Executing TestCase: -------------------- "+TC_Name+", Desc: "+testCase+"-------------------------\n\n"); logger(Report, TC_Name, title); logger(Test, "Browser launched ", "I"); Driver.get(url); logger(Test, "Loading:"+url, "I"); titleMatch(title); logger(Test, "Loaded:"+url, "I"); Thread.sleep(5000); WebElement ele= Driver.findElement(Web.getWebElement("Div")); logger(Test, "Flash Element Found: "+ele, "I"); String image1 = "CheckPol"; expImage = imageFinder(image1); actImagePath = Generic.getSeleniumSnap(ele, TC_Name, image1); imageMatcher(expImage,actImagePath); logger(Test, "Font is Matched ", "I"); Report.endTest(Test); }catch(Exception e){ logger(Test,e.getMessage(), "F"); Report.endTest(Test); e.getStackTrace(); throw e; } } }
[ "runwal@adobe.com" ]
runwal@adobe.com
419cad6ae349b0f9efda9e498dc7a76dd4b8dbb7
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-drs/src/main/java/com/amazonaws/services/drs/model/ValidationExceptionField.java
5f09db853d2af4108d4b5151b849745afcec277c
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
5,300
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.drs.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Validate exception field. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/drs-2020-02-26/ValidationExceptionField" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ValidationExceptionField implements Serializable, Cloneable, StructuredPojo { /** * <p> * Validate exception field message. * </p> */ private String message; /** * <p> * Validate exception field name. * </p> */ private String name; /** * <p> * Validate exception field message. * </p> * * @param message * Validate exception field message. */ public void setMessage(String message) { this.message = message; } /** * <p> * Validate exception field message. * </p> * * @return Validate exception field message. */ public String getMessage() { return this.message; } /** * <p> * Validate exception field message. * </p> * * @param message * Validate exception field message. * @return Returns a reference to this object so that method calls can be chained together. */ public ValidationExceptionField withMessage(String message) { setMessage(message); return this; } /** * <p> * Validate exception field name. * </p> * * @param name * Validate exception field name. */ public void setName(String name) { this.name = name; } /** * <p> * Validate exception field name. * </p> * * @return Validate exception field name. */ public String getName() { return this.name; } /** * <p> * Validate exception field name. * </p> * * @param name * Validate exception field name. * @return Returns a reference to this object so that method calls can be chained together. */ public ValidationExceptionField withName(String name) { setName(name); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMessage() != null) sb.append("Message: ").append(getMessage()).append(","); if (getName() != null) sb.append("Name: ").append(getName()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ValidationExceptionField == false) return false; ValidationExceptionField other = (ValidationExceptionField) obj; if (other.getMessage() == null ^ this.getMessage() == null) return false; if (other.getMessage() != null && other.getMessage().equals(this.getMessage()) == false) return false; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMessage() == null) ? 0 : getMessage().hashCode()); hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); return hashCode; } @Override public ValidationExceptionField clone() { try { return (ValidationExceptionField) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.drs.model.transform.ValidationExceptionFieldMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
18b8e3ed7340232bc9a83126c56297aa20d13a31
ee0f8b85cfb713f6f4e0d2cad0edc40490963afc
/app/src/main/java/com/zhxh/codeproj/leetcode/ace100/tree/LeetCode112.java
c22f1c08ca0c0a8a79a06eec56651aab2d5c4527
[]
no_license
zhxhcoder/codeProj
442b0011542f2587225a443d0a0203c026724dcd
100004cc5b25206bae68f5eb3eb9e276b304de3d
refs/heads/master
2023-03-03T19:09:43.798463
2023-02-28T12:17:23
2023-02-28T12:17:23
136,260,859
5
1
null
null
null
null
UTF-8
Java
false
false
3,027
java
package com.zhxh.codeproj.leetcode.ace100.tree; import com.zhxh.codeproj.leetcode.__base.TreeNode; import java.util.LinkedList; import java.util.Queue; /* 给定一个二叉树和一个目标和,判断该树中是否存在根节点到叶子节点的路径,这条路径上所有节点值相加等于目标和。 说明:叶子节点是指没有子节点的节点。 示例: 输入:root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22 输出:true 解释:等于目标和的根节点到叶节点路径如上图所示。 给定如下二叉树,以及目标和 sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ \ 7 2 1 返回 true, 因为存在目标和为 22 的根节点到叶子节点的路径 5->4->11->2。 */ class LeetCode112 { public static void main(String[] args) { System.out.println(new Solution().hasPathSum(TreeNode.buildBinaryTree(new Integer[]{5, 4, 8, 11, null, 13, 4, 7, 2, null, null, null, 1}), 22)); System.out.println(new Solution2().hasPathSum(TreeNode.buildBinaryTree(new Integer[]{5, 4, 8, 11, null, 13, 4, 7, 2, null, null, null, 1}), 22)); } /* 方法一:广度优先搜索 首先我们可以想到使用广度优先搜索的方式,记录从根节点到当前节点的路径和,以防止重复计算。 这样我们使用两个队列,分别存储将要遍历的节点,以及根节点到这些节点的路径和即可。 */ static class Solution { public boolean hasPathSum(TreeNode root, int sum) { if (root == null) { return false; } Queue<TreeNode> queNode = new LinkedList<TreeNode>(); Queue<Integer> queVal = new LinkedList<Integer>(); queNode.offer(root); queVal.offer(root.val); while (!queNode.isEmpty()) { TreeNode now = queNode.poll(); int temp = queVal.poll(); if (now.left == null && now.right == null) { if (temp == sum) { return true; } continue; } if (now.left != null) { queNode.offer(now.left); queVal.offer(now.left.val + temp); } if (now.right != null) { queNode.offer(now.right); queVal.offer(now.right.val + temp); } } return false; } } /* 方法二:递归 */ static class Solution2 { public boolean hasPathSum(TreeNode root, int sum) { if (root == null) { return false; } if (root.left == null && root.right == null) { return sum == root.val; } return hasPathSum(root.left, sum - root.val) || hasPathSum(root.right, sum - root.val); } } }
[ "zhxhcoder@gmail.com" ]
zhxhcoder@gmail.com
34ad018066cf8550cb2d892df38a3cd2141b4aa1
b17394f1edfbed31657b58a4b1245be3437cc9d3
/src/main/java/rtx/demo01/Demo01.java
1b4d8fa8686fd890fbe8d7c100e6daee7f45909e
[]
no_license
koerriva/bc
99f1dc09347c862990bbb718ebde34a33ddbf2af
afd243f7406e33be451861027f24dea328b37102
refs/heads/master
2023-04-26T22:18:26.207300
2021-05-17T07:43:19
2021-05-17T07:43:19
349,960,674
0
0
null
null
null
null
UTF-8
Java
false
false
9,319
java
package rtx.demo01; import org.lwjgl.BufferUtils; import org.lwjgl.glfw.GLFWErrorCallback; import org.lwjgl.glfw.GLFWKeyCallback; import org.lwjgl.glfw.GLFWVidMode; import org.lwjgl.opengl.GL; import org.lwjgl.system.MemoryUtil; import rtx.linalg.Vector3f; import rtx.util.Camera; import rtx.util.Util; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.IntBuffer; import static org.lwjgl.glfw.GLFW.*; import static org.lwjgl.opengl.GL11C.GL_FALSE; import static org.lwjgl.opengl.GL11C.GL_TRUE; import static org.lwjgl.opengl.GL15C.*; import static org.lwjgl.opengl.GL20C.*; import static org.lwjgl.opengl.GL30C.*; import static org.lwjgl.opengl.GL42C.glBindImageTexture; import static org.lwjgl.opengl.GL43C.*; public class Demo01 { private long window; private int width = 1024; private int height = 768; private int tex; private int vao; private int computeProgram; private int quadProgram; private int eyeUniform; private int ray00Uniform; private int ray10Uniform; private int ray01Uniform; private int ray11Uniform; private int workGroupSizeX; private int workGroupSizeY; private Camera camera; private final Vector3f eyeRay = new Vector3f(); GLFWErrorCallback errFun; GLFWKeyCallback keyFun; private void init() throws IOException { if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GL_FALSE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); window = glfwCreateWindow(width, height, "Demo01", MemoryUtil.NULL, MemoryUtil.NULL); if (window == MemoryUtil.NULL) { throw new AssertionError("Failed to create the GLFW window"); } glfwSetKeyCallback(window, keyFun = new GLFWKeyCallback() { public void invoke(long window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE) glfwSetWindowShouldClose(window,true); } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); assert vidmode != null; glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(1); glfwShowWindow(window); GL.createCapabilities(); /* Create all needed GL resources */ tex = createFramebufferTexture(); vao = quadFullScreenVao(); computeProgram = createComputeProgram(); initComputeProgram(); quadProgram = createQuadProgram(); initQuadProgram(); /* Setup camera */ camera = new Camera(); camera.setFrustumPerspective(60.0f, (float) width / height, 1f, 2f); camera.setLookAt(new Vector3f(3.0f, 2.0f, 7.0f), new Vector3f(0.0f, 0.5f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f)); } /** * Creates a VAO with a full-screen quad VBO. */ private int quadFullScreenVao() { int vao = glGenVertexArrays(); int vbo = glGenBuffers(); glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, vbo); ByteBuffer bb = BufferUtils.createByteBuffer(2 * 6); bb.put((byte) -1).put((byte) -1); bb.put((byte) 1).put((byte) -1); bb.put((byte) 1).put((byte) 1); bb.put((byte) 1).put((byte) 1); bb.put((byte) -1).put((byte) 1); bb.put((byte) -1).put((byte) -1); bb.flip(); glBufferData(GL_ARRAY_BUFFER, bb, GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 2, GL_BYTE, false, 0, 0L); glBindVertexArray(0); return vao; } /** * Create a shader object from the given classpath resource. * * @param resource * the class path * @param type * the shader type * @return the shader object id * @throws IOException */ private int createShader(String resource, int type) throws IOException { int shader = glCreateShader(type); InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream(resource); glShaderSource(shader, Util.getCode(is)); is.close(); glCompileShader(shader); int compiled = glGetShaderi(shader, GL_COMPILE_STATUS); String shaderLog = glGetShaderInfoLog(shader); if (shaderLog.trim().length() > 0) { System.err.println(shaderLog); } if (compiled == 0) { throw new AssertionError("Could not compile shader"); } return shader; } /** * Create the full-scren quad shader. * * @return that program id * @throws IOException */ private int createQuadProgram() throws IOException { int quadProgram = glCreateProgram(); int vshader = createShader("43/quad.vert", GL_VERTEX_SHADER); int fshader = createShader("43/quad.frag", GL_FRAGMENT_SHADER); glAttachShader(quadProgram, vshader); glAttachShader(quadProgram, fshader); glBindAttribLocation(quadProgram, 0, "vertex"); glBindFragDataLocation(quadProgram, 0, "color"); glLinkProgram(quadProgram); int linked = glGetProgrami(quadProgram, GL_LINK_STATUS); String programLog = glGetProgramInfoLog(quadProgram); if (programLog.trim().length() > 0) { System.err.println(programLog); } if (linked == 0) { throw new AssertionError("Could not link program"); } return quadProgram; } /** * Create the tracing compute shader program. * * @return that program id * @throws IOException */ private int createComputeProgram() throws IOException { int program = glCreateProgram(); int cshader = createShader("43/demo01.comp", GL_COMPUTE_SHADER); glAttachShader(program, cshader); glLinkProgram(program); int linked = glGetProgrami(program, GL_LINK_STATUS); String programLog = glGetProgramInfoLog(program); if (programLog.trim().length() > 0) { System.err.println(programLog); } if (linked == 0) { throw new AssertionError("Could not link program"); } return program; } /** * Initialize the full-screen-quad program. */ private void initQuadProgram() { glUseProgram(quadProgram); int texUniform = glGetUniformLocation(quadProgram, "tex"); glUniform1i(texUniform, 0); glUseProgram(0); } /** * Initialize the compute shader. */ private void initComputeProgram() { glUseProgram(computeProgram); IntBuffer workGroupSize = BufferUtils.createIntBuffer(3); glGetProgramiv(computeProgram, GL_COMPUTE_WORK_GROUP_SIZE, workGroupSize); workGroupSizeX = workGroupSize.get(0); workGroupSizeY = workGroupSize.get(1); eyeUniform = glGetUniformLocation(computeProgram, "eye"); ray00Uniform = glGetUniformLocation(computeProgram, "ray00"); ray10Uniform = glGetUniformLocation(computeProgram, "ray10"); ray01Uniform = glGetUniformLocation(computeProgram, "ray01"); ray11Uniform = glGetUniformLocation(computeProgram, "ray11"); glUseProgram(0); } /** * Create the texture that will serve as our framebuffer. * * @return the texture id */ private int createFramebufferTexture() { int tex = glGenTextures(); glBindTexture(GL_TEXTURE_2D, tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); ByteBuffer black = null; glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA, GL_FLOAT, black); glBindTexture(GL_TEXTURE_2D, 0); return tex; } /** * Compute one frame by tracing the scene using our compute shader and * presenting that image on the screen. */ private void trace() { glUseProgram(computeProgram); /* Set viewing frustum corner rays in shader */ glUniform3f(eyeUniform, camera.getPosition().x, camera.getPosition().y, camera.getPosition().z); camera.getEyeRay(-1, -1, eyeRay); glUniform3f(ray00Uniform, eyeRay.x, eyeRay.y, eyeRay.z); camera.getEyeRay(-1, 1, eyeRay); glUniform3f(ray01Uniform, eyeRay.x, eyeRay.y, eyeRay.z); camera.getEyeRay(1, -1, eyeRay); glUniform3f(ray10Uniform, eyeRay.x, eyeRay.y, eyeRay.z); camera.getEyeRay(1, 1, eyeRay); glUniform3f(ray11Uniform, eyeRay.x, eyeRay.y, eyeRay.z); /* Bind level 0 of framebuffer texture as writable image in the shader. */ glBindImageTexture(0, tex, 0, false, 0, GL_WRITE_ONLY, GL_RGBA32F); /* Compute appropriate invocation dimension. */ int worksizeX = Util.nextPowerOfTwo(width); int worksizeY = Util.nextPowerOfTwo(height); /* Invoke the compute shader. */ glDispatchCompute(worksizeX / workGroupSizeX, worksizeY / workGroupSizeY, 1); /* Reset image binding. */ glBindImageTexture(0, 0, 0, false, 0, GL_READ_WRITE, GL_RGBA32F); glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); glUseProgram(0); /* * Draw the rendered image on the screen using textured full-screen * quad. */ glUseProgram(quadProgram); glBindVertexArray(vao); glBindTexture(GL_TEXTURE_2D, tex); glDrawArrays(GL_TRIANGLES, 0, 6); glBindTexture(GL_TEXTURE_2D, 0); glBindVertexArray(0); glUseProgram(0); } private void loop() { while (!glfwWindowShouldClose(window)) { glfwPollEvents(); glViewport(0, 0, width, height); trace(); glfwSwapBuffers(window); } } private void run() { try { init(); loop(); glfwDestroyWindow(window); } catch (Throwable e) { e.printStackTrace(); } finally { glfwTerminate(); } } public static void main(String[] args) { new Demo01().run(); } }
[ "504097978@qq.com" ]
504097978@qq.com
629702406f4b31c32fbdbddb9747ac9d8c82e37f
37f6b225f0f7f3eb63d0fc6d7d22f3cf7e8fd4cc
/Server/src/main/java/com/team4/server/NotExistingException.java
aeb0ec7dc6ade45a8be5dd2cd10fc120a111a958
[]
no_license
Team4-HKLS/Mobile-Computing
07f4b101b25a0db1b79ec9d06fb0d0ce066eab71
b56003359d235b6c9631d951abcced97aa862644
refs/heads/master
2020-04-29T02:23:04.689387
2019-06-10T14:39:43
2019-06-10T14:39:43
175,765,207
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package com.team4.server; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.NOT_FOUND) public class NotExistingException extends RuntimeException { /** * */ public NotExistingException(String message) { super(message); } }
[ "kwangwook.kwon@gmail.com" ]
kwangwook.kwon@gmail.com
72a241f61e3a54ebb7f68ca99ab6bac504bef5ee
b4347feddc232095e8b043f4eaed2c04c6d35eff
/app/src/main/java/com/likeit/as51scholarship/activitys/NewMessageActivity.java
f30f634736ba1ca13cc0ad96eb3eb59ee86d98f2
[]
no_license
13512780735/51
f7b17c06f852965d76ec2789cd610f3faef32420
c3bc87993a933f040e5cb5b1fad0a7d795eba3c9
refs/heads/master
2021-09-12T19:28:49.386555
2017-12-14T12:26:31
2017-12-14T12:26:31
112,406,078
0
1
null
null
null
null
UTF-8
Java
false
false
4,244
java
package com.likeit.as51scholarship.activitys; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; import com.handmark.pulltorefresh.library.PullToRefreshListView; import com.likeit.as51scholarship.R; import com.likeit.as51scholarship.adapters.MessageListAdapter; import com.likeit.as51scholarship.configs.AppConfig; import com.likeit.as51scholarship.http.HttpUtil; import com.likeit.as51scholarship.model.Messageabean; import com.likeit.as51scholarship.utils.MyActivityManager; import com.loopj.android.http.RequestParams; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class NewMessageActivity extends Container { @BindView(R.id.tv_header) TextView tvHeader; @BindView(R.id.message_listview) ListView myListview; private List<Messageabean> messageData; private MessageListAdapter mAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_message); MyActivityManager.getInstance().addActivity(this); ButterKnife.bind(this); messageData=new ArrayList<Messageabean>(); initData(); showProgress("Loading..."); initView(); } private void initView() { tvHeader.setText("最新消息"); mAdapter=new MessageListAdapter(mContext,messageData); myListview.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); myListview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String link=messageData.get(position).getLink(); Intent intent=new Intent(mContext,MessageWebActivity.class); intent.putExtra("link",link); startActivity(intent); Log.d("TAG","1111"); } }); } private void initData() { String url= AppConfig.LIKEIT_INDEX_NOTICE; RequestParams parmas=new RequestParams(); // parmas.put("ukey",ukey); HttpUtil.post(url, parmas, new HttpUtil.RequestListener() { @Override public void success(String response) { Log.d("TAG",response); disShowProgress(); try { JSONObject obj=new JSONObject(response); String code=obj.optString("code"); String message=obj.optString("message"); if("1".equals(code)){ JSONArray array=obj.optJSONArray("data"); for(int i=0;i<array.length();i++){ JSONObject object=array.optJSONObject(i); Messageabean mMessageabean=new Messageabean(); mMessageabean.setId(object.optString("id")); mMessageabean.setTitle(object.optString("title")); mMessageabean.setContent(object.optString("content")); mMessageabean.setLink(object.optString("link")); mMessageabean.setCreate_time(object.optString("create_time")); messageData.add(mMessageabean); } mAdapter.notifyDataSetChanged(); Log.d("TAG",messageData.get(0).getId()); } } catch (JSONException e) { e.printStackTrace(); } } @Override public void failed(Throwable e) { disShowProgress(); } }); } @OnClick(R.id.backBtn) public void Onclick(View v){ switch (v.getId()){ case R.id.backBtn: onBackPressed(); break; } } }
[ "931317632@qq.com" ]
931317632@qq.com
c1c7a26861d2386373943f92a29fa56dbed32428
fdb8d734df8eaa3b21d4b8af03771458231902b2
/src/ITS/Dao/AccountsDao.java
d45c7c49b56954fcc4f75e04c128019b7c78d3c1
[]
no_license
AleMoli/ITS_Survey_v1.0
d241c6a084bb4b816642c1d4aceb94ce2b04fbda
817a962cbe54b95a5b020a03674eb3c9d767da79
refs/heads/master
2020-03-19T14:02:06.538900
2018-07-10T13:36:16
2018-07-10T13:36:16
136,605,994
0
0
null
null
null
null
UTF-8
Java
false
false
264
java
package ITS.Dao; import ITS.Model.Accounts; public interface AccountsDao { void updateAccounts(Accounts accounts); void deleteAccounts(Accounts accounts); Accounts accediAccounts(Accounts accounts); void createAccounts(Accounts accounts); }
[ "30347022+AleMoli@users.noreply.github.com" ]
30347022+AleMoli@users.noreply.github.com
f871946a5f7697427fab5b0e1c616784b5bb0958
a972f22f8d7ccf91fb3b3e4dda5aeb53ae5bd54e
/Main.java
cbc44e0cff86cedd08f28cd7f6db2dd664083204
[]
no_license
tatsu56432/Big_or_Small
73522fb115c1e10295948736f4f7322e82b8048d
5c719e9196b1c1a1b1918d97683129bdd41e69c5
refs/heads/master
2020-03-23T17:58:42.713777
2018-07-28T14:57:25
2018-07-28T14:57:25
141,883,816
0
0
null
null
null
null
UTF-8
Java
false
false
2,817
java
package Big_or_Small; import java.util.Scanner; public class Main { private static Scanner scanner; public static int betChip; public static void main(String[] args) { // TODO Auto-generated method stub // Cards c = new Cards(); // c.display(); int deal_num = 0; Point p = new Point(); Chip c = new Chip(9, 10); TrampCards t = new TrampCards(); BigOrSmall BorS = new BigOrSmall(); t.shuffle(); for (int i = 0; i < 52; i++) { System.out.println(t.cardsDeck.get(i)); // t.cardsDeck.get(i); } System.out.println("*****チップ枚数とカード*******"); p.display(); c.display(); boolean flag_continue = true; while (flag_continue) { Cards previous = t.cardsDeck.get(deal_num); System.out.println("現在のカード:" + previous); System.out.println("*********************"); System.out.println("現在の総計は" + c.getTotalChip() + "です"); System.out.println("BET枚数選択"); System.out.println("BETするchip数を入力してください。(最大1〜20)"); boolean scannerflag = false; while (!scannerflag) { try { int num = MyScanner.ChipLimitSizeScanner(); System.out.println(num + "枚BET!!"); c.betChip(num); System.out.println("現在のチップ数は" + c.getTotalChip() + "です"); // ここまできたらflagをtrueに scannerflag = true; } catch (NumberFormatException e) { System.out.println("正の整数で入力してください。"); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); // e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } // Cards next = t.cardsDeck.get(++deal_num); int result; System.out.println(next); int bs = 0; try { bs = MyScanner.BigOrSmallScanner(); }catch(Exception e) { System.out.println(e.getMessage()); //e.printStackTrace(); } //System.out.println(bs); // previous.setNum(1); // next.setNum(1); System.out.println(previous); System.out.println(next); result = t.numDuel(previous, next); if( (result == 1 && bs == 0) || (result == 0 && bs == 1) ) { System.out.println("win!!!"); }else{ System.out.println("lose,,,"); } System.out.println(bs); System.out.println(result); // ゲーム52回したら抜ける if(deal_num > 52) { flag_continue = false; // t.shuffle(); System.out.println("52回のデッキを使い果たしたのでゲームを終了します。"); } // どこでユーザは続けるかどうか判断する? // 戻す処理のやり方、わからない } // while loop ここまで } }
[ "tatsu56432@gmail.com" ]
tatsu56432@gmail.com
6c3013a6838a63fdaa640706394d9d85769d1352
002140e0ea60a9fcfac9fc07f60bb3e9dc49ab67
/src/main/java/net/ibizsys/paas/ctrlhandler/AppMenuHandlerBase.java
6a32e453ea93604e7523d9fc6eb827149cb6b1b7
[]
no_license
devibizsys/saibz5_all
ecacc91122920b8133c2cff3c2779c0ee0381211
87c44490511253b5b34cd778623f9b6a705cb97c
refs/heads/master
2021-01-01T16:15:17.146300
2017-07-20T07:52:21
2017-07-20T07:52:21
97,795,014
0
1
null
null
null
null
UTF-8
Java
false
false
1,729
java
package net.ibizsys.paas.ctrlhandler; import net.ibizsys.paas.ctrlmodel.IAppMenuModel; import net.ibizsys.paas.ctrlmodel.ICtrlModel; import net.ibizsys.paas.util.StringHelper; import net.ibizsys.paas.web.AjaxActionResult; import net.ibizsys.paas.web.MDAjaxActionResult; /** * 导航栏后台处理对象基类 * * @author lionlau * */ public abstract class AppMenuHandlerBase extends CtrlHandlerBase implements IAppMenuHandler { /** * 获取导航栏模型 * * @return */ protected abstract IAppMenuModel getAppMenuModel(); /* * (non-Javadoc) * * @see net.ibizsys.paas.ctrlhandler.CtrlHandlerBase#onProcessAction(java.lang .String) */ @Override protected AjaxActionResult onProcessAction(String strAction) throws Exception { if (StringHelper.compare(strAction, ACTION_FETCH, true) == 0) { return onFetch(); } return super.onProcessAction(strAction); } /** * 建立获取行为结果 * * @return */ protected MDAjaxActionResult createFetchActionResult() { return new MDAjaxActionResult(); } /** * 数据获取处理 * * @return * @throws Exception */ protected AjaxActionResult onFetch() throws Exception { MDAjaxActionResult mdAjaxActionResult = createFetchActionResult(); fillFetchResult(mdAjaxActionResult); return mdAjaxActionResult; } /** * 填充数据获取结果 * * @param fetchResult * @throws Exception */ protected void fillFetchResult(MDAjaxActionResult fetchResult) throws Exception { this.getAppMenuModel().fillFetchResult(fetchResult); } /* * (non-Javadoc) * * @see net.ibizsys.paas.ctrlhandler.ICtrlHandler#getCtrlModel() */ @Override public ICtrlModel getCtrlModel() { return getAppMenuModel(); } }
[ "dev@ibizsys.net" ]
dev@ibizsys.net
e765abd559a2a0b7c153632ed2887945d55f312d
bc60787dcb7b6df529d20652b87d24b731421541
/huomai-business/src/main/java/com/huomai/business/bo/HuomaiMiusicEditBo.java
1a3b926c3df7377d4b94f56f34e53592d70fe464
[ "MIT" ]
permissive
shortVideoTeam/short-video-services
2ff50b78b9fe4f492a57ea4fbe69adb8c51085f0
c87b39993a0229b35e366c771c5bc54edfd58cc3
refs/heads/main
2023-06-26T22:39:34.057224
2021-08-03T08:01:46
2021-08-03T08:01:46
373,133,058
0
0
null
null
null
null
UTF-8
Java
false
false
992
java
package com.huomai.business.bo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; /** * 音乐模板编辑对象 huomai_miusic * * @author huomai * @date 2021-06-19 */ @Data @ApiModel("音乐模板编辑对象") public class HuomaiMiusicEditBo { /** * ID */ @ApiModelProperty("ID") private Long id; /** * 标题 */ @ApiModelProperty("标题") private String title; /** * 封面图 */ @ApiModelProperty("封面图") private String coverImg; /** * 音乐地址 */ @ApiModelProperty("音乐地址") private String miusicUrl; /** * 更新者 */ @ApiModelProperty("更新者") private String updateBy; /** * 更新时间 */ @ApiModelProperty("更新时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; /** * 备注 */ @ApiModelProperty("备注") private String remark; }
[ "15921471241@163.com" ]
15921471241@163.com
f542680dd1d08aa2ac5d003ad32e3e2bac4dd17b
95c49f466673952b465e19a5ee3ae6eff76bee00
/src/main/java/com/zhihu/android/module/task/p1720a/$$Lambda$a$l5oHyzdHkO3kLtXJBc48fZxyEvE.java
e61a9a5a72cacfe518fd96687615ec4cc7ce2351
[]
no_license
Phantoms007/zhihuAPK
58889c399ae56b16a9160a5f48b807e02c87797e
dcdbd103436a187f9c8b4be8f71bdf7813b6d201
refs/heads/main
2023-01-24T01:34:18.716323
2020-11-25T17:14:55
2020-11-25T17:14:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
835
java
package com.zhihu.android.module.task.p1720a; import com.zhihu.android.p939ac.TaskInterceptor; import com.zhihu.android.p939ac.TaskScheduler; /* renamed from: com.zhihu.android.module.task.a.-$$Lambda$a$l5oHyzdHkO3kLtXJBc48fZxyEvE reason: invalid class name */ /* compiled from: lambda */ public final /* synthetic */ class $$Lambda$a$l5oHyzdHkO3kLtXJBc48fZxyEvE implements TaskInterceptor { public static final /* synthetic */ $$Lambda$a$l5oHyzdHkO3kLtXJBc48fZxyEvE INSTANCE = new $$Lambda$a$l5oHyzdHkO3kLtXJBc48fZxyEvE(); private /* synthetic */ $$Lambda$a$l5oHyzdHkO3kLtXJBc48fZxyEvE() { } @Override // com.zhihu.android.p939ac.TaskInterceptor public final boolean onRun(String str, int i, TaskScheduler fVar, Runnable runnable) { return InterceptorFactory.m108081d(str, i, fVar, runnable); } }
[ "seasonpplp@qq.com" ]
seasonpplp@qq.com
c57961d9bd306320f8e852347dd54e9aef954c9f
615edc20afa7c5a0df5db6c828d5384b4ceeec13
/CT25-DataPack/dist/game/data/scripts/handlers/admincommandhandlers/AdminCreateItem.java
c034c166ad0e3aaa53bd1893948ed3f721b76206
[]
no_license
l2jmaximun/Freya
7e40d4bce9a1b7837bbbe5c3bf6601a03c023fe9
5dc44b1a8048b9658a7e27b83eef2ea06268898a
refs/heads/master
2021-08-30T19:31:24.630211
2017-12-19T05:57:16
2017-12-19T05:57:16
114,718,987
0
0
null
null
null
null
UTF-8
Java
false
false
8,052
java
/* * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ package handlers.admincommandhandlers; import java.util.Collection; import java.util.StringTokenizer; import ct25.xtreme.gameserver.datatables.ItemTable; import ct25.xtreme.gameserver.handler.IAdminCommandHandler; import ct25.xtreme.gameserver.model.L2World; import ct25.xtreme.gameserver.model.actor.instance.L2PcInstance; import ct25.xtreme.gameserver.templates.item.L2Item; /** * This class handles following admin commands: - itemcreate = show menu - create_item <id> [num] = creates num items with respective id, if num is not specified, assumes 1. * @version $Revision: 1.2.2.2.2.3 $ $Date: 2005/04/11 10:06:06 $ */ public class AdminCreateItem implements IAdminCommandHandler { private static final String[] ADMIN_COMMANDS = { "admin_itemcreate", "admin_create_item", "admin_create_coin", "admin_give_item_target", "admin_give_item_to_all" }; @Override public boolean useAdminCommand(final String command, final L2PcInstance activeChar) { if (activeChar == null || !activeChar.getPcAdmin().canUseAdminCommand()) return false; if (command.equals("admin_itemcreate")) AdminHelpPage.showHelpPage(activeChar, "itemcreation.htm"); else if (command.startsWith("admin_create_item")) { try { final String val = command.substring(17); final StringTokenizer st = new StringTokenizer(val); if (st.countTokens() == 2) { final String id = st.nextToken(); final int idval = Integer.parseInt(id); final String num = st.nextToken(); final long numval = Long.parseLong(num); createItem(activeChar, activeChar, idval, numval); } else if (st.countTokens() == 1) { final String id = st.nextToken(); final int idval = Integer.parseInt(id); createItem(activeChar, activeChar, idval, 1); } } catch (final StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //create_item <itemId> [amount]"); } catch (final NumberFormatException nfe) { activeChar.sendMessage("Specify a valid number."); } AdminHelpPage.showHelpPage(activeChar, "itemcreation.htm"); } else if (command.startsWith("admin_create_coin")) { try { final String val = command.substring(17); final StringTokenizer st = new StringTokenizer(val); if (st.countTokens() == 2) { final String name = st.nextToken(); final int idval = getCoinId(name); if (idval > 0) { final String num = st.nextToken(); final long numval = Long.parseLong(num); createItem(activeChar, activeChar, idval, numval); } } else if (st.countTokens() == 1) { final String name = st.nextToken(); final int idval = getCoinId(name); createItem(activeChar, activeChar, idval, 1); } } catch (final StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //create_coin <name> [amount]"); } catch (final NumberFormatException nfe) { activeChar.sendMessage("Specify a valid number."); } AdminHelpPage.showHelpPage(activeChar, "itemcreation.htm"); } else if (command.startsWith("admin_give_item_target")) { try { L2PcInstance target; if (activeChar.getTarget() instanceof L2PcInstance) target = (L2PcInstance) activeChar.getTarget(); else { activeChar.sendMessage("Invalid target."); return false; } final String val = command.substring(22); final StringTokenizer st = new StringTokenizer(val); if (st.countTokens() == 2) { final String id = st.nextToken(); final int idval = Integer.parseInt(id); final String num = st.nextToken(); final long numval = Long.parseLong(num); createItem(activeChar, target, idval, numval); } else if (st.countTokens() == 1) { final String id = st.nextToken(); final int idval = Integer.parseInt(id); createItem(activeChar, target, idval, 1); } } catch (final StringIndexOutOfBoundsException e) { activeChar.sendMessage("Usage: //give_item_target <itemId> [amount]"); } catch (final NumberFormatException nfe) { activeChar.sendMessage("Specify a valid number."); } AdminHelpPage.showHelpPage(activeChar, "itemcreation.htm"); } else if (command.startsWith("admin_give_item_to_all")) { final String val = command.substring(22); final StringTokenizer st = new StringTokenizer(val); int idval = 0; long numval = 0; if (st.countTokens() == 2) { final String id = st.nextToken(); idval = Integer.parseInt(id); final String num = st.nextToken(); numval = Long.parseLong(num); } else if (st.countTokens() == 1) { final String id = st.nextToken(); idval = Integer.parseInt(id); numval = 1; } int counter = 0; final L2Item template = ItemTable.getInstance().getTemplate(idval); if (template == null) { activeChar.sendMessage("This item doesn't exist."); return false; } if (numval > 10 && !template.isStackable()) { activeChar.sendMessage("This item does not stack - Creation aborted."); return false; } final Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values(); { for (final L2PcInstance onlinePlayer : pls) if (activeChar != onlinePlayer && onlinePlayer.isOnline() && onlinePlayer.getClient() != null && !onlinePlayer.getClient().isDetached()) { onlinePlayer.getInventory().addItem("Admin", idval, numval, onlinePlayer, activeChar); onlinePlayer.sendMessage("Admin spawned " + numval + " " + template.getName() + " in your inventory."); counter++; } } activeChar.sendMessage(counter + " players rewarded with " + template.getName()); } return true; } @Override public String[] getAdminCommandList() { return ADMIN_COMMANDS; } private void createItem(final L2PcInstance activeChar, final L2PcInstance target, final int id, final long num) { final L2Item template = ItemTable.getInstance().getTemplate(id); if (template == null) { activeChar.sendMessage("This item doesn't exist."); return; } if (num > 10 && !template.isStackable()) { activeChar.sendMessage("This item does not stack - Creation aborted."); return; } target.getInventory().addItem("Admin", id, num, activeChar, null); if (activeChar != target) target.sendMessage("Admin spawned " + num + " " + template.getName() + " in your inventory."); activeChar.sendMessage("You have spawned " + num + " " + template.getName() + "(" + id + ") in " + target.getName() + " inventory."); } private int getCoinId(final String name) { int id; if (name.equalsIgnoreCase("adena")) id = 57; else if (name.equalsIgnoreCase("ancientadena")) id = 5575; else if (name.equalsIgnoreCase("festivaladena")) id = 6673; else if (name.equalsIgnoreCase("blueeva")) id = 4355; else if (name.equalsIgnoreCase("goldeinhasad")) id = 4356; else if (name.equalsIgnoreCase("silvershilen")) id = 4357; else if (name.equalsIgnoreCase("bloodypaagrio")) id = 4358; else if (name.equalsIgnoreCase("fantasyislecoin")) id = 13067; else id = 0; return id; } }
[ "Rener@Rener-PC" ]
Rener@Rener-PC
58ff861c5844c89b3ee2d7c36b7a9660fcf216cd
e16954689859ab1d8053bff9182a5d11054bd783
/java_0326/MyQueueByLinkedList.java
522c96806973bcb8b2377549513aaa2f2d2f2fa0
[]
no_license
YYxxxiiii/Java
c0be9634ff664ac5ae74100315657ceb1ccfa210
adeb866726f6baaf07c991c11a309f3f9e8d51f1
refs/heads/master
2020-11-28T00:17:39.197354
2020-08-20T13:39:43
2020-08-20T13:39:43
229,656,790
1
0
null
2020-10-13T22:43:48
2019-12-23T01:45:24
Java
UTF-8
Java
false
false
1,203
java
package java15_0326; public class MyQueueByLinkedList { // Node 这个类叫做 "内部类" . 定义在某个类或者方法中的类 // static 效果就是: 创建 Node 的实例不依赖 MyQueueByLinkedList 这个类的实例 static class Node { public int val; Node next = null; public Node(int val) { this.val = val; } } private Node head = null; private Node tail = null; public void offer(int val) { Node newNode = new Node(val); if (head == null) { head = newNode; tail = newNode; return; } // 当前如果不是空链表 tail.next = newNode; tail = tail.next; } // 出队列 public Integer poll() { if (head == null) { return null; } int ret = head.val; head = head.next; if (head == null) { // 删除当前元素之后, 队列变成了空的队列 tail = null; } return ret; } // 取队首元素 public Integer peek() { if (head == null) { return null; } return head.val; } }
[ "axii_@outlook.com" ]
axii_@outlook.com
e79f423caf6ee4e7706cb4acbed0eb19082b4734
e15de7f197b15de34fb4ac0997bc3903891d63c5
/farmaciaDosAnimais/.metadata/.plugins/org.eclipse.core.resources/.history/52/e04efa8e1c8f00101034c25bc0c7896c
b61b6e726aa84ff23ad5dee021e0b159e16e35f5
[]
no_license
philippegsmr/FarmaciaDosAnimais
5f9429a10615f65681ee3563925d06844b83ece7
5ad887aa926f46b9cea9982818b41e2af46e651d
refs/heads/master
2020-04-20T11:36:20.339469
2011-06-09T04:15:58
2011-06-09T04:15:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,265
import java.awt.*; import java.awt.event.*; import javax.swing.*; /* * class written by Philippe Ribeiro * Department of Computer Science, University of Minnesota * Minneapolis, Minnesota, USA - 55455 * * class Frameform provides the general frame that is going to be used * to all the functionalities into the program * so it creates a unique frame, making it a standard */ public class Frameform extends JFrame{ /** * */ private static final long serialVersionUID = 1L; private JTextField field; /* * used to display additional information */ private JLabel displayLabel; /* * constructor receives a string to the title of the frame */ public Frameform(String title){ super(title); this.field = new JTextField("Produto"); this.field.setVisible(true); displayLabel = new JLabel("Farmacia dos Animais", SwingConstants.CENTER); displayLabel.setForeground(Color.BLACK); displayLabel.setFont(new Font("Serif", Font.PLAIN, 72)); /* * default size, but it can be override by the function setFrameSize */ setSize(800, 600); setVisible(true); } /* * this function can change the Frame Size at any time */ public void setFrameSize(int height, int width){ this.setSize(width, height); } }
[ "root@localhost.localdomain" ]
root@localhost.localdomain
88ca56294d6addd2613edde3c472a3aa25127c2f
e72dd59229b707db6179c7f040d20fab072984ad
/src/main/java/com/cmfintech/ds/beans/factory/BeanFactory.java
a2ad5c81051284d7a108a33f88eea5cecfdc30e9
[]
no_license
duso1991/TinySpring
07b98f7833594e17ce33667ff52776ce366c6090
80f9d5acb2cdfb6138e58f1ad05dc96d94773fd5
refs/heads/master
2021-09-02T10:49:59.358750
2018-01-02T02:44:54
2018-01-02T02:44:54
115,967,386
0
0
null
null
null
null
UTF-8
Java
false
false
827
java
package com.cmfintech.ds.beans.factory; import java.lang.reflect.InvocationTargetException; /** * @Title: BeanFactory.java * @Description:IOC容器接口 * @Company 招商局金融科技 * @author 杜松 * @date 2017年12月20日 下午9:02:38 * @version V1.0 */ public interface BeanFactory { /** * *@Description:根据bean名获取Bean *@param name 查询的bean名称 *@return Object bean对象 *@author 杜松 * @throws IllegalAccessException * @throws InstantiationException * @throws ClassNotFoundException * @throws InvocationTargetException *@date 2017年12月20日 下午9:03:52 */ Object getBean(String name) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException; }
[ "302605782@qq.com" ]
302605782@qq.com
51d44da4b499fd932d9acc1957b3d05467f28dde
552da6666774225176f17441d544496c77d31e67
/app/src/main/java/com/project/myapp/Constants.java
21efde8a099241a8a7975422337e535734d6aa1b
[]
no_license
attifmazhar/user_conenction
79959906b8707fef19e54c58996c251465416254
fc665aa119786e05146c96b851b77d5cfa8aa3f6
refs/heads/master
2022-10-15T03:42:30.416584
2019-02-27T07:26:57
2019-02-27T07:26:57
172,863,871
0
1
null
2022-10-03T05:58:13
2019-02-27T07:15:57
Java
UTF-8
Java
false
false
1,415
java
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.project.myapp; /** * Defines several constants used between {@link BluetoothChatService} and the UI. */ public interface Constants { // Message types sent from the BluetoothChatService Handler public static final int MESSAGE_STATE_CHANGE = 1; public static final int MESSAGE_READ = 2; public static final int MESSAGE_WRITE = 3; public static final int MESSAGE_DEVICE_NAME = 4; public static final int MESSAGE_TOAST = 5; // Key names received from the BluetoothChatService Handler public static final String DEVICE_NAME = "device_name"; public static final String TOAST = "toast"; public static final int REQUEST_RECEIVE = 1001; public static final int REQUEST_REPLY_1 = 2001; public static final int REQUEST_REPLY_2 = 3001; }
[ "atif.mazhar@venturedive.com" ]
atif.mazhar@venturedive.com
9981ae26aeee96cc3d954a1724c503b90178633b
2cf92f715aa1f5a53020b2fac0fa4835b7f73225
/springcloud2020/cloudalibaba-provider-payment9003/src/main/java/com/atguigu/springcloud/alibaba/PaymentMain9003.java
d1247dac804427b2e6a1094135ad3054337902ae
[]
no_license
ChenXueLiang521/springcloud2020
da7c3cc07bb8ac41c340fb29cd1d1a81a5825751
a14e018be231a410da17af0ef19e8aa9b1e49595
refs/heads/master
2023-01-29T19:46:02.298178
2020-12-11T10:02:13
2020-12-11T10:02:13
293,681,370
0
1
null
null
null
null
UTF-8
Java
false
false
502
java
package com.atguigu.springcloud.alibaba; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * @description: * @author: chenxueliang * @date: 2020/12/8 11:32 */ @SpringBootApplication @EnableDiscoveryClient public class PaymentMain9003 { public static void main(String[] args) { SpringApplication.run(PaymentMain9003.class, args); } }
[ "chen.xue.liang@fesco.com.cn" ]
chen.xue.liang@fesco.com.cn
783a521ce61e95a8786164e6beb3a2356d25c842
c876b874672ec78599a7fee654800a7b350c5adb
/app/src/main/java/com/erickmxav/doacaodemedicamentos/activity/LoginActivity.java
40b2bf11558ccd51b34bdad87602492b98ae0f28
[]
no_license
erickmsx/doacaoDeMedicamentos
bceb9fa9d048495d740a5b3d118822fc4b387706
77e18e0771b4cc61e456347c82198a0261fe3e3a
refs/heads/master
2023-08-29T00:54:34.948264
2021-10-14T20:26:25
2021-10-14T20:26:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,760
java
package com.erickmxav.doacaodemedicamentos.activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import com.erickmxav.doacaodemedicamentos.R; import com.erickmxav.doacaodemedicamentos.config.FirebaseConfig; import com.erickmxav.doacaodemedicamentos.model.User; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException; import com.google.firebase.auth.FirebaseAuthInvalidUserException; public class LoginActivity extends AppCompatActivity { private FirebaseAuth authentication; private EditText inputEmailLogin, inputPasswordLogin; private Button buttonLogin; private User user; private String adminLogin = "admin@gmail.com"; private ProgressBar progressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); inputEmailLogin = findViewById(R.id.fieldEmailLogin); inputPasswordLogin = findViewById(R.id.fieldPasswordLogin); buttonLogin = findViewById(R.id.buttonLogin); progressBar = findViewById(R.id.progressBar); buttonLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String textEmail = inputEmailLogin.getText().toString(); String textPassword = inputPasswordLogin.getText().toString(); if (!textEmail.isEmpty()) { if (!textPassword.isEmpty()) { user = new User(); user.setEmail(textEmail); user.setPassword(textPassword); validateLogin(); } else { Toast.makeText(LoginActivity.this, "Preencha a senha", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(LoginActivity.this, "Preencha o e-mail", Toast.LENGTH_SHORT).show(); } } }); } public void validateLogin() { authentication = FirebaseConfig.getAuthenticationFirebase(); authentication.signInWithEmailAndPassword( user.getEmail(), user.getPassword() ).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { Toast.makeText(LoginActivity.this, "Sucesso ao fazer login", Toast.LENGTH_SHORT).show(); if ( user.getEmail().contains(adminLogin)) { progressBar.setVisibility(View.VISIBLE); new Handler().postDelayed(new Runnable() { @Override public void run() { openAdminHome(); } },2000); } else{ progressBar.setVisibility(View.VISIBLE); new Handler().postDelayed(new Runnable() { @Override public void run() { openHome(); } },2000); } } else { String exception = ""; try { throw task.getException(); } catch (FirebaseAuthInvalidUserException e) { exception = "Usuário não está cadastrado"; } catch (FirebaseAuthInvalidCredentialsException e) { exception = "E-mail ou senha não correspondem a um usuário cadastrado"; } catch (Exception e) { exception = "Erro ao cadastrar usuário: " + e.getMessage(); e.printStackTrace(); } Toast.makeText(LoginActivity.this, exception, Toast.LENGTH_SHORT).show(); } } }); } public void verifyUserLogged() { authentication = FirebaseConfig.getAuthenticationFirebase(); if (authentication.getCurrentUser() != null) { if (authentication.getCurrentUser().getEmail().contains(adminLogin)) { openAdminHome(); }else { openHome(); } } } public void openHome() { startActivity(new Intent(this, MainActivity.class)); finish(); } public void openHome(View view) { startActivity(new Intent(this, MainActivity.class)); } public void openUserRegister(View view) { startActivity(new Intent(this, UserRegisterActivity.class)); } public void openAdminHome() { startActivity(new Intent(this, AdminActivity.class)); finish(); } @Override protected void onStart() { super.onStart(); verifyUserLogged(); } }
[ "erickmxav@gmail.com" ]
erickmxav@gmail.com
69054f0f480799c9a9465d2504c400077992a99d
860ddd2c781358185922d3d19cbf245f002f80d0
/api/src/main/java/com/example/api/service/AdminService.java
491399660790fc43e9e1778ae9e5070eb4747ede
[]
no_license
Eternity02/logistics
af78cd3a2dedafe8a1b6e32dc38a421f36ead313
e20b4de784e82c8ab7ccd30f2f57939c18993c75
refs/heads/main
2023-05-07T05:14:06.388093
2021-05-28T10:01:32
2021-05-28T10:01:32
371,658,236
0
0
null
null
null
null
UTF-8
Java
false
false
548
java
package com.example.api.service; import com.example.api.model.dto.LoginDto; import com.example.api.model.entity.Admin; import java.util.List; public interface AdminService { Admin save(Admin admin) throws Exception; Admin findById(String id); void sendEmail(String email) throws Exception; Admin loginByPassword(LoginDto dto) throws Exception; Admin loginByEmail(LoginDto dto) throws Exception; List<Admin> findAll(); //生成token String createToken(Admin admin, long exp); void delete(String id); }
[ "1446126267@qq.com" ]
1446126267@qq.com
8d343d0a1e8a880afc5b71c3833de284c155db9b
c617d172d1e04fa12ea0c01a25c323d6f8399038
/Android-tracker/app/src/main/java/ru/jumatiy/tracker/api/StringConverter.java
2b2b1e8b44b2e6b00df052ecf15c96854a067bd9
[ "MIT" ]
permissive
zhum/AndroidTracker
51f9a8156b84365b1c2868fc52fb05d96c441868
8b89043a4c434ced09667f1e515369d55a47a10e
refs/heads/master
2021-01-19T13:52:51.013974
2015-05-07T08:42:55
2015-05-07T08:42:55
35,208,446
0
0
null
null
null
null
UTF-8
Java
false
false
1,314
java
package ru.jumatiy.tracker.api; import retrofit.converter.ConversionException; import retrofit.converter.Converter; import retrofit.mime.TypedInput; import retrofit.mime.TypedOutput; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Type; /** * Created by Sarimsakov Bakhrom Azimovich on 24.03.2015 11:07. */ public class StringConverter implements Converter { @Override public Object fromBody(TypedInput typedInput, Type type) throws ConversionException { String text = null; try { text = fromStream(typedInput.in()); } catch (IOException ignored) {/*NOP*/ } return text; } @Override public TypedOutput toBody(Object o) { return null; } public static String fromStream(InputStream in) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder out = new StringBuilder(); String newLine = System.getProperty("line.separator"); String line; while ((line = reader.readLine()) != null) { out.append(line); out.append(newLine); } return out.toString(); } }
[ "serg@parallel.ru" ]
serg@parallel.ru
96fbca5b4a6018adbaaa5b0300ce24be4cb298bd
401ec291fc7457c3642f4c277c6185e7062d6c01
/src/Control/Main.java
ef1187fbb848f96466c12036eb1e9e780147c41c
[]
no_license
ruancb/licensemonitor
34bf1a36f60ebc18b4ebcbfaa5cd5fdc480d8639
72acc4b06d6c87357607000b8a7947e395f80093
refs/heads/master
2021-01-13T01:36:53.254087
2015-03-27T15:54:55
2015-03-27T15:54:55
32,863,103
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package Control; import java.io.IOException; import java.sql.SQLException; import java.text.ParseException; /** * Main class. Instances a GUI. * @author Ruan Costa Borges * @since 1.0 * @version 1.2 * */ public class Main { private static Processa run; /** * Starts the processing creating the GUI. * @param args * Default parameter of Java void main * @throws IOException * Returns a error with read/write access. * @throws ParseException * Returns a error with date conversion. * @throws SQLException * Returns a error with database, for instance a SQL statement error. */ public static void main(String[] args) throws IOException, ParseException, SQLException { run = new Processa(); } }
[ "edd.leite@gmail.com" ]
edd.leite@gmail.com
24857649dae279be49afd70595545cb7984fb79d
5ae92e18e41bdde891eb8250862700029733fed7
/orgainfo/src/orgainfo/OIProgramas.java
19356818a4ba9e0cee49796c3841ff5cdb19f87d
[]
no_license
alesscor/costa_rica-ucr-tdderive-2006
beb614de6073dc6e9952a674f75c935d82e06706
7781165448f6652faead0b2ec56f3fed96f8bbe0
refs/heads/master
2021-04-26T16:43:46.094929
2015-11-16T05:18:09
2015-11-16T05:18:09
46,249,593
0
0
null
null
null
null
ISO-8859-1
Java
false
false
5,202
java
package orgainfo; import java.sql.ResultSet; import java.sql.SQLException; import tdutils.tdutils; /** * Guarda información sobre los programas de aplicación que * se registran para poder ser llamados en <tt>tdderive</tt>. */ public class OIProgramas extends OIPersistente implements OIActualiza { protected String alias; protected String nombre_aplicacion; protected String ruta; protected String clase; protected long tiempo_ensistema; protected long periodo_confirmacion; protected long umbral_espera; protected boolean si_cambiarcompu; protected String divisora; protected String unificadora; protected OIProgramas(){ super(null,false); } protected OIProgramas(OIDescriptor info0,boolean sivacio){ super(info0,sivacio); } public void open(){ } public void delete(){ } public void close(){ } public void creaVacio(){ } public void creaUltimo(){ } protected void openRS(ResultSet rs) throws SQLException{ alias=rs.getString("alias"); nombre_aplicacion=rs.getString("nombre_aplicacion"); ruta=rs.getString("ruta"); clase=rs.getString("clase"); divisora=rs.getString("divisora"); unificadora=rs.getString("unificadora"); tiempo_ensistema=rs.getLong("tiempo_ensistema"); periodo_confirmacion=rs.getLong("periodo_confirmacion"); umbral_espera=rs.getLong("umbral_espera"); si_cambiarcompu=rs.getBoolean("si_cambiarcompu"); } // static void openMapXML(String URI,java.util.Map map)throws OIExcepcion{ // _openMapXML(URI,null,map); // } // static void openMapXML(Node nodo,java.util.Map map)throws OIExcepcion{ // _openMapXML(null,nodo,map); // } // private static void _openMapXML(String URI,Node nodo,java.util.Map map) // throws OIExcepcion{ // LEEProgramas lista=new LEEProgramas(); // LEEProgramas.LEEPrograma prograI; // java.util.Iterator itr; // try { // if(nodo!=null){ // lista.setFromXMLNode(nodo); // }else{ // lista.setFromXMLURI(URI); // } // } // catch (MENSException ex) { // throw new OIExcepcion("Error al abrir archivo de programas.",ex); // } // itr=lista.programas.values().iterator(); // while(itr.hasNext()){ // prograI=(LEEProgramas.LEEPrograma)itr.next(); // map.put(prograI.progra.alias,prograI.progra); // } // } // // static void openMap(OIDescriptor info0,java.util.Map map)throws OIExcepcion{ // ResultSet resDB; // OIProgramas progra; // // // // carga programas // // // resDB=getRSSQL(info0,"SELECT * from programas"); // try { // if(resDB==null||!resDB.next()){ // // no hay programas // }else{ // // sí se tienen programas // do{ // progra=new OIProgramas(info0,false); // progra.openRS(resDB); // map.put(progra.alias,progra); // }while(resDB.next()); // resDB.close(); // } // }catch (SQLException ex) { // throw new OIExcepcion("No se tiene acceso a la base de datos.",ex); // } // } // static void writeMap(OIDescriptor info0,java.util.Map map)throws OIExcepcion{ // java.util.Iterator itr=null; // OIProgramas progra; // int res=0; // res = doUpdateSQL(info0, "delete from programas"); // itr = map.values().iterator(); // while (itr.hasNext()) { // progra = (OIProgramas) itr.next(); // progra.info = info0; // progra.write(); // } // } public void write()throws OIExcepcion{ int res=0; // // actualiza // res = doUpdateSQL("UPDATE Programas set " + "alias=" + tdutils.getQ(alias) + ",nombre_aplicacion=" + tdutils.getQ(nombre_aplicacion) + ",ruta=" + tdutils.getQ(ruta) + ",clase=" + tdutils.getQ(clase) + ",divisora=" + tdutils.getQ(divisora) + ",unificadora=" + tdutils.getQ(unificadora) + ",tiempo_ensistema=" + tiempo_ensistema + ",periodo_confirmacion=" + periodo_confirmacion + ",umbral_espera=" + umbral_espera + ",si_cambiarcompu=" + si_cambiarcompu + " WHERE alias=" + tdutils.getQ(alias)); // // si actualización no sirve, hace un insert // if (res==0) { res = doUpdateSQL("insert into Programas (alias,nombre_aplicacion," + "ruta,clase,divisora,unificadora,tiempo_ensistema," + "periodo_confirmacion,"+ "umbral_espera,si_cambiarcompu) values(" + tdutils.getQ(alias) + "," + tdutils.getQ(nombre_aplicacion) + "," + tdutils.getQ(ruta) + "," + tdutils.getQ(clase) + "," + tdutils.getQ(divisora) + "," + tdutils.getQ(unificadora) + "," + tiempo_ensistema + "," + periodo_confirmacion + "," + umbral_espera + "," + si_cambiarcompu + ")"); } if (res==0) { throw new OIExcepcion( "No se pudo actualizar lista de programas."); } } }
[ "alesscor@gmail.com" ]
alesscor@gmail.com
1e61aaaf4ccc34054b35cf606430b9fa996e09d9
c6d42b954e3206d3e0540dfeca62f455eeb48d77
/src/main/java/com/troyberry/util/data/UpdateTimeStamp.java
dbc8f9a79c1c85c734e5b76db65cccb8c09825f8
[]
no_license
TroyNeubauer/Troy-Berry-Core
bfc170485ea9f0e0981792e0e694de70b777922d
d7f3a914ab4887cbd999cdfcc30e1694ec513b54
refs/heads/master
2020-12-08T01:11:50.610185
2019-06-14T16:32:28
2019-06-14T16:32:28
66,308,129
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package com.troyberry.util.data; public class UpdateTimeStamp { private long time; private double targetUPS; private UpdateTimeStampManager manager; public UpdateTimeStamp(UpdateTimeStampManager manager, long time, double targetUPS) { this.time = time; this.targetUPS = targetUPS; this.manager = manager; this.manager.add(this); } public long getTime() { return time; } public double getTargetUPS() { return targetUPS; } @Override public String toString() { return "UpdateTimeStamp [time=" + time + ", targetUPS=" + targetUPS + "]"; } }
[ "troyneubauer@gmail.com" ]
troyneubauer@gmail.com
58f76a05b5f6ecb068c388b2d640778fe7b6084d
c1f957b3f9544ea18c044491934985ab497cc935
/src/main/java/com/gjxaiou/util/PathUtil.java
1a8e65cf7b66f7a1e520421c0216d3d56f569868
[ "Apache-2.0" ]
permissive
GJXAIOU/O2O
d0c9d33d3ed3b843e54a7c1e97e835a2dcaf67cf
c927c85c94f6906d0d5a6d73e1ee12a14f3170d2
refs/heads/master
2022-12-23T17:32:15.610290
2020-07-31T14:59:35
2020-07-31T14:59:35
238,706,100
1
1
Apache-2.0
2022-12-16T05:08:24
2020-02-06T14:22:50
Java
UTF-8
Java
false
false
1,436
java
package com.gjxaiou.util; /** * @author GJXAIOU * @create 2019-10-17-16:53 */ public class PathUtil { /** * 获取系统文件路径的分隔符 */ private static String separator = System.getProperty("file.separator"); // 返回项目图片的根路径 public static String getImgBasePath(){ // 获取操作系统名称 String os = System.getProperty("os.name"); String basePath = ""; // 不能将图片放在项目之下,否则每次重启就会将后生成的图片删除 if (os.toLowerCase().startsWith("win")){ basePath="E:/Program/Java/Project/o2oImage"; }else{ basePath = "/project/o2oImage"; } basePath = basePath.replace("/", separator); return basePath; } // 返回项目图片子路径 public static String getShopImagePath(long shopId){ String imagePath = "upload/item/shop/" + shopId + "/"; return imagePath.replace("/", separator); } /** * 获取首页头图路径 */ public static String getHeadLineImagePath() { String imagePath = "upload/item/headLine/"; return imagePath.replace("/", separator); } /** * 获取店铺类别路径 */ public static String getShopCategoryImagePath() { String imagePath = "upload/item/shopCategory/"; return imagePath.replace("/", separator); } }
[ "gjx1690048420@163.com" ]
gjx1690048420@163.com
c96de65ae038f6d37e0d7f50b80f44d6310d8ba8
0d7697270518c4ac909f6bbbd7795e8424986c3f
/DesignPattern/src/com/behavioral/memento/FileWriterUtil.java
4ab36ba4a07a5d67811f1e7910d1d9d4bbcdc52e
[]
no_license
ajayprasad1982/datastructureandalgorithm
0d6d6adcd3b45551dd1abb70957289996ff46499
e783efee28e3b560c82cfb8e5aaff4aa6a4a562a
refs/heads/master
2020-12-03T04:00:03.266718
2017-07-01T06:37:04
2017-07-01T06:37:04
95,800,771
0
0
null
null
null
null
UTF-8
Java
false
false
861
java
/** * */ package com.behavioral.memento; /** * @author aprasa03 * */ public class FileWriterUtil { private String fileName; private StringBuilder content; public FileWriterUtil(String file) { this.fileName=file; content=new StringBuilder(); } public Memento save() { return new Memento(this.fileName,this.content); } public void write(String mesg){ content.append(mesg); } public void undoToLastSave(Object obj) { Memento mem=Memento.class.cast(obj); this.fileName=mem.fileName; this.content=mem.content; } @Override public String toString() { return content.toString(); } private class Memento{ private String fileName; private StringBuilder content; public Memento(String file,StringBuilder content) { this.fileName=file; this.content=new StringBuilder(content); } } }
[ "APrasad2@HIBACL65001.ad.harman.com" ]
APrasad2@HIBACL65001.ad.harman.com
6fa4c990af12e9432044ce87e775abdd2b02ae1b
094abc16bdfb331ab7688e164c155365c189287b
/src/main/java/cn/lxj/chapter3/connector/http/HttpConnector.java
e49096255013d3466a125a3bf2a5a4f4fd5a8a14
[]
no_license
lixinjiang/tomcat-study1
aedc0c8163689da213805ea1b334d504d794e05b
d8d7c77f047a1b69a34795ecc87d0074db20af95
refs/heads/master
2020-03-22T05:32:24.760610
2018-07-09T12:08:46
2018-07-09T12:08:46
139,573,026
0
0
null
null
null
null
UTF-8
Java
false
false
1,352
java
package cn.lxj.chapter3.connector.http; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; /** * HttpConnector * description 连接器由于实现了Runnable接口,所以能被自己的线程专用 * create by lxj 2018/7/6 **/ public class HttpConnector implements Runnable{ boolean stopped; private String scheme = "http"; public String getScheme() { return scheme; } public void run() { // the server socket ServerSocket serverSocket = null; int port = 8080; try { serverSocket = new ServerSocket(port,1, InetAddress.getByName("127.0.0.1")); } catch (IOException e) { e.printStackTrace(); System.exit(1); } while (!stopped){ // Accept the next incoming connection from the server socket Socket socket = null; try { socket = serverSocket.accept(); } catch (IOException e) { continue; } // Hand this socket off to an HttpProcessor HttpProcessor httpProcessor = new HttpProcessor(this); httpProcessor.process(socket); } } public void start(){ Thread thread = new Thread(this); thread.start(); } }
[ "1185860710@qq.com" ]
1185860710@qq.com
966b693a881da604ce63035b710fca2d7cb71299
3bbf168e79101b3bff04a0c7d88db3ad268fab02
/src/main/java/activity/activitytrackerjpa/TrackPoint.java
767c009c880dd08199a166c3e742cdb420e54aec
[]
no_license
tlev159/activitytrackerjpa
f9738f6dcf86d5ee6becc32b1092c05593c2fd09
ea89025b6ac8af0a2b1f070b6f5d44ed6eddeb81
refs/heads/master
2023-06-24T17:59:19.277662
2021-07-25T20:40:22
2021-07-25T20:40:22
389,437,175
0
0
null
null
null
null
UTF-8
Java
false
false
1,021
java
package activity.activitytrackerjpa; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; import java.time.LocalDate; @Entity @Table(name = "track_points") @AllArgsConstructor @NoArgsConstructor @Data public class TrackPoint { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(nullable = false) @OrderBy private LocalDate time; @Column(name = "latitude") private double lat; @Column(name = "longitude") private double lon; @ManyToOne private Activity activity; public TrackPoint(LocalDate time, double lat, double lon) { this.time = time; this.lat = lat; this.lon = lon; } public LocalDate getTime() { return time; } @Override public String toString() { return "TrackPoint{" + "time=" + time + ", lat=" + lat + ", lon=" + lon + '}'; } }
[ "t.levente1598@gmail.com" ]
t.levente1598@gmail.com
0ce3d1e46effece1301f529f1a3b8aedfb704819
8da33d8a4e34eced3726c6872fe30779ff0d1933
/src/main/java/com/sh/yhby/client/watcher/impl/DefaultOffLineWatcher.java
c9aadc05dbf09d8b533ac8f85dba892eb3bad5c6
[]
no_license
shihao1001/srv-socket-netty
6f6696904058034c65feb2cb333bca76694d8914
82df46555e62f928ae98ed327917d8bdbc0c1a28
refs/heads/master
2021-01-21T13:18:26.714829
2016-04-20T03:07:10
2016-04-20T03:07:10
50,323,046
1
0
null
null
null
null
UTF-8
Java
false
false
1,985
java
package com.sh.yhby.client.watcher.impl; import com.sh.yhby.client.cache.ClientCache; import com.sh.yhby.client.main.NettyClient; import com.sh.yhby.client.watcher.inter.OffLineWatcher; public class DefaultOffLineWatcher implements OffLineWatcher { public void reconnect() { int reConnectCount = 0; while(true){ if(ClientCache.client == null){ NettyClient client = new NettyClient("127.0.0.1", 9000); client.setOffLineWatcher(new DefaultOffLineWatcher()); boolean isSussess = client.login(); if(isSussess){ break; } }else{ if(ClientCache.client.isShutdown){ NettyClient client = new NettyClient("127.0.0.1", 9000); client.setOffLineWatcher(new DefaultOffLineWatcher()); client.login(); if(client.getSocketChannel() != null){ ClientCache.client = client; reConnectCount = 0; break; }else{ reConnectCount++; if(reConnectCount <=5){ try { System.out.println("重试:"+reConnectCount+"次,等待:"+(reConnectCount * 5) + "秒"); Thread.sleep(reConnectCount * 5 * 1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }else if(reConnectCount > 5 && reConnectCount < 10){ try { System.out.println("重试:"+reConnectCount+"次,等待:"+(reConnectCount - 5) + "分钟"); Thread.sleep( (reConnectCount - 5) * 60 * 1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }else if(reConnectCount == 10){ try { reConnectCount = 0; System.out.println("重试:"+10+"次,等待半小时"); Thread.sleep(30 * 60 * 1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } } }
[ "314986623@qq.com" ]
314986623@qq.com
817916aa20ee93dc2d83a719aea5624f6cf2dad5
fb5dedfb0c614ca04b8cb85d436e29ea46411ccf
/src/test/java/io/github/nickmacdon/utility/debug/flightrecorder/FlightRecorderTestEvents.java
89779a634db177c7ed206bc2164bd3f09d4853e9
[ "Apache-2.0" ]
permissive
NickMacDon/BasicJavaFlightRecorder
b93f39b0a85451fe61ee41832844cecd3df08dc8
dc296b21543cc4d76b5e46bc164d6b6615f3ef00
refs/heads/master
2020-05-02T10:22:21.987086
2019-03-27T10:56:28
2019-03-27T10:56:28
177,895,321
1
0
null
null
null
null
UTF-8
Java
false
false
1,588
java
package io.github.nickmacdon.utility.debug.flightrecorder; /* * This code is part of https://github.com/NickMacDon/BasicJavaFlightRecorder * This code is licensed with the Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0 * Written by Nick MacDonald (C) 2019 * * This is an example of code you will actually have to write for yourself. These are the * actual events that will be logged. They need to be assigned unique IDs or else you * won't be able to analyze the log meaningfully later. Your enum will likely be * virtually identical in structure otherwise. You can use DefaultFlightRecorderEvent to * save having to make your own implementation of FlightRecorderEvent. */ import io.github.nickmacdon.utility.debug.flightrecorder.DefaultFlightRecorderEvent; import io.github.nickmacdon.utility.debug.flightrecorder.FlightRecorderEvent; import io.github.nickmacdon.utility.debug.flightrecorder.FlightRecorderEventID; enum FlightRecorderTestEvents implements FlightRecorderEventID { FLIGHT_RECORDER_TEST_EVENT1(1), FLIGHT_RECORDER_TEST_EVENT2(2), FLIGHT_RECORDER_TEST_EVENT3(3) ; private final long eventID; FlightRecorderTestEvents(final long eventID) { this.eventID = eventID; } @Override public String getEventName() { return toString(); } @Override public long getEventID() { return eventID; } public FlightRecorderEvent getEvent(final long sequenceNumber) { final long timeStamp = System.currentTimeMillis(); return new DefaultFlightRecorderEvent(timeStamp, sequenceNumber, this); } }
[ "NickMacD.GitHub@gmail.com" ]
NickMacD.GitHub@gmail.com
bb3a1305439449bbbd1674b40e59800ce5f78335
fc5d8a7eab8895e20c7b4a18d84ae660e211a987
/app/src/main/java/com/wherego/delivery/driver/model/earnings/EarningRes.java
b5bdf1c386471d71eb52e08fda6c808adbb1fdb0
[]
no_license
muthu23/WhereGoDriver
b82af5fd8a53871f2d4ef5059f4747d4c486b0db
c3f8088bb481edda9c1f3b3ff956f3b34bcdb66e
refs/heads/master
2023-01-11T04:29:20.220958
2020-11-16T18:21:58
2020-11-16T18:21:58
293,915,684
0
0
null
null
null
null
UTF-8
Java
false
false
974
java
package com.wherego.delivery.driver.model.earnings; import java.util.List; import com.google.gson.annotations.SerializedName; public class EarningRes { @SerializedName("rides") private List<Ride> mRides; @SerializedName("rides_count") private RidesCount mRidesCount; @SerializedName("target") private String mTarget; @SerializedName("user") private Long mUser; public List<Ride> getRides() { return mRides; } public void setRides(List<Ride> rides) { mRides = rides; } public RidesCount getRidesCount() { return mRidesCount; } public void setRidesCount(RidesCount ridesCount) { mRidesCount = ridesCount; } public String getTarget() { return mTarget; } public void setTarget(String target) { mTarget = target; } public Long getUser() { return mUser; } public void setUser(Long user) { mUser = user; } }
[ "muthukumar@appoets.com" ]
muthukumar@appoets.com
328464798f0dfa9ec93f237eaff7b3d1d47b4f9a
734352ba5e541239824c214abf28121f44343b96
/trips-ejb-module/src/com/technobrain/trips/reference/model/RefComTaxes.java
1ac79da13d00d9b738b9a58d07e00b5d387c1fc3
[]
no_license
vsankara/Kyron
cb2b9877aa12d06604602932e3cc812a71c298c4
4a0c0babd8ebbb707087abdd7fccff93e1412abc
refs/heads/master
2021-01-10T01:32:25.599954
2015-12-04T17:51:35
2015-12-04T17:51:35
47,420,279
0
0
null
null
null
null
UTF-8
Java
false
false
3,267
java
package com.technobrain.trips.reference.model; import java.io.Serializable; import java.sql.Timestamp; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.SequenceGenerator; import javax.persistence.Column; import javax.persistence.Entity;import com.technobrain.trips.core.model.BaseNormalModelObject; import com.technobrain.trips.core.model.BaseModelObject; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQuery; import javax.persistence.Table; @Entity @NamedQuery(name = "RefComTaxes.findAll", query = "select o from RefComTaxes o") @Table(name = "REF_COM_TAXES") public class RefComTaxes extends BaseNormalModelObject { private String band; @Column(name="COMM_CODE", nullable = false) private String commCode; @Column(name="DATE_APPLIES") private Timestamp dateApplies; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ref_com_taxes_seq") @SequenceGenerator(name = "ref_com_taxes_seq", sequenceName = "ref_com_taxes_seq", allocationSize = 1) @Column(nullable = false) private Long id; @Column(nullable = false) private Long seq; @ManyToOne @JoinColumn(name = "AGREEMENT_CODE", referencedColumnName = "CODE") private RefCustAgreementCode refCustAgreementCode; @ManyToOne @JoinColumn(name = "TAX_TYPE", referencedColumnName = "CODE") private RefCustTaxType refCustTaxType; @Column(name="EFFECTIVE_DATE") private Timestamp effectiveDate; @Column(name="EXPIRY_DATE") private Timestamp expiryDate; public RefComTaxes() { } public String getBand() { return band; } public void setBand(String band) { this.band = band; } public String getCommCode() { return commCode; } public void setCommCode(String commCode) { this.commCode = commCode; } public Timestamp getDateApplies() { return dateApplies; } public void setDateApplies(Timestamp dateApplies) { this.dateApplies = dateApplies; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getSeq() { return seq; } public void setSeq(Long seq) { this.seq = seq; } public RefCustAgreementCode getRefCustAgreementCode() { return refCustAgreementCode; } public void setRefCustAgreementCode(RefCustAgreementCode refCustAgreementCode) { this.refCustAgreementCode = refCustAgreementCode; } public RefCustTaxType getRefCustTaxType() { return refCustTaxType; } public void setRefCustTaxType(RefCustTaxType refCustTaxType) { this.refCustTaxType = refCustTaxType; } public void setEffectiveDate(Timestamp effectiveDate) { this.effectiveDate = effectiveDate; } public Timestamp getEffectiveDate() { return effectiveDate; } public void setExpiryDate(Timestamp expiryDate) { this.expiryDate = expiryDate; } public Timestamp getExpiryDate() { return expiryDate; } }
[ "vinai.sankara@technobraingroup.com" ]
vinai.sankara@technobraingroup.com
5d660b4fd21c485330ab110ed4ac8e96a88f3d02
52370789b63b959b9e73e652dac172e1e9906201
/Workspace/Section4.3/src/com/android/Animal.java
e7e97c129ea991daeb346b54dbdbe742f8389315
[]
no_license
jasonthorne/OCA_JavaProgrammer
3905cb2a3cbe1e501db99205f9cdbe7380c63377
6f12d90886e8c06440a97e72f73d3cdd5da1c26a
refs/heads/master
2021-07-06T02:45:24.049338
2020-09-23T21:05:07
2020-09-23T21:05:07
177,753,950
2
0
null
null
null
null
UTF-8
Java
false
false
1,390
java
package com.android; public abstract class Animal { //cant create objects from an abstract class ++++++++++++++++++++++++ int age=23; void eat() { System.out.println("animal eating"); } //Any class that inherits from animal HAS to override this drink method: abstract void drink(); //inherited classes can choose whether to override or not void sleep() { System.out.println("Animal sleeping"); } }//end of animal class Monkey extends Animal{ //The monkey class HAS TO override the Drink method, as the drink() method is abstract, and this method is extending from Animal. @Override void drink() { System.out.println("Monkey drinking"); } //the Monkey class has it's own method climb() void climb() { System.out.println("Monkey climbing"); } }//animal class Hippo extends Animal{ @Override void drink() { System.out.println("hippo drinking"); } //overriding the sleep method from the animal class. You dont have void sleep() { System.out.println("hippo sleeping"); } public void swim() { System.out.println("hippo swimming"); } } class Bird extends Animal{ @Override void drink() { System.out.println("bird drinking"); } //we choose to override the eat method of the Animal class void eat() { System.out.println("bird eating"); } void fly() { System.out.println("bird flying"); } }
[ "jasonthorne@live.ie" ]
jasonthorne@live.ie
5668a01fe784967c308725c6483cc950492e0053
c59f24c507d30bbb80f39e9a4f120fec26a43439
/code-of-test/src/ditb/ycsb/measurements/package-info.java
e4dd7b4d9891ee3ff9bee22b33e716d6fedd01b7
[ "Apache-2.0" ]
permissive
fengchen8086/ditb
d1b3b9c8cf3118fb53e7f2720135ead8c8c0829b
d663ecf4a7c422edc4c5ba293191bf24db4170f0
refs/heads/master
2021-01-20T01:13:34.456019
2017-04-24T13:17:23
2017-04-24T13:17:23
89,239,936
13
3
Apache-2.0
2023-03-20T11:57:01
2017-04-24T12:54:26
Java
UTF-8
Java
false
false
733
java
/* * Copyright (c) 2017 YCSB contributors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. See accompanying * LICENSE file. */ /** * The YCSB measurements package. */ package ditb.ycsb.measurements;
[ "fengchen8086@gmail.com" ]
fengchen8086@gmail.com
66922edbf3d18f3007b4b477cb562c5e2a78aa77
27c687672269dd021782ee58a314fb6b94ac6ac3
/Mua_ban_online/Mua_ban_online-ejb/src/java/com/entity/KhachHang.java
d016de23bf54f8efe5889897d23cedb9c567f76c
[]
no_license
haithanh1/haithanh1
bee17f260edc15d05c8797b45fd7b25d5c09bb1e
918f34de220229075ad32ad22f1c25249269b143
refs/heads/master
2020-05-21T06:26:25.342474
2017-03-14T11:06:05
2017-03-14T11:06:50
84,588,596
0
0
null
null
null
null
UTF-8
Java
false
false
4,884
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.entity; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlRootElement; /** * * @author username */ @Entity @Table(name = "khach_hang") @XmlRootElement @NamedQueries({ @NamedQuery(name = "KhachHang.findAll", query = "SELECT k FROM KhachHang k") , @NamedQuery(name = "KhachHang.findByStt", query = "SELECT k FROM KhachHang k WHERE k.stt = :stt") , @NamedQuery(name = "KhachHang.findByFistname", query = "SELECT k FROM KhachHang k WHERE k.fistname = :fistname") , @NamedQuery(name = "KhachHang.findByLastName", query = "SELECT k FROM KhachHang k WHERE k.lastName = :lastName") , @NamedQuery(name = "KhachHang.findBySoDt", query = "SELECT k FROM KhachHang k WHERE k.soDt = :soDt") , @NamedQuery(name = "KhachHang.findByEmail", query = "SELECT k FROM KhachHang k WHERE k.email = :email") , @NamedQuery(name = "KhachHang.findByDiachi", query = "SELECT k FROM KhachHang k WHERE k.diachi = :diachi")}) public class KhachHang implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @NotNull @Column(name = "STT") private Integer stt; @Basic(optional = false) @NotNull @Size(min = 1, max = 30) @Column(name = "Fist_name") private String fistname; @Basic(optional = false) @NotNull @Size(min = 1, max = 30) @Column(name = "last_name") private String lastName; @Basic(optional = false) @NotNull @Column(name = "so_dt") private int soDt; // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation @Size(max = 50) @Column(name = "email") private String email; @Basic(optional = false) @NotNull @Size(min = 1, max = 50) @Column(name = "diachi") private String diachi; @JoinColumn(name = "maKH", referencedColumnName = "MaKH") @ManyToOne(optional = false) private Login maKH; public KhachHang() { } public KhachHang(Integer stt) { this.stt = stt; } public KhachHang(Integer stt, String fistname, String lastName, int soDt, String diachi) { this.stt = stt; this.fistname = fistname; this.lastName = lastName; this.soDt = soDt; this.diachi = diachi; } public Integer getStt() { return stt; } public void setStt(Integer stt) { this.stt = stt; } public String getFistname() { return fistname; } public void setFistname(String fistname) { this.fistname = fistname; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getSoDt() { return soDt; } public void setSoDt(int soDt) { this.soDt = soDt; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getDiachi() { return diachi; } public void setDiachi(String diachi) { this.diachi = diachi; } public Login getMaKH() { return maKH; } public void setMaKH(Login maKH) { this.maKH = maKH; } @Override public int hashCode() { int hash = 0; hash += (stt != null ? stt.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 KhachHang)) { return false; } KhachHang other = (KhachHang) object; if ((this.stt == null && other.stt != null) || (this.stt != null && !this.stt.equals(other.stt))) { return false; } return true; } @Override public String toString() { return "com.entity.KhachHang[ stt=" + stt + " ]"; } }
[ "thanh.cs.161@gmail.com" ]
thanh.cs.161@gmail.com
b6b2d7e3e04c4d5cf7486b0aad545f43a2e9517d
a57ac3660186359cb1c6737dced7784341977d2e
/src/model/tokens/Operator.java
6fa42808e4f22f41909dac04921ef09545ab3a51
[]
no_license
yangsu/Picassa
5a4208490be2be41c6fb8f0a12e31c331f26af89
32ddd187aef0f38ab4592835bb86e99221f270e0
refs/heads/master
2021-01-19T18:54:19.321257
2014-03-06T11:40:43
2014-03-06T11:40:43
2,546,304
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package model.tokens; import model.util.PicassaException; /** * This class specifies how an operator gets the number of operands it needs. * Since all values are know, they are stored in the properties file * * @author Yang * */ public class Operator extends OperationToken { public Operator(String t) { super(t); } public int getNum() { String paramLoc = ""; for (String key : patternList) { if (token.matches(key)) { try { paramLoc = key + "Param"; return Integer.parseInt(resources.getString(paramLoc)); } catch (Exception e) { throw PicassaException.badResourceFile(paramLoc); } } } throw PicassaException.badResourceFile(paramLoc); } }
[ "suyang1+services@gmail.com" ]
suyang1+services@gmail.com
c54d6b089c933f9b86378159a9140056627b65ac
cb5de8cbfab1c5de8ccda75e450a746dca3965e6
/generator/src/main/java/org/jboss/logging/generator/validation/validator/StringFormatPart.java
c39fbfb547d2782ed490891610ba1b5a6a01d04a
[]
no_license
flashboss/jboss-logging-tools
3b9e768b39cbee35749b85d51d8c987767709de0
7f129cc2da0104c237ef9a0a82f3edc601b15373
refs/heads/master
2020-12-29T02:54:13.610312
2011-06-10T05:27:32
2011-06-15T18:37:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
20,118
java
package org.jboss.logging.generator.validation.validator; import java.util.Collections; import java.util.DuplicateFormatFlagsException; import java.util.IllegalFormatPrecisionException; import java.util.IllegalFormatWidthException; import java.util.LinkedHashSet; import java.util.Set; import java.util.UnknownFormatConversionException; import java.util.UnknownFormatFlagsException; /** * The parameter part of a format for {@link java.util.Formatter}. * <p/> * Represents the following format {@linkplain %[argument_index$][flags][width][.precision]conversion}. * <p/> * Date: 13.06.2011 * * @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> */ class StringFormatPart extends AbstractFormatPart { private int index; private final Set<Flag> flags; private int width; private int precision; private Conversion conversion; private Character dateTimeConversion; private final int position; /** * Creates a parameter format part. * * @param position the position in the string format. */ private StringFormatPart(final int position) { this.flags = new LinkedHashSet<Flag>(); this.position = position; } /** * Creates a parameter part of a format string. * * @param position the position of the part. * @param group the group array of the formats (must be a length of 6). * * @return the the parameter part. * * @throws IllegalArgumentException if the length of the group array is not equal to 6 or a format was invalid. */ public static StringFormatPart of(final int position, final String[] group) throws IllegalArgumentException { if (group.length != 6) { throw new IllegalArgumentException("Groups must have a length of 6."); } final StringFormatPart result = new StringFormatPart(position); int charIndex = 0; result.initIndex(group[charIndex++]); result.initFlags(group[charIndex++]); result.initWidth(group[charIndex++]); result.initPrecision(group[charIndex++]); // Handle date/time if (group[charIndex] != null && group[charIndex].equalsIgnoreCase(Conversion.DATE_TIME.asString())) { result.conversion = Conversion.DATE_TIME; result.dateTimeConversion = group[++charIndex].charAt(0); } else { result.conversion = Conversion.fromChar(group[++charIndex].charAt(0)); result.dateTimeConversion = null; } return result; } /** * Returns the format parameter index. * <p/> * If the index is inherited, {@code -1} is returned. * * @return the format parameter index. */ public int index() { return index; } /** * A collection of the flags. * * @return the flags. */ public Set<Flag> flags() { return Collections.unmodifiableSet(flags); } /** * The width for the format. * <p/> * If the width was not specified, {@code -1} is returned. * * @return the width. */ public int width() { return width; } /** * The precision for the format. * <p/> * If the precision was not specified, {@code -1} is returned. * * @return the precision. */ public int precision() { return precision; } /** * The conversion for the string format. * * @return the conversion. */ public Conversion conversion() { return conversion; } /** * The date/time conversion character. * <p/> * {@code null} if there is not date time conversion character. * * @return the date/time conversion character or {@code null}. */ public char dateTimeChar() { return dateTimeConversion; } /** * Initializes the index field based on the string. * * @param s the index in string form. * * @throws IllegalArgumentException if the string is not a number. */ private void initIndex(final String s) throws IllegalArgumentException { if (s == null) { index = 0; } else { try { index = Integer.parseInt(s.substring(0, s.length() - 1)); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid index argument.", e); } } } /** * Initializes the flags based on the string. * <p/> * Will set the {@link StringFormatPart#index} to {@code -1} if the {@link Flag#PREVIOUS} flag is found. * * @param s the flags in string form. * * @throws java.util.DuplicateFormatFlagsException * if the flag is specified more than once. */ private void initFlags(final String s) throws DuplicateFormatFlagsException { final char[] chars = s.toCharArray(); for (char c : chars) { final Flag flag = Flag.parse(c); if (flags.contains(flag)) { throw new DuplicateFormatFlagsException(String.format("Duplicate %s flag found. Current flags: %s", flag, flags)); } flags.add(flag); } if (flags.contains(Flag.PREVIOUS)) { index = -1; } } /** * Initializes the width based on the string. * * @param s the width in string form. * * @throws IllegalArgumentException the string is an invalid number. */ private void initWidth(final String s) throws IllegalArgumentException { if (s == null) { width = -1; } else { try { width = Integer.parseInt(s); if (width < 0) { throw new IllegalFormatWidthException(width); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid width argument.", e); } } } /** * Initializes the precision based on the string. * * @param s the precision in string form. * * @throws IllegalArgumentException if the precision is less than 0 or an invalid number. */ private void initPrecision(final String s) throws IllegalArgumentException { if (s == null) { precision = -1; } else { try { // Remove the '.' from the prevision precision = Integer.parseInt(s.substring(1)); if (precision < 0) throw new IllegalFormatPrecisionException(precision); } catch (NumberFormatException e) { throw new IllegalArgumentException("Invalid precision argument.", e); } } } @Override public int position() { return position; } @Override public String part() { final StringBuilder result = new StringBuilder("%"); if (index > 0) { result.append(index).append("$"); } if (!flags.isEmpty()) { for (Flag flag : flags) { result.append(flag.flag); } } if (width > 0) { result.append(width); } if (precision > 0) { result.append(".").append(precision); } result.append(conversion.asChar()); if (conversion.isDateTime() && dateTimeConversion != null) { result.append(dateTimeConversion); } return result.toString(); } @Override public String toString() { return new StringBuilder(getClass().getSimpleName()).append("[") .append("index=") .append(index) .append(", flags=") .append(flags) .append(", width=") .append(width) .append(", precision=") .append(precision) .append(", conversion=") .append(conversion) .append("]") .toString(); } /** * The flags for the string message format. * * @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> */ public enum Flag { /** * The result will be left-justified. * </p> * Works on all conversions. */ LEFT_JUSTIFY('-'), /** * The result should use a conversion-dependent alternate form. * </p> * Works on conversions {@link StringFormatPart.Conversion#OCTAL_INTEGER}, {@link StringFormatPart.Conversion#HEX_INTEGER}, all floating points * and most general conversions depending on the definition of {@link java.util.Formattable}. */ CONVERSION_DEPENDENT_ALTERNATE('#'), /** * The result will always include a sign. * </p> * Works on all floating points, {@link StringFormatPart.Conversion#DECIMAL_INTEGER}, {@link StringFormatPart.Conversion#OCTAL_INTEGER}, * {@link StringFormatPart.Conversion#HEX_INTEGER} when applied to {@link java.math.BigInteger} or * {@link StringFormatPart.Conversion#DECIMAL_INTEGER} when applied to {@code byte}, {@link Byte}, {@code short}, {@link Short}, * {@code int}, {@link Integer}, {@code long} and {@link Long}. */ INCLUDE_SIGN('+'), /** * The result will include a leading space for positive values. * </p> * Works on all floating points, {@link StringFormatPart.Conversion#DECIMAL_INTEGER}, {@link StringFormatPart.Conversion#OCTAL_INTEGER}, * {@link StringFormatPart.Conversion#HEX_INTEGER} when applied to {@link java.math.BigInteger} or * {@link StringFormatPart.Conversion#DECIMAL_INTEGER} when applied to {@code byte}, {@link Byte}, {@code short}, {@link Short}, * {@code int}, {@link Integer}, {@code long} and {@link Long}. */ SPACE_FOR_POSITIVE_VALUES(' '), /** * The result will be zero-padded. * </p> * Works on all integrals and floating points. */ ZERO_PADDED('0'), /** * The result will include locale-specific grouping separators. * </p> * Works only on {@link StringFormatPart.Conversion#DECIMAL_INTEGER} integrals and {@link StringFormatPart.Conversion#SCIENTIFIC_NOTATION}, * {@link StringFormatPart.Conversion#DECIMAL} and {@link StringFormatPart.Conversion#SCIENTIFIC_NOTATION_OR_DECIMAL} floating points. */ LOCALE_GROUPING_SEPARATOR(','), /** * The result will enclose negative numbers in parentheses. * </p> * Works only on {@link StringFormatPart.Conversion#DECIMAL_INTEGER}, {@link StringFormatPart.Conversion#OCTAL_INTEGER}, * {@link StringFormatPart.Conversion#HEX_INTEGER} when applied to {@link java.math.BigInteger} or * {@link StringFormatPart.Conversion#DECIMAL_INTEGER} when applied to {@code byte}, {@link Byte}, {@code short}, {@link Short}, * {@code int}, {@link Integer}, {@code long} and {@link Long} integrals and {@link StringFormatPart.Conversion#SCIENTIFIC_NOTATION}, * {@link StringFormatPart.Conversion#DECIMAL} and {@link StringFormatPart.Conversion#SCIENTIFIC_NOTATION_OR_DECIMAL} floating points. */ PARENTHESES_FOR_NEGATIVES('('), /** * The previous position. */ PREVIOUS('<'); /** * The character flag. */ final char flag; private Flag(final char flag) { this.flag = flag; } /** * {@inheritDoc} */ @Override public String toString() { return new StringBuilder(name()).append("(").append(flag).append(")").toString(); } /** * Checks to see if the character is a valid flag. * * @param c the character to check. * * @return the corresponding flag for the character. * * @throws java.util.UnknownFormatFlagsException * if the flag is invalid. */ public static Flag parse(final char c) throws UnknownFormatFlagsException { for (Flag flag : Flag.values()) { if (flag.flag == c) { return flag; } } throw new UnknownFormatFlagsException("Invalid flag: " + c); } } /** * The conversions for the string format. * * @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> */ public enum Conversion { /** * A boolean conversion 'c' or 'C'. */ BOOLEAN('b', true) { @Override public boolean isGeneral() { return true; } }, /** * A hexadecimal conversion 'h' or 'H'. */ HEX('h', true) { @Override public boolean isGeneral() { return true; } }, /** * A string conversion 's' or 'S'. */ STRING('s', true) { @Override public boolean isGeneral() { return true; } }, /** * A unicode conversion 'c' or 'C'. */ UNICODE_CHAR('c', true) { @Override public boolean isCharacter() { return true; } }, /** * A decimal integer conversion 'd'. */ DECIMAL_INTEGER('d', false) { @Override public boolean isIntegral() { return true; } }, /** * An octal integer conversion 'o'. */ OCTAL_INTEGER('o', false) { @Override public boolean isIntegral() { return true; } }, /** * A hexadecimal integer conversion 'x' or 'X'. */ HEX_INTEGER('x', true) { @Override public boolean isIntegral() { return true; } }, /** * A scientific notation conversion 'e' or 'E'. */ SCIENTIFIC_NOTATION('e', true) { @Override public boolean isFloatingPoint() { return true; } }, /** * A decimal conversion 'f'. */ DECIMAL('f', false) { @Override public boolean isFloatingPoint() { return true; } }, /** * A scientific notation or decimal 'g' or 'G' */ SCIENTIFIC_NOTATION_OR_DECIMAL('g', true) { @Override public boolean isFloatingPoint() { return true; } }, /** * A hexadecimal floating point number 'a' or 'A'. */ HEX_FLOATING_POINT('a', true) { @Override public boolean isFloatingPoint() { return true; } }, /** * A date or time conversion 't' or 'T'. */ DATE_TIME('t', true) { @Override public boolean isDateTime() { return true; } }, /** * A percentage conversion '%'. */ PERCENT('%', false) { @Override public boolean isPercent() { return true; } }, /** * A line separator conversion 'n'. */ LINE_SEPARATOR('n', false) { @Override public boolean isLineSeparator() { return true; } }; private final char conversion; /** * @code true} for the case should be ignored, otherwise {@code false} */ final boolean ignoreCase; /** * Private enum conversion. * * @param conversion the conversion character. * @param ignoreCase {@code true} for the case should be ignored, otherwise {@code false}. */ private Conversion(final char conversion, final boolean ignoreCase) { this.conversion = conversion; this.ignoreCase = ignoreCase; } /** * If the conversion is a general conversion {@code true} is returned, otherwise {@code false}. * * @return {@code true} if a general conversion, otherwise {@code false}. */ public boolean isGeneral() { return false; } /** * If the conversion is a character {@code true} is returned, otherwise {@code false}. * * @return {@code true} if c character, otherwise {@code false}. */ public boolean isCharacter() { return false; } /** * If the conversion is an integral {@code true} is returned, otherwise {@code false}. * * @return {@code true} if an integral, otherwise {@code false}. */ public boolean isIntegral() { return false; } /** * If the conversion is a floating point {@code true} is returned, otherwise {@code false}. * * @return {@code true} if a line separator, otherwise {@code false}. */ public boolean isFloatingPoint() { return false; } /** * If the conversion is a date or time {@code true} is returned, otherwise {@code false}. * * @return {@code true} if a date or time, otherwise {@code false}. */ public boolean isDateTime() { return false; } /** * If the conversion is a percent {@code true} is returned, otherwise {@code false}. * * @return {@code true} if a percent, otherwise {@code false}. */ public boolean isPercent() { return false; } /** * If the conversion is a line separator {@code true} is returned, otherwise {@code false}. * * @return {@code true} if a line separator, otherwise {@code false}. */ public boolean isLineSeparator() { return false; } /** * Returns the conversion character. * * @return the conversion character. */ public char asChar() { return conversion; } /** * Returns the conversion character as a {@link String} * * @return the conversion character. */ public String asString() { return String.valueOf(conversion); } @Override public String toString() { final StringBuilder result = new StringBuilder(name()); result.append("("); result.append(conversion); if (ignoreCase) { result.append(", ").append(Character.toUpperCase(conversion)); } result.append(")"); return result.toString(); } /** * Converts the character into a conversion descriptor. * * @param c the character to convert. * * @return the conversion descriptor. * * @throws java.util.UnknownFormatConversionException * if the character is not a valid conversion format. */ public static Conversion fromChar(final char c) throws UnknownFormatConversionException { for (Conversion conversion : Conversion.values()) { if (conversion.ignoreCase && conversion.asChar() == Character.toLowerCase(c)) { return conversion; } else if (conversion.asChar() == c) { return conversion; } } throw new UnknownFormatConversionException(String.valueOf(c)); } } }
[ "jperkins@redhat.com" ]
jperkins@redhat.com
1c227691811cf51286f00f94bceab3304ec7ce8c
afc6450618eaa2e96cb76e89b5e946971bdc80e6
/src/main/java/com/example/choyxona/entity/Month.java
a4373f5ca560453430079c8456d993de373c47f7
[]
no_license
salmon97/choyxona
a28712b7f2da3ab4ae34917f0da564e1d91a9cd5
42caf0ebd105f3998ded1250e921f10719cbc3c2
refs/heads/main
2023-03-14T06:47:05.092149
2021-03-05T10:22:14
2021-03-05T10:22:14
318,156,826
0
0
null
null
null
null
UTF-8
Java
false
false
856
java
package com.example.choyxona.entity; import com.example.choyxona.entity.template.AbsNameEntity; import com.fasterxml.jackson.annotation.JsonManagedReference; import lombok.*; import org.hibernate.annotations.CreationTimestamp; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.OneToMany; import java.sql.Timestamp; import java.util.List; @Entity @AllArgsConstructor @NoArgsConstructor @Getter @Setter public class Month extends AbsNameEntity { private String nameUz; private Integer monthNum; private Integer year; @CreationTimestamp @Column(nullable = false, updatable = false) private Timestamp createdAt; @OneToMany(mappedBy = "month", cascade = CascadeType.ALL, orphanRemoval = true) @JsonManagedReference private List<Day> days; }
[ "salmon.muminov@gmail.com" ]
salmon.muminov@gmail.com
a31a8d4a94e777a3f17375359173a6a776a9459e
d1ea5077c83cb2e93fe69e3d19a2e26efe894a0e
/src/main/java/com/rograndec/feijiayun/chain/business/distr/parent/service/DistrReturnCheckService.java
b2a83b3f317109c650277ff5642b1a62cf556757
[]
no_license
Catfeeds/rog-backend
e89da5a3bf184e4636169e7492a97dfd0deef2a1
109670cfec6cbe326b751e93e49811f07045e531
refs/heads/master
2020-04-05T17:36:50.097728
2018-10-22T16:23:55
2018-10-22T16:23:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,543
java
package com.rograndec.feijiayun.chain.business.distr.parent.service; import com.rograndec.feijiayun.chain.business.distr.parent.vo.*; import com.rograndec.feijiayun.chain.common.Page; import com.rograndec.feijiayun.chain.common.Result; import com.rograndec.feijiayun.chain.common.vo.UserVO; import java.io.OutputStream; import java.util.Date; import java.util.List; import java.util.Map; public interface DistrReturnCheckService { ClickCheckHeadVO getClickCheckHead(Long enterpriseId, Long id, UserVO userVO) throws Exception; List<ClickCheckDetailVO> ClickCheckDetail(Long enterpriseId, Long id); Result<Map<String,Object>> saveDistrReturnCheck(UserVO loginUser, SaveDistrReturnCheckVO saveDistrReturnCheckVO) throws Exception; List<DistrReturnCheckVO> getDistrReturnCheckPage(int pageNo, int pageSize, Long enterpriseId, Page page, Date startTime, Date endTime, String requestUnitCode, String requestUnitName, String code, Integer distrType, String checkerName, String secondCheckerName, String orderName, String orderType, Long type); DistrReturnCheckHeadVO getDistrReturnCheckHead(Long enterpriseId, Long id, UserVO userVO) throws Exception; List<DistrReturnCheckDetailVO> getDistrReturnCheckDetail(Long enterpriseId, Long id, UserVO loginUser) throws Exception; ExportDistrReturnCheckVO exportDistrReturnCheck(UserVO loginUser, Long id) throws Exception; void exportExcel(OutputStream output, ExportDistrReturnCheckVO exportDistrReturnCheckVo, UserVO loginUser); }
[ "ruifeng.jia@rograndec.com" ]
ruifeng.jia@rograndec.com
9c4606e203149b3a4666647f807e98f7f414ae95
8ab1fdfb0c7ade60a11a74d1d73bec832057cba6
/Open Data OCDS Observer analytical app/Back end source code/src/main/java/com/dpa/kg/portal/response/ProcurementMethodDistribution.java
fccd04106da3a8c68f089082386aa07018e4743a
[]
no_license
DPAteam/Kyrgyz-Republic-Open-Data-OCDS-Transformation-Analytics
1a4ce584a3b285f53b07551abac9c2cf8923ddb5
a61f00edd9ec4b8b7747e91e7f7facbdb8d0ac48
refs/heads/master
2022-08-13T14:02:48.136398
2021-08-12T13:58:47
2021-08-12T13:58:47
246,822,734
0
3
null
2022-06-29T18:19:08
2020-03-12T11:58:49
JavaScript
UTF-8
Java
false
false
279
java
package com.dpa.kg.portal.response; import lombok.Data; import java.util.List; @Data public class ProcurementMethodDistribution { private List<LongDate> limited; private List<LongDate> open; private List<LongDate> selective; private List<LongDate> direct; }
[ "alexd@Alexs-MacBook-Pro-3.local" ]
alexd@Alexs-MacBook-Pro-3.local
ec49f37d5ca22638f68eb8d24c178d77e3472abf
47a9e194427015dcd9d05abf8ba93bb37c257aa6
/Java/College/Advanced/ThreadEg.java
c8791898c0e80bb1d40a2e183db0e565a1f0baee
[ "MIT" ]
permissive
aryankh1409/Misc-Programs
617ec53231deddf7517738a7649127935a976535
d50a1689a89d331d2567486a5dd22fb2311a0d87
refs/heads/master
2023-05-27T20:58:54.876607
2021-03-21T14:09:29
2021-03-21T14:09:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,579
java
public class ThreadEg extends Thread { // @Override // public void run() { // Thread cur = currentThread(); // System.out.println(cur.getState()); // cur.setName("Siddharth"); // try{ // Thread.sleep(1000); // } catch (Exception e) { // e.printStackTrace(); // } // for(int i = 0; i<5; i++) { // System.out.println(i+" "+cur.getName()); // // cur.setName("Siddharth"); // System.out.println(cur.getState()); // } // } // public static void main(String[] args) { // System.out.println(currentThread()); // for(int i = 0; i<3;i++) { // // ThreadEg t = new ThreadEg(); // Thread t = new ThreadEg(); // System.out.println("Starting : "+t.getState()); // t.start(); // } // } // @Override // public void run() { // // Never join current thread // System.out.println("Thread started" + currentThread().getId()); // try{ // Thread.sleep(1010); // } catch (Exception e) { // e.printStackTrace(); // } // System.out.println("Thread ended" + currentThread().getId()); // } // public static void main(String[] args) { // for(int i = 0; i<3;i++) { // Thread t = new ThreadEg(); // t.start(); // try{ // t.join(); // } catch (Exception e) { // e.printStackTrace(); // } // } // } // static int a = 5; // @Override // public void run() { // // Never join current thread // System.out.println("Thread started" + currentThread().getId()); // try{ // Thread.sleep(1000); // } catch (Exception e) { // e.printStackTrace(); // } // a++; // System.out.println(a); // } // public static void main(String[] args) { // for(int i = 0; i<5;i++) { // Thread t = new ThreadEg(); // t.start(); // try{ // t.join(); // } catch (Exception e) {} // } // } static Integer a = 5; static Integer b = 6; // public static synchronized void incrementA() { // a++; // } public static void incrementA() { synchronized(a) { // cannot use int a, we need reference (Integer) synchronized(b) { a++; b++; } } } @Override public void run() { // Never join current thread System.out.println("Thread started" + currentThread().getId()); try{ Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } // synchronized(a) { // cannot use int a, we need reference (Integer) // synchronized(b) { // a++; // b++; // } // } // Instead of writing a and b, this method allows us to pass the current object instance // as parameter to this. This gives us the flexibility of not writing Integer a,b // synchronized(this) { // this.a+=this.b; // } ThreadEg.incrementA(); System.out.println(a+" "+b); } public static void main(String[] args) { for(int i = 0; i<5;i++) { Thread t = new ThreadEg(); t.start(); } } }
[ "siddharthsingharoy@gmail.com" ]
siddharthsingharoy@gmail.com
114a434175fe2e94f4a22e661b04c141510057b4
0a54d471036e17d9ac14a3245ffe9b4c3fcdf350
/BioMightWeb/src/biomight/cell/bloodandimmune/ProcessedAntigen.java
5520b1b8a64d1193e09a1e671a9d7792a30c637b
[ "Apache-2.0" ]
permissive
SurferJim/BioMight
b5914ee74b74321b22f1654aa465c6f49152a20a
3dc2c2b21bc6ece2ca9ac44f0727a433ae9f9430
refs/heads/master
2022-04-07T08:51:18.627053
2020-02-26T17:22:15
2020-02-26T17:22:15
97,385,911
3
1
null
null
null
null
UTF-8
Java
false
false
426
java
/* * Created on Oct 18, 2006 * * To change the template for this generated file go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */ package biomight.cell.bloodandimmune; /** * @author SurferJim * * To change the template for this generated type comment go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */ public class ProcessedAntigen { }
[ "noreply@github.com" ]
noreply@github.com
b84a6f563521cf5f7cd92cfecdd94d04b382ef6d
b2cdb3f9f41e24a3ba0031ba61c09fe1e235c844
/sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlCliTest.java
62d693310a8f286278bf28ab70afdfe275a2c1a0
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
jbonofre/beam
fad5be9108bd4cd90a9d811b47fc25994a13fd7e
4da548ec2191c25c4524b5a1076e09f18aeb4446
refs/heads/master
2021-06-04T07:40:10.088354
2018-01-17T06:13:09
2018-01-17T06:13:09
53,902,942
3
7
Apache-2.0
2018-04-27T21:46:51
2016-03-15T00:52:43
Java
UTF-8
Java
false
false
2,595
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.beam.sdk.extensions.sql; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.apache.beam.sdk.extensions.sql.meta.Table; import org.apache.beam.sdk.extensions.sql.meta.provider.text.TextTableProvider; import org.apache.beam.sdk.extensions.sql.meta.store.InMemoryMetaStore; import org.junit.Test; /** * UnitTest for {@link BeamSqlCli}. */ public class BeamSqlCliTest { @Test public void testExecute_createTextTable() throws Exception { InMemoryMetaStore metaStore = new InMemoryMetaStore(); metaStore.registerProvider(new TextTableProvider()); BeamSqlCli cli = new BeamSqlCli() .metaStore(metaStore); cli.execute( "create table person (\n" + "id int COMMENT 'id', \n" + "name varchar(31) COMMENT 'name', \n" + "age int COMMENT 'age') \n" + "TYPE 'text' \n" + "COMMENT '' LOCATION 'text://home/admin/orders'" ); Table table = metaStore.getTable("person"); assertNotNull(table); } @Test public void testExplainQuery() throws Exception { InMemoryMetaStore metaStore = new InMemoryMetaStore(); metaStore.registerProvider(new TextTableProvider()); BeamSqlCli cli = new BeamSqlCli() .metaStore(metaStore); cli.execute( "create table person (\n" + "id int COMMENT 'id', \n" + "name varchar(31) COMMENT 'name', \n" + "age int COMMENT 'age') \n" + "TYPE 'text' \n" + "COMMENT '' LOCATION 'text://home/admin/orders'" ); String plan = cli.explainQuery("select * from person"); assertEquals( "BeamProjectRel(id=[$0], name=[$1], age=[$2])\n" + " BeamIOSourceRel(table=[[person]])\n", plan ); } }
[ "mingmxu@ebay.com" ]
mingmxu@ebay.com
c8226d1a27a13a4820a5d736170ca0d632c39781
f488a0a6ea0014733c9a2658f19f28b581e1ced8
/src/main/java/com/example/dynamodb/repository/CustomerRepository.java
51c27a4365631952e80a5a665baad44aab095132
[]
no_license
nishant-/dynamodb-demo
6f80b49bef15ad4a00a3a406e6aa7480449fdabd
dcf42786f72004e567fdb2cadcae268a22308f92
refs/heads/master
2022-12-08T01:32:44.620019
2020-08-23T10:06:58
2020-08-23T10:06:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
721
java
package com.example.dynamodb.repository; import com.example.dynamodb.model.Customer; import org.springframework.stereotype.Repository; import software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable; import software.amazon.awssdk.enhanced.dynamodb.Key; @Repository public class CustomerRepository { private final DynamoDbTable<Customer> customerTable; public CustomerRepository(DynamoDbTable<Customer> customerTable) { this.customerTable = customerTable; } public void create(Customer customer) { customerTable.putItem(customer); } public Customer delete(Customer customer) { return customerTable.deleteItem(customer); } public Customer findByKey(Key key) { return customerTable.getItem(key); } }
[ "itisnishant@gmail.com" ]
itisnishant@gmail.com
9bb99a58cf11121b78cd54c948db2adb9eddc8ca
85a8b5c693517bf19b095692472dab905cd1479f
/src/main/java/com/semihunaldi/intellij/ideacurrency/plugin/model/SelectedExchangeCurrencyPair.java
c6f92a0f8e1c8b71123adc446d7079e931da2d4c
[ "MIT" ]
permissive
hpyfei/IdeaCurrency
efc2af1420eb157c6890e2d29f2222e8d6b3a1c3
75d253e98e10689bf7de88aeeb4559442f9bf81a
refs/heads/master
2020-06-07T03:55:24.130468
2018-03-12T11:38:06
2018-03-12T11:38:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,396
java
package com.semihunaldi.intellij.ideacurrency.plugin.model; import org.knowm.xchange.currency.CurrencyPair; import java.util.Set; /** * Created by semihunaldi on 01/12/2017 */ public class SelectedExchangeCurrencyPair { private String exchangeName; private Set<CurrencyPair> currencyPairList; public SelectedExchangeCurrencyPair(String exchangeName, Set<CurrencyPair> currencyPairList) { this.exchangeName = exchangeName; this.currencyPairList = currencyPairList; } public String getExchangeName() { return exchangeName; } public void setExchangeName(String exchangeName) { this.exchangeName = exchangeName; } public Set<CurrencyPair> getCurrencyPairList() { return currencyPairList; } public void setCurrencyPairList(Set<CurrencyPair> currencyPairList) { this.currencyPairList = currencyPairList; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SelectedExchangeCurrencyPair that = (SelectedExchangeCurrencyPair) o; return exchangeName != null ? exchangeName.equals(that.exchangeName) : that.exchangeName == null; } @Override public int hashCode() { return exchangeName != null ? exchangeName.hashCode() : 0; } }
[ "semihunaldi@gmail.com" ]
semihunaldi@gmail.com
19db9331ec147643f53c59ede15d3561e1f59bbd
447520f40e82a060368a0802a391697bc00be96f
/apks/comparison_androart/com.advantage.RaiffeisenBank/source/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java
e3af358a2920247b68c2ead83c632231c7e4e2d6
[ "Apache-2.0" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
2,983
java
package com.google.gson.internal.bind; import com.google.gson.Gson; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.internal..Gson.Types; import com.google.gson.internal.ConstructorConstructor; import com.google.gson.internal.ObjectConstructor; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.lang.reflect.Type; import java.util.Collection; import java.util.Iterator; public final class CollectionTypeAdapterFactory implements TypeAdapterFactory { private final ConstructorConstructor constructorConstructor; public CollectionTypeAdapterFactory(ConstructorConstructor paramConstructorConstructor) { this.constructorConstructor = paramConstructorConstructor; } public <T> TypeAdapter<T> create(Gson paramGson, TypeToken<T> paramTypeToken) { Type localType = paramTypeToken.getType(); Class localClass = paramTypeToken.getRawType(); if (!Collection.class.isAssignableFrom(localClass)) { return null; } localType = .Gson.Types.getCollectionElementType(localType, localClass); return new Adapter(paramGson, localType, paramGson.getAdapter(TypeToken.get(localType)), this.constructorConstructor.get(paramTypeToken)); } private static final class Adapter<E> extends TypeAdapter<Collection<E>> { private final ObjectConstructor<? extends Collection<E>> constructor; private final TypeAdapter<E> elementTypeAdapter; public Adapter(Gson paramGson, Type paramType, TypeAdapter<E> paramTypeAdapter, ObjectConstructor<? extends Collection<E>> paramObjectConstructor) { this.elementTypeAdapter = new TypeAdapterRuntimeTypeWrapper(paramGson, paramTypeAdapter, paramType); this.constructor = paramObjectConstructor; } public Collection<E> read(JsonReader paramJsonReader) throws IOException { if (paramJsonReader.peek() == JsonToken.NULL) { paramJsonReader.nextNull(); return null; } Collection localCollection = (Collection)this.constructor.construct(); paramJsonReader.beginArray(); while (paramJsonReader.hasNext()) { localCollection.add(this.elementTypeAdapter.read(paramJsonReader)); } paramJsonReader.endArray(); return localCollection; } public void write(JsonWriter paramJsonWriter, Collection<E> paramCollection) throws IOException { if (paramCollection == null) { paramJsonWriter.nullValue(); return; } paramJsonWriter.beginArray(); paramCollection = paramCollection.iterator(); while (paramCollection.hasNext()) { Object localObject = paramCollection.next(); this.elementTypeAdapter.write(paramJsonWriter, localObject); } paramJsonWriter.endArray(); } } }
[ "antal.micky@yahoo.com" ]
antal.micky@yahoo.com
c4fbd3e9a7ab1322b88e8eaa93b3d2a284c95217
8fdd6248548f7ccaac78f8d29dd2ebfedc9f1669
/Clock.java
d838699875945c2d86ce6e3a3a7cc268bac50650
[]
no_license
linklegend/automail
ffebe688e66e61521be2d964f4a110f197384b23
b70948f8e8259dab2588bace8f5c425b4fdf9dda
refs/heads/master
2021-06-27T22:59:25.525885
2017-09-15T08:30:34
2017-09-15T08:30:34
103,229,153
0
1
null
null
null
null
UTF-8
Java
false
false
422
java
package automail; public class Clock { /** Represents the current time **/ private static int Time = 0; /** The threshold for the latest time for mail to arrive **/ public static int LAST_DELIVERY_TIME = Integer.parseInt(Simulation.automailProperties.getProperty("Last_Delivery_Time")); public static int Time() { return Time; } public static void Tick() { Time++; } }
[ "link_leagend@hotmail.com" ]
link_leagend@hotmail.com
28255b6ebba9da4c689f21acb46aeafc99914af2
4ee023f80b66e5c27d2e7a2c9cc321414aa732e1
/src/main/java/com/company/dao/AssignmentDaoFromCsv.java
9b01ad50c184c189a6bfff4400fbcd18351d32cf
[]
no_license
bartoszmaleta/learningManagmentSystem
1e8d565673a570bfab67affd55f248e45244242e
f0676116463a6447c30580fb8ea9f581e813149e
refs/heads/Development
2021-05-24T08:51:12.008239
2020-04-10T12:03:17
2020-04-10T12:03:17
253,479,607
1
1
null
2020-10-13T20:57:31
2020-04-06T11:39:47
Java
UTF-8
Java
false
false
4,683
java
package com.company.dao; import com.company.dao.Parser.CsvParser; import com.company.models.Assignment; import com.company.models.users.User; import java.util.ArrayList; import java.util.List; public class AssignmentDaoFromCsv implements AssignmentDao { private final int idIndex = 0; private final int titleIndex = 1; private final int usernameIndex = 2; private final int mentorNameIndex = 3; private final int isSubmittedIndex = 4; private final CsvParser csvParser; private final List<List<String>> listOfRecords; private Assignment assignment; private String filepathOfAssignmentsCsv = "src/main/resources/assignments.csv"; public AssignmentDaoFromCsv() { this.csvParser = new CsvParser(filepathOfAssignmentsCsv); this.listOfRecords = csvParser.getUpdatedList(); } @Override public List<Assignment> extractAssignmentsFromListByStudentUsername(String studentUsernameForList) { String id, title, username, mentorName; boolean isSubmitted; List<Assignment> assignmentList = new ArrayList<>(); for (int i = 0; i < this.listOfRecords.size(); i++) { List<String> assignments = this.listOfRecords.get(i); id = assignments.get(idIndex); title = assignments.get(titleIndex); username = assignments.get(usernameIndex); mentorName = assignments.get(mentorNameIndex); isSubmitted = Boolean.parseBoolean(assignments.get(isSubmittedIndex)); if (studentUsernameForList.equals(username)) { assignmentList.add(new Assignment(Integer.parseInt(id), title, username, mentorName, isSubmitted)); } } return assignmentList; } @Override public List<Assignment> extractAllAssignments() { String id, title, username, mentorName; boolean isSubmitted; List<Assignment> assignmentList = new ArrayList<>(); for (int i = 0; i < this.listOfRecords.size(); i++) { List<String> assignments = this.listOfRecords.get(i); id = assignments.get(idIndex); title = assignments.get(titleIndex); username = assignments.get(usernameIndex); mentorName = assignments.get(mentorNameIndex); isSubmitted = Boolean.parseBoolean(assignments.get(isSubmittedIndex)); assignmentList.add(new Assignment(Integer.parseInt(id), title, username, mentorName, isSubmitted)); } return assignmentList; } @Override public void write(Assignment assignment) { String[] toStringArrayAssignment = toStringArray(assignment); this.csvParser.addNewRecord(toStringArrayAssignment); } @Override public String[] toStringArray(Assignment assignment) { String[] assignmentArray = {String.valueOf(assignment.getId()) , assignment.getTitle() , assignment.getStudentUsername() , assignment.getMentorName() , String.valueOf(assignment.getIsSubmitted())}; return assignmentArray; } @Override public void remove(Assignment assignment) { List<List<String>> newList; for (int i = 0; i < this.listOfRecords.size(); i++) { if (this.listOfRecords.get(i).get(0).equals(String.valueOf(assignment.getId()))) { this.listOfRecords.remove(this.listOfRecords.get(i)); } } newList = this.listOfRecords; String header = "id,title,studentUsername,mentorName,isSubmitted,"; this.csvParser.updateFile(newList, header); } @Override public void edit(Assignment assignment) { List<List<String>> newList; for (int i = 0; i < this.listOfRecords.size(); i++) { if (this.listOfRecords.get(i).get(0).equals(String.valueOf(assignment.getId()))) { this.listOfRecords.get(i).set(1, assignment.getStudentUsername()); this.listOfRecords.get(i).set(2, assignment.getStudentUsername()); // can't! this.listOfRecords.get(i).set(3, assignment.getMentorName()); this.listOfRecords.get(i).set(4, String.valueOf(assignment.getIsSubmitted())); } } newList = this.listOfRecords; String header = "id,title,studentUsername,mentorName,isSubmitted,"; this.csvParser.updateFile(newList, header); } @Override public int getLastIndex() { String lastElementIdString = this.listOfRecords. get(listOfRecords.size() - 1). get(idIndex); return Integer.parseInt(lastElementIdString); } }
[ "bartosz.maleta@gmail.com" ]
bartosz.maleta@gmail.com
01c251945e6445aba1aa982c174bb846031e4335
a2e2cb35cd639ccf7bbd5817cfd80d4e1e3392f2
/src/main/java/com/apap/tu04/service/FlightService.java
2882c266112ace2e6e6b3ca8d553ed89dbade4aa
[]
no_license
ichsandyrizki/tutorial-04
2b3b034d854746f7cfd62a3d49370c388026f316
9f3a5aad244702b254ffe8c5f7eb9e96351ae770
refs/heads/master
2021-01-09T11:43:58.730787
2020-02-25T16:06:22
2020-02-25T16:06:22
242,287,728
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.apap.tu04.service; import com.apap.tu04.model.FlightModel; import java.util.List; public interface FlightService { void addFlight (FlightModel flight); List<FlightModel> findAllFlightByPilotLicenseNumber(String licenseNumber); FlightModel findById (Long id); void deleteFlight(Long id); FlightModel updateFlight(FlightModel flightModel); List<FlightModel> flightList(); }
[ "ichsandy.rizki@ui.ac.id" ]
ichsandy.rizki@ui.ac.id
c10887925c018771cc43285a207805c2f55c18c4
555df093fa669afe88a6322e0e9c7b357af8ae6d
/src/GymnasieArbete/util/HUD.java
0811c1c90c45e54f5ff531b8dcc2f1eb8ad6fc35
[]
no_license
Forsaknd/GymnasieArbete
30ad0fa4ba8e0cb92a4ac5dfeab5c94246846856
8c556493b816c41217750aeb95238fedd43c07a5
refs/heads/master
2021-01-18T16:30:41.348485
2015-04-23T19:30:41
2015-04-23T19:30:41
24,386,631
0
0
null
null
null
null
UTF-8
Java
false
false
1,850
java
package GymnasieArbete.util; import java.awt.Color; import java.awt.Graphics; import java.util.ArrayList; import java.util.List; import GymnasieArbete.entities.items.Item; import GymnasieArbete.entities.items.Item.Type; import GymnasieArbete.entities.mob.Player; import GymnasieArbete.graphics.Screen; public class HUD { private Player parent; Message info = new Message(900, 650, Color.WHITE); private List<Message> ui = new ArrayList<Message>(); private List<Message> messages = new ArrayList<Message>(); public HUD(Player parent) { this.parent = parent; info.setText("Level: " + parent.getLevel() + " - " + parent.getExperience() + "/" + parent.getLevel() * 20); ui.add(info); } public void newMessage(String text, int lifespan) { Message temp = new Message(text, 550, 600, lifespan, Color.WHITE); messages.add(temp); int id = messages.indexOf(temp); if (id > 0) messages.get(id - 1).moveUp(id); } public void updateInfo(Item item) { if (parent.getEquipped().type == Type.EMPTY) { info.setText("Level: " + parent.getLevel() + " - " + parent.getExperience() + "/" + parent.getLevel() * 20); } else { info.setText("Level: " + parent.getLevel() + " - " + parent.getExperience() + "/" + parent.getLevel() * 20 + " " + item.getName() + " " + parent.getEquipped().getClipAmmo() + " / " + parent.getInventory().getRelAmmo()); } } public void render(Screen screen, Graphics g) { parent.getInventory().render(screen); parent.getHealth().render(screen); if (messages.size() > 0) { for (int i = 0; i < messages.size(); i++) { messages.get(i).render(g); if (messages.get(i).isRemoved()) { messages.remove(i); } } } if (ui.size() > 0) { for (int i = 0; i < ui.size(); i++) { ui.get(i).render(g); if (ui.get(i).isRemoved()) { ui.remove(i); } } } } }
[ "Forsaknkallstrom@gmail.com" ]
Forsaknkallstrom@gmail.com
af3df7eb793edfcf323d85c74b80e92ff2e1ea36
9d91afd6b80a87ef6852a28fb45d1ebf9aa285af
/src/main/java/com/sparta/jka/beans/Welcome.java
f9e7ba1ac617f6d1581e812bde58a3ebe4e40a56
[]
no_license
jka2498/JPARefresh
53f20d79d758e0b3e1f671c68753663254240665
679ab59b1f62d208548e2d9f27b9e57055b69c0a
refs/heads/master
2021-07-19T19:47:09.775253
2019-11-15T11:30:24
2019-11-15T11:30:24
221,910,831
0
0
null
2020-10-13T17:29:17
2019-11-15T11:30:02
HTML
UTF-8
Java
false
false
458
java
package com.sparta.jka.beans; import javax.enterprise.context.RequestScoped; import javax.inject.Named; @Named @RequestScoped public class Welcome { private String path; public String getPath() { return path; } public void setPath(String path) { this.path = path; } public String nextScreen() { if (path.equals("1")) { return "register"; } else { return "login"; } } }
[ "jkandrzej@googlemail.com" ]
jkandrzej@googlemail.com
664cf88956232362c33f01bad9150b2159d5265a
6131c9ef85d33eddaf77d34ccb97405c115219ab
/Week6/dongminSeol/Programmers_KAKAO_17682.java
bde085ce99c8f11d9d77a951880b5d53be9909c9
[]
no_license
HyeonJinGitHub/Morgorithm
8e82de87d6c76451e0f3f814cf7d956e5ddb27a8
e4d2b477130ff9211c55900b8b165b155d5c7637
refs/heads/master
2022-06-29T09:56:19.766524
2020-05-14T12:48:28
2020-05-14T12:48:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,871
java
import java.lang.reflect.Array; import java.util.*; /** * [다트 게임] * * 카카오톡 게임별의 하반기 신규 서비스로 다트 게임을 출시하기로 했다. 다트 게임은 다트판에 다트를 세 차례 던져 그 점수의 합계로 실력을 겨루는 게임으로, 모두가 간단히 즐길 수 있다. * 갓 입사한 무지는 코딩 실력을 인정받아 게임의 핵심 부분인 점수 계산 로직을 맡게 되었다. 다트 게임의 점수 계산 로직은 아래와 같다. * * 다트 게임은 총 3번의 기회로 구성된다. * 각 기회마다 얻을 수 있는 점수는 0점에서 10점까지이다. * 점수와 함께 Single(S), Double(D), Triple(T) 영역이 존재하고 * 각 영역 당첨 시 점수에서 1제곱, 2제곱, 3제곱 (점수1 , 점수2 , 점수3 )으로 계산된다. * * 옵션으로 스타상(*) , 아차상(#)이 존재 * * 스타상(*) 당첨 시 해당 점수와 바로 전에 얻은 점수를 각 2배로 만든다. * 아차상(#) 당첨 시 해당 점수는 마이너스된다. * * 스타상(*)은 첫 번째 기회에서도 나올 수 있다. * 이 경우 첫 번째 스타상(*)의 점수만 2배가 된다. (예제 4번 참고) * * 스타상(*)의 효과는 다른 스타상(*)의 효과와 중첩될 수 있다. * 이 경우 중첩된 스타상(*) 점수는 4배가 된다. (예제 4번 참고) * * 스타상(*)의 효과는 아차상(#)의 효과와 중첩될 수 있다. * 이 경우 중첩된 아차상(#)의 점수는 -2배가 된다. (예제 5번 참고) * * Single(S), Double(D), Triple(T)은 점수마다 하나씩 존재한다. * 스타상(*), 아차상(#)은 점수마다 둘 중 하나만 존재할 수 있으며, 존재하지 않을 수도 있다. * */ class Programmers_KAKAO_17682 { public static void main(String[] args) { Programmers_KAKAO_17682 p = new Programmers_KAKAO_17682(); String input = "1S2D*3T"; int result = p.solution(input); System.out.println(result); } // end main public int solution(String dartResult) { int[] result = {0}; String[] arr = splitInNum(dartResult); Stack<Score> scoreStack = new Stack<>(); Stack<Integer> num = new Stack<>(arr.length); Arrays.stream(arr).forEach(s -> scoreStack.push(new Score(s))); for(String dart : arr) { process(dart, scoreStack, num); } return 0; // scoreStack.stream() // .reduce(0, Integer::sum); } private void process(String dart, Stack<Score> scoreStack, Stack<Integer> nums) { Score s = new Score(dart); if(scoreStack.isEmpty()) { // [1] 맨 처음 보너스 처리 if(s.bonus == 'D'){ s.score = (int) Math.pow(s.score, 2); } else if(s.bonus == 'T'){ s.score = (int) Math.pow(s.score, 3); } // [2] 맨 처음 옵션 처리 if(s.bonus == '*') { s.score = s.score*2; } else if(s.bonus == '#') { s.score = -s.score; } } else { } nums.push(s.score); } private String [] splitInNum(String dartResult){ String digits = dartResult.replaceAll("\\D+",""); // 문자열에서 숫자만 걸러냄 List<String> list = new ArrayList<>(digits.length()); char[] cArr = dartResult.toCharArray(); StringBuilder sb = new StringBuilder(cArr.length); int idx = 0; for(char c : cArr) { if(Character.isDigit(c)) { if(idx==0) { sb.append(c); continue;} // 시작 루프 처리 list.add(sb.toString()); sb.delete(0, sb.length()); } sb.append(c); idx++; } list.add(sb.toString()); // 마지막 루프 처리 sb = null; return list.toArray(String[]::new); } } class Score { public int score; public char bonus; public char option; public Score(String dart) { this.score = Integer.parseInt(dart.replaceAll("\\D+","")); // 상태값 파싱 char[] cArr = dart.toCharArray(); for(char c : cArr) { switch(c) { case 'S': case 'D': case 'T': bonus = c; break; case '*': case '#': option = c; break; } } } // end Constructor // 아차상과 스타상이 겹칠 때 }
[ "sdm3285@gmail.com" ]
sdm3285@gmail.com
2e69a2a68f901f6755b7fae8f4ff867d37580e0f
0921787a5262815b8731b04bae6a3e44af75899e
/genplan/src/main/java/ru/genplan/equipment/data/SectionData.java
804c336aedfe158fa91d0f34cafbee3cd48f7276
[]
no_license
prokopsn/genplan
84cd696c9f6ee593a06bc5a10f1c20c66064f962
80bca866b19d47580161970ebf34eaced6b4a7d8
refs/heads/master
2020-03-07T22:07:18.833401
2018-04-30T08:50:37
2018-04-30T08:50:37
127,745,323
0
0
null
null
null
null
WINDOWS-1251
Java
false
false
5,883
java
package ru.genplan.equipment.data; import java.util.HashSet; import java.util.Set; public class SectionData { private int id; private int planogramId; private String name; private String sectionTag; private int equipmentType; private int sectionNo; private int x; private int y; private int z; private int width; private int height; private int depth; private int effectiveX = -1; private int effectiveY = -1; private int effectiveZ = -1; private int effectiveWidth = -1; private int effectiveHeight = -1; private int effectiveDepth = -1; private boolean leftBorder; private boolean rightBorder; private int leftOverHang; private int rightOverHang; private int sectionFixtureCount; private Set<String> secTag; /** * Номер группы секций слева. * Группой является оборудование стоящее рядом */ private int groupLeftNo; /** * Номер группы секций справа. * Группой является оборудование стоящее рядом */ private int groupRightNo; /** * Номер секции слева. * Совпадает с sectionNo */ private int leftNo; /** * Номер секции справа. * Совпадает с sectionNo */ private int rightNo; private int groupLeftEqualNo; private int groupRightEqualNo; public int getGroupLeftEqualNo() { return groupLeftEqualNo; } public void setGroupLeftEqualNo(int groupLeftEqualNo) { this.groupLeftEqualNo = groupLeftEqualNo; } public int getGroupRightEqualNo() { return groupRightEqualNo; } public void setGroupRightEqualNo(int groupRightEqualNo) { this.groupRightEqualNo = groupRightEqualNo; } public int getGroupLeftNo() { return groupLeftNo; } public void setGroupLeftNo(int groupLeftNo) { this.groupLeftNo = groupLeftNo; } public int getGroupRightNo() { return groupRightNo; } public void setGroupRightNo(int groupRightNo) { this.groupRightNo = groupRightNo; } public int getLeftNo() { return leftNo; } public void setLeftNo(int leftNo) { this.leftNo = leftNo; } public int getRightNo() { return rightNo; } public void setRightNo(int rightNo) { this.rightNo = rightNo; } public boolean getLeftBorder() { return leftBorder; } public boolean getRightBorder() { return rightBorder; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getPlanogramId() { return planogramId; } public void setPlanogramId(int planogramId) { this.planogramId = planogramId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSectionTag() { return sectionTag; } public void setSectionTag(String sectionTag) { this.sectionTag = sectionTag; if (this.secTag != null) this.secTag.clear(); } public int getEquipmentType() { return equipmentType; } public void setEquipmentType(int equipmentType) { this.equipmentType = equipmentType; } public int getSectionNo() { return sectionNo; } public void setSectionNo(int sectionNo) { this.sectionNo = sectionNo; } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public int getZ() { return z; } public void setZ(int z) { this.z = z; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public int getDepth() { return depth; } public void setDepth(int depth) { this.depth = depth; } public int getEffectiveX() { return effectiveX; } public void setEffectiveX(int effectiveX) { this.effectiveX = effectiveX; } public int getEffectiveY() { return effectiveY; } public void setEffectiveY(int effectiveY) { this.effectiveY = effectiveY; } public int getEffectiveZ() { return effectiveZ; } public void setEffectiveZ(int effectiveZ) { this.effectiveZ = effectiveZ; } public int getEffectiveWidth() { return effectiveWidth; } public void setEffectiveWidth(int effectiveWidth) { this.effectiveWidth = effectiveWidth; } public int getEffectiveHeight() { return effectiveHeight; } public void setEffectiveHeight(int effectiveHeight) { this.effectiveHeight = effectiveHeight; } public int getEffectiveDepth() { return effectiveDepth; } public void setEffectiveDepth(int effectiveDepth) { this.effectiveDepth = effectiveDepth; } public void setLeftBorder(boolean leftBorder) { this.leftBorder = leftBorder; } public void setRightBorder(boolean rightBorder) { this.rightBorder = rightBorder; } public int getLeftOverHang() { return leftOverHang; } public void setLeftOverHang(int leftOverHang) { this.leftOverHang = leftOverHang; } public int getRightOverHang() { return rightOverHang; } public void setRightOverHang(int rightOverHang) { this.rightOverHang = rightOverHang; } public Set<String> getSecTag() { if (secTag==null && sectionTag != null) { secTag = new HashSet<String>(); for(String s:sectionTag.split(";")) { secTag.add(s); } } return secTag; } public int getSectionFixtureCount() { return sectionFixtureCount; } public void setSectionFixtureCount(int sectionFixtureCount) { this.sectionFixtureCount = sectionFixtureCount; } }
[ "sn-prokop@mail.ru" ]
sn-prokop@mail.ru
36da0b6509f357d585b1bffe33990d7cd55f4bb0
ddac9188dcebf823fd23596e558d1a8916d217b0
/src/me/BadBones69/CrazyEnchantments/BS.java
b0f6e13424c4d0158cb3825c80f5054bad016074
[]
no_license
bditt/Crazy-Enchantments
ef3c81fd019558da9ad7c980109be2bbe4816f72
cad83a1ea65f4f8b21855e99bd98f7e5265752cf
refs/heads/master
2020-05-30T21:38:17.196532
2016-04-18T13:45:25
2016-04-18T13:45:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,935
java
package me.BadBones69.CrazyEnchantments; import java.util.ArrayList; import java.util.List; import java.util.Random; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; public class BS implements Listener{ @SuppressWarnings("deprecation") @EventHandler public void onBlackScroll(InventoryClickEvent e){ Player player = (Player) e.getWhoClicked(); Inventory inv = e.getInventory(); ItemStack item = e.getCurrentItem(); ItemStack c = e.getCursor(); ArrayList<String> enchants = new ArrayList<String>(); if(inv != null){ if(item.hasItemMeta()&&c.hasItemMeta()){ if(item.getItemMeta().hasLore()&&c.getItemMeta().hasDisplayName()){ if(c.getItemMeta().getDisplayName().equals(Api.color(Main.settings.getConfig().getString("Settings.BlackScroll.Name")))){ if(c.getAmount()==1){ boolean i = false; for(String l : item.getItemMeta().getLore()){ String L = Api.removeColor(l); L = L.replaceAll("I", ""); L = L.replaceAll("V", ""); L = L.substring(0, L.length()-1); for(String en : Enchantments()){ if(en.contains(L)){ enchants.add(l); i = true; } } } if(i){ e.setCancelled(true); String RealLore = pickEnchant(enchants); e.setCurrentItem(Api.removeLore(item, RealLore)); e.setCursor(new ItemStack(Material.AIR)); player.getInventory().addItem(Api.setBook(RealLore)); } } } } } } } @EventHandler public void onClick(PlayerInteractEvent e){ Player player = e.getPlayer(); if(e.getItem()!=null){ ItemStack item = e.getItem(); if(item.hasItemMeta()){ if(item.getItemMeta().hasDisplayName()){ if(item.getItemMeta().getDisplayName().equals(Api.color(Main.settings.getConfig().getString("Settings.BlackScroll.Name")))){ player.sendMessage(Api.getPrefix()+Api.color("&7Black scrolls will remove a random enchantment from your item.")); } } } } } String pickEnchant(List<String> enchants){ Random i = new Random(); return enchants.get(i.nextInt(enchants.size())); } ArrayList<String> Enchantments(){ ArrayList<String> enchants = new ArrayList<String>(); enchants.add("Gears"); enchants.add("Rocket"); enchants.add("Springs"); enchants.add("Drunk"); enchants.add("Inquisitive"); enchants.add("Life Steal"); enchants.add("Aquatic"); enchants.add("Glowing"); enchants.add("Headless"); enchants.add("Lightning"); enchants.add("Fire Shield"); enchants.add("Life Steal"); enchants.add("OverLoad"); enchants.add("Piercing"); enchants.add("Rage"); enchants.add("Wither"); return enchants; } }
[ "joewojcik14@gmail.com" ]
joewojcik14@gmail.com
fc3ffdf69fa79ffd8e22ea2fcefc7d8ee91223d2
49c5522543b960a0aaede647af180a7bf45b7a46
/LesProjectPrincipal/src/com/example/lesprojectprincipal/CameraActivity.java
a505d8e75d01c65c647af6068642b334e7becafc
[]
no_license
henriquerzo/projetoLes
ae9ace5c023d36ecf8cb86e2a2264c96e0268471
de76025d755cb5018eb96b9bd700709f1c652280
refs/heads/master
2021-03-12T23:25:02.716364
2013-09-03T04:01:47
2013-09-03T04:01:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,413
java
package com.example.lesprojectprincipal; import java.io.File; import java.net.URI; import java.net.URISyntaxException; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.support.v4.content.CursorLoader; import android.view.Menu; public class CameraActivity extends Activity { private static final int REQUEST_PICTURE = 1000; File photo = null; File _file; File _dir; private String selectedImagePath; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_camera); takePicture(); } /** * M�todo que tira uma foto. */ public void takePicture() { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); _file = new File(_dir, "myPhoto_{0}.jpg"); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(_file)); startActivityForResult(intent, 0); } /** * M�todo chamado quando a aplica��o nativa da c�mera � finalizada * @see android.app.Activity#onActivityResult(int, int, android.content.Intent) */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // Verifica o c�digo de requisi��o e se o resultado � OK (outro resultado indica que // o usu�rio cancelou a tirada da foto) Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri contentUri = Uri.fromFile(_file); String path = contentUri.toString(); // "/mnt/sdcard/FileName.mp3" try { File myfile = new File(new URI(path)); selectedImagePath = myfile.getAbsolutePath(); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } //File myFile = new File(contentUri.toString()); //selectedImagePath = getRealPathFromURI(contentUri); //showMessage("Teste de path", _file.getAbsolutePath()+""); Intent intent = new Intent(this, EscolhaDeImagem.class); //TODO //Adicionar extra com path da imagem tirada pela cam aqui //Intent intent = new Intent(this, GameActivity.class); //intent.putExtra("imagem",contentUri); //Matriz m = Matriz.getInstance(); //m.reset(); startActivity(intent); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.camera, menu); return true; } public String getRealPathFromURI(Uri contentUri) { String[] proj = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(contentUri, proj, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } /* * Pra mostrar mensagens [not used!] */ public void showMessage(String title, String msg){ AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(title); alertDialog.setMessage(msg); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Add your code for the button here. } }); // Set the Icon for the Dialog alertDialog.show(); } }
[ "henriquerzo@gmail.com" ]
henriquerzo@gmail.com
981e8b17274d8f691cf5733061e749a83c347920
3447b9cbca807cc921a3abd72094196bf4599288
/Omnom.Android/libraries/Omnom.Restaurateur/src/main/java/com/omnom/android/restaurateur/model/decode/Visitor.java
60152c3de2a9549c1a2031b7d7c61ba785202781
[]
no_license
saintlab/mobileapp_android
a1f6614d0837f0527ce426baa232916b985f4b43
14ab2f0ae62ee432a740922f5c2784799dac6a99
refs/heads/master
2021-05-29T11:32:21.305429
2015-07-02T06:24:50
2015-07-02T06:24:50
21,729,682
0
0
null
null
null
null
UTF-8
Java
false
false
121
java
package com.omnom.android.restaurateur.model.decode; /** * Created by Ch3D on 23.12.2014. */ public class Visitor { }
[ "xch3dx@gmail.com" ]
xch3dx@gmail.com
7321c3cc9d9c436b8d9229ff21fdc85e84f30a44
9cdf4a803b5851915b53edaeead2546f788bddc6
/machinelearning/4.0.x/drools-solver/drools-solver-core/src/main/java/org/drools/solver/benchmark/SolverBenchmarkSuite.java
f1187e0469d9ffc4733e3ae6d0de9d783eb0119e
[ "Apache-2.0" ]
permissive
kiegroup/droolsjbpm-contributed-experiments
8051a70cfa39f18bc3baa12ca819a44cc7146700
6f032d28323beedae711a91f70960bf06ee351e5
refs/heads/master
2023-06-01T06:11:42.641550
2020-07-15T15:09:02
2020-07-15T15:09:02
1,184,582
1
13
null
2021-06-24T08:45:52
2010-12-20T15:42:26
Java
UTF-8
Java
false
false
6,835
java
package org.drools.solver.benchmark; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; import java.util.Collections; import java.util.Comparator; import java.util.List; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamImplicit; import org.apache.commons.io.IOUtils; import org.drools.solver.config.localsearch.LocalSearchSolverConfig; import org.drools.solver.core.Solver; import org.drools.solver.core.solution.Solution; /** * @author Geoffrey De Smet */ @XStreamAlias("solverBenchmarkSuite") public class SolverBenchmarkSuite { private SolvedSolutionVerbosity solvedSolutionVerbosity = null; private File solvedSolutionFilesDirectory = null; private boolean sortSolverBenchmarks = true; private Comparator<SolverBenchmark> solverBenchmarkComparator = null; @XStreamAlias("inheritedLocalSearchSolver") private LocalSearchSolverConfig inheritedLocalSearchSolverConfig = null; @XStreamImplicit(itemFieldName = "inheritedUnsolvedSolutionFile") private List<File> inheritedUnsolvedSolutionFileList = null; @XStreamImplicit(itemFieldName = "solverBenchmark") private List<SolverBenchmark> solverBenchmarkList = null; public SolvedSolutionVerbosity getSolvedSolutionVerbosity() { return solvedSolutionVerbosity; } public void setSolvedSolutionVerbosity(SolvedSolutionVerbosity solvedSolutionVerbosity) { this.solvedSolutionVerbosity = solvedSolutionVerbosity; } public File getSolvedSolutionFilesDirectory() { return solvedSolutionFilesDirectory; } public void setSolvedSolutionFilesDirectory(File solvedSolutionFilesDirectory) { this.solvedSolutionFilesDirectory = solvedSolutionFilesDirectory; } public boolean isSortSolverBenchmarks() { return sortSolverBenchmarks; } public void setSortSolverBenchmarks(boolean sortSolverBenchmarks) { this.sortSolverBenchmarks = sortSolverBenchmarks; } public Comparator<SolverBenchmark> getSolverBenchmarkComparator() { return solverBenchmarkComparator; } public void setSolverBenchmarkComparator(Comparator<SolverBenchmark> solverBenchmarkComparator) { this.solverBenchmarkComparator = solverBenchmarkComparator; } public LocalSearchSolverConfig getInheritedLocalSearchSolverConfig() { return inheritedLocalSearchSolverConfig; } public void setInheritedLocalSearchSolverConfig(LocalSearchSolverConfig inheritedLocalSearchSolverConfig) { this.inheritedLocalSearchSolverConfig = inheritedLocalSearchSolverConfig; } public List<File> getInheritedUnsolvedSolutionFileList() { return inheritedUnsolvedSolutionFileList; } public void setInheritedUnsolvedSolutionFileList(List<File> inheritedUnsolvedSolutionFileList) { this.inheritedUnsolvedSolutionFileList = inheritedUnsolvedSolutionFileList; } public List<SolverBenchmark> getSolverBenchmarkList() { return solverBenchmarkList; } public void setSolverBenchmarkList(List<SolverBenchmark> solverBenchmarkList) { this.solverBenchmarkList = solverBenchmarkList; } // ************************************************************************ // Builder methods // ************************************************************************ public void benchmarkingStarted() { for (SolverBenchmark solverBenchmark : solverBenchmarkList) { if (inheritedLocalSearchSolverConfig != null) { solverBenchmark.inheritLocalSearchSolverConfig(inheritedLocalSearchSolverConfig); } if (inheritedUnsolvedSolutionFileList != null) { solverBenchmark.inheritUnsolvedSolutionFileList(inheritedUnsolvedSolutionFileList); } } } public void benchmark(XStream xStream) { // TODO refactor out xstream benchmarkingStarted(); solvedSolutionFilesDirectory.mkdirs(); for (SolverBenchmark solverBenchmark : solverBenchmarkList) { Solver solver = solverBenchmark.getLocalSearchSolverConfig().buildSolver(); for (SolverBenchmarkResult result : solverBenchmark.getSolverBenchmarkResultList()) { File unsolvedSolutionFile = result.getUnsolvedSolutionFile(); Solution unsolvedSolution = readUnsolvedSolution(xStream, unsolvedSolutionFile); solver.setStartingSolution(unsolvedSolution); solver.solve(); result.setTimeMillesSpend(solver.getTimeMillisSpend()); result.setScore(solver.getBestScore()); Solution solvedSolution = solver.getBestSolution(); writeSolvedSolution(xStream, result, solvedSolution); } } benchmarkingEnded(); } private Solution readUnsolvedSolution(XStream xStream, File unsolvedSolutionFile) { Solution unsolvedSolution; Reader reader = null; try { reader = new InputStreamReader(new FileInputStream(unsolvedSolutionFile), "utf-8"); unsolvedSolution = (Solution) xStream.fromXML(reader); } catch (IOException e) { throw new IllegalArgumentException("Problem reading unsolvedSolutionFile: " + unsolvedSolutionFile, e); } finally { IOUtils.closeQuietly(reader); } return unsolvedSolution; } private void writeSolvedSolution(XStream xStream, SolverBenchmarkResult result, Solution solvedSolution) { File solvedSolutionFile = null; Writer writer = null; try { solvedSolutionFile = File.createTempFile( "score" + result.getScore() + "_time" + result.getTimeMillesSpend() + "ms_", ".xml", solvedSolutionFilesDirectory); writer = new OutputStreamWriter(new FileOutputStream(solvedSolutionFile), "utf-8"); xStream.toXML(solvedSolution, writer); } catch (IOException e) { throw new IllegalArgumentException("Problem writing solvedSolutionFile: " + solvedSolutionFile, e); } finally { IOUtils.closeQuietly(writer); } } public void benchmarkingEnded() { if (sortSolverBenchmarks) { if (solverBenchmarkComparator == null) { solverBenchmarkComparator = new MaxScoreSolverBenchmarkComparator(); } Collections.sort(solverBenchmarkList, solverBenchmarkComparator); } } public static enum SolvedSolutionVerbosity { ALL } }
[ "gizil.oguz@gmail.com" ]
gizil.oguz@gmail.com
087ff052323c650ec94e0a7962c6119d7c553117
8ccc2a2645cb20873d03afec5197ba38267d2d95
/jberet/excelstream2csv/src/test/java/org/samples/wildfly/jberet/excelstream2csv/ExcelStream2CsvIT.java
248ffdf698b6039d1c06fbfade5994308febd97e
[ "MIT" ]
permissive
juarezjuniorgithub/wildfly-samples
9af92a4ae237b05b9f8890229ea8df7cb95a8c76
da99834807e943c82624d62e85d6b0501183188b
refs/heads/master
2021-01-21T10:00:24.151400
2016-01-24T03:09:02
2016-01-24T03:09:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,097
java
/* * Copyright (c) 2014 Red Hat, Inc. and/or its affiliates. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Cheng Fang - Initial API and implementation */ package org.samples.wildfly.jberet.excelstream2csv; import javax.batch.runtime.BatchStatus; import com.gargoylesoftware.htmlunit.TextPage; import org.junit.Test; import org.samples.wildfly.jberet.common.BatchTestBase; public final class ExcelStream2CsvIT extends BatchTestBase { static final String CONTEXT_PATH = "excelstream2csv"; static final String SERVLET_PATH = null; static final String JOB_COMMAND = "start " + CONTEXT_PATH; @Test public void testCsv2Json() throws Exception { final TextPage page = runJob(CONTEXT_PATH, SERVLET_PATH, JOB_COMMAND); final String content = page.getContent(); assertContainsBatchStatus(content, BatchStatus.COMPLETED); } }
[ "cfang@redhat.com" ]
cfang@redhat.com
64c3ac661c44a3e802fdc68e023a8345297b650c
a7ece247f847754d22a4ab6d0b838a1b6b542a3a
/project3/src/oop/abstraction/Car.java
2038cd357c12a82015d6b81f8baf5c3e52e7a6e7
[]
no_license
tasneemrahman90/BCBS
48a81a34b62b97991d782ed812c529fd520b63a8
c0364956f5d98845b7fa7f7a7b78fb82b393562f
refs/heads/master
2021-01-18T13:23:58.329495
2016-09-18T14:52:30
2016-09-18T14:52:30
68,527,340
0
0
null
null
null
null
UTF-8
Java
false
false
126
java
package oop.abstraction; public interface Car { public void carShape(); public void start(); public void stop(); }
[ "tasneemrahman90@gmail.com" ]
tasneemrahman90@gmail.com
9db4297d3106aaeafe8147648e1bf6d582934ccf
f900f95941ac12b24b14c0e8cc1c3c5d5d40ca40
/src/main/java/Observer.java
adc84cc8aa44e04f9392f7b28617e6be8cf12097
[]
no_license
Janjhy/Clicker-Game-Server
bc3f6a281fc528825b9ecf459a56ccf7d20cc39d
e8ca670be87d9132ad5b742595520fc44b74bbc3
refs/heads/master
2023-06-24T22:56:45.991798
2020-02-25T00:47:25
2020-02-25T00:47:25
242,875,350
0
0
null
2023-06-13T22:55:19
2020-02-25T00:39:58
Java
UTF-8
Java
false
false
42
java
interface Observer { void update(); }
[ "jani.hyrkas@gmail.com" ]
jani.hyrkas@gmail.com
7f57e3b8324b4bdf701693811f3acd9d8af30a34
1fc8653ef5955d6ee8b57e628ebdc967393a38bc
/Si-Vale-Dominio/src/main/java/com/mx/sivale/dao/impl/UsuarioDAOImpl.java
96c84ec0922883e711d4f396224b6c957a411f54
[]
no_license
manuel-vigueras/invoice-manager
137fc710705394f8dd5389856439b2fd8d39fbc2
03cd7902e2f1d44911b3be5df404cd673dbde9e8
refs/heads/master
2020-12-31T06:31:59.678798
2015-07-14T23:31:13
2015-07-14T23:31:13
39,580,631
0
0
null
2015-07-23T17:14:46
2015-07-23T17:14:46
null
UTF-8
Java
false
false
802
java
package com.mx.sivale.dao.impl; import java.util.List; import org.springframework.stereotype.Repository; import com.mx.sivale.dao.UsuarioDAO; import com.mx.sivale.to.UsuarioTO; /** * @author kevin-mendez, 2Big * */ @Repository public class UsuarioDAOImpl extends GenericDAOImpl<UsuarioTO, Long> implements UsuarioDAO { public UsuarioDAOImpl() { super(UsuarioTO.class); } public void insert(UsuarioTO usuarioTO) { // TODO Auto-generated method stub guardar(usuarioTO); } public void update(UsuarioTO usuarioTO) { // TODO Auto-generated method stub actualizar(usuarioTO); } public void delete(UsuarioTO usuarioTO) { // TODO Auto-generated method stub borrar(usuarioTO); } public List<UsuarioTO> getAll() { // TODO Auto-generated method stub return buscar(); } }
[ "kevin.mendez.gmz@gmail.com" ]
kevin.mendez.gmz@gmail.com
420a73fd2270adc86dbadd2fee7d1b4fc8033057
7f608f0edc8bad023deb295620409bc02e45b139
/Java/String-1/AtFirst.java
30270eb84220ac5b91eecda8d3e99158e337db4f
[]
no_license
aguilaraul/CodingBat
607df7b0f3fdcb4a515ddf5daa58e75f140ca84c
09faabb55166c9e2a7699efb4faf29af8fc58824
refs/heads/master
2021-07-23T13:19:30.079751
2020-05-10T05:59:49
2020-05-10T05:59:49
164,199,215
0
0
null
null
null
null
UTF-8
Java
false
false
695
java
/* * Given a string, return a string length 2 made of its * first 2 chars. If the string length is less than 2, * use '@' for the missing chars. */ public class AtFirst { public static void main(String[] args) { System.out.println(atFirst("hello")); // "he" System.out.println(atFirst("hi")); // "hi" System.out.println(atFirst("h")); // "h@" System.out.println(atFirst("")); // "@@" System.out.println(atFirst("kitten")); // "ki" System.out.println(atFirst("java")); // "ja" System.out.println(atFirst("j")); // "j@" } public static String atFirst(String str) { if(str.length() == 0) return "@@"; if(str.length() < 2) return str+'@'; return str.substring(0,2); } }
[ "raula@live.com" ]
raula@live.com
eb20d63c60d10f3636060917ebce3714abc53061
16d1f147ed4dc0417d3f18426b986c2a857174f0
/android/app/src/main/java/com/sraagmobile/MainActivity.java
9f5dd1241bb4adda18391354d0a68a08d9ee0201
[]
no_license
CarlosDubon/audify-mobile
320b4de9c5c376a9ef661697d6144dffc48bfe89
1cb80854fb9b7cf5cb3ea569e5e95645bceaaf44
refs/heads/master
2023-07-12T21:56:45.749392
2021-07-21T01:26:09
2021-07-21T01:26:09
374,859,933
0
0
null
null
null
null
UTF-8
Java
false
false
349
java
package com.sraagmobile; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "sraagMobile"; } }
[ "cdubon@solucionesroots.com" ]
cdubon@solucionesroots.com
3213cc940b40adad969e580e6d0c0473045c3451
044ca65a05c53a910e5709fc00ffb7563baab6a5
/stu-manager/stu-manager-dao/src/main/java/com/stu/mapper/StuStudyMsgMapper.java
3b372924f28fd9cc7d58513cb260539ca9879689
[]
no_license
cmtsgithub/stu_system_hub
b480f7fe704d02c232e25800b2c6f294794f9817
b0d5fa6dffbd515ddae9157f0c0404cb5151fc99
refs/heads/master
2022-12-24T02:09:42.382210
2019-12-19T10:16:54
2019-12-19T10:16:54
219,708,519
0
0
null
2022-12-16T07:15:54
2019-11-05T09:38:45
CSS
UTF-8
Java
false
false
524
java
package com.stu.mapper; import com.stu.pojo.StuStudyMsg; import java.util.List; import org.apache.ibatis.annotations.Param; public interface StuStudyMsgMapper { int deleteByPrimaryKey(Integer id); int insert(StuStudyMsg record); int insertSelective(StuStudyMsg record); StuStudyMsg selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(StuStudyMsg record); int updateByPrimaryKey(StuStudyMsg record); StuStudyMsg selectByStuId(String id); List<StuStudyMsg> selectAll(); }
[ "343660104@qq.com" ]
343660104@qq.com
0e10408091d737554792f01a9e6935930153bbca
90d10974cfa7208f862587fb3429eea31de13ce5
/task05/src/main/java/by/training/task05/service/specification_creator/SortSpecificationSquareCreator.java
6836fe3b961a033c1698ed89ab6379ec08769118
[]
no_license
AlexeyFor/JavaSt2021
903be880132cec2a20ab6f1883d5293f83ef4df6
78488930002be6ae03794c51c0a45213b00096b0
refs/heads/master
2023-07-17T21:46:25.592290
2021-08-24T17:05:45
2021-08-24T17:05:45
371,788,420
0
0
null
null
null
null
UTF-8
Java
false
false
542
java
package by.training.task05.service.specification_creator; import by.training.task05.repository.specification.Specification; import by.training.task05.repository.specification.sort.SquareSortSpecification; import by.training.task05.service.ServiceException; public class SortSpecificationSquareCreator implements SpecificationCreator { /** * return SquareSortSpecification */ @Override public Specification createSpecification(String[] params) throws ServiceException { return new SquareSortSpecification(); } }
[ "aleksyforepam@gmail.com" ]
aleksyforepam@gmail.com
35f1fe55703a712d044d19e3cf7efa978f01991f
a5f2051056159e2dc20a6eaa9fb1dd4c792da757
/app/src/main/java/com/nd/shapedexamproj/db/VideoDownloadDBOperator.java
132acaad2565e40a63899df01924e342efaa2116
[ "Apache-2.0" ]
permissive
GeminiWy/ShapedExamProj
48ac8f71661b72d042fc51cd5ba6cf371c3341f8
ea3f435b546627db9c102671d9ff52c8ca90b3cb
refs/heads/master
2021-04-15T04:07:57.862192
2018-03-27T02:03:46
2018-03-27T02:03:46
126,802,747
0
0
null
null
null
null
UTF-8
Java
false
false
5,188
java
package com.nd.shapedexamproj.db; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.nd.shapedexamproj.App; import com.nd.shapedexamproj.model.download.DownloadInfo; import com.tming.common.util.Log; import java.util.ArrayList; import java.util.List; /** * 下载数据库操作 * @author Linlg * */ public class VideoDownloadDBOperator { public OpenUniversityOpenHelper helper; private static VideoDownloadDBOperator operator; private String mUserId; public static VideoDownloadDBOperator getInstance(Context context) { if (operator != null) { if (operator.mUserId.equals(App.getUserId())) {//上个用户id和当前用户id比较,避免当前用户操作上个用户的数据库。(使用static要注意) return operator; } else { operator = null; } } synchronized (VideoDownloadDBOperator.class) { if (operator == null) { operator = new VideoDownloadDBOperator(context); } } return operator; } public VideoDownloadDBOperator(Context context){ helper = new OpenUniversityOpenHelper(context); mUserId = App.getUserId(); } public void insert(DownloadInfo info){ synchronized (helper.getDbLock()) { SQLiteDatabase db = null; ContentValues cv = null; try { db = helper.getWritableDatabase(); cv = new ContentValues(); cv.put("url", info.url); cv.put("coursecateid", info.coursecateid); cv.put("coursecatename", info.coursecatename); cv.put("courseid", info.courseId); cv.put("videoname", info.title); cv.put("videoid", info.videoId); db.insert("videodownload", null, cv); } catch (Exception e) { e.printStackTrace(); } finally { if (db != null) { db.close(); } } } } public synchronized void deleteByUrl(String url){ SQLiteDatabase db = null; try { db = helper.getWritableDatabase(); db.execSQL("delete from videodownload where url = '?'", new String[]{url}); Log.e("VideoDownloadDBOperator", "====删除一条下载记录===="); } catch (Exception e) { e.printStackTrace(); } finally { if (db != null) db.close(); } } public synchronized boolean isUrlExist(String url) { SQLiteDatabase db = null; Cursor cursor = null; try { db = helper.getWritableDatabase(); // TODO wy 2018年3月22日17:11:44 ?报错,改成了'?' cursor = db.rawQuery("select * from videodownload where url='?'", new String[]{url}); return cursor.moveToFirst(); } catch (Exception e) { e.printStackTrace(); } finally { if(cursor != null) { cursor.close(); } if (db != null) { db.close(); } } return false; } public synchronized List<DownloadInfo> getListByCourseId(int coursecateId) { List<DownloadInfo> downloadInfos = new ArrayList<DownloadInfo>(); SQLiteDatabase db = null; Cursor cursor = null; try { db = helper.getWritableDatabase(); cursor = db.rawQuery("select * from videodownload where coursecateid = '?'", new String[] { String.valueOf(coursecateId) }); if (cursor != null) { if (cursor.moveToFirst()) { do { DownloadInfo info = new DownloadInfo(); info.url = cursor.getString(cursor.getColumnIndex("url")); info.coursecateid = cursor.getInt(cursor.getColumnIndex("coursecateid")); info.coursecatename = cursor.getString(cursor.getColumnIndex("coursecatename")); info.title = cursor.getString(cursor.getColumnIndex("videoname")); info.courseId = cursor.getString(cursor.getColumnIndex("courseid")); info.videoId = cursor.getString(cursor.getColumnIndex("videoid")); downloadInfos.add(info); } while (cursor.moveToNext()); } } } catch (Exception e) { e.printStackTrace(); } finally { if (cursor != null) { cursor.close(); } if (db != null) { db.close(); } } return downloadInfos; } public List<DownloadInfo> getDownloads() { List<DownloadInfo> downloadInfos = new ArrayList<DownloadInfo>(); SQLiteDatabase db = null; Cursor cursor = null; synchronized (helper.getDbLock()) { try { db = helper.getWritableDatabase(); cursor = db.rawQuery("select * from videodownload", null); if (cursor != null) { if (cursor.moveToFirst()) { do { DownloadInfo info = new DownloadInfo(); info.url = cursor.getString(cursor.getColumnIndex("url")); info.coursecateid = cursor.getInt(cursor.getColumnIndex("coursecateid")); info.coursecatename = cursor.getString(cursor.getColumnIndex("coursecatename")); info.title = cursor.getString(cursor.getColumnIndex("videoname")); info.courseId = cursor.getString(cursor.getColumnIndex("courseid")); info.videoId = cursor.getString(cursor.getColumnIndex("videoid")); downloadInfos.add(info); } while (cursor.moveToNext()); } } } catch (Exception e) { e.printStackTrace(); } finally { if (cursor != null) cursor.close(); if (db != null) db.close(); } } return downloadInfos; } }
[ "729209142@qq.com" ]
729209142@qq.com
c88b53faefe13dac42cc7f5ea6529b27e5bf232a
29196e2d4adfb14ddd7c2ca8c1e60f8c10c26dad
/src/main/java/it/csi/siac/siaccecser/frontend/webservice/msg/AggiornaTipoGiustificativoResponse.java
93224cbc8e417decc8481efacf1f4bd9e677eab1
[]
no_license
unica-open/siacbilitf
bbeef5ceca40e9fb83d5b1176e7f54e8d84592bf
85f3254c05c719a0016fe55cea1a105bcb6b89b2
refs/heads/master
2021-01-06T14:51:17.786934
2020-03-03T13:27:47
2020-03-03T13:27:47
241,366,581
0
0
null
null
null
null
UTF-8
Java
false
false
876
java
/* *SPDX-FileCopyrightText: Copyright 2020 | CSI Piemonte *SPDX-License-Identifier: EUPL-1.2 */ package it.csi.siac.siaccecser.frontend.webservice.msg; import it.csi.siac.siaccecser.frontend.webservice.CECSvcDictionary; import it.csi.siac.siaccecser.model.TipoGiustificativo; import it.csi.siac.siaccorser.model.ServiceResponse; import javax.xml.bind.annotation.XmlType; @XmlType(namespace = CECSvcDictionary.NAMESPACE) public class AggiornaTipoGiustificativoResponse extends ServiceResponse { private TipoGiustificativo tipoGiustificativo; /** * @return the tipoGiustificativo */ public TipoGiustificativo getTipoGiustificativo() { return tipoGiustificativo; } /** * @param tipoGiustificativo the tipGiustificativo to set */ public void setTipoGiustificativo(TipoGiustificativo tipoGiustificativo) { this.tipoGiustificativo = tipoGiustificativo; } }
[ "barbara.malano@csi.it" ]
barbara.malano@csi.it
4d4836b44a29cfc3f5866d247b10e05557b010d4
0b17ecd55b882969913e0854a5359b53797514ec
/src/main/java/com/online/rental/car/dao/ReservationDao.java
0f4323f96dad5bcc55d69d95dee21650c252b49a
[]
no_license
eallanjoseph123/car-rental-service
aacac807f12ea2bde0e7af7017d8770f4c817abc
f8b3e97044904b8347935bde3119ae200ec109ec
refs/heads/master
2021-01-20T18:33:09.330729
2018-09-28T06:29:21
2018-09-28T06:29:21
65,206,979
0
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.online.rental.car.dao; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import com.online.rental.car.model.Reservation; @Repository public interface ReservationDao extends JpaRepository<Reservation, Long>,JpaSpecificationExecutor<Reservation>{ @Query("SELECT r FROM Reservation r WHERE r.driverLicenNumber = :driverLicenNumber") public Reservation findByDriverLicenNumber(@Param("driverLicenNumber") String driverLicenNumber); }
[ "eallanjoseph@yahoo.com" ]
eallanjoseph@yahoo.com
3bd997005b893b77287f6d4b5d53bfa6fdbf72ba
43cac3bf05c900d325fc57108ad6ba6b2988bf7e
/Catan/src/main/java/GUI/PropertiesPanel.java
d789c750598a6611cb0fd6522047663556cbdeb9
[]
no_license
AndreasDL/Tiwi-VOP2013
8ccf605c1d7dc495871ff5ccadc4189aff82d522
60e9aa3e6d9bbd63fcabc5efcd4d5dc9e2295a2e
refs/heads/master
2016-09-06T15:21:16.033743
2014-08-27T10:04:05
2014-08-27T10:04:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,460
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package GUI; import java.awt.Font; import java.awt.Graphics; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.util.ResourceBundle; import javax.swing.JDialog; import model.Village; import model.interfaces.IRoad; import model.interfaces.ISettlement; import model.interfaces.ITile; /** * Deze klasse wordt gebruikt om de eigenschappen van de elementen weer te geven. * @author tom */ public class PropertiesPanel extends JDialog implements FocusListener{ private ITile tile; private IRoad road; private ISettlement settlement; private ResourceBundle constants = ResourceBundle.getBundle("utility.config"); /** * Standaard constructor. */ public PropertiesPanel(){ addFocusListener(this); setAlwaysOnTop(true); setResizable(false); setUndecorated(true); } /** * Stel de straat in waarvan de eigenschappen moet weergegeven worden. * @param road De straat die ingesteld wordt. */ public void setRoad(IRoad road) { this.road = road; tile= null; settlement = null; setSize(200, 50); } /** * Stel het settlement in waarvan de eigenschappen moeten weergeven. * @param settlement Het settlement waarvan de eigenschappen moeten weergegeven worden. */ public void setSettlement(ISettlement settlement) { this.settlement = settlement; tile = null; road = null; setSize(200, 70); } /** * Stel de tegel in waarvan info moet gegeven worden. * @param tile De tegel waarvan de eigenschappen moeten weergegeven worden. */ public void setTile(ITile tile) { /** * */ this.tile = tile; settlement = null; road = null; setSize(150, 50); } /** * Uitekekenen van de component. * @param g het graphics object. */ @Override public void paint(Graphics g) { super.paint(g); if(tile !=null){ g.setFont(g.getFont().deriveFont(Font.BOLD)); g.drawString("Tegel", 20, 20); g.setFont(g.getFont().deriveFont(Font.PLAIN)); g.drawString("Type: " + constants.getString(tile.getType().name()), 5, 40); } else if(settlement != null){ g.setFont(g.getFont().deriveFont(Font.BOLD)); g.drawString("Nederzetting", 20, 20); g.setFont(g.getFont().deriveFont(Font.PLAIN)); if (settlement instanceof Village){ g.drawString("Type: dorp", 5, 40); }else{ g.drawString("Type: city", 5, 40); } g.drawString("Speler: " + settlement.getPlayer().getName(), 5, 60); } else if(road != null){ g.setFont(g.getFont().deriveFont(Font.BOLD)); g.drawString("Straat", 20, 20); g.setFont(g.getFont().deriveFont(Font.PLAIN)); g.drawString("Speler: " + road.getPlayer().getName(), 5, 40); } g.drawRect(0, 0, getWidth() -1, getHeight() -1); } //events public void focusGained(FocusEvent arg0) { } public void focusLost(FocusEvent arg0) { this.setVisible(false); } }
[ "andreasdelille@hotmail.Com" ]
andreasdelille@hotmail.Com
65af3d1cc1b8b3a847f1a1dac3042158e576c71b
1930d97ebfc352f45b8c25ef715af406783aabe2
/src/main/java/com/alipay/api/domain/AlipayDataDataserviceAntdataassetsFixdataCreateModel.java
573d875cbb8d31b5a15bad268974a34e7379e5d7
[ "Apache-2.0" ]
permissive
WQmmm/alipay-sdk-java-all
57974d199ee83518523e8d354dcdec0a9ce40a0c
66af9219e5ca802cff963ab86b99aadc59cc09dd
refs/heads/master
2023-06-28T03:54:17.577332
2021-08-02T10:05:10
2021-08-02T10:05:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,087
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 创建补数据流程 * * @author auto create * @since 1.0, 2019-04-30 14:22:45 */ public class AlipayDataDataserviceAntdataassetsFixdataCreateModel extends AlipayObject { private static final long serialVersionUID = 5286132486715945141L; /** * 该字段指定补数据的结束分区 */ @ApiField("end_date") private String endDate; /** * ODPS表的guid */ @ApiField("guid") private String guid; /** * 该字段指定补数据的开始分区 */ @ApiField("start_date") private String startDate; public String getEndDate() { return this.endDate; } public void setEndDate(String endDate) { this.endDate = endDate; } public String getGuid() { return this.guid; } public void setGuid(String guid) { this.guid = guid; } public String getStartDate() { return this.startDate; } public void setStartDate(String startDate) { this.startDate = startDate; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
e76197eac77ff87cb9379f10516ad75c5f5f66a2
ddb495d703e2290a7f2fe51cbfdb615a718292ad
/common/src/main/java/net/e6tech/elements/common/reflection/Reflection.java
63bdcdf842a91431a9ee513e6db0d435da33d1da
[]
no_license
futehkao/elements
f60d973e1430a9b75efdeb720bb6ac74d16b44c2
5ef950f6078972c0bf0d02b6571f014ba1284668
refs/heads/master
2023-08-25T07:02:17.879356
2023-08-22T20:00:07
2023-08-22T20:00:07
76,207,275
17
13
null
2022-02-08T16:37:11
2016-12-11T23:45:53
Java
UTF-8
Java
false
false
35,380
java
/* * Copyright 2015-2019 Futeh Kao * * 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 net.e6tech.elements.common.reflection; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import net.e6tech.elements.common.logging.Logger; import net.e6tech.elements.common.resources.Provision; import net.e6tech.elements.common.util.SystemException; import net.e6tech.elements.common.util.TextSubstitution; import net.e6tech.elements.common.util.datastructure.Pair; import net.e6tech.elements.common.util.lambda.Each; import java.beans.*; import java.lang.annotation.Annotation; import java.lang.reflect.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; import static java.util.Locale.ENGLISH; /** * Created by futeh. */ @SuppressWarnings({"unchecked", "squid:S134", "squid:S1149", "squid:S1141", "squid:MethodCyclomaticComplexity", "squid:S3776"}) public class Reflection { @SuppressWarnings("squid:S1185") static final class PrivateSecurityManager extends SecurityManager { @Override protected Class<?>[] getClassContext() { return super.getClassContext(); } } private static Set<Class> convertibleTypes = new HashSet(); static { convertibleTypes.add(Boolean.TYPE); convertibleTypes.add(Boolean.class); convertibleTypes.add(Double.TYPE); convertibleTypes.add(Double.class); convertibleTypes.add(Float.TYPE); convertibleTypes.add(Float.class); convertibleTypes.add(Integer.TYPE); convertibleTypes.add(Integer.class); convertibleTypes.add(Long.TYPE); convertibleTypes.add(Long.class); convertibleTypes.add(Short.TYPE); convertibleTypes.add(Short.class); convertibleTypes.add(BigDecimal.class); convertibleTypes.add(BigInteger.class); } private static final PrivateSecurityManager securityManager = new PrivateSecurityManager(); private static LoadingCache<Method, PropertyDescriptor> methodPropertyDescriptors = CacheBuilder.newBuilder() .maximumSize(10000) .initialCapacity(500) .concurrencyLevel(Provision.cacheBuilderConcurrencyLevel) .expireAfterWrite(120 * 60 * 1000L, TimeUnit.MILLISECONDS) .build(new CacheLoader<Method, PropertyDescriptor>() { public PropertyDescriptor load(Method method) throws IntrospectionException { String name = method.getName(); Parameter[] parameters = method.getParameters(); String property ; if (name.startsWith("set")) { if (parameters.length != 1) throw new IllegalArgumentException("" + method.getName() + " is not a setter"); property = name.substring(3); } else if (name.startsWith("get")) { if (parameters.length != 0) throw new IllegalArgumentException("" + method.getName() + " is not a getter"); property = name.substring(3); } else if (name.startsWith("is")) { if (parameters.length != 0) throw new IllegalArgumentException("" + method.getName() + " is not a getter"); property = name.substring(2); } else { throw new IllegalArgumentException("" + method.getName() + " is not an property accessor"); } boolean lowerCase = true; if (property.length() > 1 && Character.isUpperCase(property.charAt(1))) lowerCase = false; if (lowerCase) property = property.substring(0, 1).toLowerCase(ENGLISH) + property.substring(1); return new PropertyDescriptor(property, method.getDeclaringClass()); } }); private static LoadingCache<Pair<Class, String>, PropertyDescriptor> propertyDescriptors = CacheBuilder.newBuilder() .maximumSize(10000) .initialCapacity(500) .concurrencyLevel(Provision.cacheBuilderConcurrencyLevel) .expireAfterWrite(120 * 60 * 1000L, TimeUnit.MILLISECONDS) .build(new CacheLoader<Pair<Class, String>, PropertyDescriptor>() { @Override public PropertyDescriptor load(Pair<Class, String> key) throws Exception { Class cls = key.key(); String property = key.value(); PropertyDescriptor descriptor; try { descriptor = new PropertyDescriptor(property, cls, "is" + TextSubstitution.capitalize(property), null); } catch (IntrospectionException e) { throw new SystemException(cls.getName() + "." + property, e); } return descriptor; } }); private static LoadingCache<Class, Type[]> parametrizedTypes = CacheBuilder.newBuilder() .maximumSize(10000) .initialCapacity(100) .concurrencyLevel(Provision.cacheBuilderConcurrencyLevel) .expireAfterWrite(120 * 60 * 1000L, TimeUnit.MILLISECONDS) .build(new CacheLoader<Class, Type[]>() { @Override public Type[] load(Class clazz) throws Exception { Class cls = clazz; Type[] types = null; while (!cls.equals(Object.class)) { try { Type genericSuper = cls.getGenericSuperclass(); if (genericSuper instanceof ParameterizedType) { ParameterizedType parametrizedType = (ParameterizedType) genericSuper; types = parametrizedType.getActualTypeArguments(); break; } } catch (Exception th) { logger.warn(th.getMessage(), th); } cls = cls.getSuperclass(); } if (types == null) throw new IllegalArgumentException("No parametrized types found"); return types; } }); static Logger logger = Logger.getLogger(); private Reflection() { } // should use weak hash map public static PropertyDescriptor propertyDescriptor(Method method) { try { return methodPropertyDescriptors.get(method); } catch (ExecutionException e) { throw new SystemException(e.getCause()); } } public static Class getCallingClass() { return privateGetCallingClass(1); } public static Class getCallingClass(int index) { return privateGetCallingClass(index + 1); } @SuppressWarnings("squid:S1872") public static Class privateGetCallingClass(int index) { Class<?>[] trace = securityManager.getClassContext(); // trace[0] // trace[1] is Reflection because of this call. // trace[2] is the caller who wants the calling class // trace[3] is the caller. String thisClassName = Reflection.class.getName(); int i; for (i = 0; i < trace.length; i++) { if (thisClassName.equals(trace[i].getName())) break; } // trace[i] = Reflection this method // trace[i+1] = Reflection.getCallingClass method // trace[i+2] = caller // trace[i+3] = caller's caller if (i >= trace.length || i + 2 + index >= trace.length) { throw new IllegalStateException("Failed to find caller in the stack"); } return trace[i + 2 + index]; } public static Class<?>[] getClassContext() { return securityManager.getClassContext(); } public static <V, C> Optional<V> mapCallingStackTrace(Function<Each<StackTraceElement,C>, ? extends V> mapper) { Throwable th = new Throwable(); StackTraceElement[] trace = th.getStackTrace(); String thisClassName = Reflection.class.getName(); int i; for (i = 0; i < trace.length; i++) { if (thisClassName.equals(trace[i].getClassName())) break; } Each.Mutator<StackTraceElement, C> mutator = Each.create(); for (int j = i + 2; j < trace.length; j++) { mutator.setValue(trace[j]); V v = mapper.apply(mutator.each()); if (v != null) return Optional.of(v); } return Optional.empty(); } public static void printStackTrace(StringBuilder builder, String indent, int start, int end) { StackTraceElement[] elements = new Throwable().getStackTrace(); int i = start + 1; // skip 1 for this printStackTrace call while (i < end && i < elements.length) { builder.append("\n"); if (indent != null) builder.append(indent); builder.append(elements[i].getClassName()); builder.append("."); builder.append(elements[i].getMethodName()); builder.append("("); builder.append(elements[i].getFileName()); builder.append(":"); builder.append(elements[i].getLineNumber()); builder.append(")"); i ++; } } public static <T> T newInstance(String className, ClassLoader loader) { try { return (T) loadClass(className, loader).getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new SystemException(e); } } public static Class loadClass(String className, ClassLoader classLoader) { ClassLoader loader = classLoader; if (loader == null) { loader = Thread.currentThread().getContextClassLoader(); } if (loader == null) { loader = getCallingClass().getClassLoader(); } try { return loader.loadClass(className); } catch (Exception e) { throw new SystemException(e); } } public static Map<Signature, Map<Class<? extends Annotation>, Annotation>> getAnnotationsByName(Class cls) { return getAnnotations(cls).entrySet().stream() .filter(x -> x.getKey() instanceof NamedSignature) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } public static Map<Signature, Map<Class<? extends Annotation>, Annotation>> getAnnotations(Class cls) { List<Class> classes = collectClass(cls); Map<Signature<?>, Map<Class<? extends Annotation>, Annotation>> annotations = new HashMap<>(50); Map<Class<? extends Annotation>, Annotation> classAnnotations = new HashMap<>(50); for (Class c : classes) { for (Method method : c.getDeclaredMethods()) { Map<Class<? extends Annotation>, Annotation> map = Accessor.getAnnotations(method); MethodSignature signature = new MethodSignature(method); annotations.putIfAbsent(signature, map); } Field[] fields = c.getDeclaredFields(); for (Field field : fields) { Map<Class<? extends Annotation>, Annotation> map = Accessor.getAnnotations(field); FieldSignature signature = new FieldSignature(field); if (!annotations.containsKey(signature)) { annotations.put(signature, map); NamedSignature named = new NamedSignature(field.getName()); annotations.put(named, map); } } // unlike method and field, class signature aggregates all annotations including it super classes. ClassSignature classSignature = new ClassSignature(cls); for (Annotation a : c.getAnnotations()) { classAnnotations.putIfAbsent(a.annotationType(), a); } annotations.put(classSignature, classAnnotations); } for (Class c : classes) { try { for (PropertyDescriptor desc : Introspector.getBeanInfo(c).getPropertyDescriptors()) { Map<Class<? extends Annotation>, Annotation> map = Accessor.getAnnotations(desc); PropertySignature signature = new PropertySignature(desc); if (!annotations.containsKey(signature)) { annotations.put(signature, map); NamedSignature named = new NamedSignature(desc.getName()); Map<Class<? extends Annotation>, Annotation> namedMap = annotations.computeIfAbsent(named, key -> new HashMap<>()); for (Map.Entry<Class<? extends Annotation>, Annotation> entry : map.entrySet()) { namedMap.putIfAbsent(entry.getKey(), entry.getValue()); } } } } catch (IntrospectionException e) { throw new SystemException(e); } } return annotations.entrySet().stream() .filter(x -> x.getValue().size() > 0) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } private static List<Class> collectClass(Class cls) { LinkedHashSet<Class> set = new LinkedHashSet<>(); Class tmp = cls; while (tmp != null && !tmp.equals(Object.class)) { set.add(tmp); Class[] interfaces = tmp.getInterfaces(); for (Class intf : interfaces) { collectInterfaces(intf, set); } tmp = tmp.getSuperclass(); } return new ArrayList<>(set); } // this needs to be breadth first private static void collectInterfaces(Class intf, Set<Class> set) { if (!set.contains(intf)) set.add(intf); else return; Class[] interfaces = intf.getInterfaces(); for (Class i : interfaces) { collectInterfaces(i, set); } } public static BeanInfo getBeanInfo(Class cls) { try { return Introspector.getBeanInfo(cls); } catch (IntrospectionException e) { throw new SystemException(e); } } public static void forEachAnnotatedAccessor(Class objectClass, Class<? extends Annotation> annotationClass, Consumer<AccessibleObject> consumer) { Class cls = objectClass; BeanInfo beanInfo = getBeanInfo(cls); PropertyDescriptor[] props = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor prop : props) { if (prop.getReadMethod() != null && prop.getReadMethod().getAnnotation(annotationClass) != null) { consumer.accept(prop.getReadMethod()); } else if (prop.getWriteMethod() != null && prop.getWriteMethod().getAnnotation(annotationClass) != null) { consumer.accept(prop.getWriteMethod()); } } while (!cls.equals(Object.class)) { Field[] fields = cls.getDeclaredFields(); for (Field field : fields) { if (field.getAnnotation(annotationClass) != null) { consumer.accept(field); } } cls = cls.getSuperclass(); } } public static <V> V getProperty(Object object, String property) { try { Class cls = null; if (object instanceof Class) { cls = (Class) object; } else { cls = object.getClass(); } PropertyDescriptor descriptor = getPropertyDescriptor(cls, property); if (descriptor == null || descriptor.getReadMethod() == null) return null; return (V) descriptor.getReadMethod().invoke(object); } catch (Exception e) { throw new SystemException(object.getClass().getName() + "." + property, e); } } public static PropertyDescriptor getPropertyDescriptor(Class cls, String property) { try { return propertyDescriptors.get(new Pair<>(cls, property)); } catch (ExecutionException e) { throw new SystemException(e.getCause()); } } public static <V> V getField(Object object, String fieldName) { Field field = getField(object.getClass(), fieldName); try { return (V) field.get(object); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } } public static void setField(Object object, String fieldName, Object value) { Field field = getField(object.getClass(), fieldName); try { field.set(object, value); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } } public static Field getField(Class clazz, String fieldName) { Class cls = clazz; while (cls != null && !cls.equals(Object.class)) { try { Field field = cls.getDeclaredField(fieldName); field.setAccessible(true); return field; } catch (Exception e) { Logger.suppress(e); } try { cls = cls.getSuperclass(); } catch (Exception e) { throw new IllegalStateException(e); } } throw new IllegalStateException("No bankId defined"); } public static Class getParametrizedType(Class clazz, int index) { Type[] types; try { types = parametrizedTypes.get(clazz); } catch (ExecutionException e) { throw new SystemException(e.getCause()); } if (types.length <= index) { throw new IllegalArgumentException("No parametrized type at index=" + index); } else if (types[index] instanceof Class) { return (Class) types[index]; } else if (types[index] instanceof ParameterizedType && ((ParameterizedType) types[index]).getRawType() instanceof Class) { return (Class)((ParameterizedType) types[index]).getRawType(); } else { return null; } } public static <T> List<T> newInstance(Class<T> cls, List objectList) { return newInstance(cls, objectList, null); } @SuppressWarnings("squid:S1168") public static <T> List<T> newInstance(Class<T> cls, List objectList, CopyListener listener) { if (objectList == null) return null; List<T> list = new ArrayList<>(); for (Object o : objectList) { T target = (new Replicator()).newInstance(cls, o, listener); list.add(target); } return list; } public static <T> T newInstance(Class<T> cls, Object object) { return (new Replicator()).newInstance(cls, object, new HashMap<>(), null); } public static <T> T newInstance(Class<T> cls, Object object, CopyListener listener) { return (new Replicator()).newInstance(cls, object, new HashMap<>(), listener); } public static <T> T copyInstance(T target, Object object) { (new Replicator()).copy(target, object, new HashMap<>(), null); return target; } public static <T> T copyInstance(T target, Object object, CopyListener listener) { (new Replicator()).copy(target, object, new HashMap<>(), listener); return target; } public static boolean compare(Object target, Object object) { return (new Replicator()).compare(target, object); } public static class Replicator { private Map<Class, Map<String, PropertyDescriptor>> targetPropertiesDescriptor = new HashMap<>(); private Map<Class, PropertyDescriptor[]> propertyDescriptors = new HashMap<>(); private synchronized Map<String, PropertyDescriptor> getTargetProperties(Class cls) { return targetPropertiesDescriptor.computeIfAbsent(cls, key -> { HashMap<String, PropertyDescriptor> descriptors = new HashMap<>(); PropertyDescriptor[] props = getBeanInfo(key).getPropertyDescriptors(); for (PropertyDescriptor prop : props) { descriptors.put(prop.getName(), prop); } return descriptors; }); } private synchronized PropertyDescriptor[] getPropertyDescriptors(Class cls) { return propertyDescriptors.computeIfAbsent(cls, key -> getBeanInfo(key).getPropertyDescriptors()); } public synchronized Map<Class, Map<String, PropertyDescriptor>> getTargetPropertiesDescriptor() { return targetPropertiesDescriptor; } public synchronized void setTargetPropertiesDescriptor(Map<Class, Map<String, PropertyDescriptor>> targetPropertiesDescriptor) { this.targetPropertiesDescriptor = targetPropertiesDescriptor; } public synchronized Map<Class, PropertyDescriptor[]> getPropertyDescriptors() { return propertyDescriptors; } public synchronized void setPropertyDescriptors(Map<Class, PropertyDescriptor[]> propertyDescriptors) { this.propertyDescriptors = propertyDescriptors; } public <T> T newInstance(Class<T> cls, Object object) { return (new Replicator()).newInstance(cls, object, new HashMap<>(), null); } public <T> T newInstance(Class<T> cls, Object object, CopyListener listener) { return (new Replicator()).newInstance(cls, object, new HashMap<>(), listener); } private <T> T newInstance(Type toType, Object object, Map<Integer, Object> seen, CopyListener listener) { if (object == null) return null; T buildin = null; if (toType instanceof Class) { buildin = (T) convertBuiltinType((Class) toType, object); if (buildin != null) return buildin; } Integer hashCode = null; if (!object.getClass().isPrimitive()) { hashCode = System.identityHashCode(object); if (seen.get(hashCode) != null) return (T) seen.get(hashCode); } T target = null; if (toType instanceof Class) { Class cls = (Class) toType; if (Enum.class.isAssignableFrom((Class)toType)) { target = (T) Enum.valueOf(cls, object.toString()); } else if (Enum.class.isAssignableFrom(object.getClass()) && String.class.isAssignableFrom(cls)) { target = (T) ((Enum) object).name(); } else if (Collection.class.isAssignableFrom(cls)) { Collection collection = newCollection(cls); target = (T) collection; if (object instanceof Collection) { Collection c = (Collection) object; for (Object o : c) { collection.add(o); } } else { throw new IllegalStateException("Do not know how to convert " + object.getClass() + " to " + toType); } } else { try { target = (T) cls.getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new SystemException(e); } copy(target, object, seen, listener); } } else { ParameterizedType parametrized = (ParameterizedType) toType; Class enclosedType = (Class) parametrized.getRawType(); Type type = parametrized.getActualTypeArguments()[0]; if (Collection.class.isAssignableFrom(enclosedType)) { Collection collection = newCollection(enclosedType); target = (T) collection; if (object instanceof Collection) { Collection c = (Collection) object; for (Object o : c) { Object converted = newInstance(type ,o, seen, listener); collection.add(converted); } } else { throw new IllegalStateException("Do not know how to convert " + object.getClass() + " to " + toType); } } else { try { target = (T) enclosedType.getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new SystemException(e); } copy(target, object, seen, listener); } } if (hashCode != null) seen.put(hashCode, target); return target; } protected Collection newCollection(Class cls) { Collection collection = null; if (List.class.isAssignableFrom(cls)) { collection = new ArrayList<>(); } else if (Set.class.isAssignableFrom(cls)) { collection = new LinkedHashSet<>(); } else { collection = new ArrayList<>(); } return collection; } @SuppressWarnings("all") protected Object convertBuiltinType(Class type, Object object) { if (String.class.isAssignableFrom(type)) { return object.toString(); } if (!convertibleTypes.contains(type)) return null; if (type == Boolean.TYPE || type == Boolean.class) return new Boolean(object.toString()); else if (type == Double.TYPE || type == Double.class) { return new Double(object.toString()); } else if (type == Float.TYPE || type == Float.class) { return new Float(object.toString()); } else if (type == Integer.TYPE || type == Integer.class) { return new Integer(object.toString()); } else if (type == Long.TYPE || type == Long.class) { return new Long(object.toString()); } else if (type == Short.TYPE || type == Short.class) { return new Short(object.toString()); } else if (type == BigDecimal.class) { return new BigDecimal(object.toString()); } else if (type == BigInteger.class) { return new BigInteger(object.toString()); } return null; } public void copy(Object target, Object object, CopyListener copyListener) { copy(target, object, new HashMap<>(), copyListener); } public void copy(Object target, Object object) { copy(target, object, new HashMap<>(), null); } @SuppressWarnings("squid:S135") private void copy(Object target, Object object, Map<Integer, Object> seen, CopyListener copyListener) { if (target == null || object == null) return; for (PropertyDescriptor prop : getPropertyDescriptors(object.getClass())) { if (prop.getReadMethod() != null) { PropertyDescriptor targetDesc = getTargetProperties(target.getClass()).get(prop.getName()); if (targetDesc == null) continue; Method setter = targetDesc.getWriteMethod(); if (setter == null) continue; if (setter.getAnnotation(DoNotAccept.class) != null) { continue; } Method getter = targetDesc.getReadMethod(); if (getter != null && getter.getAnnotation(DoNotAccept.class) != null) { continue; } try { boolean annotated = (prop.getReadMethod().getAnnotation(DoNotCopy.class) != null); if (!annotated && prop.getWriteMethod() != null) { annotated = (prop.getWriteMethod().getAnnotation(DoNotCopy.class) != null); } if (!annotated) { try { boolean handled = false; if (copyListener != null) { handled = copyListener.copy(target, targetDesc, object, prop); } if (!handled) { Object value = prop.getReadMethod().invoke(object); if (!(value instanceof Collection) && setter.getParameterTypes()[0].isAssignableFrom(prop.getReadMethod().getReturnType())) { setter.invoke(target, value); } else { try { Object converted = newInstance(setter.getGenericParameterTypes()[0], value, seen, copyListener); setter.invoke(target, converted); } catch (Exception ex) { logger.warn("Error copying " + value + " to " + setter.getDeclaringClass() + "::" + setter.getName(), ex); } } } } catch (PropertyVetoException ex) { Logger.suppress(ex); } } } catch (Exception e) { throw new SystemException(e); } } } } public boolean compare(Object target, Object object) { Stack<String> stack = new Stack<>(); if (target != null) stack.push(target.getClass().getName()); return compare(target, object, new HashSet<>(), stack); } private boolean compare(Object target, Object object, Set<String> seen, Stack<String> stack) { if (target == null && object == null) return true; if (target == null || object == null) return false; // at this point target and object are not null int hashCode = System.identityHashCode(target); int hashCode2 = System.identityHashCode(object); String compared = Integer.toString(hashCode) + ":" + hashCode2; if (seen.contains(compared)) return true; if (target.getClass().isAssignableFrom(object.getClass())) { if (!target.equals(object)) { if (logger.isDebugEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("Comparison failed at "); boolean first = true; for (String element : stack) { if (first) first = false; else builder.append("."); builder.append(element); } logger.debug(builder.toString()); } return false; } return true; } if (!object.getClass().isPrimitive()) { seen.add(compared); } for (PropertyDescriptor prop : getPropertyDescriptors(target.getClass())) { if (prop.getReadMethod() != null && !"class".equals(prop.getName())) { try { boolean annotated = (prop.getReadMethod().getAnnotation(DoNotCopy.class) != null); if (!annotated && prop.getWriteMethod() != null) { annotated = (prop.getWriteMethod().getAnnotation(DoNotCopy.class) != null); } if (!annotated) { Method objectGetter = null; try { PropertyDescriptor objectProp = new PropertyDescriptor(prop.getName(), object.getClass(), "is" + capitalize(prop.getName()), null); objectGetter = objectProp.getReadMethod(); } catch (IntrospectionException e) { Logger.suppress(e); } if (objectGetter == null) continue; Object value = objectGetter.invoke(object); Object targetFieldValue = prop.getReadMethod().invoke(target); stack.push(prop.getName()); if (!compare(targetFieldValue, value, seen, stack)) { return false; } stack.pop(); } } catch (Exception e) { throw new SystemException(e); } } } return true; } public static String capitalize(String name) { return name.substring(0, 1).toUpperCase(ENGLISH) + name.substring(1); } } }
[ "futeh@episodesix.com" ]
futeh@episodesix.com
5306d5e2584f45cc519fc1835f5f1c96d476d0a5
38d16c128d34519c6a070ec9416287311b0269df
/src/main/java/io/discloader/discloader/common/event/voice/VoiceConnectionDisconnectEvent.java
4cfe4b130b25857eb508d297c4cf57c765cbad20
[]
no_license
IdelsTak/DiscLoader
200f7e1cdde1380e5e4a4d0c39568b9b5eb60db4
f8e79904f7ca177ffc1818f795cf7a52baabc0eb
refs/heads/master
2023-04-14T21:31:09.156828
2020-07-21T02:18:15
2020-07-21T02:18:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package io.discloader.discloader.common.event.voice; import io.discloader.discloader.entity.voice.VoiceConnection; /** * @author Perry Berman * */ public class VoiceConnectionDisconnectEvent extends VoiceConnectionEvent { /** * @param connection */ public VoiceConnectionDisconnectEvent(VoiceConnection connection) { super(connection); } }
[ "R3alCl0ud@gmail.com" ]
R3alCl0ud@gmail.com
9843638db668640712f09dd78d6488c6d9d9c477
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/transform/UntagResourceRequestProtocolMarshaller.java
84d62dda1b2a86ed691653379d0b0cd80c6f3825
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
2,630
java
/* * Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.pinpoint.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.pinpoint.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.protocol.*; import com.amazonaws.protocol.Protocol; import com.amazonaws.annotation.SdkInternalApi; /** * UntagResourceRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class UntagResourceRequestProtocolMarshaller implements Marshaller<Request<UntagResourceRequest>, UntagResourceRequest> { private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON).requestUri("/v1/tags/{resource-arn}") .httpMethodName(HttpMethodName.DELETE).hasExplicitPayloadMember(false).hasPayloadMembers(false).serviceName("AmazonPinpoint").build(); private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory; public UntagResourceRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) { this.protocolFactory = protocolFactory; } public Request<UntagResourceRequest> marshall(UntagResourceRequest untagResourceRequest) { if (untagResourceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { final ProtocolRequestMarshaller<UntagResourceRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING, untagResourceRequest); protocolMarshaller.startMarshalling(); UntagResourceRequestMarshaller.getInstance().marshall(untagResourceRequest, protocolMarshaller); return protocolMarshaller.finishMarshalling(); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
9889ba93314b79a80c93c9450b3d4489e69f6592
cd79f613c414878f9b29f9b73114d36b9d62db2c
/Phase_06/src/MenuItemHandler.java
4024ed8211a965f4c5f3222eb09d38980774abda
[]
no_license
VuppalaD/High-School-Database-Management
e608b4d79d379859d4417ff631a3115343d73d6b
6fe2b2849424eaa3d7b98dd770868279c697b5cf
refs/heads/master
2021-01-11T04:30:36.977673
2016-10-17T20:15:21
2016-10-17T20:15:21
70,944,454
0
0
null
null
null
null
UTF-8
Java
false
false
14,563
java
// ========================================== // Created by Gabriel Villanueva // CSCI 6333 // Phase 06 // ========================================== import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; import java.util.Vector; public class MenuItemHandler implements ActionListener { // Data members. private ClassIdPanel classIdPanel; private String schoolYear; // Constants. private static final String SELECT_CMD = "Select Class ID"; private static final String QUERY_CMD = "Query"; // Ctor. public MenuItemHandler() { classIdPanel = new ClassIdPanel(); } @Override public void actionPerformed(ActionEvent e) { onMenuItem(e); } private void onMenuItem(ActionEvent e) { JMenu menu = null; String query = null; String tableTitle = null; Vector results = null; if(e.getActionCommand().equals("Disconnect")) { Client.getInstance().getMainFrame().setConnectionPanel(); return; } if(e.getSource() instanceof JMenuItem) { JMenuItem menuItem = (JMenuItem) e.getSource(); JPopupMenu parent = (JPopupMenu) menuItem.getParent(); Component invoker = parent.getInvoker(); menu = (JMenu) invoker; } if(e.getActionCommand().equals("2011-2012")) { if(menu.getActionCommand().equals("Students Enrolled")) { query = "SELECT *\n" + "FROM Student s, EnrollsIn e, Classes c\n" + "WHERE s.studentId = e.studentId\n" + "AND e.classId = c.classId\n" + "AND c.schoolYear = '2011-2012';"; tableTitle = "Students Enrolled in Classes (2011-2012)"; } else if(menu.getActionCommand().equals("Class ID's")) { query = "SELECT c.classId\n" + "FROM Classes c\n" + "WHERE c.schoolYear = '2011-2012'\n" + "AND c.section_ = '1.1' OR c.section_ = '1.2';"; tableTitle = "Class ID's (2011-2012)"; } else if(menu.getActionCommand().equals("Average Score")) { query = "SELECT AVG(t.score) AS Average\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND k.schoolYear = '2011-2012';"; tableTitle = "Average Test Score (2011-2012)"; } else if(menu.getActionCommand().equals("Overall")) { query = "SELECT k.subject, COUNT(s.studentId) AS StudentCount, t.hasPassed\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND k.schoolYear = '2011-2012'\n" + "GROUP BY k.subject\n" + "HAVING t.hasPassed = 'Y';\n"; tableTitle = "Students that Passed Tests (2011-2012)"; } else if(menu.getActionCommand().equals("By Class ID")) { new PromptFrame( "Class ID", QUERY_CMD, classIdPanel, this ); schoolYear = "2011-2012"; return; } } else if(e.getActionCommand().equals("2012-2013")) { if(menu.getActionCommand().equals("Students Enrolled")) { query = "SELECT *\n" + "FROM Student s, EnrollsIn e, Classes c\n" + "WHERE s.studentId = e.studentId\n" + "AND e.classId = c.classId\n" + "AND c.schoolYear = '2012-2013';"; tableTitle = "Students Enrolled in Classes (2012-2013)"; } else if(menu.getActionCommand().equals("Class ID's")) { query = "SELECT c.classId\n" + "FROM Classes c\n" + "WHERE c.schoolYear = '2012-2013'\n" + "AND c.section_ = '1.1' OR c.section_ = '1.2';"; tableTitle = "Class ID's (2012-2013)"; } else if(menu.getActionCommand().equals("Average Score")) { query = "SELECT AVG(t.score) AS Average\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND k.schoolYear = '2012-2013';"; tableTitle = "Average Test Score (2012-2013)"; } else if(menu.getActionCommand().equals("Overall")) { query = "SELECT k.subject, COUNT(s.studentId) AS StudentCount, t.hasPassed\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND k.schoolYear = '2012-2013'\n" + "GROUP BY k.subject\n" + "HAVING t.hasPassed = 'Y';\n"; tableTitle = "Students that Passed Tests (2012-2013)"; } else if(menu.getActionCommand().equals("By Class ID")) { new PromptFrame( "Class ID", QUERY_CMD, classIdPanel, this ); schoolYear = "2012-2013"; return; } } else if(e.getActionCommand().equals("2013-2014")) { if(menu.getActionCommand().equals("Students Enrolled")) { query = "SELECT *\n" + "FROM Student s, EnrollsIn e, Classes c\n" + "WHERE s.studentId = e.studentId\n" + "AND e.classId = c.classId\n" + "AND c.schoolYear = '2013-2014';"; tableTitle = "Students Enrolled in Classes (2013-2014)"; } else if(menu.getActionCommand().equals("Class ID's")) { query = "SELECT c.classId\n" + "FROM Classes c\n" + "WHERE c.schoolYear = '2013-2014'\n" + "AND c.section_ = '1.1' OR c.section_ = '1.2';"; tableTitle = "Class ID's (2013-2014)"; } else if(menu.getActionCommand().equals("Average Score")) { query = "SELECT AVG(t.score) AS Average\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND k.schoolYear = '2013-2014';"; tableTitle = "Average Test Score (2013-2014)"; } else if(menu.getActionCommand().equals("Overall")) { query = "SELECT k.subject, COUNT(s.studentId) AS StudentCount, t.hasPassed\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND k.schoolYear = '2013-2014'\n" + "GROUP BY k.subject\n" + "HAVING t.hasPassed = 'Y';\n"; tableTitle = "Students that Passed Tests (2013-2014)"; } else if(menu.getActionCommand().equals("By Class ID")) { new PromptFrame( "Class ID", QUERY_CMD, classIdPanel, this ); schoolYear = "2013-2014"; return; } } else if(e.getActionCommand().equals("2014-2015")) { if(menu.getActionCommand().equals("Students Enrolled")) { query = "SELECT *\n" + "FROM Student s, EnrollsIn e, Classes c\n" + "WHERE s.studentId = e.studentId\n" + "AND e.classId = c.classId\n" + "AND c.schoolYear = '2014-2015';"; tableTitle = "Students Enrolled in Classes (2014-2015)"; } else if(menu.getActionCommand().equals("Class ID's")) { query = "SELECT c.classId\n" + "FROM Classes c\n" + "WHERE c.schoolYear = '2014-2015'\n" + "AND c.section_ = '1.1' OR c.section_ = '1.2';"; tableTitle = "Class ID's (2014-2015)"; } else if(menu.getActionCommand().equals("Average Score")) { query = "SELECT AVG(t.score) AS Average\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND k.schoolYear = '2014-2015';"; tableTitle = "Average Test Score (2014-2015)"; } else if(menu.getActionCommand().equals("Overall")) { query = "SELECT k.subject, COUNT(s.studentId) AS StudentCount, t.hasPassed\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND k.schoolYear = '2014-2015'\n" + "GROUP BY k.subject\n" + "HAVING t.hasPassed = 'Y';\n"; tableTitle = "Students that Passed Tests (2014-2015)"; } else if(menu.getActionCommand().equals("By Class ID")) { new PromptFrame( "Class ID", QUERY_CMD, classIdPanel, this ); schoolYear = "2014-2015"; return; } } else if(e.getActionCommand().equals("Not Passed")) { query = "SELECT s.name\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND t.hasPassed = 'N'\n" + "AND s.studentId NOT IN (\n" + "SELECT s.studentId\n" + "FROM Student s\n" + "WHERE s.level_ IN (9, 10, 11));"; tableTitle = "Students That Haven't Pass Tests"; } else if(e.getActionCommand().equals(QUERY_CMD)) { String classID = classIdPanel.getClassId(); query = "SELECT s.name, c.classId, t.hasPassed\n" + "FROM Student s, EnrollsIn e, Classes c, Takes t\n" + "WHERE s.studentId = e.studentId\n" + "AND e.classId = c.classId\n" + "AND c.schoolYear ='" + schoolYear + "'\n" + "AND c.classId =" + classID + "\n" + "AND s.studentId IN (\n" + "SELECT s.studentId\n" + "FROM Student s, Takes t, Test k\n" + "WHERE s.studentId = t.studentId\n" + "AND t.testId = k.testId\n" + "AND k.schoolYear ='" + schoolYear + "'\n" + "AND t.hasPassed = 'Y');"; tableTitle = "Students that Passed Classes & Tests (" + schoolYear +")"; } else if (e.getActionCommand().equals("Exit")) { System.exit(0); } if(query != null) { results = handleQuery(query); } if(results != null) { ResultsTablePanel resultsTablePanel = new ResultsTablePanel(results); new ResultsFrame(tableTitle, resultsTablePanel); } } private Vector handleQuery(String query) { Vector results = new Vector(); Connection connection = Client.getInstance().getConnector().getConnection(); try { Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery(query); ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); String[] columnNames = new String[columnCount]; for(int i = 0; i < columnCount; i++) { columnNames[i] = metaData.getColumnName(i + 1); } results.add(columnNames); while (resultSet.next()) { String[] values = new String[columnCount]; for(int i = 0; i < columnCount; i++) { values[i] = resultSet.getString(i + 1); } results.add(values); } } catch (SQLException ex) { results = null; String msg = "Failed to execute query.\n" + SQLExceptionReader.read(ex); JOptionPane.showMessageDialog( Client.getInstance().getMainFrame().getTaskPanel(), msg, "Query Failure", JOptionPane.ERROR_MESSAGE ); } return results; } }
[ "divya.amvn57@gmail.com" ]
divya.amvn57@gmail.com
21cf0256182350874d390b97b3a16d0704acb704
b5dcb550210c0c9bbaaee25c6fe68192ab577952
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/RoverRuckus/PennyslvaniaTeleop.java
bd2544d4a037fa46a3b543d556d49bcc7fbee92c
[ "BSD-3-Clause" ]
permissive
FTCteam9956/RoverRuckus1
21926b65df32c7395324e3f38ec53a545c4b0f56
10be0b8403bee2d51619e097ad487924dfb49ae1
refs/heads/master
2020-04-02T03:03:47.989290
2018-12-02T03:18:03
2018-12-02T03:18:03
153,944,156
2
1
null
null
null
null
UTF-8
Java
false
false
10,699
java
package org.firstinspires.ftc.teamcode.RoverRuckus; import android.provider.CalendarContract; import com.qualcomm.hardware.bosch.BNO055IMU; import com.qualcomm.hardware.bosch.JustLoggingAccelerationIntegrator; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DcMotorSimple; import com.qualcomm.robotcore.util.Range; import java.util.TimerTask; import java.util.Timer; import java.lang.Object; import org.firstinspires.ftc.robotcore.external.Func; import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder; import org.firstinspires.ftc.robotcore.external.navigation.AxesReference; import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; import org.openftc.revextensions2.ExpansionHubEx; import org.openftc.revextensions2.ExpansionHubMotor; import org.openftc.revextensions2.RevBulkData; import org.openftc.revextensions2.RevExtensions2; import java.util.Locale; @TeleOp(name = "Qualifier Teleop", group = "TeleOp") public class PennyslvaniaTeleop extends LinearOpMode { public RoverHardware robot = new RoverHardware(); public float leftPower; public float rightPower; public float xValue; public float yValue; ExpansionHubEx expansionHub; Timer stopMotor; ExpansionHubMotor left,right; RevBulkData bulkData; public void runOpMode(){ robot.init(hardwareMap); RevExtensions2.init(); expansionHub = hardwareMap.get(ExpansionHubEx.class, "Expansion Hub 2"); left = (ExpansionHubMotor) hardwareMap.dcMotor.get("left1"); right = (ExpansionHubMotor) hardwareMap.dcMotor.get("right1"); //Initialize Gyro BNO055IMU.Parameters parameters1 = new BNO055IMU.Parameters(); parameters1.angleUnit = BNO055IMU.AngleUnit.DEGREES; parameters1.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC; parameters1.calibrationDataFile = "BNO055IMUCalibration.json"; // see the calibration sample opmode parameters1.loggingEnabled = true; parameters1.loggingTag = "IMU"; parameters1.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator(); robot.imu = hardwareMap.get(BNO055IMU.class, "imu"); robot.imu.initialize(parameters1); composeTelemetry(); telemetry.addLine() .addData("heading", new Func<String>() { @Override public String value() { return robot.formatAngle(robot.angles.angleUnit, robot.angles.firstAngle); } }) .addData("roll", new Func<String>() { @Override public String value() { return robot.formatAngle(robot.angles.angleUnit, robot.angles.secondAngle); } }) .addData("pitch", new Func<String>() { @Override public String value() { return robot.formatAngle(robot.angles.angleUnit, robot.angles.thirdAngle); } }); telemetry.update(); waitForStart(); while(opModeIsActive()){ //GAMEPAD 1 //Arcade Style Drive Motors yValue = gamepad1.left_stick_y; xValue = gamepad1.left_stick_x; leftPower = yValue - xValue; rightPower = yValue + xValue; robot.left1.setPower(Range.clip(leftPower, -1.0, 1.0)); robot.right1.setPower(Range.clip(rightPower, -1.0, 1.0)); //Tank Drive (if driver prefers it // robot.left1.setPower(gamepad1.left_stick_y); // robot.right1.setPower(gamepad1.right_stick_y); //Arm that shoots blocks and balls if(gamepad1.right_trigger > 0.5) { robot.ballCatch.setPower(0.6); } else if(gamepad1.left_trigger > 0.5){ robot.ballCatch.setPower(-0.6); } //Hanging Mechanism if (gamepad1.dpad_up && robot.upperLimit.red() > 300){ robot.hang.setPower(1); } else if (gamepad1.dpad_down && robot.bottomLimit.red() < 100){ robot.hang.setPower(-1); } else{ robot.hang.setPower(0); } // //Shoots blocks // if (gamepad1.b){ // robot.launcher.setPower(-1); // stopMotor = new Timer(); // stopMotor.schedule(new PennyslvaniaTeleop.RemindTask(),1,5000); // // } //GAMEPAD 2 //Sets Servo Position to Top or Bottom if (gamepad2.y) { robot.drop.setPosition(robot.TOP_INTAKE); }else if(gamepad2.a){ robot.drop.setPosition(robot.BOTTOM_INTAKE); } //Moves intake arm in and out robot.bop.setPower(gamepad2.right_stick_y / 1.25); //Rotates the Intake Arm if(gamepad2.right_trigger >= 0.5){ robot.rotateMech.setPower(-gamepad1.right_trigger * 0.5); } else if (gamepad2.left_trigger >= 0.5){ robot.rotateMech.setPower(gamepad1.left_trigger * 0.5); } else { robot.rotateMech.setPower(0); } //Move intake in or out if(gamepad2.b){ robot.intake.setPower(0.6); } else if(gamepad2.a){ robot.intake.setPower(-0.6); } else{ robot.intake.setPower(0.0); } bulkData = expansionHub.getBulkInputData(); //Telemetry Section // telemetry.addData("Distance (cm)", //Checks what the distance sensor on the launcher sees // String.format(Locale.US, "%.02f", robot.senseOBJ.getDistance(DistanceUnit.CM))); // telemetry.addData("Left Power", leftPower); // telemetry.addData("Right Power", rightPower); // telemetry.addData("Gamepad Tigger", gamepad1.right_trigger); // telemetry.addData("upper red", robot.upperLimit.red()); // telemetry.addData("upper blue", robot.upperLimit.blue()); // telemetry.addData("bottom red", robot.bottomLimit.red()); // telemetry.addData("bottom blue", robot.bottomLimit.blue()); // telemetry.addData("stick", " y=" + yValue + " x=" + xValue); // telemetry.addData("power", " left=" + leftPower + " right=" + rightPower); // telemetry.addData("Arm power", robot.bop.getPower()); // telemetry.addData("Arm position", robot.bop.getCurrentPosition()); //telemetry.addData("Color Sensor RED", robot.cornerSensor.red()); //telemetry.addData("Color Sensor BLUE", robot.cornerSensor.blue()); // telemetry.addData("right power", robot.right1.getPower()); // telemetry.addData("right position", robot.right1.getCurrentPosition()); // telemetry.addData("left power", robot.left1.getPower()); // telemetry.addData("left position", robot.left1.getCurrentPosition()); // telemetry.addData("turret position", robot.rotateMech.getCurrentPosition()); // telemetry.addData("Turret Power", robot.rotateMech.getPower()); //telemetry.addData("heading", robot.angles.firstAngle); telemetry.addData("Total current", expansionHub.getTotalModuleCurrentDraw()); telemetry.addData("I2C current", expansionHub.getI2cBusCurrentDraw()); telemetry.addData("GPIO current", expansionHub.getGpioBusCurrentDraw()); telemetry.addData("Left current", left.getCurrentDraw()); telemetry.addData("Right current", right.getCurrentDraw()); telemetry.update(); } } class RemindTask extends TimerTask { public void run(){ robot.launcher.setPower(0); stopMotor.cancel(); } } void composeTelemetry() { telemetry.addAction(new Runnable() { @Override public void run() { robot.angles = robot.imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES); robot.gravity = robot.imu.getGravity(); } }); telemetry.addLine() .addData("status", new Func<String>() { @Override public String value() { return robot.imu.getSystemStatus().toShortString(); } }) .addData("calib", new Func<String>() { @Override public String value() { return robot.imu.getCalibrationStatus().toString(); } }); telemetry.addLine() .addData("heading", new Func<String>() { @Override public String value() { return robot.formatAngle(robot.angles.angleUnit, robot.angles.firstAngle); } }) .addData("roll", new Func<String>() { @Override public String value() { return robot.formatAngle(robot.angles.angleUnit, robot.angles.secondAngle); } }) .addData("pitch", new Func<String>() { @Override public String value() { return robot.formatAngle(robot.angles.angleUnit, robot.angles.thirdAngle); } }); telemetry.addLine() .addData("grvty", new Func<String>() { @Override public String value() { return robot.gravity.toString(); } }) .addData("mag", new Func<String>() { @Override public String value() { return String.format(Locale.getDefault(), "%.3f", Math.sqrt(robot.gravity.xAccel * robot.gravity.xAccel + robot.gravity.yAccel * robot.gravity.yAccel + robot.gravity.zAccel * robot.gravity.zAccel)); } }); } }
[ "34256192+Grant12345@users.noreply.github.com" ]
34256192+Grant12345@users.noreply.github.com
81aacd62169b3ee9a82624c725394924902b5be6
f7e993d1d9d33869d6b59b444d70653490c67b7a
/src/main/java/cn/lz/springboot_crud_415/controller/SaleController.java
d6497e82232dce90fcac548569ac327fe727f464
[]
no_license
daiwenxiang/springboot_demo423
9429d3dff88966981e4f7df45c9970d21fbcea08
6630a927926a8a3da3ce9154a6611ed40a28ddc0
refs/heads/master
2022-06-23T14:52:15.349180
2020-05-04T13:13:30
2020-05-04T13:13:30
258,083,661
0
0
null
null
null
null
UTF-8
Java
false
false
1,119
java
package cn.lz.springboot_crud_415.controller; import cn.lz.springboot_crud_415.service.SaleService; import com.github.pagehelper.PageInfo; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; import java.util.Map; @RestController @CrossOrigin public class SaleController { @Resource SaleService saleService; @GetMapping("getSales") public List<Map> getAllSales() { return saleService.getAll(); } @GetMapping("getSale") public Map getSale(@RequestParam("id") Integer id) { return saleService.getSale(id); } @DeleteMapping("del") public Integer del(@RequestParam("id") Integer id) { return saleService.del(id); } @GetMapping("getByPage") public PageInfo<Map> getByPage(@RequestParam Map map) { return saleService.getByPage(map); } @RequestMapping("add") public int add(@RequestParam Map map) { return saleService.add(map); } @PutMapping("update") public Integer update(@RequestParam Map map) { return saleService.update(map); } }
[ "dwx15@hotmail.com" ]
dwx15@hotmail.com
23c227ef6df712a9ef3d9f0e9bf54ade2bd46148
dfa6bc000ea174ccbcb3597bb5ce81fb4f763b48
/spring/src/main/java/com/oputyk/librick/security/JWTAuthenticationFilter.java
11aaf4073ca6ac987f86f2c9993d94cbe0a793a7
[]
no_license
oputyk/Librick
c02851091e744680eb4ef6a925bd99114327da05
090792eba95fd764b2fec5ffba4b5b66e98c7bc1
refs/heads/master
2021-09-14T11:08:41.709316
2018-05-12T12:58:58
2018-05-12T12:58:58
120,014,651
1
1
null
null
null
null
UTF-8
Java
false
false
3,049
java
package com.oputyk.librick.security; import com.fasterxml.jackson.databind.ObjectMapper; import com.oputyk.librick.user.domain.UserEntity; import com.oputyk.librick.user.dto.CredentialsUserDto; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.stream.Collectors; import static com.oputyk.librick.security.SecurityConstants.*; public class JWTAuthenticationFilter extends UsernamePasswordAuthenticationFilter { private AuthenticationManager authenticationManager; public JWTAuthenticationFilter(AuthenticationManager authenticationManager) { this.authenticationManager = authenticationManager; } @Override public Authentication attemptAuthentication(HttpServletRequest req, HttpServletResponse res) throws AuthenticationException { try { CredentialsUserDto credentialsUserDto = new ObjectMapper() .readValue(req.getInputStream(), CredentialsUserDto.class); return authenticationManager.authenticate( new UsernamePasswordAuthenticationToken( credentialsUserDto.getEmail(), credentialsUserDto.getPassword(), new ArrayList<>())); } catch (IOException e) { throw new RuntimeException(e); } } @Override protected void successfulAuthentication(HttpServletRequest req, HttpServletResponse res, FilterChain chain, Authentication auth) throws IOException, ServletException { String token = Jwts.builder() .setSubject(((User) auth.getPrincipal()).getUsername()) .setExpiration(new Date(System.currentTimeMillis() + expirationTime)) .signWith(SignatureAlgorithm.HS512, secret.getBytes()) .compact(); res.addHeader(headerString, tokenPrefix + " " + token); } }
[ "kamilp06@gmail.com" ]
kamilp06@gmail.com
bdde80a25f8360b0c5b93ae9d3c06aeb6105dee0
7bad78195069d3b86b4ad5a3c07a0f1c692843ca
/configurate-typesafe/src/main/java/com/typesafe/config/modded/parser/ConfigDocumentFactory.java
8b2bf5dcfba8bd5683545c92cd0002999e07ebca
[]
no_license
AbstractMenus/configurate
4ad2eb13c9ef2e50fcbbac80e68f82a6ce97d737
0c6f6e1b1e08df49912f52baf3bcadfc3281744b
refs/heads/main
2023-06-29T10:00:19.191531
2021-07-27T12:07:30
2021-07-27T12:07:30
389,927,634
0
0
null
null
null
null
UTF-8
Java
false
false
2,909
java
package com.typesafe.config.modded.parser; import com.typesafe.config.modded.ConfigParseOptions; import com.typesafe.config.modded.impl.Parseable; import com.typesafe.config.modded.ConfigException; import java.io.File; import java.io.Reader; /** * Factory for creating {@link * ConfigDocument} instances. */ public final class ConfigDocumentFactory { /** * Parses a Reader into a ConfigDocument instance. * * @param reader * the reader to parse * @param options * parse options to control how the reader is interpreted * @return the parsed configuration * @throws ConfigException on IO or parse errors */ public static ConfigDocument parseReader(Reader reader, ConfigParseOptions options) { return Parseable.newReader(reader, options).parseConfigDocument(); } /** * Parses a reader into a Config instance as with * {@link #parseReader(Reader,ConfigParseOptions)} but always uses the * default parse options. * * @param reader * the reader to parse * @return the parsed configuration * @throws ConfigException on IO or parse errors */ public static ConfigDocument parseReader(Reader reader) { return parseReader(reader, ConfigParseOptions.defaults()); } /** * Parses a file into a ConfigDocument instance. * * @param file * the file to parse * @param options * parse options to control how the file is interpreted * @return the parsed configuration * @throws ConfigException on IO or parse errors */ public static ConfigDocument parseFile(File file, ConfigParseOptions options) { return Parseable.newFile(file, options).parseConfigDocument(); } /** * Parses a file into a ConfigDocument instance as with * {@link #parseFile(File,ConfigParseOptions)} but always uses the * default parse options. * * @param file * the file to parse * @return the parsed configuration * @throws ConfigException on IO or parse errors */ public static ConfigDocument parseFile(File file) { return parseFile(file, ConfigParseOptions.defaults()); } /** * Parses a string which should be valid HOCON or JSON. * * @param s string to parse * @param options parse options * @return the parsed configuration */ public static ConfigDocument parseString(String s, ConfigParseOptions options) { return Parseable.newString(s, options).parseConfigDocument(); } /** * Parses a string (which should be valid HOCON or JSON). Uses the * default parse options. * * @param s string to parse * @return the parsed configuration */ public static ConfigDocument parseString(String s) { return parseString(s, ConfigParseOptions.defaults()); } }
[ "nanitmix@gmail.com" ]
nanitmix@gmail.com
25cb8a026bbc50b82d4c4a79977c77474d1288d3
c9f60875eab52f2f3d70b918281ad0bd08010b7f
/webworkspace4/04_SpringAOP/src/main/java/org/kh/member/common/MemberPasswordAdvice.java
129a5aafa5284268fd9676f929fa1321079ebc20
[]
no_license
skosko00/seongmin
8acc7db105a9e70d8e69805702e4debbe7f428f8
8ca7995ab6fdd7514a1ff49741e9ef45f6f315e7
refs/heads/master
2021-01-20T18:30:09.156647
2018-07-18T00:25:29
2018-07-18T00:25:29
90,919,920
1
0
null
null
null
null
UTF-8
Java
false
false
940
java
package org.kh.member.common; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.kh.member.model.vo.Member; import org.springframework.stereotype.Service; @Service @Aspect public class MemberPasswordAdvice { @Pointcut("execution (* org.kh.member.model.service.*ServiceImpl.*Member(org.kh.member.model.vo.Member))") public void encrytionPass() {} @Before("encrytionPass()") public void passwordEncrytion(JoinPoint jp) throws Exception{ Member vo = (Member)jp.getArgs()[0]; String userPw = vo.getUserPw(); // 유저 비밀번호 String encryPw = SHA256Util.encryptData(userPw); vo.setUserPw(encryPw); System.out.println("비밀번호 암호화 완료"); System.out.println("암호화 전 데이터 : " + userPw); System.out.println("암호화 후 데이터 : " + encryPw); } }
[ "skosko00@naver.com" ]
skosko00@naver.com
f8c8a0ad1f5ea3c26bf759ec24a6c325e6a5c3bb
558db29c77d9b244503b11d7927eea60c63cfbe4
/Ybigorithm/Work.java
efded7c9103e0408e92d66ab0e67a786a022c9f7
[]
no_license
sangjoo3627/Algorithm
ab8ddd7763176733fb9bf36b12161d3181385e67
b81c6d54ddbfbee9a9ac64a6d9591088d3761784
refs/heads/master
2021-08-17T04:47:02.234751
2018-10-01T15:46:51
2018-10-01T15:46:51
135,458,212
0
0
null
null
null
null
UHC
Java
false
false
1,364
java
import java.util.*; public class Work { public static void main(String[] args) { Scanner sc = new Scanner (System.in); int N = sc.nextInt(); Node [] arr = new Node[N+1]; boolean [] check = new boolean[N+1]; // Set input for(int i=1; i<=N; i++){ int remain = sc.nextInt(); arr[i] = new Node(remain); int num = sc.nextInt(); if(num != 0) { for(int j=0; j<num; j++){ int add = sc.nextInt(); arr[i].addNode(add); } } } int time = 1; while(true){ boolean end = false; for(int i=1; i<=N; i++){ if(arr[i].exec == 0 && arr[i].remain > 0){ end = true; arr[i].remain--; if(arr[i].remain == 0) check[i] = true; } } for(int i=1; i<=N; i++){ for(int j=0; j<arr[i].exec; j++){ if(check[arr[i].pre.get(j)] == true){ end = true; arr[i].pre.remove(j); } } } if(end) time++; else break; } System.out.println(time); } } class Node { int exec; // 선행작업의 개수 (0이면 실행상태) int remain; // 남아있는 실행시간 ArrayList <Integer> pre; // 선행작업 list Node(int x){ remain = x; pre = new ArrayList <Integer>(); exec = pre.size(); } void addNode (int x){ pre.add(x); } }
[ "dltkdltk13@naver.com" ]
dltkdltk13@naver.com
1cd9579aa0566dd92183f170623e1208534e5265
1ba1a97a9bc8ed18fc088add854daeb09988c22d
/SpringCloud/clould/seata-order-service2002/src/main/java/com/oy/springcloud/SeataStorageServiceApplication2002.java
c043a43b542e2ad81d4c824951db9c7b0a3f55f2
[]
no_license
OY6090/CodeWorkSpace
52519aaf8774adbed64c39199831fb58d85ce2a6
e0cbe6512410bc9c1e3a84055fbc74429f91bf5d
refs/heads/main
2023-01-22T04:18:57.906120
2020-12-07T09:28:48
2020-12-07T09:28:48
316,268,989
0
0
null
null
null
null
UTF-8
Java
false
false
582
java
package com.oy.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; /** * @Author OY * @Date 2020/11/16 */ @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients public class SeataStorageServiceApplication2002 { public static void main(String[] args) { SpringApplication.run(SeataStorageServiceApplication2002.class, args); } }
[ "2097291754@qq.com" ]
2097291754@qq.com
8a4d223f0a72bc960252f064f13159434e942c03
bc9c3091d43c8dd12c3e9c40834cfddace3bfb2a
/centrals/android/app/src/main/java/net/waveson/war/SettingsActivity.java
0f37c013d109174e91ba0546592c07685661dc13
[]
no_license
viathefalcon/war
68e56a513614b383d1b3a26dd84db506c64687be
49606c79520e53b39b284a846a837d5ac40d1048
refs/heads/master
2021-06-17T19:05:59.556503
2021-02-17T23:49:32
2021-02-17T23:49:32
172,580,801
0
0
null
2021-02-17T23:49:32
2019-02-25T20:37:47
Java
UTF-8
Java
false
false
7,003
java
package net.waveson.war; import java.util.Set; import java.util.HashSet; import android.os.Build; import android.os.Bundle; import android.view.MenuItem; import android.content.Context; import android.content.res.Configuration; import android.preference.Preference; import android.preference.ListPreference; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.support.v7.app.ActionBar; import android.annotation.TargetApi; /** * A {@link PreferenceActivity} that presents a set of application settings. On * handset devices, settings are presented as a single list. On tablets, * settings are split by category, with category headers shown to the left of * the list of settings. * <p> * See <a href="http://developer.android.com/design/patterns/settings.html"> * Android Design: Settings</a> for design guidelines and the <a * href="http://developer.android.com/guide/topics/ui/settings.html">Settings * API Guide</a> for more information on developing a Settings UI. */ public class SettingsActivity extends AppCompatPreferenceActivity { private final static Set<String> TIME_KEYS = new HashSet<>( ); static { TIME_KEYS.add( Preferences.GATT_DELAY_KEY ); TIME_KEYS.add( Preferences.RETRY_INTERVAL_KEY ); } /** * A preference value change listener that updates the preference's summary * to reflect its new value. */ private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list. ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); // Set the summary to reflect the new value. preference.setSummary( index >= 0 ? listPreference.getEntries()[index] : null); }else if (TIME_KEYS.contains( preference.getKey( ) )){ preference.setSummary( preference .getContext( ) .getString( R.string.pref_summary_gatt_delay, stringValue ) ); } else { // For all other preferences, set the summary to the value's // simple string representation. preference.setSummary(stringValue); } return true; } }; /** * Helper method to determine if the device has an extra-large screen. For * example, 10" tablets are extra-large. */ private static boolean isXLargeTablet(Context context) { return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE; } /** * Binds a preference's summary to its value. More specifically, when the * preference's value is changed, its summary (line of text below the * preference title) is updated to reflect the value. The summary is also * immediately updated upon calling this method. The exact display format is * dependent on the type of preference. * * @see #sBindPreferenceSummaryToValueListener */ private static void bindPreferenceSummaryToValue(Preference preference) { // Set the listener to watch for value changes. preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); // Trigger the listener immediately with the preference's // current value. sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, PreferenceManager .getDefaultSharedPreferences(preference.getContext()) .getString(preference.getKey(), "")); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setupActionBar(); this.getFragmentManager() .beginTransaction() .replace( android.R.id.content, new GeneralPreferenceFragment()) .commit(); } /** * Set up the {@link android.app.ActionBar}, if the API is available. */ private void setupActionBar() { ActionBar actionBar = getSupportActionBar( ); if (actionBar != null) { // Show the 'Up' button in the action bar. actionBar.setDisplayHomeAsUpEnabled( true ); } } /** * {@inheritDoc} */ @Override public boolean onIsMultiPane() { return isXLargeTablet(this); } /** * {@inheritDoc} @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onBuildHeaders(List<Header> target) { loadHeadersFromResource(R.xml.pref_headers, target); } */ /** * This method stops fragment injection in malicious applications. * Make sure to deny any unknown fragments here. */ protected boolean isValidFragment(String fragmentName) { return PreferenceFragment.class.getName().equals(fragmentName) || GeneralPreferenceFragment.class.getName().equals(fragmentName); } /** * This fragment shows general preferences only. It is used when the * activity is showing a two-pane settings UI. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static class GeneralPreferenceFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_general); setHasOptionsMenu(true); // Bind the summaries of EditText/List/Dialog/Ringtone preferences // to their values. When their values change, their summaries are // updated to reflect the new value, per the Android Design // guidelines. bindPreferenceSummaryToValue(findPreference(Preferences.GATT_DELAY_KEY)); bindPreferenceSummaryToValue(findPreference(Preferences.RETRY_INTERVAL_KEY)); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { // startActivity(new Intent(getActivity(), SettingsActivity.class)); return true; } return super.onOptionsItemSelected(item); } } }
[ "stephen.higgins@outlook.com" ]
stephen.higgins@outlook.com
9b56ba6aee6ab389f67a4959e30d3fb1c3dba2a8
edd79e24d886c614e7a818782d4210632cfe4f48
/04_passenger_management/mstraining-impl/src/main/java/co/zero/mstraining/web/controller/PassengerControllerI.java
b5528d72ae20617fcaeec40928fa47de13da9c00
[]
no_license
htenjo/microservice_training
6e5e97ca3232e43e1ef97c6b379ab9a9731239ea
2fae79b97a1de54a004beda2fd9e9e324ac4d5d1
refs/heads/master
2022-05-01T01:37:56.876281
2022-04-08T12:06:35
2022-04-08T12:06:35
219,393,942
0
0
null
2022-04-08T12:06:37
2019-11-04T01:39:21
Java
UTF-8
Java
false
false
830
java
package co.zero.mstraining.web.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import java.util.concurrent.CompletableFuture; //@RequestMapping(PassengerControllerI.PASSENGER_PATH) public interface PassengerControllerI { // String PASSENGER_PATH = "/passenger"; // // @PostMapping // CompletableFuture<String> registerPassenger(); // // @GetMapping("/{passengerId}") // CompletableFuture<String> getPassengerUserDetails(@PathVariable String passengerId); // // @GetMapping("/{passengerId}/recent-destinations") // CompletableFuture<String> getRecentDestinations(@PathVariable String passengerId); }
[ "hernan.tenjo@globant.com" ]
hernan.tenjo@globant.com
d8809c8c01e4320a914ca3ca15e96a485bfceaed
dd02a8c7811a41173524c1fdf3f67cb7e5e52783
/src/test/java/org/baswell/easybeans/TestNotifications.java
889ceffe37a69d06c80ab96914d9fd1c87e5a589
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
baswerc/easybeans
5f88b88389912b0078952f26f98581f1057bbaed
f91eeb7e0ab2fde0d780c555d38c7fe545690b98
refs/heads/master
2021-01-15T09:32:48.939689
2017-09-06T14:21:48
2017-09-06T14:21:48
27,183,892
2
0
null
null
null
null
UTF-8
Java
false
false
1,658
java
package org.baswell.easybeans; import org.junit.*; import javax.management.Notification; import javax.management.NotificationListener; import java.lang.management.ManagementFactory; import static org.junit.Assert.*; public class TestNotifications { @org.junit.Test public void testNotification() throws Exception { NotificationSender sender = new NotificationSender(); EasyBeanNotificationWrapper wrapper = new EasyBeanNotificationWrapper(sender); EasyBeansRegistery registry = new EasyBeansRegistery(); registry.register(wrapper); assertNotNull(sender.easyBeansNotifier); TestNotificationListener listener = new TestNotificationListener(); ManagementFactory.getPlatformMBeanServer().addNotificationListener(wrapper.objectName, listener, null , null); sender.easyBeansNotifier.notify("TEST", "HELLO"); assertNotNull(listener.notification); assertEquals("TEST", listener.notification.getType()); assertEquals("HELLO", listener.notification.getMessage()); } class NotificationSender implements EasyBeansNotifierUser { EasyBeansNotifier easyBeansNotifier; @Override public void setNotifier(EasyBeansNotifier easyBeansNotifier) { this.easyBeansNotifier = easyBeansNotifier; } } class TestNotificationListener implements NotificationListener { Notification notification; Object handback; @Override public void handleNotification(Notification notification, Object handback) { this.notification = notification; this.handback = handback; } void reset() { notification = null; handback = null; } } }
[ "corey.baswell@gmail.com" ]
corey.baswell@gmail.com
6f6dd3f18c496eb5a2b15c673f846d49e4371040
b82237c1472f450e059b801b9f1cc284196085ca
/src/RemoveDuplicates_Ernst_Fanfan.java
fc5969b25833868eec8d4dd188a411e689b20257
[]
no_license
ernst-fanfan/A5
1c01b2cc41ed509c192f7c6b8af5425697dad6c2
7eb883a46a503b9bd248856848b85cc7784dabc1
refs/heads/master
2020-09-10T18:36:12.993918
2019-11-23T04:29:58
2019-11-23T04:29:58
221,798,311
0
0
null
null
null
null
UTF-8
Java
false
false
4,626
java
//Class: CS 5040 //Term: Fall 2019 //Name: Ernst Fanfan //Instructor: Dr. Haddad //Assignment: 5 //IDE Name: IntelliJ import java.io.*; import java.util.InputMismatchException; import java.util.*; public class RemoveDuplicates_Ernst_Fanfan { public static void main (String [] Args){ boolean exit = false;//exit trigger /**Start of program*/ while(exit != true) {//main loop Menu_Ernst_Fanfan start = new Menu_Ernst_Fanfan();//new menu object int choice = start.setChoice();//Scan and pass choice exit = level2(choice);//process choice and query exit } } /********************* * Level 2 of program* * *******************/ private static boolean level2(int choice) {//controls flow to the second lvl of program boolean exit = false;//holds exit trigger if (choice == 0) exit = true; else if (choice == 1) processFromFile(); else processFromUser(); return exit; } /**path 1 start*/ private static void processFromFile() {//request file path and name from user, load data then pass to lvl 3 boolean exit = false; while (exit != true) { try { System.out.print("Please provide file to process:\t"); Scanner inputString = new Scanner(System.in);//new scanner String fileName = inputString.nextLine();//scan file name Scanner fileContents = new Scanner(new File(fileName));//load file to V-file System.out.println("Original text from input file:\n"); while (fileContents.hasNext()){//display file System.out.print(fileContents.next() +" "); } BST_Ernst_Fanfan<String> loadedFile = new BST_Ernst_Fanfan<String>();//new BST fileContents = new Scanner(new File(fileName));//reload file to V-file load2BST(fileContents,loadedFile); saveToFile(loadedFile); System.out.println("\nProcessed text is saved to output file."); exit = true; } catch (FileNotFoundException e) { System.out.println("\nFile not fount!\n"); exit = false; } } } /**path 2 start*/ private static void processFromUser() {//request input from user then pass data to lvl 3 System.out.print("Please enter text to process:\t"); Scanner inputLine = new Scanner(System.in);//new scanner String lineInputed = inputLine.nextLine();//scan to string System.out.println("Original Text:\n" + lineInputed);//feedback input Scanner lineContent = new Scanner(lineInputed);//load string to new scanner BST_Ernst_Fanfan<String> loadedFile = new BST_Ernst_Fanfan<String>();//new BST load2BST(lineContent, loadedFile);//load input to BST System.out.println("\nProcessed Text:"); loadedFile.inorder();//remove duplicates and display in order } /********************* * Level 3 of Program* * *******************/ /**all paths merge here*/ private static void load2BST(Scanner fileContents, BST_Ernst_Fanfan<String> loadedFile){//takes in test loads to BST while(fileContents.hasNext()){ loadedFile.insert(fileContents.next()); } } /********************* * Level 4 of Program* * *******************/ /**save to file*/ public static void saveToFile(BST_Ernst_Fanfan<String> tree) { boolean exit = false; while (exit != true) { try { System.out.print("\nPlease provide output file:\t"); Scanner inputString = new Scanner(System.in);//new scanner String fileName = inputString.nextLine(); File originalTest = new File(fileName);//creat logical file originalTest.createNewFile();//create file PrintStream output = new PrintStream(new File(fileName));//create output stream Iterator iterator = tree.iterator();//iterate tree while (iterator.hasNext()) {//save to file loop output.print(iterator.next() + " "); //read one word at a time } exit = true; } catch (FileNotFoundException e) { System.out.println("\nFile not fount!\n"); } catch (IOException e) { System.out.println("\nUnable to save file in that location!\n"); } } } }
[ "ernst.r.fanfan@gmail.com" ]
ernst.r.fanfan@gmail.com
4bbd334b2cae337d11d98af31d0d9864b3282941
cec0c2fa585c3f788fc8becf24365e56bce94368
/it/unimi/dsi/fastutil/bytes/Byte2ShortOpenHashMap.java
f1b905c06d77ae9987d15995e5d63094d263b9bc
[]
no_license
maksym-pasichnyk/Server-1.16.3-Remapped
358f3c4816cbf41e137947329389edf24e9c6910
4d992e2d9d4ada3ecf7cecc039c4aa0083bc461e
refs/heads/master
2022-12-15T08:54:21.236174
2020-09-19T16:13:43
2020-09-19T16:13:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
42,780
java
/* */ package it.unimi.dsi.fastutil.bytes; /* */ /* */ import it.unimi.dsi.fastutil.Hash; /* */ import it.unimi.dsi.fastutil.HashCommon; /* */ import it.unimi.dsi.fastutil.SafeMath; /* */ import it.unimi.dsi.fastutil.objects.AbstractObjectSet; /* */ import it.unimi.dsi.fastutil.objects.ObjectIterator; /* */ import it.unimi.dsi.fastutil.objects.ObjectSet; /* */ import it.unimi.dsi.fastutil.shorts.AbstractShortCollection; /* */ import it.unimi.dsi.fastutil.shorts.ShortCollection; /* */ import it.unimi.dsi.fastutil.shorts.ShortIterator; /* */ import java.io.IOException; /* */ import java.io.ObjectInputStream; /* */ import java.io.ObjectOutputStream; /* */ import java.io.Serializable; /* */ import java.util.Arrays; /* */ import java.util.Collection; /* */ import java.util.Iterator; /* */ import java.util.Map; /* */ import java.util.NoSuchElementException; /* */ import java.util.Objects; /* */ import java.util.Set; /* */ import java.util.function.BiFunction; /* */ import java.util.function.Consumer; /* */ import java.util.function.IntConsumer; /* */ import java.util.function.IntFunction; /* */ import java.util.function.IntUnaryOperator; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class Byte2ShortOpenHashMap /* */ extends AbstractByte2ShortMap /* */ implements Serializable, Cloneable, Hash /* */ { /* */ private static final long serialVersionUID = 0L; /* */ private static final boolean ASSERTS = false; /* */ protected transient byte[] key; /* */ protected transient short[] value; /* */ protected transient int mask; /* */ protected transient boolean containsNullKey; /* */ protected transient int n; /* */ protected transient int maxFill; /* */ protected final transient int minN; /* */ protected int size; /* */ protected final float f; /* */ protected transient Byte2ShortMap.FastEntrySet entries; /* */ protected transient ByteSet keys; /* */ protected transient ShortCollection values; /* */ /* */ public Byte2ShortOpenHashMap(int expected, float f) { /* 96 */ if (f <= 0.0F || f > 1.0F) /* 97 */ throw new IllegalArgumentException("Load factor must be greater than 0 and smaller than or equal to 1"); /* 98 */ if (expected < 0) /* 99 */ throw new IllegalArgumentException("The expected number of elements must be nonnegative"); /* 100 */ this.f = f; /* 101 */ this.minN = this.n = HashCommon.arraySize(expected, f); /* 102 */ this.mask = this.n - 1; /* 103 */ this.maxFill = HashCommon.maxFill(this.n, f); /* 104 */ this.key = new byte[this.n + 1]; /* 105 */ this.value = new short[this.n + 1]; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Byte2ShortOpenHashMap(int expected) { /* 114 */ this(expected, 0.75F); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public Byte2ShortOpenHashMap() { /* 122 */ this(16, 0.75F); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Byte2ShortOpenHashMap(Map<? extends Byte, ? extends Short> m, float f) { /* 133 */ this(m.size(), f); /* 134 */ putAll(m); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Byte2ShortOpenHashMap(Map<? extends Byte, ? extends Short> m) { /* 144 */ this(m, 0.75F); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Byte2ShortOpenHashMap(Byte2ShortMap m, float f) { /* 155 */ this(m.size(), f); /* 156 */ putAll(m); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Byte2ShortOpenHashMap(Byte2ShortMap m) { /* 166 */ this(m, 0.75F); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Byte2ShortOpenHashMap(byte[] k, short[] v, float f) { /* 181 */ this(k.length, f); /* 182 */ if (k.length != v.length) { /* 183 */ throw new IllegalArgumentException("The key array and the value array have different lengths (" + k.length + " and " + v.length + ")"); /* */ } /* 185 */ for (int i = 0; i < k.length; i++) { /* 186 */ put(k[i], v[i]); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Byte2ShortOpenHashMap(byte[] k, short[] v) { /* 200 */ this(k, v, 0.75F); /* */ } /* */ private int realSize() { /* 203 */ return this.containsNullKey ? (this.size - 1) : this.size; /* */ } /* */ private void ensureCapacity(int capacity) { /* 206 */ int needed = HashCommon.arraySize(capacity, this.f); /* 207 */ if (needed > this.n) /* 208 */ rehash(needed); /* */ } /* */ private void tryCapacity(long capacity) { /* 211 */ int needed = (int)Math.min(1073741824L, /* 212 */ Math.max(2L, HashCommon.nextPowerOfTwo((long)Math.ceil(((float)capacity / this.f))))); /* 213 */ if (needed > this.n) /* 214 */ rehash(needed); /* */ } /* */ private short removeEntry(int pos) { /* 217 */ short oldValue = this.value[pos]; /* 218 */ this.size--; /* 219 */ shiftKeys(pos); /* 220 */ if (this.n > this.minN && this.size < this.maxFill / 4 && this.n > 16) /* 221 */ rehash(this.n / 2); /* 222 */ return oldValue; /* */ } /* */ private short removeNullEntry() { /* 225 */ this.containsNullKey = false; /* 226 */ short oldValue = this.value[this.n]; /* 227 */ this.size--; /* 228 */ if (this.n > this.minN && this.size < this.maxFill / 4 && this.n > 16) /* 229 */ rehash(this.n / 2); /* 230 */ return oldValue; /* */ } /* */ /* */ public void putAll(Map<? extends Byte, ? extends Short> m) { /* 234 */ if (this.f <= 0.5D) { /* 235 */ ensureCapacity(m.size()); /* */ } else { /* 237 */ tryCapacity((size() + m.size())); /* */ } /* 239 */ super.putAll(m); /* */ } /* */ /* */ private int find(byte k) { /* 243 */ if (k == 0) { /* 244 */ return this.containsNullKey ? this.n : -(this.n + 1); /* */ } /* 246 */ byte[] key = this.key; /* */ byte curr; /* */ int pos; /* 249 */ if ((curr = key[pos = HashCommon.mix(k) & this.mask]) == 0) /* 250 */ return -(pos + 1); /* 251 */ if (k == curr) { /* 252 */ return pos; /* */ } /* */ while (true) { /* 255 */ if ((curr = key[pos = pos + 1 & this.mask]) == 0) /* 256 */ return -(pos + 1); /* 257 */ if (k == curr) /* 258 */ return pos; /* */ } /* */ } /* */ private void insert(int pos, byte k, short v) { /* 262 */ if (pos == this.n) /* 263 */ this.containsNullKey = true; /* 264 */ this.key[pos] = k; /* 265 */ this.value[pos] = v; /* 266 */ if (this.size++ >= this.maxFill) { /* 267 */ rehash(HashCommon.arraySize(this.size + 1, this.f)); /* */ } /* */ } /* */ /* */ /* */ public short put(byte k, short v) { /* 273 */ int pos = find(k); /* 274 */ if (pos < 0) { /* 275 */ insert(-pos - 1, k, v); /* 276 */ return this.defRetValue; /* */ } /* 278 */ short oldValue = this.value[pos]; /* 279 */ this.value[pos] = v; /* 280 */ return oldValue; /* */ } /* */ private short addToValue(int pos, short incr) { /* 283 */ short oldValue = this.value[pos]; /* 284 */ this.value[pos] = (short)(oldValue + incr); /* 285 */ return oldValue; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public short addTo(byte k, short incr) { /* */ int pos; /* 305 */ if (k == 0) { /* 306 */ if (this.containsNullKey) /* 307 */ return addToValue(this.n, incr); /* 308 */ pos = this.n; /* 309 */ this.containsNullKey = true; /* */ } else { /* */ /* 312 */ byte[] key = this.key; /* */ byte curr; /* 314 */ if ((curr = key[pos = HashCommon.mix(k) & this.mask]) != 0) { /* 315 */ if (curr == k) /* 316 */ return addToValue(pos, incr); /* 317 */ while ((curr = key[pos = pos + 1 & this.mask]) != 0) { /* 318 */ if (curr == k) /* 319 */ return addToValue(pos, incr); /* */ } /* */ } /* 322 */ } this.key[pos] = k; /* 323 */ this.value[pos] = (short)(this.defRetValue + incr); /* 324 */ if (this.size++ >= this.maxFill) { /* 325 */ rehash(HashCommon.arraySize(this.size + 1, this.f)); /* */ } /* */ /* 328 */ return this.defRetValue; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected final void shiftKeys(int pos) { /* 341 */ byte[] key = this.key; while (true) { /* */ byte curr; int last; /* 343 */ pos = (last = pos) + 1 & this.mask; /* */ while (true) { /* 345 */ if ((curr = key[pos]) == 0) { /* 346 */ key[last] = 0; /* */ return; /* */ } /* 349 */ int slot = HashCommon.mix(curr) & this.mask; /* 350 */ if ((last <= pos) ? (last >= slot || slot > pos) : (last >= slot && slot > pos)) /* */ break; /* 352 */ pos = pos + 1 & this.mask; /* */ } /* 354 */ key[last] = curr; /* 355 */ this.value[last] = this.value[pos]; /* */ } /* */ } /* */ /* */ /* */ public short remove(byte k) { /* 361 */ if (k == 0) { /* 362 */ if (this.containsNullKey) /* 363 */ return removeNullEntry(); /* 364 */ return this.defRetValue; /* */ } /* */ /* 367 */ byte[] key = this.key; /* */ byte curr; /* */ int pos; /* 370 */ if ((curr = key[pos = HashCommon.mix(k) & this.mask]) == 0) /* 371 */ return this.defRetValue; /* 372 */ if (k == curr) /* 373 */ return removeEntry(pos); /* */ while (true) { /* 375 */ if ((curr = key[pos = pos + 1 & this.mask]) == 0) /* 376 */ return this.defRetValue; /* 377 */ if (k == curr) { /* 378 */ return removeEntry(pos); /* */ } /* */ } /* */ } /* */ /* */ public short get(byte k) { /* 384 */ if (k == 0) { /* 385 */ return this.containsNullKey ? this.value[this.n] : this.defRetValue; /* */ } /* 387 */ byte[] key = this.key; /* */ byte curr; /* */ int pos; /* 390 */ if ((curr = key[pos = HashCommon.mix(k) & this.mask]) == 0) /* 391 */ return this.defRetValue; /* 392 */ if (k == curr) { /* 393 */ return this.value[pos]; /* */ } /* */ while (true) { /* 396 */ if ((curr = key[pos = pos + 1 & this.mask]) == 0) /* 397 */ return this.defRetValue; /* 398 */ if (k == curr) { /* 399 */ return this.value[pos]; /* */ } /* */ } /* */ } /* */ /* */ public boolean containsKey(byte k) { /* 405 */ if (k == 0) { /* 406 */ return this.containsNullKey; /* */ } /* 408 */ byte[] key = this.key; /* */ byte curr; /* */ int pos; /* 411 */ if ((curr = key[pos = HashCommon.mix(k) & this.mask]) == 0) /* 412 */ return false; /* 413 */ if (k == curr) { /* 414 */ return true; /* */ } /* */ while (true) { /* 417 */ if ((curr = key[pos = pos + 1 & this.mask]) == 0) /* 418 */ return false; /* 419 */ if (k == curr) /* 420 */ return true; /* */ } /* */ } /* */ /* */ public boolean containsValue(short v) { /* 425 */ short[] value = this.value; /* 426 */ byte[] key = this.key; /* 427 */ if (this.containsNullKey && value[this.n] == v) /* 428 */ return true; /* 429 */ for (int i = this.n; i-- != 0;) { /* 430 */ if (key[i] != 0 && value[i] == v) /* 431 */ return true; /* 432 */ } return false; /* */ } /* */ /* */ /* */ /* */ public short getOrDefault(byte k, short defaultValue) { /* 438 */ if (k == 0) { /* 439 */ return this.containsNullKey ? this.value[this.n] : defaultValue; /* */ } /* 441 */ byte[] key = this.key; /* */ byte curr; /* */ int pos; /* 444 */ if ((curr = key[pos = HashCommon.mix(k) & this.mask]) == 0) /* 445 */ return defaultValue; /* 446 */ if (k == curr) { /* 447 */ return this.value[pos]; /* */ } /* */ while (true) { /* 450 */ if ((curr = key[pos = pos + 1 & this.mask]) == 0) /* 451 */ return defaultValue; /* 452 */ if (k == curr) { /* 453 */ return this.value[pos]; /* */ } /* */ } /* */ } /* */ /* */ public short putIfAbsent(byte k, short v) { /* 459 */ int pos = find(k); /* 460 */ if (pos >= 0) /* 461 */ return this.value[pos]; /* 462 */ insert(-pos - 1, k, v); /* 463 */ return this.defRetValue; /* */ } /* */ /* */ /* */ /* */ public boolean remove(byte k, short v) { /* 469 */ if (k == 0) { /* 470 */ if (this.containsNullKey && v == this.value[this.n]) { /* 471 */ removeNullEntry(); /* 472 */ return true; /* */ } /* 474 */ return false; /* */ } /* */ /* 477 */ byte[] key = this.key; /* */ byte curr; /* */ int pos; /* 480 */ if ((curr = key[pos = HashCommon.mix(k) & this.mask]) == 0) /* 481 */ return false; /* 482 */ if (k == curr && v == this.value[pos]) { /* 483 */ removeEntry(pos); /* 484 */ return true; /* */ } /* */ while (true) { /* 487 */ if ((curr = key[pos = pos + 1 & this.mask]) == 0) /* 488 */ return false; /* 489 */ if (k == curr && v == this.value[pos]) { /* 490 */ removeEntry(pos); /* 491 */ return true; /* */ } /* */ } /* */ } /* */ /* */ /* */ public boolean replace(byte k, short oldValue, short v) { /* 498 */ int pos = find(k); /* 499 */ if (pos < 0 || oldValue != this.value[pos]) /* 500 */ return false; /* 501 */ this.value[pos] = v; /* 502 */ return true; /* */ } /* */ /* */ /* */ public short replace(byte k, short v) { /* 507 */ int pos = find(k); /* 508 */ if (pos < 0) /* 509 */ return this.defRetValue; /* 510 */ short oldValue = this.value[pos]; /* 511 */ this.value[pos] = v; /* 512 */ return oldValue; /* */ } /* */ /* */ /* */ public short computeIfAbsent(byte k, IntUnaryOperator mappingFunction) { /* 517 */ Objects.requireNonNull(mappingFunction); /* 518 */ int pos = find(k); /* 519 */ if (pos >= 0) /* 520 */ return this.value[pos]; /* 521 */ short newValue = SafeMath.safeIntToShort(mappingFunction.applyAsInt(k)); /* 522 */ insert(-pos - 1, k, newValue); /* 523 */ return newValue; /* */ } /* */ /* */ /* */ /* */ public short computeIfAbsentNullable(byte k, IntFunction<? extends Short> mappingFunction) { /* 529 */ Objects.requireNonNull(mappingFunction); /* 530 */ int pos = find(k); /* 531 */ if (pos >= 0) /* 532 */ return this.value[pos]; /* 533 */ Short newValue = mappingFunction.apply(k); /* 534 */ if (newValue == null) /* 535 */ return this.defRetValue; /* 536 */ short v = newValue.shortValue(); /* 537 */ insert(-pos - 1, k, v); /* 538 */ return v; /* */ } /* */ /* */ /* */ /* */ public short computeIfPresent(byte k, BiFunction<? super Byte, ? super Short, ? extends Short> remappingFunction) { /* 544 */ Objects.requireNonNull(remappingFunction); /* 545 */ int pos = find(k); /* 546 */ if (pos < 0) /* 547 */ return this.defRetValue; /* 548 */ Short newValue = remappingFunction.apply(Byte.valueOf(k), Short.valueOf(this.value[pos])); /* 549 */ if (newValue == null) { /* 550 */ if (k == 0) { /* 551 */ removeNullEntry(); /* */ } else { /* 553 */ removeEntry(pos); /* 554 */ } return this.defRetValue; /* */ } /* 556 */ this.value[pos] = newValue.shortValue(); return newValue.shortValue(); /* */ } /* */ /* */ /* */ /* */ public short compute(byte k, BiFunction<? super Byte, ? super Short, ? extends Short> remappingFunction) { /* 562 */ Objects.requireNonNull(remappingFunction); /* 563 */ int pos = find(k); /* 564 */ Short newValue = remappingFunction.apply(Byte.valueOf(k), (pos >= 0) ? Short.valueOf(this.value[pos]) : null); /* 565 */ if (newValue == null) { /* 566 */ if (pos >= 0) /* 567 */ if (k == 0) { /* 568 */ removeNullEntry(); /* */ } else { /* 570 */ removeEntry(pos); /* */ } /* 572 */ return this.defRetValue; /* */ } /* 574 */ short newVal = newValue.shortValue(); /* 575 */ if (pos < 0) { /* 576 */ insert(-pos - 1, k, newVal); /* 577 */ return newVal; /* */ } /* 579 */ this.value[pos] = newVal; return newVal; /* */ } /* */ /* */ /* */ /* */ public short merge(byte k, short v, BiFunction<? super Short, ? super Short, ? extends Short> remappingFunction) { /* 585 */ Objects.requireNonNull(remappingFunction); /* 586 */ int pos = find(k); /* 587 */ if (pos < 0) { /* 588 */ insert(-pos - 1, k, v); /* 589 */ return v; /* */ } /* 591 */ Short newValue = remappingFunction.apply(Short.valueOf(this.value[pos]), Short.valueOf(v)); /* 592 */ if (newValue == null) { /* 593 */ if (k == 0) { /* 594 */ removeNullEntry(); /* */ } else { /* 596 */ removeEntry(pos); /* 597 */ } return this.defRetValue; /* */ } /* 599 */ this.value[pos] = newValue.shortValue(); return newValue.shortValue(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void clear() { /* 610 */ if (this.size == 0) /* */ return; /* 612 */ this.size = 0; /* 613 */ this.containsNullKey = false; /* 614 */ Arrays.fill(this.key, (byte)0); /* */ } /* */ /* */ public int size() { /* 618 */ return this.size; /* */ } /* */ /* */ public boolean isEmpty() { /* 622 */ return (this.size == 0); /* */ } /* */ /* */ /* */ /* */ final class MapEntry /* */ implements Byte2ShortMap.Entry, Map.Entry<Byte, Short> /* */ { /* */ int index; /* */ /* */ /* */ MapEntry(int index) { /* 634 */ this.index = index; /* */ } /* */ /* */ MapEntry() {} /* */ /* */ public byte getByteKey() { /* 640 */ return Byte2ShortOpenHashMap.this.key[this.index]; /* */ } /* */ /* */ public short getShortValue() { /* 644 */ return Byte2ShortOpenHashMap.this.value[this.index]; /* */ } /* */ /* */ public short setValue(short v) { /* 648 */ short oldValue = Byte2ShortOpenHashMap.this.value[this.index]; /* 649 */ Byte2ShortOpenHashMap.this.value[this.index] = v; /* 650 */ return oldValue; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Byte getKey() { /* 660 */ return Byte.valueOf(Byte2ShortOpenHashMap.this.key[this.index]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Short getValue() { /* 670 */ return Short.valueOf(Byte2ShortOpenHashMap.this.value[this.index]); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Short setValue(Short v) { /* 680 */ return Short.valueOf(setValue(v.shortValue())); /* */ } /* */ /* */ /* */ public boolean equals(Object o) { /* 685 */ if (!(o instanceof Map.Entry)) /* 686 */ return false; /* 687 */ Map.Entry<Byte, Short> e = (Map.Entry<Byte, Short>)o; /* 688 */ return (Byte2ShortOpenHashMap.this.key[this.index] == ((Byte)e.getKey()).byteValue() && Byte2ShortOpenHashMap.this.value[this.index] == ((Short)e.getValue()).shortValue()); /* */ } /* */ /* */ public int hashCode() { /* 692 */ return Byte2ShortOpenHashMap.this.key[this.index] ^ Byte2ShortOpenHashMap.this.value[this.index]; /* */ } /* */ /* */ public String toString() { /* 696 */ return Byte2ShortOpenHashMap.this.key[this.index] + "=>" + Byte2ShortOpenHashMap.this.value[this.index]; /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ private class MapIterator /* */ { /* 706 */ int pos = Byte2ShortOpenHashMap.this.n; /* */ /* */ /* */ /* */ /* */ /* */ /* 713 */ int last = -1; /* */ /* 715 */ int c = Byte2ShortOpenHashMap.this.size; /* */ /* */ /* */ /* 719 */ boolean mustReturnNullKey = Byte2ShortOpenHashMap.this.containsNullKey; /* */ /* */ /* */ ByteArrayList wrapped; /* */ /* */ /* */ public boolean hasNext() { /* 726 */ return (this.c != 0); /* */ } /* */ public int nextEntry() { /* 729 */ if (!hasNext()) /* 730 */ throw new NoSuchElementException(); /* 731 */ this.c--; /* 732 */ if (this.mustReturnNullKey) { /* 733 */ this.mustReturnNullKey = false; /* 734 */ return this.last = Byte2ShortOpenHashMap.this.n; /* */ } /* 736 */ byte[] key = Byte2ShortOpenHashMap.this.key; /* */ while (true) { /* 738 */ if (--this.pos < 0) { /* */ /* 740 */ this.last = Integer.MIN_VALUE; /* 741 */ byte k = this.wrapped.getByte(-this.pos - 1); /* 742 */ int p = HashCommon.mix(k) & Byte2ShortOpenHashMap.this.mask; /* 743 */ while (k != key[p]) /* 744 */ p = p + 1 & Byte2ShortOpenHashMap.this.mask; /* 745 */ return p; /* */ } /* 747 */ if (key[this.pos] != 0) { /* 748 */ return this.last = this.pos; /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private void shiftKeys(int pos) { /* 762 */ byte[] key = Byte2ShortOpenHashMap.this.key; while (true) { /* */ byte curr; int last; /* 764 */ pos = (last = pos) + 1 & Byte2ShortOpenHashMap.this.mask; /* */ while (true) { /* 766 */ if ((curr = key[pos]) == 0) { /* 767 */ key[last] = 0; /* */ return; /* */ } /* 770 */ int slot = HashCommon.mix(curr) & Byte2ShortOpenHashMap.this.mask; /* 771 */ if ((last <= pos) ? (last >= slot || slot > pos) : (last >= slot && slot > pos)) /* */ break; /* 773 */ pos = pos + 1 & Byte2ShortOpenHashMap.this.mask; /* */ } /* 775 */ if (pos < last) { /* 776 */ if (this.wrapped == null) /* 777 */ this.wrapped = new ByteArrayList(2); /* 778 */ this.wrapped.add(key[pos]); /* */ } /* 780 */ key[last] = curr; /* 781 */ Byte2ShortOpenHashMap.this.value[last] = Byte2ShortOpenHashMap.this.value[pos]; /* */ } /* */ } /* */ public void remove() { /* 785 */ if (this.last == -1) /* 786 */ throw new IllegalStateException(); /* 787 */ if (this.last == Byte2ShortOpenHashMap.this.n) { /* 788 */ Byte2ShortOpenHashMap.this.containsNullKey = false; /* 789 */ } else if (this.pos >= 0) { /* 790 */ shiftKeys(this.last); /* */ } else { /* */ /* 793 */ Byte2ShortOpenHashMap.this.remove(this.wrapped.getByte(-this.pos - 1)); /* 794 */ this.last = -1; /* */ return; /* */ } /* 797 */ Byte2ShortOpenHashMap.this.size--; /* 798 */ this.last = -1; /* */ } /* */ /* */ /* */ public int skip(int n) { /* 803 */ int i = n; /* 804 */ while (i-- != 0 && hasNext()) /* 805 */ nextEntry(); /* 806 */ return n - i - 1; /* */ } /* */ private MapIterator() {} } /* */ /* */ private class EntryIterator extends MapIterator implements ObjectIterator<Byte2ShortMap.Entry> { private Byte2ShortOpenHashMap.MapEntry entry; /* */ /* */ public Byte2ShortOpenHashMap.MapEntry next() { /* 813 */ return this.entry = new Byte2ShortOpenHashMap.MapEntry(nextEntry()); /* */ } /* */ private EntryIterator() {} /* */ public void remove() { /* 817 */ super.remove(); /* 818 */ this.entry.index = -1; /* */ } } /* */ /* */ private class FastEntryIterator extends MapIterator implements ObjectIterator<Byte2ShortMap.Entry> { private FastEntryIterator() { /* 822 */ this.entry = new Byte2ShortOpenHashMap.MapEntry(); /* */ } private final Byte2ShortOpenHashMap.MapEntry entry; /* */ public Byte2ShortOpenHashMap.MapEntry next() { /* 825 */ this.entry.index = nextEntry(); /* 826 */ return this.entry; /* */ } } /* */ /* */ private final class MapEntrySet extends AbstractObjectSet<Byte2ShortMap.Entry> implements Byte2ShortMap.FastEntrySet { private MapEntrySet() {} /* */ /* */ public ObjectIterator<Byte2ShortMap.Entry> iterator() { /* 832 */ return new Byte2ShortOpenHashMap.EntryIterator(); /* */ } /* */ /* */ public ObjectIterator<Byte2ShortMap.Entry> fastIterator() { /* 836 */ return new Byte2ShortOpenHashMap.FastEntryIterator(); /* */ } /* */ /* */ /* */ public boolean contains(Object o) { /* 841 */ if (!(o instanceof Map.Entry)) /* 842 */ return false; /* 843 */ Map.Entry<?, ?> e = (Map.Entry<?, ?>)o; /* 844 */ if (e.getKey() == null || !(e.getKey() instanceof Byte)) /* 845 */ return false; /* 846 */ if (e.getValue() == null || !(e.getValue() instanceof Short)) /* 847 */ return false; /* 848 */ byte k = ((Byte)e.getKey()).byteValue(); /* 849 */ short v = ((Short)e.getValue()).shortValue(); /* 850 */ if (k == 0) { /* 851 */ return (Byte2ShortOpenHashMap.this.containsNullKey && Byte2ShortOpenHashMap.this.value[Byte2ShortOpenHashMap.this.n] == v); /* */ } /* 853 */ byte[] key = Byte2ShortOpenHashMap.this.key; /* */ byte curr; /* */ int pos; /* 856 */ if ((curr = key[pos = HashCommon.mix(k) & Byte2ShortOpenHashMap.this.mask]) == 0) /* 857 */ return false; /* 858 */ if (k == curr) { /* 859 */ return (Byte2ShortOpenHashMap.this.value[pos] == v); /* */ } /* */ while (true) { /* 862 */ if ((curr = key[pos = pos + 1 & Byte2ShortOpenHashMap.this.mask]) == 0) /* 863 */ return false; /* 864 */ if (k == curr) { /* 865 */ return (Byte2ShortOpenHashMap.this.value[pos] == v); /* */ } /* */ } /* */ } /* */ /* */ public boolean remove(Object o) { /* 871 */ if (!(o instanceof Map.Entry)) /* 872 */ return false; /* 873 */ Map.Entry<?, ?> e = (Map.Entry<?, ?>)o; /* 874 */ if (e.getKey() == null || !(e.getKey() instanceof Byte)) /* 875 */ return false; /* 876 */ if (e.getValue() == null || !(e.getValue() instanceof Short)) /* 877 */ return false; /* 878 */ byte k = ((Byte)e.getKey()).byteValue(); /* 879 */ short v = ((Short)e.getValue()).shortValue(); /* 880 */ if (k == 0) { /* 881 */ if (Byte2ShortOpenHashMap.this.containsNullKey && Byte2ShortOpenHashMap.this.value[Byte2ShortOpenHashMap.this.n] == v) { /* 882 */ Byte2ShortOpenHashMap.this.removeNullEntry(); /* 883 */ return true; /* */ } /* 885 */ return false; /* */ } /* */ /* 888 */ byte[] key = Byte2ShortOpenHashMap.this.key; /* */ byte curr; /* */ int pos; /* 891 */ if ((curr = key[pos = HashCommon.mix(k) & Byte2ShortOpenHashMap.this.mask]) == 0) /* 892 */ return false; /* 893 */ if (curr == k) { /* 894 */ if (Byte2ShortOpenHashMap.this.value[pos] == v) { /* 895 */ Byte2ShortOpenHashMap.this.removeEntry(pos); /* 896 */ return true; /* */ } /* 898 */ return false; /* */ } /* */ while (true) { /* 901 */ if ((curr = key[pos = pos + 1 & Byte2ShortOpenHashMap.this.mask]) == 0) /* 902 */ return false; /* 903 */ if (curr == k && /* 904 */ Byte2ShortOpenHashMap.this.value[pos] == v) { /* 905 */ Byte2ShortOpenHashMap.this.removeEntry(pos); /* 906 */ return true; /* */ } /* */ } /* */ } /* */ /* */ /* */ public int size() { /* 913 */ return Byte2ShortOpenHashMap.this.size; /* */ } /* */ /* */ public void clear() { /* 917 */ Byte2ShortOpenHashMap.this.clear(); /* */ } /* */ /* */ /* */ public void forEach(Consumer<? super Byte2ShortMap.Entry> consumer) { /* 922 */ if (Byte2ShortOpenHashMap.this.containsNullKey) /* 923 */ consumer.accept(new AbstractByte2ShortMap.BasicEntry(Byte2ShortOpenHashMap.this.key[Byte2ShortOpenHashMap.this.n], Byte2ShortOpenHashMap.this.value[Byte2ShortOpenHashMap.this.n])); /* 924 */ for (int pos = Byte2ShortOpenHashMap.this.n; pos-- != 0;) { /* 925 */ if (Byte2ShortOpenHashMap.this.key[pos] != 0) /* 926 */ consumer.accept(new AbstractByte2ShortMap.BasicEntry(Byte2ShortOpenHashMap.this.key[pos], Byte2ShortOpenHashMap.this.value[pos])); /* */ } /* */ } /* */ /* */ public void fastForEach(Consumer<? super Byte2ShortMap.Entry> consumer) { /* 931 */ AbstractByte2ShortMap.BasicEntry entry = new AbstractByte2ShortMap.BasicEntry(); /* 932 */ if (Byte2ShortOpenHashMap.this.containsNullKey) { /* 933 */ entry.key = Byte2ShortOpenHashMap.this.key[Byte2ShortOpenHashMap.this.n]; /* 934 */ entry.value = Byte2ShortOpenHashMap.this.value[Byte2ShortOpenHashMap.this.n]; /* 935 */ consumer.accept(entry); /* */ } /* 937 */ for (int pos = Byte2ShortOpenHashMap.this.n; pos-- != 0;) { /* 938 */ if (Byte2ShortOpenHashMap.this.key[pos] != 0) { /* 939 */ entry.key = Byte2ShortOpenHashMap.this.key[pos]; /* 940 */ entry.value = Byte2ShortOpenHashMap.this.value[pos]; /* 941 */ consumer.accept(entry); /* */ } /* */ } /* */ } } /* */ /* */ public Byte2ShortMap.FastEntrySet byte2ShortEntrySet() { /* 947 */ if (this.entries == null) /* 948 */ this.entries = new MapEntrySet(); /* 949 */ return this.entries; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private final class KeyIterator /* */ extends MapIterator /* */ implements ByteIterator /* */ { /* */ public byte nextByte() { /* 966 */ return Byte2ShortOpenHashMap.this.key[nextEntry()]; /* */ } } /* */ /* */ private final class KeySet extends AbstractByteSet { private KeySet() {} /* */ /* */ public ByteIterator iterator() { /* 972 */ return new Byte2ShortOpenHashMap.KeyIterator(); /* */ } /* */ /* */ /* */ public void forEach(IntConsumer consumer) { /* 977 */ if (Byte2ShortOpenHashMap.this.containsNullKey) /* 978 */ consumer.accept(Byte2ShortOpenHashMap.this.key[Byte2ShortOpenHashMap.this.n]); /* 979 */ for (int pos = Byte2ShortOpenHashMap.this.n; pos-- != 0; ) { /* 980 */ byte k = Byte2ShortOpenHashMap.this.key[pos]; /* 981 */ if (k != 0) /* 982 */ consumer.accept(k); /* */ } /* */ } /* */ /* */ public int size() { /* 987 */ return Byte2ShortOpenHashMap.this.size; /* */ } /* */ /* */ public boolean contains(byte k) { /* 991 */ return Byte2ShortOpenHashMap.this.containsKey(k); /* */ } /* */ /* */ public boolean remove(byte k) { /* 995 */ int oldSize = Byte2ShortOpenHashMap.this.size; /* 996 */ Byte2ShortOpenHashMap.this.remove(k); /* 997 */ return (Byte2ShortOpenHashMap.this.size != oldSize); /* */ } /* */ /* */ public void clear() { /* 1001 */ Byte2ShortOpenHashMap.this.clear(); /* */ } } /* */ /* */ /* */ public ByteSet keySet() { /* 1006 */ if (this.keys == null) /* 1007 */ this.keys = new KeySet(); /* 1008 */ return this.keys; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private final class ValueIterator /* */ extends MapIterator /* */ implements ShortIterator /* */ { /* */ public short nextShort() { /* 1025 */ return Byte2ShortOpenHashMap.this.value[nextEntry()]; /* */ } /* */ } /* */ /* */ public ShortCollection values() { /* 1030 */ if (this.values == null) /* 1031 */ this.values = (ShortCollection)new AbstractShortCollection() /* */ { /* */ public ShortIterator iterator() { /* 1034 */ return new Byte2ShortOpenHashMap.ValueIterator(); /* */ } /* */ /* */ public int size() { /* 1038 */ return Byte2ShortOpenHashMap.this.size; /* */ } /* */ /* */ public boolean contains(short v) { /* 1042 */ return Byte2ShortOpenHashMap.this.containsValue(v); /* */ } /* */ /* */ public void clear() { /* 1046 */ Byte2ShortOpenHashMap.this.clear(); /* */ } /* */ /* */ public void forEach(IntConsumer consumer) /* */ { /* 1051 */ if (Byte2ShortOpenHashMap.this.containsNullKey) /* 1052 */ consumer.accept(Byte2ShortOpenHashMap.this.value[Byte2ShortOpenHashMap.this.n]); /* 1053 */ for (int pos = Byte2ShortOpenHashMap.this.n; pos-- != 0;) { /* 1054 */ if (Byte2ShortOpenHashMap.this.key[pos] != 0) /* 1055 */ consumer.accept(Byte2ShortOpenHashMap.this.value[pos]); /* */ } } /* */ }; /* 1058 */ return this.values; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public boolean trim() { /* 1075 */ int l = HashCommon.arraySize(this.size, this.f); /* 1076 */ if (l >= this.n || this.size > HashCommon.maxFill(l, this.f)) /* 1077 */ return true; /* */ try { /* 1079 */ rehash(l); /* 1080 */ } catch (OutOfMemoryError cantDoIt) { /* 1081 */ return false; /* */ } /* 1083 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public boolean trim(int n) { /* 1107 */ int l = HashCommon.nextPowerOfTwo((int)Math.ceil((n / this.f))); /* 1108 */ if (l >= n || this.size > HashCommon.maxFill(l, this.f)) /* 1109 */ return true; /* */ try { /* 1111 */ rehash(l); /* 1112 */ } catch (OutOfMemoryError cantDoIt) { /* 1113 */ return false; /* */ } /* 1115 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected void rehash(int newN) { /* 1131 */ byte[] key = this.key; /* 1132 */ short[] value = this.value; /* 1133 */ int mask = newN - 1; /* 1134 */ byte[] newKey = new byte[newN + 1]; /* 1135 */ short[] newValue = new short[newN + 1]; /* 1136 */ int i = this.n; /* 1137 */ for (int j = realSize(); j-- != 0; ) { /* 1138 */ while (key[--i] == 0); int pos; /* 1139 */ if (newKey[pos = HashCommon.mix(key[i]) & mask] != 0) /* 1140 */ while (newKey[pos = pos + 1 & mask] != 0); /* 1141 */ newKey[pos] = key[i]; /* 1142 */ newValue[pos] = value[i]; /* */ } /* 1144 */ newValue[newN] = value[this.n]; /* 1145 */ this.n = newN; /* 1146 */ this.mask = mask; /* 1147 */ this.maxFill = HashCommon.maxFill(this.n, this.f); /* 1148 */ this.key = newKey; /* 1149 */ this.value = newValue; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Byte2ShortOpenHashMap clone() { /* */ Byte2ShortOpenHashMap c; /* */ try { /* 1166 */ c = (Byte2ShortOpenHashMap)super.clone(); /* 1167 */ } catch (CloneNotSupportedException cantHappen) { /* 1168 */ throw new InternalError(); /* */ } /* 1170 */ c.keys = null; /* 1171 */ c.values = null; /* 1172 */ c.entries = null; /* 1173 */ c.containsNullKey = this.containsNullKey; /* 1174 */ c.key = (byte[])this.key.clone(); /* 1175 */ c.value = (short[])this.value.clone(); /* 1176 */ return c; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public int hashCode() { /* 1189 */ int h = 0; /* 1190 */ for (int j = realSize(), i = 0, t = 0; j-- != 0; ) { /* 1191 */ while (this.key[i] == 0) /* 1192 */ i++; /* 1193 */ t = this.key[i]; /* 1194 */ t ^= this.value[i]; /* 1195 */ h += t; /* 1196 */ i++; /* */ } /* */ /* 1199 */ if (this.containsNullKey) /* 1200 */ h += this.value[this.n]; /* 1201 */ return h; /* */ } /* */ private void writeObject(ObjectOutputStream s) throws IOException { /* 1204 */ byte[] key = this.key; /* 1205 */ short[] value = this.value; /* 1206 */ MapIterator i = new MapIterator(); /* 1207 */ s.defaultWriteObject(); /* 1208 */ for (int j = this.size; j-- != 0; ) { /* 1209 */ int e = i.nextEntry(); /* 1210 */ s.writeByte(key[e]); /* 1211 */ s.writeShort(value[e]); /* */ } /* */ } /* */ /* */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { /* 1216 */ s.defaultReadObject(); /* 1217 */ this.n = HashCommon.arraySize(this.size, this.f); /* 1218 */ this.maxFill = HashCommon.maxFill(this.n, this.f); /* 1219 */ this.mask = this.n - 1; /* 1220 */ byte[] key = this.key = new byte[this.n + 1]; /* 1221 */ short[] value = this.value = new short[this.n + 1]; /* */ /* */ /* 1224 */ for (int i = this.size; i-- != 0; ) { /* 1225 */ int pos; byte k = s.readByte(); /* 1226 */ short v = s.readShort(); /* 1227 */ if (k == 0) { /* 1228 */ pos = this.n; /* 1229 */ this.containsNullKey = true; /* */ } else { /* 1231 */ pos = HashCommon.mix(k) & this.mask; /* 1232 */ while (key[pos] != 0) /* 1233 */ pos = pos + 1 & this.mask; /* */ } /* 1235 */ key[pos] = k; /* 1236 */ value[pos] = v; /* */ } /* */ } /* */ /* */ private void checkTable() {} /* */ } /* Location: C:\Users\Josep\Downloads\Decompile Minecraft\deobfuscated.jar!\i\\unimi\dsi\fastutil\bytes\Byte2ShortOpenHashMap.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
[ "tanksherman27@gmail.com" ]
tanksherman27@gmail.com
6f4ece7389b19aa86a07588ae80a70afc9b4228a
4111cb1d6366fcd4a96271668b0fad524d9dba08
/eclipse-workspace/Sample programs/src/Productofdigits.java
77e2d63be0b075bcdc2fa5abe6e5699ffd4c6fbb
[]
no_license
poojaanand2495/Sample-programs
107cbb39b6332cffe1f700d119f95f21cd52b5d1
90457b0305b06b0f55404819ffe0119acd65ca2d
refs/heads/master
2020-03-14T11:05:13.743522
2018-05-03T08:45:23
2018-05-03T08:45:23
131,582,861
0
0
null
null
null
null
UTF-8
Java
false
false
1,986
java
class Productofdigits // To find the largest product of consecutive 13 digits { public static void main(String args[]) { String num="7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"; int maximumProduct=1; // Initialized to 1 int product=1; // temporary variable for(int i=0;i<num.length()-13;i++) // store the number as string for easy computation than array { product=1; for(int j=0;j<13;j++) { int p=Integer.parseInt(String.valueOf(num.charAt(i+j) - '0')); // To eliminate 0 from number to avoid 0 product //int p=num.charAt(i+j)-'0'; This also works product=product*p; } if(product>maximumProduct) // Checking for the larger one maximumProduct=product; } System.out.println("\nThe largest product of the consecutive 13 digits in the given number is :"+maximumProduct); } }
[ "hp@DESKTOP-LD0RQ0O" ]
hp@DESKTOP-LD0RQ0O
07a57f030ded4c4c296d1459b79dea172e6c8941
e2462a6b1cca0f26496a9b404808c5aa9821de99
/src/main/java/crawler/BaiduCrawler.java
0011ab200980dcbf06d15a3aca1d71acad1ac939
[]
no_license
wanghz/stCrawler
43e85c97e0e3dfcfc6f139a2ad5ac775e0ef56c1
a91180add3ad6462532509eb297102642a0d3dec
refs/heads/master
2021-01-18T11:07:54.377010
2015-10-13T15:39:06
2015-10-14T10:11:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,959
java
package crawler; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; public class BaiduCrawler { public static HttpEntity getHtmlEntity(String url){ HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); HttpResponse resp = null; try { resp = httpClient.execute(httpGet); if(resp.getStatusLine().getStatusCode() == 200){ for(Header header : resp.getAllHeaders()){ System.out.println(header.getName() + " : " + header.getValue()); } } } catch (Exception e) { e.printStackTrace(); } return resp.getEntity(); }; public static void saveToLocal(HttpEntity httpEntity, String filename) { try { File dir = new File("D:/work"); if (!dir.isDirectory()) { dir.mkdir(); } File file = new File(dir.getAbsolutePath() + "/" + filename); FileOutputStream fileOutputStream = new FileOutputStream(file); InputStream inputStream = httpEntity.getContent(); if (!file.exists()) { file.createNewFile(); } byte[] bytes = new byte[1024]; int length = 0; while ((length = inputStream.read(bytes)) > 0) { fileOutputStream.write(bytes, 0, length); } inputStream.close(); fileOutputStream.close(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { String url = "http://www.baidu.com"; HttpEntity entity = new BaiduCrawler().getHtmlEntity(url); saveToLocal(entity, "baidu.html"); } }
[ "luckterry7@163.com" ]
luckterry7@163.com
938732ce79fae9e0c5ec8ce20075f8e23eb7021d
e010f83b9d383a958fc73654162758bda61f8290
/src/main/java/com/alipay/api/domain/AlipayTradeCustomsQueryModel.java
6f4f4c9ca7bfce0a657b4920879f7541ea736a99
[ "Apache-2.0" ]
permissive
10088/alipay-sdk-java
3a7984dc591eaf196576e55e3ed657a88af525a6
e82aeac7d0239330ee173c7e393596e51e41c1cd
refs/heads/master
2022-01-03T15:52:58.509790
2018-04-03T15:50:35
2018-04-03T15:50:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 查询报关详细信息 * * @author auto create * @since 1.0, 2018-03-02 14:37:16 */ public class AlipayTradeCustomsQueryModel extends AlipayObject { private static final long serialVersionUID = 5665521119357216195L; /** * 报关请求号。需要查询的商户端报关请求号,支持批量查询, 多个值用英文半角逗号分隔,单次请求最多10个; */ @ApiField("out_request_nos") private String outRequestNos; public String getOutRequestNos() { return this.outRequestNos; } public void setOutRequestNos(String outRequestNos) { this.outRequestNos = outRequestNos; } }
[ "liuqun.lq@alibaba-inc.com" ]
liuqun.lq@alibaba-inc.com