blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ec92ba52a82350816713730530b3c52b4149f768
|
b780df8c6126391f48c509675e1da6ff9b680f65
|
/src/avatar/entities/benders/AirBender.java
|
9da47bfedbc85035f139f424ebac06ede83592a3
|
[] |
no_license
|
teo-stoyanov/AvatarApp
|
4c23ddf84ec1cd393593f3295ffb8a6339a24fa4
|
b0bb1a8600a8fed73dcf8221b3da78db4b7c2735
|
refs/heads/master
| 2020-04-14T13:10:09.553560 | 2019-01-02T15:56:25 | 2019-01-02T15:56:25 | 163,860,975 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 559 |
java
|
package avatar.entities.benders;
public class AirBender extends Bender {
private double aerialIntegrity;
public AirBender(String name, int power, double aerialIntegrity) {
super(name, power);
this.aerialIntegrity = aerialIntegrity;
}
@Override
public String toString() {
return String.format("###Air Bender: %s, Power: %d, Aerial Integrity: %.2f",super.getName(),super.getPower(),this.aerialIntegrity);
}
@Override
public double benderPower() {
return getPower() * aerialIntegrity;
}
}
|
[
"[email protected]"
] | |
9268a21d5f2ea874732071b707b60c17c7ab877d
|
c89b43d358c6c3c4a106f51b7d828d41972321e7
|
/src/main/java/com/aveng/wapp/service/StringDiffer.java
|
b3c8590434f8bb18b0414223bf98affeb31cf7a7
|
[
"Unlicense"
] |
permissive
|
grimwall/wapp
|
efebb794640db97709a34149dc93a0df7a236b73
|
a541ac18a9ef1a0ab99602e997f893459926c67a
|
refs/heads/master
| 2021-07-19T19:03:11.820989 | 2020-03-10T11:09:39 | 2020-03-10T11:34:11 | 245,635,801 | 0 | 0 |
Unlicense
| 2021-03-31T21:50:58 | 2020-03-07T13:15:30 |
Java
|
UTF-8
|
Java
| false | false | 2,709 |
java
|
package com.aveng.wapp.service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Service;
import com.aveng.wapp.service.dto.StringDiff;
import com.aveng.wapp.service.dto.StringDiffResult;
/**
* A Service for comparing two strings
*
* @author apaydin
*/
@Service
public class StringDiffer {
/**
* Compares two strings and if they are matching in length, finds their diffs
*
* @param leftText left input
* @param rightText right input
* @return Message indicating the diff result and if present, a list of diffs
*/
public StringDiffResult compare(@NonNull String leftText, @NonNull String rightText) {
if (Objects.equals(leftText, rightText)) {
return StringDiffResult.builder().message("Provided strings are equal.").build();
}
if (leftText.length() != rightText.length()) {
return StringDiffResult.builder().message("Provided strings are not equal in length.").build();
}
List<StringDiff> stringDiffs = findDiffs(leftText, rightText);
return StringDiffResult.builder().message("Provided strings have diffs.").stringDiffs(stringDiffs).build();
}
private List<StringDiff> findDiffs(@NonNull String leftText, @NonNull String rightText) {
List<StringDiff> stringDiffs = new ArrayList<>();
boolean hasStartedADiff = false;
StringDiff currentDiff = null;
char left;
char right;
/*
* Walk the strings one char at a time. If the current chars are not equal,
* start a diff and continue. Finish the current diff at the first encountered equal char.
*/
for (int i = 0; i < leftText.length(); i++) {
left = leftText.charAt(i);
right = rightText.charAt(i);
//create a new diff point
if (!hasStartedADiff && left != right) {
currentDiff = new StringDiff();
currentDiff.setOffset(i);
hasStartedADiff = true;
//last char diff must be added! (edge case)
if (i == leftText.length() - 1) {
currentDiff.setLength(1);
stringDiffs.add(currentDiff);
}
} else if (hasStartedADiff && left == right) {
//finish the current diff
currentDiff.setLength(i - currentDiff.getOffset());
stringDiffs.add(currentDiff);
hasStartedADiff = false;
}
// no need to do anything, keep going
}
return stringDiffs;
}
}
|
[
"[email protected]"
] | |
688f1cb494dbcaecc4f298cdaadc15b3a8eadd3b
|
fb55a7b3b210e00d3f2c0e813245e754cf95b748
|
/nephele/nephele-streaming/src/main/java/eu/stratosphere/nephele/streaming/taskmanager/chaining/ChainManagerThread.java
|
3e9efecdba52e20c1c52256ffff85691d9bc795c
|
[] |
no_license
|
derSascha/stratosphere-streaming
|
4fede4c3945f2f00b5104fedb42024e572d6362f
|
9631fbfe59a699ba054ae1338c29fe500d80df04
|
refs/heads/master
| 2021-01-15T10:36:05.970455 | 2014-04-13T21:13:40 | 2014-04-13T21:13:40 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,257 |
java
|
/***********************************************************************************************************************
*
* Copyright (C) 2010 by the Stratosphere project (http://stratosphere.eu)
*
* 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 eu.stratosphere.nephele.streaming.taskmanager.chaining;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.log4j.Logger;
import eu.stratosphere.nephele.executiongraph.ExecutionVertexID;
import eu.stratosphere.nephele.profiling.ProfilingException;
import eu.stratosphere.nephele.streaming.message.action.CandidateChainConfig;
import eu.stratosphere.nephele.streaming.taskmanager.qosreporter.QosReporterConfigCenter;
import eu.stratosphere.nephele.taskmanager.runtime.RuntimeTask;
/**
* @author Bjoern Lohrmann
*
*/
public class ChainManagerThread extends Thread {
private final static Logger LOG = Logger
.getLogger(ChainManagerThread.class);
private final ExecutorService backgroundChainingWorkers = Executors
.newCachedThreadPool();
private final ConcurrentHashMap<ExecutionVertexID, TaskInfo> activeMapperTasks = new ConcurrentHashMap<ExecutionVertexID, TaskInfo>();
private final CopyOnWriteArraySet<CandidateChainConfig> pendingCandidateChainConfigs = new CopyOnWriteArraySet<CandidateChainConfig>();
private final ArrayList<TaskChainer> taskChainers = new ArrayList<TaskChainer>();
private final ThreadMXBean tmx = ManagementFactory.getThreadMXBean();
private final QosReporterConfigCenter configCenter;
private boolean started;
public ChainManagerThread(QosReporterConfigCenter configCenter)
throws ProfilingException {
this.configCenter = configCenter;
// Initialize MX interface and check if thread contention monitoring is
// supported
if (this.tmx.isThreadContentionMonitoringSupported()) {
this.tmx.setThreadContentionMonitoringEnabled(true);
} else {
throw new ProfilingException(
"The thread contention monitoring is not supported.");
}
this.started = false;
this.setName("ChainManager");
}
@Override
public void run() {
LOG.info("ChainManager thread started");
int counter = 0;
try {
while (!interrupted()) {
this.processPendingCandidateChainConfigs();
this.collectThreadProfilingData();
if (counter == 5) {
this.attemptDynamicChaining();
counter = 0;
}
counter++;
Thread.sleep(1000);
}
} catch (InterruptedException e) {
} finally {
cleanUp();
LOG.info("ChainManager thread stopped.");
}
}
private void attemptDynamicChaining() {
for (TaskChainer taskChainer : this.taskChainers) {
taskChainer.attemptDynamicChaining();
}
}
private void processPendingCandidateChainConfigs() {
for (CandidateChainConfig candidateChainConfig : this.pendingCandidateChainConfigs) {
boolean success = tryToCreateTaskChainer(candidateChainConfig);
if (success) {
this.pendingCandidateChainConfigs.remove(candidateChainConfig);
}
}
}
private boolean tryToCreateTaskChainer(
CandidateChainConfig candidateChainConfig) {
ArrayList<TaskInfo> taskInfos = new ArrayList<TaskInfo>();
for (ExecutionVertexID vertexID : candidateChainConfig
.getChainingCandidates()) {
TaskInfo taskInfo = this.activeMapperTasks.get(vertexID);
if (taskInfo == null) {
return false;
}
taskInfos.add(taskInfo);
}
this.taskChainers.add(new TaskChainer(taskInfos,
this.backgroundChainingWorkers, this.configCenter));
return true;
}
private void collectThreadProfilingData() {
for (TaskChainer taskChainer : this.taskChainers) {
taskChainer.measureCPUUtilizations();
}
}
private void cleanUp() {
// FIXME clean up data structures here
}
public void shutdown() {
this.interrupt();
}
public synchronized void registerMapperTask(RuntimeTask task) {
TaskInfo taskInfo = new TaskInfo(task, this.tmx);
this.activeMapperTasks.put(task.getVertexID(), taskInfo);
if (!this.started) {
this.started = true;
this.start();
}
}
public synchronized void unregisterMapperTask(ExecutionVertexID vertexID) {
TaskInfo taskInfo = this.activeMapperTasks.remove(vertexID);
if (taskInfo != null) {
taskInfo.cleanUp();
}
if (this.activeMapperTasks.isEmpty()) {
shutdown();
}
}
public void registerCandidateChain(CandidateChainConfig chainConfig) {
this.pendingCandidateChainConfigs.add(chainConfig);
}
}
|
[
"[email protected]"
] | |
7b6e2309e128087f308b33a18592130e9f5e567e
|
6705d12f93264888514de5155c236f046421f084
|
/Ch07/Exercise/Exercise7_15.java
|
e4bedd93864a7c2e047e9c6405a84ee6f7493767
|
[] |
no_license
|
yoo03/java-standard
|
40eb51be88d6d0a87bfcec137561aec8715d454c
|
631b83738d2ce024234b27de3d7dbb92922b95cf
|
refs/heads/master
| 2023-02-24T13:08:12.945226 | 2021-01-29T14:54:12 | 2021-01-29T14:54:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,283 |
java
|
/* Exercise 7-15. 클래스가 다음과 같이 정의되어 있을 떄,
* 형변환을 올바르게 하지 않은 것은? (모두 고르시오.)
* class Unit {}
* class AirUnit extends Unit {}
* class GroundUnit extends Unit {}
* class Tank extends GroundUnit {}
* class AirCraft extends AirUnit {}
*
* Unit u = new GroundUnit();
* Tank t = new Tank();
* AirCraft ac = new AirCraft();
*
* [선택지]
* a. u = (Unit)ac;
* b. u = ac;
* c. GroundUnit gu = (GroundUnit)u;
* d. AirUnit au = ac;
* e. t = (Tank)u;
* f. GroundUnit gu = t;
* [답] e. 자손의 참조변수 타입에 조상을 담을 수는 없다.
* [보충] a. 명시적 형변환 안해도 된다.
* b. 가능하다.
* c. 명시적 형변환 해야 하며, 가능하다.
* d. 가능하다.
* e. 자손의 매개변수 타입에 조상을 담을 수는 없다.
* f. Tank클래스는 GroundUnit클래스의 자손클래스이므로 조상클래스 타입의 변수에 담을 수 있다.
* [팁] 클래스간의 상속관계를 그림으로 그려보면 쉽게 알 수 있다.
* [해설] 조상인스턴스를 자손타입으로 형변환하는 것은 허용하지 않는다.
* [by LSH] 형변환 자체는 문제가 없으나 대입하는 부분에서 문제가 생기는 것
*/
|
[
"[email protected]"
] | |
da7ecb519d062863a80c07b895e8be5a675afb16
|
6ce004385555108bfa52ccb515f878d8c2ba272a
|
/src/main/java/site/pyyf/spring/web/server/TomcatServer.java
|
fcb56a68238d3bffb64a52fb82f2ebc2ff4256f4
|
[] |
no_license
|
Gepeng18/MySpring
|
9f8e489988b3d0618d5d1587e69fb73b55afa478
|
1147ef9977cfe2320916b1b9ba5492a2c1688029
|
refs/heads/master
| 2023-03-22T05:19:02.409149 | 2020-05-05T11:17:57 | 2020-05-05T11:17:57 | 261,437,094 | 0 | 0 | null | 2021-03-19T20:23:39 | 2020-05-05T11:05:04 |
Java
|
UTF-8
|
Java
| false | false | 2,082 |
java
|
package site.pyyf.spring.web.server;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.startup.Tomcat;
import site.pyyf.spring.web.servlet.DispatcherServlet;
/**
* @author:czwbig
* @date:2019/7/6 15:08
* @description: Tomcat服务器初始化,这里调用的 DispatcherServlet
*/
public class TomcatServer {
private Tomcat tomcat;
private String[] args;
public TomcatServer(String[] args) {
this.args = args;
}
public void startServer() throws LifecycleException {
tomcat = new Tomcat();
tomcat.setPort(8080);
tomcat.start();
// new 一个标准的 context 容器并设置访问路径;
// 同时为 context 设置生命周期监听器。
Context context = new StandardContext();
context.setPath("");
context.addLifecycleListener(new Tomcat.FixContextListener());
// 新建一个 DispatcherServlet 对象,这个是我们自己写的 Servlet 接口的实现类,
// 然后使用 `Tomcat.addServlet()` 方法为 context 设置指定名字的 Servlet 对象,
// 并设置为支持异步。
DispatcherServlet servlet = new DispatcherServlet();
Tomcat.addServlet(context, "dispatcherServlet", servlet)
.setAsyncSupported(true);
// Tomcat 所有的线程都是守护线程,
// 如果某一时刻所有的线程都是守护线程,那 JVM 会退出,
// 因此,需要为 tomcat 新建一个非守护线程来保持存活,
// 避免服务到这就 shutdown 了
context.addServletMappingDecoded("/", "dispatcherServlet");
tomcat.getHost().addChild(context);
Thread tomcatAwaitThread = new Thread("tomcat_await_thread") {
@Override
public void run() {
TomcatServer.this.tomcat.getServer().await();
}
};
tomcatAwaitThread.setDaemon(false);
tomcatAwaitThread.start();
}
}
|
[
"[email protected]"
] | |
f1800d3777fd47388c958ffca880e9ef2298e1ee
|
579a7b78a0fc0145c0eba913e4043c1a1980e8eb
|
/HelloCompat/app/src/main/java/srujan/com/hellocompat/MainActivity.java
|
98fa3b2e75df4207342e30e58d18269d1a5a14e6
|
[] |
no_license
|
jan76sru/Sample-apps
|
4cd90c3a0deba6b29b6acea5fd2b58d0b671fae0
|
0e8a686721ed6028d452cd424f3c941779b45f3a
|
refs/heads/master
| 2020-04-09T10:29:10.499572 | 2018-12-25T05:01:32 | 2018-12-25T05:01:32 | 160,272,690 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,699 |
java
|
package srujan.com.hellocompat;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
private TextView mHelloTextView;
private String[] mColorArray = {"red", "pink", "purple", "deep_purple",
"indigo", "blue", "light_blue", "cyan", "teal", "green",
"light_green", "lime", "yellow", "amber", "orange", "deep_orange",
"brown", "grey", "blue_grey", "black" };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mHelloTextView = findViewById(R.id.hello_textview);
// restore saved instance state (the text color)
if(savedInstanceState !=null){
mHelloTextView.setTextColor(savedInstanceState.getInt("color"));
}
}
@Override
public void onSaveInstanceState(Bundle outstate){
super.onSaveInstanceState(outstate);
outstate.putInt("color",mHelloTextView.getCurrentTextColor());
}
public void changeColor(View view) {
Random random = new Random();
String colorName = mColorArray[random.nextInt(20)];
int colorResourceName = getResources().getIdentifier(colorName,
"color", getApplicationContext().getPackageName());
int colorRes = ContextCompat.getColor(this, colorResourceName);
mHelloTextView.setTextColor(colorRes);
}
}
|
[
"[email protected]"
] | |
9dbe6fa07192fa17776955e4e268621046c269e9
|
b7fd95e2d2b00d650243c4e551b73ec477f96fc3
|
/java/design-code/src/main/java/com/duchen/design/composite/iterator/NullIterator.java
|
c72d6a1966dd6ab96377b4d8b1d656e09f1ed36b
|
[] |
no_license
|
SJX516/DuchenProject
|
ccb05e2c985a51d2d92d1a52ca95d71d0f9eed00
|
f130a541dd3b4eb283961487023e3ab57d42e06c
|
refs/heads/master
| 2021-01-19T11:59:15.156204 | 2019-08-21T17:56:30 | 2019-08-21T17:56:30 | 82,276,532 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 268 |
java
|
package com.duchen.design.composite.iterator;
import java.util.Iterator;
public class NullIterator implements Iterator {
@Override
public boolean hasNext() {
return false;
}
@Override
public Object next() {
return null;
}
}
|
[
"[email protected]"
] | |
3576bfb84528820b07e0569990d8d95519f1fa1d
|
075267d2283a20b489ef0f27f654b463b3359b0b
|
/VipStudent/app/src/main/java/com/vip/student/network/ApiUrls.java
|
3d0d31b74fbcb17d5c49f42d0ae5b9f308f830e0
|
[] |
no_license
|
HardWareMall2016/vipstudent
|
cd163d3a8a2b773443ecd6bbc6b60bb6c814926b
|
ef79f9f845d9c629a850a4585043ff9b4f31d10a
|
refs/heads/master
| 2021-01-20T20:08:45.991157 | 2016-06-30T03:55:46 | 2016-06-30T03:55:46 | 62,277,080 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,416 |
java
|
package com.vip.student.network;
public class ApiUrls {
//User - 用户登录
public static final String USER_LOGIN = "LoginService";
public static final String GET_USERINFO = "GetStudentFullinfo";
//Message - 学生消息
public static final String GET_STUDENT_MSG = "GetStudentMessage";
//Message - 学生消息标记已读
public static final String SET_MSG_READ = "SetMessageRead";
//Message - 获取推送消息
public static final String GET_PUSH_MSG = "GetPushMessage";
//Message - 设置推送消息已读
public static final String SET_PUSH_MSG_READ = "SetPushMessageRead";
//修改密码
public static final String CHANGPASSWORD = "ChangePassword";
//获取学生课表
public static final String GETSTUDEENTLESSON = "GetStudentLesson";
//调课申请
public static final String CHANGELESSONREQUEST = "ChangeLessonRequest";
//添加教师评价
public static final String SETTEACHERAPPRAISER = "SetTeacherAppraise";
//获取提醒时间
public static final String GETPUSHSTATE = "GetPushState";
//设置提醒时间
public static final String SETPUSHSTATE = "SetPushState";
//调课申请限制
public static final String GETCHANGELESSON = "GetChangeLesson";
//意见反馈
public static final String TEACHER_FEEDBACK = "http://userfeedback.tpooo.com/appmsg/api/message/addMessage.do";
}
|
[
"[email protected]"
] | |
dd5af84c8b5d12cfec4a628722d727b6e0477ee0
|
c5371eb78dc408265ae539d0f9cfffe9d6c9f04c
|
/MyFirstMavenWebAPP/src/main/java/com/RMI/RmiServiceImpl.java
|
d6238e54b82f8eb0616274e09252d051c716e8ab
|
[] |
no_license
|
gitForXuming/MyRepository
|
cf70226c72aa03694ea7ba25b29a95e9018cef83
|
4abfd918fc562ffc91e2853708f50c29f52b808d
|
refs/heads/master
| 2021-09-04T01:47:18.656066 | 2018-01-14T07:28:12 | 2018-01-14T07:28:12 | 116,688,294 | 6 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 689 |
java
|
package com.RMI;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.List;
//此为远程对象的实现类,须继承UnicastRemoteObject
public class RmiServiceImpl extends UnicastRemoteObject implements RmiService{
private static final long serialVersionUID = -8073404305626076413L;
protected RmiServiceImpl() throws RemoteException {
super();
}
@Override
public List<RmiModel> getModelList() throws RemoteException {
List<RmiModel> list = new ArrayList<RmiModel>();
RmiModel model = new RmiModel();
model.setUsername("xu");
model.setPassword("111111");
list.add(model);
return list;
}
}
|
[
"[email protected]"
] | |
b2b4167cb5534afc84e300909a73582d5ce0e939
|
81c91910dc51131a744224908452e356cac9b94e
|
/src/test/java/com/zzj/demo/ActivitiWebDemoApplicationTests.java
|
eb6256b77f5300cd73242ea0eba130f8c2c39a30
|
[] |
no_license
|
relsol/springboot-activiti-design
|
63390ea03ed7d95306ebcc2820716e6283ff8e01
|
8199d5049687b1d8dbd34cb6effbaaaea6532976
|
refs/heads/master
| 2021-02-14T21:07:12.333280 | 2020-03-04T07:31:15 | 2020-03-04T07:31:15 | 244,832,639 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 347 |
java
|
package com.zzj.demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ActivitiWebDemoApplicationTests {
@Test
public void contextLoads() {
}
}
|
[
"[email protected]"
] | |
2cee8f422b8e21ccc457607e65a334c117382064
|
973f5e0b77f2afb188d4b72c51ccbd85f43b230a
|
/src/main/java/com/food/services/Order/OrderService.java
|
e4030e2a08548d77b4515c30f5d3c2c328744ef2
|
[] |
no_license
|
nghiemxuanquang/FoodDamasSelf
|
71bf949e61e0090b1596c2b3e26cb59cee4210b6
|
e2789fd028362b9fcc0f093f67a915dd27412407
|
refs/heads/master
| 2020-12-05T12:37:32.219123 | 2016-09-05T00:30:00 | 2016-09-05T00:30:00 | 67,221,887 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 816 |
java
|
package com.food.services.Order;
import java.util.List;
import com.food.domain.OrderDetailVO;
import com.food.domain.OrderVO;
public interface OrderService {
public List<OrderVO> getListOrderByCustID(String c_id)throws Exception;
public List<OrderVO> getListOrderBySaleID(Integer sno) throws Exception;
public OrderVO getOrderByID(Integer ono) throws Exception;
public void insertOrder(OrderVO vo) throws Exception;
public Integer getCurrentInsertID() throws Exception;
public void updateOrder(OrderVO vo) throws Exception;
public void updateOrderState(OrderVO vo) throws Exception;
public List<OrderDetailVO> getListOrderDetailByOrderID(Integer ono) throws Exception;
public void insertOrderDetail(OrderDetailVO vo) throws Exception;
public void updateOrderDetail(OrderDetailVO vo) throws Exception;
}
|
[
"Quang Nghiem Xuan"
] |
Quang Nghiem Xuan
|
c7a9f5afeef3d09b6d76a24742e8cfd75bfebfee
|
470d84adc3810b10e5a4f02d1d87f1e762a22aab
|
/Ex_line1.java
|
a61c82011f50128d9c1f0e64c3ce6a2ae17fedd9
|
[] |
no_license
|
Gayatri1199/-Basic-Java-Programs
|
ffc1dde19a3533fea5326eff2f2132f74d206f71
|
c07659779e5946fabc2008ace0f58dbfd20e49c0
|
refs/heads/master
| 2022-04-22T12:47:55.258485 | 2020-04-25T20:16:41 | 2020-04-25T20:16:41 | 258,864,294 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 819 |
java
|
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/**<applet code=Ex_line1 heigh500 width=500>
</applet>
*/
public class Ex_line1 extends implements MouseListener,MouseMotionListener
{
int x1,y1,x2,y2;
Graphics g;
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
g=getGraphics();
}
public void mouseMoved(MouseEvent me)
{
x1=me.getX();
x2=me.getY();
}
public void mouseDragged(MouseEvent me)
{
x2=me.getX();
y2=me.getY();
g.drawLine(x1,y1,x2,y2);
x1=x2;
y1=y2;
}
public void mouseEntered(MouseEvent me)
{
}
public void mouseExited(MouseEvent me)
{
}
public void mousePressed(MouseEvent me)
{
}
public void mouseClicked(MouseEvent me)
{
}
public void mouseReleased(MouseEvent me)
{
}
}
|
[
"[email protected]"
] | |
0a2d3dc7208d1e6444e7aedd93041b588ebaea43
|
a8f117651c83cbe348cd03eb35ef517e6949f049
|
/Pawn.java
|
f9c8ad71c703b5701a15cd470b11b84cff1589b8
|
[] |
no_license
|
johndecarlo/Chess
|
dc162ddae10f96c6d4e6c0c8d4624a0e6ac0f1a2
|
dec6d346b43205cafb31553278bda69548584a40
|
refs/heads/master
| 2020-06-01T04:27:55.388444 | 2019-06-06T19:10:00 | 2019-06-06T19:10:00 | 190,635,577 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,354 |
java
|
import java.awt.*;
public class Pawn extends Piece {
public Pawn(String color, int row, int col) {
super(color, row, col, "Pawn");
}
public String moveIsValid(Piece[][] board, int fromX, int fromY, int toX, int toY, boolean checkKing) {
boolean move = false; //The move is valid this piece
boolean blocked = false; //If there is a piece in the spot we want to move
boolean kingAtRisk = false; //If the piece moving puts the king at risk
//If the selected move is the exact same location
if(fromX == toX && fromY == toY) {
return "same"; //Return false
}
if(toX < 0 || toX > 7 || toY < 0 || toY > 7) { //If the selected move is off the board
return "off"; //Set on board
}
if(board[toX][toY] != null && this.getColor().equals(board[toX][toY].getColor())) { //If the selected piece is not null and is the player's color
return "color"; //Set color to true
}
//If the piece selected is a white pawn
if(board[fromX][fromY] != null && board[fromX][fromY].getColor().equals("White")) {
if(fromY == toY && toX == fromX - 1) { //Moves up one spot
move = true; //Set move to true
if(board[toX][toY] != null) { //Blocked if a piece is there
return "blocked"; //Return blocked error message
}
}
if(fromY == toY && toX == fromX - 2 && fromX == 6) { //Moves up one spot
move = true; //Set move to true
if(board[toX][toY] != null) { //Blocked if a piece is there
return "blocked"; //Return blocked error message
}
}
if((toY == fromY - 1 && toX == fromX - 1) && (board[toX][toY] != null && !this.getColor().equals(board[toX][toY].getColor()))) { //Takes piece to the piece's right
move = true; //Set move equal to true
}
if((toY == fromY + 1 && toX == fromX - 1) && (board[toX][toY] != null && !this.getColor().equals(board[toX][toY].getColor()))) { //Takes piece tp the piece's left
move = true; //Set move equal to true
}
}
else //If the piece selected is a black pawn
if(board[fromX][fromY] != null && board[fromX][fromY].getColor().equals("Black")) {
if(fromY == toY && toX == fromX + 1) { //Moves up one spot
move = true; //Set move equal to true
if(board[toX][toY] != null) { //Blocked if a piece is there
return "blocked"; //Return blocked error message
}
}
if(fromY == toY && toX == fromX + 2 && fromX == 1) { //Moves up one spot
move = true; //Set move equal to true
if(board[toX][toY] != null) { //Blocked if a piece is there
return "blocked"; //Return blocked error message
}
}
if((toY == fromY - 1 && toX == fromX + 1) && (board[toX][toY] != null && !this.getColor().equals(board[toX][toY].getColor()))) { //Takes piece to the left
move = true; //Set move equal to true
}
if((toY == fromY + 1 && toX == fromX + 1) && (board[toX][toY] != null && !this.getColor().equals(board[toX][toY].getColor()))) { //Takes piece to the right
move = true; //Set move equal to true
}
}
if(checkKing == true) {
Piece p = board[fromX][fromY];
if(p != null && p.getColor().equals("White")) {
int[] kingPos = new int[2];
kingPos = ChessBoard.findKing("White");
kingAtRisk = kingAtRisk(board, fromX, fromY, kingPos[0], kingPos[1]);
if(kingAtRisk)
return "kingAtRisk"; //The king is at risk
}
else
if(p != null && p.getColor().equals("Black")) {
int[] kingPos = new int[2];
kingPos = ChessBoard.findKing("Black");
kingAtRisk = kingAtRisk(board, fromX, fromY, kingPos[0], kingPos[1]);
if(kingAtRisk)
return "kingAtRisk"; //The king is at risk
}
}
if(move)
return "legal"; //This move is legal for this piece
else
return "illegal"; //This move is illegial for this piece
}
}
|
[
"[email protected]"
] | |
552260277701201aa0ff57d2b8982958dca55094
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/13/13_c17e6f906c58030c49814cf7ef3a4fa557a734fe/BrowserLCA/13_c17e6f906c58030c49814cf7ef3a4fa557a734fe_BrowserLCA_s.java
|
b0499b0f70c34b8db5dcec920c0dbe4850e7290a
|
[] |
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 | 13,889 |
java
|
/*******************************************************************************
* Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Innoopract Informationssysteme GmbH - initial API and implementation
* EclipseSource - ongoing development
******************************************************************************/
package org.eclipse.swt.internal.browser.browserkit;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.rwt.internal.resources.ResourceManager;
import org.eclipse.rwt.internal.service.ContextProvider;
import org.eclipse.rwt.internal.service.IServiceStateInfo;
import org.eclipse.rwt.lifecycle.*;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.BrowserFunction;
import org.eclipse.swt.internal.widgets.IBrowserAdapter;
import org.eclipse.swt.widgets.Widget;
public final class BrowserLCA extends AbstractWidgetLCA {
static final String BLANK_HTML = "<html><script></script></html>";
private static final String QX_TYPE = "org.eclipse.swt.browser.Browser";
private static final String QX_FIELD_SOURCE = "source";
private static final String PARAM_EXECUTE_RESULT = "executeResult";
static final String PARAM_EXECUTE_FUNCTION = "executeFunction";
static final String PARAM_EXECUTE_ARGUMENTS = "executeArguments";
static final String EXECUTED_FUNCTION_NAME
= Browser.class.getName() + "#executedFunctionName.";
static final String EXECUTED_FUNCTION_RESULT
= Browser.class.getName() + "#executedFunctionResult.";
static final String EXECUTED_FUNCTION_ERROR
= Browser.class.getName() + "#executedFunctionError.";
private static final String FUNCTIONS_TO_CREATE
= Browser.class.getName() + "#functionsToCreate.";
private static final String FUNCTIONS_TO_DESTROY
= Browser.class.getName() + "#functionsToDestroy.";
private static final String PROP_URL = "url";
private static final String PROP_TEXT = "text";
public void preserveValues( final Widget widget ) {
Browser browser = ( Browser )widget;
ControlLCAUtil.preserveValues( browser );
IWidgetAdapter adapter = WidgetUtil.getAdapter( browser );
adapter.preserve( PROP_URL, browser.getUrl() );
adapter.preserve( PROP_TEXT, getText( browser ) );
WidgetLCAUtil.preserveCustomVariant( browser );
}
public void readData( final Widget widget ) {
Browser browser = ( Browser )widget;
String value
= WidgetLCAUtil.readPropertyValue( browser, PARAM_EXECUTE_RESULT );
if( value != null ) {
boolean executeResult = Boolean.valueOf( value ).booleanValue();
getAdapter( browser ).setExecuteResult( executeResult );
}
executeFunction( browser );
}
public void renderInitialization( final Widget widget ) throws IOException {
Browser browser = ( Browser )widget;
JSWriter writer = JSWriter.getWriterFor( browser );
writer.newWidget( QX_TYPE );
ControlLCAUtil.writeStyleFlags( browser );
}
public void renderChanges( final Widget widget ) throws IOException {
Browser browser = ( Browser )widget;
// TODO [rh] though implemented in DefaultAppearanceTheme, setting border
// does not work
ControlLCAUtil.writeChanges( browser );
destroyBrowserFunctions( browser );
writeUrl( browser );
createBrowserFunctions( browser );
writeExecute( browser );
writeFunctionResult( browser );
WidgetLCAUtil.writeCustomVariant( browser );
}
public void renderDispose( final Widget widget ) throws IOException {
JSWriter writer = JSWriter.getWriterFor( widget );
writer.dispose();
}
private static void writeUrl( final Browser browser )
throws IOException
{
if( hasUrlChanged( browser ) ) {
JSWriter writer = JSWriter.getWriterFor( browser );
writer.set( QX_FIELD_SOURCE, getUrl( browser ) );
}
}
static boolean hasUrlChanged( final Browser browser ) {
boolean initialized = WidgetUtil.getAdapter( browser ).isInitialized();
return !initialized
|| WidgetLCAUtil.hasChanged( browser, PROP_TEXT, getText( browser ) )
|| WidgetLCAUtil.hasChanged( browser, PROP_URL, browser.getUrl() );
}
static String getUrl( final Browser browser ) throws IOException {
String text = getText( browser );
String url = browser.getUrl();
String result;
if( !"".equals( text.trim() ) ) {
result = registerHtml( text );
} else if( !"".equals( url.trim() ) ) {
result = url;
} else {
result = registerHtml( BLANK_HTML );
}
return result;
}
private static void writeExecute( final Browser browser ) throws IOException {
IBrowserAdapter adapter = getAdapter( browser );
String executeScript = adapter.getExecuteScript();
if( executeScript != null ) {
JSWriter writer = JSWriter.getWriterFor( browser );
writer.call( "execute", new Object[] { executeScript } );
}
}
private static String registerHtml( final String html ) throws IOException {
String name = createUrlFromHtml( html );
byte[] bytes = html.getBytes( "UTF-8" );
InputStream inputStream = new ByteArrayInputStream( bytes );
ResourceManager.getInstance().register( name, inputStream );
return ResourceManager.getInstance().getLocation( name );
}
private static String createUrlFromHtml( final String html ) {
StringBuffer result = new StringBuffer();
result.append( "org.eclipse.swt.browser/text" );
result.append( String.valueOf( html.hashCode() ) );
result.append( ".html" );
return result.toString();
}
private static String getText( final Browser browser ) {
Object adapter = browser.getAdapter( IBrowserAdapter.class );
IBrowserAdapter browserAdapter = ( IBrowserAdapter )adapter;
return browserAdapter.getText();
}
private static IBrowserAdapter getAdapter( final Browser browser ) {
return ( IBrowserAdapter )browser.getAdapter( IBrowserAdapter.class );
}
//////////////////////////////////////
// Helping methods for BrowserFunction
private static void createBrowserFunctions( final Browser browser )
throws IOException
{
IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
String id = WidgetUtil.getId( browser );
String[] functions
= ( String[] )stateInfo.getAttribute( FUNCTIONS_TO_CREATE + id );
if( functions != null ) {
for( int i = 0; i < functions.length; i++ ) {
JSWriter writer = JSWriter.getWriterFor( browser );
writer.call( "createFunction", new Object[]{ functions[ i ] } );
}
}
}
private static void destroyBrowserFunctions( final Browser browser )
throws IOException
{
IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
String id = WidgetUtil.getId( browser );
String[] functions
= ( String[] )stateInfo.getAttribute( FUNCTIONS_TO_DESTROY + id );
if( functions != null ) {
for( int i = 0; i < functions.length; i++ ) {
JSWriter writer = JSWriter.getWriterFor( browser );
writer.call( "destroyFunction", new Object[]{ functions[ i ] } );
}
}
}
private void executeFunction( final Browser browser ) {
String function
= WidgetLCAUtil.readPropertyValue( browser, PARAM_EXECUTE_FUNCTION );
String arguments
= WidgetLCAUtil.readPropertyValue( browser, PARAM_EXECUTE_ARGUMENTS );
if( function != null ) {
IBrowserAdapter adapter = getAdapter( browser );
BrowserFunction[] functions = adapter.getBrowserFunctions();
boolean found = false;
for( int i = 0; i < functions.length && !found; i++ ) {
final BrowserFunction current = functions[ i ];
if( current.getName().equals( function ) ) {
final Object[] args = parseArguments( arguments );
ProcessActionRunner.add( new Runnable() {
public void run() {
try {
setExecutedFunctionName( browser, current.getName() );
Object executedFunctionResult = current.function( args );
setExecutedFunctionResult( browser, executedFunctionResult );
} catch( Exception e ) {
setExecutedFunctionError( browser, e.getMessage() );
}
}
} );
found = true;
}
}
}
}
private static void writeFunctionResult( final Browser browser )
throws IOException
{
IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
String id = WidgetUtil.getId( browser );
String function
= ( String )stateInfo.getAttribute( EXECUTED_FUNCTION_NAME + id );
if( function != null ) {
Object result = stateInfo.getAttribute( EXECUTED_FUNCTION_RESULT + id );
if( result != null ) {
result = new JSVar( toJson( result, true ) );
}
String error
= ( String )stateInfo.getAttribute( EXECUTED_FUNCTION_ERROR + id );
JSWriter writer = JSWriter.getWriterFor( browser );
writer.call( "setFunctionResult", new Object[]{ result, error } );
}
}
private static void setExecutedFunctionName( final Browser browser,
final String name )
{
IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
String id = WidgetUtil.getId( browser );
stateInfo.setAttribute( EXECUTED_FUNCTION_NAME + id, name );
}
private static void setExecutedFunctionResult( final Browser browser,
final Object result )
{
IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
String id = WidgetUtil.getId( browser );
stateInfo.setAttribute( EXECUTED_FUNCTION_RESULT + id, result );
}
private static void setExecutedFunctionError( final Browser browser,
final String error )
{
IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
String id = WidgetUtil.getId( browser );
stateInfo.setAttribute( EXECUTED_FUNCTION_ERROR + id, error );
}
static Object[] parseArguments( final String arguments ) {
List result = new ArrayList();
if( arguments.startsWith( "[" ) && arguments.endsWith( "]" ) ) {
// remove [ ] brackets
String args = arguments.substring( 1, arguments.length() - 1 );
int openQuotes = 0;
int openBrackets = 0;
String arg;
StringBuffer argBuff = new StringBuffer();
char prevChar = ' ';
for( int i = 0; i < args.length(); i++ ) {
char ch = args.charAt( i );
if( ch == ',' && openQuotes == 0 && openBrackets == 0 ) {
arg = argBuff.toString();
if( arg.startsWith( "[" ) ) {
result.add( parseArguments( arg ) );
} else {
arg = arg.replaceAll( "\\\\\"", "\"" );
result.add( withType( arg ) );
}
argBuff.setLength( 0 );
} else {
if( ch == '"' && prevChar != '\\' ) {
if( openQuotes == 0 ) {
openQuotes++;
} else {
openQuotes--;
}
} else if( ch == '[' && openQuotes == 0 ) {
openBrackets++;
} else if( ch == ']'&& openQuotes == 0 ) {
openBrackets--;
}
argBuff.append( ch );
}
prevChar = ch;
}
// append last segment
arg = argBuff.toString();
if( arg.startsWith( "[" ) ) {
result.add( parseArguments( arg ) );
} else if( !arg.equals( "" ) ) {
arg = arg.replaceAll( "\\\\\"", "\"" );
result.add( withType( arg ) );
}
}
return result.toArray();
}
static Object withType( final String argument ) {
Object result;
if( argument.equals( "null" ) || argument.equals( "undefined" ) ) {
result = null;
} else if( argument.equals( "true" ) || argument.equals( "false" ) ) {
result = new Boolean( argument );
} else if( argument.startsWith( "\"" ) ) {
result = new String( argument.substring( 1, argument.length() - 1 ) );
} else {
try {
result = Double.valueOf( argument );
} catch( NumberFormatException nfe ) {
result = argument;
}
}
return result;
}
static String toJson( final Object object, final boolean deleteLastChar ) {
StringBuffer result = new StringBuffer();
if( object == null ) {
result.append( "null" );
result.append( "," );
} else if( object instanceof String ) {
result.append( "\"" );
result.append( ( String )object );
result.append( "\"" );
result.append( "," );
} else if( object instanceof Boolean ) {
result.append( ( ( Boolean )object ).toString() );
result.append( "," );
} else if( object instanceof Number ) {
result.append( ( ( Number )object ).toString() );
result.append( "," );
} else if( object.getClass().isArray() ) {
Object[] array = ( Object[] )object;
result.append( "[" );
for( int i = 0; i < array.length; i++ ) {
result.append( toJson( array[ i ], false ) );
}
result.insert( result.length() - 1, "]" );
}
if( deleteLastChar ) {
result.deleteCharAt( result.length() - 1 );
}
return result.toString();
}
}
|
[
"[email protected]"
] | |
ca0b7ab8724c85b9e2f17acf85cf9dee770040b2
|
31637038d5f8491f665cea7e70f9cd2fac7740b0
|
/app/src/main/java/com/example/mycancercare/KankerHati/GejalaLiver.java
|
f98313e5dc2182fcf4f5ba28137daf701fd20524
|
[] |
no_license
|
dindatrisnadewi/cancercare_app
|
748c635dbb0b0bd16dd5154d076b04bd45e880a4
|
0647d795f8410dd210dcbafd0416a48066882738
|
refs/heads/master
| 2020-05-24T15:42:03.687298 | 2019-05-19T01:14:07 | 2019-05-19T01:14:07 | 187,337,532 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 391 |
java
|
package com.example.mycancercare.KankerHati;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.example.mycancercare.R;
public class GejalaLiver extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gejala_liver);
}
}
|
[
"[email protected]"
] | |
0ff4868eaa06bd277751f184a6037b03248b87f1
|
5fc03678d939455d34990883b84d742f36540715
|
/Java AI Agent/Agent II/content/RavensProbObj.java
|
8f22348dfa34f7cf9f55a6aa27418fa3f0a46599
|
[] |
no_license
|
mirikerstein/Sample-Work
|
3a2fc6faac85f6528c6f74b192229906abeacedf
|
7090279f8221613b0dbe77226f672ea448794fc1
|
refs/heads/master
| 2021-06-24T04:39:06.929758 | 2017-09-01T06:00:17 | 2017-09-01T06:00:17 | 100,446,795 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,668 |
java
|
package ravensproject.content;
import java.util.HashMap;
import ravensproject.setC.*;
import ravensproject.*;
public class RavensProbObj {
//Data fields
private String name;
private String type;
private HashMap<String,RavensFigObj>figs;
private Scorer scorer;
private ScorerC scorerC;
//Default constructor
public RavensProbObj(){
this.name = null;
this.type = null;
this.figs = null;
this.scorer = null;
this.scorerC = null;
}
//Given a RavensProblem, creates a RavensProbObj
public RavensProbObj(RavensProblem rp){
this.name = rp.getName();
this.type = rp.getProblemType();
this.figs = new HashMap<String, RavensFigObj>();
HashMap<String, RavensFigure>map = rp.getFigures();
for(RavensFigure rf:map.values()){
RavensFigObj obj = new RavensFigObj(rf);
this.figs.put(obj.getName(), obj);
}
this.scorer = new Scorer();
this.scorerC = new ScorerC();
}
//Correlates the figures within the individual images of a problem
public void correlateTwoByTwo(){
this.scorer.correlateAWithB(this);
this.scorer.correlateAWithC(this);
}
public void correlateSetC(){
this.scorerC.correlateAWithC(this);
this.scorerC.correlateAWithG(this);
}
//Get the figures
public HashMap<String,RavensFigObj>getFigs(){
return this.figs;
}
//toString
public String toString(){
StringBuilder print = new StringBuilder("Content Obj:");
print.append("\n");
for(RavensFigObj rf:this.figs.values()){
if(rf.getName().equals("A")||rf.getName().equals("C")||rf.getName().equals("G")){
for(ContentObj c: rf.getContents().values()){
print.append(c.aliasSetToString());
}
}
}
return print.toString();
}
}
|
[
"[email protected]"
] | |
2df43a5886aa162f236bcc7926a71ffe0a2a69a7
|
0ffbaa738c05a2e1552d7ea5b0c690bc6a3f0069
|
/src/test/java/com/mycompany/myapp/web/rest/errors/ExceptionTranslatorIntTest.java
|
45ae9fb014a3cdb766fa0c97a7bedf9c4e682ca1
|
[] |
no_license
|
jiangying59143/jhipster-vue-2
|
c63c60167024f0e0b84846ed50b775b0537d365f
|
4908c33955bbb2f8449897ff4a7669369d00f0b4
|
refs/heads/master
| 2020-05-21T00:18:18.612294 | 2019-05-09T15:07:48 | 2019-05-09T15:07:48 | 185,822,792 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,626 |
java
|
package com.mycompany.myapp.web.rest.errors;
import com.mycompany.myapp.JhipsterVue2App;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Test class for the ExceptionTranslator controller advice.
*
* @see ExceptionTranslator
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = JhipsterVue2App.class)
public class ExceptionTranslatorIntTest {
@Autowired
private ExceptionTranslatorTestController controller;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
private MockMvc mockMvc;
@Before
public void setup() {
mockMvc = MockMvcBuilders.standaloneSetup(controller)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter)
.build();
}
@Test
public void testConcurrencyFailure() throws Exception {
mockMvc.perform(get("/test/concurrency-failure"))
.andExpect(status().isConflict())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE));
}
@Test
public void testMethodArgumentNotValid() throws Exception {
mockMvc.perform(post("/test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION))
.andExpect(jsonPath("$.fieldErrors.[0].objectName").value("testDTO"))
.andExpect(jsonPath("$.fieldErrors.[0].field").value("test"))
.andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull"));
}
@Test
public void testParameterizedError() throws Exception {
mockMvc.perform(get("/test/parameterized-error"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("test parameterized error"))
.andExpect(jsonPath("$.params.param0").value("param0_value"))
.andExpect(jsonPath("$.params.param1").value("param1_value"));
}
@Test
public void testParameterizedError2() throws Exception {
mockMvc.perform(get("/test/parameterized-error2"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("test parameterized error"))
.andExpect(jsonPath("$.params.foo").value("foo_value"))
.andExpect(jsonPath("$.params.bar").value("bar_value"));
}
@Test
public void testMissingServletRequestPartException() throws Exception {
mockMvc.perform(get("/test/missing-servlet-request-part"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testMissingServletRequestParameterException() throws Exception {
mockMvc.perform(get("/test/missing-servlet-request-parameter"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testAccessDenied() throws Exception {
mockMvc.perform(get("/test/access-denied"))
.andExpect(status().isForbidden())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.403"))
.andExpect(jsonPath("$.detail").value("test access denied!"));
}
@Test
public void testUnauthorized() throws Exception {
mockMvc.perform(get("/test/unauthorized"))
.andExpect(status().isUnauthorized())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.401"))
.andExpect(jsonPath("$.path").value("/test/unauthorized"))
.andExpect(jsonPath("$.detail").value("test authentication failed!"));
}
@Test
public void testMethodNotSupported() throws Exception {
mockMvc.perform(post("/test/access-denied"))
.andExpect(status().isMethodNotAllowed())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.405"))
.andExpect(jsonPath("$.detail").value("Request method 'POST' not supported"));
}
@Test
public void testExceptionWithResponseStatus() throws Exception {
mockMvc.perform(get("/test/response-status"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.400"))
.andExpect(jsonPath("$.title").value("test response status"));
}
@Test
public void testInternalServerError() throws Exception {
mockMvc.perform(get("/test/internal-server-error"))
.andExpect(status().isInternalServerError())
.andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(jsonPath("$.message").value("error.http.500"))
.andExpect(jsonPath("$.title").value("Internal Server Error"));
}
}
|
[
"[email protected]"
] | |
2944f29747df5513bf84ef907f5c579c8d3f7485
|
b00724828fff8e473d59f25f08ef8a41d00d4b25
|
/src/main/java/com/mossle/security/impl/DatabaseUrlSourceFetcher.java
|
1221b1862f6783da0c960632237868ccad45adc3
|
[
"Apache-2.0"
] |
permissive
|
412537896/lemon
|
0d549c7be3de02285ea71140eba9ae85727e65ef
|
10499ec7dcbc13de9731e8edc67d17ec0384f986
|
refs/heads/master
| 2021-01-13T04:01:58.321757 | 2013-11-26T09:25:19 | 2013-11-26T09:25:19 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 652 |
java
|
package com.mossle.security.impl;
import com.mossle.security.api.UrlSourceFetcher;
import org.springframework.beans.factory.InitializingBean;
public class DatabaseUrlSourceFetcher extends AbstractDatabaseSourceFetcher
implements UrlSourceFetcher, InitializingBean {
public void afterPropertiesSet() throws Exception {
if (getQuery() != null) {
return;
}
String sql = "select ac.value as access,p.name as perm"
+ " from AUTH_ACCESS ac,AUTH_PERM p"
+ " where ac.perm_id=p.id and ac.type='URL'"
+ " order by priority";
this.setQuery(sql);
}
}
|
[
"[email protected]"
] | |
52fb2c6ec7edc7447643f460de81c56aa72075c7
|
6598c97185cdef976cee993e48412fe414a27748
|
/src/fizzbuzz/FizzBuzzApp.java
|
7c0d1d6604ed71fd4e6b21a10775c4212d2c15bb
|
[] |
no_license
|
c-awatsu/tips
|
2cb6e942cb35bd734107c41d709996e52b4a6520
|
ef5bcc93464b45bcea233dcd343be5569851a032
|
refs/heads/master
| 2021-01-18T13:30:21.796574 | 2016-01-28T15:59:33 | 2016-01-28T15:59:33 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 709 |
java
|
package fizzbuzz;
//FizzBuzz問題の解答例
public class FizzBuzzApp {
public static void main(String args[]) {
type2();
}
public static void type1(){
for (int i = 1; i <= 30; i++) {
if (i % 3 == 0 && i % 5 == 0) {
System.out.println("FizzBuzz");
} else if (i % 3 == 0) {
System.out.println("Fizz");
} else if (i % 5 == 0) {
System.out.println("Buzz");
} else {
System.out.println(i);
}
}
}
public static void type2(){
for (int i = 1; i <= 30; i++) {
if(i % 3 == 0){
System.out.print("fizz");
}
if(i % 5 == 0){
System.out.print("buzz");
}
if(!(i % 3 == 0 || i % 5 == 0)){
System.out.print(i);
}
System.out.println();
}
}
}
|
[
"[email protected]"
] | |
fbd429f404ebad423c576ba0fe16c919a0c055e8
|
2be5c7a46a9e15ec7ca1fd4eb69cdb2538f132fa
|
/src/main/java/com/task/controller/CategoryController.java
|
2f78843bf37d2135386be74543e3a35e0b9ed5af
|
[] |
no_license
|
oblivious7777/AOP
|
b022a53d846b79828cc6c8c96169efb076ef0f11
|
82b6dc95aaa1cc2ec5317083848bc887fe6468b4
|
refs/heads/master
| 2021-07-22T11:08:59.460352 | 2017-11-01T12:22:46 | 2017-11-01T12:22:46 | 109,127,831 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,534 |
java
|
package com.task.controller;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.task.model.Category;
import com.task.service.CategoryService;
import com.task.units.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
简单的部署于web的增删改查
起始页面是http://localhost/task2/list
运行信息与resources/log内
*/
//controller类,负责对web的接口
@Controller
@RequestMapping(value = "",method = RequestMethod.GET)
class CategoryController {
@Autowired
CategoryService categoryService;
//设置log4j
static Logger logger = Logger.getLogger(CategoryController.class);
/*
基于PageHelper进行分页查询
total为总页码
*/
@RequestMapping(value ="", method = RequestMethod.GET)
public String getCategory(Page page , Model model){
PageHelper.offsetPage(page.getStart(),5);
List<Category> cs= categoryService.list();
int total = (int) new PageInfo<Category>(cs).getTotal();
logger.debug(total+"total信息");
page.caculateLast(total);
logger.debug(cs+"cs信息");
model.addAttribute("list",cs);
logger.debug("list");
return "theList";
}
/*
添加接口
使用POST
在jsp中输入category的数据
*/
@RequestMapping(value = "/add" ,method = RequestMethod.POST)
public String addCategory(Category category){
categoryService.add(category);
return "theAdd";
}
/*
删除接口
使用DELETE
*/
@RequestMapping(value="del/{id}" ,method = RequestMethod.DELETE)
public String delCategory(@PathVariable(value = "id") Integer id) {
categoryService.del(id);
return "success";
}
/*
修改语句
*/
@RequestMapping(value="/upd",method = RequestMethod.POST)
public String updCategory(Category category){
categoryService.upd(category);
return "theUpd";
}
/*
根据ID查询一条数据
*/
@RequestMapping(value = "selI/{id}", method = RequestMethod.POST)
public String queryOne(@PathVariable(value = "id") Integer id,Model model) {
List<Category> cs= categoryService.selId(id);
model.addAttribute("getName",cs);
return "theSel";
}
/**
*
* 使用@ResponseBody标签输入输出json
*
*/
@RequestMapping(value ="listCategory", method = RequestMethod.GET)
public @ResponseBody List<Category> listCategory(Model model){
List<Category> cs= categoryService.list();
model.addAttribute("listCategory",cs);
return cs;
}
@RequestMapping(value ="addCategory", method = RequestMethod.POST)
public @ResponseBody List<Category> adCategory (Category category){
categoryService.add(category);
List<Category> cs= categoryService.list();
return cs;//仅作查询
}
}
|
[
"[email protected]"
] | |
3913ccb6bb400d5ff00a7a30d8b93b3091f7204c
|
f21878be2bbac66f46886c20967e64fa2fffaa41
|
/src/main/java/manager/JdbcConnection.java
|
60f8342e8e4e0a1d1ca4c8a5de1321b2670e0d40
|
[] |
no_license
|
AzizPetro/java-spring-rest
|
2f35a56df34ce871c143dcd574301b53c4ae5218
|
ad3bd5f5ccaa81ef5d08e9afa0f4cde7f7a03490
|
refs/heads/main
| 2023-04-05T05:15:05.290954 | 2021-04-05T12:59:11 | 2021-04-05T12:59:11 | 354,663,734 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 812 |
java
|
package manager;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Optional;
import org.postgresql.util.DriverInfo;
public class JdbcConnection {
private static Optional<Connection> connection = Optional.empty();
public static Optional<Connection> getConnection() {
if (!connection.isPresent()) {
String url = "jdbc:postgresql://localhost:8080/";
String user = "postgres";
String password = " ";
try {
Class.forName("org.postgresql.Driver");
connection = Optional.ofNullable(DriverManager.getConnection(url, user, password));
String sf = DriverInfo.DRIVER_FULL_NAME;
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
return connection;
}
}
|
[
"[email protected]"
] | |
c14151cf5652feb5ecacd4dbd15f458694fc98ae
|
714953afdfcf6dcb48849eb6d8b65a2f13375501
|
/src/com/yueke/pojo/Money.java
|
f69edd6d2f2ffc3be40dfc3f4f2aad2ccf400477
|
[] |
no_license
|
lucknhb/yueke
|
af1ebd99f090305a1ed0e73dd8f082deab6da4b4
|
e59eb099d584f83ecd3cade526c6ac848ff7f203
|
refs/heads/master
| 2021-09-19T04:59:09.936584 | 2018-07-23T09:50:42 | 2018-07-23T09:50:42 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,034 |
java
|
package com.yueke.pojo;
import java.io.Serializable;
import java.util.Date;
/**
* 余额
* 记录每个用户的账户余额
* @param <T>
* @author luck_nhb
*/
public class Money<T> implements Serializable {
private String mId;
private T object;
private Double balance;
private Date time;
public void set(String mId, T object, Double balance, Date time) {
this.mId = mId;
this.object = object;
this.balance = balance;
this.time = time;
}
public String getmId() {
return mId;
}
public void setmId(String mId) {
this.mId = mId;
}
public T getObject() {
return object;
}
public void setObject(T object) {
this.object = object;
}
public Double getBalance() {
return balance;
}
public void setBalance(Double balance) {
this.balance = balance;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
}
|
[
"[email protected]"
] | |
0864b25f4540e6e18596fd306d8e48210a54dc4e
|
716b231c89805b3e1217c6fc0a4ff9fbcdcdb688
|
/system-booking/src/main/java/com/train/system/booking/service/impl/PassengerServiceImpl.java
|
0300c3257afb037767ddf18e21bc466ab7cca73d
|
[] |
no_license
|
d0l1u/train_ticket
|
32b831e441e3df73d55559bc416446276d7580be
|
c385cb36908f0a6e9e4a6ebb9b3ad737edb664d7
|
refs/heads/master
| 2020-06-14T09:00:34.760326 | 2019-07-03T00:30:46 | 2019-07-03T00:30:46 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 688 |
java
|
package com.train.system.booking.service.impl;
import com.train.system.booking.dao.PassengerMapper;
import com.train.system.booking.entity.Passenger;
import com.train.system.booking.service.PassengerService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* PassengerServiceImpl
*
* @author taokai3
* @date 2018/6/18
*/
@Service("passengerService")
public class PassengerServiceImpl implements PassengerService {
@Resource
private PassengerMapper passengerMapper;
@Override
public List<Passenger> queryListByOrderId(String orderId) {
return passengerMapper.queryListByOrderId(orderId);
}
}
|
[
"meizs"
] |
meizs
|
e1ec271c0441a3294bb4de2126f68145a058dd74
|
55875ed948b259b29663064691088fabfb7f657d
|
/src/main/java/sample/Controller.java
|
a2337c8268d9053d70cee3881dfea128b16302b3
|
[] |
no_license
|
N0rp/Bowser
|
4c9f024fbd2ae9fd52dc150be199473cf367e712
|
1ed248d16fa21bba62f049a249aa97b0002e3a46
|
refs/heads/master
| 2021-01-10T15:00:06.792617 | 2015-06-07T20:47:39 | 2015-06-07T20:47:39 | 36,869,849 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 964 |
java
|
package sample;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Slider;
import javafx.scene.text.Text;
public class Controller {
@FXML
private Text actiontarget;
@FXML
private Slider slider;
@FXML
private void initialize() {
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable,
Number oldValue, Number newValue) {
int value = newValue.intValue() * 50;
actiontarget.setTranslateZ(value);
actiontarget.setText("Slide value is " + value);
}
});
}
@FXML
private void handleSubmitButtonAction(ActionEvent event)
{
actiontarget.setText("Sign in button pressed");
}
}
|
[
"[email protected]"
] | |
5321063fa2c50556502af390776a87998f227293
|
ab41927a9b1b63c08a5f7003269e9482c1445739
|
/SimulatorSpecificationLanguage/src/ssl/ObserveMode.java
|
6659023f12c1f474a5832edb59bf26f5417427e6
|
[] |
no_license
|
louismrose/ttc2011
|
bcca3299875b8c41d4b85e53c75ac4d6b099e6e2
|
8456184f4e1b8c1367aa80ba58cf97f7c18997bd
|
refs/heads/master
| 2020-06-02T09:29:29.770873 | 2011-09-05T11:07:46 | 2011-09-05T11:07:46 | 1,899,623 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,203 |
java
|
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package ssl;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Observe Mode</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link ssl.ObserveMode#getMode <em>Mode</em>}</li>
* </ul>
* </p>
*
* @see ssl.SslPackage#getObserveMode()
* @model
* @generated
*/
public interface ObserveMode extends Observation {
/**
* Returns the value of the '<em><b>Mode</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Mode</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Mode</em>' attribute.
* @see #setMode(String)
* @see ssl.SslPackage#getObserveMode_Mode()
* @model required="true"
* @generated
*/
String getMode();
/**
* Sets the value of the '{@link ssl.ObserveMode#getMode <em>Mode</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Mode</em>' attribute.
* @see #getMode()
* @generated
*/
void setMode(String value);
} // ObserveMode
|
[
"[email protected]"
] | |
759dc60c49d23e7e4d5e296958568f2eca893486
|
fddde2543bb0e48f1eabd077866036ec7639564d
|
/core/java/iesi-rest-without-microservices/src/main/java/io/metadew/iesi/server/rest/script/dto/ScriptPostDtoService.java
|
10648e09223665f1e24bfe2fa3c6526ec585d398
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
DaoCalendar/iesi
|
d98394e48610c1a6b9dd86b748c04e700eb0cf91
|
a6c52410ef9b14236078a4091be51b958d46c5e2
|
refs/heads/master
| 2023-08-30T07:30:50.603216 | 2021-09-01T07:38:56 | 2021-09-01T07:38:56 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,288 |
java
|
package io.metadew.iesi.server.rest.script.dto;
import io.metadew.iesi.metadata.configuration.security.SecurityGroupConfiguration;
import io.metadew.iesi.metadata.definition.script.Script;
import io.metadew.iesi.metadata.definition.script.key.ScriptKey;
import io.metadew.iesi.metadata.definition.security.SecurityGroup;
import io.metadew.iesi.metadata.tools.IdentifierTools;
import io.metadew.iesi.server.rest.script.dto.action.IScriptActionDtoService;
import io.metadew.iesi.server.rest.script.dto.label.IScriptLabelDtoService;
import io.metadew.iesi.server.rest.script.dto.parameter.IScriptParameterDtoService;
import io.metadew.iesi.server.rest.script.dto.version.IScriptVersionDtoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.stream.Collectors;
@Service
public class ScriptPostDtoService implements IScriptPostDtoService {
private IScriptParameterDtoService scriptParameterDtoService;
private IScriptLabelDtoService scriptLabelDtoService;
private IScriptActionDtoService scriptActionDtoService;
private IScriptVersionDtoService scriptVersionDtoService;
private SecurityGroupConfiguration securityGroupConfiguration;
@Autowired
public ScriptPostDtoService(IScriptParameterDtoService scriptParameterDtoService, IScriptLabelDtoService scriptLabelDtoService,
IScriptActionDtoService scriptActionDtoService, IScriptVersionDtoService scriptVersionDtoService,
SecurityGroupConfiguration securityGroupConfiguration) {
this.scriptActionDtoService = scriptActionDtoService;
this.scriptLabelDtoService = scriptLabelDtoService;
this.scriptParameterDtoService = scriptParameterDtoService;
this.scriptVersionDtoService = scriptVersionDtoService;
this.securityGroupConfiguration = securityGroupConfiguration;
}
public Script convertToEntity(ScriptPostDto scriptDto) {
SecurityGroup securityGroup = securityGroupConfiguration.getByName(scriptDto.getSecurityGroupName())
.orElseThrow(() -> new RuntimeException("could not find Security Group with name " + scriptDto.getSecurityGroupName()));
return new Script(
new ScriptKey(IdentifierTools.getScriptIdentifier(scriptDto.getName()),
scriptVersionDtoService.convertToEntity(scriptDto.getVersion(), IdentifierTools.getScriptIdentifier(scriptDto.getName())).getNumber()),
securityGroup.getMetadataKey(),
scriptDto.getSecurityGroupName(),
scriptDto.getName(),
scriptDto.getDescription(),
scriptVersionDtoService.convertToEntity(scriptDto.getVersion(), IdentifierTools.getScriptIdentifier(scriptDto.getName())),
scriptDto.getParameters().stream()
.map(parameter -> parameter.convertToEntity(new ScriptKey(IdentifierTools.getScriptIdentifier(scriptDto.getName()), scriptDto.getVersion().getNumber())))
.collect(Collectors.toList()),
scriptDto.getActions().stream()
.map(action -> action.convertToEntity(IdentifierTools.getScriptIdentifier(scriptDto.getName()), scriptDto.getVersion().getNumber()))
.collect(Collectors.toList()),
scriptDto.getLabels().stream()
.map(label -> label.convertToEntity(new ScriptKey(IdentifierTools.getScriptIdentifier(scriptDto.getName()), scriptDto.getVersion().getNumber())))
.collect(Collectors.toList()));
}
public ScriptPostDto convertToDto(Script script) {
return new ScriptPostDto(script.getName(),
script.getSecurityGroupName(),
script.getDescription(),
scriptVersionDtoService.convertToDto(script.getVersion()),
script.getParameters().stream().map(scriptParameterDtoService::convertToDto).collect(Collectors.toSet()),
script.getActions().stream().map(scriptActionDtoService::convertToDto).collect(Collectors.toSet()),
script.getLabels().stream().map(scriptLabelDtoService::convertToDto).collect(Collectors.toSet()));
}
}
|
[
"[email protected]"
] | |
f49f7c2b47f53aac6048b1d592e77489c51c7f6c
|
71027e2310f9917cd46ccb6a21c0100487c6b43b
|
/hep/freehep-java3d/src/main/java/org/freehep/j3d/plot/AxisBuilder.java
|
6900b415d4108437e77180c1cc08a2daba1fc585
|
[] |
no_license
|
kdk-pkg-soft/freehep-ncolor-pdf
|
f70f99ebdc7a78fc25960f42629e05d3c58f2b03
|
d317ea43554c75f8ff04e826b4361ad4326574b0
|
refs/heads/master
| 2021-01-23T12:18:26.502269 | 2012-08-22T23:22:21 | 2012-08-22T23:22:21 | 5,516,244 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,769 |
java
|
package org.freehep.j3d.plot;
import java.awt.Font;
import javax.media.j3d.*;
import javax.vecmath.*;
public class AxisBuilder
{
/**
* Constructs an axis
* @author Joy Kyriakopulos ([email protected])
* @version $Id: AxisBuilder.java 8584 2006-08-10 23:06:37Z duns $
*/
AxisBuilder()
{
// build all the major components of the Axis, keeping the important
// parts in member variables so we can modify them later.
label = new Text3D(); // The Axis label
label.setAlignment(label.ALIGN_CENTER);
Point3f pos = new Point3f(scale/2,-labelOffSet,0);
label.setPosition(pos);
label.setCapability(label.ALLOW_FONT3D_WRITE);
label.setCapability(label.ALLOW_STRING_WRITE);
axis = new Shape3D(); // The axis and tick marks.
axis.setCapability(axis.ALLOW_GEOMETRY_WRITE);
// We can create the tick labels yet, since we don't know how many there
// will be, but we can make a group to hold them.
ticks = new BranchGroup();
ticks.setCapability(ticks.ALLOW_CHILDREN_READ);
ticks.setCapability(ticks.ALLOW_CHILDREN_WRITE);
ticks.setCapability(ticks.ALLOW_DETACH);
// Group the components together
mainGroup = new TransformGroup();
mainGroup.setCapability(ticks.ALLOW_CHILDREN_WRITE);
mainGroup.setCapability(ticks.ALLOW_CHILDREN_EXTEND);
mainGroup.addChild(new Shape3D(label));
mainGroup.addChild(axis);
mainGroup.addChild(ticks);
// Set up a BulletinBoard behaviour to keep the axis oriented
// towards the user.
mainGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
mainGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
Billboard bboard = new Billboard( mainGroup );
mainGroup.addChild( bboard );
bboard.setSchedulingBounds( new BoundingSphere(new Point3d(0,0,0),10));
bboard.setAlignmentAxis( 1.0f, 0.0f, 0.0f);
}
public String getLabel()
{
return labelText;
}
public void setLabel(String label)
{
labelText = label;
}
public Font3D getLabelFont()
{
return labelFont;
}
public void setLabelFont(Font3D font)
{
labelFont = font;
}
public Font3D getTickFont()
{
return tickFont;
}
public void setTickFont(Font3D font)
{
tickFont = font;
}
/**
* Tick labels and locations (positions) can be set
* by the caller or calculated and set by the
* createLabelsNTicks method as a convenience.
*/
public double[] getTickLocations()
{
return tickLocations;
}
public void setTickLocations(double[] ticks)
{
tickLocations = ticks;
}
public String[] getTickLabels()
{
return tickLabels;
}
public void setTickLabels(String[] labels)
{
tickLabels = labels;
}
/**
* Call the createLabelsNTicks method if you would like the
* axisbuilder to create axis labels and tick positions for you.
*/
public void createLabelsNTicks(double min, double max)
{
AxisLabelCalculator axisCalc = new AxisLabelCalculator();
axisCalc.createNewLabels(min, max);
// System.out.println("in createLabelsNTicks: min = " + min + ", max = " + max);
// axisCalc.printLabels();
tickLabels = axisCalc.getLabels();
tickLocations = axisCalc.getPositions();
}
/**
* Call this method after setting the required axis properties, to actually
* setup/modify the axis appearance.
*/
public void apply()
{
/*
* Build an axis on the X axis from 0 to 256. Note the reason for the
* 256 is to compensate for the giant size of the Text3D characters.
* The axis is built in the XY plane.
* We will use suitable translation and rotation to position it later.
*
* Note we currently use Text3D to draw the labels. This is because Text3D
* seems somewhat easier to use. A better solution would
* probably involve using Text2D, but the com.sun.j3d.utils.geometry.Text2D
* class seems pretty brain dead. A better solution may be to get the source
* for the Text2D class and rewrite it for our own purposes.
*/
int tMajor = (tickLocations.length-1)/(tickLabels.length-1);
LineArray lines = new LineArray(2*tickLocations.length+2, LineArray.COORDINATES);
int coordIdx = 0; // coordinate index into Axis linearray
// Actual axis
lines.setCoordinate(coordIdx++, new Point3d(0, 0, 0));
lines.setCoordinate(coordIdx++, new Point3d(scale, 0, 0));
// Remove the old tick labels. Note a more efficient implementation
// we would keep as many as of the old labels as possible, adding/removing
// new tick marks only as the number of tick marks change, and changing the
// text only as necessary. For now we just do the easiest thing.
// TODO: More efficient implementation.
// while (ticks.numChildren() > 0)
// ticks.removeChild(0);
ticks.detach();
ticks = new BranchGroup();
ticks.setCapability(ticks.ALLOW_CHILDREN_READ);
ticks.setCapability(ticks.ALLOW_CHILDREN_WRITE);
ticks.setCapability(ticks.ALLOW_DETACH);
// Rendering Ticks on Axis
for(int i = 0; i < tickLocations.length; i++)
{
float x = (float) tickLocations[i]*scale;
if (i % tMajor == 0) // Major tick mark?
{
lines.setCoordinate(coordIdx++, new Point3d(x, 0, 0));
lines.setCoordinate(coordIdx++, new Point3d(x, -major, 0));
// Add the tick label
int nt = i/tMajor;
Point3f pos = new Point3f(x,-tickOffSet,0);
Text3D tickLabel = new Text3D(tickFont,tickLabels[nt],pos);
tickLabel.setAlignment(tickLabel.ALIGN_CENTER);
ticks.addChild(new Shape3D(tickLabel));
}
else // Minor tick mark
{
lines.setCoordinate(coordIdx++, new Point3d(x, 0, 0));
lines.setCoordinate(coordIdx++, new Point3d(x, -minor, 0));
}
}
// TODO: It would be more efficient to only update the label if something has changed.
mainGroup.addChild(ticks);
label.setFont3D(labelFont);
label.setString(labelText);
axis.setGeometry(lines);
}
/**
* Returns the node representing this Axis
* Subclasses can override this method to transform this axis
* to make it into an X,Y,Z axis.
*/
public Node getNode()
{
return mainGroup;
}
private String labelText;
private Font3D labelFont = defaultLabelFont;
private double[] tickLocations;
private String[] tickLabels;
private Font3D tickFont = defaultTickFont;
private TransformGroup mainGroup;
private Text3D label;
private Shape3D axis;
private BranchGroup ticks;
protected static float scale = 256f; // See comment on apply
protected static float major = 0.02f*scale;
protected static float minor = 0.01f*scale;
protected static float tickOffSet = 0.06f*scale;
protected static float labelOffSet = 0.12f*scale;
private static final Font3D defaultLabelFont = new Font3D(new Font("DIALOG",Font.BOLD,16),null);
private static final Font3D defaultTickFont = new Font3D(new Font("DIALOG",Font.PLAIN,12),null);
private static Color3f white = new Color3f(1,1,1);
}
|
[
"[email protected]"
] | |
74b642c595f260c4973adb50b2406041be6f8f3d
|
a32f2ccddfb715e070909d4540ed753dce1029f7
|
/src/main/java/com/gservice/repository/UserRepository.java
|
257ee40d8332e998cc73887539e67cc4f8641e37
|
[] |
no_license
|
arunjava/genericService
|
5ec8b25c9d9846949384561fbac51adf0e877111
|
8fc2022cc2bf0fec40302e6182d00fa1fbacff4e
|
refs/heads/master
| 2020-04-14T01:28:23.450017 | 2019-01-06T19:14:52 | 2019-01-06T19:14:52 | 163,560,953 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 263 |
java
|
package com.gservice.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.gservice.entity.User;
@Repository
public interface UserRepository extends CrudRepository<User, Long>{
}
|
[
"[email protected]"
] | |
7bc6588e60d129031cf5ea6e7fbd0169ffe07a39
|
32b8ed81e2533da80af5317e2900733f0c9d891c
|
/FunctionalPrograms/Triplet.java
|
7c2e4fc91dde0e5260bb7f7f9a31491f427a0b78
|
[] |
no_license
|
PratikC22/BasicJavaCoreAndFunctionalPrograms
|
494eca60bdfad1715da851aaa8f7046da432afb7
|
ddf7b9d538c383af9945e58dde33cd91439fcbfa
|
refs/heads/main
| 2023-06-01T19:25:41.485747 | 2021-06-23T05:32:28 | 2021-06-23T05:32:28 | 376,540,860 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,580 |
java
|
/**
* This code checks if sum of three integers adds zero.
*
* @author Pratik Chaudhari
* @since 14/06/2021
*/
import java.util.*;
public class Triplet {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter how many numbers you want add : ");
int arraySize = sc.nextInt();
//array to store numbers
int elementArray[] = new int[arraySize];
int elementIndex =0;
int tripletCounter =0;
while(elementIndex < arraySize) {
System.out.println("Enter no to check for triplet :");
int inputNumber = sc.nextInt();
elementArray[elementIndex] = inputNumber; //storing number into array
elementIndex++;
}
for(int i=0; i<=arraySize-1; i++) {
int firstNumber=elementArray[i];
for(int j=i+1; j<=arraySize-1; j++) {
int secondNumber=elementArray[j];
for(int k=j+1; k<=arraySize-1; k++) {
int thirdNumber =elementArray[k];
int isTriplet = firstNumber + secondNumber + thirdNumber;
//checking for triplet
if(isTriplet == 0) {
tripletCounter++;
System.out.println("Triplet : "+firstNumber+" "+secondNumber+" "+thirdNumber);
}
}
}
}
System.out.println("Total triplet : "+tripletCounter);
}
}
|
[
"[email protected]"
] | |
c8f2c7cf2ecf0af0ae34a03532b0aac964f71040
|
4530ed54f7ce2f601c3e114f2751ab2b437fea3c
|
/src/test/java/com/junction/stupidhack/alarm/AlarmApplicationTests.java
|
1ad6091d7e1d71757257949278a444e945d5e3d3
|
[] |
no_license
|
EkaterinaAntonyuk/wake-me-app-backend
|
1d7321b6382ed98e04bf4f0857b31124d6b92c39
|
398e9a908a393480e1fb21d46bc062d243955235
|
refs/heads/master
| 2023-05-13T01:36:32.636932 | 2021-05-30T10:04:33 | 2021-05-30T10:04:33 | 365,508,439 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 229 |
java
|
package com.junction.stupidhack.alarm;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class AlarmApplicationTests {
@Test
void contextLoads() {
}
}
|
[
"[email protected]"
] | |
73d895411a4a724e9d26d21ea16c0e04985bfae9
|
7f52c1414ee44a3efa9fae60308e4ae0128d9906
|
/core/src/test/java/com/alibaba/druid/bvt/sql/PagerUtilsTest_Limit_h2_0.java
|
3669190b0eca17490a29963a64d0cf889dbb7d77
|
[
"Apache-2.0"
] |
permissive
|
luoyongsir/druid
|
1f6ba7c7c5cabab2879a76ef699205f484f2cac7
|
37552f849a52cf0f2784fb7849007e4656851402
|
refs/heads/master
| 2022-11-19T21:01:41.141853 | 2022-11-19T13:21:51 | 2022-11-19T13:21:51 | 474,518,936 | 0 | 1 |
Apache-2.0
| 2022-03-27T02:51:11 | 2022-03-27T02:51:10 | null |
UTF-8
|
Java
| false | false | 636 |
java
|
package com.alibaba.druid.bvt.sql;
import com.alibaba.druid.sql.PagerUtils;
import com.alibaba.druid.util.JdbcConstants;
import com.alibaba.druid.util.JdbcUtils;
import junit.framework.TestCase;
import org.junit.Assert;
public class PagerUtilsTest_Limit_h2_0 extends TestCase {
public void test_db2_union() throws Exception {
String sql = "select * from t1 union select * from t2";
String result = PagerUtils.limit("SELECT * FROM test", JdbcUtils.H2, 0, 10);
System.out.println(result);
Assert.assertEquals("SELECT *\n" +
"FROM test\n" +
"LIMIT 10", result);
}
}
|
[
"[email protected]"
] | |
7899f67779422b7e23f864054853be20160391e0
|
963599f6f1f376ba94cbb504e8b324bcce5de7a3
|
/sources/p035ru/unicorn/ujin/view/fragments/makearecord/RecordRep$getAllRecords$remoteData$4.java
|
bb34b17ab62ce255967e12e9424b6f7d1ae1a2eb
|
[] |
no_license
|
NikiHard/cuddly-pancake
|
563718cb73fdc4b7b12c6233d9bf44f381dd6759
|
3a5aa80d25d12da08fd621dc3a15fbd536d0b3d4
|
refs/heads/main
| 2023-04-09T06:58:04.403056 | 2021-04-20T00:45:08 | 2021-04-20T00:45:08 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,309 |
java
|
package p035ru.unicorn.ujin.view.fragments.makearecord;
import java.util.List;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import p035ru.unicorn.ujin.view.fragments.makearecord.model.Appointment;
import p046io.reactivex.functions.Function;
@Metadata(mo51341bv = {1, 0, 3}, mo51342d1 = {"\u0000\u0012\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000\u0010\u0000\u001a\n\u0012\u0004\u0012\u00020\u0002\u0018\u00010\u00012\u0006\u0010\u0003\u001a\u00020\u0004H\n¢\u0006\u0002\b\u0005"}, mo51343d2 = {"<anonymous>", "", "Lru/unicorn/ujin/view/fragments/makearecord/model/Appointment;", "t", "", "apply"}, mo51344k = 3, mo51345mv = {1, 4, 1})
/* renamed from: ru.unicorn.ujin.view.fragments.makearecord.RecordRep$getAllRecords$remoteData$4 */
/* compiled from: RecordRep.kt */
final class RecordRep$getAllRecords$remoteData$4<T, R> implements Function<Throwable, List<? extends Appointment>> {
public static final RecordRep$getAllRecords$remoteData$4 INSTANCE = new RecordRep$getAllRecords$remoteData$4();
RecordRep$getAllRecords$remoteData$4() {
}
public final List<Appointment> apply(Throwable th) {
Intrinsics.checkNotNullParameter(th, "t");
return CollectionsKt.emptyList();
}
}
|
[
"[email protected]"
] | |
da8ed82c8e9c1fc25ad55e27dda5ef2e6a6a5cb3
|
1303dda07afb57e29126dd3c4c4758d498334160
|
/src/main/java/com/udemy/compras/graphQL/ProdutoGraphQL.java
|
da2387ae83253f895fe59961e19eba6ae5e9c780
|
[] |
no_license
|
rafaelhenriquemartins/API_GraphQL_Spring
|
9d8457888d3163b8c179212c529ad6977c65c413
|
efab624616ba67d910957db0035a9d4c3a7f5cfd
|
refs/heads/master
| 2023-04-25T12:00:36.685562 | 2021-05-18T02:47:41 | 2021-05-18T02:47:41 | 367,547,021 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,375 |
java
|
package com.udemy.compras.graphQL;
import com.coxautodev.graphql.tools.GraphQLMutationResolver;
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import com.udemy.compras.model.*;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class ProdutoGraphQL implements GraphQLQueryResolver, GraphQLMutationResolver {
@Autowired
private ProdutoService service;
public Produto cliente(Long id) {
return service.findById(id);
}
public List<Produto> clientes(){
return service.findAll();
}
public Produto saveCliente(ProdutoInput input){
// Cliente c = new Cliente();
// c.setId(input.getId());
// c.setNome(input.getNome());
// c.setEmail(input.getEmail());
ModelMapper m = new ModelMapper();
Produto c = m.map(input, Produto.class);
return service.save(c);
}
public Boolean deleteProduto(Long id) {
return service.deleteById(id);
}
// public List<Cliente> clientes(){
// List<Cliente> listClientes = new ArrayList<>();
//
// for (int i = 0; i <=10 ; i++) {
// listClientes.add(new Cliente("Cliente"+i,"Cliente"+i+"@gmail"));
// }
// return listClientes;
// }
}
|
[
"[email protected]"
] | |
90094969e1b1caa6dbdc5417e851f257215c055f
|
391f3089c241db67a053f25cd8027bbd63e5bda8
|
/src/application/Suit.java
|
9ec782390a45f78a94d967db0ddb2744a7773a54
|
[] |
no_license
|
anjusolomon/BlackJackgame
|
580f576403ecf3416422db0a72a37c5171509eb2
|
72734e7b657ae82d68970cf9771ff86e8d20273e
|
refs/heads/master
| 2020-04-17T20:08:56.447608 | 2019-01-21T23:19:49 | 2019-01-21T23:19:49 | 166,892,916 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 920 |
java
|
package application;
import java.util.Arrays;
import java.util.Collections;
public final class Suit {
private String name;
private String symbol;
public final static Suit CLUBS = new Suit( "Clubs", "c" );
public final static Suit DIAMONDS = new Suit( "Diamonds", "d" );
public final static Suit HEARTS = new Suit( "Hearts", "h" );
public final static Suit SPADES = new Suit( "Spades", "s" );
@SuppressWarnings("rawtypes")
public final static java.util.List VALUES =
Collections.unmodifiableList(
Arrays.asList( new Suit[] { CLUBS, DIAMONDS, HEARTS, SPADES } ) );
private Suit( String nameValue, String symbolValue ) {
name = nameValue;
symbol = symbolValue;
}
public String getName() {
return name;
}
public String getSymbol() {
return symbol;
}
@Override
public String toString() {
return name;
}
}
|
[
"[email protected]"
] | |
01d2210f21eaa333e650642cdd521ce63b51973b
|
d3e9b083a6f7ed5cb80b48f622370e5ecf587e5b
|
/app/src/main/java/org/learn/dellse/learnfrench/Score.java
|
1a12b2dbd4530624b87d3d5c24cd799f166fdd3f
|
[] |
no_license
|
AnkitSingh98/AndroidProject1-LearnFrench
|
5cf62ade93537437aba06ef70a97b9e4d40bb643
|
dfedf98bb8e2e08b64e13b57a6cf4ffc300a254b
|
refs/heads/master
| 2021-04-15T18:45:04.242833 | 2018-03-25T10:41:45 | 2018-03-25T10:41:45 | 126,689,070 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,441 |
java
|
package org.learn.dellse.learnfrench;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import org.ankithacks.learnfrench.R;
public class Score extends AppCompatActivity {
int m;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_score);
Bundle msg = getIntent().getExtras();
if (msg == null) {
return;
}
m = msg.getInt("message");
TextView ts=(TextView)findViewById(R.id.textView49);
ts.setText(""+m);
TextView tp=(TextView)findViewById(R.id.textView50);
if(m>=70)
tp.setText("Congratulations !!! ...... ");
if(m>=40 && m<70)
tp.setText("EXCELLENT !!! ...... ");
if(m>0 && m<40)
tp.setText("Good ...... Try once again ");
if(m<=0)
tp.setText("Poor ...... Try again!!!");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//YOUR CODE
}
public void again(View view)
{
Intent i = new Intent(Score.this, MainActivity.class);
startActivity(i);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
onBackPressed();
return true;
}
}
|
[
"[email protected]"
] | |
d75225437285f98ccdf828248de38cd64411e14e
|
079df0fe1de4f6b789daf9e04d94a8d8b38955e9
|
/Terminal/src/main/java/mikera/util/Maths.java
|
2dab9a79f5867339fc70aa9a7a1f1501e8c2d98f
|
[] |
no_license
|
condatgd/test
|
7fd884ac024837bf040033d86dd9db2830c663a9
|
f1d5a38909cc0f86031b480f40257c86049e84f5
|
refs/heads/master
| 2023-02-24T22:13:57.972583 | 2023-02-15T12:53:17 | 2023-02-15T12:53:17 | 154,280,441 | 1 | 0 | null | 2018-10-23T07:34:36 | 2018-10-23T07:15:46 | null |
UTF-8
|
Java
| false | false | 11,073 |
java
|
package mikera.util;
/**
* Helpful maths functions
*
* Focus on using floats rather than doubles for speed
*
* @author Mike
*
*/
public final class Maths {
public static final double ROOT_TWO = Math.sqrt(2);
public static final double ROOT_THREE = Math.sqrt(3);
/** mathematical constant e */
public static final double E = java.lang.Math.E;
/** Mathematical constant Pi = 3.1415926... */
public static final double PI = Math.PI;
public static final double TWO_PI = 2.0 * PI;
/** Mathematical constant Tau = 2 * Pi */
public static final double TAU = TWO_PI;
public static final double HALF_PI = 0.5 * PI;
public static final double QUARTER_PI = 0.25 * PI;
private static final double EPSILON = 0.00001;
public static float sqrt(float a) {
return (float) Math.sqrt(a);
}
public static double sqrt(double a) {
return Math.sqrt(a);
}
/**
* Clamp a double value to an integer range
*/
public static int clampToInteger(double value, int min, int max) {
int v = (int) value;
if (v < min) return min;
if (v > max) return max;
return v;
}
/**
* Clamp a float value to an integer range
*/
public static int clampToInteger(float value, int min, int max) {
int v = (int) value;
if (v < min) return min;
if (v > max) return max;
return v;
}
/** Linear interpolation between a and b */
public static final double lerp(double t, double a, double b) {
return (1 - t) * a + t * b;
}
/**
* Return the middle value of 3 numbers
*
* Can use faster "bound" method if first and last parameters are in order
*/
public static int middle(int a, int b, int c) {
if (a < b) {
if (b < c) { return b; }
return (a < c) ? c : a;
}
if (a < c) { return a; }
return (b < c) ? c : b;
}
/**
* Return the middle value of 3 numbers
*
* Can use faster "bound" method if parameters 2 and 3 are known to be in
* order
*/
public static float middle(float a, float b, float c) {
if (a < b) {
if (b < c) { return b; }
return (a < c) ? c : a;
}
if (a < c) { return a; }
return (b < c) ? c : b;
}
/**
* Return the sign of a double value
*/
public static int sign(double x) {
if (x == 0.0) return 0;
return (x > 0) ? 1 : -1;
}
/**
* Return the sign of a float value
*/
public static int sign(float x) {
if (x == 0.0f) return 0;
return (x > 0) ? 1 : -1;
}
/**
* Return the sign of an int value
*/
public static final int sign(int a) {
return (a == 0) ? 0 : ((a > 0) ? 1 : -1);
}
/** Return the sign of a long value */
public static int sign(long a) {
if (a == 0) return 0;
return (a > 0) ? 1 : -1;
}
/**
* Integer modulus function
*
* @param n
* number
* @param d
* divisor
* @return
*/
public static int mod(int number, int divisor) {
int r = (number % divisor);
if (r < 0) r += divisor;
return r;
}
/**
* Long modulus function
*
* @param n
* number
* @param d
* divisor
* @return
*/
public static long mod(long number, long divisor) {
long r = (number % divisor);
if (r < 0) r += divisor;
return r;
}
/**
* Detects the number of times that boundary is passed when adding increase
* to base
*
* @param increase
* @param boundary
* @param base
* @return
*/
public static long quantize(long increase, long boundary, long base) {
return ((base + increase) / boundary) - (base / boundary);
}
/** Return the minimum of three values */
public static double min(double a, double b, double c) {
double result = a;
if (b < result) result = b;
if (c < result) result = c;
return result;
}
/** Return the maximum of three values */
public static double max(double a, double b, double c) {
double result = a;
if (b > result) result = b;
if (c > result) result = c;
return result;
}
/** Return the minimum of three values */
public static float min(float a, float b, float c) {
float result = a;
if (b < result) result = b;
if (c < result) result = c;
return result;
}
/** Return the maximum of three values */
public static float max(float a, float b, float c) {
float result = a;
if (b > result) result = b;
if (c > result) result = c;
return result;
}
/** Return the minimum of four values */
public static final float min(float a, float b, float c, float d) {
float result = a;
if (result > b) result = b;
if (result > c) result = c;
if (result > d) result = d;
return result;
}
/** Return the maximum of four values */
public static final float max(float a, float b, float c, float d) {
float result = a;
if (result < b) result = b;
if (result < c) result = c;
if (result < d) result = d;
return result;
}
/** Return the minimum of two numbers */
public static int min(final int a, final int b) {
// oddly, this seems to outperform java.lang.Math.min by about 10% on
// caliper tests.....
return (a < b) ? a : b;
}
/** Return the maximum of two numbers */
public static int max(final int a, final int b) {
return (a > b) ? a : b;
}
/** Return the minimum of two numbers */
public static float min(float a, float b) {
return (a < b) ? a : b;
}
/** Return the maximum of two numbers */
public static float max(float a, float b) {
return (a > b) ? a : b;
}
/** Return the minimum of three numbers */
public static int min(int a, int b, int c) {
int result = a;
if (b < result) result = b;
if (c < result) result = c;
return result;
}
/** Return the maximum of three numbers */
public static int max(int a, int b, int c) {
int result = a;
if (b > result) result = b;
if (c > result) result = c;
return result;
}
/**
* Standard logistic function
*
* @param x
* @return
*/
public static double logistic(double x) {
double ea = Math.exp(-x);
double df = (1 / (1.0f + ea));
if (Double.isNaN(df)) return (x > 0) ? 1 : 0;
return df;
}
public static double softplus(double x) {
if (x > 100) return x;
if (x < -100) return 0.0;
return Math.log(1 + Math.exp(x));
}
public static double tanhScaled(double x) {
return 1.7159 * Math.tanh((2.0 / 3.0) * x);
}
public static double tanhScaledDerivative(double x) {
double ta = Math.tanh((2.0 / 3.0) * x);
return (1.7159 * (2.0 / 3.0)) * (ta * (1 - ta));
}
public static double inverseLogistic(double y) {
if (y >= 1) return 800;
if (y <= 0) return -800;
double ea = y / (1.0 - y);
return Math.log(ea);
}
public static double logisticDerivative(double x) {
double sa = logistic(x);
return sa * (1 - sa);
}
public static double tanhDerivative(double x) {
double sa = Math.tanh(x);
return 1.0 - (sa * sa);
}
/** Return the (always non-negative) fractional part of a number */
public static float frac(float a) {
return a - roundDown(a);
}
/** Return the (always non-negative) fractional part of a number */
public static double frac(double a) {
return a - Math.floor(a);
}
/** Return the square of a number */
public static int square(byte b) {
return b * b;
}
/** Return the square of a number */
public static int square(int x) {
return x * x;
}
/** Return the square of a number */
public static float square(float x) {
return x * x;
}
/** Return the square of a number */
public static double square(double x) {
return x * x;
}
/** Round up to next integer */
public static int roundUp(double x) {
int i = (int) x;
return (i == x) ? i : (i + 1);
}
/** Round up to next integer */
public static int roundUp(Number x) {
return roundUp(x.doubleValue());
}
/** Round up to next integer */
public static int roundUp(float x) {
int i = (int) x;
return (i == x) ? i : (i + 1);
}
/** Rounds down (integer floor) of a double value */
public static int roundDown(double x) {
if (x >= 0) return (int) x;
int r = (int) x;
return (x == r) ? r : r - 1;
}
/** Round down to next smallest integer (towards negative infinity) */
public static int roundDown(float x) {
if (x >= 0) return (int) x;
int r = (int) x;
return (x == r) ? r : r - 1;
}
/**
* Soft maximum function
*/
public static double softMaximum(double x, double y) {
double max = Math.max(x, y);
double min = Math.min(x, y);
return max + Math.log(1.0 + Math.exp(max - min));
}
/** Bound a value within a given range */
public static final double bound(double v, double min, double max) {
if (v < min) return min;
if (v > max) return max;
return v;
}
/** Bound a value within a given range */
public static final float bound(float v, float min, float max) {
if (v < min) return min;
if (v > max) return max;
return v;
}
/** Bound a value within a given range */
public static final int bound(int v, int min, int max) {
if (v < min) return min;
if (v > max) return max;
return v;
}
/**
* Returns (x^pow) mod (2^32) as an int
*/
public static int modPower32Bit(int x, int pow) {
int result = 1;
for (int n = pow; n > 0; n >>>= 1) {
if ((n & 1) != 0) {
result *= x;
}
x *= x;
}
return result;
}
/** Tests whether a value is near zero, to a default tolerance level */
public static boolean notNearZero(double x) {
return (x < -EPSILON) || (x > EPSILON);
}
/** Double mod function with fractional divisor */
public static double mod(double num, double div) {
double result = num % div;
if (result < 0) result += div;
return result;
}
/** Triangle wave with wavelength 1.0, and range 0.0 - 1.0 */
public static double triangleWave(double x) {
x -= Math.floor(x);
return (x < 0.5) ? x * 2 : (2 - x * 2);
}
}
|
[
"[email protected]"
] | |
294c5f2da3fb350dddc1756555d73ea4964f983a
|
48db73c0f5ba7373a4108261e93a94994c899e9f
|
/test/codility/lesson1/BinaryGapTest.java
|
f3a2b4e969e2054c873d5e87621560ed68487a76
|
[] |
no_license
|
Shrineas/Codility
|
6633c0f05fed4e130203f4dc9ef38691115a449e
|
1463e4e6b4b582acc71748632686fb585f6efff6
|
refs/heads/master
| 2021-01-02T08:38:32.721659 | 2017-08-13T13:03:59 | 2017-08-13T13:03:59 | 99,040,192 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,514 |
java
|
package codility.lesson1;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
public class BinaryGapTest {
private BinaryGap binaryGap;
@Before
public void setup() {
binaryGap = new BinaryGap();
// 0 - 0 -> 0
// 1 - 1 -> 0
// 2 - 10 -> 0
// 3 - 11 -> 0
// 4 - 100 -> 0
// 5 - 101 -> 1
// 7 - 111 -> 0
// 9 - 1001 -> 2
// 10 - 1010 -> 1
// 13 - 10101 -> 1
// 37 - 100101 -> 2
}
@Test
public void lowValuesWithoutBinaryGap_ShouldReturnZero() throws Exception {
assertEquals(0, binaryGap.solution(0));
assertEquals(0, binaryGap.solution(1));
assertEquals(0, binaryGap.solution(4));
}
@Test
public void binaryValuesWithOnlyOnes_ShouldReturnZero() throws Exception {
assertEquals(0, binaryGap.solution(7));
}
@Test
public void simplestBinaryGapNumberFive_ShouldReturnOne() throws Exception {
assertEquals(1, binaryGap.solution(5));
}
@Test
public void twoOnesContainingZeroes_ShouldReturnNumberOfZeroes() throws Exception {
assertEquals(2, binaryGap.solution(9));
}
@Test
public void binaryValueWithGapEndingWithZero_ShouldReturnSizeOfGap() throws Exception {
assertEquals(1, binaryGap.solution(10));
}
@Test
public void binaryValueWithMultipleGapsSameSize_ShouldReturnSizeOfGap() throws Exception {
assertEquals(1, binaryGap.solution(13));
}
@Test
public void binaryValueWithMultipleGapsDifferentSize_ShouldReturnSizeOfBiggestGap() throws Exception {
assertEquals(2, binaryGap.solution(37));
}
}
|
[
"[email protected]"
] | |
ab705c3e08e1caa3bf4240f2344a68571b1aa31f
|
3f88dbdf16f9dc8f40233cc6aca3acd7ee12d5fd
|
/Flax Engine/src/ie/flax/flaxengine/client/weave/view/MainMenuView.java
|
ee057b3a59f811f48a1ee2b9f342ef27ecb9e4c8
|
[
"Apache-2.0"
] |
permissive
|
FlaxProject/Flax-HTML5-Game-Engine
|
d1fd82a6fafbb3b66d6736bff0151b0efc1bbe5f
|
5cc9671de6baa12f0e365a2700ad4732db206cd6
|
refs/heads/master
| 2016-09-08T01:57:37.824440 | 2011-07-28T21:28:08 | 2011-07-28T21:28:08 | 1,974,241 | 2 | 1 | null | null | null | null |
WINDOWS-1250
|
Java
| false | false | 3,058 |
java
|
package ie.flax.flaxengine.client.weave.view;
import ie.flax.flaxengine.client.weave.Weave;
import ie.flax.flaxengine.client.weave.presenter.AbstractPresenter;
import ie.flax.flaxengine.client.weave.presenter.FileUploadPresenter;
import ie.flax.flaxengine.client.weave.presenter.MapImportExportPresenter;
import ie.flax.flaxengine.client.weave.view.customwidgets.FWindow;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.MenuBar;
/**
* This is the menu bar in the north panel of Weave. Its not really done in MVP,
* may want to look into converting it sometime soon
*
* @author Ciarán McCann
*
*/
public class MainMenuView extends MenuBar {
private MenuBar file;
private Command uploadFile;
private Command exportImport;
private Weave model;
private FWindow window;
private AbstractPresenter fileuploadPresneter;
private AbstractPresenter ImportExportPresenter;
public MainMenuView(Weave model) {
this.model = model;
file = new MenuBar();
bindCommands();
// this.addItem("File", file);
this.addItem("Upload Tilesheet", uploadFile);
this.addItem("Export/Import Map", exportImport);
this.setAnimationEnabled(true);
this.addHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
event.preventDefault();
}
}, ClickEvent.getType());
this.addHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
selectItem(null);
}
}, MouseOutEvent.getType());
window = new FWindow("Window");
fileuploadPresneter = new FileUploadPresenter();
ImportExportPresenter = new MapImportExportPresenter(model);
}
/**
* Binds the commands to the menu items
*/
private void bindCommands() {
// TODO: Async this code, some reason not working atm. No bige for the
// mo
// GWT.runAsync(new RunAsyncCallback() {
exportImport = new Command() {
@Override
public void execute() {
window.setTitle("Import/Export Map");
window.add(ImportExportPresenter.getView());
window.show();
}
};
uploadFile = new Command() {
@Override
public void execute() {
window.setTitle("Upload Tilesheet");
window.add(fileuploadPresneter.getView());
window.show();
}
};
// }
}
@Override
public void focus() {
// ignore anything that gives focus
}
}
|
[
"[email protected]"
] | |
6819b8394450037909d5f76f0e53dd8a20ace2fa
|
c0252581a023f09998d8845d05783f3a6b45bd5a
|
/src/main/java/cn/zjyc/together/service/impl/TypeServiceImpl.java
|
3ea4492011da78329ca920c4bc35613ae4ee40e8
|
[] |
no_license
|
liszt1/together
|
4665d3d3ee02c0d77bcce66fced6b6d23e27d4fe
|
59207ea87ce27f880e3838d034e544e3974b825d
|
refs/heads/master
| 2021-04-09T17:36:10.684994 | 2018-04-06T03:48:49 | 2018-04-06T03:48:49 | 125,874,942 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 519 |
java
|
package cn.zjyc.together.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.zjyc.together.dao.TypeDAO;
import cn.zjyc.together.entity.Type;
import cn.zjyc.together.service.TypeService;
@Service("typeService")
public class TypeServiceImpl implements TypeService {
@Autowired
private TypeDAO typeDAO;
@Override
public List<Type> findAllType() {
return typeDAO.findAllType();
}
}
|
[
"[email protected]"
] | |
8987af9c0b6f727cfe04132c9124ddb46f1afffb
|
297b0dcd8e9f6fd00425bcc12849bdc0b46a4ed2
|
/ui/com.mercatis.lighthouse3.ui.security.ui/src/com/mercatis/lighthouse3/security/ui/providers/GroupConverter.java
|
1b079af2c3d01d056b08b5c23dbded8341856552
|
[
"Apache-2.0"
] |
permissive
|
mercatis/Lighthouse
|
cedf5093ea16285460975f4882de0de0b05b0db2
|
85885f29585137347150cfc7e24fcc5315db980a
|
refs/heads/master
| 2020-05-19T23:49:00.669151 | 2011-12-13T09:48:22 | 2011-12-13T09:48:22 | 2,143,373 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,199 |
java
|
/*
* Copyright 2011 mercatis Technologies AG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
*/
package com.mercatis.lighthouse3.security.ui.providers;
import com.mercatis.lighthouse3.base.ui.provider.ILabelConverterHelper;
import com.mercatis.lighthouse3.domainmodel.users.Group;
public class GroupConverter implements ILabelConverterHelper {
/* (non-Javadoc)
* @see com.mercatis.lighthouse3.base.ui.provider.ILabelConverterHelper#getLabelForObject(java.lang.Object)
*/
public String getLabelForObject(Object obj) {
String label = ((Group)obj).getLongName();
if (label == null || label.length() == 0)
label = ((Group)obj).getCode();
return label;
}
}
|
[
"[email protected]"
] | |
3700cec7b2bf11c4f041b7f4c1bdc1e675ea70a6
|
0feec9a847517c98651771c51f5945d50ef55d2e
|
/src/com/groupclass/model/GroupClassVO.java
|
a2d3084f68f761f3c63e2a5c27e2dc4cc80e7dc7
|
[] |
no_license
|
air-gi/EA102G4
|
d9fb111ae13b21ded94499c1527d683e1d656901
|
1657fc867df3f5657089bb9b663b504b37dd0e28
|
refs/heads/master
| 2023-04-18T19:11:12.639937 | 2021-05-06T12:53:14 | 2021-05-06T12:53:14 | 364,875,460 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,507 |
java
|
package com.groupclass.model;
public class GroupClassVO implements java.io.Serializable{
private String g_class_no;
private String pro_id;
private String c_type_no;
private String g_name;
private String loc;
private Integer g_max;
private Integer p_coin;
private String g_detail;
private Integer c_status;
private byte[] g_pic;
public Integer getC_status() {
return c_status;
}
public void setC_status(Integer c_status) {
this.c_status = c_status;
}
public String getG_class_no() {
return g_class_no;
}
public void setG_class_no(String g_class_no) {
this.g_class_no = g_class_no;
}
public String getPro_id() {
return pro_id;
}
public void setPro_id(String pro_id) {
this.pro_id = pro_id;
}
public String getC_type_no() {
return c_type_no;
}
public void setC_type_no(String c_type_no) {
this.c_type_no = c_type_no;
}
public String getG_name() {
return g_name;
}
public void setG_name(String g_name) {
this.g_name = g_name;
}
public String getLoc() {
return loc;
}
public void setLoc(String loc) {
this.loc = loc;
}
public Integer getG_max() {
return g_max;
}
public void setG_max(Integer g_max) {
this.g_max = g_max;
}
public Integer getP_coin() {
return p_coin;
}
public void setP_coin(Integer p_coin) {
this.p_coin = p_coin;
}
public String getG_detail() {
return g_detail;
}
public void setG_detail(String g_detail) {
this.g_detail = g_detail;
}
public byte[] getG_pic() {
return g_pic;
}
public void setG_pic(byte[] g_pic) {
this.g_pic = g_pic;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((g_class_no == null) ? 0 : g_class_no.hashCode());
result = prime * result + ((g_max == null) ? 0 : g_max.hashCode());
result = prime * result + ((p_coin == null) ? 0 : p_coin.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
GroupClassVO other = (GroupClassVO) obj;
if (g_class_no == null) {
if (other.g_class_no != null)
return false;
} else if (!g_class_no.equals(other.g_class_no))
return false;
if (g_max == null) {
if (other.g_max != null)
return false;
} else if (!g_max.equals(other.g_max))
return false;
if (p_coin == null) {
if (other.p_coin != null)
return false;
} else if (!p_coin.equals(other.p_coin))
return false;
return true;
}
}
|
[
"User@DESKTOP-JO81F50"
] |
User@DESKTOP-JO81F50
|
d2e4f7e6de58ffc5cb28df5c178a535268104489
|
7da0de1fe5145b833b7a1c85726f9451f87c4d8f
|
/classes/cn/com/miaoto/modules/feedback/model/BackFeedbackResp.java
|
dfc10e57e8f73a1a968347b30dadfbfc9d4db2e1
|
[] |
no_license
|
wang1433256766/GJS_bookMgnSys
|
c3415a9b58d006667baf8fdc8f9722191b715911
|
735ef7462e3f7f6d9e01751f02106284f3a2ed00
|
refs/heads/master
| 2021-07-24T07:39:26.714616 | 2017-11-02T02:07:01 | 2017-11-02T02:07:01 | 109,111,318 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 193 |
java
|
package cn.com.miaoto.modules.feedback.model;
import cn.com.miaoto.common.httpBean.ResponseInfo;
/**
* Created by hx on 2017/7/27.
*/
public class BackFeedbackResp extends ResponseInfo {
}
|
[
"[email protected]"
] | |
1a7ef704bcb070279a3f5b88d5d79debff8d484e
|
46597191a67491ab792e4348cb9abd356411e163
|
/hw12-web/src/main/java/com/danzki/WebServerApp.java
|
c16d3885f21fb2818a1cadb14087d93db9383954
|
[] |
no_license
|
Danzki/jOtus
|
98e05c2cfea4d04974c49d88774d111f6204f2c0
|
4875611eb30bc441d157c6fee185fedf5a0eafe5
|
refs/heads/master
| 2022-12-23T15:23:34.742505 | 2020-05-12T16:50:14 | 2020-05-12T16:50:14 | 192,604,943 | 0 | 0 | null | 2022-12-16T15:38:06 | 2019-06-18T20:03:00 |
Java
|
UTF-8
|
Java
| false | false | 1,990 |
java
|
package com.danzki;
import com.danzki.core.dao.UserDao;
import com.danzki.core.service.DBServiceUser;
import com.danzki.core.service.DbServiceUserImpl;
import com.danzki.mongo.dao.UserDaoMongo;
import com.danzki.mongo.sessionmanager.SessionManagerMongo;
import com.danzki.mongo.template.MongoGenerator;
import com.danzki.mongo.template.MongoGeneratorImpl;
import com.danzki.server.UsersWebServer;
import com.danzki.server.UsersWebServerSecurity;
import com.danzki.services.TemplateProcessor;
import com.danzki.services.TemplateProcessorImpl;
import com.danzki.services.UserAuthService;
import com.danzki.services.UserAuthServiceImpl;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
/*
Полезные для демо ссылки
// Стартовая страница
http://localhost:8080
// Страница пользователей
http://localhost:8080/users
// REST сервис
http://localhost:8080/api/user/3
*/
public class WebServerApp {
private static final int WEB_SERVER_PORT = 8080;
private static final String TEMPLATES_DIR = "/templates/";
public static void main(String[] args) throws Exception {
SessionManagerMongo sessionManager = new SessionManagerMongo("mongodb://localhost", "mongo-db-test");
sessionManager.dropDatabase();
UserDao userDao = new UserDaoMongo(sessionManager);
DBServiceUser dbServiceUser = new DbServiceUserImpl(userDao);
MongoGenerator mongoGenerator = new MongoGeneratorImpl(dbServiceUser);
mongoGenerator.generateUsers();
Gson gson = new GsonBuilder().serializeNulls().setPrettyPrinting().create();
TemplateProcessor templateProcessor = new TemplateProcessorImpl(TEMPLATES_DIR);
UserAuthService authService = new UserAuthServiceImpl(dbServiceUser);
UsersWebServer usersWebServer = new UsersWebServerSecurity(WEB_SERVER_PORT,
authService, userDao, gson, templateProcessor);
usersWebServer.start();
usersWebServer.join();
}
}
|
[
"[email protected]"
] | |
85f2a6e0ecfe2b06c845fe556c35689b526ac78c
|
0b9a7b22e95001d91871a1666da413f2a8460c0b
|
/src/main/java/com/harrymanproject/retailstores/data/repository/ItemRepository.java
|
fb29ef7b697f0bdacebb25af292c9dbe668e1594
|
[] |
no_license
|
harrykextra/retailstores
|
2cc3752df544cc42a14aed4984a31fa900a834b0
|
9b786a7b20c59d3e6717f9d92374eff8a5ed51a7
|
refs/heads/main
| 2023-06-21T08:14:20.270345 | 2021-07-24T00:15:46 | 2021-07-24T00:15:46 | 388,957,978 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 250 |
java
|
package com.harrymanproject.retailstores.data.repository;
import com.harrymanproject.retailstores.data.model.Item;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ItemRepository extends JpaRepository<Item,Integer>{
}
|
[
"[email protected]"
] | |
d0d38dc9d89f151f2e7cb9c9654a1b01c2f858fb
|
40b9ec8727d786c8a0fad945cfb9117e67a73115
|
/fyc/src/cn/ideal/es/security/HttpParameterRequestWrapper.java
|
543d500f9fe87d95fd6934513e489371762e7dee
|
[] |
no_license
|
MR-JDY/fyc
|
404144f8f598c7082137b88df24e293d6eac28c4
|
d9cb2c39051c43aa3c67d5c143c044e085acdf1c
|
refs/heads/master
| 2021-09-02T11:54:29.571019 | 2018-01-02T10:02:07 | 2018-01-02T10:02:07 | 115,989,444 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,049 |
java
|
package cn.ideal.es.security;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StreamUtils;
import cn.ideal.es.common.constants.CommonStandard;
/**
* 对用户输入数据进行安全替换和编码后再传递到程序
*
*
* @author NetSnake
* @date 2015年12月29日
*
*/
public class HttpParameterRequestWrapper extends HttpServletRequestWrapper {
protected static final Logger logger = LoggerFactory.getLogger(HttpParameterRequestWrapper.class);
private Map<String, String[]> parameterMap;
private byte[] rawSubmitData;
public HttpParameterRequestWrapper(HttpServletRequest request) throws IOException {
super(request);
if(request.getCharacterEncoding() == null){
request.setCharacterEncoding(CommonStandard.DEFAULT_ENCODING);
}
this.parameterMap = new HashMap<String,String[]>(request.getParameterMap());
if(this.parameterMap == null || this.parameterMap.size() < 1){
rawSubmitData = StreamUtils.copyToByteArray(request.getInputStream());
if(rawSubmitData == null || rawSubmitData.length < 1){
logger.debug("当前请求没有提交任何数据");
} else {
StringBuffer sb = new StringBuffer() ;
InputStream is = new ByteArrayInputStream(rawSubmitData);
InputStreamReader isr = new InputStreamReader(is,request.getCharacterEncoding());
BufferedReader br = new BufferedReader(isr);
String s = "" ;
while((s=br.readLine())!=null){
sb.append(s) ;
}
String sValue = HttpUtils.filterUnSafeHtml(sb.toString());
rawSubmitData = sValue.getBytes(request.getCharacterEncoding());
logger.debug("处理一个RAW数据请求,请求的数据是:" + sb.toString() + ",安全过滤后:" + new String(rawSubmitData, request.getCharacterEncoding()));
}
return;
}
for(String key :request.getParameterMap().keySet()){
String[] src = request.getParameterValues(key);
if(src == null || src.length < 1){
if(logger.isDebugEnabled())logger.debug("忽略空参数[" + key + "]");
continue;
}
//logger.debug("参数[" + key + "]的输入数据有:" + src.length + "个:" + src);
String[] filterd = new String[src.length];
for(int i = 0; i < src.length; i++){
String sValue = HttpUtils.filterUnSafeHtml(src[i]);
filterd[i] = sValue;
}
this.parameterMap.put(key, filterd);
}
}
@Override
public String getParameter(String name) {
String result = "";
Object v = parameterMap.get(name);
if (v == null) {
result = null;
} else if (v instanceof String[]) {
String[] strArr = (String[]) v;
if(strArr == null || strArr.length < 1){
result = null;
} else {
StringBuffer sb = new StringBuffer();
for(String s : strArr){
sb.append(s).append(',');
}
result = sb.toString().replaceAll(",$", "");
}
} else if (v instanceof String) {
result = (String) v;
} else {
result = v.toString();
}
return result;
}
@Override
public Map<String, String[]> getParameterMap() {
return parameterMap;
}
@Override
public Enumeration<String> getParameterNames() {
return new Vector<String>(parameterMap.keySet()).elements();
}
@Override
public String[] getParameterValues(String name) {
String[] result = null;
Object v = parameterMap.get(name);
if (v == null) {
result = null;
} else if (v instanceof String[]) {
result = (String[]) v;
} else if (v instanceof String) {
result = new String[] { (String) v };
} else {
result = new String[] { v.toString() };
}
// logger.debug("返回参数[" + name + "]的值,数量:" + (result == null ? "空" : result.length));
return result;
}
@Override
public BufferedReader getReader() throws IOException {
return new BufferedReader(new InputStreamReader(getInputStream()));
}
@Override
public ServletInputStream getInputStream() throws IOException {
if(rawSubmitData == null){
logger.warn("过滤器中的数据是空");
return null;
}
final ByteArrayInputStream bais = new ByteArrayInputStream(rawSubmitData);
return new ServletInputStream() {
@Override
public int read() throws IOException {
return bais.read();
}
@Override
public boolean isFinished() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isReady() {
// TODO Auto-generated method stub
return false;
}
@Override
public void setReadListener(ReadListener arg0) {
// TODO Auto-generated method stub
}
};
}
}
|
[
"[email protected]"
] | |
54905ed1ac8ae96377fa45979cd1f076848296a0
|
15f9a96e8fd0461e1a68386c9d3f3d12c96808fc
|
/src/main/java/fetch/LoadFetchUrl.java
|
9d38b5c2213558b2431eb48d7404f743cdf95c49
|
[] |
no_license
|
xiawq87/rssreader-fetch
|
888e94f5bc9650c8c7e7da468c492d18f43bc27b
|
632dec69441da249a92f32141e8c49edabbb32a4
|
refs/heads/master
| 2020-06-14T00:31:09.920874 | 2014-04-13T10:43:08 | 2014-04-13T10:43:08 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,024 |
java
|
package fetch;
import java.util.ArrayList;
import java.util.List;
import util.MemcacheUtil;
import util.MongoUtil;
import vo.FetchUrl;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import constant.Constants;
public class LoadFetchUrl {
private static List<String> rssSources = new ArrayList<String>();
//从数据库中读取rss源地址存入memcache中
public static void loadUrlFromDB() {
rssSources.clear();
DB db = MongoUtil.getDB();
DBCollection fetchUrlColl = db.getCollection("fetch_url");
DBCursor cursor = fetchUrlColl.find();
while(cursor.hasNext()) {
DBObject record = cursor.next();
FetchUrl fetchUrl = new FetchUrl();
fetchUrl.setFetchUrl(record.get("fetch_url").toString());
fetchUrl.setSourceName(record.get("source_name").toString());
rssSources.add(fetchUrl.toString());
}
cursor.close();
MemcacheUtil.set(Constants.RSS_SOURCES, rssSources);
}
}
|
[
"[email protected]"
] | |
3efb354797320bbf12a3eb3c8f91a24a0b27af75
|
4c645b3321c187bbc0a842ffe911a90c55ec8a02
|
/java/javaprograms/src/com/composition/Case.java
|
7bc692fe7f549f74486f5e1192c923dd1b75b51c
|
[] |
no_license
|
deepanshululla/DataStructuresAndAlgo
|
7eae2a0a076f197707629128bed11069777caa7c
|
c78c3a16222484a7beb9f882f90e26801b1eab13
|
refs/heads/master
| 2021-01-22T06:07:20.602935 | 2017-06-30T03:29:57 | 2017-06-30T03:29:57 | 81,737,664 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 850 |
java
|
package com.composition;
/**
* Created by deepa on 6/23/2017.
*/
public class Case {
private String model;
private String manufacturer;
private String powerSupply;
private Dimensions dimensions;
public Case(String model, String manufacturer, String powerSupply, Dimensions dimensions) {
this.model = model;
this.manufacturer = manufacturer;
this.powerSupply = powerSupply;
this.dimensions = dimensions;
}
public void pressPowerButton(){
System.out.println("Power button has been pressed");
}
public String getModel() {
return model;
}
public String getManufacturer() {
return manufacturer;
}
public String getPowerSupply() {
return powerSupply;
}
public Dimensions getDimensions() {
return dimensions;
}
}
|
[
"[email protected]"
] | |
542d94d3313a352aa44edb44ec86bad4878c6d2a
|
1a5d8991488aabc3ebc2965db135c577daae34b9
|
/src/com/test/cor/ConsoleLogger.java
|
bf9920031cbef4d624f43d097678da69ae0e92de
|
[] |
no_license
|
rajeevkri/designPat
|
409a605a522105b2e5878b4be9a55ae55202a303
|
8525cab5103c28d5f16ebc07eb1057c5f63e2ee6
|
refs/heads/master
| 2021-01-23T00:53:00.501548 | 2017-07-27T11:58:33 | 2017-07-27T11:58:33 | 85,845,015 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 252 |
java
|
package com.test.cor;
public class ConsoleLogger extends AbstractLogger {
public ConsoleLogger(int level) {
this.level = level;
}
@Override
public void write(String message) {
System.out.println("Standard Console::Logger: " + message);
}
}
|
[
"[email protected]"
] | |
8b60a97ac909f2fbeb2c4f9bdd3439e505e67f8f
|
ef3632a70d37cfa967dffb3ddfda37ec556d731c
|
/aws-java-sdk-ebs/src/main/java/com/amazonaws/services/ebs/model/ValidationExceptionReason.java
|
973899a64ac99c180adce4f0fad63e4877505ab9
|
[
"Apache-2.0"
] |
permissive
|
ShermanMarshall/aws-sdk-java
|
5f564b45523d7f71948599e8e19b5119f9a0c464
|
482e4efb50586e72190f1de4e495d0fc69d9816a
|
refs/heads/master
| 2023-01-23T16:35:51.543774 | 2023-01-19T03:21:46 | 2023-01-19T03:21:46 | 134,658,521 | 0 | 0 |
Apache-2.0
| 2019-06-12T21:46:58 | 2018-05-24T03:54:38 |
Java
|
UTF-8
|
Java
| false | false | 2,381 |
java
|
/*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.ebs.model;
import javax.annotation.Generated;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum ValidationExceptionReason {
INVALID_CUSTOMER_KEY("INVALID_CUSTOMER_KEY"),
INVALID_PAGE_TOKEN("INVALID_PAGE_TOKEN"),
INVALID_BLOCK_TOKEN("INVALID_BLOCK_TOKEN"),
INVALID_SNAPSHOT_ID("INVALID_SNAPSHOT_ID"),
UNRELATED_SNAPSHOTS("UNRELATED_SNAPSHOTS"),
INVALID_BLOCK("INVALID_BLOCK"),
INVALID_CONTENT_ENCODING("INVALID_CONTENT_ENCODING"),
INVALID_TAG("INVALID_TAG"),
INVALID_DEPENDENCY_REQUEST("INVALID_DEPENDENCY_REQUEST"),
INVALID_PARAMETER_VALUE("INVALID_PARAMETER_VALUE"),
INVALID_VOLUME_SIZE("INVALID_VOLUME_SIZE"),
CONFLICTING_BLOCK_UPDATE("CONFLICTING_BLOCK_UPDATE");
private String value;
private ValidationExceptionReason(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
/**
* Use this in place of valueOf.
*
* @param value
* real value
* @return ValidationExceptionReason corresponding to the value
*
* @throws IllegalArgumentException
* If the specified value does not map to one of the known values in this enum.
*/
public static ValidationExceptionReason fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException("Value cannot be null or empty!");
}
for (ValidationExceptionReason enumEntry : ValidationExceptionReason.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
}
}
|
[
""
] | |
e3a5effebebd4fafcc87137661e421ecb46d7d92
|
14593dbd5ce47c01aa04b120b08650c4e63215ea
|
/servicecat-webapp/src/main/java/org/aksw/servicecat/security/model/UserInfo.java
|
a25168685ca98351b12cf4bad80ab95f0d77a667
|
[
"Apache-2.0"
] |
permissive
|
GeoKnow/SparqlServiceCatalogue
|
a38094ba77fa0cc8518091ad25e4d3ca9946ea4a
|
3e02d46b8f37d078f8bfa64cc610b905af5f1f90
|
refs/heads/master
| 2021-01-02T22:51:02.659229 | 2015-02-27T10:47:33 | 2015-02-27T10:47:33 | 22,769,286 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,159 |
java
|
package org.aksw.servicecat.security.model;
import java.util.Collection;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
public class UserInfo
implements UserDetails
{
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getPassword() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getUsername() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isAccountNonExpired() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isAccountNonLocked() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isCredentialsNonExpired() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isEnabled() {
// TODO Auto-generated method stub
return false;
}
}
|
[
"[email protected]"
] | |
47819e9e17a3d08f652a383612c322fe35a6b6cf
|
8a9b80725a12f3f35e93858de7660c237e424bc9
|
/src/main/java/vcs/citydb/wfs/config/WFSConfig.java
|
98f57eb4d1d1751fecc397e765f835d3a267d277
|
[
"Apache-2.0",
"LGPL-3.0-only"
] |
permissive
|
3dcitydb/web-feature-service
|
7ae7d27fe5b25328177f3e9f8e11a53cd35e1754
|
8dd80723cd46844422e2f8c9ab7e7413690e24d3
|
refs/heads/master
| 2022-12-22T11:00:45.535803 | 2022-12-15T15:35:41 | 2022-12-15T15:35:41 | 18,515,903 | 33 | 16 |
Apache-2.0
| 2022-06-21T05:08:10 | 2014-04-07T12:19:05 |
Java
|
UTF-8
|
Java
| false | false | 3,056 |
java
|
package vcs.citydb.wfs.config;
import vcs.citydb.wfs.config.capabilities.Capabilities;
import vcs.citydb.wfs.config.constraints.Constraints;
import vcs.citydb.wfs.config.database.Database;
import vcs.citydb.wfs.config.feature.FeatureTypes;
import vcs.citydb.wfs.config.filter.FilterCapabilities;
import vcs.citydb.wfs.config.logging.Logging;
import vcs.citydb.wfs.config.operation.Operations;
import vcs.citydb.wfs.config.processing.PostProcessing;
import vcs.citydb.wfs.config.server.Server;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlRootElement(name="wfs")
@XmlType(name="WFSConfigType", propOrder={
"capabilities",
"featureTypes",
"operations",
"filterCapabilities",
"constraints",
"postProcessing",
"database",
"server",
"logging"
})
public class WFSConfig {
@XmlElement(required=true)
private Capabilities capabilities;
@XmlElement(required=true)
private FeatureTypes featureTypes;
private Operations operations;
private FilterCapabilities filterCapabilities;
private Constraints constraints;
private PostProcessing postProcessing;
@XmlElement(required=true)
private Database database;
@XmlElement(required=true)
private Server server;
private Logging logging;
public WFSConfig() {
capabilities = new Capabilities();
featureTypes = new FeatureTypes();
operations = new Operations();
filterCapabilities = new FilterCapabilities();
constraints = new Constraints();
postProcessing = new PostProcessing();
database = new Database();
server = new Server();
logging = new Logging();
}
public Capabilities getCapabilities() {
return capabilities;
}
public void setCapabilities(Capabilities capabilities) {
this.capabilities = capabilities;
}
public FeatureTypes getFeatureTypes() {
return featureTypes;
}
public void setFeatureTypes(FeatureTypes featureTypes) {
this.featureTypes = featureTypes;
}
public Operations getOperations() {
return operations;
}
public void setOperations(Operations operations) {
this.operations = operations;
}
public FilterCapabilities getFilterCapabilities() {
return filterCapabilities;
}
public void setFilterCapabilities(FilterCapabilities filterCapabilities) {
this.filterCapabilities = filterCapabilities;
}
public Constraints getConstraints() {
return constraints;
}
public void setConstraints(Constraints constraints) {
this.constraints = constraints;
}
public PostProcessing getPostProcessing() {
return postProcessing;
}
public void setPostProcessing(PostProcessing postProcessing) {
this.postProcessing = postProcessing;
}
public Database getDatabase() {
return database;
}
public void setDatabase(Database database) {
this.database = database;
}
public Server getServer() {
return server;
}
public void setServer(Server server) {
this.server = server;
}
public Logging getLogging() {
return logging;
}
public void setLogging(Logging logging) {
this.logging = logging;
}
}
|
[
"[email protected]"
] | |
7688732bf7dbf540c3c96a0610646252b04446a4
|
637556c9335498605b5b961898455bfed4c6fe5b
|
/src/main/java/jari/duyvejonck/sunnyportaltodbspring/sunnyportal/auth/AuthenticateHttpRequest.java
|
b80a1ac35259639d2ceb7606ed5cf2aa8d42728c
|
[
"MIT"
] |
permissive
|
JaDuyve/SunnyPortal-to-DB-Spring
|
e583dffdedc836eda4672d4fe77deb88b358386f
|
89e804f35ed2829c7972e9c79f18d8ab435dcdb2
|
refs/heads/main
| 2023-02-18T11:13:36.782076 | 2021-01-13T22:23:31 | 2021-01-13T22:23:31 | 325,617,740 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,476 |
java
|
package jari.duyvejonck.sunnyportaltodbspring.sunnyportal.auth;
import org.apache.tomcat.util.codec.binary.Base64;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.util.DefaultUriBuilderFactory;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
public class AuthenticateHttpRequest extends SPRequest {
private static final String AUTH_ENDPOINT = "services/authentication/100";
private final SPConfig config;
private final URI uri;
public AuthenticateHttpRequest(final SPConfig config) {
this.config = config;
this.uri = new DefaultUriBuilderFactory().builder()
.scheme(this.getScheme())
.host(this.config.getBaseUrl())
.path(AUTH_ENDPOINT)
.build();
}
@Override
public final URI getURI() {
return this.uri;
}
@Override
public final HttpHeaders getHeaders() {
final String credentials = config.getUsername() + ":" + config.getPassword();
final byte[] base64CredentialData = Base64.encodeBase64(credentials.getBytes(StandardCharsets.UTF_8));
final HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set("Authorization", "Basic " + new String(base64CredentialData));
httpHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_XML));
return httpHeaders;
}
}
|
[
"[email protected]"
] | |
0bbe17d30831298f65a76c3a95b1cc3a0bdd5115
|
a8e727973b939f7b3c48c781394d5b5cfba1b258
|
/Pharmacy/Common/src/main/java/checkForm/fields/Field.java
|
a2087a2436df08d19b9d8b04d6d5d549aff94544
|
[] |
no_license
|
smir-vic-alex/failed_fun_startups
|
c1352411d7a5654f2a15d3555acc46f27bc380c9
|
163fc96ab31f8938b6f3060caaa7edcbe6fadce8
|
refs/heads/main
| 2023-01-30T12:25:47.110559 | 2020-12-12T16:42:05 | 2020-12-12T16:42:05 | 320,874,793 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,065 |
java
|
/**
* Создано: Денис
* Дата: 08.01.15
* Описание: Интерфейс для полей с формы
*/
package checkForm.fields;
import checkForm.parsers.FieldParser;
import checkForm.validators.Validator;
import java.util.List;
public interface Field {
/**
* Установление валидатора.
* @param validator Валидатор
*/
public void setValidator(Validator validator);
/**
* Установение валидаторов.
* @param validators Валидаторы
*/
public void setValidators(Validator... validators);
/**
* Получение валидаторов.
* @return Список валидаторов
*/
public List<Validator> getValidators();
/**
* Установление парсера.
* @param parser Парсер
*/
public void setParser(FieldParser parser);
/**
* Получение парсера
* @return Парсер
*/
public FieldParser getParser();
/**
* Установление имени поля.
* @param name Имя поля, соответствующее имени на форме.
*/
public void setName(String name);
/**
* Получение имени.
* @return Имя формы
*/
public String getName();
/**
* Установление описания
* @param description Описание поля
*/
public void setDescription(String description);
/**
* Получение описания.
* @return Описание
*/
public String getDescription();
/**
* Маркировка поля, что оно является не обязательным
*/
public void setNotRequired();
/**
* Проверка, является ли поле обязательным
* @return Да, если поле обязательное. Нет, в противном случае.
*/
public boolean isRequire();
}
|
[
"[email protected]"
] | |
2174e3a487387f7d991d88d67e4f3f543afe1cc9
|
e8bf5eed2cb868f4c8f1eab1f3eacec5db394170
|
/src/Moodle/EmployeeHour.java
|
1c66a58a2d552ad9e1c40c6427a1324913afbc55
|
[] |
no_license
|
yinon115/finalProject
|
573a3859326a47dbfd3bc95de3b18828f0e5ad01
|
64473813bf2485ee34a5b8f52e279e28590c3a55
|
refs/heads/master
| 2023-07-03T00:14:22.159654 | 2021-08-04T10:59:56 | 2021-08-04T10:59:56 | 390,715,880 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 71 |
java
|
package Moodle;
//public class EmployeeHour extends Employees{
//
//}
|
[
"[email protected]"
] | |
c8e5ea97f3559b04dc0d24f463c32b7521b4e19d
|
14ce0b6ec16dcde669b824316f89b85ed783a024
|
/trunk/projects/zxses/src/com/zx/core/model/SysParameter.java
|
ac50b173cdb3881195906d9ea431d2e939eed9af
|
[] |
no_license
|
BGCX262/zxses-svn-to-git
|
077b860e2e5b6ccc6b57571aacdbb06deaec382c
|
44bc0e02f7b6b3cb2d5378b08e04e90ec11bf8bd
|
refs/heads/master
| 2021-01-22T04:41:02.426134 | 2015-08-23T06:49:12 | 2015-08-23T06:49:12 | 41,250,909 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,064 |
java
|
package com.zx.core.model;
import java.util.Date;
/**
* SysParameter entity.
*
* @author MyEclipse Persistence Tools
*/
public class SysParameter implements java.io.Serializable {
// Fields
private Long id;
private String code;
private String name;
private String content;
private Date createTime;
private Date updateTime;
private Integer recordStatus;
// Constructors
/** default constructor */
public SysParameter() {
}
/** minimal constructor */
public SysParameter(String code, String name, String content,
Date createTime, Integer recordStatus) {
this.code = code;
this.name = name;
this.content = content;
this.createTime = createTime;
this.recordStatus = recordStatus;
}
/** full constructor */
public SysParameter(String code, String name, String content,
Date createTime, Date updateTime, Integer recordStatus) {
this.code = code;
this.name = name;
this.content = content;
this.createTime = createTime;
this.updateTime = updateTime;
this.recordStatus = recordStatus;
}
// Property accessors
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return this.updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getRecordStatus() {
return this.recordStatus;
}
public void setRecordStatus(Integer recordStatus) {
this.recordStatus = recordStatus;
}
}
|
[
"[email protected]"
] | |
5408e21c8a87dcb83217b25397c3134db4b0d566
|
24f758bfdb6acc0d06d7aef8f4ed933e332d909b
|
/weather/src/main/java/stats/StatsVarianza.java
|
557a13e756cf105c1df7602b7784059d40e9ae7f
|
[] |
no_license
|
martina-mammarella/programmazioneadoggettiunivpm
|
d5fead69b219080c9b29c42f2adcc14aa1cf1d97
|
7bd3f7f26feb795027c9f126041ff0ab10a1a652
|
refs/heads/master
| 2023-03-24T03:26:17.098516 | 2021-03-03T20:44:47 | 2021-03-03T20:44:47 | 339,783,654 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 53 |
java
|
package stats;
public class StatsVarianza {
}
|
[
"[email protected]"
] | |
4394f3058d03893cbf747599c075eca029ef42cf
|
2b659e430eb379c4137fb923359c62bfa414b5af
|
/Examen3-API-master/Examen3-API-master/ContabilidadUIA/src/main/java/uia/com/api/ContabilidadUIA/modelo/cheques/NotaDebito.java
|
2a34b3e491ed29585412c70592b05b8f1dbe1a15
|
[] |
no_license
|
JuanMJ/EXAM-Api
|
ce7dcb418996ec7f6b250bb4bdd018504af70223
|
480b7d040f606cd706c2997f8556040535f38bd6
|
refs/heads/master
| 2023-04-12T08:09:47.633684 | 2021-05-15T16:15:54 | 2021-05-15T16:15:54 | 367,546,181 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,034 |
java
|
package uia.com.api.ContabilidadUIA.modelo.cheques;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import uia.com.api.ContabilidadUIA.modelo.clientes.InfoUIA;
public class NotaDebito extends InfoUIA
{
String fecha = "";
public NotaDebito()
{
}
public NotaDebito(@JsonProperty("id")int id, @JsonProperty("name")String name, @JsonProperty("estado")String status, @JsonProperty("fecha")String fecha)
{
super(id, name);
this.setEstado(status);
super.type = this. getClass(). getSimpleName();
this.setFecha(fecha);
}
public NotaDebito(int id, String name, String p1)
{
super(id, name);
this.fecha = p1;
}
public String getFecha() {
return fecha;
}
public void setFecha(String fecha) {
this.fecha = fecha;
}
public void validaCobranza()
{
System.out.println("Ejecutando validaCobranza() de " + this.getId()+ " "+this.getName());
}
}
|
[
"[email protected]"
] | |
d2249784efaa5997cbc57275ef85aeaab7669b6f
|
3f01bb0acbbf497adba8474551592db9b92b5dcc
|
/src/test/CandidateTest.java
|
b4cebe2ad7924cdf6b8a96be94789eba41ce98f8
|
[] |
no_license
|
zixiaoy/secondProject
|
111c228279e279dff481533643b612b3138e2ce5
|
e4f7c635fe102962b4ffad1ee336b429219454df
|
refs/heads/master
| 2020-03-31T21:24:30.028788 | 2018-10-25T00:36:45 | 2018-10-25T00:36:45 | 152,579,443 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 790 |
java
|
import com.xiaoy.entity.Candidate;
import com.xiaoy.service.CandidateServ;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
/**
* Created by 紫青 on 2018/10/12.
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath*:applicationContext.xml")
public class CandidateTest {
@Autowired
private CandidateServ candidateServ;
@Test
public void testFindCandidateByCreaTime(){
// candidateServ.saveCandidate(new Candidate(1,new Date(),1,1));
System.out.println(candidateServ.findCandidateByVisitorId(2));
}
}
|
[
"[email protected]"
] | |
905536da10d0a75e95f6f453544aeafc31f38f75
|
c3fa36983f5fd99802c42e78943a391d4efe7f7d
|
/src/main/java/com/ssh/quartz/controller/PmsBrandController.java
|
f97b67fb18d819cb8da6de896af17e6d54edf885
|
[] |
no_license
|
ssh3519/springboot-quartz
|
ed3c90b33c6172202cd0df572d6137b49b079aa0
|
6bb9df4a82bb7ec65eae01a35669df3f7822d389
|
refs/heads/master
| 2022-12-30T17:17:43.141914 | 2020-10-26T03:54:05 | 2020-10-26T03:54:05 | 307,255,603 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,051 |
java
|
package com.ssh.quartz.controller;
import com.ssh.quartz.common.api.CommonPage;
import com.ssh.quartz.common.api.CommonResult;
import com.ssh.quartz.mbg.model.PmsBrand;
import com.ssh.quartz.service.PmsBrandService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @description
* @author: ssh
* @Date: 2020/10/26 11:39
*/
//@Api(tags = "PmsBrandController", description = "商品品牌管理")
@Controller
@RequestMapping("/brand")
public class PmsBrandController {
@Autowired
private PmsBrandService brandService;
private static final Logger LOGGER = LoggerFactory.getLogger(PmsBrandController.class);
@ApiOperation("获取所有品牌列表")
@RequestMapping(value = "listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsBrand>> getBrandList() {
return CommonResult.success(brandService.listAllBrand());
}
@ApiOperation("添加品牌")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult createBrand(@RequestBody PmsBrand pmsBrand) {
CommonResult commonResult;
int count = brandService.createBrand(pmsBrand);
if (count == 1) {
commonResult = CommonResult.success(pmsBrand);
LOGGER.debug("createBrand success:{}", pmsBrand);
} else {
commonResult = CommonResult.failed("操作失败");
LOGGER.debug("createBrand failed:{}", pmsBrand);
}
return commonResult;
}
@ApiOperation("更新指定id品牌信息")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateBrand(@PathVariable("id") Long id, @RequestBody PmsBrand pmsBrandDto, BindingResult result) {
CommonResult commonResult;
int count = brandService.updateBrand(id, pmsBrandDto);
if (count == 1) {
commonResult = CommonResult.success(pmsBrandDto);
LOGGER.debug("updateBrand success:{}", pmsBrandDto);
} else {
commonResult = CommonResult.failed("操作失败");
LOGGER.debug("updateBrand failed:{}", pmsBrandDto);
}
return commonResult;
}
@ApiOperation("删除指定id的品牌")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult deleteBrand(@PathVariable("id") Long id) {
int count = brandService.deleteBrand(id);
if (count == 1) {
LOGGER.debug("deleteBrand success :id={}", id);
return CommonResult.success(null);
} else {
LOGGER.debug("deleteBrand failed :id={}", id);
return CommonResult.failed("操作失败");
}
}
@ApiOperation("分页查询品牌列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<PmsBrand>> listBrand(@RequestParam(value = "pageNum", defaultValue = "1")
@ApiParam("页码") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "3")
@ApiParam("每页数量") Integer pageSize) {
List<PmsBrand> brandList = brandService.listBrand(pageNum, pageSize);
return CommonResult.success(CommonPage.restPage(brandList));
}
@ApiOperation("获取指定id的品牌详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<PmsBrand> brand(@PathVariable("id") Long id) {
return CommonResult.success(brandService.getBrand(id));
}
}
|
[
"shensh"
] |
shensh
|
49ffdb3159d98bd91fb0a938a5d3828e42aa2a46
|
bf2966abae57885c29e70852243a22abc8ba8eb0
|
/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/InstanceLifecycle.java
|
33d6f2a7d87b2fe20c90ed70d7430ed0bb9cd0c6
|
[
"Apache-2.0"
] |
permissive
|
kmbotts/aws-sdk-java
|
ae20b3244131d52b9687eb026b9c620da8b49935
|
388f6427e00fb1c2f211abda5bad3a75d29eef62
|
refs/heads/master
| 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 |
Apache-2.0
| 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null |
UTF-8
|
Java
| false | false | 1,788 |
java
|
/*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.ec2.model;
import javax.annotation.Generated;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum InstanceLifecycle {
Spot("spot"),
OnDemand("on-demand");
private String value;
private InstanceLifecycle(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
/**
* Use this in place of valueOf.
*
* @param value
* real value
* @return InstanceLifecycle corresponding to the value
*
* @throws IllegalArgumentException
* If the specified value does not map to one of the known values in this enum.
*/
public static InstanceLifecycle fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException("Value cannot be null or empty!");
}
for (InstanceLifecycle enumEntry : InstanceLifecycle.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
}
}
|
[
""
] | |
14753bec4c078bc47f3fe6ffbf8d53b9f2e38ffe
|
b055b4212d839153eb6ff6a64a79eaf34c5f3f00
|
/src/Person.java
|
a9f99bf2460f6f7969412193d78de0fd8172821f
|
[] |
no_license
|
Robert-Piwowarczyk/zadanie-3.1.0
|
6a1c112bdd74e94d73a8bdbccfe736a0ab371796
|
7754ffbaae1ae665350d502242f171cca0024ea8
|
refs/heads/master
| 2022-04-16T11:29:05.976743 | 2020-04-12T16:45:40 | 2020-04-12T16:45:40 | 255,064,697 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 131 |
java
|
class Person {
String firstName;
String lastName;
String pesel;
Addres livingAddres;
Addres registeredAddres;
}
|
[
"[email protected]"
] | |
d4a42d24dfdd8ae636eb7d4850bc761ed6832f20
|
fed24d613eefe68217b5ade1fd65f7bedfdd813d
|
/core/src/main/java/com/linecorp/armeria/client/endpoint/FileWatcherRunnable.java
|
9b8afe1d51b884cb59689916be0ad5404c11b920
|
[
"BSD-3-Clause",
"EPL-1.0",
"WTFPL",
"MIT",
"JSON",
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
anuraaga/armeria
|
45f251337ecfe3eafb5d61fcd883cfb8f24ae6a4
|
7afa5bdbc25856568a49062a4195af94f3a3bf0f
|
refs/heads/master
| 2021-11-04T04:51:12.220718 | 2020-05-15T06:41:56 | 2020-05-15T06:41:56 | 46,321,489 | 2 | 0 |
Apache-2.0
| 2019-12-02T08:30:21 | 2015-11-17T03:43:26 |
Java
|
UTF-8
|
Java
| false | false | 5,113 |
java
|
/*
* Copyright 2019 LINE Corporation
*
* LINE Corporation 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:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.linecorp.armeria.client.endpoint;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.OVERFLOW;
import java.nio.file.ClosedWatchServiceException;
import java.nio.file.Path;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import com.linecorp.armeria.client.endpoint.FileWatcherRegistry.FileSystemWatchContext;
/**
* A runnable which watches files.
*/
class FileWatcherRunnable implements Runnable {
private static final Logger logger = LoggerFactory.getLogger(FileWatcherRunnable.class);
private final WatchService watchService;
private final FileSystemWatchContext fileSystemWatchContext;
/**
* Initializes a runnable which watches files.
* @param watchService the {@code WatchService} to receive events from
* @param fileSystemWatchContext the context which contains target files
*/
FileWatcherRunnable(WatchService watchService, FileSystemWatchContext fileSystemWatchContext) {
this.watchService = watchService;
this.fileSystemWatchContext = fileSystemWatchContext;
}
@Override
public void run() {
try {
WatchKey key;
while ((key = watchService.take()) != null) {
final Path dirPath = (Path) key.watchable();
for (WatchEvent<?> event : key.pollEvents()) {
if (event.kind().type() == Path.class) {
@SuppressWarnings("unchecked")
final Path filePath = dirPath.resolve(((WatchEvent<Path>) event).context());
if (event.kind().equals(ENTRY_DELETE)) {
logger.warn("Ignoring a deleted file: {}", filePath);
continue;
}
runCallback(filePath);
} else if (event.kind().equals(OVERFLOW)) {
logger.debug("Watch events may have been lost for path: {}", dirPath);
runCallback(dirPath);
} else {
logger.debug("Ignoring unexpected event type: {}", event.kind().name());
}
}
final boolean reset = key.reset();
if (!reset) {
logger.info("Path will no longer be watched: {}", dirPath);
}
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
logger.trace("File watching thread interrupted");
} catch (ClosedWatchServiceException e) {
// do nothing
}
}
private void runCallback(Path path) {
fileSystemWatchContext.watchEvents().stream().filter(
ctx -> path.startsWith(ctx.dirPath())).forEach(ctx -> {
try {
ctx.runCallback();
} catch (Exception e) {
logger.warn("Unexpected error from listener: {} ", path, e);
}
});
}
/**
* Utility class which contains context info for each watched path.
*/
static class FileWatchEvent {
private final WatchKey watchKey;
private final Runnable callback;
private final Path dirPath;
/**
* Initializes the context for each watched path.
* @param watchKey the {@link WatchKey} registered for the current path
* @param callback the callback which is invoked on a watch event
* @param dirPath path which is watched
*/
FileWatchEvent(WatchKey watchKey, Runnable callback, Path dirPath) {
this.watchKey = watchKey;
this.callback = callback;
this.dirPath = dirPath;
}
private void runCallback() {
callback.run();
}
Path dirPath() {
return dirPath;
}
void cancel() {
watchKey.cancel();
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("dirPath", dirPath)
.add("watchable", watchKey.watchable())
.add("isValid", watchKey.isValid())
.toString();
}
}
}
|
[
"[email protected]"
] | |
0a9547446c5c16be8b605400304cb2dedd642d74
|
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
|
/aws-java-sdk-chimesdkmessaging/src/main/java/com/amazonaws/services/chimesdkmessaging/model/ErrorCode.java
|
a1a2eb1cafcaaa5dd9404089879997d7e834352c
|
[
"Apache-2.0"
] |
permissive
|
aws/aws-sdk-java
|
2c6199b12b47345b5d3c50e425dabba56e279190
|
bab987ab604575f41a76864f755f49386e3264b4
|
refs/heads/master
| 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 |
Apache-2.0
| 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null |
UTF-8
|
Java
| false | false | 2,311 |
java
|
/*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.chimesdkmessaging.model;
import javax.annotation.Generated;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum ErrorCode {
BadRequest("BadRequest"),
Conflict("Conflict"),
Forbidden("Forbidden"),
NotFound("NotFound"),
PreconditionFailed("PreconditionFailed"),
ResourceLimitExceeded("ResourceLimitExceeded"),
ServiceFailure("ServiceFailure"),
AccessDenied("AccessDenied"),
ServiceUnavailable("ServiceUnavailable"),
Throttled("Throttled"),
Throttling("Throttling"),
Unauthorized("Unauthorized"),
Unprocessable("Unprocessable"),
VoiceConnectorGroupAssociationsExist("VoiceConnectorGroupAssociationsExist"),
PhoneNumberAssociationsExist("PhoneNumberAssociationsExist");
private String value;
private ErrorCode(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
/**
* Use this in place of valueOf.
*
* @param value
* real value
* @return ErrorCode corresponding to the value
*
* @throws IllegalArgumentException
* If the specified value does not map to one of the known values in this enum.
*/
public static ErrorCode fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException("Value cannot be null or empty!");
}
for (ErrorCode enumEntry : ErrorCode.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
}
}
|
[
""
] | |
aaad73699858d394326796d1a6f290a2137fb0b9
|
7dd970da92a2919f06caa99c6da5be3415169476
|
/src/thread/Deadlock.java
|
a4b307b8f27ba4a54ac70ab6654c83acc6d2dc59
|
[] |
no_license
|
JAVACodeFarmer/basic-learning
|
7ff0da096de6282db93c3cad124149405526971b
|
014a3a9a46619ea5ac617aea9e21f92b0f70f132
|
refs/heads/master
| 2020-03-24T03:33:52.462805 | 2018-07-26T10:22:16 | 2018-07-26T10:22:16 | 142,424,372 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,182 |
java
|
package thread;
/**
* Created by yi.yh on 2018/7/25.
* 死锁
*/
public class Deadlock {
static class Friend {
private final String name;
public Friend(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public synchronized void bow(Friend bower) {
System.out.format("%s: %s" + " has bowed to me!%n", this.name, bower.getName());
bower.bowBack(this);
}
public synchronized void bowBack(Friend bower) {
System.out.format("%s: %s" + " has bowed back to me!%n", this.name, bower.getName());
}
}
public static void main(String[] args) {
final Friend alphonse = new Friend("Alphonse");
final Friend gaston = new Friend("Gaston");
// new Thread(new Runnable() {
// public void run() { alphonse.bow(gaston); }
// }).start();
//
// new Thread(new Runnable() {
// public void run() { gaston.bow(alphonse); }
// }).start();
new Thread(() -> alphonse.bow(gaston)).start();
new Thread(() -> gaston.bow(alphonse)).start();
}
}
|
[
"[email protected]"
] | |
3774794269fb4be1e0932738c86580ed950a89db
|
36f5587cae0987de920a205d55d3b47e41f2fefb
|
/src/main/java/com/xiao/jd/vop/bean/stock/StockResult.java
|
421188b4f1ebe01bc087c52b87a42a56fdc6f85c
|
[] |
no_license
|
lihuafeng/jd-vop-api
|
ab1daa6a45c13e6abda972cd9f4820dcb0c27fa5
|
9589f05c60bda8219152edabaf726c174e38b736
|
refs/heads/master
| 2020-08-30T23:50:45.605457 | 2018-05-21T03:01:05 | 2018-05-21T03:01:05 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,308 |
java
|
package com.xiao.jd.vop.bean.stock;
import java.io.Serializable;
/**
* 〈京东库存信息〉<br>
*
* @author jianjun.xiao
* @create 2018/2/9 9:52
* @since 1.0.0
*/
public class StockResult implements Serializable {
private static final long serialVersionUID = 6270018860718585946L;
/**
* 地址
*/
private String area;
/**
* 库存状态描述
* 有货 现货
* 有货 在途
*/
private String desc;
/**
* 商品编号
*/
private long sku;
/**
* 库存状态编号
* 33 有货 现货-下单立即发货
* 39 有货 在途-正在内部配货,预计 2~6 天到达本仓库
* 40 有货 可配货-下单后从有货仓库配货
* 36 预订
* 34 无货
*/
private int state;
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public long getSku() {
return sku;
}
public void setSku(long sku) {
this.sku = sku;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
}
|
[
"[email protected]"
] | |
764cae8cf1190be70729dcddf81fbfdabeab5098
|
f3f1f6da6e725aadda2b4f3761b23e19bdad1193
|
/app/src/main/java/com/example/sportup/trainer_add_Exersice.java
|
5df7da54d06348974c22192af4f9e33e294a04e9
|
[] |
no_license
|
NetanelShimoni/SportUp-App
|
ab1946d7ddaa562da5ab8a5903dc1ef0872d779f
|
b0d0fa3f93ad6fa51e28ca3d341a7ee09d43d9f4
|
refs/heads/or_branch
| 2023-02-08T23:08:38.313382 | 2020-12-27T15:02:22 | 2020-12-27T15:02:22 | 317,814,478 | 0 | 1 | null | 2020-12-27T15:04:37 | 2020-12-02T09:38:45 |
Java
|
UTF-8
|
Java
| false | false | 2,810 |
java
|
package com.example.sportup;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class trainer_add_Exersice extends AppCompatActivity {
Spinner spinner_muselse,spinner_hight,spinner_wight;
EditText e_name , e_dis,e_link;
DatabaseReference exerciseDbRef;
Button add;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_trainer_add__exersice);
spinner_muselse = findViewById(R.id.spinner_trainer_muselse);
Intent i = getIntent();
spinner_muselse.setSelection(i.getExtras().getInt("id_m"));
e_name=findViewById(R.id.edit_name);
e_dis=findViewById(R.id.editText_discrpition);
e_link=findViewById(R.id.edit_link);
spinner_hight=findViewById(R.id.spinner_how_hight);
spinner_wight=findViewById(R.id.spinner_how_weight);
add = findViewById(R.id.button_add_exe);
FirebaseDatabase mData = FirebaseDatabase.getInstance();
exerciseDbRef = mData.getInstance().getReference("Exersice");
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String name = e_name.getText().toString();
String discription = e_dis.getText().toString();
String link = e_link.getText().toString();
String hight = spinner_hight.getSelectedItem().toString();
String witht = spinner_wight.getSelectedItem().toString();
String name_maselce = spinner_muselse.getSelectedItem().toString();
Intent intent = getIntent();
Tranier mover = (Tranier)intent.getSerializableExtra("trainer");
String id = exerciseDbRef.push().getKey();
String name_trainer=mover.getName();
String phone_trainer=mover.phone_num;
Exersice e = new Exersice(name_maselce,name,name_trainer,phone_trainer,discription,witht,hight,link);
exerciseDbRef.child(id).setValue(e);
Toast.makeText(trainer_add_Exersice.this, "Data inserted!", Toast.LENGTH_SHORT).show();
Intent i = new Intent(trainer_add_Exersice.this, trainer_Home.class);
i.putExtra("trainer",mover);
startActivity(i);
}});
}
}
|
[
"[email protected]"
] | |
ac66d5db2dfbdf594e73612ad7d68910c0580852
|
94092671fb09e5a9749bbcad99814e9be44124fd
|
/flight/src/main/java/com/xworkz/web/component/FlightComponent.java
|
a4cee34ebf3e5a9183de629431682cb7d7c1a01c
|
[] |
no_license
|
Tapannaik/flight
|
73004b10014f300587f03fc095c4ac702263de02
|
14120b55a4b3304d3bd4631038c1fa6072f1b25b
|
refs/heads/master
| 2022-12-24T01:21:44.855440 | 2019-07-11T08:59:01 | 2019-07-11T08:59:01 | 196,355,658 | 0 | 0 | null | 2022-12-16T06:36:57 | 2019-07-11T08:45:31 |
Java
|
UTF-8
|
Java
| false | false | 881 |
java
|
package com.xworkz.web.component;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
//error
@Component
@RequestMapping("/")
public class FlightComponent {
public FlightComponent() {
System.out.println("created /t" + this.getClass().getSimpleName());
}
@RequestMapping("/saveFlight.do")
public String onSave() {
System.out.println("invoked on save");
return "/Servlet.jsp";
}
@RequestMapping("/saveFlight2.do")
public String onSave(@RequestParam String name, @RequestParam int passanger, @RequestParam String airport,
@RequestParam String arrival, @RequestParam String departure) {
System.out.println(name + " " + passanger + " " + airport + " " + arrival + " " + departure);
return "/Servlet.jsp";
}
}
|
[
"[email protected]"
] | |
b66b3450f9d93947b2147a463cddcd27555ce498
|
ba4cf6b03c8941449eae7c9f70a48739072d4d80
|
/wk-framework-utils/src/main/java/com/wk/framework/utils/VideoUtil.java
|
6d6ea6d904b8728c34c7b8f01e2e946691425132
|
[] |
no_license
|
LuoHongGit/bs-wk-services
|
042473ff68067166c354cd32522ce5a6114098b6
|
7f39a882eac5f71e6fb34c36ea560ed25acb7162
|
refs/heads/master
| 2023-02-09T02:56:57.098514 | 2021-01-04T08:38:00 | 2021-01-04T08:38:00 | 316,161,830 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,459 |
java
|
package com.wk.framework.utils;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* 此文件作为视频文件处理父类,提供:
* 1、查看视频时长
* 2、校验两个视频的时长是否相等
*
*/
public class VideoUtil {
String ffmpeg_path = "D:\\Program Files\\ffmpeg-20180227-fa0c9d6-win64-static\\bin\\ffmpeg.exe";//ffmpeg的安装位置
public VideoUtil(String ffmpeg_path){
this.ffmpeg_path = ffmpeg_path;
}
//检查视频时间是否一致
public Boolean check_video_time(String source,String target) {
String source_time = get_video_time(source);
//取出时分秒
source_time = source_time.substring(0,source_time.lastIndexOf("."));
String target_time = get_video_time(target);
//取出时分秒
target_time = target_time.substring(0,target_time.lastIndexOf("."));
if(source_time == null || target_time == null){
return false;
}
if(source_time.equals(target_time)){
return true;
}
return false;
}
//获取视频时间(时:分:秒:毫秒)
public String get_video_time(String video_path) {
/*
ffmpeg -i lucene.mp4
*/
List<String> commend = new ArrayList<String>();
commend.add(ffmpeg_path);
commend.add("-i");
commend.add(video_path);
try {
ProcessBuilder builder = new ProcessBuilder();
builder.command(commend);
//将标准输入流和错误输入流合并,通过标准输入流程读取信息
builder.redirectErrorStream(true);
Process p = builder.start();
String outstring = waitFor(p);
System.out.println(outstring);
int start = outstring.trim().indexOf("Duration: ");
if(start>=0){
int end = outstring.trim().indexOf(", start:");
if(end>=0){
String time = outstring.substring(start+10,end);
if(time!=null && !time.equals("")){
return time.trim();
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
public String waitFor(Process p) {
InputStream in = null;
InputStream error = null;
String result = "error";
int exitValue = -1;
StringBuffer outputString = new StringBuffer();
try {
in = p.getInputStream();
error = p.getErrorStream();
boolean finished = false;
int maxRetry = 600;//每次休眠1秒,最长执行时间10分种
int retry = 0;
while (!finished) {
if (retry > maxRetry) {
return "error";
}
try {
while (in.available() > 0) {
Character c = new Character((char) in.read());
outputString.append(c);
System.out.print(c);
}
while (error.available() > 0) {
Character c = new Character((char) in.read());
outputString.append(c);
System.out.print(c);
}
//进程未结束时调用exitValue将抛出异常
exitValue = p.exitValue();
finished = true;
} catch (IllegalThreadStateException e) {
Thread.currentThread().sleep(1000);//休眠1秒
retry++;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
return outputString.toString();
}
public static void main(String[] args) throws IOException {
String ffmpeg_path = "D:\\Program Files\\ffmpeg-20180227-fa0c9d6-win64-static\\bin\\ffmpeg.exe";//ffmpeg的安装位置
VideoUtil videoUtil = new VideoUtil(ffmpeg_path);
String video_time = videoUtil.get_video_time("E:\\ffmpeg_test\\1.avi");
System.out.println(video_time);
}
}
|
[
"[email protected]"
] | |
39a574b5d359c28485ace8445719e21ea496f942
|
1a99b7ad4fccd9824aeada985171dfcc258a16aa
|
/src/main/java/org/jboss/wfk/repotree/filter/SignatureFilter.java
|
31177ca42834b049224d55afed86d533782dd59c
|
[] |
no_license
|
kpiwko/repotree
|
7183021f6fa05f548ba40c581c35866d63ac7530
|
5874d9258cceeb26fd8c803a8acb7d5b79fba961
|
refs/heads/master
| 2016-09-06T15:10:05.334842 | 2011-05-18T15:40:03 | 2011-05-18T15:40:03 | 1,068,751 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,806 |
java
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* 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.jboss.wfk.repotree.filter;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.logging.Logger;
import org.jboss.wfk.repotree.api.Configuration;
import org.jboss.wfk.repotree.api.Filter;
import org.jboss.wfk.repotree.artifact.Artifact;
/**
* @author <a href="mailto:[email protected]">Karel Piwko</a>
*
*/
public class SignatureFilter implements Filter
{
private static final Logger log = Logger.getLogger(SignatureFilter.class.getName());
private static final String SIGNATURE_ENTRY_ATTR = "SHA1-Digest-Manifest";
private Configuration configuration;
/*
* (non-Javadoc)
*
* @see org.jboss.wfk.repotree.filter.Filter#accept(java.io.File)
*/
public boolean accept(File file) throws Exception
{
JarFile jar = new JarFile(file);
Enumeration<JarEntry> elements = jar.entries();
List<JarEntry> candidates = new ArrayList<JarEntry>();
while (elements.hasMoreElements())
{
JarEntry entry = elements.nextElement();
if (!entry.isDirectory() && isSignatureFile(entry.getName()))
{
candidates.add(entry);
}
}
if (candidates.isEmpty())
{
return false;
}
for (JarEntry entry : candidates)
{
String signature = extractSignature(jar, entry);
log.fine("Signature for: " + file.getName() + " is " + "'" + signature + "'");
Artifact artifact = configuration.getSignatures().lookup(signature);
if (artifact == null)
{
continue;
}
if (configuration.getRepositorySystem().installArtifact(artifact.attachFile(file), null))
{
return true;
}
}
return false;
}
/*
* (non-Javadoc)
*
* @see org.jboss.wfk.repotree.filter.Filter#configure(org.jboss.wfk.repotree.Configuration)
*/
public void configure(Configuration configuration)
{
this.configuration = configuration;
}
/*
* (non-Javadoc)
*
* @see org.jboss.wfk.repotree.filter.Filter#name()
*/
public String name()
{
return "Signature";
}
private String extractSignature(JarFile jar, JarEntry signatureEntry)
{
try
{
Manifest signature = new Manifest();
signature.read(jar.getInputStream(signatureEntry));
Attributes attrs = signature.getMainAttributes();
return attrs.getValue(SIGNATURE_ENTRY_ATTR);
}
catch (IOException e)
{
log.warning("Unable to extract signature from a signed jar file: " + jar.getName() + ", cause: " + e.getMessage());
}
return null;
}
private boolean isSignatureFile(String name)
{
return name.startsWith("META-INF") && name.toUpperCase().endsWith(".SF");
}
}
|
[
"[email protected]"
] | |
d1dae2c25a528c70ee55a09ce9dcb3c6f8be4a82
|
b6a7fc77850a32e846f28c087c1d525f2af21f74
|
/ovh.api/src/main/java/com/milleapplis/ovh/api/sms/Users.java
|
e62643cc13ae28c50808e38e75aa158747bc9d3c
|
[
"Apache-2.0"
] |
permissive
|
1000applis/ovh-api
|
dd7d3aa1f570e10fc31eed1bad979726011a9790
|
cfbc6d7ea0dab14fbc029a78ac0f7e37cc6bc2a7
|
refs/heads/master
| 2022-11-23T20:50:48.361381 | 2019-08-02T06:06:32 | 2019-08-02T06:06:32 | 53,325,130 | 1 | 0 |
Apache-2.0
| 2022-11-16T12:39:24 | 2016-03-07T12:48:10 |
Java
|
UTF-8
|
Java
| false | false | 1,868 |
java
|
package com.milleapplis.ovh.api.sms;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Users {
@JsonProperty
private Quota quotaInformations;
@JsonProperty
private String password;
@JsonProperty
private String stopCallBack;
@JsonProperty
private List<String> ipRestrictions;
private AlertThreshold alertThresholdInformations;
private String login;
private String callBack;
public String toString() {
return String.format("[Login : %s][Quota info : %s][Stop callback : %s][IP Restrictions : %s][Alert threshold info : %s][Callback : %s]",
login, quotaInformations, stopCallBack, ipRestrictions, alertThresholdInformations, callBack);
}
public Quota getQuotaInformations() {
return quotaInformations;
}
public void setQuotaInformations(Quota quotaInformations) {
this.quotaInformations = quotaInformations;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getStopCallBack() {
return stopCallBack;
}
public void setStopCallBack(String stopCallBack) {
this.stopCallBack = stopCallBack;
}
public List<String> getIpRestrictions() {
return ipRestrictions;
}
public void setIpRestrictions(List<String> ipRestrictions) {
this.ipRestrictions = ipRestrictions;
}
public AlertThreshold getAlertThresholdInformations() {
return alertThresholdInformations;
}
public void setAlertThresholdInformations(
AlertThreshold alertThresholdInformations) {
this.alertThresholdInformations = alertThresholdInformations;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getCallBack() {
return callBack;
}
public void setCallBack(String callBack) {
this.callBack = callBack;
}
}
|
[
"[email protected]"
] | |
6a6ca7249c80496f29e8854a0ae7fc15827c0c45
|
7b9821957842dbe317b000b6d765c3832732488e
|
/main/java/com/example/school/services/interfaces/IAuthGroupService.java
|
c60214d3425d80e0c03f321c2049ce6b7e1ecf72
|
[] |
no_license
|
OPNydox/SchoolRegisterProject
|
12a51192dc9169718b0ad2e0b991e8842068c614
|
b649b99d9bdfd86760409b18383ce85ec7eac125
|
refs/heads/master
| 2023-09-01T21:13:00.138790 | 2021-10-02T09:32:28 | 2021-10-02T09:32:28 | 303,963,899 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 333 |
java
|
package com.example.school.services.interfaces;
import com.example.school.database.entities.AuthGroup;
import com.example.school.utilities.ServiceReturnResult;
import com.example.school.viewModels.Interfaces.UserViewModel;
public interface IAuthGroupService {
ServiceReturnResult<AuthGroup> addAuth(UserViewModel viewModel);
}
|
[
"[email protected]"
] | |
7b26860af58b61c825409c34ff6627b24fcf2f91
|
2fac1b6a785bc4bc5bba919ddcde1099e93675de
|
/Customer.java
|
edb45bde7e042795ce89f69b7aab7adbaa0c8b86
|
[] |
no_license
|
Pendulun/AulaPraticaRefactoring
|
de36b40695964d2937a1ad516f3b116dc71a0947
|
faf3822f359bf7832c18944d4aa71257598a6dde
|
refs/heads/main
| 2023-06-28T20:52:51.195081 | 2021-08-04T15:39:58 | 2021-08-04T15:39:58 | 392,702,650 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,190 |
java
|
import java.util.Enumeration;
import java.util.Vector;
public class Customer {
private String _name;
private Vector<Rental> _rentals = new Vector<Rental>();
public Customer (String name){
_name = name;
}
public void addRental(Rental arg) {
_rentals.addElement(arg);
}
public String getName (){
return _name;
}
public Enumeration getRentals() {
return _rentals.elements();
}
public String statement() {
return new TextStatement().value(this);
}
public double getTotalCharge() {
double result = 0;
Enumeration rentals = _rentals.elements();
while (rentals.hasMoreElements()) {
Rental each = (Rental) rentals.nextElement();
result += each.getCharge();
}
return result;
}
public int getTotalFrequentRenterPoints(){
int result = 0;
Enumeration rentals = _rentals.elements();
while (rentals.hasMoreElements()) {
Rental each = (Rental) rentals.nextElement();
result += each.getFrequentRenterPoints();
}
return result;
}
public String htmlStatement() {
return new HtmlStatement().value(this);
}
}
|
[
"[email protected]"
] | |
10aa046997758039d41853f29de7f20814bf5648
|
6283e53dc2d707bd29b6462cf577b1571037c3bf
|
/android/MediaPlayer/app/src/main/java/mart/io/mediaplayer/MainActivity.java
|
3ccef6f48aee83cfdcbd963aff885c3690fc948b
|
[] |
no_license
|
amartyushov/Experiments
|
2d95ebc442ae5707f8435f828a04aacca110dfc1
|
5af4e006e81c9d401a328c033c1fd9357da60131
|
refs/heads/master
| 2023-09-01T17:25:43.409389 | 2023-09-01T06:59:07 | 2023-09-01T06:59:07 | 90,235,236 | 0 | 2 | null | 2022-02-10T08:39:12 | 2017-05-04T07:40:54 |
Java
|
UTF-8
|
Java
| false | false | 1,331 |
java
|
package mart.io.mediaplayer;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
final MediaPlayer player = MediaPlayer.create(this, R.raw.color_black);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView play = (TextView) findViewById(R.id.play);
play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
player.start();
}
});
TextView pause = (TextView) findViewById(R.id.pause);
pause.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
player.pause();
}
});
player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
Toast.makeText(MainActivity.this,
"Song has finished", Toast.LENGTH_SHORT).show();
}
});
}
}
|
[
"[email protected]"
] | |
74842e10b4da0a1a12fd069ab62df37d22b56fce
|
5a637cb8d14e58f0ee1ba640acddd0380df1d907
|
/src/ciknow/teamassembly/Team.java
|
d9534d6ce3c5da4304f92647fefe547e2f4a98a8
|
[] |
no_license
|
albedium/ciknow
|
b20e46c925d54c54e176b0df65e1a5a96385066b
|
57e401eb5ffa24181c7cb72e59fc0e7319cfc104
|
refs/heads/master
| 2021-01-21T01:17:55.683578 | 2012-09-26T18:27:03 | 2012-09-26T18:27:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,953 |
java
|
package ciknow.teamassembly;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import ciknow.domain.Edge;
import ciknow.domain.Node;
public class Team {
private static Log logger = LogFactory.getLog(Team.class);
private TeamBuilder tb;
private int id;
private List<Node> members = new LinkedList<Node>();
private double score = 0.0;
private double diversity = 0.0;
private double similarity = 0.0;
private double density = 0.0;
public Team(TeamBuilder tb, int id){
this.tb = tb;
this.id = id;
members = new LinkedList<Node>();
score = 0.0;
}
public Team(TeamBuilder tb, String id, String[] memberIds){
this.tb = tb;
this.id = Integer.parseInt(id);
for (String memberId : memberIds){
long nodeId = Long.parseLong(memberId);
Node member = tb.getNodeById(nodeId);
if (member == null){
logger.error("ERROR: CANNOT IDENTIFY NODE (ID=" + nodeId);
continue;
}
members.add(member);
member.setAttribute(TeamBuilder.TEAM_KEY, id);
}
score = calculateScore();
}
public double getGain(Node newMember){
members.add(newMember);
double gain = calculateScore() - score;
members.remove(newMember);
//return Double.parseDouble(nf.format(gain));
return gain;
}
public double getLoss(Node removeMember){
members.remove(removeMember);
double loss = score - calculateScore();
members.add(removeMember);
//return Double.parseDouble(nf.format(loss));
return loss;
}
public double calculateScore(){
// diversity
double w = Double.parseDouble((String)tb.getParams().get("diversity"));
double s = 0.0;
diversity = calculateDiversity();
s += diversity * w;
// size
//s += members.size();
// hobby (similarity)
w = Double.parseDouble((String)tb.getParams().get("similarity"));
similarity = calculateSimilarity(tb.getHobbies());
s += similarity * w;
// density
w = Double.parseDouble((String)tb.getParams().get("density"));
density = calculateDensity();
s += density * w;
return s;
}
@SuppressWarnings("unchecked")
private double calculateDiversity() {
double s = 0.0;
List<Map> skills = (List<Map>)tb.getParams().get("skills");
for (Map skill : skills){
String name = (String) skill.get("name");
double weight = Double.parseDouble((String)skill.get("weight"));
if (weight <= 0) continue;
for (Node member : members){
if (member.getAttribute(name) != null){
s += weight;
break;
}
}
}
return s;
}
public Node getRemovableMember(){
Node removable = null;
if (getSize() <= tb.getMinTeamSize()) return removable;
List<Double> losses = new LinkedList<Double>();
double minLoss = Double.MAX_VALUE;
for (int i = 0; i < members.size(); i++){
Node member = members.get(i);
double loss = getLoss(member);
losses.add(loss);
if (minLoss > loss) minLoss = loss;
}
int index = TeamBuilder.getRandomIndex(losses, minLoss);
return members.get(index);
}
public int getSize(){
return getMembers().size();
}
private double calculateSimilarity(List<String> hobbies){
double score = 0.0;
// max (members of a hobby)
// for (String hobby : hobbies){
// int count = 0;
// for (Node member : members){
// if (member.getAttribute(hobby) != null) count++;
// }
// if (count > score) score = count;
// }
// yun's
// Set<String> livingHobbies = new HashSet<String>();
// for (Node member : members){
// Set<String> iHobbies = new HashSet<String>(hobbies);
// iHobbies.retainAll(member.getAttributes().keySet());
// livingHobbies.addAll(iHobbies);
// }
// logger.debug("all hobbies: " + hobbies.size() + ", living hobbies: " + livingHobbies.size());
// if (livingHobbies.size() == 0) return score;
//
// int count = 0;
// for (Node member : members){
// Set<String> iHobbies = new HashSet<String>(livingHobbies);
// iHobbies.retainAll(member.getAttributes().keySet());
// if (iHobbies.size() == 0) continue;
//
// double pi = iHobbies.size()/livingHobbies.size();
// logger.debug("member: " + member.getLabel() + ", iHobbies: " + iHobbies.size() + ", pi: " + pi);
// score += pi * pi;
// count++;
// }
// score = score/count;;
// http://en.wikipedia.org/wiki/Diversity_index
// assumption:
// 1) ignore nodes without hobbies;
// 2) allow multiple choices, e.g. result is also divided by number of hobbies
// in order to normalized b.w 0 ~ 1. This does not make much sense in practice :(
Collection<Node> boringMembers = TeamBuilder.getMembersWithoutAttributes(members, hobbies);
List<Node> activeMembers = new LinkedList<Node>(members);
activeMembers.removeAll(boringMembers);
if (activeMembers.size() == 0) return score;
for (String hobby : hobbies){
int count = 0;
for (Node member : activeMembers){
if (member.getAttribute(hobby) != null) count++;
}
double pi = count*1.0/activeMembers.size();
score += pi*pi;
}
score = score/hobbies.size();
return score;
}
private double calculateDensity(){
double score = 0.0;
if (members.size() > 0){
List<Edge> edges = tb.getEdgesAmongNodes(members);
int numType = 0;
Map<String, String> typeMap = new HashMap<String, String>();
for (Edge edge : edges){
String type = edge.getType();
if (typeMap.containsKey(type)) continue;
typeMap.put(type, type);
numType++;
}
int size = getSize();
double total = size > 1?size*(size-1):1;
score = (numType == 0 ? 0 : (edges.size()/numType)/total);
//logger.debug("team: " + id + ", teamSize: " + size +", numEdges: " + edges.size() + ", density: " + score);
}
return score;
}
public void addMember(Node member){
members.add(member);
score = calculateScore();
member.setAttribute(TeamBuilder.TEAM_KEY, Integer.toString(id));
logger.debug("Node " + member.getLabel() + " is added to team: " + id);
}
public void removeMember(Node member){
members.remove(member);
score = calculateScore();
member.getAttributes().remove(TeamBuilder.TEAM_KEY);
logger.debug("Node " + member.getLabel() + " is removed from team: " + id);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public List<Node> getMembers() {
return members;
}
public void setMembers(List<Node> members) {
this.members = members;
}
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
public double getDiversity() {
return diversity;
}
public void setDiversity(double diversity) {
this.diversity = diversity;
}
public double getSimilarity() {
return similarity;
}
public void setSimilarity(double similarity) {
this.similarity = similarity;
}
public void setDensity(double density) {
this.density = density;
}
public double getDensity() {
return density;
}
public TeamBuilder getTb() {
return tb;
}
public void setTb(TeamBuilder tb) {
this.tb = tb;
}
public String toString(){
StringBuilder sb = new StringBuilder();
sb.append("Team: " + id +
", size: " + getSize() +
", score:" + score +
", diversity: " + diversity +
", similarity: " + similarity +
", density: " + density +
", members: [");
for (int i=0; i < members.size(); i++){
Node member = members.get(i);
if (i > 0) sb.append(", ");
sb.append(member.getLabel());
}
sb.append("]");
return sb.toString();
}
}
|
[
"[email protected]"
] | |
c65b8f06b2d9b54f837ecc3ea8fd63ee6b6b0c2f
|
ca91a32851f54adb4c2e1179179b21d6bc7cb83a
|
/app/src/main/java/com/example/admin/bitsandpizza/PizzaFragment.java
|
0a979a35ef83ccee05e4e2d070c23e66d9fa3a4f
|
[] |
no_license
|
e-kuri/BritsAndPizza
|
85250396146a1070065701466b847620d6b7a0e6
|
8b3179a8439d96d59c19b4332cc56238d7781750
|
refs/heads/master
| 2021-01-20T15:39:27.099842 | 2016-07-18T13:20:54 | 2016-07-18T13:20:54 | 63,604,676 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 937 |
java
|
package com.example.admin.bitsandpizza;
import android.app.ListFragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
/**
* A simple {@link Fragment} subclass.
*/
public class PizzaFragment extends ListFragment {
public PizzaFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(inflater.getContext(), android.R.layout.simple_list_item_1,
getResources().getStringArray(R.array.pizzas));
setListAdapter(adapter);
return super.onCreateView(inflater, container, savedInstanceState);
}
}
|
[
"[email protected]"
] | |
ae0fc7bd0acdaa26ee6f9543d99543e74e814b08
|
a81744f4917a8cd429dde2b0b6fcd787e6e35c7e
|
/src/tetris_ui/MainFrame.java
|
28f65c46061ac5f070347595d17b4af0dc7e937b
|
[] |
no_license
|
IgorMedved/tetrisSolver
|
6956304700d443956b1c34fb9664b54c999da071
|
5696cb654b3fc5c10450e22c6afa0e152bdfa2bd
|
refs/heads/master
| 2021-01-10T17:56:11.941820 | 2017-06-16T03:39:13 | 2017-06-16T03:39:13 | 51,782,859 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,591 |
java
|
package tetris_ui;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JSplitPane;
import javax.swing.JToggleButton;
import javax.swing.KeyStroke;
import javax.swing.text.TextAction;
import tetris_model.Point;
import tetris_model.contracts.TetrisContract;
import tetris_model.events.GameEvent;
import tetris_model.events.GameEventListener;
import tetris_ui.events.UI_EventListener;
import tetris_ui.events.KeyBoardShortcutsAction;
import tetris_ui.events.ShapeMoveAction;
/*
* This is Top level UI class all the components are initialized and laid out here
*/
public class MainFrame extends JFrame implements GameEventListener, ActionListener, ItemListener {
private TetrisPanel mTetrisGamePanel; // panel showing tetris board and all the figures on it (South East corner)
private PicturePanel mPicturePanel; // panel with cover picture and hidden picture
private ScorePanel mScorePanel; // panel showing current score and level
private GameHelperPanel mGameHelperPanel; // panel with play button, and next shape Label and Panel on it
private SettingsPanel mSettingsPanel; // hide-able panel with some extra settings
//private JSplitPane mSplitPane; // allows to hide the settings menu
//*************************************************************************///
private UI_EventListener mInterfaceEventListener;
public MainFrame()
{
super ("Igor's self solving Tetris");
ImageDefinitions.initializePictures(); // call to read-in all the UI pictures,
// UI component initialization
mTetrisGamePanel = new TetrisPanel(12,18);
mGameHelperPanel = new GameHelperPanel();
mPicturePanel = new PicturePanel();
mScorePanel = new ScorePanel();
mSettingsPanel = new SettingsPanel();
componentLayout();
setSize(new Dimension(615,490));
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
public void componentLayout()
{
setLayout (new GridBagLayout());
GridBagConstraints gc = new GridBagConstraints();
// first row (scorePanel and GameHelperPanel
gc.gridx = 0;
gc.gridy = 0;
gc.weightx = .18;
gc.weighty = .04;
gc.anchor = GridBagConstraints.FIRST_LINE_START;
add(mScorePanel, gc);
gc.gridx=1;
gc.weightx=.12;
gc.anchor = GridBagConstraints.FIRST_LINE_START;
add (mGameHelperPanel, gc);
// second row (PicturePanel and TetrisGamePanel
gc.gridx = 0;
gc.gridy = 1;
gc.weightx=.18;
gc.weighty=.18;
gc.anchor = GridBagConstraints.FIRST_LINE_START;
add (mPicturePanel, gc);
gc.gridy = 1;
gc.gridx =1;
gc.weightx =.12;
gc.anchor = GridBagConstraints.FIRST_LINE_START;
add(mTetrisGamePanel, gc);
// last row
gc.gridx = 0;
gc.gridy=2;
gc.gridwidth=2;
gc.weighty = .04;
gc.anchor = GridBagConstraints.FIRST_LINE_START;
add(mSettingsPanel, gc);
}
// update interface into response to model changes
@Override
public synchronized void gameEventOccurred(GameEvent e)
{
// update gameBoard view
if (e.getBoard()!=null)
{
//System.out.println("running board update");
mTetrisGamePanel.showBoard(e.getBoard(), e.getCurrentShape(), e.getCurrentShapeType(), e.getHintsLocations());
}
// update nextShape screen if necessary
if (e.getNextShape()!= null)
{
mGameHelperPanel.updateNextShape(e.getNextShapeBoard(), e.getNextShape(), e.getNextShapeType());
}
// update the game level showing on screen
if(e.getLevel()!= GameEvent.NOT_UPDATED)
mScorePanel.updateLevel(e.getLevel());
// update score showing on the screen if necessary
if (e.getScore() != GameEvent.NOT_UPDATED)
mScorePanel.updateScore(e.getScore());
// show disappearing lines animation (not implemented)
if (e.getLinesDeleted()!= null)
mGameHelperPanel.animateDeletedLines(e.getLinesDeleted());
// update picture cover transparency if necessary
if (e.getCoverOpacity()!= GameEvent.NOT_UPDATED);
mPicturePanel.updateCoverTransparency(e.getCoverOpacity());
// show game over or you won messsage, when necessary
if (e.isGameOverUpdated())
mGameHelperPanel.setGameOverMessage(e.isGameOver(), e.isGameWon());
// remind user to press play button and change the appearance of the play/pause button
if (e.isGamePlayedUpdated())
mGameHelperPanel.setPlayButton(e.isGamePlayed());
}
// method for binding up, down, left, and right keyboard keys to game Actions
private void registerKeyActions()
{
// connect key presses to actions
((JComponent) getContentPane()).getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(ShapeMoveAction.ROTATE_KEY), ShapeMoveAction.ACTN_ROTATE);
((JComponent) getContentPane()).getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(ShapeMoveAction.LEFT_KEY), ShapeMoveAction.ACTN_LEFT);
((JComponent) getContentPane()).getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(ShapeMoveAction.RIGHT_KEY), ShapeMoveAction.ACTN_RIGHT);
((JComponent) getContentPane()).getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(ShapeMoveAction.DROP_KEY), ShapeMoveAction.ACTN_DROP);
((JComponent) getContentPane()).getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyBoardShortcutsAction.PLAY_PAUSE_KEY), KeyBoardShortcutsAction.ACTN_PLAY_PAUSE);
((JComponent) getContentPane()).getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyBoardShortcutsAction.RESTART_GAME_KEY), KeyBoardShortcutsAction.ACTN_RESTART);
((JComponent) getContentPane()).getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyBoardShortcutsAction.SHOW_HELP_KEY), KeyBoardShortcutsAction.ACTN_SHOW_HELP);
((JComponent) getContentPane()).getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyBoardShortcutsAction.SHOW_HINTS_KEY), KeyBoardShortcutsAction.ACTN_SHOW_HINTS);
((JComponent) getContentPane()).getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyBoardShortcutsAction.PLAY_AI_MODE_KEY), KeyBoardShortcutsAction.ACTN_AI_MODE);
// connect arrow key actions to game events
((JComponent) getContentPane()).getActionMap().put(ShapeMoveAction.ACTN_ROTATE, new ShapeMoveAction(ShapeMoveAction.ACTN_ROTATE,mInterfaceEventListener));
((JComponent) getContentPane()).getActionMap().put(ShapeMoveAction.ACTN_LEFT, new ShapeMoveAction(ShapeMoveAction.ACTN_LEFT,mInterfaceEventListener));
((JComponent) getContentPane()).getActionMap().put(ShapeMoveAction.ACTN_RIGHT, new ShapeMoveAction(ShapeMoveAction.ACTN_RIGHT,mInterfaceEventListener));
((JComponent) getContentPane()).getActionMap().put(ShapeMoveAction.ACTN_DROP, new ShapeMoveAction(ShapeMoveAction.ACTN_DROP,mInterfaceEventListener));
// connect short cut keys to interface button presses
((JComponent) getContentPane()).getActionMap().put(KeyBoardShortcutsAction.ACTN_PLAY_PAUSE, new TextAction(KeyBoardShortcutsAction.ACTN_PLAY_PAUSE){
@Override
public void actionPerformed(ActionEvent e) {
mGameHelperPanel.pressPlayButton();
}
});
((JComponent) getContentPane()).getActionMap().put(KeyBoardShortcutsAction.ACTN_RESTART, new TextAction(KeyBoardShortcutsAction.ACTN_RESTART){
@Override
public void actionPerformed(ActionEvent e) {
mSettingsPanel.pressRestartButton();
}
});
((JComponent) getContentPane()).getActionMap().put(KeyBoardShortcutsAction.ACTN_SHOW_HELP, new TextAction(KeyBoardShortcutsAction.ACTN_SHOW_HELP){
@Override
public void actionPerformed(ActionEvent e) {
mSettingsPanel.pressHelpButton();
}
});
((JComponent) getContentPane()).getActionMap().put(KeyBoardShortcutsAction.ACTN_SHOW_HINTS, new TextAction(KeyBoardShortcutsAction.ACTN_SHOW_HINTS){
@Override
public void actionPerformed(ActionEvent e) {
mSettingsPanel.pressShowHintsButton();
}
});
((JComponent) getContentPane()).getActionMap().put(KeyBoardShortcutsAction.ACTN_AI_MODE, new TextAction(KeyBoardShortcutsAction.ACTN_AI_MODE){
@Override
public void actionPerformed(ActionEvent e) {
mSettingsPanel.pressAIModeButton();
}
});
}
// setting controller as UI_EventListener
public void setListener (UI_EventListener listener)
{
mInterfaceEventListener = listener;
mGameHelperPanel.setActionListener(this); // connect play button clicks to this Frame
mSettingsPanel.setActionListener (this); // connect restart and help button clicks to this Frame
mSettingsPanel.setItemListener(this); // connect show hints and auto mode toggle button clicks to this frame
registerKeyActions(); // register key bindings
}
@Override
// this function processes JButton clicks
// The button include Play button, restart button, help buttons
public void actionPerformed(ActionEvent ev)
{
if (mInterfaceEventListener!=null)
{
JButton source = (JButton)ev.getSource(); // the source of action performed should be buttons only
// if the code is changed this needs to be modified
if (source.getName().equalsIgnoreCase(TetrisContract.PLAY_BUTTON))
{
mInterfaceEventListener.onPlayButtonPressed(null);
}
else if (source.getName().equalsIgnoreCase(TetrisContract.HELP_BUTTON))
{
mInterfaceEventListener.onHelpButtonPressed();
showHelp();
}
else if (source.getName().equalsIgnoreCase(TetrisContract.RESTART_BUTTON))
{
int confirmed = JOptionPane.showConfirmDialog(this, "Do you want to restart the game");
if (confirmed == JOptionPane.YES_OPTION)
{
mInterfaceEventListener.initializeNewGame();
}
}
}
}
// Dialog shown when help button is pressed
private void showHelp() {
StringBuilder sb = new StringBuilder ("Help for Tetris: ");
sb.append("\nTetris is an easy game!");
sb.append("\nWhen the game starts different shapes consisting of 4 squares");
sb.append("\nstart falling to the bottom of the game board");
sb.append("\n\nBy moving shapes left and right with corresponding arrow keys " );
sb.append("\nand rotating it with \"Up\" key move shape into desired position");
sb.append("\nand then drop it with \"Down\" key");
sb.append("\n\n\nWhen you fill an entire row all the squares in this row");
sb.append("\ndisappear and all the squares that were above drop down");
sb.append("\nThe goal is to keep the game field as empty as possible");
sb.append("\n\n\nUse \"Show Hints\" toggle button if you need help playing");
sb.append("\nOr enter automated mode by pressing enter \"Auto\" mode button");
sb.append("\n\n\n\nShortcuts:");
sb.append("\na - enter/exit \"AUTO\" mode");
sb.append("\ni - show/disable hint arrows");
sb.append("\nh - show this menu");
sb.append("\np - play/pause game");
sb.append("\ns - start new game");
sb.append("\n\n<- move current shape left");
sb.append("\n-> move current shape right");
sb.append("\n^ - rotate current shape clockwise");
sb.append("\n\\/ - drop current shape to the bottom");
JOptionPane.showMessageDialog(this, sb.toString(), "Help" , JOptionPane.INFORMATION_MESSAGE);
mInterfaceEventListener.unPauseGame();
}
@Override
// this function processes toggle button presses and state changes
// for AI_MODE_BUTTON and SHOW_HINTS_BUTTON
public void itemStateChanged(ItemEvent e) {
if (mInterfaceEventListener != null)
{
JToggleButton source = (JToggleButton)e.getSource();
if (source.getName().equals(TetrisContract.AI_MODE_BUTTON))
if (e.getStateChange() == ItemEvent.SELECTED)
{
source.setText(TetrisContract.AI_MODE_BUTTON_LABEL_PRESSED);
mInterfaceEventListener.onAIButtonPressed(true);
}
else
{
source.setText(TetrisContract.AI_MODE_BUTTON_LABEL_DEPRESSED);
mInterfaceEventListener.onAIButtonPressed(false);
}
else if (source.getName().equals(TetrisContract.SHOW_HINTS_BUTTON))
if (e.getStateChange() == ItemEvent.SELECTED)
{
source.setText(TetrisContract.SHOW_HINTS_BUTTON_LABEL_PRESSED);
mInterfaceEventListener.onShowHintsButtonPressed(true);
}
else
{
source.setText(TetrisContract.SHOW_HINTS_BUTTON_LABEL_DEPRESSED);
mInterfaceEventListener.onShowHintsButtonPressed(false);
}
}
}
}
|
[
"[email protected]"
] | |
89832b206b2770c5ed5cb886bc3dda70a20df9be
|
997f8ddc11ecf15d8232030673e2fcb45a16857d
|
/src/main/java/com/hcl/bank/benef/app/util/ApiResponse.java
|
eec1ca87e6b0313e8a998f5aca16b8a021d28e0b
|
[] |
no_license
|
udaych31/BankBeneficiaryApp
|
5765f7c1dbcf5cc9205d62b866a64697e61ef021
|
079db1c1267d84173e019580950a22c0995a5872
|
refs/heads/master
| 2020-05-31T06:40:13.656297 | 2019-06-05T10:52:27 | 2019-06-05T10:52:27 | 190,146,309 | 0 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 534 |
java
|
package com.hcl.bank.benef.app.util;
import java.io.Serializable;
public class ApiResponse implements Serializable {
private static final long serialVersionUID = 1L;
private Integer statusCode;
private String status;
public ApiResponse() {
super();
}
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
|
[
"[email protected]"
] | |
2e3f06ddb2a3d63efb6fd72b158f4b24a65d8592
|
27b7583996fe74b6039eda51a51ecdb767c90f8c
|
/app/src/main/java/com/white/ghost/programmersupermario/base/BaseLazyFragment.java
|
28a38c22e45701f5716d73f6f50104efa38f02ce
|
[] |
no_license
|
ChrisChing24/ProgrammerSuperMario
|
03225f1bb708b8e83d86ffa0b698c1e5b0808351
|
94256c578d1189c5898c3db913b367db9b420966
|
refs/heads/master
| 2020-05-18T00:07:41.599731 | 2019-05-16T07:28:57 | 2019-05-16T07:28:57 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,351 |
java
|
package com.white.ghost.programmersupermario.base;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import com.trello.rxlifecycle3.components.support.RxFragment;
import com.white.ghost.programmersupermario.R;
import com.white.ghost.programmersupermario.SuperMarioApp;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
/**
* Function:BaseFragment 懒加载
* Author Name: Chris
* Date: 2019/4/30 9:54
*/
public abstract class BaseLazyFragment extends RxFragment {
/**
* 控件是否初始化完成
*/
private boolean isViewCreated;
/**
* 数据是否已加载完毕
*/
private boolean isLoadDataCompleted;
private Unbinder mBind;
private AlertDialog mProgressDialog;
private CompositeDisposable mCompositeDisposable;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(getLayoutId(), container, false);
mBind = ButterKnife.bind(view);
initViews();
isViewCreated = true;
return view;
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser && isViewCreated && !isLoadDataCompleted) {
isLoadDataCompleted = true;
loadData();
}
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (getUserVisibleHint()) {
isLoadDataCompleted = true;
loadData();
}
}
public abstract int getLayoutId();
public abstract void initViews();
/**
* 加载数据
*/
public void loadData() {
}
/**
* 显示进度条
*/
public void showProgressBar() {
}
/**
* 隐藏进度条
*/
public void hideProgressBar() {
}
/**
* 显示加载框
*/
public void showProgressDialog() {
if (mProgressDialog == null) {
mProgressDialog = new AlertDialog
.Builder(getContext(), R.style.CustomAlertDialogTheme)
.create();
}
View view = View.inflate(getContext(), R.layout.layout_progress_dialog, null);
mProgressDialog.setView(view, 0, 0, 0, 0);
mProgressDialog.setCancelable(true);
mProgressDialog.setCanceledOnTouchOutside(false);
Window window = mProgressDialog.getWindow();
WindowManager.LayoutParams layoutParams = window.getAttributes();
layoutParams.alpha = 1f;
window.setAttributes(layoutParams);
mProgressDialog.show();
}
/**
* 隐藏加载框
*/
public void hideProgressDialog() {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
}
/**
* 初始化recyclerView
*/
public void initRecyclerView() {
}
/**
* 初始化refreshLayout
*/
public void initRefreshLayout() {
}
/**
* 设置数据显示
*/
public void setData(BaseResponse baseResponse) {
}
/**
* 展示空布局
*/
public void showEmptyLayout() {
}
/**
* 添加RxJava事件
*
* @param disposable 事件
*/
public void addDisposable(Disposable disposable) {
if (mCompositeDisposable == null) {
mCompositeDisposable = new CompositeDisposable();
}
mCompositeDisposable.add(disposable);
}
@Override
public void onDestroyView() {
super.onDestroyView();
//黄油刀unBind
mBind.unbind();
}
@Override
public void onDestroy() {
super.onDestroy();
//清空所有事件
if (mCompositeDisposable != null) {
mCompositeDisposable.clear();
}
//添加leakCanary监测
SuperMarioApp.getRefWatcher().watch(this);
}
}
|
[
"gaodun123com"
] |
gaodun123com
|
0f297c94a792ac1e88fee344171e7dcd06fd85f4
|
73f4ba554a081b222c24798d8bff1c2998215bd7
|
/src/main/java/com/bad/remon/io/tempateJava/paramEntry/LombokAnn.java
|
673a40c5725fa4cf71ed8e2f61ee59f494c9dc63
|
[] |
no_license
|
remonlong/bad-io-template
|
256e084cb20d985565ea9669ac6aa09c0b57b136
|
822e56c604c65fa07a10d68d827e806fb55f4b65
|
refs/heads/master
| 2020-03-19T04:52:49.276845 | 2018-06-05T02:27:25 | 2018-06-05T02:27:25 | 135,878,176 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 165 |
java
|
package com.bad.remon.io.tempateJava.paramEntry;
/**
* @author remon
* @create 2018-06-02 22:59
**/
public class LombokAnn {
private Class<?> clazzName;
}
|
[
"[email protected]"
] | |
bef225c7f9a82c88277adc1417202c2ffa28d0b0
|
f296e69ee23105e630c6ebb6393dba8dce157ee9
|
/2019-3-4/src/school/course/AboutClass.java
|
707b1a1f2412824f90ac2d0bcfdb6e8075fb7d00
|
[] |
no_license
|
2676583711/school.course.java
|
1a3c91aad5b2bc28a944b3739023c195c22dd00d
|
8fbb243c57f8ac72365cfb65bde754c5913ee805
|
refs/heads/master
| 2020-04-25T02:06:07.422165 | 2019-03-18T02:07:10 | 2019-03-18T02:07:10 | 172,427,593 | 0 | 0 | null | null | null | null |
GB18030
|
Java
| false | false | 651 |
java
|
package school.course;
/*
*关于 java 的对象的学习
*/
class Person {
protected String name;
protected int age;
public void speak() {
System.out.println("我叫" + name + ",今年" + age + "岁了");
}
}
public class AboutClass {
public static void main(String[] args) {
Person p = new Person();
p.name = "张三";
p.age = 250;
p.speak();
/**********/
// /////*//*/**/**//*/*/*
class Person2 {
String name;
int age;
public void speak() {
System.out.println("我叫" + name + ",今年" + age + "岁了");
}
}
Person2 p2 = new Person2();
p2.name = "张三2";
p2.age = 250;
p2.speak();
}
}
|
[
"[email protected]"
] | |
dc506aa63a868853d1847bc78b5b2534ce3fcbad
|
fc249fdee1cf8faa8bda0c593f44e5a781485d33
|
/app/src/main/java/com/clicktech/snsktv/module_home/inject/module/PracticingSongModule.java
|
9019b9437837618c0ea0845a92a4ae059437388f
|
[] |
no_license
|
WooYu/Karaok
|
320fbcc7d97904d8b20c352b4ffb9cb31bf55482
|
42120b10d4f5039307348976b508ccc89ff0f40b
|
refs/heads/master
| 2020-04-08T11:30:29.288269 | 2018-11-27T09:28:22 | 2018-11-27T09:28:22 | 159,308,447 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,759 |
java
|
package com.clicktech.snsktv.module_home.inject.module;
import com.clicktech.snsktv.arms.inject.scope.ActivityScope;
import com.clicktech.snsktv.module_home.contract.PracticingSongContract;
import com.clicktech.snsktv.module_home.model.PracticingSongModel;
import dagger.Module;
import dagger.Provides;
/**
* 通过Template生成对应页面的MVP和Dagger代码,请注意输入框中输入的名字必须相同
* 由于每个项目包结构都不一定相同,所以每生成一个文件需要自己导入import包名,可以在设置中设置自动导入包名
* 请在对应包下按以下顺序生成对应代码,Contract->Model->Presenter->Activity->Module->Component
* 因为生成Activity时,Module和Component还没生成,但是Activity中有它们的引用,所以会报错,但是不用理会
* 继续将Module和Component生成完后,编译一下项目再回到Activity,按提示修改一个方法名即可
* 如果想生成Fragment的相关文件,则将上面构建顺序中的Activity换为Fragment,并将Component中inject方法的参数改为此Fragment
*/
/**
* Created by Administrator on 2017/1/16.
*/
@Module
public class PracticingSongModule {
private PracticingSongContract.View view;
/**
* 构建PracticingSongModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
*
* @param view
*/
public PracticingSongModule(PracticingSongContract.View view) {
this.view = view;
}
@ActivityScope
@Provides
PracticingSongContract.View providePracticingSongView() {
return this.view;
}
@ActivityScope
@Provides
PracticingSongContract.Model providePracticingSongModel(PracticingSongModel model) {
return model;
}
}
|
[
"[email protected]"
] | |
d514d4d11d9bca2126b22a68e2a38c557a345830
|
c9a7ddb19aef9d88bcd05fe37417ed86f30a8834
|
/stable/src/drcl/inet/protocol/dv/DVPacket.java
|
b556267950ff6069da1803a82b99425cfc6e3ab2
|
[
"BSD-3-Clause"
] |
permissive
|
jsimjava/j-sim
|
ca1ca5b5ef8d0ba67ed5b58b62fccb5acd9e986f
|
7cee84946bd85d7a8ba641039baacdb3b973e1e2
|
refs/heads/master
| 2020-06-01T13:25:53.114658 | 2015-08-04T07:34:07 | 2015-08-04T07:34:07 | 32,123,947 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,815 |
java
|
// @(#)DVPacket.java 2/2004
// Copyright (c) 1998-2004, Distributed Real-time Computing Lab (DRCL)
// 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. Neither the name of "DRCL" 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 REGENTS 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 drcl.inet.protocol.dv;
import java.util.Vector;
/**
Defines the format of the packet used by {@link DV}.
The format is simplified from what is defined in RFC2453.
*/
public class DVPacket implements drcl.ObjectCloneable
{
// commands
public static final int REQUEST = 1;
public static final int UPDATE = 2;
int cmd, version;
Vector rte;
public DVPacket()
{ super(); }
public DVPacket (int cmd_, int version_)
{
cmd = cmd_;
version = version_;
}
private DVPacket (int cmd_, int version_, Vector rte_)
{
cmd = cmd_;
version = version_;
rte = rte_;
}
/** Returns the command of this packet. */
public int getCommand()
{ return cmd; }
/** Returns the version of this packet. */
public int getVersion()
{ return version; }
public void addRTE(long dest_, long mask_, long nexthop_, int metric_)
{
RTE rte_ = new RTE(dest_, mask_, nexthop_, metric_);
if (rte == null) rte = new Vector();
rte.addElement(rte_);
}
public void setCommand(int value_)
{ cmd = value_; }
public void setVersion(int value_)
{ version = value_; }
public int getNumRTEs()
{ return rte == null? 0: rte.size(); }
public RTE getRTE(int index_)
{ return (RTE)rte.elementAt(index_); }
public RTE[] getRTEs()
{
RTE[] ss_ = new RTE[rte.size()];
rte.copyInto(ss_);
return ss_;
}
/*
public void duplicate(Object source_)
{
DVPacket that_ = (DVPacket)source_;
cmd = that_.cmd;
version = that_.version;
rte = (Vector)drcl.util.ObjectUtil.clone(that_.rte);
}
*/
public Object clone()
{ return new DVPacket(cmd, version, (Vector)rte.clone()); }
public String toString()
{
if (cmd == REQUEST)
return "DVv" + version + "_REQUEST";
else
return "DVv" + version + "_UPDATE,rte:" + rte;
}
static class RTE implements drcl.ObjectCloneable//extends drcl.DrclObj
{
long dest, mask, nexthop;
int metric;
public RTE ()
{}
public RTE (long dest_, long mask_, long nexthop_, int metric_)
{
dest = dest_;
mask = mask_;
nexthop = nexthop_;
metric = metric_;
}
/*
public void duplicate(Object source_)
{
super.duplicate(source_);
RTE that_ = (RTE)source_;
dest = that_.dest;
mask = that_.mask;
nexthop = that_.nexthop;
metric = that_.metric;
}
*/
public Object clone()
{ return new RTE(dest, mask, nexthop, metric); }
/** Retrieves the destination field from an RTE. */
public long getDestination()
{ return dest; }
/** Retrieves the mask field from an RTE. */
public long getMask()
{ return mask; }
/** Retrieves the next-hop field from an RTE. */
public long getNextHop()
{ return nexthop; }
/** Retrieves the metric field from an RTE. */
public int getMetric()
{ return metric; }
public String toString()
{ return dest + "/" + mask +":" + nexthop + ":" + metric; }
}
}
|
[
"jsim.java@8bbd7491-ab50-0410-b0e2-7bef82531098"
] |
jsim.java@8bbd7491-ab50-0410-b0e2-7bef82531098
|
147d5d1f448d1efab4cc89b9ae9a8f254bb18571
|
b86dafabc3c7424adaf76f6c32bf9e6955277a46
|
/java/javaday18/src/checkpoint1/Test07.java
|
c4e1932ba3a7a76b08883c26bef02c5c79a55f4c
|
[] |
no_license
|
Caressing-bot/sbjy_hezh
|
a0fe39eeef199851e22a5121bedb75cdc56a53d6
|
3bd96d0fbd551a214e412c4bca39cee6a4581c25
|
refs/heads/master
| 2020-09-21T15:01:13.961463 | 2019-11-29T09:32:11 | 2019-11-29T09:32:11 | 224,825,180 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 538 |
java
|
package checkpoint1;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class Test07 {
public static void main(String[] args) {
int len;
byte[] b = new byte[1024];
try (FileOutputStream fos = new FileOutputStream("a2.jpg"); FileInputStream fis = new FileInputStream("a.jpg")) {
while (-1!=(len = fis.read(b))){
fos.write(b,0,len);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
8c04415d6cbd89b151aaf53a720d378571dedf4e
|
92f5860bfd39930a8108cff2e0a8b0eeece12b25
|
/src/main/java/com/syntaxerror/ezz0034/business/EmployeeBusiness.java
|
372b3602df908b9ca2876294d04e7247c73b2a0e
|
[] |
no_license
|
piooneer77/EzzSystemJPA
|
cc47a4bd6379dfd6a9f597802dba1dfc322bbf8b
|
4aa1d2c93f36cd020db3fb867e5695614d342e84
|
refs/heads/master
| 2021-07-10T20:38:42.271616 | 2017-10-10T14:31:58 | 2017-10-10T14:31:58 | 106,416,403 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 683 |
java
|
package com.syntaxerror.ezz0034.business;
import com.syntaxerror.ezz0034.models.Employee;
import com.syntaxerror.ezz0034.repositories.EmployeeRepository;
import java.util.List;
import javafx.collections.ObservableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class EmployeeBusiness {
@Autowired
private EmployeeRepository employeeRepository;
public List<Employee> getListCustomer() {
return employeeRepository.findAll();
}
public void createNewEmployee(Employee employee) {
employeeRepository.save(employee);
}
}
|
[
"[email protected]"
] | |
5da5939afe350441f0c31fa5fc4526336b08a98d
|
7bc6ef3eda2ee41386f7e52a44e1ae2779a7338a
|
/favoritemovies/src/main/java/com/putrasamawa/favoritemovies/rest/UtilsConstant.java
|
36391adef328bb7c32c992b6b30df290921c7cb6
|
[] |
no_license
|
narumiya1/Dicoding-AndroidExpert-Sub5
|
4bc11a7502c85d40c113d2b8b527cddbd447f16d
|
438e4bd702c200762b4b1055d046f208b63e1eb8
|
refs/heads/master
| 2022-04-05T14:19:42.585062 | 2020-02-25T01:25:33 | 2020-02-25T01:25:33 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 732 |
java
|
package com.putrasamawa.favoritemovies.rest;
/* Copyright Satria Junanda */
public class UtilsConstant {
public final static String BASE_URL = "https://api.themoviedb.org/3/";
public final static String MOVIE_LIST_INSTANCE = "MOVIE_LIST";
public final static String MOVIE_LIST_QUERY = "MOVIE_LIST_QUERY";
public final static String MOVIE_LIST_TOTAL = "MOVIE_LIST_TOTAL";
public final static String MOVIE_POPULAR_BOOL = "movie_popular_bool";
public final static String MOVIE_DETAIL = "movie_detail";
public static final String INTENT_SEARCH = "intent_search";
public static final String INTENT_TAG = "tag";
public static final String INTENT_DETAIL = "detail";
}
/* Copyright Satria Junanda */
|
[
"[email protected]"
] | |
d3768366254082fdd79987b244e8ba0d964e8c3d
|
030e2be4cbee11998c4f87c4d0f497103ba39756
|
/src/tactics/DefaultQuackBehavior.java
|
e809a9056288703ab9720c17a3107192411e9138
|
[] |
no_license
|
zhsheng26/design
|
900e2324149d85fd516e460d39c65c8293fecd8f
|
67bf2f694f61075e716d918e3a8bdcf105b3aebf
|
refs/heads/master
| 2020-04-04T00:30:37.604122 | 2018-11-13T06:51:39 | 2018-11-13T06:51:39 | 155,652,324 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 177 |
java
|
package tactics;
public class DefaultQuackBehavior implements QuackBehavior {
@Override
public void quack() {
System.out.println("普通鸭子叫声");
}
}
|
[
"[email protected]"
] | |
c17ecd54e2e806202c3066e3f51dad27f01f46a6
|
6b0b65b21c5a0d2021f706b62564bf0e74e98473
|
/src/com/vendor/Vendor.java
|
c32a789ae99555fd378855e730622b3cd753a012
|
[] |
no_license
|
amanthajayathilake/Online-Event-Management-System
|
e6e91326049c40b5ebeebafa2b3e27777578e81a
|
10524a5b487f3ca4d7c1900ecb99f3184703b29c
|
refs/heads/main
| 2023-07-31T17:22:02.085649 | 2021-09-16T18:31:51 | 2021-09-16T18:31:51 | 407,270,058 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,293 |
java
|
package com.vendor;
public class Vendor {
private int id;
private String name;
private String email;
private String phone;
private String userName;
private String password;
private String vendorpackage;
private String venue;
private String buffet;
private String maxGuests;
private String entertainment;
private String photography;
private String decorations;
private String invitations;
private String costPerPerson;
private String startdate;
private String enddate;
public Vendor(int id, String name, String email, String phone,
String userName, String password, String vendorpackage ,String venue , String buffet , String maxGuests ,String entertainment ,String photography ,String decorations , String invitations,String costPerPerson ,String startdate ,String enddate) {
this.id = id;
this.name = name;
this.email = email;
this.phone = phone;
this.userName = userName;
this.password = password;
this.vendorpackage = vendorpackage;
this.venue = venue;
this.buffet = buffet;
this.maxGuests = maxGuests;
this.entertainment = entertainment;
this.photography = photography;
this.decorations = decorations;
this.invitations = invitations;
this.costPerPerson = costPerPerson;
this.startdate = startdate;
this.enddate = enddate;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public String getPhone() {
return phone;
}
public String getUserName() {
return userName;
}
public String getPassword() {
return password;
}
public String getvendorpackage() {
return vendorpackage;
}
public String getVenue() {
return venue;
}
public String getBuffet() {
return buffet;
}
public String getMaxGuests() {
return maxGuests;
}
public String getEntertainment() {
return entertainment;
}
public String getPhotography() {
return photography;
}
public String getDecorations() {
return decorations;
}
public String getInvitations() {
return invitations;
}
public String getCostPerPerson() {
return costPerPerson;
}
public String getStartdate() {
return startdate;
}
public String getEnddate() {
return enddate;
}
}
|
[
"[email protected]"
] | |
9449cac9308abcf732ca7f75994217a346121601
|
b1e0f7b8f64267c82dd236fb65d89cfcefb8df43
|
/src/test/java/com/lusa/carros/functional/PostCarroValidationTest.java
|
ac8e2df4da615a3f6a4c8df14df7d63faa1e57fb
|
[] |
no_license
|
brunolusa/api-carros-integration-test
|
02c3a09e681b506cf9f4e7fe403e0665074d2911
|
53b56db80a2f73977a0bdfa7c5bf31cf7da21468
|
refs/heads/master
| 2023-05-13T03:58:01.671668 | 2020-08-19T18:33:23 | 2020-08-19T18:33:23 | 283,604,929 | 1 | 0 | null | 2023-05-09T18:40:05 | 2020-07-29T21:21:28 |
Java
|
UTF-8
|
Java
| false | false | 763 |
java
|
package com.lusa.carros.functional;
import com.lusa.carros.basetest.BaseTest;
import com.lusa.carros.model.Carro;
import com.lusa.carros.datadriven.CarroDataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
public class PostCarroValidationTest extends BaseTest {
@Test(dataProvider = "novoCarro", dataProviderClass = CarroDataProvider.class)
public void criaNovoCarro(Carro carro){
Carro carroCriado = carrosClient.criaNovoCarro(carro).extract().body().as(Carro.class);
assertNotNull(carroCriado.getId());
assertEquals(carroCriado.getMarca(), carro.getMarca());
assertEquals(carroCriado.getModelo(), carro.getModelo());
}
}
|
[
"[email protected]"
] | |
71d42479ab28549f230a9df1dde7fc0c168e3b64
|
0889521f422166404e325d3716e0b6ddbdef8ff1
|
/src/main/java/com/pinpinbox/android/Views/HeaderScroll/scrollable/CanScrollVerticallyDelegate.java
|
551ddda106e406a97a73296f166bd71dd2017551
|
[] |
no_license
|
pinpinbox/app
|
8efac19291b0d243ee305971cb43944878334adf
|
a32914264de932e73f762396a10143149f2ea670
|
refs/heads/master
| 2021-06-30T01:49:40.132026 | 2019-04-03T08:06:51 | 2019-04-03T08:06:51 | 115,250,997 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 307 |
java
|
package com.pinpinbox.android.Views.HeaderScroll.scrollable;
/**
* Created by Dimitry Ivanov ([email protected]) on 28.03.2015.
*/
public interface CanScrollVerticallyDelegate {
/**
* @see android.view.View#canScrollVertically(int)
*/
boolean canScrollVertically(int direction);
}
|
[
"[email protected]"
] | |
b89ee35577770fa756c5a97291fa83650db96487
|
0cf80bc132b107b1adcfdcb62e9c0f3b72dfd903
|
/src/main/java/base/patient/service/PatientInfoService.java
|
e95158b8c32b1ba1720c00c1c25b2c77b40c6fb6
|
[
"Apache-2.0"
] |
permissive
|
clairewoo66/pdct
|
b3e5b408d04d71f38bdf9d81c464e3a427909a14
|
3cb2d842874c7687b0f42b420e1892887b140bd5
|
refs/heads/master
| 2020-12-30T14:19:42.489230 | 2017-05-15T07:31:04 | 2017-05-15T07:31:04 | 91,307,389 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 11,340 |
java
|
package base.patient.service;
import base.patient.mapper.PatientContactInfoMapper;
import base.patient.mapper.PatientInfoMapper;
import base.patient.mapper.PatientInformedMapper;
import base.patient.model.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.System;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* Created by zyn on 11/17/16.
*/
@Service
public class PatientInfoService {
@Autowired
PatientInformedMapper patientInformedMapper;
@Autowired
PatientContactInfoMapper patientContactInfoMapper;
@Autowired
PatientInfoMapper patientInfoMapper;
@Autowired
DiagnosisInfoService diagnosisInfoService;
@Autowired
HospitaledInfoService hospitaledInfoService;
@Autowired
MmCureHistoryService mmCureHistoryService;
@Autowired
FollowupService followupService;
public boolean isExist(String patientId) {
return patientInfoMapper.countByPatientId(patientId) > 0;
}
public List<PatientInfo> listAll(String hospitalId) {
return patientInfoMapper.listAll(hospitalId);
}
public PageInfo<PatientInfo> listPage(String hospitalIds,String query,int pageNum, int pageSize, String orderBy) {
PageHelper.startPage(pageNum, pageSize);
return new PageInfo<>(patientInfoMapper.queryAll(hospitalIds,query, orderBy));
}
public PatientInfo findByPatientId(String patientId,int hospitalId) {
return patientInfoMapper.findByPatientId(patientId, hospitalId);
}
public PatientInfo findSimpleByPatientId(String patientId,int hospitalId) {
return patientInfoMapper.findSimpleByPatientId(patientId, hospitalId);
}
@Transactional
public int addPatientInfo(PatientInfo patientInfo,int confirm) {
if (patientInfo.getDiagnosisInfo() != null) {
int diagnosisInfoId = diagnosisInfoService.addDiagnosisInfo(patientInfo.getDiagnosisInfo());
patientInfo.setFkdiagnosisid(diagnosisInfoId);
}
if (patientInfo.getFollowupInfo() != null) { //不太可能存在
int followupInfoId = followupService.addFollowupInfo(patientInfo.getFollowupInfo());
patientInfo.setFollowupid(followupInfoId);
patientInfo.setFollowupStatus(1);
}
setUpDeathInfo(patientInfo);
patientInfo.setCreateDate(new Date());
patientInfo.setUpdateDate(new Date());
if(confirm==1) {
patientInfo.setAcquisitionStatus(2);
} else {
patientInfo.setAcquisitionStatus(1);
}
patientInfoMapper.addEntry(patientInfo);
if (patientInfo.getMmCureHistories() != null) {
mmCureHistoryService.addMmCureHistorys(patientInfo.getMmCureHistories(), patientInfo.getId());
}
if (patientInfo.getHospitaledInfos() != null) {
hospitaledInfoService.addHospitaledInfos(patientInfo.getHospitaledInfos(), patientInfo.getId());
}
return patientInfo.getId();
}
@Transactional
public int updateFollowup(PatientInfo patientInfo,int confirm) {
PatientInfo old = patientInfoMapper.findSimpleByPatientId(patientInfo.getPatientId(),patientInfo.getFkhospitalid());
if(old==null) return 0;
patientInfo.setAcquisitionStatus(old.getAcquisitionStatus());
patientInfo.setAgreementStatus(old.getAgreementStatus());
patientInfo.setContactStatus(old.getContactStatus());
FollowupInfo followupInfo = patientInfo.getFollowupInfo();
DiagnosisInfo diagnosisInfo = patientInfo.getDiagnosisInfo();
if (diagnosisInfo != null) {
if (diagnosisInfo.getId() > 0) { //更新
diagnosisInfoService.updateDiagnosisInfo(diagnosisInfo);
} else { //新增
diagnosisInfoService.addDiagnosisInfo(diagnosisInfo);
}
patientInfo.setFkdiagnosisid(diagnosisInfo.getId());
}
if (followupInfo != null) {
if (followupInfo.getId() > 0) {
followupService.updateFollowupInfo(followupInfo);
} else {
followupService.addFollowupInfo(followupInfo);
}
patientInfo.setFollowupid(followupInfo.getId());
if(confirm==1) {
patientInfo.setFollowupStatus(2);
} else {
patientInfo.setFollowupStatus(1);
}
}
setUpDeathInfo(patientInfo);
patientInfo.setUpdateDate(new Date());
patientInfoMapper.updateEntry(patientInfo);
return patientInfo.getId();
}
@Transactional
public int updatePatientInfo(PatientInfo patientInfo,int confirm) {
PatientInfo old = patientInfoMapper.findSimpleByPatientId(patientInfo.getPatientId(),patientInfo.getFkhospitalid());
if(old==null) return 0;
patientInfo.setAcquisitionStatus(old.getAcquisitionStatus());
patientInfo.setAgreementStatus(old.getAgreementStatus());
patientInfo.setContactStatus(old.getContactStatus());
DiagnosisInfo diagnosisInfo = patientInfo.getDiagnosisInfo();
if (diagnosisInfo != null) {
if (diagnosisInfo.getId() > 0) { //更新
diagnosisInfoService.updateDiagnosisInfo(diagnosisInfo);
} else { //新增
diagnosisInfoService.addDiagnosisInfo(diagnosisInfo);
}
patientInfo.setFkdiagnosisid(diagnosisInfo.getId());
}
// FollowupInfo followupInfo = patientInfo.getFollowupInfo();
// if (followupInfo != null) {
// if (followupInfo.getId() > 0) {
// followupService.updateFollowupInfo(followupInfo);
// } else {
// followupService.addFollowupInfo(followupInfo);
// }
// patientInfo.setFollowupid(followupInfo.getId());
// patientInfo.setFollowupStatus(2);
// }
setUpDeathInfo(patientInfo);
patientInfo.setUpdateDate(new Date());
if(confirm==1) {
patientInfo.setAcquisitionStatus(2);
} else {
patientInfo.setAcquisitionStatus(1);
}
patientInfoMapper.updateEntry(patientInfo);
if (patientInfo.getMmCureHistories() != null) {
mmCureHistoryService.updateMmCureHistory(patientInfo.getMmCureHistories(), patientInfo.getId());
}
if (patientInfo.getHospitaledInfos() != null) {
hospitaledInfoService.updateHospitaledInfos(patientInfo.getHospitaledInfos(), patientInfo.getId());
}
return patientInfo.getId();
}
public PatientContactInfo findPatientContactInfo(String patientId,int hospitalId) {
return patientContactInfoMapper.findByPatientId(patientId,hospitalId);
}
public void updatePatientContactInfo(PatientContactInfo patientContactInfo,int confirm) {
PatientContactInfo old = patientContactInfoMapper.findByPatientId(patientContactInfo.getPatientId(),patientContactInfo.getHospitalId());
patientContactInfo.setUpdateDate(new Date());
if(old==null) {
//patientContactInfo.setCreateDate(new Date());
patientContactInfoMapper.addEntry(patientContactInfo);
} else {
//patientContactInfo.setCreateDate(old.getCreateDate());
if(old.getCreateDate()==null)
patientContactInfo.setCreateDate(new Date());
patientContactInfoMapper.updateEntry(patientContactInfo);
if(old.getLivingState()==2&&patientContactInfo.getLivingState()==1) {//已死亡=>未死亡
patientInfoMapper.setAgreementStatus(patientContactInfo.getPatientId(),1);//未开始
patientInfoMapper.setFollowupStatus(patientContactInfo.getPatientId(),1);//未开始
}
if(old.getAgreeVisit()==2&&patientContactInfo.getLivingState()==1) {//拒绝=>同意
patientInfoMapper.setAgreementStatus(patientContactInfo.getPatientId(),1);//未开始
patientInfoMapper.setFollowupStatus(patientContactInfo.getPatientId(),1);//未开始
}
}
if(confirm==1) {
if(patientContactInfo.getLivingState()==2||patientContactInfo.getAgreeVisit()==2) { //已死亡/已拒绝
patientInfoMapper.setAgreementStatus(patientContactInfo.getPatientId(),4);//不适用
patientInfoMapper.setFollowupStatus(patientContactInfo.getPatientId(),3);//不适用
}
if(patientContactInfo.getLivingState()==2) {
patientInfoMapper.setContactStatus(patientContactInfo.getPatientId(),3);//已死亡
} else {
patientInfoMapper.setContactStatus(patientContactInfo.getPatientId(),2);//已完成
}
} else {
patientInfoMapper.setContactStatus(patientContactInfo.getPatientId(),1);//未完成
}
}
public PatientInformed findPatientInformed(String patientId,int hospitalId) {
return patientInformedMapper.findByPatientId(patientId,hospitalId);
}
public void updatePatientInformed(PatientInformed patientInformed,int confirm) {
PatientInformed old = patientInformedMapper.findByPatientId(patientInformed.getPatientId(),patientInformed.getHospitalId());
patientInformed.setUpdateDate(new Date());
if(old==null) {
patientInformed.setCreateDate(new Date());
patientInformedMapper.addEntry(patientInformed);
} else {
patientInformed.setCreateDate(old.getCreateDate());
if(old.getCreateDate()==null)
patientInformed.setCreateDate(new Date());
patientInformedMapper.updateEntry(patientInformed);
}
if(confirm==1) {
patientInfoMapper.setAgreementStatus(patientInformed.getPatientId(),patientInformed.getAgreeInformedConsentStatus());
} else {
patientInfoMapper.setAgreementStatus(patientInformed.getPatientId(),1);
}
}
private void setUpDeathInfo(PatientInfo patientInfo) {
if(patientInfo.getHospitaledInfos()!=null) {
for(HospitaledInfo hospitaledInfo:patientInfo.getHospitaledInfos()) {
if(hospitaledInfo.getLivingState()==2) {
patientInfo.setLivingState(2);
patientInfo.setDeathTime(hospitaledInfo.getDeathDate());
patientInfo.setDeathReason(hospitaledInfo.getDeathReason());
break;
}
}
patientInfo.setAcquisitionStatus(2);
}
if(patientInfo.getLivingState()==2) {//已死亡
patientInfo.setContactStatus(3);//已死亡
patientInfo.setFollowupStatus(3);//不适用
} else {
patientInfo.setLivingState(1);
}
}
}
|
[
"[email protected]"
] | |
d74602292c61ac5dfc3685337b2a7fa95b9b4ac1
|
aa7193834b08a3b4bb2acc10236afdf4e50660d8
|
/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDestroy.java
|
68f0b410d37a78fc5bdbd1249302411a4f7ace99
|
[] |
no_license
|
tabahara/plantuml
|
90c07ed4a4b16137621543ef9c9aae0e97400d81
|
30ffb8bdae209dce2631ce252f28dc74efd63479
|
refs/heads/master
| 2020-12-27T21:18:36.063678 | 2014-12-11T05:42:13 | 2014-12-11T05:42:13 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,500 |
java
|
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML 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.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 10925 $
*
*/
package net.sourceforge.plantuml.skin.rose;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.skin.AbstractComponent;
import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ComponentRoseDestroy extends AbstractComponent {
private final HtmlColor foregroundColor;
public ComponentRoseDestroy(HtmlColor foregroundColor) {
this.foregroundColor = foregroundColor;
}
private final int crossSize = 9;
@Override
protected void drawInternalU(UGraphic ug, Area area) {
ug = ug.apply(new UStroke(2)).apply(new UChangeColor(foregroundColor));
ug.draw(new ULine(2 * crossSize, 2 * crossSize));
ug.apply(new UTranslate(0, 2 * crossSize)).draw(new ULine(2 * crossSize, -2 * crossSize));
}
@Override
public double getPreferredHeight(StringBounder stringBounder) {
return crossSize * 2;
}
@Override
public double getPreferredWidth(StringBounder stringBounder) {
return crossSize * 2;
}
}
|
[
"[email protected]"
] | |
2e1505f0dd22c8ad3053d32875a0614e110c2312
|
a059d1f1e05f3257dbb73d4556c9f530791ac98c
|
/src/main/java/com/jfeat/pdf/print/util/Fonts.java
|
18d8990c4bdc33243f652ce144955b14e909a500
|
[] |
no_license
|
LDJ4cob/zero-io
|
1f9f7da7e522f1896658404a617c7374021ba0b3
|
9ecefbe4839e965d74cc47c938efeef97f3eb450
|
refs/heads/master
| 2020-04-29T07:22:30.120825 | 2019-03-15T08:33:30 | 2019-03-15T08:33:30 | 175,950,663 | 0 | 0 | null | 2019-03-16T09:16:04 | 2019-03-16T09:16:03 | null |
UTF-8
|
Java
| false | false | 2,351 |
java
|
package com.jfeat.pdf.print.util;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.BaseFont;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import static com.itextpdf.text.pdf.BaseFont.NOT_EMBEDDED;
import static com.itextpdf.text.pdf.BaseFont.createFont;
/**
* Created by vincenthuang on 19/03/2018.
*/
public class Fonts {
public static final float FONT_SIZE_6 = 6.0f;
public static final float FONT_SIZE_8 = 8.0f;
public static final float FONT_SIZE_9 = 9.0f;
public static final float FONT_SIZE_10 = 12.60f;
public static final float FONT_SIZE_12 = 14.12f;
public static final float FONT_SIZE_14 = 15.64f;
public static final float FONT_SIZE_16 = 17.16f;
public static final float FONT_SIZE_18 = 18.68f;
public static final float FONT_SIZE_20 = 20.20f;
public static final float FONT_SIZE_21 = 20.96f;
public static final float FONT_SIZE_22 = 21.72f;
public static final float FONT_SIZE_24 = 24.24f;
public static BaseFont SONG;
public static BaseFont HELVETICA;
public static BaseFont BASE;
static {
try {
SONG = createFont("STSong-Light", "UniGB-UCS2-H", NOT_EMBEDDED);
HELVETICA = BaseFont.createFont("Helvetica", "Cp1252", NOT_EMBEDDED);
BASE = BaseFont.createFont("fonts/msyh_常规.ttf", BaseFont.IDENTITY_H, NOT_EMBEDDED);
} catch (DocumentException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public enum Definition {
BASE("常规", Fonts.BASE),SONG("宋体", Fonts.SONG), HELVETICA("Helvetica", Fonts.HELVETICA);
private static final Map<String, BaseFont> cache = new HashMap<>();
Definition(String name, BaseFont font) {
this.name = name;
this.font = font;
}
static {
for(Definition item : Definition.values()) {
cache.put(item.name, item.font);
}
}
private String name;
private BaseFont font;
public static BaseFont getFont(String name){
return cache.containsKey(name) ? cache.get(name) : BASE.font;
}
@Override
public String toString() {
return name;
}
}
}
|
[
"[email protected]"
] | |
92d14dba58e5967eb651c576127e9eafdeca775c
|
524e0d20a43523bf6c928a0ddf6abe5da71d6661
|
/Java_OO/Aula6/CreditoBancario/src/main/java/com/mycompany/creditobancario/CreditoHabitacao.java
|
85a234ee016146033df8197227f1128621f00c08
|
[] |
no_license
|
helfer1991/UPSkill
|
dae4faa48a5c9f8003792d82f219efe23b2e0175
|
c518f008cd07400e5b8ac38e14f906f79a824fdc
|
refs/heads/master
| 2023-02-15T09:34:14.792007 | 2021-01-13T09:02:00 | 2021-01-13T09:02:00 | 305,502,551 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,007 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.creditobancario;
/**
*
* @author Asus
*/
public class CreditoHabitacao extends CreditoBancario {
private static final double TXJUROANUAL = 0.1;
private double spread;
private static int qtInstancias = 0;
private static final float SPREAD_OMISSO = 1;
public CreditoHabitacao(String nomeCliente, String profissao, int montante, int prazoFinanciamento, double spread) {
super(nomeCliente, profissao, montante, prazoFinanciamento);
this.spread = spread;
qtInstancias++;
}
public CreditoHabitacao() {
super();
this.spread = SPREAD_OMISSO;
qtInstancias++;
}
/**
* @return the spread
*/
public double getSpread() {
return spread;
}
/**
* @param spread the spread to set
*/
public void setSpread(double spread) {
this.spread = spread;
}
public static int getQtInstancias() {
return qtInstancias;
}
@Override
public String toString() {
return String.format("%sSpread: %.1f\n", super.toString(), spread);
}
@Override
public double calcularMontanteTotalJuros() {
double txJuroSpreadMensal = (this.spread/100/12) + (TXJUROANUAL/100/12);
double capitalAmortizarMensal = super.getMontante() / super.getPrazoFinanciamento();
double totalJuros = 0;
double montanteEmprestimo = super.getMontante();
while(montanteEmprestimo > 0) {
totalJuros += montanteEmprestimo * txJuroSpreadMensal;
montanteEmprestimo -= capitalAmortizarMensal;
}
return totalJuros;
}
@Override
public double calcularMontanteAReceberPorCadaCredito() {
return super.getMontante() + calcularMontanteTotalJuros();
}
}
|
[
"[email protected]"
] | |
2d9fbeee16ea1972aa99d1072c421acb2e6d9016
|
b524cff38faeca93ea899457be2fc1412853f0be
|
/random-beans/random-beans-producer/src/main/java/org/esco/notification/randombeans/GeneratorException.java
|
f05e155e6cae318c90e0edc95bc62515b9a2a7fb
|
[
"Apache-2.0"
] |
permissive
|
GIP-RECIA/Notification-POC
|
2ec98d9d071a6a9e16f14e4f92ceb8d11dd3ae1b
|
338f742b3359348c064439225bf3f6077c49de1b
|
refs/heads/master
| 2021-09-04T06:08:38.605724 | 2018-01-16T15:19:46 | 2018-01-16T15:19:46 | 110,958,026 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 595 |
java
|
package org.esco.notification.randombeans;
public class GeneratorException extends Exception {
public GeneratorException() {
}
public GeneratorException(String message) {
super(message);
}
public GeneratorException(String message, Throwable cause) {
super(message, cause);
}
public GeneratorException(Throwable cause) {
super(cause);
}
public GeneratorException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
|
[
"[email protected]"
] | |
e847604d5b85b8f00c561716f938b501cf888e85
|
da71f6a9b8a4949c8de43c738fa61730129bdf5e
|
/src/minecraft/net/minecraft/src/RenderPainting.java
|
b51f365b9879c84f5453227603ee4ef85f59e926
|
[] |
no_license
|
nmg43/mcp70-src
|
1c7b8938178a08f70d3e21b02fe1c2f21c2a3329
|
030db5929c75f4096b12b1c5a8a2282aeea7545d
|
refs/heads/master
| 2020-12-30T09:57:42.156980 | 2012-09-09T20:59:42 | 2012-09-09T20:59:42 | 5,654,713 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,335 |
java
|
package net.minecraft.src;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class RenderPainting extends Render
{
/** RNG. */
private Random rand;
public RenderPainting()
{
rand = new Random();
}
public void func_77009_a(EntityPainting par1EntityPainting, double par2, double par4, double par6, float par8, float par9)
{
rand.setSeed(187L);
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glRotatef(par8, 0.0F, 1.0F, 0.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
loadTexture("/art/kz.png");
EnumArt enumart = par1EntityPainting.art;
float f = 0.0625F;
GL11.glScalef(f, f, f);
func_77010_a(par1EntityPainting, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
private void func_77010_a(EntityPainting par1EntityPainting, int par2, int par3, int par4, int par5)
{
float f = (float)(-par2) / 2.0F;
float f1 = (float)(-par3) / 2.0F;
float f2 = -0.5F;
float f3 = 0.5F;
for (int i = 0; i < par2 / 16; i++)
{
for (int j = 0; j < par3 / 16; j++)
{
float f4 = f + (float)((i + 1) * 16);
float f5 = f + (float)(i * 16);
float f6 = f1 + (float)((j + 1) * 16);
float f7 = f1 + (float)(j * 16);
func_77008_a(par1EntityPainting, (f4 + f5) / 2.0F, (f6 + f7) / 2.0F);
float f8 = (float)((par4 + par2) - i * 16) / 256F;
float f9 = (float)((par4 + par2) - (i + 1) * 16) / 256F;
float f10 = (float)((par5 + par3) - j * 16) / 256F;
float f11 = (float)((par5 + par3) - (j + 1) * 16) / 256F;
float f12 = 0.75F;
float f13 = 0.8125F;
float f14 = 0.0F;
float f15 = 0.0625F;
float f16 = 0.75F;
float f17 = 0.8125F;
float f18 = 0.001953125F;
float f19 = 0.001953125F;
float f20 = 0.7519531F;
float f21 = 0.7519531F;
float f22 = 0.0F;
float f23 = 0.0625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
tessellator.addVertexWithUV(f4, f7, f2, f9, f10);
tessellator.addVertexWithUV(f5, f7, f2, f8, f10);
tessellator.addVertexWithUV(f5, f6, f2, f8, f11);
tessellator.addVertexWithUV(f4, f6, f2, f9, f11);
tessellator.setNormal(0.0F, 0.0F, 1.0F);
tessellator.addVertexWithUV(f4, f6, f3, f12, f14);
tessellator.addVertexWithUV(f5, f6, f3, f13, f14);
tessellator.addVertexWithUV(f5, f7, f3, f13, f15);
tessellator.addVertexWithUV(f4, f7, f3, f12, f15);
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV(f4, f6, f2, f16, f18);
tessellator.addVertexWithUV(f5, f6, f2, f17, f18);
tessellator.addVertexWithUV(f5, f6, f3, f17, f19);
tessellator.addVertexWithUV(f4, f6, f3, f16, f19);
tessellator.setNormal(0.0F, -1F, 0.0F);
tessellator.addVertexWithUV(f4, f7, f3, f16, f18);
tessellator.addVertexWithUV(f5, f7, f3, f17, f18);
tessellator.addVertexWithUV(f5, f7, f2, f17, f19);
tessellator.addVertexWithUV(f4, f7, f2, f16, f19);
tessellator.setNormal(-1F, 0.0F, 0.0F);
tessellator.addVertexWithUV(f4, f6, f3, f21, f22);
tessellator.addVertexWithUV(f4, f7, f3, f21, f23);
tessellator.addVertexWithUV(f4, f7, f2, f20, f23);
tessellator.addVertexWithUV(f4, f6, f2, f20, f22);
tessellator.setNormal(1.0F, 0.0F, 0.0F);
tessellator.addVertexWithUV(f5, f6, f2, f21, f22);
tessellator.addVertexWithUV(f5, f7, f2, f21, f23);
tessellator.addVertexWithUV(f5, f7, f3, f20, f23);
tessellator.addVertexWithUV(f5, f6, f3, f20, f22);
tessellator.draw();
}
}
}
private void func_77008_a(EntityPainting par1EntityPainting, float par2, float par3)
{
int i = MathHelper.floor_double(par1EntityPainting.posX);
int j = MathHelper.floor_double(par1EntityPainting.posY + (double)(par3 / 16F));
int k = MathHelper.floor_double(par1EntityPainting.posZ);
if (par1EntityPainting.direction == 0)
{
i = MathHelper.floor_double(par1EntityPainting.posX + (double)(par2 / 16F));
}
if (par1EntityPainting.direction == 1)
{
k = MathHelper.floor_double(par1EntityPainting.posZ - (double)(par2 / 16F));
}
if (par1EntityPainting.direction == 2)
{
i = MathHelper.floor_double(par1EntityPainting.posX - (double)(par2 / 16F));
}
if (par1EntityPainting.direction == 3)
{
k = MathHelper.floor_double(par1EntityPainting.posZ + (double)(par2 / 16F));
}
int l = renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0);
int i1 = l % 0x10000;
int j1 = l / 0x10000;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, i1, j1);
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
func_77009_a((EntityPainting)par1Entity, par2, par4, par6, par8, par9);
}
}
|
[
"[email protected]"
] | |
9c525dbbb13f565d45aaf679db79947642b66359
|
64e4ac0cffb656d2c8e4c2760615ea3aed6a3126
|
/UT5/src/ejemplos/Ejemplo3.java
|
acedd1a2dad84e8554eb7c67a6dd0ea420ba5c6e
|
[] |
no_license
|
AlvaroSanCer/EntornosUT5
|
c95a77e827a505f73132ca82f4046808c45721b9
|
4653e094979d8bfd58093c69c7b77080e22da3de
|
refs/heads/master
| 2020-05-05T04:53:46.243509 | 2019-05-02T19:27:04 | 2019-05-02T19:27:04 | 179,729,166 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,750 |
java
|
package ejemplos;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Ejemplo3 extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Ejemplo3 frame = new Ejemplo3();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Ejemplo3() {
setTitle("BorderLayout ALvaro SC");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(15, 15));
setContentPane(contentPane);
JButton btnNewButton = new JButton("Bot\u00F3n Norte");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
contentPane.add(btnNewButton, BorderLayout.NORTH);
JButton btnNewButton_1 = new JButton("Bot\u00F3n Oeste");
contentPane.add(btnNewButton_1, BorderLayout.WEST);
JButton btnNewButton_2 = new JButton("Bot\u00F3n Central");
contentPane.add(btnNewButton_2, BorderLayout.CENTER);
JButton btnNewButton_3 = new JButton("Bot\u00F3n Este");
contentPane.add(btnNewButton_3, BorderLayout.EAST);
JButton btnNewButton_4 = new JButton("Bot\u00F3n Sur");
contentPane.add(btnNewButton_4, BorderLayout.SOUTH);
}
}
|
[
"[email protected]"
] | |
1b53c2b0195c05d96fc702a8380362fcd7358226
|
9323d904a3b09ca1958013835fa526ccbfae9799
|
/src/com/clientwin/fram/RegisterFrame.java
|
5117978f99037e1e6cf39ea21181c56ed6c74af0
|
[] |
no_license
|
ChenJiWei95/ClientWin
|
d4a33b60a2fa40e7ec45eea536cafe5d24f26ce9
|
4bb2046ca578e0d4dc06aad01b56401fc870389c
|
refs/heads/master
| 2020-03-17T17:33:55.409180 | 2018-05-17T09:48:51 | 2018-05-17T09:48:51 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,842 |
java
|
package com.clientwin.fram;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import com.clientwin.conn.Client;
import com.clientwin.conn.ConnParam;
import com.clientwin.core.ArrayJson;
import com.clientwin.core.CrateSendMessage;
import com.clientwin.core.TestLine;
import com.clientwin.fram.ConnFram.ChatJPanel;
import com.clientwin.pool.JpanelPool;
import com.clientwin.request.RegisterRequest;
/**
*
* @ClassName: RegisterFrame
* @Description: TODO(注册界面)
* @author 威
* @date 2017年5月30日 下午10:58:57
*
*/
public class RegisterFrame extends JFrame implements MouseListener{
/*String spath = System.getProperty("user.dir") + "/src\\com\\clientwin\\img/" ;*/
String spath = System.getProperty("user.dir") + "/img/" ;
private static final long serialVersionUID = 1L;
/**
* 组件
*/
JLayeredPane fram = null ;
JButton top_close = null ;
JButton register = null ;
JLabel login = null ;
/**
* 处理拖动的参数
*/
private boolean isMoved = false ;
private Point pre_point = null ;
private Point end_point = null ;
public RegisterFrame(){
int w_ = Toolkit.getDefaultToolkit().getScreenSize().width ;
int h_ = Toolkit.getDefaultToolkit().getScreenSize().height ;
this.setSize(350, 300) ;
this.setLocation((w_-350)/2, (h_-300)/2) ;
this.setUndecorated(true) ;
this.setDragable(this) ;
setBacis() ;
mainf() ;
topf() ;
componentf() ;
JpanelPool pool = JpanelPool.newInstans() ;
System.out.println(pool.getSize()) ;
ConnParam conn = ConnParam.newInstants() ;
System.out.println("sfd"+conn.getIP()) ;
GetWinObject.newIstants().setRegisterFrame(this) ;
}
/**
*
* @Title: setBacis
* @Description: TODO(基础参数的配置)
* void
*
*/
public void setBacis(){
this.setLayout(null) ;
this.setResizable(false) ;
this.setDefaultCloseOperation(EXIT_ON_CLOSE) ;
this.setVisible(true) ;
}
/**
*
* @Title: mainf
* @Description: TODO(主要)
* void
*
*/
public void mainf(){
fram = new JLayeredPane(){
private static final long serialVersionUID = 1L ;
protected void paintComponent(Graphics g) {
ImageIcon icon = new ImageIcon(spath+"register.png");
Image img = icon.getImage() ;
g.drawImage(img, 0, 0, 350,
300, icon.getImageObserver()) ;
}
};
fram.setSize(350, 300) ;
fram.setLayout(null) ;
this.add(fram) ;
fram.setVisible(true) ;
}
//顶部
//JPanel top_jpanel = null ;
public void topf(){
//关闭按钮
top_close = new JButton() ;
top_close.setSize(32, 32) ;
top_close.setLocation(316, 2);
top_close.setBorder(BorderFactory.createEmptyBorder());
top_close.setCursor(new Cursor(HAND_CURSOR)) ;
fram.add(top_close, JLayeredPane.PALETTE_LAYER) ;
top_close.setContentAreaFilled(false) ;
top_close.setFocusable(false) ;
top_close.addMouseListener(this) ;
}
JTextField user = new JTextField() ;
JPasswordField pass = new JPasswordField() ;
JPasswordField pass_ = new JPasswordField() ;
JTextField email = new JTextField() ;
//其他组件
/**
*
* @Title: componentf
* @Description: TODO(其他组件堆放处 )
* void
*
*/
public void componentf(){
user.setSize(180, 30) ;
user.setLocation(110, 64) ;
pass.setSize(180, 30) ;
pass.setLocation(110, 118) ;
pass_.setSize(180, 30) ;
pass_.setLocation(110, 169) ;
email.setSize(180, 30) ;
email.setLocation(110, 220) ;
user.setBorder(BorderFactory.createEmptyBorder()) ;
pass.setBorder(BorderFactory.createEmptyBorder()) ;
pass_.setBorder(BorderFactory.createEmptyBorder()) ;
email.setBorder(BorderFactory.createEmptyBorder()) ;
user.setFont(new Font("微软雅黑",Font.PLAIN,13)) ;
pass.setFont(new Font("微软雅黑",Font.PLAIN,13)) ;
pass_.setFont(new Font("微软雅黑",Font.PLAIN,13)) ;
email.setFont(new Font("微软雅黑",Font.PLAIN,13)) ;
register = new JButton() ;
register.setSize(32, 32) ;
register.setLocation(294, 261) ;
register.setBorder(BorderFactory.createEmptyBorder()) ;
register.setCursor(new Cursor(HAND_CURSOR)) ;
login = new JLabel("前往登录") ;
login.setSize(90, 30) ;
login.setLocation(32, 268) ;
login.setForeground(Color.GRAY) ;
login.setFont(new Font("微软雅黑",Font.PLAIN,13)) ;
login.setCursor(new Cursor(HAND_CURSOR)) ;
fram.add(user, JLayeredPane.DEFAULT_LAYER) ;
fram.add(pass, JLayeredPane.DEFAULT_LAYER) ;
fram.add(pass_, JLayeredPane.DEFAULT_LAYER) ;
fram.add(register, JLayeredPane.DEFAULT_LAYER) ;
fram.add(login, JLayeredPane.DEFAULT_LAYER) ;
fram.add(email, JLayeredPane.DEFAULT_LAYER) ;
user.setOpaque(false) ;
pass.setOpaque(false) ;
pass_.setOpaque(false) ;
email.setOpaque(false) ;
register.setOpaque(false) ;
register.setContentAreaFilled(false) ;
register.setFocusable(false) ;
user.setVisible(true) ;
pass.setVisible(true) ;
pass_.setVisible(true) ;
email.setVisible(true) ;
register.setVisible(true) ;
login.setVisible(true) ;
register.addMouseListener(this) ;
login.addMouseListener(this) ;
}
//实现拖拽
// 为窗口加上监听器,使得窗口可以被拖动
/**
*
* @Title: setDragable
* @Description: TODO(处理窗口拖动)
* @param frame
* void
*
*/
private void setDragable(final RegisterFrame frame) {
this.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
isMoved = false;// 鼠标释放了以后,是不能再拖拽的了
frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
public void mousePressed(MouseEvent e) {
isMoved = true;
pre_point = new Point(e.getX(), e.getY());// 得到按下去的位置
frame.setCursor(new Cursor(Cursor.MOVE_CURSOR));
}
});
//拖动时当前的坐标减去鼠标按下去时的坐标,就是界面所要移动的向量。
this.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent e) {
if (isMoved) {// 判断是否可以拖拽
end_point = new Point(frame.getLocation().x + e.getX() - pre_point.x,
frame.getLocation().y + e.getY() - pre_point.y);
frame.setLocation(end_point);
}
}
});
}
public void setVisible(){
this.setVisible(false) ;
}
/**
* 错误提示窗
* 外界可以调用
*/
public static JPanel err_alert_win = null ;
public void err_win(String err_str){
TestLine testLine = TestLine.newInstants() ;
String err_msg = testLine.getMessage(err_str) ;
/**
* 提示窗
*/
err_alert_win = new JPanel();
err_alert_win.setSize(350, 300) ;
err_alert_win.setLocation(0, 0) ;
err_alert_win.setLayout(null) ;
JLabel bg = new JLabel() ;
err_alert_win.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e){
err_alert_win.setVisible(false);
}
});
bg.setSize(350, 300) ;
ImageIcon ico = new ImageIcon(spath+"3.png") ;
bg.setIcon(ico) ;
/**
* 提示框
*/
JPanel err_alert = new AlertJPanel() ;
err_alert.setLayout(null) ;
/**
* 提示内容
*/
JLabel err_message = new JLabel(err_msg) ;
err_message.setSize(testLine.getWidth2(), testLine.getHeight2());
err_message.setLocation(6, 3);
err_alert.setSize(err_message.getWidth()+8, err_message.getHeight()+16) ;
err_alert.setLocation((350-(err_message.getWidth()+8))/2, (300-(err_message.getHeight()+16))/2) ;
err_message.setForeground(new Color(255, 255, 255)) ;
/**
* 设置字体
*/
err_message.setFont(new Font("微软雅黑",Font.PLAIN,14));
/**
* 添加
*/
fram.add(err_alert_win, JLayeredPane.DRAG_LAYER) ;
err_alert_win.add(err_alert) ;
err_alert_win.add(bg) ;
err_alert.add(err_message) ;
err_alert_win.setOpaque(false) ;
/**
* 设置可视
*/
err_alert_win.setVisible(true) ;
err_alert.setVisible(true) ;
err_message.setVisible(true) ;
bg.setVisible(true) ;
}
public static void main(String[] args){
new RegisterFrame() ;
}
/**
* 事件
*/
@Override
public void mouseClicked(MouseEvent e) {
if(e.getSource().equals(top_close)){
System.exit(0);
}else if(e.getSource().equals(register)){
//点击判断信息无误发送注册信息到服务器
int len1 = user.getText().length() ;
int len2 = pass.getText().length() ;
int len3 = email.getText().length() ;
int len4 = pass_.getText().length() ;
if(len1 != 0 && len2 != 0 && len3 != 0 && len4 != 0){
if(pass.getText().equals(pass_.getText())){
ArrayJson json = new ArrayJson() ;
json.put("user", user.getText()) ;
json.put("pass", pass.getText()) ;
json.put("email", email.getText()) ;
CrateSendMessage msgMudle = CrateSendMessage.newInstans() ;
msgMudle.setContent(json.getMessage()) ;
RegisterRequest.newInstants().doRequest(msgMudle) ;
//等待服务响应做出下一部动作
return ;
}
else{
err_win("确认密码不正确") ;
}
}
else{
err_win("输入不能为空") ;
}
}else if(e.getSource().equals(login)){
this.setVisible(false) ;
new LoginFrame() ;
}
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
}
class AlertJPanel extends JPanel{
private static final long serialVersionUID = 1L;
public AlertJPanel(){
}
public void paintComponent(Graphics g){
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(new Color(25, 25, 25));
RoundRectangle2D.Double rect=new RoundRectangle2D.Double(0, 0, this.getWidth(), this.getHeight()-10, 15, 15);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.fill(rect);
g2d.draw(rect);
}
}
|
[
"[email protected]"
] | |
faf962de9b8ef80737dbbb3ab9aeeb7c06b6f8f7
|
6a3b36644a367bbfb21d180bcb540c5d8c24d9aa
|
/IBatisQuickStartSample/src/main/java/com/ibatis/quickstart/sample/main/Executor.java
|
99ca14b59a0c43fb90340cf38c4b20027242240a
|
[] |
no_license
|
matsuSV/IBatisQuickStartSample
|
0d9ecbe78be9d95ceb9f2764e22f5c9e02f10d50
|
8fdce1427c99ee6a794179c95cdfdf7e2e3d0ccf
|
refs/heads/master
| 2020-06-08T15:03:40.393703 | 2014-05-06T12:21:45 | 2014-05-06T12:21:45 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 845 |
java
|
package com.ibatis.quickstart.sample.main;
import java.io.IOException;
import java.sql.SQLException;
import com.ibatis.quickstart.sample.bean.SampleTable;
import com.ibatis.quickstart.sample.query.Inserter;
import com.ibatis.quickstart.sample.query.Selector;
import com.ibatis.quickstart.sample.util.LogProvider;
/**
* main関数
*
*/
public class Executor {
public static void main(String[] args) {
try {
Selector selector = new Selector();
selector.execute(SampleTable.class, "ibatis.sample.select_QT_SAMPLE_170_EMPLOYEE", "qt_Sample_100%");
// Inserter inserter = new Inserter();
// inserter.run("ibatis.sample.insert_QT_SAMPLE_170_EMPLOYEE");
} catch (SQLException e) {
LogProvider.error("", e);
} catch (IOException e) {
LogProvider.error("", e);
}
}
}
|
[
"[email protected]"
] | |
a6f62abe1123d21c36a54a62829b2d36305b0dbe
|
dc08f5a5178a074cfe9069e413c4e6ea1ade9aa9
|
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/AutonomousOpModes/BeaconTest.java
|
4f665f2cbb8248a6634c1debc47e6f7efff038b2
|
[
"BSD-3-Clause"
] |
permissive
|
gutsylvin/Team_Repo_TheClueless
|
e7124b4f71cd79893bb154f7af205e15712f6f96
|
852f21a95a80002c1bef5a739ab7c6423a3f8457
|
refs/heads/master
| 2021-01-12T13:45:23.353017 | 2017-02-12T05:29:36 | 2017-02-12T05:29:36 | 69,124,756 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 24,068 |
java
|
package org.firstinspires.ftc.teamcode.AutonomousOpModes;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.hardware.ColorSensor;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.qualcomm.robotcore.util.Range;
import com.qualcomm.robotcore.util.RobotLog;
import org.firstinspires.ftc.teamcode.AutonomousNavigation.MatchDetails;
import org.firstinspires.ftc.teamcode.RobotHardware.Robot;
import org.lasarobotics.vision.android.Cameras;
import org.lasarobotics.vision.ftc.resq.Beacon;
import org.lasarobotics.vision.opmode.LinearVisionOpMode;
import org.lasarobotics.vision.opmode.extensions.CameraControlExtension;
import org.lasarobotics.vision.util.ScreenOrientation;
import org.opencv.core.Size;
import static org.firstinspires.ftc.teamcode.AutonomousOpModes.AutonomousOpMode.HEADING_THRESHOLD;
import static org.firstinspires.ftc.teamcode.AutonomousOpModes.AutonomousOpMode.P_TURN_COEFF;
import static org.firstinspires.ftc.teamcode.RobotHardware.Robot.robot;
/**
* Created by hsunx on 2/10/2017.
*/
@Autonomous(name = "Beacon test", group = "test")
public class BeaconTest extends LinearVisionOpMode {
//region bloated shit
enum BeaconTestType {
VISIONPROCESSING,
COLORSENSOR,
RESET
}
private Beacon localBeacon;
private BeaconTestType type = BeaconTestType.COLORSENSOR;
private ElapsedTime runtime = new ElapsedTime();
static final double SPEED_FACTOR = 0.95;
static final double LINE_FOLLOW_TARGET = 0.4;
static final double CONFIDENCE_THRESHOLD = 0.75; // This is how confident the FTCVision reading needs to be in order
// for the program to be sure of its results. Lower is less accurate (duh)
// but higher may lead to inefficiency.
// These constants define the desired driving/control characteristics
// The can/should be tweaked to suite the specific robot drive train.
static final double TURN_SPEED = 0.15; // Nominal half speed for better accuracy.
static final double TURN_TIMEOUT = 10;
static final double START_ENCODER = 200; // Driving subroutines will use this encoder value as the "revving up" period
static final double END_ENCODER = 900;
//endregion
@Override
public void runOpMode() throws InterruptedException {
robot = new Robot();
robot.init(hardwareMap, telemetry);
localBeacon = new Beacon(Beacon.AnalysisMethod.COMPLEX);
//region ftcvision
//Wait for vision to initialize - this should be the first thing you do
waitForVisionStart();
this.setCamera(Cameras.PRIMARY);
this.setFrameSize(new Size(900, 900));
enableExtension(Extensions.BEACON); //Beacon detection
enableExtension(Extensions.ROTATION); //Automatic screen rotation correction
enableExtension(Extensions.CAMERA_CONTROL); //Manual camera control
beacon.setAnalysisMethod(Beacon.AnalysisMethod.FAST);
/**
* Set color tolerances
* 0 is default, -1 is minimum and 1 is maximum tolerance
*/
beacon.setColorToleranceRed(0);
beacon.setColorToleranceBlue(0);
rotation.setIsUsingSecondaryCamera(false);
rotation.disableAutoRotate();
rotation.setActivityOrientationFixed(ScreenOrientation.PORTRAIT);
cameraControl.setColorTemperature(CameraControlExtension.ColorTemperature.AUTO);
cameraControl.setAutoExposureCompensation();
//endregion
waitForStart();
//gyroDriveUntilLine(0.075, 0.4, 6.2);
//gyroTurn(0.2, 90);
vpBeacon(0.125);
}
// Left to right
enum BeaconState {
REDBLUE,
BLUERED,
BLUEBLUE,
REDRED,
UNKNOWN
}
/**
* Method to spin on central axis to point in a new direction.
* Move will stop if either of these conditions occur:
* 1) Move gets to the heading (angle)
* 2) Driver stops the opmode running.
*
* @param speed Desired speed of turn.
* @param angle Absolute Angle (in Degrees) relative to last gyro reset.
* 0 = fwd. +ve is CCW from fwd. -ve is CW from forward.
* If a relative angle is required, add/subtract from current heading.
* @throws InterruptedException
*/
public void gyroTurn(double speed, double angle)
throws InterruptedException {
speed *= SPEED_FACTOR;
double startTime = time;
// keep looping while we are still active, and not on heading.
while (opModeIsActive() && !onHeading(speed, angle, P_TURN_COEFF)) {
// Update telemetry & Allow time for other processes to run.
if (time > TURN_TIMEOUT + startTime) {
break;
}
telemetry.addData("time", time);
telemetry.addData("timeout", TURN_TIMEOUT * 1000);
telemetry.addData("left encoder", robot.leftMotor.getCurrentPosition());
telemetry.addData("right encoder", robot.rightMotor.getCurrentPosition());
RobotLog.i("left encoder : " + robot.leftMotor.getCurrentPosition());
RobotLog.i("right encoder : " + robot.rightMotor.getCurrentPosition());
telemetry.addData("gyro", robot.gyro.getHeading());
telemetry.update();
idle();
}
robot.leftMotor.setPower(0);
robot.rightMotor.setPower(0);
}
/**
* Perform one cycle of closed loop heading control.
*
* @param speed Desired speed of turn.
* @param angle Absolute Angle (in Degrees) relative to last gyro reset.
* 0 = fwd. +ve is CCW from fwd. -ve is CW from forward.
* If a relative angle is required, add/subtract from current heading.
* @param PCoeff Proportional Gain coefficient
* @return
*/
boolean onHeading(double speed, double angle, double PCoeff) {
double error;
double steer;
boolean onTarget = false;
double leftSpeed;
double rightSpeed;
// determine turn power based on +/- error
error = getError(angle);
if (Math.abs(error) <= HEADING_THRESHOLD) {
steer = 0.0;
leftSpeed = 0.0;
rightSpeed = 0.0;
onTarget = true;
} else {
steer = getSteer(error, PCoeff);
rightSpeed = speed * steer * SPEED_FACTOR;
leftSpeed = -rightSpeed;
}
// Send desired speeds to motors.
robot.leftMotor.setPower(leftSpeed);
robot.rightMotor.setPower(rightSpeed);
// Display it for the driver.
telemetry.addData("Target", "%5.2f", angle);
telemetry.addData("Err/St", "%5.2f/%5.2f", error, steer);
telemetry.addData("Speed.", "%5.2f:%5.2f", leftSpeed, rightSpeed);
return onTarget;
}
/**
* getError determines the error between the target angle and the robot's current heading
*
* @param targetAngle Desired angle (relative to global reference established at last Gyro Reset).
* @return error angle: Degrees in the range +/- 180. Centered on the robot's frame of reference
* +ve error means the robot should turn LEFT (CCW) to reduce error.
*/
public double getError(double targetAngle) {
double robotError;
// calculate error in -179 to +180 range (
robotError = targetAngle - robot.gyro.getIntegratedZValue();
while (robotError > 180) robotError -= 360;
while (robotError <= -180) robotError += 360;
return robotError;
}
/**
* returns desired steering force. +/- 1 range. +ve = steer left
*
* @param error Error angle in robot relative degrees
* @param PCoeff Proportional Gain Coefficient
* @return
*/
public double getSteer(double error, double PCoeff) {
return Range.clip(error * PCoeff, -1, 1);
}
//region beacon
public void pushBasedOnState(BeaconState state) {
if (state == BeaconState.REDBLUE) {
if (MatchDetails.color == MatchDetails.TeamColor.RED) {
robot.push(true);
}
else {
robot.push(false);
}
}
else if (state == BeaconState.BLUERED) {
if (MatchDetails.color == MatchDetails.TeamColor.RED) {
robot.push(false);
}
else {
robot.push(true);
}
}
else if (state == BeaconState.BLUEBLUE) {
if (MatchDetails.color == MatchDetails.TeamColor.RED) {
robot.pushBoth(true);
}
}
else if (state == BeaconState.REDRED) {
if (MatchDetails.color == MatchDetails.TeamColor.BLUE) {
robot.pushBoth(true);
}
}
}
// Assumes both sides are different colors
BeaconState getBeaconState() {
Beacon.BeaconAnalysis analysis = beacon.getAnalysis();
RobotLog.d(analysis.toString());
BeaconState visionState = BeaconState.UNKNOWN;
BeaconState sensorState = BeaconState.UNKNOWN;
if (analysis.isLeftKnown() && analysis.isRightKnown()) {
if (analysis.isLeftBlue() && analysis.isRightRed()) {
visionState = BeaconState.BLUERED;
}
else if (analysis.isLeftRed() && analysis.isRightBlue()) {
visionState = BeaconState.REDBLUE;
}
else if (analysis.isLeftRed() && analysis.isRightRed()) {
visionState = BeaconState.REDRED;
}
else if (analysis.isRightBlue() && analysis.isRightBlue()) {
visionState = BeaconState.BLUEBLUE;
}
else {
visionState = BeaconState.UNKNOWN;
}
}
if (!notDetecting(robot.colorSensor)) {
if (isRed(robot.colorSensor)) {
sensorState = BeaconState.BLUERED;
}
else {
sensorState = BeaconState.REDBLUE;
}
}
if (visionState == BeaconState.BLUEBLUE || visionState == BeaconState.REDRED) {
return visionState;
}
if (visionState == sensorState) {
// Good
return visionState;
}
else if (visionState == BeaconState.UNKNOWN) {
return sensorState;
}
else if (sensorState == BeaconState.UNKNOWN) {
return visionState;
}
else {
return BeaconState.UNKNOWN;
}
}
void vpBeacon(double speed) throws InterruptedException {
robot.leftMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
robot.rightMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
telemetry.addData("Team Color", MatchDetails.color);
Thread.sleep(200);
BeaconState state = getBeaconState();
while (state == BeaconState.UNKNOWN) {
encoderDrive(speed, 150, 2250);
Thread.sleep(200);
state = getBeaconState();
}
pushBasedOnState(state);
encoderDrive(speed, 800, 3000);
robot.leftMotor.setPower(0);
robot.rightMotor.setPower(0);
robot.pushBoth(false);
Thread.sleep(200);
boolean retry = true;
BeaconState afterState = getBeaconState();
if (afterState == BeaconState.REDRED) {
if (MatchDetails.color == MatchDetails.TeamColor.BLUE) {
pushBasedOnState(afterState);
}
else {
retry = false;
}
}
else if (afterState == BeaconState.BLUEBLUE) {
if (MatchDetails.color == MatchDetails.TeamColor.RED) {
pushBasedOnState(afterState);
}
else {
retry = false;
}
}
else if ((isRed(robot.colorSensor) && MatchDetails.color == MatchDetails.TeamColor.BLUE) || (isBlue(robot.colorSensor) && MatchDetails.color == MatchDetails.TeamColor.RED)) {
retry = true;
}
else {
retry = false;
}
if (retry) {
encoderDrive(0.75, -150, -150, 2000);
robot.pushBoth(true);
Thread.sleep(5000);
encoderDrive(0.5, 300, 300, 1750);
Thread.sleep(300);
encoderDrive(0.5, -75, -75, 800);
}
}
boolean isRed (ColorSensor c) {
if (c.red() > c.blue()) {
return true;
}
return false;
}
boolean isBlue (ColorSensor c) {
if (c.blue() > c.red()) {
return true;
}
return false;
}
public boolean reviseColor () {
if (isRed(robot.colorSensor)) {
if (MatchDetails.color == MatchDetails.TeamColor.RED) {
robot.push(false);
} else {
robot.push(true);
}
return true;
} else if (isBlue(robot.colorSensor)) {
if (MatchDetails.color == MatchDetails.TeamColor.RED) {
robot.push(true);
} else {
robot.push(false);
}
return true;
}
//}
return false;
//return (isRed(robot.colorSensor) && isRed(robot.adafruitColorSensor) || (isBlue(robot.colorSensor) && isBlue(robot.adafruitColorSensor)));
}
public boolean notDetecting(ColorSensor c) {
return c.blue() == c.red();
}
//endregion
//region driving
public void encoderDrive(double speed,
double left, double right,
double timeoutMs) throws InterruptedException {
encoderDrive(speed, speed, speed, left, right, timeoutMs, true);
}
public void encoderDrive(double speed, double counts, double timeoutMs) throws InterruptedException {
encoderDrive(speed, speed, speed, counts, counts, timeoutMs, true);
}
public void encoderDriveColor(double speed,
double counts,
double timeoutMs) throws InterruptedException {
encoderDriveColor(speed, speed, speed, counts, counts, timeoutMs);
}
public void encoderDriveColor(double speed,
double speed1,
double speed2,
double left, double right,
double timeoutMs) throws InterruptedException{
int newLeftTarget;
int newRightTarget;
int encoderStartLeft;
int encoderStartRight;
boolean stopped = false;
speed *= SPEED_FACTOR;
speed1 *= SPEED_FACTOR;
speed2 *= SPEED_FACTOR;
// Ensure that the opmode is still active
if (opModeIsActive()) {
encoderStartLeft = robot.leftMotor.getCurrentPosition();
encoderStartRight = robot.rightMotor.getCurrentPosition();
// Determine new target position, and pass to motor controller
newLeftTarget = encoderStartLeft + (int) ((left));
newRightTarget = encoderStartRight + (int) ((right));
robot.leftMotor.setTargetPosition(newLeftTarget);
robot.rightMotor.setTargetPosition(newRightTarget);
// Turn On RUN_TO_POSITION
robot.leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
robot.rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
robot.leftMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
robot.leftMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
// reset the timeout time and start motion.
runtime.reset();
robot.leftMotor.setPower(Math.abs(speed));
robot.rightMotor.setPower(Math.abs(speed));
// keep looping while we are still active, and there is time left, and both motors are running.
while (opModeIsActive() &&
(runtime.milliseconds() < timeoutMs) &&
(robot.leftMotor.isBusy() && robot.rightMotor.isBusy())) {
boolean pastStart = (Math.abs(robot.leftMotor.getCurrentPosition() - encoderStartLeft) > START_ENCODER
|| Math.abs(robot.rightMotor.getCurrentPosition() - encoderStartRight) > START_ENCODER);
boolean pastEnd = (Math.abs(newLeftTarget - robot.leftMotor.getCurrentPosition()) < END_ENCODER
|| Math.abs(newRightTarget - robot.rightMotor.getCurrentPosition()) < END_ENCODER);
boolean stop = reviseColor();
if (stop && !stopped) {
stopRobotMotion();
stopped = true;
Thread.sleep(200);
continue;
}
robot.leftMotor.setPower(Math.abs(pastEnd ? speed2 : (pastStart ? speed1 : speed)));
robot.rightMotor.setPower(Math.abs(pastEnd ? speed2 : (pastStart ? speed1 : speed)));
// Display it for the driver.
telemetry.addData("Path1", "Running to %7d :%7d", newLeftTarget, newRightTarget);
telemetry.addData("Path2", "Running at %7d :%7d",
robot.leftMotor.getCurrentPosition(),
robot.rightMotor.getCurrentPosition());
telemetry.addData("Gyro Angle", robot.gyro.getHeading());
telemetry.update();
// Allow time for other processes to run.
idle();
}
// Stop all motion;
robot.leftMotor.setPower(0);
robot.rightMotor.setPower(0);
// Turn off RUN_TO_POSITION
robot.leftMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
robot.rightMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
// sleep(250); // optional pause after each move
}
}
public void encoderDrive(double speed,
double speed1,
double speed2,
double left, double right,
double timeoutMs, boolean endBreak) throws InterruptedException {
int newLeftTarget;
int newRightTarget;
int encoderStartLeft;
int encoderStartRight;
speed *= SPEED_FACTOR;
speed1 *= SPEED_FACTOR;
speed2 *= SPEED_FACTOR;
robot.leftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
// Ensure that the opmode is still active
if (opModeIsActive()) {
encoderStartLeft = robot.leftMotor.getCurrentPosition();
encoderStartRight = robot.rightMotor.getCurrentPosition();
// Determine new target position, and pass to motor controller
newLeftTarget = encoderStartLeft + (int) ((left));
newRightTarget = encoderStartRight + (int) ((right));
robot.leftMotor.setTargetPosition(newLeftTarget);
robot.rightMotor.setTargetPosition(newRightTarget);
// Turn On RUN_TO_POSITION
robot.leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
robot.rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
robot.leftMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
robot.leftMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
// reset the timeout time and start motion.
runtime.reset();
robot.leftMotor.setPower(speed);
robot.rightMotor.setPower(speed);
// keep looping while we are still active, and there is time left, and both motors are running.
while (opModeIsActive() &&
(runtime.seconds() < timeoutMs) &&
(robot.leftMotor.isBusy() && robot.rightMotor.isBusy())) {
boolean pastStart = (Math.abs(robot.leftMotor.getCurrentPosition() - encoderStartLeft) > START_ENCODER
|| Math.abs(robot.rightMotor.getCurrentPosition() - encoderStartRight) > START_ENCODER);
boolean pastEnd = (Math.abs(newLeftTarget - robot.leftMotor.getCurrentPosition()) < END_ENCODER
|| Math.abs(newRightTarget - robot.rightMotor.getCurrentPosition()) < END_ENCODER);
robot.leftMotor.setPower(Math.abs(pastEnd ? speed2 : (pastStart ? speed1 : speed)));
robot.rightMotor.setPower(Math.abs(pastEnd ? speed2 : (pastStart ? speed1 : speed)));
// Display it for the driver.
telemetry.addData("Path1", "Running to %7d :%7d", newLeftTarget, newRightTarget);
telemetry.addData("Path2", "Running at %7d :%7d",
robot.leftMotor.getCurrentPosition(),
robot.rightMotor.getCurrentPosition());
telemetry.addData("Gyro Angle", robot.gyro.getHeading());
telemetry.update();
// Allow time for other processes to run.
idle();
}
// Stop all motion;
robot.leftMotor.setPower(0);
robot.rightMotor.setPower(0);
// Turn off RUN_TO_POSITION
robot.leftMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
robot.rightMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
// sleep(250); // optional pause after each move
}
}
/**
* @param speed speed
* @param target target for the optical distance sensor
* @throws InterruptedException
*/
public void gyroDriveUntilLine(double speed
/*double angle*/, double target, double adafruitTarget) throws InterruptedException {
gyroDriveUntilLine(speed, speed, target, adafruitTarget);
}
public void gyroDriveUntilLine(double leftSpeed, double rightSpeed
/*double angle*/, double target, double adafruitTarget) throws InterruptedException {
runtime.reset();
// Ensure that the opmode is still active
if (opModeIsActive()) {
// start motion.
leftSpeed = Range.clip(leftSpeed, -1.0, 1.0) * SPEED_FACTOR;
rightSpeed = Range.clip(rightSpeed, -1.0, 1.0) * SPEED_FACTOR;
robot.leftMotor.setPower(leftSpeed);
robot.rightMotor.setPower(rightSpeed);
robot.leftMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
robot.rightMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
// keep looping while we are still active, and BOTH motors are running.
while (opModeIsActive()) {
double scaledValue = robot.opticalDistanceSensor.getLightDetected();
telemetry.addData("light", scaledValue);
telemetry.addData("gyro", robot.gyro.getHeading());
telemetry.update();
if (scaledValue >= target || (getGreyscale(robot.adafruitI2cColorSensor) / 255 > adafruitTarget)) {
stopRobotMotion();
return;
}
idle();
}
// Stop all motion;
robot.leftMotor.setPower(0);
robot.rightMotor.setPower(0);
// Turn off RUN_TO_POSITION
robot.leftMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
robot.rightMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
}
}
public double getGreyscale(ColorSensor c) {
return 0.299 * c.red() + 0.587 * c.green() + 0.114 * c.blue();
}
public void stopRobotMotion() {
robot.leftMotor.setPower(0);
robot.rightMotor.setPower(0);
}
//endregion
}
|
[
"[email protected]"
] | |
56f10fa9dc40ef3939716e8833750eb8ec8b0083
|
e82b41390ca70e8571b692bdf4c17a25ae06a148
|
/src/main/java/com/lt/concurrency/example/aqs/ForkJoinTaskExample.java
|
7ac9f19f0a08ce39b8ea4b7e8fa505d6bdb976c1
|
[] |
no_license
|
lttoto/concurrency
|
4e7d6ff25d1e3418b28ea43c4d67dd88be9bff96
|
45d81eca4e1573b3dc28a943f0dd16919fc3b7c5
|
refs/heads/master
| 2020-03-10T18:45:09.186133 | 2018-04-30T09:26:25 | 2018-04-30T09:26:25 | 129,533,057 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,634 |
java
|
package com.lt.concurrency.example.aqs;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;
import java.util.concurrent.RecursiveTask;
import java.util.function.Function;
/**
* Created by taoshiliu on 2018/4/30.
*/
@Slf4j
public class ForkJoinTaskExample extends RecursiveTask<Integer>{
public static final int threshold = 2;
private int start;
private int end;
public ForkJoinTaskExample(int start,int end) {
this.start = start;
this.end = end;
}
@Override
protected Integer compute() {
int sum = 0;
boolean canCompute = (end - start) <= threshold;
if(canCompute) {
for (int i = start; i <= end;i++) {
sum += i;
}
}else {
int middle = (start + end) / 2;
ForkJoinTaskExample leftTask = new ForkJoinTaskExample(start,middle);
ForkJoinTaskExample rightTask = new ForkJoinTaskExample(middle+1,end);
leftTask.fork();
rightTask.fork();
int leftResult = leftTask.join();
int rightResult = rightTask.join();
sum = leftResult + rightResult;
}
return sum;
}
public static void main(String[] args) {
ForkJoinPool forkJoinPool = new ForkJoinPool();
ForkJoinTaskExample task = new ForkJoinTaskExample(1,100);
Future<Integer> result = forkJoinPool.submit(task);
try {
log.info("result:{}",result.get());
}catch (Exception e) {
log.error("exception",e);
}
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.