blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e6cad72ec106960fb4aba37c8bf8397fd5984109 | 138fc010fc805b9cdeaff460350b7049e2dab052 | /src/main/java/me/MinerSheeps/PAFishingRod/commands/PAFishingRodCommand.java | 810634aef14098a91ed06b77d9b531c8cd980e9c | [] | no_license | lycano/PAFishingRod | 8f7419111368c4700e28c9fc64ab22d512e2492d | b38c625569ef405403c0c4e361a7bfd2c6256a59 | refs/heads/master | 2016-09-05T11:26:17.945516 | 2013-03-16T23:32:15 | 2013-03-16T23:32:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | java | /*
* PAFishingRod for Bukkit
* Copyright (C) 2013 Lycano <https://github.com/lycano/PAFishingRod/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.MinerSheeps.PAFishingRod.commands;
import me.MinerSheeps.PAFishingRod.utils.PAFishingRodLogger;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
/**
* Handler for the /hookit command
* @author lycano
*/
public class PAFishingRodCommand implements CommandExecutor {
String version = "";
public PAFishingRodCommand(String pluginVersion) {
this.version = pluginVersion;
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] split) {
sender.sendMessage(String.format("You are currently using %s v%s", PAFishingRodLogger.getLoggerName(), version));
return true;
}
} | [
"luricos@gmx.de"
] | luricos@gmx.de |
d75d01012257c091950719c90547f6a7901c2044 | fd40c1c8905afc32aafca76ae2d4d0d376ff10cc | /src/main/java/com/kcframework/srpingboottest/config/MailServiceImpl.java | cbd603257668b3a07f591b6f578ea40874930f27 | [] | no_license | jayangyy/srpingboottest | 3c0a5bd29d254fd9f796119521a97548d2728b16 | 02f9dffb155e354856a435dba7a049641d726490 | refs/heads/master | 2020-04-02T03:35:46.490661 | 2018-10-21T04:47:43 | 2018-10-21T04:47:43 | 153,974,299 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,325 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.kcframework.srpingboottest.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;
/**
*
* @author jayan
*/
@Component
public class MailServiceImpl {
// private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private JavaMailSender mailSender;
@Value("${mail.fromMail.addr}")
private String from;
public void sendSimpleMail(String to, String subject, String content) {
SimpleMailMessage message = new SimpleMailMessage();
message.setFrom(from);
message.setTo(to);
message.setSubject(subject);
message.setText(content);
try {
mailSender.send(message);
// logger.info("简单邮件已经发送。");
} catch (Exception e) {
// logger.error("发送简单邮件时发生异常!", e);
}
}
} | [
"361300115@qq.com"
] | 361300115@qq.com |
d2258db5afb21fff1f51af4e326da5999b863fc3 | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-identitystore/src/main/java/com/amazonaws/services/identitystore/model/transform/GroupMarshaller.java | 5c8c4c9bbb300a0ce64cc6af2cfd91081f56355f | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 2,176 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.identitystore.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.identitystore.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* GroupMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class GroupMarshaller {
private static final MarshallingInfo<String> GROUPID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("GroupId").build();
private static final MarshallingInfo<String> DISPLAYNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("DisplayName").build();
private static final GroupMarshaller instance = new GroupMarshaller();
public static GroupMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(Group group, ProtocolMarshaller protocolMarshaller) {
if (group == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(group.getGroupId(), GROUPID_BINDING);
protocolMarshaller.marshall(group.getDisplayName(), DISPLAYNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
92b877fb6d0e69c0f20ecac06967a6c0f18c37a2 | 7ef8f6010cd38a0575f5e24a5f24f34bf91ca23c | /src/main/java/com/job/finderr/model/service/impl/IndividuServiceImpl.java | 6537f93d246646412b80c0b65678a5b2f603d3f5 | [] | no_license | mohcineaitellattare/jobfinderr | 5597ec1f878d012384c164b3e894e9a75e1cce0e | 62aa8d62ae3fa3d7ed6191601963f26d556b08d6 | refs/heads/main | 2023-01-08T05:57:33.975556 | 2020-11-07T20:28:09 | 2020-11-07T20:28:09 | 310,877,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package com.job.finderr.model.service.impl;
import com.job.finderr.bean.Individu;
import com.job.finderr.model.dao.IndividuDao;
import com.job.finderr.model.service.IndividuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
@Service
@Transactional
public class IndividuServiceImpl implements IndividuService {
@Autowired
private IndividuDao individuDao;
@Override
public Individu findByReference(String reference) {
return individuDao.findByReference(reference);
}
@Override
public int save(Individu individu) {
Individu individu1=individuDao.findByReference(individu.getReference());
if (individu1!=null){
System.out.println("there is a problem in save individu");
return -1;
}
individuDao.save(individu);
return 1;
}
@Override
public List<Individu> findAll() {
return individuDao.findAll();
}
}
| [
"mohcineaitellattare@gmail.com"
] | mohcineaitellattare@gmail.com |
29a176b1ac65df0d9f1f0cd969904241786e8572 | 4d6c00789d5eb8118e6df6fc5bcd0f671bbcdd2d | /src/main/java/com/alipay/api/response/AlipayUserAgreementSignConfirmResponse.java | ba43f382adf75ee5d4ca2a71f0d016a6cb1fec25 | [
"Apache-2.0"
] | permissive | weizai118/payment-alipay | 042898e172ce7f1162a69c1dc445e69e53a1899c | e3c1ad17d96524e5f1c4ba6d0af5b9e8fce97ac1 | refs/heads/master | 2020-04-05T06:29:57.113650 | 2018-11-06T11:03:05 | 2018-11-06T11:03:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,784 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.user.agreement.sign.confirm response.
*
* @author auto create
* @since 1.0, 2018-01-08 15:35:38
*/
public class AlipayUserAgreementSignConfirmResponse extends AlipayResponse {
private static final long serialVersionUID = 5434834418137376172L;
/**
* 支付宝系统中用以唯一标识用户签约记录的编号。
*/
@ApiField("agreement_no")
private String agreementNo;
/**
* 是否海外购汇身份。值:T/F
*/
@ApiField("forex_eligible")
private String forexEligible;
/**
* 协议的当前状态。
1. TEMP:暂存,协议未生效过;
2. NORMAL:正常;
3. STOP:暂停。
*/
@ApiField("status")
private String status;
/**
* Sets agreement no.
*
* @param agreementNo the agreement no
*/
public void setAgreementNo(String agreementNo) {
this.agreementNo = agreementNo;
}
/**
* Gets agreement no.
*
* @return the agreement no
*/
public String getAgreementNo( ) {
return this.agreementNo;
}
/**
* Sets forex eligible.
*
* @param forexEligible the forex eligible
*/
public void setForexEligible(String forexEligible) {
this.forexEligible = forexEligible;
}
/**
* Gets forex eligible.
*
* @return the forex eligible
*/
public String getForexEligible( ) {
return this.forexEligible;
}
/**
* Sets status.
*
* @param status the status
*/
public void setStatus(String status) {
this.status = status;
}
/**
* Gets status.
*
* @return the status
*/
public String getStatus( ) {
return this.status;
}
}
| [
"hanley@thlws.com"
] | hanley@thlws.com |
a04a22475798654d0c850f8997eb77cbeb29238a | 002dd4f1d033584f32a6c961502be1b48fd79b21 | /course-api/src/main/java/com/xmedia/springstart/response/User/UserResponseList.java | e13a4a9c08b19cae300f98aaa14a53cbd07c6545 | [] | no_license | vananadminn/xtel.management | 841028bfb6a9106af8b01c5102d808349aa2f75b | 2c404b9ad8fdc773fa3600e6d84e50f32b9cfcbf | refs/heads/master | 2022-12-09T03:27:11.534493 | 2019-08-02T06:10:29 | 2019-08-02T06:10:29 | 195,674,806 | 0 | 0 | null | 2022-11-24T09:51:28 | 2019-07-07T16:42:18 | Java | UTF-8 | Java | false | false | 674 | java | package com.xmedia.springstart.response.User;
import java.util.List;
import com.xmedia.springstart.model.User.User;
import com.xmedia.springstart.response.BaseResponse.BaseResponse;
import org.springframework.stereotype.Component;
@Component
public class UserResponseList extends BaseResponse {
List<User> users;
public UserResponseList() {
}
public UserResponseList(String message, int code, List<User> list) {
this.setMessage(message);
this.setCode(code);
this.users = list;
}
public List<User> getUsers() {
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
}
| [
"anbvph06661@fpt.edu.vn"
] | anbvph06661@fpt.edu.vn |
148c8a3be1041b928793dfc59555f7a47afa1a98 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_944555bbde31f845b624f52f13013052e049580a/StorageManager/10_944555bbde31f845b624f52f13013052e049580a_StorageManager_t.java | 4a30f01dca67b0efc36126c9a2c2ea3e4e0a8e50 | [] | 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 | 20,881 | java | /*
* Copyright (C) 2010 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.android.providers.downloads;
import android.content.ContentUris;
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.drm.mobile1.DrmRawContent;
import android.net.Uri;
import android.os.Environment;
import android.os.StatFs;
import android.provider.Downloads;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.R;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Manages the storage space consumed by Downloads Data dir. When space falls below
* a threshold limit (set in resource xml files), starts cleanup of the Downloads data dir
* to free up space.
*/
class StorageManager {
/** the max amount of space allowed to be taken up by the downloads data dir */
private static final long sMaxdownloadDataDirSize =
Resources.getSystem().getInteger(R.integer.config_downloadDataDirSize) * 1024 * 1024;
/** threshold (in bytes) beyond which the low space warning kicks in and attempt is made to
* purge some downloaded files to make space
*/
private static final long sDownloadDataDirLowSpaceThreshold =
Resources.getSystem().getInteger(
R.integer.config_downloadDataDirLowSpaceThreshold)
* sMaxdownloadDataDirSize / 100;
/** see {@link Environment#getExternalStorageDirectory()} */
private final File mExternalStorageDir;
/** see {@link Environment#getDownloadCacheDirectory()} */
private final File mSystemCacheDir;
/** The downloaded files are saved to this dir. it is the value returned by
* {@link Context#getCacheDir()}.
*/
private final File mDownloadDataDir;
/** the Singleton instance of this class.
* TODO: once DownloadService is refactored into a long-living object, there is no need
* for this Singleton'ing.
*/
private static StorageManager sSingleton = null;
/** how often do we need to perform checks on space to make sure space is available */
private static final int FREQUENCY_OF_CHECKS_ON_SPACE_AVAILABILITY = 1024 * 1024; // 1MB
private int mBytesDownloadedSinceLastCheckOnSpace = 0;
/** misc members */
private final Context mContext;
/**
* maintains Singleton instance of this class
*/
synchronized static StorageManager getInstance(Context context) {
if (sSingleton == null) {
sSingleton = new StorageManager(context);
}
return sSingleton;
}
private StorageManager(Context context) { // constructor is private
mContext = context;
mDownloadDataDir = context.getCacheDir();
mExternalStorageDir = Environment.getExternalStorageDirectory();
mSystemCacheDir = Environment.getDownloadCacheDirectory();
startThreadToCleanupDatabaseAndPurgeFileSystem();
}
/** How often should database and filesystem be cleaned up to remove spurious files
* from the file system and
* The value is specified in terms of num of downloads since last time the cleanup was done.
*/
private static final int FREQUENCY_OF_DATABASE_N_FILESYSTEM_CLEANUP = 250;
private int mNumDownloadsSoFar = 0;
synchronized void incrementNumDownloadsSoFar() {
if (++mNumDownloadsSoFar % FREQUENCY_OF_DATABASE_N_FILESYSTEM_CLEANUP == 0) {
startThreadToCleanupDatabaseAndPurgeFileSystem();
}
}
/* start a thread to cleanup the following
* remove spurious files from the file system
* remove excess entries from the database
*/
private Thread mCleanupThread = null;
private synchronized void startThreadToCleanupDatabaseAndPurgeFileSystem() {
if (mCleanupThread != null && mCleanupThread.isAlive()) {
return;
}
mCleanupThread = new Thread() {
@Override public void run() {
removeSpuriousFiles();
trimDatabase();
}
};
mCleanupThread.start();
}
void verifySpaceBeforeWritingToFile(int destination, String path, long length)
throws StopRequestException {
// do this check only once for every 1MB of downloaded data
if (incrementBytesDownloadedSinceLastCheckOnSpace(length) <
FREQUENCY_OF_CHECKS_ON_SPACE_AVAILABILITY) {
return;
}
verifySpace(destination, path, length);
}
void verifySpace(int destination, String path, long length) throws StopRequestException {
resetBytesDownloadedSinceLastCheckOnSpace();
File dir = null;
if (Constants.LOGV) {
Log.i(Constants.TAG, "in verifySpace, destination: " + destination +
", path: " + path + ", length: " + length);
}
if (path == null) {
throw new IllegalArgumentException("path can't be null");
}
switch (destination) {
case Downloads.Impl.DESTINATION_CACHE_PARTITION:
case Downloads.Impl.DESTINATION_CACHE_PARTITION_NOROAMING:
case Downloads.Impl.DESTINATION_CACHE_PARTITION_PURGEABLE:
dir = mDownloadDataDir;
break;
case Downloads.Impl.DESTINATION_EXTERNAL:
dir = mExternalStorageDir;
break;
case Downloads.Impl.DESTINATION_SYSTEMCACHE_PARTITION:
dir = mSystemCacheDir;
break;
case Downloads.Impl.DESTINATION_FILE_URI:
if (path.startsWith(mExternalStorageDir.getPath())) {
dir = mExternalStorageDir;
} else if (path.startsWith(mDownloadDataDir.getPath())) {
dir = mDownloadDataDir;
} else if (path.startsWith(mSystemCacheDir.getPath())) {
dir = mSystemCacheDir;
}
break;
}
if (dir == null) {
throw new IllegalStateException("invalid combination of destination: " + destination +
", path: " + path);
}
findSpace(dir, length, destination);
}
/**
* finds space in the given filesystem (input param: root) to accommodate # of bytes
* specified by the input param(targetBytes).
* returns true if found. false otherwise.
*/
private synchronized void findSpace(File root, long targetBytes, int destination)
throws StopRequestException {
if (targetBytes == 0) {
return;
}
if (destination == Downloads.Impl.DESTINATION_FILE_URI ||
destination == Downloads.Impl.DESTINATION_EXTERNAL) {
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
throw new StopRequestException(Downloads.Impl.STATUS_DEVICE_NOT_FOUND_ERROR,
"external media not mounted");
}
}
// is there enough space in the file system of the given param 'root'.
long bytesAvailable = getAvailableBytesInFileSystemAtGivenRoot(root);
if (bytesAvailable < sDownloadDataDirLowSpaceThreshold) {
/* filesystem's available space is below threshold for low space warning.
* threshold typically is 10% of download data dir space quota.
* try to cleanup and see if the low space situation goes away.
*/
discardPurgeableFiles(destination, sDownloadDataDirLowSpaceThreshold);
removeSpuriousFiles();
bytesAvailable = getAvailableBytesInFileSystemAtGivenRoot(root);
if (bytesAvailable < sDownloadDataDirLowSpaceThreshold) {
/*
* available space is still below the threshold limit.
*
* If this is system cache dir, print a warning.
* otherwise, don't allow downloading until more space
* is available because downloadmanager shouldn't end up taking those last
* few MB of space left on the filesystem.
*/
if (root.equals(mSystemCacheDir)) {
Log.w(Constants.TAG, "System cache dir ('/cache') is running low on space." +
"space available (in bytes): " + bytesAvailable);
} else {
throw new StopRequestException(Downloads.Impl.STATUS_INSUFFICIENT_SPACE_ERROR,
"space in the filesystem rooted at: " + root +
" is below 10% availability. stopping this download.");
}
}
}
if (root.equals(mDownloadDataDir)) {
// this download is going into downloads data dir. check space in that specific dir.
bytesAvailable = getAvailableBytesInDownloadsDataDir(mSystemCacheDir);
if (bytesAvailable < sDownloadDataDirLowSpaceThreshold) {
// print a warning
Log.w(Constants.TAG, "Downloads data dir: " + root +
" is running low on space. space available (in b): " + bytesAvailable);
} else if (bytesAvailable < targetBytes) {
// Insufficient space; make space.
discardPurgeableFiles(destination, sDownloadDataDirLowSpaceThreshold);
removeSpuriousFiles();
bytesAvailable = getAvailableBytesInDownloadsDataDir(mSystemCacheDir);
}
}
if (bytesAvailable < targetBytes) {
throw new StopRequestException(Downloads.Impl.STATUS_INSUFFICIENT_SPACE_ERROR,
"not enough free space in the filesystem rooted at: " + root +
" and unable to free any more");
}
}
/**
* returns the number of bytes available in the downloads data dir
* TODO this implementation is too slow. optimize it.
*/
private long getAvailableBytesInDownloadsDataDir(File root) {
File[] files = root.listFiles();
long space = sMaxdownloadDataDirSize;
if (files == null) {
return space;
}
int size = files.length;
for (int i = 0; i < size; i++) {
space -= files[i].length();
}
if (Constants.LOGV) {
Log.i(Constants.TAG, "available space (in bytes) in downloads data dir: " + space);
}
return space;
}
private long getAvailableBytesInFileSystemAtGivenRoot(File root) {
StatFs stat = new StatFs(root.getPath());
// put a bit of margin (in case creating the file grows the system by a few blocks)
long availableBlocks = (long) stat.getAvailableBlocks() - 4;
long size = stat.getBlockSize() * availableBlocks;
if (Constants.LOGV) {
Log.i(Constants.TAG, "available space (in bytes) in filesystem rooted at: " +
root.getPath() + " is: " + size);
}
return size;
}
File locateDestinationDirectory(String mimeType, int destination, long contentLength)
throws StopRequestException {
switch (destination) {
case Downloads.Impl.DESTINATION_CACHE_PARTITION:
case Downloads.Impl.DESTINATION_CACHE_PARTITION_PURGEABLE:
case Downloads.Impl.DESTINATION_CACHE_PARTITION_NOROAMING:
return mDownloadDataDir;
case Downloads.Impl.DESTINATION_SYSTEMCACHE_PARTITION:
return mSystemCacheDir;
case Downloads.Impl.DESTINATION_EXTERNAL:
File base = new File(mExternalStorageDir.getPath() + Constants.DEFAULT_DL_SUBDIR);
if (!base.isDirectory() && !base.mkdir()) {
// Can't create download directory, e.g. because a file called "download"
// already exists at the root level, or the SD card filesystem is read-only.
throw new StopRequestException(Downloads.Impl.STATUS_FILE_ERROR,
"unable to create external downloads directory " + base.getPath());
}
return base;
default:
// DRM messages should be temporarily stored internally and then passed to
// the DRM content provider
if (DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING.equalsIgnoreCase(mimeType)) {
return mDownloadDataDir;
}
throw new IllegalStateException("unexpected value for destination: " + destination);
}
}
File getDownloadDataDirectory() {
return mDownloadDataDir;
}
/**
* Deletes purgeable files from the cache partition. This also deletes
* the matching database entries. Files are deleted in LRU order until
* the total byte size is greater than targetBytes
*/
private long discardPurgeableFiles(int destination, long targetBytes) {
if (Constants.LOGV) {
Log.i(Constants.TAG, "discardPurgeableFiles: destination = " + destination +
", targetBytes = " + targetBytes);
}
String destStr = (destination == Downloads.Impl.DESTINATION_SYSTEMCACHE_PARTITION) ?
String.valueOf(destination) :
String.valueOf(Downloads.Impl.DESTINATION_CACHE_PARTITION_PURGEABLE);
String[] bindArgs = new String[]{destStr};
Cursor cursor = mContext.getContentResolver().query(
Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI,
null,
"( " +
Downloads.Impl.COLUMN_STATUS + " = '" + Downloads.Impl.STATUS_SUCCESS + "' AND " +
Downloads.Impl.COLUMN_DESTINATION + " = ? )",
bindArgs,
Downloads.Impl.COLUMN_LAST_MODIFICATION);
if (cursor == null) {
return 0;
}
long totalFreed = 0;
try {
while (cursor.moveToNext() && totalFreed < targetBytes) {
File file = new File(cursor.getString(cursor.getColumnIndex(Downloads.Impl._DATA)));
if (Constants.LOGV) {
Log.i(Constants.TAG, "purging " + file.getAbsolutePath() + " for " +
file.length() + " bytes");
}
totalFreed += file.length();
file.delete();
long id = cursor.getLong(cursor.getColumnIndex(Downloads.Impl._ID));
mContext.getContentResolver().delete(
ContentUris.withAppendedId(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, id),
null, null);
}
} finally {
cursor.close();
}
if (Constants.LOGV) {
Log.i(Constants.TAG, "Purged files, freed " + totalFreed + " for " +
targetBytes + " requested");
}
return totalFreed;
}
/**
* Removes files in the systemcache and downloads data dir without corresponding entries in
* the downloads database.
* This can occur if a delete is done on the database but the file is not removed from the
* filesystem (due to sudden death of the process, for example).
* This is not a very common occurrence. So, do this only once in a while.
*/
private void removeSpuriousFiles() {
if (Constants.LOGV) {
Log.i(Constants.TAG, "in removeSpuriousFiles");
}
// get a list of all files in system cache dir and downloads data dir
List<File> files = new ArrayList<File>();
File[] listOfFiles = mSystemCacheDir.listFiles();
if (listOfFiles != null) {
files.addAll(Arrays.asList(listOfFiles));
}
listOfFiles = mDownloadDataDir.listFiles();
if (listOfFiles != null) {
files.addAll(Arrays.asList(listOfFiles));
}
if (files.size() == 0) {
return;
}
Cursor cursor = mContext.getContentResolver().query(
Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI,
new String[] { Downloads.Impl._DATA }, null, null, null);
try {
if (cursor != null) {
while (cursor.moveToNext()) {
String filename = cursor.getString(0);
if (!TextUtils.isEmpty(filename)) {
if (Constants.LOGV) {
Log.i(Constants.TAG, "in removeSpuriousFiles, preserving file " +
filename);
}
files.remove(new File(filename));
}
}
}
} finally {
if (cursor != null) {
cursor.close();
}
}
// delete the files not found in the database
for (File file : files) {
if (file.getName().equals(Constants.KNOWN_SPURIOUS_FILENAME) ||
file.getName().equalsIgnoreCase(Constants.RECOVERY_DIRECTORY)) {
continue;
}
if (Constants.LOGV) {
Log.i(Constants.TAG, "deleting spurious file " + file.getAbsolutePath());
}
file.delete();
}
}
/**
* Drops old rows from the database to prevent it from growing too large
* TODO logic in this method needs to be optimized. maintain the number of downloads
* in memory - so that this method can limit the amount of data read.
*/
private void trimDatabase() {
if (Constants.LOGV) {
Log.i(Constants.TAG, "in trimDatabase");
}
Cursor cursor = null;
try {
cursor = mContext.getContentResolver().query(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI,
new String[] { Downloads.Impl._ID },
Downloads.Impl.COLUMN_STATUS + " >= '200'", null,
Downloads.Impl.COLUMN_LAST_MODIFICATION);
if (cursor == null) {
// This isn't good - if we can't do basic queries in our database,
// nothing's gonna work
Log.e(Constants.TAG, "null cursor in trimDatabase");
return;
}
if (cursor.moveToFirst()) {
int numDelete = cursor.getCount() - Constants.MAX_DOWNLOADS;
int columnId = cursor.getColumnIndexOrThrow(Downloads.Impl._ID);
while (numDelete > 0) {
Uri downloadUri = ContentUris.withAppendedId(
Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, cursor.getLong(columnId));
mContext.getContentResolver().delete(downloadUri, null, null);
if (!cursor.moveToNext()) {
break;
}
numDelete--;
}
}
} catch (SQLiteException e) {
// trimming the database raised an exception. alright, ignore the exception
// and return silently. trimming database is not exactly a critical operation
// and there is no need to propagate the exception.
Log.w(Constants.TAG, "trimDatabase failed with exception: " + e.getMessage());
return;
} finally {
if (cursor != null) {
cursor.close();
}
}
}
private synchronized int incrementBytesDownloadedSinceLastCheckOnSpace(long val) {
mBytesDownloadedSinceLastCheckOnSpace += val;
return mBytesDownloadedSinceLastCheckOnSpace;
}
private synchronized void resetBytesDownloadedSinceLastCheckOnSpace() {
mBytesDownloadedSinceLastCheckOnSpace = 0;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
b363376d4d296d6df065523a432cf1e63bd49fd9 | 666395038e04da2d140e338a9e343f34d1009d80 | /usertype.spi/src/main/java/org/jadira/usertype/spi/shared/AbstractUserTypeHibernateIntegrator.java | ddf88e7e60c951e07311d110b4fa932feae3c83e | [
"Apache-2.0"
] | permissive | olliefreeman/jadira | dc9410a5f45fa3998d66398b12af58ff5421d74a | cdd34a301e053958da3fec01595fcea0e25eb9e6 | refs/heads/master | 2021-01-15T12:28:27.366156 | 2015-09-26T01:59:38 | 2015-09-26T01:59:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,075 | java | /*
* Copyright 2011 Christopher Pheby
*
* 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.jadira.usertype.spi.shared;
import org.hibernate.boot.Metadata;
import org.hibernate.cfg.Configuration;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
import org.hibernate.usertype.CompositeUserType;
import org.hibernate.usertype.UserType;
import org.jadira.usertype.spi.utils.runtime.JavaVersion;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.Properties;
public abstract class AbstractUserTypeHibernateIntegrator implements Integrator {
private static final String REGISTER_USERTYPES_KEY = "jadira.usertype.autoRegisterUserTypes";
private static final String DEFAULT_JAVAZONE_KEY = "jadira.usertype.javaZone";
private static final String DEFAULT_DATABASEZONE_KEY = "jadira.usertype.databaseZone";
private static final String DEFAULT_SEED_KEY = "jadira.usertype.seed";
private static final String DEFAULT_CURRENCYCODE_KEY = "jadira.usertype.currencyCode";
private static final String JDBC42_API_KEY = "jadira.usertype.useJdbc42Apis";
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
try {
ConfigurationHelper.setCurrentSessionFactory(sessionFactory);
String isEnabled = configuration.getProperty(REGISTER_USERTYPES_KEY);
String javaZone = configuration.getProperty(DEFAULT_JAVAZONE_KEY);
String databaseZone = configuration.getProperty(DEFAULT_DATABASEZONE_KEY);
String seed = configuration.getProperty(DEFAULT_SEED_KEY);
String currencyCode = configuration.getProperty(DEFAULT_CURRENCYCODE_KEY);
String jdbc42Apis = configuration.getProperty(JDBC42_API_KEY);
configureDefaultProperties(sessionFactory, javaZone, databaseZone, seed, currencyCode, jdbc42Apis);
if (isEnabled != null && Boolean.valueOf(isEnabled)) {
autoRegisterUsertypes(configuration);
}
final boolean use42Api = use42Api(configuration, sessionFactory);
ConfigurationHelper.setUse42Api(sessionFactory, use42Api);
doIntegrate(configuration, sessionFactory, serviceRegistry);
} finally {
ConfigurationHelper.setCurrentSessionFactory(null);
}
}
@SuppressWarnings("deprecation")
private boolean use42Api(Configuration configuration, SessionFactoryImplementor sessionFactory) {
String jdbc42Apis = configuration.getProperty(JDBC42_API_KEY);
boolean use42Api;
if (jdbc42Apis == null) {
if (JavaVersion.getMajorVersion() >= 1 && JavaVersion.getMinorVersion() >= 8) {
Connection conn = null;
try {
JdbcServices jdbcServices = sessionFactory.getServiceRegistry().getService(JdbcServices.class);
conn = jdbcServices.getBootstrapJdbcConnectionAccess().obtainConnection();
DatabaseMetaData dmd = conn.getMetaData();
int driverMajorVersion = dmd.getDriverMajorVersion();
int driverMinorVersion = dmd.getDriverMinorVersion();
if (driverMajorVersion >= 5) {
use42Api = true;
} else if (driverMajorVersion >= 4 && driverMinorVersion >= 2) {
use42Api = true;
} else {
use42Api = false;
}
} catch (SQLException e) {
use42Api = false;
} catch (NoSuchMethodError e) {
// Occurs in Hibernate 4.2.12
use42Api = false;
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
// Ignore
}
}
}
} else {
use42Api = false;
}
} else {
use42Api = Boolean.parseBoolean(jdbc42Apis);
}
return use42Api;
}
private void autoRegisterUsertypes(Configuration configuration) {
for(UserType next : getUserTypes()) {
registerType(configuration, next);
}
for(CompositeUserType next : getCompositeUserTypes()) {
registerType(configuration, next);
}
}
private void configureDefaultProperties(SessionFactoryImplementor sessionFactory, String javaZone, String databaseZone, String seed, String currencyCode, String jdbc42Apis) {
Properties properties = new Properties();
if (databaseZone != null) { properties.put("databaseZone", databaseZone); }
if (javaZone != null) { properties.put("javaZone", javaZone); }
if (seed != null) { properties.put("seed", seed); }
if (currencyCode != null) { properties.put("currencyCode", currencyCode); }
if (jdbc42Apis != null) { properties.put("jdbc42Apis", jdbc42Apis); }
ConfigurationHelper.configureDefaultProperties(sessionFactory, properties);
}
private void registerType(Configuration configuration, CompositeUserType type) {
String className = type.returnedClass().getName();
configuration.registerTypeOverride(type, new String[] {className});
}
private void registerType(Configuration configuration, UserType type) {
String className = type.returnedClass().getName();
configuration.registerTypeOverride(type, new String[] {className});
}
/**
* {@inheritDoc}
*/
@Override
public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
// no-op
}
/**
* {@inheritDoc}
*/
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
ConfigurationHelper.configureDefaultProperties(sessionFactory, null);
}
protected abstract CompositeUserType[] getCompositeUserTypes();
protected abstract UserType[] getUserTypes();
protected void doIntegrate(Configuration configuration, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
}
}
| [
"chris@jadira.co.uk"
] | chris@jadira.co.uk |
fff365515ff5b3042abe28eb012f4dbbb6cbd9bf | 724e3a4c0c3f83a148a7c495c90ae9c6dd9616f0 | /app/src/main/java/com/radioknit/mminewapp/activity/CarCallActivity.java | f56d03528646b0945f0d5c626b9ff9e77224f0f5 | [] | no_license | AndroidPayal/MMINewAPP | b02f3a0ed2460763903c5ae5f88bd3907691a966 | 673ed52c80bd8a1ae5110b19a2508108bce8645a | refs/heads/master | 2020-05-03T09:07:31.741894 | 2019-03-30T10:47:56 | 2019-03-30T10:47:56 | 178,545,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,385 | java | package com.radioknit.mminewapp.activity;
import android.app.Activity;
import android.app.ProgressDialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.ListView;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.radioknit.mminewapp.DeviceData;
import com.radioknit.mminewapp.R;
import com.radioknit.mminewapp.Utils;
import com.radioknit.mminewapp.adapter.CarCallAdapter;
import com.radioknit.mminewapp.bluetooth.DeviceConnector;
import com.radioknit.mminewapp.bluetooth.DeviceListActivity;
import com.radioknit.mminewapp.sharedpreference.TempSharedPreference;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
public class CarCallActivity extends BaseActivity implements CarCallAdapter.CarCallIndicatorSignalListner {
private static final String TAG = "CarCallActivity";
private BluetoothAdapter bluetoothAdapter;
private static Context mContext;
private static ListView lstFloorsIndicator;
private OutputStream outputStream;
private static final String DEVICE_NAME = "DEVICE_NAME";
private static final String LOG = "LOG";
private static final SimpleDateFormat timeformat = new SimpleDateFormat("HH:mm:ss.SSS");
private static String MSG_NOT_CONNECTED;
private static String MSG_CONNECTING;
private static String MSG_CONNECTED;
private static DeviceConnector connector;
private static CarCallActivity.BluetoothResponseHandler mHandler;
DeviceListActivity deviceListActivity;
private boolean hexMode, needClean;
private boolean show_timings, show_direction;
private String command_ending;
private String deviceName;
private int counter = 1;
private ProgressDialog pd;
private StringBuffer completReceivedString;
public static int showState[]=new int[16], showStateUp[] = new int[16], showStateDown[] = new int[16];
CarCallAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferenceManager.setDefaultValues(this, R.xml.settings_activity, false);
if (mHandler == null) mHandler = new CarCallActivity.BluetoothResponseHandler(this);
else mHandler.setTarget(this);
MSG_NOT_CONNECTED = getString(R.string.msg_not_connected);
MSG_CONNECTING = getString(R.string.msg_connecting);
MSG_CONNECTED = getString(R.string.msg_connected);
setContentView(R.layout.activity_car_call);
completReceivedString = new StringBuffer();
createObj();
generateId();
registerEvent();
if (isConnected() && (savedInstanceState != null)) {
setDeviceName(savedInstanceState.getString(DEVICE_NAME));
} else getSupportActionBar().setSubtitle(MSG_NOT_CONNECTED);
}
private void createObj() {
mContext = CarCallActivity.this;
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}
private void registerEvent() {
}
private void generateId() {
lstFloorsIndicator = (ListView)findViewById(R.id.lstFloorIndicator);
adapter = new CarCallAdapter(getApplicationContext(), "00000000","00000000" , this);
for(int pos=0;pos<=15;pos++){
showState[pos]=0;
showStateUp[pos]=0;
showStateDown[pos]=0;
}
lstFloorsIndicator.setAdapter(adapter);
}
@Override
public void sendCarCallIndicatorSignal(int position) {
}
@Override
public void sendUpCallIndicatorSignal(int position) {
}
@Override
public void sendDnCallIndicatorSignal(int position) {
}
@Override
public void onBackPressed() {
super.onBackPressed();
startActivity(new Intent(mContext, MainActivity.class));
finish();
}
// ============================================================================
@Override
public synchronized void onResume() {
super.onResume();
Log.e(TAG,"onResume");
String address = TempSharedPreference.getPairedDeviceAddress(mContext);
if(Utils.isStringNotNull(address)) {
BluetoothDevice device = btAdapter.getRemoteDevice(address);
if (super.isAdapterReady() && (connector == null)) setupConnector(device);
setDeviceName(device.getName());
}
}
//========================================================================
/**
* ???????? ?????????? ??????????
*/
private boolean isConnected() {
return (connector != null) && (connector.getState() == DeviceConnector.STATE_CONNECTED);
}
// ==========================================================================
/**
* ????????? ??????????
*/
private void stopConnection() {
if (connector != null) {
connector.stop();
connector = null;
deviceName = null;
}
}
// ==========================================================================
@Override
public synchronized void onPause() {
super.onPause();
stopConnection();
}
/**
* ?????? ????????? ??? ???????????
*/
private void startDeviceListActivity() {
stopConnection();
Intent serverIntent = new Intent(this, DeviceListActivity.class);
startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);
}
// ============================================================================
/**
* ????????? ?????????? ?????? "?????"
*
* @return
*/
@Override
public boolean onSearchRequested() {
if (super.isAdapterReady()) startDeviceListActivity();
return false;
}
// ==========================================================================
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.device_control_activity, menu);
return true;
}
// ============================================================================
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_search:
if (super.isAdapterReady()) {
if (isConnected()) stopConnection();
else startDeviceListActivity();
} else {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}
return true;
case R.id.wroteModeEnable :
Intent intent = new Intent(mContext, WriteModeEnableActivity.class);
startActivityForResult(intent,WRITE_MODE_ENABLE );
return true;
default:
return super.onOptionsItemSelected(item);
}
}
// ============================================================================
@Override
public void onStart() {
super.onStart();
// hex mode
final String mode = Utils.getPrefence(this, getString(R.string.pref_commands_mode));
this.hexMode = mode.equals("HEX");
this.command_ending = getCommandEnding();
// ?????? ??????????? ???? ??????
this.show_timings = Utils.getBooleanPrefence(this, getString(R.string.pref_log_timing));
this.show_direction = Utils.getBooleanPrefence(this, getString(R.string.pref_log_direction));
this.needClean = Utils.getBooleanPrefence(this, getString(R.string.pref_need_clean));
}
// ============================================================================
/**
* ???????? ?? ???????? ??????? ????????? ???????
*/
private String getCommandEnding() {
String result = Utils.getPrefence(this, getString(R.string.pref_commands_ending));
if (result.equals("\\r\\n")) result = "\r\n";
else if (result.equals("\\n")) result = "\n";
else if (result.equals("\\r")) result = "\r";
else result = "";
return result;
}
// ============================================================================
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_CONNECT_DEVICE:
// When DeviceListActivity returns with a device to connect
if (resultCode == Activity.RESULT_OK) {
String address = data.getStringExtra(DeviceListActivity.EXTRA_DEVICE_ADDRESS);
BluetoothDevice device = btAdapter.getRemoteDevice(address);
if (super.isAdapterReady() && (connector == null)) setupConnector(device);
}
break;
case REQUEST_ENABLE_BT:
// When the request to enable Bluetooth returns
super.pendingRequestEnableBt = false;
if (resultCode != Activity.RESULT_OK) {
Utils.log("BT not enabled");
}
break;
}
}
// ==========================================================================
/**
* ????????? ?????????? ? ???????????
*/
private void setupConnector(BluetoothDevice connectedDevice) {
stopConnection();
try {
String emptyName = getString(R.string.empty_device_name);
DeviceData data = new DeviceData(connectedDevice, emptyName);
connector = new DeviceConnector(data, mHandler);
connector.connect();
} catch (IllegalArgumentException e) {
Utils.log("setupConnector failed: " + e.getMessage());
}
}
// ==========================================================================
/**
* @param message - ????? ??? ???????????
* @param outgoing - ??????????? ????????
*/
public void appendLog(String message, boolean hexMode, boolean outgoing, boolean clean) {
StringBuffer msg = new StringBuffer();
msg.append(hexMode ? Utils.toHex1(message) : message);
if (outgoing) msg.append('\n');
// logTextView.setText(msg);
// if (clean) commandEditText.setText("");
}
// =========================================================================
public void appendLog1(String message, boolean hexMode, boolean outgoing, boolean clean) {
completReceivedString.append(message);
String receivedString = new String(completReceivedString);
Log.e(TAG, "receivedString = "+receivedString);
int indexOD = receivedString.indexOf("\r");
// String temp1 = receivedString.substring(0, indexOD);
if(receivedString.contains("131143")&&receivedString.contains("\r")){
showCarCalls(receivedString);
}
if (receivedString.contains("114c50")){
showUpDnCalls(receivedString);
}
}
// =========================================================================
void setDeviceName(String deviceName) {
this.deviceName = deviceName;
getSupportActionBar().setSubtitle(deviceName);
getSupportActionBar().setTitle("Car Call");
}
// ==========================================================================
/**
* ?????????? ?????? ?????? ?? bluetooth-??????
*/
private static class BluetoothResponseHandler extends Handler {
private WeakReference<CarCallActivity> mActivity;
private String temp = "";
public BluetoothResponseHandler(CarCallActivity activity) {
mActivity = new WeakReference<CarCallActivity>(activity);
}
public void setTarget(CarCallActivity target) {
mActivity.clear();
mActivity = new WeakReference<CarCallActivity>(target);
}
@Override
public void handleMessage(Message msg) {
CarCallActivity activity = mActivity.get();
if (activity != null) {
switch (msg.what) {
case MESSAGE_STATE_CHANGE:
Utils.log("MESSAGE_STATE_CHANGE: " + msg.arg1);
final ActionBar bar = activity.getSupportActionBar();
switch (msg.arg1) {
case DeviceConnector.STATE_CONNECTED:
bar.setSubtitle(MSG_CONNECTED);
break;
case DeviceConnector.STATE_CONNECTING:
bar.setSubtitle(MSG_CONNECTING);
break;
case DeviceConnector.STATE_NONE:
bar.setSubtitle(MSG_NOT_CONNECTED);
break;
}
break;
case MESSAGE_READ:
/**
*
* /dev/ttyUSB0
*
*/
/* final String readMessage = (String) msg.obj;
temp = temp + readMessage;
if (temp.contains("\r")) {
activity.appendLog1(readMessage, false, false, activity.needClean);
temp = "";
}*/
final String readMessage = (String) msg.obj;
if (readMessage != null) {
//Log.e(TAG, " readMessage = "+ readMessage);
activity.appendLog1(readMessage, false, false, activity.needClean);
}
break;
case MESSAGE_DEVICE_NAME:
activity.setDeviceName((String) msg.obj);
break;
case MESSAGE_WRITE:
break;
case MESSAGE_TOAST:
// stub
break;
}
}
}
}
void showCarCalls(String strCarCall) {
/* CarCallAdapter adapter1 = new CarCallAdapter(mContext, "00000000","00000000",(CarCallAdapter.CarCallIndicatorSignalListner) this);
lstFloorsIndicator.setAdapter(adapter1);*/
try {
int index = strCarCall.lastIndexOf("131143");
String hexCarCallsCop1 = strCarCall.substring(index+6,index+8);
String hexCarCallsCop2 = strCarCall.substring(index+8,index+10);
String strcallCop1 = Utils.hexToBin(hexCarCallsCop1);
String strcallCop2 = Utils.hexToBin(hexCarCallsCop2);
Log.e(TAG, "hexCarCallsCop1 = "+hexCarCallsCop1);
Log.e(TAG, "strcallCop1 = "+strcallCop1);
Log.e(TAG, "hexCarCallsCop2 = "+hexCarCallsCop2);
Log.e(TAG, "strcallCop2 = "+strcallCop2);
String strCallCopCombine = strcallCop2 + strcallCop1;
for(int indexCop=0; indexCop <=15; indexCop++) {
if (strCallCopCombine.charAt(indexCop) == '0') {
showState[indexCop] = 0;
} else if(strCallCopCombine.charAt(indexCop) == '1') {
showState[indexCop] = 1;
}
}
adapter.notifyDataSetChanged();
/*CarCallAdapter adapter = new CarCallAdapter(mContext, strcallCop1, strcallCop2, (CarCallAdapter.CarCallIndicatorSignalListner) this);
lstFloorsIndicator.setAdapter(adapter);*/
}catch (Exception e){
e.printStackTrace();
}
}
private void showUpDnCalls(String strUpDn) {
/* CarCallAdapter adapter1 = new CarCallAdapter(mContext, "00000000","00000000", (CarCallAdapter.CarCallIndicatorSignalListner)this);
lstFloorsIndicator.setAdapter(adapter1);
*/
try {
int index = strUpDn.lastIndexOf("114c50");
String strChkFlr=strUpDn.substring(index-2,index);
Log.e(TAG, "strChkFlr = "+ strChkFlr);
String hexSwitchData = strUpDn.substring(index+8,index+10);
String binSwitchData = Utils.hexToBin(hexSwitchData);
Log.e(TAG, "hexSwitchData = "+ hexSwitchData);
if(strChkFlr.equals("30")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[15]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[15]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[15]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[15]=1;
}
}
if(strChkFlr.equals("31")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[14]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[14]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[14]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[14]=1;
}
}
if(strChkFlr.equals("32")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[13]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[13]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[13]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[13]=1;
}
}
if(strChkFlr.equals("33")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[12]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[12]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[12]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[12]=1;
}
}
if(strChkFlr.equals("34")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[11]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[11]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[11]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[11]=1;
}
}
if(strChkFlr.equals("35")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[10]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[10]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[10]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[10]=1;
}
}
if(strChkFlr.equals("36")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[9]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[9]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[9]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[9]=1;
}
}
if(strChkFlr.equals("37")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[8]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[8]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[8]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[8]=1;
}
}
if(strChkFlr.equals("38")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[7]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[7]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[7]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[7]=1;
}
}
if(strChkFlr.equals("39")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[6]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[6]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[6]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[6]=1;
}
}
if(strChkFlr.equals("3a")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[5]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[5]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[5]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[5]=1;
}
}
if(strChkFlr.equals("3b")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[4]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[4]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[4]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[4]=1;
}
}
if(strChkFlr.equals("3c")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[3]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[3]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[3]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[3]=1;
}
}
if(strChkFlr.equals("3d")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[2]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[2]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[2]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[2]=1;
}
}
if(strChkFlr.equals("3e")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[1]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[1]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[1]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[1]=1;
}
}
if(strChkFlr.equals("3f")){
if(binSwitchData.charAt(0)=='0'){
showStateDown[0]=0;
}
else if(binSwitchData.charAt(0)=='1'){
showStateDown[0]=1;
}
if(binSwitchData.charAt(1)=='0'){
showStateUp[0]=0;
}
else if(binSwitchData.charAt(1)=='1'){
showStateUp[0]=1;
}
}
adapter.notifyDataSetChanged();
/*String hexUpDnCalls = String.format("%04x", (int) strUpDn.charAt(index + 3));
String strUpDnCalls = Utils.hexToBin(hexUpDnCalls);
String floorNo = String.format("%04x", (int) strUpDn.charAt(index - 2));
int flrNo = Integer.parseInt(floorNo) - 30;*/
/*CarCallAdapter adapter = new CarCallAdapter(mContext, strUpDnCalls, flrNo,(CarCallAdapter.CarCallIndicatorSignalListner) this);
lstFloorsIndicator.setAdapter(adapter);*/
}catch (Exception e){
e.printStackTrace();
}
}
// ==========================================================================
}
| [
"payalagrawal2311@gmail.com"
] | payalagrawal2311@gmail.com |
cd8e5e592cd3982820326690ae61489cd97b3bdc | 7594ec598ee526d859f49a10c871381c266cf546 | /treats-euc-ui/src/main/java/com/treats/euc/ui/controller/WorkFlowController.java | d873803abc66965fe80f5c1ca3c4531e4936dbb4 | [] | no_license | DarwinWu/treats-hackathon | ed0b1a14d6e4972b2f4cb947b514e759a1324c64 | 5c7fce91f1ecc60873913dd997f25404c72b193f | refs/heads/master | 2020-03-16T20:48:44.195766 | 2018-05-13T15:28:15 | 2018-05-13T15:28:15 | 132,973,598 | 0 | 0 | null | 2018-05-11T01:35:06 | 2018-05-11T01:35:06 | null | UTF-8 | Java | false | false | 3,640 | java | package com.treats.euc.ui.controller;
import org.springframework.web.bind.annotation.RestController;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.auth.oauth2.ServiceAccountCredentials;
import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryOptions;
import com.google.cloud.bigquery.Dataset;
import com.google.cloud.bigquery.DatasetId;
import com.google.cloud.bigquery.Table;
import com.google.cloud.bigquery.TableDefinition;
import com.google.cloud.bigquery.TableDefinition.Builder;
import com.google.cloud.bigquery.TableId;
import com.google.cloud.bigquery.TableResult;
import com.treats.euc.excel.ExcelGenerator;
import com.treats.euc.model.DocumentTemplate;
import com.treats.euc.model.EucFlow;
import com.treats.euc.pdf.PdfGenerator;
import com.treats.euc.services.BigQueryServices;
import com.treats.euc.services.DataMappingServices;
import com.treats.euc.services.DocTemplateServicesDataStore;
import com.treats.euc.services.DocTemplateServicesInterface;
import com.treats.euc.services.DocTemplateServicesMemory;
import com.treats.euc.services.EmailDeliveryServices;
import com.treats.euc.services.EucFlowServicesInterface;
import com.treats.euc.services.EucFlowServicesMemory;
import com.treats.euc.ui.TreatsConstants;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@RestController
@RequestMapping("/treats-euc/workflow")
public class WorkFlowController {
@RequestMapping(value = "/execute/{workflowId}")
public String getDataSets(@PathVariable String workflowId) throws Exception {
System.out.println("execute workflow " + workflowId);
BigQueryServices bigQueryServices = new BigQueryServices();
EucFlowServicesInterface flowService = new EucFlowServicesMemory();
DocTemplateServicesInterface docTemplateService = new DocTemplateServicesDataStore();
EucFlow flowObject = flowService.getEucFlow(workflowId);
DocumentTemplate docTemplate = docTemplateService.getDocumentTemplate(flowObject.getDocumentTemplateID().toString());
if (flowObject.getOutputFormat().equals("EXCEL")) {
System.out.println("Excel output");
ArrayList<ArrayList<String>> tableArray = bigQueryServices.getTableArrayByWorkflow(flowObject);
ExcelGenerator excelGenerator = new ExcelGenerator();
if (flowObject.getOutputMedium().equals("EMAIL")) {
System.out.println("Excel-Email output");
// TODO : add email address
excelGenerator.excelEmailSend(tableArray, flowObject.getEmailAddress());
// excelGenerator.excelEmailSend(tableArray);
} else if (flowObject.getOutputMedium().equals("SERVER")) {
System.out.println("Excel-Server output");
// TODO : save excel to server
excelGenerator.excelDownload(tableArray);
}
} else if (flowObject.getOutputFormat().equals("PDF")) {
System.out.println("PDF output");
TableResult tableResult = bigQueryServices.getTableResultByWorkflow(flowObject);
DataMappingServices dataMappingServices = new DataMappingServices();
ArrayList<String> listResultPDF = dataMappingServices.matchPattern(docTemplate.getDocTemplate(), tableResult);
PdfGenerator pdf = new PdfGenerator();
pdf.generatePdf(listResultPDF, flowObject.getEmailAddress());
}
return "success";
}
}
| [
"jackychau@maplequad.com"
] | jackychau@maplequad.com |
e68b08c2d0b20b191589e4a97a0717c06164141e | f5dd04d1973cb58b5cc6e6979873afaed71f80ce | /src/main/java/com/imooc/service/EmailService.java | 65b4a2878787f5416429a61c3d3a3d0ab3d56eeb | [] | no_license | 278883741/imooc-video | d05eef057a23663cd04f7e237b84a75eef6a5f02 | 66ff2ee5ba3ea1601f3eeb9e2aa2251615368b16 | refs/heads/master | 2022-10-23T00:49:19.983650 | 2020-09-21T08:15:31 | 2020-09-21T08:15:31 | 178,350,035 | 0 | 0 | null | 2022-10-12T20:24:42 | 2019-03-29T06:56:24 | JavaScript | UTF-8 | Java | false | false | 186 | java | package com.imooc.service;
import com.imooc.model.Notice;
import com.imooc.model.SysUser;
public interface EmailService {
void emailUserNotice(Notice notice, SysUser sysUser);
}
| [
"q278883741@qq.com"
] | q278883741@qq.com |
37c04abfd6e396ade982d191dc899a678ea4e2b9 | caa12f1cdee217760c923b44fc256d8ed2ad1016 | /service/src/main/java/com/ronghui/service/common/base/BaseService.java | 24d082e13911c12529957b37bd42106394b0caea | [] | no_license | Kaiser-love/huielu-api-server | d65b1927b59fb301a8805d399768e242f78c8141 | 237e2d3aaf6c6bc550dedfc1b58f5fbce212e105 | refs/heads/master | 2020-06-29T10:02:11.846225 | 2019-08-04T15:05:39 | 2019-08-04T15:05:39 | 200,506,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.ronghui.service.common.base;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.constraints.NotEmpty;
import java.util.List;
public interface BaseService<T> extends IService<T> {
/**
* 逻辑删除
*
* @param ids id集合(逗号分隔)
* @return
*/
boolean deleteLogic(@NotEmpty List<Integer> ids);
}
| [
"13058142866@163.com"
] | 13058142866@163.com |
2b01eace07757c5e940b0bb612389036ff9aa4ce | 6b3d0133ad32b079f07039e9c210391b6dcde723 | /app/src/main/java/com/ashwinee/numberblocker/modelClasses/DatabaseInteractions.java | 3e876911771dd134e80290a9a157ec3636a00636 | [] | no_license | ashwinee08/NumberBlocker | 8b2e2757fbb89a30b98877a9ce51d24bd486351b | 81ee633758fa2202dae7605faa0715780f7ec4cb | refs/heads/master | 2020-04-08T09:27:17.928709 | 2018-11-26T19:51:54 | 2018-11-26T19:51:54 | 159,224,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,279 | java | package com.ashwinee.numberblocker.modelClasses;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by Ashwinee on 14-Nov-18.
*/
public class DatabaseInteractions extends SQLiteOpenHelper {
private static final int TABLE_VERSION=7;
private static final String TABLE_NAME="number_blocker";
private static final String DB_NAME="Number_blocked";
private static final String TABLE_BUILDER_QUERY=
"CREATE TABLE "+TABLE_NAME+"(" +
"NUMBERS_BLOCKED VARCHAR(10) PRIMARY KEY NOT NULL," +
"FLAG INTEGER DEFAULT 1," +
"COUNT INTEGER AUTO INCREAMENT DEFAULT 0);";
private static final String DELETE_TABLE_QUERY="" +
"DROP TABLE IF EXISTS "+TABLE_NAME;
public DatabaseInteractions(Context context){
super(context,DB_NAME,null,TABLE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(TABLE_BUILDER_QUERY);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if(newVersion>oldVersion){
db.execSQL(DELETE_TABLE_QUERY);
this.onCreate(db);
}
}
}
| [
"ashwinee.lkd.in@gmail.com"
] | ashwinee.lkd.in@gmail.com |
b478d67e5853eaccbb8b41b68d5c18b6355c0523 | 3b3e599f5576b7e0aa696710d90382b254cd1716 | /src/com/revature/beans/Human.java | 0baff2c328ff36a18e90327d04bc07d501207f83 | [
"MIT"
] | permissive | 2004javausf/DAY3Tina | d72361260adeeded11e70ff1d50711daaf2ed682 | 33170c0b3fcb70defbccefccbf75a62f115ecd17 | refs/heads/master | 2022-04-16T14:12:43.616824 | 2020-04-15T21:19:13 | 2020-04-15T21:19:13 | 256,023,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.revature.beans;
public class Human {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "Human [name=" + name + ", age=" + age + "]";
}
}
| [
"haruko@yeah.net"
] | haruko@yeah.net |
07b95bd6c15559434812ed7aabe091c776e5a7c1 | 1773402ffeb47f5c89447e0ac63e4450dbc72eb4 | /gen/com/rosshambrick/l/Manifest.java | 2004619feca57db3e28606ae03c7802a3768129a | [] | no_license | rosshambrick/L | b79bfe549895cb67e29c59dcaf30913bc2626530 | e609bb13e5b534f4d89f86bf2103218f9bd347e6 | refs/heads/master | 2021-01-01T18:41:32.095124 | 2014-04-24T05:04:32 | 2014-04-24T05:04:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | /*___Generated_by_IDEA___*/
package com.rosshambrick.l;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
} | [
"ross@bignerdranch.com"
] | ross@bignerdranch.com |
28c4f6db4ab27316290737b3886ff6da999143c1 | 0538ecc1dd7aaf09807e9f6d6c5a093c8c7eb5ee | /src/cn/com/trueway/workflow/set/util/HtmlHander.java | 9939a41e805a7ee3a1daaf4798f5e49defe956e3 | [] | no_license | lyt123456789/trueArchive_M | 5d78386578a2728db1bfd4b3254b2cd94eb0067a | 4037ced7e125e0987402163d1cb495cac39534e7 | refs/heads/master | 2021-02-17T17:55:34.733218 | 2020-03-05T09:52:01 | 2020-03-05T09:52:01 | 245,115,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,497 | java | package cn.com.trueway.workflow.set.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import cn.com.trueway.base.util.Constant;
import cn.com.trueway.base.util.FileUploadUtils;
import cn.com.trueway.base.util.PathUtil;
import cn.com.trueway.base.util.UrlCatcher;
import cn.com.trueway.sys.util.SystemParamConfigUtil;
import cn.com.trueway.workflow.set.pojo.FormTagMapColumn;
import cn.com.trueway.workflow.set.pojo.TagBean;
public class HtmlHander {
public String replaceHtml(String htmlPath,String elementId,int yjHeight){
Calendar calendar = Calendar.getInstance();
String pdfRoot = SystemParamConfigUtil.getParamValueByParam("workflow_file_path");
String dstPath = FileUploadUtils.getRealFolderPath(pdfRoot, Constant.GENE_FILE_PATH); // 得到上传文件在服务器上存储的唯一路径,并创建存储目录
String newHtmlPath = pdfRoot +dstPath+ String.valueOf(calendar.getTimeInMillis()) + ".html";
FileInputStream fileinputstream;
try {
fileinputstream = new FileInputStream(htmlPath);
// 下面四行:获得输入流的长度,然后建一个该长度的数组,然后把输入流中的数据以字节的形式读入到数组中,然后关闭流
int length = fileinputstream.available();
byte bytes[] = new byte[length];
fileinputstream.read(bytes);
fileinputstream.close();
String templateContent = "";
templateContent = new String(bytes, "UTF-8");
// 正则匹配
UrlCatcher u = new UrlCatcher();
String reg_yj = "<td .*?id=\""+elementId+"\"[^>]*?>";
String[] yjs = u.getStringByRegEx(templateContent, reg_yj, 2);
if(yjs != null && yjs.length >0){
for(int i = 0; i < yjs.length; i++){
Pattern p = Pattern.compile("height:(.*?)px",Pattern.DOTALL);
Matcher m = p.matcher(yjs[i]);
if(m.find()){
String tempStr = yjs[i].replace( m.group(0), "height:"+yjHeight+"px");
templateContent = templateContent.replace(yjs[i],tempStr);
}
}
}
FileOutputStream fileoutputstream = new FileOutputStream(newHtmlPath);// 建立文件输出流
OutputStreamWriter osw = new OutputStreamWriter(fileoutputstream,"UTF-8");
osw.write(templateContent);
osw.close();
} catch (Exception e) {
e.printStackTrace();
}
return newHtmlPath;
}
/**
* 将板式html转换为生成pdf的newHtml
* @param htmlpath
* @return
*/
public String getPdfPath(String htmlpath){
Calendar calendar = Calendar.getInstance();
// 生成一个新的html,用于存放值和生成pdf
String newHtmlPath = PathUtil.getWebRoot() + "form/html/newInfo_"+ String.valueOf(calendar.getTimeInMillis()) + ".html";
// 从html流中获取所有的标签数据
List<FormTagMapColumn> mapList = new ArrayList<FormTagMapColumn>();
String htmlString = readHTML(htmlpath);// 源数据
List<TagBean> tags = getTagFromHTMLString(htmlString);// 返回页面taglist
if (tags != null) {
for (int i = 0; i < tags.size(); i++) {
FormTagMapColumn m = new FormTagMapColumn();
m.setFormtagname(tags.get(i).getTagName());
m.setFormtagtype(tags.get(i).getTagType());
m.setSelectDic(tags.get(i).getSelect_dic());
m.setListId(tags.get(i).getListId());
m.setColumnCname(tags.get(i).getCommentDes());
mapList.add(m);
}
}
try {
// 读取模板文件
FileInputStream fileinputstream = new FileInputStream(htmlpath);
// 下面四行:获得输入流的长度,然后建一个该长度的数组,然后把输入流中的数据以字节的形式读入到数组中,然后关闭流
int length = fileinputstream.available();
byte bytes[] = new byte[length];
fileinputstream.read(bytes);
fileinputstream.close();
// 通过使用平台的默认字符集解码指定的 byte 数组,构造一个新的 String,
// 然后利用字符串的replaceAll()方法进行指定字符的替换,此处除了这种方法之外,应该还可以使用表达式语言${}的方法来进行。
// String start_en =
// SystemParamConfigUtil.getParamValueByParam("start_en");
// String templateContent = new String(bytes,"UTF-8");
String templateContent = "";
// if("0".equals(start_en)){
templateContent = new String(bytes, "UTF-8");
// htmlString = new String(bytes,"UTF-8");
// }
// if("1".equals(start_en)){
// templateContent = new String(bytes,"GB2312");
// htmlString = new String(bytes,"GB2312");
// }
templateContent =templateContent.replace("<html>", "<html><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />");
// ------------------------------进行内容替换-------start----------------------------------------
UrlCatcher u = new UrlCatcher();
// 获取所有input类型标签
String reg_input = "<INPUT[^<]*>";
String[] inputs = u.getStringByRegEx(htmlString, reg_input, true);
// 获取所有select类型标签
String reg_select = "<SELECT[^<]*>(</select>)?";
// String reg_select = "<SELECT.*?</select>";
String[] selects = u.getStringByRegEx(htmlString, reg_select, true);
// 获取所有textarea类型标签
String reg_textarea = "<TEXTAREA[^<]*</TEXTAREA>";
String[] textareas = u.getStringByRegEx(htmlString, reg_textarea,
true);
// 获取正文及附件类型的标签
String reg_spanAtt = "<SPAN[^<]*</SPAN>";
String[] spanAtts = u.getStringByRegEx(htmlString, reg_spanAtt,
true);
// 获取放意见标签的div
String reg_divComment = "<trueway:comment[^<]*/>";
String[] divComments = u.getStringByRegEx(htmlString,
reg_divComment, true);
// 把值填入html里
// 替换值
String req_checkbox = "<input .*?checkbox[^/]*?>.*?</input>";
String[] checkboxs = u.getStringByRegEx(templateContent, req_checkbox, true);
for (int k = 0; checkboxs!=null && k < checkboxs.length; k++) {
templateContent = templateContent.replace(checkboxs[k], "");
}
String req_radio = "<input .*?radio[^/]*?>.*?</input>";
String[] radios = u.getStringByRegEx(templateContent, req_radio, true);
for (int k = 0; radios!=null && k < radios.length; k++) {
templateContent = templateContent.replace(radios[k], "");
}
if(inputs!= null){
for(int i = 0 ; i <inputs.length ; i ++ ){
String valstr = "";
Pattern p = Pattern.compile("width:(.*?)px",Pattern.DOTALL);
Matcher m = p.matcher(inputs[i]);
if(m.find()){
valstr = m.group(1);
}
int width = 120;
if(valstr!=null && !valstr.equals("")){
width = Integer.parseInt(valstr.trim());
}
templateContent = templateContent.replace(inputs[i],"<span style='width:"+width+"px;display:-moz-inline-box;display:inline-block;' ></span>");
}
}
if(selects!= null){
for(int i = 0 ; i <selects.length ; i ++ ){
templateContent = templateContent.replace(selects[i],"");
}
}
if(textareas != null){
for(int i = 0 ; i <textareas.length ; i ++ ){
templateContent = templateContent.replace(textareas[i],"");
}
}
// ----------------------------------进行内容替换--------end----------------------------------------
// 使用平台的默认字符集将此 String 编码为 byte 序列,并将结果存储到一个新的 byte 数组中。
// byte tag_bytes[] = templateContent.getBytes();
byte[] tag_bytes = null;
// if("0".equals(start_en)){
// tag_bytes = templateContent.getBytes();
// }
// if("1".equals(start_en)){
tag_bytes = templateContent.getBytes("utf-8");
// }
// System.out.println(tag_bytes);
// byte tag_bytes[] = templateContent.getBytes("utf-8");
FileOutputStream fileoutputstream = new FileOutputStream(
newHtmlPath);// 建立文件输出流
OutputStreamWriter osw = new OutputStreamWriter(fileoutputstream,
"UTF-8");
osw.write(templateContent);
osw.close();
}catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return newHtmlPath;
}
/**
*
* @Title: getTagFromHTMLString
* @Description: 从html字符串流中获取标签信息(非常重要)
* @param htmlString
* @return List<String[]> 返回类型
*/
public List<TagBean> getTagFromHTMLString(String htmlString){
List<TagBean> tags=new ArrayList<TagBean>();
UrlCatcher u=new UrlCatcher();
String reg_input="<INPUT[^<]*>";//获取所有input类型标签
String[] inputs=u.getStringByRegEx(htmlString, reg_input, true);
String reg_select="<SELECT[^<]*>";//获取所有select类型标签
String[] selects=u.getStringByRegEx(htmlString, reg_select, true);
String reg_textarea="<TEXTAREA[^<]*</TEXTAREA>";//获取所有textarea类型标签
String[] textareas=u.getStringByRegEx(htmlString, reg_textarea, true);
//新增意见标签抓取
//<trueway:comment typeinAble="true" deleteAbled="true" id="${instanceId}csyj" instanceId="${instanceId}" currentStepId="${instanceId}"/>
String reg_comment="<trueway:comment[^<]*>";//获取所有comment类型标签
String[] comments=u.getStringByRegEx(htmlString, reg_comment, true);
//附件标签抓取
//<trueway:att onlineEditAble="true" id="${instanceId}att" docguid="${instanceId}" showId="attshow" ismain="true" uploadAble="true" deleteAble="true" previewAble="true" tocebAble="false" toStampAble="true" openBtnClass="icon-add" otherBtnsClass="icon-help" uploadCallback="loadCss" deleteCallback="loadCss"/>
String reg_att="<trueway:att[^<]*>";//获取所有att类型标签
String[] atts=u.getStringByRegEx(htmlString, reg_att, true);
//文号标签抓取
//<trueway:dn tagId="dn_tagid_zhu" defineId="${workFlowId}" webId="${webId}" showId="wenhaos" value="wenhaos"/>
String reg_dn="<trueway:dn[^<]*>";//获取所有dn类型标签
String[] dns=u.getStringByRegEx(htmlString, reg_dn, true);
/*
String reg_zd=">[^<]+</a>";
String zd=uc.getStringByRegEx(datatds[5], reg_zd, false)[0];
zd=zd.substring(1,zd.length()-4);
*/
if (inputs!=null&&inputs.length>0) {
for (int i = 0; i < inputs.length; i++) {
TagBean tag=new TagBean();
String tagName=null;//表单元素名称
String tagType=null;//表单元素类型
String select_dic=null;//下拉框关联字典表名称
//利用正则表达式获取表单元素名称
String reg_name=" name=['\"]?[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+['\"]?";
String[] names=u.getStringByRegEx(inputs[i], reg_name, true);
if (names!=null&&names.length>0) {
tagName=names[0];
tagName=tagName.trim();
tagName=tagName.replaceAll("'", "");
tagName=tagName.replaceAll("\"", "");
tagName=tagName.substring(5,tagName.length());
}
//利用正则表达式获取表单元素类型
String reg_type=" type=['\"]?[^'\"]+['\"]?";
String[] types=u.getStringByRegEx(inputs[i], reg_type, true);
if (types!=null&&types.length>0) {
tagType=types[0];
tagType=tagType.trim();
tagType=tagType.replaceAll("'", "");
tagType=tagType.replaceAll("\"", "");
tagType=tagType.substring(5,tagType.length());
}
//利用正则表达式获取标签中文描述
String tagZname=null;//
String tagZnameStr=null;
String reg_cname=" zname=['\"]?[^'\"]+['\"]?";
String[] cnames=u.getStringByRegEx(inputs[i], reg_cname, true);
if (cnames!=null&&cnames.length>0) {
tagZname=cnames[0];
tagZname=tagZname.trim();tagZnameStr=tagZname;
tagZname=tagZname.replaceAll("'", "");
tagZname=tagZname.replaceAll("\"", "");
tagZname=tagZname.substring(6,tagZname.length());
}
// if (tagType==null) {
// reg_type=" type=['\"]?hidden['\"]?";
// types=u.getStringByRegEx(inputs[i], reg_type, true);
// if (types!=null&&types.length>0) {
// tagType=types[0];
// tagType=tagType.trim();
// tagType=tagType.replaceAll("'", "");
// tagType=tagType.replaceAll("\"", "");
// tagType=tagType.substring(5,tagType.length());
// }
// }
//如果匹配到元素名称,但没有匹配到元素类型,则认为元素类型为text文本框
if (tagName!=null&&tagType==null) {
tagType="text";
}
//匹配列表字段属性
String reg_list=" list=['\"]?[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789]+['\"]?";
String[] lists=u.getStringByRegEx(inputs[i], reg_list, true);
String list=null;
if (lists!=null&&lists.length>0) {
list=lists[0];
list=list.trim();
list=list.replaceAll("'", "");
list=list.replaceAll("\"", "");
list=list.substring(5,list.length());
}
if (tagName!=null&&tagType!=null) {
tag.setTagName(tagName);
tag.setTagType(tagType);
tag.setSelect_dic(select_dic);
tag.setListId(list);
tag.setCommentDes(tagZname);//标签属性zname中文描述
tag.setCommentTagDes(tagZnameStr);//标签属性zname字符串
//此处过滤radio、checkbox,同组radio或checkbox采用一条记录
boolean isin=false;
for (int j = 0; j < tags.size(); j++) {
TagBean bean=tags.get(j);
if (bean.getTagName().equals(tagName)&&bean.getTagType().equals(tagType)) {
isin=true;break;
}
}
if (!isin) {
tags.add(tag);
}
}
}
}
if (selects!=null&&selects.length>0) {
for (int i = 0; i < selects.length; i++) {
TagBean tag=new TagBean();
String tagName=null;//表单元素名称
String tagType=null;//表单元素类型
String select_dic=null;//下拉框关联字典表名称
//利用正则表达式获取表单元素名称
String reg_name=" name=['\"]?[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+['\"]?";
String[] names=u.getStringByRegEx(selects[i], reg_name, true);
if (names!=null&&names.length>0) {
tagName=names[0];
tagName=tagName.trim();
tagName=tagName.replaceAll("'", "");
tagName=tagName.replaceAll("\"", "");
tagName=tagName.substring(5,tagName.length());
}
tagType="select";
//利用正则表达式获取标签中文描述
String tagZname=null;//
String tagZnameStr=null;
String reg_cname=" zname=['\"]?[^'\"]+['\"]?";
String[] cnames=u.getStringByRegEx(selects[i], reg_cname, true);
if (cnames!=null&&cnames.length>0) {
tagZname=cnames[0];
tagZname=tagZname.trim();tagZnameStr=tagZname;
tagZname=tagZname.replaceAll("'", "");
tagZname=tagZname.replaceAll("\"", "");
tagZname=tagZname.substring(6,tagZname.length());
}
String reg_dic=" dic=['\"]?[^'\"]+['\"]?";
String[] dics=u.getStringByRegEx(selects[i], reg_dic, true);
if (dics!=null&&dics.length>0) {
select_dic=dics[0];
select_dic=select_dic.trim();
select_dic=select_dic.replaceAll("'", "");
select_dic=select_dic.replaceAll("\"", "");
select_dic=select_dic.trim();
select_dic=select_dic.substring(4,select_dic.length());
}
//匹配列表字段属性
String reg_list=" list=['\"]?[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789]+['\"]?";
String[] lists=u.getStringByRegEx(selects[i], reg_list, true);
String list=null;
if (lists!=null&&lists.length>0) {
list=lists[0];
list=list.trim();
list=list.replaceAll("'", "");
list=list.replaceAll("\"", "");
list=list.substring(5,list.length());
}
if (tagName!=null&&tagType!=null) {
tag.setTagName(tagName);
tag.setTagType(tagType);
tag.setSelect_dic(select_dic);
tag.setListId(list);
tag.setCommentDes(tagZname);//标签属性zname中文描述
tag.setCommentTagDes(tagZnameStr);//标签属性zname字符串
tags.add(tag);
}
}
}
if (textareas!=null&&textareas.length>0) {
for (int i = 0; i < textareas.length; i++) {
TagBean tag=new TagBean();
String tagName=null;//表单元素名称
String tagType=null;//表单元素类型
String select_dic=null;//下拉框关联字典表名称
//利用正则表达式获取表单元素名称
String reg_name=" name=['\"]?[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+['\"]?";
String[] names=u.getStringByRegEx(textareas[i], reg_name, true);
if (names!=null&&names.length>0) {
tagName=names[0];
tagName=tagName.trim();
tagName=tagName.replaceAll("'", "");
tagName=tagName.replaceAll("\"", "");
tagName=tagName.substring(5,tagName.length());
}
tagType="textarea";
//利用正则表达式获取标签中文描述
String tagZname=null;//
String tagZnameStr=null;
String reg_cname=" zname=['\"]?[^'\"]+['\"]?";
String[] cnames=u.getStringByRegEx(textareas[i], reg_cname, true);
if (cnames!=null&&cnames.length>0) {
tagZname=cnames[0];
tagZname=tagZname.trim();tagZnameStr=tagZname;
tagZname=tagZname.replaceAll("'", "");
tagZname=tagZname.replaceAll("\"", "");
tagZname=tagZname.substring(6,tagZname.length());
}
//匹配列表字段属性
String reg_list=" list=['\"]?[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789]+['\"]?";
String[] lists=u.getStringByRegEx(textareas[i], reg_list, true);
String list=null;
if (lists!=null&&lists.length>0) {
list=lists[0];
list=list.trim();
list=list.replaceAll("'", "");
list=list.replaceAll("\"", "");
list=list.substring(5,list.length());
}
if (tagName!=null&&tagType!=null) {
tag.setTagName(tagName);
tag.setTagType(tagType);
tag.setSelect_dic(select_dic);
tag.setListId(list);
tag.setCommentDes(tagZname);//标签属性zname中文描述
tag.setCommentTagDes(tagZnameStr);//标签属性zname字符串
tags.add(tag);
}
}
}
//新增意见标签抓取
if (comments!=null&&comments.length>0) {
for (int i = 0; i < comments.length; i++) {
TagBean tag=new TagBean();
String tagName=null;//表单元素名称
String tagType=null;//表单元素类型
String select_dic=null;//下拉框关联字典表名称
//利用正则表达式获取表单元素名称
//<trueway:comment typeinAble="true" deleteAbled="true" id="${instanceId}csyj" instanceId="${instanceId}" currentStepId="${instanceId}"/>
String reg_name=" id=['\"]{1}[^'\"]+['\"]{1}";
String[] names=u.getStringByRegEx(comments[i], reg_name, true);
if (names!=null&&names.length>0) {
tagName=names[0];
tagName=tagName.trim();
tagName=tagName.replaceAll("'", "");
tagName=tagName.replaceAll("\"", "");
//tagName=tagName.substring(16,tagName.length());
if (tagName.indexOf("}")!=-1) {
tagName=tagName.split("}")[1];
}
}
tagType="comment";
//利用正则表达式获取标签中文描述
String tagZname=null;//
String tagZnameStr=null;
String reg_cname=" zname=['\"]?[^'\"]+['\"]?";
String[] cnames=u.getStringByRegEx(comments[i], reg_cname, true);
if (cnames!=null&&cnames.length>0) {
tagZname=cnames[0];
tagZname=tagZname.trim();tagZnameStr=tagZname;
tagZname=tagZname.replaceAll("'", "");
tagZname=tagZname.replaceAll("\"", "");
tagZname=tagZname.substring(6,tagZname.length());
}
//意见标签描述
// String cname="";
// String commentTagDes="";
// String reg_cname=" commentDes=['\"]{1}[^'\"]+['\"]{1}";
// String[] cnames=u.getStringByRegEx(comments[i], reg_cname, true);
// if (cnames!=null&&cnames.length>0) {
// cname=cnames[0];
// cname=cname.trim();commentTagDes=cname;
// cname=cname.replaceAll("'", "");
// cname=cname.replaceAll("\"", "");
// cname=cname.substring(11,cname.length());
// }
if (tagName!=null&&tagType!=null) {
tag.setTagName(tagName);
tag.setTagType(tagType);
tag.setSelect_dic(select_dic);
tag.setCommentDes(tagZname);//意见标签描述
tag.setCommentTagDes(tagZnameStr);
tags.add(tag);
}
}
}
//附件标签抓取
if (atts!=null&&atts.length>0) {
for (int i = 0; i < atts.length; i++) {
TagBean tag=new TagBean();
String tagName=null;//表单元素名称
String tagType=null;//表单元素类型
String select_dic=null;//下拉框关联字典表名称
//利用正则表达式获取表单元素名称
//<trueway:att onlineEditAble="true" id="${instanceId}att" docguid="${instanceId}" showId="attshow" ismain="true" uploadAble="true" deleteAble="true" previewAble="true" tocebAble="false" toStampAble="true" openBtnClass="icon-add" otherBtnsClass="icon-help" uploadCallback="loadCss" deleteCallback="loadCss"/>
String reg_name=" id=['\"]{1}[^'\"]+['\"]{1}";
String[] names=u.getStringByRegEx(atts[i], reg_name, true);
if (names!=null&&names.length>0) {
tagName=names[0];
tagName=tagName.trim();
tagName=tagName.replaceAll("'", "");
tagName=tagName.replaceAll("\"", "");
//tagName=tagName.substring(16,tagName.length());
if (tagName.indexOf("}")!=-1) {
tagName=tagName.split("}")[1];
}
}
tagType="attachment";
//利用正则表达式获取标签中文描述
String tagZname=null;//
String tagZnameStr=null;
String reg_cname=" zname=['\"]?[^'\"]+['\"]?";
String[] cnames=u.getStringByRegEx(atts[i], reg_cname, true);
if (cnames!=null&&cnames.length>0) {
tagZname=cnames[0];
tagZname=tagZname.trim();tagZnameStr=tagZname;
tagZname=tagZname.replaceAll("'", "");
tagZname=tagZname.replaceAll("\"", "");
tagZname=tagZname.substring(6,tagZname.length());
}
if (tagName!=null&&tagType!=null) {
tag.setTagName(tagName);
tag.setTagType(tagType);
tag.setSelect_dic(select_dic);
tag.setCommentDes(tagZname);//标签属性zname中文描述
tag.setCommentTagDes(tagZnameStr);//标签属性zname字符串
tags.add(tag);
}
}
}
//文号标签抓取
if (dns!=null&&dns.length>0) {
for (int i = 0; i < dns.length; i++) {
TagBean tag=new TagBean();
String tagName=null;//表单元素名称
String tagType=null;//表单元素类型
String select_dic=null;//下拉框关联字典表名称
//利用正则表达式获取表单元素名称
//<trueway:dn tagId="dn_tagid_zhu" defineId="${workFlowId}" webId="${webId}" showId="wenhaos" value="wenhaos"/>
String reg_name=" tagId=['\"]{1}[^'\"]+['\"]{1}";
String[] names=u.getStringByRegEx(dns[i], reg_name, true);
if (names!=null&&names.length>0) {
tagName=names[0];
tagName=tagName.trim();
tagName=tagName.replaceAll("'", "");
tagName=tagName.replaceAll("\"", "");
tagName=tagName.substring(6,tagName.length());
// if (tagName.indexOf("}")!=-1) {
// tagName=tagName.split("}")[1];
// }
}
tagType="wh";
//利用正则表达式获取标签中文描述
String tagZname=null;//
String tagZnameStr=null;
String reg_cname=" zname=['\"]?[^'\"]+['\"]?";
String[] cnames=u.getStringByRegEx(dns[i], reg_cname, true);
if (cnames!=null&&cnames.length>0) {
tagZname=cnames[0];
tagZname=tagZname.trim();tagZnameStr=tagZname;
tagZname=tagZname.replaceAll("'", "");
tagZname=tagZname.replaceAll("\"", "");
tagZname=tagZname.substring(6,tagZname.length());
}
if (tagName!=null&&tagType!=null) {
tag.setTagName(tagName);
tag.setTagType(tagType);
tag.setSelect_dic(select_dic);
tag.setCommentDes(tagZname);//标签属性zname中文描述
tag.setCommentTagDes(tagZnameStr);//标签属性zname字符串
tags.add(tag);
}
}
}
return tags;
}
/**
*
* @Title: readHTMLToString
* @Description: 输入流 按行的方式读取文件为字符串用于teatarea中展示
* @param path
* @return String 返回类型
*/
public String readHTML(String path){
StringBuffer htmlString=new StringBuffer();//返回页面流格式字符串
//读取文件,用于展示
File file=new File(path);
BufferedReader reader=null;
if (file.exists()) {
try {
reader=new BufferedReader(new InputStreamReader(new FileInputStream(file),Charset.forName("UTF-8")));
String tempString = null;
while ((tempString = reader.readLine()) != null) {
htmlString.append(tempString+"\n");
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
if (reader!=null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return htmlString.toString();
}
}
| [
"1149676859@qq.com"
] | 1149676859@qq.com |
bf17d74b81ab414109cec6b77dbaa14fb91f11f5 | db3671948281979c425667f79fdb5dd61a683d60 | /src/main/java/xyz/jetdrone/vertx/lambda/aws/event/APIGatewayProxyResponse.java | 790c432b8776deedabb45029caa54f93f416f26e | [] | no_license | pmlopes/vertx-lambda-runtime | 11b5b048bba2e1b6d3fefcfc60692c7a24b3f94f | 89d44e18e57a5828d0e392943b372cbf600e7a0f | refs/heads/develop | 2021-07-06T14:07:09.885054 | 2019-11-12T19:55:19 | 2019-11-12T19:55:19 | 193,095,258 | 2 | 1 | null | 2020-10-13T14:27:37 | 2019-06-21T12:35:45 | Java | UTF-8 | Java | false | false | 1,453 | java |
package xyz.jetdrone.vertx.lambda.aws.event;
import io.vertx.codegen.annotations.DataObject;
import io.vertx.core.json.JsonObject;
@DataObject(generateConverter = true)
public class APIGatewayProxyResponse {
public APIGatewayProxyResponse() {}
public APIGatewayProxyResponse(JsonObject json) {
APIGatewayProxyResponseConverter.fromJson(json, this);
}
public JsonObject toJson() {
JsonObject json = new JsonObject();
APIGatewayProxyResponseConverter.toJson(this, json);
return json;
}
private String body;
private JsonObject headers;
private Boolean isBase64Encoded;
private Integer statusCode;
public String getBody() {
return body;
}
public APIGatewayProxyResponse setBody(String body) {
this.body = body;
return this;
}
public JsonObject getHeaders() {
return headers;
}
public APIGatewayProxyResponse setHeaders(JsonObject headers) {
this.headers = headers;
return this;
}
public Boolean getIsBase64Encoded() {
return isBase64Encoded;
}
public APIGatewayProxyResponse setIsBase64Encoded(Boolean isBase64Encoded) {
this.isBase64Encoded = isBase64Encoded;
return this;
}
public Integer getStatusCode() {
return statusCode;
}
public APIGatewayProxyResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
@Override
public String toString() {
return toJson().encodePrettily();
}
}
| [
"pmlopes@gmail.com"
] | pmlopes@gmail.com |
097d8ef6c06331c73a052ba1df8ef4e920848a9e | 559b7557a8798a3c09671af7af17e825fdd8c075 | /src/main/java/com/smartsampa/busapi/DataFiller.java | 80e32f499fd5b63c5e1aae18750b4319e2669938 | [] | no_license | ruan0408/TCC_old | 501585a1b662cfb4d7d18da22340a51bace4e742 | 57eeaf3c5e4cd7c4844540e99123844df880cc14 | refs/heads/master | 2021-06-07T03:48:27.286011 | 2016-10-16T14:49:04 | 2016-10-16T14:49:04 | 50,862,147 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,709 | java | package com.smartsampa.busapi;
import com.smartsampa.gtfswrapper.GtfsAPIFacade;
import com.smartsampa.olhovivoapi.OlhovivoAPI;
import com.smartsampa.utils.APIConnectionException;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Created by ruan0408 on 16/07/2016.
*/
public class DataFiller {
private OlhovivoAPI olhovivoAPI;
private GtfsAPIFacade gtfsAPIFacade;
public DataFiller() {
olhovivoAPI = Provider.getOlhovivoAPI();
gtfsAPIFacade = Provider.getGtfsAPIFacade();
}
public void fill(Trip trip) {
Trip olhovivoTrip = olhovivoAPI.getTrip(trip);
Trip gtfsTrip = gtfsAPIFacade.getTrip(trip);
Trip fullTrip = merge(Trip.class, gtfsTrip, olhovivoTrip);
merge(Trip.class, trip, fullTrip);
}
public void fill(Stop stop) {
Stop olhovivoStop = olhovivoAPI.getStop(stop);
Stop gtfsStop = gtfsAPIFacade.getStop(stop);
Stop fullStop = merge(Stop.class, gtfsStop, olhovivoStop);
merge(Stop.class, stop, fullStop);
}
private <T> T merge(Class<T> tClass, T thisObject, T thatObject) {
try {
if (thisObject == null && thatObject == null)
return (T) tClass.getMethod("empty" + tClass.getSimpleName()).invoke(null);
if (thisObject == null) return thatObject;
if (thatObject == null) return thisObject;
for (Field field : tClass.getDeclaredFields()) {
Method getterMethod = getGetterMethod(field.getName(), tClass);
Method setterMethod = getSetterMethod(field.getName(), tClass);
Object thisValue = getterMethod.invoke(thisObject);
Object thatValue = getterMethod.invoke(thatObject);
if (thisValue == null) setterMethod.invoke(thisObject, thatValue);
}
} catch (IllegalAccessException | IntrospectionException | InvocationTargetException | NoSuchMethodException e) {
throw new APIConnectionException("An internal unexpected error occurred", e);
}
return thisObject;
}
private <T> Method getGetterMethod(String field, Class<T> tClass) throws IntrospectionException {
PropertyDescriptor descriptor = new PropertyDescriptor(field, tClass);
return descriptor.getReadMethod();
}
private <T> Method getSetterMethod(String field, Class<T> tClass) throws IntrospectionException {
PropertyDescriptor descriptor = new PropertyDescriptor(field, tClass);
return descriptor.getWriteMethod();
}
}
| [
"ruan.cocito@gmail.com"
] | ruan.cocito@gmail.com |
bc693e47f3aa7a658fad4bf4eb7a1be7e4f28183 | 70e596ae537e609fbd2b5680d30eb5770cf6fb1a | /generator/src/main/java/com/course/generator/vue/VueGenerator.java | 0d1e6219932125f97dcc60d2e79277a91debd27b | [] | no_license | JohntunLiu/course-online | addedfa1d3ba0f701aecce2500817ae0e0908c59 | d37383274e85453513151bedbdf0d661f074e575 | refs/heads/master | 2023-04-29T02:00:17.104808 | 2021-05-20T06:43:28 | 2021-05-20T06:43:28 | 361,161,810 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,585 | java | package com.course.generator.vue;
import com.course.generator.util.DbUtil;
import com.course.generator.util.Field;
import com.course.generator.util.FreemarkerUtil;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import java.io.File;
import java.util.*;
public class VueGenerator {
static String MODULE = "system";
static String toVuePath = "admin\\src\\views\\admin\\";
static String generatorConfigPath = "server\\src\\main\\resources\\generator\\generatorConfig.xml";
public static void main(String[] args) throws Exception {
String module = MODULE;
// 只生成配置文件中的第一个table节点
File file = new File(generatorConfigPath);
SAXReader reader=new SAXReader();
//读取xml文件到Document中
Document doc=reader.read(file);
//获取xml文件的根节点
Element rootElement=doc.getRootElement();
//读取context节点
Element contextElement = rootElement.element("context");
//定义一个Element用于遍历
Element tableElement;
//取第一个“table”的节点
tableElement=contextElement.elementIterator("table").next();
String Domain = tableElement.attributeValue("domainObjectName");
String tableName = tableElement.attributeValue("tableName");
String tableNameCn = DbUtil.getTableComment(tableName);
String domain = Domain.substring(0, 1).toLowerCase() + Domain.substring(1);
System.out.println("表:"+tableElement.attributeValue("tableName"));
System.out.println("Domain:"+tableElement.attributeValue("domainObjectName"));
List<Field> fieldList = DbUtil.getColumnByTableName(tableName);
Set<String> typeSet = getJavaTypes(fieldList);
HashMap<String, Object> map = new HashMap<>();
map.put("Domain", Domain);
map.put("domain", domain);
map.put("tableNameCn", tableNameCn);
map.put("module", module);
map.put("fieldList", fieldList);
map.put("typeSet", typeSet);
// 生成vue
FreemarkerUtil.initConfig("vue.ftl");
FreemarkerUtil.generator(toVuePath + domain + ".vue", map);
}
/**
* 获取所有的Java类型,使用Set去重
*/
private static Set<String> getJavaTypes(List<Field> fieldList) {
Set<String> set = new HashSet<>();
for (int i = 0; i < fieldList.size(); i++) {
Field field = fieldList.get(i);
set.add(field.getJavaType());
}
return set;
}
}
| [
"46100812+liuzongtang@users.noreply.github.com"
] | 46100812+liuzongtang@users.noreply.github.com |
4c1791ace1538e5fd8a848db22db31358d32b05e | 13c2d3db2d49c40c74c2e6420a9cd89377f1c934 | /program_data/JavaProgramData/95/256.java | 3efb87cc2d8eb7585ca4b5123d328d0000bcffee | [
"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 | 676 | java | package <missing>;
public class GlobalMembers
{
public static int Main()
{
String s = new String(new char[250]);
String t = new String(new char[250]);
int i;
s = new Scanner(System.in).nextLine();
t = new Scanner(System.in).nextLine();
for (i = 0;i < s.length();i++)
{
if (s.charAt(i) >= 65 && s.charAt(i) <= 92)
{
s.charAt(i) += 32;
}
}
for (i = 0;i < t.length();i++)
{
if (t.charAt(i) >= 65 && t.charAt(i) <= 92)
{
t.charAt(i) += 32;
}
}
if (strcmp(s,t) > 0)
{
System.out.print(">\n");
}
else if (strcmp(s,t) < 0)
{
System.out.print("<\n");
}
else
{
System.out.print("=\n");
}
return 0;
}
}
| [
"y.yu@open.ac.uk"
] | y.yu@open.ac.uk |
823cad0ca23bbc7a706139259d00a3baf3c26ca3 | d62fbde5dc501f6877a56b4eb75a8472d1317aed | /src/main/java/com/kapeed/msscbeerservice/web/controller/BeerController.java | d1269aa50ba34f9769011054b0b88905afe133e8 | [] | no_license | Kelekhun/mssc-beer-service-restdocs | ae392ce376f500e19cad66e7268366536d572fff | 1399e2d46e05d8f672e4119d00eff6de3bbb6ccb | refs/heads/master | 2020-07-01T22:05:46.501650 | 2019-08-08T23:26:38 | 2019-08-08T23:26:38 | 201,317,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,836 | java | package com.kapeed.msscbeerservice.web.controller;
import com.kapeed.msscbeerservice.repositories.BeerRepository;
import com.kapeed.msscbeerservice.web.mappers.BeerMapper;
import com.kapeed.msscbeerservice.web.model.BeerDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.UUID;
@RequiredArgsConstructor
@RequestMapping("/api/v1/beer")
@RestController
public class BeerController {
private final BeerMapper beerMapper;
private final BeerRepository beerRepository;
@RequestMapping(method = RequestMethod.GET, path = "/{beerId}")
public ResponseEntity<BeerDTO> getBeerById(@PathVariable("beerId") UUID beerId){
return new ResponseEntity<>(
beerMapper
.BeerToBeerDTO(beerRepository
.findById(beerId).get()), HttpStatus.OK);
}
@PostMapping
public ResponseEntity saveNewBeer(@RequestBody @Validated BeerDTO beerDTO){
beerRepository.save(beerMapper.BeerDTOToBeer(beerDTO));
return new ResponseEntity(HttpStatus.CREATED);
}
@PutMapping("/{beerId}")
public ResponseEntity updateBeerById(@PathVariable("beerId") UUID beerId, @RequestBody @Validated BeerDTO beerDTO){
beerRepository.findById(beerId).ifPresent(beer -> {
beer.setBeerName(beerDTO.getBeerName());
beer.setBeerStyle(beerDTO.getBeerStyle().name());
beer.setPrice(beerDTO.getPrice());
beer.setUpc(beerDTO.getUpc());
beerRepository.save(beer);
});
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
}
| [
"khadkadeepak@gmail.com"
] | khadkadeepak@gmail.com |
384f67108c141f593188bbd2bdf571b21f37576f | 4b6bda65340506817b107e632bb5ddc11f890c90 | /src/main/java/ru/spbstu/dis/ep/data/DataProvider.java | f8a52c536a012c670570d338a2f37213ef3fc220 | [] | no_license | alexff91/demofx | 3ddda8ca689230475c895799599522df96c19fc8 | 965581162985969180cd11ad64948b6e2b5aafc3 | refs/heads/master | 2016-08-12T06:36:22.898651 | 2016-03-29T17:45:30 | 2016-03-29T17:45:30 | 54,342,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package ru.spbstu.dis.ep.data;
import java.util.function.Supplier;
@FunctionalInterface
public interface DataProvider extends Supplier<DataInput> {
@Override
default DataInput get() {
return nextDataPortion();
}
DataInput nextDataPortion();
}
| [
"a.fedorov@argustelecom.ru"
] | a.fedorov@argustelecom.ru |
dc2603525fcab9ef5c5bd3f91cdc24101488ca61 | 7debabf7513c133df55f4d7a53dc4b10cf4ff827 | /app/src/main/java/com/example/mateu/testadventure/Player/Warrior.java | 176a095192e400f7ede43178e377c289955d7f94 | [] | no_license | Quspy/TestAdvneture | 6d151f10856d5e730e82ca98e95859556d7e5305 | a017f2c24fde61a5fb1a429d5ecd30a58be55a72 | refs/heads/master | 2020-05-21T01:05:06.108473 | 2019-05-09T18:23:58 | 2019-05-09T18:23:58 | 185,847,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | package com.example.mateu.testadventure.Player;
import com.example.mateu.testadventure.Weapon.LongSword;
public class Warrior extends Player {
private LongSword longSword;
private String type = "Warrior";
public Warrior(String sName)
{
super(sName);
setiHp(13);
setiAgility(2);
setiStrength(5);
setiIntelligence(1);
setiAttack(4);
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public void setiAttack()
{
int attack = (2+getiStrength()+getLongSword().getiAttack())/2;
this.setiAttack(attack);
}
public LongSword getLongSword() {
return longSword;
}
public void setLongSword(LongSword longSword) {
this.longSword = longSword;
}
}
| [
"mateusz.siewiera@gmail.com"
] | mateusz.siewiera@gmail.com |
8d7f0cb220212ec37e5244c70d42682af7645911 | 746c5378ffc40e5a506d52a0fcfe3615ab7d35d8 | /src/main/java/com/hungnd62/observer/TestObserver.java | 17ec6a04226eae75af1f25a49975ad52c04a2afa | [] | no_license | hungpp123/gitturorial | 552d3215e535bf0b4317c06e178526632fd99e30 | 7efa0fbc97a0153ecf9d8201b460d82dcd1f8b2f | refs/heads/main | 2023-08-22T21:59:41.656884 | 2021-09-23T14:23:23 | 2021-09-23T14:23:23 | 407,194,995 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.hungnd62.observer;
/**
*
* @author Admin
*/
public class TestObserver {
public static void main(String[] args) {
AccountService account1 = createAccountService("nguyendinhhunghn96@gmail.com", "127.0.0.1");
account1.login();
account1.changeStatus(Common.LoginStatus.EXPIRED);
System.out.println("--------------------");
AccountService account2 = createAccountService("nguyendinhhunghn96@gmail.com", "127.1.0.1");
account2.login();
}
private static AccountService createAccountService(String email, String ip) {
AccountService account = new AccountService(email, ip);
account.attach(new Logger());
account.attach(new Mailer());
account.attach(new Protector());
return account;
}
}
| [
"nguyendinhhunghn96@gmail.com"
] | nguyendinhhunghn96@gmail.com |
438153ef6c36ba2481bc8e740abf4bac0c308129 | 74364c00fd2b86f0ae9e6209de285e6d28f37089 | /src/com/chen/chinaos/app/Constants.java | 0fcfac5bec5519dd5c3ba6d990b68ebd69bc2a04 | [] | no_license | hczcgq/ChinaOS | 61683abbc86705df6e9ef0bae452171c008410a1 | 33f06240be211ef77fc9274c1df497ee708f263a | refs/heads/master | 2021-01-19T09:45:08.445758 | 2013-11-21T08:48:41 | 2013-11-21T08:48:41 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,009 | java | package com.chen.chinaos.app;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import com.chen.chinaos.ui.R;
/**
*静态类型和静态方法
* @author turui
*
*/
public class Constants {
public final static String CONF_APP_UNIQUEID = "APP_UNIQUEID";
public final static String HOST = "www.oschina.net";
public final static String NEWS_LIST_URL="http://www.oschina.net/action/api/news_list/"; //新闻列表
public final static int CATALOG_NEWS = 1; //资讯
public final static int PAGE_SIZE=20;//每页记录条数
/**
* 发送App异常崩溃报告
*
* @param cont
* @param crashReport
*/
public static void sendAppCrashReport(final Context cont,
final String crashReport) {
AlertDialog.Builder builder = new AlertDialog.Builder(cont);
builder.setIcon(android.R.drawable.ic_dialog_info);
builder.setTitle(R.string.app_error);
builder.setMessage(R.string.app_error_message);
builder.setPositiveButton(R.string.submit_report,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
// 发送异常报告
Intent i = new Intent(Intent.ACTION_SEND);
// i.setType("text/plain"); //模拟器
i.setType("message/rfc822"); // 真机
i.putExtra(Intent.EXTRA_EMAIL,
new String[] { "jxsmallmouse@163.com" });
i.putExtra(Intent.EXTRA_SUBJECT,
"开源中国Android客户端 - 错误报告");
i.putExtra(Intent.EXTRA_TEXT, crashReport);
cont.startActivity(Intent.createChooser(i, "发送错误报告"));
// 退出
AppManager.getAppManager().AppExit(cont);
}
});
builder.setNegativeButton(R.string.sure,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
// 退出
AppManager.getAppManager().AppExit(cont);
}
});
builder.show();
}
}
| [
"514858501@qq.com"
] | 514858501@qq.com |
9bad31a8229bd0597c8bd20a3f509ef949430b6b | e32f63fe850c3a9359c6a41730864f2e3f765538 | /Source/7 Domain Specific Languages/Week 4 - Constraining Meta Models/mdsebook.fsm/src/mdsebook/fsm/impl/FsmFactoryImpl.java | 0ad126e1d3f9d2fc297888b2a481a6ca47482284 | [] | no_license | janjve/Itu.Shared | 94b77de16e8b7ee9fbb44963a236c717177143aa | 64e7eb5761d29938bbb71e1a217462aae2de8351 | refs/heads/master | 2020-12-11T03:55:34.278540 | 2016-11-26T15:30:12 | 2016-11-26T15:31:38 | 68,357,850 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,737 | java | /**
*/
package mdsebook.fsm.impl;
import mdsebook.fsm.*;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class FsmFactoryImpl extends EFactoryImpl implements FsmFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static FsmFactory init() {
try {
FsmFactory theFsmFactory = (FsmFactory)EPackage.Registry.INSTANCE.getEFactory(FsmPackage.eNS_URI);
if (theFsmFactory != null) {
return theFsmFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new FsmFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FsmFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case FsmPackage.TRANSITION: return createTransition();
case FsmPackage.MODEL: return createModel();
case FsmPackage.FINITE_STATE_MACHINE: return createFiniteStateMachine();
case FsmPackage.STATE: return createState();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Transition createTransition() {
TransitionImpl transition = new TransitionImpl();
return transition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Model createModel() {
ModelImpl model = new ModelImpl();
return model;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FiniteStateMachine createFiniteStateMachine() {
FiniteStateMachineImpl finiteStateMachine = new FiniteStateMachineImpl();
return finiteStateMachine;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public State createState() {
StateImpl state = new StateImpl();
return state;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FsmPackage getFsmPackage() {
return (FsmPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static FsmPackage getPackage() {
return FsmPackage.eINSTANCE;
}
} //FsmFactoryImpl
| [
"jan.jve@gmail.com"
] | jan.jve@gmail.com |
577039888a478774e65331de404363a4c51c50ab | e45a7d1c52c671cee61449fc8bfef991011949d6 | /app/src/main/java/com/forateq/cloudcheetah/views/ProjectUpdateView.java | 7121c84c9aa8c408b84945cd636d584057136936 | [] | no_license | cloudcheetah/Cloud-Cheetah-Android-06-28-16- | fb7623f357d0d590d383a5ea007089dfc01c547f | f3033fc2f30ab2d08d37939f53cb6c8575354152 | refs/heads/master | 2020-05-22T06:35:28.834502 | 2016-09-16T08:01:59 | 2016-09-16T08:01:59 | 62,125,738 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,678 | java | package com.forateq.cloudcheetah.views;
import android.app.DatePickerDialog;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import com.forateq.cloudcheetah.R;
import com.forateq.cloudcheetah.adapters.NothingSelectedSpinnerAdapter;
import com.forateq.cloudcheetah.models.Projects;
import com.forateq.cloudcheetah.models.Users;
import java.util.Calendar;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* Created by Vallejos Family on 6/30/2016.
*/
public class ProjectUpdateView extends RelativeLayout {
@Bind(R.id.project_name)
EditText projectNameET;
@Bind(R.id.project_start_date)
EditText projectStartDateET;
@Bind(R.id.project_end_date)
EditText projectEnddateET;
@Bind(R.id.budget)
EditText projectBudgetET;
@Bind(R.id.project_details)
EditText projectDetailsET;
@Bind(R.id.project_objectives)
EditText projectObjectivesET;
@Bind(R.id.project_sponsor)
Spinner projectSponsorSpinner;
@Bind(R.id.project_manager)
Spinner projectManagerSpinner;
@Bind(R.id.update_project)
Button updateProjectButton;
int project_id;
long project_offline_id;
public ProjectUpdateView(Context context, int project_id, long project_offline_id) {
super(context);
this.project_id = project_id;
this.project_offline_id = project_offline_id;
init();
}
public ProjectUpdateView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public ProjectUpdateView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public void init(){
inflate(getContext(), R.layout.project_update_fragment, this);
ButterKnife.bind(this);
Projects projects = Projects.getProjectsOfflineMode(project_offline_id);
projectNameET.setText(projects.getName());
projectStartDateET.setText(projects.getStart_date());
projectStartDateET.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setDate(projectStartDateET);
}
});
projectEnddateET.setText(projects.getEnd_date());
projectEnddateET.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setDate(projectEnddateET);
}
});
projectBudgetET.setText(""+projects.getBudget());
projectDetailsET.setText(projects.getDescription());
projectObjectivesET.setText(projects.getObjectives());
ArrayAdapter<String> nameAdapter = new ArrayAdapter(getContext(),android.R.layout.simple_spinner_item, Users.getUsersNames());
nameAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
projectManagerSpinner.setAdapter(nameAdapter);
projectManagerSpinner.setPrompt(projects.getProject_manager());
projectManagerSpinner.setAdapter(
new NothingSelectedSpinnerAdapter(
nameAdapter,
R.layout.nothing_selected,
getContext()));
projectSponsorSpinner.setAdapter(nameAdapter);
projectSponsorSpinner.setPrompt(projects.getProject_sponsor());
projectSponsorSpinner.setAdapter(
new NothingSelectedSpinnerAdapter(
nameAdapter,
R.layout.nothing_selected,
getContext()));
}
/**
* This method is used to display and set the date of a selected the selected edittext
* @param editText
*/
public void setDate(final EditText editText){
final Calendar c = Calendar.getInstance();
int mYear = c.get(Calendar.YEAR);
int mMonth = c.get(Calendar.MONTH);
int mDay = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog dpd = new DatePickerDialog(getContext(),
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
editText.setText(dayOfMonth + "-"
+ (monthOfYear + 1) + "-" + year);
}
}, mYear, mMonth, mDay);
dpd.show();
}
}
| [
"jayharvallejos12@gmail.com"
] | jayharvallejos12@gmail.com |
f6606bd51ca2357fcee650e71b67c78828b51519 | 16b7baa4156956a72943b5ca5e02eb4200aa32ad | /hospitalbooklet/hospitalbooklet-soa/hospitalbooklet-soa-model/src/main/java/org/osanchezhuerta/hospitalbooklet/soa/model/Vet.java | 0cc0b2b7cf35807af75513af723ae29b01d90522 | [
"Apache-2.0"
] | permissive | osanchezh/hospitalbooklet-app | 7a4de36bca1b41f312c999001389ba581a54dd12 | a35640ae2cb4b1cba68ba0876af7a19218f0a65c | refs/heads/master | 2021-05-31T20:17:58.067342 | 2016-06-25T23:27:58 | 2016-06-25T23:27:58 | 57,075,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,399 | java | /*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.osanchezhuerta.hospitalbooklet.soa.model;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
import org.springframework.beans.support.MutableSortDefinition;
import org.springframework.beans.support.PropertyComparator;
/**
* Simple JavaBean domain object representing a veterinarian.
*
*/
@Entity
@Table(name = "vets")
public class Vet extends Person {
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "vet_specialties", joinColumns = @JoinColumn(name = "vet_id"),
inverseJoinColumns = @JoinColumn(name = "specialty_id"))
private Set<Specialty> specialties;
protected void setSpecialtiesInternal(Set<Specialty> specialties) {
this.specialties = specialties;
}
protected Set<Specialty> getSpecialtiesInternal() {
if (this.specialties == null) {
this.specialties = new HashSet<Specialty>();
}
return this.specialties;
}
@XmlElement
public List<Specialty> getSpecialties() {
List<Specialty> sortedSpecs = new ArrayList<Specialty>(getSpecialtiesInternal());
PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
return Collections.unmodifiableList(sortedSpecs);
}
public int getNrOfSpecialties() {
return getSpecialtiesInternal().size();
}
public void addSpecialty(Specialty specialty) {
getSpecialtiesInternal().add(specialty);
}
}
| [
"osanchezhuerta@gmail.com"
] | osanchezhuerta@gmail.com |
40af106252730a05ad386aa6be239d3fafdf4cd0 | b64bf0ed9ddf1a72d397eb3a926a9d6dee77cc94 | /src/com/hy/ly/factory/InstanceCarFactory.java | 8dedc9b41ae340b68e7614c9cfd96d662d77cf1c | [] | no_license | royplaygame/springProject | 091950398679b9b267f3bcf3505479a5492abb46 | 33191e187d11a215d8d0e49292c634df334feddd | refs/heads/master | 2021-07-04T15:10:44.334037 | 2017-09-28T14:07:30 | 2017-09-28T14:07:30 | 104,606,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java | package com.hy.ly.factory;
import java.util.HashMap;
import java.util.Map;
//实例工厂方法:实例工厂的方法,即先得到工厂本身,再调用用工厂的实例方法,再返回bean的实例。
public class InstanceCarFactory {
private Map<String, Car> cars = null;
public InstanceCarFactory() {
cars = new HashMap<>();
cars.put("bmw", new Car("BMW", 300000));
cars.put("3w", new Car("3W", 100000));
cars.put("ford", new Car("FORD", 150000));
cars.put("audi", new Car("Audi", 200000));
}
public Car getCar(String brand) {
return cars.get(brand);
}
}
| [
"root@test.com"
] | root@test.com |
0a9859a54d5195d02b7b1666bba44995c84bd655 | 7609150a7d9db9682d01e1ca199831a5d0ff8ce8 | /Lecture5(14-1-2017)/src/Class/ismirrorinverse.java | e9db23c70815f5f70b619b5bca2a2987d21236d4 | [] | no_license | sanjeetboora/myWorkspace-JAVA- | 62aad19ef4aaa22c2c5f7d2f8214ca8834a5a0a1 | cfd5956b0512583926b1628506b25745493a4a31 | refs/heads/master | 2020-03-23T03:56:02.890546 | 2018-10-03T00:35:13 | 2018-10-03T00:35:13 | 141,056,742 | 1 | 1 | null | 2018-10-04T02:29:40 | 2018-07-15T20:34:32 | Java | UTF-8 | Java | false | false | 385 | java | package Class;
public class ismirrorinverse {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arr = takeinput.takeinput();
System.out.println(ismirrorinverse(arr));
}
public static boolean ismirrorinverse(int[] arr) {
for (int i = 0; i < arr.length; i++) {
if (arr[arr[i]] != i) {
return false;
}
}
return true;
}
}
| [
"sanjeet.boora97@gmail.com"
] | sanjeet.boora97@gmail.com |
0877aeccdb845a46834bed447b01b7392771f6f3 | 9a817bb6595f4bc02111ccf0c3c427719e5e27d8 | /JDBC/03_Retrieving Data/src/Database.java | 2738868a721f6c3d42e0c75a0c86e165fa8bf381 | [] | no_license | SOEHTUTOO/JavaBasic | c8f40d818b05178eb7fc2d3b721ab871c9408802 | c46ddd422667007ad38630634161eb6c95707f4d | refs/heads/master | 2020-03-10T14:27:52.166102 | 2018-04-13T17:27:03 | 2018-04-13T17:27:03 | 129,427,035 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,152 | java | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class Database {
private Connection conn;
public void connect() throws SQLException {
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver Found.");
} catch (ClassNotFoundException e) {
System.out.println("Driver Not Found.");
e.printStackTrace();
}
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "root", "");
}
public Student getAStudent(int id) {
String cmdSql = "select * from members where id="+id;
Student std = null;
try {
Statement stmt = conn.createStatement();
ResultSet results = stmt.executeQuery(cmdSql);
while(results.next()) {
String name = results.getString("name");
String email = results.getString("email");
String password = results.getString("password");
String mobile = results.getString("mobile");
std = new Student(id, name, email, password, mobile);
}
} catch (SQLException e) {
System.out.println("Can't get Student data.");
e.printStackTrace();
}
return std;
}
public List<Student> getStudent() {
List<Student> students = new ArrayList<>();
String cmdSql = "select * from members";
try {
Statement stmt = conn.createStatement();
ResultSet results = stmt.executeQuery(cmdSql);
while(results.next()) {
int id = results.getInt("id");
String name = results.getString("name");
String email = results.getString("email");
String password = results.getString("password");
String mobile = results.getString("mobile");
students.add(new Student(id, name, email, password, mobile));
}
} catch (SQLException e) {
System.out.println("Can't get Student data.");
e.printStackTrace();
}
return students;
}
public void disconnect() throws SQLException {
if(conn!=null) {
conn.close();
}
}
}
| [
"noreply@github.com"
] | SOEHTUTOO.noreply@github.com |
5b981be4bf9439ec287278542c9af20994352ef4 | f6f301edb02a7bdc0a77c29a2d0a0d5152042d8f | /sword-admin/src/main/java/com/lideng/sword/admin/model/entity/SysUserRole.java | 531859d62614452bfa2781919093dc3c2b92fac8 | [] | no_license | wistwill/sword | 7feee1f4499365211948af572bc0306f7392ce2c | 31c473ec641677e9e03bc3cfb9144efcea339dcb | refs/heads/master | 2020-12-02T04:53:37.709824 | 2019-12-05T15:25:53 | 2019-12-05T15:25:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | package com.lideng.sword.admin.model.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 基础模型
* @author lideng
* @date Sep 13, 2018
*/
@Data
@EqualsAndHashCode(callSuper=false)
public class SysUserRole extends BaseModel {
private String userId;
private String roleId;
} | [
"453321481@qq.com"
] | 453321481@qq.com |
37612140e2609baf34118441945709fcdf2358cc | 7df40f6ea2209b7d48979465fd8081ec2ad198cc | /TOOLS/server/com/wurmonline/website/news/NewsSection.java | be4dbb66dcb9e3cebef4c60590e9161738f6c7f8 | [
"IJG"
] | permissive | warchiefmarkus/WurmServerModLauncher-0.43 | d513810045c7f9aebbf2ec3ee38fc94ccdadd6db | 3e9d624577178cd4a5c159e8f61a1dd33d9463f6 | refs/heads/master | 2021-09-27T10:11:56.037815 | 2021-09-19T16:23:45 | 2021-09-19T16:23:45 | 252,689,028 | 0 | 0 | null | 2021-09-19T16:53:10 | 2020-04-03T09:33:50 | Java | UTF-8 | Java | false | false | 2,529 | java | /* */ package com.wurmonline.website.news;
/* */
/* */ import com.wurmonline.website.Block;
/* */ import com.wurmonline.website.LoginInfo;
/* */ import com.wurmonline.website.Section;
/* */ import java.util.ArrayList;
/* */ import java.util.Collection;
/* */ import java.util.List;
/* */ import javax.servlet.http.HttpServletRequest;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class NewsSection
/* */ extends Section
/* */ {
/* 29 */ private SubmitNewsBlock submitBlock = new SubmitNewsBlock();
/* 30 */ private List<NewsBlock> news = new ArrayList<>();
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public String getName() {
/* 39 */ return "News";
/* */ }
/* */
/* */
/* */
/* */ public String getId() {
/* 45 */ return "news";
/* */ }
/* */
/* */
/* */
/* */ public List<Block> getBlocks(HttpServletRequest req, LoginInfo loginInfo) {
/* 51 */ List<Block> list = new ArrayList<>();
/* */
/* 53 */ if ("delete".equals(req.getParameter("action")))
/* */ {
/* 55 */ if (loginInfo != null && loginInfo.isAdmin())
/* */ {
/* 57 */ delete(req.getParameter("id"));
/* */ }
/* */ }
/* */
/* 61 */ list.addAll((Collection)this.news);
/* */
/* 63 */ if (loginInfo != null && loginInfo.isAdmin())
/* */ {
/* 65 */ list.add(this.submitBlock);
/* */ }
/* */
/* 68 */ return list;
/* */ }
/* */
/* */
/* */
/* */ private void delete(String id) {}
/* */
/* */
/* */
/* */ public void handlePost(HttpServletRequest req, LoginInfo loginInfo) {
/* 78 */ if (loginInfo != null && loginInfo.isAdmin()) {
/* */
/* 80 */ String title = req.getParameter("title");
/* 81 */ String text = req.getParameter("text");
/* 82 */ text = text.replaceAll("\r\n", "<br>");
/* 83 */ text = text.replaceAll("\r", "<br>");
/* 84 */ text = text.replaceAll("\n", "<br>");
/* */
/* 86 */ this.news.add(new NewsBlock(new News(title, text, loginInfo.getName())));
/* */ }
/* */ }
/* */ }
/* Location: C:\Users\leo\Desktop\server.jar!\com\wurmonline\website\news\NewsSection.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ | [
"warchiefmarkus@gmail.com"
] | warchiefmarkus@gmail.com |
17c78e97679d3a69436877a5cd6b039574aa2d60 | 738f2281013a59e8707b24693d84b6dc3236f84e | /mddf-tools/src/com/movielabs/mddf/tools/util/logging/LoggerWidget.java | e961190f8ab9203fc5f58de21d955f230e0f14ee | [] | no_license | ljlevin/mddf-1 | 39deab1675db16d34df9fda6b21552d5408f5ed6 | 1fe22ff44023d95f61c90dd6e468aa0e9f522972 | refs/heads/master | 2020-04-23T12:41:13.279879 | 2019-02-17T21:54:18 | 2019-02-17T21:54:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,590 | java | /**
* Created June 27, 2016
* Copyright Motion Picture Laboratories, Inc. 2016
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.movielabs.mddf.tools.util.logging;
import com.movielabs.mddflib.logging.LogMgmt;
/**
* Extends the <tt>LogMgmt</tt> interface to include support for GUI-related
* functions.
*
* @author L. Levin, Critical Architectures LLC
*
*/
public interface LoggerWidget extends LogMgmt {
public abstract void setSize(int width, int ht);
public abstract void expand();
public abstract void collapse();
} | [
"lawrence.j.levin@gmail.com"
] | lawrence.j.levin@gmail.com |
fd1ca6c496102cedf3e71d7f9cc4d3a6706e6d5b | 1dc663a84a77e615af37e3bff0adb817fd3ed192 | /TextReader4/app/src/main/java/helloandroid/textreader4/MainActivity.java | a0dc3d4b813d55c120eeec4e668383ad27763b00 | [] | no_license | hadesshark/android_project | 1b7d68469965fa39678a85c8550290dd2e029c7b | c3c9436b18d542832dbd9d38a26b644c763edc42 | refs/heads/master | 2021-01-22T00:52:17.878722 | 2017-09-20T12:07:44 | 2017-09-20T12:07:44 | 102,195,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,463 | java | package helloandroid.textreader4;
import android.app.UiModeManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SwitchCompat;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.TextView;
import com.github.clans.fab.FloatingActionButton;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
private Toolbar toolbar;
private FloatingActionButton faBtn_up, faBtn_down;
private DrawerLayout drawerLayout;
private NavigationView navigationView;
private RecyclerView recyclerView;
private String bookList_str[];
private ActionBarDrawerToggle toggle;
private SharedPreferences config;
private boolean nightMode;
// private UiModeManager uiManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
recyclerViewSetting();
FloatingActionButtonSetting();
}
private void FloatingActionButtonSetting() {
faBtn_up.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
recyclerView.smoothScrollToPosition(0);
}
});
faBtn_down.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
recyclerView.smoothScrollToPosition(recyclerView.getBottom());
}
});
}
class BookAdapter extends RecyclerView.Adapter<BookAdapter.ViewHolder> {
private List<Book> bookList;
class ViewHolder extends RecyclerView.ViewHolder {
private TextView tvName;
private CardView cardView;
public ViewHolder(View itemView) {
super(itemView);
tvName = (TextView) itemView.findViewById(R.id.tv_name);
cardView = (CardView) itemView.findViewById(R.id.card_view);
}
}
public BookAdapter(List<Book> bookList) {
this.bookList = bookList;
}
@Override
public int getItemCount() {
return bookList.size();
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.reader_card, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
final Book book = bookList.get(position);
holder.tvName.setText(book.getBook_name());
holder.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, ReadActivity.class);
Bundle bundle = new Bundle();
bundle.putString("fileName", book.getBook_name());
intent.putExtras(bundle);
startActivity(intent);
}
});
}
}
private void recyclerViewSetting() {
recyclerView.setHasFixedSize(true);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
final List<Book> bookList = new ArrayList<>();
try {
bookList_str = getAssets().list("JsonBookstore");
} catch (IOException e) {
e.printStackTrace();
}
for (String book_name : bookList_str) {
bookList.add(new Book(book_name.substring(0, book_name.indexOf("."))));
}
recyclerView.setAdapter(new BookAdapter(bookList));
}
private void initView() {
config = getSharedPreferences("config", Context.MODE_PRIVATE);
nightMode = config.getBoolean("dayNightMode", false);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("小說閱讀器");
setSupportActionBar(toolbar);
faBtn_up = (FloatingActionButton) findViewById(R.id.faBtn_up);
faBtn_down = (FloatingActionButton) findViewById(R.id.faBtn_down);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
toggle = new ActionBarDrawerToggle(
this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close
);
drawerLayout.setDrawerListener(toggle);
navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
drawerSetting();
}
private void disableNightMode() {
config.edit().putBoolean("dayNightMode", false).apply();
getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO);
recreate();
}
private void enableNightMode() {
config.edit().putBoolean("dayNightMode", true).apply();
getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_YES);
recreate();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
toggle.onConfigurationChanged(newConfig);
}
@Override
public void onBackPressed() {
if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
drawerLayout.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
toggle.syncState();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_settings:
break;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.taggle:
drawerSetting();
break;
}
drawerLayout.closeDrawer(GravityCompat.START);
item.setChecked(true);
getSupportActionBar().setTitle(item.getTitle());
return true;
}
private void drawerSetting() {
MenuItem dayNightItem = navigationView.getMenu().findItem(R.id.night_mode);
SwitchCompat dayNightSwitch = (SwitchCompat) MenuItemCompat.getActionView(dayNightItem).findViewById(R.id.taggle);
if(nightMode) {
dayNightSwitch.setChecked(true);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
} else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
dayNightSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(b) {
enableNightMode();
} else {
disableNightMode();
}
}
});
}
}
| [
"hades_shark@hotmail.com"
] | hades_shark@hotmail.com |
8a4da0bed4c32851265379fefc07ad91f8dab93c | 936a8206ce1d3c6316dadcc955f309eeccaecfdb | /app/src/test/java/com/example/hsr15/easyshopping/ExampleUnitTest.java | 39517e1ff6ac002c6a2c8558cecae0d411cdb067 | [] | no_license | Hemendra-s/EasyShopping | 1f02ad1dd13ce2368f3431b6bf98d1c5cd4a428b | da883fff2216e45af9b5beea4dcbdd4c808a392f | refs/heads/master | 2020-06-16T20:07:55.859281 | 2019-07-07T19:34:52 | 2019-07-07T19:34:52 | 195,688,804 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com.example.hsr15.easyshopping;
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);
}
} | [
"hsr15498@gmail.com"
] | hsr15498@gmail.com |
135d8829ef7c7299568866ca4e30ea1c330465af | e71ae93e37e09c6a36635085d880d77aa9330716 | /src/main/java/com/strayfootball/api/util/ArrayUtil.java | 6435172244b84cb82ce460843c4b948fe91f1d8c | [] | no_license | lijianjun001/strayfootball-api | e4856d9ce8a6098af0b673e6fba1d9dddd2404c1 | f4eb1bf00d197876fd67e9fea8447f65da6d8f5b | refs/heads/master | 2022-11-21T20:40:59.164395 | 2019-06-04T17:17:17 | 2019-06-04T17:17:17 | 190,190,965 | 0 | 0 | null | 2022-11-16T08:38:08 | 2019-06-04T11:49:31 | HTML | UTF-8 | Java | false | false | 476 | java | package com.strayfootball.api.util;
import java.util.List;
/**
* 集合工具类
*
* @author karl
*/
public class ArrayUtil<T> {
/***
* 判断集合不为null并有数据
* @param list 集合对象
* @return true 空 ,false非空
*/
public static <T> boolean isNull(List<T> list) {
if (null != list && list.size() > 0) {
return true;
} else {
return false;
}
}
}
| [
"1455404626@qq.com"
] | 1455404626@qq.com |
1be4e5f653ce7af3f51ba7b45e066ee725355ad4 | c631206d106188d0ec73bde11741294ac04fbb2f | /src/test/java/com/vmware/pa/multiprofile/MultiprofileApplicationTests.java | 098b7220c024bbae4467a7c03be99b9b86809880 | [] | no_license | cdelashmutt-pivotal/multiprofile | 9cbf538712ffa48a0d58d7abea510eb1df559715 | 18f2ab3c3322de7d188d9549091d85e02ee2148b | refs/heads/master | 2020-12-10T20:43:27.119148 | 2020-01-13T22:28:26 | 2020-01-13T22:28:26 | 233,706,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package com.vmware.pa.multiprofile;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MultiprofileApplicationTests {
@Test
void contextLoads() {
}
}
| [
"cdelashmutt@ChrisDetsiPhone.home"
] | cdelashmutt@ChrisDetsiPhone.home |
73c260c83e0829e1bfdb3b731f457d1e6ec9f568 | 47022da858be57a44aff2a055b9fc5875d1aad90 | /src/main/java/dto/DetailDto.java | 80321f1899e001fe219293ee7eb24ba2685968b3 | [] | no_license | AnhTuPhi/Nahato_BOT | eeee35013bc06a86b94fad5e77028656fc874a9f | 519492743e48cc9b0d0ec89984032e4a0ac13a5a | refs/heads/master | 2023-08-27T16:32:36.373266 | 2021-10-25T07:39:08 | 2021-10-25T07:39:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class DetailDto {
private String description;
private Integer id;
private String name;
}
| [
"dev1@oceantech.vn"
] | dev1@oceantech.vn |
ad3062de9b7190b1d9899d967ee895e197a976b2 | ecaf6ec5b5429928d41d23883e11e129729a7374 | /cargo/map/src/main/java/org/qsardb/cargo/map/ReferencesCargo.java | 05d49918446e03c96e757750856964b477503f28 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | qsardb/qsardb | 615fa33241bcf792a80693dd7215b4d50d76347b | 7e11747c5fd108d5aee31bc0dbfad26b48142351 | refs/heads/master | 2023-05-30T03:49:59.387275 | 2021-06-21T12:11:25 | 2021-06-21T12:11:25 | 7,729,841 | 4 | 0 | BSD-3-Clause | 2021-06-22T12:36:30 | 2013-01-21T09:43:11 | Java | UTF-8 | Java | false | false | 895 | java | /*
* Copyright (c) 2009 University of Tartu
*/
package org.qsardb.cargo.map;
import java.io.*;
import java.util.*;
import org.qsardb.model.*;
public class ReferencesCargo extends MapCargo<Parameter> {
protected ReferencesCargo(Descriptor descriptor){
super(ReferencesCargo.ID, descriptor);
}
protected ReferencesCargo(Prediction prediction){
super(ReferencesCargo.ID, prediction);
}
protected ReferencesCargo(Property property){
super(ReferencesCargo.ID, property);
}
@Override
protected String keyName(){
return "Compound Id";
}
@Override
protected String valueName(){
return "BibTeX entry key(s)";
}
public Map<String, String> loadReferences() throws IOException {
return loadStringMap();
}
public void storeReferences(Map<String, String> references) throws IOException {
storeStringMap(references);
}
public static final String ID = "references";
} | [
"villu.ruusmann@gmail.com"
] | villu.ruusmann@gmail.com |
63ec1e59b1dc10066ab2a39afa9fc5b03e638621 | 4ca64553a8195d5466888e5905dc13bbae092cb7 | /src/main/java/de/academy/dao/ProfessorDAO.java | 0806c0a5243054c9c4bba026ee59c350de3f7ead | [] | no_license | missTam/University-Management-Tool | 447f4954c1fa32373b24026927f5de6568560716 | fed0d66e42e9e832ec0d3132a144efadd3797478 | refs/heads/main | 2023-02-28T13:36:12.210289 | 2021-02-03T16:36:21 | 2021-02-03T16:36:21 | 332,759,605 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package de.academy.dao;
import de.academy.entities.Professor;
import de.academy.entities.User;
import java.util.List;
public interface ProfessorDAO {
List<Professor> findAll();
Professor getProfessorByUser(User user);
Professor addLectureToProfessor(Long professorId, long lectureId);
Professor removeLectureFromProfessor(Long professorId, long lectureId);
}
| [
"tamara.tacic@gmail.com"
] | tamara.tacic@gmail.com |
83def05b4364d9b459a5f4ccc8114e1575cde127 | b9f6085a38e4a069da59195b9d8a2bc28b1a698c | /src/main/java/com/jeonguk/auth/AuthServiceApplication.java | 5f0dc569f76615a9611b78d92ecfcbd5d3d2b366 | [] | no_license | jeonguk/auth-service | e7d759ecc111bbbb64e852f15e5531a9a4226030 | 2614624ddde8db10cd817ef9cdf1f12ce89dab79 | refs/heads/master | 2020-04-15T12:09:33.985825 | 2019-01-11T09:54:16 | 2019-01-11T09:54:16 | 164,662,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | package com.jeonguk.auth;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories;
import org.springframework.web.reactive.config.EnableWebFlux;
@SpringBootApplication
@EnableWebFlux
@EnableReactiveMongoRepositories
public class AuthServiceApplication {
public static void main(String[] args) {
SpringApplication.run(AuthServiceApplication.class, args);
}
}
| [
"kato1883@gmail.com"
] | kato1883@gmail.com |
13bb64a1e089d66c0e916bbd998fcaebe6f12deb | ac1116b56fd0caf6ce1cd61cd4b609811449d6b9 | /lesson 10 - 26.01.2018/src/Student/StudMain.java | 4005998c16f82adaa31b59c70cc17c36b9a165a3 | [] | no_license | MishaOnyshchenko/Lessons | 8436ee39661fd72287f74c882e073ea68878bfbb | da92830b0b4b4cef8fed593a3176381c9733c28a | refs/heads/master | 2018-12-14T17:42:22.909687 | 2018-10-12T17:27:42 | 2018-10-12T17:27:42 | 117,250,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package Student;
/**
* Created by java on 26.01.2018.
*/
public class StudMain {
public static void main(String[] args) {
Student st1 = new Student();
st1.setName("Kolia");
st1.setAge(2);
Student st2 = new Student();
st2.setName("Kolia");
System.out.println(st1.equals(st2));
}
}
| [
"misha.onyshchenko@gmail.com"
] | misha.onyshchenko@gmail.com |
2da2ccfd5ea93b91d6afb2d1a2b029b36582a9ba | 46f3e8bc3bfa00f61d876142d8925f26a38f25d6 | /gameserver/src/main/java/org/linlinjava/litemall/gameserver/data/vo/ListVo_61537_0.java | 6bd75f53df88aca316017bfd18d5defaf0cc1fb3 | [] | no_license | cxvisho/wendao | 1d58146ae4d62041295383bd19d4c11a4d0397ef | 98a2cc2571efa4c0dc503b8dbe904fcd5211d0ce | refs/heads/master | 2022-03-30T18:57:42.200158 | 2020-01-10T10:03:15 | 2020-01-10T10:03:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | //
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package org.linlinjava.litemall.gameserver.data.vo;
import java.util.LinkedList;
import java.util.List;
public class ListVo_61537_0 {
public List<Vo_61537_0> vo_61537_0 = new LinkedList();
public int a;
public int count;
public int c;
public int d;
public ListVo_61537_0() {
}
}
| [
"460475302@qq.com"
] | 460475302@qq.com |
b428188bc2be10e2734731e1667ae349b23940eb | ba3b2c108da7e5a21391cb47eef5e13672f9f498 | /SeleniumCode/src/selcode/action.java | 914852f175835eaa801aadca839a783ab77ab558 | [] | no_license | QVCAutomation1/qvc-automatuion-13.06.2020- | 81952bbcf4a5f307b9509a9eefe22c1ad6721242 | 091820bcf25cac408ec42be75447c7f04c2a37d5 | refs/heads/master | 2022-10-16T14:54:43.107774 | 2020-06-14T07:51:02 | 2020-06-14T07:51:02 | 272,037,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java |
package selcode;
public class action extends Teamplayers{
public void teamplayers() {
// TODO Auto-generated method stub
}
@Override
public void footballplayer() {
// TODO Auto-generated method stub
}
@Override
public void cricketplayer() {
// TODO Auto-generated method stub
}
@Override
public void volleyballplayer() {
// TODO Auto-generated method stub
}
@Override
public void kabadipalyer() {
// TODO Auto-generated method stub
}
@Override
public void hockeyplayer() {
// TODO Auto-generated method stub
}
}
| [
"My@My-PC"
] | My@My-PC |
76befc03e9e60c0ab53033267985b7ab9f86e236 | 8e0cd38daa9911ead7f2513ded5b997dd380f694 | /app/src/main/java/com/victor/myclient/widget/drawSmoothLine/ChartStyle.java | 2eb7ddd26434bee22206a346b61a18da832592b1 | [] | no_license | VVictorWang/xiaoyu | b9d86bccc2ca0c265b99399f4e4c6f407d1b5cc7 | 811d2153539a475a9601c0b308f4b06d82bb23ff | refs/heads/master | 2021-07-05T12:27:23.751560 | 2017-09-28T13:50:36 | 2017-09-28T13:50:36 | 90,042,699 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,266 | java | package com.victor.myclient.widget.drawSmoothLine;
import android.graphics.Color;
/**
* 曲线图整体的样式
*
* @author tomkeyzhang(qitongzhang@anjuke.com)
* @date :2014年4月17日
*/
public class ChartStyle {
/**
* 竖直标记线的颜色
*/
private int verticalLineColor;
/**
* 网格线颜色
*/
private int gridColor;
/**
* 坐标轴分隔线宽度
*/
private int axisLineWidth;
/**
* 横坐标文本大小
*/
private float horizontalLabelTextSize;
/**
* 横坐标文本颜色
*/
private int horizontalLabelTextColor;
/**
* 横坐标标题文本大小
*/
private float horizontalTitleTextSize;
/**
* 横坐标标题文本颜色
*/
private int horizontalTitleTextColor;
/**
* 横坐标标题文本左间距
*/
private int horizontalTitlePaddingLeft;
/**
* 横坐标标题文本右间距
*/
private int horizontalTitlePaddingRight;
/**
* 纵坐标文本大小
*/
private float verticalLabelTextSize;
/**
* 纵坐标文本上下间距
*/
private int verticalLabelTextPadding;
/**
* 纵坐标文本左右间距相对文本的比例
*/
private float verticalLabelTextPaddingRate;
/**
* 纵坐标文本颜色
*/
private int verticalLabelTextColor;
/**
* 图片背景上部分颜色
*/
private int backgroundUpPartColor;
/**
* 图片背景下部分颜色
*/
private int backgroundDownPartColor;
/**
* 最大温度最小温度提升温度的字体大小与颜色
*/
private int maxTemColor;
private int minTemColor;
private int raiseTemColor;
/**
*
*/
private int maxTemTextSize;
private int minTemTextSize;
private int raiseTemTextSize;
public ChartStyle() {
verticalLineColor = Color.WHITE;
gridColor = Color.LTGRAY;
horizontalTitleTextSize = 50;
horizontalTitleTextColor = Color.GRAY;
horizontalLabelTextSize = 50;
horizontalLabelTextColor = 0xFFD2F4FD;
verticalLabelTextSize = 20;
verticalLabelTextPadding = 50;
verticalLabelTextColor = Color.GRAY;
verticalLabelTextPaddingRate = 0.2f;
axisLineWidth = 2;
horizontalTitlePaddingLeft = 20;
horizontalTitlePaddingRight = 10;
backgroundUpPartColor = 0xff24cffc;
backgroundDownPartColor = 0xff1cbde7;
maxTemColor = Color.WHITE;
minTemColor = 0xFFD2F4FD;
raiseTemColor = 0xFFD2F4FD;
maxTemTextSize = 100;
minTemTextSize = 50;
raiseTemTextSize = 75;
}
public float getVerticalLabelTextSize() {
return verticalLabelTextSize;
}
public void setVerticalLabelTextSize(float verticalLabelTextSize) {
this.verticalLabelTextSize = verticalLabelTextSize;
}
public int getVerticalLabelTextPadding() {
return verticalLabelTextPadding;
}
public void setVerticalLabelTextPadding(int verticalLabelTextPadding) {
this.verticalLabelTextPadding = verticalLabelTextPadding;
}
public int getVerticalLabelTextColor() {
return verticalLabelTextColor;
}
public void setVerticalLabelTextColor(int verticalLabelTextColor) {
this.verticalLabelTextColor = verticalLabelTextColor;
}
public float getHorizontalLabelTextSize() {
return horizontalLabelTextSize;
}
public void setHorizontalLabelTextSize(float horizontalLabelTextSize) {
this.horizontalLabelTextSize = horizontalLabelTextSize;
}
public int getHorizontalLabelTextColor() {
return horizontalLabelTextColor;
}
public void setHorizontalLabelTextColor(int horizontalLabelTextColor) {
this.horizontalLabelTextColor = horizontalLabelTextColor;
}
public int getGridColor() {
return gridColor;
}
public void setGridColor(int gridColor) {
this.gridColor = gridColor;
}
public int getVerticalLineColor() {
return verticalLineColor;
}
public void setVerticalLineColor(int verticalLineColor) {
this.verticalLineColor = verticalLineColor;
}
public float getHorizontalTitleTextSize() {
return horizontalTitleTextSize;
}
public void setHorizontalTitleTextSize(float horizontalTitleTextSize) {
this.horizontalTitleTextSize = horizontalTitleTextSize;
}
public int getHorizontalTitleTextColor() {
return horizontalTitleTextColor;
}
public void setHorizontalTitleTextColor(int horizontalTitleTextColor) {
this.horizontalTitleTextColor = horizontalTitleTextColor;
}
public float getVerticalLabelTextPaddingRate() {
return verticalLabelTextPaddingRate;
}
public void setVerticalLabelTextPaddingRate(float verticalLabelTextPaddingRate) {
this.verticalLabelTextPaddingRate = verticalLabelTextPaddingRate;
}
public int getAxisLineWidth() {
return axisLineWidth;
}
public void setAxisLineWidth(int axisLineWidth) {
this.axisLineWidth = axisLineWidth;
}
public int getHorizontalTitlePaddingLeft() {
return horizontalTitlePaddingLeft;
}
public void setHorizontalTitlePaddingLeft(int horizontalTitlePaddingLeft) {
this.horizontalTitlePaddingLeft = horizontalTitlePaddingLeft;
}
public int getHorizontalTitlePaddingRight() {
return horizontalTitlePaddingRight;
}
public void setHorizontalTitlePaddingRight(int horizontalTitlePaddingRight) {
this.horizontalTitlePaddingRight = horizontalTitlePaddingRight;
}
public int getBackgroundUpPartColor() {
return backgroundUpPartColor;
}
public void setBackgroundUpPartColor(int backgroundUpPartColor) {
this.backgroundUpPartColor = backgroundUpPartColor;
}
public int getBackgroundDownPartColor() {
return backgroundDownPartColor;
}
public void setBackgroundDownPartColor(int backgroundDownPartColor) {
this.backgroundDownPartColor = backgroundDownPartColor;
}
public int getMaxTemColor() {
return maxTemColor;
}
public void setMaxTemColor(int maxTemColor) {
this.maxTemColor = maxTemColor;
}
public int getMinTemColor() {
return minTemColor;
}
public void setMinTemColor(int minTemColor) {
this.minTemColor = minTemColor;
}
public int getRaiseTemColor() {
return raiseTemColor;
}
public void setRaiseTemColor(int raiseTemColor) {
this.raiseTemColor = raiseTemColor;
}
public int getMaxTemTextSize() {
return maxTemTextSize;
}
public void setMaxTemTextSize(int maxTemTextSize) {
this.maxTemTextSize = maxTemTextSize;
}
public int getMinTemTextSize() {
return minTemTextSize;
}
public void setMinTemTextSize(int minTemTextSize) {
this.minTemTextSize = minTemTextSize;
}
public int getRaiseTemTextSize() {
return raiseTemTextSize;
}
public void setRaiseTemTextSize(int raiseTemTextSize) {
this.raiseTemTextSize = raiseTemTextSize;
}
} | [
"643705913@qq.com"
] | 643705913@qq.com |
e334164d97c89422af71609e3b69213c0556be3d | e017d211d4b760dfd9515c26baa8ad3b26916599 | /src/main/java/com/paypay/baymax/commons/DTB/security/GroupsDTB.java | 65d9f720fc16e9f6a79197a375be049a44c545c3 | [] | no_license | ricardoSANICK/paypay-commons | 345cbdb97569104fef7f42c23884ea6bd1d222db | 52da2d86af1685a72e64a50e6478d09bf3370519 | refs/heads/master | 2022-12-15T08:32:24.018611 | 2020-09-18T00:46:30 | 2020-09-18T00:46:30 | 295,899,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 972 | java | package com.paypay.baymax.commons.DTB.security;
import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY)
public class GroupsDTB {
private String id;
private String group_name;
private String description;
public GroupsDTB() {
super();
}
public GroupsDTB(String id, String group_name, String description) {
super();
this.id = id;
this.group_name = group_name;
this.description = description;
}
public GroupsDTB(String id, String group_name) {
this.id = id;
this.group_name = group_name;
}
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getGroup_name() {
return this.group_name;
}
public void setGroup_name(String group_name) {
this.group_name = group_name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"rickborderlight@gmail.com"
] | rickborderlight@gmail.com |
a4072621c47756c84cafdb6f85943877f310546b | ce475cdc11907eddfe7d419048fa9883474631d2 | /WORKSPACE/PracticeCollection/src/com/collection/practice/test/TestGenereicArrayList.java | 5fe30d2f244ff47bce58c6d615b787741f6851b4 | [] | no_license | avinashporwal2607/Manthan-ELF-16th-October-Avinash-Porwal | 0c44d8924da2f0e02da803e6521792b8c943c1ed | 28dc9a3664826e6690f81696aa51c6726860387f | refs/heads/master | 2020-09-16T22:30:10.336409 | 2019-12-27T07:05:13 | 2019-12-27T07:05:13 | 223,904,867 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 860 | java | //pgm for generic array list
package com.collection.practice.test;
import java.util.ArrayList;
import java.util.Iterator;
public class TestGenereicArrayList {
public static void main(String[] args) {
ArrayList<String> AL=new ArrayList<String>();
AL.add(null);
AL.add("AVINASH");
AL.add("DEVENDRA");
AL.add("ANKIT");
AL.add("AASHISH");
System.out.println("(**************fetching generic arraylist by iterator************");
Iterator<String> it=AL.iterator();
while(it.hasNext())
{
Object o=it.next();
System.out.println(o);
}
System.out.println("***************fetching data by for loop**************");
for(int i=0;i<AL.size();i++)
{
Object o=AL.get(i);
System.out.println(o);
}
System.out.println("************data by for each loop****************");
for(Object o:AL)
{
System.out.println(o);
}
}
}
| [
"aviporwal2607@gmail.com"
] | aviporwal2607@gmail.com |
1d53f6fa253a2c06646343e065001a6886fcd293 | db22a3f5794985785a32e3d5f2aa317e028c2bff | /jgt-jgrassgears/src/test/java/org/jgrasstools/gears/TestFeatureUtils.java | 77ca2300792026b95598c321be0f072a7831b196 | [] | no_license | wuletawu/UBN_Adige_Project | b5aabe6ef5223f84a342eaadbcad977d1afaa478 | 85a0c12a999591c0c6ab0e22fea01b520691f6a4 | refs/heads/master | 2021-01-10T01:52:45.754382 | 2015-10-03T16:59:35 | 2015-10-03T16:59:35 | 43,604,571 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,263 | java | package org.jgrasstools.gears;
import java.util.HashMap;
import java.util.List;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.jgrasstools.gears.utils.HMTestCase;
import org.jgrasstools.gears.utils.HMTestMaps;
import org.jgrasstools.gears.utils.RegionMap;
import org.jgrasstools.gears.utils.coverage.CoverageUtilities;
import org.jgrasstools.gears.utils.features.FeatureUtilities;
import org.jgrasstools.gears.utils.geometry.GeometryUtilities;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
/**
* Test FeatureUtils.
*
* @author Andrea Antonello (www.hydrologis.com)
*/
public class TestFeatureUtils extends HMTestCase {
@SuppressWarnings("nls")
public void testFeatureUtils() throws Exception {
SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
b.setName("typename");
b.setCRS(DefaultGeographicCRS.WGS84);
b.add("the_geom", Point.class);
b.add("AttrName", String.class);
SimpleFeatureType type = b.buildFeatureType();
SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
Object[] values = new Object[]{GeometryUtilities.gf().createPoint(new Coordinate(0, 0)), "test"};
builder.addAll(values);
SimpleFeature feature = builder.buildFeature(type.getTypeName());
Object attr = FeatureUtilities.getAttributeCaseChecked(feature, "attrname");
assertEquals("test", attr.toString());
attr = FeatureUtilities.getAttributeCaseChecked(feature, "attrnam");
assertNull(attr);
}
public void testGridCellGeoms() throws Exception {
double[][] mapData = HMTestMaps.mapData;
CoordinateReferenceSystem crs = HMTestMaps.getCrs();
HashMap<String, Double> envelopeParams = HMTestMaps.getEnvelopeparams();
GridCoverage2D inElev = CoverageUtilities.buildCoverage("elevation", mapData, envelopeParams, crs, true); //$NON-NLS-1$
RegionMap regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inElev);
double east = regionMap.getEast();
double north = regionMap.getNorth();
double south = regionMap.getSouth();
int nCols = regionMap.getCols();
int nRows = regionMap.getRows();
List<Polygon> cellPolygons = FeatureUtilities.gridcoverageToCellPolygons(inElev);
int size = nCols * nRows;
assertEquals(size, cellPolygons.size());
Polygon polygon = cellPolygons.get(9);
Envelope env = polygon.getEnvelopeInternal();
assertEquals(east, env.getMaxX(), DELTA);
assertEquals(north, env.getMaxY(), DELTA);
polygon = cellPolygons.get(size - 1);
env = polygon.getEnvelopeInternal();
assertEquals(east, env.getMaxX(), DELTA);
assertEquals(south, env.getMinY(), DELTA);
}
}
| [
"wuletawu979@yahoo.com"
] | wuletawu979@yahoo.com |
d0ad5ad52e6829b13def4a0ff0b072dba25b57b4 | b4d21a82f6e960aa8218e9bddb6611a5c1f7e0d0 | /web/src/main/java/com/hangjiang/action/config/JmsConfig.java | 9ea5b59440b38972bc0a11701fb966d7285d0578 | [] | no_license | jianghang/SpringBoot-Action | ed6a15b375071d84bca19721109d8337ba85bdb4 | 0759f866e57c88df1d7dac91dadc2070ffd90467 | refs/heads/master | 2021-01-20T13:07:42.344777 | 2017-12-14T08:32:27 | 2017-12-14T08:32:27 | 90,451,075 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,788 | java | package com.hangjiang.action.config;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.core.JmsTemplate;
import javax.jms.ConnectionFactory;
/**
* Created by jianghang on 2017/6/13.
*/
@Configuration
@Profile("prod")
@EnableJms
public class JmsConfig {
@Value("${jms.broker-url}")
private String brokerUrl;
@Value("${jms.user}")
private String user;
@Value("${jms.user}")
private String password;
@Bean
public ConnectionFactory connectionFactory(){
ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory();
activeMQConnectionFactory.setBrokerURL(brokerUrl);
activeMQConnectionFactory.setUserName(user);
activeMQConnectionFactory.setPassword(password);
return activeMQConnectionFactory;
}
@Bean
public JmsTemplate jmsTemplate(){
return new JmsTemplate(connectionFactory());
}
@Bean(name = "jmsQueueListenerCF")
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory(){
DefaultJmsListenerContainerFactory jmsListenerContainerFactory = new DefaultJmsListenerContainerFactory();
jmsListenerContainerFactory.setConnectionFactory(connectionFactory());
jmsListenerContainerFactory.setConcurrency("3-10");
jmsListenerContainerFactory.setRecoveryInterval(3000L);
return jmsListenerContainerFactory;
}
}
| [
"664019848@qq.com"
] | 664019848@qq.com |
60427ddb053766322c69fc6dcb8182f523b92a5f | 7ced6c0ed03f2f9345bbc06a09dbbcf5c8687619 | /catering-basic-server/catering-admin/catering-admin-server/src/main/java/com/meiyuan/catering/admin/dao/CateringAdvertisingExtMapper.java | 18cf71911bd7f3da55ddf146410fdc6898c8688d | [] | no_license | haorq/food-word | c14d5752c6492aed4a6a1410f9e0352479460da0 | 18a71259d77b4d96261dab8ed51ca1f109ab5c2f | refs/heads/master | 2023-01-01T12:19:48.967366 | 2020-10-26T07:32:25 | 2020-10-26T07:32:25 | 307,292,398 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.meiyuan.catering.admin.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.meiyuan.catering.admin.entity.CateringAdvertisingExtEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* description:
*
* @author yy
* @version 1.4.0
* @date 2020/9/2 15:57
*/
@Mapper
public interface CateringAdvertisingExtMapper extends BaseMapper<CateringAdvertisingExtEntity> {
}
| [
"386234736"
] | 386234736 |
fc0c56d701d81042f38f0e53cba04cf6d4d3a732 | d452156619c86b200a52bae1dbd98eccf7ddca4a | /src/main/java/com/github/crashdemons/deathtempban/DeathTempbanPlugin.java | 7958350da881f5f3ad8dbd352b0b451f80f88fcb | [] | no_license | crashdemons/deathtempban | 9f15dc05ab46a086422faa730b3a6040bb8cd13f | c1d71f7437573343daa0b230a84066471d0bb22c | refs/heads/master | 2022-12-30T18:21:18.874945 | 2020-10-13T22:51:41 | 2020-10-13T22:51:41 | 189,120,637 | 0 | 0 | null | 2020-10-13T22:51:42 | 2019-05-29T00:10:17 | Java | UTF-8 | Java | false | false | 2,540 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.crashdemons.deathtempban;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;
/**
*
* @author crashdemons (crashenator at gmail.com)
*/
public class DeathTempbanPlugin extends JavaPlugin implements Listener {
private void reload(){
reloadConfig();
}
@Override
public void onEnable(){
saveDefaultConfig();
reload();
getServer().getPluginManager().registerEvents(this, this);
}
@Override
public void onDisable(){
saveConfig();
getLogger().info("Disabled.");
}
@EventHandler
public void onDeath(PlayerDeathEvent event){
//getLogger().info(" PDE ");
Player p = event.getEntity();
String playerName = p.getName();
if(playerName==null) return;//nullable.
String uuid = p.getUniqueId().toString();
String key = "players."+uuid;
//getLogger().info(" "+key);
int firstBanDuration = getConfig().getInt("configuration.initial-ban-seconds");
int deathbanMultiplier = getConfig().getInt("configuration.death-ban-multiplier");
String commandFormat = getConfig().getString("configuration.tempban-command");
int deathcount = getConfig().getInt(key);
//getLogger().info(" "+deathcount);
deathcount++;
getConfig().set(key, deathcount);
double deathMultiplier = Math.pow(deathbanMultiplier, deathcount-1);
double deathbanDuration = firstBanDuration * deathMultiplier;
//getLogger().info(commandFormat);
//getLogger().info(" "+String.format(commandFormat, playerName, (int) deathbanDuration));
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run()
{
getServer().dispatchCommand(getServer().getConsoleSender(), String.format(commandFormat, playerName, (int) deathbanDuration));
}
}, 20L);
}
}
| [
"crashenator+gh@gmail.com"
] | crashenator+gh@gmail.com |
8ed33550b069b2792e6723db39815c4bd5f164d1 | 4594452a04274c4436542052f4240777f97ef1aa | /ontimize-more-plaf-j9/src/main/java/com/ontimize/plaf/painter/OSeparatorPainter.java | f14a665ce4ebb4482c7fcc066535e7cee4ec2ab4 | [] | no_license | ontimize/ontimize-more-plaf | 5244096f70804b69aa8559392f6d10c7d7737d54 | d4277ceb5b78a4c464e520fe99d17a1e337f19a5 | refs/heads/master | 2022-12-13T09:23:58.650667 | 2022-10-24T07:02:04 | 2022-10-24T07:02:04 | 235,548,088 | 1 | 1 | null | 2022-12-07T06:51:10 | 2020-01-22T10:19:17 | Java | UTF-8 | Java | false | false | 4,210 | java | package com.ontimize.plaf.painter;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import com.ontimize.plaf.utils.OntimizeLAFColorUtils;
/**
* Painter for the background of the buttons in a scroll bar (to configure
* border and foreground colors, painters, images, ...)
*
* @author Imatia Innovation
*
*/
public class OSeparatorPainter extends AbstractRegionPainter {
// package protected integers representing the available states that
// this painter will paint. These are used when creating a new instance
// of OSeparatorPainter to determine which region/state is being painted
// by that instance.
public static final int BACKGROUND_ENABLED = 1;
// painter to fill the component:
protected Paint backgroundColorEnabled;
protected Paint backgroundColorEnabledShadow;
// the following 4 variables are reused during the painting code of the
// layers
protected Path2D path = new Path2D.Float();
protected Rectangle2D rect = new Rectangle2D.Float(0, 0, 0, 0);
// All Colors used for painting are stored here. Ideally, only those colors
// being used
// by a particular instance of OSeparatorPainter would be created. For the
// moment at least,
// however, all are created for each instance.
protected Color color1 = new ColorUIResource(OntimizeLAFColorUtils.setAlpha(Color.black, 0.2));
protected Color color2 = new ColorUIResource(OntimizeLAFColorUtils.setAlpha(Color.white, 0.2));
// Array of current component colors, updated in each paint call
protected Object[] componentColors;
public OSeparatorPainter(int state, PaintContext ctx) {
super(state, ctx);
}
@Override
protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {
// populate componentColors array with colors calculated in
// getExtendedCacheKeys call
this.componentColors = extendedCacheKeys;
// generate this entire method. Each state/bg/fg/border combo that has
// been painted gets its own KEY and paint method.
switch (this.state) {
case BACKGROUND_ENABLED:
this.paintBackgroundEnabled(g, width, height);
break;
}
}
@Override
protected PaintContext getPaintContext() {
return this.ctx;
}
@Override
protected String getComponentKeyName() {
return "Separator";
}
/**
* Get configuration properties to be used in this painter (such as:
* *BorderPainter, *upperCornerPainter, *lowerCornerPainter and *BgPainter).
* As usual, it is checked the OLAFCustomConfig.properties, and then in
* OLAFDefaultConfig.properties.
*
* Moreover, if there are not values for that properties in both, the
* default Nimbus configuration values are set, due to, those properties are
* needed to paint and used by the Ontimize L&F, so, there are not Nimbus
* values for that, so, default values are always configured based on Nimbus
* values.
*
*/
@Override
protected void init() {
// enable:
Object obj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + "[Enabled].background");
if (obj instanceof Paint) {
this.backgroundColorEnabled = (Paint) obj;
} else {
this.backgroundColorEnabled = this.color1;
}
obj = UIManager.getLookAndFeelDefaults().get(this.getComponentKeyName() + "[Enabled].backgroundShadow");
if (obj instanceof Paint) {
this.backgroundColorEnabledShadow = (Paint) obj;
} else {
this.backgroundColorEnabledShadow = this.color2;
}
}
protected void paintBackgroundEnabled(Graphics2D g, int width, int height) {
// Painting upper line...
this.path.reset();
this.path.moveTo(0, (height / 2.0) - 1);
this.path.lineTo(width, (height / 2.0) - 1);
g.setPaint(this.backgroundColorEnabled);
g.draw(this.path);
// Painting bottom line...
this.path.reset();
this.path.moveTo(0, height / 2.0);
this.path.lineTo(width, height / 2.0);
g.setPaint(this.backgroundColorEnabledShadow);
g.draw(this.path);
}
} | [
"faustino.lage@imatia.com"
] | faustino.lage@imatia.com |
a04797327e551f0bb574c63fb3114380a0b5214d | 05a4da2e57c5fafc1f8549656ede0095b161e576 | /app/src/test/java/edu/washington/dubeh/awty/ExampleUnitTest.java | 62d4592ceae047d52c913e7f514f3714313087cd | [] | no_license | cazadori/awty | f9a1edeee9ac7bfc215d5724aff5a86247fd2d3c | 433f150c283904123c27e0246e523dd15e5948ce | refs/heads/master | 2021-01-21T06:39:05.144826 | 2017-02-28T00:26:41 | 2017-02-28T00:26:41 | 82,868,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package edu.washington.dubeh.awty;
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() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"dubeh@uw.edu"
] | dubeh@uw.edu |
413511850891befe647b856352be2792e60ca6e4 | f3424eb383986cf13d60f2df9fb71143ac473fca | /lib/poweraqua/poweraquaDB/JenaConnectionBean.java | 49e9acce9bbe12d13382acffd2dee3403da3b3d4 | [] | no_license | bshambaugh/PowerAqua-decompiled | 054c28ce8c06e592edc8ce9bd14a755408080468 | c8cd82d864a15464586d2a4cb94db254e86c48e7 | refs/heads/master | 2021-01-19T09:37:14.480840 | 2017-05-20T18:21:37 | 2017-05-20T18:21:37 | 87,772,291 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 824 | java | package poweraquaDB;
import com.hp.hpl.jena.db.DBConnection;
import com.hp.hpl.jena.rdf.model.ModelMaker;
import java.io.PrintStream;
public class JenaConnectionBean
extends ConnectionBean
{
private DBConnection connection;
private ModelMaker modelMaker;
public JenaConnectionBean(DBConnection connection, long idConnection, ModelMaker modelMaker)
{
super(idConnection);
this.connection = connection;
this.modelMaker = modelMaker;
}
public DBConnection getConnection()
{
return this.connection;
}
public ModelMaker getModelMaker()
{
return this.modelMaker;
}
public void close()
{
try
{
this.modelMaker.close();
this.connection.close();
}
catch (Exception e)
{
System.out.println("Error closing the conexion");
}
}
}
| [
"brent.shambaugh@gmail.com"
] | brent.shambaugh@gmail.com |
32e54a9d44c6faa3dd0bb16fde9e18fe551162c4 | 47794690d5f092315862269d33cdc1aed0882f2d | /src/main/java/com/teamunemployment/lolanalytics/data/control/MatchListControl.java | a60ae4054cb362eab086c97a3725fe0ee72e78b4 | [] | no_license | josiahkendall/LeagueAnalytics | 756ddb04e06c3a6dc204e57f9e884218d0061271 | 1e754edc84389ca6468270052cf4deeb0d11e750 | refs/heads/master | 2021-01-12T09:39:27.301848 | 2017-07-14T02:04:19 | 2017-07-14T02:04:19 | 76,221,644 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,703 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.teamunemployment.lolanalytics.data.control;
import com.teamunemployment.lolanalytics.data.SummonerTableAccessor;
import com.teamunemployment.lolanalytics.data.database.DBHelper;
import com.teamunemployment.lolanalytics.models.MatchList;
import com.teamunemployment.lolanalytics.models.MatchSummary;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Class to load and save the matchList for a user.
* @author jek40
*/
public class MatchListControl {
private MatchSummaryControl matchSummaryControl;
private DBHelper dbHelper;
public MatchListControl(MatchSummaryControl matchSummaryControl, DBHelper dbHelper) {
this.matchSummaryControl = matchSummaryControl;
this.dbHelper = dbHelper;
}
/**
* Save an array of match summaries.
* @param matchList The match
*/
public void saveMatches(ArrayList<MatchSummary> matchList, long summonerId) {
// iterate over each item and save them all one by one.
Iterator<MatchSummary> matchListIterator = matchList.iterator();
// Match lists can be 1000's of matches. If we put this matchlist inside
// the loop we will consume a lot of memory and force the gc to run too frequently.
MatchSummary match = null;
while (matchListIterator.hasNext()) {
match = matchListIterator.next();
if (!matchSummaryControl.hasMatchSummary(match.matchId)) {
matchSummaryControl.saveMatchSummary(match, summonerId);
}
}
}
/**
* Get a list of all the match summaries for a summoner.
* @param summonerId
* @return
*/
public ArrayList<MatchSummary> getMatchSummariesForSummoner(long summonerId) {
ArrayList<MatchSummary> resultArray = new ArrayList();
boolean isLastItem = false;
try {
String query = "SELECT * from matchsummary WHERE SummonerId = " + summonerId;
ResultSet resultSet = dbHelper.ExecuteSqlQuery(query);
while (!isLastItem) {
resultSet.next();
isLastItem = resultSet.isLast();
// Why is this needed
if(!isLastItem) {
MatchSummary matchSummary = new MatchSummary();
matchSummary.region = resultSet.getString("Region");
matchSummary.platformId = resultSet.getString("PlatformId");
matchSummary.matchId = resultSet.getLong("MatchId");
matchSummary.champion = resultSet.getInt("Champion");
matchSummary.queue = resultSet.getString("Queue");
matchSummary.season = resultSet.getString("Season");
matchSummary.timestamp = resultSet.getLong("GameTimeStamp");
matchSummary.lane = resultSet.getString("Lane");
matchSummary.role = resultSet.getString("Role");
resultArray.add(matchSummary);
}
}
} catch (SQLException | IllegalStateException ex) {
System.out.println(ex.getMessage());
}
return resultArray;
}
public ArrayList<MatchSummary> getMatchSummariesSummonerOfACertainChampion(long summonerId, int championId) {
return null;
}
}
| [
"josiahephraim.kendall@gmail.com"
] | josiahephraim.kendall@gmail.com |
bf507bd7b7367cee295b0e5302b0a997ecae61af | f859d58bd12855f8c5a720a0748b588a0f235ba4 | /app/src/test/java/android/com/testnewview/ExampleUnitTest.java | e2c15822f8a6b23d781bf80dda3604d1d2ee7e3b | [] | no_license | zhangyouyun/TestNewView | 25a053e5612e47ebd4062ab0860362cc1239ff4a | 1c0a19a4a91432325949b558e5916edf34356d24 | refs/heads/master | 2021-01-10T01:45:50.924177 | 2016-02-26T01:02:14 | 2016-02-26T01:02:14 | 52,076,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 316 | java | package android.com.testnewview;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"744120141@qq.com"
] | 744120141@qq.com |
77e6e5a3f90edcaf3ad7853e2500fbf64c89763e | 07dc9c6bab23e298311c5243322ff3ab7ce1adc1 | /E-commerce/src/main/java/com/xinyuan/main/controller/UserController.java | 429ab88ba3605d05cd854b1bb0c3fba02ec4c3aa | [] | no_license | chenxin57085122/CourseDesign | 2ed382c1127bb18637539e4890c927d6bf10fdbf | 52b3837e5689fbd10f785af4bb8eda0111425c72 | refs/heads/master | 2020-04-14T04:19:59.209892 | 2019-01-08T14:34:10 | 2019-01-08T14:34:10 | 163,633,098 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,306 | java | package com.xinyuan.main.controller;
import com.xinyuan.main.domain.User;
import com.xinyuan.main.service.UserService;
import com.xinyuan.main.utils.ServiceVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @Auther: chenxin
* @Date: 2019/1/2 15:29
* @Description: 提供与用户相关的API
*/
@RestController
@RequestMapping("/user")
//@CrossOrigin
public class UserController {
private Logger logger = LoggerFactory.getLogger(UserController.class);
@Autowired
private UserService userService = null;
/**
*
* 功能描述: 用户登录
*
* @param:
* @return:
* @auther: chenxin
* @date: 2019/1/5 17:48
*/
@PostMapping("/login")
public ServiceVO<User> login(@RequestBody Map<String,String> user){
logger.info(user.toString());
User res = userService.login(user.get("username"),user.get("password"));
if (res != null){
return new ServiceVO(res);
}
return new ServiceVO.ServiceVOBuilder().message("username or password is error!").code(500).builder();
}
/**
*
* 功能描述: 用户注册
*
* @param:
* @return:
* @auther: chenxin
* @date: 2019/1/5 17:48
*/
@PostMapping("/register")
public ServiceVO<Integer> register(@RequestBody User user){
return new ServiceVO(userService.reister(user));
}
/**
*
* 功能描述: 修改用户信息
*
* @param:
* @return:
* @auther: chenxin
* @date: 2019/1/5 17:48
*/
@PostMapping("/update/userInfo")
public ServiceVO<Integer> updateUserInfo(@RequestBody User user){
return new ServiceVO(userService.updateUserInfor(user));
}
/**
*
* 功能描述: 读取用户信息
*
* @param:
* @return:
* @auther: chenxin
* @date: 2019/1/5 17:48
*/
@GetMapping("/read/user/{id}")
public ServiceVO readUserInfoById(@PathVariable("id") int id){
if (id < 1) return new ServiceVO.ServiceVOBuilder().message("登出").code(2).builder();
return new ServiceVO(userService.selectByPrimaryKey(id));
}
}
| [
"1004498612@qq.com"
] | 1004498612@qq.com |
cba5b56e0de1e654df41789bdf227b484c8e4e37 | 5b1f94da1ac0a25c956ca93bd57c301e4c97c87a | /src/test/java/Login/LoginAction.java | e5a23bb22f0099f620edc6221110e591fe3fa949 | [] | no_license | enesaydinqa/trendyolProject | 07b29362e65eedc4d29873c1f99a3e9d7a3ff6ab | f0b755e4c330644bd98e082930e307e7f9dea137 | refs/heads/master | 2021-09-20T12:21:53.093586 | 2018-08-09T16:44:26 | 2018-08-09T16:44:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,235 | java | package Login;
import BasePackage.BaseClass;
import MainPage.trendyolMainPageImage;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openqa.selenium.By;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import static KeywordLayer.Command.*;
public class LoginAction extends BaseClass {
private static final By loginIconUser = By.className("login-register-button-container");
private static final By accountLoginButton = By.cssSelector(".login");
private static final By email = By.id("email");
private static final By password = By.id("password");
private static final By loginSubmitButton = By.id("loginSubmit");
private static final By loggedInPanel = By.cssSelector(".loggedin-panel-container");
private static XSSFWorkbook workbook;
private static XSSFSheet sheet;
private static XSSFCell cell;
private static File src;
@Test
public void trendyolLogin() throws Exception {
src = new File(System.getProperty("user.dir") + "/src/main/resources/DataDriven Excel File/trendyolLoginDataDriven.xlsx");
FileInputStream finput = new FileInputStream(src);
workbook = new XSSFWorkbook(finput);
sheet = workbook.getSheetAt(0);
GetURL("https://www.trendyol.com/");
try {
WaitElementToBeClickable(trendyolMainPageImage.ClosePopup);
Click(trendyolMainPageImage.ClosePopup);
} catch (Exception ex) {
}
WaitElementVisible(loginIconUser);
MouseOver(loginIconUser);
WaitElementToBeClickable(accountLoginButton);
Click(accountLoginButton);
cell = sheet.getRow(3).getCell(1);
cell.setCellType(Cell.CELL_TYPE_STRING);
String emailValue = cell.getStringCellValue();
cell = sheet.getRow(3).getCell(2);
cell.setCellType(Cell.CELL_TYPE_STRING);
String passwordValue = cell.getStringCellValue();
WaitElementVisible(email);
SendKeys(email, emailValue);
SendKeys(password, passwordValue);
Click(loginSubmitButton);
isElementPresent(loggedInPanel); // Verify Login
}
@AfterMethod
public static void TestResult(ITestResult result) throws Exception {
if (result.getStatus() == ITestResult.FAILURE) {
sheet.getRow(3).createCell(3).setCellValue("FAILURE");
FileOutputStream fileOutput = new FileOutputStream(src);
workbook.write(fileOutput);
} else if (result.getStatus() == ITestResult.SKIP) {
sheet.getRow(3).createCell(3).setCellValue("SKIP");
FileOutputStream fileOutput = new FileOutputStream(src);
workbook.write(fileOutput);
} else if (result.getStatus() == ITestResult.SUCCESS) {
sheet.getRow(3).createCell(3).setCellValue("SUCCESS");
FileOutputStream fileOutput = new FileOutputStream(src);
workbook.write(fileOutput);
}
}
}
| [
"enesaydin@testkalite.com"
] | enesaydin@testkalite.com |
b6265cc990cd944fa267aa112181a7246b2c28c7 | f6a5e921c5fc2031e89ea58f000aa4971a3fdee4 | /app/src/main/java/com/orangemoo/com/beta/fragment/PersonFragment.java | b20a20b1673e63250ca36af2ad883d2b04d91887 | [] | no_license | lyang850108/OrangeMoon | ef4e323e1b2a479f5532838ea84d3c5a1ac9af73 | 4f224d37271e908ea1929b8ab586e0291a6eb596 | refs/heads/master | 2021-01-11T08:12:36.248568 | 2016-11-27T11:00:47 | 2016-11-27T11:00:47 | 69,479,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | java | package com.orangemoo.com.beta.fragment;
import android.os.Bundle;
/**
* Created by 德祥 on 2015/7/13.
*/
public class PersonFragment extends SwipeRefreshFragment {
public static PersonFragment newInstance(int requestType) {
PersonFragment fragment = new PersonFragment();
Bundle args = new Bundle();
args.putInt(ARG_API_TYPE, requestType);
fragment.setArguments(args);
return fragment;
}
public PersonFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
| [
"lyang850108@163.com"
] | lyang850108@163.com |
d6ae78d8948a6ce518d752cd729b6ef46d318a4b | ee958046f3637a5fc44082d6defc0c3a6018be19 | /app/src/main/java/com/playdate/app/model/Medium.java | cb3f69ff97ebbcd365c2df229aaec93b37a55896 | [] | no_license | Abhishek-cdac/android_PlayDate | 6ba1c33d7eadd8652112e1d28b0dad69b57ec9fe | fe72ac1e16cfe2c4548baacd57eafeefaa23918d | refs/heads/master | 2023-06-30T19:35:18.080825 | 2021-08-03T13:10:27 | 2021-08-03T13:10:27 | 364,789,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java |
package com.playdate.app.model;
import com.google.gson.annotations.Expose;
public class Medium {
@Expose
private String mediaFullPath;
@Expose
private String mediaId;
@Expose
private String mediaThumbName;
@Expose
private String mediaType;
public String getMediaFullPath() {
return mediaFullPath;
}
public void setMediaFullPath(String mediaFullPath) {
this.mediaFullPath = mediaFullPath;
}
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
public String getMediaThumbName() {
return mediaThumbName;
}
public void setMediaThumbName(String mediaThumbName) {
this.mediaThumbName = mediaThumbName;
}
public String getMediaType() {
return mediaType;
}
public void setMediaType(String mediaType) {
this.mediaType = mediaType;
}
}
| [
"mayuri.dayla@nectarinfotel.com"
] | mayuri.dayla@nectarinfotel.com |
6db2362f38d153e975cb3ac8ae984745a0532164 | 0cce585637e5c8764a4694d379882ae270f1fa2f | /src/main/java/com/byteatebit/nbserver/simple/udp/IDatagramMessageHandler.java | 2d98ba6f4d142530e71beef4c52c24df365ef0dc | [
"Apache-2.0"
] | permissive | byteatebit/byteatebit-nbserver | 08685a4b60bb9e2e9d494fdc0b85f2d49f38b9b6 | 5fe283f127dff5f80cf9896dcc74aa70dad6e26a | refs/heads/master | 2021-01-20T20:02:26.240604 | 2016-06-13T02:45:09 | 2016-06-13T02:45:09 | 61,002,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | /*
* Copyright (c) 2016 byteatebit
*
* 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.byteatebit.nbserver.simple.udp;
import com.byteatebit.nbserver.DatagramMessage;
import com.byteatebit.nbserver.INbContext;
public interface IDatagramMessageHandler {
void accept(DatagramMessage message);
}
| [
"josh@byteatebit.com"
] | josh@byteatebit.com |
66dc65557b85cf0267b929a77a4582f9881ba1a4 | 17069154b30562aed84bc847d48223e94b038577 | /minecraft/pixelmon/enums/EnumPokeballs.java | 5485353e03700489c90f950e78adf118a5165244 | [] | no_license | LethalInjection/Pixelmon | 49ad0b5a36248624490cdf33ea6c00e09e31db27 | e96b56bb8ea2b09cacac06c23e2a7822febf2ed9 | refs/heads/master | 2020-12-25T04:28:39.498852 | 2012-07-25T20:53:30 | 2012-07-25T20:53:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,142 | java | package pixelmon.enums;
import net.minecraft.src.Item;
import net.minecraft.src.mod_Pixelmon;
public enum EnumPokeballs {
PokeBall(0, 1, "pokeball"), GreatBall(1, 1.5, "greatball"), UltraBall(2, 2, "ultraball"), MasterBall(3, 255, "masterball");
private EnumPokeballs(int index, double ballBonus, String filenamePrefix) {
this.ballBonus = ballBonus;
this.index = index;
this.filenamePrefix = filenamePrefix;
}
private double ballBonus;
private int index;
private String filenamePrefix;
public double getBallBonus() {
return ballBonus;
}
public int getIndex(){
return index;
}
public Item getItem(){
if (index ==0) return mod_Pixelmon.pokeBall;
if (index ==1) return mod_Pixelmon.greatBall;
if (index ==2) return mod_Pixelmon.ultraBall;
if (index ==3) return mod_Pixelmon.masterBall;
return mod_Pixelmon.pokeBall;
}
public String getTexture() {
return filenamePrefix + ".png";
}
public String getFlashRedTexture() {
return filenamePrefix + "_flashing.png";
}
public String getCaptureTexture() {
return filenamePrefix + "_captured.png";
}
}
| [
"malc.geddes@gmail.com"
] | malc.geddes@gmail.com |
4f36d50333fb1330081ead549353bfcdc40aff22 | 9dab4f5b8c5fbe8d464f889b6c8bd5d46e1f5fda | /src/main/java/com/rest/demo/exception/GlobalExceptionHandler.java | 291cceaf4f84487033dcb8517b554a2f38972a83 | [
"MIT"
] | permissive | JDogeStyle/spring-rest-demo | 89e93a811a75eeb44b5cfcaa7f482628762f473b | f73d8a19a0966983028e5a999f0f8d7c59b4f5c2 | refs/heads/master | 2020-04-19T01:46:10.162162 | 2019-02-02T04:20:49 | 2019-02-02T04:20:49 | 159,724,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,941 | java | package com.rest.demo.exception;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import org.springframework.beans.TypeMismatchException;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.validation.BindException;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.multipart.support.MissingServletRequestPartException;
import org.springframework.web.servlet.NoHandlerFoundException;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
@RestControllerAdvice
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(final MethodArgumentNotValidException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) {
final List<String> errors = new ArrayList<String>();
for (final FieldError error : ex.getBindingResult().getFieldErrors()) {
errors.add(error.getField() + ": " + error.getDefaultMessage());
}
for (final ObjectError error : ex.getBindingResult().getGlobalErrors()) {
errors.add(error.getObjectName() + ": " + error.getDefaultMessage());
}
final ResponseError responseError = new ResponseError(HttpStatus.BAD_REQUEST, ex.getLocalizedMessage(), errors);
return handleExceptionInternal(ex, responseError, headers, responseError.getStatus(), request);
}
@Override
protected ResponseEntity<Object> handleBindException(final BindException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) {
final List<String> errors = new ArrayList<String>();
for (final FieldError error : ex.getBindingResult().getFieldErrors()) {
errors.add(error.getField() + ": " + error.getDefaultMessage());
}
for (final ObjectError error : ex.getBindingResult().getGlobalErrors()) {
errors.add(error.getObjectName() + ": " + error.getDefaultMessage());
}
final ResponseError responseError = new ResponseError(HttpStatus.BAD_REQUEST, ex.getLocalizedMessage(), errors);
return handleExceptionInternal(ex, responseError, headers, responseError.getStatus(), request);
}
@Override
protected ResponseEntity<Object> handleTypeMismatch(final TypeMismatchException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) {
final String error = ex.getValue() + " value for " + ex.getPropertyName() + " should be of type " + ex.getRequiredType();
final ResponseError responseError = new ResponseError(HttpStatus.BAD_REQUEST, ex.getLocalizedMessage(), error);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@Override
protected ResponseEntity<Object> handleMissingServletRequestPart(final MissingServletRequestPartException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) {
final String error = ex.getRequestPartName() + " part is missing";
final ResponseError responseError = new ResponseError(HttpStatus.BAD_REQUEST, ex.getLocalizedMessage(), error);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@Override
protected ResponseEntity<Object> handleMissingServletRequestParameter(final MissingServletRequestParameterException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) {
final String error = ex.getParameterName() + " parameter is missing";
final ResponseError responseError = new ResponseError(HttpStatus.BAD_REQUEST, ex.getLocalizedMessage(), error);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@Override
protected ResponseEntity<Object> handleNoHandlerFoundException(final NoHandlerFoundException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) {
final String error = "No handler found for " + ex.getHttpMethod() + " " + ex.getRequestURL();
final ResponseError responseError = new ResponseError(HttpStatus.NOT_FOUND, ex.getLocalizedMessage(), error);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@Override
protected ResponseEntity<Object> handleHttpRequestMethodNotSupported(final HttpRequestMethodNotSupportedException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) {
final StringBuilder builder = new StringBuilder();
builder.append(ex.getMethod());
builder.append(" method is not supported for this request. Supported methods are ");
ex.getSupportedHttpMethods().forEach(t -> builder.append(t + " "));
final ResponseError responseError = new ResponseError(HttpStatus.METHOD_NOT_ALLOWED, ex.getLocalizedMessage(), builder.toString().trim());
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@Override
protected ResponseEntity<Object> handleHttpMediaTypeNotSupported(final HttpMediaTypeNotSupportedException ex, final HttpHeaders headers, final HttpStatus status, final WebRequest request) {
final StringBuilder builder = new StringBuilder();
builder.append(ex.getContentType());
builder.append(" media type is not supported. Supported media types are ");
ex.getSupportedMediaTypes().forEach(t -> builder.append(t + ", "));
final ResponseError responseError = new ResponseError(HttpStatus.UNSUPPORTED_MEDIA_TYPE, ex.getLocalizedMessage(), builder.substring(0, builder.length() - 2));
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@ExceptionHandler({ MethodArgumentTypeMismatchException.class })
public ResponseEntity<Object> handleMethodArgumentTypeMismatch(final MethodArgumentTypeMismatchException ex, final WebRequest request) {
final String error = ex.getName() + " should be of type " + ex.getRequiredType().getName();
final ResponseError responseError = new ResponseError(HttpStatus.BAD_REQUEST, ex.getLocalizedMessage(), error);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@ExceptionHandler({ ConstraintViolationException.class })
public ResponseEntity<Object> handleConstraintViolation(final ConstraintViolationException ex, final WebRequest request) {
final List<String> errors = new ArrayList<String>();
for (final ConstraintViolation<?> violation : ex.getConstraintViolations()) {
errors.add(violation.getRootBeanClass().getName() + " " + violation.getPropertyPath() + ": " + violation.getMessage());
}
final ResponseError responseError = new ResponseError(HttpStatus.BAD_REQUEST, ex.getLocalizedMessage(), errors);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@ExceptionHandler({ DataIntegrityViolationException.class })
public ResponseEntity<Object> handleDataIntegrityViolationException(final DataIntegrityViolationException ex, final WebRequest request) {
final String error = "Data integrity has been violated " + ex.getMostSpecificCause();
final ResponseError responseError = new ResponseError(HttpStatus.BAD_REQUEST, ex.getLocalizedMessage(), error);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@ExceptionHandler({ ResourceNotFoundException.class })
public ResponseEntity<Object> handleResourceNotFoundException(final ResourceNotFoundException ex, final HttpServletRequest request){
final String resource = request.getMethod() + ":" + request.getRequestURI();
final String error = "The resource " + resource + " does not exist. Please try with other parameter.";
final ResponseError responseError = new ResponseError(HttpStatus.NOT_FOUND, ex.getLocalizedMessage(), error);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@ExceptionHandler({ AccessDeniedException.class })
public ResponseEntity<Object> handleAccessDeniedException(final AccessDeniedException ex, final HttpServletRequest request) {
final String error = "Requested access to the resource is denied. Please try with other user account.";
final ResponseError responseError = new ResponseError(HttpStatus.FORBIDDEN, ex.getLocalizedMessage(), error);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@ExceptionHandler({ AuthenticationException.class })
public ResponseEntity<Object> handleAuthenticationException(final AuthenticationException ex, final HttpServletRequest request) {
final String error = "The resource owner could not be authenticated due to missing or invalid credentials.";
final ResponseError responseError = new ResponseError(HttpStatus.UNAUTHORIZED, ex.getLocalizedMessage(), error);
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
@ExceptionHandler({ Exception.class })
public ResponseEntity<Object> handleAll(final Exception ex, final WebRequest request) {
final ResponseError responseError = new ResponseError(HttpStatus.INTERNAL_SERVER_ERROR, ex.getLocalizedMessage(), "error occurred");
return new ResponseEntity<Object>(responseError, new HttpHeaders(), responseError.getStatus());
}
}
| [
"joepx3@hotmail.com"
] | joepx3@hotmail.com |
52726cfc6c951672e944f15867620c15b20483ab | ded11cd95a48e7f5f616f45327f06342dd8b9204 | /mbg/src/main/java/com/leapstack/wanglong/mbg/model/UmsPermissionExample.java | eb40be5ad097312a9241ba0d2399c2596e023707 | [] | no_license | zrx8586/easy-mall | 87427deeab7c2894235fdc1db90996591170caf2 | 9c760a4fe52bc88fd78e22a0e419e8cb4bbc8d09 | refs/heads/master | 2022-07-01T22:41:06.076823 | 2019-11-18T08:12:49 | 2019-11-18T08:12:49 | 221,857,136 | 0 | 0 | null | 2022-06-21T02:15:28 | 2019-11-15T06:16:37 | Java | UTF-8 | Java | false | false | 25,706 | java | package com.leapstack.wanglong.mbg.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class UmsPermissionExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UmsPermissionExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andPidIsNull() {
addCriterion("pid is null");
return (Criteria) this;
}
public Criteria andPidIsNotNull() {
addCriterion("pid is not null");
return (Criteria) this;
}
public Criteria andPidEqualTo(Long value) {
addCriterion("pid =", value, "pid");
return (Criteria) this;
}
public Criteria andPidNotEqualTo(Long value) {
addCriterion("pid <>", value, "pid");
return (Criteria) this;
}
public Criteria andPidGreaterThan(Long value) {
addCriterion("pid >", value, "pid");
return (Criteria) this;
}
public Criteria andPidGreaterThanOrEqualTo(Long value) {
addCriterion("pid >=", value, "pid");
return (Criteria) this;
}
public Criteria andPidLessThan(Long value) {
addCriterion("pid <", value, "pid");
return (Criteria) this;
}
public Criteria andPidLessThanOrEqualTo(Long value) {
addCriterion("pid <=", value, "pid");
return (Criteria) this;
}
public Criteria andPidIn(List<Long> values) {
addCriterion("pid in", values, "pid");
return (Criteria) this;
}
public Criteria andPidNotIn(List<Long> values) {
addCriterion("pid not in", values, "pid");
return (Criteria) this;
}
public Criteria andPidBetween(Long value1, Long value2) {
addCriterion("pid between", value1, value2, "pid");
return (Criteria) this;
}
public Criteria andPidNotBetween(Long value1, Long value2) {
addCriterion("pid not between", value1, value2, "pid");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andValueIsNull() {
addCriterion("value is null");
return (Criteria) this;
}
public Criteria andValueIsNotNull() {
addCriterion("value is not null");
return (Criteria) this;
}
public Criteria andValueEqualTo(String value) {
addCriterion("value =", value, "value");
return (Criteria) this;
}
public Criteria andValueNotEqualTo(String value) {
addCriterion("value <>", value, "value");
return (Criteria) this;
}
public Criteria andValueGreaterThan(String value) {
addCriterion("value >", value, "value");
return (Criteria) this;
}
public Criteria andValueGreaterThanOrEqualTo(String value) {
addCriterion("value >=", value, "value");
return (Criteria) this;
}
public Criteria andValueLessThan(String value) {
addCriterion("value <", value, "value");
return (Criteria) this;
}
public Criteria andValueLessThanOrEqualTo(String value) {
addCriterion("value <=", value, "value");
return (Criteria) this;
}
public Criteria andValueLike(String value) {
addCriterion("value like", value, "value");
return (Criteria) this;
}
public Criteria andValueNotLike(String value) {
addCriterion("value not like", value, "value");
return (Criteria) this;
}
public Criteria andValueIn(List<String> values) {
addCriterion("value in", values, "value");
return (Criteria) this;
}
public Criteria andValueNotIn(List<String> values) {
addCriterion("value not in", values, "value");
return (Criteria) this;
}
public Criteria andValueBetween(String value1, String value2) {
addCriterion("value between", value1, value2, "value");
return (Criteria) this;
}
public Criteria andValueNotBetween(String value1, String value2) {
addCriterion("value not between", value1, value2, "value");
return (Criteria) this;
}
public Criteria andIconIsNull() {
addCriterion("icon is null");
return (Criteria) this;
}
public Criteria andIconIsNotNull() {
addCriterion("icon is not null");
return (Criteria) this;
}
public Criteria andIconEqualTo(String value) {
addCriterion("icon =", value, "icon");
return (Criteria) this;
}
public Criteria andIconNotEqualTo(String value) {
addCriterion("icon <>", value, "icon");
return (Criteria) this;
}
public Criteria andIconGreaterThan(String value) {
addCriterion("icon >", value, "icon");
return (Criteria) this;
}
public Criteria andIconGreaterThanOrEqualTo(String value) {
addCriterion("icon >=", value, "icon");
return (Criteria) this;
}
public Criteria andIconLessThan(String value) {
addCriterion("icon <", value, "icon");
return (Criteria) this;
}
public Criteria andIconLessThanOrEqualTo(String value) {
addCriterion("icon <=", value, "icon");
return (Criteria) this;
}
public Criteria andIconLike(String value) {
addCriterion("icon like", value, "icon");
return (Criteria) this;
}
public Criteria andIconNotLike(String value) {
addCriterion("icon not like", value, "icon");
return (Criteria) this;
}
public Criteria andIconIn(List<String> values) {
addCriterion("icon in", values, "icon");
return (Criteria) this;
}
public Criteria andIconNotIn(List<String> values) {
addCriterion("icon not in", values, "icon");
return (Criteria) this;
}
public Criteria andIconBetween(String value1, String value2) {
addCriterion("icon between", value1, value2, "icon");
return (Criteria) this;
}
public Criteria andIconNotBetween(String value1, String value2) {
addCriterion("icon not between", value1, value2, "icon");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("type is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("type is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("type =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("type <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("type >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("type >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("type <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("type <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("type in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("type not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("type between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("type not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andUriIsNull() {
addCriterion("uri is null");
return (Criteria) this;
}
public Criteria andUriIsNotNull() {
addCriterion("uri is not null");
return (Criteria) this;
}
public Criteria andUriEqualTo(String value) {
addCriterion("uri =", value, "uri");
return (Criteria) this;
}
public Criteria andUriNotEqualTo(String value) {
addCriterion("uri <>", value, "uri");
return (Criteria) this;
}
public Criteria andUriGreaterThan(String value) {
addCriterion("uri >", value, "uri");
return (Criteria) this;
}
public Criteria andUriGreaterThanOrEqualTo(String value) {
addCriterion("uri >=", value, "uri");
return (Criteria) this;
}
public Criteria andUriLessThan(String value) {
addCriterion("uri <", value, "uri");
return (Criteria) this;
}
public Criteria andUriLessThanOrEqualTo(String value) {
addCriterion("uri <=", value, "uri");
return (Criteria) this;
}
public Criteria andUriLike(String value) {
addCriterion("uri like", value, "uri");
return (Criteria) this;
}
public Criteria andUriNotLike(String value) {
addCriterion("uri not like", value, "uri");
return (Criteria) this;
}
public Criteria andUriIn(List<String> values) {
addCriterion("uri in", values, "uri");
return (Criteria) this;
}
public Criteria andUriNotIn(List<String> values) {
addCriterion("uri not in", values, "uri");
return (Criteria) this;
}
public Criteria andUriBetween(String value1, String value2) {
addCriterion("uri between", value1, value2, "uri");
return (Criteria) this;
}
public Criteria andUriNotBetween(String value1, String value2) {
addCriterion("uri not between", value1, value2, "uri");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Integer value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Integer value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Integer value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Integer value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Integer value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Integer> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Integer> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Integer value1, Integer value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Integer value1, Integer value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"lwang@leapstack.cn"
] | lwang@leapstack.cn |
f3478bf7cf08b17388abbb479364961fc0c354a4 | 73bcd7b3466f1f7122c977c73ecce69eea598c68 | /src/main/java/com/litewolf101/aztech/blocks/CustomSpreadableDirtBlock.java | 9adb71d908550cb6444de81c0bec2986dd3cda49 | [] | no_license | LiteWolf101/AzTech | 5469923dbc2bf9daf242140aba34de3454cad1c8 | c4cdf7b8d777519525dcb3768f87151ff4982cf3 | refs/heads/master | 2020-03-29T08:01:40.508967 | 2020-03-05T06:21:38 | 2020-03-05T06:21:38 | 149,690,920 | 2 | 0 | null | 2020-02-06T19:41:49 | 2018-09-21T01:12:55 | Java | UTF-8 | Java | false | false | 2,519 | java | package com.litewolf101.aztech.blocks;
import com.litewolf101.aztech.init.ModBlocks;
import net.minecraft.block.*;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.lighting.LightEngine;
import java.util.Random;
public class CustomSpreadableDirtBlock extends SnowyDirtBlock {
protected CustomSpreadableDirtBlock(Block.Properties builder) {
super(builder);
}
private static boolean isSnowAbove(BlockState state, IWorldReader reader, BlockPos pos) {
BlockPos blockpos = pos.up();
BlockState blockstate = reader.getBlockState(blockpos);
if (blockstate.getBlock() == Blocks.SNOW && blockstate.get(SnowBlock.LAYERS) == 1) {
return true;
} else {
int i = LightEngine.func_215613_a(reader, state, pos, blockstate, blockpos, Direction.UP, blockstate.getOpacity(reader, blockpos));
return i < reader.getMaxLightLevel();
}
}
private static boolean func_220256_c(BlockState state, IWorldReader reader, BlockPos pos) {
BlockPos blockpos = pos.up();
return isSnowAbove(state, reader, pos) && !reader.getFluidState(blockpos).isTagged(FluidTags.WATER);
}
@SuppressWarnings("deprecation")
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
if (!worldIn.isRemote) {
if (!worldIn.isAreaLoaded(pos, 3))
return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading
if (!isSnowAbove(state, worldIn, pos)) {
worldIn.setBlockState(pos, ModBlocks.ANCIENT_DIRT.getDefaultState());
} else {
if (worldIn.getLight(pos.up()) >= 9) {
BlockState blockstate = this.getDefaultState();
for (int i = 0; i < 4; ++i) {
BlockPos blockpos = pos.add(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
if (worldIn.getBlockState(blockpos).getBlock() == ModBlocks.ANCIENT_DIRT && func_220256_c(blockstate, worldIn, blockpos)) {
worldIn.setBlockState(blockpos, blockstate.with(SNOWY, Boolean.valueOf(worldIn.getBlockState(blockpos.up()).getBlock() == Blocks.SNOW)));
}
}
}
}
}
}
}
| [
"packeraman@gmail.com"
] | packeraman@gmail.com |
b38c82b14b5806fd8a083cba2d9084f866d12da6 | 29d75cf1c8ffdd684870e753c0ed94e73b785260 | /TXTr/src/main/java/nl/harmjanwestra/txtr/TXTr.java | 4e71ce8cfb1e6b73acea1b94d7c273d18022763d | [] | no_license | DPCscience/harmjan | ad9bbd932f318cb3f6adaabdfc6cf56d6a6e4846 | 4ba45020ea30241a26f41cc6c8800fa3e4c79b51 | refs/heads/master | 2021-07-19T19:07:23.071559 | 2017-10-27T10:11:07 | 2017-10-27T10:11:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,566 | java | package nl.harmjanwestra.txtr;
import org.apache.commons.cli.*;
import nl.harmjanwestra.utilities.legacy.genetica.io.Gpio;
import nl.harmjanwestra.utilities.legacy.genetica.io.text.TextFile;
import java.io.IOException;
/**
* Created by Harm-Jan on 02/01/16.
*/
public class TXTr {
private static Options OPTIONS;
static {
OPTIONS = new Options();
Option option;
option = Option.builder()
.desc("Test GZipped file")
.longOpt("testgz")
.build();
OPTIONS.addOption(option);
option = Option.builder()
.desc("Split textfile by lines")
.longOpt("split")
.build();
OPTIONS.addOption(option);
option = Option.builder()
.desc("Multiple line hashtag delimited header")
.longOpt("multilineheader")
.build();
OPTIONS.addOption(option);
option = Option.builder()
.desc("Merge while skipping first line of all files except 1st")
.longOpt("merge")
.build();
OPTIONS.addOption(option);
option = Option.builder("i")
.desc("Input")
.hasArg().required()
.build();
OPTIONS.addOption(option);
option = Option.builder()
.longOpt("comma")
.desc("input is comma separated (in stead of a single path with locations)")
.build();
OPTIONS.addOption(option);
option = Option.builder()
.longOpt("pattern")
.desc("input contains CHR pattern")
.build();
OPTIONS.addOption(option);
option = Option.builder("n")
.desc("Nr lines for splitting")
.hasArg()
.build();
OPTIONS.addOption(option);
option = Option.builder("o")
.desc("Input")
.hasArg().required()
.build();
OPTIONS.addOption(option);
}
public static void main(String[] args) {
TXTr t = new TXTr();
try {
CommandLineParser parser = new DefaultParser();
final CommandLine cmd = parser.parse(OPTIONS, args, true);
String input = "";
String output = "";
boolean commaseparated = false;
if (cmd.hasOption("i")) {
input = cmd.getOptionValue("i");
}
if (cmd.hasOption("o")) {
output = cmd.getOptionValue("o");
}
if (cmd.hasOption("comma")) {
commaseparated = true;
}
if (cmd.hasOption("testgz")) {
try {
t.testGZ(input);
} catch (IOException e) {
e.printStackTrace();
}
} else if (cmd.hasOption("split")) {
if (cmd.hasOption("n")) {
try {
int nrLines = Integer.parseInt(cmd.getOptionValue("n"));
try {
t.split(input, output, nrLines);
} catch (IOException e) {
e.printStackTrace();
}
} catch (NumberFormatException e) {
System.out.println(cmd.getOptionValue("n") + " is not an integer");
}
} else {
System.out.println("Use -n for --split");
printHelp();
}
} else if (cmd.hasOption("merge")) {
try {
boolean multilineheader = false;
if (cmd.hasOption("multilineheader")) {
multilineheader = true;
}
t.mergeSkipHeader(input, output, multilineheader, commaseparated, cmd.hasOption("pattern"));
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (ParseException e) {
printHelp();
e.printStackTrace();
}
}
private void testGZ(String input) throws IOException {
TextFile tf = new TextFile(input, TextFile.R);
int ctr = 0;
try {
while (tf.readLine() != null) {
tf.readLine();
ctr++;
if (ctr % 1000 == 0) {
System.out.print(ctr + " lines parsed...\r");
}
}
} catch (Exception e) {
System.out.println("File failed at line "+ctr);
e.printStackTrace();
}
System.out.println();
tf.close();
}
public static void printHelp() {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp(" ", OPTIONS);
System.exit(-1);
}
public void split(String file, String fileout, int lns) throws IOException {
TextFile in = new TextFile(file, TextFile.R);
int ctr = 0;
int ctr2 = 1;
String ln = in.readLine();
TextFile out = new TextFile(fileout + "-" + ctr2, TextFile.W);
while (ln != null) {
ln = in.readLine();
out.writeln(ln);
ctr++;
if (ctr % lns == 0) {
out.close();
out = new TextFile(fileout + "-" + ctr2, TextFile.W);
ctr2++;
}
}
out.close();
in.close();
}
public void mergeSkipHeader(String fileList, String output, boolean multilinehashtagheader, boolean commasep, boolean pattern) throws IOException {
String[] files = null;
if (pattern) {
files = new String[22];
for (int i = 1; i < 23; i++) {
files[i - 1] = fileList.replaceAll("CHR", "" + i);
}
} else if (commasep) {
files = fileList.split(",");
} else {
TextFile tf1 = new TextFile(fileList, TextFile.R);
files = tf1.readAsArray();
tf1.close();
}
boolean headerwritten = false;
TextFile out = new TextFile(output, TextFile.W);
int fctr = 0;
for (String file : files) {
if (Gpio.exists(file)) {
TextFile in = new TextFile(file, TextFile.R);
String ln = in.readLine();
int lnctr = 0;
while (ln != null) {
if (multilinehashtagheader) {
if (ln.startsWith("#")) {
if (fctr == 0) {
out.writeln(ln);
}
} else {
out.writeln(ln);
}
} else {
if (!headerwritten && lnctr == 0) {
out.writeln(ln);
headerwritten = true;
} else if (lnctr > 0) {
out.writeln(ln);
}
}
ln = in.readLine();
lnctr++;
}
in.close();
fctr++;
} else {
System.out.println("Warning - could not find file: " + file);
}
}
out.close();
}
}
| [
"westra.harmjan@outlook.com"
] | westra.harmjan@outlook.com |
1910b3da11a311faa0dcf9618f66a48da7ae35fc | 0ef6169c6ff329fa9a9b76bd5b6dafbfb774c000 | /app/src/main/java/com/example/navigationcomponentdemo/ConfirmationFragment.java | 1d19874077fe59ffcaf616a7425e8090665e1184 | [] | no_license | dinesh9977031104/navigationComponentDemo | 87d30e35890064089985e69ad92286fa204afab4 | 3751ac8aace37d448a34c0c7aa47b0183b335abc | refs/heads/master | 2023-03-11T07:12:35.126266 | 2021-03-03T12:58:08 | 2021-03-03T12:58:08 | 344,125,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | package com.example.navigationcomponentdemo;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class ConfirmationFragment extends Fragment {
View view;
TextView name, amount;
public ConfirmationFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_confirmation, container, false);
name = view.findViewById(R.id.name);
amount = view.findViewById(R.id.amount);
name.setText(ConfirmationFragmentArgs.fromBundle(getArguments()).getName());
amount.setText(""+ConfirmationFragmentArgs.fromBundle(getArguments()).getAmount());
return view;
}
} | [
"dinesh9977031104@gmail.com"
] | dinesh9977031104@gmail.com |
f9a394474cb8ffac197a3ce0493c2c1b94e16080 | edfce0f82507990d9262adce41100711dd43ea6b | /dubbo-domain/src/main/java/com/pxxy/beans/TbOrder.java | f7f07687050c1539975bf8c4f44a79229c9ff552 | [
"Apache-2.0"
] | permissive | yan123zi/dubbo-sample | a2cfc4f91bc53c914ddd81b358d63e6d75ac2843 | ddc391e0b620c852faf72abd38317fb2d4202440 | refs/heads/master | 2020-05-18T05:03:50.238879 | 2019-05-15T08:45:51 | 2019-05-15T08:45:51 | 184,192,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,049 | java | package com.pxxy.beans;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yzj
* @since 2019-05-05
*/
@Data
public class TbOrder extends Model<TbOrder> implements Serializable{
private static final long serialVersionUID=1L;
/**
* 订单id
*/
@TableId(value = "order_id", type = IdType.AUTO)
private String orderId;
/**
* 实付金额。精确到2位小数;单位:元。如:200.07,表示:200元7分
*/
private String payment;
/**
* 支付类型,1、在线支付,2、货到付款
*/
private Integer paymentType;
/**
* 邮费。精确到2位小数;单位:元。如:200.07,表示:200元7分
*/
private String postFee;
/**
* 状态:1、未付款,2、已付款,3、未发货,4、已发货,5、交易成功,6、交易关闭
*/
private Integer status;
/**
* 订单创建时间
*/
private Date createTime;
/**
* 订单更新时间
*/
private Date updateTime;
/**
* 付款时间
*/
private Date paymentTime;
/**
* 发货时间
*/
private Date consignTime;
/**
* 交易完成时间
*/
private Date endTime;
/**
* 交易关闭时间
*/
private Date closeTime;
/**
* 物流名称
*/
private String shippingName;
/**
* 物流单号
*/
private String shippingCode;
/**
* 用户id
*/
private Long userId;
/**
* 买家留言
*/
private String buyerMessage;
/**
* 买家昵称
*/
private String buyerNick;
/**
* 买家是否已经评价
*/
private Integer buyerRate;
@Override
protected Serializable pkVal() {
return this.orderId;
}
}
| [
"673343330@qq.com"
] | 673343330@qq.com |
c1ebaa1b4750c620749abd5673a84177b40545e6 | d450b62e0cebfcfc592350192cd424009c347733 | /jOOQ-test/examples/org/jooq/examples/sqlserver/adventureworks/dbo/tables/Awbuildversion.java | 4323b23ec58bb37424383489d1614d56b219e62d | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | rtincar/jOOQ | 9ccec69ff0d4af5217829413c1132a0d08acded8 | d0304fdfa77c0a8fd79614f7ff72b558783ec6a8 | refs/heads/master | 2020-12-25T11:21:22.173304 | 2012-03-01T16:32:48 | 2012-03-01T16:32:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,707 | java | /**
* This class is generated by jOOQ
*/
package org.jooq.examples.sqlserver.adventureworks.dbo.tables;
/**
* This class is generated by jOOQ.
*/
public class Awbuildversion extends org.jooq.impl.UpdatableTableImpl<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord> {
private static final long serialVersionUID = -1319738074;
/**
* The singleton instance of dbo.AWBuildVersion
*/
public static final org.jooq.examples.sqlserver.adventureworks.dbo.tables.Awbuildversion AWBUILDVERSION = new org.jooq.examples.sqlserver.adventureworks.dbo.tables.Awbuildversion();
/**
* The class holding records for this type
*/
private static final java.lang.Class<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord> __RECORD_TYPE = org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord.class;
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord> getRecordType() {
return __RECORD_TYPE;
}
/**
* An uncommented item
*
* PRIMARY KEY
*/
public final org.jooq.TableField<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord, java.lang.Byte> SYSTEMINFORMATIONID = createField("SystemInformationID", org.jooq.impl.SQLDataType.TINYINT, this);
/**
* An uncommented item
*/
public final org.jooq.TableField<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord, java.lang.String> DATABASE_VERSION = createField("Database Version", org.jooq.impl.SQLDataType.NVARCHAR, this);
/**
* An uncommented item
*/
public final org.jooq.TableField<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord, java.sql.Timestamp> VERSIONDATE = createField("VersionDate", org.jooq.impl.SQLDataType.TIMESTAMP, this);
/**
* An uncommented item
*/
public final org.jooq.TableField<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord, java.sql.Timestamp> MODIFIEDDATE = createField("ModifiedDate", org.jooq.impl.SQLDataType.TIMESTAMP, this);
/**
* No further instances allowed
*/
private Awbuildversion() {
super("AWBuildVersion", org.jooq.examples.sqlserver.adventureworks.dbo.Dbo.DBO);
}
/**
* No further instances allowed
*/
private Awbuildversion(java.lang.String alias) {
super(alias, org.jooq.examples.sqlserver.adventureworks.dbo.Dbo.DBO, org.jooq.examples.sqlserver.adventureworks.dbo.tables.Awbuildversion.AWBUILDVERSION);
}
@Override
public org.jooq.Identity<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord, java.lang.Byte> getIdentity() {
return org.jooq.examples.sqlserver.adventureworks.dbo.Keys.IDENTITY_AWBUILDVERSION;
}
@Override
public org.jooq.UniqueKey<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord> getMainKey() {
return org.jooq.examples.sqlserver.adventureworks.dbo.Keys.PK_AWBUILDVERSION_SYSTEMINFORMATIONID;
}
@Override
@SuppressWarnings("unchecked")
public java.util.List<org.jooq.UniqueKey<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord>> getKeys() {
return java.util.Arrays.<org.jooq.UniqueKey<org.jooq.examples.sqlserver.adventureworks.dbo.tables.records.AwbuildversionRecord>>asList(org.jooq.examples.sqlserver.adventureworks.dbo.Keys.PK_AWBUILDVERSION_SYSTEMINFORMATIONID);
}
@Override
public org.jooq.examples.sqlserver.adventureworks.dbo.tables.Awbuildversion as(java.lang.String alias) {
return new org.jooq.examples.sqlserver.adventureworks.dbo.tables.Awbuildversion(alias);
}
}
| [
"lukas.eder@gmail.com"
] | lukas.eder@gmail.com |
f807ee85c04a26d1aa114858a649e55fd45fac2f | 37c7539db23c46b0a1392945fca28a2c4189279b | /src/test/java/utilities/ExcelUtils.java | 1e45fdb70082672a7b31461d54fb8cd676fc1a53 | [] | no_license | AimiraUsenova/AUCucumberFramework | d021f3a323605d6d7e466e02d971780dd4d3075d | 1a90f70eb58db0707bba300de1a5ceb1a351f6e5 | refs/heads/master | 2020-09-16T17:38:13.506650 | 2019-12-15T01:09:59 | 2019-12-15T01:09:59 | 223,843,642 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,670 | java | package utilities;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.*;
public class ExcelUtils {
//workbook
//sheet
//row
//cell
//filepath
//openExcelFile(String path,String sheetName) --> return void
//getValue (int rowNum , int cellNum) --> return String
//setValue(String value, int rowNum , int cellNum) --> return void ,it will just update
//getNumberOfRows() --> return int
private static XSSFWorkbook workbook;
private static XSSFSheet excelSheet;
private static XSSFRow row;
private static XSSFCell cell;
private static String filePath;
/**
* This method will open excel file
*
* @param excelFileName
* @param SheetName
*/
public static void openExcelFile(String excelFileName, String SheetName) {
filePath = "src/test/resources/data/" + excelFileName + ".xlsx";
try {
File file = new File(filePath);
FileInputStream input = new FileInputStream(file);
workbook = new XSSFWorkbook(input);
excelSheet = workbook.getSheet(SheetName);
} catch (Exception e) {
System.out.println("No such file directory");
}
}
/**
* Method will accept rowNum and cellNum and will return the value on
* that cell from excel file.
*
* @param rowNum
* @param cellNum
* @return
*/
public static String getValue(int rowNum, int cellNum) {
row = excelSheet.getRow(rowNum);
cell = row.getCell(cellNum);
return cell.toString();
}
public static void setValue(String value, int rowNum, int cellNum) throws IOException {
row = excelSheet.getRow(rowNum);
cell = row.getCell(cellNum);
if (cell == null) {
cell = row.createCell(cellNum);
cell.setCellType(CellType.STRING);
cell.setCellValue(value);
} else {
cell.setCellValue(value);
}
FileOutputStream output = null;
try {
output = new FileOutputStream(filePath);
workbook.write(output);
} catch (FileNotFoundException e) {
System.out.println("No such file in directory");
} finally {
output.close();
}
}
/**
* This method will return the number of rows in excel file.
* @return
*/
public static int getNumberOfRows(){
return excelSheet.getPhysicalNumberOfRows();
}
} | [
"ajmirau@gmail.com"
] | ajmirau@gmail.com |
79c2e9c898a1ffa01084c4ab7a5f554c6fb95757 | bc16294f65a8da6a5214d97dc31dd6da62c9a8fe | /src/com/lynuc/bean/SysLog.java | 8971c3a84c5acfec268d7ebb8f426c7d39e2543b | [] | no_license | strideahead/infopub | 8a9f62014adb4501ebe4d92ca2449d70cc3ffa14 | 45184080fc104491b039696e8272059e5e50fb18 | refs/heads/master | 2021-01-12T03:52:30.945415 | 2017-01-07T13:57:49 | 2017-01-07T13:57:49 | 78,279,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,676 | java | package com.lynuc.bean;
public class SysLog {
private String gguid;
private String log_user;
private String log_memo;
private String log_time;
private String log_type;
private String uploadpag_gguid;
public SysLog() {
super();
// TODO Auto-generated constructor stub
}
public SysLog(String gguid, String log_user, String log_memo, String log_time, String log_type,
String uploadpag_gguid) {
super();
this.gguid = gguid;
this.log_user = log_user;
this.log_memo = log_memo;
this.log_time = log_time;
this.log_type = log_type;
this.uploadpag_gguid = uploadpag_gguid;
}
public String getGguid() {
return gguid;
}
public void setGguid(String gguid) {
this.gguid = gguid;
}
public String getLog_user() {
return log_user;
}
public void setLog_user(String log_user) {
this.log_user = log_user;
}
public String getLog_memo() {
return log_memo;
}
public void setLog_memo(String log_memo) {
this.log_memo = log_memo;
}
public String getLog_time() {
return log_time;
}
public void setLog_time(String log_time) {
this.log_time = log_time;
}
public String getLog_type() {
return log_type;
}
public void setLog_type(String log_type) {
this.log_type = log_type;
}
public String getUploadpag_gguid() {
return uploadpag_gguid;
}
public void setUploadpag_gguid(String uploadpag_gguid) {
this.uploadpag_gguid = uploadpag_gguid;
}
@Override
public String toString() {
return "{\"gguid\":\"" + gguid + "\",\"log_user\":\"" + log_user + "\",\"log_memo\":\"" + log_memo
+ "\",\"log_time\":\"" + log_time + "\",\"log_type\":\"" + log_type + "\",\"uploadpag_gguid\":\""
+ uploadpag_gguid + "\"} ";
}
}
| [
"503137249@163.com"
] | 503137249@163.com |
dd19814d0da156ff59eda874cd4c8caf905c710d | 6a3519ee354744d1256972d586dccf522901767a | /src/command/LocationCommand.java | c255522e45b581eb579bd097ff3125c7c03ca07c | [] | no_license | odh4145/bookinghairshop | 177c6f71ec5b4f99a482921c28d473d3e699b141 | 4fde9deea5cda6ce7f7e1a52e94dfbb8fc3280b1 | refs/heads/master | 2022-04-12T21:14:31.292063 | 2020-04-03T05:52:35 | 2020-04-03T05:52:35 | 238,248,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package command;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.location.beans.LocDAO;
import com.location.beans.LocDTO;
public class LocationCommand implements Command {
@Override
public void execute(HttpServletRequest request, HttpServletResponse response) {
LocDAO dao = new LocDAO();
LocDTO [] arr = null;
try {
arr = dao.selectAllShop();
request.setAttribute("shoplist", arr);
arr.toString();
} catch (SQLException e) { // 만약 ConnectionPool 을 사용한다면 여기서 NamingException 도 catch 해야 한다
e.printStackTrace();
}
}
}
| [
"odh@odh-PC"
] | odh@odh-PC |
b53e7d6fff9600bb9e853ac70a075b4cd25486e8 | 87eb9bd8bac2123ec92d69bfdf338eb8858c52fd | /SkillTest/app/src/main/java/com/androidlime/skilltest/MainActivity.java | 3201afec08adf7d78d6797ed025e5c85d4a607c2 | [] | no_license | ACbOntu/ACbs-Projects | 80c64376a605605ff3dbce8ffb7ee8b25b1f52dc | 08419aaf01da9c9821dbeae9458635294c52534c | refs/heads/master | 2022-04-29T09:37:28.182183 | 2020-07-28T17:40:01 | 2020-07-28T17:40:01 | 151,581,023 | 0 | 0 | null | 2022-03-29T22:34:11 | 2018-10-04T14:01:38 | PHP | UTF-8 | Java | false | false | 3,153 | java | package com.androidlime.skilltest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.CountDownTimer;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.widget.VideoView;
import java.net.URI;
import static com.androidlime.skilltest.R.styleable.AlertDialog;
public class MainActivity extends AppCompatActivity {
public static int result = 0;
Button b,r;
EditText name,password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
name = (EditText) findViewById(R.id.name);
password = (EditText) findViewById(R.id.pass);
b = (Button) findViewById(R.id.start);
r = (Button) findViewById(R.id.reg);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences share = getSharedPreferences("Registration", Context.MODE_PRIVATE);
String n = share.getString("name","No name found");
String p = share.getString("password","No password found");
if(name.getText().toString().equals(n) && password.getText().toString().equals(p))
{
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("আপনার পাসওয়ার্ড মিলেছে। আপনি কি প্রবেশ করবেন ?");
builder.setPositiveButton("হ্যাঁ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext()," প্রিয় "+name.getText().toString()+ ",\nআপনার পরীক্ষা এখন শুরু হল...\nBest of luck",Toast.LENGTH_SHORT).show();
Intent i = new Intent(MainActivity.this,Second.class);
startActivity(i);
}
});
builder.setNegativeButton("না", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
}
}
});
r.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent p = new Intent(MainActivity.this,Reg.class);
startActivity(p);
}
});
}
}
| [
"acbontu@gmail.com"
] | acbontu@gmail.com |
09d6a0ff8e99cae9f23a7cae70952ebef1179b43 | 0825572e5482f7e69f2d89d3c947d0dd9f330d91 | /AppEngine/src/app/adshandler/EngineHandler.java | e0551416e26d157c7519902d81f0282bad0de456 | [] | no_license | monika1995/ApkInstaller | 4ca18e7516d6837e1144659ce5080279737f3aef | 183a8719840e971786c6cce28fb2d85a1c2f5339 | refs/heads/master | 2020-09-20T23:56:33.271252 | 2020-02-01T17:15:18 | 2020-02-01T17:15:18 | 224,621,547 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,224 | java | package app.adshandler;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import androidx.annotation.NonNull;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.gson.Gson;
import java.util.ArrayList;
import app.PrintLog;
import app.fcm.FCMTopicResponse;
import app.fcm.GCMPreferences;
import app.receiver.TopicAlarmReceiver;
import app.rest.request.DataRequest;
import app.rest.rest_utils.RestUtils;
import app.server.v2.DataHubConstant;
import app.server.v2.DataHubHandler;
import app.server.v2.DataHubPreference;
import app.serviceprovider.Utils;
import app.socket.EngineApiController;
import app.socket.Response;
import static android.content.Context.ALARM_SERVICE;
/**
* Created by quantum4u1 on 25/04/18.
*/
class EngineHandler {
private DataHubPreference preference;
private DataHubHandler mHandler;
private DataHubConstant mConstant;
private GCMPreferences gcmPreference;
private Context mContext;
EngineHandler(Context context) {
preference = new DataHubPreference(context);
mHandler = new DataHubHandler();
mConstant = new DataHubConstant(context);
gcmPreference = new GCMPreferences(context);
this.mContext = context;
}
void initServices(boolean fetchFromServer) {
if (fetchFromServer) {
doVersionRequest();
} else {
PrintLog.print("get pref data" + " " + new DataHubPreference(mContext).getAdsResponse());
new DataHubHandler().parseMasterData(mContext, new DataHubPreference(mContext).getAdsResponse());
}
}
private void doVersionRequest() {
DataRequest dataRequest = new DataRequest();
EngineApiController mApiController = new EngineApiController(mContext, new Response() {
@Override
public void onResponseObtained(Object response, int responseType, boolean isCachedData) {
PrintLog.print("response version OK" + " " + response);
mHandler.parseVersionData(mContext, response.toString(), new DataHubHandler.MasterRequestListener() {
@Override
public void callMasterService() {
PrintLog.print("checking version flow domasterRequest");
doMasterRequest();
}
});
}
@Override
public void onErrorObtained(String errormsg, int responseType) {
PrintLog.print("response version ERROR" + " " + errormsg);
if (!preference.getAdsResponse().equalsIgnoreCase(DataHubConstant.KEY_NA)) {
mHandler.parseMasterData(mContext, preference.getAdsResponse());
} else {
mHandler.parseMasterData(mContext, mConstant.parseAssetData());
}
}
}, EngineApiController.VERSION_ID_CODE);
mApiController.getVersionRequest(dataRequest);
doReferrerRequest();
}
private void doMasterRequest() {
DataRequest mMasterRequest = new DataRequest();
EngineApiController apiController = new EngineApiController(mContext, new Response() {
@Override
public void onResponseObtained(Object response, int responseType, boolean isCachedData) {
PrintLog.print("response master OK" + " " + response.toString() + " :" + responseType);
mHandler.parseMasterData(mContext, response.toString());
}
@Override
public void onErrorObtained(String errormsg, int responseType) {
PrintLog.print("response master Failed" + " " + errormsg + " :type" + " " + responseType);
if (!preference.getAdsResponse().equalsIgnoreCase(DataHubConstant.KEY_NA)) {
mHandler.parseMasterData(mContext, preference.getAdsResponse());
} else {
mHandler.parseMasterData(mContext, mConstant.parseAssetData());
}
}
}, EngineApiController.MASTER_SERVICE_CODE);
apiController.getMasterData(mMasterRequest);
}
void doGCMRequest() {
System.out.println("353 Logs >> 00");
if (RestUtils.isVirtual(mContext)
|| !gcmPreference.getGCMRegister()
|| !gcmPreference.getGCMID().equalsIgnoreCase("NA")) {
System.out.println("353 Logs >> 01");
DataRequest mRequest = new DataRequest();
EngineApiController mApiController = new EngineApiController(mContext, new Response() {
@Override
public void onResponseObtained(Object response, int responseType, boolean isCachedData) {
mHandler.parseFCMData(mContext, response.toString());
}
@Override
public void onErrorObtained(String errormsg, int responseType) {
System.out.println("response GCM Failed receiver" + " " + errormsg);
gcmPreference.setGCMRegister(false);
}
}, EngineApiController.GCM_SERVICE_CODE);
mApiController.setFCMTokens(gcmPreference.getGCMID());
mApiController.getGCMIDRequest(mRequest);
System.out.println("EngineHandler.doGCMRequest already register");
}
}
private void doReferrerRequest() {
if (!gcmPreference.getReferalRegister() && !gcmPreference.getreferrerId().equalsIgnoreCase("NA")) {
DataRequest mRequest = new DataRequest();
EngineApiController mController = new EngineApiController(mContext, new Response() {
@Override
public void onResponseObtained(Object response, int responseType, boolean isCachedData) {
PrintLog.print("response referal success" + " ");
mHandler.parseReferalData(mContext, response.toString());
}
@Override
public void onErrorObtained(String errormsg, int responseType) {
PrintLog.print("response referal Failed app launch 1" + " " + errormsg);
gcmPreference.setReferalRegister(false);
}
}, EngineApiController.REFERRAL_ID_CODE);
mController.getReferralRequest(mRequest);
}
}
void doTopicsRequest() {
/*
*creating topic for first time or when app version change.
*/
if (!RestUtils.getVersion(mContext).equalsIgnoreCase(String.valueOf(gcmPreference.getTopicAppVersion()))
|| !gcmPreference.getregisterAllTopics()) {
createTopics(mContext);
}
}
private ArrayList<String> topics, allsubscribeTopic;
private String version;
private void createTopics(Context context) {
String country = "C_" + RestUtils.getCountryCode(context);
version = "AV_" + RestUtils.getVersion(context);
String osVersion = "OS_" + RestUtils.getOSVersion(context);
String deviceVersion = "DV_" + RestUtils.getDeviceVersion(context);
String date = "DT_" + RestUtils.getDateofLos_Angeles();
String month = "DT_" + RestUtils.getMonthofLos_Angeles();
if (!RestUtils.validateJavaDate(RestUtils.getDateofLos_Angeles())) {
date = "DT_" + RestUtils.getDate(System.currentTimeMillis());
System.out.println("EngineHandler.createTopics not valid " + date);
}
topics = new ArrayList<>();
topics.add("all");
topics.add(country);
topics.add(version);
topics.add(osVersion);
topics.add(deviceVersion);
topics.add(date);
topics.add(month);
allsubscribeTopic = new ArrayList<>();
System.out.println("EngineHandler.createTopics " + gcmPreference.getAllSubscribeTopic());
System.out.println("EngineHandler.createTopics topic ver " + version + " " + gcmPreference.getTopicAppVersion());
/*
* subscribe all topic first time and boolen getAllSubscribeTopic help to know
* that is all topic subscribe successfully or not.
*/
if (!gcmPreference.getAllSubscribeTopic()) {
for (int i = 0; i < topics.size(); i++) {
subscribeToTopic(topics.get(i));
}
} else if (!version.equalsIgnoreCase(gcmPreference.getTopicAppVersion())) {
/*
* here when app version updated, we unsubsribe last topic which we saved on setTopicAppVersion preference
* and send to server new topic
*/
System.out.println("EngineHandler.createTopics not equal");
unsubscribeTopic(gcmPreference.getTopicAppVersion(), version);
} else {
System.out.println("EngineHandler.createTopics hi meeenuuu ");
/*
* here when server response failed and all topics are already subscribed successfully.
*/
if (!gcmPreference.getregisterAllTopics()) {
doFCMTopicRequest(topics);
}
}
}
private void subscribeToTopic(final String topicName) {
try {
FirebaseMessaging.getInstance().subscribeToTopic(topicName).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
allsubscribeTopic.add(topicName);
if (topics.size() == allsubscribeTopic.size()) {
System.out.println("task successfull for all topics");
doFCMTopicRequest(allsubscribeTopic);
gcmPreference.setAllSubscribeTopic(true);
gcmPreference.setTopicAppVersion(version);
}
System.out.println("Subscribed to " + topicName + " topic");
} else {
System.out.println("Failed to subscribe to " + topicName + " topic");
}
}
});
} catch (Exception e) {
System.out.println("Subscribed to " + topicName + " topic failed " + e.getMessage());
}
}
private void unsubscribeTopic(final String topicName, final String currentVersion) {
FirebaseMessaging.getInstance().unsubscribeFromTopic(topicName).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
System.out.println("EngineHandler.createTopics unsubscribeTopic " + topicName);
}
});
FirebaseMessaging.getInstance().subscribeToTopic(currentVersion).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
System.out.println("EngineHandler.createTopics subscribeTopic " + currentVersion);
doFCMTopicRequest(topics);
}
});
}
private void doFCMTopicRequest(ArrayList<String> list) {
DataRequest mRequest = new DataRequest();
EngineApiController mApiController = new EngineApiController(mContext, new Response() {
@Override
public void onResponseObtained(Object response, int responseType, boolean isCachedData) {
System.out.println("response FCM topic " + response);
new DataHubHandler().parseFCMTopicData(response.toString(), new DataHubHandler.NotificationListener() {
@Override
public void pushFCMNotification(String json) {
if (json != null) {
showFCMTopicResponse(json);
}
}
});
}
@Override
public void onErrorObtained(String errormsg, int responseType) {
System.out.println("response FCM topic Failed receiver" + " " + errormsg);
gcmPreference.setregisterAllTopics(false);
}
}, EngineApiController.FCM_TOPIC_CODE);
mApiController.setAllTopics(list);
mApiController.getFCMTopicData(mRequest);
}
private void showFCMTopicResponse(String response) {
Gson gson = new Gson();
FCMTopicResponse fcmTopicResponse = gson.fromJson(response, FCMTopicResponse.class);
if (fcmTopicResponse.status.equalsIgnoreCase("0")) {
gcmPreference.setregisterAllTopics(true);
gcmPreference.setTopicAppVersion(version);
if (fcmTopicResponse.pushData != null) {
try {
if (fcmTopicResponse.pushData.reqvalue != null && fcmTopicResponse.pushData.reqvalue.contains("#")) {
String[] reqValueArr = fcmTopicResponse.pushData.reqvalue.split("#");
String reqvalue = reqValueArr[0];
String ifdelay = reqValueArr[1];
String delaytime = reqValueArr[2];
if (ifdelay != null && ifdelay.equalsIgnoreCase("yes")) {
gcmPreference.setOnBoardNotificationId(reqvalue);
setFCMAlarm(mContext, Integer.parseInt(delaytime));
} else {
Intent myIntent = new Intent(mContext, TopicAlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, myIntent, 0);
AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC, System.currentTimeMillis(), pendingIntent);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private void setFCMAlarm(Context context, int delayTime) {
int dtime = Utils.getRandomNo(delayTime);
gcmPreference.setFCMRandomOnboard(dtime);
System.out.println("response FCM topic setFCMAlarm " + dtime);
Intent myIntent = new Intent(context, TopicAlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 1, myIntent, 0);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(ALARM_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC, System.currentTimeMillis() + dtime, pendingIntent);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
alarmManager.setExact(AlarmManager.RTC, System.currentTimeMillis() + dtime, pendingIntent);
} else {
alarmManager.set(AlarmManager.RTC, System.currentTimeMillis() + dtime, pendingIntent);
}
}
}
| [
"bhanu2freeze@gmail.com"
] | bhanu2freeze@gmail.com |
45fd473580a5004d2487bfecc916b1cbddc99f99 | ec7ac775cdce7de724ba46683ab4e862865abeeb | /src/test/java/com/microfocus/adm/almoctane/migration/dbs/TestDBSMigration.java | 6ebf539276227f4e6e6d50bdfdbc991dd26c3eae | [
"Apache-2.0"
] | permissive | slbruce/dbs_test_migration | 8004479f2c1f801dbc95f6c4239b361086bd08c6 | 0f443fd9c1bd2998bd7152be6e1ef0c2ca801243 | refs/heads/master | 2020-04-07T08:43:32.979070 | 2018-11-19T13:51:41 | 2018-11-19T13:51:41 | 158,225,104 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,246 | java | /**
* Copyright 2018 EntIT Software LLC, a Micro Focus company
* 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.microfocus.adm.almoctane.migration.dbs;
import com.hpe.adm.nga.sdk.authentication.SimpleClientAuthentication;
import org.junit.Test;
import java.io.File;
public class TestDBSMigration {
@Test
public void testDBSMigration() throws Exception {
new DBSManualTestMigration(new SimpleClientAuthentication("clientid", "clientsecret", "HPE_REST_API_TECH_PREVIEW"),
"http://server",
1001,
2002, "sa@nga", "1001",
new File(this.getClass().getClassLoader().getResource("dbs-test-case.csv").toURI()))
.migrateDBS(0);
}
}
| [
"spencer.bruce@hpe.com"
] | spencer.bruce@hpe.com |
4a8ce6d61b376f4c4e1136cc56bc7dcdf6a0d309 | eac68de88285afd76912c3dcc2f72f4d05537de1 | /homeworkdate3/P158_12.java | c6a179edbae724f09ce7bfa0a9fdde207994874c | [] | no_license | navaratmai/Learn-Java-with-Expert-Programming-Tutor | f5516169b9140f27800bc7e959b0d763d8a35099 | a39fe17b0a8617d10c8f11d02be789b085d174af | refs/heads/master | 2020-12-30T11:59:39.777939 | 2017-05-16T16:41:16 | 2017-05-16T16:41:16 | 91,481,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 350 | java | package homeworkdate3;
public class P158_12
{
public static void main(String[] args)
{
int a = 0, b = 1, c = 2;
double x = 0, y = 1 , z = 2;
x = a-- + ++b + c++ + ++y / z++;
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(x);
System.out.println(y);
System.out.println(z);
}
}
| [
"navarat_33@hotmail.com"
] | navarat_33@hotmail.com |
8b0e08f0998b5e4fdf95123e55130b6d81a28b48 | d779205fe395ebc2507ba4f1670e12f5621ae3b3 | /SistemaEstacionamento codigos/src/Modelo/ModeloUsuario.java | 7b495ba1bf8a728076d81c979553ad897c5fcac7 | [
"Apache-2.0"
] | permissive | atonho/Sistema-Estacionamento | 680738f9dc6807038831f9292285660f38b9b51b | fb748aaf884361de2975062f236d1ef6cdc19d07 | refs/heads/master | 2020-05-20T17:41:00.575659 | 2019-05-09T01:59:19 | 2019-05-09T01:59:19 | 185,692,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,521 | 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 Modelo;
/**
*
* @author Adriano Zanette
*/
public class ModeloUsuario {
private int codigo;
private String nome;
private String usuario;
private String senha;
private String nivel;
private String codigoStatus;
private String descStatus;
public int getCodigo() {
return codigo;
}
public void setCodigo(int codigo) {
this.codigo = codigo;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public String getNivel() {
return nivel;
}
public void setNivel(String nivel) {
this.nivel = nivel;
}
public String getCodigoStatus() {
return codigoStatus;
}
public void setCodigoStatus(String codigoStatus) {
this.codigoStatus = codigoStatus;
}
public String getDescStatus() {
return descStatus;
}
public void setDescStatus(String descStatus) {
this.descStatus = descStatus;
}
}
| [
"atonho.vil@gmail.com"
] | atonho.vil@gmail.com |
70702c33fd381b134418841b2ac37cfd205aec99 | 37782e9e14c5a92021971daffc773912ef2156d1 | /src/main/java/com/example/youtube/controller/api/rest/EmployeeRestController.java | 1faa9785c97862fbd9fddea70479ec3d367299d0 | [] | no_license | herianp/gymOffice | 2cbb3422f4158807c6e2623b941861ff1539331d | a9fb2848a56fa35fe73fd2e7e63e339357fbf2fa | refs/heads/main | 2023-09-03T18:47:49.730605 | 2021-11-04T18:54:59 | 2021-11-04T18:54:59 | 424,523,076 | 0 | 0 | null | 2021-11-04T18:55:00 | 2021-11-04T08:33:24 | Java | UTF-8 | Java | false | false | 891 | java | package com.example.youtube.controller.api.rest;
import com.example.youtube.models.EmployeeAndMessageDTO;
import com.example.youtube.models.EmployeeDto;
import com.example.youtube.models.MessageDto;
import com.example.youtube.service.EmployeeService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/employee")
public class EmployeeRestController {
private final EmployeeService employeeService;
public EmployeeRestController(EmployeeService employeeService) {
this.employeeService = employeeService;
}
@GetMapping
public List<EmployeeDto> getAllEmployee(){
return employeeService.findAllEmployee();
}
@PostMapping
public EmployeeDto saveEmployee(@RequestBody EmployeeAndMessageDTO employeeAndMessageDTO){
return employeeService.save(employeeAndMessageDTO);
}
}
| [
"peta.herian@gmail.com"
] | peta.herian@gmail.com |
0b1a838c9e0b4035e09c219fb07fd76edceff58f | ad6e17520272679e3e14446c5422c9ce4be6d1e7 | /homework6/Place.java | 3bec23d9ec3493450de0f77f2471f28da6b4787e | [] | no_license | elizabethmchan2/cs206 | c27305b4972c41f26b9805f0b94469af7cd49a4f | 90d46628851483abd8931a15496e6552ad87639a | refs/heads/master | 2020-04-06T04:42:31.287339 | 2017-03-17T03:02:43 | 2017-03-17T03:02:43 | 82,879,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,740 | java | import java.util.ArrayList;
public class Place implements Comparable<Place>{
//Attributes
private ArrayList<String> Azip = new ArrayList<String>();
private String town;
private String state;
private int totalPopulation;
private int females;
private int males;
//constructors
public Place(String _zip, String _town, String _state, int _total, int _males, int _females) {
this.Azip.add(_zip);
this.town = _town;
this.state = _state;
this.totalPopulation = _total;
this.females = _females;
this.males = _males;
} //place
//accessors
// public String getZip() {
// return this.zip;
// } //getZip()
public ArrayList<String> getZip() {
return this.Azip;
}
//public method to update arraylist!
public void update(String z, int total, int f, int m) {
Azip.add(z);
this.totalPopulation +=total;
this.females +=f;
this.males +=m;
}
public String getTown() {
return this.town;
}//getTown()
public String getState() {
return this.state;
}//getState()
public int getTotal() {
return this.totalPopulation;
}//getState()
public int getFemales() {
return this.females;
}//getState()
public int getMales() {
return this.males;
}//getState()
public boolean equals (String userInput) {
userInput.toLowerCase().equals(this.town.toLowerCase() + ", " + this.state.toLowerCase());
return (town + ", " + state).toLowerCase().equals(userInput);
}
public int compareTo(Place p) {
return (this.getTown() + this.getState()).compareTo(p.getTown() + p.getState());
}
//print Method
public String toString() {
return this.Azip+ " (Total Population: " + this.totalPopulation+ " Female: " + this.females + " Male: " + this.males+ ")";
} //toString()
}
| [
"noreply@github.com"
] | elizabethmchan2.noreply@github.com |
c641b4afe78f32de275f62d74cabfc55467ba006 | 65a48d91770e34a9a547643172e3fbd1b96db539 | /src/main/java/com/java/action/chap12/DateTimeExamples.java | b2dbc51d4d7dcbf99ae76a6189183bb7846a4f51 | [] | no_license | guolinxin/action | 16912d5bff412b358f905cb116b2e8fc1b7095c0 | a7423a81e36f820f37203692c16de6ce22b2848e | refs/heads/master | 2021-01-02T09:03:00.312688 | 2017-08-02T14:54:57 | 2017-08-02T14:54:57 | 99,126,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,581 | java | package com.java.action.chap12;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.chrono.JapaneseDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAdjuster;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import static java.time.temporal.TemporalAdjusters.lastDayOfMonth;
import static java.time.temporal.TemporalAdjusters.nextOrSame;
public class DateTimeExamples {
private static final ThreadLocal<DateFormat> formatters = new ThreadLocal<DateFormat>() {
protected DateFormat initialValue() {
return new SimpleDateFormat("dd-MMM-yyyy");
}
};
public static void main(String[] args) {
useOldDate();
useLocalDate();
useTemporalAdjuster();
useDateFormatter();
}
private static void useOldDate() {
Date date = new Date(114, 2, 18);
System.out.println(date);
System.out.println(formatters.get().format(date));
Calendar calendar = Calendar.getInstance();
calendar.set(2014, Calendar.FEBRUARY, 18);
System.out.println(calendar);
}
private static void useLocalDate() {
LocalDate date = LocalDate.of(2014, 3, 18);
int year = date.getYear(); // 2014
Month month = date.getMonth(); // MARCH
int day = date.getDayOfMonth(); // 18
DayOfWeek dow = date.getDayOfWeek(); // TUESDAY
int len = date.lengthOfMonth(); // 31 (days in March)
boolean leap = date.isLeapYear(); // false (not a leap year)
System.out.println(date);
int y = date.get(ChronoField.YEAR);
int m = date.get(ChronoField.MONTH_OF_YEAR);
int d = date.get(ChronoField.DAY_OF_MONTH);
LocalTime time = LocalTime.of(13, 45, 20); // 13:45:20
int hour = time.getHour(); // 13
int minute = time.getMinute(); // 45
int second = time.getSecond(); // 20
System.out.println(time);
LocalDateTime dt1 = LocalDateTime.of(2014, Month.MARCH, 18, 13, 45, 20); // 2014-03-18T13:45
LocalDateTime dt2 = LocalDateTime.of(date, time);
LocalDateTime dt3 = date.atTime(13, 45, 20);
LocalDateTime dt4 = date.atTime(time);
LocalDateTime dt5 = time.atDate(date);
System.out.println(dt1);
LocalDate date1 = dt1.toLocalDate();
System.out.println(date1);
LocalTime time1 = dt1.toLocalTime();
System.out.println(time1);
Instant instant = Instant.ofEpochSecond(44 * 365 * 86400);
Instant now = Instant.now();
Duration d1 = Duration.between(LocalTime.of(13, 45, 10), time);
Duration d2 = Duration.between(instant, now);
System.out.println(d1.getSeconds());
System.out.println(d2.getSeconds());
Duration threeMinutes = Duration.of(3, ChronoUnit.MINUTES);
System.out.println(threeMinutes);
JapaneseDate japaneseDate = JapaneseDate.from(date);
System.out.println(japaneseDate);
}
private static void useTemporalAdjuster() {
LocalDate date = LocalDate.of(2014, 3, 18);
date = date.with(nextOrSame(DayOfWeek.SUNDAY));
System.out.println(date);
date = date.with(lastDayOfMonth());
System.out.println(date);
date = date.with(new NextWorkingDay());
System.out.println(date);
date = date.with(nextOrSame(DayOfWeek.FRIDAY));
System.out.println(date);
date = date.with(new NextWorkingDay());
System.out.println(date);
date = date.with(nextOrSame(DayOfWeek.FRIDAY));
System.out.println(date);
date = date.with(temporal -> {
DayOfWeek dow = DayOfWeek.of(temporal.get(ChronoField.DAY_OF_WEEK));
int dayToAdd = 1;
if (dow == DayOfWeek.FRIDAY) dayToAdd = 3;
if (dow == DayOfWeek.SATURDAY) dayToAdd = 2;
return temporal.plus(dayToAdd, ChronoUnit.DAYS);
});
System.out.println(date);
}
private static class NextWorkingDay implements TemporalAdjuster {
@Override
public Temporal adjustInto(Temporal temporal) {
DayOfWeek dow = DayOfWeek.of(temporal.get(ChronoField.DAY_OF_WEEK));
int dayToAdd = 1;
if (dow == DayOfWeek.FRIDAY) dayToAdd = 3;
if (dow == DayOfWeek.SATURDAY) dayToAdd = 2;
return temporal.plus(dayToAdd, ChronoUnit.DAYS);
}
}
private static void useDateFormatter() {
LocalDate date = LocalDate.of(2014, 3, 18);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
DateTimeFormatter italianFormatter = DateTimeFormatter.ofPattern("d. MMMM yyyy", Locale.ITALIAN);
System.out.println(date.format(DateTimeFormatter.ISO_LOCAL_DATE));
System.out.println(date.format(formatter));
System.out.println(date.format(italianFormatter));
DateTimeFormatter complexFormatter = new DateTimeFormatterBuilder()
.appendText(ChronoField.DAY_OF_MONTH)
.appendLiteral(". ")
.appendText(ChronoField.MONTH_OF_YEAR)
.appendLiteral(" ")
.appendText(ChronoField.YEAR)
.parseCaseInsensitive()
.toFormatter(Locale.ITALIAN);
System.out.println(date.format(complexFormatter));
}
}
| [
"linxing@tdbfusion.com"
] | linxing@tdbfusion.com |
e9a8b06570d6cf7a6668b8786b7edaed565d3ed3 | 80403ec5838e300c53fcb96aeb84d409bdce1c0c | /server/modules/ms2/src/org/labkey/ms2/Spectrum.java | e4161f739fdb067c94955e1c7b51b83fb5189357 | [] | no_license | scchess/LabKey | 7e073656ea494026b0020ad7f9d9179f03d87b41 | ce5f7a903c78c0d480002f738bccdbef97d6aeb9 | refs/heads/master | 2021-09-17T10:49:48.147439 | 2018-03-22T13:01:41 | 2018-03-22T13:01:41 | 126,447,224 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | /*
* Copyright (c) 2006-2016 LabKey Corporation
*
* 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.labkey.ms2;
/**
* User: adam
* Date: May 10, 2006
* Time: 11:09:10 AM
*/
public interface Spectrum
{
float[] getX();
float[] getY();
int getCharge();
int getFraction();
int getRun();
double getPrecursorMass();
double getMZ();
double getScore(int index);
Double getRetentionTime();
String getSequence();
String getTrimmedSequence();
String getNextAA();
String getPrevAA();
}
| [
"klum@labkey.com"
] | klum@labkey.com |
d1fee07ee3ab7bb1fd0268767246f725c613300d | 5fd6f74ac0cb1944c281f76d504e329a82613bbd | /src/main/java/br/com/casadocodigo/loja/controllers/PagamentoController.java | 7f35ea3cd6dbfa1c26cef1f893c185523be8d5bc | [
"MIT"
] | permissive | palerique/google-cloud-spring | 8737764b625fc32cbb4d28a8db1ef6aab9f7b6ba | 923868e09cc82545dc60a7ec04c59601e0159320 | refs/heads/master | 2020-03-22T09:33:59.694243 | 2018-07-05T13:03:08 | 2018-07-05T13:03:08 | 139,845,651 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,375 | java | package br.com.casadocodigo.loja.controllers;
import br.com.casadocodigo.loja.models.CarrinhoCompras;
import br.com.casadocodigo.loja.models.DadosPagamento;
import br.com.casadocodigo.loja.models.Usuario;
import java.util.concurrent.Callable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.security.web.bind.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
@RequestMapping("/pagamento")
@Controller
public class PagamentoController {
@Autowired
private CarrinhoCompras carrinho;
@Autowired
private RestTemplate restTemplate;
@Autowired
private MailSender sender;
@RequestMapping(value = "/finalizar", method = RequestMethod.POST)
public Callable<ModelAndView> finalizar(@AuthenticationPrincipal Usuario usuario,
RedirectAttributes model) {
return () -> {
String uri = "http://book-payment.herokuapp.com/payment";
try {
String response = restTemplate
.postForObject(uri, new DadosPagamento(carrinho.getTotal()), String.class);
System.out.println(response);
enviaEmailCompraProduto(usuario);
model.addFlashAttribute("sucesso", response);
return new ModelAndView("redirect:/produtos");
} catch (HttpClientErrorException e) {
e.printStackTrace();
model.addFlashAttribute("falha", "Valor maior que o permitido");
return new ModelAndView("redirect:/produtos");
}
};
}
private void enviaEmailCompraProduto(Usuario usuario) {
SimpleMailMessage email = new SimpleMailMessage();
email.setSubject("Compra finalizada com sucesso");
//email.setTo(usuario.getEmail());
email.setTo("compras@casadocodigo.com.br");
email.setText("Compra aprovada com sucesso no valor de " + carrinho.getTotal());
email.setFrom("compras@casadocodigo.com.br");
sender.send(email);
}
}
| [
"palerique@gmail.com"
] | palerique@gmail.com |
939ae735530699f420795677a0a7182914755518 | 907b6303de4272de89bfd3c408334c377b54e1cc | /scheduler/src/test/java/org/apache/mesos/elasticsearch/scheduler/matcher/TaskInfoMatcher.java | 62315356656481e1c11c1146652e05029516fe9c | [
"Apache-2.0"
] | permissive | globalic/elasticsearch | fc0aea7cbc0ae9114b47e6d15f36c84dcd329a4a | 96a1ba4e0ee406ac32a267d49ab537cb49636924 | refs/heads/master | 2021-05-25T23:06:49.187953 | 2015-05-28T18:20:44 | 2015-05-28T18:20:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,454 | java | package org.apache.mesos.elasticsearch.scheduler.matcher;
import org.apache.mesos.Protos;
import org.apache.mesos.elasticsearch.common.Configuration;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import java.util.ArrayList;
import java.util.List;
/**
* Matcher for {@link org.apache.mesos.Protos.TaskInfo}s
*/
public class TaskInfoMatcher extends BaseMatcher<Protos.TaskInfo> {
private String id;
private Protos.SlaveID slaveId;
private Double cpus;
private Double mem;
private Double disk;
public TaskInfoMatcher(String id) {
this.id = id;
}
@Override
public boolean matches(Object o) {
Protos.TaskInfo taskInfo = (Protos.TaskInfo) o;
List<Protos.Resource> resources = new ArrayList<>();
if (cpus != null) {
resources.add(newResource("cpus", cpus));
}
if (mem != null) {
resources.add(newResource("mem", mem));
}
if (disk != null) {
resources.add(newResource("disk", disk));
}
return taskInfo.getResourcesList().containsAll(resources) &&
taskInfo.getSlaveId().equals(slaveId) &&
taskInfo.getTaskId().getValue().equals(id) &&
taskInfo.getName().equals(Configuration.TASK_NAME);
}
private Protos.Resource newResource(String name, Double value) {
return Protos.Resource.newBuilder()
.setName(name)
.setType(Protos.Value.Type.SCALAR)
.setScalar(Protos.Value.Scalar.newBuilder().setValue(value).build())
.build();
}
@Override
public void describeTo(Description description) {
if (cpus != null) {
description.appendText("(cpu:" + cpus + ")");
}
if (mem != null) {
description.appendText("(mem: " + mem + ")");
}
if (disk != null) {
description.appendText("(disk: " + disk + ")");
}
}
public TaskInfoMatcher slaveId(String slaveId) {
this.slaveId = Protos.SlaveID.newBuilder().setValue(slaveId).build();
return this;
}
public TaskInfoMatcher cpus(double cpus) {
this.cpus = cpus;
return this;
}
public TaskInfoMatcher mem(double mem) {
this.mem = mem;
return this;
}
public TaskInfoMatcher disk(double disk) {
this.disk = disk;
return this;
}
}
| [
"frank@frankscholten.nl"
] | frank@frankscholten.nl |
27b7c2a61efe5e707421cc932165aac9cee1370a | f1894feaf5c1576d4319c3d4351dc9c85aaf1fab | /demo-interface-service/src/test/java/demo/interfaces/service/AppTest.java | 7fbb74801f6001a91148c9d08958b636d61a05fa | [] | no_license | paras27/benz-assignment | 7d3dc3a45dca59df6584cc950aed4c4277e3705e | cf995c6c542c8c5c32172132e438228fa6e877d3 | refs/heads/main | 2023-07-19T22:23:42.607516 | 2021-09-06T20:41:34 | 2021-09-06T20:41:34 | 403,741,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 651 | java | package demo.interfaces.service;
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 );
}
}
| [
"36442105+paras27@users.noreply.github.com"
] | 36442105+paras27@users.noreply.github.com |
3628acd069f08af41248315d3567af10d5d2724d | 6aebe29d7369a8b17568282b081cbf9ab8ced740 | /src/leetcode/easy/Q231.java | e895a6b49deaba76f927edf941dd37837f0a2659 | [] | no_license | chenchen2018/leetcodeJava | 335a8dd6d23f67abf3d2199b129937f5712e2c52 | d2c7e85c369185db132e1f2fb2d030460bc79d69 | refs/heads/master | 2021-05-05T20:45:26.252289 | 2018-04-07T16:21:03 | 2018-04-07T16:21:03 | 115,458,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | package leetcode.easy;
public class Q231 {
}
class Q231Solution {
public boolean isPowerOfTwo(int n) {
if (n < 1) {
return false;
}
if (n == 1) {
return true;
}
if (n % 2 != 0) {
return false;
}
return isPowerOfTwo(n / 2);
}
public boolean isPowerOfTwo2(int n) {
if (n < 1) {
return false;
}
for (int i = 0; i < 32; i++) {
if ((n & 1) == 1) {
return (n >> 1) == 0;
}
n >>= 1;
}
return false;
}
} | [
"Chen.Chen@tradingscreen.com"
] | Chen.Chen@tradingscreen.com |
31451dbdca22e4ebb26014d067f9e16d88446a5c | 503c3dc0250095401ddd6f2b36c0333fd612fb81 | /MobilePhone/src/TwoGPhone.java | 7330f028aae84223593329f50be98029b0996908 | [] | no_license | ImaginaryBIT/CE2002_OOP | 0b226e35f5746b18e692264b595da0d037d3f9d9 | caddf2904babe8490218089e6895548fe02fb6b4 | refs/heads/master | 2021-04-26T08:50:40.530432 | 2017-11-09T12:52:51 | 2017-11-09T12:52:51 | 106,941,582 | 0 | 0 | null | 2020-01-27T12:59:02 | 2017-10-14T16:01:54 | Java | UTF-8 | Java | false | false | 676 | java |
public class TwoGPhone extends MobilePhone{
private int screenSize;
private static int numPhone;
public TwoGPhone()
{
super();
screenSize = 0;
}
public TwoGPhone(String color, int seriesNum, int screenSize)
{
super(color,seriesNum);
this.screenSize = screenSize;
}
public void Ring()
{
System.out.println("The phone " + super.getPhoneSeries() + " is ringing!");
}
public void print()
{
System.out.println("The phone " + super.getPhoneSeries() + " color is " + super.getPhoneColor() + ".");
}
public void messager()
{
System.out.println("hello motor");
}
//public static void setNumPhone(int num)
//{
// numPhone = num;
//}
}
| [
"32798440+ImaginaryBIT@users.noreply.github.com"
] | 32798440+ImaginaryBIT@users.noreply.github.com |
f26155b44fd00cee6c3f607bea368c17ff2dcad5 | ecaaaa1ef3a878db57490a7b3426a4bc091a3abb | /v1_8_R2/src/main/java/be/isach/ultracosmetics/v1_8_R2/customentities/FlyingSquid.java | b26e34b1a27a7a0d9d249c16b4def5370d6da46f | [] | no_license | DevotedMC/UltraCosmetics | e896c096f9396c029190d495d150c16d9e82405f | ebd7ef68d66dfe7fe142ad120b99b315df40dfcf | refs/heads/master | 2021-01-23T05:46:05.386613 | 2017-06-02T21:09:45 | 2017-06-02T21:09:45 | 92,989,101 | 0 | 0 | null | 2017-05-31T21:11:15 | 2017-05-31T21:11:15 | null | UTF-8 | Java | false | false | 7,049 | java | package be.isach.ultracosmetics.v1_8_R2.customentities;
import be.isach.ultracosmetics.cosmetics.mounts.IMountCustomEntity;
import net.minecraft.server.v1_8_R2.*;
import org.bukkit.craftbukkit.v1_8_R2.util.UnsafeList;
import org.bukkit.entity.Entity;
import java.lang.reflect.Field;
/**
* @author RadBuilder
*/
public class FlyingSquid extends EntitySquid implements IMountCustomEntity {
public FlyingSquid(World world) {
super(world);
}
private void removeSelectors() {
try {
Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
bField.setAccessible(true);
Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
cField.setAccessible(true);
bField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
bField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
cField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
cField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
} catch (Exception exc) {
exc.printStackTrace();
}
}
@Override
public void removeAi() {
removeSelectors();
}
@Override
public void g(float sideMot, float forMot) {
if (!CustomEntities.customEntities.contains(this)) {
super.g(sideMot, forMot);
return;
}
if (this.passenger != null && this.passenger instanceof EntityHuman
&& CustomEntities.customEntities.contains(this)) {
this.lastYaw = this.yaw = this.passenger.yaw;
this.pitch = this.passenger.pitch * 0.5F;
this.setYawPitch(this.yaw, this.pitch);//Update the pitch and yaw
this.aI = this.aG = this.yaw;
sideMot = ((EntityLiving) this.passenger).aZ * 0.5F;
forMot = ((EntityLiving) this.passenger).ba;
Field jump = null; //Jumping
try {
jump = EntityLiving.class.getDeclaredField("aY");
} catch (NoSuchFieldException | SecurityException e1) {
e1.printStackTrace();
}
jump.setAccessible(true);
try {
if (jump.getBoolean(this.passenger)) {
this.motY = 0.5D; // Used all the time in NMS for entity jumping
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
this.S = 1.0F; // The custom entity will now automatically climb up 1 high blocks
this.aK = this.yaw;
if (!this.world.isClientSide) {
this.k(0.35f*2);
if (bM()) {
if (V()) {
double d0 = locY;
float f3 = 0.8F;
float f4 = 0.02F;
float f2 = EnchantmentManager.b(this);
if (f2 > 3.0F) {
f2 = 3.0F;
}
if (f2 > 0.0F) {
f3 += (0.5460001F - f3) * f2 / 3.0F;
f4 += (bI() * 1.0F - f4) * f2 / 3.0F;
}
a(sideMot, forMot, f4);
move(motX, motY, motZ);
motX *= f3;
motY *= 0.800000011920929D;
motZ *= f3;
motY -= 0.02D;
if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ)))
motY = 0.300000011920929D;
} else if (ab()) {
double d0 = locY;
a(sideMot, forMot, 0.02F);
move(motX, motY, motZ);
motX *= 0.5D;
motY *= 0.5D;
motZ *= 0.5D;
motY -= 0.02D;
if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ)))
motY = 0.300000011920929D;
} else {
float f5 = world.getType(new BlockPosition(MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))).getBlock().frictionFactor * 0.91F;
float f6 = 0.1627714F / (f5 * f5 * f5);
float f3 = bI() * f6;
a(sideMot, forMot, f3);
f5 = world.getType(new BlockPosition(MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))).getBlock().frictionFactor * 0.91F;
if (k_()) {
float f4 = 0.15F;
motX = MathHelper.a(motX, -f4, f4);
motZ = MathHelper.a(motZ, -f4, f4);
fallDistance = 0.0F;
if (motY < -0.15D) {
motY = -0.15D;
}
if (motY < 0.0D) {
motY = 0.0D;
}
}
move(motX, motY, motZ);
if ((positionChanged) && (k_())) {
motY = 0.2D;
}
if ((world.isClientSide) && ((!world.isLoaded(new BlockPosition((int) locX, 0, (int) locZ))) || (!world.getChunkAtWorldCoords(new BlockPosition((int) locX, 0, (int) locZ)).o()))) {
if (locY > 0.0D)
motY = -0.1D;
else
motY = 0.0D;
} else {
motY += 0D;
}
motY *= 0.9800000190734863D;
motX *= f5;
motZ *= f5;
}
}
ay = az;
double d0 = locX - lastX;
double d1 = locZ - lastZ;
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
if (f2 > 1.0F) {
f2 = 1.0F;
}
az += (f2 - az) * 0.4F;
aA += az;
super.g(sideMot, forMot);
}
this.ay = this.az; //Some extra things
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
if (f4 > 1.0F) {
f4 = 1.0F;
}
this.az += (f4 - this.az) * 0.4F;
this.aA += this.az;
} else {
this.S = 0.5F;
this.aK = 0.02F;
super.g(sideMot, forMot);
}
}
@Override
public Entity getEntity() {
return getBukkitEntity();
}
}
| [
"RadBuilder@users.noreply.github.com"
] | RadBuilder@users.noreply.github.com |
d3abf33c2b10976d83d68ff6e504b53583d0ec42 | 4e5595d44699e4974f209d91844798d3769a3b1b | /src/main/java/lv/lumii/obis/schema/services/reader/OWLObjectTypePropertyProcessor.java | c62812ea54679514a4671197c80ebe74f6eb8deb | [
"Apache-2.0"
] | permissive | LUMII-Syslab/OBIS-SchemaExtractor | f911914960450cbe070d3776f18f14dba4c469fe | 6bdfa34859722a3dabd8747c2da0b2b2e20027dc | refs/heads/master | 2023-09-01T03:38:30.389904 | 2023-08-24T20:07:25 | 2023-08-24T20:07:25 | 137,050,057 | 3 | 1 | Apache-2.0 | 2022-05-20T21:13:33 | 2018-06-12T09:38:08 | Java | UTF-8 | Java | false | false | 4,085 | java | package lv.lumii.obis.schema.services.reader;
import lv.lumii.obis.schema.model.v1.ClassPair;
import lv.lumii.obis.schema.model.v1.Schema;
import lv.lumii.obis.schema.model.v1.SchemaClass;
import lv.lumii.obis.schema.model.v1.SchemaRole;
import lv.lumii.obis.schema.services.reader.dto.OWLOntologyReaderRequest;
import lv.lumii.obis.schema.services.reader.dto.OWLOntologyReaderProcessingData;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.search.EntitySearcher;
import org.springframework.stereotype.Service;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class OWLObjectTypePropertyProcessor extends OWLPropertyProcessor {
@Override
public void process(@Nonnull OWLOntology inputOntology, @Nonnull Schema resultSchema, @Nonnull OWLOntologyReaderProcessingData processingData,
@Nonnull OWLOntologyReaderRequest readerRequest) {
List<OWLObjectPropertyDomainAxiom> domains = inputOntology.axioms(AxiomType.OBJECT_PROPERTY_DOMAIN).collect(Collectors.toList());
List<OWLObjectPropertyRangeAxiom> ranges = inputOntology.axioms(AxiomType.OBJECT_PROPERTY_RANGE).collect(Collectors.toList());
List<OWLObjectProperty> objectProperties = inputOntology.objectPropertiesInSignature()
.filter(p -> p != null && !isExcludedResource(p.getIRI(), readerRequest.getExcludedNamespaces()))
.collect(Collectors.toList());
for (OWLObjectProperty property : objectProperties) {
String propertyName = property.getIRI().toString();
SchemaRole objectProperty = new SchemaRole();
setSchemaElementNameAndNamespace(property.getIRI(), objectProperty);
ClassPair classPair = new ClassPair();
setDomain(propertyName, domains, processingData.getClassesMap(), classPair);
setRange(propertyName, ranges, processingData.getClassesMap(), classPair);
setCardinalities(objectProperty, propertyName, processingData.getCardinalityMap());
setAnnotations(EntitySearcher.getAnnotations(property, inputOntology), objectProperty);
objectProperty.getClassPairs().add(classPair);
resultSchema.getAssociations().add(objectProperty);
}
}
private void setDomain(@Nonnull String propertyName, @Nonnull List<OWLObjectPropertyDomainAxiom> domains,
@Nonnull Map<String, SchemaClass> classesMap, ClassPair classPair) {
OWLObjectPropertyDomainAxiom domainAxiom = domains.stream().filter(d -> propertyName.equals(
d.getProperty().asOWLObjectProperty().getIRI().toString())).findFirst().orElse(null);
if (isValidDomainClass(domainAxiom)) {
String domainUri = domainAxiom.getDomain().asOWLClass().getIRI().toString();
if (classesMap.containsKey(domainUri)) {
classPair.setSourceClass(domainUri);
}
}
}
private void setRange(@Nonnull String propertyName, @Nonnull List<OWLObjectPropertyRangeAxiom> ranges,
@Nonnull Map<String, SchemaClass> classesMap, ClassPair classPair) {
OWLObjectPropertyRangeAxiom rangeAxiom = ranges.stream().filter(d -> propertyName.equals(
d.getProperty().asOWLObjectProperty().getIRI().toString())).findFirst().orElse(null);
if (isValidRangeClass(rangeAxiom)) {
String rangeUri = rangeAxiom.getRange().asOWLClass().getIRI().toString();
if (classesMap.containsKey(rangeUri)) {
classPair.setTargetClass(rangeUri);
}
}
}
private boolean isValidDomainClass(@Nullable OWLPropertyDomainAxiom<?> axiom) {
return axiom != null && axiom.getDomain() != null && axiom.getDomain().isOWLClass();
}
private boolean isValidRangeClass(@Nullable OWLObjectPropertyRangeAxiom axiom) {
return axiom != null && axiom.getRange() != null && axiom.getRange().isOWLClass();
}
}
| [
"aiga.romane@inbox.lv"
] | aiga.romane@inbox.lv |
3ea04a67439d9c83f4aa4ca0a4884333440a1463 | b2a46dbd3d6fb6d5516a2a1ccdc21d264621159c | /backend/build/tmp/appengineEndpointsExpandClientLibs/myApi-v1-java.zip-unzipped/myApi/src/main/java/com/warrier/joketeller/backend/myApi/MyApi.java | bd294f81315be950e506662fab44ba8a3c9d1229 | [
"Apache-2.0"
] | permissive | MohanRW/JokeTeller | 7fa113f0f2345daf5512fa4d4875bffc519f151e | 40ac58602e3a80536aca36d0e9b1a8a0108c4a60 | refs/heads/master | 2021-05-10T13:23:54.834084 | 2018-01-22T15:15:46 | 2018-01-22T15:15:46 | 118,474,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,939 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/google/apis-client-generator/
* (build: 2017-11-07 19:12:12 UTC)
* on 2018-01-22 at 12:25:21 UTC
* Modify at your own risk.
*/
package com.warrier.joketeller.backend.myApi;
/**
* Service definition for MyApi (v1).
*
* <p>
* This is an API
* </p>
*
* <p>
* For more information about this service, see the
* <a href="" target="_blank">API Documentation</a>
* </p>
*
* <p>
* This service uses {@link MyApiRequestInitializer} to initialize global parameters via its
* {@link Builder}.
* </p>
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class MyApi extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {
// Note: Leave this static initializer at the top of the file.
static {
com.google.api.client.util.Preconditions.checkState(
com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 15,
"You are currently running with version %s of google-api-client. " +
"You need at least version 1.15 of google-api-client to run version " +
"1.23.0 of the myApi library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
}
/**
* The default encoded root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_ROOT_URL = "https://myApplicationId.appspot.com/_ah/api/";
/**
* The default encoded service path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_SERVICE_PATH = "myApi/v1/";
/**
* The default encoded batch path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.23
*/
public static final String DEFAULT_BATCH_PATH = "batch";
/**
* The default encoded base URL of the service. This is determined when the library is generated
* and normally should not be changed.
*/
public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;
/**
* Constructor.
*
* <p>
* Use {@link Builder} if you need to specify any of the optional parameters.
* </p>
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public MyApi(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
this(new Builder(transport, jsonFactory, httpRequestInitializer));
}
/**
* @param builder builder
*/
MyApi(Builder builder) {
super(builder);
}
@Override
protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?> httpClientRequest) throws java.io.IOException {
super.initialize(httpClientRequest);
}
/**
* Create a request for the method "getJoke".
*
* This request holds the parameters needed by the myApi server. After setting any optional
* parameters, call the {@link GetJoke#execute()} method to invoke the remote operation.
*
* @return the request
*/
public GetJoke getJoke() throws java.io.IOException {
GetJoke result = new GetJoke();
initialize(result);
return result;
}
public class GetJoke extends MyApiRequest<com.warrier.joketeller.backend.myApi.model.MyBean> {
private static final String REST_PATH = "mybean";
/**
* Create a request for the method "getJoke".
*
* This request holds the parameters needed by the the myApi server. After setting any optional
* parameters, call the {@link GetJoke#execute()} method to invoke the remote operation. <p>
* {@link
* GetJoke#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @since 1.13
*/
protected GetJoke() {
super(MyApi.this, "GET", REST_PATH, null, com.warrier.joketeller.backend.myApi.model.MyBean.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public GetJoke setAlt(java.lang.String alt) {
return (GetJoke) super.setAlt(alt);
}
@Override
public GetJoke setFields(java.lang.String fields) {
return (GetJoke) super.setFields(fields);
}
@Override
public GetJoke setKey(java.lang.String key) {
return (GetJoke) super.setKey(key);
}
@Override
public GetJoke setOauthToken(java.lang.String oauthToken) {
return (GetJoke) super.setOauthToken(oauthToken);
}
@Override
public GetJoke setPrettyPrint(java.lang.Boolean prettyPrint) {
return (GetJoke) super.setPrettyPrint(prettyPrint);
}
@Override
public GetJoke setQuotaUser(java.lang.String quotaUser) {
return (GetJoke) super.setQuotaUser(quotaUser);
}
@Override
public GetJoke setUserIp(java.lang.String userIp) {
return (GetJoke) super.setUserIp(userIp);
}
@Override
public GetJoke set(String parameterName, Object value) {
return (GetJoke) super.set(parameterName, value);
}
}
/**
* Builder for {@link MyApi}.
*
* <p>
* Implementation is not thread-safe.
* </p>
*
* @since 1.3.0
*/
public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {
/**
* Returns an instance of a new builder.
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
super(
transport,
jsonFactory,
DEFAULT_ROOT_URL,
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
setBatchPath(DEFAULT_BATCH_PATH);
}
/** Builds a new instance of {@link MyApi}. */
@Override
public MyApi build() {
return new MyApi(this);
}
@Override
public Builder setRootUrl(String rootUrl) {
return (Builder) super.setRootUrl(rootUrl);
}
@Override
public Builder setServicePath(String servicePath) {
return (Builder) super.setServicePath(servicePath);
}
@Override
public Builder setBatchPath(String batchPath) {
return (Builder) super.setBatchPath(batchPath);
}
@Override
public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
}
@Override
public Builder setApplicationName(String applicationName) {
return (Builder) super.setApplicationName(applicationName);
}
@Override
public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
}
@Override
public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
}
@Override
public Builder setSuppressAllChecks(boolean suppressAllChecks) {
return (Builder) super.setSuppressAllChecks(suppressAllChecks);
}
/**
* Set the {@link MyApiRequestInitializer}.
*
* @since 1.12
*/
public Builder setMyApiRequestInitializer(
MyApiRequestInitializer myapiRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(myapiRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}
| [
"mohanrwarrier@gmail.com"
] | mohanrwarrier@gmail.com |
8d8fdcd41ec88d619518d518876e0677abf4e06b | 81401f8454d8026ad2ab539ec8868456fc789a14 | /src/main/java/app/blog/config/AppConfiguration.java | 8b9189dce70407c2a931c975877cd61f10aa0eca | [] | no_license | cgc0220h1/demo-HibernateJPA-SimpleBlog | 9e2c344f28f9232bd9a81d4d6e8bc3cc87208a8a | 654f6d0583ad3858d020bc93a9293af03428fdb5 | refs/heads/master | 2022-11-10T13:27:15.243499 | 2020-06-18T09:05:22 | 2020-06-18T09:05:22 | 269,404,057 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,696 | java | package app.blog.config;
import app.blog.formatter.*;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import app.blog.services.post.PostServiceImp;
import app.blog.services.category.CategoryServiceImp;
@Configuration
public class AppConfiguration implements ApplicationContextAware, WebMvcConfigurer {
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addFormatter(new TimeStampArrayFormatter());
registry.addFormatter(new MonthFormatter());
registry.addFormatter(new CategoryFormatter(applicationContext.getBean(CategoryServiceImp.class)));
registry.addFormatter(new PostFormatter(applicationContext.getBean(PostServiceImp.class)));
registry.addFormatter(new TimeStampFormatter());
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor();
interceptor.setParamName("lang");
registry.addInterceptor(interceptor);
}
}
| [
"vanduc2514@gmail.com"
] | vanduc2514@gmail.com |
b23a9dcde3893861dd12c4a1b6224e0df2887c8d | 507726bb8a7d373a8f2d22755c448e01e418d54f | /springclouddemo/cloud-consumer-order80/src/main/java/me/lukegs7/springcloud/lb/LoadBalancer.java | 2f560b215bb3449325f5229f16168764ef44fe14 | [] | no_license | lukegs7/java_project | 3de32028352fd3522acef30bb45fc426e093ad20 | c5595d6d3c1c743360bd564d660653847b3ee6d5 | refs/heads/master | 2023-03-01T15:07:05.259021 | 2021-02-02T13:33:03 | 2021-02-02T13:33:03 | 298,026,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package me.lukegs7.springcloud.lb;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.stereotype.Component;
import java.util.List;
public interface LoadBalancer {
ServiceInstance instance(List<ServiceInstance> serviceInstanceList);
}
| [
"geshuai1992@163.com"
] | geshuai1992@163.com |
8cc372b91b54748a783d8c51fd554a79769bb70f | 4cafc32047dc2af5d362879f02b0c5feeff7bbd4 | /prueba-tcs-ingreso/src/main/java/com/tcs/pruebatcsingreso/dao/repository/IEmpleadoFuncionRepository.java | 9662173dc23b47eed6a35438f7dbdcaa522da142 | [] | no_license | SERLEX189/JavaAngularSpring | e6accfdc2288abf0dc7b4138de03aca6a0f4d487 | e3d03263729abae270b32fe9503e84b0bf779110 | refs/heads/master | 2022-04-21T12:42:49.193668 | 2020-04-17T22:56:57 | 2020-04-17T22:56:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | package com.tcs.pruebatcsingreso.dao.repository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import com.tcs.pruebatcsingreso.model.entity.EmpleadoFuncion;
public interface IEmpleadoFuncionRepository extends CrudRepository<EmpleadoFuncion, Integer> {
@Modifying
@Query("delete from EmpleadoFuncion empfunc where empfunc.empleado.idEmpleado = :idEmpleado")
public void borrarFuncionesEmpl(@Param("idEmpleado") Integer idEmpleado);
}
| [
"serlex@localhost.localdomain"
] | serlex@localhost.localdomain |
2e4d765b7c38a6423f12c88cc00beb9ed1835fc8 | d711c1adc3eea74aad1cebfb5fbe26aadb170b2b | /src/me/herobrine/ai/tasks/IdleTask.java | 809d17a278f2273fa13a3cede69271cda0dbb852 | [] | no_license | don4of4/Herobrine | dcbd65e55dfc1494f1776c978527be78232f92b0 | 4db892f50ec24da412211e21464c1768602a28d3 | refs/heads/master | 2016-09-16T06:16:48.836500 | 2012-09-15T00:34:26 | 2012-09-15T00:34:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package me.herobrine.ai.tasks;
import me.herobrine.ai.Task;
import me.herobrine.ai.TaskUnsuccessfulException;
public class IdleTask extends Task {
@Override
public Task execute() throws TaskUnsuccessfulException {
return this;
}
@Override
public boolean handleException(TaskUnsuccessfulException exception) {
return false;
}
}
| [
"Emiel Tasseel"
] | Emiel Tasseel |
1838b8a917f8cc481a7dce9ab1d2914e021f90ef | 7f4ec868071d6c6d577645085fbbb2815f09a73a | /gen/src/main/java/org/openapitools/client/model/PaymentSubmitOrderRequest.java | bc8e65ad785045db08b8ab9a2c0d10ae30b088fa | [] | no_license | COS301-SE-2021/Odosla | 2a368ed19388e50a137d92e7434e1461bb6fcf31 | 5045d8fc1347dab86c3b23c623a080b88c46ada9 | refs/heads/master | 2023-09-06T08:28:50.111898 | 2021-10-14T08:50:08 | 2021-10-14T08:50:08 | 369,605,671 | 9 | 1 | null | 2021-10-13T12:08:44 | 2021-05-21T17:17:05 | Java | UTF-8 | Java | false | false | 8,071 | java | /*
* Library Service
* The library service
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.ItemObject;
/**
* This object is expected as input
*/
@ApiModel(description = "This object is expected as input")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2021-08-26T18:20:06.034903200+02:00[Africa/Harare]")
public class PaymentSubmitOrderRequest {
public static final String SERIALIZED_NAME_JWT_TOKEN = "jwtToken";
@SerializedName(SERIALIZED_NAME_JWT_TOKEN)
private String jwtToken;
public static final String SERIALIZED_NAME_LIST_OF_ITEMS = "listOfItems";
@SerializedName(SERIALIZED_NAME_LIST_OF_ITEMS)
private List<ItemObject> listOfItems = null;
public static final String SERIALIZED_NAME_DISCOUNT = "discount";
@SerializedName(SERIALIZED_NAME_DISCOUNT)
private BigDecimal discount;
public static final String SERIALIZED_NAME_STORE_ID = "storeId";
@SerializedName(SERIALIZED_NAME_STORE_ID)
private String storeId;
public static final String SERIALIZED_NAME_ORDER_TYPE = "orderType";
@SerializedName(SERIALIZED_NAME_ORDER_TYPE)
private String orderType;
public static final String SERIALIZED_NAME_LATITUDE = "latitude";
@SerializedName(SERIALIZED_NAME_LATITUDE)
private BigDecimal latitude;
public static final String SERIALIZED_NAME_LONGITUDE = "longitude";
@SerializedName(SERIALIZED_NAME_LONGITUDE)
private BigDecimal longitude;
public static final String SERIALIZED_NAME_DELIVERY_ADDRESS = "deliveryAddress";
@SerializedName(SERIALIZED_NAME_DELIVERY_ADDRESS)
private String deliveryAddress;
public PaymentSubmitOrderRequest jwtToken(String jwtToken) {
this.jwtToken = jwtToken;
return this;
}
/**
* generated token used to identify the caller of the endpoint
* @return jwtToken
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "generated token used to identify the caller of the endpoint")
public String getJwtToken() {
return jwtToken;
}
public void setJwtToken(String jwtToken) {
this.jwtToken = jwtToken;
}
public PaymentSubmitOrderRequest listOfItems(List<ItemObject> listOfItems) {
this.listOfItems = listOfItems;
return this;
}
public PaymentSubmitOrderRequest addListOfItemsItem(ItemObject listOfItemsItem) {
if (this.listOfItems == null) {
this.listOfItems = new ArrayList<ItemObject>();
}
this.listOfItems.add(listOfItemsItem);
return this;
}
/**
* Get listOfItems
* @return listOfItems
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public List<ItemObject> getListOfItems() {
return listOfItems;
}
public void setListOfItems(List<ItemObject> listOfItems) {
this.listOfItems = listOfItems;
}
public PaymentSubmitOrderRequest discount(BigDecimal discount) {
this.discount = discount;
return this;
}
/**
* Get discount
* @return discount
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public BigDecimal getDiscount() {
return discount;
}
public void setDiscount(BigDecimal discount) {
this.discount = discount;
}
public PaymentSubmitOrderRequest storeId(String storeId) {
this.storeId = storeId;
return this;
}
/**
* Get storeId
* @return storeId
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public PaymentSubmitOrderRequest orderType(String orderType) {
this.orderType = orderType;
return this;
}
/**
* Get orderType
* @return orderType
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getOrderType() {
return orderType;
}
public void setOrderType(String orderType) {
this.orderType = orderType;
}
public PaymentSubmitOrderRequest latitude(BigDecimal latitude) {
this.latitude = latitude;
return this;
}
/**
* Get latitude
* @return latitude
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public BigDecimal getLatitude() {
return latitude;
}
public void setLatitude(BigDecimal latitude) {
this.latitude = latitude;
}
public PaymentSubmitOrderRequest longitude(BigDecimal longitude) {
this.longitude = longitude;
return this;
}
/**
* Get longitude
* @return longitude
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public BigDecimal getLongitude() {
return longitude;
}
public void setLongitude(BigDecimal longitude) {
this.longitude = longitude;
}
public PaymentSubmitOrderRequest deliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
return this;
}
/**
* Get deliveryAddress
* @return deliveryAddress
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getDeliveryAddress() {
return deliveryAddress;
}
public void setDeliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PaymentSubmitOrderRequest paymentSubmitOrderRequest = (PaymentSubmitOrderRequest) o;
return Objects.equals(this.jwtToken, paymentSubmitOrderRequest.jwtToken) &&
Objects.equals(this.listOfItems, paymentSubmitOrderRequest.listOfItems) &&
Objects.equals(this.discount, paymentSubmitOrderRequest.discount) &&
Objects.equals(this.storeId, paymentSubmitOrderRequest.storeId) &&
Objects.equals(this.orderType, paymentSubmitOrderRequest.orderType) &&
Objects.equals(this.latitude, paymentSubmitOrderRequest.latitude) &&
Objects.equals(this.longitude, paymentSubmitOrderRequest.longitude) &&
Objects.equals(this.deliveryAddress, paymentSubmitOrderRequest.deliveryAddress);
}
@Override
public int hashCode() {
return Objects.hash(jwtToken, listOfItems, discount, storeId, orderType, latitude, longitude, deliveryAddress);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PaymentSubmitOrderRequest {\n");
sb.append(" jwtToken: ").append(toIndentedString(jwtToken)).append("\n");
sb.append(" listOfItems: ").append(toIndentedString(listOfItems)).append("\n");
sb.append(" discount: ").append(toIndentedString(discount)).append("\n");
sb.append(" storeId: ").append(toIndentedString(storeId)).append("\n");
sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n");
sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n");
sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n");
sb.append(" deliveryAddress: ").append(toIndentedString(deliveryAddress)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"u19060468@tuks.co.za"
] | u19060468@tuks.co.za |
7b93b6d6051bf0467cdf9edfd970b44c8e99bf7a | 983f9a8cf420f68bdcd2fe642c72c6e0a72f0ee7 | /src/model/Tanque.java | 6fccc78b847415c63309fc79e0ad5985360030eb | [] | no_license | gabrielbucalon/posto_blue | 34fe7f802424faad440f87caf25b4c5297b16316 | 18fcd68dd18c0c550e3f2be32fec90a5d284650f | refs/heads/master | 2020-05-25T08:39:24.297275 | 2019-06-14T00:44:13 | 2019-06-14T00:44:13 | 187,715,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package model;
import javafx.fxml.FXML;
public class Tanque {
private double quantidadeCombustivel;
private String tipoCombustivel;
public Tanque(String tipoCombustivel){ // Tipo do combustivel
this.tipoCombustivel = tipoCombustivel;
}
@FXML
public void initialize(){ // Segundo a ser carregado
}
public String getTipoCombustivel() { // Pega o que foi digitado
return tipoCombustivel;
}
public void setTipoCombustivel(String tipoCombustivel) {
this.tipoCombustivel = tipoCombustivel;
}
public double getQuantidadeCombustivel() {
return quantidadeCombustivel;
}
public void setQuantidadeCombustivel(double quantidadeCombustivel) {
this.quantidadeCombustivel = quantidadeCombustivel;
}
@Override
public String toString(){
return tipoCombustivel;
}
}
| [
"gabriel.bucalon@synvia.com.br"
] | gabriel.bucalon@synvia.com.br |
3fc64938fd726ae70fe8d2cf398db96ab01b7c84 | 605f5078b63571150d52bdfa75654637cb7393a2 | /app/src/main/java/javafx_nio_async_chat_server/App.java | 8e07a82e59a86bce47afd6a4fd50a62e0c761a81 | [] | no_license | hjyoon/javafx_nio_async_chat_server | 7800c9fa32549cb90c069148880e375586c0ee39 | 2226512ee1aed2ef1eca9144805ee15fbc67e467 | refs/heads/main | 2023-01-11T11:28:30.640134 | 2020-11-17T15:00:24 | 2020-11-17T15:00:24 | 313,648,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,723 | java | /*
* This Java source file was generated by the Gradle 'init' task.
*/
package javafx_nio_async_chat_server;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import java.util.concurrent.*;
import java.text.*;
import java.net.*;
import java.net.http.*;
import java.nio.*;
import java.nio.charset.*;
import java.nio.channels.*;
import com.google.gson.*;
public class App {
public static void main(String[] args) throws Exception {
ServerExample server = new ServerExample();
server.startServer();
}
}
class ServerExample {
AsynchronousChannelGroup acg;
AsynchronousServerSocketChannel assc;
List<Client> connections = new Vector<Client>();
void startServer() {
try {
acg = AsynchronousChannelGroup.withFixedThreadPool(
Runtime.getRuntime().availableProcessors(),
Executors.defaultThreadFactory()
);
assc = AsynchronousServerSocketChannel.open(acg);
assc.bind(new InetSocketAddress(5001));
}
catch(Exception e) {
e.printStackTrace();
if(assc.isOpen()) {
stopServer();
}
return;
}
System.out.println("[start server]");
// accept(A attachment, new CompletionHandler<AsynchronousSocketChannel, ? super A> handler)
assc.accept(null, new CompletionHandler<AsynchronousSocketChannel, Void>() {
@Override
public void completed(AsynchronousSocketChannel socketChannel, Void attachment) {
try {
Client client = new Client(socketChannel, connections);
connections.add(client);
System.out.println("[accept connection: " + socketChannel.getRemoteAddress() + ": " + Thread.currentThread().getName() + "]");
System.out.println("[the number of connections: " + connections.size() + "]");
assc.accept(null, this);
}
catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void failed(Throwable exc, Void attachment) {
System.out.println("[fail to accept]");
if(assc.isOpen()) {
stopServer();
}
}
});
}
void stopServer() {
try {
connections.clear();
if(acg != null && !acg.isShutdown()) {
System.out.println("[stopServer -> shutdownNow]");
acg.shutdownNow();
//assc.close();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
class Client {
AsynchronousSocketChannel asc;
List<Client> connections;
String userName;
Charset charset;
Client(AsynchronousSocketChannel socketChannel, List<Client> connections) {
this.asc = socketChannel;
this.connections = connections;
charset = Charset.forName("utf-8");
receive();
}
void receive() {
ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
// read(ByteBuffer dst, A attachment, new CompletionHandler<Integer, ? super A> handler)
asc.read(byteBuffer, byteBuffer, new CompletionHandler<Integer, ByteBuffer>() {
@Override
public void completed(Integer result, ByteBuffer attachment) {
try {
System.out.println("[process request: " + asc.getRemoteAddress() + ": " + Thread.currentThread().getName() + "]");
attachment.flip();
Charset charset = Charset.forName("utf-8");
String data = charset.decode(attachment).toString(); // .decode() : ByteBuffer -> CharBuffer
System.out.println("[success to receive] " + data);
Gson gson = new Gson();
MyMessage from = gson.fromJson(data, MyMessage.class);
if(from.type.equals("userTalk")) {
MyMessage to = new MyMessage("print", userName+"> "+from.data+"\n");
//String json = gson.toJson(to);
// broadcasting to all
for(Client client : connections) {
ByteBuffer byteBuffer = charset.encode(gson.toJson(to));
client.send(byteBuffer);
}
}
else if(from.type.equals("setNickname")) {
userName = from.data;
MyMessage to = new MyMessage("print", Util.time_now()+" \""+userName+"\" has joined.\n");
//String json = gson.toJson(to);
for(Client client : connections) {
ByteBuffer byteBuffer = charset.encode(gson.toJson(to));
client.send(byteBuffer);
}
Thread.sleep(10);
to = new MyMessage("newJoin", userName);
//json = gson.toJson(to);
// broadcasting to all
for(Client client : connections) {
if(Client.this == client) {
continue;
}
ByteBuffer byteBuffer = charset.encode(gson.toJson(to));
client.send(byteBuffer);
}
Thread.sleep(10);
String[] users = new String[connections.size()];
for(int i=0; i<users.length; i++) {
users[i] = connections.get(i).userName;
}
to = new MyMessage("userList", users);
//json = gson.toJson(to);
ByteBuffer byteBuffer = charset.encode(gson.toJson(to));
Client.this.send(byteBuffer);
}
ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
asc.read(byteBuffer, byteBuffer, this);
}
catch(Exception e) {
e.printStackTrace();
}
}
@Override
public void failed(Throwable exc, ByteBuffer attachment) {
try {
System.out.println("[read error from client: " + asc.getRemoteAddress() + ": " + Thread.currentThread().getName() + "]");
connections.remove(Client.this);
asc.close();
Gson gson = new Gson();
MyMessage to = new MyMessage("userLeave", userName);
//String json = gson.toJson(to);
for(Client client : connections) {
ByteBuffer byteBuffer = charset.encode(gson.toJson(to));
client.send(byteBuffer);
}
try {
Thread.sleep(10);
}
catch(Exception e) {
e.printStackTrace();
}
to = new MyMessage("print", Util.time_now()+" \""+userName+"\" has left.\n");
//json = gson.toJson(to);
for(Client client : connections) {
ByteBuffer byteBuffer = charset.encode(gson.toJson(to));
client.send(byteBuffer);
}
}
catch (IOException e) {
e.printStackTrace();
}
}
});
}
void send(ByteBuffer bb) {
//write(ByteBuffer src, A attachment, new CompletionHandler<Integer, ? super A> handler);
asc.write(bb, null, new CompletionHandler<Integer, Void>() {
@Override
public void completed(Integer result, Void attachment) {
String data = charset.decode(bb).toString();
System.out.println("[success to send] " + data);
}
@Override
public void failed(Throwable exc, Void attachment) {
try {
System.out.println("[write error to client: " + asc.getRemoteAddress() + ": " + Thread.currentThread().getName() + "]");
connections.remove(Client.this);
asc.close();
Gson gson = new Gson();
MyMessage to = new MyMessage("userLeave", userName);
//String json = gson.toJson(to);
for(Client client : connections) {
ByteBuffer byteBuffer = charset.encode(gson.toJson(to));
client.send(byteBuffer);
}
try {
Thread.sleep(10);
}
catch(Exception e) {
e.printStackTrace();
}
to = new MyMessage("print", Util.time_now()+" \""+userName+"\" has left.\n");
//json = gson.toJson(to);
for(Client client : connections) {
ByteBuffer byteBuffer = charset.encode(gson.toJson(to));
client.send(byteBuffer);
}
}
catch (IOException e) {
e.printStackTrace();
}
}
});
}
} | [
"hjyoon314@gmail.com"
] | hjyoon314@gmail.com |
ac8d0043a31d32646d099d7450b6ba2b2a3d1b19 | 3dc737a1d2bfe3b53724616ef6b88038b4e6cdb9 | /src/main/java/com/microsoft/graph/requests/extensions/CallCollectionPage.java | a0b76b1bdf35a1176bb86345e680b34a6818c839 | [
"MIT"
] | permissive | kitherill/msgraph-sdk-java | 2a549e1b65f8d1fdf509eacb048d6fffabaa597b | 16cfeb7675cb311a8af9c6272915b96f718a1e5d | refs/heads/dev | 2021-07-03T00:56:33.097329 | 2020-04-20T16:16:48 | 2020-04-20T16:16:48 | 159,879,325 | 0 | 1 | MIT | 2020-04-20T16:16:50 | 2018-11-30T21:13:51 | Java | UTF-8 | Java | false | false | 1,185 | java | // ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.requests.extensions;
import com.microsoft.graph.models.extensions.Call;
import com.microsoft.graph.requests.extensions.ICallCollectionRequestBuilder;
import com.microsoft.graph.http.BaseCollectionPage;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Call Collection Page.
*/
public class CallCollectionPage extends BaseCollectionPage<Call, ICallCollectionRequestBuilder> implements ICallCollectionPage {
/**
* A collection page for Call
*
* @param response the serialized CallCollectionResponse from the service
* @param builder the request builder for the next collection page
*/
public CallCollectionPage(final CallCollectionResponse response, final ICallCollectionRequestBuilder builder) {
super(response.value, builder);
}
}
| [
"noreply@github.com"
] | kitherill.noreply@github.com |
b357e30cab0fdbade1e3b50a1b48110cfbe3878c | 833b285ba49893c5d57614bff4d7791cbef41c52 | /src/org/bee/tl/samples/User.java | 575e9934214896c3de05a7528e1151b9ac45b73e | [] | no_license | javamonkey/beetl1.2 | 003cd61c472977b653b16025c8861ebd84bb93e6 | 06c5a02f0927aed9fef8ab06cbe68d32a0621e8b | refs/heads/master | 2020-04-06T03:38:43.513875 | 2014-08-18T10:05:23 | 2014-08-18T10:05:23 | 9,101,442 | 7 | 5 | null | 2013-08-31T02:31:07 | 2013-03-29T15:56:35 | Java | UTF-8 | Java | false | false | 2,043 | java | package org.bee.tl.samples;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class User extends Person
{
public int id;
public static int max = 12;
String _Name ="defaultName";
User wife = null;
User son = null;
Date bir = new Date();
List<User> friend = new ArrayList<User>();
Map<String, String> books = new HashMap<String, String>();
int age;
public int getAge()
{
return age;
}
public void setAge(int age)
{
this.age = age;
}
public User()
{
}
public Object getSon(){
return new User() ;
}
public String getName()
{
return this._Name;
}
public void setName(String name)
{
this._Name = name;
}
public User getWife()
{
return wife;
}
public void setWife(User wife)
{
this.wife = wife;
}
public Date getBir()
{
return bir;
}
public void setBir(Date bir)
{
this.bir = bir;
}
public List<User> getFriend()
{
return friend;
}
public User getFriend(String name){
for(User u :friend){
if(u.getName().equals(name)){
return u;
}
}
return null;
}
public void setFriend(List<User> friend)
{
this.friend = friend;
}
public Map<String, String> getBooks()
{
return books;
}
public void setBooks(Map<String, String> books)
{
this.books = books;
}
public String toString()
{
return this._Name;
}
public static void main(String[] args)
{
User user = new User();
Boolean isContinue = true;
String dv = "N/A";
Object o = null;
if (user != null && user.getWife() != null)
{
o = user.getWife().getName();
//format
}
else
{
o = dv;
isContinue = false;
}
System.out.println(o);
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public String getReadOnly(){
return "test";
}
public static int getMax()
{
return max;
}
} | [
"javamonkey@163.com"
] | javamonkey@163.com |
27137f4a2b13b6e56bd7ee561159d9cfca22f77d | b03c18e31efa93e06cc6bdc79e91d02022f32755 | /src/org/ourgrid/portal/server/logic/executors/plugin/epanet/EpanetJobSubmissionExecutor.java | 578ef1a15af98f58bde5d11aff6025417e899cb1 | [] | no_license | OurGrid/portal | 1f63f81e8aab1572eca0e683daccd7988454cb20 | f306296cded8bbff7707ed106ac2c0f954c9153f | refs/heads/master | 2020-06-04T20:24:29.032118 | 2013-09-19T19:02:10 | 2013-09-19T19:02:10 | 12,737,811 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,504 | java | package org.ourgrid.portal.server.logic.executors.plugin.epanet;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.ourgrid.common.specification.exception.JobSpecificationException;
import org.ourgrid.common.specification.exception.TaskSpecificationException;
import org.ourgrid.common.specification.job.IOBlock;
import org.ourgrid.common.specification.job.IOEntry;
import org.ourgrid.common.specification.job.JobSpecification;
import org.ourgrid.common.specification.job.TaskSpecification;
import org.ourgrid.portal.client.common.to.response.ResponseTO;
import org.ourgrid.portal.client.common.to.service.ServiceTO;
import org.ourgrid.portal.client.plugin.epanetgrid.gui.model.EpanetJobRequest;
import org.ourgrid.portal.client.plugin.epanetgrid.to.model.EpanetInputFileTO;
import org.ourgrid.portal.client.plugin.epanetgrid.to.response.EpanetJobSubmissionResponseTO;
import org.ourgrid.portal.client.plugin.epanetgrid.to.service.EpanetJobSubmissionTO;
import org.ourgrid.portal.server.exceptions.ExecutionException;
import org.ourgrid.portal.server.logic.executors.JobSubmissionExecutor;
import org.ourgrid.portal.server.logic.executors.plugin.epanet.io.ModificarMalhas;
import org.ourgrid.portal.server.logic.executors.plugin.epanet.io.PerturbadorExecutor;
import org.ourgrid.portal.server.logic.interfaces.OurGridPortalIF;
import org.ourgrid.portal.server.messages.OurGridPortalServiceMessages;
import org.ourgrid.portal.server.util.OurgridPortalProperties;
public class EpanetJobSubmissionExecutor extends JobSubmissionExecutor {
private final String FILE_SEPARATOR = System.getProperty("file.separator");
private Long uploadId;
private File malhasFile;
private File perturbacaoFile;
public EpanetJobSubmissionExecutor(OurGridPortalIF portal) {
super(portal);
}
@Override
public void logTransaction(ServiceTO serviceTO) {
// TODO Auto-generated method stub
}
@Override
public ResponseTO execute(ServiceTO serviceTO) throws ExecutionException {
EpanetJobSubmissionTO epanetJobSubmissionTO = (EpanetJobSubmissionTO) serviceTO;
EpanetJobSubmissionResponseTO epanetJobSubmissionResponseTO = new EpanetJobSubmissionResponseTO();
initializeClient();
uploadId = epanetJobSubmissionTO.getUploadId();
String userLogin = epanetJobSubmissionTO.getUserLogin();
boolean emailNotification = epanetJobSubmissionTO.isEmailNotification();
EpanetInputFileTO inputFile = epanetJobSubmissionTO.getInputFile();
JobSpecification theJob = new JobSpecification();
try {
theJob = compileInputs(inputFile, epanetJobSubmissionTO);
} catch (JobSpecificationException e) {
throw new ExecutionException(OurGridPortalServiceMessages.PORTAL_SERVICE_UNAVAIABLE_MSG);
} catch (TaskSpecificationException e) {
throw new ExecutionException(OurGridPortalServiceMessages.PORTAL_SERVICE_UNAVAIABLE_MSG);
} catch (IOException e) {
throw new ExecutionException(OurGridPortalServiceMessages.PORTAL_SERVICE_UNAVAIABLE_MSG);
}
Integer jobId = addJob(epanetJobSubmissionTO.getUserLogin(), theJob);
epanetJobSubmissionResponseTO.setJobID(jobId);
epanetJobSubmissionResponseTO.getJobIDs().add(jobId);
addRequest(jobId, new EpanetJobRequest(jobId, uploadId, userLogin, emailNotification, inputFile));
reeschedule();
return epanetJobSubmissionResponseTO;
}
private String getFilesPath() {
return getPortal().getDAOManager().getUploadDirName(uploadId);
}
public JobSpecification compileInputs(EpanetInputFileTO inputFile, EpanetJobSubmissionTO epanetJobSubmissionTO) throws JobSpecificationException, TaskSpecificationException, IOException, ExecutionException {
String perturbacaoFilePath = getFilesPath() + FILE_SEPARATOR + "perturbacao";
List<TaskSpecification> taskList = new ArrayList<TaskSpecification>();
File perturbacao = new File(perturbacaoFilePath);
if(!perturbacao.exists()) {
perturbacao.mkdirs();
}
File remoteFolder = new File(getFilesPath());
for (String fileName : remoteFolder.list()) {
File file = new File(remoteFolder.getCanonicalPath() + FILE_SEPARATOR + fileName);
if(file.getName().endsWith(".inp")) {
setMalhasFile(file);
} else if(file.getName().endsWith(".per")) {
setPerturbacaoFile(file);
}
}
System.out.println("vai criar perturbador...");
PerturbadorExecutor pe = new PerturbadorExecutor(getMalhasFile().getCanonicalPath());
pe.addPerturbacao(getPerturbacaoFile().getCanonicalPath());
System.out.println("Vai gerar perturbacao");
pe.geraPerturbacao(perturbacaoFilePath, "Malha-out-");
int count = 0;
for (String malhaFiles : perturbacao.list()) {
count++;
ModificarMalhas modificar = new ModificarMalhas(perturbacao.getAbsolutePath() + FILE_SEPARATOR + malhaFiles, "resultados"+count+".txt");
modificar.modificar();
}
int counter = 0;
for (String malhaFiles : perturbacao.list()) {
counter++;
File malha = new File(perturbacao.getAbsolutePath() + FILE_SEPARATOR + malhaFiles);
createJobSpecification(taskList, malha, "saida"+ counter+".txt", "Resultados"+ counter+".txt", remoteFolder.getAbsolutePath() + FILE_SEPARATOR + "output",counter);
}
return new JobSpecification("Epanet Job", "", taskList);
}
public void createJobSpecification(List<TaskSpecification> tasksList,File malha, String outputFileSaida, String outputFileResultado,String outputPath,int index) throws TaskSpecificationException, ExecutionException {
String epanetPath = OurgridPortalProperties.getInstance().getProperty(OurgridPortalProperties.EPANET_PATH);
File file = new File (epanetPath + FILE_SEPARATOR + "epanetgrid.tar.gz");
try {
epanetPath = file.getCanonicalPath();
} catch (IOException e1) {
throw new ExecutionException(OurGridPortalServiceMessages.PORTAL_SERVICE_UNAVAIABLE_MSG);
}
// create initBlock
IOBlock initBlock = new IOBlock();
IOEntry epanetFile = new IOEntry("store", epanetPath, "epanetgrid.tar.gz");
IOEntry malhaFile = new IOEntry("put", malha.getAbsolutePath(), malha.getName());
initBlock.putEntry(epanetFile);
initBlock.putEntry(malhaFile);
//create remotExe
String remoteExe = "";
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("tar xzvf $STORAGE/epanetgrid.tar.gz -C $PLAYPEN ; executa.sh ");
stringBuilder.append(malha.getName());
stringBuilder.append(" ");
stringBuilder.append("saida");
stringBuilder.append(index);
stringBuilder.append(".txt");
stringBuilder.append(" ");
stringBuilder.append("Resultados");
stringBuilder.append(index);
stringBuilder.append(".txt");
remoteExe += stringBuilder.toString();
//create finalBlock
IOBlock finalBlock = new IOBlock();
IOEntry finalEntrySaida = new IOEntry("get",outputFileSaida, outputPath + FILE_SEPARATOR + outputFileSaida );
IOEntry finalEntryResultado = new IOEntry("get",outputFileResultado, outputPath + FILE_SEPARATOR + outputFileResultado);
finalBlock.putEntry(finalEntrySaida);
finalBlock.putEntry(finalEntryResultado);
TaskSpecification taskSpec = new TaskSpecification(initBlock, remoteExe, finalBlock, null);
tasksList.add(taskSpec);
}
public File getMalhasFile() {
return malhasFile;
}
public void setMalhasFile(File malhasFile) {
this.malhasFile = malhasFile;
}
public File getPerturbacaoFile() {
return perturbacaoFile;
}
public void setPerturbacaoFile(File perturbacaoFile) {
this.perturbacaoFile = perturbacaoFile;
}
}
| [
"abmargb@gmail.com"
] | abmargb@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.