blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e0a1be92595d88b57fb2ef846f752b5dcc9930f1 | 15d6f1a73e08922d6b5520d92bf09ad698dae66a | /aula_20200915_polimorfismo_figuras_geometricas_implements/src/entities/Retangulo.java | 816c993ba4f68fc7929f47012cbf306de8ab6754 | []
| no_license | limamarcelo/entra21 | 76e3b84f11dc30faccc4bef59fa9ebc25cad6110 | 2ae4c565db8087c0a9eab49d62392d444677b8e1 | refs/heads/master | 2023-02-19T15:42:59.923178 | 2021-01-20T10:26:45 | 2021-01-20T10:26:45 | 296,712,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package entities;
public class Retangulo implements FiguraGeometrica {
private double base;
private double altura;
public Retangulo(double base, double altura) {
setBase(base);
setAltura(altura);
}
public void setBase(double base) {
this.base = base;
}
public double getBase() {
return base;
}
public void setAltura(double altura) {
this.altura = altura;
}
public double getAltura() {
return altura;
}
public double calcularArea() {
return 2 * (base * altura);
}
public double calcularPerimetro() {
return 2 * (base + altura);
}
}
| [
"[email protected]"
]
| |
4ef3985d3f557cd9c30a25070494fd23b3b093c6 | b8cccad0115f54ffa94169905255534779e8d447 | /src/main/java/com/monsanto/constants/Constant.java | d9f9a6ae7dd27d63c4a8ac5703955b7270f500ad | []
| no_license | mithunmondalbnp/coding-test1 | fd0a15e6bb39119237efc6d1e1a0fc8cc8ab55b7 | 14fb22cf5f92b6248243ef20bd12d047cc180f29 | refs/heads/master | 2020-03-09T19:08:14.608621 | 2018-04-10T22:11:39 | 2018-04-10T22:11:39 | 128,950,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,316 | java | package com.monsanto.constants;
public class Constant {
//-------------------Common Messages--------------------------------------------------------
public static String MESSAGE_TYPE_SUCCESS = "Success";
public static String MESSAGE_TYPE_FAILURE = "Failure";
public static String NO_RECORD_FOUND = "No record found";
//-------------------Widget Messages--------------------------------------------------------
public static String WIDGET_ADDED_SUCCESSFULLY = "Widget added successfully";
public static String WIDGET_UPDATED_SUCCESSFULLY = "Widget updated successfully";
public static String WIDGET_DELETED_SUCCESSFULLY = "Widget deleted successfully";
public static String WIDGET_DELETED_ALL_SUCCESSFULLY = "All widget deleted successfully";
//-------------------Shipment Messages--------------------------------------------------------
public static String SHIPMENT_ADDED_SUCCESSFULLY = "Shipment added successfully";
public static String SHIPMENT_UPDATED_SUCCESSFULLY = "Shipment updated successfully";
public static String SHIPMENT_DELETED_SUCCESSFULLY = "Shipment deleted successfully";
public static String SHIPMENT_DELETED_ALL_SUCCESSFULLY = "All shipment deleted successfully";
public static final String INVALID_WIDGET_COUNT = "Widget count cannot be more than 10s";
}
| [
"[email protected]"
]
| |
0c5beee14099048c971f8612cf8568f06f1c3975 | 3a8b56d3e74730ecf9c16783f78157d20d10d05b | /biz.aQute.bndlib/src/aQute/bnd/connection/settings/SettingsDTO.java | bc522333c7a261f65fae89cb3c146ac675d9ddea | [
"Apache-2.0"
]
| permissive | gdams/bnd | a90ca3d4714d30869c5a7c41376e13b7ecc95d23 | 82822deee69453df66bd68f67f9cbf431e33e76f | refs/heads/master | 2020-04-08T17:14:02.120465 | 2018-11-27T23:56:03 | 2018-11-27T23:56:03 | 159,557,976 | 1 | 1 | Apache-2.0 | 2018-11-29T14:08:17 | 2018-11-28T20:03:07 | Java | UTF-8 | Java | false | false | 271 | java | package aQute.bnd.connection.settings;
import java.util.ArrayList;
import java.util.List;
import aQute.bnd.util.dto.DTO;
public class SettingsDTO extends DTO {
public List<ProxyDTO> proxies = new ArrayList<>();
public List<ServerDTO> servers = new ArrayList<>();
}
| [
"[email protected]"
]
| |
d827b61eb0d2ad78281d6a849b66592c95202d06 | 10c1aaab6cb26ac05883763ec1eec4ad15819565 | /surf_netty_4.x/src/main/java/com/kael/surf/net/Cmd.java | 0915094887ec4fe69cb8fd543e0ca4ae27cc69f6 | []
| no_license | backoffbelief/surf | 61991607786db99aea3fed29f4272ed9aca5ea4d | 5255875531efb11ade31a4e56de570abeaed489d | refs/heads/master | 2020-04-29T03:31:22.032117 | 2015-06-10T09:28:51 | 2015-06-10T09:28:51 | 33,969,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.kael.surf.net;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Cmd {
short code();
String protoName();
}
| [
"[email protected]"
]
| |
6a0748a209e5d8bcfbbc4b7c52715844a9673eac | 477c3a4bf84a79e894253a4cf26b3edb24ede753 | /app/src/main/java/com/sheep/zk/floatball/view/impl/LvPowerSavingActivity.java | 0da806647e0516346a144f3dd4e1c98d098578c4 | []
| no_license | acesheep/FloatBall | 6ae88933e7aa5b4c7437d4367a6ddc04de8d3983 | 4a01d1319a1e2e7effd68a4edeea4a6c4e006a0d | refs/heads/master | 2021-09-01T23:03:04.674017 | 2017-12-29T03:15:26 | 2017-12-29T03:15:26 | 115,681,405 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,802 | java | package com.sheep.zk.floatball.view.impl;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.etiennelawlor.quickreturn.library.enums.QuickReturnViewType;
import com.etiennelawlor.quickreturn.library.listeners.QuickReturnListViewOnScrollListener;
import com.jaredrummler.android.processes.AndroidProcesses;
import com.jaredrummler.android.processes.models.AndroidAppProcess;
import com.sheep.zk.floatball.R;
import com.sheep.zk.floatball.adapter.LvPowerSavingAdapter;
import com.sheep.zk.floatball.base.BaseActivity;
import com.sheep.zk.floatball.base.BaseApplication;
import com.sheep.zk.floatball.bean.ProcessInfo;
import com.sheep.zk.floatball.bean.StorageSize;
import com.sheep.zk.floatball.ui.textcounter.CounterView;
import com.sheep.zk.floatball.ui.textcounter.DecimalFormatter;
import com.sheep.zk.floatball.util.CommonUtil;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* Created by sheep on 2017/11/28.
*/
public class LvPowerSavingActivity extends BaseActivity implements View.OnClickListener{
@BindView(R.id.iv_back)
ImageView ivBack;
@BindView(R.id.rl_emptty)
RelativeLayout rlEmptty;
@BindView(R.id.header)
RelativeLayout header;
@BindView(R.id.listview)
ListView listview;
@BindView(R.id.btn_clean)
Button btnClean;
@BindView(R.id.textCounter)
CounterView textCounter;
@BindView(R.id.sufix)
TextView sufix;
@BindView(R.id.progressBarText)
TextView progressBarText;
@BindView(R.id.progressBar)
LinearLayout progressBar;
private long mCacheSize = 0;
//运行的进程列表
List<ProcessInfo> mProcessInfos=new ArrayList<>();
LvPowerSavingAdapter lvPowerSavingAdapter;
@Override
public int setCustomContentViewResourceId() {
return R.layout.activity_power_saving;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init();
initViews();
initOperator();
}
private void init() {
new TaskScan().execute();
}
private void initViews() {
listview.setEmptyView(rlEmptty);
lvPowerSavingAdapter=new LvPowerSavingAdapter(context,mProcessInfos);
listview.setAdapter(lvPowerSavingAdapter);
listview.setOnItemClickListener(lvPowerSavingAdapter);
QuickReturnListViewOnScrollListener scrollListener = new QuickReturnListViewOnScrollListener.Builder(QuickReturnViewType.FOOTER)
.header(null)
.minHeaderTranslation(0)
.footer(btnClean)
.minFooterTranslation(180)
.build();
listview.setOnScrollListener(scrollListener);
}
private void initOperator() {
ivBack.setOnClickListener(this);
btnClean.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_back:
finish();
break;
case R.id.btn_clean:
break;
}
}
// @Override
// public void onCleanCompleted(Context context, long cacheSize) {
// Toast.makeText(context, context.getString(R.string.cleaned, Formatter.formatShortFileSize(
// context, cacheSize)), Toast.LENGTH_LONG).show();
// header.setVisibility(View.GONE);
// btnClean.setVisibility(View.GONE);
// mCacheListItem.clear();
// rvCacheCleanAdapter.notifyDataSetChanged();
//
// }
private boolean isProgressBarVisible() {
return progressBar.getVisibility() == View.VISIBLE;
}
private void showProgressBar(boolean show) {
if(show){
progressBar.setVisibility(View.VISIBLE);
}else {
Animation animation=AnimationUtils.loadAnimation(context,R.anim.rubbishclean_scan_complete_fade_out);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
progressBar.setVisibility(View.GONE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
progressBar.setAnimation(animation);
animation.start();
}
}
@Override
protected void onRestart() {
super.onRestart();
}
@Override
protected void onPause() {
finish();
super.onPause();
}
@Override
protected void onStop() {
BaseApplication.isBigWindowShow=false;
super.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
private class TaskScan extends AsyncTask<Void,Integer,List<ProcessInfo>>{
private int mProcessesCount = 0;
@Override
protected void onPreExecute() {
progressBarText.setText("扫描中...");
showProgressBar(true);
}
@Override
protected List<ProcessInfo> doInBackground(Void... params) {
mCacheSize = 0;
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
PackageManager pm =getPackageManager();
List<ProcessInfo> processInfoList = new ArrayList<ProcessInfo>();
List<AndroidAppProcess> processes = AndroidProcesses.getRunningAppProcesses();
//更新进度
publishProgress(0,processes.size());
if (processes != null) {
for (int i = 0; i < processes.size(); i++) {
publishProgress(++mProcessesCount, processes.size());
AndroidAppProcess appProcess = processes.get(i);
String processName = appProcess.name;
ProcessInfo processInfo = new ProcessInfo();
processInfo.setPackName(processName);
android.os.Debug.MemoryInfo[] processMemoryInfo = am.getProcessMemoryInfo(new int[]{appProcess.pid});
android.os.Debug.MemoryInfo memoryInfo = processMemoryInfo[0];
processInfo.setSize(memoryInfo.getTotalPrivateDirty()*1024);
mCacheSize+=processInfo.getSize();
try {
ApplicationInfo applicationInfo = pm.getApplicationInfo(processInfo.getPackName(), 0);
//8,获取应用的名称
processInfo.setName(applicationInfo.loadLabel(pm).toString());
//9,获取应用的图标
processInfo.setIcon(applicationInfo.loadIcon(pm));
//10,判断是否为系统进程
if((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == ApplicationInfo.FLAG_SYSTEM){
processInfo.setSystem(true);
}else{
processInfo.setSystem(false);
}
} catch (PackageManager.NameNotFoundException e) {
//需要处理
processInfo.name = appProcess.name;
processInfo.icon = context.getResources().getDrawable(R.mipmap.ic_launcher);
processInfo.isSystem = true;
e.printStackTrace();
}
processInfoList.add(processInfo);
}
}
return processInfoList;
}
@Override
protected void onProgressUpdate(Integer... values) {
progressBarText.setText(getString(R.string.scanning_m_of_n, values[0], values[1]));
}
@Override
protected void onPostExecute(List<ProcessInfo> processInfos) {
showProgressBar(false);
if(processInfos.size()<=0){
rlEmptty.setVisibility(View.VISIBLE);
}else {
rlEmptty.setVisibility(View.GONE);
}
mProcessInfos.clear();
mProcessInfos.addAll(processInfos);
lvPowerSavingAdapter.notifyDataSetChanged();
header.setVisibility(View.GONE);
if(processInfos.size()>0){
header.setVisibility(View.VISIBLE);
btnClean.setVisibility(View.VISIBLE);
StorageSize storageSize= CommonUtil.convertStorageSize(mCacheSize);
textCounter.setAutoFormat(false);
textCounter.setFormatter(new DecimalFormatter());
textCounter.setAutoStart(false);
textCounter.setStartValue(0f);
textCounter.setEndValue(storageSize.value);
textCounter.setIncrement(10f); //每个时间间隔中数字的增量
textCounter.setTimeInterval(50); //数字变化间的时间间隔
sufix.setText(storageSize.suffix);
textCounter.start();
}else {
header.setVisibility(View.GONE);
btnClean.setVisibility(View.GONE);
}
}
}
}
| [
"[email protected]"
]
| |
e384923ca70d992548f4b28602969578b7e5ad00 | 0ce7f617c41f7b8931e2a5d8bbeac23e6c339b34 | /src/main/java/com/my/weichat/mvc/SessionHelper.java | 4d095e47ca20aa7318e4a96838dd89c8d0c77cf3 | []
| no_license | yinguoliang/wechat | 9401b6b24a8f752ec7601d7e87cda019bcacb61a | 9b968be739a060aaad65ee08836e41220c72b9b2 | refs/heads/master | 2016-09-05T21:27:30.303086 | 2014-12-14T12:08:37 | 2014-12-14T12:08:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | package com.my.weichat.mvc;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
public class SessionHelper {
public HttpServletRequest getRequest(){
HttpServletRequest request =
((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
return request;
}
public String getCustomerID(){
return (String) this.getRequest().getSession().getAttribute("customerID");
}
public void putCustomerID(String customerID){
this.getRequest().getSession().setAttribute("customerID", customerID);
}
}
| [
"[email protected]"
]
| |
67fa6bd5d3425a519e3d4357fc1102e310d21f7a | 36763d93cb20a9d2650e7aa8430396d1f5901c8b | /fineo-adapter-drill/src/main/java/io/fineo/read/drill/exec/store/rel/recombinator/logical/FineoRecombinatorRel.java | fbef47002684a149ced270aaa1fe99672b4dddbc | []
| no_license | jyates/fineo-readerator | 529c61340cf55b9c77c995ed27ce397662a949df | a8ce2133ce67be63accba46ed20d160b7162144e | refs/heads/master | 2021-03-27T09:49:15.195226 | 2017-05-03T01:39:31 | 2017-05-03T01:39:31 | 58,482,402 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,160 | java | package io.fineo.read.drill.exec.store.rel.recombinator.logical;
import io.fineo.schema.store.StoreClerk;
import org.apache.calcite.plan.RelOptCluster;
import org.apache.calcite.plan.RelTraitSet;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.RelWriter;
import org.apache.calcite.rel.SingleRel;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.drill.common.logical.data.LogicalOperator;
import org.apache.drill.exec.planner.logical.DrillImplementor;
import org.apache.drill.exec.planner.logical.DrillRel;
import java.util.List;
/**
* Logical conversion of fields from the sub-query into the fields that is actually visible in this
* metric.
*/
public class FineoRecombinatorRel extends SingleRel implements DrillRel {
private final StoreClerk.Metric metric;
private final SourceType type;
/**
* Creates a <code>SingleRel</code>.
*
* @param cluster Cluster this relational expression belongs to
* @param traits
* @param input Input relational expression
* @param metric
* @param rowType
* @param type
*/
protected FineoRecombinatorRel(RelOptCluster cluster,
RelTraitSet traits, RelNode input, StoreClerk.Metric metric, RelDataType rowType,
SourceType type) {
super(cluster, traits, input);
this.metric = metric;
this.rowType = rowType;
this.type = type;
}
@Override
public LogicalOperator implement(DrillImplementor implementor) {
final LogicalOperator input = implementor.visitChild(this, 0, getInput());
FineoRecombinatorLogicalOperator op =
new FineoRecombinatorLogicalOperator(metric.getUnderlyingMetric(), type);
op.setInput(input);
return op;
}
public StoreClerk.Metric getMetric() {
return this.metric;
}
@Override
public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
return new FineoRecombinatorRel(this.getCluster(), traitSet, SingleRel.sole(inputs), metric,
rowType, type);
}
@Override
public RelWriter explainTerms(RelWriter pw) {
return super.explainTerms(pw).item("rowtype", this.getRowType());
}
public SourceType getSourceType() {
return type;
}
}
| [
"[email protected]"
]
| |
b69d98465e1475c7dc082e53aa977d8e9ba34e70 | 4b5664ad26b6f821a2f669b7a7778498f99aa8a7 | /src/main/java/cd/go/contrib/elasticagent/RequestExecutor.java | 067f4fd14fba6f50fc53e2e4695f8269f0f2d224 | [
"Apache-2.0"
]
| permissive | lorenzo-ange/kubernetes-elastic-agents | e13d0e86a34a16dee1ca356e201c10e6dc15e0fd | f7d8efbf9b0b86b6fd1041f501fe6e9c35460bbf | refs/heads/master | 2022-08-01T18:51:55.103523 | 2020-04-30T11:32:42 | 2020-04-30T11:32:42 | 267,003,633 | 0 | 0 | Apache-2.0 | 2020-05-26T09:43:22 | 2020-05-26T09:43:21 | null | UTF-8 | Java | false | false | 799 | java | /*
* Copyright 2017 ThoughtWorks, Inc.
*
* 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 cd.go.contrib.elasticagent;
import com.thoughtworks.go.plugin.api.response.GoPluginApiResponse;
public interface RequestExecutor {
GoPluginApiResponse execute() throws Exception;
}
| [
"[email protected]"
]
| |
1fabccf96a2b678c3264c3cea0adcd5695d029c0 | 4f418b324895abb8371c8402ee01ad8f2a028329 | /src/main/java/com/chainanalytica/nic/security/UserNotActivatedException.java | 0608fe52ee78b2630be9b16ea14b6a785558c3c4 | []
| no_license | DDevinda/jhipster-nic-alfresco | a4ffff95c771e5d4795d019fe0c39fbae3bdd51c | 48ea402dbb6fae628c579582554e19d5034516a4 | refs/heads/master | 2022-12-22T22:37:09.412263 | 2019-12-03T08:49:22 | 2019-12-03T08:49:22 | 225,559,130 | 0 | 0 | null | 2022-12-16T05:04:08 | 2019-12-03T07:38:19 | Java | UTF-8 | Java | false | false | 518 | java | package com.chainanalytica.nic.security;
import org.springframework.security.core.AuthenticationException;
/**
* This exception is thrown in case of a not activated user trying to authenticate.
*/
public class UserNotActivatedException extends AuthenticationException {
private static final long serialVersionUID = 1L;
public UserNotActivatedException(String message) {
super(message);
}
public UserNotActivatedException(String message, Throwable t) {
super(message, t);
}
}
| [
"[email protected]"
]
| |
ece013358cc3a0391f06865e608ca3698d994f2b | 7e43f6f74cb85add045e7cb978bb2ac828484430 | /src/main/java/com/xylugah/issuetracker/dao/ResolutionDAO.java | 64405c1da414656105f93e2de7801b013ab0d6f1 | []
| no_license | XylugaH/IssueTracker | 6323b6ffe2a8db63682eadd7791c430bff3774dd | 6379343e54a44adb93ea164bd920b5ff5b911fdd | refs/heads/master | 2021-01-23T02:58:49.480639 | 2017-04-26T16:08:11 | 2017-04-26T16:08:11 | 86,035,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.xylugah.issuetracker.dao;
import java.util.List;
import com.xylugah.issuetracker.entity.Resolution;
public interface ResolutionDAO {
Resolution getById(int id);
Resolution getByName(String name);
List<Resolution> getAll();
void add(Resolution resolution);
void delete(int id);
Resolution edit(Resolution resolution);
}
| [
"[email protected]"
]
| |
f95fd166f1ee789ccd01928d83c2067189513731 | 65e5ba8ac50d96a5efca044b0f61707bb17ec442 | /Tour/src/main/java/com/spring/service/MovieReplyService.java | 05291da4007ecf0980c15c286dbc5dce4ad8befe | []
| no_license | rlawjdgh/Tour | 4504a75318725392712733c23013875a8f508ca8 | 2e876b0dc0c62b5448fb2d0742368fcab031e3cc | refs/heads/master | 2020-05-14T16:03:52.195825 | 2019-06-30T17:11:14 | 2019-06-30T17:11:14 | 181,864,800 | 1 | 0 | null | 2020-03-04T22:36:29 | 2019-04-17T09:59:32 | JavaScript | UTF-8 | Java | false | false | 367 | java | package com.spring.service;
import java.util.List;
import com.spring.domain.MovieReplyVO;
public interface MovieReplyService {
public List<MovieReplyVO> getReplies(String movieNm);
public int getTotal();
public List<MovieReplyVO> getRepliesPaging(int nowPage, String movieNm);
public int insertReply(String movieNm, String writer, String reply);
}
| [
"[email protected]"
]
| |
90782413b625def3be50dd7e66e6f900ce7af473 | b4ad81f5c58194c23712910c3066fdee6865d2cd | /app/src/main/java/com/example/kfreshproduce/SignInFragment.java | be3e75556d3ada1586977c9d062e24693ddf86c2 | []
| no_license | ratiebareeng/KFreshProduce | 3ad66206baff662ee17bace88ef2332ae288fac8 | 8b267d9341c40d2ecc16796bfe4f097787a7e419 | refs/heads/master | 2022-10-07T19:44:45.157643 | 2020-06-04T21:23:13 | 2020-06-04T21:23:13 | 269,469,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,045 | java | package com.example.kfreshproduce;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link SignInFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SignInFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public SignInFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment SignInFragment.
*/
// TODO: Rename and change types and number of parameters
public static SignInFragment newInstance(String param1, String param2) {
SignInFragment fragment = new SignInFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_sign_in, container, false);
}
} | [
"[email protected]"
]
| |
d0c3b3011c667cf8d153730771816ba69ea9cc05 | 0d02ef297096c8aa6760dedaf53b3c9515b9da87 | /src/main/java/br/cesed/si/dto/CadastrarVendedor.java | dd23924fee47448458a729ff31cac6068b87d74c | [
"Apache-2.0"
]
| permissive | MatheusRSousa/Treinamento4 | c1a2e331a522553de966da42343e832cf9a3c7f7 | db0735c33516521d209d60cc64ccce2eb22adbc6 | refs/heads/master | 2020-04-17T15:00:22.676858 | 2019-01-28T21:11:17 | 2019-01-28T21:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 723 | java | package br.cesed.si.dto;
import java.io.Serializable;
public class CadastrarVendedor implements Serializable{
private static final long serialVersionUID = 1L;
private String nome;
private String cpf;
private String login;
private String senha;
public CadastrarVendedor(){}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
}
| [
"[email protected]"
]
| |
36323cacc0c3019f9226f39efb944595c0226f40 | 6bfadf4bed8f739ad784a752d7311cecbb63f544 | /flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializerSnapshotTest.java | fbfa76540ba728de020dcf817fd5fd4319ec2a6d | [
"Apache-2.0",
"CC-BY-2.5",
"OFL-1.1",
"AGPL-3.0-only",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-jdom",
"GCC-exception-3.1",
"MIT-0",
"MPL-2.0-no-copyleft-exception",
"CDDL-1.1",
"CDDL-1.0",
"MIT",
"CC0-1.0",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-only",
"BSD-2-Clause-Views",
"EPL-1.0",
"Classpath-exception-2.0",
"LicenseRef-scancode-other-permissive",
"Python-2.0",
"MPL-2.0",
"CC-PDDC",
"GPL-2.0-only",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"ISC"
]
| permissive | tianchen92/flink | ee8c6cd78a073103b0ce2a27736e1fbfc5a14360 | 4320d8372f93e8fa4d82da06e5e0a0ba310195a2 | refs/heads/master | 2020-04-18T06:48:43.768065 | 2019-06-05T11:11:54 | 2019-06-17T04:05:53 | 167,337,383 | 3 | 1 | Apache-2.0 | 2019-01-24T09:09:10 | 2019-01-24T09:09:10 | null | UTF-8 | Java | false | false | 6,820 | 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.flink.api.java.typeutils.runtime.kryo;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.common.typeutils.TypeSerializerSchemaCompatibility;
import org.apache.flink.api.common.typeutils.TypeSerializerSnapshot;
import org.apache.flink.api.java.typeutils.runtime.kryo.KryoPojosForMigrationTests.Animal;
import org.apache.flink.api.java.typeutils.runtime.kryo.KryoPojosForMigrationTests.Dog;
import org.apache.flink.api.java.typeutils.runtime.kryo.KryoPojosForMigrationTests.DogKryoSerializer;
import org.apache.flink.api.java.typeutils.runtime.kryo.KryoPojosForMigrationTests.DogV2KryoSerializer;
import org.apache.flink.api.java.typeutils.runtime.kryo.KryoPojosForMigrationTests.Parrot;
import org.apache.flink.core.memory.DataInputDeserializer;
import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataOutputSerializer;
import org.apache.flink.core.testutils.CommonTestUtils;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import static org.apache.flink.api.common.typeutils.TypeSerializerMatchers.isCompatibleAsIs;
import static org.apache.flink.api.common.typeutils.TypeSerializerMatchers.isCompatibleWithReconfiguredSerializer;
import static org.apache.flink.api.common.typeutils.TypeSerializerMatchers.isIncompatible;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Tests for {@link KryoSerializerSnapshot}.
*/
public class KryoSerializerSnapshotTest {
private ExecutionConfig oldConfig;
private ExecutionConfig newConfig;
@Before
public void setup() {
oldConfig = new ExecutionConfig();
newConfig = new ExecutionConfig();
}
@Test
public void sanityTest() {
assertThat(resolveKryoCompatibility(oldConfig, newConfig), isCompatibleAsIs());
}
@Test
public void addingTypesIsCompatibleAfterReconfiguration() {
oldConfig.registerKryoType(Animal.class);
newConfig.registerKryoType(Animal.class);
newConfig.registerTypeWithKryoSerializer(Dog.class, DogKryoSerializer.class);
assertThat(resolveKryoCompatibility(oldConfig, newConfig),
isCompatibleWithReconfiguredSerializer());
}
@Test
public void replacingKryoSerializersIsCompatibleAsIs() {
oldConfig.registerKryoType(Animal.class);
oldConfig.registerTypeWithKryoSerializer(Dog.class, DogKryoSerializer.class);
newConfig.registerKryoType(Animal.class);
newConfig.registerTypeWithKryoSerializer(Dog.class, DogV2KryoSerializer.class);
// it is compatible as is, since Kryo does not expose compatibility API with KryoSerializers
// so we can not know if DogKryoSerializer is compatible with DogV2KryoSerializer
assertThat(resolveKryoCompatibility(oldConfig, newConfig),
isCompatibleAsIs());
}
@Test
public void reorderingIsCompatibleAfterReconfiguration() {
oldConfig.registerKryoType(Parrot.class);
oldConfig.registerKryoType(Dog.class);
newConfig.registerKryoType(Dog.class);
newConfig.registerKryoType(Parrot.class);
assertThat(resolveKryoCompatibility(oldConfig, newConfig),
isCompatibleWithReconfiguredSerializer());
}
@Test
public void tryingToRestoreWithNonExistingClassShouldBeIncompatible() throws IOException {
TypeSerializerSnapshot<Animal> restoredSnapshot = kryoSnapshotWithMissingClass();
TypeSerializer<Animal> currentSerializer = new KryoSerializer<>(Animal.class, new ExecutionConfig());
assertThat(restoredSnapshot.resolveSchemaCompatibility(currentSerializer),
isIncompatible());
}
// -------------------------------------------------------------------------------------------------------
// Helpers
// -------------------------------------------------------------------------------------------------------
private static TypeSerializerSnapshot<Animal> kryoSnapshotWithMissingClass() throws IOException {
DataInputView in = new DataInputDeserializer(unLoadableSnapshotBytes());
return TypeSerializerSnapshot.readVersionedSnapshot(
in,
KryoSerializerSnapshotTest.class.getClassLoader());
}
/**
* This method returns the bytes of a serialized {@link KryoSerializerSnapshot}, that contains a Kryo registration
* of a class that does not exists in the current classpath.
*/
private static byte[] unLoadableSnapshotBytes() throws IOException {
final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
ClassLoader tempClassLoader =
new URLClassLoader(new URL[0], KryoSerializerSnapshotTest.class.getClassLoader());
try {
Thread.currentThread().setContextClassLoader(tempClassLoader);
ExecutionConfig conf = registerClassThatIsNotInClassPath(tempClassLoader);
KryoSerializer<Animal> previousSerializer = new KryoSerializer<>(Animal.class, conf);
TypeSerializerSnapshot<Animal> previousSnapshot = previousSerializer.snapshotConfiguration();
DataOutputSerializer out = new DataOutputSerializer(4096);
TypeSerializerSnapshot.writeVersionedSnapshot(out, previousSnapshot);
return out.getCopyOfBuffer();
}
finally {
Thread.currentThread().setContextClassLoader(originalClassLoader);
}
}
private static ExecutionConfig registerClassThatIsNotInClassPath(ClassLoader tempClassLoader) {
Object objectForClassNotInClassPath =
CommonTestUtils.createObjectForClassNotInClassPath(tempClassLoader);
ExecutionConfig conf = new ExecutionConfig();
conf.registerKryoType(objectForClassNotInClassPath.getClass());
return conf;
}
private static TypeSerializerSchemaCompatibility<Animal> resolveKryoCompatibility(ExecutionConfig previous, ExecutionConfig current) {
KryoSerializer<Animal> previousSerializer = new KryoSerializer<>(Animal.class, previous);
TypeSerializerSnapshot<Animal> previousSnapshot = previousSerializer.snapshotConfiguration();
TypeSerializer<Animal> currentSerializer = new KryoSerializer<>(Animal.class, current);
return previousSnapshot.resolveSchemaCompatibility(currentSerializer);
}
}
| [
"[email protected]"
]
| |
2fc354c008a3d1467a0a3f844a24b5d30be3be97 | ec5438d60b6b1e35eb2a2d741fd032cd176118d3 | /Assignment_DayFour/src/com/ss/dayfour/assignmenttwo/SingletonData.java | 3d72b374012ae2beff4b7563d68b9b67e37249e9 | []
| no_license | elijahbrooks/smoothstack-assignments | d3523c98517b68c770a0f73b3b1c9eea5cd2ee83 | f9920f62010eef295530784b985fe95ec14ce738 | refs/heads/master | 2023-03-29T23:00:54.101704 | 2021-04-12T19:37:50 | 2021-04-12T19:37:50 | 355,247,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 837 | java | package com.ss.dayfour.assignmenttwo;
/**
* Singleton Class
* @author elijahbrooks
*/
public class SingletonData {
private static final SingletonData instance = new SingletonData();
public int count = 0;
private SingletonData(){}
/**
* @return instance of SingletonClass
*/
public static SingletonData getInstance() {
return instance;
}
/**
* increment count
*/
synchronized public void incrementCount(){
try {
Thread.sleep(1000);
count++;
decrementCount();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* decrement count
*/
synchronized public void decrementCount(){
count--;
incrementCount();
}
}
| [
"[email protected]"
]
| |
1c4a196e7b804d1055bc406f1f520499f8793ea9 | a4a51084cfb715c7076c810520542af38a854868 | /src/main/java/com/google/android/gms/internal/gtm/zzlg.java | 296e6d3a58f56cd115ff69e90a2736d7de0ae92f | []
| no_license | BharathPalanivelu/repotest | ddaf56a94eb52867408e0e769f35bef2d815da72 | f78ae38738d2ba6c9b9b4049f3092188fabb5b59 | refs/heads/master | 2020-09-30T18:55:04.802341 | 2019-12-02T10:52:08 | 2019-12-02T10:52:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package com.google.android.gms.internal.gtm;
import com.google.android.gms.common.internal.Preconditions;
public final class zzlg extends zzhb {
private final zzfj zzaru;
public zzlg(zzfj zzfj) {
this.zzaru = zzfj;
}
/* access modifiers changed from: protected */
public final zzoa<?> zza(zzfl zzfl, zzoa<?>... zzoaArr) {
boolean z = true;
Preconditions.checkArgument(true);
if (zzoaArr.length != 0) {
z = false;
}
Preconditions.checkArgument(z);
return zzoo.zzq(this.zzaru.zzkt().zzkg());
}
}
| [
"[email protected]"
]
| |
e78b4a6da3926e3c615dd06363fb4c370d8e0764 | 58df55b0daff8c1892c00369f02bf4bf41804576 | /src/agv.java | 7bc87259173e006b6da19db868ef42f75ed863bf | []
| no_license | gafesinremedio/com.google.android.gm | 0b0689f869a2a1161535b19c77b4b520af295174 | 278118754ea2a262fd3b5960ef9780c658b1ce7b | refs/heads/master | 2020-05-04T15:52:52.660697 | 2016-07-21T03:39:17 | 2016-07-21T03:39:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,273 | java | import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Paint;
import android.graphics.Shader;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.util.AttributeSet;
import android.widget.ProgressBar;
class agv
{
private static final int[] c = { 16843067, 16843068 };
final agj a;
Bitmap b;
private final ProgressBar d;
agv(ProgressBar paramProgressBar, agj paramagj)
{
d = paramProgressBar;
a = paramagj;
}
private final Drawable a(Drawable paramDrawable, boolean paramBoolean)
{
int j = 0;
if ((paramDrawable instanceof kx))
{
localObject1 = ((kx)paramDrawable).a();
if (localObject1 != null)
{
localObject1 = a((Drawable)localObject1, paramBoolean);
((kx)paramDrawable).a((Drawable)localObject1);
}
}
do
{
return paramDrawable;
if ((paramDrawable instanceof LayerDrawable))
{
paramDrawable = (LayerDrawable)paramDrawable;
int k = paramDrawable.getNumberOfLayers();
localObject1 = new Drawable[k];
int i = 0;
if (i < k)
{
int m = paramDrawable.getId(i);
localObject2 = paramDrawable.getDrawable(i);
if ((m == 16908301) || (m == 16908303)) {}
for (paramBoolean = true;; paramBoolean = false)
{
localObject1[i] = a((Drawable)localObject2, paramBoolean);
i += 1;
break;
}
}
localObject1 = new LayerDrawable((Drawable[])localObject1);
i = j;
while (i < k)
{
((LayerDrawable)localObject1).setId(i, paramDrawable.getId(i));
i += 1;
}
return (Drawable)localObject1;
}
} while (!(paramDrawable instanceof BitmapDrawable));
paramDrawable = (BitmapDrawable)paramDrawable;
Object localObject2 = paramDrawable.getBitmap();
if (b == null) {
b = ((Bitmap)localObject2);
}
Object localObject1 = new ShapeDrawable(new RoundRectShape(new float[] { 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F }, null, null));
localObject2 = new BitmapShader((Bitmap)localObject2, Shader.TileMode.REPEAT, Shader.TileMode.CLAMP);
((ShapeDrawable)localObject1).getPaint().setShader((Shader)localObject2);
((ShapeDrawable)localObject1).getPaint().setColorFilter(paramDrawable.getPaint().getColorFilter());
if (paramBoolean) {
return new ClipDrawable((Drawable)localObject1, 3, 1);
}
return (Drawable)localObject1;
}
void a(AttributeSet paramAttributeSet, int paramInt)
{
amp localamp = amp.a(d.getContext(), paramAttributeSet, c, paramInt);
Object localObject = localamp.b(0);
if (localObject != null)
{
ProgressBar localProgressBar = d;
paramAttributeSet = (AttributeSet)localObject;
if ((localObject instanceof AnimationDrawable))
{
localObject = (AnimationDrawable)localObject;
int i = ((AnimationDrawable)localObject).getNumberOfFrames();
paramAttributeSet = new AnimationDrawable();
paramAttributeSet.setOneShot(((AnimationDrawable)localObject).isOneShot());
paramInt = 0;
while (paramInt < i)
{
Drawable localDrawable = a(((AnimationDrawable)localObject).getFrame(paramInt), true);
localDrawable.setLevel(10000);
paramAttributeSet.addFrame(localDrawable, ((AnimationDrawable)localObject).getDuration(paramInt));
paramInt += 1;
}
paramAttributeSet.setLevel(10000);
}
localProgressBar.setIndeterminateDrawable(paramAttributeSet);
}
paramAttributeSet = localamp.b(1);
if (paramAttributeSet != null) {
d.setProgressDrawable(a(paramAttributeSet, false));
}
a.recycle();
}
}
/* Location:
* Qualified Name: agv
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
]
| |
f4cdb8db1920244aebf4a5c484e4835d277c3d31 | 3c4d92e20850542fbe5c88465e1313a5c61a999b | /app/src/main/java/com/example/appp/Home.java | 40e95a808ef1036458a69c3b9f33ffd55b1acba9 | []
| no_license | seokhuyn/aplication | 7d781a0f418f9c5b3670030447450213181ebcad | 11ab86c44f070270b0808e094603aae4e7891693 | refs/heads/master | 2023-01-09T04:01:28.854653 | 2020-10-28T10:39:01 | 2020-10-28T10:39:01 | 307,989,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,580 | java | package com.example.appp;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.SearchView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Calendar;
import static android.widget.Toast.LENGTH_SHORT;
import static android.widget.Toast.makeText;
import static com.example.appp.Login.MYid;
import static com.example.appp.Myschedule.REQUEST_CODE1;
public class Home extends AppCompatActivity {
public static final int REQUEST_CODE2 = 300;
Button btn_Schedule, btn_Main, btn_setting,btn_Memory;
TextView tv_choicedate;
SharedPreferences sharedPreferences;
private ArrayList<HomeData> HomearrayList;
private HomeAdapter HomeAdapter;
private RecyclerView recyclerView;
private LinearLayoutManager linearLayoutManager;
private String getgetid ;
private String getgetmypicture ;
@Override
protected void onStart() {
super.onStart();
load();
Log.d("filter" ,"onStart 로드했다");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
Intent intent = getIntent();
final String getmypicture = intent.getStringExtra("mypicture");
final String getid = intent.getStringExtra("id");
recyclerView = (RecyclerView) findViewById(R.id.Rc);
linearLayoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(linearLayoutManager);
HomearrayList = new ArrayList<>();
HomeAdapter = new HomeAdapter(HomearrayList);
recyclerView.setAdapter(HomeAdapter);
btn_Schedule = findViewById(R.id.btn_Schedule);
btn_Main = findViewById(R.id.btn_Main);
btn_setting = findViewById(R.id.btn_setting);
// tv_choicedate = findViewById(R.id.tv_choicedate);
btn_Memory = findViewById(R.id.btn_Memory);
//
// tv_choicedate.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
//
// // init();
//
//
// }
// });
try {
sharedPreferences = getSharedPreferences("Userannouncedata", MODE_PRIVATE);
String json = sharedPreferences.getString("announce", "");
JSONArray jsonArray = new JSONArray(json);
Log.d("shared", "" + jsonArray.toString());
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String id1 = jsonObject.getString("id");
String mypicture1 = jsonObject.getString("mypicture");
Log.d("사진왔다", "원래사진" + mypicture1);
if (MYid.equals(id1)) {
getgetid = id1 ;
Log.d("사진왔다", "원래사진" + mypicture1);
getgetmypicture = mypicture1;
Log.d("사진왔다", "원래사진" + getgetmypicture);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
btn_Memory.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Home.this, Memory.class);
intent.putExtra("id",getid);
intent.putExtra("mypicture",getmypicture);
startActivity(intent);
}
});
btn_Schedule.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sharedPreferences = getSharedPreferences("Useralldata", MODE_PRIVATE);
String json = sharedPreferences.getString("user", "");
try {
JSONArray jsonArray = new JSONArray(json);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String id = jsonObject.getString("id");
Log.d("=jsonarray", "가져온 아이디 " + id);
if (MYid.equals(id)) {
String mypicture = jsonObject.getString("mypicture");
Log.d("로그인에서 가져온 아이디","아이디"+id + mypicture);
Intent intent = new Intent(Home.this, Myschedule.class);
intent.putExtra("id",id);
intent.putExtra("mypicture",mypicture);
startActivity(intent);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
btn_setting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Home.this, Setting.class);
intent.putExtra("id",getid);
intent.putExtra("mypicture",getmypicture);
startActivity(intent);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE2) {
// Intent intent = getIntent();
// final String mypicture = intent.getStringExtra("mypicture");
// final String id = intent.getStringExtra("id");
// Log.d("home", "수정" + mypicture);
// Log.d("home", "수정 " +id);
String Title = data.getStringExtra("Title");
String Date = data.getStringExtra("Date");
String Money = data.getStringExtra("Money");
String Address = data.getStringExtra("Address");
String Need = data.getStringExtra("Need");
String Time = data.getStringExtra("Time");
int position = data.getIntExtra("Position", 0);
Log.d("shared", "수정또왔다" + Title);
Log.d("shared", "수정또왔다" + Date);
Log.d("shared", "수정또왔다" + Money);
Log.d("shared", "수정또왔다" + Address);
Log.d("shared", "수정또왔다" + Need);
Log.d("shared", "수정또왔다" + position);
HomeData homeData = new HomeData(getgetmypicture, Title
, Money, Date, Address, Need, Time, getgetid, R.drawable.menu);
sharedPreferences = getSharedPreferences("Userannouncedata", MODE_PRIVATE);
String json = sharedPreferences.getString("announce", "");
try {
JSONArray jsonArray = new JSONArray(json);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String id1 = jsonObject.getString("id");
if (MYid.equals(id1)) {
String getTitle = jsonObject.getString("Title");
Log.d("shared1", " 제목" + MYid);
Log.d("shared1", " 제목" + id1);
if (getTitle.equals(HomearrayList.get(position).getTitle())) {
Log.d("shared1", " 제목" + (HomearrayList.get(position).getTitle()));
Log.d("shared1", " 제목" + getTitle);
sharedPreferences = getSharedPreferences("Userannouncedata", MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
//
// String Date1 = jsonObject.getString("Date");
// String Title1 = jsonObject.getString("Title");
// String Money1 = jsonObject.getString("Money");
// String Need1 = jsonObject.getString("Need");
// String Address1 = jsonObject.getString("Address");
// String Time1 = jsonObject.getString("Time");
// String id2 = jsonObject.getString("id");
// String mypicture1 = jsonObject.getString("mypicture");
// JSONObject title = jsonArray.getJSONObject(i).put("Title",Title);
// Log.d("shared", "저장하자" +title);
//
//
jsonObject.put("Title", Title);
jsonObject.put("Date", Date);
jsonObject.put("Money", Money);
jsonObject.put("Need", Need);
jsonObject.put("Address", Address);
jsonObject.put("Time", Time);
jsonObject.put("id", getgetid);
jsonObject.put("mypicture", getgetmypicture);
//
// Log.d("shared", "저장하자" +jsonArray.toString());
editor.putString("announce", jsonArray.toString());
editor.commit();
HomearrayList.set(position, homeData);
HomeAdapter.notifyDataSetChanged();
break;
} else {
// sharedPreferences = view.getContext().getSharedPreferences("Userannouncedata", MODE_PRIVATE);
// SharedPreferences.Editor editor = sharedPreferences.edit();
// editor.putString("announce", jsonArray.toString());
// editor.commit();
// Log.d("shared1", " 다른 제목" + getTitle);
}
}
}
Log.d("shared", "saveeditor" + jsonArray.toString());
Log.d("shared1", " 나왔다" + MYid);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
public void load() {
Intent intent = getIntent();
String getmypicture = intent.getStringExtra("mypicture");
Log.d("사진왔다", "" + getmypicture);
try {
Log.d("로드", "" + HomearrayList.toString());
HomearrayList.clear(); ///로드 데이터가 쌓이기 때문에 클리어 .
sharedPreferences = getSharedPreferences("Userannouncedata", MODE_PRIVATE);
String json = sharedPreferences.getString("announce", "");
JSONArray jsonArray = new JSONArray(json);
Log.d("제이슨", "" + jsonArray.toString());
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String id = jsonObject.getString("id");
String Title = jsonObject.getString("Title");
String Money = jsonObject.getString("Money");
String Date = jsonObject.getString("Date");
String Address = jsonObject.getString("Address");
String Need = jsonObject.getString("Need");
String Time = jsonObject.getString("Time");
String mypicture = jsonObject.getString("mypicture");
if (MYid.equals(id)) {
Log.d("사진왔다", "원래사진" + mypicture);
Log.d("사진왔다", "가져온사진" + getmypicture);
if (mypicture.equals(getmypicture)){
Log.d("로그인아이디", "" + jsonObject.toString());
Log.d("로그인아이디", "" + id);
HomeData HomeData = new HomeData(mypicture, Title
, Money, Date, Address, Need, Time,id, R.drawable.menu);
HomearrayList.add(0, HomeData);
HomeAdapter.notifyDataSetChanged();
}else if (getmypicture == null){
HomeData HomeData = new HomeData(mypicture, Title
, Money, Date, Address, Need, Time,id, R.drawable.menu);
HomearrayList.add(0, HomeData);
HomeAdapter.notifyDataSetChanged();
}else {
Log.d("로그인아이디", "" + jsonObject.toString());
Log.d("로그인아이디", "" + id);
Log.d("사진", "" + getmypicture);
HomeData HomeData = new HomeData(getmypicture, Title
, Money, Date, Address, Need, Time, id, R.drawable.menu);
HomearrayList.add(0, HomeData);
HomeAdapter.notifyDataSetChanged();
jsonObject.put("mypicture", getmypicture);
sharedPreferences = getSharedPreferences("Userannouncedata", MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("announce", jsonArray.toString() );
editor.commit();
}
} else {
HomeData homeData = new HomeData(mypicture, Title
, Money, Date, Address, Need, Time );
Log.d("announcedata", "" + homeData.getAddress());
HomearrayList.add(0, homeData);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.searchmenu,menu);
MenuItem searchitem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) searchitem.getActionView();
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
load();
HomeAdapter.getFilter().filter(s);
Log.d("Home", "filter" + s);
return false;
}
});
return true;
}
//
// private void init() {
//
// //Calendar를 이용하여 년, 월, 일, 시간, 분을 PICKER에 넣어준다.
// final Calendar cal = Calendar.getInstance();
//
// findViewById(R.id.tv_choicedate).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
//
// DatePickerDialog dialog = new DatePickerDialog(Home.this, new DatePickerDialog.OnDateSetListener() {
// @Override
// public void onDateSet(DatePicker datePicker, int year, int month, int date) {
//
// String msg = String.format("%d년 %d월 %d일", year, month + 1, date);
// makeText(Home.this, msg, LENGTH_SHORT).show();
// tv_choicedate.setText(msg);
// }
// }, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
//
// // dialog.getDatePicker().setMaxDate(new Date().getTime()); //입력한 날짜 이후로 클릭 안되게 옵션
// dialog.show();
//
// }
// });
//
// }
}
| [
"[email protected]"
]
| |
13914d93f2640ef9c42ce2724052b40319dc57b4 | 2db3843bab0a9b8cb5d6deb5ded1bb25a70f868b | /src/main/java/com/coy/pay/route/util/DateUtils.java | 896ee1a084e1986fb0129d354beeaf60c280e8fc | []
| no_license | Golcondas/pay-route | fd9ae3f04b2dbaddbc3c7fd9ab6d6be0dfba55c5 | b9bde7b99dce2dbd37607e18a8743b83d6c0407d | refs/heads/master | 2023-05-29T07:32:40.830476 | 2020-07-10T06:47:38 | 2020-07-10T06:47:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,492 | java | package com.coy.pay.route.util;
import com.coy.pay.route.exception.BizException;
import com.coy.pay.route.exception.BizResultCode;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* 日期工具类
*/
public class DateUtils {
// 默认的时间格式
public static final String YYYY_MM_DD = "yyyy-MM-dd";
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
public static final String YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd HH:mm:ss.SSS";
public static final String YYYYMMDD = "yyyyMMdd";
public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS";
public static final String YYMMDDHHMMSS = "yyMMddHHmmss";
public static final String YYMMDDHHMMSSSSS = "yyMMddHHmmssSSS";
public static final String HH_MM_SS = "HH:mm:ss";
public static final String HHMMSS = "HHmmss";
private DateUtils() {
}
/**
* 将毫秒转换为日期yyyy-MM-dd HH:mm:ss
*
* @param millis
* @return
*/
public static String getDateFromMillis(long millis) {
try {
Date nowTime = new Date(millis);
SimpleDateFormat sdFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdFormatter.format(nowTime);
} catch (Throwable e) {
throw new BizException(BizResultCode.ERR_DATE_FORMAT, e);
}
}
/**
* 字串日期转换
*
* @param strDate 字符串日期
* @param format 日期的格式
* @return
*/
public static Date getDate(String strDate, String format) {
try {
SimpleDateFormat sdFormatter = new SimpleDateFormat(format);
return sdFormatter.parse(strDate);
} catch (Exception e) {
throw new BizException(BizResultCode.ERR_DATE_FORMAT, e);
}
}
/**
* 8位日期转换为10位日期
*
* @param dateStr
* @return
*/
public static String getEighthToTen(String dateStr) {
if (8 == dateStr.length()) {
String year = dateStr.substring(0, 4);
String month = dateStr.substring(4, 6);
String day = dateStr.substring(6, 8);
return year + "-" + month + "-" + day;
}
return dateStr;
}
/**
* 清除小时分钟和秒
*/
public static Date clearHourMiniteSecond(Date date) {
if (date == null) {
return null;
}
Calendar gc = Calendar.getInstance();
gc.clear();
gc.setTime(date);
gc.set(Calendar.HOUR_OF_DAY, 0);
gc.set(Calendar.MINUTE, 0);
gc.set(Calendar.SECOND, 0);
gc.set(Calendar.MILLISECOND, 0);
return gc.getTime();
}
/**
* 清除秒
*/
public static Date clearSecond(Date date) {
if (date == null) {
return null;
}
Calendar gc = Calendar.getInstance();
gc.clear();
gc.setTime(date);
gc.set(Calendar.SECOND, 0);
gc.set(Calendar.MILLISECOND, 0);
return gc.getTime();
}
/**
* 按照指定格式返回当前时间,如果格式为空,则默认为yyyy-MM-dd
*
* @param dateFormat
* @return
*/
public static String getCurrentDateToString(String dateFormat) {
if (StringUtils.isBlank(dateFormat)) {
dateFormat = YYYY_MM_DD;
}
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
return sdf.format(getCurrentDate());
}
/**
* 按照指定格式返回当前时间,如果格式为空,则默认为yyyy-MM-dd
*
* @param dateFormat
* @return
*/
public static Date strToDate(String date, String dateFormat) {
if (date == null) {
return null;
}
if (StringUtils.isBlank(dateFormat)) {
if (date.length() > 10) {
dateFormat = YYYY_MM_DD_HH_MM_SS;
} else {
dateFormat = YYYY_MM_DD;
}
}
try {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
return sdf.parse(date);
} catch (Exception e) {
throw new BizException(BizResultCode.ERR_DATE_FORMAT, e);
}
}
/**
* 格式化日期输出,如果格式为空,则默认为yyyy-MM-dd
*
* @param date
* @param dateFormat
* @return
*/
public static String dateToStr(Date date, String dateFormat) {
if (date == null) {
return "";
}
if (StringUtils.isBlank(dateFormat)) {
dateFormat = YYYY_MM_DD;
}
try {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
return sdf.format(date);
} catch (Exception e) {
throw new BizException(BizResultCode.ERR_DATE_FORMAT, e);
}
}
/**
* 得到当前时间
*
* @return
*/
public static Date getCurrentDate() {
return new Date();
}
/**
* 获取当前日期,格式yyyyMMddHH
*
* @return
*/
public static String getCurrentDateYYYYMMDD() {
return dateToStr(getCurrentDate(), YYYYMMDD);
}
/**
* 获取当前日期,格式yyyyMMddHHmmss
*
* @return
*/
public static String getCurrentDateYYYYMMDDHHMMSS() {
return dateToStr(getCurrentDate(), YYYYMMDDHHMMSS);
}
/**
* 比较两个时间的间隔,单位为毫秒
*
* @param endDate
* @param startDate
* @return
*/
public static Long diffTwoDateWithTime(Date endDate, Date startDate) {
if (startDate == null || endDate == null) {
return -1l;
}
Long diff = (endDate.getTime() - startDate.getTime());
return diff;
}
/**
* 比较两个时间的间隔,单位为小时
*
* @param startDate
* @param endDate
* @return
*/
public static int diffTwoDateWithMinute(Date startDate, Date endDate) {
return (int) ((endDate.getTime() - startDate.getTime()) / (60 * 1000) + 1);
}
/**
* 比较两个时间的间隔,单位为小时
*
* @param startDate
* @param endDate
* @return
*/
public static int diffTwoDateWithHour(Date startDate, Date endDate) {
return (int) ((endDate.getTime() - startDate.getTime()) / (60 * 60 * 1000) + 1);
}
/**
* @param startDate
* @param endDate
* @return int 返回类型
* @throws @author Administrator
* @Title: diffTwoDateWithDay
* @Description: 比较两个时间的间隔,单位为天
*/
public static int diffTwoDateWithDay(Date startDate, Date endDate) {
return (int) ((endDate.getTime() - startDate.getTime()) / (24 * 60 * 60 * 1000));
}
/**
* 时间增加一天Calendar的使用yyyyMMdd
*
* @param s
* @param n
* @return
*/
public static String addDate(String s, int n) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(YYYYMMDD);
Calendar cd = Calendar.getInstance();
cd.setTime(sdf.parse(s));
cd.add(Calendar.DATE, n);// 增加一天
// cd.add(Calendar.MONTH, n);//增加一个月
return sdf.format(cd.getTime());
} catch (Exception e) {
throw new BizException(BizResultCode.ERR_DATE_FORMAT, e);
}
}
/**
* 日期处理
*
* @param srcDate 原日期
* @param days 增加的天数
* @param minutes 增加的分钟数
* @param seconds 增加的秒数
* @return
*/
public static Date addDate(Date srcDate, int days, int minutes, int seconds) {
Calendar c = Calendar.getInstance();
c.setTime(srcDate);
if (days != 0) {
c.add(Calendar.DATE, days);
}
if (minutes != 0) {
c.add(Calendar.MINUTE, minutes);
}
if (seconds != 0) {
c.add(Calendar.SECOND, seconds);
}
return c.getTime();
}
/**
* 给指定日期添加指定天数
*
* @param srcDate yyyyMMdd
* @param days 增加的天数
* @return
*/
public static Date addDay(String srcDate, int days) {
Date date = DateUtils.strToDate(srcDate, DateUtils.YYYYMMDD);
return DateUtils.addDate(date, days, 0, 0);
}
/**
* @param date
* @param days
* @return String 返回类型 yyyy-MM-dd
* @throws @author Administrator
* @Title: addDay
* @Description: 给指定日期添加指定天数
*/
public static String addDay(Date date, int days) {
Date tempDate = DateUtils.addDate(date, days, 0, 0);
return DateUtils.dateToStr(tempDate, "");
}
/**
* 根据日期获取日
*
* @param date 格式yyyyMMdd
* @return
*/
public static int getDayByDate(String date) {
try {
Calendar calen = Calendar.getInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
calen.setTime(dateFormat.parse(date));
return calen.get(Calendar.DAY_OF_MONTH);
} catch (ParseException e) {
throw new BizException(BizResultCode.ERR_DATE_FORMAT, e);
}
}
}
| [
"[email protected]"
]
| |
8c28d255798ba90a77555434d71180bf266cf8e2 | 68a109ab86010021871a62d69c9c009987488d05 | /Object_class/app2/src/M18.java | 289306cad3f0fd7ac8e8d5833b72e595b6577904 | []
| no_license | Vijay-Ky/8BFSD | c881ea60f179ebb7f4c79f6da931003af379904a | 6d6f6c3e63d92c6234006d24af3bf5682ee36712 | refs/heads/main | 2023-06-23T19:16:42.379675 | 2021-07-26T16:08:22 | 2021-07-26T16:08:22 | 342,541,161 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | class O
{
int i;
}
class F
{
int i;
F(int i)
{
this.i = i;
}
public boolean equals(Object obj)
{
//to avoid this we can first get suggestion from instance of operatror
if(! (obj instanceof F))
{
return false;
}
F ref = (F) obj;//downcasting obj into F
return this.i == ref.i;
}
}
class M18
{
public static void main(String[] args)
{
F f1 = new F(900);
F f2 = new F(90);
O o1 = new O();
o1.i = 90;
System.out.println(f1.equals(f2));
System.out.println(f1.equals(o1));
System.out.println(f1.equals("xyz"));
System.out.println(f1.equals(90));
System.out.println(f1.equals(true));
}
}
| [
"[email protected]"
]
| |
d0a08a8bda44584312585a22b57d885274bd124c | 8d78fa71f347b4b712a46dd929944eaec6c72592 | /android/unityLibrary/src/main/java/com/unity3d/player/UnityPlayerActivity.java | 5c7d3699e5b2d07651c2ace950e8b97520c9ca3b | []
| no_license | trantienhd97/unity_demo | fa158732b8608196a34571bc26e8c981350e7b9c | a8947d6d94c2d6458c2900f89a1f5b1395edc9a0 | refs/heads/master | 2023-03-13T17:34:45.604915 | 2021-03-05T08:29:50 | 2021-03-05T08:29:50 | 331,587,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,834 | java | // GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
package com.unity3d.player;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.os.Process;
public class UnityPlayerActivity extends Activity implements IUnityPlayerLifecycleEvents
{
protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code
// Override this in your custom UnityPlayerActivity to tweak the command line arguments passed to the Unity Android Player
// The command line arguments are passed as a string, separated by spaces
// UnityPlayerActivity calls this from 'onCreate'
// Supported: -force-gles20, -force-gles30, -force-gles31, -force-gles31aep, -force-gles32, -force-gles, -force-vulkan
// See https://docs.unity3d.com/Manual/CommandLineArguments.html
// @param cmdLine the current command line arguments, may be null
// @return the modified command line string or null
protected String updateUnityCommandLineArguments(String cmdLine)
{
return cmdLine;
}
// Setup activity layout
@Override protected void onCreate(Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
String cmdLine = updateUnityCommandLineArguments(getIntent().getStringExtra("unity"));
getIntent().putExtra("unity", cmdLine);
mUnityPlayer = new UnityPlayer(this, this);
setContentView(mUnityPlayer);
mUnityPlayer.requestFocus();
}
// When Unity player unloaded move task to background
@Override public void onUnityPlayerUnloaded() {
moveTaskToBack(true);
}
// When Unity player quited kill process
@Override public void onUnityPlayerQuitted() {
Process.killProcess(Process.myPid());
}
@Override protected void onNewIntent(Intent intent)
{
// To support deep linking, we need to make sure that the client can get access to
// the last sent intent. The clients access this through a JNI api that allows them
// to get the intent set on launch. To update that after launch we have to manually
// replace the intent with the one caught here.
setIntent(intent);
mUnityPlayer.newIntent(intent);
}
// Quit Unity
@Override protected void onDestroy ()
{
mUnityPlayer.destroy();
super.onDestroy();
}
// Pause Unity
@Override protected void onPause()
{
super.onPause();
mUnityPlayer.pause();
}
// Resume Unity
@Override protected void onResume()
{
super.onResume();
mUnityPlayer.resume();
}
// Low Memory Unity
@Override public void onLowMemory()
{
super.onLowMemory();
mUnityPlayer.lowMemory();
}
// Trim Memory Unity
@Override public void onTrimMemory(int level)
{
super.onTrimMemory(level);
if (level == TRIM_MEMORY_RUNNING_CRITICAL)
{
mUnityPlayer.lowMemory();
}
}
// This ensures the layout will be correct.
@Override public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
mUnityPlayer.configurationChanged(newConfig);
}
// Notify Unity of the focus change.
@Override public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
mUnityPlayer.windowFocusChanged(hasFocus);
}
// For some reason the multiple keyevent type is not supported by the ndk.
// Force event injection by overriding dispatchKeyEvent().
@Override public boolean dispatchKeyEvent(KeyEvent event)
{
if (event.getAction() == KeyEvent.ACTION_MULTIPLE)
return mUnityPlayer.injectEvent(event);
return super.dispatchKeyEvent(event);
}
// Pass any events not handled by (unfocused) views straight to UnityPlayer
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { return mUnityPlayer.injectEvent(event); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { return mUnityPlayer.injectEvent(event); }
@Override public boolean onTouchEvent(MotionEvent event) { return mUnityPlayer.injectEvent(event); }
/*API12*/ public boolean onGenericMotionEvent(MotionEvent event) { return mUnityPlayer.injectEvent(event); }
@Override
public void onBackPressed() {
super.onBackPressed();
this.mUnityPlayer.quit();
}
}
| [
"[email protected]"
]
| |
5f580d351ca4e3850bd62be3aece1f4a2b1ad40b | c22b983af578427b09a8ba5ef3335cc92dc97b35 | /src/javas/WrapLayout.java | 95581bf18f7180bddbe9a5c0058c867b38139e37 | []
| no_license | maochaokuo/zepler1 | 41173f17c20fe320b805024122ef44114dc2fe50 | 8b0b6d33b7852f33009e715c4d8c0b9efc519eea | refs/heads/master | 2020-12-28T18:50:23.061967 | 2020-03-10T15:46:45 | 2020-03-10T15:46:45 | 238,448,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,096 | java | package javas;
import java.awt.*;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
/**
* FlowLayout subclass that fully supports wrapping of components.
*/
public class WrapLayout extends FlowLayout
{
private Dimension preferredLayoutSize;
/**
* Constructs a new <code>WrapLayout</code> with a left
* alignment and a default 5-unit horizontal and vertical gap.
*/
public WrapLayout()
{
super();
}
/**
* Constructs a new <code>FlowLayout</code> with the specified
* alignment and a default 5-unit horizontal and vertical gap.
* The value of the alignment argument must be one of
* <code>WrapLayout</code>, <code>WrapLayout</code>,
* or <code>WrapLayout</code>.
* @param align the alignment value
*/
public WrapLayout(int align)
{
super(align);
}
/**
* Creates a new flow layout manager with the indicated alignment
* and the indicated horizontal and vertical gaps.
* <p>
* The value of the alignment argument must be one of
* <code>WrapLayout</code>, <code>WrapLayout</code>,
* or <code>WrapLayout</code>.
* @param align the alignment value
* @param hgap the horizontal gap between components
* @param vgap the vertical gap between components
*/
public WrapLayout(int align, int hgap, int vgap)
{
super(align, hgap, vgap);
}
/**
* Returns the preferred dimensions for this layout given the
* <i>visible</i> components in the specified target container.
* @param target the component which needs to be laid out
* @return the preferred dimensions to lay out the
* subcomponents of the specified container
*/
@Override
public Dimension preferredLayoutSize(Container target)
{
return layoutSize(target, true);
}
/**
* Returns the minimum dimensions needed to layout the <i>visible</i>
* components contained in the specified target container.
* @param target the component which needs to be laid out
* @return the minimum dimensions to lay out the
* subcomponents of the specified container
*/
@Override
public Dimension minimumLayoutSize(Container target)
{
Dimension minimum = layoutSize(target, false);
minimum.width -= (getHgap() + 1);
return minimum;
}
/**
* Returns the minimum or preferred dimension needed to layout the target
* container.
*
* @param target target to get layout size for
* @param preferred should preferred size be calculated
* @return the dimension to layout the target container
*/
private Dimension layoutSize(Container target, boolean preferred)
{
synchronized (target.getTreeLock())
{
// Each row must fit with the width allocated to the containter.
// When the container width = 0, the preferred width of the container
// has not yet been calculated so lets ask for the maximum.
//int targetWidth = target.getSize().width;
Container container = target;
while (container.getSize().width == 0 && container.getParent() != null)
{
container = container.getParent();
}
int targetWidth = container.getSize().width;
if (targetWidth == 0)
targetWidth = Integer.MAX_VALUE;
int hgap = getHgap();
int vgap = getVgap();
Insets insets = target.getInsets();
int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2);
int maxWidth = targetWidth - horizontalInsetsAndGap;
// Fit components into the allowed width
Dimension dim = new Dimension(0, 0);
int rowWidth = 0;
int rowHeight = 0;
int nmembers = target.getComponentCount();
for (int i = 0; i < nmembers; i++)
{
Component m = target.getComponent(i);
if (m.isVisible())
{
Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize();
// Can't add the component to current row. Start a new row.
if (rowWidth + d.width > maxWidth)
{
addRow(dim, rowWidth, rowHeight);
rowWidth = 0;
rowHeight = 0;
}
// Add a horizontal gap for all components after the first
if (rowWidth != 0)
{
rowWidth += hgap;
}
rowWidth += d.width;
rowHeight = Math.max(rowHeight, d.height);
}
}
addRow(dim, rowWidth, rowHeight);
dim.width += horizontalInsetsAndGap;
dim.height += insets.top + insets.bottom + vgap * 2;
// When using a scroll pane or the DecoratedLookAndFeel we need to
// make sure the preferred size is less than the size of the
// target containter so shrinking the container size works
// correctly. Removing the horizontal gap is an easy way to do this.
Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target);
if (scrollPane != null && target.isValid())
{
dim.width -= (hgap + 1);
}
return dim;
}
}
/*
* A new row has been completed. Use the dimensions of this row
* to update the preferred size for the container.
*
* @param dim update the width and height when appropriate
* @param rowWidth the width of the row to add
* @param rowHeight the height of the row to add
*/
private void addRow(Dimension dim, int rowWidth, int rowHeight)
{
dim.width = Math.max(dim.width, rowWidth);
if (dim.height > 0)
{
dim.height += getVgap();
}
dim.height += rowHeight;
}
}
| [
"[email protected]"
]
| |
0b3d24b6900bbdd952bc7d616ad18fbc85254184 | 4d3f2b66e33d47dc713f614ae86e11afd587f85b | /src/Resources/Function/ButtonFunction.java | f05e2a7cacced794c08f5598257f9a592c1f203d | []
| no_license | jesslyn-ctrl/JavaFX_AfternoonCafe | 1771cb07d8f1cffab90d7f4044e1042674ca84a7 | b495c336d8a36ce8ca1fede153a7b293e2957721 | refs/heads/master | 2022-12-12T07:32:31.484804 | 2020-09-04T13:49:59 | 2020-09-04T13:49:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package Resources.Function;
import javafx.scene.control.Button;
public class ButtonFunction extends Button {
public ButtonFunction(String btn_name, HandlerFunction func) {
super(btn_name);
this.setOnAction(func);
}
}
| [
"[email protected]"
]
| |
b2ba7b0f171f30b160d9e0f3fbe3fc6f70f544ba | e4c4b5812de8481d980f9efcea26da63ff908dd3 | /src/LPA/Node.java | 69b2f4c82586f502d646c47598934dfc2153cba3 | []
| no_license | Hcqian/SSAA | d8af7b9acb9f5502944ffa64dc208f590c508248 | 295bce4cbf63292fbe9457d0a818af5de8d76c7e | refs/heads/master | 2021-08-24T06:04:42.332740 | 2017-12-08T09:59:58 | 2017-12-08T09:59:58 | 113,559,863 | 0 | 1 | null | null | null | null | GB18030 | Java | false | false | 6,560 | java | package LPA;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Random;
import java.util.Set;
/**
* Represents the node of the undirected graph.
* @author pejakalabhargava
*
*/
public class Node {
//Adjacenecy list holding all the neighbours of the given node 存放邻接点
//private Set<Node> neighbhours;
public Map<Node, Double> neighbhours;
public Map<Node, Double> beneighbhours;
//Id of the given node.
private int nodeId;
// Memory map used to hold the labelId and the count used for SLPA
// algorithm.存储<标签,标签次数>
// private Map<Integer, Integer> memoryMap;
private int[] labels;
// This represents the total number of counts(or communities) present in the
// memory map of this node.//总标签数所属社区数量
private int noOfCommunities;
/**
* Constructor to create the node structure.
*/
public Node(Integer source) {
nodeId = source;
initializeDataStructure();
}
/**
* Helper method to initialize the required data strucutres. This also makes
* sure that the memory of each node is initialized with a unique label as
* part of SLPA algorithm.
*/
private void initializeDataStructure() {
neighbhours = new HashMap();
beneighbhours = new HashMap();
labels=new int[2];
//memoryMap = new LinkedHashMap <Integer, Integer>();
noOfCommunities = 1;
labels[0]=nodeId;
//memoryMap.put(nodeId, 1);
}
/**
* This function implements the listen step of the SLPA algorithm. Each
* neighbor sends the selected label to the listener and the listener adds
* the most popular label received to its memory.
*/
public void listen() {
//Map to hold the all the received labels from its neighbours in this iteration
Map<Integer, Integer> labelMap = new HashMap<Integer, Integer>();//存储该点每次收到的标签以及次数
//Iterate through all the neighbors and callk speak on them as part of SLPA algorithm.
for (Node node : neighbhours.keySet()) {
//Speak method returns label to the listener
// Node label = node.speak(); //得到邻接点的标签
int label=node.labels[0];
//Add the label received to the temporary labelMap to hold the labelId and received count.
if (labelMap.get(label) == null) {
labelMap.put(label, 1);
} else {
int currentLabelCount = labelMap.get(label);
currentLabelCount++;
labelMap.put(label, currentLabelCount);
}
}
for (Node node : beneighbhours.keySet()) {
//Speak method returns label to the listener
// Node label = node.speak(); //得到邻接点的标签
int label=node.labels[0];
//Add the label received to the temporary labelMap to hold the labelId and received count.
if (labelMap.get(label) == null) {
labelMap.put(label, 1);
} else {
int currentLabelCount = labelMap.get(label);
currentLabelCount++;
labelMap.put(label, currentLabelCount);
}
}
//After all neighbours sends the label, findout the most popular label
int popularLabel = getMostPopularLabel(labelMap);//得到标签出现次数最多的标签
if(popularLabel!=-1){
labels[0]=popularLabel;
}else {
labels[0]=nodeId;
}
//add the popular label to the memory map of the node.
//次数出现最多的标签 到标签集中,并且记录曾经出现的次数
// if(memoryMap.get(popularLabel) == null) {
// memoryMap.put(popularLabel, 1);
// } else {
// int currentCount = memoryMap.get(popularLabel);
// currentCount++;
// memoryMap.put(popularLabel, currentCount);
// }
//Increment the noOfCommunities
// noOfCommunities++;
// labelMap.clear();
}
private int getMostPopularLabel(Map<Integer, Integer> labelMap) {
int maxLabelCount = 0;
int popularLabel= -1;
for (Map.Entry<Integer, Integer> entry : labelMap.entrySet()) {
Integer labelId = entry.getKey();
Integer labelCount = entry.getValue();
if (labelCount > maxLabelCount) {
popularLabel = labelId;
maxLabelCount = labelCount;
}
}
return popularLabel;
}
/**
* Each neighbor of the selected node randomly selects a label with probability
* proportional to the occurrence frequency of this label in its memory and sends
* the selected label to the listener.
* @return label
*/
//随机选择记忆中概率最大的标签送出,按照概率分布随机取
private int speak() {
//generate a random double value
Random random = new Random();
double randomDoubleValue = random.nextDouble();
double cumulativeSum = 0;
// Randomly select a label with probability proportional to the
// occurrence frequency of this label in its memory
// int lab=this.nodeId;
// double max=0;
double allv=0;
for (Node i : neighbhours.keySet()) {
//allv+=neighbhours.get(i);
allv++;
}
for (Node i : neighbhours.keySet()) {
cumulativeSum +=neighbhours.get(i)*(1/allv);
if(cumulativeSum >= randomDoubleValue) {
return i.labels[0];
}
}
// System.out.println(cumulativeSum);
// for (Map.Entry<Integer, Integer> entry : memoryMap.entrySet()) {
// Integer labelId = entry.getKey();
// Integer labelCount = entry.getValue();
// cumulativeSum = cumulativeSum + ((double)labelCount)/noOfCommunities;
// if(cumulativeSum >= randomDoubleValue) {
// return labelId;
// }
// }
return nodeId;
}
//Getters and Setters
/**
* Adds a neighbor to the node's adjacency list
* @param destNode
*/
public void addNeighbour(Node destNode,Double value) {
neighbhours.put(destNode,value);
}
public void addbeNeighbour(Node destNode,Double value) {
beneighbhours.put(destNode,value);
}
/**
* Returns the neighbors of the node
* @return set of neighbors
*/
// public Set<Node> getNeighbhours() {
// return neighbhours;
// }
public Map<Node,Double> getNeighbhours() {
return neighbhours;
}
/**
* Returns the NodeId
* @return node ID
*/
public int getNodeId() {
return nodeId;
}
/**
* Returns the memory map of the node at given time t
* @return map
*/
public int[] getlLabels(){
return labels;
}
// public Map<Integer, Integer> getMemoryMap() {
// return memoryMap;
// }
/**
* Returns the total number of entries in the memory map's count
* @return int
*/
public int getNoOfCommunities() {
return noOfCommunities;
}
@Override
public int hashCode() {
// TODO Auto-generated method stub
Integer i=new Integer(nodeId);
return i.hashCode();
}
@Override
public boolean equals(Object obj) {
// TODO Auto-generated method stub
Node n=(Node)obj;
return nodeId==n.nodeId;
}
}
| [
"[email protected]"
]
| |
8aef2d8959bfaf9fac06f426379d4e5e47f9a40a | a99e516b7d1070cdc51f70b3168ffb3dc6829444 | /src/main/java/org/ethan/iservice/ITagService.java | efbc82f6d92a9796e700a15b59d2f4a2108eb0a1 | []
| no_license | chenzihaojie/hexo-blog | 20155f44097db1bfd2a411fea74696beb08d8899 | 2a6d996618ebfa0895c12c64b9f2cafce1d04437 | refs/heads/master | 2022-07-23T17:09:30.920774 | 2022-07-18T02:47:10 | 2022-07-18T02:47:10 | 59,120,438 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package org.ethan.iservice;
import java.util.List;
import org.ethan.bean.Tag;
public interface ITagService {
public void add(Tag t);
public void delete(int id);
public void update(Tag t);
public Tag load(int id);
public List<Tag> listAllTag();
public Tag getTagByName(String tagName);
public List<String> getAllTagsName();
}
| [
"[email protected]"
]
| |
fd42e6ba0e01351b08e0f8826e3752465e4cef57 | 6a7c4e586ea998ac3f037df4f37e3176e77febb2 | /src/com/sanguine/excise/dao/clsLicenceMasterDaoImpl.java | 74ec17f7c7d799084ffa0e61526e879cd658d034 | []
| no_license | puneteamsangsoftwares/SanguineERP | ef635a953b7f2ad24e7c53d28472f9b09ccce1cb | 9c603a4591d165e6975931f53847aa4a97a0a504 | refs/heads/master | 2022-12-25T05:02:27.601147 | 2021-01-12T13:18:11 | 2021-01-12T13:18:11 | 215,270,060 | 0 | 1 | null | 2019-10-15T10:54:03 | 2019-10-15T10:22:47 | Java | UTF-8 | Java | false | false | 2,126 | java | package com.sanguine.excise.dao;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.sanguine.excise.model.clsExciseLicenceMasterModel;
import com.sanguine.excise.model.clsExciseLicenceMasterModel_ID;
@Repository("clsLicenceMasterDao")
public class clsLicenceMasterDaoImpl implements clsLicenceMasterDao {
@Autowired
@Qualifier("exciseSessionFactory")
private SessionFactory exciseSessionFactory;
@Override
public boolean funAddUpdateLicenceMaster(clsExciseLicenceMasterModel objMaster) {
boolean success = false;
try {
Session currentSession = exciseSessionFactory.getCurrentSession();
currentSession.saveOrUpdate(objMaster);
success = true;
} catch (Exception e) {
e.printStackTrace();
success = false;
}
return success;
}
@Override
public clsExciseLicenceMasterModel funGetLicenceMaster(String docCode, String propertyCode, String clientCode) {
clsExciseLicenceMasterModel objModel = null;
try {
Session currentSession = exciseSessionFactory.getCurrentSession();
objModel = (clsExciseLicenceMasterModel) currentSession.get(clsExciseLicenceMasterModel.class, new clsExciseLicenceMasterModel_ID(docCode, clientCode, propertyCode));
} catch (Exception e) {
e.printStackTrace();
}
return objModel;
}
@Override
@Transactional(value = "OtherTransactionManager")
public clsExciseLicenceMasterModel funGetObject(String code, String propertyCode, String clientCode) {
clsExciseLicenceMasterModel objModel = null;
try {
Session currentSession = exciseSessionFactory.getCurrentSession();
objModel = (clsExciseLicenceMasterModel) currentSession.get(clsExciseLicenceMasterModel.class, new clsExciseLicenceMasterModel_ID(code, clientCode, propertyCode));
} catch (Exception e) {
e.printStackTrace();
}
return objModel;
}
}
| [
"[email protected]"
]
| |
06aefdeac5ed93a1397895a5c9b3f2f3f4509da9 | a0c131c506da920e43f7b3387146cef42ee38857 | /src/ui/MainUI.java | dc8d92ea6ae7b97aae3f963cd845206831236f56 | []
| no_license | PoghosPetrosyan/AirportManager | a2aa326fde4a4d3a63edfb7962382107375eb01b | bfbf00b102e33f15b559130b4654c9947d511c7b | refs/heads/master | 2020-03-19T18:52:56.004928 | 2018-06-18T07:53:08 | 2018-06-18T07:53:08 | 136,829,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package ui;
import javafx.event.ActionEvent;
public class UserUI {
public UserUI() {
}
public void addAirplane(ActionEvent actionEvent) {
}
public void editArplane(ActionEvent actionEvent) {
}
public void deleteArplane(ActionEvent actionEvent) {
}
}
| [
"[email protected]"
]
| |
861b902d3ea3c07acc1858d21a10e9020c8b4dbd | fd4562c79cb764527821c99682d31c1ddbcf1a6e | /EchoServer/ServerTh.java | 60f696a2da0448f5c190b86996214bd6aa1c9036 | []
| no_license | navalvaidya/TE-PL3 | e508ab7382d898b18e3663c46ef74a549b6e4d85 | bc716c4049f01b6eb938f6e672c6b09f90975c32 | refs/heads/master | 2016-09-13T08:32:00.323202 | 2016-05-04T16:18:26 | 2016-05-04T16:18:26 | 58,066,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,024 | java | import java.io.*;
import java.net.*;
class ServerTh
{
public static void main(String args[])
{
ServerSocket server;
int port=Integer.parseInt(args[0]);
try{
server=new ServerSocket(port);
while(true){
Socket connection=server.accept();
ConnectionHandler handler=new ConnectionHandler(connection);
handler.start();
}
}
catch(Exception e){
System.err.println("Exception Occurs");
}
}
}
class ConnectionHandler extends Thread
{ private Socket connection;
public ConnectionHandler(Socket connection){
this.connection=connection;
}
public void run()
{
try{
System.out.println("Connected...");
BufferedReader reader=new BufferedReader(new InputStreamReader(connection.getInputStream()));
PrintWriter writer=new PrintWriter(connection.getOutputStream());
System.out.println("ok");
while(true){
String clientName=reader.readLine();
writer.println("Hello "+clientName);
writer.flush();
}
}catch(IOException e){}
}
}
| [
"[email protected]"
]
| |
2a029394a2425f1c11e007d7acc0dc0332ec516f | e275459cf0210281f83bc3cf475964a6a7b0266e | /src/application/Program.java | f5150b08953b152620e038775baa02f65fa755f1 | []
| no_license | thiaagohabib/exceptions1-java | c80433f730a81fe9990ab7cd58b92a2746876cb3 | 707336c97541e88ca3bd7da3c93362a06bf0b2e2 | refs/heads/master | 2021-05-17T06:47:32.517663 | 2020-03-28T22:23:36 | 2020-03-28T22:23:36 | 250,681,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,554 | java | package application;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Scanner;
import model.entities.Reservation;
import model.exceptions.DomainException;
public class Program {
public static void main(String[] args) {
// TODO Auto-generated method stub
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
try {
System.out.print("Room number: ");
int number = sc.nextInt();
System.out.println("Check-in date (dd/MM/yyyy): ");
Date checkIn = sdf.parse(sc.next());
System.out.println("Check-out date (dd/MM/yyyy): ");
Date checkOut = sdf.parse(sc.next());
Reservation reservation = new Reservation(number, checkIn, checkOut);
System.out.println("Reservation: " + reservation);
System.out.println();
System.out.println("Enter data to update the reservation: ");
System.out.println("Check-in date (dd/MM/yyyy): ");
checkIn = sdf.parse(sc.next());
System.out.println("Check-out date (dd/MM/yyyy): ");
checkOut = sdf.parse(sc.next());
reservation.updateDates(checkIn, checkOut);
System.out.println("Reservation: " + reservation);
}
catch (ParseException e) {
System.out.println("Invalid date format");
}
catch (DomainException e) {
System.out.println("Error in reservation: " + e.getMessage());
}
catch (RuntimeException e) {
System.out.println("Unexpected error");
}
sc.close();
}
}
| [
"[email protected]"
]
| |
b9920a435f66a700b223209ae0f3ab752a46bcd6 | fe56b1009de06730426a3484d55485ff6479f519 | /src/main/java/vn/edu/vnu/uet/dktadmin/rest/model/subjectSemesterExam/StudentSubjectExamResponse.java | e1883669ceb8f5a58b430321af66fc8fd935b294 | []
| no_license | 127phudu/dkt-admin | 63d63acda340e6847c678da20cf8483739605c5d | 4249257fe162444bcb113df17b78064bd7ab540e | refs/heads/master | 2022-11-15T12:24:03.319948 | 2020-05-17T18:17:21 | 2020-05-17T18:17:21 | 264,867,632 | 0 | 0 | null | 2020-05-18T07:52:44 | 2020-05-18T07:52:43 | null | UTF-8 | Java | false | false | 515 | java | package vn.edu.vnu.uet.dktadmin.rest.model.subjectSemesterExam;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class StudentSubjectExamResponse {
@JsonProperty("Id")
private Long id;
@JsonProperty("ExamId")
private Long examId;
@JsonProperty("StudentSubjectId")
private Long studentSubjectId;
@JsonProperty("Status")
private String status;
@JsonProperty("LocationId")
private Long locationId;
}
| [
"[email protected]"
]
| |
017dfdea3907ba686c2ec6d421514b7f9c3bb87f | 668e4f5037ccb4b6b1856b89ec6943f59e60f8c0 | /app/src/java/Utilities/DAOUtility.java | 7b49f98ba1db062f06117301a8a21ffaad9ea5c7 | []
| no_license | jordenseet/SMU-Location-Analytics-Service | c5c748ed2cbaa179f356d2b82b600a75d2994107 | 63ca75e439733f6b9b33dfffcf22b79163e9423f | refs/heads/master | 2020-03-10T05:34:36.293232 | 2018-04-12T08:45:54 | 2018-04-12T08:45:54 | 129,220,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | 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 Utilities;
/**
*
* @author G7T4
*/
public class DAOUtility {
/**
*to format the date time
* @param datetime
* @return
*/
public static String formatDatetime(String datetime) {
// datetime from HTML is in the form YYYY-MM-DDTHH:MM:SS (if SS not 00)
// we need YYYY-MM-DD HH:MI:SS for SQL
if (datetime.length() < 19) {
datetime += ":00";
}
return datetime.replace('T', ' ');
}
}
| [
"[email protected]"
]
| |
e15c5f59c5b5a4c21b2525fc2f4ae4ef76e5d7f4 | 32b72e1dc8b6ee1be2e80bb70a03a021c83db550 | /ast_results/ushahidi_SMSSync/smssync/src/main/java/org/addhen/smssync/presentation/receiver/PowerStateChangedReceiver.java | e8ce1bd0dbcd9c5bf8bbca63f6da5d8812972ce4 | []
| no_license | cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | d90c41a17e88fcd99d543124eeb6e93f9133cb4a | 0564143d92f8024ff5fa6b659c2baebf827582b1 | refs/heads/master | 2020-07-13T13:53:40.297493 | 2019-01-11T11:51:18 | 2019-01-11T11:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,248 | java | // isComment
package org.addhen.smssync.presentation.receiver;
import org.addhen.smssync.R;
import org.addhen.smssync.data.PrefsFactory;
import org.addhen.smssync.data.cache.FileManager;
import org.addhen.smssync.presentation.App;
import org.addhen.smssync.presentation.presenter.AlertPresenter;
import org.addhen.smssync.presentation.service.AutoSyncScheduledService;
import org.addhen.smssync.presentation.service.CheckTaskService;
import org.addhen.smssync.presentation.util.Utility;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.BatteryManager;
/**
* isComment
*/
public class isClassOrIsInterface extends BroadcastReceiver {
private Intent isVariable;
private Intent isVariable;
@Override
public void isMethod(final Context isParameter, Intent isParameter) {
boolean isVariable = isNameExpr.isMethod().isMethod(isNameExpr.isFieldAccessExpr);
boolean isVariable = isNameExpr.isMethod().isMethod(isNameExpr.isFieldAccessExpr);
int isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, -isIntegerConstant);
int isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, -isIntegerConstant);
final int isVariable = isNameExpr.isMethod(isNameExpr, isNameExpr);
PrefsFactory isVariable = isNameExpr.isMethod().isMethod();
FileManager isVariable = isNameExpr.isMethod().isMethod();
AlertPresenter isVariable = isNameExpr.isMethod().isMethod();
if (isNameExpr) {
// isComment
isNameExpr.isMethod(isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr));
if (isNameExpr.isMethod().isMethod()) {
isNameExpr.isMethod(isNameExpr);
// isComment
if (isNameExpr.isMethod().isMethod()) {
isNameExpr = new Intent(isNameExpr, AutoSyncScheduledService.class);
isNameExpr.isMethod(isNameExpr);
}
// isComment
if (isNameExpr.isMethod().isMethod()) {
isNameExpr = new Intent(isNameExpr, CheckTaskService.class);
isNameExpr.isMethod(isNameExpr);
}
}
new Thread(new Runnable() {
@Override
public void isMethod() {
isNameExpr.isMethod(isNameExpr);
}
}).isMethod();
}
if (isNameExpr) {
isNameExpr.isMethod(isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr));
// isComment
if (isNameExpr.isMethod().isMethod()) {
// isComment
isNameExpr.isMethod(isNameExpr);
if (isNameExpr.isMethod().isMethod()) {
isNameExpr = new Intent(isNameExpr, AutoSyncScheduledService.class);
isNameExpr.isMethod(isNameExpr, isNameExpr);
}
if (isNameExpr.isMethod().isMethod()) {
isNameExpr = new Intent(isNameExpr, CheckTaskService.class);
isNameExpr.isMethod(isNameExpr, isNameExpr);
}
}
}
}
}
| [
"[email protected]"
]
| |
b90d4e1c3dca7af279e1afa66027f02c7234fa67 | 5d76b555a3614ab0f156bcad357e45c94d121e2d | /src-v2/com/google/gson/internal/ConstructorConstructor.java | 06e79062ffe703e5ebec2515d357d7b4b6164687 | []
| no_license | BinSlashBash/xcrumby | 8e09282387e2e82d12957d22fa1bb0322f6e6227 | 5b8b1cc8537ae1cfb59448d37b6efca01dded347 | refs/heads/master | 2016-09-01T05:58:46.144411 | 2016-02-15T13:23:25 | 2016-02-15T13:23:25 | 51,755,603 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,798 | java | /*
* Decompiled with CFR 0_110.
*/
package com.google.gson.internal;
import com.google.gson.InstanceCreator;
import com.google.gson.JsonIOException;
import com.google.gson.internal.LinkedTreeMap;
import com.google.gson.internal.ObjectConstructor;
import com.google.gson.internal.UnsafeAllocator;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
public final class ConstructorConstructor {
private final Map<Type, InstanceCreator<?>> instanceCreators;
public ConstructorConstructor(Map<Type, InstanceCreator<?>> map) {
this.instanceCreators = map;
}
private <T> ObjectConstructor<T> newDefaultConstructor(Class<? super T> object) {
try {
object = object.getDeclaredConstructor(new Class[0]);
if (!object.isAccessible()) {
object.setAccessible(true);
}
object = new ObjectConstructor<T>((Constructor)object){
final /* synthetic */ Constructor val$constructor;
@Override
public T construct() {
Object t2;
try {
t2 = this.val$constructor.newInstance(null);
}
catch (InstantiationException var1_2) {
throw new RuntimeException("Failed to invoke " + this.val$constructor + " with no args", var1_2);
}
catch (InvocationTargetException var1_3) {
throw new RuntimeException("Failed to invoke " + this.val$constructor + " with no args", var1_3.getTargetException());
}
catch (IllegalAccessException var1_4) {
throw new AssertionError(var1_4);
}
return t2;
}
};
return object;
}
catch (NoSuchMethodException var1_2) {
return null;
}
}
private <T> ObjectConstructor<T> newDefaultImplementationConstructor(final Type type, Class<? super T> class_) {
if (Collection.class.isAssignableFrom(class_)) {
if (SortedSet.class.isAssignableFrom(class_)) {
return new ObjectConstructor<T>(){
@Override
public T construct() {
return (T)new TreeSet();
}
};
}
if (EnumSet.class.isAssignableFrom(class_)) {
return new ObjectConstructor<T>(){
@Override
public T construct() {
if (type instanceof ParameterizedType) {
Type type2 = ((ParameterizedType)type).getActualTypeArguments()[0];
if (type2 instanceof Class) {
return (T)EnumSet.noneOf((Class)type2);
}
throw new JsonIOException("Invalid EnumSet type: " + type.toString());
}
throw new JsonIOException("Invalid EnumSet type: " + type.toString());
}
};
}
if (Set.class.isAssignableFrom(class_)) {
return new ObjectConstructor<T>(){
@Override
public T construct() {
return (T)new LinkedHashSet();
}
};
}
if (Queue.class.isAssignableFrom(class_)) {
return new ObjectConstructor<T>(){
@Override
public T construct() {
return (T)new LinkedList();
}
};
}
return new ObjectConstructor<T>(){
@Override
public T construct() {
return (T)new ArrayList();
}
};
}
if (Map.class.isAssignableFrom(class_)) {
if (SortedMap.class.isAssignableFrom(class_)) {
return new ObjectConstructor<T>(){
@Override
public T construct() {
return (T)new TreeMap();
}
};
}
if (type instanceof ParameterizedType && !String.class.isAssignableFrom(TypeToken.get(((ParameterizedType)type).getActualTypeArguments()[0]).getRawType())) {
return new ObjectConstructor<T>(){
@Override
public T construct() {
return (T)new LinkedHashMap();
}
};
}
return new ObjectConstructor<T>(){
@Override
public T construct() {
return (T)new LinkedTreeMap();
}
};
}
return null;
}
private <T> ObjectConstructor<T> newUnsafeAllocator(final Type type, final Class<? super T> class_) {
return new ObjectConstructor<T>(){
private final UnsafeAllocator unsafeAllocator;
@Override
public T construct() {
Object t2;
try {
t2 = this.unsafeAllocator.newInstance(class_);
}
catch (Exception var1_2) {
throw new RuntimeException("Unable to invoke no-args constructor for " + type + ". " + "Register an InstanceCreator with Gson for this type may fix this problem.", var1_2);
}
return t2;
}
};
}
/*
* Enabled force condition propagation
* Lifted jumps to return sites
*/
public <T> ObjectConstructor<T> get(TypeToken<T> object) {
ObjectConstructor objectConstructor;
Type type = object.getType();
Class class_ = object.getRawType();
object = this.instanceCreators.get(type);
if (object != null) {
return new ObjectConstructor<T>((InstanceCreator)object, type){
final /* synthetic */ Type val$type;
final /* synthetic */ InstanceCreator val$typeCreator;
@Override
public T construct() {
return this.val$typeCreator.createInstance(this.val$type);
}
};
}
object = this.instanceCreators.get(class_);
if (object != null) {
return new ObjectConstructor<T>((InstanceCreator)object, type){
final /* synthetic */ InstanceCreator val$rawTypeCreator;
final /* synthetic */ Type val$type;
@Override
public T construct() {
return this.val$rawTypeCreator.createInstance(this.val$type);
}
};
}
object = objectConstructor = this.newDefaultConstructor(class_);
if (objectConstructor != null) return object;
object = this.newDefaultImplementationConstructor(type, class_);
if (object == null) return this.newUnsafeAllocator(type, class_);
return object;
}
public String toString() {
return this.instanceCreators.toString();
}
}
| [
"[email protected]"
]
| |
1ecee064ba8b748377ba4db29a9a13b55fa6a658 | 7c3e769ad1e036004fcd47540d018524d8cf69c4 | /libCore/src/main/java/com/bogokj/library/utils/SDNumberUtil.java | 1f958a1707c724b7f20b55d9c6d2d6e98b2b4902 | []
| no_license | zkbqhuang/bogo_live_android | b813ed99f7237f4dd2e77014c311bc8da74ecbf9 | a51799fa7038f089b10209e7ec446a0000a68d8a | refs/heads/master | 2022-07-06T15:29:08.344192 | 2020-05-11T03:11:12 | 2020-05-11T03:11:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,207 | java | package com.bogokj.library.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class SDNumberUtil
{
/**
* 保留小数位(四舍五入模式)
*
* @param value 需要格式化的值
* @param scale 保留几位小数
* @return
*/
public static double scaleHalfUp(double value, int scale)
{
return scale(value, scale, RoundingMode.HALF_UP);
}
/**
* 保留小数位
*
* @param value 需要格式化的值
* @param scale 保留几位小数
* @param mode 保留模式
* @return
*/
public static double scale(double value, int scale, RoundingMode mode)
{
return new BigDecimal(String.valueOf(value)).setScale(scale, mode).doubleValue();
}
//----------加减乘除 start----------
/**
* 加法
*
* @param value1
* @param value2
* @return
*/
public static double add(double value1, double value2)
{
return new BigDecimal(String.valueOf(value1))
.add(new BigDecimal(String.valueOf(value2))).doubleValue();
}
/**
* 加法(最终结果四舍五入)
*
* @param value1
* @param value2
* @param scale 保留几位小数
* @return
*/
public static double add(double value1, double value2, int scale)
{
return scaleHalfUp(add(value1, value2), scale);
}
/**
* 减法
*
* @param value1
* @param value2
* @return
*/
public static double subtract(double value1, double value2)
{
return new BigDecimal(String.valueOf(value1))
.subtract(new BigDecimal(String.valueOf(value2))).doubleValue();
}
/**
* 减法(最终结果四舍五入)
*
* @param value1
* @param value2
* @param scale 保留几位小数
* @return
*/
public static double subtract(double value1, double value2, int scale)
{
return scaleHalfUp(subtract(value1, value2), scale);
}
/**
* 乘法
*
* @param value1
* @param value2
* @return
*/
public static double multiply(double value1, double value2)
{
return new BigDecimal(String.valueOf(value1))
.multiply(new BigDecimal(String.valueOf(value2))).doubleValue();
}
/**
* 乘法(最终结果四舍五入)
*
* @param value1
* @param value2
* @param scale 保留几位小数
* @return
*/
public static double multiply(double value1, double value2, int scale)
{
return scaleHalfUp(multiply(value1, value2), scale);
}
/**
* 除法
*
* @param value1
* @param value2
* @return
*/
public static double divide(double value1, double value2, int scale, RoundingMode roundingMode)
{
return new BigDecimal(String.valueOf(value1))
.divide(new BigDecimal(String.valueOf(value2)), scale, roundingMode).doubleValue();
}
/**
* 除法(最终结果四舍五入)
*
* @param value1
* @param value2
* @param scale 保留几位小数
* @return
*/
public static double divide(double value1, double value2, int scale)
{
return divide(value1, value2, scale, RoundingMode.HALF_UP);
}
//----------加减乘除 end----------
public static double distance(double lat1, double lon1, double lat2, double lon2)
{
double theta = lon1 - lon2;
double dist = Math.sin(deg2rad(lat1)) * Math.sin(deg2rad(lat2)) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2))
* Math.cos(deg2rad(theta));
dist = Math.acos(dist);
dist = rad2deg(dist);
double miles = dist * 60 * 1.1515 * 1.609344 * 1000;
return miles;
}
/**
* 角度转换为弧度
*
* @param degree
* @return
*/
public static double deg2rad(double degree)
{
return degree / 180 * Math.PI;
}
/**
* 弧度转换为角度
*
* @param radian
* @return
*/
public static double rad2deg(double radian)
{
return radian * 180 / Math.PI;
}
}
| [
"[email protected]"
]
| |
e054ddee1c1e0a3e090c317e96a6cc71c6e476cd | d05c545ac611338b17356fc2f807902894c8cc41 | /FbLogin/src/pl/kitek/fblogin/MainActivity.java | 9f26d558bed30118491119a674065a311a6d591e | []
| no_license | kitek/android-sandbox | 2cc0cd30e74a3295fbf2175842abd485e74a4b6d | 249ac8724eab672df7980700bf85b2bd32809d1a | refs/heads/master | 2016-09-01T17:52:22.422100 | 2013-11-25T20:49:45 | 2013-11-25T20:49:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,518 | java | package pl.kitek.fblogin;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;
import android.view.MenuItem;
import com.facebook.Session;
import com.facebook.SessionState;
import com.facebook.UiLifecycleHelper;
public class MainActivity extends FragmentActivity {
private static final int SPLASH = 0;
private static final int SELECTION = 1;
private static final int SETTINGS = 2;
private static final int FRAGMENT_COUNT = SETTINGS + 1;
private Fragment[] fragments = new Fragment[FRAGMENT_COUNT];
private boolean isResumed = false;
private MenuItem settings;
private UiLifecycleHelper uiHelper;
private Session.StatusCallback callback = new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
uiHelper = new UiLifecycleHelper(this, callback);
uiHelper.onCreate(savedInstanceState);
setContentView(R.layout.main);
FragmentManager fm = getSupportFragmentManager();
fragments[SPLASH] = fm.findFragmentById(R.id.splashFragment);
fragments[SELECTION] = fm.findFragmentById(R.id.selectionFragment);
fragments[SETTINGS] = fm.findFragmentById(R.id.userSettingsFragment);
FragmentTransaction transaction = fm.beginTransaction();
for (int i = 0; i < fragments.length; i++) {
transaction.hide(fragments[i]);
}
transaction.commit();
}
public boolean onPrepareOptionsMenu(Menu menu) {
// only add the menu when the selection fragment is showing
if (fragments[SELECTION].isVisible()) {
if (menu.size() == 0) {
settings = menu.add(R.string.settings);
}
return true;
} else {
menu.clear();
settings = null;
}
return false;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.equals(settings)) {
showFragment(SETTINGS, true);
return true;
}
return false;
}
@Override
public void onResume() {
super.onResume();
uiHelper.onResume();
isResumed = true;
}
@Override
public void onPause() {
super.onPause();
uiHelper.onPause();
isResumed = false;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
uiHelper.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onDestroy() {
super.onDestroy();
uiHelper.onDestroy();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
uiHelper.onSaveInstanceState(outState);
}
@Override
protected void onResumeFragments() {
super.onResumeFragments();
Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
// if the session is already open,
// try to show the selection fragment
showFragment(SELECTION, false);
} else {
// otherwise present the splash screen
// and ask the person to login.
showFragment(SPLASH, false);
}
}
private void showFragment(int fragmentIndex, boolean addToBackStack) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
for (int i = 0; i < fragments.length; i++) {
if (i == fragmentIndex) {
transaction.show(fragments[i]);
} else {
transaction.hide(fragments[i]);
}
}
if (addToBackStack) {
transaction.addToBackStack(null);
}
transaction.commit();
}
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
// Only make changes if the activity is visible
if (isResumed) {
FragmentManager manager = getSupportFragmentManager();
// Get the number of entries in the back stack
int backStackSize = manager.getBackStackEntryCount();
// Clear the back stack
for (int i = 0; i < backStackSize; i++) {
manager.popBackStack();
}
if (state.isOpened()) {
// If the session state is open:
// Show the authenticated fragment
showFragment(SELECTION, false);
} else if (state.isClosed()) {
// If the session state is closed:
// Show the login fragment
showFragment(SPLASH, false);
}
}
}
}
| [
"[email protected]"
]
| |
a417a7f72bed1b6bb1bc05e0652c110cb934bd0b | 786b6f42b57e45f4413cceb1ce93005f3d989c2a | /psi-integ/src/main/java/org/muhia/app/psi/integ/wsdl/crba/transunion/GetProduct153.java | 237bf1d4d79c75b561bceb33e978611ecd9ee16d | []
| no_license | wangqi7/psi | 8ee99dfaa9ae7dc68dfe754d94fdfbf682d2f9a1 | 851338b1953f43682a271e66af5cdae34b3b956c | refs/heads/master | 2020-03-17T09:55:35.206617 | 2017-05-02T08:56:23 | 2017-05-02T08:56:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,404 | java | package org.muhia.app.psi.integ.wsdl.crba.transunion;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* <p>Java class for getProduct153 complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <complexType name="getProduct153">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="username" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="code" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="infinityCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="companyName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="companyRegNo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="taxID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="vatID" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="companyRegDate" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
* <element name="postalBoxNo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="postalTown" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="postalCountry" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="telephoneNo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="faxNo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="websiteAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="physicalAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="physicalTown" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="physicalCountry" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="reportSector" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="reportReason" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getProduct153", propOrder = {"username", "password", "code", "infinityCode", "companyName", "companyRegNo", "taxID", "vatID", "companyRegDate", "postalBoxNo", "postalTown", "postalCountry", "telephoneNo", "faxNo", "websiteAddress", "physicalAddress", "physicalTown", "physicalCountry", "reportSector", "reportReason"})
public class GetProduct153 {
protected String username;
protected String password;
protected String code;
protected String infinityCode;
protected String companyName;
protected String companyRegNo;
protected String taxID;
protected String vatID;
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar companyRegDate;
protected String postalBoxNo;
protected String postalTown;
protected String postalCountry;
protected String telephoneNo;
protected String faxNo;
protected String websiteAddress;
protected String physicalAddress;
protected String physicalTown;
protected String physicalCountry;
protected int reportSector;
protected int reportReason;
/**
* Gets the value of the username property.
*
* @return possible object is
* {@link String }
*/
public String getUsername() {
return username;
}
/**
* Sets the value of the username property.
*
* @param value allowed object is
* {@link String }
*/
public void setUsername(String value) {
this.username = value;
}
/**
* Gets the value of the password property.
*
* @return possible object is
* {@link String }
*/
public String getPassword() {
return password;
}
/**
* Sets the value of the password property.
*
* @param value allowed object is
* {@link String }
*/
public void setPassword(String value) {
this.password = value;
}
/**
* Gets the value of the code property.
*
* @return possible object is
* {@link String }
*/
public String getCode() {
return code;
}
/**
* Sets the value of the code property.
*
* @param value allowed object is
* {@link String }
*/
public void setCode(String value) {
this.code = value;
}
/**
* Gets the value of the infinityCode property.
*
* @return possible object is
* {@link String }
*/
public String getInfinityCode() {
return infinityCode;
}
/**
* Sets the value of the infinityCode property.
*
* @param value allowed object is
* {@link String }
*/
public void setInfinityCode(String value) {
this.infinityCode = value;
}
/**
* Gets the value of the companyName property.
*
* @return possible object is
* {@link String }
*/
public String getCompanyName() {
return companyName;
}
/**
* Sets the value of the companyName property.
*
* @param value allowed object is
* {@link String }
*/
public void setCompanyName(String value) {
this.companyName = value;
}
/**
* Gets the value of the companyRegNo property.
*
* @return possible object is
* {@link String }
*/
public String getCompanyRegNo() {
return companyRegNo;
}
/**
* Sets the value of the companyRegNo property.
*
* @param value allowed object is
* {@link String }
*/
public void setCompanyRegNo(String value) {
this.companyRegNo = value;
}
/**
* Gets the value of the taxID property.
*
* @return possible object is
* {@link String }
*/
public String getTaxID() {
return taxID;
}
/**
* Sets the value of the taxID property.
*
* @param value allowed object is
* {@link String }
*/
public void setTaxID(String value) {
this.taxID = value;
}
/**
* Gets the value of the vatID property.
*
* @return possible object is
* {@link String }
*/
public String getVatID() {
return vatID;
}
/**
* Sets the value of the vatID property.
*
* @param value allowed object is
* {@link String }
*/
public void setVatID(String value) {
this.vatID = value;
}
/**
* Gets the value of the companyRegDate property.
*
* @return possible object is
* {@link XMLGregorianCalendar }
*/
public XMLGregorianCalendar getCompanyRegDate() {
return companyRegDate;
}
/**
* Sets the value of the companyRegDate property.
*
* @param value allowed object is
* {@link XMLGregorianCalendar }
*/
public void setCompanyRegDate(XMLGregorianCalendar value) {
this.companyRegDate = value;
}
/**
* Gets the value of the postalBoxNo property.
*
* @return possible object is
* {@link String }
*/
public String getPostalBoxNo() {
return postalBoxNo;
}
/**
* Sets the value of the postalBoxNo property.
*
* @param value allowed object is
* {@link String }
*/
public void setPostalBoxNo(String value) {
this.postalBoxNo = value;
}
/**
* Gets the value of the postalTown property.
*
* @return possible object is
* {@link String }
*/
public String getPostalTown() {
return postalTown;
}
/**
* Sets the value of the postalTown property.
*
* @param value allowed object is
* {@link String }
*/
public void setPostalTown(String value) {
this.postalTown = value;
}
/**
* Gets the value of the postalCountry property.
*
* @return possible object is
* {@link String }
*/
public String getPostalCountry() {
return postalCountry;
}
/**
* Sets the value of the postalCountry property.
*
* @param value allowed object is
* {@link String }
*/
public void setPostalCountry(String value) {
this.postalCountry = value;
}
/**
* Gets the value of the telephoneNo property.
*
* @return possible object is
* {@link String }
*/
public String getTelephoneNo() {
return telephoneNo;
}
/**
* Sets the value of the telephoneNo property.
*
* @param value allowed object is
* {@link String }
*/
public void setTelephoneNo(String value) {
this.telephoneNo = value;
}
/**
* Gets the value of the faxNo property.
*
* @return possible object is
* {@link String }
*/
public String getFaxNo() {
return faxNo;
}
/**
* Sets the value of the faxNo property.
*
* @param value allowed object is
* {@link String }
*/
public void setFaxNo(String value) {
this.faxNo = value;
}
/**
* Gets the value of the websiteAddress property.
*
* @return possible object is
* {@link String }
*/
public String getWebsiteAddress() {
return websiteAddress;
}
/**
* Sets the value of the websiteAddress property.
*
* @param value allowed object is
* {@link String }
*/
public void setWebsiteAddress(String value) {
this.websiteAddress = value;
}
/**
* Gets the value of the physicalAddress property.
*
* @return possible object is
* {@link String }
*/
public String getPhysicalAddress() {
return physicalAddress;
}
/**
* Sets the value of the physicalAddress property.
*
* @param value allowed object is
* {@link String }
*/
public void setPhysicalAddress(String value) {
this.physicalAddress = value;
}
/**
* Gets the value of the physicalTown property.
*
* @return possible object is
* {@link String }
*/
public String getPhysicalTown() {
return physicalTown;
}
/**
* Sets the value of the physicalTown property.
*
* @param value allowed object is
* {@link String }
*/
public void setPhysicalTown(String value) {
this.physicalTown = value;
}
/**
* Gets the value of the physicalCountry property.
*
* @return possible object is
* {@link String }
*/
public String getPhysicalCountry() {
return physicalCountry;
}
/**
* Sets the value of the physicalCountry property.
*
* @param value allowed object is
* {@link String }
*/
public void setPhysicalCountry(String value) {
this.physicalCountry = value;
}
/**
* Gets the value of the reportSector property.
*/
public int getReportSector() {
return reportSector;
}
/**
* Sets the value of the reportSector property.
*/
public void setReportSector(int value) {
this.reportSector = value;
}
/**
* Gets the value of the reportReason property.
*/
public int getReportReason() {
return reportReason;
}
/**
* Sets the value of the reportReason property.
*/
public void setReportReason(int value) {
this.reportReason = value;
}
}
| [
"[email protected]"
]
| |
c15ad67ff30c34c8cf385cc6e5a4ec080b6d1ba1 | 1596a394d4c0e488e65cf02c2682f5a9970f9e5e | /android/expoview/src/main/java/versioned/host/exp/exponent/ExponentPackage.java | 2928ae4af87f54ab68a4f258ecd5336e6fe481a8 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"CC-BY-4.0"
]
| permissive | weiqiangzheng/expo | f6cd8413ee338a38b159ccaa2a3e29e6721902d0 | af9f49916669538eb9a73cae0afbb75c1ca89536 | refs/heads/master | 2020-03-20T12:18:39.402059 | 2018-06-14T21:55:35 | 2018-06-14T21:57:57 | 137,426,443 | 1 | 0 | null | 2018-06-15T01:28:23 | 2018-06-15T01:28:23 | null | UTF-8 | Java | false | false | 13,386 | java | // Copyright 2015-present 650 Industries. All rights reserved.
package versioned.host.exp.exponent;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import host.exp.exponent.ExponentManifest;
import host.exp.exponent.analytics.EXL;
import host.exp.exponent.kernel.ExperienceId;
import host.exp.exponent.kernel.ExponentKernelModuleProvider;
import host.exp.exponent.utils.ScopedContext;
import versioned.host.exp.exponent.modules.api.BrightnessModule;
import versioned.host.exp.exponent.modules.api.ImageManipulatorModule;
import versioned.host.exp.exponent.modules.api.MailComposerModule;
import versioned.host.exp.exponent.modules.api.MediaLibraryModule;
import versioned.host.exp.exponent.modules.api.print.PrintModule;
import versioned.host.exp.exponent.modules.api.UpdatesModule;
import versioned.host.exp.exponent.modules.api.av.video.VideoManager;
import versioned.host.exp.exponent.modules.api.components.barcodescanner.BarCodeScannerModule;
import versioned.host.exp.exponent.modules.api.components.barcodescanner.BarCodeScannerViewManager;
import versioned.host.exp.exponent.modules.api.components.facedetector.FaceDetectorModule;
import versioned.host.exp.exponent.modules.api.sensors.AccelerometerModule;
import versioned.host.exp.exponent.modules.api.AmplitudeModule;
import versioned.host.exp.exponent.modules.api.CalendarModule;
import versioned.host.exp.exponent.modules.api.ConstantsModule;
import versioned.host.exp.exponent.modules.api.ContactsModule;
import versioned.host.exp.exponent.modules.api.CryptoModule;
import versioned.host.exp.exponent.modules.api.DocumentPickerModule;
import versioned.host.exp.exponent.modules.api.ErrorRecoveryModule;
import versioned.host.exp.exponent.modules.api.FabricModule;
import versioned.host.exp.exponent.modules.api.FacebookModule;
import versioned.host.exp.exponent.modules.api.FileSystemModule;
import versioned.host.exp.exponent.modules.api.FingerprintModule;
import versioned.host.exp.exponent.modules.api.FontLoaderModule;
import versioned.host.exp.exponent.modules.api.GoogleModule;
import versioned.host.exp.exponent.modules.api.sensors.DeviceMotionModule;
import versioned.host.exp.exponent.modules.api.sensors.GyroscopeModule;
import versioned.host.exp.exponent.modules.api.ImageCropperModule;
import versioned.host.exp.exponent.modules.api.ImagePickerModule;
import versioned.host.exp.exponent.modules.api.KeepAwakeModule;
import versioned.host.exp.exponent.modules.api.KeyboardModule;
import versioned.host.exp.exponent.modules.api.LocationModule;
import versioned.host.exp.exponent.modules.api.LocalizationModule;
import versioned.host.exp.exponent.modules.api.NotificationsModule;
import versioned.host.exp.exponent.modules.api.PedometerModule;
import versioned.host.exp.exponent.modules.api.PermissionsModule;
import versioned.host.exp.exponent.modules.api.RNViewShotModule;
import versioned.host.exp.exponent.modules.api.SQLiteModule;
import versioned.host.exp.exponent.modules.api.ScreenOrientationModule;
import versioned.host.exp.exponent.modules.api.SegmentModule;
import versioned.host.exp.exponent.modules.api.ShakeModule;
import versioned.host.exp.exponent.modules.api.SpeechModule;
import versioned.host.exp.exponent.modules.api.URLHandlerModule;
import versioned.host.exp.exponent.modules.api.WebBrowserModule;
import versioned.host.exp.exponent.modules.api.av.AVModule;
import versioned.host.exp.exponent.modules.api.av.video.VideoViewManager;
import versioned.host.exp.exponent.modules.api.cognito.RNAWSCognitoModule;
import versioned.host.exp.exponent.modules.api.components.LinearGradientManager;
import versioned.host.exp.exponent.modules.api.components.camera.CameraModule;
import versioned.host.exp.exponent.modules.api.components.camera.CameraViewManager;
import versioned.host.exp.exponent.modules.api.components.lottie.LottiePackage;
import versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerPackage;
import versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerModule;
import versioned.host.exp.exponent.modules.api.components.maps.MapsPackage;
import versioned.host.exp.exponent.modules.api.components.svg.SvgPackage;
import versioned.host.exp.exponent.modules.api.fbads.AdSettingsManager;
import versioned.host.exp.exponent.modules.api.fbads.BannerViewManager;
import versioned.host.exp.exponent.modules.api.fbads.InterstitialAdManager;
import versioned.host.exp.exponent.modules.api.fbads.NativeAdManager;
import versioned.host.exp.exponent.modules.api.fbads.NativeAdViewManager;
import versioned.host.exp.exponent.modules.api.gl.GLObjectManagerModule;
import versioned.host.exp.exponent.modules.api.gl.GLViewManager;
import versioned.host.exp.exponent.modules.api.IntentLauncherModule;
import versioned.host.exp.exponent.modules.api.reanimated.ReanimatedModule;
import versioned.host.exp.exponent.modules.api.SecureStoreModule;
import versioned.host.exp.exponent.modules.api.sensors.MagnetometerModule;
import versioned.host.exp.exponent.modules.api.sensors.MagnetometerUncalibratedModule;
import versioned.host.exp.exponent.modules.api.standalone.branch.RNBranchModule;
import versioned.host.exp.exponent.modules.internal.ExponentAsyncStorageModule;
import versioned.host.exp.exponent.modules.internal.ExponentIntentModule;
import versioned.host.exp.exponent.modules.internal.ExponentUnsignedAsyncStorageModule;
import versioned.host.exp.exponent.modules.api.components.payments.StripeModule;
import versioned.host.exp.exponent.modules.test.ExponentTestNativeModule;
import static host.exp.exponent.kernel.KernelConstants.LINKING_URI_KEY;
public class ExponentPackage implements ReactPackage {
private static final String TAG = ExponentPackage.class.getSimpleName();
private final boolean mIsKernel;
private final Map<String, Object> mExperienceProperties;
private final JSONObject mManifest;
private ExponentPackage(boolean isKernel, Map<String, Object> experienceProperties, JSONObject manifest) {
mIsKernel = isKernel;
mExperienceProperties = experienceProperties;
mManifest = manifest;
}
public ExponentPackage(Map<String, Object> experienceProperties, JSONObject manifest) {
mIsKernel = false;
mExperienceProperties = experienceProperties;
mManifest = manifest;
}
public static ExponentPackage kernelExponentPackage(JSONObject manifest) {
Map<String, Object> kernelExperienceProperties = new HashMap<>();
kernelExperienceProperties.put(LINKING_URI_KEY, "exp://");
return new ExponentPackage(true, kernelExperienceProperties, manifest);
}
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
boolean isVerified = false;
if (mManifest != null) {
isVerified = mManifest.optBoolean(ExponentManifest.MANIFEST_IS_VERIFIED_KEY);
}
List<NativeModule> nativeModules = new ArrayList<>(Arrays.<NativeModule>asList(
new URLHandlerModule(reactContext),
new ConstantsModule(reactContext, mExperienceProperties, mManifest),
new ShakeModule(reactContext),
new FontLoaderModule(reactContext),
new KeyboardModule(reactContext),
new UpdatesModule(reactContext, mExperienceProperties, mManifest),
new ExponentIntentModule(reactContext, mExperienceProperties)
));
if (mIsKernel) {
// Never need this in versioned code. Comment this out if this is in an abi package
nativeModules.add((NativeModule) ExponentKernelModuleProvider.newInstance(reactContext));
}
if (isVerified) {
try {
ExperienceId experienceId = ExperienceId.create(mManifest.getString(ExponentManifest.MANIFEST_ID_KEY));
ScopedContext scopedContext = new ScopedContext(reactContext, experienceId.getUrlEncoded());
nativeModules.add(new ExponentAsyncStorageModule(reactContext, mManifest));
nativeModules.add(new AccelerometerModule(reactContext, experienceId));
nativeModules.add(new GyroscopeModule(reactContext, experienceId));
nativeModules.add(new MagnetometerModule(reactContext, experienceId));
nativeModules.add(new DeviceMotionModule(reactContext, experienceId));
nativeModules.add(new MagnetometerUncalibratedModule(reactContext, experienceId));
nativeModules.add(new NotificationsModule(reactContext, mManifest, mExperienceProperties));
nativeModules.add(new ContactsModule(reactContext, experienceId));
nativeModules.add(new FileSystemModule(reactContext, scopedContext, mExperienceProperties));
nativeModules.add(new LocationModule(reactContext, scopedContext, experienceId));
nativeModules.add(new CryptoModule(reactContext));
nativeModules.add(new ImagePickerModule(reactContext, scopedContext, experienceId));
nativeModules.add(new ImageManipulatorModule(reactContext, scopedContext));
nativeModules.add(new FacebookModule(reactContext));
nativeModules.add(new FabricModule(reactContext, mExperienceProperties));
nativeModules.add(new FingerprintModule(reactContext));
nativeModules.add(new GoogleModule(reactContext, mExperienceProperties));
nativeModules.add(new PermissionsModule(reactContext, experienceId, mManifest));
nativeModules.add(new AmplitudeModule(reactContext, scopedContext));
nativeModules.add(new SegmentModule(reactContext, scopedContext));
nativeModules.add(new CameraModule(reactContext, scopedContext, experienceId));
nativeModules.add(new FaceDetectorModule(reactContext, scopedContext));
nativeModules.add(new RNViewShotModule(reactContext, scopedContext));
nativeModules.add(new KeepAwakeModule(reactContext));
nativeModules.add(new ExponentTestNativeModule(reactContext));
nativeModules.add(new WebBrowserModule(reactContext));
nativeModules.add(new AVModule(reactContext, scopedContext, experienceId));
nativeModules.add(new VideoManager(reactContext));
nativeModules.add(new NativeAdManager(reactContext));
nativeModules.add(new AdSettingsManager(reactContext));
nativeModules.add(new InterstitialAdManager(reactContext));
nativeModules.add(new SQLiteModule(reactContext, scopedContext));
nativeModules.add(new DocumentPickerModule(reactContext, scopedContext));
nativeModules.add(new PedometerModule(reactContext));
nativeModules.add(new RNBranchModule(reactContext));
nativeModules.add(new ErrorRecoveryModule(reactContext, experienceId));
nativeModules.add(new IntentLauncherModule(reactContext));
nativeModules.add(new ScreenOrientationModule(reactContext));
nativeModules.add(new SpeechModule(reactContext));
nativeModules.add(new SecureStoreModule(reactContext, scopedContext));
nativeModules.add(new GLObjectManagerModule(reactContext, scopedContext));
nativeModules.add(new BrightnessModule(reactContext));
nativeModules.add(new RNGestureHandlerModule(reactContext));
nativeModules.add(new StripeModule(reactContext));
nativeModules.add(new BarCodeScannerModule(reactContext));
nativeModules.add(new RNAWSCognitoModule(reactContext));
nativeModules.add(new MailComposerModule(reactContext));
nativeModules.add(new CalendarModule(reactContext, experienceId));
nativeModules.add(new MediaLibraryModule(reactContext, experienceId));
nativeModules.add(new PrintModule(reactContext, scopedContext));
nativeModules.add(new LocalizationModule(reactContext));
nativeModules.add(new ReanimatedModule(reactContext));
} catch (JSONException | UnsupportedEncodingException e) {
EXL.e(TAG, e.toString());
}
} else {
nativeModules.add(new ExponentUnsignedAsyncStorageModule(reactContext));
}
nativeModules.add(new ImageCropperModule(reactContext));
return nativeModules;
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
List<ViewManager> viewManagers = new ArrayList<>(Arrays.<ViewManager>asList(
new LinearGradientManager(),
new VideoViewManager(),
new CameraViewManager(),
new GLViewManager(),
new NativeAdViewManager(),
new BarCodeScannerViewManager(),
new BannerViewManager()
));
// Add view manager from 3rd party library packages.
addViewManagersFromPackages(reactContext, viewManagers, Arrays.<ReactPackage>asList(
new SvgPackage(),
new MapsPackage(),
new LottiePackage(),
new RNGestureHandlerPackage()
));
return viewManagers;
}
private void addViewManagersFromPackages(ReactApplicationContext reactContext,
List<ViewManager> viewManagers,
List<ReactPackage> packages) {
for (ReactPackage pack : packages) {
viewManagers.addAll(pack.createViewManagers(reactContext));
}
}
}
| [
"[email protected]"
]
| |
f8fe0cce2cb294e00fa74929d5eb0b03cb677955 | 177dcdc56c417d828022d333a6c5bfe69f45c81d | /MovieShare/src/com/zx/utils/FilmmakerType.java | 2170dd303d7d9d030c489ff971effa21e1edbdff | []
| no_license | zx7714/graduation | cccb212f767a1e4fad7e56b64a9b048c32b06693 | bb6187f31f642d2ff93b53ba8b6ed3c7ff1b2e03 | refs/heads/master | 2020-03-09T22:09:17.467327 | 2018-04-11T06:40:23 | 2018-04-11T06:40:23 | 129,027,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 95 | java | package com.zx.utils;
public enum FilmmakerType {
FilmmakerExist,
AddSuccess,
AddFailed;
}
| [
"[email protected]"
]
| |
a76b395206290f9bc08521cfc27e1f06f4feb4e7 | c3d1043bbf675b7b5891e48dea24b12fe808110f | /libhttp/src/main/java/toasts/StringUtil.java | aa5458125addb97e6ecd5dc01fa7fcdf9ea5ab75 | []
| no_license | BJColor/BJColor | c316d4f777bbe198b09c09ae7069373091455e9e | f0e4e9b49f928a71c78680e91c147c92d42486f0 | refs/heads/master | 2018-09-04T11:19:07.435568 | 2018-06-04T09:55:27 | 2018-06-04T09:55:27 | 118,750,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,355 | java | package toasts;
import android.graphics.Color;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.widget.EditText;
import org.json.JSONArray;
import org.json.JSONObject;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
/**
* 设备信息工具类
*/
public class StringUtil {
/**
* str is null or length==0 or "null" or "NULL"
* @param str
* @return
*/
public static boolean isNull(String str) {
return TextUtils.isEmpty(str) || str.equalsIgnoreCase("null");
}
public static String avoidNull(String str) {
return TextUtils.isEmpty(str) ? "" : str;
}
/**
* 大图地址
*/
public static String transformBIG(String url) {
return url.substring(0, url.lastIndexOf(".")) + ".big"
+ url.substring(url.lastIndexOf("."), url.length());
}
/**
* StringUtil.isEmpty(null) = true StringUtil.isEmpty("") = true
* StringUtil.isEmpty(" ") = false StringUtil.isEmpty("gaohang") = false
* StringUtil.isEmpty(" gaohang ") = false
*/
// 是否为空
public static boolean isEmpty(String str) {
return (str == null || str.length() == 0);
}
/**
* 验证身份证号是否符合规则
*
* @param text 身份证号
* @return
*/
public static boolean personIdValidation(String text) {
text = text.toUpperCase();
// String regx = "[0-9]{17}x";
// String reg1 = "[0-9]{15}";
// String regex = "[0-9]{18}";
String re = "(\\d{14}[0-9X])|(\\d{17}[0-9X])";
return text.matches(re) /*|| text.matches(regx) || text.matches(reg1)
|| text.matches(regex)*/;
}
/**
* StringUtil.isBlank(null) = true StringUtil.isBlank("") = true
* StringUtil.isBlank(" ") = true StringUtil.isBlank("gaohang") = false
* StringUtil.isBlank(" gaohang ") = false
*/
// 是否为空白
public static boolean isBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if ((Character.isWhitespace(str.charAt(i)) == false)) {
return false;
}
}
return true;
}
/**
* StringUtil.isNotEmpty(null) = false StringUtil.isNotEmpty("") = false
* StringUtil.isNotEmpty(" ") = true StringUtil.isNotEmpty("gaohang") = true
* StringUtil.isNotEmpty(" gaohang ") = true
*/
// 是否不为空
public static boolean isNotEmpty(String str) {
return (str != null && str.length() > 0);
}
/**
* StringUtil.isNotBlank(null) = false StringUtil.isNotBlank("") = false
* StringUtil.isNotBlank(" ") = false StringUtil.isNotBlank("gaohang") =
* true StringUtil.isNotBlank(" gaohang ") = true
*/
// 是否不为空白
public static boolean isNotBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return false;
}
for (int i = 0; i < strLen; i++) {
if ((Character.isWhitespace(str.charAt(i)) == false)) {
return true;
}
}
return false;
}
/**
* StringUtil.isNumeric(null) = false StringUtil.isNumeric("") = false
* StringUtil.isNumeric(" ") = false StringUtil.isNumeric("1234567890") =
* true StringUtil.isNumeric("12 3") = false StringUtil.isNumeric("ab2c") =
* false StringUtil.isNumeric("12-3") = false StringUtil.isNumeric("12.3") =
* false
*/
// 是否为数字
public static boolean isNumeric(String str) {
if (str == null || str.length() == 0) {
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++) {
if (Character.isDigit(str.charAt(i)) == false) {
return false;
}
}
return true;
}
// 分割字符串
public static String[] split(String src, String separator) {
if (src == null || separator == null) {
return null;
}
if (src.length() == 0 || separator.length() == 0) {
String[] s = {src};
return s;
}
java.util.Vector<String> v = new java.util.Vector<String>();
int start = 0, end = 0;
while ((end = src.indexOf(separator, start)) != -1) {
v.addElement(src.substring(start, end));
start = end + separator.length();
}
v.addElement(src.substring(start));
int ilen = v.size();
if (ilen < 1) {
return null;
}
String[] arr = new String[ilen];
for (int i = 0; i < ilen; i++) {
arr[i] = v.elementAt(i).toString();
}
return arr;
}
// 获取url最后一节
public static String getLastPathComponent(String url) {
if (url == null)
return "";
return url.split("/")[url.split("/").length - 1];
}
// 是否是子字符串
public static boolean isSubString(String str, String subStr) {
return str.indexOf(subStr) != -1;
}
public static void appendString(StringBuffer buff, String str) {
if (isBlank(str))
str = "";
buff.append(str);
}
// 字符串拼接
public static String appendString(String str1, String str2) {
if (isBlank(str1))
str1 = "";
StringBuffer strBuf = new StringBuffer(str1);
appendString(strBuf, str2);
return strBuf.toString();
}
public static boolean isNotBlank(Object object) {
return !isBlank(object);
}
public static boolean isNull(Object object) {
return object == null;
}
public static boolean isNotNull(Object object) {
return !isNull(object);
}
public static boolean isBlank(Object object) {
if (isNull(object))
return true;
if (object instanceof JSONArray) {
JSONArray obj = (JSONArray) object;
if (obj.length() == 0)
return true;
}
if (object instanceof JSONObject) {
JSONObject obj = (JSONObject) object;
if (obj.length() == 0)
return true;
}
if (object instanceof List) {
List<?> obj = (List<?>) object;
if (obj.size() == 0)
return true;
}
if (object instanceof Map) {
Map<?, ?> obj = (Map<?, ?>) object;
if (obj.size() == 0)
return true;
}
return isNull(object);
}
public static SpannableString formatText(int left, int right) {
String num = left + "/" + right;
SpannableString ssb = new SpannableString(num);
int index = num.indexOf("/");
ssb.setSpan(new AbsoluteSizeSpan(40, true), 0, index,
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
ssb.setSpan(new ForegroundColorSpan(Color.parseColor("#ff7800")), 0,
index, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
ssb.setSpan(new AbsoluteSizeSpan(18, true), index, num.length(),
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
ssb.setSpan(new ForegroundColorSpan(Color.parseColor("#fefefe")),
index, num.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
return ssb;
}
/**
* 判断edittext是否null
*/
public static String checkEditText(EditText editText) {
if (editText != null && editText.getText() != null
&& !(editText.getText().toString().trim().equals(""))) {
return editText.getText().toString().trim();
} else {
return "";
}
}
/**
* 获取arrays的string拼接
*/
public static String ArraysToString(int[] array) {
if (array == null) {
return "null";
}
if (array.length == 0) {
return "";
}
StringBuilder sb = new StringBuilder(array.length * 6);
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
sb.append(array[i]);
}
return sb.toString();
}
public static boolean isNumber(String str) {
Boolean isNumber = str.matches("-?[0-9]+.*[0-9]*");
return isNumber;
}
public static void printSerialString(byte[] bytes, int size) {
StringBuffer stringBuffer = new StringBuffer();//by holy
stringBuffer.append("datatostring:::: ");//by holy
for (int counts = 0; counts < size; counts++) {//by holy
stringBuffer.append(String.format("%02x", bytes[counts]));//by holy
stringBuffer.append(" ");//by holy
}//by holy
// MyLogUtil.i("printSerialString", stringBuffer.toString());//by holy
}
public static byte getHexByteFrom10(int i) {
byte b=(byte) Integer.parseInt(Integer.toHexString(i), 16);
// MyLogUtil.i("testbyte::::", String.format("%02x", b));
return b;
}
public static String fmtPrice(double price) {
DecimalFormat df = new DecimalFormat("0.00");
return df.format(price);
}
}
| [
"[email protected]"
]
| |
85121d9b65e9db305361fa602753c3e9a93fb528 | 0719b19b21ed009e564ecb52c660ade5c72e83ce | /foodordering_wear/src/main/java/com/example/foodordering_wear/Url.java | 4567d771735e19faeabd6eefd69b9df0cb2b8d5c | []
| no_license | ashishpokhrel123/android | c2cacafb6518f8648c28b3e029c2a7396aacf74e | 6f891046afcfe200b85cc5362a566ba8fe408269 | refs/heads/master | 2021-03-15T14:46:08.035978 | 2020-02-23T13:42:14 | 2020-02-23T13:42:14 | 246,858,321 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package com.example.foodordering_wear;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class Url {
//public static final String BASE_URL= "http://192.168.137.19:3002/";
//public static final String BASE_URL = "http://192.168.43.228:3002/";
//public static final String BASE_URL ="http://172.26.1.91:3002/";
public static final String BASE_URL ="http:/192.168.0.118:3002/";
//public static final String BASE_URL ="http://192.168.0.122:3002/";
//public static final String BASE_URL="http://192.168.43.228:3002/";
public static String token = "Bearer ";
public static String imagePath = BASE_URL + "uploads/";
public static Retrofit getInstance() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
return retrofit;
}
}
| [
"[email protected]"
]
| |
d38f93c78772f0fdbc3d38aca36336fc088ab4d1 | e64ff2176a2a405d7dbf0d1f7785f98621aedf2c | /src/main/java/com/imbookings/model/SiteUser.java | 4531a613a8c8cec91ec1d76294b0d01c00d0039c | []
| no_license | r1ptr92/imlearnings | 3b03f12834519a2f45e9b76ecdb398809a5f397a | 457afe7ee2da44908c90f1c5bef1bdcc901e1f7f | refs/heads/master | 2021-01-03T17:59:18.649420 | 2020-02-13T05:07:21 | 2020-02-13T05:07:21 | 240,181,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package com.imbookings.model;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class SiteUser {
@Id
@GeneratedValue
private Long id;
@Column(unique = true)
private String name;
private String password;
private boolean enabled;
@OneToMany(cascade = CascadeType.ALL)
private Set<Image> imageList;
public SiteUser(){}
public SiteUser(String name, String password, boolean enabled) {
this.name = name;
this.password = password;
this.enabled = enabled;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public Set<Image> getImageList() {
return imageList;
}
public void setImageList(Set<Image> imageList) {
this.imageList = imageList;
}
}
| [
"[email protected]"
]
| |
33b9371582887d319bcce9eaee36612470345ef5 | bdb65e3fb4b707df8764d2bd66d5092a70a728bd | /demo-spring-boot/src/main/java/com/example/demo/executor/ExecutorTest.java | 80537b5ad32d37037c2f451091f1e410603593c5 | []
| no_license | onsingledog/springCloudStudy | 4400d57d2ec9c7547b5e161fe0f64ed31ef7e979 | c78c024114f3a47e8e43165e8efaa8d7fca89b97 | refs/heads/master | 2020-03-17T05:41:31.619521 | 2018-09-13T09:47:07 | 2018-09-13T09:47:07 | 133,325,603 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,862 | java | package com.example.demo.executor;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
* 多线程,线程池测试类
* Created by Administrator on 2018/5/23.
*/
public class ExecutorTest {
public static void main(String[] args) throws Exception {
long start = System.currentTimeMillis();
System.out.println("-----主程序开始");
int taskSize = 5;
//创建包含5个线程的线程池
ExecutorService pool = Executors.newFixedThreadPool(taskSize);
List<Future> futures = new ArrayList<>();
for (int i = 0; i < taskSize; i++) {
Callable callable = new MyCallable(i);
//执行任务并获得future返回对象
Future future = pool.submit(callable);
futures.add(future);
}
for (Future future : futures) {
System.out.println("-----"+future.get().toString());
}
//关闭线程池
pool.shutdown();
long end = System.currentTimeMillis();
System.out.println("-----主程序运行结束,执行时间【"+(end - start)+"】毫秒。");
}
}
class MyCallable implements Callable<Object>{
private Integer taskNum;
MyCallable(Integer taskNum){
this.taskNum = taskNum;
}
@Override
public Object call() throws Exception {
System.out.println(">>>"+this.taskNum+"线程启动");
Long start = System.currentTimeMillis();
Thread.sleep(10000);
Long end = System.currentTimeMillis();
System.out.println(">>>"+this.taskNum+"线程结束");
return this.taskNum + "线程返回结果,任务执行时间【"+(end - start)+"】毫秒。";
}
}
| [
"[email protected]"
]
| |
1b135a8ca454cb14372d261263648839d4d85bb9 | 98af468e35e6c1f18782b6fef725169fbe2c2a79 | /MiscJava/src/coursera_algorithms/allClasses/stdlib/In.java | 36a7f5c30e10140388a6b2e41ca2cabdae892bea | []
| no_license | constantinpopa10/youtube.demo | 53af8c8e6c1eb7bec98dde7bffd9ebaef8f2b348 | 75b4fa96d88a3f8499bf261f652fa7429423d582 | refs/heads/master | 2021-01-20T12:15:22.167675 | 2014-08-11T21:42:43 | 2014-08-11T21:42:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,606 | java | package coursera_algorithms.allClasses.stdlib;
/*************************************************************************
* Compilation: javac In.java
* Execution: java In (basic test --- see source for required files)
*
* Reads in data of various types from standard input, files, and URLs.
*
*************************************************************************/
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.HttpURLConnection;
import java.net.URLConnection;
import java.util.Scanner;
import java.util.regex.Pattern;
/**
* <i>Input</i>. This class provides methods for reading strings
* and numbers from standard input, file input, URLs, and sockets.
* <p>
* The Locale used is: language = English, country = US. This is consistent
* with the formatting conventions with Java floating-point literals,
* command-line arguments (via {@link Double#parseDouble(String)})
* and standard output.
* <p>
* For additional documentation, see
* <a href="http://introcs.cs.princeton.edu/31datatype">Section 3.1</a> of
* <i>Introduction to Programming in Java: An Interdisciplinary Approach</i>
* by Robert Sedgewick and Kevin Wayne.
* <p>
* Like {@link Scanner}, reading a token also consumes preceding Java
* whitespace, reading a full line consumes
* the following end-of-line delimeter, while reading a character consumes
* nothing extra.
* <p>
* Whitespace is defined in {@link Character#isWhitespace(char)}. Newlines
* consist of \n, \r, \r\n, and Unicode hex code points 0x2028, 0x2029, 0x0085;
* see <tt><a href="http://www.docjar.com/html/api/java/util/Scanner.java.html">
* Scanner.java</a></tt> (NB: Java 6u23 and earlier uses only \r, \r, \r\n).
*
* @author David Pritchard
* @author Robert Sedgewick
* @author Kevin Wayne
*/
public final class In {
private Scanner scanner;
/*** begin: section (1 of 2) of code duplicated from In to StdIn */
// assume Unicode UTF-8 encoding
private static final String charsetName = "UTF-8";
// assume language = English, country = US for consistency with System.out.
private static final java.util.Locale usLocale =
new java.util.Locale("en", "US");
// the default token separator; we maintain the invariant that this value
// is held by the scanner's delimiter between calls
private static final Pattern WHITESPACE_PATTERN
= Pattern.compile("\\p{javaWhitespace}+");
// makes whitespace characters significant
private static final Pattern EMPTY_PATTERN
= Pattern.compile("");
// used to read the entire input. source:
// http://weblogs.java.net/blog/pat/archive/2004/10/stupid_scanner_1.html
private static final Pattern EVERYTHING_PATTERN
= Pattern.compile("\\A");
/*** end: section (1 of 2) of code duplicated from In to StdIn */
/**
* Create an input stream from standard input.
*/
public In() {
scanner = new Scanner(new BufferedInputStream(System.in), charsetName);
scanner.useLocale(usLocale);
}
/**
* Create an input stream from a socket.
*/
public In(java.net.Socket socket) {
try {
InputStream is = socket.getInputStream();
scanner = new Scanner(new BufferedInputStream(is), charsetName);
scanner.useLocale(usLocale);
}
catch (IOException ioe) {
System.err.println("Could not open " + socket);
}
}
/**
* Create an input stream from a URL.
*/
public In(URL url) {
try {
URLConnection site = url.openConnection();
InputStream is = site.getInputStream();
scanner = new Scanner(new BufferedInputStream(is), charsetName);
scanner.useLocale(usLocale);
}
catch (IOException ioe) {
System.err.println("Could not open " + url);
}
}
/**
* Create an input stream from a file.
*/
public In(File file) {
try {
scanner = new Scanner(file, charsetName);
scanner.useLocale(usLocale);
}
catch (IOException ioe) {
System.err.println("Could not open " + file);
}
}
/**
* Create an input stream from a filename or web page name.
*/
public In(String s) {
try {
// first try to read file from local file system
File file = new File(s);
if (file.exists()) {
scanner = new Scanner(file, charsetName);
scanner.useLocale(usLocale);
return;
}
// next try for files included in jar
URL url = getClass().getResource(s);
// or URL from web
if (url == null) { url = new URL(s); }
URLConnection site = url.openConnection();
// in order to set User-Agent, replace above line with these two
// HttpURLConnection site = (HttpURLConnection) url.openConnection();
// site.addRequestProperty("User-Agent", "Mozilla/4.76");
InputStream is = site.getInputStream();
scanner = new Scanner(new BufferedInputStream(is), charsetName);
scanner.useLocale(usLocale);
}
catch (IOException ioe) {
System.err.println("Could not open " + s);
}
}
/**
* Create an input stream from a given Scanner source; use with
* <tt>new Scanner(String)</tt> to read from a string.
* <p>
* Note that this does not create a defensive copy, so the
* scanner will be mutated as you read on.
*/
public In(Scanner scanner) {
this.scanner = scanner;
}
/**
* Does the input stream exist?
*/
public boolean exists() {
return scanner != null;
}
/*** begin: section (2 of 2) of code duplicated from In to StdIn,
* with all methods changed from "public" to "public static" ***/
/**
* Is the input empty (except possibly for whitespace)? Use this
* to know whether the next call to {@link #readString()},
* {@link #readDouble()}, etc will succeed.
*/
public boolean isEmpty() {
return !scanner.hasNext();
}
/**
* Does the input have a next line? Use this to know whether the
* next call to {@link #readLine()} will succeed. <p> Functionally
* equivalent to {@link #hasNextChar()}.
*/
public boolean hasNextLine() {
return scanner.hasNextLine();
}
/**
* Is the input empty (including whitespace)? Use this to know
* whether the next call to {@link #readChar()} will succeed. <p> Functionally
* equivalent to {@link #hasNextLine()}.
*/
public boolean hasNextChar() {
scanner.useDelimiter(EMPTY_PATTERN);
boolean result = scanner.hasNext();
scanner.useDelimiter(WHITESPACE_PATTERN);
return result;
}
/**
* Read and return the next line.
*/
public String readLine() {
String line;
try { line = scanner.nextLine(); }
catch (Exception e) { line = null; }
return line;
}
/**
* Read and return the next character.
*/
public char readChar() {
scanner.useDelimiter(EMPTY_PATTERN);
String ch = scanner.next();
assert (ch.length() == 1) : "Internal (Std)In.readChar() error!"
+ " Please contact the authors.";
scanner.useDelimiter(WHITESPACE_PATTERN);
return ch.charAt(0);
}
/**
* Read and return the remainder of the input as a string.
*/
public String readAll() {
if (!scanner.hasNextLine())
return "";
String result = scanner.useDelimiter(EVERYTHING_PATTERN).next();
// not that important to reset delimeter, since now scanner is empty
scanner.useDelimiter(WHITESPACE_PATTERN); // but let's do it anyway
return result;
}
/**
* Read and return the next string.
*/
public String readString() {
return scanner.next();
}
/**
* Read and return the next int.
*/
public int readInt() {
return scanner.nextInt();
}
/**
* Read and return the next double.
*/
public double readDouble() {
return scanner.nextDouble();
}
/**
* Read and return the next float.
*/
public float readFloat() {
return scanner.nextFloat();
}
/**
* Read and return the next long.
*/
public long readLong() {
return scanner.nextLong();
}
/**
* Read and return the next short.
*/
public short readShort() {
return scanner.nextShort();
}
/**
* Read and return the next byte.
*/
public byte readByte() {
return scanner.nextByte();
}
/**
* Read and return the next boolean, allowing case-insensitive
* "true" or "1" for true, and "false" or "0" for false.
*/
public boolean readBoolean() {
String s = readString();
if (s.equalsIgnoreCase("true")) return true;
if (s.equalsIgnoreCase("false")) return false;
if (s.equals("1")) return true;
if (s.equals("0")) return false;
throw new java.util.InputMismatchException();
}
/**
* Read all strings until the end of input is reached, and return them.
*/
public String[] readAllStrings() {
// we could use readAll.trim().split(), but that's not consistent
// since trim() uses characters 0x00..0x20 as whitespace
String[] tokens = WHITESPACE_PATTERN.split(readAll());
if (tokens.length == 0 || tokens[0].length() > 0)
return tokens;
String[] decapitokens = new String[tokens.length-1];
for (int i = 0; i < tokens.length-1; i++)
decapitokens[i] = tokens[i+1];
return decapitokens;
}
/**
* Read all ints until the end of input is reached, and return them.
*/
public int[] readAllInts() {
String[] fields = readAllStrings();
int[] vals = new int[fields.length];
for (int i = 0; i < fields.length; i++)
vals[i] = Integer.parseInt(fields[i]);
return vals;
}
/**
* Read all doubles until the end of input is reached, and return them.
*/
public double[] readAllDoubles() {
String[] fields = readAllStrings();
double[] vals = new double[fields.length];
for (int i = 0; i < fields.length; i++)
vals[i] = Double.parseDouble(fields[i]);
return vals;
}
/*** end: section (2 of 2) of code duplicated from In to StdIn */
/**
* Close the input stream.
*/
public void close() {
scanner.close();
}
/**
* Reads all ints from a file
* @deprecated Clearer to use
* <tt>new In(filename)</tt>.{@link #readAllInts()}
*/
public static int[] readInts(String filename) {
return new In(filename).readAllInts();
}
/**
* Reads all doubles from a file
* @deprecated Clearer to use
* <tt>new In(filename)</tt>.{@link #readAllDoubles()}
*/
public static double[] readDoubles(String filename) {
return new In(filename).readAllDoubles();
}
/**
* Reads all strings from a file
* @deprecated Clearer to use
* <tt>new In(filename)</tt>.{@link #readAllStrings()}
*/
public static String[] readStrings(String filename) {
return new In(filename).readAllStrings();
}
/**
* Reads all ints from stdin
* @deprecated Clearer to use {@link StdIn#readAllInts()}
*/
public static int[] readInts() {
return new In().readAllInts();
}
/**
* Reads all doubles from stdin
* @deprecated Clearer to use {@link StdIn#readAllDoubles()}
*/
public static double[] readDoubles() {
return new In().readAllDoubles();
}
/**
* Reads all strings from stdin
* @deprecated Clearer to use {@link StdIn#readAllStrings()}
*/
public static String[] readStrings() {
return new In().readAllStrings();
}
/**
* Test client.
*/
public static void main(String[] args) {
In in;
String urlName = "http://introcs.cs.princeton.edu/stdlib/InTest.txt";
// read from a URL
System.out.println("readAll() from URL " + urlName);
System.out.println("---------------------------------------------------------------------------");
try {
in = new In(urlName);
System.out.println(in.readAll());
}
catch (Exception e) { System.out.println(e); }
System.out.println();
// read one line at a time from URL
System.out.println("readLine() from URL " + urlName);
System.out.println("---------------------------------------------------------------------------");
try {
in = new In(urlName);
while (!in.isEmpty()) {
String s = in.readLine();
System.out.println(s);
}
}
catch (Exception e) { System.out.println(e); }
System.out.println();
// read one string at a time from URL
System.out.println("readString() from URL " + urlName);
System.out.println("---------------------------------------------------------------------------");
try {
in = new In(urlName);
while (!in.isEmpty()) {
String s = in.readString();
System.out.println(s);
}
}
catch (Exception e) { System.out.println(e); }
System.out.println();
// read one line at a time from file in current directory
System.out.println("readLine() from current directory");
System.out.println("---------------------------------------------------------------------------");
try {
in = new In("./InTest.txt");
while (!in.isEmpty()) {
String s = in.readLine();
System.out.println(s);
}
}
catch (Exception e) { System.out.println(e); }
System.out.println();
// read one line at a time from file using relative path
System.out.println("readLine() from relative path");
System.out.println("---------------------------------------------------------------------------");
try {
in = new In("../stdlib/InTest.txt");
while (!in.isEmpty()) {
String s = in.readLine();
System.out.println(s);
}
}
catch (Exception e) { System.out.println(e); }
System.out.println();
// read one char at a time
System.out.println("readChar() from file");
System.out.println("---------------------------------------------------------------------------");
try {
in = new In("InTest.txt");
while (!in.isEmpty()) {
char c = in.readChar();
System.out.print(c);
}
}
catch (Exception e) { System.out.println(e); }
System.out.println();
System.out.println();
// read one line at a time from absolute OS X / Linux path
System.out.println("readLine() from absolute OS X / Linux path");
System.out.println("---------------------------------------------------------------------------");
in = new In("/n/fs/introcs/www/java/stdlib/InTest.txt");
try {
while (!in.isEmpty()) {
String s = in.readLine();
System.out.println(s);
}
}
catch (Exception e) { System.out.println(e); }
System.out.println();
// read one line at a time from absolute Windows path
System.out.println("readLine() from absolute Windows path");
System.out.println("---------------------------------------------------------------------------");
try {
in = new In("G:\\www\\introcs\\stdlib\\InTest.txt");
while (!in.isEmpty()) {
String s = in.readLine();
System.out.println(s);
}
System.out.println();
}
catch (Exception e) { System.out.println(e); }
System.out.println();
}
}
| [
"[email protected]"
]
| |
2bf6c64f2cd09709fb8715800688ab8bb6d40ada | db12b990924703cd74748d8585cd9c11fafa6746 | /h2o-core/src/main/java/hex/segments/WorkAllocator.java | 5c4c30a8d51ac1133a45f9e3b8e221cdfb988536 | [
"Apache-2.0"
]
| permissive | h2oai/h2o-3 | 919019a8f297eec676011a9cfd2cc2d97891ce14 | d817ab90c8c47f6787604a0b9639b66234158228 | refs/heads/master | 2023-08-17T18:50:17.732191 | 2023-08-17T16:44:42 | 2023-08-17T16:44:42 | 17,371,412 | 6,872 | 2,345 | Apache-2.0 | 2023-09-14T18:05:40 | 2014-03-03T16:08:07 | Jupyter Notebook | UTF-8 | Java | false | false | 512 | java | package hex.segments;
import water.DKV;
import water.Iced;
import water.Key;
import water.util.IcedLong;
class WorkAllocator extends Iced<WorkAllocator> {
private final Key _counter_key;
private final long _max_work;
WorkAllocator(Key counterKey, long maxWork) {
_counter_key = counterKey;
_max_work = maxWork;
DKV.put(_counter_key, new IcedLong(-1));
}
long getNextWorkItem() {
return IcedLong.incrementAndGet(_counter_key);
}
long getMaxWork() {
return _max_work;
}
}
| [
"[email protected]"
]
| |
46d36f224f3170cd63d7a1e7fd811ba88c5ecd55 | 6bf2cbc0295dc1b57e059737914a31adf7c457a4 | /app/src/main/java/com/app/onebuy/login/countrychoose/CountryListBean.java | 6c31905a1d878ac6b518b6c0e498a4eb7473df9f | []
| no_license | 496907049/OneBuy | a1c39e042aa3c842b6352ab7f214790803e3e57f | be82125df139dfe6db4714e24b6e5edc108c6009 | refs/heads/master | 2020-03-22T02:59:39.381684 | 2018-07-02T07:25:28 | 2018-07-02T07:25:28 | 139,401,070 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 542 | java | package com.app.onebuy.login.countrychoose;
import com.app.onebuy.bean.BasisBean;
import java.util.ArrayList;
public class CountryListBean extends BasisBean {
// public static final String nameSpace =
// Constans.SERVICE_URL+"SearchCity.jws";
// public static final String soapAction =nameSpace+methodName;
private ArrayList<CountryListDate> list = new ArrayList<CountryListDate>();
public ArrayList<CountryListDate> getList() {
return list;
}
public void setList(ArrayList<CountryListDate> list) {
this.list = list;
}
}
| [
"[email protected]"
]
| |
db0cd0e5144f725ea503d0b6baf92e4bef0492f2 | c6c357e517b99af329f33d1a2b59625e494d7dbd | /src/main/java/com/huayu/platform/session/AbstractSession.java | e69462866188086f1be9b2725b5a25928c539ef9 | []
| no_license | xiezonghua/digxy-web | 7811886bdbf036acb730fe49f351d7dcb6941dfe | 53ff0cb095e61aff6f91f12162ce537acbffb037 | refs/heads/master | 2021-01-17T10:16:52.608041 | 2016-03-21T13:26:06 | 2016-03-21T13:26:06 | 34,315,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package com.huayu.platform.session;
import java.io.Serializable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractSession implements Session, Serializable {
private static final long serialVersionUID = 4901401585131620726L;
private static final String MY_SESSION_ID = "MYDegSESSIONID";
private static final Logger logger = LoggerFactory
.getLogger(AbstractSession.class);
}
| [
"[email protected]"
]
| |
ab7f4fb20f0eef0bd28a3d39f633f28d8e457606 | 071a9fa7cfee0d1bf784f6591cd8d07c6b2a2495 | /corpus/norm-class/sling/3986.java | 8eebcfb6e201f934cfc070a8d5f92b33f5b8c942 | [
"MIT"
]
| permissive | masud-technope/ACER-Replication-Package-ASE2017 | 41a7603117f01382e7e16f2f6ae899e6ff3ad6bb | cb7318a729eb1403004d451a164c851af2d81f7a | refs/heads/master | 2021-06-21T02:19:43.602864 | 2021-02-13T20:44:09 | 2021-02-13T20:44:09 | 187,748,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,111 | java | licensed apache software foundation asf contributor license agreements notice file distributed work additional copyright ownership asf licenses file apache license version license file compliance license copy license http apache org licenses license required applicable law agreed writing software distributed license distributed basis warranties conditions kind express implied license specific language governing permissions limitations license org apache sling discovery commons providers base java util concurrent locks lock org apache sling discovery commons providers view state manager viewstatemanager org apache sling discovery commons providers spi cluster sync service clustersyncservice create implementation classes type view state manager viewstatemanager idea leave implementation classes view state manager factory viewstatemanagerfactory view state manager viewstatemanager new view state manager newviewstatemanager lock lock cluster sync service clustersyncservice consistency service consistencyservice view state manager impl viewstatemanagerimpl lock consistency service consistencyservice | [
"[email protected]"
]
| |
0da2225c4a892823136320eecb5441e107da8163 | 2f2da35fb76443b2c5caae11c41cf36f87a7caef | /app/src/main/java/com/pum/voicememory/model/eFieldState.java | d2f1f01c7b9a9ba17858f3756e52efd19043c2da | []
| no_license | tomdepta/voice-memory | edf95fa315bbd8f14752751e95eebf5040d4e734 | 16190fa1fe6bdc753f1373754e0c9a9607e5d52e | refs/heads/master | 2021-06-11T06:25:51.108194 | 2017-02-10T19:01:14 | 2017-02-10T19:01:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | package com.pum.voicememory.model;
public enum eFieldState {
Pending,
Selected,
Finalized
}
| [
"[email protected]"
]
| |
ff4bfca8eef9d1bd32e2cf54e64491304ad0cb04 | f46f01648db353978156e831ee057c10e185df94 | /app/src/main/java/com/example/redfoxoptimaiii/farmaide/Jama/util/Maths.java | 6ad0fef75b61e390338eedfe6c4a6484b130abab | []
| no_license | xyrus23/FarmAide | b10112e6438fa435d47223d11b7fbde4d8334c61 | 07918c2f8b9660352c679987eee6e567a94867ec | refs/heads/master | 2021-01-11T22:51:16.297905 | 2017-06-12T15:20:40 | 2017-06-12T15:20:40 | 78,510,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package com.example.redfoxoptimaiii.farmaide.Jama.util;
public class Maths {
/**
* sqrt(a^2 + b^2) without under/overflow.
**/
public static double hypot(double a, double b) {
double r;
if (Math.abs(a) > Math.abs(b)) {
r = b / a;
r = Math.abs(a) * Math.sqrt(1 + r * r);
} else if (b != 0) {
r = a / b;
r = Math.abs(b) * Math.sqrt(1 + r * r);
} else {
r = 0.0;
}
return r;
}
}
| [
"[email protected]"
]
| |
2fbe4ddba0d68449551d9c448b5acdfc3dcdbdc0 | 4b4a69df96f05f5f38ad365109c10fa559500bc6 | /jsmpp/src/main/java/org/jsmpp/session/OutbindParameter.java | 06437aba4b52b0bfbca585c3b3cdf630474fb774 | [
"Apache-2.0"
]
| permissive | vivekanandasofware/jsmpp | 85d248fafd2d7991a2b1a2964e72856540ebe115 | ec178a71e4e3c7aa5def59461cfe289d5bf73985 | refs/heads/master | 2023-08-16T21:12:24.653316 | 2023-01-19T07:50:38 | 2023-01-19T07:50:38 | 399,458,603 | 0 | 0 | Apache-2.0 | 2023-08-10T06:08:04 | 2021-08-24T12:35:04 | Java | UTF-8 | Java | false | false | 2,430 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.jsmpp.session;
import java.util.Objects;
import org.jsmpp.bean.InterfaceVersion;
/**
* This class is wraps all outbind parameter that will be send as PDU.
*
* @author pmoerenhout
*/
public class OutbindParameter {
private String systemId;
private String password;
private InterfaceVersion interfaceVersion;
/**
* Construct with all mandatory parameters.
*
* @param systemId is the system id.
* @param password is the password.
*/
public OutbindParameter(String systemId,
String password) {
this(systemId, password, InterfaceVersion.IF_34);
}
/**
* Construct with all mandatory parameters.
*
* @param systemId is the system id
* @param password is the password.
* @param interfaceVersion is the interface version
*/
public OutbindParameter(String systemId,
String password,
InterfaceVersion interfaceVersion) {
this.systemId = systemId;
this.password = password;
this.interfaceVersion = interfaceVersion;
}
public String getSystemId() {
return this.systemId;
}
public String getPassword() {
return this.password;
}
public InterfaceVersion getInterfaceVersion() {
return this.interfaceVersion;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final OutbindParameter that = (OutbindParameter) o;
return Objects.equals(systemId, that.systemId) &&
Objects.equals(password, that.password) &&
interfaceVersion == that.interfaceVersion;
}
@Override
public int hashCode() {
return Objects.hash(systemId, password, interfaceVersion);
}
}
| [
"[email protected]"
]
| |
62add944df5ea52935c89cb74eb4c073fd9e692f | 0938094fc7691dcc826281ff6accbd4cdaea5184 | /src/test/java/com/xd/geekbang/datastructure/queue/CircularQueueBasedOnArrayTest.java | 4b07763108adeaeaf0de84446f43394ce7d833c8 | []
| no_license | xudai3/geekbang | bcf6904faa40ec35ba3718e89e8c2bade6087fc6 | 03109b3c1ffe0c05bb50041d4c020407094ac16a | refs/heads/master | 2023-03-13T10:32:26.087367 | 2021-03-01T12:24:55 | 2021-03-01T12:24:55 | 266,092,642 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 807 | java | package com.xd.geekbang.datastructure.queue;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class CircularQueueBasedOnArrayTest {
@Test
void enqueue() {
CircularQueueBasedOnArray<String> queue = new CircularQueueBasedOnArray<>(3);
assertEquals(true, queue.enqueue("a"));
assertEquals(true, queue.enqueue("b"));
assertEquals(true, queue.enqueue("c"));
assertEquals(false, queue.enqueue("d"));
assertEquals("a", queue.dequeue());
assertEquals(true, queue.enqueue("d"));
assertEquals("b", queue.dequeue());
assertEquals("c", queue.dequeue());
assertEquals("d", queue.dequeue());
assertEquals(null, queue.dequeue());
}
@Test
void dequeue() {
}
} | [
"[email protected]"
]
| |
4a2dda9e6ced200fef07d7a173c852a0bf0fc602 | 930c106bc0417fbc6593369bf82d19dfed57f562 | /src/util/Params.java | bfd1e388f0f68a69ce381c13e43e63efe9d280ec | []
| no_license | eliranrefael/Mario | d048aeddd3432dbfed4731286481b63a8e55ba84 | 8daf0ff227ba235b0b9a5d85d74147de15411a79 | refs/heads/main | 2023-08-13T22:13:26.372974 | 2021-09-29T09:00:57 | 2021-09-29T09:00:57 | 409,860,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 946 | java | package util;
public interface Params {
//WIDTHS AND HEIGHTS
int WIDTH=600;
int HEIGHT=600;
int GROUND_HEIGHT =100 ;
int GROUND_WIDTH = 100;
//LOCATIONS
double SCORE_LOCATIONX = WIDTH/15;
double SCORE_LOCATIONY = HEIGHT/15;
int CHARACTER_POS = HEIGHT-GROUND_HEIGHT-75;
int STAR_POS = HEIGHT-GROUND_HEIGHT-50;
//SPACES AND LENGTHS
int CLOUDS_SPACE=110;
int CLOUDS_SPACEX=250;
int STAR_SPACE=110;
int JUMP =200 ;
int CLOUDS_SPACEY = 100;
int RAMP_MAX_WIDTH = 4;
int STAR_SPACEY = 250;
double STAR_SPACEX = 220;
//QUANTITIES
int CLOUDS_NUM = 6;
int RAMPS_NUM = 6;
int STAR_NUM = 6;
public enum LEVEL{
LEVEL_ONE(1.5),
LEVEL_TWO(2),
LEVEL_THREE(3),
LEVEL_FOUR(3.5),
LEVEL_FIVE(4);
public final double value;
LEVEL(final double newvalue){
value=newvalue;
}
}
}
| [
"[email protected]"
]
| |
cb8bf140005735253f3240050707af8ee2369f49 | 0de79f44be29644adf6e2e909565894d0e5199ad | /Tag2_01Vererbung/src/main/java/de/limago/jpademo/models/BaseEntity.java | 3c0b0381b2819a2a584a6aab4a7ce053c6315c3e | []
| no_license | LimagoHub/BootCamp2 | 3e286693fd3b8eb3248f1356be0ffec1afb58e88 | 6330a4ea49915b9ee4b399ff6e6382f6665b94f8 | refs/heads/master | 2022-12-18T19:38:03.227402 | 2020-09-25T08:04:42 | 2020-09-25T08:04:42 | 295,324,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,471 | java | package de.limago.jpademo.models;
import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;
@MappedSuperclass
public class BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Temporal(TemporalType.TIMESTAMP)
private Date createDate;
@Version
@Temporal(TemporalType.TIMESTAMP)
private Date updateDate;
public BaseEntity() {
id = 0;
createDate = updateDate = null;
}
@PrePersist
public void prePersist() {
createDate = updateDate = new Date();
}
@PreUpdate
public void onUpdate() {
updateDate = new Date();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
@Override
public String toString() {
return "BaseEntity [id=" + id + ", createDate=" + createDate + ", updateDate=" + updateDate + "]";
}
}
| [
"[email protected]"
]
| |
903273ea31db97e8da1220b4f18703faec2c5f6e | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/6/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunction_derivative_158.java | 12751ae1b22ed670a3c87157dd7e75a6d143557b | []
| no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 1,437 | java |
org apach common math3 analysi polynomi
repres polynomi spline function
strong polynomi spline function strong consist set
interpol polynomi ascend arrai domain
knot point determin interv spline function
defin constitu polynomi polynomi assum
comput match valu function knot
point consist constraint enforc
code polynomi spline function polynomialsplinefunct code assum hold
polynomi knot point pass constructor
polynomi code polynomi code properti
center knot point comput spline function valu
domain polynomi spline function
code smallest knot largest knot code attempt evalu
function valu rang gener illeg argument except illegalargumentexcept
polynomi spline function argument code code
comput
knot arrai search find segment code code
belong code code smallest knot point greater
largest code illeg argument except illegalargumentexcept code
thrown
code code index largest knot point
equal code code return
code polynomi knot code
version
polynomi spline function polynomialsplinefunct univari differenti function univariatedifferentiablefunct differenti univari function differentiableunivariatefunct
deriv polynomi spline function
deriv function
univari function univariatefunct deriv
polynomi spline deriv polynomialsplinederiv
| [
"[email protected]"
]
| |
8eeedc9ecf93f73672b7054ee20a1afd578aec70 | 435bd7d2825fe3fc7c9e7ccada374f3015f578dc | /src/protocol/Intent.java | 0ca132eb8ec0465ddf79fdc2398da3f6dca91e57 | []
| no_license | 15608447849/P2PInet | c6e60528366e7e2b4ed8474fd8a770d3298d8e0f | 5113258649405125ba298fa9be628b5ceb311ccc | refs/heads/master | 2021-01-24T08:10:50.200850 | 2017-06-16T12:36:30 | 2017-06-16T12:36:30 | 93,378,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,656 | java | package protocol;
import client.socketimp.SocketManager;
import server.abs.IOperate;
import server.obj.CLI;
import server.obj.IParameter;
import java.nio.channels.AsynchronousSocketChannel;
import java.util.HashMap;
/**
* Created by user on 2017/6/1.
* 数据传递
*/
public class Intent {
private byte command;
private HashMap<String,Object> map;
private IOperate operate;
private IParameter param;
private CLI serverCli;
public Intent(){}
public Intent(IOperate operate) {
putOperate(operate);
}
public Intent(IOperate operate, IParameter param) {
putOperate(operate);
putIparam(param);
}
public void putIparam(IParameter param){
this.param = param;
}
public IParameter getIparam(){
return param;
}
public void putMap(HashMap<String,Object> map) {
this.map = map;
}
public void putOperate(IOperate operate) {
this.operate = operate;
}
public void putCLI(CLI serverCli) {
this.serverCli= serverCli;
}
public HashMap<String,Object> getMap() {
return map;
}
public CLI getServerCLI() {
return serverCli;
}
public IOperate getOperate() {
return operate;
}
public void putCommand(byte command) {
this.command = command;
}
public byte getCommand() {
return command;
}
private SocketManager socketManager;
public SocketManager getSourceManager() {
return socketManager;
}
public void putSocketManager(SocketManager socketManager) {
this.socketManager = socketManager;
}
}
| [
"[email protected]"
]
| |
b1874ac417b374e2bf828359d497ef97ac15cd3b | c07204f38ae06a60c9929665dd88634337f7b9cb | /maas_hesaplama/personel.java | ef0f0772f2e7f9b2991b63a66ffee247f72b79c1 | []
| no_license | Beyzacbn/Nesneye_Yonelik_Programlama | 648109c8cc3d5a6036604b573b6070b63a109bdd | 95eb5d4e99e2fdc7646ba65e94969653e2808cd8 | refs/heads/master | 2020-04-30T10:17:34.788892 | 2019-03-20T18:06:00 | 2019-03-20T18:06:00 | 176,773,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,341 | java | public class Personel
{
protected String ad;
protected String soyad;
protected String sskNo;
protected double satis; // aylık satış sayısı
protected double komisyon; // ürün başına komisyon
public Personel(String ad, String soyad, String sskNo , double satis, double komisyon)
{
this.ad=ad;
this.soyad=soyad;
this.sskNo=sskNo;
this.komisyon=komisyon;
this.satis=satis;
setSatis(satis);
setKomisyon(komisyon);
}
public double maasHesapla()
{
return satis*komisyon;
}
@Override
public String toString() // overrride
{
return "Personel\t:"+ad+"\t"+soyad+"\t"+komisyon ;
}
public String getAd() {
return ad;
}
public void setAd(String ad) {
this.ad = ad;
}
public String getSoyad() {
return soyad;
}
public void setSoyad(String soyad) {
this.soyad = soyad;
}
public String getSskNo() {
return sskNo;
}
public void setSskNo(String sskNo) {
this.sskNo = sskNo;
}
public double getSatis() {
return satis;
}
public void setSatis(double satis) {
if (satis>=0)
this.satis = satis;
else
System.out.println("satis>=0 olmalı");
}
public double getKomisyon() {
return komisyon;
}
public void setKomisyon(double komisyon) {
if(komisyon>=0.0 && komisyon<1.0)
this.komisyon = komisyon;
else
System.out.println("0<komisyon<1 olmalı");
}
| [
"[email protected]"
]
| |
b662311db4daaf2f0b7317f2668d6683ef8aeedc | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/27/27_93f425d9bc80b63fcf57a06b126cb94317dd9029/WinJustificacion/27_93f425d9bc80b63fcf57a06b126cb94317dd9029_WinJustificacion_t.java | 5535f275472018027950fb7b4f90dab581709bf9 | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 30,804 | java |
package Gui;
import Appi.JExcel;
import Dao.EmpleadoDAO;
import Javabeans.Empleado;
import Dao.justificacionesDAO;
import Dao.RegistroDAO;
import Javabeans.Registro;
import javax.swing.table.DefaultTableModel;
import Utilitarios.Query;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import Utilitarios.Helpers;
import Utilitarios.Validators;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import javax.swing.JOptionPane;
import Utilitarios.Data;
import Appi.TimeOPeration;
import java.io.File;
import java.sql.Time;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;
public class WinJustificacion extends javax.swing.JInternalFrame {
private Query qs;
private Empleado empleado;
private justificacionesDAO objjusti;
private DateFormat format;
private Validators val;
private Data dt;
private Helpers hp;
private Date date;
private Date date2;
private Calendar calendar;
private GregorianCalendar calendar2;
private JExcel xls;
private TimeOPeration tm;
private String _error = "Gui_WinJustificacion_";
private RegistroDAO reg;
public WinJustificacion() {
initComponents();
cargaForm();
}
public final void cargaForm(){
try{
format=new SimpleDateFormat("dd-MM-yyyy");
cboDia.setDateFormat(format);
cboIni.setDateFormat(format);
cboFin.setDateFormat(format);
qs=new Query();
qs.loadChoice(cboTipojus,"tipo_justificaciones","nombre");
Lblidemp.setVisible(false);
jLabel5.setVisible(false);
}
catch(Exception e) {
System.out.println("Gui_Asistencia"+ e);
}
}
public void cleanBox(){
lblID.setText("");
lblNomape.setText("");
Calendar rightNow = Calendar.getInstance();
Lblarea.setText("");
lblcargo.setText("");
cboDia.setSelectedDate(rightNow);
}
public void cleanForm() {
TxtNum.setText("");
Txtaobservacion.setText("");
}
public void cargarLog() {
try {
reg = new RegistroDAO();
hp = new Helpers();
String fecha=hp.getFormatDate(cboDia.getText());
if (!"".equals(lblID.getText())) {
reg.findRegFecha(lblID.getText(),fecha, fecha, JtblLog, jLabel5);
} else {
JOptionPane.showMessageDialog(null,"Seleccione un empleado para consultar");
}
} catch(Exception e) {
System.out.println(_error + "cargaLog: " + e);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel5 = new javax.swing.JPanel();
cboTipojus = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
TxtNum = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
Txtaobservacion = new javax.swing.JTextArea();
cboDia = new datechooser.beans.DateChooserCombo();
TimSalida = new com.lavantech.gui.comp.TimePanel();
TimIngreso = new com.lavantech.gui.comp.TimePanel();
jPanel3 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
JtblLog = new javax.swing.JTable();
BtnVer = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
TblJusti = new javax.swing.JTable();
jPanel10 = new javax.swing.JPanel();
cboIni = new datechooser.beans.DateChooserCombo();
cboFin = new datechooser.beans.DateChooserCombo();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
btnDateSearch = new javax.swing.JButton();
jLabel16 = new javax.swing.JLabel();
lblcant = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
mfile = new javax.swing.JMenu();
mitemregister = new javax.swing.JMenuItem();
mitemdelete = new javax.swing.JMenuItem();
medit = new javax.swing.JMenu();
mitemclear = new javax.swing.JMenuItem();
ItemExportar = new javax.swing.JMenuItem();
mclose = new javax.swing.JMenu();
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel5.add(cboTipojus, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 10, 230, -1));
jLabel2.setText("Tipo ");
jPanel5.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 12, -1, -1));
jLabel7.setText("Fecha");
jPanel5.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));
jPanel5.add(TxtNum, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 110, 230, -1));
jLabel13.setText("Recibo");
jPanel5.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, -1, -1));
jLabel10.setText("Motivo");
jPanel5.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 200, -1, -1));
jLabel12.setText("Ingreso");
jPanel5.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 290, -1, -1));
jLabel11.setText("Salida");
jPanel5.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 300, -1, -1));
Txtaobservacion.setColumns(20);
Txtaobservacion.setRows(5);
jScrollPane3.setViewportView(Txtaobservacion);
jPanel5.add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 170, 590, -1));
jPanel5.add(cboDia, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 60, 230, -1));
TimSalida.setDisplayAnalog(false);
TimSalida.setSecDisplayed(false);
jPanel5.add(TimSalida, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 270, -1, 70));
TimIngreso.setDisplayAnalog(false);
TimIngreso.setSecDisplayed(false);
jPanel5.add(TimIngreso, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 260, -1, 70));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Log de asistencia"));
JtblLog.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jScrollPane1.setViewportView(JtblLog);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 254, Short.MAX_VALUE)
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel5.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 10, 290, 140));
BtnVer.setText("Ver");
BtnVer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtnVerActionPerformed(evt);
}
});
jPanel5.add(BtnVer, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 60, -1, -1));
jPanel5.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 140, -1, -1));
jTabbedPane1.addTab("Registro", jPanel5);
TblJusti.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
}
));
jScrollPane2.setViewportView(TblJusti);
jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Rango de busqueda"));
jLabel14.setText("Fecha inicial");
jLabel15.setText("Fecha final ");
btnDateSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Utilitarios/Img/consulta.png"))); // NOI18N
btnDateSearch.setText("Buscar");
btnDateSearch.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
btnDateSearchjButton5MouseClicked(evt);
}
});
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel10Layout.createSequentialGroup()
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cboFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel10Layout.createSequentialGroup()
.addComponent(jLabel14)
.addGap(18, 18, 18)
.addComponent(cboIni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(38, 38, 38)
.addComponent(btnDateSearch)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel10Layout.createSequentialGroup()
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(cboIni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(cboFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15))
.addGap(0, 8, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
.addContainerGap(20, Short.MAX_VALUE)
.addComponent(btnDateSearch)
.addGap(20, 20, 20))
);
jLabel16.setText("Total: ");
lblcant.setBorder(javax.swing.BorderFactory.createEtchedBorder());
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 678, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel16)
.addGap(17, 17, 17)
.addComponent(lblcant, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel16)
.addComponent(lblcant, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
jTabbedPane1.addTab("Ver", jPanel2);
getContentPane().add(jTabbedPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 160, 710, 400));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos"));
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setText("Trabajador");
jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));
jLabel3.setText("Area");
jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 100, -1, -1));
jLabel4.setText("Cargo");
jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 100, -1, -1));
lblcargo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jPanel1.add(lblcargo, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 100, 140, 30));
Lblarea.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jPanel1.add(Lblarea, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 100, 140, 30));
lblID.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jPanel1.add(lblID, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 20, 60, 30));
jLabel18.setText("ID");
jPanel1.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, -1, -1));
lblNomape.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jPanel1.add(lblNomape, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 60, 340, 30));
jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Utilitarios/Img/empleado.png"))); // NOI18N
jLabel17.setText("Buscar");
jLabel17.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel17MouseClicked(evt);
}
});
jPanel1.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 60, -1, -1));
jPanel1.add(Lblidemp, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 20, -1, -1));
lblFoto.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jPanel1.add(lblFoto, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 20, 110, 100));
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, 700, 140));
mfile.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Utilitarios/Img/Archivo.png"))); // NOI18N
mfile.setText("Archivo");
mitemregister.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
mitemregister.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Utilitarios/Img/registrar.png"))); // NOI18N
mitemregister.setText("Registrar");
mitemregister.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
mitemregisterMousePressed(evt);
}
});
mfile.add(mitemregister);
mitemdelete.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
mitemdelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Utilitarios/Img/eliminar.png"))); // NOI18N
mitemdelete.setText("Eliminar");
mitemdelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mitemdeleteActionPerformed(evt);
}
});
mfile.add(mitemdelete);
jMenuBar1.add(mfile);
medit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Utilitarios/Img/Editar.png"))); // NOI18N
medit.setText("Edit");
mitemclear.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
mitemclear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Utilitarios/Img/limpiar.png"))); // NOI18N
mitemclear.setText("Limpiar");
mitemclear.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mitemclearMouseClicked(evt);
}
});
medit.add(mitemclear);
ItemExportar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Utilitarios/Img/exportar.png"))); // NOI18N
ItemExportar.setText("Exportar");
ItemExportar.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
ItemExportarMousePressed(evt);
}
});
medit.add(ItemExportar);
jMenuBar1.add(medit);
mclose.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Utilitarios/Img/Cerrar.png"))); // NOI18N
mclose.setText("Cerrar");
mclose.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
mcloseMousePressed(evt);
}
});
mclose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mcloseActionPerformed(evt);
}
});
jMenuBar1.add(mclose);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>//GEN-END:initComponents
private void mcloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mcloseActionPerformed
this.setVisible(false);
Utilitarios.Config.OPENWINDOWS =0;
}//GEN-LAST:event_mcloseActionPerformed
private void mitemdeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mitemdeleteActionPerformed
int fsel;
fsel = this.TblJusti.getSelectedRow();
objjusti= new justificacionesDAO();
if (fsel == -1) {
//No se ha seleccionado registo en Jtable
} else{
DefaultTableModel m = new DefaultTableModel();
m = (DefaultTableModel) this.TblJusti.getModel();
String idempleado = String.valueOf(m.getValueAt(fsel, 0));
int i;
i= JOptionPane.showConfirmDialog(null,"¿Esta seguro de eliminar este registro?","Aviso",JOptionPane.OK_CANCEL_OPTION,JOptionPane.WARNING_MESSAGE);
if(i==0){
int id = Integer.valueOf(idempleado);
i = objjusti.delete(id);
if(i==0) {
JOptionPane.showMessageDialog(null,"No se pudo eliminar el registro de asistencia");
}
else {
JOptionPane.showMessageDialog(null,"Justificacion eliminada");
cleanBox();
}
}
}
}//GEN-LAST:event_mitemdeleteActionPerformed
private void mcloseMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mcloseMousePressed
this.setVisible(false);
Utilitarios.Config.OPENWINDOWS =0;
}//GEN-LAST:event_mcloseMousePressed
private void ItemExportarMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ItemExportarMousePressed
try {
JFileChooser Obj=new JFileChooser();
xls = new JExcel();
FileNameExtensionFilter filter = new FileNameExtensionFilter("Excel xls", "xls","xlsx");
Obj.setFileFilter(filter);
Obj.setDialogTitle("Guardar reporte");
int seleccion=Obj.showSaveDialog(TblJusti);
//Guardar
if(seleccion == JFileChooser.APPROVE_OPTION){
File fichero = Obj.getSelectedFile();
String filePath = fichero.getPath();
if(!filePath.toLowerCase().endsWith(".xls")){
fichero = new File(filePath + ".xls");
}
boolean Confirma;
if((fichero).exists()) {
if(JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(this,"El fichero existe,deseas reemplazarlo?","Reemplazar",JOptionPane.YES_NO_OPTION));{
Confirma=xls.ExportJtable(TblJusti, fichero, "Justificaciones");
}
}
else{
Confirma=xls.ExportJtable(TblJusti, fichero, "Justificaciones");
}
if(Confirma==true){
JOptionPane.showMessageDialog(null, "El documento se grabo exitosamente","Confirmacion",JOptionPane.INFORMATION_MESSAGE);
}
else{
JOptionPane.showMessageDialog(null, "No se pudo grabar el documento", "Confirmacion", JOptionPane.INFORMATION_MESSAGE);
}
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Ha ocurrido un error durante la exportacion del documento","Error",JOptionPane.ERROR_MESSAGE);
System.out.println(_error + "Exportar :"+e);
}
}//GEN-LAST:event_ItemExportarMousePressed
private void btnDateSearchjButton5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnDateSearchjButton5MouseClicked
if(!"".equals(lblID.getText())){
hp=new Helpers();
String inicio=hp.getFormatDate(cboIni.getText());
String fin=hp.getFormatDate(cboFin.getText());
//int id = Integer.parseInt(lblidEmp.getText() );
objjusti= new justificacionesDAO();
val=new Validators();
if(val.validarFechas(inicio, fin)){
objjusti.findJusti(lblID.getText() ,inicio, fin,TblJusti, lblcant);
}
else{
JOptionPane.showMessageDialog(null,"Conflicto de fechas");
}
} else {
JOptionPane.showMessageDialog(null,"Seleccione un empleado para poder ingresar sus asistencia");
}
}//GEN-LAST:event_btnDateSearchjButton5MouseClicked
private void mitemregisterMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mitemregisterMousePressed
if(!"".equals(lblID.getText())){
try{
int id = Integer.parseInt(lblID.getText());
val = new Validators();
dt = new Data();
tm = new TimeOPeration();
qs = new Query();
hp = new Helpers();
//Validacion propia del evento
objjusti = new justificacionesDAO();
SimpleDateFormat fhora = new SimpleDateFormat("HH:mm:ss");
Calendar ingreso = TimIngreso.getCalendar();
Calendar salida = TimSalida.getCalendar();
String motivo = Txtaobservacion.getText();
String recivo = TxtNum.getText();
Time ing = Time.valueOf(fhora.format(ingreso.getTime()));
Time sal = Time.valueOf(fhora.format(salida.getTime()));
//System.out.println("Resta de horas: "+sal + " - " +ing+" : "+tm.restarTime(ing,sal));
Time hrs = tm.restarTime(sal,ing);
String fecha=hp.getFormatDate(cboDia.getText());
int tipojus = Integer.parseInt(qs.idChoice("tipo_justificaciones","nombre",String.valueOf(cboTipojus.getSelectedItem())));
int i = objjusti.save(id,tipojus,fecha,motivo,recivo,hrs,ing,sal);
cleanForm();
if (i == 0 ) {
JOptionPane.showMessageDialog(null,"No se pudo grabar el detalle");
}
else {
JOptionPane.showMessageDialog(null,"justificacion grabada");
}
}
catch(Exception e){
System.out.println("Evento registrar: "+e);
}
} else {
JOptionPane.showMessageDialog(null,"Seleccione un empleado para poder ingresar su justificacion");
}
}//GEN-LAST:event_mitemregisterMousePressed
private void jLabel17MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel17MouseClicked
WinBuscarEmpleado objbus = new WinBuscarEmpleado();
//objbus.setTitle(titulo);
objbus.setResizable(true);
objbus.setMaximizable(true);
objbus.setIconifiable(true);
objbus.setClosable(true);
WinMdi.jdpContenedor.add(objbus);
objbus.LblModulo.setText("2");
objbus.setVisible(true);
}//GEN-LAST:event_jLabel17MouseClicked
private void mitemclearMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mitemclearMouseClicked
cleanBox();
}//GEN-LAST:event_mitemclearMouseClicked
private void BtnVerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnVerActionPerformed
cargarLog();
}//GEN-LAST:event_BtnVerActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton BtnVer;
private javax.swing.JMenuItem ItemExportar;
private javax.swing.JTable JtblLog;
public static final javax.swing.JLabel Lblarea = new javax.swing.JLabel();
public static final javax.swing.JLabel Lblidemp = new javax.swing.JLabel();
private javax.swing.JTable TblJusti;
private com.lavantech.gui.comp.TimePanel TimIngreso;
private com.lavantech.gui.comp.TimePanel TimSalida;
private javax.swing.JTextField TxtNum;
private javax.swing.JTextArea Txtaobservacion;
private javax.swing.JButton btnDateSearch;
private datechooser.beans.DateChooserCombo cboDia;
private datechooser.beans.DateChooserCombo cboFin;
private datechooser.beans.DateChooserCombo cboIni;
private javax.swing.JComboBox cboTipojus;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel7;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel5;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTabbedPane jTabbedPane1;
public static final javax.swing.JLabel lblFoto = new javax.swing.JLabel();
public static final javax.swing.JLabel lblID = new javax.swing.JLabel();
public static final javax.swing.JLabel lblNomape = new javax.swing.JLabel();
private javax.swing.JLabel lblcant;
public static final javax.swing.JLabel lblcargo = new javax.swing.JLabel();
private javax.swing.JMenu mclose;
private javax.swing.JMenu medit;
private javax.swing.JMenu mfile;
private javax.swing.JMenuItem mitemclear;
private javax.swing.JMenuItem mitemdelete;
private javax.swing.JMenuItem mitemregister;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
95f92e25e773750b1547fd8cea85076670f546f6 | b1a1463ebaccf134394784b23c2511eb19aae30c | /src/main/java/org/web3j/sample/AsyncTest.java | a27de6f67fc67d5e056a1667ed7155ec5138f4c1 | []
| no_license | WilliamLann/TryChain | 61e0bdb6d3a78369010c0017a6c80fb437f654d6 | 95c17cd0513d51711773251b5feea91f6edc2393 | refs/heads/master | 2020-03-19T00:59:14.528415 | 2018-05-31T02:16:11 | 2018-05-31T02:16:11 | 135,514,509 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package org.web3j.sample;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
public class AsyncTest {
public static void main(String[] args) throws InterruptedException, ExecutionException {
CompletableFuture<String> completableFuture=new CompletableFuture();
new Thread(new Runnable() {
@Override
public void run() {
//模拟执行耗时任务
System.out.println("task doing...");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
//告诉completableFuture任务已经完成
completableFuture.complete("result");
}
}).start();
//获取任务结果,如果没有完成会一直阻塞等待
String result=completableFuture.get();
System.out.println("计算结果:"+result);
}
}
| [
"[email protected]"
]
| |
2da546dbaccb28612abf3345b8fdf5d813f85646 | b33ac321f18a5bf7b9fe117687c6eb6f26e5bc7f | /final/jobmatch/jobmatch/data/MailQueueBDO.java | 7b25de1915df5823192a110a7197b556bfa93c66 | []
| no_license | mlocher-sf/jobmatch | 046a2d481d6a75ec73a870c530a587bff28e21ec | 085f5f59a5c692ac165f47bfa7bf43814af7cedb | refs/heads/master | 2021-01-10T00:54:42.560726 | 2000-08-10T21:19:19 | 2000-08-10T21:19:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,240 | java | /*-----------------------------------------------------------------------------
* Enhydra Java Application Server
* Copyright 1997-2000 Lutris Technologies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes Enhydra software developed by Lutris
* Technologies, Inc. and its contributors.
* 4. Neither the name of Lutris Technologies nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY LUTRIS TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LUTRIS TECHNOLOGIES OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*-----------------------------------------------------------------------------
* /scratch/studer_repositry/dataTest/jobmatch/data/MailQueueBDO.java
*-----------------------------------------------------------------------------
*/
package jobmatch.data;
import java.sql.*;
import com.lutris.appserver.server.*;
import com.lutris.appserver.server.sql.*;
import com.lutris.dods.builder.generator.query.*;
/**
* MailQueueBDO contains the same set and get methods as
* the MailQueueDO class.
* Business Object (BO) classes typically need these set and get methods.
* So by deriving a BO from a BDO, or by implementing a BO that
* contains a BDO, the developer of the BO is spared some work.
*
* @author studer
* @version $Revision: 1.1 $
*/
public class MailQueueBDO implements java.io.Serializable {
/**
* The MailQueueDO object upon which the set and get methods operate.
* This member is protected so that classes derived from MailQueueBDO
* can access the underlying Data Object.
*/
protected MailQueueDO DO;
/**
* Note: This method is intended for use only by other BDO classes.
* Presentation Layer classes should (theoretically) always use the
* Business Layer (BDO) to create/access Data Layer (DO) objects.
* The overhead for using BDO objects is small
* (the BDO classes are fairly lightweight.)
*
* @return The DO object held by this BDO object.
*/
public MailQueueDO getDO() {
return DO;
}
/**
* Like the class <CODE>MailQueueDO</CODE>,
* this class acts as a factory.
* Business Object (BO) classes typically need these set and get methods.
* So by deriving a BO from a BDO, or by implementing a BO that
* contains one or more BDOs, the developer of the BO is spared some work.
*
* @exception Exception
* If an error occurs.
*/
public static MailQueueBDO createVirgin() throws Exception {
MailQueueBDO bdo = new MailQueueBDO ();
return bdo;
}
/**
* Constructor for use by classes derived from <CODE>MailQueueBDO</CODE>.
* Example usage:<CODE>
* class CustomerBO extends CustomerBDO {
* // a BDO class is commonly extended in order to implement:
* public void beforeAnySet() throws Exception {
* if ( CustomerDO should not be altered )
* throw new ApplicationException( "ERROR" );
* }
* public CustomerBO( CustomerDO DO ) {
* super( DO );
* }
* }
* class SomePresentationLayerClass {
* public CustomerBO findCustomer( String name ) {
* CustomerQuery q = new CustomerQuery();
* q.setQueryName( name );
* CustomerDO DO = q.getNextDO();
* // Here the CustomerBO ctor fires the CustomerBDO ctor.
* return new CustomerBO( DO );
* }
* }
* </CODE>
*/
public MailQueueBDO( MailQueueDO DO ) {
this.DO = DO;
}
/**
* Constructor required by <CODE>MailQueueBDO.create</CODE> methods.
*/
public MailQueueBDO() throws Exception {
this.DO = MailQueueDO.createVirgin();
}
/**
* The createExisting method is used to create a <CODE>MailQueueBDO</CODE>
* from a <CODE>MailQueueDO</CODE> that was returned by
* the <CODE>MailQueueQuery</CODE> class.
*/
public static MailQueueBDO createExisting( MailQueueDO DO ) {
MailQueueBDO bdo = new MailQueueBDO ( DO );
return bdo;
}
/**
* The getBDOarray method performs a database query to
* return an array of <CODE>MailQueueBDO</CODE> objects
* representing all the rows in the <CODE>MailQueue</CODE> table.
*
* This method is a minimal example of using a Query class.
* To restrict the set of objects returned, you could
* invoke <CODE>query.setXxx()</CODE>, where <CODE>Xxx</CODE>
* is an Attribute of <CODE>MailQueueDO</CODE> which was
* marked as "Can be queried" in the DODS Attribute Editor.
*
* @exception DataObjectException
* If an object is not found in the database.
*/
public static MailQueueBDO[] getBDOarray()
throws DataObjectException {
MailQueueDO[] DOarray = null;
try {
MailQueueQuery query = new MailQueueQuery();
// To restrict the set of objects returned,
// you could invoke query.setXxx(), where Xxx
// is an Attribute of <CODE>MailQueueDO</CODE> which was
// marked as "Can be queried" in the DODS Attribute Editor.
DOarray = query.getDOArray();
} catch ( NonUniqueQueryException e1 ) {
// MailQueueQuery will throw NonUniqueQueryException
// only if query.requireUniqueInstance() is called
// and more than one DO was found.
} catch ( DataObjectException e2 ) {
// This could happen if the database server dies, etc.
throw e2;
}
MailQueueBDO[] BDOarray = new MailQueueBDO[ DOarray.length ];
for ( int i = 0; i < DOarray.length; i++ )
BDOarray[i] = MailQueueBDO.createExisting( DOarray[i] );
return BDOarray;
}
/**
* The developer of a Business Object that derives from this class
* can override the methods:<CODE>
* beforeAnyGet
* beforeAnySet
* afterAnySet
* </CODE> to handle any general assertions or cleanup needed
* for <CODE>get</CODE> and <CODE>set</CODE> methods.
*/
protected void beforeAnyGet() {
}
// beforeAnySet throws plain Exception to allow overriding implementations
// to throw any flavor needed.
protected void beforeAnySet() throws Exception {
if ( DO.isReadOnly() )
throw new DataObjectException( DO + " is read-only." );
}
protected void afterAnySet() {
}
/**
* The methods <CODE>
* getHandle
* hasMatchingHandle
* </CODE> are used by Presentation Objects that need to populate
* HTML select lists with <CODE>MailQueueBDO</CODE> objects as options.
*
* The <CODE>getHandle()</CODE> method is used
* to set the value for each option,
* and the <CODE>hasMatchingHandle()<CODE>
* methods are used to lookup the Data Object when the selection has
* been made.
*
* This MailQueueBDO object holds a reference to a MailQueueDO object.
* The id of this MailQueueBDO is the id of its MailQueueDO.
* @exception DatabaseManagerException
* If a connection to the database cannot be established, etc.
* @return id of this BDO as a string
* If an object id can't be allocated for this object.
*/
public String getHandle()
throws DatabaseManagerException {
return DO.getHandle();
}
/**
* @param handle
* <CODE>String</CODE> representation of the id for this BDO
* @return boolean
* True if the string version of the id of this DO matches passed handle
* @see getHandle
*/
public boolean hasMatchingHandle( String handle ) {
return DO.hasMatchingHandle( handle );
}
/**
* for debugging
*/
public String toString() {
if ( null == DO )
return "NULL";
return DO.toString();
}
/**
* Get Time of the MailQueueDO
*
* @return Time of the MailQueueDO
*
* @exception DataObjectException
* If the object is not found in the database.
*/
public java.sql.Timestamp getTime ()
throws DataObjectException {
beforeAnyGet(); // business actions/assertions prior to data return
return DO.getTime ();
}
/**
* Set Time of the MailQueueDO
*
* @param Time of the MailQueueDO
*
* @exception DataObjectException
* If the object is not found in the database.
*/
public void setTime ( java.sql.Timestamp Time )
throws DataObjectException {
try {
// business actions/assertions prior to data assignment
beforeAnySet();
} catch ( Exception e ) {
throw new DataObjectException( "beforeAnySet: " + e.getMessage() );
}
DO.setTime ( Time );
afterAnySet(); // business actions/assertions after data assignment
}
/**
* Get Mail of the MailQueueDO
*
* @return Mail of the MailQueueDO
*
* @exception DataObjectException
* If the object is not found in the database.
*/
public byte[] getMail ()
throws DataObjectException {
beforeAnyGet(); // business actions/assertions prior to data return
return DO.getMail ();
}
/**
* Set Mail of the MailQueueDO
*
* @param Mail of the MailQueueDO
*
* @exception DataObjectException
* If the object is not found in the database.
*/
public void setMail ( byte[] Mail )
throws DataObjectException {
try {
// business actions/assertions prior to data assignment
beforeAnySet();
} catch ( Exception e ) {
throw new DataObjectException( "beforeAnySet: " + e.getMessage() );
}
DO.setMail ( Mail );
afterAnySet(); // business actions/assertions after data assignment
}
/**
* Get Priority of the MailQueueDO
*
* @return Priority of the MailQueueDO
*
* @exception DataObjectException
* If the object is not found in the database.
*/
public int getPriority ()
throws DataObjectException {
beforeAnyGet(); // business actions/assertions prior to data return
return DO.getPriority ();
}
/**
* Set Priority of the MailQueueDO
*
* @param Priority of the MailQueueDO
*
* @exception DataObjectException
* If the object is not found in the database.
*/
public void setPriority ( int Priority )
throws DataObjectException {
try {
// business actions/assertions prior to data assignment
beforeAnySet();
} catch ( Exception e ) {
throw new DataObjectException( "beforeAnySet: " + e.getMessage() );
}
DO.setPriority ( Priority );
afterAnySet(); // business actions/assertions after data assignment
}
/**
* Inserts/Updates the DO into its table.
*
* @exception com.lutris.appserver.server.sql.DatabaseManagerException if a Transaction can not be created.
* @exception RefAssertionException thrown by okTo method.
* @exception java.sql.SQLException if any SQL errors occur.
*/
public void commit()
throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
modifyDO( null, false );
}
/**
* Inserts/Updates the DO into its table.
* The transaction is likely provided by the commit() method of another BDO
* whose DO references this DO.
*
* @param dbt The transaction object to use for this operation.
* @exception com.lutris.appserver.server.sql.DatabaseManagerException if a Transaction can not be created.
* @exception RefAssertionException thrown by okTo method.
* @exception java.sql.SQLException if any SQL errors occur.
*/
public void commit(DBTransaction dbt)
throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
modifyDO( dbt, false );
}
/**
* Deletes the DO from its table.
*
* @exception com.lutris.appserver.server.sql.DatabaseManagerException if a Transaction can not be created.
* @exception RefAssertionException thrown by okTo method.
* @exception java.sql.SQLException if any SQL errors occur.
*/
public void delete()
throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
modifyDO( null, true );
}
/**
* Deletes the DO from its table.
* The transaction is likely provided by the delete() method of another BDO
* whose DO references this DO.
*
* @param dbt The transaction object to use for this operation.
* @exception com.lutris.appserver.server.sql.DatabaseManagerException if a Transaction can not be created.
* @exception RefAssertionException thrown by okTo method.
* @exception java.sql.SQLException if any SQL errors occur.
*/
public void delete(DBTransaction dbt)
throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
modifyDO( dbt, true );
}
/**
* Modifies the DO within its table.
* Performs recursive commit/delete on referenced DOs;
* all operations occur within a single transaction
* to allow rollback in the event of error.
* Only the creator of the transaction releases it.
*
* @param dbt The transaction object to use for this operation.
* @param delete True if doing a delete, otherwise doing insert/update.
* @exception com.lutris.appserver.server.sql.DatabaseManagerException if a Transaction can not be created.
* @exception RefAssertionException thrown by okTo method.
* @exception java.sql.SQLException if any SQL errors occur.
*/
protected void modifyDO( DBTransaction dbt, boolean delete )
throws SQLException, DatabaseManagerException, DataObjectException, RefAssertionException, DBRowUpdateException, QueryException {
boolean ownTransaction = false;
try {
if ( null == dbt ) {
DatabaseManager dbm = Enhydra.getDatabaseManager();
dbt = dbm.createTransaction(); // create a transaction
ownTransaction = true;
}
if ( null == dbt )
throw new DatabaseManagerException(
"DatabaseManager.createTransaction returned null." );
if ( delete ) {
// Code to perform cascading deletes is generated here
// if cascading deletes are not supported by the database.
// The following line keeps the compiler happy
// when the CASCADING_DELETES tag is empty.
if ( false )
throw new QueryException("XXX");
} else {
// commit referenced DOs.
}
if ( false ) {
// This throw is here to keep the compiler happy
// in the case of a DO that does not refer to other DOs.
// In that case, the above delete/commit code blocks will be empty
// and throw nothing.
throw new DataObjectException( "foo" );
}
if ( delete ) {
dbt.delete( DO );
} else {
if ( DO.isLoaded() )
dbt.insert( DO ); // dbt.insert() handles insertions and updates
}
if (ownTransaction) {
dbt.commit(); // commit the transaction
}
} catch (DataObjectException doe) {
throw doe;
} catch (SQLException sqle) {
StringBuffer message = new StringBuffer("Failed to insert/update DO: ");
message.append(sqle.getMessage());
// rollback, if necessary
if (ownTransaction) {
try {
dbt.rollback();
} catch (SQLException sqle2) {
message.insert(0,"\n");
message.insert(0,sqle2.getMessage());
message.insert(0,"Rollback failed: ");
}
}
throw new SQLException(message.toString());
} finally {
// release the transaction, if any
if (ownTransaction) {
dbt.release();
}
}
}
}
| [
"pse4"
]
| pse4 |
5b1ab21003952ae0a455146eb99fd9f4d71ce1e7 | 478543e89206537b3f660381c6000e8fcf35c8ab | /src/main/java/com/app/smpt/common/validation/package-info.java | 09ed1b0461a57c4a15cdad14cb710247986242d2 | []
| no_license | saistockproject/sai | e0fbab105344963020c8a71bba7a477db83c26cc | f1c62504b0ce07c716bd237f272c7b36c103c7b8 | refs/heads/master | 2021-01-10T03:56:26.282235 | 2015-11-05T07:40:43 | 2015-11-05T07:40:43 | 45,346,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | /**
*
*/
/**
* @author dan
*
*/
package com.app.smpt.common.validation; | [
"[email protected]"
]
| |
e9fe7c95a61a74f02dc6fd0c91f69117d1d1cc19 | e5fcec27576c8f370eb65642bbdd1eed7b7fa638 | /javach10/src/ch18/StringTokenizerMainExample.java | d59f8ee28cbf2b8a78a6ea66ce80d4fb27cf0495 | [
"MIT"
]
| permissive | daehyeonhong/Java | 893133c6d0e0580d199a9a63934aef967a6db922 | 258f0bcf7906a3ea2d2f945fcfcb5d9e4cfb2fe1 | refs/heads/master | 2023-01-20T02:13:07.808995 | 2020-11-20T17:59:42 | 2020-11-20T17:59:42 | 261,452,095 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package ch18;
import java.util.StringTokenizer;
public class StringTokenizerMainExample {
public static void main(String[] args) {
String text = "홍길동&이수홍/박연수";
StringTokenizer stk = new StringTokenizer(text, "/|&");
int countTokens = stk.countTokens();
// token 저장 - nextToken() 소모
// 소모성 객체
for (int i = 0; i < countTokens; i++) {
System.out.println(stk.nextToken());
}
System.out.println("─────");
stk = new StringTokenizer(text, "&|/");
while (stk.hasMoreElements()) {
System.out.println(stk.nextElement());
}
}
} | [
"[email protected]"
]
| |
28bfad6975df83053a84a33104753969a8f86dd5 | 9cba88dc4bcc448b6f5934f68311b334e3e7a938 | /src/main/java/eu/janinko/Andaria/ultimasdk/StaticDrawer.java | 991f79b0587140359d1b8f42795a7332fe1b2a93 | []
| no_license | NaphalAXT/ultimasdk-1 | 4eea6f76d7833b32c526b43fddcc484fa8270dda | 666f53d3dd700ab53085bd1488917412792f46a5 | refs/heads/master | 2021-03-01T11:29:27.288896 | 2014-11-27T01:54:24 | 2014-11-27T01:54:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,409 | java | package eu.janinko.Andaria.ultimasdk;
import eu.janinko.Andaria.ultimasdk.files.Arts;
import eu.janinko.Andaria.ultimasdk.files.Map;
import eu.janinko.Andaria.ultimasdk.files.Statics;
import eu.janinko.Andaria.ultimasdk.files.TileData;
import eu.janinko.Andaria.ultimasdk.files.arts.Art;
import eu.janinko.Andaria.ultimasdk.files.map.MapTile;
import eu.janinko.Andaria.ultimasdk.files.statics.Static;
import eu.janinko.Andaria.ultimasdk.files.tiledata.ItemData;
import eu.janinko.Andaria.ultimasdk.files.tiledata.TileFlag;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.imageio.ImageIO;
/**
* @author Honza Brázdil <[email protected]>
*/
public class StaticDrawer {
public static final String uopath=System.getProperty("user.home") + "/Ultima/hra/";
public static final int VERTICAL_SHIFT = -4;
public static final int TILE_HALFSIZE = 22;
public static final int TILE_SIZE = TILE_HALFSIZE*2;
private int cx, cy;
private int ccx, ccy;
private int width, height;
private BufferedImage image;
private Graphics canvas;
public StaticDrawer(int width, int height, int cx, int cy){
this(width, height, cx, cy, 0, 0);
}
public StaticDrawer(int width, int height, int cx, int cy, int ccx, int ccy){
this.width = width;
this.height = height;
this.cx = cx;
this.cy = cy;
this.ccx = ccx;
this.ccy = ccy;
image = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
canvas = image.getGraphics();
}
private int getRelGX(int x, int y){
return (x - cx) * TILE_HALFSIZE - (y - cy) * TILE_HALFSIZE + ccx;
}
private int getRelGY(int x, int y){
return (x - cx) * TILE_HALFSIZE + (y - cy) * TILE_HALFSIZE + ccy;
}
private int getArtRelGX(Art art){
return - art.getWidth() / 2;
}
private int getArtRelGY(Art art){
return 22 - art.getHeight();
}
public void putArt(Art art, int x, int y){
putArt(art, x, y, 0);
}
public void putArt(Art art, int x, int y, int z){
//System.out.println("Drawing pos " + x + "," + y );
//System.out.println(" getRelGX: " + getRelGX(x,y) + " getRelGY: " + getRelGY(x,y) );
int gx = width / 2 + getRelGX(x, y) + getArtRelGX(art);
int gy = height / 2 + getRelGY(x, y) + getArtRelGY(art) + z*VERTICAL_SHIFT;
//System.out.println(" on " + gx + "," + gy);
canvas.drawImage(art.getImage(), gx, gy, null);
}
private BufferedImage getImage() {
return image;
}
public static void main(String[] args) throws IOException {
File artidx = new File(uopath + "artidx.mul");
File artmul = new File(uopath + "art.mul");
File staidx0 = new File(uopath + "staidx0.mul");
File statics0 = new File(uopath + "statics0.mul");
File map0 = new File(uopath + "map0.mul");
File tiledatamul = new File(uopath + "tiledata.mul");
Arts arts = new Arts(new FileInputStream(artidx), artmul);
Statics statics = new Statics(new FileInputStream(staidx0), statics0);
Map map = new Map(map0);
TileData tiledata = new TileData(new FileInputStream(tiledatamul));
renderWholeStatic(arts, statics, tiledata);
}
private static void renderThyris() throws IOException{
File artidx = new File(uopath + "artidx.mul");
File artmul = new File(uopath + "art.mul");
File staidx0 = new File(uopath + "staidx0.mul");
File statics0 = new File(uopath + "statics0.mul");
File map0 = new File(uopath + "map0.mul");
File tiledatamul = new File(uopath + "tiledata.mul");
Arts arts = new Arts(new FileInputStream(artidx), artmul);
Statics statics = new Statics(new FileInputStream(staidx0), statics0);
Map map = new Map(map0);
TileData tiledata = new TileData(new FileInputStream(tiledatamul));
List<Static> sts = new ArrayList<Static>();
for(int x = 1150/8; x <= 2150/8; x++){
for(int y = 2550/8; y <= 3000/8; y++){
sts.addAll(statics.getStaticsOnBlock(x, y));
}
}
Collections.sort(sts, new StaticPositionComparator(tiledata));
StaticDrawer sd = new StaticDrawer(15000, 11000, 2780, 1930);
for(int x = 1150/8; x <= 2150/8; x++){
for(int y = 2550/8; y <= 3000/8; y++){
for(MapTile[] tiles : map.getTilesOnBlock(x, y)){
for(MapTile tile : tiles){
Art a = arts.getMap(tile.getId());
sd.putArt(a, tile.getY(), tile.getX(), tile.getAlt());
}
}
}
}
int i = 0;
for(Static s : sts){
Art a = arts.getStatic(s.getId());
ItemData t = tiledata.getItem(s.getId());
if(a == null){
System.out.println(i + ": id: " + s.getId() + " name: " + t.getName() + " pos: " + s.getX() + "," + s.getY() + "," + s.getZ() );
continue;
}
sd.putArt(a, s.getY(), s.getX(), s.getZ());
//File out = new File("/tmp/canvas/g"+i+".png");
//ImageIO.write(sd.getImage(), "png", out);
//i++;
}
BufferedImage img = sd.getImage();
File out = new File("/tmp/canvas/areaT.png");
ImageIO.write(img, "png", out);
}
private static void renderWholeStatic(Arts arts, Statics statics, TileData tiledata) throws IOException{
int mapWidth = 896;
int mapHeight = 512;
int plateSize = 8192;
int mapA = mapHeight*8 * TILE_HALFSIZE;
int mapB = mapWidth*8 * TILE_HALFSIZE;
int zeroX = (mapA + 22) / 22;
int zeroY = (mapA + 22) / 22 - mapA/11;
int overallSize = mapA + mapB;
int plates = overallSize / plateSize +1;
System.out.println("plates: " + plates);
long platesOnWidth = Math.round(Math.ceil((mapWidth*8 * TILE_SIZE) / (double) plateSize));
long platesOnHeight =Math.round(Math.ceil((mapHeight*8 * TILE_SIZE) / (double) plateSize));
double tilesOnPlate = plateSize / 44.0;
int renderSize = (int) (Math.round(Math.ceil(tilesOnPlate)) + 15);
for(int px = 0; px < plates; px++){
for(int py = 0; py < plates; py++){
System.out.print("Rendering plate " + px + "," + py +". ");
int dx = plateSize * px + plateSize / 2; // pixelový střed plate
int dy = plateSize * py + plateSize / 2;
System.out.println("Pixel center is " + dx + "," + dy +". ");
int cx = ((dx + dy)/22 - zeroX)/2; // souřadnice ve středu
int cy = (((dx + dy)/22 - dx / 11) - zeroY)/2;
System.out.println(" Central position is " + cx + "," + cy + ".");
int ddx = mapA - (cy * TILE_HALFSIZE - cx * TILE_HALFSIZE); // pixelový střed souřadnic
int ddy = cy * TILE_HALFSIZE + cx * TILE_HALFSIZE;
System.out.println(" Central position center is " + ddx + "," + ddy + ".");
int ccx = ddx - dx;
int ccy = ddy - dy;
System.out.println(" Difference is " + ccx + "," + ccy + ".");
while(ccx > 0){
cx -= 1;
cy += 1;
ccx -= 44;
}
while(ccy > 0){
cx -= 1;
cy -= 1;
ccy -= 44;
}
while(ccx <= -44){
cx += 1;
cy -= 1;
ccx += 44;
}
while(ccy <= -44){
cx += 1;
cy += 1;
ccy += 44;
}
ddx = mapA - (cy * TILE_HALFSIZE - cx * TILE_HALFSIZE); // pixelový střed souřadnic
ddy = cy * TILE_HALFSIZE + cx * TILE_HALFSIZE;
System.out.println(" New central position center is " + ddx + "," + ddy + ".");
System.out.println(" Resulting position move is " + ccx + "," + ccy + ".");
int startX = cx - renderSize;
if(startX < 0) startX = 0;
int startY = cy - renderSize;
if(startY < 0) startY = 0;
int stopX = cx + renderSize;
if(stopX >= mapWidth*8) stopX = mapWidth*8;
int stopY = cy + renderSize;
if(stopY >= mapHeight*8) stopY = mapHeight*8;
if(stopX < 0 || stopY < 0) continue;
if(startX >= 8*mapWidth || startY >= 8*mapHeight) continue;
System.out.println(" Starting rendering on " + startX + "," + startY + ", ending on " + stopX + "," + stopY + ".");
StaticDrawer sd = new StaticDrawer(plateSize, plateSize, cx, cy, ccx, ccy);
List<Static> sts = new ArrayList<Static>();
for(int rx = startX; rx < stopX; rx++){
for(int ry = startY; ry < stopY; ry++){
sts.addAll(statics.getStatics(rx, ry));
}
}
Collections.sort(sts, new StaticPositionComparator(tiledata));
int i = 0;
for (Static s : sts) {
Art a = arts.getStatic(s.getId());
ItemData t = tiledata.getItem(s.getId());
if (a == null) {
System.out.println(i + ": id: " + s.getId() + " name: " + t.getName() + " pos: " + s.getX() + "," + s.getY() + "," + s.getZ());
continue;
}
sd.putArt(a, s.getX(), s.getY(), s.getZ());
}
File out = new File("/tmp/map/map_" + px + "_" + py + ".png");
ImageIO.write(sd.getImage(), "png", out);
}
}
}
private static class StaticPositionComparator implements Comparator<Static> {
TileData tiledata;
public StaticPositionComparator(){
}
public StaticPositionComparator(TileData tiledata) {
this.tiledata = tiledata;
}
public int compare(Static o1, Static o2) {
if(tiledata != null && o1.getX() == o2.getX() && o1.getY() == o2.getY() && o1.getZ() == o2.getZ()){
ItemData t1 = tiledata.getItem(o1.getId());
ItemData t2 = tiledata.getItem(o2.getId());
if(t1 == null && t2 == null) return 0;
int t1b = (t1.getFlags().contains(TileFlag.Background) ? 1: 0);
int t2b = (t2.getFlags().contains(TileFlag.Background) ? 1: 0);
return t2b - t1b;
}
return ((o1.getX() + o1.getY()) * 22 - o1.getZ() * VERTICAL_SHIFT) - ((o2.getX() + o2.getY()) * 22 - o2.getZ() * VERTICAL_SHIFT);
}
}
}
| [
"[email protected]"
]
| |
6448df30da7bc4183fc443484f2ca8418e4c8931 | 7ab35f8077a64ad4856c1955fba6ca2c9d5580a0 | /demo1/bin/com/cg/client/DeleteRow.java | efd620ad7a59594113afbd409752e88afba1700e | []
| no_license | laasy/jpa | b098ef16a42c319cdb6ac4f1722f4df5e220909c | f9dfe43388957f5ee8ba4aac9dcae08af808affd | refs/heads/master | 2020-04-18T07:41:14.288673 | 2019-01-25T04:02:11 | 2019-01-25T04:02:11 | 167,368,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 680 | java | package com.cg.client;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import com.cg.entity.Student;
public class DeleteRow {
public static void main(String[] args) {
// TODO Auto-generated method stub
EntityManagerFactory factory = Persistence.createEntityManagerFactory("JPA-PU");
EntityManager manager = factory.createEntityManager();
manager.getTransaction().begin();
Student stu=manager.find(Student.class,1);
manager.remove(stu);
System.out.println("Deleted");
manager.close();
manager.getTransaction().commit();
factory.close();
}
}
| [
"[email protected]"
]
| |
328a1ed1cfc53805029de854b1959c534781db57 | 97fbe1217f6f9a44761fde36881721323c077084 | /src/main/java/com/google/solutions/cloud/deployment/DeploymentManager.java | 3f0fcd246e38c9a751d284f2a279bde435639250 | [
"Apache-2.0"
]
| permissive | oivonin/cloud-app-demo-tool | a8b310f9179dd79c3070e325d746e976aee706e3 | f215a42f77c0631047257070a7c3cc2c148415ed | refs/heads/master | 2021-01-18T01:31:14.997368 | 2015-02-04T17:47:55 | 2015-02-04T18:48:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,781 | java | package com.google.solutions.cloud.deployment;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.api.services.compute.model.Instance;
import com.google.common.base.Optional;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.solutions.cloud.compute.ComputeInstanceHelper;
import com.google.solutions.cloud.compute.ComputeService;
import com.google.solutions.cloud.demo.info.DemoInfo;
import java.io.IOException;
import java.util.Map;
import java.util.logging.Logger;
public class DeploymentManager {
private static final Logger LOGGER = Logger.getLogger(DeploymentManager.class.toString());
private final ComputeService computeService;
public DeploymentManager(ComputeService computeService) {
this.computeService = checkNotNull(computeService);
}
public void launch(SingleInstanceDeployment sid) {
try {
this.computeService.createInstance(sid.getInstanceTemplate());
} catch (IOException e) {
Throwables.propagate(e);
}
}
public void teardown(SingleInstanceDeployment sid) {
Instance instanceTemplate = sid.getInstanceTemplate();
try {
Optional<Instance> instance = this.computeService.getInstanceInformation(instanceTemplate);
if (instance.isPresent()) {
this.computeService.deleteInstance(instance.get());
} else {
LOGGER.info(String.format("instance, %s, in zone %s, not found during teardown attempt",
instanceTemplate.getName(), instanceTemplate.getZone()));
}
} catch (IOException e) {
Throwables.propagate(e);
}
}
public void updateDemoInfo(SingleInstanceDeployment sid, DemoInfo demoInfo) {
Instance instanceTemplate = sid.getInstanceTemplate();
String instanceName = instanceTemplate.getName();
Optional<Instance> fullInstance = this.computeService.getInstanceInformation(instanceTemplate);
if (fullInstance.isPresent()) {
demoInfo.setDeploymentStatus(fullInstance.get().getStatus());
Map<String, String> fullDeploymentMetadata = ImmutableMap.of(
"instanceDetailURL", ComputeInstanceHelper.getInstanceDetailUrl(instanceName),
"sshURL", ComputeInstanceHelper.getSshUrl(instanceName));
demoInfo.setFullDeploymentMetadta(fullDeploymentMetadata);
}
}
public void launch(DeploymentTemplate unsupported) {
throw new UnsupportedOperationException("unsupported template: " + unsupported);
}
public void teardown(DeploymentTemplate unsupported) {
throw new UnsupportedOperationException("unsupported template: " + unsupported);
}
public void updateDemoInfo(DeploymentTemplate unsupported) {
throw new UnsupportedOperationException("unsupported template: " + unsupported);
}
}
| [
"[email protected]"
]
| |
063c5ff424a7386a4825d4a35bb4cd23e086e27e | 1539e02d14dda92132bce89178a7b62d80e91067 | /src/main/java/controllers/actor/ActorMessageFolderController.java | 0e19e13d63c6831a92965c57da40d73aa4f8ee93 | []
| no_license | GuillermoCasalCaro/ISPP | e250633c115e2ffcaad276cdde0a5041daa6e9c6 | b9538f08fad5ddd89d9800066170aff15d0f0141 | refs/heads/master | 2022-01-28T03:10:04.285094 | 2019-04-01T23:07:46 | 2019-04-01T23:07:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,906 | java |
package controllers.actor;
import java.util.Collection;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import security.LoginService;
import services.MessageFolderService;
import services.MessageService;
import controllers.AbstractController;
import domain.Message;
import domain.MessageFolder;
@Controller
@RequestMapping("/messageFolder/actor")
public class ActorMessageFolderController extends AbstractController {
// Services ---------------------------------------------------------------
@Autowired
private MessageFolderService folderService;
@Autowired
private LoginService loginService;
@Autowired
private MessageService messageService;
// Constructors -----------------------------------------------------------
public ActorMessageFolderController() {
super();
}
//List Rest
@RequestMapping(value = "/listRest", method = RequestMethod.GET)
public @ResponseBody
Collection<MessageFolder> listRest() {
Collection<MessageFolder> result;
result = this.loginService.getPrincipalActor().getMessageFolders();
return result;
}
// Listing ----------------------------------------------------------------
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ModelAndView list() {
ModelAndView result;
Collection<MessageFolder> folders;
folders = this.loginService.getPrincipalActor().getMessageFolders();
result = new ModelAndView("actor/messageFolder/list");
result.addObject("folders", folders);
return result;
}
// Creation ---------------------------------------------------------------
@RequestMapping(value = "/create", method = RequestMethod.GET)
public ModelAndView create() {
ModelAndView result;
MessageFolder f;
f = this.folderService.create();
f.setActor(this.loginService.getPrincipalActor());
f.setIsModificable(true);
result = this.createEditModelAndView(f);
return result;
}
// Edition ----------------------------------------------------------------
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public ModelAndView edit(@RequestParam final int folderId) {
ModelAndView result;
MessageFolder folder;
folder = this.folderService.findOne(folderId);
Assert.notNull(folder);
Assert.isTrue(this.loginService.getPrincipalActor().getId() == folder.getActor().getId());
Assert.isTrue(folder.getIsModificable());
result = this.createEditModelAndView(folder);
return result;
}
@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "save")
public ModelAndView save(@Valid final MessageFolder folder, final BindingResult binding) {
ModelAndView result;
if (folder.getId() != 0) {
final MessageFolder fbd = this.folderService.findOne(folder.getId());
Assert.notNull(fbd);
Assert.isTrue(this.loginService.getPrincipalActor().getId() == fbd.getActor().getId());
Assert.isTrue(fbd.getIsModificable());
folder.setMessages(fbd.getMessages());
} else {
Assert.isTrue(this.loginService.getPrincipalActor().getId() == folder.getActor().getId());
Assert.isTrue(folder.getIsModificable());
}
if (binding.hasErrors())
result = this.createEditModelAndView(folder);
else if (this.folderService.isReservedName(folder))
result = this.createEditModelAndView(folder, "folder.commit.error.name");
else if (this.folderService.existsMessageFolder(folder))
result = this.createEditModelAndView(folder, "folder.commit.error.name.exist");
else
try {
this.folderService.save(folder);
result = new ModelAndView("redirect:list.do");
} catch (final Throwable oops) {
result = this.createEditModelAndView(folder, "folder.commit.error");
}
return result;
}
@RequestMapping(value = "/edit", method = RequestMethod.POST, params = "delete")
public ModelAndView delete(final MessageFolder folder, final BindingResult binding) {
ModelAndView result;
if (folder.getId() != 0) {
final MessageFolder fbd = this.folderService.findOne(folder.getId());
Assert.notNull(fbd);
Assert.isTrue(this.loginService.getPrincipalActor().getId() == fbd.getActor().getId());
Assert.isTrue(fbd.getIsModificable());
}
Assert.isTrue(this.loginService.getPrincipalActor().getId() == folder.getActor().getId());
Assert.isTrue(folder.getIsModificable());
try {
for (final Message m : folder.getMessages()) {
final MessageFolder f = this.folderService.getPapelera(this.loginService.getPrincipalActor());
m.setMessageFolder(f);
final List<Message> lm = f.getMessages();
lm.add(m);
f.setMessages(lm);
this.folderService.save(f);
this.messageService.save(m);
}
this.folderService.delete(folder);
result = new ModelAndView("redirect:list.do");
} catch (final Throwable oops) {
result = this.createEditModelAndView(folder, "folder.commit.error");
System.out.println(oops.getMessage());
}
return result;
}
// Ancillary methods ------------------------------------------------------
protected ModelAndView createEditModelAndView(final MessageFolder folder) {
ModelAndView result;
result = this.createEditModelAndView(folder, null);
return result;
}
protected ModelAndView createEditModelAndView(final MessageFolder folder, final String message) {
ModelAndView result;
result = new ModelAndView("actor/messageFolder/edit");
result.addObject("messageFolder", folder);
result.addObject("message", message);
return result;
}
}
| [
"[email protected]"
]
| |
b33602d09e41ec16fadcafd5de1eb4fe7b7d327c | ce0735b66cfb8e26f43e10f6acad3c76dbd6fdbb | /src/main/java/com/szepe/peter/pex/impl/OutputWriterToConsole.java | c701f79fb771795bde3bd66fbcd2d5f3187ccad7 | []
| no_license | szepep/pex-hw | 4606aae9e32be78f0a0eefa58034b6e5cce2c0e7 | d793343c70becde82aeec57191f19bcd1b039aef | refs/heads/master | 2020-06-10T22:20:25.271232 | 2019-07-14T16:08:20 | 2019-07-14T16:08:20 | 193,771,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | package com.szepe.peter.pex.impl;
import com.szepe.peter.pex.spi.OutputWriter;
public class OutputWriterToConsole implements OutputWriter {
@Override
public void write(String s) {
System.out.println(s);
}
@Override
public void close() {
}
}
| [
"[email protected]"
]
| |
57a9130e563c378b1b23b1b90e2ef989ebfe48fc | b7910f1f37b27ff46c4543996456bded4ee7931e | /src/main/java/pl/janda/crypto/application/Lifecycle.java | e5a52d5b511e3ee014210798544dc3d466d0d146 | []
| no_license | Subtelny/CryptoMarketApp | e547f9dec60ff6f1652d11f69f6ef5b4011668f6 | 909728f722f863b9a7a6d0473fbf620c269ac425 | refs/heads/master | 2023-06-22T06:14:06.153703 | 2020-06-13T02:52:14 | 2020-06-13T02:52:14 | 271,929,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 72 | java | package pl.janda.crypto.application;
public interface Lifecycle {
}
| [
"[email protected]"
]
| |
448dfbba209bfc6984e8ec51f7ee27da65dc19da | 03e4b4e5c13fc606d1ae5060958f0ee2f3a8234a | /trunk/catalogue/src/eu/morfeoproject/fast/catalogue/DuplicatedScreenException.java | 80db992a099658007f8a5faa692380cdec158bf5 | []
| no_license | conwetlab/fast | 0328151bb0d3e837e7ce25de385cf329fc849f36 | 173ec7b7b812cc87b211c95884b2a53a8417eb98 | refs/heads/master | 2021-01-19T12:36:44.726945 | 2012-10-05T20:42:32 | 2012-10-05T20:42:32 | 6,093,257 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 109 | java | package eu.morfeoproject.fast.catalogue;
public class DuplicatedScreenException extends Exception {
}
| [
"irivera"
]
| irivera |
f5eaa67a499ef864dc62389db0b63ad83d60ced5 | 0c1de49744adfe8535da928751f5994cf7fbacba | /src/com/task/WidgetProvider.java | 9c2f27f795a8b9298c56c61608a91b34af1ee69b | []
| no_license | elynde/task-android | 8ce4b89f9c655ce272fb1467e305e01e0979b068 | 9cca53d282f8de2f4ca1abe7e7b2b7c943de6025 | refs/heads/master | 2018-12-29T19:12:06.243431 | 2013-11-09T03:10:38 | 2013-11-09T03:10:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,010 | java | package com.task;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.widget.RemoteViews;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class WidgetProvider extends AppWidgetProvider {
@Override
public void onUpdate( Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds )
{
RemoteViews remoteViews;
ComponentName watchWidget;
DateFormat format = SimpleDateFormat.getTimeInstance(SimpleDateFormat.MEDIUM, Locale.getDefault());
remoteViews = new RemoteViews( context.getPackageName(), R.layout.main );
watchWidget = new ComponentName( context, WidgetProvider.class );
remoteViews.setTextViewText( R.id.LinearLayout01, "Time = " + format.format( new Date()));
appWidgetManager.updateAppWidget( watchWidget, remoteViews );
}
}
| [
"[email protected]"
]
| |
a06c6090e95de9ddd9b4d2fdd6b475bab42194ea | e90095391ce8d74fe5c239bd39580167ffa11aa3 | /FileProcessing/src/main/java/com/fileprocessor/akka/Application.java | acc78cffb454679f68d34b93daaf6d632e8a8551 | []
| no_license | lbalamallikarjunaraju/akkaFileProcessor | 12aa92a7654410cff7e1b3a1e28963dcd0a760b3 | e64689e83cb95272eb5708b1227f8373d54c7bc5 | refs/heads/master | 2020-06-24T08:46:00.838283 | 2018-07-31T07:26:46 | 2018-07-31T07:26:46 | 96,927,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,138 | java | package com.fileprocessor.akka;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import com.fileprocessor.akka.actor.AggregatorActor;
import com.fileprocessor.akka.actor.FileParserActor;
import com.fileprocessor.akka.actor.FileScannerActor;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.event.LoggingAdapter;
public class Application {
public static String FILE_PATH;
private ActorSystem _system = null;
private LoggingAdapter logger = null;
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter directory or file path: ");
FILE_PATH = reader.readLine();
if (FILE_PATH.trim().length() == 0) {
throw new RuntimeException("Path should not be empty");
}
Application app = new Application();
app.init();
app.start();
app.shutdown();
}
public final void init() {
_system = ActorSystem.create("fileProcessor");
logger = _system.log();
logger.info("Initialized the Actor System");
}
public final void start() {
if (_system != null) {
ActorRef aggregatorActor = _system.actorOf(AggregatorActor.props());
ActorRef fileParserActor = _system.actorOf(FileParserActor.props(aggregatorActor));
ActorRef fileScannerActor = _system.actorOf(FileScannerActor.props(fileParserActor));
fileScannerActor.tell(FILE_PATH, fileScannerActor);
} else {
throw new RuntimeException("Illeagal start of actor system");
}
}
public final void shutdown() {
if (_system != null) {
if (AggregatorActor.getMapCount() == 0) {
try {
Thread.sleep(Thread.currentThread().getThreadGroup().activeCount() * 100);
} catch (InterruptedException e) {
e.printStackTrace();
}
// I know this is weird.
// Need to find out a better way to shutdown properly.
if (AggregatorActor.getMapCount() == 0) {
_system.terminate();
}
}
} else {
throw new RuntimeException("Illeagal access to shutdown actor system");
}
}
}
| [
"[email protected]"
]
| |
cf467980450bae8be14bd2694ccb2b69bbf901a4 | fe6fe25a9a04050362d44662286e2d441bc161e4 | /menulayout/src/main/java/com/ldt/menulayout/helper/LocaleHelper.java | f28541cf2a60aad130ff51e208de7e1c26a1d53c | []
| no_license | bk-group/TrainingMenu | 0b5423be5d18d14a9b07fa31f345d9dc20786e50 | a9b3b8ebaacff261122f673c7da43ac31af6cf5d | refs/heads/master | 2021-01-26T18:04:19.862399 | 2019-12-18T11:23:35 | 2019-12-18T11:23:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,681 | java | package com.ldt.menulayout.helper;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import androidx.preference.PreferenceManager;
import java.util.Locale;
public class LocaleHelper {
private static final String SELECTED_LANGUAGE = "Locale.Helper.Selected.Language";
public static Context onAttach(Context context) {
String lang = getPersistedData(context, Locale.getDefault().getLanguage());
return setLocale(context, lang);
}
public static Context onAttach(Context context, String defaultLanguage) {
String lang = getPersistedData(context, defaultLanguage);
return setLocale(context, lang);
}
public static String getLanguage(Context context) {
return getPersistedData(context, Locale.getDefault().getLanguage());
}
public static Context setLocale(Context context, String language) {
persist(context, language);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return updateResources(context, language);
}
return updateResourcesLegacy(context, language);
}
private static String getPersistedData(Context context, String defaultLanguage) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
return preferences.getString(SELECTED_LANGUAGE, defaultLanguage);
}
private static void persist(Context context, String language) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(SELECTED_LANGUAGE, language);
editor.apply();
}
@TargetApi(Build.VERSION_CODES.N)
private static Context updateResources(Context context, String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Configuration configuration = context.getResources().getConfiguration();
configuration.setLocale(locale);
return context.createConfigurationContext(configuration);
}
private static Context updateResourcesLegacy(Context context, String language) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.locale = locale;
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return context;
}
}
| [
"[email protected]"
]
| |
304859384b5ae492976d6b72fd6d18d3cb63b294 | 817ad06dbe338e064d27dd78f56b47d8607f7b26 | /src/main/java/com/heisenberg404/manytomanyjpa/repository/BookRepository.java | 678ddac55ee0730ad7f9ce0837b98a47a1b94d7c | []
| no_license | Heisenberg404/manytomanyjpa | 2cf1c0c5ab37efce6b6cf15ddf5cb79273149199 | 11a1100e71d0dae5a3bda9af7487f886e178028b | refs/heads/master | 2021-04-30T10:27:48.664212 | 2018-02-13T03:25:12 | 2018-02-13T03:25:12 | 121,333,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java | package com.heisenberg404.manytomanyjpa.repository;
import com.heisenberg404.manytomanyjpa.model.Book;
import org.springframework.data.jpa.repository.JpaRepository;
public interface BookRepository extends JpaRepository<Book, Integer> {
}
| [
"[email protected]"
]
| |
dfb87e4d2e69477b5a1d2e98bc8add193dfff7d5 | 963c9735b14a9d5f4f8bb81d852f6492997d7284 | /app/src/main/java/com/ahxbapp/common/Unread.java | decb0cd95a485dff5fbf13bf705ac5f4d348772b | []
| no_license | liuwenfang/JISUQIANBAO | 63df1d35a64551a3c36a16d416a4cd40a9c6f672 | eb287540b6475022c8e883b28ffd64417238e122 | refs/heads/master | 2020-04-23T05:52:37.184518 | 2019-02-16T02:40:29 | 2019-02-16T02:40:29 | 170,954,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package com.ahxbapp.common;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by gravel on 14-9-27.
*/
public class Unread {
public int messages;
public int notifications;
public int project_update_count;
public Unread(JSONObject json) throws JSONException {
messages = json.getInt("messages");
notifications = json.getInt("notifications");
project_update_count = json.getInt("project_update_count");
}
public Unread() {
}
public String getProject() {
return countToString(project_update_count);
}
public String getNotify() {
return countToString(notifications + messages);
}
public static String countToString(int count) {
if (count == 0) {
return "";
} else if (count > 99) {
return "99+";
} else {
return String.valueOf(count);
}
}
}
| [
"[email protected]"
]
| |
ce38d1d8da36973843a38c78679bb7cd8c59522e | d583e9fd66a22d8c01ea09a823dd69ade71a2333 | /eureka bankApp services/account-service/src/main/java/com/moneymoney/app/accountservice/entity/SavingsAccount.java | 4cdbb7dd2248ab565f93f55977c8c81022199511 | []
| no_license | Ragadeep/eureka-Assignments | 21be4a6e5dd230326570300c531935fcb5430091 | 085c844b0704bc66766c3b767a4c39231bc353ac | refs/heads/master | 2020-04-18T03:22:02.165070 | 2019-01-23T14:33:10 | 2019-01-23T14:33:10 | 167,195,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 843 | java | package com.moneymoney.app.accountservice.entity;
public class SavingsAccount extends Account {
private boolean salary;
public SavingsAccount() {
// TODO Auto-generated constructor stub
}
public SavingsAccount(Integer accountNumber, String accountHolderName, Double currentBalance, boolean salary) {
super(accountNumber, accountHolderName, currentBalance);
this.salary = salary;
}
public SavingsAccount(Integer accountNumber, String accountHolderName, boolean salary) {
super(accountNumber, accountHolderName);
this.salary = salary;
}
public boolean isSalary() {
return salary;
}
public void setSalary(boolean salary) {
this.salary = salary;
}
@Override
public String toString() {
return "SavingsAccount [salary=" + salary + ", toString()=" + super.toString() + "]";
}
}
| [
"[email protected]"
]
| |
0acf22cc795ae6ba46b6d5b250eaf0a0e4a55ff7 | 01e55a2513bc1ad4d395874ae251e3cfc60669d0 | /xunjian/trunk/app/src/main/java/com/swdn/db_qiangxiu/QXOpenHelper.java | 1ff421039206cc3f298fb9d78b3709b58b788b88 | []
| no_license | bob001/MobileOperationApp | b2e685c664b17fabed1cbc324d8d6e594dd86e08 | ac711112c9673e6b0ca440cef363db5cbacf93e4 | refs/heads/master | 2020-06-23T18:29:04.766383 | 2016-11-24T05:52:24 | 2016-11-24T05:52:24 | 74,641,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,331 | java | package com.swdn.db_qiangxiu;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by lenovo on 2016/11/9.
*/
public class QXOpenHelper extends SQLiteOpenHelper {
/**
* RepairInfo表建表语句
*/
public static final String CREATE_RepairInfo = "create table repair_info (" +
"id integer primary key," +
"alarm_id integer," +
"manager text," +
"category text," +
"address text," +
"group_info text," +
"process_state integer," +
"receive_state integer," +
"receiver text," +
"receive_date text," +
"arrival_time text," +
"end_time text," +
"repair_persons text," +
"failure_cause text," +
"execute_situation text," +
"remarks text)";
public QXOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_RepairInfo);//创建RepairInfo表
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| [
"[email protected]"
]
| |
7f078810ba6a8007eec3df0bccf2126ff7c379b1 | b66340cc635d2932cdb91a96ae643827b26d90b2 | /encrypted_im/src/main/java/org/linux/encrypted_im/controller/UserController.java | e105d9ff522ca50f69c91538ef75cdd141f4fd40 | []
| no_license | vintanda/encryptedIM-Message | 124a594af4f389b01f77d11e4e06a79f6cf5a3b8 | 22a4f8fdaf6fb1506c9b587aff1c720c13fb8ce8 | refs/heads/master | 2022-07-07T06:25:50.611239 | 2019-05-27T16:13:14 | 2019-05-27T16:13:14 | 186,128,099 | 0 | 0 | null | 2022-06-21T01:07:22 | 2019-05-11T12:05:52 | JavaScript | UTF-8 | Java | false | false | 8,464 | java | package org.linux.encrypted_im.controller;
import org.apache.commons.lang3.StringUtils;
import org.linux.encrypted_im.entity.ChatMsg;
import org.linux.encrypted_im.entity.bo.UserBO;
import org.linux.encrypted_im.entity.Users;
import org.linux.encrypted_im.entity.vo.MyFriendsVO;
import org.linux.encrypted_im.enums.OperatorFriendRequestTypeEnum;
import org.linux.encrypted_im.enums.SearchFriendsStatusEnum;
import org.linux.encrypted_im.service.UserService;
import org.linux.encrypted_im.utils.JSONResult;
import org.linux.encrypted_im.utils.MD5Utils;
import org.linux.encrypted_im.entity.vo.UsersVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.security.NoSuchAlgorithmException;
import java.util.List;
@RestController
@RequestMapping("u")
public class UserController {
@Autowired
private UserService userService;
/**
* @description 登录注册
*/
@RequestMapping("/registOrLogin")
public JSONResult registOrLogin(@RequestBody Users user) throws NoSuchAlgorithmException {
System.out.println("registOrLogin");
// 0.判断用户名/密码不能为空
if (StringUtils.isBlank(user.getUsername())
|| StringUtils.isBlank(user.getPassword())) {
return JSONResult.errorMsg("用户名或密码不能为空...");
}
// 1.判断用户名是否存在,存在 --> 登录, 不存在 --> 注册
boolean usernameIsExist = userService.queryUsernameIsExist(user.getUsername());
Users userResult = null;
if (usernameIsExist) {
// 1.1 login
System.out.println("login...");
userResult = userService.queryUserForLogin(user.getUsername(),
MD5Utils.getMD5Str(user.getPassword()));
if (userResult == null) {
return JSONResult.errorMsg("用户名或密码不正确...");
}
} else {
// 1.2 regist
System.out.println("regist...");
// 更改user的密码为MD5格式
user.setPassword(MD5Utils.getMD5Str(user.getPassword()));
// 其余字段在service中实现
userResult = userService.saveUser(user);
}
UsersVO usersVO = new UsersVO();
BeanUtils.copyProperties(userResult, usersVO);
return JSONResult.ok(usersVO);
}
/**
* @description 修改昵称
*/
@RequestMapping("/setNickname")
public JSONResult setNickname(@RequestBody UserBO userBO) throws Exception {
Users user = new Users();
user.setId(userBO.getUserId());
user.setNickname(userBO.getNickname());
Users result = userService.updateUserInfo(user);
return JSONResult.ok(result);
}
/**
* @description 搜索好友:根据账号做匹配查询而不是做模糊查询
*/
@RequestMapping("/search")
public JSONResult searchUser(String myUserId, String friendUsername) throws Exception {
// 0.判断 myUserId 和 friendUsername 都不为空
if (StringUtils.isBlank(myUserId) || StringUtils.isBlank(friendUsername)) {
return JSONResult.errorMsg("");
}
/*
前置条件:
1.搜索的用户不存在,返回[查无此人]
2.搜索的账户是你自己,返回[这是你自己啊]
3.搜索的用户已是你的好友,返回[该用户已经是你的好友啦]
*/
Integer status = userService.preconditionSearchFriends(myUserId, friendUsername);
// 成功
if (status == SearchFriendsStatusEnum.SUCCESS.status) {
Users friend = userService.queryUserInfoByUsername(friendUsername);
UsersVO usersVO = new UsersVO();
BeanUtils.copyProperties(friend, usersVO);
return JSONResult.ok(usersVO);
} else {
// 不成功
String errorMsg = SearchFriendsStatusEnum.getMsgByKey(status);
return JSONResult.errorMsg(errorMsg);
}
}
/**
* @description: 添加好友
*/
@RequestMapping("/addFriendRequest")
public JSONResult addFriendRequest(String myUserId, String friendUsername) {
// 0.判断 myUserId 和 friendUsername 都不为空
if (StringUtils.isBlank(myUserId) || StringUtils.isBlank(friendUsername)) {
return JSONResult.errorMsg("");
}
/*
前置条件:
1.搜索的用户不存在,返回[查无此人]
2.搜索的账户是你自己,返回[这是你自己啊]
3.搜索的用户已是你的好友,返回[该用户已经是你的好友啦]
*/
Integer status = userService.preconditionSearchFriends(myUserId, friendUsername);
// 成功
if (status == SearchFriendsStatusEnum.SUCCESS.status) {
userService.sendFriendRequest(myUserId, friendUsername);
} else {
// 不成功
String errorMsg = SearchFriendsStatusEnum.getMsgByKey(status);
return JSONResult.errorMsg(errorMsg);
}
return JSONResult.ok();
}
/**
* @description: 查询收到的好友申请
*/
@RequestMapping("/queryFriendRequest")
public JSONResult queryFriendRequest(String userId) {
System.out.println("查询好友请求列表.....");
// 0.判断 userId 不能为空
if (StringUtils.isBlank(userId)) {
return JSONResult.errorMsg("");
}
// 1.查询用户收到的好友申请
return JSONResult.ok(userService.queryFriendRequestList(userId));
}
/**
* @description: 对收到的好友请求进行处理:忽略/通过
*/
@RequestMapping("/operFriendRequest")
public JSONResult operFriendRequest(String acceptUserId, String sendUserId, Integer operType) {
// 0. 判断 acceptUserId sendUserId 不能为空
if (StringUtils.isBlank(acceptUserId) || StringUtils.isBlank(sendUserId) || operType == null) {
return JSONResult.errorMsg("");
}
// 1. 如果 operType 没有对应的枚举值 则直接抛出空错误信息
if (StringUtils.isBlank(OperatorFriendRequestTypeEnum.getMsgByType(operType))) {
return JSONResult.errorMsg("");
}
// 2. 判断是忽略/通过
if (operType == OperatorFriendRequestTypeEnum.IGNORE.type) {
// 2.1 是忽略 --- 删除好友请求的数据库表记录
userService.deleteFriendRequest(sendUserId, acceptUserId);
} else if (operType == OperatorFriendRequestTypeEnum.PASS.type) {
// 2.2 是通过 --- 增加好友记录到数据库friend表 并 删除好友请求记录的表
userService.passFriendRequest(sendUserId, acceptUserId);
}
// 4.数据库查询好友列表
List<MyFriendsVO> myFriends = userService.queryMyFriends(acceptUserId);
return JSONResult.ok(myFriends);
}
/**
* @description 查询我的好友列表
*/
@RequestMapping("/myFriends")
public JSONResult myFriends(String userId) throws Exception {
System.out.println("查询好友列表");
// 0. 判断userId不能为空
if (StringUtils.isBlank(userId)) {
return JSONResult.errorMsg("");
}
// 1.数据库查询好友列表
List<MyFriendsVO> myFriends = userService.queryMyFriends(userId);
return JSONResult.ok(myFriends);
}
/**
* @description: 用户获取未读消息列表
*/
@RequestMapping("/getUnReadMsgList")
public JSONResult getUnReadMsgList(String acceptUserId) {
// 0.判断 userId 不能为空
if (StringUtils.isBlank(acceptUserId)) {
return JSONResult.errorMsg("");
}
// 查询列表
List<ChatMsg> unReadMsgList = userService.getUnReadMsgList(acceptUserId);
return JSONResult.ok(unReadMsgList);
}
}
| [
"[email protected]"
]
| |
a2f5ff060336960fe5d2bf137ff676b74c48c761 | 708a962cf80a1be1931c4788febd71df3e218c31 | /springcloud-provider-hystrix-payment-8001/src/main/java/com/yezi/springcloud/service/PaymentService.java | 61766e662ccc834ea77f9cb5d51b308a0880b130 | []
| no_license | yezis/springcloud2020 | 4902712fd45ccedb5adf5c95121fb483b54bd564 | bcf9b74efc02adcaeb94e254d6449b959649eb84 | refs/heads/master | 2023-06-18T09:25:59.574537 | 2021-07-12T07:26:15 | 2021-07-12T07:26:15 | 384,900,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,465 | java | package com.yezi.springcloud.service;
import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import org.springframework.stereotype.Service;
import java.util.concurrent.TimeUnit;
@Service
@DefaultProperties(defaultFallback = "defaultFallBack")
public class PaymentService {
public String paymentInfo_OK(Integer id) {
return "线程: " + Thread.currentThread().getName() + " paymentInfo_OK, id: " + id;
}
/*@HystrixCommand(fallbackMethod = "paymentInfo_TimeOutFallBack", commandProperties = {
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "3000")
})*/
@HystrixCommand
public String paymentInfo_TimeOut(Integer id) {
long time = 5;
try {
TimeUnit.SECONDS.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace();
}
return "线程: " + Thread.currentThread().getName() + " paymentInfo_TimeOut, id: " + id + " 耗时(s):" + time;
}
public String paymentInfo_TimeOutFallBack(Integer id) {
return "线程: " + Thread.currentThread().getName() + " 这个请求超时或者出错,请稍后再试 id: " + id;
}
public String defaultFallBack() {
return "这是一个默认的降级提示方法";
}
}
| [
"[email protected]"
]
| |
aa4247f03a192ab63a855c546b9ccaa43bc8d7d9 | e3afb5bec33cf49591e0b77e9608a3b323a4f0b7 | /screen/src/main/java/com/osprey/screen/BlackListItem.java | fc23fd277c4b5d90182994be452128c88cff34fc | []
| no_license | olschofkah/osprey-jcore | 143a5fb6d251d22fb81ce8d702168ff6d2603417 | dae60209c42d613c0fba2aa1901cd57917bdcf5c | refs/heads/master | 2021-03-20T02:38:11.587875 | 2017-11-07T21:38:54 | 2017-11-07T21:38:54 | 60,883,328 | 0 | 0 | null | 2017-11-07T22:29:22 | 2016-06-11T00:00:44 | Java | UTF-8 | Java | false | false | 203 | java | package com.osprey.screen;
public class BlackListItem {
private String symbol;
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
}
| [
"[email protected]"
]
| |
df65f3a01c3564caaa33dd2468944bb7f247ee3f | 5a8f934c734e93190b216cd1afe039f3fc791501 | /app/src/main/java/com/example/mnm_crm_android/RecyclerViewAdapter.java | 63ef783fa5a0862c31fe3a862a9e57455f20d4bc | []
| no_license | ngarces/MNM-CRM-Android-HW3 | 7a1588c7522dfb23500e41465112bb655e4be14a | b314438173d71f0dc9c28e479e2a6b587827a19c | refs/heads/master | 2020-05-07T15:28:02.541058 | 2019-04-19T17:51:42 | 2019-04-19T17:51:42 | 180,637,615 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,804 | java | package com.example.mnm_crm_android;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by Megan Williamson March 2019
*/
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final String TAG = "RecyclerViewAdapter";
private ArrayList<String> mnmImageNames = new ArrayList<>();
private ArrayList<String> mnmImages = new ArrayList<>();
private Context mnmContext;
public RecyclerViewAdapter(ArrayList<String> imageNames, ArrayList<String> image, Context context){
mnmImageNames = imageNames;
mnmImages = image;
mnmContext = context;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_listitem, parent, false);
ViewHolder holder = new ViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
}
//changes based on what the layout should look like.
public void onBindViewHolder(ViewHolder holder, final int position) {
Log.d(TAG, "onBindViewHolder: called.");
Glide.with(mnmContext)
.asBitmap()
.load(mnmImages.get(position))
.into(holder.image);
holder.imageName.setText(mnmImageNames.get(position));
holder.parentLayout.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
Log.d(TAG, "onClick: clicked on: " + mnmImageNames.get(position));
Toast.makeText(mnmContext, mnmImageNames.get(position), Toast.LENGTH_SHORT).show();
}
});
}
@Override
public int getItemCount() {
return mnmImageNames.size();
}
//Holds the view and gets ready to add the next one
public class ViewHolder extends RecyclerView.ViewHolder{
CircleImageView image;
TextView imageName;
RelativeLayout parentLayout;
public ViewHolder(@NonNull View itemView) {
super(itemView);
image = itemView.findViewById(R.id.image);
imageName = itemView.findViewById(R.id.image_name);
parentLayout = itemView.findViewById(R.id.parent_Layout);
}
}
}
| [
"[email protected]"
]
| |
55e4da644c0e570ad3592ce9060b18fdb12303fe | 35a583b9b13a4dcfa813272d09963cd6e19d6df8 | /app/src/main/java/com/example/simpletodo/MainActivity.java | c223467f14bd58e175b7198fe27b240a364656c8 | [
"Apache-2.0"
]
| permissive | salvillalon45/codepath-SimpleTodo | 08302c89dafb4dafbfc148091429ecc453f89cf4 | f24baf6fd4bbd7b3ed93981012cdfc084d3fa787 | refs/heads/master | 2021-04-11T15:28:34.702203 | 2020-03-21T18:36:07 | 2020-03-21T18:36:07 | 249,033,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,240 | java | package com.example.simpletodo;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
public static final String KEY_ITEM_TEXT = "item_text";
public static final String KEY_ITEM_POSITION = "item_position";
public static final int EDIT_TEXT_CODE = 20;
List<String> items;
Button btnAdd;
EditText etItem;
RecyclerView rvItems;
ItemsAdapter itemsAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnAdd = findViewById(R.id.btnAdd);
etItem = findViewById(R.id.etItem);
rvItems = findViewById(R.id.rvItems);
loadItems();
// Adding logic when the user long clicks on a list item
ItemsAdapter.OnLongClickListener onLongClickListener = new ItemsAdapter.OnLongClickListener() {
@Override
public void onItemLongClick(int position) {
// Delete the item from the model
items.remove(position);
// Notify the adapter
itemsAdapter.notifyItemRemoved(position);
Toast.makeText(getApplicationContext(), "Item was removed", Toast.LENGTH_SHORT).show();
saveItems();
}
};
ItemsAdapter.OnClickListener onClickListener = new ItemsAdapter.OnClickListener() {
@Override
public void onItemClicked(int position) {
Log.d("MainActivity", "Single click at position " + position);
// Create the new edit activity
// Here we are going from MainActivity to Edit Activity
Intent i = new Intent(MainActivity.this, EditActivity.class);
// Pass the data being edited
i.putExtra(KEY_ITEM_TEXT, items.get(position));
i.putExtra(KEY_ITEM_POSITION, position);
// Display the activity
startActivityForResult(i, EDIT_TEXT_CODE);
}
};
itemsAdapter = new ItemsAdapter(items, onLongClickListener, onClickListener);
rvItems.setAdapter(itemsAdapter);
rvItems.setLayoutManager(new LinearLayoutManager(this));
// Adding logic to when user clicks on the button
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String todoItem = etItem.getText().toString();
// Add item to the model
items.add(todoItem);
// Notify adapter that an item is inserted
itemsAdapter.notifyItemInserted(items.size() - 1);
etItem.setText("");
Toast.makeText(getApplicationContext(), "Item was added", Toast.LENGTH_SHORT).show();
saveItems();
}
});
}
// Handle the result of the edit activity
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (resultCode == RESULT_OK && requestCode == EDIT_TEXT_CODE) {
// Retrieve the updated text value
String itemText = data.getStringExtra(KEY_ITEM_TEXT);
// Extract original position of the edited item from the position key
int position = data.getExtras().getInt(KEY_ITEM_POSITION);
// Update the model at the right position with the new item text
items.set(position, itemText);
// Notify adapter to show that something has changed
itemsAdapter.notifyItemChanged(position);
// Persist the changes
saveItems();
Toast.makeText(getApplicationContext(), "Item updated successfully", Toast.LENGTH_SHORT).show();
}
else {
Log.w("MainActivity", "Unknown call to onActivityResult");
}
}
private File getDataFile() {
return new File(getFilesDir(), "data.txt");
}
// This function will load items by reading every line of the data file
private void loadItems() {
try {
items = new ArrayList<>(FileUtils.readLines(getDataFile(), Charset.defaultCharset()));
}
catch (IOException e) {
Log.e("MainActivity", "Error reading items", e);
items = new ArrayList<>();
}
}
// This function saves items by writing them into the data file
private void saveItems() {
try {
FileUtils.writeLines(getDataFile(), items);
}
catch (IOException e) {
Log.e("MainActivity", "Error writing items", e);
}
}
}
| [
"[email protected]"
]
| |
a5aad8f2cd7175419aa70ed61ea3f10c2d5c7f13 | 5ffa6832193e74ca024fe28fa5339fefb4f4066e | /src/main/java/oop/assignment2/ex26/Application.java | e3588811ee605218e47a273eed1653a1cdcec085 | []
| no_license | Awesome-wolf-101/ashby-cop3330-assignment2 | 7a061dd97b554b58cdf4a94fef4146a7b3368de6 | 06b0a2f217b5f5a1a13c6dc7e518e60f090dcdea | refs/heads/master | 2023-05-20T16:01:31.726225 | 2021-06-14T03:01:47 | 2021-06-14T03:01:47 | 376,626,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,388 | java | /*
* UCF COP3330 Summer 2021 Assignment 2 Solution
* Copyright 2021 Joshua Ashby
*/
package oop.assignment2.ex26;
import java.util.Scanner;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Application {
private static final Scanner in = new Scanner(System.in);
private static String inputString1;
private static String inputString2;
private static String inputString3;
public static void main(String[] args){
PaymentCalculator Paymentcalculator = new PaymentCalculator();
inputTime();
double b = Double.parseDouble(inputString1);
double APR = Double.parseDouble(inputString2);
double p = Double.parseDouble(inputString3);
int n = Paymentcalculator.calculateMonthsUntilPaidOff(b, p, APR);
String OutputString = OutPutGenerator(n);
System.out.println(OutputString);
}
public static void inputTime()
{
System.out.println("What is your balance?");
inputString1 = in.next();
System.out.println("What is the APR on the card (as a percent)?");
inputString2 = in.next();
System.out.println("What is the monthly payment you can make?");
inputString3 = in.next();
}
public static String OutPutGenerator(int n)
{
return "It will take you " + n + " months to pay off this card.";
}
}
| [
"[email protected]"
]
| |
77d6b10b299633726767aea92968b825ad116b33 | a2d4bec9812e129e28a63507da7b3aa3f96f5787 | /com/google/android/gms/drive/realtime/internal/event/TextDeletedDetails.java | 2a20d463215485a7534e74abb3ab8de56ce79d9e | []
| no_license | achoraev/RealRacingSource | c5720b4a4437e96c356e88e225a8d0f812e3520a | 9bc98f4708c8f67c388b35d756e3c3517572163e | refs/heads/master | 2020-04-17T16:47:58.342025 | 2015-04-22T06:52:40 | 2015-04-22T06:52:40 | 34,332,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | package com.google.android.gms.drive.realtime.internal.event;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
public class TextDeletedDetails
implements SafeParcelable
{
public static final Parcelable.Creator<TextDeletedDetails> CREATOR = new e();
final int BR;
final int RL;
final int mIndex;
TextDeletedDetails(int paramInt1, int paramInt2, int paramInt3)
{
this.BR = paramInt1;
this.mIndex = paramInt2;
this.RL = paramInt3;
}
public int describeContents()
{
return 0;
}
public void writeToParcel(Parcel paramParcel, int paramInt)
{
e.a(this, paramParcel, paramInt);
}
}
/* Location: E:\Dropbox\Dropbox\RealRacingHack\Decompile\install_dex2jar.jar
* Qualified Name: com.google.android.gms.drive.realtime.internal.event.TextDeletedDetails
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
]
| |
8a61a2bb797ca54b3c0f4d84f8863775877321d1 | cbd14440ab37698e4c81031d4c9262000b397adc | /cleanandroidcode/src/main/java/info/piwai/cleanandroidcode/base/BaseModule.java | a37973d688ba52d4ec777d15a29370233e8f27cb | []
| no_license | sinojelly/CleanAndroidCode | a42bf0e6bd029aa78f9540780c8c7630410cb55b | dc3619f77f608336ef8811673612327be80e2a4e | refs/heads/master | 2021-01-18T06:25:14.616599 | 2013-06-22T05:24:20 | 2013-06-22T05:24:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package info.piwai.cleanandroidcode.base;
import javax.inject.Singleton;
import com.squareup.otto.Bus;
import dagger.Module;
import dagger.Provides;
@Module
public class BaseModule {
@Provides
@Singleton
Bus provideBus() {
return new Bus();
}
}
| [
"[email protected]"
]
| |
9269b1bced77b0d4095224167ad4497d727a3c04 | 45d9b5637e5ceed19005beeacf4b4508a3b2a5fb | /library-manager/domain/src/com/kooobao/lm/finance/FinanceOperationService.java | c00964d3481ba57c76b16b9394bb049cc01739e6 | []
| no_license | harperjiang/kooobao-website | c15a77eeb6a3cef35483752af557f37cfb193c33 | ba256ff15d4158a68b66c40b58b2921fce22af94 | refs/heads/master | 2021-01-10T21:21:09.087650 | 2013-07-16T01:22:37 | 2013-07-16T01:22:37 | 32,114,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package com.kooobao.lm.finance;
import java.math.BigDecimal;
import com.kooobao.lm.profile.entity.Visitor;
public interface FinanceOperationService {
void changeVisitorDeposit(Visitor v, BigDecimal change, String comment,
String operatorId);
}
| [
"[email protected]@0fce3ec8-7071-de33-013e-020e0f3b7730"
]
| [email protected]@0fce3ec8-7071-de33-013e-020e0f3b7730 |
3006f7eced93b030d1300c2ef9966fd49ddbdb64 | 7cdebabdc3d1f0436bc6d5a01be11c006702fa46 | /QueueIT.Security/src/queueit/security/uribuilder/HierarchicalUriComponents.java | 8866be550084f30a2ccbdfdad577029b6778d26a | [
"MIT"
]
| permissive | queueit/QueueIT.Security-JavaEE | 4059dc9360d69a5b7fd0a6a674a9e7ab6d15c195 | 59490de4cfea79730f555ec8a295de8f6fce6c76 | refs/heads/master | 2021-01-15T19:40:23.692719 | 2020-08-17T09:18:27 | 2020-08-17T09:18:27 | 16,279,695 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 23,062 | java | /*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package queueit.security.uribuilder;
import java.io.ByteArrayOutputStream;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Extension of {@link UriComponents} for hierarchical URIs.
*
* @author Arjen Poutsma
* @author Phillip Webb
* @since 3.1.3
* @see <a href="http://tools.ietf.org/html/rfc3986#section-1.2.3">Hierarchical URIs</a>
*/
@SuppressWarnings("serial")
final class HierarchicalUriComponents extends UriComponents {
private static final char PATH_DELIMITER = '/';
private final String userInfo;
private final String host;
private final int port;
private final PathComponent path;
private final MultiValueMap<String, String> queryParams;
private final boolean encoded;
/**
* Package-private constructor. All arguments are optional, and can be {@code null}.
* @param scheme the scheme
* @param userInfo the user info
* @param host the host
* @param port the port
* @param path the path
* @param queryParams the query parameters
* @param fragment the fragment
* @param encoded whether the components are already encoded
* @param verify whether the components need to be checked for illegal characters
*/
HierarchicalUriComponents(String scheme, String userInfo, String host, int port, PathComponent path,
MultiValueMap<String, String> queryParams, String fragment, boolean encoded, boolean verify) {
super(scheme, fragment);
this.userInfo = userInfo;
this.host = host;
this.port = port;
this.path = path != null ? path : NULL_PATH_COMPONENT;
this.queryParams = CollectionUtils.unmodifiableMultiValueMap(
queryParams != null ? queryParams : new LinkedMultiValueMap<String, String>(0));
this.encoded = encoded;
if (verify) {
verify();
}
}
// component getters
@Override
public String getSchemeSpecificPart() {
return null;
}
@Override
public String getUserInfo() {
return this.userInfo;
}
@Override
public String getHost() {
return this.host;
}
@Override
public int getPort() {
return this.port;
}
@Override
public String getPath() {
return this.path.getPath();
}
@Override
public List<String> getPathSegments() {
return this.path.getPathSegments();
}
@Override
public String getQuery() {
if (!this.queryParams.isEmpty()) {
StringBuilder queryBuilder = new StringBuilder();
for (Map.Entry<String, List<String>> entry : this.queryParams.entrySet()) {
String name = entry.getKey();
List<String> values = entry.getValue();
if (CollectionUtils.isEmpty(values)) {
if (queryBuilder.length() != 0) {
queryBuilder.append('&');
}
queryBuilder.append(name);
}
else {
for (Object value : values) {
if (queryBuilder.length() != 0) {
queryBuilder.append('&');
}
queryBuilder.append(name);
if (value != null) {
queryBuilder.append('=');
queryBuilder.append(value.toString());
}
}
}
}
return queryBuilder.toString();
}
else {
return null;
}
}
/**
* Returns the map of query parameters. Empty if no query has been set.
*/
@Override
public MultiValueMap<String, String> getQueryParams() {
return this.queryParams;
}
// encoding
/**
* Encodes all URI components using their specific encoding rules, and returns the result as a new
* {@code UriComponents} instance.
* @param encoding the encoding of the values contained in this map
* @return the encoded uri components
* @throws UnsupportedEncodingException if the given encoding is not supported
*/
@Override
public HierarchicalUriComponents encode(String encoding) throws UnsupportedEncodingException {
if (this.encoded) {
return this;
}
String encodedScheme = encodeUriComponent(this.getScheme(), encoding, Type.SCHEME);
String encodedUserInfo = encodeUriComponent(this.userInfo, encoding, Type.USER_INFO);
String encodedHost = encodeUriComponent(this.host, encoding, Type.HOST);
PathComponent encodedPath = this.path.encode(encoding);
MultiValueMap<String, String> encodedQueryParams =
new LinkedMultiValueMap<String, String>(this.queryParams.size());
for (Map.Entry<String, List<String>> entry : this.queryParams.entrySet()) {
String encodedName = encodeUriComponent(entry.getKey(), encoding, Type.QUERY_PARAM);
List<String> encodedValues = new ArrayList<String>(entry.getValue().size());
for (String value : entry.getValue()) {
String encodedValue = encodeUriComponent(value, encoding, Type.QUERY_PARAM);
encodedValues.add(encodedValue);
}
encodedQueryParams.put(encodedName, encodedValues);
}
String encodedFragment = encodeUriComponent(this.getFragment(), encoding, Type.FRAGMENT);
return new HierarchicalUriComponents(encodedScheme, encodedUserInfo, encodedHost, this.port, encodedPath,
encodedQueryParams, encodedFragment, true, false);
}
/**
* Encodes the given source into an encoded String using the rules specified
* by the given component and with the given options.
* @param source the source string
* @param encoding the encoding of the source string
* @param type the URI component for the source
* @return the encoded URI
* @throws IllegalArgumentException when the given uri parameter is not a valid URI
*/
static String encodeUriComponent(String source, String encoding, Type type) throws UnsupportedEncodingException {
if (source == null) {
return null;
}
byte[] bytes = encodeBytes(source.getBytes(encoding), type);
return new String(bytes, "US-ASCII");
}
private static byte[] encodeBytes(byte[] source, Type type) {
ByteArrayOutputStream bos = new ByteArrayOutputStream(source.length);
for (byte b : source) {
if (b < 0) {
b += 256;
}
if (type.isAllowed(b)) {
bos.write(b);
}
else {
bos.write('%');
char hex1 = Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, 16));
char hex2 = Character.toUpperCase(Character.forDigit(b & 0xF, 16));
bos.write(hex1);
bos.write(hex2);
}
}
return bos.toByteArray();
}
// verifying
/**
* Verifies all URI components to determine whether they contain any illegal
* characters, throwing an {@code IllegalArgumentException} if so.
* @throws IllegalArgumentException if any component has illegal characters
*/
private void verify() {
if (!this.encoded) {
return;
}
verifyUriComponent(getScheme(), Type.SCHEME);
verifyUriComponent(userInfo, Type.USER_INFO);
verifyUriComponent(host, Type.HOST);
this.path.verify();
for (Map.Entry<String, List<String>> entry : queryParams.entrySet()) {
verifyUriComponent(entry.getKey(), Type.QUERY_PARAM);
for (String value : entry.getValue()) {
verifyUriComponent(value, Type.QUERY_PARAM);
}
}
verifyUriComponent(getFragment(), Type.FRAGMENT);
}
private static void verifyUriComponent(String source, Type type) {
if (source == null) {
return;
}
int length = source.length();
for (int i=0; i < length; i++) {
char ch = source.charAt(i);
if (ch == '%') {
if ((i + 2) < length) {
char hex1 = source.charAt(i + 1);
char hex2 = source.charAt(i + 2);
int u = Character.digit(hex1, 16);
int l = Character.digit(hex2, 16);
if (u == -1 || l == -1) {
throw new IllegalArgumentException("Invalid encoded sequence \"" + source.substring(i) + "\"");
}
i += 2;
}
else {
throw new IllegalArgumentException("Invalid encoded sequence \"" + source.substring(i) + "\"");
}
}
else if (!type.isAllowed(ch)) {
throw new IllegalArgumentException(
"Invalid character '" + ch + "' for " + type.name() + " in \"" + source + "\"");
}
}
}
// expanding
@Override
protected HierarchicalUriComponents expandInternal(UriTemplateVariables uriVariables) {
String expandedScheme = expandUriComponent(this.getScheme(), uriVariables);
String expandedUserInfo = expandUriComponent(this.userInfo, uriVariables);
String expandedHost = expandUriComponent(this.host, uriVariables);
PathComponent expandedPath = this.path.expand(uriVariables);
MultiValueMap<String, String> expandedQueryParams =
new LinkedMultiValueMap<String, String>(this.queryParams.size());
for (Map.Entry<String, List<String>> entry : this.queryParams.entrySet()) {
String expandedName = expandUriComponent(entry.getKey(), uriVariables);
List<String> expandedValues = new ArrayList<String>(entry.getValue().size());
for (String value : entry.getValue()) {
String expandedValue = expandUriComponent(value, uriVariables);
expandedValues.add(expandedValue);
}
expandedQueryParams.put(expandedName, expandedValues);
}
String expandedFragment = expandUriComponent(this.getFragment(), uriVariables);
return new HierarchicalUriComponents(expandedScheme, expandedUserInfo, expandedHost, this.port, expandedPath,
expandedQueryParams, expandedFragment, false, false);
}
/**
* Normalize the path removing sequences like "path/..".
* @see StringUtils#cleanPath(String)
*/
@Override
public UriComponents normalize() {
String normalizedPath = StringUtils.cleanPath(getPath());
return new HierarchicalUriComponents(getScheme(), this.userInfo, this.host,
this.port, new FullPathComponent(normalizedPath), this.queryParams,
getFragment(), this.encoded, false);
}
// other functionality
/**
* Returns a URI string from this {@code UriComponents} instance.
*/
@Override
public String toUriString() {
StringBuilder uriBuilder = new StringBuilder();
if (getScheme() != null) {
uriBuilder.append(getScheme());
uriBuilder.append(':');
}
if (this.userInfo != null || this.host != null) {
uriBuilder.append("//");
if (this.userInfo != null) {
uriBuilder.append(this.userInfo);
uriBuilder.append('@');
}
if (this.host != null) {
uriBuilder.append(host);
}
if (this.port != -1) {
uriBuilder.append(':');
uriBuilder.append(port);
}
}
String path = getPath();
if (StringUtils.hasLength(path)) {
if (uriBuilder.length() != 0 && path.charAt(0) != PATH_DELIMITER) {
uriBuilder.append(PATH_DELIMITER);
}
uriBuilder.append(path);
}
String query = getQuery();
if (query != null) {
uriBuilder.append('?');
uriBuilder.append(query);
}
if (getFragment() != null) {
uriBuilder.append('#');
uriBuilder.append(getFragment());
}
return uriBuilder.toString();
}
/**
* Returns a {@code URI} from this {@code UriComponents} instance.
*/
@Override
public URI toUri() {
try {
if (this.encoded) {
return new URI(toString());
}
else {
String path = getPath();
if (StringUtils.hasLength(path) && path.charAt(0) != PATH_DELIMITER) {
// Only prefix the path delimiter if something exists before it
if(getScheme() != null || getUserInfo() != null || getHost() != null || getPort() != -1) {
path = PATH_DELIMITER + path;
}
}
return new URI(getScheme(), getUserInfo(), getHost(), getPort(), path, getQuery(),
getFragment());
}
}
catch (URISyntaxException ex) {
throw new IllegalStateException("Could not create URI object: " + ex.getMessage(), ex);
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof HierarchicalUriComponents)) {
return false;
}
HierarchicalUriComponents other = (HierarchicalUriComponents) obj;
return ObjectUtils.nullSafeEquals(getScheme(), other.getScheme()) &&
ObjectUtils.nullSafeEquals(getUserInfo(), other.getUserInfo()) &&
ObjectUtils.nullSafeEquals(getHost(), other.getHost()) &&
getPort() == other.getPort() &&
this.path.equals(other.path) &&
this.queryParams.equals(other.queryParams) &&
ObjectUtils.nullSafeEquals(getFragment(), other.getFragment());
}
@Override
public int hashCode() {
int result = ObjectUtils.nullSafeHashCode(getScheme());
result = 31 * result + ObjectUtils.nullSafeHashCode(this.userInfo);
result = 31 * result + ObjectUtils.nullSafeHashCode(this.host);
result = 31 * result + this.port;
result = 31 * result + this.path.hashCode();
result = 31 * result + this.queryParams.hashCode();
result = 31 * result + ObjectUtils.nullSafeHashCode(getFragment());
return result;
}
// inner types
/**
* Enumeration used to identify the parts of a URI.
* <p>Contains methods to indicate whether a given character is valid in a specific URI component.
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>
*/
static enum Type {
SCHEME {
@Override
public boolean isAllowed(int c) {
return isAlpha(c) || isDigit(c) || '+' == c || '-' == c || '.' == c;
}
},
AUTHORITY {
@Override
public boolean isAllowed(int c) {
return isUnreserved(c) || isSubDelimiter(c) || ':' == c || '@' == c;
}
},
USER_INFO {
@Override
public boolean isAllowed(int c) {
return isUnreserved(c) || isSubDelimiter(c) || ':' == c;
}
},
HOST {
@Override
public boolean isAllowed(int c) {
return isUnreserved(c) || isSubDelimiter(c);
}
},
PORT {
@Override
public boolean isAllowed(int c) {
return isDigit(c);
}
},
PATH {
@Override
public boolean isAllowed(int c) {
return isPchar(c) || '/' == c;
}
},
PATH_SEGMENT {
@Override
public boolean isAllowed(int c) {
return isPchar(c);
}
},
QUERY {
@Override
public boolean isAllowed(int c) {
return isPchar(c) || '/' == c || '?' == c;
}
},
QUERY_PARAM {
@Override
public boolean isAllowed(int c) {
if ('=' == c || '+' == c || '&' == c) {
return false;
}
else {
return isPchar(c) || '/' == c || '?' == c;
}
}
},
FRAGMENT {
@Override
public boolean isAllowed(int c) {
return isPchar(c) || '/' == c || '?' == c;
}
};
/**
* Indicates whether the given character is allowed in this URI component.
* @return {@code true} if the character is allowed; {@code false} otherwise
*/
public abstract boolean isAllowed(int c);
/**
* Indicates whether the given character is in the {@code ALPHA} set.
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986, appendix A</a>
*/
protected boolean isAlpha(int c) {
return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
}
/**
* Indicates whether the given character is in the {@code DIGIT} set.
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986, appendix A</a>
*/
protected boolean isDigit(int c) {
return c >= '0' && c <= '9';
}
/**
* Indicates whether the given character is in the {@code gen-delims} set.
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986, appendix A</a>
*/
protected boolean isGenericDelimiter(int c) {
return ':' == c || '/' == c || '?' == c || '#' == c || '[' == c || ']' == c || '@' == c;
}
/**
* Indicates whether the given character is in the {@code sub-delims} set.
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986, appendix A</a>
*/
protected boolean isSubDelimiter(int c) {
return '!' == c || '$' == c || '&' == c || '\'' == c || '(' == c || ')' == c || '*' == c || '+' == c ||
',' == c || ';' == c || '=' == c;
}
/**
* Indicates whether the given character is in the {@code reserved} set.
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986, appendix A</a>
*/
protected boolean isReserved(char c) {
return isGenericDelimiter(c) || isReserved(c);
}
/**
* Indicates whether the given character is in the {@code unreserved} set.
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986, appendix A</a>
*/
protected boolean isUnreserved(int c) {
return isAlpha(c) || isDigit(c) || '-' == c || '.' == c || '_' == c || '~' == c;
}
/**
* Indicates whether the given character is in the {@code pchar} set.
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986, appendix A</a>
*/
protected boolean isPchar(int c) {
return isUnreserved(c) || isSubDelimiter(c) || ':' == c || '@' == c;
}
}
/**
* Defines the contract for path (segments).
*/
interface PathComponent extends Serializable {
String getPath();
List<String> getPathSegments();
PathComponent encode(String encoding) throws UnsupportedEncodingException;
void verify();
PathComponent expand(UriTemplateVariables uriVariables);
}
/**
* Represents a path backed by a string.
*/
static final class FullPathComponent implements PathComponent {
private final String path;
public FullPathComponent(String path) {
this.path = path;
}
@Override
public String getPath() {
return path;
}
@Override
public List<String> getPathSegments() {
String delimiter = new String(new char[]{PATH_DELIMITER});
String[] pathSegments = StringUtils.tokenizeToStringArray(path, delimiter);
return Collections.unmodifiableList(Arrays.asList(pathSegments));
}
@Override
public PathComponent encode(String encoding) throws UnsupportedEncodingException {
String encodedPath = encodeUriComponent(getPath(),encoding, Type.PATH);
return new FullPathComponent(encodedPath);
}
@Override
public void verify() {
verifyUriComponent(this.path, Type.PATH);
}
@Override
public PathComponent expand(UriTemplateVariables uriVariables) {
String expandedPath = expandUriComponent(getPath(), uriVariables);
return new FullPathComponent(expandedPath);
}
@Override
public boolean equals(Object obj) {
return (this == obj || (obj instanceof FullPathComponent &&
getPath().equals(((FullPathComponent) obj).getPath())));
}
@Override
public int hashCode() {
return getPath().hashCode();
}
}
/**
* Represents a path backed by a string list (i.e. path segments).
*/
static final class PathSegmentComponent implements PathComponent {
private final List<String> pathSegments;
public PathSegmentComponent(List<String> pathSegments) {
this.pathSegments = Collections.unmodifiableList(pathSegments);
}
@Override
public String getPath() {
StringBuilder pathBuilder = new StringBuilder();
pathBuilder.append(PATH_DELIMITER);
for (Iterator<String> iterator = this.pathSegments.iterator(); iterator.hasNext(); ) {
String pathSegment = iterator.next();
pathBuilder.append(pathSegment);
if (iterator.hasNext()) {
pathBuilder.append(PATH_DELIMITER);
}
}
return pathBuilder.toString();
}
@Override
public List<String> getPathSegments() {
return this.pathSegments;
}
@Override
public PathComponent encode(String encoding) throws UnsupportedEncodingException {
List<String> pathSegments = getPathSegments();
List<String> encodedPathSegments = new ArrayList<String>(pathSegments.size());
for (String pathSegment : pathSegments) {
String encodedPathSegment = encodeUriComponent(pathSegment, encoding, Type.PATH_SEGMENT);
encodedPathSegments.add(encodedPathSegment);
}
return new PathSegmentComponent(encodedPathSegments);
}
@Override
public void verify() {
for (String pathSegment : getPathSegments()) {
verifyUriComponent(pathSegment, Type.PATH_SEGMENT);
}
}
@Override
public PathComponent expand(UriTemplateVariables uriVariables) {
List<String> pathSegments = getPathSegments();
List<String> expandedPathSegments = new ArrayList<String>(pathSegments.size());
for (String pathSegment : pathSegments) {
String expandedPathSegment = expandUriComponent(pathSegment, uriVariables);
expandedPathSegments.add(expandedPathSegment);
}
return new PathSegmentComponent(expandedPathSegments);
}
@Override
public boolean equals(Object obj) {
return (this == obj || (obj instanceof PathSegmentComponent &&
getPathSegments().equals(((PathSegmentComponent) obj).getPathSegments())));
}
@Override
public int hashCode() {
return getPathSegments().hashCode();
}
}
/**
* Represents a collection of PathComponents.
*/
static final class PathComponentComposite implements PathComponent {
private final List<PathComponent> pathComponents;
public PathComponentComposite(List<PathComponent> pathComponents) {
this.pathComponents = pathComponents;
}
@Override
public String getPath() {
StringBuilder pathBuilder = new StringBuilder();
for (PathComponent pathComponent : this.pathComponents) {
pathBuilder.append(pathComponent.getPath());
}
return pathBuilder.toString();
}
@Override
public List<String> getPathSegments() {
List<String> result = new ArrayList<String>();
for (PathComponent pathComponent : this.pathComponents) {
result.addAll(pathComponent.getPathSegments());
}
return result;
}
@Override
public PathComponent encode(String encoding) throws UnsupportedEncodingException {
List<PathComponent> encodedComponents = new ArrayList<PathComponent>(this.pathComponents.size());
for (PathComponent pathComponent : this.pathComponents) {
encodedComponents.add(pathComponent.encode(encoding));
}
return new PathComponentComposite(encodedComponents);
}
@Override
public void verify() {
for (PathComponent pathComponent : this.pathComponents) {
pathComponent.verify();
}
}
@Override
public PathComponent expand(UriTemplateVariables uriVariables) {
List<PathComponent> expandedComponents = new ArrayList<PathComponent>(this.pathComponents.size());
for (PathComponent pathComponent : this.pathComponents) {
expandedComponents.add(pathComponent.expand(uriVariables));
}
return new PathComponentComposite(expandedComponents);
}
}
/**
* Represents an empty path.
*/
static final PathComponent NULL_PATH_COMPONENT = new PathComponent() {
@Override
public String getPath() {
return null;
}
@Override
public List<String> getPathSegments() {
return Collections.emptyList();
}
@Override
public PathComponent encode(String encoding) throws UnsupportedEncodingException {
return this;
}
@Override
public void verify() {
}
@Override
public PathComponent expand(UriTemplateVariables uriVariables) {
return this;
}
@Override
public boolean equals(Object obj) {
return (this == obj);
}
@Override
public int hashCode() {
return 42;
}
};
} | [
"[email protected]"
]
| |
afbc41898b859b86c916118adb45dce0f4b0f512 | 8e7e6ada1fd4d2cf6ac5ddd95b4a283e33824b6f | /RunningCalculator/RunningCalculator/src/pmg/android/runningcalculator/view/DisplayStringFormatter.java | a75dc72c94c6d9c95165a73d80b54a85d70e4e97 | []
| no_license | possemeeg/android | cfa414dbabcf49925f7d7fda3264b8c6700b4b9a | 261bcdabdeb23586c4811848bc078d28a5115112 | refs/heads/master | 2021-01-18T06:38:42.218348 | 2013-05-27T06:41:23 | 2013-05-27T06:41:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,071 | java | package pmg.android.runningcalculator.view;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import pmg.android.runningcalculator.R;
import pmg.android.runningcalculator.PreferenceValues.UnitFilterValue;
import pmg.android.runningcalculator.data.DistanceConverter;
import pmg.android.runningcalculator.data.DistanceUnit;
import pmg.android.runningcalculator.data.InputValue;
import android.content.res.Resources;
public class DisplayStringFormatter {
private static Calendar calcCalendar = Calendar.getInstance();
private static SimpleDateFormat minSecTimeFormat = new SimpleDateFormat("mm:ss");
private static SimpleDateFormat hourMinSecTimeFormat = new SimpleDateFormat("HH:mm:ss");
public static String formatSecondsAsTime(Resources resources, double seconds) {
if(seconds < 60) return formatSecondsPrecise(resources, seconds);
calcCalendar.set(1969, 1, 12, 0, 0, 0);
calcCalendar.setTimeInMillis(calcCalendar.getTimeInMillis() + (long) (seconds * 1000));
Date time = calcCalendar.getTime();
return time.getHours()>0 ? resources.getString(R.string.hrs_mins_seconds_as_lable, hourMinSecTimeFormat.format(time)) :
resources.getString(R.string.mins_seconds_as_lable, minSecTimeFormat.format(time));
}
private static DecimalFormat distanceFormat = new DecimalFormat("#,##0.###");
public static String formatDistance(double distance){
return distanceFormat.format(distance);
}
private static DecimalFormat secondsFormat = new DecimalFormat("##0.#");
private static String formatSecondsPrecise(Resources resources, double seconds) {
return resources.getString(R.string.precise_seconds_as_lable,secondsFormat.format(seconds));
}
private static DecimalFormat speedFormat = new DecimalFormat("#,##0.##");
public static String formatSpeed(double speed) {
return speedFormat.format(speed);
}
public static String formatPace(Resources resources, double from) {
return formatSecondsAsTime(resources,from);
}
private static DecimalFormat vo2MaxFormat = new DecimalFormat("0");
public static String formatVO2Max(double d) {
return vo2MaxFormat.format(d);
}
public static String formatInputValue(Resources resources, InputValue inputValue){
switch(inputValue.getValueType()){
case TIME_SECONDS:
return resources.getString(R.string.input_value_time,formatSecondsAsTime(resources, inputValue.getValue()));
case DISTANCE_KILOMETRES:
return resources.getString(R.string.input_value_km,formatDistance(inputValue.getValue()));
case DISTANCE_METRES:
return resources.getString(R.string.input_value_m,formatDistance(inputValue.getValue()));
case DISTANCE_TRACKLAPS:
return resources.getString(R.string.input_value_tracklaps,formatDistance(inputValue.getValue()));
case DISTANCE_MILES:
return resources.getString(R.string.input_value_mi,formatDistance(inputValue.getValue()));
case PACE_SEC_PER_KM:
return resources.getString(R.string.input_value_sec_per_km,formatPace(resources,inputValue.getValue()));
case PACE_SEC_PER_MILE:
return resources.getString(R.string.input_value_sec_per_mi,formatPace(resources,inputValue.getValue()));
case SPEED_KPH:
return resources.getString(R.string.input_value_kph,formatSpeed(inputValue.getValue()));
case SPEED_MPH:
return resources.getString(R.string.input_value_mph,formatSpeed(inputValue.getValue()));
}
return "";
}
public static String getFormattedDistance(Resources resources, int distanceInMetres) {
switch(DistanceConverter.estimatePrimaryDistanceUnit(distanceInMetres)){
case MILES:
return resources.getString(R.string.input_value_mi, formatDistance(DistanceConverter.getMetresInMiles(distanceInMetres)));
case METRES:
return resources.getString(R.string.input_value_m,formatDistance(distanceInMetres));
default:
return resources.getString(R.string.input_value_km, formatDistance(DistanceConverter.getMetresInKilometres(distanceInMetres)));
}
}
}
| [
"peter@peter-P5K.(none)"
]
| peter@peter-P5K.(none) |
28ecf5bab8b25908612d7ba6a120fe9dda739580 | 428a80fe171f8dee113c603a52afc8c5cc5c2347 | /src/com/ca/livecoding/repository/mysql/MySqlItemRepository.java | 28c46994f47325bde901e6bbb33d8c35367ef57e | []
| no_license | nrstott/ca-java-tdd | 7359980d764fce12205bfe67e525f7e833cc6205 | 9a4eedaf06620b679c626d54499ea42301bead76 | refs/heads/master | 2021-01-10T20:45:15.539473 | 2014-01-15T22:53:41 | 2014-01-15T22:53:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | package com.ca.livecoding.repository.mysql;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.ca.livecoding.model.Item;
import com.ca.livecoding.repository.ItemRepository;
public class MySqlItemRepository implements ItemRepository {
private Connection connection;
public MySqlItemRepository(Connection connection) {
this.connection = connection;
}
@Override
public Item find(int id) throws SQLException {
PreparedStatement statement =
this.connection.prepareStatement(
"SELECT id, sku, description FROM Item WHERE id = ?");
statement.setInt(1, id);
ResultSet resultSet = statement.executeQuery();
resultSet.first();
int idFromDb = resultSet.getInt(1);
String sku = resultSet.getString(2);
String description = resultSet.getString(3);
return new Item(idFromDb, sku, description);
}
}
| [
"[email protected]"
]
| |
63a89943a4cc4aba14225513b0a3399f0bcff443 | e56bab8212c7e35617af5dd02ee9e581b260ff1c | /events-smvc/src/com/techno/dao/EventTypeDao.java | c95537110576c40bd5c17fe02b24ac44dc4e9d7f | []
| no_license | noumanalisyed/web-eng | eed699365fa81429c785ada86d7afb734343546e | 192ed989169fac60f7501b70200f2df183dfc5e6 | refs/heads/master | 2023-07-05T13:46:54.196181 | 2023-07-05T09:05:05 | 2023-07-05T09:05:05 | 127,851,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.techno.dao;
import com.techno.bean.EventTypes;
import com.techno.bean.Events;
import java.util.List;
public interface EventTypeDao {
public void addEventType(EventTypes eventTypes);
public List<EventTypes> getEventTypes();
public EventTypes getEventType(int eventTypeId);
public void deleteEventType(int eventTypeId);
}
| [
"[email protected]"
]
| |
efc62d294382ec014dbe764d24a084062260fe07 | 15fa30bd8b95b85d30cb39e5cb53f43e2b112427 | /Tasks/src/main/java/TasksEdmProvider.java | 2dc6eff96cd13fbb6c79f873ee2a8adfa5920984 | []
| no_license | dskfgit/tasks | eeb74ea4f1d3f199ad8994aabda38999077b25d9 | d10fbd992114ff8e9e7dec52a4c1739c801157f9 | refs/heads/master | 2020-03-27T18:57:19.208857 | 2018-09-01T01:01:20 | 2018-09-01T01:01:20 | 146,955,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,453 | java |
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.olingo.commons.api.*;
import org.apache.olingo.commons.api.edm.*;
import org.apache.olingo.server.api.edm.provider.*;
public class TasksEdmProvider extends EdmProvider {
// Service Namespace
public static final String NAMESPACE = "";
// EDM Container
public static final String CONTAINER_NAME = "Container";
public static final FullQualifiedName CONTAINER_FQN = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
// Entity Types Names
public static final FullQualifiedName ET_TASK = new FullQualifiedName(NAMESPACE, "Task");
// Entity Set Names
public static final String ES_TASKS_NAME = "Tasks";
@Override
public List<Schema> getSchemas() throws ODataException {
List<Schema> schemas = new ArrayList<Schema>();
Schema schema = new Schema();
schema.setNamespace(NAMESPACE);
// EntityTypes
List<EntityType> entityTypes = new ArrayList<EntityType>();
entityTypes.add(getEntityType(ET_TASK));
schema.setEntityTypes(entityTypes);
// EntityContainer
schema.setEntityContainer(getEntityContainer());
schemas.add(schema);
return schemas;
}
@Override
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
if (ET_TASK.equals(entityTypeName)) {
return new EntityType()
.setName(ET_TASK.getName())
.setKey(Arrays.asList(
new PropertyRef().setPropertyName("Id")))
.setProperties(Arrays.asList(
new Property().setName("Id").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()),
new Property().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()),
new Property().setName("Details").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()),
new Property().setName("DueDate").setType(EdmPrimitiveTypeKind.Date.getFullQualifiedName()),
new Property().setName("Alert").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()),
new Property().setName("Priority").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
));
}
return null;
}
@Override
public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName) throws ODataException {
if (CONTAINER_FQN.equals(entityContainer)) {
if (ES_TASKS_NAME.equals(entitySetName)) {
return new EntitySet()
.setName(ES_TASKS_NAME)
.setType(ET_TASK);
}
}
return null;
}
@Override
public EntityContainer getEntityContainer() throws ODataException {
EntityContainer container = new EntityContainer();
container.setName(CONTAINER_FQN.getName());
// EntitySets
List<EntitySet> entitySets = new ArrayList<EntitySet>();
container.setEntitySets(entitySets);
entitySets.add(getEntitySet(CONTAINER_FQN, ES_TASKS_NAME));
return container;
}
@Override
public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException {
if (entityContainerName == null || CONTAINER_FQN.equals(entityContainerName)) {
return new EntityContainerInfo().setContainerName(CONTAINER_FQN);
}
return null;
}
}
| [
"des@barbaraersimac3"
]
| des@barbaraersimac3 |
288a7c85bfcdfecf13dfbe815a186b954845fce5 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.unifiedtelemetry-UnifiedTelemetry/sources/X/AnonymousClass09.java | 3c75a5871627c1164aeefada03aa56d4cf331238 | []
| no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 1,375 | java | package X;
import com.google.common.annotations.GwtCompatible;
import java.util.concurrent.Callable;
import java.util.concurrent.RunnableFuture;
@GwtCompatible
/* renamed from: X.09 reason: invalid class name */
public final class AnonymousClass09<V> extends AbstractC00030p<V> implements RunnableFuture<V> {
public volatile Bd<?> A00;
@Override // X.AbstractC00136k
public final String pendingToString() {
Bd<?> bd = this.A00;
if (bd == null) {
return super.pendingToString();
}
StringBuilder sb = new StringBuilder("task=[");
sb.append(bd);
sb.append("]");
return sb.toString();
}
public final void run() {
Bd<?> bd = this.A00;
if (bd != null) {
bd.run();
}
this.A00 = null;
}
public AnonymousClass09(Callable<V> callable) {
this.A00 = new UD(this, callable);
}
@Override // X.AbstractC00136k
public final void afterDone() {
Bd<?> bd;
super.afterDone();
if (wasInterrupted() && (bd = this.A00) != null) {
Runnable runnable = (Runnable) bd.get();
if ((runnable instanceof Thread) && bd.compareAndSet(runnable, Bd.A01)) {
((Thread) runnable).interrupt();
bd.set(Bd.A00);
}
}
this.A00 = null;
}
}
| [
"[email protected]"
]
| |
ec44afac0f0fb1bc6bcbded79845a2cb4b657e02 | f2c541d5f3dd640ada0dc22a3ace77b89b28236f | /src/games/Block.java | 1f56990be4c03f7302c6c1babf49a6e301502335 | []
| no_license | rdvonz/Alarm-Clock | b753dc3580ea8ef63d76e6fdc01ac316eb2be948 | be05fe27e711c626059bb4a8cb4c9047c7049eb8 | refs/heads/master | 2020-12-24T17:35:27.459303 | 2011-12-05T21:54:35 | 2011-12-05T21:54:35 | 2,831,994 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package games;
import java.util.ArrayList;
import java.util.Random;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.fills.GradientFill;
import org.newdawn.slick.Color;
public class Block extends Rectangle{
/**
*
*/
private static final long serialVersionUID = 1L;
Random r = new Random();
private int xVel;
private int yVel;
private int x;
private int y;
private int prevBlock=0;
private int[] coords;
public Block(){
super(50, 50, 50, 50);
int vel = 1;
if(r.nextInt(2)==1){
vel = vel*-1;
}
coords = new int[4];
xVel = vel;
yVel = 2;
x = r.nextInt(650)+prevBlock;
prevBlock = x;
System.out.print(x);
y = 0;
System.out.println(prevBlock);
}
public void setLoc(){
super.setLocation(x+=xVel, y+=yVel);
//Update the coordinates
coords[0] = x;
coords[1] = x+50;
coords[2] = y;
coords[3] = y+50;
}
public void setLoc(int x, int y){
this.x = x;
this.y = y;
setLoc();
}
public int[] getCoords(){
return coords;
}
}
| [
"[email protected]"
]
| |
5beef987cb0a7be097624d2bb2e968b889609e76 | 09e212d2b86eae6634eba8fd30f759abc696e7b6 | /app/src/main/java/com/test/yogiyo/yogiyotest/App.java | 9134428d103c6ce8adefd6fe2537f37b27c32318 | []
| no_license | dhkimlucky/yogiyoTest | 0456020929de23cb98b6b2fbff68783277df5441 | fa18ebf0d4dc06eaf8ed24a1a349999d12f9c210 | refs/heads/master | 2021-01-01T19:32:00.627138 | 2017-07-28T10:55:27 | 2017-07-28T10:55:27 | 98,542,609 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,187 | java | package com.test.yogiyo.yogiyotest;
import android.app.Application;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.test.yogiyo.yogiyotest.Model.UserData;
import com.test.yogiyo.yogiyotest.Util.LruBitmapCache;
import java.util.ArrayList;
import java.util.List;
public class App extends Application {
public static final String TAG = App.class.getSimpleName();
private RequestQueue mRequestQueue;
private ImageLoader mImageLoader;
private static App mInstance;
private List<UserData> userDataList, likedUserList;
public static String GITHUBUSER = "https://api.github.com/search/users?q=";
public long totalCount = 0;
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
userDataList = new ArrayList<>();
likedUserList = new ArrayList<>();
}
public static synchronized App getInstance(){
return mInstance;
}
public ImageLoader getImageLoader (){
getRequestQueue();
if(mImageLoader == null){
mImageLoader = new ImageLoader(this.mRequestQueue, new LruBitmapCache());
}
return this.mImageLoader;
}
public List getUserData(){
return userDataList;
}
public List getLikedUserData(){
return likedUserList;
}
public RequestQueue getRequestQueue() {
if(mRequestQueue == null){
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public <T> void addToRequestQueue(Request<T> req){
req.setTag(TAG);
getRequestQueue().add(req);
}
public boolean isConnected(){
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if(netInfo != null && netInfo.isConnectedOrConnecting()){
return true;
}
return false;
}
}
| [
"amdin"
]
| amdin |
5e2b678584f7aa5dfbc6560cc81b208b42729379 | 1c577d3b112c94c0a8d350c6e8a1c373935a9c55 | /Thompson/src/PLHom.java | 037ec3ff359c2ac411a7b79e0a6869354c616cf1 | [
"MIT"
]
| permissive | Daev7997/Thompson-s-Group-T-Calculator | 3ab8f69c0b6d7a41cdc7811a85c7e720a7d7f53c | 732b8650a3984b383a5c2530d36435c4fe51620a | refs/heads/master | 2021-01-01T19:51:31.347719 | 2013-10-09T01:07:06 | 2013-10-09T01:07:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,304 | java | import java.util.Collections;
import java.util.LinkedList;
public class PLHom
{
LinkedList<Corner> corners;
public PLHom()
{
corners = new LinkedList<Corner>();
}
public PLHom copy()
{
PLHom p = new PLHom();
for(int i = 0; i < corners.size(); i++)
{
p.addCorner(corners.get(i));
}
return p;
}
public Corner getCorner(int i)
{
return corners.get(i);
}
public int size()
{
return corners.size();
}
public void addCorner(Corner c)
{
corners.add(c);
remDup();
}
public void addCorner(Dyadic x, Dyadic y)
{
addCorner(new Corner(x, y));
}
public void addCorner(double x, double y)
{
addCorner(new Corner(x, y));
}
public void addCorner(Dyadic y)
{
for(int i = 0; i < corners.size() - 1; i++)
{
if(!wrappingInterval(i))
{
Interval in = new Interval(corners.get(i), corners.get(i+1));
if(in.withinY(y))
{
addCorner(in.fInv(y), y);
return;
}
}
}
}
public Dyadic fInv(Dyadic y)
{
for(int i = 0; i < corners.size() - 1; i++)
{
if(!wrappingInterval(i))
{
Interval in = new Interval(corners.get(i), corners.get(i+1));
if(in.withinY(y))
{
return in.fInv(y);
}
}
}
return null;
}
public Dyadic f(Dyadic x)
{
for(int i = 0; i < corners.size() - 1; i++)
{
if(!wrappingInterval(i))
{
Interval in = new Interval(corners.get(i), corners.get(i+1));
if(in.withinX(x))
{
return in.f(x);
}
}
}
return x;
}
public LinkedList<Corner> getCorners()
{
return corners;
}
public void addRedundantCorners(PLHom p)
{
for(int i = 0; i < corners.size(); i++)
{
p.addCorner(corners.get(i).getX());
}
}
public PLHom compose(PLHom q)
{
PLHom p = q.copy();
remRed();
p.remRed();
addRedundantCorners(p);
LinkedList<Corner> points = p.getCorners();
PLHom r = new PLHom();
for(int i = 0; i < points.size(); i++)
{
Corner c = new Corner(points.get(i).getX(), f(points.get(i).getY()));
r.addCorner(c);
if(c.getY().equals(new Dyadic(1))) //&& !c.getX().equals(new Dyadic(1)) && !c.getX().equals(new Dyadic(0)))
{
r.addCorner(new Corner(c.getX(), new Dyadic(0)));
}
}
r.remRed();
p.remRed();
return r;
}
public void remDup()
{
Collections.sort(corners);
for(int i = 0; i < corners.size()-1; i++)
{
if(corners.get(i).equals(corners.get(i+1)))
{
corners.remove(i+1);
i--;
}
}
}
public void remRed()
{
remDup();
for(int i = 0; i < corners.size() - 2; i++)
{
if(!wrappingInterval(i) && !wrappingInterval(i+1))
if(new Interval(corners.get(i), corners.get(i+1)).equals(new Interval(corners.get(i+1), corners.get(i+2))))
{
corners.remove(i+1);
i--;
}
}
}
public String toString()
{
String r = "";
for(int i = 0; i < corners.size() - 1; i++)
{
if(!wrappingInterval(i))
{
r += new Interval(corners.get(i), corners.get(i+1)) + "\n";
}
}
return r;
}
public String corners()
{
String r = "";
for(int i = 0; i < corners.size(); i++)
{
r += corners.get(i) + "\n";
}
return r;
}
public boolean wrappingInterval(int i)
{
return corners.get(i).getX().equals(corners.get(i+1).getX());
}
public boolean equals(PLHom p)
{
remRed();
p.remRed();
LinkedList<Corner> corners2 = p.getCorners();
if(corners.size() != corners2.size())
{
return false;
}
for(int i = 0; i < corners.size(); i++)
{
if(!corners.get(i).equals(corners2.get(i)))
{
return false;
}
}
return true;
}
public PLHom invert()
{
remRed();
PLHom r = new PLHom();
for(int i = 0; i < corners.size(); i++)
{
r.addCorner(corners.get(i).getY(), corners.get(i).getX());
}
r.remRed();
return r;
}
public boolean isElement()
{
remRed();
if(!corners.get(corners.size()-1).getX().equals(new Dyadic(1)))
{
return false;
}
else if(!corners.get(0).getX().equals(new Dyadic(0)))
{
return false;
}
for(int i = 0; i < corners.size() - 1; i++)
{
if(!wrappingInterval(i))
{
double slope = new Interval(corners.get(i), corners.get(i+1)).getM();
if(Math.floor(Math.log(slope)/Math.log(2))!= Math.log(slope)/Math.log(2))
{
return false;
}
else if(slope <= 0)
{
return false;
}
}
}
return true;
}
}
| [
"[email protected]"
]
| |
cd33c500d0c4e7be72c097557b3f02ed1771e9da | 9bf6dee1407f112cebf42443e0f492e89d0d3fbc | /gameserver/data/scripts/system/handlers/quest/master_craft/_19032AlchemistsPotential.java | 73c294985b94ce487b57aa796549d3b1861a394e | []
| no_license | vavavr00m/aion-source | 6caef6738fee6d4898fcb66079ea63da46f5c9c0 | 8ce4c356d860cf54e5f3fe4a799197725acffc3b | refs/heads/master | 2021-01-10T02:08:43.965463 | 2011-08-22T10:47:12 | 2011-08-22T10:47:12 | 50,949,918 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,038 | java | /*
* This file is part of aion-unique.
*
* aion-unique 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.
*
* aion-unique 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 aion-unique. If not, see <http://www.gnu.org/licenses/>.
*/
package quest.master_craft;
import org.openaion.gameserver.model.gameobjects.player.Player;
import org.openaion.gameserver.quest.handlers.QuestHandler;
import org.openaion.gameserver.quest.model.QuestCookie;
import org.openaion.gameserver.quest.model.QuestState;
import org.openaion.gameserver.quest.model.QuestStatus;
import org.openaion.gameserver.services.QuestService;
public class _19032AlchemistsPotential extends QuestHandler
{
private final static int questId = 19032;
private final static int questStartNpc = 203786;
private final static int secondNpc = 203787;
private final static int[] recipesItemIds = {152202147, 152202148};
private final static int[] recipesIds = {155002185, 155002186};
public _19032AlchemistsPotential()
{
super(questId);
}
@Override
public boolean onDialogEvent(QuestCookie env)
{
Player player = env.getPlayer();
if(defaultQuestNoneDialog(env, questStartNpc, 4762))
return true;
QuestState qs = player.getQuestStateList().getQuestState(questId);
if(qs == null)
return false;
int var = qs.getQuestVarById(0);
if(qs.getStatus() == QuestStatus.START)
{
switch(env.getTargetId())
{
case secondNpc:
switch(env.getDialogId())
{
case 26:
if(var == 0)
return sendQuestDialog(env, 1011);
else if(var == 2)
return sendQuestDialog(env, 4080);
case 10009:
if(player.getInventory().decreaseKinah(251000))
{
defaultQuestGiveItem(env, 152020248, 1);
return defaultCloseDialog(env, var, 1, recipesItemIds[0], 1, 0, 0);
}
else
return sendQuestDialog(env, 4400);
case 10019:
if(player.getInventory().decreaseKinah(334500))
{
defaultQuestGiveItem(env, 152020248, 1);
return defaultCloseDialog(env, var, 1, recipesItemIds[1], 1, 0, 0);
}
else
return sendQuestDialog(env, 4400);
}
break;
case questStartNpc:
switch(env.getDialogId())
{
case 26:
if(var == 1)
return sendQuestDialog(env, 1352);
case 34:
if (var == 1)
{
if(QuestService.collectItemCheck(env, true))
{
qs.setStatus(QuestStatus.REWARD);
updateQuestStatus(env);
return sendQuestDialog(env, 5);
}
else
{
int checkFailId = 3398;
if(player.getRecipeList().isRecipePresent(recipesIds[0]) || player.getRecipeList().isRecipePresent(recipesIds[1]))
checkFailId = 2716;
else if(player.getInventory().getItemCountByItemId(recipesItemIds[0]) > 0 || player.getInventory().getItemCountByItemId(recipesItemIds[1]) > 0)
checkFailId = 3057;
if(checkFailId == 3398)
{
qs.setQuestVar(2);
updateQuestStatus(env);
}
return sendQuestDialog(env, checkFailId);
}
}
break;
}
break;
}
}
return defaultQuestRewardDialog(env, questStartNpc, 0);
}
@Override
public void register()
{
qe.setNpcQuestData(questStartNpc).addOnQuestStart(questId);
qe.setNpcQuestData(questStartNpc).addOnTalkEvent(questId);
qe.setNpcQuestData(secondNpc).addOnTalkEvent(questId);
}
} | [
"[email protected]"
]
| |
0a4c18ee3c9957a64d8ba1998f5732c99526119b | 3b0828af674295db1a25b8fecb9e00acf85d168f | /src/main/java/com/example/demo_jsqlparser/UserController.java | 8b6105cdf761fb7afbb7e006c93c90f96bea6a1e | []
| no_license | ColorBoom/Test | 5e5c633f4e94eb26751c7f6bfcf7a3bf28b05e27 | 85d48e925295822ffbda6f644099e3c109103186 | refs/heads/master | 2020-03-17T09:19:31.796560 | 2018-08-24T10:19:55 | 2018-08-24T10:19:55 | 133,469,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package com.example.demo_jsqlparser;
import com.example.demo_jsqlparser.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private IUserService userService;
@RequestMapping("/qu")
public String querUser(){
return userService.findBySql().toString();
}
@RequestMapping("/all")
public String querAllUser(){
return userService.findAllBySql().toString();
}
}
| [
"[email protected]"
]
| |
54b70e0afe19470acd472577dd500f400f7c64cd | f2fc2c306f8206fa244707d41d3d62b5ea7c97f5 | /ua.com.shop322/src/main/java/ua/com/myshop/service/TypeOfShoesService.java | 2f17a9a151267f6ac5a46e9b43f7d43695ca18c1 | []
| no_license | MorozIhor/ShoeStore | cdc7bad4c8451e5b7fc4b872b0ffc9db58ec55a1 | d707f235c8ec7f5ca93f2533d8b1667c8db23f36 | refs/heads/master | 2021-01-23T08:21:52.202028 | 2017-04-08T15:06:09 | 2017-04-08T15:06:09 | 86,509,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 271 | java | package ua.com.myshop.service;
import java.util.List;
import ua.com.myshop.entity.TypeOfShoes;
public interface TypeOfShoesService {
void save(TypeOfShoes typeOfShoes);
List<TypeOfShoes> findAll();
TypeOfShoes findOne(int id);
void delete(int id);
}
| [
"Ihor@ProBook"
]
| Ihor@ProBook |
fb253e3929fc0da18ce6a414eee466b6ee081474 | 6b445c3513c01c34721e4e9284de799f0336b2ea | /src/leetcode/q12/Solution.java | 7323f22793f87936f20afe8eb10ecff55cad1066 | []
| no_license | PrototypeZ/alg | bc03bb03f8dddb93e6e49948e3a57c904bb8820c | 8a9011746633ca6417251b5cefd85a9c3b8e9811 | refs/heads/master | 2023-03-20T05:41:06.448982 | 2021-03-15T13:30:21 | 2021-03-15T13:30:21 | 262,215,618 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,108 | java | package leetcode.q12;
/**
*
* 罗马数字包含以下七种字符:?I,?V,?X,?L,C,D?和?M。
字符 数值
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
例如, 罗马数字 2 写做?II?,即为两个并列的 1。12 写做?XII?,即为?X?+?II?。 27 写做??XXVII, 即为?XX?+?V?+?II?。
通常情况下,罗马数字中小的数字在大的数字的右边。但也存在特例,例如 4 不写做?IIII,而是?IV。数字 1 在数字 5 的左边,所表示的数等于大数 5 减小数 1 得到的数值 4 。同样地,数字 9 表示为?IX。这个特殊的规则只适用于以下六种情况:
I?可以放在?V?(5) 和?X?(10) 的左边,来表示 4 和 9。
X?可以放在?L?(50) 和?C?(100) 的左边,来表示 40 和?90。?
C?可以放在?D?(500) 和?M?(1000) 的左边,来表示?400 和?900。
给定一个整数,将其转为罗马数字。输入确保在 1?到 3999 的范围内。
示例?1:
输入:?3
输出: "III"
示例?2:
输入:?4
输出: "IV"
示例?3:
输入:?9
输出: "IX"
示例?4:
输入:?58
输出: "LVIII"
解释: L = 50, V = 5, III = 3.
示例?5:
输入:?1994
输出: "MCMXCIV"
解释: M = 1000, CM = 900, XC = 90, IV = 4.
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/integer-to-roman
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
* Created by Jason on 2019/10/15/0015.
*/
public class Solution {
public String intToRoman(int num) {
StringBuilder sb = new StringBuilder();
int value = num;
value = testAppend(value, 1000, "M", sb);
value = testAppend(value, 900, "CM", sb);
value = testAppend(value, 500, "D", sb);
value = testAppend(value, 400, "CD", sb);
value = testAppend(value, 100, "C", sb);
value = testAppend(value, 90, "XC", sb);
value = testAppend(value, 50, "L", sb);
value = testAppend(value, 40, "XL", sb);
value = testAppend(value, 10, "X", sb);
value = testAppend(value, 9, "IX", sb);
value = testAppend(value, 5, "V", sb);
value = testAppend(value, 4, "IV", sb);
testAppend(value, 1, "I", sb);
return sb.toString();
}
private int testAppend(int value, int base, String unit, StringBuilder sb) {
int num = value / base;
if (num > 0) {
appendWithTimes(sb, unit,num);
}
return value - num * base;
}
private void appendWithTimes(StringBuilder sb, String string, int times) {
for (int i = 0; i < times; i++) {
sb.append(string);
}
}
public static void main(String[] args) {
Solution solution = new Solution();
System.out.println(solution.intToRoman(3));
System.out.println(solution.intToRoman(4));
System.out.println(solution.intToRoman(9));
System.out.println(solution.intToRoman(58));
System.out.println(solution.intToRoman(1994));
}
}
| [
"[email protected]"
]
| |
8ee0abc5fdfcc71e314a136a69a6ce247599a356 | 302755081d1f708d5321cee5f63ff0cc5cf3b2bf | /Project/src/main/java/com/privatejgoodies/common/internal/IActionObject.java | 966723c622ea5e0fc738a1c1d872d5275705f30d | [
"MIT"
]
| permissive | ArchieBlack/LGoodDatePicker | 3ff4f9d74d22c6ed93edd9e4efd7849e0038e55e | 825d443056ff73cccb3e68938b0bd5c4784957e4 | refs/heads/master | 2020-12-03T04:16:18.089748 | 2020-08-15T18:34:31 | 2020-08-15T18:34:31 | 95,841,741 | 0 | 0 | MIT | 2020-08-06T19:58:40 | 2017-06-30T02:55:07 | Java | UTF-8 | Java | false | false | 2,376 | java | /*
* Copyright (c) 2012-2013 JGoodies Software GmbH. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* o Neither the name of JGoodies Software GmbH nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.privatejgoodies.common.internal;
import javax.swing.Action;
/**
* Describes an object that can look up an Action for a given Action name.<p>
*
* <strong>Note:</strong> This class is intended for predefined and custom binder implementations as
* used by the JGoodies Binding API. Application developers won't use this interface directly.
*
* @author Karsten Lentzsch
*
* @since 1.4
*/
public interface IActionObject {
/**
* Looks up and returns an Action for the given action name.
*
* @param actionName the string used to look up the Action
* @return the Action with the given action name - if any
*
* @throws NullPointerException if {@code actionName} is {@code null}
*/
Action getAction(String actionName);
}
| [
"[email protected]"
]
| |
e8cf13c4540d764a4c56a78486491cec496d18d2 | 1fab9a02772e1ec898820434e0fc82cb5845e31a | /src/main/java/com/createsequence/blog/service/impl/BlogAritcleServiceImpl.java | 4b90eac285a60d1f653a0443c4f0028a86895008 | []
| no_license | Createsequence/simple-blog-back | 64dc8b9e3df0d03347b9e0528a392dde3c43c83d | e414a2e76546ab6a1777bbe3428019ba89328340 | refs/heads/main | 2023-02-24T06:59:26.759725 | 2021-01-31T07:53:29 | 2021-01-31T07:53:29 | 329,253,701 | 0 | 0 | null | 2021-01-31T07:53:30 | 2021-01-13T09:18:01 | Java | UTF-8 | Java | false | false | 745 | java | package com.createsequence.blog.service.impl;
import com.createsequence.blog.common.utils.BaseService;
import com.createsequence.blog.domain.BlogArticleEntity;
import com.createsequence.blog.mapper.BlogArticleMapper;
import com.createsequence.blog.service.BlogArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 文章service
*
* @author Created by Createsequence on 2021/1/23 11:14
*/
@Service
public class BlogAritcleServiceImpl extends BaseService<BlogArticleEntity, BlogArticleMapper> implements BlogArticleService {
@Autowired
BlogArticleMapper blogArticleMapper;
@Override
protected BlogArticleMapper mapper() {
return blogArticleMapper;
}
}
| [
"[email protected]"
]
| |
e2a2ea61aa3bb57e1d630cb6753465f2720ef6ac | 6779dfe95b97bf85347b5d1c6412032ed2b52884 | /trunk/Bicing/src/IA/Bicing/succesor/SuccessorFunction1.java | f68aead5d04f4b31776a5c549c83df2f59bb27f8 | []
| no_license | huanghuan92/bicing | abd9e4f3314d4707481ff9eb0fc36253b33da346 | 8682e329595052e97f847564eba8ea737bb9a50e | refs/heads/master | 2020-06-21T14:57:53.727707 | 2009-11-03T22:59:30 | 2009-11-03T22:59:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,060 | java | package IA.Bicing.succesor;
import IA.Bicing.*;
import aima.search.framework.Successor;
import aima.search.framework.SuccessorFunction;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Tomas Barton
*/
public class SuccessorFunction1 implements SuccessorFunction {
private int numVans;
private int vanCapacity;
private int cnt;
private BicingState bicing;
public SuccessorFunction1(int numVans, int vanCapacity){
this.numVans = numVans;
this.vanCapacity = vanCapacity;
}
public List getSuccessors(Object state) {
ArrayList successors = new ArrayList();
bicing = (BicingState) state;
int mov;
//we can make just as many move as we have vans
if(bicing.getActionCount() < numVans){
cnt = bicing.getStationsNum();
//try to move bikes (if there are any) from each station
for(int i=0; i< cnt; i++){
mov = bicing.getMoveableBikes(i);
if(mov > 0){
expandPossibleDestinations(successors, i, mov);
}
}
}
// System.out.println("next states: "+successors.size());
return successors;
}
private boolean expandPossibleDestinations(ArrayList succ,int fromStation, int numBikes){
BicingState newState;
//we can only move the maximum capacity of van
if(numBikes >= vanCapacity){
numBikes = vanCapacity;
}
if(!bicing.isPossibleAddMove()){
return false;
}
//all available bikes to different station than is this one
for(int i=0; i < cnt; i++){
if(i!=fromStation && bicing.getDemandedBikes(i) > 0){
newState = bicing.clone();
if(newState.addMove(fromStation, i, numBikes, newState.getActionCount())){
succ.add(new Successor(newState.getLastAction(), newState));
}
}
}
//one load, two unloads
//possible combinations
for(int k=1; k<numBikes;k++){
for(int i=0; i < cnt; i++){
if(i!=fromStation && bicing.getDemandedBikes(i) > 0){
//unload some bikes at one station
for(int j=0; j<cnt; j++){
if(j!=fromStation && j!=i && bicing.getDemandedBikes(j) > 0){
//and the rest we try to unload to every other station
BicingState secondStepState = bicing.clone();
if(secondStepState.dobleMoveBikes(fromStation, i, k,
fromStation, j, numBikes-k,secondStepState.getActionCount())){
succ.add(new Successor(secondStepState.getLastAction(), secondStepState));
}
}
}
}
}
}
return true;
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.