blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
297720785dde99aed905cb271f627487271a79c1 | 948558c28ae9febd405e02b734ad74550b8fc38d | /src/main/java/com/example/demo/repository/UserRepository.java | 3419ac78e295378b7834669e372cf85b253e5fee | [] | no_license | balaji-thiruvengadam/redis-template-examples | 32db92f8bd06f1aff56793dbd86ce92a00133ae8 | 1e1fb837bc7eef64ad2b3e1772713ec2ce1da37d | refs/heads/master | 2023-03-28T20:43:29.420179 | 2021-04-07T09:01:34 | 2021-04-07T09:01:34 | 355,462,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,079 | java | package com.example.demo.repository;
import java.util.List;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Repository;
import com.example.demo.entity.User;
@Repository
public class UserRepository {
private static final String USER = "tenant:user";
private HashOperations hashOperations;
private RedisTemplate redisTemplate;
public UserRepository(RedisTemplate redisTemplate){
this.redisTemplate = redisTemplate;
this.hashOperations = this.redisTemplate.opsForHash();
}
public void save(User user){
hashOperations.put(USER, user.getId(), user);
}
public List findAll(){
return hashOperations.values(USER);
}
public User findById(String id){
return (User) hashOperations.get(USER, id);
}
public void update(User user){
save(user);
}
public void delete(String id){
hashOperations.delete(USER, id);
}
}
| [
"thiruvengadam.balaji@gmail.com"
] | thiruvengadam.balaji@gmail.com |
01cfc9f964392b3519ae036c3b677da0b6aba5e9 | fd5dcff2841ae19862bf98d2632f2a33de3b9054 | /PizzaOrderSystem/SicilianPizza.java | 981c386f064f151c51dee06ca95cebfdc04d9e62 | [] | no_license | gujin1991/Object-Oriented-Design | 20cdb1e5d999dea0dec575465c4b22ed46606f69 | 742c3dfb37a71617b4983e615daf5d36d31e0ad9 | refs/heads/master | 2021-01-09T20:05:25.326806 | 2016-07-16T18:27:12 | 2016-07-16T18:27:12 | 59,839,260 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 124 | java | package June7th;
public class SicilianPizza extends Pizza{
public SicilianPizza(String t, int s) {
super(t, s);
}
}
| [
"Jin@gujindeMacBook-Pro.local"
] | Jin@gujindeMacBook-Pro.local |
58ccfa3ef893d1cdbee51040cef90108d0da67ee | f17482e8bb3b951997f4f65d33ed351c2bab4214 | /src/test/java/com/example/demo/RabbitmqTest.java | a056c85d0db7d35a233d8db51a3cb502ab1bc053 | [] | no_license | liusa63/springbootdemo | ea9b2b86afe3fff3711ff7ac00b7f9fd606fed23 | 7b95bf2cf4e31bfe1d2c78bc23327191d59fece1 | refs/heads/master | 2022-08-30T23:07:02.875887 | 2022-08-17T09:19:39 | 2022-08-17T09:19:39 | 181,633,923 | 3 | 0 | null | 2022-06-29T17:25:28 | 2019-04-16T07:04:45 | Java | UTF-8 | Java | false | false | 504 | java | package com.example.demo;
import javax.annotation.Resource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.example.demo.rabbitmq.MQProducer;
@RunWith(SpringRunner.class)
@SpringBootTest
public class RabbitmqTest {
@Resource
private MQProducer producer;
@Test
public void testDemo() {
producer.sendMessage("testQueue", "testContent");
}
}
| [
"liusa@lenovocloud.com"
] | liusa@lenovocloud.com |
90ebe7208d7b409eaff68d2400e0296265f4a107 | 4669ae0a9c105e8c5191de5ee4bd24816e920828 | /network/app/src/main/java/multi/android/network/iot/IoTClientActivity.java | f3e80d4cac1633d2463ead47ebb0a63bfc8f67d8 | [] | no_license | kim-svadoz/Android | 505be6a1f05ed88f1a3211eff7fc7ea176dbefdf | 04ab4c33dea7ed1b265799d786a21ac334a78c9c | refs/heads/master | 2021-05-16T22:11:10.526115 | 2020-05-25T09:49:33 | 2020-05-25T09:49:33 | 250,490,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,549 | java | package multi.android.network.iot;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Random;
import multi.android.network.R;
public class IoTClientActivity extends AppCompatActivity {
IoTAsyncTask asyncTaskExam;
InputStream is;
InputStreamReader isr;
BufferedReader br;
Socket socket;
OutputStream os;
PrintWriter pw;
String androidId;
int flag;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_io_t_client);
//로그인을 해서 DB에 접속한 후에 (인증 후) 발생된 id를 넘겨받아 작업
Random r = new Random();
flag =r.nextInt(2)+1;
if(flag%2==0){
androidId = "1111";
}else{
androidId = "2222";
}
asyncTaskExam = new IoTAsyncTask();
asyncTaskExam.execute(10,20);
}
public void send_msg(final View view){
new Thread(new Runnable() {
@Override
public void run() {
String message="";
if(view.getId()==R.id.led_on){
message = "led_on";
}else if(view.getId()==R.id.led_off){
message = "led_off";
}else{
message = "다른거";
}
pw.println("job/"+message+"/phone/"+androidId);
pw.flush();
}
}).start();
}
class IoTAsyncTask extends AsyncTask<Integer,String,String> {
@Override
protected String doInBackground(Integer... integers) {
try {
socket = new Socket("70.12.230.200", 12345);
if (socket != null) {
ioWork();
}
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
String msg;
try {
msg = br.readLine();
Log.d("myiot", "서버로 부터 수신된 메시지>>"
+ msg);
} catch (IOException e) {
try {
//2. 서버쪽에서 연결이 끊어지는 경우 사용자는 자원을 반납======
//자원반납
is.close();
isr.close();
br.close();
os.close();
pw.close();
socket.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
break;//반복문 빠져나가도록 설정
}
}
}
});
t1.start();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
void ioWork(){
//최초접속할 때 서버에게 접속한 아이디에 정보 전달
try {
is = socket.getInputStream();
isr = new InputStreamReader(is);
br = new BufferedReader(isr);
os = socket.getOutputStream();
pw = new PrintWriter(os,true);
pw.println("phone/"+androidId);
pw.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
protected void onDestroy() {
super.onDestroy();
try {
if (socket != null) socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"dhkdghehfdl@gmail.com"
] | dhkdghehfdl@gmail.com |
22dad223d733a69f754fc9fa95b6dbc06e4d9b48 | 9254e7279570ac8ef687c416a79bb472146e9b35 | /pai-dlc-20201203/src/main/java/com/aliyun/pai_dlc20201203/models/ListJobsShrinkRequest.java | b4978ce4d72a1e07237800c98048ec55ca2b8015 | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,907 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.pai_dlc20201203.models;
import com.aliyun.tea.*;
public class ListJobsShrinkRequest extends TeaModel {
// 作业显示名称,支持模糊查询
@NameInMap("DisplayName")
public String displayName;
// 作业类型
@NameInMap("JobType")
public String jobType;
// 作业状态
@NameInMap("Status")
public String status;
// 起始时间
@NameInMap("StartTime")
public String startTime;
// 截止时间
@NameInMap("EndTime")
public String endTime;
// 当前页
@NameInMap("PageNumber")
public Integer pageNumber;
// 每页返回的作业数
@NameInMap("PageSize")
public Integer pageSize;
// 按返回字段排序
@NameInMap("SortBy")
public String sortBy;
// 排序顺序
@NameInMap("Order")
public String order;
// 是否只返回当前登录者所提交的作业
@NameInMap("ShowOwn")
public Boolean showOwn;
// 工作空间ID
@NameInMap("WorkspaceId")
public String workspaceId;
// 资源组ID
@NameInMap("ResourceId")
public String resourceId;
// 作业关联用户ID
@NameInMap("BusinessUserId")
public String businessUserId;
// 调用方
@NameInMap("Caller")
public String caller;
// 自定义标签
@NameInMap("Tags")
public String tagsShrink;
// 工作流ID
@NameInMap("PipelineId")
public String pipelineId;
public static ListJobsShrinkRequest build(java.util.Map<String, ?> map) throws Exception {
ListJobsShrinkRequest self = new ListJobsShrinkRequest();
return TeaModel.build(map, self);
}
public ListJobsShrinkRequest setDisplayName(String displayName) {
this.displayName = displayName;
return this;
}
public String getDisplayName() {
return this.displayName;
}
public ListJobsShrinkRequest setJobType(String jobType) {
this.jobType = jobType;
return this;
}
public String getJobType() {
return this.jobType;
}
public ListJobsShrinkRequest setStatus(String status) {
this.status = status;
return this;
}
public String getStatus() {
return this.status;
}
public ListJobsShrinkRequest setStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public String getStartTime() {
return this.startTime;
}
public ListJobsShrinkRequest setEndTime(String endTime) {
this.endTime = endTime;
return this;
}
public String getEndTime() {
return this.endTime;
}
public ListJobsShrinkRequest setPageNumber(Integer pageNumber) {
this.pageNumber = pageNumber;
return this;
}
public Integer getPageNumber() {
return this.pageNumber;
}
public ListJobsShrinkRequest setPageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
public Integer getPageSize() {
return this.pageSize;
}
public ListJobsShrinkRequest setSortBy(String sortBy) {
this.sortBy = sortBy;
return this;
}
public String getSortBy() {
return this.sortBy;
}
public ListJobsShrinkRequest setOrder(String order) {
this.order = order;
return this;
}
public String getOrder() {
return this.order;
}
public ListJobsShrinkRequest setShowOwn(Boolean showOwn) {
this.showOwn = showOwn;
return this;
}
public Boolean getShowOwn() {
return this.showOwn;
}
public ListJobsShrinkRequest setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId;
return this;
}
public String getWorkspaceId() {
return this.workspaceId;
}
public ListJobsShrinkRequest setResourceId(String resourceId) {
this.resourceId = resourceId;
return this;
}
public String getResourceId() {
return this.resourceId;
}
public ListJobsShrinkRequest setBusinessUserId(String businessUserId) {
this.businessUserId = businessUserId;
return this;
}
public String getBusinessUserId() {
return this.businessUserId;
}
public ListJobsShrinkRequest setCaller(String caller) {
this.caller = caller;
return this;
}
public String getCaller() {
return this.caller;
}
public ListJobsShrinkRequest setTagsShrink(String tagsShrink) {
this.tagsShrink = tagsShrink;
return this;
}
public String getTagsShrink() {
return this.tagsShrink;
}
public ListJobsShrinkRequest setPipelineId(String pipelineId) {
this.pipelineId = pipelineId;
return this;
}
public String getPipelineId() {
return this.pipelineId;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
3ef2172068f2425b0ca6008da13a3f9b23933907 | fc78d615949794fdfb54d359d4b26fd54ed610ac | /core/src/main/java/tachyon/master/MasterClient.java | 237b7d5345fe21f27e8766077babf7b721eb2f74 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | mtunique/tachyon-rdma | 76fb0ac6524b7e53a88df66d77d26220a4066843 | b79cb19c2895d859384aa3aa3f3f11d1aed20e28 | refs/heads/master | 2022-10-18T07:45:24.482784 | 2021-04-27T02:29:54 | 2021-04-27T02:29:54 | 25,732,604 | 7 | 2 | Apache-2.0 | 2022-10-05T02:34:25 | 2014-10-25T13:38:43 | Java | UTF-8 | Java | false | false | 26,738 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package tachyon.master;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransportException;
import org.apache.log4j.Logger;
import tachyon.Constants;
import tachyon.HeartbeatThread;
import tachyon.LeaderInquireClient;
import tachyon.conf.CommonConf;
import tachyon.conf.UserConf;
import tachyon.thrift.BlockInfoException;
import tachyon.thrift.ClientBlockInfo;
import tachyon.thrift.ClientDependencyInfo;
import tachyon.thrift.ClientFileInfo;
import tachyon.thrift.ClientRawTableInfo;
import tachyon.thrift.ClientWorkerInfo;
import tachyon.thrift.Command;
import tachyon.thrift.DependencyDoesNotExistException;
import tachyon.thrift.FileAlreadyExistException;
import tachyon.thrift.FileDoesNotExistException;
import tachyon.thrift.InvalidPathException;
import tachyon.thrift.MasterService;
import tachyon.thrift.NetAddress;
import tachyon.thrift.NoWorkerException;
import tachyon.thrift.SuspectedFileSizeException;
import tachyon.thrift.TableColumnException;
import tachyon.thrift.TableDoesNotExistException;
import tachyon.thrift.TachyonException;
import tachyon.util.CommonUtils;
/**
* The master server client side.
*
* Since MasterService.Client is not thread safe, this class has to guarantee thread safe.
*/
public class MasterClient {
private final static int MAX_CONNECT_TRY = 5;
private final Logger LOG = Logger.getLogger(Constants.LOGGER_TYPE);
private boolean mUseZookeeper;
private MasterService.Client mClient = null;
private InetSocketAddress mMasterAddress = null;
private TProtocol mProtocol = null;
private volatile boolean mIsConnected;
private volatile boolean mIsShutdown;
private volatile long mLastAccessedMs;
private HeartbeatThread mHeartbeatThread = null;
public MasterClient(InetSocketAddress masterAddress) {
this(masterAddress, CommonConf.get().USE_ZOOKEEPER);
}
public MasterClient(InetSocketAddress masterAddress, boolean useZookeeper) {
mUseZookeeper = useZookeeper;
if (!mUseZookeeper) {
mMasterAddress = masterAddress;
}
mIsConnected = false;
mIsShutdown = false;
}
/**
* @param workerId
* if -1, means the checkpoint is added directly by the client from underlayer fs.
* @param fileId
* @param length
* @param checkpointPath
* @return
* @throws FileDoesNotExistException
* @throws SuspectedFileSizeException
* @throws BlockInfoException
* @throws TException
*/
public synchronized boolean addCheckpoint(long workerId, int fileId, long length,
String checkpointPath) throws FileDoesNotExistException, SuspectedFileSizeException,
BlockInfoException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.addCheckpoint(workerId, fileId, length, checkpointPath);
} catch (TException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return false;
}
/**
* Clean the connect. E.g. if the client has not connect the master for a while, the connection
* should be shut down.
*/
public synchronized void cleanConnect() {
if (mIsConnected) {
LOG.debug("Disconnecting from the master " + mMasterAddress);
mIsConnected = false;
}
if (mProtocol != null) {
mProtocol.getTransport().close();
}
if (mHeartbeatThread != null) {
mHeartbeatThread.shutdown();
}
}
/**
* Connects to the Tachyon Master; an exception is thrown if this fails.
*/
public synchronized void connect() throws TException {
mLastAccessedMs = System.currentTimeMillis();
if (mIsConnected) {
return;
}
cleanConnect();
if (mIsShutdown) {
throw new TException("Client is shutdown, will not try to connect");
}
int tries = 0;
Exception lastException = null;
while (tries ++ < MAX_CONNECT_TRY && !mIsShutdown) {
mMasterAddress = getMasterAddress();
mProtocol =
new TBinaryProtocol(new TFramedTransport(new TSocket(mMasterAddress.getHostName(),
mMasterAddress.getPort())));
mClient = new MasterService.Client(mProtocol);
mLastAccessedMs = System.currentTimeMillis();
try {
mProtocol.getTransport().open();
mHeartbeatThread =
new HeartbeatThread("Master_Client Heartbeat", new MasterClientHeartbeatExecutor(this,
UserConf.get().MASTER_CLIENT_TIMEOUT_MS),
UserConf.get().MASTER_CLIENT_TIMEOUT_MS / 2);
mHeartbeatThread.start();
} catch (TTransportException e) {
lastException = e;
LOG.error("Failed to connect (" + tries + ") to master " + mMasterAddress + " : "
+ e.getMessage());
if (mHeartbeatThread != null) {
mHeartbeatThread.shutdown();
}
CommonUtils.sleepMs(LOG, Constants.SECOND_MS);
continue;
}
mIsConnected = true;
return;
}
// Reaching here indicates that we did not successfully connect.
throw new TException("Failed to connect to master " + mMasterAddress + " after " + (tries - 1)
+ " attempts", lastException);
}
public ClientDependencyInfo getClientDependencyInfo(int did) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getClientDependencyInfo(did);
} catch (DependencyDoesNotExistException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized ClientFileInfo getClientFileInfoById(int id) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.getClientFileInfoById(id);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (TException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
long getLastAccessedMs() {
return mLastAccessedMs;
}
private InetSocketAddress getMasterAddress() {
if (!mUseZookeeper) {
return mMasterAddress;
}
LeaderInquireClient leaderInquireClient =
LeaderInquireClient.getClient(CommonConf.get().ZOOKEEPER_ADDRESS,
CommonConf.get().ZOOKEEPER_LEADER_PATH);
try {
String temp = leaderInquireClient.getMasterAddress();
return CommonUtils.parseInetSocketAddress(temp);
} catch (IOException e) {
LOG.error(e.getMessage(), e);
CommonUtils.runtimeException(e);
}
return null;
}
public synchronized long getUserId() throws TException {
while (!mIsShutdown) {
connect();
try {
long ret = mClient.user_getUserId();
LOG.info("User registered at the master " + mMasterAddress + " got UserId " + ret);
return ret;
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public synchronized List<ClientWorkerInfo> getWorkersInfo() throws TException {
while (!mIsShutdown) {
connect();
try {
return mClient.getWorkersInfo();
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized boolean isConnected() {
return mIsConnected;
}
public synchronized List<ClientFileInfo> listStatus(String path) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.liststatus(path);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (TException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public void shutdown() {
mIsShutdown = true;
if (mProtocol != null) {
mProtocol.getTransport().close();
}
cleanConnect();
}
public synchronized void user_completeFile(int fId) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
mClient.user_completeFile(fId);
return;
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
}
public synchronized int user_createDependency(List<String> parents, List<String> children,
String commandPrefix, List<ByteBuffer> data, String comment, String framework,
String frameworkVersion, int dependencyType, long childrenBlockSizeByte) throws IOException,
TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_createDependency(parents, children, commandPrefix, data, comment,
framework, frameworkVersion, dependencyType, childrenBlockSizeByte);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (FileAlreadyExistException e) {
throw new IOException(e);
} catch (BlockInfoException e) {
throw new IOException(e);
} catch (TachyonException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public synchronized int user_createFile(String path, long blockSizeByte) throws IOException,
TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_createFile(path, blockSizeByte);
} catch (FileAlreadyExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (BlockInfoException e) {
throw new IOException(e);
} catch (TachyonException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public int user_createFileOnCheckpoint(String path, String checkpointPath) throws IOException,
TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_createFileOnCheckpoint(path, checkpointPath);
} catch (FileAlreadyExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (SuspectedFileSizeException e) {
throw new IOException(e);
} catch (BlockInfoException e) {
throw new IOException(e);
} catch (TachyonException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public synchronized long user_createNewBlock(int fId) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_createNewBlock(fId);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public synchronized int user_createRawTable(String path, int columns, ByteBuffer metadata)
throws IOException, TException {
if (metadata == null) {
metadata = ByteBuffer.allocate(0);
}
while (!mIsShutdown) {
connect();
try {
return mClient.user_createRawTable(path, columns, metadata);
} catch (FileAlreadyExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TableColumnException e) {
throw new IOException(e);
} catch (TachyonException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public synchronized boolean user_delete(int fileId, boolean recursive) throws IOException,
TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_deleteById(fileId, recursive);
} catch (TachyonException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return false;
}
public synchronized boolean user_delete(String path, boolean recursive) throws IOException,
TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_deleteByPath(path, recursive);
} catch (TachyonException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return false;
}
public synchronized long user_getBlockId(int fId, int index) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getBlockId(fId, index);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public ClientBlockInfo user_getClientBlockInfo(long blockId) throws FileDoesNotExistException,
BlockInfoException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getClientBlockInfo(blockId);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized ClientFileInfo user_getClientFileInfoByPath(String path) throws IOException,
TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getClientFileInfoByPath(path);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized ClientRawTableInfo user_getClientRawTableInfoById(int id)
throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
ClientRawTableInfo ret = mClient.user_getClientRawTableInfoById(id);
ret.setMetadata(CommonUtils.generateNewByteBufferFromThriftRPCResults(ret.metadata));
return ret;
} catch (TableDoesNotExistException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized ClientRawTableInfo user_getClientRawTableInfoByPath(String path)
throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
ClientRawTableInfo ret = mClient.user_getClientRawTableInfoByPath(path);
ret.setMetadata(CommonUtils.generateNewByteBufferFromThriftRPCResults(ret.metadata));
return ret;
} catch (TableDoesNotExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized List<ClientBlockInfo> user_getFileBlocks(int id) throws IOException,
TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getFileBlocksById(id);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized int user_getFileId(String path) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getFileId(path);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public synchronized int user_getNumberOfFiles(String folderPath) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getNumberOfFiles(folderPath);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public synchronized int user_getRawTableId(String path) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getRawTableId(path);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
public synchronized String user_getUnderfsAddress() throws TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getUnderfsAddress();
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized NetAddress user_getWorker(boolean random, String hostname)
throws NoWorkerException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_getWorker(random, hostname);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized List<Integer> user_listFiles(String path, boolean recursive)
throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_listFiles(path, recursive);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized List<String> user_ls(String path, boolean recursive) throws IOException,
TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_ls(path, recursive);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized boolean user_mkdir(String path) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_mkdir(path);
} catch (FileAlreadyExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TachyonException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return false;
}
public synchronized void user_outOfMemoryForPinFile(int fileId) throws TException {
while (!mIsShutdown) {
connect();
try {
mClient.user_outOfMemoryForPinFile(fileId);
return;
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
}
public synchronized boolean user_rename(String srcPath, String dstPath) throws IOException,
TException {
while (!mIsShutdown) {
connect();
try {
return mClient.user_rename(srcPath, dstPath);
} catch (FileAlreadyExistException e) {
throw new IOException(e);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return false;
}
public void user_renameTo(int fId, String path) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
mClient.user_renameTo(fId, path);
return;
} catch (FileAlreadyExistException e) {
throw new IOException(e);
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (InvalidPathException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
}
public synchronized void user_reportLostFile(int fileId) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
mClient.user_reportLostFile(fileId);
return;
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
}
public synchronized void user_requestFilesInDependency(int depId) throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
mClient.user_requestFilesInDependency(depId);
return;
} catch (DependencyDoesNotExistException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
}
public synchronized void user_setPinned(int id, boolean pinned)
throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
mClient.user_setPinned(id, pinned);
return;
} catch (FileDoesNotExistException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
}
public synchronized void user_updateRawTableMetadata(int id, ByteBuffer metadata)
throws IOException, TException {
while (!mIsShutdown) {
connect();
try {
mClient.user_updateRawTableMetadata(id, metadata);
return;
} catch (TableDoesNotExistException e) {
throw new IOException(e);
} catch (TachyonException e) {
throw new IOException(e);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
}
public synchronized void worker_cacheBlock(long workerId, long workerUsedBytes, long blockId,
long length) throws FileDoesNotExistException, SuspectedFileSizeException,
BlockInfoException, TException {
while (!mIsShutdown) {
connect();
try {
mClient.worker_cacheBlock(workerId, workerUsedBytes, blockId, length);
return;
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
}
public synchronized Set<Integer> worker_getPinIdList() throws TException {
while (!mIsShutdown) {
connect();
try {
return mClient.worker_getPinIdList();
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
public synchronized List<Integer> worker_getPriorityDependencyList() throws TException {
while (!mIsShutdown) {
connect();
try {
return mClient.worker_getPriorityDependencyList();
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return new ArrayList<Integer>();
}
public synchronized Command worker_heartbeat(long workerId, long usedBytes,
List<Long> removedPartitionList) throws BlockInfoException, TException {
while (!mIsShutdown) {
connect();
try {
return mClient.worker_heartbeat(workerId, usedBytes, removedPartitionList);
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return null;
}
/**
* Register the worker to the master.
*
* @param workerNetAddress
* Worker's NetAddress
* @param totalBytes
* Worker's capacity
* @param usedBytes
* Worker's used storage
* @param currentBlockList
* Blocks in worker's space.
* @return the worker id assigned by the master.
* @throws BlockInfoException
* @throws TException
*/
public synchronized long worker_register(NetAddress workerNetAddress, long totalBytes,
long usedBytes, List<Long> currentBlockList) throws BlockInfoException, TException {
while (!mIsShutdown) {
connect();
try {
long ret =
mClient.worker_register(workerNetAddress, totalBytes, usedBytes, currentBlockList);
LOG.info("Registered at the master " + mMasterAddress + " from worker " + workerNetAddress
+ " , got WorkerId " + ret);
return ret;
} catch (TTransportException e) {
LOG.error(e.getMessage());
mIsConnected = false;
}
}
return -1;
}
} | [
"taomeng@hustunique.com"
] | taomeng@hustunique.com |
eafcace2814e2fee01da7fb7c997e69157ddd476 | a2d1278f05965382977c8045afdf1ea3cdd8025b | /src/main/java/com/huxx/vo/CategoryVo.java | e97729ef88e19fb2a759b948a32c0c38eb5ddc57 | [] | no_license | huxx-j/JBlog | e432212d193aecb64239a916f536c54ed7263d2d | b271fe8ccbb6dcbff17581a6aee55e8e5f4d7cc8 | refs/heads/master | 2020-03-17T04:42:20.524811 | 2018-05-14T10:42:44 | 2018-05-14T10:42:44 | 133,285,696 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,891 | java | package com.huxx.vo;
public class CategoryVo {
private int cateNo;
private String id;
private String cateName;
private String description;
private String regDate;
private int postCnt;
public CategoryVo() {
}
public CategoryVo(String id, String cateName, String description) {
this.id = id;
this.cateName = cateName;
this.description = description;
}
public CategoryVo(int cateNo, String id, String cateName, String description, String regDate) {
this.cateNo = cateNo;
this.id = id;
this.cateName = cateName;
this.description = description;
this.regDate = regDate;
}
public int getPostCnt() {
return postCnt;
}
public void setPostCnt(int postCnt) {
this.postCnt = postCnt;
}
public int getCateNo() {
return cateNo;
}
public void setCateNo(int cateNo) {
this.cateNo = cateNo;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCateName() {
return cateName;
}
public void setCateName(String cateName) {
this.cateName = cateName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getRegDate() {
return regDate;
}
public void setRegDate(String regDate) {
this.regDate = regDate;
}
@Override
public String toString() {
return "CategoryVo{" +
"cateNo=" + cateNo +
", id='" + id + '\'' +
", cateName='" + cateName + '\'' +
", description='" + description + '\'' +
", regDate='" + regDate + '\'' +
'}';
}
}
| [
"perfekta213@gmail.com"
] | perfekta213@gmail.com |
1609acf0b7a559c2dae66030dd06fdc81e7347c6 | 1b712a9856b6c7bcb7ce2d0ef4ff89cf8b2b81ad | /app/src/main/java/com/igalda/scrimgg/pers/PersistenciaNotification.java | 66fa3a2457074ebe9073e0b12d97762f9dce6511 | [] | no_license | albanita/ScrimGG | 504e3956dbfaa3b86a3c64d03ea3b8f6f3bfb597 | b019fa741f8a630efd4341764aab111101dbac01 | refs/heads/main | 2023-06-04T06:26:03.334392 | 2021-06-20T21:46:08 | 2021-06-20T21:46:08 | 378,745,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,112 | java | package com.igalda.scrimgg.pers;
import android.annotation.SuppressLint;
import android.util.Log;
import androidx.annotation.NonNull;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import com.igalda.scrimgg.dom.notif.Notification;
import com.igalda.scrimgg.neg.Negocio;
import com.igalda.scrimgg.neg.NegocioNotification;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@SuppressLint("SimpleDateFormat")
public class PersistenciaNotification {
private static FirebaseFirestore db = FirebaseFirestore.getInstance();
private static String DBOK = "DB Confirmation";
private static String DBError = "DB ERROR";
private static Negocio n = Negocio.getNegocio();
/**
* Añade una notificación a la BD.
* @param n notificación a añadir a la BD.
*/
public static void addNotification(Notification n){
Map<String, Object> notifToAdd = new HashMap<>();
notifToAdd.put("asunto", n.getTitle());
notifToAdd.put("fecha", n.getDate());
notifToAdd.put("texto", n.getText());
if (!existNotif(n.getNid(), n.getUid())) {
Task<Void> notifAdd = db.collection("users").document(n.getUid()).collection("notifications").document(n.getNid()).set(notifToAdd).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(DBOK, "Notification added to the DB.");
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d(DBError, "Unexpected error adding the notification to the DB.");
}
});
while (!notifAdd.isComplete()) {
}
} else {
Log.d(DBOK, "Notification alredy exists on DB.");
}
}
/**
* Devuelve una notificación a partir de su id.
* @param nid id de la notificación.
* @param uid id del usuario al que pertenece la notificación.
* @return Notificación solicitada.
*/
public static Notification getNotification(String nid, String uid) {
Notification ret = null;
Task<DocumentSnapshot> notif = db.collection("users").document(uid).collection("notifications").document(nid).get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot doc = task.getResult();
if (doc.exists()) {
Log.d(DBOK, "Document Exist.");
} else {
Log.d(DBOK, "Document doesn't exist.");
}
} else {
Log.d(DBError, "Failed with: ", task.getException());
}
}
});
while (!notif.isComplete()) {
// Empty
}
DocumentSnapshot result = notif.getResult();
SimpleDateFormat sdf = new SimpleDateFormat("kk:mm-dd/MMM");
Date date = new Date();
try {
date = sdf.parse((String) result.get("fecha"));
} catch (ParseException ex){
Log.d("Notif error", "Failed parsing notification date.");
}
ret = new Notification( nid, uid,
(String) result.get("asunto"),
(String) result.get("texto"),
date);
return ret;
}
/**
* Devuelve un listado de notificaciones pendientes de un usuario.
* @param uid ID del usuario.
* @return Lista de 'Notificacion' pendientes.
*/
public static List<Notification> listNotifications(String uid){
List<Notification> ret = new ArrayList<>();
if (n.nUsuario().existeUsuario(uid)) {
Task<QuerySnapshot> colNotif = db.collection("users").document(uid).collection("notifications").get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
Log.d(DBOK, "Notifications get correctly.");
} else {
Log.d(DBError, "Error while getting the notifications.");
}
}
});
while (!colNotif.isComplete()) {
}
for (QueryDocumentSnapshot notifIds : colNotif.getResult()) {
Log.d("Pruebas", notifIds.getId());
ret.add(n.nNotification().getNotification(notifIds.getId(), uid));
}
} else {
Log.d(DBOK, "User doesn't exist on DB!");
}
return ret;
}
/**
* Elimina una notificación de la BD.
* @param nid ID de la notificación.
*/
public static void deleteNotification(String nid, String uid){
if(existNotif(nid, uid)){
Task<Void> del = db.collection("users").document(uid).collection("notifications").document(nid).delete();
while(!del.isComplete()){}
}else{
Log.d(DBOK,"Notification doesn't exist on the DB.");
}
}
/**
* Elimina todas las notificaciones de un usuario.
* @param uid ID del usuario.
*/
public static void wipeNotifications(String uid){
List<Notification> lnotif = n.nNotification().listNotifications(uid);
for(Notification not : lnotif){
n.nNotification().deleteNotification(not.getNid(), not.getUid());
}
}
/**
* Comprueba si una notificación existe o no en la BD.
* @param nid notificación a comprobar si existe o no.
* @param uid usuario al que pertenece la notificación.
* @return True si la notificación existe, false en caso contrario.
*/
public static boolean existNotif(String nid, String uid) {
boolean ret = false;
Task<DocumentSnapshot> notifDoc = db.collection("users").document(uid).collection("notifications").document(nid).get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
DocumentSnapshot doc = task.getResult();
if (doc.exists()) {
Log.d(DBOK, "Document Exist.");
} else {
Log.d(DBOK, "Document doesn't exist.");
}
} else {
Log.d(DBError, "Failed with: ", task.getException());
}
}
});
while (!notifDoc.isComplete()) {
// Empty
}
if (notifDoc.getResult().exists()) {
ret = true;
}
return ret;
}
/**
* Genera un identificador para una nueva notificación.
* @param uid Identificador del usuario.
* @return Entero más bajo encontrado libre para ser identificador.
*/
public static int generateNotificationId(String uid){
List<Notification> ln = listNotifications(uid);
List<Integer> ids = new ArrayList<>();
int i = 0;
for (Notification nt : ln){
ids.add(Integer.parseInt(nt.getNid()));
}
for(i = 0; i < Integer.MAX_VALUE; i++){
if(!ids.contains(i)) break;
}
return i;
}
}
| [
"43749327+albanita@users.noreply.github.com"
] | 43749327+albanita@users.noreply.github.com |
16451dafacd96feb2d7c586c7b16942865e104ad | 75b9d879cf681c9156ab48102ee5ca4f7e21fb7e | /leasing-identity-parent/leasing-identity-pojo/src/main/java/com/cloudkeeper/leasing/identity/domain/TownUser.java | b94cf9f37f41813eb3491379b4babad4016720a0 | [] | no_license | lzj1995822/jr-api | 35bae753cadd4b576fe8f983806bc64440892e2c | 362d4f0573205aa0ae57e0d575274422bb6b2539 | refs/heads/master | 2020-04-13T13:38:51.914466 | 2018-12-27T13:02:53 | 2018-12-27T13:02:53 | 163,237,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package com.cloudkeeper.leasing.identity.domain;
import com.cloudkeeper.leasing.base.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* 所站人员
* @author wj
*/
@ApiModel(value = "所站人员", description = "所站人员")
@Getter
@Setter
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_town_user")
public class TownUser extends BaseEntity {
@ApiModelProperty(value = "所站id", position = 11, required = true)
private String townId;
@ApiModelProperty(value = "工号", position = 13, required = true)
private String jobNumber;
@ApiModelProperty(value = "姓名", position = 15)
private String name;
@ApiModelProperty(value = "性别", position = 17)
private String gender;
@ApiModelProperty(value = "职位", position = 19)
private String position;
@ApiModelProperty(value = "备注", position = 21)
private String remark;
} | [
"1486630378@qq.com"
] | 1486630378@qq.com |
c9f56064d0c042303bfff454718a650ece3cba14 | 00cbdabe0304da2ed37e083f4996d18142106827 | /week7-week7_08.Airport/Plane.java | ad625689b79b5fa65d89ffd4cbc9a950ff0b4089 | [] | no_license | kdrake1992/Programming-Practice-Part-2 | d5f6b6b79f2202fe06cc6415dd5a8d5777616740 | 0ff517bbb6ec8c431211f575ad37bbf37cff07ef | refs/heads/master | 2020-06-08T07:51:07.746759 | 2019-07-20T11:57:37 | 2019-07-20T11:57:37 | 193,190,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 680 | java | import java.util.HashMap;
public class Plane {
private HashMap<String, Integer> planes;
public Plane() {
this.planes = new HashMap<String, Integer>();
}
public void addPlane(String name, int cap) {
this.planes.put(name, cap);
}
public String findPlane(String name) {
if(planes.containsKey(name)) {
return name + " (" + this.planes.get(name) + " ppl)";
}
else {
return "Can't find plane";
}
}
public void printAllPlanes() {
for (String key : this.planes.keySet()) {
System.out.println(key + " (" + this.planes.get(key) + " ppl)");
}
}
}
| [
"kdrake1992@outlook.com"
] | kdrake1992@outlook.com |
9ab1b5524c6f57427b0b17eb278870e34c16240f | 94dd9d8411702dd3956b854e054ad42b4bb97688 | /app/src/main/java/com/illiyinmagang/miafandi/donaku/Fragment/adapter/InvestasiAdapter.java | ca5441e21b16b2f60f9258a3d24e9496f68c0b75 | [] | no_license | naofalhakim/FisherGround_Anforcom | e13e9d5a8ff0b29079550bbc40e7e39abc7c9534 | d31ba21cf17736e485b6559c1c0f1662f9add831 | refs/heads/master | 2021-07-11T09:38:32.619551 | 2019-03-19T14:02:52 | 2019-03-19T14:02:52 | 150,704,114 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,837 | java | package com.illiyinmagang.miafandi.donaku.Fragment.adapter;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.illiyinmagang.miafandi.donaku.Fragment.HomeUser.DetailJual;
import com.illiyinmagang.miafandi.donaku.Fragment.Investasi.DetailInvestasi;
import com.illiyinmagang.miafandi.donaku.R;
import java.security.PublicKey;
import java.util.ArrayList;
import java.util.List;
public class InvestasiAdapter extends RecyclerView.Adapter<InvestasiAdapter.ViewHolder> {
private Context context;
List<InvestasiUser> listInvestasi;
public InvestasiAdapter(Context context) {
// super();
this.context = context;
listInvestasi = new ArrayList<InvestasiUser>();
listInvestasi.add(new InvestasiUser(R.drawable.iv2,"Peremajaan Kapal","Rudi Habibi","Banyuwangi",1,10,3000000));
listInvestasi.add(new InvestasiUser(R.drawable.iv1,"Keramba Tuna","Bambang Hendrawan","Pengandaran",0,15,7500000));
listInvestasi.add(new InvestasiUser(R.drawable.investasib,"Tambak Udang","Irwan Suwardi","Bodowoso",1,20,20000000));
listInvestasi.add(new InvestasiUser(R.drawable.investasia,"Pembuatan Kapal 10GT","Naofal Perdana","Sendang Biru",0,12,8000000));
listInvestasi.add(new InvestasiUser(R.drawable.iv2,"Peremajaan Kapal","Rudi Habibi","Banyuwangi",1,10,3000000));
listInvestasi.add(new InvestasiUser(R.drawable.iv1,"Keramba Tuna","Bambang Hendrawan","Pengandaran",0,15,7500000));
listInvestasi.add(new InvestasiUser(R.drawable.investasib,"Tambak Udang","Irwan Suwardi","Bodowoso",1,20,20000000));
listInvestasi.add(new InvestasiUser(R.drawable.investasia,"Pembuatan Kapal 10GT","Naofal Perdana","Sendang Biru",0,12,8000000));
}
@Override
public InvestasiAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.investasiview, viewGroup, false);
InvestasiAdapter.ViewHolder viewHolder = new InvestasiAdapter.ViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(InvestasiAdapter.ViewHolder viewHolder, int i) {
InvestasiUser investasi = listInvestasi.get(i);
viewHolder.imgI.setImageResource(investasi.getImgInvestasi());
viewHolder.judulI.setText(investasi.getNamaInvestasi());
viewHolder.pembuatI.setText(investasi.getPembuatInvestasi());
viewHolder.tempatI.setText(investasi.getLokasiInvestasi());
viewHolder.donaturI.setText(Integer.toString(investasi.getDonaturInvestasi()));
viewHolder.roiI.setText(Integer.toString(investasi.getRoiInvestasi()));
viewHolder.biayaI.setText(Integer.toString(investasi.getBiayaInvestasi()));
}
@Override
public int getItemCount() {
return listInvestasi.size();
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public ImageView imgI;
public TextView judulI;
public TextView pembuatI;
public TextView tempatI;
public TextView donaturI;
public TextView roiI;
public TextView biayaI;
public ViewHolder(View itemView) {
super(itemView);
imgI = (ImageView) itemView.findViewById(R.id.imgInvestasi);
judulI = (TextView) itemView.findViewById(R.id.txtJudul);
pembuatI = (TextView) itemView.findViewById(R.id.txtPencariDana);
tempatI = (TextView) itemView.findViewById(R.id.txtTempat);
donaturI = (TextView) itemView.findViewById(R.id.txtdonatur);
roiI = (TextView) itemView.findViewById(R.id.txtBesarRoi);
biayaI = (TextView) itemView.findViewById(R.id.txtInvestasi);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View view) {
int position = getAdapterPosition();
InvestasiUser invest = listInvestasi.get(position);
Intent intent = new Intent(context, DetailInvestasi.class);
intent.putExtra("gambarInvest",invest.getImgInvestasi());
intent.putExtra("judulInvest", invest.getNamaInvestasi());
intent.putExtra("pembuatInvest",invest.getPembuatInvestasi());
intent.putExtra("tempatInvest",invest.getLokasiInvestasi());
intent.putExtra("donaturInvest",invest.getDonaturInvestasi());
intent.putExtra("roiInvest",invest.getRoiInvestasi());
intent.putExtra("biayaInvest",invest.getBiayaInvestasi());
context.startActivity(intent);
}
}
}
| [
"mohamadirwanafandi@gmail.com"
] | mohamadirwanafandi@gmail.com |
1d7dda0ff37c7598af7457abc648a99196e61bc9 | 047c7c4e0e5876f70d879e210eb094e2bd43e781 | /app/src/main/java/com/myapplicationdev/android/p01_dailygoals/MainActivity.java | 245498cd2d6dda508cf9c730a0a3ba9197f577af | [] | no_license | 17010578/P01DailyGoals | 69237476a8a1a99abc24d4e369ff7453bc678be3 | 835fdb1bfbf82f8cbe9a13d9c493f90eb21f3f42 | refs/heads/master | 2020-05-13T15:46:03.749597 | 2019-04-16T07:12:17 | 2019-04-16T07:12:17 | 181,635,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,022 | java | package com.myapplicationdev.android.p01_dailygoals;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnOk = findViewById(R.id.button);
btnOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
//Get the edittext when user keys in name
TextView tv1 = findViewById(R.id.textView);
TextView tv3 = findViewById(R.id.textView3);
TextView tv5 = findViewById(R.id.textView5);
EditText et1 = findViewById(R.id.editText2);
RadioGroup rg = findViewById(R.id.radioGroup1);
RadioGroup rg2 = findViewById(R.id.radioGroup2);
RadioGroup rg3 = findViewById(R.id.radioGroup3);
int selectedButtonID = rg.getCheckedRadioButtonId();
int selectedButtonID2 = rg2.getCheckedRadioButtonId();
int selectedButtonID3 = rg3.getCheckedRadioButtonId();
RadioButton rb = findViewById(selectedButtonID);
RadioButton rb2 = findViewById(selectedButtonID2);
RadioButton rb3 = findViewById(selectedButtonID3);
//Put the name and age into the array
String[] info = {tv1.getText().toString(), tv3.getText().toString(), tv5.getText().toString(), rb.getText().toString(),rb2.getText().toString(),rb3.getText().toString()
,et1.getText().toString()};
//Create an intent to start another activity called DemoActivities
Intent i = new Intent(MainActivity.this,Summary.class);
//Pass the String array holding the name and age to new activity
i.putExtra("info",info);
//Start the new activity
startActivity(i);
}
});
}
protected void onPause() {
super.onPause();
RadioGroup rg1 = findViewById(R.id.radioGroup1);
RadioGroup rg2 = findViewById(R.id.radioGroup2);
RadioGroup rg3 = findViewById(R.id.radioGroup3);
EditText et1 = findViewById(R.id.editText2);
int selectedButtonId1 = rg1.getCheckedRadioButtonId();
int selectedButtonId2 = rg2.getCheckedRadioButtonId();
int selectedButtonId3 = rg3.getCheckedRadioButtonId();
String text = et1.getText().toString();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor prefEdit = prefs.edit();
prefEdit.putInt("rg1", selectedButtonId1);
prefEdit.putInt("rg2", selectedButtonId2);
prefEdit.putInt("rg3", selectedButtonId3);
prefEdit.putString("text", text);
prefEdit.commit();
}
protected void onResume() {
super.onResume();
RadioGroup rg1 = findViewById(R.id.radioGroup1);
RadioGroup rg2 = findViewById(R.id.radioGroup2);
RadioGroup rg3 = findViewById(R.id.radioGroup3);
EditText et1 = findViewById(R.id.editText2);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
int intRB1 = prefs.getInt("rg1",0);
int intRB2 = prefs.getInt("rg2",0);
int intRB3 = prefs.getInt("rg3",0);
String strText = prefs.getString("text", "");
rg1.check(intRB1);
rg2.check(intRB2);
rg3.check(intRB3);
et1.setText(strText);
}
}
| [
"shijie_00@hotmail.com"
] | shijie_00@hotmail.com |
7c408bca54441e1401fd51277812c787052acac8 | b926289b62ceb4ec3718044974974382e8a1f6e0 | /app/src/main/java/com/aruns/sirvacs_a_lot/models/Session.java | 4d11688522616ea1ad63a6e2ddd2dd20584961b2 | [] | no_license | arunsasankan/SirVacs-a-lot | 7ab9a086dca3dff2a0d0d701c40d8b03c2bcab4b | 56559f5af6600ec5f7deb5ec944e4841ae7b329a | refs/heads/master | 2023-05-15T10:26:39.114592 | 2021-06-15T02:42:19 | 2021-06-15T02:42:19 | 377,010,811 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,304 | java | package com.aruns.sirvacs_a_lot.models;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Session {
@JsonProperty("session_id")
private String sessionId;
@JsonProperty("date")
private String date;
@JsonProperty("available_capacity")
private Integer availableCapacity;
@JsonProperty("available_capacity_dose1")
private Integer availableCapacityDose1;
@JsonProperty("available_capacity_dose2")
private Integer availableCapacityDose2;
@JsonProperty("min_age_limit")
private Integer minAgeLimit;
@JsonProperty("vaccine")
private String vaccine;
@JsonProperty("slots")
private List<String> slots = null;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("session_id")
public String getSessionId() {
return sessionId;
}
@JsonProperty("session_id")
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
@JsonProperty("date")
public String getDate() {
return date;
}
@JsonProperty("date")
public void setDate(String date) {
this.date = date;
}
@JsonProperty("available_capacity")
public Integer getAvailableCapacity() {
return availableCapacity;
}
@JsonProperty("available_capacity")
public void setAvailableCapacity(Integer availableCapacity) {
this.availableCapacity = availableCapacity;
}
@JsonProperty("available_capacity_dose1")
public Integer getAvailableCapacityDose1() {
return availableCapacityDose1;
}
@JsonProperty("available_capacity_dose1")
public void setAvailableCapacityDose1(Integer availableCapacityDose1) {
this.availableCapacityDose1 = availableCapacityDose1;
}
@JsonProperty("available_capacity_dose2")
public Integer getAvailableCapacityDose2() {
return availableCapacityDose2;
}
@JsonProperty("available_capacity_dose2")
public void setAvailableCapacityDose2(Integer availableCapacityDose2) {
this.availableCapacityDose2 = availableCapacityDose2;
}
@JsonProperty("min_age_limit")
public Integer getMinAgeLimit() {
return minAgeLimit;
}
@JsonProperty("min_age_limit")
public void setMinAgeLimit(Integer minAgeLimit) {
this.minAgeLimit = minAgeLimit;
}
@JsonProperty("vaccine")
public String getVaccine() {
return vaccine;
}
@JsonProperty("vaccine")
public void setVaccine(String vaccine) {
this.vaccine = vaccine;
}
@JsonProperty("slots")
public List<String> getSlots() {
return slots;
}
@JsonProperty("slots")
public void setSlots(List<String> slots) {
this.slots = slots;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"Arun.Sasankan@Aurigo.com"
] | Arun.Sasankan@Aurigo.com |
d943d143a7fb4eaee06de1fe674ee648d44fe45f | 09e8c63ee4a6c2009478d5a206003410d4f17c91 | /liquibasesample/src/main/java/com/liquibase/sample/App.java | 5af55e3392f5c9c083e30648c3b33099269a4905 | [] | no_license | sdeshmukh01/liquibasesample | a53cf81450a76bc40cf9e5913d1323ad648729ff | 91f7ae1064d52a0a53e1055dd96687834fa09a10 | refs/heads/master | 2020-04-13T12:24:40.447577 | 2018-12-26T17:38:25 | 2018-12-26T17:38:25 | 163,201,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 183 | java | package com.liquibase.sample;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"sagar.deshmukh4@gmail.com"
] | sagar.deshmukh4@gmail.com |
8ca1f4609da720e59f3ba8f644bb6b230768edc4 | d14c2bb638288e69191af8ec0bf2b20e7805b3a5 | /app/src/main/java/com/karl/fingerprintmodule/volleyQueue.java | 3fce6c2c86700143362cc8bacb480e080b2efa16 | [] | no_license | karllllllllll/Fingerprint-Scanner | 30690dfeb240ac30b21872a11cecb72c3ecefd9b | 0d114a1395497698a6cf0b9ebfa69aa7df735a92 | refs/heads/master | 2020-12-12T03:48:03.417473 | 2020-01-31T03:44:11 | 2020-01-31T03:44:11 | 234,034,996 | 0 | 0 | null | 2020-01-31T03:44:12 | 2020-01-15T08:32:42 | Java | UTF-8 | Java | false | false | 1,898 | java | package com.karl.fingerprintmodule;
import android.content.Context;
import android.graphics.Bitmap;
import android.util.LruCache;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
public class volleyQueue {
private static volleyQueue instance;
private RequestQueue requestQueue;
private ImageLoader imageLoader;
private static Context ctx;
private volleyQueue(Context context) {
ctx = context;
requestQueue = getRequestQueue();
imageLoader = new ImageLoader(requestQueue,
new ImageLoader.ImageCache() {
private final LruCache<String, Bitmap>
cache = new LruCache<String, Bitmap>(20);
@Override
public Bitmap getBitmap(String url) {
return cache.get(url);
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
cache.put(url, bitmap);
}
});
}
public static synchronized volleyQueue getInstance(Context context) {
if (instance == null) {
instance = new volleyQueue(context);
}
return instance;
}
public RequestQueue getRequestQueue() {
if (requestQueue == null) {
// getApplicationContext() is key, it keeps you from leaking the
// Activity or BroadcastReceiver if someone passes one in.
requestQueue = Volley.newRequestQueue(ctx.getApplicationContext());
}
return requestQueue;
}
public <T> void addToRequestQueue(Request<T> req) {
getRequestQueue().add(req);
}
public ImageLoader getImageLoader() {
return imageLoader;
}
}
| [
"karl.mirafuente@lpunetwork.edu.ph"
] | karl.mirafuente@lpunetwork.edu.ph |
2326eb9209858ad1bad44e1733d46631909b55f9 | 0c22281310914cbdecdee2d3fafab7475a390533 | /app/src/main/java/cn/lrapps/utils/filetools/FileTools.java | f7727f2a12a1288ff494381a38590ded97188577 | [] | no_license | libit/wdym | 9412beafcc866ca6cd7095e43e52658e58cf6ad0 | fb0e8149d339ebe90b63f973eded0f51986cbb67 | refs/heads/master | 2021-04-15T13:35:01.297536 | 2018-03-24T07:35:45 | 2018-03-24T07:35:45 | 126,576,554 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,740 | java | /*
* Libit保留所有版权,如有疑问联系QQ:308062035
* Copyright (c) 2018.
*/
package cn.lrapps.utils.filetools;
import android.os.Environment;
import cn.lrapps.android.ui.MyApplication;
import cn.lrapps.utils.AppConfig;
import cn.lrapps.utils.StringTools;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Created by libit on 15/9/1.
*/
public class FileTools
{
/**
* 获取文件<br/>
* 从根目录开始,需要有ROOT权限才能读取
*
* @param dir
* @param fileName
*
* @return
*/
public static File getRootFile(String dir, String fileName)
{
if (StringTools.isNull(fileName))
{
return null;
}
if (StringTools.isNull(dir))
{
dir = "";
}
if (!dir.endsWith(File.separator))
{
dir += File.separator;
}
if (!createDir(dir))// 创建文件夹失败
{
return null;
}
return new File(dir, fileName);
}
/**
* 获取文件
*
* @param dir
* @param fileName
*
* @return
*/
public static File getFile(String dir, String fileName)
{
if (StringTools.isNull(fileName))
{
return null;
}
if (StringTools.isNull(dir))
{
dir = "";
}
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
{
// 优先保存到SD卡中
dir = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + AppConfig.getSDCardFolder() + File.separator + dir;
if (!dir.endsWith(File.separator))
{
dir += File.separator;
}
}
else
{
// 如果SD卡不存在,就保存到本应用的目录下
dir = MyApplication.getContext().getFilesDir().getAbsolutePath() + File.separator + AppConfig.getSDCardFolder() + File.separator + dir;
if (!dir.endsWith(File.separator))
{
dir += File.separator;
}
}
if (!createDir(dir))// 创建文件夹失败
{
return null;
}
return new File(dir, fileName);
}
/**
* 取得文件夹路径
*
* @param dir
*
* @return
*/
public static String getAppDir(String dir)
{
if (StringTools.isNull(dir))
{
dir = "";
}
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
{
// 优先保存到SD卡中
dir = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + AppConfig.getSDCardFolder() + File.separator + dir;
if (!dir.endsWith(File.separator))
{
dir += File.separator;
}
}
else
{
// 如果SD卡不存在,就保存到本应用的目录下
dir = MyApplication.getContext().getFilesDir().getAbsolutePath() + File.separator + AppConfig.getSDCardFolder() + File.separator + dir;
if (!dir.endsWith(File.separator))
{
dir += File.separator;
}
}
if (!createDir(dir))// 创建文件夹失败
{
return null;
}
return dir;
}
/**
* 取得文件夹路径
*
* @param dir
*
* @return
*/
public static String getUserDir(String dir)
{
if (StringTools.isNull(dir))
{
dir = "";
}
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
{
// 优先保存到SD卡中
dir = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + dir;
if (!dir.endsWith(File.separator))
{
dir += File.separator;
}
}
else
{
// 如果SD卡不存在,就保存到本应用的目录下
dir = MyApplication.getContext().getFilesDir().getAbsolutePath() + File.separator + dir;
if (!dir.endsWith(File.separator))
{
dir += File.separator;
}
}
if (!createDir(dir))// 创建文件夹失败
{
return null;
}
return dir;
}
/**
* 创建路径
*
* @param path 要创建的路径
*
* @return 成功true,失败false
*/
private static boolean createDir(String path)
{
if (StringTools.isNull(path))
{
return false;
}
if (new File(path).exists())
{
return true;
}
if (path.startsWith(Environment.getExternalStorageDirectory().getAbsolutePath()))// 如果是存储卡
{
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
{
int index = path.indexOf(File.separator, Environment.getExternalStorageDirectory().getAbsolutePath().length() + 1);
while (index > 0)
{
String subPath = path.substring(0, index);
File dir = new File(subPath);
if (!dir.exists())
{
if (!dir.mkdir())
{
return false;
}
}
index = path.indexOf(File.separator, index + 1);
}
}
else
{
return false;
}
}
else
{
int index = path.indexOf(File.separator, 1);
while (index > 0)
{
String subPath = path.substring(0, index);
File dir = new File(subPath);
if (!dir.exists())
{
if (!dir.mkdir())
{
return false;
}
}
index = path.indexOf(File.separator, index + 1);
}
}
return true;
}
/**
* 读文件内容
*
* @param fileName 文件名
*
* @return 文件内容
*/
public static String readFile(String dir, String fileName)
{
if (StringTools.isNull(fileName))
{
return null;
}
File file = getFile(dir, fileName);
return readFile(file);
}
/**
* 读文件内容
*
* @param file
*
* @return
*/
public static String readFile(File file)
{
if (file != null && file.exists() && file.canRead())
{
BufferedReader input = null;
try
{
input = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line;
StringBuilder strBuffer = new StringBuilder("");
while ((line = input.readLine()) != null)
{
strBuffer.append(line).append("\n");
}
return strBuffer.toString();
}
catch (IOException e)
{
}
finally
{
if (input != null)
{
try
{
input.close();
}
catch (IOException e)
{
}
}
}
}
return null;
}
/**
* 写文件
*
* @param file 文件
* @param content 文件内容
*
* @return 写入成功true,失败false
*/
public static boolean writeFile(File file, String content)
{
try
{
if (file != null && file.exists())
{
FileOutputStream fos = new FileOutputStream(file);
fos.write(content.getBytes());
fos.close();
return true;
}
}
catch (Exception e)
{
e.printStackTrace();
}
return false;
}
/**
* 写文件
*
* @param fileName 文件名
* @param content 文件内容
*
* @return 写入成功true,失败false
*/
public static boolean writeFile(String dir, String fileName, String content)
{
try
{
File file = getFile(dir, fileName);
return writeFile(file, content);
}
catch (Exception e)
{
e.printStackTrace();
}
return false;
}
}
| [
"libit0909@gmail.com"
] | libit0909@gmail.com |
47f5c0d001f07080432bf832095246bbb0c8ae08 | 62aa4062e0abb52b7d1bc079d7f05cde5e1b74a1 | /src/main/java/it/unitn/disi/buybuy/dao/entities/Purchase.java | 84596f5effb6a5e8702fe5820bd6f3f3bef0f00b | [] | no_license | MaxFrax/ProgettoWeb | 5406f20af81e3feee24444adb75fee9ef2a10774 | 4473b83370253bafa601c237f98cc4c025254eca | refs/heads/master | 2021-09-05T17:46:01.354363 | 2018-01-30T01:37:50 | 2018-01-30T01:37:50 | 111,698,230 | 1 | 2 | null | 2018-01-30T01:37:51 | 2017-11-22T15:02:19 | Java | UTF-8 | Java | false | false | 1,588 | java | /*
* Purchase.java
*/
package it.unitn.disi.buybuy.dao.entities;
import java.io.Serializable;
/**
* The bean that map a {@code purchase} entity.
*
* @author apello96
*/
public class Purchase implements Serializable{
private Integer id;
private Item item;
private User user;
/**
* Returns the primary key of this purchase entity.
* @return the id of the purchase entity.
*
* @author apello96
*/
public Integer getId() {
return id;
}
/**
* Sets the new primary key of this purchase entity.
* @param id the new id of this purchase entity.
*
* @author apello96
*/
public void setId(Integer id) {
this.id = id;
}
/**
* Returns the item of this purchase entity.
* @return the item of this purchase entity.
*
* @author apello96
*/
public Item getItem() {
return item;
}
/**
* Sets the new item of this purchase entity.
* @param item the new item of this purchase entity.
*
* @author apello96
*/
public void setItem(Item item) {
this.item = item;
}
/**
* Returns the user of this purchase entity.
* @return the user of this purchase entity.
*
* @author apello96
*/
public User getUser() {
return user;
}
/**
* Sets the new user of this purchase entity.
* @param user the new user of this purchase entity.
*
* @author apello96
*/
public void setUser(User user) {
this.user = user;
}
}
| [
"apello@hotmail.it"
] | apello@hotmail.it |
c7c096c79a85b7a95c0cc374e98b9128cd2f5e8b | d6168fb704f2c758d16d38063873745c717622ca | /app/src/main/java/com/example/karabushka/karabas_music_app/ui/MainFragment.java | 3f8926393544f5da1177d200e772d1734264185e | [] | no_license | Karabas911/karabas_music_app | c767d4abbb9e68b5629edaf306bca1d10931c03c | bcaa6fa3a0217da6de6f998e0a4383f0859a3f96 | refs/heads/master | 2020-12-03T04:08:10.937747 | 2017-07-02T15:37:46 | 2017-07-02T15:37:46 | 95,819,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,841 | java | /*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.example.karabushka.karabas_music_app.ui;
import android.app.LoaderManager;
import android.content.Intent;
import android.content.Loader;
import android.os.Bundle;
import android.support.v17.leanback.app.BrowseFragment;
import android.support.v17.leanback.widget.ArrayObjectAdapter;
import android.support.v17.leanback.widget.HeaderItem;
import android.support.v17.leanback.widget.ListRow;
import android.support.v17.leanback.widget.ListRowPresenter;
import android.support.v17.leanback.widget.OnItemViewClickedListener;
import android.support.v17.leanback.widget.OnItemViewSelectedListener;
import android.support.v17.leanback.widget.Presenter;
import android.support.v17.leanback.widget.Row;
import android.support.v17.leanback.widget.RowPresenter;
import android.util.Log;
import android.view.View;
import com.example.karabushka.karabas_music_app.R;
import com.example.karabushka.karabas_music_app.model.Movie;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Karabushka on 25.06.2017.
*/
public class MainFragment extends BrowseFragment {
private static final String TAG = MainFragment.class.getSimpleName();
private ArrayObjectAdapter mRowsAdapter;
private static final int VIDEO_ITEM_LOADER_ID = 1;
private static PicassoBackgroundManager picassoBackgroundManager = null;
private static final String[] CHANNEL_NAMES = {"Chill out","Synthwave","Hip-Hop","Rock"};
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Log.i(TAG, "onActivityCreated");
super.onActivityCreated(savedInstanceState);
picassoBackgroundManager = new PicassoBackgroundManager(getActivity());
picassoBackgroundManager.updateBackgroundWithDelay("http://i1.ytimg.com/vi/gwDoRPcPxtc/maxresdefault.jpg");
setupUIElements();
// loadRows();
getLoaderManager().initLoader(VIDEO_ITEM_LOADER_ID, null, new MainFragmentLoaderCallbacks());
setupEventListeners();
}
private class MainFragmentLoaderCallbacks implements LoaderManager.LoaderCallbacks<LinkedHashMap<Integer, List<Movie>>> {
@Override
public Loader<LinkedHashMap<Integer, List<Movie>>> onCreateLoader(int id, Bundle args) {
if(id == VIDEO_ITEM_LOADER_ID) {
Log.d(TAG, "create VideoItemLoader");
return new VideoItemLoader(getActivity());
}
return null;
}
@Override
public void onLoadFinished(Loader<LinkedHashMap<Integer, List<Movie>>> loader, LinkedHashMap<Integer, List<Movie>> data) {
Log.d(TAG, "onLoadFinished");
/* Loader data has prepared. Start updating UI here */
switch (loader.getId()) {
case VIDEO_ITEM_LOADER_ID:
Log.d(TAG, "VideoLists UI update");
mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
CardPresenter cardPresenter = new CardPresenter();
if (null != data) {
for (Map.Entry<Integer, List<Movie>> entry : data.entrySet()) {
ArrayObjectAdapter cardRowAdapter = new ArrayObjectAdapter(cardPresenter);
HeaderItem cardPresenterHeader = new HeaderItem(entry.getKey(), CHANNEL_NAMES[entry.getKey()]);
List<Movie> list = entry.getValue();
for (Movie movie : list) {
cardRowAdapter.add(movie);
}
mRowsAdapter.add(new ListRow(cardPresenterHeader, cardRowAdapter));
}
} else {
Log.e(TAG, "An error occurred fetching videos");
}
/* Set */
setAdapter(mRowsAdapter);
}
}
@Override
public void onLoaderReset(Loader<LinkedHashMap<Integer, List<Movie>>> loader) {
Log.d(TAG, "VideoItemLoader: onLoadReset");
}
}
// private void loadRows() {
// mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
// CardPresenter cardPresenter = new CardPresenter();
//
// HeaderItem cardPresenterHeader = new HeaderItem(0, "Chill out");
// ArrayObjectAdapter cardRowAdapter = new ArrayObjectAdapter(cardPresenter);
// ArrayList<Movie> mItems = MovieProvider.getMovieItems(MovieProvider.CHILL_OUT_NUMBER);
// for (Movie movie : mItems) {
// cardRowAdapter.add(movie);
// }
// mRowsAdapter.add(new ListRow(cardPresenterHeader, cardRowAdapter));
//
// HeaderItem cardPresenterHeader1 = new HeaderItem(1, "Synthwave");
// ArrayObjectAdapter cardRowAdapter1 = new ArrayObjectAdapter(cardPresenter);
// ArrayList<Movie> mItems1 = MovieProvider.getMovieItems(MovieProvider.SYNTHWAVE_NUMBER);
// for (Movie movie : mItems1) {
// cardRowAdapter1.add(movie);
// }
// mRowsAdapter.add(new ListRow(cardPresenterHeader1, cardRowAdapter1));
//
// HeaderItem cardPresenterHeader2 = new HeaderItem(2, "Hip-Hop");
// ArrayObjectAdapter cardRowAdapter2 = new ArrayObjectAdapter(cardPresenter);
// ArrayList<Movie> mItems2 = MovieProvider.getMovieItems(MovieProvider.HIP_HOP_NUMBER);
// for (Movie movie : mItems2) {
// cardRowAdapter2.add(movie);
// }
// mRowsAdapter.add(new ListRow(cardPresenterHeader2, cardRowAdapter2));
//
// HeaderItem cardPresenterHeader3 = new HeaderItem(3, "Rock");
// ArrayObjectAdapter cardRowAdapter3 = new ArrayObjectAdapter(cardPresenter);
// ArrayList<Movie> mItems3 = MovieProvider.getMovieItems(MovieProvider.ROCK_NUMBER);
// for (Movie movie : mItems3) {
// cardRowAdapter3.add(movie);
// }
// mRowsAdapter.add(new ListRow(cardPresenterHeader3, cardRowAdapter3));
//
// setAdapter(mRowsAdapter);
// }
private void setupUIElements() {
setTitle("Music App");
setHeadersState(HEADERS_ENABLED);
setHeadersTransitionOnBackEnabled(true);
setBrandColor(getResources().getColor(R.color.default_background));
setSearchAffordanceColor(getResources().getColor(R.color.search_opaque));
}
private void setupEventListeners() {
setOnItemViewSelectedListener(new ItemViewSelectedListener());
setOnItemViewClickedListener(new ItemViewClickedListener());
setOnSearchClickedListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), SearchActivity.class);
startActivity(intent);
}
});
}
private final class ItemViewSelectedListener implements OnItemViewSelectedListener {
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
// each time the item is selected, code inside here will be executed.
if (item instanceof String) {
picassoBackgroundManager.updateBackgroundWithDelay("http://heimkehrend.raindrop.jp/kl-hacker/wp-content/uploads/2014/10/RIMG0656.jpg");
} else if (item instanceof Movie) { // CardPresenter
picassoBackgroundManager.updateBackgroundWithDelay(((Movie) item).getCardImageUrl());
}
}
}
private final class ItemViewClickedListener implements OnItemViewClickedListener {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
Movie movie = (Movie) item;
Log.d(TAG, "Item: " + item.toString());
Intent intent = new Intent(getActivity(), VideoDetailsActivity.class);
intent.putExtra(VideoDetailsActivity.MOVIE, movie);
getActivity().startActivity(intent);
}
}
}
| [
"karabynosh911@gmail.com"
] | karabynosh911@gmail.com |
e2e766525ed8283cf17899be2f4f52d6a062aadd | f910a84171e04f833a415f5d9bcc36920aa8c9aa | /User-Registration-Module/src/main/java/nybsys/tillboxweb/entities/BusinessAddress.java | d6733a7b7d0dc492a034bbb2f638c63e12328808 | [] | no_license | rocky-bgta/Java_Mircoservice_Backend_With_Mosquitto | 7ecb35ca05c1d44d5f43668ccd6c5f3bcb40e03b | 7528f12ed35560fcd4aba40b613ff09c5032bebf | refs/heads/master | 2022-11-17T23:50:42.207381 | 2020-09-18T13:53:00 | 2020-09-18T13:53:00 | 138,392,854 | 0 | 1 | null | 2022-11-16T07:30:17 | 2018-06-23T10:38:52 | Java | UTF-8 | Java | false | false | 3,831 | java | package nybsys.tillboxweb.entities;
import nybsys.tillboxweb.BaseEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Objects;
@Entity
public class BusinessAddress extends BaseEntity {
@Id
@GeneratedValue(generator = "IdGen")
@GenericGenerator(name = "IdGen", strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
parameters =
{
@org.hibernate.annotations.Parameter(name = "sequence_name", value = "addressID_seq"),
@org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled"),
@org.hibernate.annotations.Parameter(name = "initial_value", value = "1"),
@org.hibernate.annotations.Parameter(name = "increment_size", value = "1"),
})
private Integer addressID;
private Integer businessID;
private Integer typeID;
private String address;
private String suburb;
private String state;
private Integer postCode;
private Integer country;
public Integer getAddressID() {
return addressID;
}
public void setAddressID(Integer addressID) {
this.addressID = addressID;
}
public Integer getBusinessID() {
return businessID;
}
public void setBusinessID(Integer businessID) {
this.businessID = businessID;
}
public Integer getTypeID() {
return typeID;
}
public void setTypeID(Integer typeID) {
this.typeID = typeID;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getSuburb() {
return suburb;
}
public void setSuburb(String suburb) {
this.suburb = suburb;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public Integer getPostCode() {
return postCode;
}
public void setPostCode(Integer postCode) {
this.postCode = postCode;
}
public Integer getCountry() {
return country;
}
public void setCountry(Integer country) {
this.country = country;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BusinessAddress)) return false;
if (!super.equals(o)) return false;
BusinessAddress that = (BusinessAddress) o;
return Objects.equals(getAddressID(), that.getAddressID()) &&
Objects.equals(getBusinessID(), that.getBusinessID()) &&
Objects.equals(getTypeID(), that.getTypeID()) &&
Objects.equals(getAddress(), that.getAddress()) &&
Objects.equals(getSuburb(), that.getSuburb()) &&
Objects.equals(getState(), that.getState()) &&
Objects.equals(getPostCode(), that.getPostCode()) &&
Objects.equals(getCountry(), that.getCountry());
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), getAddressID(), getBusinessID(), getTypeID(), getAddress(), getSuburb(), getState(), getPostCode(), getCountry());
}
@Override
public String toString() {
return "BusinessAddress{" +
"addressID=" + addressID +
", businessID=" + businessID +
", typeID=" + typeID +
", address='" + address + '\'' +
", suburb='" + suburb + '\'' +
", state='" + state + '\'' +
", postCode=" + postCode +
", country=" + country +
'}';
}
}
| [
"rocky.bgta@gmail.com"
] | rocky.bgta@gmail.com |
1474a4baf666a3ea5a0980942b58f92bf97691be | 13c2d3db2d49c40c74c2e6420a9cd89377f1c934 | /program_data/JavaProgramData/103/624.java | 9c8ef03e6dc3bb59be0747f39b4ae69615fe3071 | [
"MIT"
] | permissive | qiuchili/ggnn_graph_classification | c2090fefe11f8bf650e734442eb96996a54dc112 | 291ff02404555511b94a4f477c6974ebd62dcf44 | refs/heads/master | 2021-10-18T14:54:26.154367 | 2018-10-21T23:34:14 | 2018-10-21T23:34:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,311 | java | package <missing>;
public class GlobalMembers
{
public static int Main()
{
int i;
int[] a = new int[1000];
int x;
String s = new String(new char[1001]);
String tempVar = ConsoleInput.scanfRead();
if (tempVar != null)
{
s = tempVar.charAt(0);
}
x = s.length();
for (i = 0;i < 1000;i++)
{
a[i] = 1;
}
for (i = 1;i <= x;i++)
{
if ((s.charAt(i) - 'A') == (s.charAt(i - 1) - 'A' - 32))
{
a[s.charAt(i) - 'A']++;
}
else if ((s.charAt(i) - 'A' - 32) == (s.charAt(i - 1) - 'A'))
{
a[s.charAt(i) - 'A' - 32]++;
}
else if ((s.charAt(i) - '0') == (s.charAt(i - 1) - '0'))
{
if ((s.charAt(i) - '0') < 43)
{
a[s.charAt(i) - 'A']++;
}
else
{
a[s.charAt(i) - 'A' - 32]++;
}
}
else
{
if ((s.charAt(i - 1) - '0') < 43)
{
System.out.printf("(%c,%d)",s.charAt(i - 1),a[s.charAt(i - 1) - 'A']);
a[s.charAt(i - 1) - 'A'] = 1;
}
else
{
System.out.printf("(%c,%d)",s.charAt(i - 1) - 'A' - 32 + 'A',a[s.charAt(i - 1) - 'A' - 32]);
a[s.charAt(i - 1) - 'A' - 32] = 1;
}
}
}
}
}
| [
"y.yu@open.ac.uk"
] | y.yu@open.ac.uk |
4db899fdea9fc10f7ab5b101841a2886d7df606f | 9aefcf2c0ecf627ed9998ad5db4fabe617d9b10e | /2015-nodl-ohjelmointi/viikko04-Viikko04_086.Ruokalista/src/Ruokalista.java | 7071a69ae1b8a2d84c88ebfe8b1706bdd3db00a0 | [] | no_license | PhilKesselOfAtala/ownStuff | fa88fc9f0a38e9d3d38fe6f191fa135ad77175aa | 00c740c54fcfd99628b172ad4a51de43f87296c8 | refs/heads/master | 2022-12-23T10:00:12.909459 | 2019-11-28T16:16:29 | 2019-11-28T16:16:29 | 33,491,961 | 0 | 0 | null | 2022-12-11T15:14:21 | 2015-04-06T16:23:49 | Java | UTF-8 | Java | false | false | 594 | java |
import java.util.ArrayList;
public class Ruokalista {
private ArrayList<String> ateriat;
public Ruokalista() {
this.ateriat = new ArrayList<>();
}
// toteuta tänne tarvittavat metodit
public void lisaaAteria(String ateria) {
if (!ateriat.contains(ateria)) {
ateriat.add(ateria);
}
}
public void tulostaAteriat() {
for (int i = 0; i < ateriat.size(); i++) {
System.out.println(ateriat.get(i));
}
}
public void tyhjennaRuokalista() {
ateriat.clear();
}
}
| [
"matias.karjalainen@gmail.com"
] | matias.karjalainen@gmail.com |
801d30035d5224749f604eff3b4ac5158fb6b601 | 399e6060e4f73745e5af5eab84c0e201924572d2 | /src/test/java/projeto_sonar/projeto_sonar/AppTest.java | 8ca5fab753d8113c5d7fb18a1ef7f0b1c7ff9bd7 | [] | no_license | JonathanMori/calculadora-sonar | 1ec08e5e378ff3190e53fd8e7a16015092f7f1e8 | b2f417365297eee08726046f96e23715f94ec040 | refs/heads/master | 2023-03-27T07:06:43.180294 | 2021-03-31T01:12:44 | 2021-03-31T01:12:44 | 353,185,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package projeto_sonar.projeto_sonar;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Unit test for simple App.
*/
public class AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
| [
"jonathanmori@hotmail.com"
] | jonathanmori@hotmail.com |
7664b557909d0625605dcf7b3654bdfecd2211f1 | b57f01d0fae7bbdab086811c5aed8884c18caadb | /src/main/java/es/qiu/drzug/domain/PacketItem.java | 92fd0bcf12bc7b7d25ac6f4f7fffcb5a250ae5e9 | [] | no_license | qiuwei/drzug | 5d6ccc71d779935f0aa4fe67063bc9525e81d989 | 216775bc9444b3d1c916ae58109da0c696eb38b8 | refs/heads/master | 2021-08-20T05:41:36.210988 | 2017-10-27T15:14:24 | 2017-10-27T15:14:24 | 100,290,854 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,151 | java | package es.qiu.drzug.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
import java.util.UUID;
/**
* A PacketItem.
*/
@Entity
@Table(name = "packet_item")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class PacketItem implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private UUID id;
@NotNull
@Column(name = "count", nullable = false)
private Long count;
@ManyToOne
private Packet packet;
// jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public Long getCount() {
return count;
}
public PacketItem count(Long count) {
this.count = count;
return this;
}
public void setCount(Long count) {
this.count = count;
}
public Packet getPacket() {
return packet;
}
public PacketItem packet(Packet packet) {
this.packet = packet;
return this;
}
public void setPacket(Packet packet) {
this.packet = packet;
}
// jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PacketItem packetItem = (PacketItem) o;
if (packetItem.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), packetItem.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "PacketItem{" +
"id=" + getId() +
", count='" + getCount() + "'" +
"}";
}
}
| [
"wei.qiu@uni-tuebingen.de"
] | wei.qiu@uni-tuebingen.de |
cd5310761017ec4bd659596adafb6ca01bcd0e25 | 70c5b5837a68dac24626908c07c91e6cf6d14207 | /cineapp/src/main/java/com/arcones/Service/BannersServiceImpl.java | bff7d5d4c9fadf11ec5d575bc0ae9bcafa4eb1c0 | [] | no_license | Arconess/SpringWebAppCine | 8b363f8617a49d049ce882b8a293dcf7b8e62998 | b1668d9d8deabebd46069cfc2b3b2831f1db7757 | refs/heads/master | 2022-12-23T20:32:50.074193 | 2019-08-28T16:22:46 | 2019-08-28T16:22:46 | 204,651,667 | 0 | 0 | null | 2022-12-16T00:38:59 | 2019-08-27T08:01:57 | Java | UTF-8 | Java | false | false | 1,639 | java | package com.arcones.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.LinkedList;
import java.util.List;
import org.springframework.stereotype.Service;
import com.arcones.Models.Banner;
@Service
public class BannersServiceImpl implements IBannersService {
List<Banner> banners = null;
public BannersServiceImpl() {
System.out.println("Creando una instancia de la clase BannersServiceImpl");
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
try {
this.banners = new LinkedList<>();
Banner banner1 = new Banner();
banner1.setId(0);
banner1.setTitulo("King Kong");
banner1.setFecha(formatter.parse("02-05-2017"));
banner1.setArchivo("slide1.jpg");
Banner banner2 = new Banner();
banner2.setId(1);
banner2.setTitulo("Bella y la Bestia");
banner2.setFecha(formatter.parse("02-05-2017"));
banner2.setArchivo("slide2.jpg");
Banner banner3 = new Banner();
banner3.setId(2);
banner3.setTitulo("Spiderman");
banner3.setFecha(formatter.parse("02-05-2017"));
banner3.setArchivo("slide3.jpg");
Banner banner4 = new Banner();
banner4.setId(3);
banner4.setTitulo("Cars");
banner4.setFecha(formatter.parse("02-05-2017"));
banner4.setArchivo("slide4.jpg");
banners.add(banner1);
banners.add(banner2);
banners.add(banner3);
banners.add(banner4);
} catch (ParseException e) {
System.out.println("Error: " + e.getMessage());
}
}
@Override
public void insertar(Banner banner) {
this.banners.add(banner);
}
@Override
public List<Banner> buscarTodos() {
return this.banners;
}
}
| [
"parcones@indra.es"
] | parcones@indra.es |
b92fbc676e92d0d1796789218f0f5ef5ea6fd31d | 276b32d3b27d3c976f4b10c57130d77ecd741c40 | /travel-weixin/src/net/zhinet/travel/inf/impl/CityGuideImplProxy.java | 23d26567d6925cf8db0810929d316d56f401ea8c | [] | no_license | liughost/mingda | 7f1f1ac857089c862f3aa174bc6ac8d60e539b8f | 15a6203058214e13e88ffe34ed8f79cd7dd421f2 | refs/heads/master | 2020-04-06T04:56:49.648642 | 2015-03-16T03:04:00 | 2015-03-16T03:04:00 | 28,849,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,986 | java | package net.zhinet.travel.inf.impl;
public class CityGuideImplProxy implements net.zhinet.travel.inf.impl.CityGuideImpl {
private String _endpoint = null;
private net.zhinet.travel.inf.impl.CityGuideImpl cityGuideImpl = null;
public CityGuideImplProxy() {
_initCityGuideImplProxy();
}
public CityGuideImplProxy(String endpoint) {
_endpoint = endpoint;
_initCityGuideImplProxy();
}
private void _initCityGuideImplProxy() {
try {
cityGuideImpl = (new net.zhinet.travel.inf.impl.CityGuideImplServiceLocator()).getCityGuideImpl();
if (cityGuideImpl != null) {
if (_endpoint != null)
((javax.xml.rpc.Stub)cityGuideImpl)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
else
_endpoint = (String)((javax.xml.rpc.Stub)cityGuideImpl)._getProperty("javax.xml.rpc.service.endpoint.address");
}
}
catch (javax.xml.rpc.ServiceException serviceException) {}
}
public String getEndpoint() {
return _endpoint;
}
public void setEndpoint(String endpoint) {
_endpoint = endpoint;
if (cityGuideImpl != null)
((javax.xml.rpc.Stub)cityGuideImpl)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
}
public net.zhinet.travel.inf.impl.CityGuideImpl getCityGuideImpl() {
if (cityGuideImpl == null)
_initCityGuideImplProxy();
return cityGuideImpl;
}
public net.zhinet.travel.pojo.reqandrespojo.City_ActivesRes city_actives(net.zhinet.travel.pojo.reqandrespojo.City_ActivesReq city_ActivesReq) throws java.rmi.RemoteException{
if (cityGuideImpl == null)
_initCityGuideImplProxy();
return cityGuideImpl.city_actives(city_ActivesReq);
}
public net.zhinet.travel.pojo.reqandrespojo.Province_ListRes province_list(net.zhinet.travel.pojo.basepojo.RequestHead requestHead) throws java.rmi.RemoteException{
if (cityGuideImpl == null)
_initCityGuideImplProxy();
return cityGuideImpl.province_list(requestHead);
}
public net.zhinet.travel.pojo.reqandrespojo.City_ListRes city_list(net.zhinet.travel.pojo.reqandrespojo.City_ListReq city_ListReq) throws java.rmi.RemoteException{
if (cityGuideImpl == null)
_initCityGuideImplProxy();
return cityGuideImpl.city_list(city_ListReq);
}
public net.zhinet.travel.pojo.reqandrespojo.View_ListRes view_list(net.zhinet.travel.pojo.reqandrespojo.View_ListReq view_ListReq) throws java.rmi.RemoteException{
if (cityGuideImpl == null)
_initCityGuideImplProxy();
return cityGuideImpl.view_list(view_ListReq);
}
public net.zhinet.travel.pojo.reqandrespojo.Tickets_ListRes tickets_list(net.zhinet.travel.pojo.reqandrespojo.Tickets_ListReq tickets_ListReq) throws java.rmi.RemoteException{
if (cityGuideImpl == null)
_initCityGuideImplProxy();
return cityGuideImpl.tickets_list(tickets_ListReq);
}
} | [
"liughost@126.com"
] | liughost@126.com |
d2cd17550f55de569ef75247779ee513a75555b7 | 94b12f6351a7406712a7ca55a1b2e489ea019886 | /src/main/java/com/willsanches/cursomc/domain/Estado.java | 633b51daee306470e015d5631d9aa0184d7dbb3b | [] | no_license | willsancheslima/cursomc | 55cc4ccd2fea1dd26bea29e2f723a071adf00a81 | 88f839405df8763c04f6cb96580807a22a23b904 | refs/heads/master | 2020-03-10T11:53:07.105602 | 2018-08-01T02:39:55 | 2018-08-01T02:39:55 | 129,365,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,628 | java | package com.willsanches.cursomc.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class Estado implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
private String nome;
@JsonIgnore
@OneToMany(mappedBy="estado")
private List<Cidade> cidades = new ArrayList<>();
public Estado() {
}
public Estado(Integer id, String nome) {
super();
this.id = id;
this.nome = nome;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public List<Cidade> getCidades() {
return cidades;
}
public void setCidades(List<Cidade> cidades) {
this.cidades = cidades;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.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;
Estado other = (Estado) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
| [
"willsancheslima@gmail.com"
] | willsancheslima@gmail.com |
81131f2af32721e145cfc88e96acbb82b2f51b19 | f252c466eccd63f619cc9622f69b945e57a6d4da | /src/main/java/org/ros/internal/message/field/MessageFields.java | 9cb4a31d9ffc36e7067c36a76d9a75bc51e5a504 | [] | no_license | neocoretechs/RosJavaLiteBootstrap | d7f6c2cf2a558ecf2a1447d0df947301dbb51e80 | 00381871ab9d587fa772687e794af12a53206243 | refs/heads/master | 2021-07-09T14:16:36.224498 | 2021-04-24T18:11:31 | 2021-04-24T18:11:31 | 41,332,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,860 | java |
package org.ros.internal.message.field;
import org.ros.exception.RosRuntimeException;
import org.ros.internal.message.context.MessageContext;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Jonathan Groff Copyright (C) NeoCoreTechs 2015,2021
*/
public class MessageFields implements Serializable {
private static final long serialVersionUID = -8375131025949194350L;
private Map<String, Field> fields;
private Map<String, Field> setters;
private Map<String, Field> getters;
private List<Field> orderedFields;
public MessageFields(MessageContext messageContext) {
fields = new HashMap<String, Field>();
setters = new HashMap<String, Field>();
getters = new HashMap<String, Field>();
orderedFields = new ArrayList<Field>();
for (String name : messageContext.getFieldNames()) {
Field field = messageContext.getFieldFactory(name).create();
fields.put(name, field);
getters.put(messageContext.getFieldGetterName(name), field);
setters.put(messageContext.getFieldSetterName(name), field);
orderedFields.add(field);
}
}
public MessageFields() {}
public Field getField(String name) {
return fields.get(name);
}
public Field getSetterField(String name) {
return setters.get(name);
}
public Field getGetterField(String name) {
return getters.get(name);
}
public List<Field> getFields() {
return Collections.unmodifiableList(orderedFields);
}
public Object getFieldValue(String name) {
Field field = fields.get(name);
if (field != null) {
return field.getValue();
}
throw new RosRuntimeException("Uknown field: " + name);
}
public void setFieldValue(String name, Object value) {
Field field = fields.get(name);
if (field != null) {
field.setValue(value);
} else {
throw new RosRuntimeException("Uknown field: " + name);
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((fields == null) ? 0 : fields.hashCode());
result = prime * result + ((orderedFields == null) ? 0 : orderedFields.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;
MessageFields other = (MessageFields) obj;
if (fields == null) {
if (other.fields != null)
return false;
} else if (!fields.equals(other.fields))
return false;
if (orderedFields == null) {
if (other.orderedFields != null)
return false;
} else if (!orderedFields.equals(other.orderedFields))
return false;
return true;
}
}
| [
"groffj@neocoretechs.com"
] | groffj@neocoretechs.com |
2029bbb7567b88febf97a1f11af58df1e678caba | 47ccfbd1eb9d7b41dca8c6b0e58cc8f8243b5210 | /TuringMachine/logic/src/main/java/com/kingsley/turing/direction/StayDirrection.java | 1bdba6ee3b498b1ce00f2166b1fbe4c56b3bad19 | [] | no_license | KITSOleksandrProkopiuk/KinglseyRepository | 2f74c58f96e6e0aa2fd83dc95832152abc495854 | 439e7610c199d68ace59739b55a3a9e4adeadee0 | refs/heads/master | 2016-09-05T23:32:08.748931 | 2012-05-08T15:45:49 | 2012-05-08T15:45:49 | 2,836,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package com.kingsley.turing.direction;
import com.kingsley.turing.Tape;
public class StayDirrection implements Dirrection {
public void move(Tape tape) {
}
}
| [
"wizard711@gmail.com"
] | wizard711@gmail.com |
a2f6b407115aef2351dfb0a96a55532a2072b5b6 | 45f87afc7fe493a3739885d39f9eb0184c96e0c9 | /services/vautoscaling/src/main/java/com/ncloud/vautoscaling/model/GetAutoScalingGroupListRequest.java | 50f352dc39f6bf16ec2f24eb386341c337d48f6d | [
"MIT"
] | permissive | NaverCloudPlatform/ncloud-sdk-java | 6635639835ed19dc82e4605c554f894a14645004 | bb692dab5f00f94f36c1fcc622bec6d2f2c88d28 | refs/heads/master | 2023-05-03T07:21:03.219343 | 2023-04-19T10:56:17 | 2023-04-19T10:56:17 | 210,761,909 | 7 | 6 | MIT | 2023-04-19T10:56:52 | 2019-09-25T05:23:36 | Java | UTF-8 | Java | false | false | 6,378 | java | /*
* vautoscaling
* VPC Auto Scaling 관련 API<br/>https://ncloud.apigw.ntruss.com/vautoscaling/v2
*
* NBP corp.
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.ncloud.vautoscaling.model;
import java.util.Objects;
import java.util.ArrayList;
import java.util.List;
/**
* GetAutoScalingGroupListRequest
*/
public class GetAutoScalingGroupListRequest {
private String regionCode = null;
private List<String> autoScalingGroupNoList = null;
private List<String> autoScalingGroupNameList = null;
private Integer pageNo = null;
private Integer pageSize = null;
private String sortList = null;
private String responseFormatType = null;
public GetAutoScalingGroupListRequest regionCode(String regionCode) {
this.regionCode = regionCode;
return this;
}
/**
* REGION코드
* @return regionCode
**/
public String getRegionCode() {
return regionCode;
}
public void setRegionCode(String regionCode) {
this.regionCode = regionCode;
}
public GetAutoScalingGroupListRequest autoScalingGroupNoList(List<String> autoScalingGroupNoList) {
this.autoScalingGroupNoList = autoScalingGroupNoList;
return this;
}
public GetAutoScalingGroupListRequest addAutoScalingGroupNoListItem(String autoScalingGroupNoListItem) {
if (this.autoScalingGroupNoList == null) {
this.autoScalingGroupNoList = new ArrayList<String>();
}
this.autoScalingGroupNoList.add(autoScalingGroupNoListItem);
return this;
}
/**
* 오토스케일링그룹번호리스트
* @return autoScalingGroupNoList
**/
public List<String> getAutoScalingGroupNoList() {
return autoScalingGroupNoList;
}
public void setAutoScalingGroupNoList(List<String> autoScalingGroupNoList) {
this.autoScalingGroupNoList = autoScalingGroupNoList;
}
public GetAutoScalingGroupListRequest autoScalingGroupNameList(List<String> autoScalingGroupNameList) {
this.autoScalingGroupNameList = autoScalingGroupNameList;
return this;
}
public GetAutoScalingGroupListRequest addAutoScalingGroupNameListItem(String autoScalingGroupNameListItem) {
if (this.autoScalingGroupNameList == null) {
this.autoScalingGroupNameList = new ArrayList<String>();
}
this.autoScalingGroupNameList.add(autoScalingGroupNameListItem);
return this;
}
/**
* 오토스케일링그룹이름리스트
* @return autoScalingGroupNameList
**/
public List<String> getAutoScalingGroupNameList() {
return autoScalingGroupNameList;
}
public void setAutoScalingGroupNameList(List<String> autoScalingGroupNameList) {
this.autoScalingGroupNameList = autoScalingGroupNameList;
}
public GetAutoScalingGroupListRequest pageNo(Integer pageNo) {
this.pageNo = pageNo;
return this;
}
/**
* 페이지번호
* @return pageNo
**/
public Integer getPageNo() {
return pageNo;
}
public void setPageNo(Integer pageNo) {
this.pageNo = pageNo;
}
public GetAutoScalingGroupListRequest pageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
/**
* 페이지사이즈
* @return pageSize
**/
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public GetAutoScalingGroupListRequest sortList(String sortList) {
this.sortList = sortList;
return this;
}
/**
* 정렬리스트
* @return sortList
**/
public String getSortList() {
return sortList;
}
public void setSortList(String sortList) {
this.sortList = sortList;
}
public GetAutoScalingGroupListRequest responseFormatType(String responseFormatType) {
this.responseFormatType = responseFormatType;
return this;
}
/**
* responseFormatType {json, xml}
* @return responseFormatType
**/
public String getResponseFormatType() {
return responseFormatType;
}
public void setResponseFormatType(String responseFormatType) {
this.responseFormatType = responseFormatType;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GetAutoScalingGroupListRequest getAutoScalingGroupListRequest = (GetAutoScalingGroupListRequest) o;
return Objects.equals(this.regionCode, getAutoScalingGroupListRequest.regionCode) &&
Objects.equals(this.autoScalingGroupNoList, getAutoScalingGroupListRequest.autoScalingGroupNoList) &&
Objects.equals(this.autoScalingGroupNameList, getAutoScalingGroupListRequest.autoScalingGroupNameList) &&
Objects.equals(this.pageNo, getAutoScalingGroupListRequest.pageNo) &&
Objects.equals(this.pageSize, getAutoScalingGroupListRequest.pageSize) &&
Objects.equals(this.sortList, getAutoScalingGroupListRequest.sortList) &&
Objects.equals(this.responseFormatType, getAutoScalingGroupListRequest.responseFormatType);
}
@Override
public int hashCode() {
return Objects.hash(regionCode, autoScalingGroupNoList, autoScalingGroupNameList, pageNo, pageSize, sortList, responseFormatType);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class GetAutoScalingGroupListRequest {\n");
sb.append(" regionCode: ").append(toIndentedString(regionCode)).append("\n");
sb.append(" autoScalingGroupNoList: ").append(toIndentedString(autoScalingGroupNoList)).append("\n");
sb.append(" autoScalingGroupNameList: ").append(toIndentedString(autoScalingGroupNameList)).append("\n");
sb.append(" pageNo: ").append(toIndentedString(pageNo)).append("\n");
sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n");
sb.append(" sortList: ").append(toIndentedString(sortList)).append("\n");
sb.append(" responseFormatType: ").append(toIndentedString(responseFormatType)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"lee.yongtak@navercorp.com"
] | lee.yongtak@navercorp.com |
074f169c0a69baa1d78455455dc60d33181f733b | 76da2fc2699a8e955cbe3c9a5ecea84a04be2b87 | /java/javaVisitor/NodeRead.java | aac0d6f457920e49665e77544cedcc2834d2fe72 | [
"BSD-3-Clause"
] | permissive | pedroreissantos/simples | 664937b109957c582d38ea19841f5a71ea2af0df | 99c621a50f549926d58dbe5a86ad7a2bd87cc2ca | refs/heads/master | 2021-06-01T18:25:09.762432 | 2020-09-10T18:35:50 | 2020-09-10T18:35:50 | 31,664,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | import java.util.*;
public class NodeRead extends NodeUnary {
NodeRead(Node arg1) { super(arg1); }
NodeRead(Node arg1, int lineno) { super(arg1, lineno); }
public void accept(Compiler c) { c.nodeRead(this); }
}
| [
"reis.santos@tecnico.ulisboa.pt"
] | reis.santos@tecnico.ulisboa.pt |
d998cfbdf745bfca368d55da32d9c1a200dedb71 | cf81ca7cd21a10680eb5de71f70ecabb3699088a | /src/main/java/com/xg/arctic/model/User.java | bd4fe05e3a3b39c8a03f9af4c4a3d31cd616907d | [
"Apache-2.0"
] | permissive | gongmingqm10/Leonard | 3a4c8f38611f0abfc63fb84ad29c29903518bbb8 | 455052afbf62609a32399522c545cbc0d9085b43 | refs/heads/master | 2020-05-30T18:44:31.924442 | 2014-08-09T08:00:35 | 2014-08-09T08:00:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package com.xg.arctic.model;
/**
* User: gongming
* Date: 7/25/14
* Time: 9:23 AM
* Email:gongmingqm10@foxmail.com
*/
public class User {
private long id;
private String userName;
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
| [
"="
] | = |
cd5ad549102caa929b7f211c88a6d65984b1ba47 | 322ac84614bd8d011c79b03d96214d4ceabcf086 | /src/main/java/com/oseasy/pie/modules/impdata/entity/ProMdApprovalError.java | bf05e0f797ff9a5c746ebfb057d78ee8af063608 | [] | no_license | SchuckBeta/cxcy | f2f953c074be5ab8ab8aeac533ade6600135d759 | ed4ceee397fae9d470fb93579bbf6af631965eaa | refs/heads/master | 2022-12-25T14:53:58.066476 | 2019-09-20T12:28:55 | 2019-09-20T12:28:55 | 209,783,634 | 1 | 0 | null | 2022-12-16T07:46:52 | 2019-09-20T12:18:07 | Java | UTF-8 | Java | false | false | 7,762 | java | package com.oseasy.pie.modules.impdata.entity;
import org.hibernate.validator.constraints.Length;
import com.oseasy.com.pcore.common.persistence.DataEntity;
/**
* 民大项目立项审核导入错误数据表Entity.
* @author 9527
* @version 2017-09-22
*/
public class ProMdApprovalError extends DataEntity<ProMdApprovalError> {
private static final long serialVersionUID = 1L;
private String impId; // 导入信息表主键
private String proCategory; // 申报类型
private String level; // 申报级别
private String pNumber; // 项目编号
private String pName; // 项目名称
private String leaderName; // 负责人-姓名
private String no; // 负责人-学号
private String mobile; // 负责人-手机
private String proSource; // 项目来源
private String sourceProjectName; // 来源项目名称
private String sourceProjectType; // 来源项目类别
private String teachers1; // 导师-姓名
private String teachers2; // 导师-职称
private String teachers3; // 导师-学历
private String teachers4; // 导师-工号
private String rufu; // 是否申请入孵
private String members1; // 成员-姓名
private String members2; // 成员-学号
private String members3; // 成员-手机
private String result; // 评审结果
private String proModelMdId; // 项目id
private String gnodeid; // 节点
private String sheetIndex;//所在sheet
public ProMdApprovalError() {
super();
}
public ProMdApprovalError(String id) {
super(id);
}
public String getSheetIndex() {
return sheetIndex;
}
public void setSheetIndex(String sheetIndex) {
this.sheetIndex = sheetIndex;
}
@Length(min=1, max=64, message="导入信息表主键长度必须介于 1 和 64 之间")
public String getImpId() {
return impId;
}
public void setImpId(String impId) {
this.impId = impId;
}
@Length(min=0, max=128, message="申报类型长度必须介于 0 和 128 之间")
public String getProCategory() {
return proCategory;
}
public void setProCategory(String proCategory) {
if (proCategory!=null&&proCategory.length()>128) {
return;
}
this.proCategory = proCategory;
}
@Length(min=0, max=128, message="申报级别长度必须介于 0 和 128 之间")
public String getLevel() {
return level;
}
public void setLevel(String level) {
if (level!=null&&level.length()>128) {
return;
}
this.level = level;
}
@Length(min=0, max=128, message="项目编号长度必须介于 0 和 128 之间")
public String getPNumber() {
return pNumber;
}
public void setPNumber(String pNumber) {
if (pNumber!=null&&pNumber.length()>128) {
return;
}
this.pNumber = pNumber;
}
@Length(min=0, max=128, message="项目名称长度必须介于 0 和 128 之间")
public String getPName() {
return pName;
}
public void setPName(String pName) {
if (pName!=null&&pName.length()>128) {
return;
}
this.pName = pName;
}
@Length(min=0, max=128, message="负责人-姓名长度必须介于 0 和 128 之间")
public String getLeaderName() {
return leaderName;
}
public void setLeaderName(String leaderName) {
if (leaderName!=null&&leaderName.length()>128) {
return;
}
this.leaderName = leaderName;
}
@Length(min=0, max=128, message="负责人-学号长度必须介于 0 和 128 之间")
public String getNo() {
return no;
}
public void setNo(String no) {
if (no!=null&&no.length()>128) {
return;
}
this.no = no;
}
@Length(min=0, max=128, message="负责人-手机长度必须介于 0 和 128 之间")
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
if (mobile!=null&&mobile.length()>128) {
return;
}
this.mobile = mobile;
}
@Length(min=0, max=128, message="项目来源长度必须介于 0 和 128 之间")
public String getProSource() {
return proSource;
}
public void setProSource(String proSource) {
if (proSource!=null&&proSource.length()>128) {
return;
}
this.proSource = proSource;
}
@Length(min=0, max=128, message="来源项目名称长度必须介于 0 和 128 之间")
public String getSourceProjectName() {
return sourceProjectName;
}
public void setSourceProjectName(String sourceProjectName) {
if (sourceProjectName!=null&&sourceProjectName.length()>128) {
return;
}
this.sourceProjectName = sourceProjectName;
}
@Length(min=0, max=128, message="来源项目类别长度必须介于 0 和 128 之间")
public String getSourceProjectType() {
return sourceProjectType;
}
public void setSourceProjectType(String sourceProjectType) {
if (sourceProjectType!=null&&sourceProjectType.length()>128) {
return;
}
this.sourceProjectType = sourceProjectType;
}
@Length(min=0, max=128, message="导师-姓名长度必须介于 0 和 128 之间")
public String getTeachers1() {
return teachers1;
}
public void setTeachers1(String teachers1) {
if (teachers1!=null&&teachers1.length()>128) {
return;
}
this.teachers1 = teachers1;
}
@Length(min=0, max=128, message="导师-职称长度必须介于 0 和 128 之间")
public String getTeachers2() {
return teachers2;
}
public void setTeachers2(String teachers2) {
if (teachers2!=null&&teachers2.length()>128) {
return;
}
this.teachers2 = teachers2;
}
@Length(min=0, max=128, message="导师-学历长度必须介于 0 和 128 之间")
public String getTeachers3() {
return teachers3;
}
public void setTeachers3(String teachers3) {
if (teachers3!=null&&teachers3.length()>128) {
return;
}
this.teachers3 = teachers3;
}
@Length(min=0, max=128, message="导师-工号长度必须介于 0 和 128 之间")
public String getTeachers4() {
return teachers4;
}
public void setTeachers4(String teachers4) {
if (teachers4!=null&&teachers4.length()>128) {
return;
}
this.teachers4 = teachers4;
}
@Length(min=0, max=128, message="是否申请入孵长度必须介于 0 和 128 之间")
public String getRufu() {
return rufu;
}
public void setRufu(String rufu) {
if (rufu!=null&&rufu.length()>128) {
return;
}
this.rufu = rufu;
}
@Length(min=0, max=256, message="成员-姓名长度必须介于 0 和 256 之间")
public String getMembers1() {
return members1;
}
public void setMembers1(String members1) {
if (members1!=null&&members1.length()>256) {
return;
}
this.members1 = members1;
}
@Length(min=0, max=256, message="成员-学号长度必须介于 0 和 256 之间")
public String getMembers2() {
return members2;
}
public void setMembers2(String members2) {
if (members2!=null&&members2.length()>256) {
return;
}
this.members2 = members2;
}
@Length(min=0, max=256, message="成员-手机长度必须介于 0 和 256 之间")
public String getMembers3() {
return members3;
}
public void setMembers3(String members3) {
if (members3!=null&&members3.length()>256) {
return;
}
this.members3 = members3;
}
@Length(min=0, max=12, message="评审结果长度必须介于 0 和 12 之间")
public String getResult() {
return result;
}
public void setResult(String result) {
if (result!=null&&result.length()>12) {
return;
}
this.result = result;
}
@Length(min=0, max=64, message="项目id长度必须介于 0 和 64 之间")
public String getProModelMdId() {
return proModelMdId;
}
public void setProModelMdId(String proModelMdId) {
if (proModelMdId!=null&&proModelMdId.length()>64) {
return;
}
this.proModelMdId = proModelMdId;
}
@Length(min=0, max=64, message="节点长度必须介于 0 和 64 之间")
public String getGnodeid() {
return gnodeid;
}
public void setGnodeid(String gnodeid) {
if (gnodeid!=null&&gnodeid.length()>64) {
return;
}
this.gnodeid = gnodeid;
}
} | [
"chenhao@os-easy.com"
] | chenhao@os-easy.com |
7ab198321373ecf017303a0a3fb7cbd1ffad7ac2 | d356950b46a6090a56e0672972b99c4e72ed8d96 | /welcomeIT/app/src/main/java/com/example/uday/welcomeit/MainActivity.java | 043d5d3fc9e8b8570941431f89a3d5f57ddea46a | [] | no_license | udayabhaskar1/my-android-projects | c59365afc361f17f2579fdde02d487e004cd90c3 | 69b119ae87aeaa50ab428a2e8d423715a9613f49 | refs/heads/master | 2022-05-20T23:03:18.720953 | 2020-04-27T16:53:49 | 2020-04-27T16:53:49 | 259,333,650 | 0 | 0 | null | 2020-04-27T15:40:24 | 2020-04-27T13:39:12 | JavaScript | UTF-8 | Java | false | false | 339 | java | package com.example.uday.welcomeit;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"e0384968@u.nus.edu"
] | e0384968@u.nus.edu |
9ed21f3a57bd5dd43a22ee03c5dab38f6de86b12 | 4125c5800f19043e4e558466650eab6d15f0b9be | /src/test/java/com/tgc/test/suit/TaskThreeTest.java | 2700aa65d096a29930b9c192fea89fbe3e042834 | [] | no_license | yeqizhang/springboot-jsp-learn | eb2aad19f0662a82891d09e801e71b36b3d528d1 | 862867e780bb53824c2d38a06f57d922dd88ba2a | refs/heads/master | 2020-04-02T16:18:05.479375 | 2019-12-03T12:22:56 | 2019-12-03T12:22:56 | 154,601,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 167 | java | package com.tgc.test.suit;
import org.junit.Test;
public class TaskThreeTest {
@Test
public void test() {
System.out.println("Task Three.");
}
}
| [
"tan478527359@qq.com"
] | tan478527359@qq.com |
ff7ee03bf87f37c2fcacc6984dee395bbbb6e0e2 | be3e50975989f0cec3b8e12dcc0059bf71db0acd | /app/src/main/java/com/uplooking/dell/myjsondata/newsresult/NewsResultRootClass.java | f98ced2bbbd584b09680c4d4868ea35f72d38d5d | [] | no_license | ouchengle/Test | a5a2eec1fb1b35a0de15ca62d6469ff6394010f9 | 5e3b33137c42480d06dcebbddea48ce26354decf | refs/heads/master | 2021-07-22T10:22:36.594128 | 2021-07-07T02:23:43 | 2021-07-07T02:23:43 | 62,632,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package com.uplooking.dell.myjsondata.newsresult;
import com.uplooking.dell.myjsondata.ErrorCodeAndMessage;
import java.util.List;
public class NewsResultRootClass extends ErrorCodeAndMessage{
private List<NewsResult> result;
public List<NewsResult> getresult() {
return result;
}
public void setresult(List<NewsResult> result) {
this.result = result;
}
}
| [
"969707751@qq.com"
] | 969707751@qq.com |
18ec8a75c8dcd439399e957907f9b9ece65cc701 | ae7d883514fdf8c7a1f11a6a9f7e6dbbcca6ed8d | /src/main/java/net/mcreator/aetheria/MCreatorPalladium.java | a055de3c773ac93712fe708619b9c2bf8484985c | [] | no_license | LittleWhole/Aetheria | 7b5b2992591e63d519a5411b447bc328a817c9a8 | 5fa1a01c05d7c877ab7cf35fd5ff7d471b27d468 | refs/heads/master | 2021-01-13T20:08:45.978929 | 2020-02-21T04:12:24 | 2020-02-21T04:12:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,079 | java | package net.mcreator.aetheria;
import net.minecraftforge.registries.ObjectHolder;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.Item;
import net.minecraft.block.BlockState;
@Elementsaetheria.ModElement.Tag
public class MCreatorPalladium extends Elementsaetheria.ModElement {
@ObjectHolder("aetheria:palladium")
public static final Item block = null;
public MCreatorPalladium(Elementsaetheria instance) {
super(instance, 44);
}
@Override
public void initElements() {
elements.items.add(() -> new ItemCustom());
}
public static class ItemCustom extends Item {
public ItemCustom() {
super(new Item.Properties().group(ItemGroup.MATERIALS).maxStackSize(64));
setRegistryName("palladium");
}
@Override
public int getItemEnchantability() {
return 0;
}
@Override
public int getUseDuration(ItemStack itemstack) {
return 0;
}
@Override
public float getDestroySpeed(ItemStack par1ItemStack, BlockState par2Block) {
return 1F;
}
}
}
| [
"jmref@DESKTOP-RAU8VAD.attlocal.net"
] | jmref@DESKTOP-RAU8VAD.attlocal.net |
ff2e98022e50a83501e7c35f9987ee2a2747d028 | bd26e0b9aab0a855c0a2f6c3779c3b415e2a78ef | /service/service-product/src/main/java/com/atguigu/gmall/product/controller/AttrController.java | 8d322db74ad7b84b93d4e164353956fec9ef0b4b | [] | no_license | FickleSadness/gmall-parent | 8767ba906b877ef66f07a542c121c8d766daf470 | d9089ccd5c8933857e3e6e117e0feed5bd2086cf | refs/heads/main | 2023-02-18T20:08:48.480089 | 2021-01-22T13:27:38 | 2021-01-22T13:27:38 | 331,222,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,489 | java | package com.atguigu.gmall.product.controller;
import com.atguigu.gmall.model.product.BaseAttrInfo;
import com.atguigu.gmall.model.product.BaseAttrValue;
import com.atguigu.gmall.product.service.AttrService;
import com.atguigu.gmall.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Author xyh
* @Date 2021/1/22 14:08
* @Description
*/
@RestController
@RequestMapping("admin/product/")
@CrossOrigin
public class AttrController {
@Autowired
private AttrService attrService;
@RequestMapping("attrInfoList/{category1Id}/{category2Id}/{category3Id}")
public Result attrInfoList(@PathVariable("category1Id") Long category1Id,
@PathVariable("category2Id") Long category2Id,
@PathVariable("category3Id") Long category3Id) {
List<BaseAttrInfo> baseAttrInfos = attrService.attrInfoList(category3Id);
return Result.ok(baseAttrInfos);
}
@RequestMapping("saveAttrInfo")
public Result saveAttrInfo(@RequestBody BaseAttrInfo baseAttrInfo) {
attrService.saveAttrInfo(baseAttrInfo);
return Result.ok();
}
@RequestMapping("getAttrValueList/{attrId}")
public Result getAttrValueList(@PathVariable("attrId") Long attrId) {
List<BaseAttrValue> baseAttrValues = attrService.getAttrValueList(attrId);
return Result.ok(baseAttrValues);
}
}
| [
"193632817@qq.com"
] | 193632817@qq.com |
c516fe432cc274d497c55b2843f8290515578d2a | bf6a2ee31e421a8c8a24cad42db0e3a365e9527f | /abhishek/Spring STS Workspace/CoreJavaPrograms/src/com/corejava/inheritance/A.java | 515dd95206fd993bdeecee1cf6d17e31b7224c81 | [] | no_license | abhidynmc/abhishek | d6275d1f5013222b9d26aa64fac9d682e00d46de | f020dba932d92cfe6590fb49c33178e263ba7b00 | refs/heads/master | 2023-01-14T03:27:37.731840 | 2019-06-14T18:22:03 | 2019-06-14T18:22:03 | 114,673,633 | 0 | 0 | null | 2023-01-07T02:25:30 | 2017-12-18T18:17:25 | JavaScript | UTF-8 | Java | false | false | 127 | java | package com.corejava.inheritance;
public class A {
public void show() {
System.out.println("Calling Show() from A");
}
}
| [
"abhi_2611@hotmail.com"
] | abhi_2611@hotmail.com |
29fa98b3ea1e885f93719bd03a4c7f69c23b4232 | 421c0da368cc4fcd01531cb3bc04b1cee5922cd4 | /src/main/java/bf/gov/application/config/ApplicationProperties.java | d91b2e208f80fa1fee21e9527981f2b425ac10b0 | [] | no_license | wmmitte/einstances | 6c72b4507f6939b59115676141a6a7fbc558dd2e | 4826e378abfa8bf1fa970b5c8d62246bc9686d66 | refs/heads/master | 2020-03-30T04:36:42.710107 | 2018-09-28T14:30:08 | 2018-09-28T14:30:08 | 150,752,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package bf.gov.application.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Properties specific to Einstances.
* <p>
* Properties are configured in the application.yml file.
* See {@link io.github.jhipster.config.JHipsterProperties} for a good example.
*/
@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
public class ApplicationProperties {
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
bfbfa60008ab907958d6423535b0a7a2f46ce195 | e48c0af75937d3e870b006ab274b99b02f544db6 | /automation/src/core/support/objects/KeyValue.java | 9e108c307db6b44d6b85f776374f079061d8beee | [
"MIT"
] | permissive | 81088511/AutonomxCore | a8e7ded8157f8f20f0c08ba6bb7cdf163f0546ac | d14c4915e83f6492f1743bb59035c0fec3301624 | refs/heads/master | 2020-11-26T20:03:12.518227 | 2019-12-18T05:01:45 | 2019-12-18T05:01:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package core.support.objects;
public class KeyValue {
public String key;
public String position;
public Object value;
public KeyValue() {
}
public KeyValue(String key, String position, Object value) {
this.key = key;
this.position = position;
this.value = value;
}
public KeyValue(String key, String position, String value) {
this.key = key;
this.position = position;
this.value = value;
}
public KeyValue(String key, Object value) {
this.key = key;
this.value = value;
}
public KeyValue(String key, String value) {
this.key = key;
this.value = value;
}
public void add(String key, String position, Object value) {
this.key = key;
this.position = position;
this.value = value;
}
public void add(String key, String position, String value) {
this.key = key;
this.position = position;
this.value = value;
}
public void add(String key, Object value) {
this.key = key;
this.value = value;
}
public void add(String key, String value) {
this.key = key;
this.value = value;
}
} | [
"ehsan.matean@fortify.pro"
] | ehsan.matean@fortify.pro |
dc01fac07ecd795bac5f57e204c497a3ddfd3340 | 3d2905ec0a8d3283ec0059acc027de51806968d6 | /diamond-client-3.7.0/src/main/java/com/taobao/diamond/manager/ManagerListenerAdapter.java | e442fda269a8c703d280d25c83d3c2d26fc970f6 | [] | no_license | jooo000hn/my-im | 9cddd5c9ae7a0a50b9c0ae6b83748ce3bbb2f105 | b02856db68fab0110b582d17e88fd77adbd9325f | refs/heads/master | 2021-01-21T06:19:11.948931 | 2017-02-26T14:10:10 | 2017-02-26T14:10:10 | 83,211,820 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.taobao.diamond.manager;
import java.util.concurrent.Executor;
public abstract class ManagerListenerAdapter implements ManagerListener {
public Executor getExecutor() {
return null;
}
}
| [
"jooo000hn@163.com"
] | jooo000hn@163.com |
ff7515cbb67cca946ea4d37a62c88ada4cda8303 | 6c7da4c5477f15244926cd72bcef090a0f4ed773 | /Discount/src/main/java/com/xmu/oomall/domain/CartItemPo.java | 92a1e9587e1f51d9c1e5e9411bb176d42f369f94 | [] | no_license | neilhanhan/oomall | 5f642b08a6bc356546442d468135103631b5bc45 | f20bb31eff1a442344a62e4b53d6b851fa79a2cc | refs/heads/master | 2022-06-30T00:04:02.073399 | 2019-12-19T13:26:23 | 2019-12-19T13:26:23 | 226,604,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package com.xmu.oomall.domain;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.time.LocalDateTime;
/**
* @Author: 数据库与对象模型标准组
* @Description: 购物车明细
* @Date: Created in 14:30 2019/12/11
**/
@Getter
@Setter
@ToString
@EqualsAndHashCode
public class CartItemPo {
private Integer id;
/**
* 购物车归属的用户id
*/
private Integer userId;
/**
* 货品ID
*/
private Integer productId;
/**
* 是否选中,0未选中,1已选中
*/
private Boolean beCheck;
/**
* 数量
*/
private Integer number;
private LocalDateTime gmtCreate;
private LocalDateTime gmtModified;
}
| [
"1138418834@qq.com"
] | 1138418834@qq.com |
4a580acc0caf62ff8b3273517c8196d0df2d6585 | 39d5d67350eeeb41a7519e09ef8945bafc997ce0 | /CollapseCalendarView/src/test/java/com/wefika/calendar/manager/RangeUnitTest.java | 157c5af38cc714ecac824810415a8451768e14b3 | [
"MIT"
] | permissive | sohel274/android-collapse-calendar-view | ad03f1398e150c268dd53d4126fd5205549b8cb9 | 66915c5cf79e3ec9d33faa14d16b7a512371bf00 | refs/heads/develop | 2020-02-26T17:00:30.177063 | 2014-11-27T12:23:04 | 2014-11-27T12:23:04 | 34,260,402 | 0 | 1 | null | 2015-04-20T12:56:09 | 2015-04-20T12:56:08 | Java | UTF-8 | Java | false | false | 3,879 | java | package com.wefika.calendar.manager;
import android.test.AndroidTestCase;
import org.joda.time.DateTimeConstants;
import org.joda.time.Days;
import org.joda.time.LocalDate;
public class RangeUnitTest extends AndroidTestCase {
RangeUnit mRangeUnit;
public void setUp() throws Exception {
LocalDate today = LocalDate.now();
mRangeUnit = new Month(today, today, today.minusMonths(2), today.plusMonths(2));
}
public void testInit() throws Exception {
LocalDate today = LocalDate.now();
assertEquals(today.minusMonths(2), mRangeUnit.getMinDate());
assertEquals(today.plusMonths(2), mRangeUnit.getMaxDate());
}
public void testIllegalRange() throws Exception {
LocalDate today = LocalDate.now();
try {
new Month(today, today, today.plusDays(1), today);
fail();
} catch (IllegalArgumentException e) {
// should happen
}
}
public void testMinMaxNull() throws Exception {
LocalDate today = LocalDate.now();
RangeUnit unit = new Month(today, today, null, null);
assertNull(unit.getMinDate());
assertNull(unit.getMaxDate());
}
public void testGetFirstWeekNull() throws Exception {
LocalDate today = LocalDate.now();
RangeUnit unit = new Month(today, today, null, null);
assertEquals(0, unit.getFirstWeek(null));
}
public void testGetFirstWeekCurrentMonth() throws Exception {
LocalDate today = LocalDate.now();
LocalDate firstMonday = today.withDayOfMonth(1).withDayOfWeek(DateTimeConstants.MONDAY);
int week = Days.daysBetween(firstMonday, today).dividedBy(DateTimeConstants.DAYS_PER_WEEK).getDays();
assertEquals(week, mRangeUnit.getFirstWeek(today));
}
public void testGetFirstWeekMinDate() throws Exception {
LocalDate today = LocalDate.now();
LocalDate minDate = today.minusMonths(2);
LocalDate date = minDate.minusWeeks(1);
RangeUnit unit = new Week(date, today, minDate, today);
LocalDate firstMonday = minDate.withDayOfMonth(1).withDayOfWeek(DateTimeConstants.MONDAY);
int week = Days.daysBetween(firstMonday, minDate).dividedBy(DateTimeConstants.DAYS_PER_WEEK).getDays();
assertEquals(week, unit.getFirstWeek(date));
}
public void testGetFirstWeekBetween() throws Exception {
LocalDate date = LocalDate.parse("2014-08-01");
RangeUnit unit = new Month(date, date, date.plusDays(2), date.plusWeeks(2));
assertEquals(0, unit.getFirstWeek(date.plusDays(12)));
}
public void testGetFirstWeekOutOfView() throws Exception {
LocalDate date = LocalDate.parse("2014-08-01");
RangeUnit unit = new Week(date, date, date, date.plusWeeks(2));
assertEquals(0, unit.getFirstWeek(date.plusDays(12)));
}
public void testGetFirstWeekDifferentMonth() throws Exception {
LocalDate date = LocalDate.parse("2014-08-01");
RangeUnit unit = new Month(date, date, date.plusDays(2), date.plusMonths(3));
assertEquals(0, unit.getFirstWeek(date.plusMonths(1).plusWeeks(1)));
}
public void testGetFirstEnabledNullMin() throws Exception {
LocalDate today = LocalDate.now();
RangeUnit unit = new Week(today, today, null, null);
assertEquals(today.withDayOfWeek(DateTimeConstants.MONDAY), unit.getFirstEnabled());
}
public void testGetFirstEnabledBeforeMin() throws Exception {
LocalDate today = LocalDate.now();
RangeUnit unit = new Week(today, today, today.plusDays(1), null);
assertEquals(today.plusDays(1), unit.getFirstEnabled());
}
public void testGetFirstEnabled() throws Exception {
assertEquals(mRangeUnit.getFrom(), mRangeUnit.getFirstEnabled());
}
} | [
"solarblaz@gmail.com"
] | solarblaz@gmail.com |
45ed5f2c1e036419883578f6651cd810b3b121eb | f84fb055be9c17e36af7c2a73194ae20858d8a16 | /src/main/java/action/AddItemToCartAction.java | 7305e876d4ab52ec23ec22a6f1f3ee2ada96dce7 | [] | no_license | yylou15/code_review_test | 8c5ccd9eee2ff7f9a57ca6cb1d89f4349fbb00dd | 73b0e7510bf9e052d799de605d596e16304cd8c9 | refs/heads/master | 2022-12-25T00:08:04.506038 | 2020-03-22T04:18:44 | 2020-03-22T04:18:44 | 249,108,928 | 0 | 1 | null | 2022-12-16T04:56:24 | 2020-03-22T03:54:53 | Java | UTF-8 | Java | false | false | 1,493 | java | package action;
import domain.Cart;
import domain.Item;
import service.CatalogService;
import java.math.BigDecimal;
public class AddItemToCartAction extends AbstractAction {
private String workingItemId;
private Cart cart;
BigDecimal subTotal;
private CatalogService catalogService;
public String getWorkingItemId() {
return workingItemId;
}
public void setWorkingItemId(String workingItemId) {
this.workingItemId = workingItemId;
}
public Cart getCart() {
return cart;
}
public void setCart(Cart cart) {
this.cart = cart;
}
public BigDecimal getSubTotal() {
return subTotal;
}
public void setSubTotal(BigDecimal subTotal) {
this.subTotal = subTotal;
}
@Override
public String execute() throws Exception {
cart=(Cart) session.get("cart");
if(cart==null)
{
cart = new Cart();
}
if(cart.containsItemId(workingItemId))
{
cart.incrementQuantityByItemId(workingItemId);
}
else
{
catalogService = new CatalogService();
boolean isInStock = catalogService.isItemInStock(workingItemId);
Item item = catalogService.getItem(workingItemId);
cart.addItem(item,isInStock);
}
subTotal = cart.getSubTotal();
session.put("cart",cart);
session.put("subTotal",subTotal);
return SUCCESS;
}
}
| [
"geneve@csu.edu.cn"
] | geneve@csu.edu.cn |
87ca19daa7ca37bfa4fb53e64f5a9918427083d4 | d79f26b420cc5a90a137455cdec1fa6b048fb7ac | /src/main/java/com/spring_mvc_project/dao/EmployeeDao.java | 170eaed50b487488cfacd8b61a3b1a4590f7878f | [] | no_license | cypher3301/spring_mvc_hibernate_aop | bc1bb7e8f1a588047b623470b0e02ea9a923cade | 6add7ff15f10a78f8c1e83ab1357098914df5db1 | refs/heads/master | 2023-07-13T10:37:30.129948 | 2021-08-20T06:36:51 | 2021-08-20T06:36:51 | 398,179,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.spring_mvc_project.dao;
import com.spring_mvc_project.entity.Employee;
import java.util.List;
public interface EmployeeDao {
public List<Employee> getAllEmployee();
public void saveEmployee(Employee employee);
public Employee getEmployeeById(int id);
public void deleteEmployeeById(int id);
}
| [
"cypher.is.3301@gmail.com"
] | cypher.is.3301@gmail.com |
b5a634a56ff77d1f8ffb61f7d2d18ede8d90e323 | 93fe77dfa29bf8bbb0f2c949b4fe9413e1e3d0a2 | /src/main/java/guru/springframework/services/PrimarySpanishGreetingService.java | 21ebbada3d2a0f7ddcd83e694d857ea914755a75 | [] | no_license | praveen-vp/spring-guru-di-assignment | eb84446062bc04744fe34ff5e5039f997dd165b6 | a978294b68cbbe21b29d18dbf2df453832ae1f54 | refs/heads/master | 2020-03-22T14:31:47.807631 | 2018-07-08T17:15:29 | 2018-07-08T17:15:29 | 140,186,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package guru.springframework.services;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
/**
* Created by jt on 5/24/17.
*/
@Service
@Profile("es")
@Primary
public class PrimarySpanishGreetingService implements GreetingService {
private GreetingRepository greetingRepository;
public PrimarySpanishGreetingService(GreetingRepository greetingRepository) {
this.greetingRepository = greetingRepository;
}
@Override
public String sayGreeting() {
return greetingRepository.getSpanishGreeting();
}
}
| [
"praveen_v.p@outlook.com"
] | praveen_v.p@outlook.com |
a1d51ea48f2c0fda3e8f5d741b6c1136b6a2a5bb | f0a70753f3e140ababb39848083905541e456fb4 | /src/com/class07/WhileLoopPractice.java | 78b64068e35e7fd85e558949e657dcfeb50f6c1c | [] | no_license | nslhnbysl/JavaClasses | a5e78fad74220c6ddc3a361983dec3fcc6e52c9b | 49f62bc8cc2949064af23e6ba6c5d37bec2a2148 | refs/heads/master | 2020-09-04T20:59:45.109124 | 2020-03-07T17:38:02 | 2020-03-07T17:38:02 | 219,890,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,752 | java | package com.class07;
public class WhileLoopPractice {
public static void main(String[] args) {
//how to print numbers from 1 to 20
// int i=1;
// while(i<=10) {
// System.out.println(i);
// i++;
// }
//
// //i want to print numbers from 10 to 30 all in 1 line
//
// int y=10;
// while(y<=30) {
// System.out.print(y+ " " );
// y++;
// }
// System.out.println("_________________");
// //how to print values 10 to 1;
//
// int a=10;
// while(a>=1) {
// System.out.println(a);
// a--;
// }
// System.out.println("____________________");
// //print values from50 to 20
//
// int b=50;
// while(b>=20) {
// System.out.println(b);
// b--;
// }
// System.out.println("____________");
// //I want to print all even numbers from 1 to 20
// //1 way-increment value by 2
// int z=2;
// while(z<=20) {
// System.out.println(z);
// z+=2;
// }
// System.out.println("_____________-");
// //2 way using modulus
// int q=1;
// while(q<=20) {
// if(q%2==0) {
// System.out.println(q);
// }
// q++; // we should add this part in while loop because while loop it still running
// //if we write this part in if statement incrementation never happen
// //
//
// }
//print only odd number from 50 to 100
//print only even numbers from 100 to 1
int f=51; //int f=50;
while(f<=100) { //while(f<=100){
//if(f%2==1){
System.out.println(f); //System.out.print(f);
f+=2; //}f++;}
}
int h=100;
while(h>=1) {
System.out.println(h);
h-=2;
}
}
}
| [
"baysalneslihan@gmail.com"
] | baysalneslihan@gmail.com |
6f256c618e5f4047576a9854e0d1a3203d670e0f | 77d03f6c33c2967134d3d911f9c28f778a7fa773 | /app/src/main/java/com/kaur0183algonquincollege/doorsopenottawa/DetailActivity.java | 9f7a03a3fdf8b85c741f5e8cfeabe315e4ee3977 | [] | no_license | kaur0183/DoorsOpenOttawa | f4a45dd9359acdedc832c5d2cbb9440a41cf267c | baedce5b9c704fddaef6d4f33c7e49928d98c66a | refs/heads/master | 2020-06-26T20:09:28.388228 | 2016-12-14T06:39:56 | 2016-12-14T06:39:56 | 74,541,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,187 | java | package com.kaur0183algonquincollege.doorsopenottawa;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import java.util.List;
import java.util.Locale;
/**
* DetailActivity is showing all the details of particular building on which we click and also pin the location on the google maps.
*
* @author Prabhjot kaur (kaur0183@algonquinlive.com)
*/
public class DetailActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
private Geocoder mGeocoder;
private TextView buildingName;
private TextView buildingDescription;
private TextView buildingAddress;
private TextView buildingOpenHours;
private void pin(String locationName) {
try {
Address address = mGeocoder.getFromLocationName(locationName, 1).get(0);
LatLng ll = new LatLng(address.getLatitude(), address.getLongitude());
mMap.addMarker(new MarkerOptions().position(ll).title(locationName));
mMap.moveCamera(CameraUpdateFactory.newLatLng(ll));
Toast.makeText(this, "Pinned: " + locationName, Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Toast.makeText(this, "Not found: " + locationName, Toast.LENGTH_SHORT).show();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
buildingName = (TextView) findViewById(R.id.name);
buildingDescription = (TextView) findViewById(R.id.description);
buildingAddress = (TextView) findViewById(R.id.address);
buildingOpenHours = (TextView) findViewById(R.id.openhrs);
Bundle bundle = getIntent().getExtras();
buildingName.setText(bundle.getString("buildingname"));
buildingAddress.setText(bundle.getString("buildingaddress"));
buildingDescription.setText(bundle.getString("buildingdescription"));
List<String> temp = bundle.getStringArrayList("buildingopenhrs");
StringBuilder mtempBuilder = new StringBuilder();
for (int i = 0; i < temp.size(); i++) {
mtempBuilder.append(temp.get(i) + "\n");
}
buildingOpenHours.setText(mtempBuilder.toString());
mGeocoder = new Geocoder(this, Locale.CANADA);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
pin(buildingAddress.getText().toString());
}
}
| [
"kaue0183@algonquinlive.com"
] | kaue0183@algonquinlive.com |
d5ffe2dacae1631b26c61d3fd3f25e8f27dd068e | e33fe8b34e700f7718bdda28990f173f2f25650d | /02/Kakezan.java | 856941c262bc8e55e2eda68897cbbeb81fd19c36 | [] | no_license | pe-to/java-programming-lesson | 8584a48662a35c5fe2e3dec4de59b5957563cddc | d30b0a6bb70e5f0a4bb1c4d23c89c478ca49a231 | refs/heads/master | 2020-04-26T08:36:56.397207 | 2019-03-02T11:44:03 | 2019-03-02T11:44:03 | 173,428,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 565 | java | public class Kakezan {
public static void main(String[] args) {
System.out.println("0 × 0=" + (0 * 0));
System.out.println("1 × 1=" + (1 * 1));
System.out.println("2 × 2=" + (2 * 2));
System.out.println("3 × 3=" + (3 * 3));
System.out.println("4 × 4=" + (4 * 4));
System.out.println("5 × 5=" + (5 * 5));
System.out.println("6 × 6=" + (6 * 6));
System.out.println("7 × 7=" + (7 * 7));
System.out.println("8 × 8=" + (8 * 8));
System.out.println("9 × 9=" + (9 * 9));
}
} | [
"taku.star.ring.child@gmail.com"
] | taku.star.ring.child@gmail.com |
a02316f0dc095a15c7fa7f7b47dbd9ca3f79621c | e4b214afb2368396cc12559ef8e781ff82987475 | /src/main/java/com/stackoverflow/sbvalueinject/SpringComponentImpl.java | 372fdaab02adfed3e2713adb7d39ba77261d4257 | [] | no_license | inchestnovstackoverflow/sb-value-inject | aa9c716740380496db7e477ee2f1bf318701bd64 | cee8f6c3b9797191fed667a22a68d15d82d9c85d | refs/heads/master | 2023-05-07T01:05:10.339540 | 2021-05-23T07:04:41 | 2021-05-23T07:04:41 | 369,980,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package com.stackoverflow.sbvalueinject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
@Component
public class SpringComponentImpl implements SpringComponent {
@Value("${injected.value}")
private String injectedValue;
@Override
public String getInjectedValue() {
if (!StringUtils.hasText(injectedValue))
throw new IllegalStateException("Actual rounding strategy undefined");
return injectedValue;
}
}
| [
"chestnov@haulmont.com"
] | chestnov@haulmont.com |
2d92a70dbc7fbc2334738f7a19a7fdc63c1ed57e | c1fe831bfbb943a3573a2d65a67ed164891e6fd6 | /FinalSystem/src/java/Controller/GeneratePoliticalPartyReport.java | 5b37e505162405b0bdd47bd1d92924c1692030e2 | [] | no_license | EvotingGit/System | 5b3500f50a7a2825eca63917bea7970c87b253d0 | 1d0d6b8b0c029f53ead3f75c8971d7e0f1a96cfc | refs/heads/master | 2016-08-08T15:52:20.936823 | 2013-07-19T15:42:44 | 2013-07-19T15:42:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,067 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Controller;
import Model.ElectionPartyReg;
import Model.PoliticalPartyRpts;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
*
* @author User
*/
@WebServlet(name = "GeneratePoliticalPartyReport", urlPatterns = {"/GeneratePoliticalPartyReport"})
public class GeneratePoliticalPartyReport extends HttpServlet {
/**
* Processes requests for both HTTP
* <code>GET</code> and
* <code>POST</code> methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
PoliticalPartyRpts poliPartyRpt=new PoliticalPartyRpts();
try {
if(request.getParameter("hiidenbtn")!=null)
{
request.getRequestDispatcher("politicalparydetailRpt.jsp").forward(request, response);
response.sendRedirect("politicalparydetailRpt.jsp");
}
if(request.getParameter("btngnerate")!=null)
{
HttpSession session=request.getSession(true);
boolean reprt=false;
String Poli_partyId = request.getParameter("partyId");
if(Poli_partyId!=null)
{
reprt= poliPartyRpt.GenrateSeatDetails(Poli_partyId);
if(reprt==true)
{
session.setAttribute("report", "Sucess");
response.sendRedirect("../FinalSystem/JspPages/politicalparydetailRpt.jsp");
}
else
{
session.setAttribute("report", "Error");
response.sendRedirect("../FinalSystem/JspPages/politicalparydetailRpt.jsp");
}
}
}
}catch(Exception ex)
{
ex.toString();
}
finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP
* <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP
* <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"cnalinhudson@yahoo.com"
] | cnalinhudson@yahoo.com |
06583300e6d2cd133d7318a0d472e4ed79b1628d | f83f02b7073419251ac135bdb5893f6d0b20e64a | /workspace/POM/src/test/encapsulation/test.java | dfaea6de432c8397598208dc6e858be08f9ce06f | [] | no_license | sheel2006/Mylearning | e9aebdb470bb3b0117807b4d4a8d57ff601c1402 | b5a00623e48f4a4495ddb8fe362ac685cdb51bf7 | refs/heads/master | 2020-03-12T06:25:36.721299 | 2018-04-22T06:17:49 | 2018-04-22T06:17:49 | 130,484,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package test.encapsulation;
public class test {
public static void main(String[] args) {
Room r = new Room();
r.space=100;
School s = new School(r);
s.teach();
System.out.println(s.r.getspace());
}
}
| [
"sheel2006@gmail.com"
] | sheel2006@gmail.com |
34878b8a77bd9deebc5f82c94f276de5d6e4a540 | a875bcbce08766672d3051584b5374913c867f89 | /intro_to_enums/src/practice/Hobby.java | cf2b5f7ad4d0698985cba2e22883a656e0674c33 | [] | no_license | joshbarcher/SDEV220_fall2020 | 20f23e197231183676aea564c1c737af54234ec4 | b72abaa05036bdb8256c56406f36cc1bf6d44136 | refs/heads/master | 2023-01-25T01:07:55.256227 | 2020-12-04T19:01:29 | 2020-12-04T19:01:29 | 290,044,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 138 | java | package practice;
public enum Hobby
{
BOXING,
YOGA,
GAMING,
ROCK_CLIMBING,
VIDEO_EDITING,
PAINTING,
FLYING
}
| [
"jarcher@greenriver.edu"
] | jarcher@greenriver.edu |
292f3e6bb453c9a9ef33695b269652e024dc2cad | b11ffda0f975b32b029455a13f8805fbe49c8bdb | /BrndBot/src/java/pojos/TblBrandPersonality.java | 8415a837a10401b18d92811257d745d4bf5f996f | [] | no_license | SyedAkmalAtIntBitTech/AkmalJenkins | bbb75833f678f98dd6c2f2bdbb661f51d39bf3a0 | 13f639142ffec2f22a95fd94956ba4dabfe0fc83 | refs/heads/master | 2020-07-23T22:59:49.039283 | 2015-10-08T07:40:04 | 2015-10-08T07:40:04 | 73,801,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,912 | java | package pojos;
// Generated May 28, 2015 12:35:50 PM by Hibernate Tools 4.3.1
import java.util.HashSet;
import java.util.Set;
/**
* TblBrandPersonality generated by hbm2java
*/
public class TblBrandPersonality implements java.io.Serializable {
private int id;
private TblBrandFontFamily tblBrandFontFamily;
private String brandName;
private Integer lookId;
private Set tblUserPreferenceses = new HashSet(0);
public TblBrandPersonality() {
}
public TblBrandPersonality(TblBrandFontFamily tblBrandFontFamily, String brandName) {
this.tblBrandFontFamily = tblBrandFontFamily;
this.brandName = brandName;
}
public TblBrandPersonality(TblBrandFontFamily tblBrandFontFamily, String brandName, Integer lookId, Set tblUserPreferenceses) {
this.tblBrandFontFamily = tblBrandFontFamily;
this.brandName = brandName;
this.lookId = lookId;
this.tblUserPreferenceses = tblUserPreferenceses;
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
public TblBrandFontFamily getTblBrandFontFamily() {
return this.tblBrandFontFamily;
}
public void setTblBrandFontFamily(TblBrandFontFamily tblBrandFontFamily) {
this.tblBrandFontFamily = tblBrandFontFamily;
}
public String getBrandName() {
return this.brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public Integer getLookId() {
return this.lookId;
}
public void setLookId(Integer lookId) {
this.lookId = lookId;
}
public Set getTblUserPreferenceses() {
return this.tblUserPreferenceses;
}
public void setTblUserPreferenceses(Set tblUserPreferenceses) {
this.tblUserPreferenceses = tblUserPreferenceses;
}
}
| [
"syed.muzamil@intbittech.com"
] | syed.muzamil@intbittech.com |
af5dcc3eddc9913bc4fac5691795f5ff535f4806 | 0497e2da47d5da60f4007aea939463d01ba03601 | /src/koneksi/koneksi.java | d8b64b5e4545f5933ddb566f30a1f927f2d72c2b | [] | no_license | Lnyx00/CobaKary | e28e5e32ef0bee56dc6fd3b34aa3f7536c1f43b4 | de376724f49ecdd649553a79f994177e6f9f700a | refs/heads/master | 2020-08-04T07:53:51.282345 | 2019-10-01T13:21:58 | 2019-10-01T13:21:58 | 212,063,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 936 | 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 koneksi;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author ilham
*/
public class koneksi {
private Connection koneksi;
public Connection connect(){
try{
Class.forName("com.mysql.jdbc.Driver");
// System.out.println("i");
}catch(ClassNotFoundException ex){
System.out.println("Gagal Koneksi "+ex);
}
String url = "jdbc:mysql://localhost:3306/ilhamariy_penerimaankaryawan";
try{
koneksi = DriverManager.getConnection(url,"ilhamari_root","J}w*dH^?[CFp");
System.out.println("koneksi tersambung");
}catch(SQLException ex){
System.out.println("Gagal Koneksi Database "+ex);
}
return koneksi;
}
}
| [
"ilhamariyanda28@gmail.com"
] | ilhamariyanda28@gmail.com |
2abcadc831600348bb9636c02d029870e26f9563 | 25d349681156dc583ce5ed01a0c3a3f447b37387 | /5-4-RegularExpressions/src/Digraph.java | 388a0a5295839af8ed10a3bb17435cd06ca087ea | [] | no_license | fushaoqing/Algorithms4 | 038e2ea626d1424887bb2f2274ddc7c346eddcf8 | 9b1b86a4d0ded73325303c9522647d178804ebb0 | refs/heads/master | 2021-01-13T14:31:03.640407 | 2017-01-12T07:32:59 | 2017-01-12T07:32:59 | 72,849,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | import edu.princeton.cs.algs4.Alphabet;
import edu.princeton.cs.algs4.Bag;
import edu.princeton.cs.algs4.In;
public class Digraph {
private int V;
private int E;
private Bag<Integer>[] adj;
public Digraph(int V){
this.V=V;
this.E=0;
adj=(Bag<Integer>[])new Bag[V];
for(int v=0;v<V;v++)
adj[v]=new Bag<Integer>();
}
public Digraph(In in){
this(in.readInt());
int E=in.readInt();
for(int i=0;i<E;i++){
int v=in.readInt();
int w=in.readInt();
addEdge(v,w);
}
}
public void addEdge(int v,int w){
adj[v].add(w);//单向添加
this.E++;
}
public int V(){
return V;
}
public int E(){
return E;
}
public Iterable<Integer> adj(int v){
return adj[v];
}
public Digraph reverse(){
Digraph d=new Digraph(V);
for(int v=0;v<V;v++)
for(int w:adj(v)){
d.addEdge(w,v);//反向添加到反图中
}
return d;
}
public String toString(){
String s=V+" vertices "+E+" edges\n";
for(int v=0;v<V;v++){
s+=v+": ";//打印顶点
for(int w:this.adj(v))
s+=w+" ";//打印与顶点相邻的点
s+="\n";
}
return s;
}
public static void main(String[] args) {
Digraph d=new Digraph(new In(args[0]));
System.out.print(d);
}
}
| [
"541718406@qq.com"
] | 541718406@qq.com |
f2c77d5203ffa7fba7a137d47f19870e6d03abd9 | d6138989f05b178c9a2300f60955697c80529fbd | /Demo/mylibrary/src/main/java/com/china/bosh/mylibrary/db/MigrationHelper.java | e1dabbe7851c1fc74ece9d86e439d4493bc39418 | [
"Apache-2.0"
] | permissive | chinabosh/androiddemo | f82d7e84bb39ed17ce2e93d0ce4218e89ae347fb | e314891d2ee30507837e0992a9fcb631b6589b28 | refs/heads/master | 2022-06-22T10:00:16.637592 | 2022-06-14T08:50:47 | 2022-06-14T08:50:47 | 139,726,747 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,272 | java | package com.china.bosh.mylibrary.db;
import android.database.Cursor;
import android.text.TextUtils;
import android.util.Log;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.internal.DaoConfig;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 数据库升级
*
* @author lzq
* @date 2019/4/28
*/
public class MigrationHelper {
private static final String CONVERSION_CLASS_NOT_FOUND_EXCEPTION = "MIGRATION HELPER - CLASS DOESN'T MATCH WITH THE CURRENT PARAMETERS";
private static MigrationHelper instance;
public static MigrationHelper getInstance() {
if (instance == null) {
instance = new MigrationHelper();
}
return instance;
}
public void migrate(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) {
generateTempTables(db, daoClasses);
DaoMaster.dropAllTables(db, true);
DaoMaster.createAllTables(db, false);
restoreData(db, daoClasses);
}
/**
* 生成临时列表
*
* @param db
* @param daoClasses
*/
private void generateTempTables(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) {
for (int i = 0; i < daoClasses.length; i++) {
DaoConfig daoConfig = new DaoConfig(db, daoClasses[i]);
String divider = "";
String tableName = daoConfig.tablename;
String tempTableName = daoConfig.tablename.concat("_TEMP");
ArrayList<String> properties = new ArrayList<>();
StringBuilder createTableStringBuilder = new StringBuilder();
createTableStringBuilder.append("CREATE TABLE ").append(tempTableName).append(" (");
for (int j = 0; j < daoConfig.properties.length; j++) {
String columnName = daoConfig.properties[j].columnName;
if (getColumns(db, tableName).contains(columnName)) {
properties.add(columnName);
String type = null;
try {
type = getTypeByClass(daoConfig.properties[j].type);
} catch (Exception exception) {
exception.printStackTrace();
}
createTableStringBuilder.append(divider).append(columnName).append(" ").append(type);
if (daoConfig.properties[j].primaryKey) {
createTableStringBuilder.append(" PRIMARY KEY");
}
divider = ",";
}
}
createTableStringBuilder.append(");");
db.execSQL(createTableStringBuilder.toString());
StringBuilder insertTableStringBuilder = new StringBuilder();
insertTableStringBuilder.append("INSERT INTO ").append(tempTableName).append(" (");
insertTableStringBuilder.append(TextUtils.join(",", properties));
insertTableStringBuilder.append(") SELECT ");
insertTableStringBuilder.append(TextUtils.join(",", properties));
insertTableStringBuilder.append(" FROM ").append(tableName).append(";");
db.execSQL(insertTableStringBuilder.toString());
}
}
/**
* 存储新的数据库表 以及数据
*
* @param db
* @param daoClasses
*/
private void restoreData(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) {
for (int i = 0; i < daoClasses.length; i++) {
DaoConfig daoConfig = new DaoConfig(db, daoClasses[i]);
String tableName = daoConfig.tablename;
String tempTableName = daoConfig.tablename.concat("_TEMP");
ArrayList<String> properties = new ArrayList();
for (int j = 0; j < daoConfig.properties.length; j++) {
String columnName = daoConfig.properties[j].columnName;
if (getColumns(db, tempTableName).contains(columnName)) {
properties.add(columnName);
} else {
StringBuilder addColumnBuilder = new StringBuilder();
addColumnBuilder.append("ALTER TABLE ")
.append(tempTableName)
.append(" ADD COLUMN ")
.append(columnName)
.append(getTableType(daoConfig.properties[j].type));
db.execSQL(addColumnBuilder.toString());
properties.add(columnName);
}
}
StringBuilder insertTableStringBuilder = new StringBuilder();
insertTableStringBuilder.append("INSERT INTO ").append(tableName).append(" (");
insertTableStringBuilder.append(TextUtils.join(",", properties));
insertTableStringBuilder.append(") SELECT ");
insertTableStringBuilder.append(TextUtils.join(",", properties));
insertTableStringBuilder.append(" FROM ").append(tempTableName).append(";");
StringBuilder dropTableStringBuilder = new StringBuilder();
dropTableStringBuilder.append("DROP TABLE ").append(tempTableName);
db.execSQL(insertTableStringBuilder.toString());
db.execSQL(dropTableStringBuilder.toString());
}
}
private static Object getTableType(Class<?> type) {
if (type.equals(int.class)) {
return " INTEGER DEFAULT 0";
}
if (type.equals(long.class)) {
return " Long DEFAULT 0";
}
if (type.equals(String.class)) {
return " TEXT ";
}
if (type.equals(boolean.class)) {
return " NUMERIC DEFAULT 0";
}
return " TEXT";
}
private String getTypeByClass(Class<?> type) throws Exception {
if (type.equals(String.class)) {
return "TEXT";
}
if (type.equals(Long.class) || type.equals(Integer.class) || type.equals(long.class) || type.equals(int.class)) {
return "INTEGER";
}
if (type.equals(Boolean.class) || type.equals(boolean.class)) {
return "BOOLEAN";
}
if (type.equals(double.class) || type.equals(Double.class)) {
return "DOUBLE";
}
if (type.equals(float.class) || type.equals(Float.class)) {
return "REAL";
}
Exception exception = new Exception(CONVERSION_CLASS_NOT_FOUND_EXCEPTION.concat(" - Class: ").concat(type.toString()));
exception.printStackTrace();
throw exception;
}
private List<String> getColumns(Database db, String tableName) {
List<String> columns = new ArrayList<>();
Cursor cursor = null;
try {
cursor = db.rawQuery("SELECT * FROM " + tableName + " limit 1", null);
if (cursor != null) {
columns = new ArrayList<>(Arrays.asList(cursor.getColumnNames()));
}
} catch (Exception e) {
Log.v(tableName, e.getMessage(), e);
e.printStackTrace();
} finally {
if (cursor != null) {
cursor.close();
}
}
return columns;
}
}
| [
"810916259@qq.com"
] | 810916259@qq.com |
78124ca1db792a78bfaca9b1f9ebac4e79ddbb1d | 4cbb87a3825d43948e61cf27c6654a325aa30d59 | /src/In.java | e9615b1930a015ccbbca34a4d5c060fe17d59a49 | [] | no_license | dat09loz/UTS-Library-System-CLI | 8b0037b33d0c54a62aaedfb026d7a3a8c2f407c2 | 81c3d33e3e7945195378b56ee536ff0c57a85c6a | refs/heads/main | 2023-01-31T08:09:58.008860 | 2020-12-17T04:19:13 | 2020-12-17T04:19:13 | 309,892,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,647 | java | package src;
import java.util.*;
/**
* This class provides static methods for easily reading
* input from STDIN:
*
* nextLine reads a string
* nextInt reads an integer
* nextDouble reads a double
* nextChar reads a character
*
* All methods consume the end-of-line character.
*/
public class In {
/**
* A singleton instance of Scanner used for reading all input
* from STDIN.
*/
private static final Scanner scanner = new Scanner(System.in);
/**
* The constructor is private because no instances of this
* class should be created. All methods are static and can
* be directly invoked on the class itself.
*/
private In() {}
/**
* Read the next line of text.
*
* @return the line as a String
*/
public static String nextLine() {
return scanner.nextLine();
}
/**
* Read the next line as an integer.
*
* @return the integer that was read
*/
public static int nextInt() {
int value = scanner.nextInt();
scanner.nextLine(); // read the "\n" as well
return value;
}
/**
* Read the next line as a double.
*
* @return the double that was read
*/
public static double nextDouble() {
double value = scanner.nextDouble();
scanner.nextLine();
return value;
}
/**
* Read the first character of the next line of text.
*
* @return the character that was read
*/
public static char nextChar() {
return scanner.nextLine().charAt(0);
}
} | [
"isaacnguyen1308@gmail.com"
] | isaacnguyen1308@gmail.com |
f1a9ea26af1e604113e43499ca080e460fd3e038 | 2113dfc9701c2037bee87fbc589322c0c55001ec | /src/graph/packing/SetWeightEvalFunction.java | 382bdb6dc743d6038079ff402ea4f46a4f794915 | [] | no_license | ioannischristou/popt4jlib | e129915f518d7c0638b2cc751487294b42684dcb | f03dbfb91acbc3e9a9aba9bed48e062d60cd84b8 | refs/heads/master | 2023-07-06T14:04:16.697709 | 2023-07-04T12:43:21 | 2023-07-04T12:43:21 | 23,873,414 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,762 | java | package graph.packing;
import graph.*;
import popt4jlib.FunctionIntf;
import java.util.*;
/**
* Evaluates the total weight of the nodes whose ids are in the set-argument and
* returns its negative.
* <p>Title: popt4jlib</p>
* <p>Description: A Parallel Meta-Heuristic Optimization Library in Java</p>
* <p>Copyright: Copyright (c) 2011</p>
* <p>Company: </p>
* @author Ioannis T. Christou
* @version 1.0
*/
public class SetWeightEvalFunction implements FunctionIntf {
private Graph _g;
/**
* sole public constructor
* @param g Graph
*/
public SetWeightEvalFunction(Graph g) {
_g = g;
}
/**
* return minus the total weight of the nodes whose ids are in the set-valued
* argument.
* @param arg Object // Set<Integer node-id>
* @param params HashMap may contain the name of the weight to compute,
* in a ("weightname",name) key-pair, else the default "value" string will be
* used.
* @throws IllegalArgumentException if arg is not a Set.
* @return double
*/
public double eval(Object arg, HashMap params) throws IllegalArgumentException {
try {
double w = 0.0;
Set s = (Set) arg;
Iterator it = s.iterator();
while (it.hasNext()) {
Integer id = (Integer) it.next();
String name = "value";
if (params!=null) {
String n = (String) params.get("weightname");
if (n!=null) name = n;
}
Double nwD = _g.getNode(id.intValue()).getWeightValue(name);
if (nwD==null && name.length()==0) w+=1.0;
else if (nwD!=null) w += nwD.doubleValue();
}
return -w;
}
catch (ClassCastException e) {
throw new IllegalArgumentException("arg must be a Set<Integer>");
}
}
}
| [
"ichr@ait.edu.gr"
] | ichr@ait.edu.gr |
71bda488343f03710975edaa8d59f91e40eabd48 | 4370bee8031f26959c4454bd1a8c3879f50851f2 | /src/test/java/cn/bugging/work/AppTest.java | 0e8368d2d0eeaa5369d8671a804aafb236cfbb82 | [] | no_license | JQPlus/work | b5f900c7f38b0c0af00b7666fe5e186b2a1efdcd | f4f3f705b32993009f760668ea46b54c8c6733bd | refs/heads/master | 2022-07-04T08:08:32.375180 | 2019-05-22T06:35:58 | 2019-05-22T06:35:58 | 178,368,748 | 0 | 0 | null | 2022-06-17T02:08:16 | 2019-03-29T08:54:21 | Java | UTF-8 | Java | false | false | 681 | java | package cn.bugging.work;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"543796673@qq.com"
] | 543796673@qq.com |
ed78b125884c24ec94a935cbb4655a0d1f85f402 | fa7b7d601f40df97d62286be87b0f398d92cd100 | /3.JavaMultithreading/src/com/javarush/task/task21/task2105/Solution.java | 80a59d835a5f16499209ba27137ead6b538061fc | [] | no_license | knastnt/JavaRushTasks | 4b2a7747a3c70a734d5f4285be8e66b1637fa725 | 80f1259cc7c2c170970d0c1b4d2431804c65febb | refs/heads/master | 2022-06-13T08:40:55.370767 | 2018-11-19T22:40:57 | 2018-11-19T22:40:57 | 122,807,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,267 | java | package com.javarush.task.task21.task2105;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
/*
Исправить ошибку. Сравнение объектов
*/
public class Solution {
private final String first, last;
public Solution(String first, String last) {
this.first = first;
this.last = last;
}
/*public boolean equals(Object o) {
if (!(o instanceof Solution)) return false;
Solution n = (Solution) o;
return n.first.equals(first) && n.last.equals(last);
}*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if(o instanceof Solution) {
Solution solution = (Solution) o;
return Objects.equals(first, solution.first) &&
Objects.equals(last, solution.last);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(first, last);
}
public static void main(String[] args) {
Set<Solution> s = new HashSet<>();
s.add(new Solution("Mickey", "Mouse"));
System.out.println(s.contains(new Solution("Mickey", "Mouse")));
}
}
| [
"456kot@mail.ru"
] | 456kot@mail.ru |
308f988d7307fcc34b513c1188e08e81c6633ff6 | 72d81fb95970cc0af63375ee7e40924313ca2faf | /Assignment_Data_Driven_Testing_and_Using_the_Page_Object_Model_LinhVTT2/src/test/java/com/fpt/assignment2/excercise1/FirstTest.java | 0422d87ba8a3141a7f2ded1257a9311cae87d642 | [] | no_license | thuylinhvt/HN19_FR_AT_01 | 58c554d6ba38c4938c5029c1e9683b112b762bb3 | 295f977080bfa18f090b9d63d368f92c55cd1b76 | refs/heads/master | 2020-04-29T04:28:13.186940 | 2019-04-10T03:00:32 | 2019-04-10T03:00:32 | 175,847,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,138 | java | package com.fpt.assignment2.excercise1;
import static org.testng.Assert.assertEquals;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.fpt.assignment2.excercise1.services.AddToCartConfirmPage;
import com.fpt.assignment2.excercise1.services.HomePage;
import com.fpt.assignment2.excercise1.services.NavigationMenu;
import com.fpt.assignment2.excercise1.services.ProductDetailPage;
import com.fpt.assignment2.excercise1.services.SearchResultPage;
import com.fpt.assignment2.excercise1.utils.ExcelUtils;
public class FirstTest {
private WebDriver driver;
@BeforeMethod
public void setup() {
System.setProperty("webdriver.chrome.driver", "chromedriver");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.navigate().to("http://automationpractice.com/index.php");
}
@Test(dataProvider="dataTest")
public void Test(String testcaseid, String productTitle, String priceProduct) throws InterruptedException {
HomePage homePage = new HomePage(driver);
NavigationMenu navigationMenu = homePage.naMenu();
SearchResultPage searchResultPage = navigationMenu.searchFor(productTitle);
ProductDetailPage productDetailPage = searchResultPage.clickProductTitle();
//Verify that product title is correct
assertEquals(productDetailPage.getProductTitle(), productTitle);
//Verify that product price is correct
String actualPrice = productDetailPage.getProductPrice();
assertEquals(actualPrice, priceProduct);
//Verify confirmation test appears: “1 item added to Cart”
AddToCartConfirmPage addToCartConfirmPage = productDetailPage.addToCart();
assertEquals(addToCartConfirmPage.getConfirmText(), "There is 1 item in your cart.");
}
@DataProvider
public Object[][] dataTest() throws Exception{
return ExcelUtils.readFile();
}
@AfterMethod
public void teardown() {
driver.quit();
}
}
| [
"bvh165@gmail.com"
] | bvh165@gmail.com |
4d685227ffa25197885f358512daad20a43c349a | 6a2c80223e33a7f0e6c1aeb4479e1982d80b5468 | /src/main/java/com/springboot/blog/controller/LoginController.java | 7a48b441de9027d619abd827e0f08a953c07c6f4 | [] | no_license | manish11414/BlogApplication | 98779ebcac3b23c9917bd19af923aa5dba44ddf8 | f0751c2cb87d5e1ee072e97d88ffdc08b2427183 | refs/heads/master | 2023-03-31T17:00:25.286354 | 2021-03-28T18:14:33 | 2021-03-28T18:15:12 | 352,405,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package com.springboot.blog.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class LoginController {
@GetMapping("/login")
public String login() {
return "login";
}
@GetMapping("/")
public String home() {
return "index";
}
}
| [
"manish.kumar@mountblue.tech"
] | manish.kumar@mountblue.tech |
40422a9cd81bd0e7dd3a5bb0708b50abaac53017 | 1dd4ceca9cee9c9c53f7aa9dc0838ee793c2368c | /src/org/araneaframework/Environment.java | 9feac6d092f78c9246f06d047321b7d59e3f00ad | [
"Apache-2.0"
] | permissive | alarkvell/araneaframework | 8609eff61e502ea170452fbef964d174e995c814 | f2f7f41d7d5ad193e46dfb57816d584dcaab774d | refs/heads/master | 2021-05-26T21:19:25.958151 | 2006-03-29T05:48:44 | 2006-03-29T05:48:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,692 | java | /**
* Copyright 2006 Webmedia Group Ltd.
*
* 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.araneaframework;
import java.io.Serializable;
import org.araneaframework.core.NoSuchEnvironmentEntryException;
/**
* A special data structure providing encapsulation of data needed by different components.
* Every Aranea component has an environment. The environment can be inhereted from the parent
* or be standalone. No component knows from which component the Environment comes from.
* <br><br>
* Component does know about the hooks in the environment. As different contexts are added to
* the environment the component in need of them is reponsible of checking them and acting upon
* them.
*
* @author "Toomas Römer" <toomas@webmedia.ee>
* @author Jevgeni Kabanov (ekabanov@webmedia.ee)
*/
public interface Environment extends Serializable {
/**
* Returns the entry with the specified key from this Environment.
*/
public Object getEntry(Object key);
/**
* Does the same as {@link #getEntry(Object)}, but throws a {@link NoSuchEnvironmentEntryException} if
* entry cannot be found.
*/
public Object requireEntry(Object key);
}
| [
"Jevgeni.Kabanov@webmedia.eu"
] | Jevgeni.Kabanov@webmedia.eu |
4d498b9564698826d6e27026994f63ef1fb2a2aa | 0cdf40131d2c5a2286b728e7fafd3c6664045ae3 | /app/src/main/java/com/jeffysmak/Wallpapers/splash.java | d025517ef13ea9d27b91c4f734b31a1739306759 | [] | no_license | freelance-Androider/DullWalpaper | e0b6638f961017c40ef7c9244de9a4fdd720bcb9 | d9bffa6adc31847ebb240e6dbef0ced8988b4565 | refs/heads/master | 2020-03-23T19:54:02.527145 | 2018-07-23T12:09:32 | 2018-07-23T12:09:32 | 142,009,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 909 | java | package com.jeffysmak.Wallpapers;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class splash extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_splash);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity();
}
}, 2000);
}
private void startActivity() {
startActivity(new Intent(this,Home.class));
finish();
}
}
| [
"jeffy.smak.jhonny@gmail.com"
] | jeffy.smak.jhonny@gmail.com |
ef899089d0f0e3af7176626ae08f598ce9d6b594 | b9dedab4687106a18eede86dc9906ebdcac8e73c | /forms/formResetPassword.java | 0ef2cb6e4643a8ddf6e06bddf0ae9ec18cb44170 | [] | no_license | tcaopendata/hackforlocal | 74b8d3bf8fa5a6d83654fbde2668ca28897237fb | 9521be1276591ab8ee0fb4fb598a04952194ac69 | refs/heads/master | 2021-01-01T06:08:44.679577 | 2017-07-16T07:09:54 | 2017-07-16T07:09:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 639 | java | package forms;
/**
* Created by Saber on 2016/3/7.
*/
public class formResetPassword {
protected String password;
protected String email;
protected String token;
public void setPassword(String password) {
this.password = password;
}
public String getPassword() {
return password;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public void setToken(String token) {
this.token = token;
}
public String getToken() {
return token;
}
}
| [
"wenfahuang@iii.org.tw"
] | wenfahuang@iii.org.tw |
0dac0825f34f70ecd1076d5e2b435d223ab2a327 | 7a672b195e81f7ab27d624ae3131b41bdd2e2836 | /mybatis1114/src/com/yitian/mybatis/util/MybatisUtil.java | 4a8b6f96a34ec1b7009bb6860cf3de7a5dd7d563 | [] | no_license | ludonghua1/git | 3644f5309176333e545e3b4692c10cc02df8f418 | 0b7b3c6356f81f52969662dfdd4887879670aafc | refs/heads/master | 2020-04-16T23:17:45.880004 | 2019-01-16T12:26:28 | 2019-01-16T12:26:28 | 165,986,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | package com.yitian.mybatis.util;
import java.io.IOException;
import java.io.InputStream;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
public class MybatisUtil {
private static SqlSessionFactory factory;
static {
InputStream in;
try {
in = Resources.getResourceAsStream("mybatis.xml");
factory=new SqlSessionFactoryBuilder().build(in);
} catch (IOException e) {
e.printStackTrace();
}
}
public static SqlSessionFactory getFactory() {
return factory;
}
}
| [
"46676971+ludonghua1@users.noreply.github.com"
] | 46676971+ludonghua1@users.noreply.github.com |
99e75d72dbfd4df29a3b11aa8ed305892c2a91ce | 33f800cf0ef06fbeb67e2aeba8171e26ec048a9c | /app/src/test/java/com/example/kulinerkotasemarang/ExampleUnitTest.java | fd729d249c46525dfc03b550237315ec85e0972a | [] | no_license | arya25092000/kuliner-semarang | d44e616a93230c1381a297357e4fef21fbcda25c | 0bc4a90cb728516bd64726769f514554b0fc3078 | refs/heads/main | 2023-08-11T20:09:20.723711 | 2021-09-26T15:18:36 | 2021-09-26T15:18:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.example.kulinerkotasemarang;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"1111912342@mhs.dinus.ac.id"
] | 1111912342@mhs.dinus.ac.id |
4a7c02627838e9c71f5c54e23162838f9e5cb970 | 5709f86bebeabb1e3987cc22eaf580d0ea4afd23 | /src/main/java/de/arraying/lumberjack/LFsRules.java | 97394d0ece83d418dec9c3d2c3252ce089afcb96 | [] | no_license | Arraying/Lumberjack | 639df81a57af03113525bf84cc1c56bcfca9e179 | d5899ab84b389668c1cdaa7be1769f58a109edc1 | refs/heads/master | 2023-06-30T08:53:24.092768 | 2021-06-05T16:01:27 | 2021-06-05T16:01:27 | 269,420,498 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 994 | java | package de.arraying.lumberjack;
import java.io.File;
/**
* LFsRules is a set of file system rules the logger should use.
*/
public interface LFsRules {
/**
* Gets the logging directory.
* @return The directory logs should go into, not null.
*/
File getDirectory();
/**
* The line limit per log.
* @return less than or equal to 0 for no line limit, otherwise the line limit.
*/
int getLineLimit();
/**
* The time limit per log in milliseconds.
* Time is started from the first log entry.
* @return less than or equal to 0 for no time limit, otherwise the time limit.
*/
long getTimeLimit();
/**
* Formats the file name.
* @param time The current time in milliseconds.
* @param uid The unique ID for the timestamp.
* @return A formatted string, must not be null.
*/
default String formatFileName(long time, long uid) {
return String.format("%d-%d.txt", time, uid);
}
}
| [
"paul.huebner@googlemail.com"
] | paul.huebner@googlemail.com |
0345048ec587e0832f37f996ddb26c4ca3a09869 | 5bd0028c1523aa3a265c5c1455a0de5873ee8c29 | /lab/src/main/java/me/mi/milab/view/Switch.java | d394018a810975f60761ef6f1331d5cfcb2e51bd | [] | no_license | jimwind/MiLab | d2d4ce3c30f07ef36973b63f60bd7befed68e421 | 87067cf305d3023974b6f5222d5b140cd12c5261 | refs/heads/master | 2021-10-20T06:24:29.303344 | 2019-02-26T07:37:59 | 2019-02-26T07:37:59 | 113,539,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,414 | java | package me.mi.milab.view;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.RelativeLayout;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.view.ViewHelper;
import me.mi.milab.R;
import me.mi.milab.utils.Utils;
/**
* Created by mi.gao on 2017/8/8.
*/
public class Switch extends CustomView {
private int backgroundColor = Color.parseColor("#4CAF50");
private Ball ball;
private boolean check = false;
private boolean eventCheck = false;
private boolean press = false;
private OnCheckListener onCheckListener;
private Bitmap bitmap;
public Switch(Context context, AttributeSet attrs) {
super(context, attrs);
setAttributes(attrs);
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (check)
setChecked(false);
else
setChecked(true);
}
});
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs) {
setBackgroundResource(R.drawable.background_transparent);
// Set size of view
setMinimumHeight(Utils.dpToPx(48, getResources()));
setMinimumWidth(Utils.dpToPx(80, getResources()));
// Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,
"background", -1);
if (bacgroundColor != -1) {
setBackgroundColor(getResources().getColor(bacgroundColor));
} else {
// Color by hexadecimal
int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
}
check = attrs.getAttributeBooleanValue(MATERIALDESIGNXML, "check",
false);
eventCheck = check;
ball = new Ball(getContext());
RelativeLayout.LayoutParams params = new LayoutParams(Utils.dpToPx(20,
getResources()), Utils.dpToPx(20, getResources()));
params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
ball.setLayoutParams(params);
addView(ball);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (isEnabled()) {
isLastTouch = true;
if (event.getAction() == MotionEvent.ACTION_DOWN) {
press = true;
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
float x = event.getX();
x = (x < ball.xIni) ? ball.xIni : x;
x = (x > ball.xFin) ? ball.xFin : x;
if (x > ball.xCen) {
eventCheck = true;
} else {
eventCheck = false;
}
ViewHelper.setX(ball, x);
ball.changeBackground();
if ((event.getX() <= getWidth() && event.getX() >= 0)) {
isLastTouch = false;
press = false;
}
} else if (event.getAction() == MotionEvent.ACTION_UP ||
event.getAction() == MotionEvent.ACTION_CANCEL) {
press = false;
isLastTouch = false;
if (eventCheck != check) {
check = eventCheck;
if (onCheckListener != null)
onCheckListener.onCheck(Switch.this,check);
}
if ((event.getX() <= getWidth() && event.getX() >= 0)) {
ball.animateCheck();
}
}
}
return true;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!placedBall) {
placeBall();
}
// Crop line to transparent effect
if(null == bitmap) {
bitmap = Bitmap.createBitmap(canvas.getWidth(),
canvas.getHeight(), Bitmap.Config.ARGB_8888);
}
Canvas temp = new Canvas(bitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor((eventCheck) ? backgroundColor : Color.parseColor("#B0B0B0"));
paint.setStrokeWidth(Utils.dpToPx(2, getResources()));
temp.drawLine(getHeight() / 2, getHeight() / 2, getWidth()
- getHeight() / 2, getHeight() / 2, paint);
Paint transparentPaint = new Paint();
transparentPaint.setAntiAlias(true);
transparentPaint.setColor(getResources().getColor(
android.R.color.transparent));
transparentPaint.setXfermode(new PorterDuffXfermode(
PorterDuff.Mode.CLEAR));
temp.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
ViewHelper.getY(ball) + ball.getHeight() / 2,
ball.getWidth() / 2, transparentPaint);
canvas.drawBitmap(bitmap, 0, 0, new Paint());
if (press) {
paint.setColor((check) ? makePressColor() : Color
.parseColor("#446D6D6D"));
canvas.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
getHeight() / 2, getHeight() / 2, paint);
}
invalidate();
}
/**
* Make a dark color to press effect
*
* @return
*/
protected int makePressColor() {
int r = (this.backgroundColor >> 16) & 0xFF;
int g = (this.backgroundColor >> 8) & 0xFF;
int b = (this.backgroundColor >> 0) & 0xFF;
r = (r - 30 < 0) ? 0 : r - 30;
g = (g - 30 < 0) ? 0 : g - 30;
b = (b - 30 < 0) ? 0 : b - 30;
return Color.argb(70, r, g, b);
}
// Move ball to first position in view
boolean placedBall = false;
private void placeBall() {
ViewHelper.setX(ball, getHeight() / 2 - ball.getWidth() / 2);
ball.xIni = ViewHelper.getX(ball);
ball.xFin = getWidth() - getHeight() / 2 - ball.getWidth() / 2;
ball.xCen = getWidth() / 2 - ball.getWidth() / 2;
placedBall = true;
ball.animateCheck();
}
// SETTERS
@Override
public void setBackgroundColor(int color) {
backgroundColor = color;
if (isEnabled())
beforeBackground = backgroundColor;
}
public void setChecked(boolean check) {
invalidate();
this.check = check;
this.eventCheck = check;
ball.animateCheck();
}
public boolean isCheck() {
return check;
}
class Ball extends View {
float xIni, xFin, xCen;
public Ball(Context context) {
super(context);
setBackgroundResource(R.drawable.background_switch_ball_uncheck);
}
public void changeBackground() {
if (eventCheck) {
setBackgroundResource(R.drawable.background_checkbox);
LayerDrawable layer = (LayerDrawable) getBackground();
GradientDrawable shape = (GradientDrawable) layer
.findDrawableByLayerId(R.id.shape_bacground);
shape.setColor(backgroundColor);
} else {
setBackgroundResource(R.drawable.background_switch_ball_uncheck);
}
}
public void animateCheck() {
changeBackground();
ObjectAnimator objectAnimator;
if (eventCheck) {
objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xFin);
} else {
objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xIni);
}
objectAnimator.setDuration(300);
objectAnimator.start();
}
}
public void setOncheckListener(OnCheckListener onCheckListener) {
this.onCheckListener = onCheckListener;
}
public interface OnCheckListener {
public void onCheck(Switch view, boolean check);
}
}
| [
"jimwind@yeah.net"
] | jimwind@yeah.net |
0908e1dac79dca035302e8b628a2229bac987420 | 39764ebf37ceb2a18cdc471e6abc1c2a8d68216e | /src/test/java/tests/vytrack/CreateCarTests.java | dfc750079cea43d27a3f385cb8c3a674d38da5e8 | [] | no_license | nurancebe/MyFirstSeleniumProject | a8c8358f6861b31be2908c5c2d02011b0966199c | 32d3d76f2f2bf0225385b7cc711afdd4b081f4cc | refs/heads/master | 2023-05-12T13:51:34.392953 | 2020-01-01T23:59:37 | 2020-01-01T23:59:37 | 230,491,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,023 | java | //realData driven testing
package tests.vytrack;
import org.testng.annotations.Test;
import pages.CreateCarPage;
import pages.LoginPage;
import pages.VehiclesPage;
import tests.TestBase;
import utils.BrowserUtils;
import utils.ConfigurationReader;
import utils.ExcelUtil;
import java.util.List;
import java.util.Map;
public class CreateCarTests extends TestBase {
@Test(description = "Create some random car")
public void test1(){
extentTest = extentReports.createTest("Create a new car");
LoginPage loginPage = new LoginPage();
VehiclesPage vehiclesPage = new VehiclesPage();
CreateCarPage createCarPage = new CreateCarPage();
loginPage.login("storemanager85", "UserUser123");
loginPage.navigateTo("Fleet", "Vehicles");
loginPage.waitUntilLoaderMaskDisappear();
vehiclesPage.clickToCreateACar();
loginPage.waitUntilLoaderMaskDisappear();
createCarPage.licensePlateElement.sendKeys("Random");
createCarPage.selectTags("Compact");
createCarPage.selectFuelType("Diesel");
loginPage.waitUntilLoaderMaskDisappear();
createCarPage.saveAndCloseButtonElement.click();
extentTest.pass("New car was created");
}
@Test(description = "Create a car by reading test data from excel file")
public void createCarTest(){
extentTest = extentReports.createTest("Create a car by reading test data from excel file");
LoginPage loginPage = new LoginPage();
VehiclesPage vehiclesPage = new VehiclesPage();
CreateCarPage createCarPage = new CreateCarPage();
String username = ConfigurationReader.getProperty("user_name");
String password = ConfigurationReader.getProperty("password");
loginPage.login(username, password);
loginPage.navigateTo("Fleet", "Vehicles");
loginPage.waitUntilLoaderMaskDisappear();
vehiclesPage.clickToCreateACar();
loginPage.waitUntilLoaderMaskDisappear();
ExcelUtil excelUtil = new ExcelUtil("cars.xlsx", "cars");
//read data from excel spreadsheet as list of map
//testData it's just reference variable
List<Map<String, String>> testData = excelUtil.getDataList();
//0 means data from first row, License Plate it's a column name
//so we are reading from first row and License Plate column
createCarPage.licensePlateElement.sendKeys(testData.get(0).get("License Plate"));
//enter driver info
createCarPage.driverElement.sendKeys(testData.get(0).get("Driver"));
//enter model year
createCarPage.modelYearElement.sendKeys(testData.get(0).get("Model Year"));
//enter color
createCarPage.colorElement.sendKeys(testData.get(0).get("Color"));
loginPage.waitUntilLoaderMaskDisappear();
createCarPage.saveAndCloseButtonElement.click();//click to save and close
BrowserUtils.wait(3);//for demo
extentTest.info("Created a new car");
}
} | [
"nurancebe@gmail.com"
] | nurancebe@gmail.com |
98ee84b253c2e77fd18b4bb1bc41990b8a82aa13 | cb581cf784ff077b61f79c8afaebce4cb3ba4a0b | /core/src/ru/hse/checker/screen/IntroScreen.java | 825bacf401eb4e5236945d1171bcee39d91d7ccc | [] | no_license | annyl/rl_game | b4a3f316335474d946b9c404c0e14b233f8bc764 | 516e92943db1a6cfd3877b48fec6ccfdef4156c7 | refs/heads/master | 2022-07-07T02:22:03.221777 | 2020-03-25T16:31:47 | 2020-03-25T16:31:47 | 234,305,614 | 1 | 1 | null | 2022-06-22T01:06:48 | 2020-01-16T11:30:03 | Java | UTF-8 | Java | false | false | 1,739 | java | package ru.hse.checker.screen;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Event;
import com.badlogic.gdx.scenes.scene2d.EventListener;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import ru.hse.checker.Game;
import ru.hse.checker.model.Config;
public class IntroScreen extends UIScreen {
private Config config = new Config();
@Override
public void show() {
Label welcomeLabel = new Label("Welcome to", getSkin());
Label.LabelStyle halogen = new Label.LabelStyle(getSkin().getFont("halogen"), getSkin().getColor("color"));
welcomeLabel.setStyle(halogen);
getTable().center().add(welcomeLabel).center();
getTable().row();
Label NeonCheckers = new Label("Neon Checkers", getSkin());
Label.LabelStyle las = new Label.LabelStyle(getSkin().getFont("las"), getSkin().getColor("text"));
NeonCheckers.setStyle(las);
getTable().add(NeonCheckers);
getTable().row();
TextButton textButton = new TextButton("Play", getSkin());
textButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
((Game) Gdx.app.getApplicationListener()).setScreen(new ChooseEnemy(config));
}
});
getTable().add(textButton).pad(50);
getTable().pack();
}
@Override
public void dispose() {
super.dispose();
}
@Override
public void keyBackPressed() {
super.keyBackPressed();
Gdx.app.exit();
}
}
| [
"myvaheed@gmail.com"
] | myvaheed@gmail.com |
2a7a7d1b7e7e911d0b6edbcf77d711645f7cd96f | d67080c9d3ae20533021929102836a5fad2c79e1 | /src/music/util/Harmonizator.java | 4788214e3d6e7cd7ed0648be2c228600d22f563a | [] | no_license | IraKorshunova/GenMeowth | 67b37e3f5bb0b0d63f668bde01bf1742c1def9a6 | 7a8ae671fcddc29852450f8487b564f4c50bc30f | refs/heads/master | 2016-09-06T03:22:15.541426 | 2015-04-02T11:26:01 | 2015-04-02T11:26:01 | 33,301,564 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,781 | java | package music.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import jm.music.data.Part;
import jm.music.data.Phrase;
import jm.music.data.Score;
import music.constants.Volume;
import music.exception.IllegalPieceAttributesException;
import musicLevak.Note;
/**
* The class <code>Harmonizator</code> contains methods for making a chordal
* accompaniment to a melody.
*/
public class Harmonizator {
private ArrayList<Note> melody;
private ArrayList<ArrayList<Note>> bars;
private Phrase backing;
private double chordDuration;
private int octave;
private int notesNum;
private int numerator;
private int denominator;
private int keyQuality;
private int tonic;
private int dominant;
private int subdominant;
private int[] dominantGroup;
private int[] subdominantGroup;
private int[][] transMatrix;
public Harmonizator(ArrayList<Note> melody, int numerator, int denominator,
int keyQuality, int tonic) {
this.numerator = numerator;
this.denominator = denominator;
this.keyQuality = keyQuality;
this.tonic = tonic;
this.notesNum = melody.size();
this.melody = melody;
this.backing = new Phrase("backing");
dominant = (tonic + 7) % 12;
subdominant = (tonic + 5) % 12;
dominantGroup = new int[3];
subdominantGroup = new int[3];
if (keyQuality == 1) {
dominantGroup[0] = (tonic + 3) % 12; // III
subdominantGroup[2] = (tonic + 10) % 12; // VI
} else {
dominantGroup[0] = (tonic + 4) % 12; // III
subdominantGroup[2] = (tonic + 9) % 12; // VI
}
dominantGroup[1] = dominant; // V
dominantGroup[2] = (tonic + 11) % 12; // VII
subdominantGroup[0] = (tonic + 2) % 12; // II
subdominantGroup[1] = subdominant; // IV
if (keyQuality == 1)
melodyHarmonicMinor();
divideIntoBars();
initializeTransitMatrix();
fitBackingOctave();
fitHarmony();
}
private void melodyHarmonicMinor() {
Note checkedNote;
for (int i = 0; i < melody.size(); i++) {
checkedNote = melody.get(i);
if (checkedNote.getPitch() % 12 == dominantGroup[2] - 1) {
melody.set(
i,
new Note(checkedNote.getPitch() + 1, checkedNote
.getRhythmValue()));
}
}
}
/**
* Divides a melody into half bars up to semi quaver triplet note.
* */
private void divideIntoBars() {
final double EPSILON = 0.2;
double barLength = numerator / denominator * 4.0;
double sumDuration = 0.0;
double buffDuration = 0.0;
double carryDuration = 0.0;
boolean carryFlag = false;
Note buffNote = new Note();
bars = new ArrayList<ArrayList<Note>>();
switch (denominator) {
case 2: {
chordDuration = barLength = 2;
break;
}
case 4: {
if (numerator == 3)
chordDuration = barLength = 3;
else {
chordDuration = barLength = 2;
}
break;
}
case 8: {
chordDuration = barLength = 1.5;
break;
}
}
int barsNumber = getBarsNumber(barLength);
int j = -1;
for (int i = 0; i < barsNumber; i++) {
ArrayList<Note> bar = new ArrayList<Note>();
bars.add(bar);
sumDuration = 0.0;
if (carryFlag && buffNote.getRhythmValue() > EPSILON) {
buffDuration = buffNote.getRhythmValue();
sumDuration += buffDuration;
if (sumDuration > barLength + EPSILON) {
carryFlag = true;
sumDuration -= buffDuration;
carryDuration = buffDuration;
buffDuration = barLength - sumDuration;
carryDuration -= buffDuration;
if (buffDuration > EPSILON)
bar.add(new Note(melody.get(j).getPitch(), buffDuration));
buffNote = new Note(melody.get(j).getPitch(), carryDuration);
} else {
carryFlag = false;
if (buffDuration > EPSILON)
bar.add(buffNote);
}
}
while (!carryFlag && j < notesNum - 1) {
j++;
buffNote = melody.get(j);
buffDuration = melody.get(j).getRhythmValue();
sumDuration += buffDuration;
if ((sumDuration < barLength + EPSILON)
&& (buffDuration > EPSILON)) {
bar.add(buffNote);
if (sumDuration < barLength + EPSILON
&& sumDuration > barLength - EPSILON) {
break;
}
} else if (buffDuration > EPSILON) {
carryFlag = true;
sumDuration -= buffDuration;
carryDuration = buffDuration;
buffDuration = barLength - sumDuration;
carryDuration -= buffDuration;
if (buffDuration > EPSILON)
bar.add(new Note(melody.get(j).getPitch(), buffDuration));
buffNote = new Note(melody.get(j).getPitch(), carryDuration);
}
}
}
}
/**
* Returns the approximated number of bars
*
* @param barLength the length of bar.
* @return number of bars in the score.
* */
private int getBarsNumber(double barLength) {
double sumDuration = 0;
for (int i = 0; i < notesNum; i++) {
sumDuration += melody.get(i).getRhythmValue();
}
return (int) Math.round(sumDuration / barLength);
}
/**
* Returns the pitch of the longest note in the bar in the contra octave
* (numeric values 0-11)
*
* @param noteList notes in the bar.
* @return longest note in the bar.
* */
private int barHarmony(ArrayList<Note> noteList) {
ArrayList<Note> noRepsNoteList = new ArrayList<Note>();
int curPitch = 0;
double sumDuration = 0;
for (int i = 0; i < noteList.size(); i++) {
sumDuration = noteList.get(i).getRhythmValue();
curPitch = noteList.get(i).getPitch();
for (int j = i + 1; j < noteList.size(); j++) {
if (curPitch == noteList.get(j).getPitch()) {
sumDuration += noteList.get(j).getRhythmValue();
noteList.remove(j);
j--;
}
}
noRepsNoteList.add(i, new Note(curPitch, sumDuration));
}
Note maxLengthNote = Collections.max(noRepsNoteList,
new Comparator<Note>() {
@Override
public int compare(Note o1, Note o2) {
Double double1 = new Double(o1.getRhythmValue());
Double double2 = new Double(o2.getRhythmValue());
return double1.compareTo(double2);
}
});
return maxLengthNote.getPitch() % 12;
}
/**
* Defines the octave of the backing chords
* */
private void fitBackingOctave() {
Note lowestNote = Collections.min(melody, new Comparator<Note>() {
@Override
public int compare(Note o1, Note o2) {
Double double1 = new Double(o1.getPitch());
Double double2 = new Double(o2.getPitch());
return double1.compareTo(double2);
}
});
octave = (int) lowestNote.getPitch() / 12 - 1;
}
/**
* Adds triad or it's first inversion (sixth) to the backing chords
* progression. In major R 35(0-4-7)may be found on I,IV and V; R b35(0-3-7)
* builds on II,III,VI; diminished R b3b5(0-3-6) based on VII. In harmonic
* minor R 35 builds on VI,V ; R b35 based on I and IV; R b3b5 builds on II
* and VII; R 3d5 (0-4-8) may be found on III.
*
* @param root chord's root pitch
* @param firstInvertion
* */
private void triad(int root, boolean firstInvertion) {
int third;
int fifth;
int[] chord = new int[3];
if (keyQuality == 1) {
if (root == tonic || root == subdominant
|| root == dominantGroup[2] || root == subdominantGroup[0])
third = root + 3;
else
third = root + 4;
} else {
if (root == tonic || root == subdominant || root == dominant)
third = root + 4;
else
third = root + 3;
}
fifth = root + 7;
if (keyQuality == 1) {
if (root == subdominantGroup[0] || root == dominantGroup[2])
fifth = root + 6;
if (root == dominantGroup[0])
fifth = root + 8;
} else {
if (root == dominantGroup[2])
fifth = root + 6;
}
if (firstInvertion) {
chord[0] = third;
chord[1] = fifth;
chord[2] = root;
if (root == subdominantGroup[2] || root == dominantGroup[1]
|| root == dominantGroup[2]) {
for (int i = 0; i < 3; i++)
chord[i] += 12 * (octave - 1);
} else {
for (int i = 0; i < 3; i++)
chord[i] += 12 * octave;
}
chord[2] += 12;
} else {
chord[0] = root;
chord[1] = third;
chord[2] = fifth;
if (root == dominantGroup[2]) {
for (int i = 0; i < 3; i++)
chord[i] += 12 * (octave - 1);
} else {
for (int i = 0; i < 3; i++)
chord[i] += 12 * octave;
}
}
backing.addChord(chord, chordDuration);
}
private void initializeTransitMatrix() {
int[][] a = new int[14][14];
a[0][1] = a[0][11] = a[0][7] = a[0][13] = 1;
a[1][1] = a[1][2] = a[1][3] = a[1][8] = a[1][4] = a[1][7] = a[1][13] = 1;
a[2][1] = a[2][3] = a[2][11] = a[2][7] = a[2][7] = a[2][13] = 1;
a[3][1] = a[3][8] = a[3][9] = a[3][4] = a[3][10] = a[3][13] = 1;
a[8][1] = a[8][11] = a[8][7] = a[8][13] = 1;
a[9][1] = a[9][10] = a[9][6] = a[9][7] = 1;
a[4][1] = a[4][3] = a[4][9] = a[4][13] = 1;
a[5][1] = a[5][3] = a[5][9] = a[5][10] = a[5][6] = 1;
a[10][1] = a[10][9] = a[10][7] = 1;
a[11][0] = a[11][7] = a[11][12] = a[11][13] = 1;
a[6][1] = a[6][3] = a[6][9] = a[6][5] = a[6][10] = 1;
a[7][1] = a[7][2] = a[7][8] = a[7][11] = a[7][12] = a[7][13] = 1;
a[12][1] = a[12][11] = a[12][7] = 1;
a[13][0] = a[13][1] = a[13][8] = a[13][11] = a[13][7] = 1;
transMatrix = a;
}
private void fitHarmony() {
int harmonyGroup = 0;
int prevState = 0;
triad(tonic, false);
for (int i = 1; i < bars.size() - 1; i++) {
harmonyGroup = barHarmony(bars.get(i));
if (harmonyGroup == tonic) {
prevState = getNextState(prevState, 0);
} else {
if (Arrays.binarySearch(subdominantGroup, harmonyGroup) >= 0) {
prevState = getNextState(prevState, 1);
} else {
prevState = getNextState(prevState, 2);
}
}
}
cadenza();
}
private void cadenza() {
triad(subdominantGroup[0], true);
triad(dominant, false);
triad(tonic, false);
}
private int getNextState(int prevState, int harmonyGroup) {
int sumInRow = 0;
double[] transRow = new double[2];
switch (harmonyGroup) {
case 0: {
transRow = new double[2];
for (int i = 0; i < 2; i++) {
sumInRow += transMatrix[prevState][i];
transRow[i] = transMatrix[prevState][i];
}
break;
}
case 1: {
transRow = new double[6];
for (int i = 2; i < 8; i++) {
sumInRow += transMatrix[prevState][i];
transRow[i - 2] = transMatrix[prevState][i];
}
break;
}
case 2: {
transRow = new double[8];
for (int i = 8; i < 14; i++) {
sumInRow += transMatrix[prevState][i];
transRow[i - 8] = transMatrix[prevState][i];
}
transRow[6] = transMatrix[prevState][0];
sumInRow += transMatrix[prevState][0];
transRow[7] = transMatrix[prevState][1];
sumInRow += transMatrix[prevState][1];
break;
}
}
for (int i = 0; i < transRow.length; i++) {
transRow[i] /= sumInRow;
}
double sum = 0;
double choise = Math.random();
for (int i = 0; i < transRow.length; i++) {
sum += transRow[i];
if (choise <= sum) {
switch (harmonyGroup) {
case 0: {
if (i == 0)
triad(tonic, false);
else
triad(tonic, true);
return i;
}
case 1: {
if (i % 2 == 0)
triad(subdominantGroup[(int) i / 2], false);
else
triad(subdominantGroup[(int) i / 2], true);
return i + 2;
}
case 2: {
if (i % 2 == 0) {
if (i == 0) {
triad(tonic, false);
return 0;
} else
triad(dominantGroup[(int) i / 2 - 1], false);
} else {
if (i == 1) {
triad(tonic, true);
return 1;
} else
triad(dominantGroup[(int) i / 2 - 1], true);
}
return i + 6;
}
}
}
}
return 0;
}
public Score createScore() {
Score score = new Score();
Part part = new Part();
Note[] melodyNoteArray = new Note[melody.size()];
melody.toArray(melodyNoteArray);
Phrase melodyPhrase = new Phrase(melodyNoteArray);
melodyPhrase.setTitle("melody");
backing.setInstrument(0);
backing.setDuration(chordDuration * 1.2);
//backing.setVolume(Volume.PIANO);
backing.setStartTime(0);
part.add(melodyPhrase);
part.add(backing);
score.add(part);
return score;
}
/*
* Defines major and minor key with such key signature
*
* @param keySignature
*
* @return keys array 0 - major key, 1- minor key
*/
public static int[] getKeys(int keySignature) {
int tonic[] = new int[2];
if (keySignature >= 0) {
if (keySignature % 2 == 0)
tonic[0] = keySignature;
else
tonic[0] = keySignature + 6;
} else {
if (keySignature % 2 == 0)
tonic[0] = keySignature + 12;
else
tonic[0] = keySignature + 6;
}
if (tonic[0] >= 12 || tonic[0] < 0)
tonic[0] = Math.abs(12 - Math.abs(tonic[0]));
if ((tonic[0] - 3) >= 0)
tonic[1] = tonic[0] - 3;
else
tonic[1] = tonic[0] + 9;
return tonic;
}
public static void fitToKey(ArrayList<Note> melody, int keySignature) {
int[] naturalsToSharps = { 5, 0, 7, 2, 9, 4, 11 };
int[] naturalsToFlats = { 11, 4, 9, 2, 7, 0, 5 };
if (Math.abs(keySignature) > 7) {
throw new IllegalPieceAttributesException();
}
for (Note n : melody) {
for (int i = 0; i < Math.abs(keySignature); i++) {
if (keySignature > 0) {
if (n.getPitch() % 12 == naturalsToSharps[i]) {
n.setPitch(n.getPitch() + 1);
}
}
if (keySignature < 0) {
if (n.getPitch() % 12 == naturalsToFlats[i]) {
n.setPitch(n.getPitch() - 1);
}
}
}
}
}
} | [
"i.hmarynka@gmail.com"
] | i.hmarynka@gmail.com |
a3dcef5a5804db860cabb6e82786ad221e39d3d8 | ac73a7c66938e57ec07b56c3da1316e49e8b63cd | /lab91/app/src/main/java/jb/ws/lab91/MainActivity.java | 966b00f6b73011a56ab25cfb58badec7121bab14 | [] | no_license | aswinpradeep0/android2 | a991ec246f112c5a796dbaa54fee10f5e4980f3b | 02621e56571c78e6fc6af7a1ef6ba20cf29cddac | refs/heads/master | 2020-05-21T00:53:44.015402 | 2019-05-09T17:12:07 | 2019-05-09T17:12:07 | 185,841,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,108 | java | package jb.ws.lab91;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class MainActivity extends AppCompatActivity {
ConnectionReceiver receiver;
IntentFilter intentFilter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
receiver = new ConnectionReceiver();
intentFilter = new IntentFilter("com.journaldev.broadcastreceiver.SOME_ACTION");
}
@Override
protected void onResume() {
super.onResume();
registerReceiver(receiver, intentFilter);
}
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(receiver);
}
@OnClick(R.id.button)
void someMethod() {
Intent intent = new Intent("com.journaldev.broadcastreceiver.SOME_ACTION");
sendBroadcast(intent);
}
} | [
"aswinpradeep1@gmail.com"
] | aswinpradeep1@gmail.com |
46225c4805192687ea63cc0f3862024f06dc3d95 | 56c3e911b36a74e628d9849707b44e86ca13cbc9 | /bookstoreV4.9/src/com/atguigu/utils/WebUtil.java | 0fb37159a3ba3d79dd93b41029b77b5858a503fc | [] | no_license | tanjunwei957/meinianlvyou | e4ad54639da0bde6a850ba37b1cd3d24877d4093 | e0af508e661390a13fa4b4bede2a35cbf204f658 | refs/heads/master | 2021-01-08T20:09:25.585901 | 2020-02-25T02:45:21 | 2020-02-25T02:45:21 | 242,130,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.atguigu.utils;
import javax.servlet.http.HttpServletRequest;
public class WebUtil {
public static String getRequestPath(HttpServletRequest request) {
/*//获取请求路径
String uri =request.getRequestURI();
//获取客户端传输到服务器的数据
*/
//获取请求路径
String uri = request.getRequestURI();
//获取客户端传输到服务器的数据,name=value&name=value
String queryString = request.getQueryString();
String path = uri + "?" + queryString;
if(path.contains("&")) {
path = path.substring(0, path.indexOf("&"));
}
return path;
}
}
| [
"362088172@qq.com"
] | 362088172@qq.com |
2d5dbf43cd689d83b4f5fb6d4bf9b47a72a82162 | f2e0279b92bbc270663da4801c19eb9eab2d1cb2 | /app/src/main/java/com/tariqs/xerox/Config.java | e6aee4297de6754b507553de9c7dbc32502beaff | [] | no_license | Omarhussien61/Xerox-BroCopy_V2 | 815b8b054d0ec5b38aadc3fdf7c476ab746f7386 | ee600ff466cf6ec8956fc884769852443a6f8e47 | refs/heads/master | 2021-01-26T07:09:17.621098 | 2020-03-10T16:54:52 | 2020-03-10T16:54:52 | 243,355,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,291 | java | package com.tariqs.xerox;
public class Config {
//URL to our login.php file
public static final String LOGIN_URL = "http://192.168.94.1/Android/LoginLogout/login.php";
//Keys for email and password as defined in our $_POST['key'] in login.php
public static final String KEY_EMAIL = "email";
public static final String KEY_PASSWORD = "password";
//If server response is equal to this that means login is successful
public static final String LOGIN_SUCCESS = "success";
//Keys for Sharedpreferences
//This would be the name of our shared preferences
public static final String SHARED_PREF_NAME = "myloginapp";
public static final int TOTAL_SHARED_PREF = 0;
//This would be used to store the phone of current logged in user
public static final String Phone_SHARED_PREF = "phone";
public static final String groupid_SHARED_PREF = "groupid";
public static final String id_SHARED_PREF = "id";
public static final String cas_SHARED_PREF = "cas";
public static final String name_SHARED_PREF = "name";
//We will use this to store the boolean in sharedpreference to track user is loggedin or not
public static final String LOGGEDIN_SHARED_PREF = "loggedin";
public static final String edit_SHARED_PREF = "false";
}
| [
"Oo23119950"
] | Oo23119950 |
5dd7f94c381150d45aa0c2ce51006d0d2d4ad5fa | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_58b4e5df7226af0ee2be9ac5b6c369b7c615b94d/GlacierMethod/13_58b4e5df7226af0ee2be9ac5b6c369b7c615b94d_GlacierMethod_t.java | 842e742250b1d06dd0f1cc100a37ee87d8076656 | [] | 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 | 16,856 | java | /**
* Copyright (C) 2009-2013 Dell, Inc.
* See annotations for authorship information
*
* ====================================================================
* 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.dasein.cloud.aws.storage;
import org.apache.http.*;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.*;
import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.apache.log4j.Logger;
import org.dasein.cloud.CloudErrorType;
import org.dasein.cloud.CloudException;
import org.dasein.cloud.InternalException;
import org.dasein.cloud.OperationNotSupportedException;
import org.dasein.cloud.ProviderContext;
import org.dasein.cloud.aws.AWSCloud;
import org.json.JSONException;
import org.json.JSONObject;
import javax.annotation.Nonnull;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
* [Class Documentation]
* <p>Created by George Reese: 5/22/13 2:46 PM</p>
*
* @author George Reese
*/
public class GlacierMethod {
static private final Logger logger = Logger.getLogger(GlacierMethod.class);
static public final String GLACIER_PREFIX = "glacier:";
static public final String SERVICE_ID = "glacier";
static public final String API_VERSION = "2012-06-01";
private GlacierAction action = null;
private Map<String,String> headers = null;
private Map<String,String> queryParameters = null;
private AWSCloud provider = null;
private String vaultId = null;
private String archiveId = null;
private String jobId = null;
private String bodyText = null;
private File bodyFile = null;
private GlacierMethod(Builder builder) {
this.action = builder.action;
this.provider = builder.provider;
this.vaultId = builder.vaultId;
this.archiveId = builder.archiveId;
this.jobId = builder.jobId;
this.headers = builder.headers == null ? new HashMap<String,String>() : builder.headers;
this.queryParameters = builder.queryParameters == null ? new HashMap<String, String>() : builder.queryParameters;
this.bodyText = builder.bodyText;
this.bodyFile = builder.bodyFile;
}
private static byte[] computePayloadSHA256Hash(byte[] payload) throws NoSuchAlgorithmException, IOException {
BufferedInputStream inputStream =
new BufferedInputStream(new ByteArrayInputStream(payload));
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
byte[] buffer = new byte[4096];
int bytesRead;
while ( (bytesRead = inputStream.read(buffer, 0, buffer.length)) != -1 ) {
messageDigest.update(buffer, 0, bytesRead);
}
return messageDigest.digest();
}
static private final Logger wire = AWSCloud.getWireLogger(Glacier.class);
/**
* Invokes the method and returns the response body as a JSON object
* @return JSON object
* @throws InternalException
* @throws CloudException
* @throws GlacierException
*/
public JSONObject invokeJson() throws InternalException, CloudException {
String content;
try {
HttpResponse response = invokeInternal();
Header contentType = response.getFirstHeader("content-type");
if (!"application/json".equalsIgnoreCase(contentType.getValue())) {
throw new CloudException("Invalid Glacier response: expected JSON");
}
content = EntityUtils.toString(response.getEntity());
if (content == null) {
return null;
}
return new JSONObject(content);
} catch (IOException e) {
throw new CloudException(e);
} catch (JSONException e) {
throw new CloudException(e);
}
}
/**
* Invokes the method and returns the response headers
* @return map of response headers; duplicate header keys are ignored
* @throws InternalException
* @throws CloudException
* @throws GlacierException
*/
public Map<String, String> invokeHeaders() throws InternalException, CloudException {
HttpResponse response = invokeInternal();
Map<String, String> headers = new HashMap<String, String>();
// doesn't support duplicate header keys, but they are unused by glacier
for (Header header : response.getAllHeaders()) {
headers.put(header.getName().toLowerCase(), header.getValue());
}
return headers;
}
/**
* Invokes the method and returns nothing
* @throws InternalException
* @throws CloudException
*/
public void invoke() throws InternalException, CloudException {
invokeInternal();
}
private HttpResponse invokeInternal() throws InternalException, CloudException {
if( wire.isDebugEnabled() ) {
wire.debug("");
wire.debug("----------------------------------------------------------------------------------");
}
try {
final String url = getUrlWithParameters();
final String host;
try {
host = new URI(url).getHost();
} catch (URISyntaxException e) {
throw new InternalException(e);
}
final HttpRequestBase method = action.getMethod(url);
final HttpClient client = getClient(url);
final String accessId;
final String secret;
try {
accessId = new String(provider.getContext().getAccessPublic(), "utf-8");
secret = new String(provider.getContext().getAccessPrivate(), "utf-8");
} catch (UnsupportedEncodingException e) {
throw new InternalException(e);
}
headers.put(AWSCloud.P_AWS_DATE, provider.getV4HeaderDate(null));
headers.put("x-amz-glacier-version", API_VERSION);
headers.put("host", host);
final String v4Authorization = provider.getV4Authorization(accessId, secret,
method.getMethod(), url, SERVICE_ID, headers, getRequestBodyHash());
for( Map.Entry<String, String> entry : headers.entrySet() ) {
method.addHeader(entry.getKey(), entry.getValue());
}
method.addHeader(AWSCloud.P_CFAUTH, v4Authorization);
if (bodyText != null) {
try {
((HttpEntityEnclosingRequestBase)method).setEntity(new StringEntity(bodyText));
} catch (UnsupportedEncodingException e) {
throw new InternalException(e);
}
}
if( wire.isDebugEnabled() ) {
wire.debug("[" + url + "]");
wire.debug(method.getRequestLine().toString());
for( Header header : method.getAllHeaders() ) {
wire.debug(header.getName() + ": " + header.getValue());
}
wire.debug("");
if( bodyText != null ) {
try { wire.debug(EntityUtils.toString(((HttpEntityEnclosingRequestBase)method).getEntity())); }
catch( IOException ignore ) { }
wire.debug("");
}
}
HttpResponse httpResponse;
try {
httpResponse = client.execute(method);
} catch (IOException e) {
throw new CloudException(e);
}
if( wire.isDebugEnabled() ) {
wire.debug(httpResponse.getStatusLine().toString());
for( Header header : httpResponse.getAllHeaders() ) {
wire.debug(header.getName() + ": " + header.getValue());
}
wire.debug("");
}
int status = httpResponse.getStatusLine().getStatusCode();
if( status >= 400) {
throw getGlacierException(httpResponse);
} else {
return httpResponse;
}
}
finally {
if( wire.isDebugEnabled() ) {
wire.debug("----------------------------------------------------------------------------------");
wire.debug("");
}
}
}
private GlacierException getGlacierException(HttpResponse httpResponse) {
String errorCode;
String errorBody = "";
String errorMessage;
try {
errorBody = EntityUtils.toString(httpResponse.getEntity());
JSONObject errorObject = new JSONObject(errorBody);
errorCode = errorObject.getString("code");
errorMessage = errorObject.getString("message");
} catch (IOException e) {
errorCode = errorMessage = "failed to read error";
} catch (JSONException e) {
errorMessage = errorBody;
errorCode = "GeneralError";
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
CloudErrorType errorType = CloudErrorType.GENERAL;
if (statusCode == 403) {
errorType = CloudErrorType.AUTHENTICATION;
}
else if (statusCode == 400) {
errorType = CloudErrorType.COMMUNICATION;
}
return new GlacierException(errorType, statusCode, errorCode, errorMessage);
}
private String getRequestBodyHash() throws InternalException {
if (bodyText == null && bodyFile == null) {
// use hash of the empty string
return AWSCloud.computeSHA256Hash("");
} else if (bodyText != null) {
return AWSCloud.computeSHA256Hash(bodyText);
} else {
throw new OperationNotSupportedException("glacier file handling not implemented");
}
}
private String getUrlWithParameters() throws InternalException, CloudException {
if (queryParameters == null || queryParameters.size() == 0) {
return getUrl();
}
final StringBuilder sb = new StringBuilder();
sb.append(getUrl()).append("?");
boolean first = true;
for (Map.Entry<String, String> entry : queryParameters.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key == null || value == null) {
throw new InternalException("Invalid query parameter: " + key);
}
key = AWSCloud.encode(key.trim(), false);
value = AWSCloud.encode(value.trim(), false);
if (key.length() == 0) {
throw new InternalException("Empty query parameter key");
}
if (!first) {
sb.append("&");
} else {
first = false;
}
sb.append(key).append("=").append(value);
}
return sb.toString();
}
public String getUrl() throws InternalException, CloudException {
String baseUrl = provider.getGlacierUrl();
StringBuilder url = new StringBuilder(baseUrl).append("/vaults");
if (action == GlacierAction.LIST_VAULTS) {
return url.toString();
}
if (vaultId == null) {
throw new InternalException("vaultId required");
}
url.append("/").append(vaultId);
switch (action) {
case CREATE_VAULT: case DELETE_VAULT: case DESCRIBE_VAULT:
break;
case CREATE_ARCHIVE:
url.append("/archives");
break;
case DELETE_ARCHIVE:
if (archiveId == null) {
throw new InternalException("archiveId required");
}
url.append("/archives/").append(archiveId);
break;
case LIST_JOBS: case CREATE_JOB:
url.append("/jobs");
break;
case DESCRIBE_JOB: case GET_JOB_OUTPUT:
if (jobId == null) {
throw new InternalException("jobId required");
}
url.append("/jobs/").append(jobId);
if (action == GlacierAction.GET_JOB_OUTPUT) {
url.append("/output");
}
break;
}
return url.toString();
}
protected @Nonnull
HttpClient getClient(String url) throws InternalException {
ProviderContext ctx = provider.getContext();
if( ctx == null ) {
throw new InternalException("No context was specified for this request");
}
boolean ssl = url.startsWith("https");
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
//noinspection deprecation
HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);
HttpProtocolParams.setUserAgent(params, "Dasein Cloud");
Properties p = ctx.getCustomProperties();
if( p != null ) {
String proxyHost = p.getProperty("proxyHost");
String proxyPort = p.getProperty("proxyPort");
if( proxyHost != null ) {
int port = 0;
if( proxyPort != null && proxyPort.length() > 0 ) {
port = Integer.parseInt(proxyPort);
}
params.setParameter(ConnRoutePNames.DEFAULT_PROXY, new HttpHost(proxyHost, port, ssl ? "https" : "http"));
}
}
return new DefaultHttpClient(params);
}
public static Builder build(@Nonnull AWSCloud provider, @Nonnull GlacierAction action) {
return new Builder(provider, action);
}
public static class Builder {
private final AWSCloud provider;
private final GlacierAction action;
private String vaultId;
private String archiveId;
private String jobId;
public Map<String, String> headers;
public Map<String, String> queryParameters;
public String bodyText;
public File bodyFile;
public Builder(@Nonnull AWSCloud provider, @Nonnull GlacierAction action) {
this.provider = provider;
this.action = action;
}
public Builder vaultId(@Nonnull String value) {
vaultId = value;
return this;
}
public Builder archiveId(@Nonnull String value) {
archiveId = value;
return this;
}
public Builder jobId(@Nonnull String value) {
jobId = value;
return this;
}
public Builder headers(@Nonnull Map<String, String> value) {
headers = value;
return this;
}
public Builder queryParameters(@Nonnull Map<String, String> value) {
queryParameters = value;
return this;
}
public Builder bodyText(@Nonnull String value) {
bodyText = value;
return this;
}
public Builder bodyFile(@Nonnull File value) {
bodyFile = value;
return this;
}
public GlacierMethod toMethod() {
return new GlacierMethod(this);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
22faaa266941ed1aeb36dd6c1e851c9bd05875e2 | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_1/src/b/i/e/c/Calc_1_1_18429.java | 75eb97c2635cfcccd668781147ca26fc7343ca0e | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package b.i.e.c;
public class Calc_1_1_18429 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
1d32f1cf538bca0d0c16f56d56e4c737d1a045b3 | 63bc09aaca0fe18d0c16a4b4eb2e4c9f14dd5d6c | /src/main/java/com/lib8/leetcode/editor/cn/QLongestSubstringWithoutRepeatingCharacters.java | 6160cc8edf0dd3e98cea5a91401b7f2946b0f334 | [] | no_license | L-ios/letscode | 9491b48b0a030581ae130a76ff0dc5d37c57db96 | 60de9cfaba209b6802522263f9dc0df6bdfbffd2 | refs/heads/main | 2023-07-12T02:32:32.535932 | 2021-08-14T14:27:03 | 2021-08-14T14:27:03 | 318,574,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,837 | java | package com.lib8.leetcode.editor.cn;
//给定一个字符串 s ,请你找出其中不含有重复字符的 最长子串 的长度。
//
//
//
// 示例 1:
//
//
//输入: s = "abcabcbb"
//输出: 3
//解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。
//
//
// 示例 2:
//
//
//输入: s = "bbbbb"
//输出: 1
//解释: 因为无重复字符的最长子串是 "b",所以其长度为 1。
//
//
// 示例 3:
//
//
//输入: s = "pwwkew"
//输出: 3
//解释: 因为无重复字符的最长子串是 "wke",所以其长度为 3。
// 请注意,你的答案必须是 子串 的长度,"pwke" 是一个子序列,不是子串。
//
//
// 示例 4:
//
//
//输入: s = ""
//输出: 0
//
//
//
//
// 提示:
//
//
// 0 <= s.length <= 5 * 104
// s 由英文字母、数字、符号和空格组成
//
// Related Topics 哈希表 字符串 滑动窗口
// 👍 5874 👎 0
import java.util.HashSet;
import java.util.Set;
/**
* Project: letscode
* Question: 3
*
* @author: Lionseun Ling
* @create: 2021-08-06 22:57:56
*/
public class QLongestSubstringWithoutRepeatingCharacters {
public static void main(String[] args) {
Solution solution = new Solution();
assert solution.lengthOfLongestSubstring("") == 0;
assert solution.lengthOfLongestSubstring(" ") == 1;
assert solution.lengthOfLongestSubstring("dvdf") == 3;
assert solution.lengthOfLongestSubstring("pwwkes") == 3;
assert solution.lengthOfLongestSubstring("abcabcbb") == 3;
}
public static int lengthOfLongestSubstring(String s) {
return new Solution().lengthOfLongestSubstring(s);
}
private static
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
/**
* 使用快慢指针进行滑动
* 1. contains is true 滑动慢指针
* 2. else 滑动慢指针
*/
public int lengthOfLongestSubstring(String s) {
Set<Character> pathed = new HashSet<>();
int slow = 0;
int fast = 0;
int maxSub = 0;
// 判断要走到那一个字符串
char dup = 0;
while (fast < s.length() && slow < s.length()) {
if (dup != 0) {
if (s.charAt(slow)== dup) {
dup = 0;
}
pathed.remove(s.charAt(slow));
slow++;
} else {
if (pathed.contains(s.charAt(fast))) {
dup = s.charAt(fast);
maxSub = Math.max(maxSub, pathed.size());
} else {
pathed.add(s.charAt(fast));
fast++;
}
}
}
return Math.max(maxSub, pathed.size());
}
}
//leetcode submit region end(Prohibit modification and deletion)
} | [
"lionseun@gmail.com"
] | lionseun@gmail.com |
e738b982ea1100265fb5214f61c56c0099a365b5 | 380c2f42aa7ea8ead05d08b8d61f5ef834b39cef | /src/main/java/com/kaaterskil/workflow/engine/parser/handler/ParseHandler.java | 98234a2e2e0a30b0f455768005ac926e05401f42 | [] | no_license | kaaterskil/workflow | 593208bef83f149843e1349cb4f21dca5ea6e51a | c1498bd2a3eb2be9b832019416c7ceaebf36e15f | refs/heads/master | 2021-01-10T09:34:36.084242 | 2016-04-26T12:59:39 | 2016-04-26T12:59:39 | 56,303,739 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.kaaterskil.workflow.engine.parser.handler;
import java.util.Collection;
import com.kaaterskil.workflow.bpm.foundation.BaseElement;
import com.kaaterskil.workflow.engine.parser.BpmParser;
public interface ParseHandler {
Collection<Class<? extends BaseElement>> getHandledTypes();
void parse(BpmParser parser, BaseElement target);
}
| [
"bcaple@akamai.com"
] | bcaple@akamai.com |
4bfc605e883373ff9e1f4b20f9070010d1af7018 | 96158be9b9d611414de46a6ddfae3e921d107695 | /src/main/java/com/tebeshir/dao/FollowPostDAO.java | 389856b2d4735d5238c1bfdead2a85b7c7c96fbb | [] | no_license | ytimocin/tebeshir-web-app | e75eb40f2036a2442f9c43f36db8f63ebba1f8fc | 0e99236b151e5324e215014dfdd89f6ee92ed4f7 | refs/heads/master | 2021-01-10T21:58:00.102655 | 2015-11-25T09:41:48 | 2015-11-25T09:41:48 | 46,850,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,341 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.tebeshir.dao;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author yetkin.timocin
*/
public class FollowPostDAO {
private CallableStatement callStmt;
public int followPost(int postID, int studentID) throws InstantiationException, IllegalAccessException, SQLException {
int result = -1;
ResultSet rs = null;
Connection dbConn = PostgresConnection.getConnection();
try {
dbConn.setAutoCommit(false);
callStmt = dbConn.prepareCall("{? = call behati.pkgPostOperations.followPost(?, ?)}");
callStmt.registerOutParameter(1, java.sql.Types.NUMERIC);
callStmt.setInt(2, postID);
callStmt.setInt(3, studentID);
callStmt.execute();
result = callStmt.getBigDecimal(1).intValue();
} catch (SQLException ex) {
ex.printStackTrace(System.err);
} finally {
PostgresConnection.closeResultSet(rs);
PostgresConnection.closeStatement(callStmt);
PostgresConnection.commit(dbConn);
PostgresConnection.closeConnection(dbConn);
}
return result;
}
public int unfollowPost(int postID, int studentID) throws InstantiationException, IllegalAccessException, SQLException {
int result = -1;
ResultSet rs = null;
Connection dbConn = PostgresConnection.getConnection();
try {
dbConn.setAutoCommit(false);
callStmt = dbConn.prepareCall("{? = call behati.pkgPostOperations.unfollowPost(?, ?)}");
callStmt.registerOutParameter(1, java.sql.Types.NUMERIC);
callStmt.setInt(2, postID);
callStmt.setInt(3, studentID);
callStmt.execute();
result = callStmt.getBigDecimal(1).intValue();
} catch (SQLException ex) {
ex.printStackTrace(System.err);
} finally {
PostgresConnection.closeResultSet(rs);
PostgresConnection.closeStatement(callStmt);
PostgresConnection.commit(dbConn);
PostgresConnection.closeConnection(dbConn);
}
return result;
}
}
| [
"yeko@Yetkin-MacBook-Pro.local"
] | yeko@Yetkin-MacBook-Pro.local |
45e3d49cf6b06f17e92b3a8f3773d0842c4f1896 | 609dcd1fd65cb4c364eb5220a971de4485c26758 | /IMLib/build/generated/source/buildConfig/androidTest/debug/io/rong/imlib/test/BuildConfig.java | 59878d40ea4a3b6cd47f9535e7721c4c70059d5c | [] | no_license | xueqin123/RongCloudDemo | 3e88786ff2a2af5069da85cab5eb36ab9e683318 | bc5d6fa107316a914dbd9983e44be7a75a369cc5 | refs/heads/master | 2021-09-17T22:58:07.622621 | 2018-07-06T09:22:47 | 2018-07-06T09:22:47 | 103,253,616 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package io.rong.imlib.test;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "io.rong.imlib.test";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 2017082318;
public static final String VERSION_NAME = "2.8.16 Stable";
}
| [
"qinxue@rongcloud.cn"
] | qinxue@rongcloud.cn |
39d9034e991a840d7f10e0f3eb20d07771dd3ef0 | 5a01f73bbb2fcadaf2837f4a924b1e7e147ef27d | /family/src/test/java/geektrust/family/relations/DaughterTest.java | 57c7d5a0260206cad74ee91984714917595179bf | [] | no_license | imsushil/Meet-The-Family | 08a6be400353c10328ad63c0f600510517a2c76c | ddfcdb9e4af8f24fb7b547e3a800d0a009f48a6a | refs/heads/master | 2021-05-22T16:42:25.274917 | 2020-06-15T18:57:36 | 2020-06-15T18:57:36 | 253,007,310 | 0 | 0 | null | 2020-10-13T20:54:29 | 2020-04-04T13:43:05 | Java | UTF-8 | Java | false | false | 1,437 | java | package geektrust.family.relations;
import geektrust.family.QueryProcessor;
import geektrust.family.pojo.Family;
import geektrust.family.pojo.Member;
import geektrust.family.relations.impl.Daughter;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import static geektrust.family.pojo.Constants.NONE;
public class DaughterTest {
private Family family;
private Daughter daughter;
@Before
public void setUp() throws IOException{
family = new Family();
QueryProcessor queryProcessor = new QueryProcessor();
queryProcessor.processInitCommand(family);
daughter = new Daughter();
}
@Test
public void findDaughterTest() {
String name = "Vich";
Optional<Member> angaOpt = family.searchMemberUtil(name);
Member member = angaOpt.orElseThrow(() -> new RuntimeException("Member not found."));
List<String> daughters = Arrays.asList(daughter.of(member).split(" "));
Assert.assertThat(daughters, CoreMatchers.hasItems("Vila", "Chika"));
}
@Test
public void noDaughterTest() {
String name = "Dritha";
Optional<Member> angaOpt = family.searchMemberUtil(name);
Member member = angaOpt.orElseThrow(() -> new RuntimeException("Member not found."));
String daughters = daughter.of(member);
Assert.assertTrue(daughters.equalsIgnoreCase(NONE));
}
}
| [
"sushil7161@gmail.com"
] | sushil7161@gmail.com |
10d007286cb211a0d74b6fba442d42a972c27f39 | edb3d51743629b37f0100498cec59104b32a20aa | /src/main/java/topic/heap/TopKFrequentElements.java | 27774feaa916c52779f4cb4025b9b49950a09939 | [] | no_license | wangxi761/solution | 9fdf3b6c62c8d47b33c9d220f27b8750adf6fd9c | a6329fc912b0cda2e1882400c00997c87bf4cfec | refs/heads/master | 2023-08-08T05:25:37.255530 | 2023-06-20T15:37:07 | 2023-06-20T15:37:07 | 137,974,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,878 | java | package topic.heap;
import java.util.*;
public class TopKFrequentElements {
public List<Integer> topKFrequent(int[] nums, int k) {
List<Integer> res = new ArrayList<>();
Map<Integer, Integer> map = new HashMap<>();
for (int num : nums) {
map.put(num, map.getOrDefault(num, 0) + 1);
}
List<Map.Entry<Integer, Integer>> list = new ArrayList<>(map.entrySet());
list.sort(Comparator.<Map.Entry<Integer, Integer>, Integer>comparing(Map.Entry::getValue).reversed());
for (int i = 0; i < k; i++) {
res.add(list.get(i).getKey());
}
return res;
}
public List<Integer> topKFrequent1(int[] nums, int k) {
Map<Integer, Integer> cache = new HashMap<>();
for (int num : nums) {
cache.put(num, cache.getOrDefault(num, 0) + 1);
}
PriorityQueue<Map.Entry<Integer, Integer>> queue = new PriorityQueue<>(Comparator.comparing(Map.Entry::getValue));
for (Map.Entry<Integer, Integer> entry : cache.entrySet()) {
if (queue.size() < k) {
queue.offer(entry);
} else if (queue.peek().getValue() < entry.getValue()) {
queue.poll();
queue.offer(entry);
}
}
List<Integer> res = new ArrayList<>();
while (!queue.isEmpty()) {
res.add(0, queue.poll().getKey());
}
return res;
}
public List<Integer> topKFrequent2(int[] nums, int k) {
Map<Integer, Integer> cache = new HashMap<>();
for (int num : nums) {
cache.put(num, cache.getOrDefault(num, 0) + 1);
}
List<Integer>[] buckets = new List[nums.length + 1];
for (Map.Entry<Integer, Integer> entry : cache.entrySet()) {
if (buckets[entry.getValue()] == null) {
buckets[entry.getValue()] = new ArrayList<>();
}
buckets[entry.getValue()].add(entry.getKey());
}
List<Integer> res = new ArrayList<>();
for (int i = buckets.length - 1; i >= 0 && res.size() < k; i--) {
if (buckets[i] != null) {
res.addAll(buckets[i]);
}
}
return res;
}
} | [
"346461036@qq.com"
] | 346461036@qq.com |
8073e2c2cdfa1f7dff70ad4a065d7882be6aacef | 9165bb9f1624fcce098a08bb959c25bcb5cf53d0 | /ACSYambing/src/HashTables/WordTester.java | 6fa1c952bd0b41455ac95334cc5cf266ddf7ce9a | [] | no_license | jyambing/ACS2015-2016 | 5d29529e59d5610393582828b4b08c4c6a70d1cc | 2394b46ee57a085330443b2a266baa18808daef5 | refs/heads/master | 2021-01-19T04:06:01.042716 | 2016-05-23T14:21:08 | 2016-05-23T14:21:08 | 87,349,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package HashTables;
//© A+ Computer Science - www.apluscompsci.com
//Name -
//Date -
//Class -
//Lab -
public class WordTester
{
public static void main(String[] args)
{
Word one = new Word("45alligator");
System.out.println(one.hashCode()); //should out 4
Word two = new Word("cat");
System.out.println(two.hashCode()); //should out 3
Word three = new Word("whootit");
System.out.println(three.hashCode()); //should out 1
}
} | [
"779462@apps.district196.org"
] | 779462@apps.district196.org |
311f9489199d4a15bb7e2da8bb1fa754645b89cd | 9001175ddb7039ffba19a3d809959ba4a9ef6c0f | /AI_Lab3/src/main/java/it/polito/ai14/lab/Costanti.java | 29b23d3602765005ec591671f461df3595f5f4ae | [] | no_license | fausone-alessio/ai2014 | cc756d35a6e1de20598149a933a2f521f6d15d7d | fbe140a57baecb46fa0002812c4955eb06bf8dfd | refs/heads/master | 2016-09-06T08:00:35.598461 | 2014-05-09T23:09:08 | 2014-05-09T23:09:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package it.polito.ai14.lab;
public class Costanti {
public static final int UTENTE = 0;
public static final int PWD = 1;
public static final int PWDTIME = 2;
public static final int RUOLO = 3;
public static final String dbUtenti = "/WEB-INF/users.txt";
}
| [
"bianco.riccardo@gmail.com"
] | bianco.riccardo@gmail.com |
cad004cd2014deb8fa8d67c4cc334678efa83616 | a0b19da2c0dc6fe016c1d73f7c13a44fd61c2f9f | /xxgk/src/main/java/com/dk/mp/xxgk/db/IntroDBHelper.java | 13d39f4ab2a6d43e0e9d525fad3dea7f30ca425f | [] | no_license | lulingyu/Czwx | efe6b7b467e99a8af7796e9c24ccde55b533d0ac | 9f4cad2d1233313793bb761ba95eaf9488716323 | refs/heads/master | 2021-01-23T18:44:20.385625 | 2017-09-14T09:15:35 | 2017-09-14T09:15:42 | 102,803,920 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,632 | java | package com.dk.mp.xxgk.db;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.dk.mp.core.util.Logger;
import com.dk.mp.xxgk.entity.Depart;
import com.dk.mp.xxgk.entity.History;
import com.dk.mp.xxgk.entity.Introduction;
/**
* 概况数据库.
*
* @since
* @version 2014-9-26
* @author zhaorm
*/
public class IntroDBHelper extends SQLiteOpenHelper{
private SQLiteDatabase sqlitedb;
public static final String TABLE_SCHOOL_INFO = "INTRO_SCHOOL_INFO",
TABLE_HISTROY = "INTRO_HISTROY",
TABLE_DEPART_INFO = "INTRO_DEPART_INFO";
private static final String ID = "id", CONTENT = "content", IMG = "img",
TIMESTAMP = "TIMESTAMP", NAME = "name", TITLE = "TITLE",
TIME = "TIME";
public IntroDBHelper(Context context) {
super(context, "schiofo.db", null, 2);
// 实例化默认数据库辅助操作对象
sqlitedb = getWritableDatabase(); // 实例化数据库
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(createSchoolInfoTable());
db.execSQL(createHistoryTable());
db.execSQL(createDepartTable());
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
/**
* 创建学院介绍表.
*/
public static String createSchoolInfoTable() {
StringBuffer sql1 = new StringBuffer("CREATE TABLE IF NOT EXISTS "
+ TABLE_SCHOOL_INFO + "(" + ID + " INTEGER ");
sql1.append("," + IMG + " text");
sql1.append("," + CONTENT + " text");
sql1.append("," + TIMESTAMP + " text");
sql1.append(" )");
return sql1.toString();
}
/**
* 创建辉煌校史表.
*/
public static String createHistoryTable() {
StringBuffer sql2 = new StringBuffer("CREATE TABLE IF NOT EXISTS "
+ TABLE_HISTROY + "(" + ID + " text ");
sql2.append("," + CONTENT + " text");
sql2.append("," + IMG + " text");
sql2.append("," + TITLE + " text");
sql2.append("," + TIME + " text");
sql2.append("," + TIMESTAMP + " text");
sql2.append(" )");
return sql2.toString();
}
/**
* 创建院系介绍表.
*/
public static String createDepartTable() {
StringBuffer sql2 = new StringBuffer("CREATE TABLE IF NOT EXISTS "
+ TABLE_DEPART_INFO + "(" + ID + " text ");
sql2.append("," + NAME + " text");
sql2.append("," + CONTENT + " text");
sql2.append("," + TIMESTAMP + " text");
sql2.append(" )");
return sql2.toString();
}
/**
* 插入院系数据.
* News
*/
public void insertTable(List<Depart> list) {
try {
for (int i = 0; i < list.size(); i++) {
Depart depart = list.get(i);
ContentValues cv = new ContentValues();
cv.put(ID, depart.getId());
cv.put(TIMESTAMP, depart.getTimeStamp());
cv.put(CONTENT, depart.getContent());
cv.put(NAME, depart.getName());
boolean b = checkUpdate(TABLE_DEPART_INFO, depart.getId());
if (b) {
sqlitedb.update(TABLE_DEPART_INFO, cv,
ID + "=" + depart.getId(), null);
} else {
sqlitedb.insert(TABLE_DEPART_INFO, null, cv);
}
}
} catch (Exception e) {
Logger.info("插入数据失败");
e.printStackTrace();
} finally {
sqlitedb.close();
}
}
/**
* 插入校史数据.
* history
*/
public void updateHistory(History history) {
try {
ContentValues cv = new ContentValues();
cv.put(ID, history.getIdHistory());
cv.put(CONTENT, history.getContext());
cv.put(IMG, history.getImage());
cv.put(TITLE, history.getTitle());
cv.put(TIME, history.getTime());
cv.put(TIMESTAMP, history.getTimeStamp());
if (checkUpdate(TABLE_HISTROY, history.getIdHistory())) {
sqlitedb.update(TABLE_HISTROY, cv,
ID + "='" + history.getIdHistory() + "'", null);
} else {
sqlitedb.insert(TABLE_HISTROY, null, cv);
}
} catch (Exception e) {
e.printStackTrace();
Logger.info("update 数据失败");
} finally {
sqlitedb.close();
}
}
/**
* 插入校园简介数据.
*
* @param introduction
*/
public void updateSchoolInfo(final Introduction introduction) {
try {
ContentValues cv = new ContentValues();
cv.put(CONTENT, introduction.getContent());
cv.put(TIMESTAMP, introduction.getTimeStamp());
cv.put(ID, introduction.getIdIntroduction());
cv.put(IMG, introduction.getImg());
if (checkUpdate(TABLE_SCHOOL_INFO, introduction.getIdIntroduction())
&& !"".equals(introduction.getIdIntroduction())) {
sqlitedb.update(TABLE_SCHOOL_INFO, cv,
ID + "=" + introduction.getIdIntroduction(), null);
} else {
sqlitedb.insert(TABLE_SCHOOL_INFO, null, cv);
}
} catch (Exception e) {
e.printStackTrace();
Logger.info("update 数据失败");
} finally {
sqlitedb.close();
}
}
/**
* 检查更新.
*
* @param tableName
* @param id
* @return
*/
private boolean checkUpdate(String tableName, String id) {
Cursor cur = sqlitedb.rawQuery("SELECT * FROM " + tableName + " WHERE "
+ ID + "='" + id + "'", null);
if (cur != null) {
return cur.getCount() > 0;
}
return false;
}
/**
* 查询院系介绍.
*/
public List<Depart> getDepartList(String name) {
Cursor cur = null;
List<Depart> list = new ArrayList<Depart>();
String sql = "SELECT * FROM " + TABLE_DEPART_INFO;
if (null != name && !"".equals(name)) {
sql = sql + " WHERE " + NAME + " like '%" + name + "%'";
}
sql = sql + " order by "+TIMESTAMP+" asc";
try {
cur = sqlitedb.rawQuery(sql, null);
if (cur != null) {
while (cur.moveToNext()) {
Depart depart = new Depart();
depart.setId(cur.getString(0));
depart.setName(cur.getString(1));
depart.setContent(cur.getString(2));
list.add(depart);
}
}
} catch (Exception e) {
Logger.info("搜索部门列表失败");
} finally {
if (cur != null) {
cur.close();
}
sqlitedb.close();
}
return list;
}
/**
* 查询校史.
*
* @return
*/
public History getHistory() {
Cursor cur = null;
History history = null;
String sql = "SELECT * FROM " + TABLE_HISTROY;
try {
cur = sqlitedb.rawQuery(sql, null);
if (cur != null && cur.getCount() > 0) {
history = new History();
cur.moveToFirst();
history.setIdHistory(cur.getString(0));
history.setContext(cur.getString(1));
history.setImage(cur.getString(2));
history.setTitle(cur.getString(3));
history.setTime(cur.getString(4));
history.setTimeStamp(cur.getString(5));
}
} catch (Exception e) {
Logger.info("搜索部门列表失败");
} finally {
if (cur != null) {
cur.close();
}
sqlitedb.close();
}
return history;
}
/**
* 查询校园简介.
*
* @return
*/
public Introduction getIntroduction() {
Introduction introduction = null;
Cursor cur = sqlitedb.rawQuery("SELECT * FROM " + TABLE_SCHOOL_INFO,
null);
if (cur != null && cur.getCount() > 0) {
introduction = new Introduction();
cur.moveToFirst();
introduction.setImg(cur.getString(1));
introduction.setContent(cur.getString(2));
}
if (cur != null) {
cur.close();
}
return introduction;
}
/**
* 功能:取时间戳.
*
* @param tableName
* @param columnIndex
* @return
*/
public String getTimestap(String tableName) {
String str = "";
Cursor cur = sqlitedb.query(tableName, new String[] { TIMESTAMP },
null, null, null, null, TIMESTAMP + " desc");
if (cur != null && cur.getCount() > 0) {
cur.moveToFirst();
str = cur.getString(0);
}
if (cur != null) {
cur.close();
}
return str;
}
}
| [
"github.163.yll"
] | github.163.yll |
49937505958bc23ec4424cd75c777056d45dc781 | 565fdfca5fad71c0d73bd97d0efe864b0ac9fcf3 | /app/src/main/java/com/rolandopalermo/facturacion/ec/app/api/OperationController.java | 42d6754d9628d8180bc652ee3aa018a9531308c8 | [
"MIT"
] | permissive | OscarHMG/VeronicaV2021 | 1c74e14902d31db5c574bdb369fe3fb3ad3464fc | f6995643c8c99776e54356f430c4bbd945b20d01 | refs/heads/master | 2023-07-16T19:55:41.317391 | 2021-09-07T18:02:36 | 2021-09-07T18:02:36 | 404,022,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,704 | java | package com.rolandopalermo.facturacion.ec.app.api;
import com.rolandopalermo.facturacion.ec.domain.PaymentMethod;
import com.rolandopalermo.facturacion.ec.domain.ReceiptType;
import com.rolandopalermo.facturacion.ec.domain.Supplier;
import com.rolandopalermo.facturacion.ec.domain.TaxType;
import com.rolandopalermo.facturacion.ec.domain.User;
import com.rolandopalermo.facturacion.ec.dto.CertificadoDigitalDTO;
import com.rolandopalermo.facturacion.ec.dto.EmpresaDTO;
import com.rolandopalermo.facturacion.ec.dto.MetodoPagoDTO;
import com.rolandopalermo.facturacion.ec.dto.PasswordDTO;
import com.rolandopalermo.facturacion.ec.dto.TipoDocumentoDTO;
import com.rolandopalermo.facturacion.ec.dto.TipoImpuestoDTO;
import com.rolandopalermo.facturacion.ec.dto.UsuarioDTO;
import com.rolandopalermo.facturacion.ec.dto.VeronicaResponseDTO;
import com.rolandopalermo.facturacion.ec.service.DigitalCertService;
import com.rolandopalermo.facturacion.ec.service.crud.GenericCRUDService;
import com.rolandopalermo.facturacion.ec.service.crud.UserServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
import static com.rolandopalermo.facturacion.ec.app.common.Constants.URI_OPERATIONS;
import static com.rolandopalermo.facturacion.ec.common.Constants.API_DOC_ANEXO_1;
import static com.rolandopalermo.facturacion.ec.common.Constants.SWAGGER_EMISOR;
@RestController
@RequestMapping(value = {URI_OPERATIONS})
@Api(description = "Realiza operaciones generales sobre Verónica")
public class OperationController {
@Autowired
@Qualifier("digitalCertServiceImpl")
private DigitalCertService digitalCertService;
@Autowired
@Qualifier("paymentMethodServiceImpl")
private GenericCRUDService<PaymentMethod, MetodoPagoDTO> paymentMethodService;
@Autowired
@Qualifier("taxTypeServiceImpl")
private GenericCRUDService<TaxType, TipoImpuestoDTO> taxTypeService;
@Autowired
@Qualifier("receiptTypeServiceImpl")
private GenericCRUDService<ReceiptType, TipoDocumentoDTO> receiptTypeService;
@Autowired
@Qualifier("userServiceImpl")
private GenericCRUDService<User, UsuarioDTO> userService;
@Autowired
@Qualifier("supplierServiceImpl")
private GenericCRUDService<Supplier, EmpresaDTO> supplierService;
@ApiOperation(value = "Almacena un certificado digital asociado a número de RUC")
@PostMapping(value = "certificados-digitales/empresas/{numeroRuc}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> insertDigitalCert(
@ApiParam(value = SWAGGER_EMISOR, required = true) @PathVariable("numeroRuc") String numeroRuc,
@Valid @ApiParam(value = API_DOC_ANEXO_1, required = true) @RequestBody CertificadoDigitalDTO certificadoDigital) {
digitalCertService.save(numeroRuc, certificadoDigital);
return new ResponseEntity<>(new VeronicaResponseDTO<>(true, null), HttpStatus.CREATED);
}
@ApiOperation(value = "Crea un nuevo tipo de impuesto")
@PostMapping(value = "tipos-impuesto", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> insertTaxType(
@Valid @ApiParam(value = API_DOC_ANEXO_1, required = true) @RequestBody TipoImpuestoDTO tipoImpuestoDTO) {
taxTypeService.saveOrUpdate(tipoImpuestoDTO);
return new ResponseEntity<>(new VeronicaResponseDTO<>(true, null), HttpStatus.CREATED);
}
@ApiOperation(value = "Crea un nuevo tipo de documento")
@PostMapping(value = "tipos-documento", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> insertReceiptType(
@Valid @ApiParam(value = API_DOC_ANEXO_1, required = true) @RequestBody TipoDocumentoDTO tipoDocumentoRetenidoDTO) {
receiptTypeService.saveOrUpdate(tipoDocumentoRetenidoDTO);
return new ResponseEntity<>(new VeronicaResponseDTO<>(true, null), HttpStatus.CREATED);
}
@ApiOperation(value = "Crea un nuevo método de pago")
@PostMapping(value = "metodos-pago", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> insertPaymentMethod(
@Valid @ApiParam(value = API_DOC_ANEXO_1, required = true) @RequestBody MetodoPagoDTO metodoPagoDTO) {
paymentMethodService.saveOrUpdate(metodoPagoDTO);
return new ResponseEntity<>(new VeronicaResponseDTO<>(true, null), HttpStatus.CREATED);
}
@ApiOperation(value = "Crea un nuevo usuario de la aplicación")
@PostMapping(value = "usuarios", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> insertUser(
@Valid @ApiParam(value = API_DOC_ANEXO_1, required = true) @RequestBody UsuarioDTO usuarioDTO) {
userService.saveOrUpdate(usuarioDTO);
return new ResponseEntity<>(new VeronicaResponseDTO<>(true, null), HttpStatus.CREATED);
}
@ApiOperation(value = "Actualiza la contraseña de un usuario de la aplicación")
@PutMapping(value = "usuarios/{usuario}/password", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> updatePassword(
@Valid @ApiParam(value = "Nombre de usuario", required = true) @PathVariable("usuario") String usuario,
@Valid @ApiParam(value = API_DOC_ANEXO_1, required = true) @RequestBody PasswordDTO passwordDTO) {
((UserServiceImpl) userService).updatePassword(usuario, passwordDTO);
return new ResponseEntity<>(new VeronicaResponseDTO<>(true, null), HttpStatus.CREATED);
}
@ApiOperation(value = "Registra datos de una nueva empresa")
@PostMapping(value = "empresa", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> insertSupplier(
@Valid @ApiParam(value = API_DOC_ANEXO_1, required = true) @RequestBody EmpresaDTO empresaDTO) {
supplierService.saveOrUpdate(empresaDTO);
return new ResponseEntity<>(new VeronicaResponseDTO<>(true, null), HttpStatus.CREATED);
}
@ApiOperation(value = "Retorna la información asociada a una empresa")
@GetMapping(value = "empresa/{numeroIdentificacion}", produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<Object> getBolsBySupplier(
@Valid @ApiParam(value = "Número de identificación de la empresa", required = true) @PathVariable("numeroIdentificacion") String numeroIdentificacion) {
EmpresaDTO empresa = new EmpresaDTO();
empresa.setRucPropietario(numeroIdentificacion);
List<EmpresaDTO> listSuppliers = supplierService.findAll(empresa);
if (!StringUtils.isEmpty(listSuppliers)) {
VeronicaResponseDTO<List<EmpresaDTO>> response = new VeronicaResponseDTO<>(true, listSuppliers);
return (new ResponseEntity<Object>(response, HttpStatus.OK));
} else {
return new ResponseEntity<Object>(HttpStatus.NOT_FOUND);
}
}
} | [
"rolando.roc@gmail.com"
] | rolando.roc@gmail.com |
443da46ac26c64b2bc4e763612e5cb1868af187c | e7d9b7ab98625538df2b0d2f7df97e4f4bc331fd | /commons/src/main/java/com/enliple/pudding/commons/network/vo/BaseAPI.java | 1c7344381171a23a5d602643de946ff04c854f4b | [] | no_license | ssang83/Pudding | 5c9f1703c5f7101b65c63db5af604f70474fee99 | 474fa922a1bc663bd3504c852837474da32617e8 | refs/heads/main | 2023-03-11T10:02:06.471278 | 2021-02-24T07:07:34 | 2021-02-24T07:07:34 | 341,803,579 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 470 | java | package com.enliple.pudding.commons.network.vo;
/**
* Created by Kim Joonsung on 2018-11-20.
*/
public class BaseAPI {
/**
* status : true
* message : false 인경우 메시지
*/
public boolean status;
public String message;
@Override
public String toString() {
return "BaseAPI{" +
"status=" + status +
", message='" + message + '\'' +
'}';
}
}
| [
"js.kim@petdoc.co.kr"
] | js.kim@petdoc.co.kr |
a12105785bee282864312602240775977a9024ff | 0a4cbb16160333fbf8808c3918a554a534b19e9a | /src/Lambdas/InterfaceFuncionalSupplier.java | 5ac19221ca02133b0ced5afea94896d0ea57b78b | [] | no_license | GleistonMachado/exercicios_java | d77deb429bc9d5199e04c23c85a4a509025f76b1 | c0ca45fe2a2f36da9c8d3595dc5dca3e4dbbe53b | refs/heads/master | 2023-06-25T00:09:33.063351 | 2021-07-21T14:16:30 | 2021-07-21T14:16:30 | 388,139,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package Lambdas;
import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
public class InterfaceFuncionalSupplier {
public static void main(String[] args) {
Supplier<List<String>> umaLista = () -> Arrays.asList("Ana", "Bia", "Lia", "Gui");
System.out.println(umaLista.get());
}
}
| [
"gleiston.dev@gmail.com"
] | gleiston.dev@gmail.com |
2b5615d04b1b8b57bb95e5ab3ba3aa8ef827255d | 12429e3ac85cefdf695dccc7a3c56a193e3f7cb9 | /app/src/main/java/swachbharatabhiyan/swachbharatabhiyan/DriverLoginActivity.java | 29df27f32dd62ddb032d5a5235b335836acc9457 | [] | no_license | Girrajjangid/SwachBharatAbhiyan | 640494f67d6d258165e2268cafad14a2c17b05c7 | c4adfd5455768539299c7a0cee3fcf00ea3d7a1c | refs/heads/master | 2020-03-23T16:53:07.265291 | 2018-10-07T18:07:06 | 2018-10-07T18:07:06 | 141,831,863 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,924 | java | package swachbharatabhiyan.swachbharatabhiyan;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class DriverLoginActivity extends AppCompatActivity {
EditText ET_email, ET_password;
private FirebaseAuth Authentication;
private FirebaseAuth.AuthStateListener firebaseAuthListener;
Animation anim_logo, anim_email_pass, anim_login_sign, anim_version;
ImageView anim1;
RelativeLayout anim2;
LinearLayout anim3;
//SharedPreferences prefs;
//public static final String preference = "UserData";
ProgressDialog loading;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_driver_login);
ET_email = findViewById(R.id.login_email);
ET_password = findViewById(R.id.login_password);
anim1 = findViewById(R.id.logo);
anim2 = findViewById(R.id.relative_layout_1);
anim3 = findViewById(R.id.linear_layout1);
anim_version = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.animation0);
anim_logo = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.animation1);
anim_email_pass = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.animation2);
anim_login_sign = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.animation3);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
anim2.setVisibility(View.VISIBLE);
anim3.setVisibility(View.VISIBLE);
anim1.startAnimation(anim_logo);
anim2.startAnimation(anim_email_pass);
anim3.startAnimation(anim_login_sign);
}
}, 3000);
Authentication = FirebaseAuth.getInstance();
firebaseAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
Intent intent = new Intent(DriverLoginActivity.this, DriverMapsActivity.class);
startActivity(intent);
finish();
}
}
};
}
@Override
protected void onStart() {
super.onStart();
Authentication.addAuthStateListener(firebaseAuthListener);
}
@Override
protected void onStop() {
super.onStop();
Authentication.removeAuthStateListener(firebaseAuthListener);
}
public void logIn(View view) {
final String email = ET_email.getText().toString();
final String password = ET_password.getText().toString();
if (!isConnected2()) {
Toast.makeText(DriverLoginActivity.this, "No Internet Connection", Toast.LENGTH_SHORT).show();
} else if (email.isEmpty() || !isEmailValid(email)) {
alertDialog("Invalid Email Address");
} else if (password.isEmpty() || password.length() < 5) {
ET_password.setError("at least 6 character");
alertDialog("Invalid Password");
} else {
loading = ProgressDialog.show(this, "Processing...", "Please wait...", false, false);
Authentication.signInWithEmailAndPassword(email, password).addOnCompleteListener(DriverLoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
loading.dismiss();
alertDialog("Wrong Email or Password");
}
loading.dismiss();
}
});
}
}
public void signUp(View view) {
startActivity(new Intent(DriverLoginActivity.this, SignUpActivity.class));
}
public void forgetPassword(View view) {
Toast.makeText(this, "forget password", Toast.LENGTH_SHORT).show();
}
boolean isEmailValid(String email) {
return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
}
private void alertDialog(String mess) {
final AlertDialog.Builder aBuilder = new AlertDialog.Builder(this);
aBuilder.setMessage(mess);
aBuilder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
}).create().show();
}
public boolean isConnected2() {
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected() && activeNetworkInfo.isAvailable();
}
} | [
"girraj.jangid.14581@gmail.com"
] | girraj.jangid.14581@gmail.com |
a1dd61817fe006e1413d31b4a51b0d0bc074270f | 4d7d2b851a41d7d986150ebccb7f1301b2499a67 | /QXVideoLib/src/main/java/com/gl/softphone/VqeConfig.java | 857ca2c6de01b4c86c1a0e016202c66cfc843ae8 | [] | no_license | improj/android | 0231d57f4f3c304ed38c6ff95f3cc53176b2156e | eec49b4766624f84c05fd8746ac98ed62fe13d32 | refs/heads/master | 2020-04-28T10:19:52.001946 | 2019-03-12T11:55:34 | 2019-03-12T11:55:34 | 175,197,994 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,558 | java | /**
* Copyright (c) 2017 The KQuck project authors. All Rights Reserved.
*/
package com.gl.softphone;
/**
* @author vinton
* @date 2016-12-15
* @description Voice Quality Enhanced configuration
*/
public class VqeConfig {
// Voice Echo Cancellation enabled, default true
public boolean EcEnable;
// Voice Auto Gain Control enabled, default true
public boolean AgcEnable;
// Voice Noise Suppression enabled, default true
public boolean NsEnable;
// Voice Auto Gain Control enabled on received side, default false
public boolean AgcRxEnable;
// Voice Noise Suppression enabled on received side, default false
public boolean NsRxEnable;
// AGC target level,value range:1---15, default value:6
// typical value:3(high volume) 6(medium volume) 9(small volume)
public int AgcTargetDbfs;
// AGC compressionGain ,value range:1---30,default value 9,
// typical value:12(high volume) 9(medium volume) 6(small volume)
public int AgcCompressionGaindB;
// Enable dual microphone noise suppression
public boolean DualMicNsEnable;
public int AgcRxTargetDbfs;
// AGC compressionGain ,value range:1---30,default value 9,
// typical value:12(high volume) 9(medium volume) 6(small volume)
public int AgcRxCompressionGaindB;
/**
*
*/
public VqeConfig() {
// TODO Auto-generated constructor stub
EcEnable = true;
AgcEnable = true;
NsEnable = true;
AgcRxEnable = false;
NsRxEnable = false;
AgcTargetDbfs = 6;
AgcCompressionGaindB = 9;
DualMicNsEnable = false;
}
}
| [
"16408015@qq.com"
] | 16408015@qq.com |
692543e7adf6958de9903e50e362502dfec2fb7a | 0d0c974032fd14c642dc8b6d0e299cb9a56be7d3 | /app/src/main/java/fr/m2i/notifications/Tools.java | b27202b7983ed1556dcb15ca2b1ae3953824065a | [] | no_license | DimitriDim/Notifications | 096d1a777eda9cae8c84b89c78d401cbff302e4c | cac73710103a7a63c01cbc3b380313302fcab065 | refs/heads/master | 2021-09-04T06:07:27.633745 | 2018-01-16T15:21:02 | 2018-01-16T15:21:02 | 116,817,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,253 | java | package fr.m2i.notifications;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
/**
* Created by Administrateur on 09/01/2018.
*/
public class Tools {
private static int notifID = 0;
public static int showNotification(Context ctx, String channel) {
// o = version 26 (Oreo)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return showNotificationV_26(ctx, channel, null);
} else {
return showNotificationV_25(ctx, channel, null);
}
}
public static int showNotification(Context ctx, String channel, PendingIntent intent) {
// o = version 26 (Oreo)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return showNotificationV_26(ctx, channel, intent);
} else {
return showNotificationV_25(ctx, channel, intent);
}
}
public static int showNotificationV_26(Context ctx, String channel, PendingIntent intent) {
//création du channel pour la notification
NotificationManager mNotificationManager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
// The id of the channel.
String id = "my_channel_01";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// The user-visible name of the channel.
CharSequence name = channel;
// The user-visible description of the channel.
String description = channel;
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel mChannel = new NotificationChannel(id, name, importance);
// Configure the notification channel.
mChannel.setDescription(description);
mChannel.enableLights(true);
// Sets the notification light color for notifications posted to this
// channel, if the device supports this feature.
mChannel.setLightColor(Color.RED);
mChannel.enableVibration(true);
mChannel.setVibrationPattern(new long[]
{
100, 200, 300, 400, 500, 400, 300, 200, 400
});
mNotificationManager.createNotificationChannel(mChannel);
// creation de la notification
notifID++;
// The id of the channel.
String CHANNEL_ID = "my_channel_01";
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(ctx, CHANNEL_ID)
.setSmallIcon(R.drawable.notification)
.setContentTitle("Ma premiere notification n°" + notifID)
.setContentText("Youpiiiiii V25");
// /!\ peut etre écrit ainsi:
/*NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ctx);
mBuilder.setContentText("Youpiiiiii");
mBuilder.setContentTitle("Ma premiere notification n°" + notifID);
mBuilder.setSmallIcon(R.drawable.notification);*/
// intent objet qui définit ce qu'on fait quand on clic
mBuilder.setContentIntent(intent);
mNotificationManager.notify(notifID, mBuilder.build());
}
return notifID;
}
public static int showNotificationV_25(Context ctx, String channel, PendingIntent intent) {
NotificationManager mNotificationManager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder mBuilder = new Notification.Builder(ctx);
mBuilder.setContentText("Youpiiiiii");
mBuilder.setContentTitle("Ma premiere notification n°" + notifID);
mBuilder.setSmallIcon(R.drawable.notification);
mNotificationManager.notify(notifID, mBuilder.build());
// intent objet qui définit ce qu'on fait quand on clic
mBuilder.setContentIntent(intent);
return notifID;
}
}
| [
"scrat7@gmail.com"
] | scrat7@gmail.com |
50995ae155862dcaaa3fad13b363441eb5af357f | 795c84aa52b58a562b0e2315eb4526f78cd158a4 | /src/main/java/com/biqasoft/microservice/communicator/adaptors/OptionalAdapter.java | 876e8f8a2ea004c599faa08d3ad89fedd5cc1000 | [
"Apache-2.0"
] | permissive | biqasoft-retired/microservice-communicator | 5107b0ade68d3d366889a84ae934cbd353fa0f98 | 9580f1a317d7a0d73229f445f5d97e725f7ac39c | refs/heads/master | 2021-09-18T23:45:44.185528 | 2018-03-10T13:26:09 | 2018-03-10T13:26:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,048 | java | package com.biqasoft.microservice.communicator.adaptors;
import com.biqasoft.microservice.communicator.http.MicroserviceRestTemplate;
import com.biqasoft.microservice.communicator.interfaceimpl.MicroserviceRequestInterceptor;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
/**
* Process return type {@link Optional}
*
* Created by Nikita on 10/17/2016.
*/
@Component
public class OptionalAdapter implements MicroserviceRequestInterceptor {
private static final ObjectMapper objectMapper = new ObjectMapper();
@Override
public Object onBeforeReturnResult(Object modifiedObject, Object originalObject, Object payload, Class returnType, MicroserviceRestTemplate restTemplate, Class[] returnGenericType, Map<String, Object> params) {
if (returnType.equals(Optional.class)) {
if (originalObject == null) {
return Optional.empty();
}
if (originalObject instanceof byte[]) {
byte[] responseBody = (byte[]) originalObject;
if (responseBody.length == 0) {
return Optional.empty();
}
Object object;
try {
if (Collection.class.isAssignableFrom(returnGenericType[0])) {
JavaType type = objectMapper.getTypeFactory().constructCollectionType(returnGenericType[0], returnGenericType[1]);
object = objectMapper.readValue(responseBody, type);
} else {
object = objectMapper.readValue(responseBody, returnGenericType[0]);
}
return Optional.of(object);
} catch (IOException e) {
return modifiedObject;
}
}
}
return modifiedObject;
}
}
| [
"ya@nbakaev.ru"
] | ya@nbakaev.ru |
818d43fae4518638de789e1b6cab00d6b54df8e5 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/8/8_b972bb364832a4ee6f3ed34a63a088f50a459314/DefaultAbstractRepository/8_b972bb364832a4ee6f3ed34a63a088f50a459314_DefaultAbstractRepository_t.java | a5a6356c1afbcec12de1700556bf52693152cfa7 | [] | 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 | 4,142 | java | package com.aciertoteam.common.repository.impl;
import com.aciertoteam.common.interfaces.IAbstractEntity;
import com.aciertoteam.common.repository.AbstractRepository;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.ParameterizedType;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @param <T> IAbstractEntity
* @author Bogdan Nechyporenko
*/
@SuppressWarnings("unchecked")
public abstract class DefaultAbstractRepository<T extends IAbstractEntity> implements AbstractRepository<T> {
@Autowired
private SessionFactory sessionFactory;
@Override
@Transactional(readOnly = true)
public List<T> getAll() {
return getSession().createQuery("from " + getClazz().getSimpleName()).list();
}
@Override
@Transactional(readOnly = true)
public T get(Long id) {
return (T) getSession().createCriteria(getClazz()).add(Restrictions.eq("id", id)).uniqueResult();
}
@Override
public void saveAll(Collection<T> coll) {
for (T t : coll) {
save(t);
}
}
@Override
public T save(T t) {
getSession().save(t);
return t;
}
@Override
public T findByField(String fieldName, Object value) {
Criteria criteria = getSession().createCriteria(getClazz());
return (T) criteria.add(Restrictions.like(fieldName, value)).uniqueResult();
}
@Override
public Collection<T> findCollectionByField(String fieldName, Object value) {
Criteria criteria = getSession().createCriteria(getClazz());
return criteria.add(Restrictions.like(fieldName, value)).list();
}
@Override
public T saveOrUpdate(T t) {
t.check();
getSession().saveOrUpdate(t);
return t;
}
@Override
public void markAsDeleted(Long id) {
T t = get(id);
t.closeEndPeriod();
saveOrUpdate(t);
}
@Override
public void markAsDeleted(List<T> entities) {
for (T t : entities) {
t.closeEndPeriod();
saveOrUpdate(t);
}
}
@Override
public void markAsDeleted(T entity) {
entity.closeEndPeriod();
saveOrUpdate(entity);
}
@Override
public void delete(Long id) {
getSession().delete(get(id));
}
@Override
public void delete(List<T> entities) {
for (T entity : entities) {
delete(entity);
}
}
@Override
public void delete(T entity) {
getSession().delete(entity);
}
@Override
public void deleteAll() {
getSession().createQuery("delete from " + getClazz().getSimpleName()).executeUpdate();
}
@Override
public List<T> getList(List<Long> ids) {
return getSession().createCriteria(getClazz()).add(Restrictions.in("id", ids)).list();
}
@Override
public Set<T> getSet(List<Long> ids) {
return new HashSet<T>(getList(ids));
}
@Override
public long count() {
return Long.valueOf(String.valueOf(getSession().createCriteria(getClazz())
.setProjection(Projections.rowCount()).uniqueResult()));
}
@Override
public boolean isEmpty() {
return count() == 0;
}
public Class getClazz() {
ParameterizedType superClass = (ParameterizedType) this.getClass().getGenericSuperclass();
return (Class) superClass.getActualTypeArguments()[0];
}
protected final Session getSession() {
return sessionFactory.getCurrentSession();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
df173f0421559602ae9de1be9a38d60e7df35215 | 1504250d8da1281702d5dc51044b738fe3238f3e | /app/src/main/java/co/za/roomwordssample/WordRepository.java | 717c58fc9f82591d2b6de953066d2d51fada8619 | [] | no_license | jpillay07/RoomWordsSample | 8a404f264d53ee98bfacee7c72023ddd4f3ed24a | 1cb172bde250ad99e4bd48ed7da31c3d235a2e02 | refs/heads/master | 2022-07-31T01:32:35.538479 | 2020-05-22T21:04:50 | 2020-05-22T21:04:50 | 266,192,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,478 | java | package co.za.roomwordssample;
import android.app.Application;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import androidx.lifecycle.LiveData;
import java.util.List;
public class WordRepository {
private WordDao mWordDao;
private LiveData<List<Word>> mAllWords;
public WordRepository(Application application){
WordRoomDatabase db = WordRoomDatabase.getDatabase(application);
mWordDao = db.wordDao();
mAllWords = mWordDao.getAllWords();
}
public LiveData<List<Word>> getAllWords(){
return mAllWords;
}
public void insert(Word word){
new insertAsyncTask(mWordDao).execute(word);
}
public void update(Word word){
new updateAsyncTask(mWordDao).execute(word);
}
public void deleteAll(){
new deleteAllAsyncTask(mWordDao).execute();
}
public void delete(Word word){
new deleteAsyncTask(mWordDao).execute(word);
}
private static class insertAsyncTask extends AsyncTask<Word, Void, Void>{
private WordDao mAsyncTaskDao;
@Override
protected Void doInBackground(Word... words) {
mAsyncTaskDao.insert(words[0]);
return null;
}
public insertAsyncTask(WordDao wordDao){
this.mAsyncTaskDao = wordDao;
}
}
private static class updateAsyncTask extends AsyncTask<Word, Void, Void>{
private WordDao mAsyncTaskDao;
@Override
protected Void doInBackground(Word... words) {
mAsyncTaskDao.update(words[0]);
return null;
}
public updateAsyncTask(WordDao wordDao){
this.mAsyncTaskDao = wordDao;
}
}
private static class deleteAllAsyncTask extends AsyncTask<Void, Void, Void>{
private WordDao mAsyncTaskDao;
@Override
protected Void doInBackground(Void... voids) {
mAsyncTaskDao.deleteAll();
return null;
}
public deleteAllAsyncTask(WordDao wordDao){
this.mAsyncTaskDao = wordDao;
}
}
private static class deleteAsyncTask extends AsyncTask<Word, Void, Void>{
private WordDao mAsyncTaskDao;
@Override
protected Void doInBackground(Word... words) {
mAsyncTaskDao.delete(words[0]);
return null;
}
public deleteAsyncTask(WordDao wordDao){
this.mAsyncTaskDao = wordDao;
}
}
}
| [
"jpillay07@gmail.com"
] | jpillay07@gmail.com |
d8bed0fae18968ed43ff7537b4e2f1bbeb14dc42 | 34283f1f223530073844120ba95f2070a0ee6ff0 | /Java/CamelCase.java | 4f2887e2af26d32c7d2cef3f43413c91ea5242c9 | [] | no_license | hienmv/Problems-Solving | 7275dee51bd77a3e1e7e54d73cf2fdbdb879efd6 | deaaaac9668a749f379ecc2b5e399fe0565b3138 | refs/heads/develop | 2021-06-06T04:04:38.069944 | 2021-05-04T11:32:08 | 2021-05-04T11:39:11 | 135,049,232 | 8 | 0 | null | 2021-05-03T11:51:23 | 2018-05-27T13:33:39 | Java | UTF-8 | Java | false | false | 446 | java | /**
* https://www.hackerrank.com/challenges/camelCase/problem tag: #implementation just count uppercase
* Chacter.
*/
import java.util.Scanner;
public class CamelCase {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.next();
int count = 1;
for (char c : str.toCharArray()) {
if (c >= 'A' && c <= 'Z') {
count++;
}
}
System.out.println(count);
}
}
| [
"hienmv.vn@gmail.com"
] | hienmv.vn@gmail.com |
44fcb3dda6fa2c3345850b9c7b02b2aceafd3076 | 3dd2f910d26cd3346be2e96a7749f2118c56646f | /app/src/main/java/com/codingwithmitch/foodrecipes/viewmodels/RecipeViewModel.java | e097b8fed09f15c7430dbdfdbc1ff57c3b34e72a | [] | no_license | kellymckinnon/FoodRecipes-MVVM | 134db2e84385e7372cf1e4b34a06e609ab516ce9 | 0703655d7d61e584d1b2f2a8c0412b332beb521c | refs/heads/master | 2021-01-02T02:19:06.627091 | 2020-04-19T06:23:15 | 2020-04-19T06:23:15 | 239,451,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 782 | java | package com.codingwithmitch.foodrecipes.viewmodels;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import com.codingwithmitch.foodrecipes.models.Recipe;
import com.codingwithmitch.foodrecipes.repositories.RecipeRepository;
import com.codingwithmitch.foodrecipes.util.Resource;
public class RecipeViewModel extends AndroidViewModel {
private final RecipeRepository mRecipeRepository;
public RecipeViewModel(@NonNull Application application) {
super(application);
mRecipeRepository = RecipeRepository.getInstance(application);
}
public LiveData<Resource<Recipe>> searchRecipesApi(String recipeId) {
return mRecipeRepository.searchRecipesApi(recipeId);
}
}
| [
"kellymckinnon@utexas.edu"
] | kellymckinnon@utexas.edu |
2c04c2959333265aa285ed46047de9b57deb1661 | 944a2f9e8874b0626ebddd4567367d0893ba9e8b | /src/main/java/naw/spring/recipespring/models/Notes.java | 23b67534c1919d0df330017df550c13db6fc3fb7 | [] | no_license | BouakkezAnouar/RecipeSpringBoot | a8e1c0d9278ba63757bae2992353c3e294eb389c | 515403950dbc6f440a82efd690570cbc727b1a4e | refs/heads/master | 2020-04-20T09:03:04.783000 | 2019-02-01T21:06:15 | 2019-02-01T21:06:15 | 168,755,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | package naw.spring.recipespring.models;
import javax.persistence.*;
@Entity
public class Notes {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id ;
@OneToOne
private Recipe recipe ;
@Lob
private String recipeNotes ;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Recipe getRecipe() {
return recipe;
}
public void setRecipe(Recipe recipe) {
this.recipe = recipe;
}
public String getRecipeNotes() {
return recipeNotes;
}
public void setRecipeNotes(String recipeNotes) {
this.recipeNotes = recipeNotes;
}
}
| [
"anouar.bouakkez@gmail.com"
] | anouar.bouakkez@gmail.com |
7d5b8e5ab53e87fc5baa4afc7e0504908f6274bd | b52bc196fba38085670eb2ff28e473d221ee9b24 | /Practico_I/src/main/java/Punto4/Client.java | f2d5a667d18880ef4088288f2716234ce9f0fc77 | [] | no_license | LucianoPal/SD-Practico_I | fa9e9141ba1429cdc8ce6f2c75f1ba02ff8a287c | b641c41a5166dda25a1722cba63030f1cf3898e2 | refs/heads/master | 2021-05-21T21:41:01.727042 | 2020-04-03T18:54:26 | 2020-04-03T18:54:26 | 252,813,728 | 0 | 0 | null | 2020-10-13T20:53:28 | 2020-04-03T18:48:19 | Java | UTF-8 | Java | false | false | 4,112 | java | package Punto4;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
import org.json.JSONObject;
public class Client {
public static void main(String[] args) {
try {
System.out.println("Ingrese el ID del cliente");
Scanner scn = new Scanner(System.in);
String clienteID = scn.nextLine();
Socket servidor = new Socket("127.0.0.1", 9000);
System.out.println("Cliente iniciado");
boolean salir = true;
PrintWriter output;
BufferedReader input;
String mensajeRta;
while (salir) {
System.out.println("Ingrese la operacion que desea realizar");
System.out.println("1 - Enviar");
System.out.println("2 - Leer");
System.out.println("3 - Borrar mensajes");
System.out.println("0 - Salir");
char op = scn.next().charAt(0);
Integer opcion = (int) op;
long inicio;
long fin;
long tiempo;
switch (opcion) {
case 49:
System.out.println("Ingrese el ID del cliente que desea enviarle un mensaje");
String id = new Scanner(System.in).nextLine();
System.out.println("Ingrese el asunto del msj: ");
String asunto = new Scanner(System.in).nextLine();
System.out.println("Ingrese el cuerpo del msj: ");
String cuerpo = new Scanner(System.in).nextLine();
String mensaje = new JSONObject()
.put("asunto",asunto)
.put("cuerpo",cuerpo).toString();
if (mensaje == null) {
System.err.println("Debe ingresar un mensaje\n");
}
else {
output = new PrintWriter(servidor.getOutputStream(), true);
mensaje = "1|" + id + "|" + mensaje;
output.println(mensaje);
System.out.println("Mensaje enviado\n");
}
break;
case 50:
output = new PrintWriter(servidor.getOutputStream(), true);
mensaje = "2|" + clienteID;
inicio = System.currentTimeMillis();
output.println(mensaje);
input = new BufferedReader(new InputStreamReader(servidor.getInputStream()));
mensajeRta = input.readLine();
fin = System.currentTimeMillis();
tiempo = fin - inicio;
System.err.println("tiempo de respuesta: " + tiempo + "\n");
String msg = mensajeRta.substring(0, mensajeRta.indexOf("|"));
mensajeRta = mensajeRta.substring(mensajeRta.indexOf("|")+1, mensajeRta.length());
int cantidad = 1;
while (!msg.equals("No hay mensajes")) {
JSONObject json = new JSONObject(msg);
System.out.println("\n\tMensaje " + cantidad);
System.out.println("Asunto:\n\t" + json.get("asunto"));
System.out.println("Cuerpo:\n\t" + json.get("cuerpo"));
cantidad++;
msg = mensajeRta.substring(0, mensajeRta.indexOf("|"));
mensajeRta = mensajeRta.substring(mensajeRta.indexOf("|")+1, mensajeRta.length());
}
if (cantidad == 1) {
System.out.println(msg);
}
System.out.println("\n");
break;
case 51:
output = new PrintWriter(servidor.getOutputStream(), true);
mensaje = "3|" + clienteID;
inicio = System.currentTimeMillis();
output.println(mensaje);
input = new BufferedReader(new InputStreamReader(servidor.getInputStream()));
mensajeRta = input.readLine();
fin = System.currentTimeMillis();
tiempo = fin - inicio;
System.err.println("tiempo de respuesta: " + tiempo + "\n");
System.out.println(mensajeRta + "\n");
break;
case 48:
output = new PrintWriter(servidor.getOutputStream(), true);
mensaje = "0|";
output.println(mensaje);
servidor.close();
System.out.println("Se cerró la conexion con el servidor");
salir = false;
break;
default:
System.out.println("Debe ingresar una opción válida");
break;
}
}
scn.close();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"luciano.palmieri.97@gmail.com"
] | luciano.palmieri.97@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.