blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3f271bff917d6617e59b80cc301e77987d5b1877 | 2b2fcb1902206ad0f207305b9268838504c3749b | /WakfuClientSources/srcx/class_9808_dMS.java | 9c3838d29fd69384153444a58cd4a4f6c2a2b79a | [] | no_license | shelsonjava/Synx | 4fbcee964631f747efc9296477dee5a22826791a | 0cb26d5473ba1f36a3ea1d7163a5b9e6ebcb0b1d | refs/heads/master | 2021-01-15T13:51:41.816571 | 2013-11-17T10:46:22 | 2013-11-17T10:46:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | import java.util.Locale;
public class dMS
{
private String name;
private boolean optional;
private boolean eOD;
private String description;
private String mdw;
public void setName(String paramString)
{
if (!dnE.kb(paramString)) {
throw new cJ("Illegal name [" + paramString + "] for attribute");
}
this.name = paramString.toLowerCase(Locale.ENGLISH);
}
public String getName()
{
return this.name;
}
public void iJ(boolean paramBoolean)
{
this.optional = paramBoolean;
}
public boolean dpF()
{
return this.optional;
}
public void kF(boolean paramBoolean)
{
this.eOD = paramBoolean;
}
public boolean dpG()
{
return this.eOD;
}
public void setDescription(String paramString)
{
this.description = paramString;
}
public String getDescription()
{
return this.description;
}
public void bK(String paramString)
{
this.mdw = paramString;
}
public String bFa()
{
return this.mdw;
}
public boolean equals(Object paramObject)
{
if (paramObject == null) {
return false;
}
if (paramObject.getClass() != getClass()) {
return false;
}
dMS localdMS = (dMS)paramObject;
return (dnE.x(this.name, localdMS.name)) && (this.optional == localdMS.optional) && (this.eOD == localdMS.eOD) && (dnE.x(this.mdw, localdMS.mdw));
}
public int hashCode()
{
return dnE.bo(this.name);
}
} | [
"music_inme@hotmail.fr"
] | music_inme@hotmail.fr |
b756ece79bcf3a9ca4dc847a443667332f94e057 | d9633b089fe515c00abd087997e6346895dc41f0 | /message-driven/mq-demo/rabbitmq-amqp/rabbitmq-consumer/src/main/java/com/txw/rabbitmq/RabbitmqSpringBootConsumerApplication.java | 5abdb4c58e45f1d2d56f4b9ad6992ccc397c8b2e | [] | no_license | Adair999/message-driven | 0b9def93cd75aede6df36a19f8277b29eddf74df | 64db54330e1db7270f1b72fcca49071cc09432a5 | refs/heads/main | 2023-01-29T23:18:08.857733 | 2020-12-11T09:53:08 | 2020-12-11T09:53:08 | 320,531,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package com.txw.rabbitmq;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RabbitmqSpringBootConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(RabbitmqSpringBootConsumerApplication.class, args);
}
} | [
"1578533828@qq.com"
] | 1578533828@qq.com |
2be57531c23e0066edb5e57947e527ed09c31596 | dec3801a9075c3753e0aa0b02a456dd5982d3aee | /src/main/java/org/dheeraj/springsecurityjwt/repository/UserRepository.java | e8ece574d375a7466b70d4cf1c3d60b9b0e37498 | [] | no_license | kdheeraj-cse/spring-security-jwt | f923303c942b4c8f70b911d68edcc17a11b04078 | a2cebd6eacf125daa09a78df3b7d62ada03bcf87 | refs/heads/master | 2023-08-28T03:45:24.941136 | 2021-11-12T06:24:47 | 2021-11-12T06:24:47 | 426,738,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package org.dheeraj.springsecurityjwt.repository;
import java.util.Optional;
import org.dheeraj.springsecurityjwt.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<UserEntity,Integer> {
Optional<UserEntity> findByUsername(String username);
}
| [
"kdheeraj.cse@gmail.com"
] | kdheeraj.cse@gmail.com |
49bb53b657345e5e0fa210d90a56af2552330813 | e020799198ab7a3def36dfb1991444cb76d7421a | /chapter1/src/com/mxm/thread/sleep/Run.java | 74b70c7381694e7630b80dd6d90bed73c1c373ea | [] | no_license | heronsbill/ThreadTest | 74e8ab615bf4da4a916e4e63ebbf04082331689d | 060c3e21c2de2bf51452876cab6f023d96419de6 | refs/heads/master | 2021-01-20T09:13:30.820160 | 2017-09-22T08:16:30 | 2017-09-22T08:16:30 | 101,582,508 | 0 | 0 | null | 2017-09-05T08:10:41 | 2017-08-27T21:51:07 | Java | UTF-8 | Java | false | false | 275 | java | package com.mxm.thread.sleep;
public class Run {
public static void main(String[] args) {
MyThread mt = new MyThread();
System.out.println("begin = " + System.currentTimeMillis());
mt.run();
System.out.println("end = " + System.currentTimeMillis());
}
}
| [
"530574250@qq.com"
] | 530574250@qq.com |
87dc9d15b961a64ef0e0c15f8e26d06570bb5180 | 3dd35c0681b374ce31dbb255b87df077387405ff | /generated/com/guidewire/_generated/entity/UWCompanyInternalAccess.java | 9102663ba4d0e88f430134f27264dd2915c4f0e0 | [] | no_license | walisashwini/SBTBackup | 58b635a358e8992339db8f2cc06978326fed1b99 | 4d4de43576ec483bc031f3213389f02a92ad7528 | refs/heads/master | 2023-01-11T09:09:10.205139 | 2020-11-18T12:11:45 | 2020-11-18T12:11:45 | 311,884,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 777 | java | package com.guidewire._generated.entity;
@javax.annotation.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "UWCompany.eti;UWCompany.eix;UWCompany.etx")
@java.lang.SuppressWarnings(value = {"deprecation", "unchecked"})
public class UWCompanyInternalAccess {
public static final com.guidewire.pl.system.internal.FriendAccessor<com.guidewire.pl.persistence.code.InstantiableEntityFriendAccess<entity.UWCompany, com.guidewire._generated.entity.UWCompanyInternal>> FRIEND_ACCESSOR = new com.guidewire.pl.system.internal.FriendAccessor<com.guidewire.pl.persistence.code.InstantiableEntityFriendAccess<entity.UWCompany, com.guidewire._generated.entity.UWCompanyInternal>>(entity.UWCompany.class);
private UWCompanyInternalAccess() {
}
} | [
"ashwini@cruxxtechnologies.com"
] | ashwini@cruxxtechnologies.com |
4f2fb58528807dff9d0e634a7f6a9231c7aa0ce0 | d3cb5b8a2902b5af0210fd195015c80a488f6c3d | /src/main/java/com/veera/customInputFormat/CombineInputFormat.java | 2faee7ab473ed9891914d6fddc8847413424c418 | [] | no_license | luckyakhi/BigDataTraining | c2130b104b181567d8928a31c599e24dbdbea103 | 8dbe84dd3b4e4703af3e36a5600d0e744e7cf8e0 | refs/heads/master | 2020-02-26T16:50:13.605329 | 2017-04-16T14:48:27 | 2017-04-16T14:48:27 | 71,615,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,742 | java | package com.veera.customInputFormat;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.CombineFileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.CombineFileRecordReader;
import org.apache.hadoop.mapreduce.lib.input.CombineFileSplit;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import org.apache.hadoop.mapreduce.lib.input.LineRecordReader;
import org.apache.hadoop.net.NetworkTopology;
import org.apache.hadoop.net.NodeBase;
import org.apache.log4j.Logger;
public class CombineInputFormat extends CombineFileInputFormat<LongWritable, Text> {
private static final Logger LOGGER = Logger.getLogger(CombineFileInputFormat.class.getName());
public static final String SPLIT_MINSIZE_PERNODE =
"mapreduce.input.fileinputformat.split.minsize.per.node";
public static final String SPLIT_MINSIZE_PERRACK =
"mapreduce.input.fileinputformat.split.minsize.per.rack";
// ability to limit the size of a single split
private long maxSplitSize = 0;
private long minSplitSizeNode = 0;
private long minSplitSizeRack = 0;
private static final long BLOCK_SIZE = 67108864;
// A pool of input paths filters. A split cannot have blocks from files
// across multiple pools.
private final ArrayList<MultiPathFilter> pools = new ArrayList<MultiPathFilter>();
// mapping from a rack name to the set of Nodes in the rack
private final HashMap<String, Set<String>> rackToNodes =
new HashMap<String, Set<String>>();
public CombineInputFormat() {
super();
// 64 MB, default block size on hadoop
setMaxSplitSize(BLOCK_SIZE);
}
@Override
public RecordReader<LongWritable, Text> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException {
return new CombineFileRecordReader<LongWritable, Text>((CombineFileSplit) split, context, BasicCombineFileRecordReader.class);
}
@Override
protected boolean isSplitable(JobContext context, Path file) {
return false;
}
/**
* Specify the maximum size (in bytes) of each split. Each split is
* approximately equal to the specified size.
*/
@Override
protected void setMaxSplitSize(long maxSplitSize) {
this.maxSplitSize = maxSplitSize;
}
/**
* Specify the minimum size (in bytes) of each split per node. This applies
* to data that is left over after combining data on a single node into
* splits that are of maximum size specified by maxSplitSize. This leftover
* data will be combined into its own split if its size exceeds
* minSplitSizeNode.
*/
@Override
protected void setMinSplitSizeNode(long minSplitSizeNode) {
this.minSplitSizeNode = minSplitSizeNode;
}
/**
* Specify the minimum size (in bytes) of each split per rack. This applies
* to data that is left over after combining data on a single rack into
* splits that are of maximum size specified by maxSplitSize. This leftover
* data will be combined into its own split if its size exceeds
* minSplitSizeRack.
*/
@Override
protected void setMinSplitSizeRack(long minSplitSizeRack) {
this.minSplitSizeRack = minSplitSizeRack;
}
@Override
public List<InputSplit> getSplits(JobContext job)
throws IOException {
long minSizeNode = 0;
long minSizeRack = 0;
long maxSize = 0;
Configuration conf = job.getConfiguration();
// the values specified by setxxxSplitSize() takes precedence over the
// values that might have been specified in the config
if (minSplitSizeNode != 0) {
minSizeNode = minSplitSizeNode;
}
else {
minSizeNode = conf.getLong(SPLIT_MINSIZE_PERNODE, 0);
}
if (minSplitSizeRack != 0) {
minSizeRack = minSplitSizeRack;
}
else {
minSizeRack = conf.getLong(SPLIT_MINSIZE_PERRACK, 0);
}
if (maxSplitSize != 0) {
maxSize = maxSplitSize;
}
else {
maxSize = conf.getLong("mapreduce.input.fileinputformat.split.maxsize", 0);
}
if (minSizeNode != 0 && maxSize != 0 && minSizeNode > maxSize) {
LOGGER.error("Minimum split size pernode " + minSizeNode +
" cannot be larger than maximum split size " +
maxSize);
throw new IOException("Minimum split size pernode " + minSizeNode +
" cannot be larger than maximum split size " +
maxSize);
}
if (minSizeRack != 0 && maxSize != 0 && minSizeRack > maxSize) {
LOGGER.error("Minimum split size per rack" + minSizeRack +
" cannot be larger than maximum split size " +
maxSize);
throw new IOException("Minimum split size per rack" + minSizeRack +
" cannot be larger than maximum split size " +
maxSize);
}
if (minSizeRack != 0 && minSizeNode > minSizeRack) {
LOGGER.error("Minimum split size per node" + minSizeNode +
" cannot be smaller than minimum split " +
"size per rack " + minSizeRack);
throw new IOException("Minimum split size per node" + minSizeNode +
" cannot be smaller than minimum split " +
"size per rack " + minSizeRack);
}
// all the files in input set
Path[] paths = FileUtil.stat2Paths(
listStatus(job).toArray(new FileStatus[0]));
List<InputSplit> splits = new ArrayList<InputSplit>();
if (paths.length == 0) {
return splits;
}
// Convert them to Paths first. This is a costly operation and
// we should do it first, otherwise we will incur doing it multiple
// times, one time each for each pool in the next loop.
List<Path> newpaths = new LinkedList<Path>();
for (int i = 0; i < paths.length; i++) {
FileSystem fs = paths[i].getFileSystem(conf);
Path p = fs.makeQualified(paths[i]);
newpaths.add(p);
}
paths = null;
// In one single iteration, process all the paths in a single pool.
// Processing one pool at a time ensures that a split contains paths
// from a single pool only.
for (MultiPathFilter onepool : pools) {
ArrayList<Path> myPaths = new ArrayList<Path>();
// pick one input path. If it matches all the filters in a pool,
// add it to the output set
for (Iterator<Path> iter = newpaths.iterator(); iter.hasNext();) {
Path p = iter.next();
if (onepool.accept(p)) {
// add it to my output set
myPaths.add(p);
iter.remove();
}
}
// create splits for all files in this pool.
getMoreSplits(job, myPaths.toArray(new Path[myPaths.size()]),
maxSize, minSizeNode, minSizeRack, splits);
}
// create splits for all files that are not in any pool.
getMoreSplits(job, newpaths.toArray(new Path[newpaths.size()]),
maxSize, minSizeNode, minSizeRack, splits);
// free up rackToNodes map
rackToNodes.clear();
return splits;
}
/**
* Create a single split from the list of blocks specified in validBlocks
* Add this new split into splitList.
*/
private void addCreatedSplit(List<InputSplit> splitList,
Collection<String> locations,
List<OneBlockInfo> validBlocks) {
// create an input split
Path[] fl = new Path[validBlocks.size()];
long[] offset = new long[validBlocks.size()];
long[] length = new long[validBlocks.size()];
for (int i = 0; i < validBlocks.size(); i++) {
fl[i] = validBlocks.get(i).onepath;
offset[i] = validBlocks.get(i).offset;
length[i] = validBlocks.get(i).length;
}
// add this split to the list that is returned
CombineFileSplit thissplit = new CombineFileSplit(fl, offset,
length, locations.toArray(new String[0]));
splitList.add(thissplit);
}
/**
* Return all the splits in the specified set of paths
*/
private void getMoreSplits(JobContext job, Path[] paths,
long maxSize, long minSizeNode, long minSizeRack,
List<InputSplit> splits)
throws IOException {
Configuration conf = job.getConfiguration();
// all blocks for all the files in input set
OneFileInfo[] files;
// mapping from a rack name to the list of blocks it has
HashMap<String, List<OneBlockInfo>> rackToBlocks =
new HashMap<String, List<OneBlockInfo>>();
// mapping from a block to the nodes on which it has replicas
HashMap<OneBlockInfo, String[]> blockToNodes =
new HashMap<OneBlockInfo, String[]>();
// mapping from a node to the list of blocks that it contains
HashMap<String, List<OneBlockInfo>> nodeToBlocks =
new HashMap<String, List<OneBlockInfo>>();
files = new OneFileInfo[paths.length];
if (paths.length == 0) {
return;
}
// populate all the blocks for all files
long totLength = 0;
for (int i = 0; i < paths.length; i++) {
files[i] = new OneFileInfo(paths[i], conf, isSplitable(job, paths[i]),
rackToBlocks, blockToNodes, nodeToBlocks,
rackToNodes, maxSize);
totLength += files[i].getLength();
}
List<OneBlockInfo> validBlocks = new ArrayList<OneBlockInfo>();
Set<String> nodes = new HashSet<String>();
long curSplitSize = 0;
// process all nodes and create splits that are local
// to a node.
for (Iterator<Map.Entry<String, List<OneBlockInfo>>> iter = nodeToBlocks.entrySet().iterator(); iter.hasNext();) {
Map.Entry<String, List<OneBlockInfo>> one = iter.next();
nodes.add(one.getKey());
List<OneBlockInfo> blocksInNode = one.getValue();
// for each block, copy it into validBlocks. Delete it from
// blockToNodes so that the same block does not appear in
// two different splits.
for (OneBlockInfo oneblock : blocksInNode) {
if (blockToNodes.containsKey(oneblock)) {
validBlocks.add(oneblock);
blockToNodes.remove(oneblock);
curSplitSize += oneblock.length;
// if the accumulated split size exceeds the maximum, then
// create this split.
if (maxSize != 0 && curSplitSize >= maxSize) {
// create an input split and add it to the splits array
addCreatedSplit(splits, nodes, validBlocks);
curSplitSize = 0;
validBlocks.clear();
}
}
}
// if there were any blocks left over and their combined size is
// larger than minSplitNode, then combine them into one split.
// Otherwise add them back to the unprocessed pool. It is likely
// that they will be combined with other blocks from the
// same rack later on.
if (minSizeNode != 0 && curSplitSize >= minSizeNode) {
// create an input split and add it to the splits array
addCreatedSplit(splits, nodes, validBlocks);
}
else {
for (OneBlockInfo oneblock : validBlocks) {
blockToNodes.put(oneblock, oneblock.hosts);
}
}
validBlocks.clear();
nodes.clear();
curSplitSize = 0;
}
// if blocks in a rack are below the specified minimum size, then keep
// them
// in 'overflow'. After the processing of all racks is complete, these
// overflow blocks will be combined into splits.
List<OneBlockInfo> overflowBlocks = new ArrayList<OneBlockInfo>();
Set<String> racks = new HashSet<String>();
// Process all racks over and over again until there is no more work to
// do.
while (blockToNodes.size() > 0) {
// Create one split for this rack before moving over to the next
// rack.
// Come back to this rack after creating a single split for each of
// the
// remaining racks.
// Process one rack location at a time, Combine all possible blocks
// that
// reside on this rack as one split. (constrained by minimum and
// maximum
// split size).
// iterate over all racks
for (Iterator<Map.Entry<String, List<OneBlockInfo>>> iter =
rackToBlocks.entrySet().iterator(); iter.hasNext();) {
Map.Entry<String, List<OneBlockInfo>> one = iter.next();
racks.add(one.getKey());
List<OneBlockInfo> blocks = one.getValue();
// for each block, copy it into validBlocks. Delete it from
// blockToNodes so that the same block does not appear in
// two different splits.
boolean createdSplit = false;
for (OneBlockInfo oneblock : blocks) {
if (blockToNodes.containsKey(oneblock)) {
validBlocks.add(oneblock);
blockToNodes.remove(oneblock);
curSplitSize += oneblock.length;
// if the accumulated split size exceeds the maximum,
// then
// create this split.
if (maxSize != 0 && curSplitSize >= maxSize) {
// create an input split and add it to the splits
// array
addCreatedSplit(splits, getHosts(racks), validBlocks);
createdSplit = true;
break;
}
}
}
// if we created a split, then just go to the next rack
if (createdSplit) {
curSplitSize = 0;
validBlocks.clear();
racks.clear();
continue;
}
if (!validBlocks.isEmpty()) {
if (minSizeRack != 0 && curSplitSize >= minSizeRack) {
// if there is a minimum size specified, then create a
// single split
// otherwise, store these blocks into overflow data
// structure
addCreatedSplit(splits, getHosts(racks), validBlocks);
}
else {
// There were a few blocks in this rack that
// remained to be processed. Keep them in 'overflow'
// block list.
// These will be combined later.
overflowBlocks.addAll(validBlocks);
}
}
curSplitSize = 0;
validBlocks.clear();
racks.clear();
}
}
assert blockToNodes.isEmpty();
assert curSplitSize == 0;
assert validBlocks.isEmpty();
assert racks.isEmpty();
// Process all overflow blocks
for (OneBlockInfo oneblock : overflowBlocks) {
validBlocks.add(oneblock);
curSplitSize += oneblock.length;
// This might cause an exiting rack location to be re-added,
// but it should be ok.
for (int i = 0; i < oneblock.racks.length; i++) {
racks.add(oneblock.racks[i]);
}
// if the accumulated split size exceeds the maximum, then
// create this split.
if (maxSize != 0 && curSplitSize >= maxSize) {
// create an input split and add it to the splits array
addCreatedSplit(splits, getHosts(racks), validBlocks);
curSplitSize = 0;
validBlocks.clear();
racks.clear();
}
}
// Process any remaining blocks, if any.
if (!validBlocks.isEmpty()) {
addCreatedSplit(splits, getHosts(racks), validBlocks);
}
}
/**
* information about one file from the File System
*/
private static class OneFileInfo {
private long fileSize; // size of the file
private OneBlockInfo[] blocks; // all blocks in this file
OneFileInfo(Path path, Configuration conf,
boolean isSplitable,
HashMap<String, List<OneBlockInfo>> rackToBlocks,
HashMap<OneBlockInfo, String[]> blockToNodes,
HashMap<String, List<OneBlockInfo>> nodeToBlocks,
HashMap<String, Set<String>> rackToNodes,
long maxSize)
throws IOException {
this.fileSize = 0;
// get block locations from file system
FileSystem fs = path.getFileSystem(conf);
FileStatus stat = fs.getFileStatus(path);
BlockLocation[] locations = fs.getFileBlockLocations(stat, 0,
stat.getLen());
// create a list of all block and their locations
if (locations == null) {
blocks = new OneBlockInfo[0];
}
else {
if (!isSplitable) {
// if the file is not splitable, just create the one block
// with
// full file length
blocks = new OneBlockInfo[1];
fileSize = stat.getLen();
blocks[0] = new OneBlockInfo(path, 0, fileSize, locations[0]
.getHosts(), locations[0].getTopologyPaths());
}
else {
ArrayList<OneBlockInfo> blocksList = new ArrayList<OneBlockInfo>(
locations.length);
for (int i = 0; i < locations.length; i++) {
fileSize += locations[i].getLength();
// each split can be a maximum of maxSize
long left = locations[i].getLength();
long myOffset = locations[i].getOffset();
long myLength = 0;
while (left > 0) {
if (maxSize == 0) {
myLength = left;
}
else {
if (left > maxSize && left < 2 * maxSize) {
// if remainder is between max and 2*max -
// then
// instead of creating splits of size max,
// left-max we
// create splits of size left/2 and left/2.
// This is
// a heuristic to avoid creating really
// really small
// splits.
myLength = left / 2;
}
else {
myLength = Math.min(maxSize, left);
}
}
OneBlockInfo oneblock = new OneBlockInfo(path, myOffset,
myLength, locations[i].getHosts(), locations[i]
.getTopologyPaths());
left -= myLength;
myOffset += myLength;
blocksList.add(oneblock);
}
}
blocks = blocksList.toArray(new OneBlockInfo[blocksList.size()]);
}
for (OneBlockInfo oneblock : blocks) {
// add this block to the block --> node locations map
blockToNodes.put(oneblock, oneblock.hosts);
// For blocks that do not have host/rack information,
// assign to default rack.
String[] racks = null;
if (oneblock.hosts.length == 0) {
racks = new String[] { NetworkTopology.DEFAULT_RACK };
}
else {
racks = oneblock.racks;
}
// add this block to the rack --> block map
for (int j = 0; j < racks.length; j++) {
String rack = racks[j];
List<OneBlockInfo> blklist = rackToBlocks.get(rack);
if (blklist == null) {
blklist = new ArrayList<OneBlockInfo>();
rackToBlocks.put(rack, blklist);
}
blklist.add(oneblock);
if (!racks[j].equals(NetworkTopology.DEFAULT_RACK)) {
// Add this host to rackToNodes map
addHostToRack(rackToNodes, racks[j], oneblock.hosts[j]);
}
}
// add this block to the node --> block map
for (int j = 0; j < oneblock.hosts.length; j++) {
String node = oneblock.hosts[j];
List<OneBlockInfo> blklist = nodeToBlocks.get(node);
if (blklist == null) {
blklist = new ArrayList<OneBlockInfo>();
nodeToBlocks.put(node, blklist);
}
blklist.add(oneblock);
}
}
}
}
long getLength() {
return fileSize;
}
OneBlockInfo[] getBlocks() {
return blocks;
}
}
/**
* information about one block from the File System
*/
private static class OneBlockInfo {
Path onepath; // name of this file
long offset; // offset in file
long length; // length of this block
String[] hosts; // nodes on which this block resides
String[] racks; // network topology of hosts
OneBlockInfo(Path path, long offset, long len,
String[] hosts, String[] topologyPaths) {
this.onepath = path;
this.offset = offset;
this.hosts = hosts;
this.length = len;
assert (hosts.length == topologyPaths.length || topologyPaths.length == 0);
// if the file system does not have any rack information, then
// use dummy rack location.
if (topologyPaths.length == 0) {
topologyPaths = new String[hosts.length];
for (int i = 0; i < topologyPaths.length; i++) {
topologyPaths[i] = (new NodeBase(hosts[i],
NetworkTopology.DEFAULT_RACK)).toString();
}
}
// The topology paths have the host name included as the last
// component. Strip it.
this.racks = new String[topologyPaths.length];
for (int i = 0; i < topologyPaths.length; i++) {
this.racks[i] = (new NodeBase(topologyPaths[i])).getNetworkLocation();
}
}
}
@Override
protected BlockLocation[] getFileBlockLocations(
FileSystem fs, FileStatus stat) throws IOException {
return fs.getFileBlockLocations(stat, 0, stat.getLen());
}
private static void addHostToRack(HashMap<String, Set<String>> rackToNodes,
String rack, String host) {
Set<String> hosts = rackToNodes.get(rack);
if (hosts == null) {
hosts = new HashSet<String>();
rackToNodes.put(rack, hosts);
}
hosts.add(host);
}
private Set<String> getHosts(Set<String> racks) {
Set<String> hosts = new HashSet<String>();
for (String rack : racks) {
if (rackToNodes.containsKey(rack)) {
hosts.addAll(rackToNodes.get(rack));
}
}
return hosts;
}
public static class BasicCombineFileRecordReader extends RecordReader<LongWritable, Text> {
private static final Logger LOGGER = Logger.getLogger(BasicCombineFileRecordReader.class.getName());
private final LineRecordReader reader;
private int index = 0;
CombineFileSplit _split;
public BasicCombineFileRecordReader(CombineFileSplit split, TaskAttemptContext context, Integer idx) throws IOException {
LOGGER.debug("Called constructor for Combined Record Reader.");
index = idx;
reader = new LineRecordReader();
}
@Override
public void close() throws IOException {
reader.close();
}
@Override
public LongWritable getCurrentKey() throws IOException, InterruptedException {
return reader.getCurrentKey();
}
@Override
public Text getCurrentValue() throws IOException, InterruptedException {
return reader.getCurrentValue();
}
@Override
public float getProgress() throws IOException, InterruptedException {
return reader.getProgress();
}
@Override
public void initialize(InputSplit sp, TaskAttemptContext context) throws IOException, InterruptedException {
LOGGER.debug("Called initialize() for Combined Record Reader.");
LOGGER.debug("Split CLASS: " + sp.getClass().getName());
CombineFileSplit split = (CombineFileSplit) sp;
FileSplit fileSplit = new FileSplit(split.getPath(index), split.getOffset(index), split.getLength(index),
split.getLocations());
reader.initialize(fileSplit, context);
}
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
return reader.nextKeyValue();
}
}
/**
* Accept a path only if any one of filters given in the constructor do.
*/
private static class MultiPathFilter implements PathFilter {
private final List<PathFilter> filters;
public MultiPathFilter() {
this.filters = new ArrayList<PathFilter>();
}
public MultiPathFilter(List<PathFilter> filters) {
this.filters = filters;
}
public void add(PathFilter one) {
filters.add(one);
}
public boolean accept(Path path) {
for (PathFilter filter : filters) {
if (filter.accept(path)) {
return true;
}
}
return false;
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("[");
for (PathFilter f : filters) {
buf.append(f);
buf.append(",");
}
buf.append("]");
return buf.toString();
}
}
}
| [
"asi304@sapient.com"
] | asi304@sapient.com |
8f1c4af8ba381de6c2d48fb818abced1b12d0f80 | 90803399bed3ee89f1c7775e73d47a4b851c0766 | /src/main/java/com/github/terrasearch/jviewmodel/convert/IntegerValueConverter.java | 5fa1940fefc21cc6f3cc9aaa99331a2e4a6ac15b | [] | no_license | terrasearch/JViewModel | e85307ac2adc77de67a01b722ca36747218be586 | 6835588fafd7db145ae31a0da86d353492a7c056 | refs/heads/master | 2023-03-18T22:21:25.116922 | 2021-02-16T08:47:08 | 2021-02-16T08:47:08 | 331,586,176 | 0 | 0 | null | 2021-01-22T18:56:22 | 2021-01-21T10:02:05 | Java | UTF-8 | Java | false | false | 428 | java | package com.github.terrasearch.jviewmodel.convert;
import org.jetbrains.annotations.Nullable;
public class IntegerValueConverter implements IValueConverter<Integer> {
@Override
public Integer convertToValue(@Nullable final String value) throws NumberFormatException {
if (value != null && !value.isEmpty()) {
return Integer.parseInt(value);
} else {
return 0;
}
}
}
| [
"bertram.englert@gmx.at"
] | bertram.englert@gmx.at |
91c5896529feeeaf095dd8dd21daed2ff59a53d4 | 8782061b1e1223488a090f9f3f3b8dfe489e054a | /storeMongoDB/projects/ABCD/apache_kafka/main/1.java | f01bb3eb1f9a1e3653f73a5deb3c844d05aea379 | [] | no_license | ryosuke-ku/TCS_init | 3cb79a46aa217e62d8fff13d600f2a9583df986c | e1207d68bdc9d2f1eed63ef44a672b5a37b45633 | refs/heads/master | 2020-08-08T18:40:17.929911 | 2019-10-18T01:06:32 | 2019-10-18T01:06:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 867 | java | public void poll(long now) {
invokeCompletedOffsetCommitCallbacks();
if (subscriptions.partitionsAutoAssigned() && coordinatorUnknown()) {
ensureCoordinatorReady();
now = time.milliseconds();
}
if (needRejoin()) {
// due to a race condition between the initial metadata fetch and the initial rebalance,
// we need to ensure that the metadata is fresh before joining initially. This ensures
// that we have matched the pattern against the cluster's topics at least once before joining.
if (subscriptions.hasPatternSubscription())
client.ensureFreshMetadata();
ensureActiveGroup();
now = time.milliseconds();
}
pollHeartbeat(now);
maybeAutoCommitOffsetsAsync(now);
}
| [
"naist1020@gmail.com"
] | naist1020@gmail.com |
bd55243249f01c420ef4d1c3d69b0abfb578b593 | ed72af2ec124a7556fcea94210624735c2e4f31e | /src/main/java/com/clearbases/springbootjwt/model/UserDto.java | d288ef942dfcbb0e2199cbb9befdf07ac7a7cebd | [] | no_license | diegocmsantos/spring-boot-jwt | b46af8548494636fc82e2f892ed3e0061b950913 | 19668a157dba2610f0a222f66c74c7a0273d858c | refs/heads/master | 2020-04-14T10:07:27.284701 | 2019-01-02T01:10:20 | 2019-01-02T01:10:20 | 163,778,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | package com.clearbases.springbootjwt.model;
public class UserDto {
private int id;
private String firstName;
private String lastName;
private String username;
private String password;
private int age;
private int salary;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public int getSalary() {
return salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
}
| [
"diego_santos@atlantico.com.br"
] | diego_santos@atlantico.com.br |
f656444a7ef691440b504a39a31a0798fcc1c73f | 3dd39aa6510668f645f2fb5fe46474cd58cfc180 | /designpattern/src/main/java/com/robinzhou/designpattern/strategy/Duck.java | 0146d3b0e360f340d29a3f3b05160a3c1a11be81 | [] | no_license | fengguiyushao/study | 5a4e1b82194a437cd9453eb41803f40b15a8a767 | 269030b181fd544b7e9e8aad32ccd93250209067 | refs/heads/master | 2022-05-01T16:24:33.229105 | 2022-04-16T13:22:32 | 2022-04-16T13:22:32 | 39,480,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | package com.robinzhou.designpattern.strategy;
public abstract class Duck {
FlyBehavior flyBehavior;
QuackBehavior quackBehavior;
public Duck() {
}
public abstract void display();
public void performFly() {
flyBehavior.fly();
}
public void performQuack() {
quackBehavior.quack();
}
public void swim() {
System.out.println("all duck can swim");
}
public FlyBehavior getFlyBehavior() {
return flyBehavior;
}
public void setFlyBehavior(FlyBehavior flyBehavior) {
this.flyBehavior = flyBehavior;
}
public QuackBehavior getQuackBehavior() {
return quackBehavior;
}
public void setQuackBehavior(QuackBehavior quackBehavior) {
this.quackBehavior = quackBehavior;
}
}
| [
"fengguiyushao@gmail.com"
] | fengguiyushao@gmail.com |
299062ce3014a3d419f7cd81424a269ad66d26f3 | 41e0f45fb4ea0e3fc8e641e7e4f0ad840dface43 | /app/src/test/java/com/hw/corcow/samplemultitypelist/ExampleUnitTest.java | 45997014c8142fbf48f4ed33ae104c7770f067e3 | [] | no_license | henussii/SampleMultiTypeList | db9176848dd10596087acec2e5312a40652ba02e | bb08601630bdcebd20976cbef4c7737841d57e74 | refs/heads/master | 2022-05-03T12:11:56.955504 | 2015-10-06T02:19:53 | 2015-10-06T02:19:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package com.hw.corcow.samplemultitypelist;
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);
}
} | [
"cho7673@gmail.com"
] | cho7673@gmail.com |
43d2b0f67edfed35337c91634dcb890a2d122786 | d7045b3be26437db0d390dae56d2a82f02f1acac | /hawtdispatch/src/main/java/org/fusesource/hawtdispatch/internal/util/IntegerCounter.java | 373108fbfb09391ae196cfda263b4ba31cc3e516 | [
"Apache-2.0"
] | permissive | chirino/hawtdispatch | f035fbd690f311acdb2d5435bf7d82ad2c650f2b | 649d28f8c5371f6d136d327813caf03df81e4186 | refs/heads/master | 2023-07-13T06:41:35.394186 | 2012-02-13T16:07:35 | 2012-02-13T16:07:35 | 553,391 | 14 | 4 | null | null | null | null | UTF-8 | Java | false | false | 2,432 | java | /**
* Copyright (C) 2012 FuseSource, Inc.
* http://fusesource.com
*
* 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.fusesource.hawtdispatch.internal.util;
/**
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*
*/
public class IntegerCounter {
int counter;
public IntegerCounter() {
}
public IntegerCounter(int count) {
this.counter = count;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
IntegerCounter other = (IntegerCounter) obj;
if (counter != other.counter)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + counter;
return result;
}
public final int addAndGet(int delta) {
counter+=delta;
return counter;
}
public final int decrementAndGet() {
return --counter;
}
public final int get() {
return counter;
}
public final int getAndAdd(int delta) {
int rc = counter;
counter += delta;
return rc;
}
public final int getAndDecrement() {
int rc = counter;
counter --;
return rc;
}
public final int getAndIncrement() {
return counter++;
}
public final int getAndSet(int newValue) {
int rc = counter;
counter = newValue;
return rc;
}
public final int incrementAndGet() {
return ++counter;
}
public int intValue() {
return counter;
}
public final void set(int newValue) {
counter = newValue;
}
public String toString() {
return Integer.toString(counter);
}
}
| [
"hiram@hiramchirino.com"
] | hiram@hiramchirino.com |
a097dfeaaa9ccd2f45a19170e6c543c688edfd28 | 2fdeeb4aa1b9d45cdd758db13bfd1edf28c742d4 | /LevelUp/3_Tree/Traversals.java | 12ef5e7f66983ba1f51274637517a9d914b5304f | [] | no_license | Vipin1313/PepCoding_DSA | 30ef65c475e3b9ef63a9549d80361debddc04149 | 616d6561eb8755c158d91600f8d230f9bb9b42cf | refs/heads/main | 2023-07-06T16:03:51.544052 | 2021-08-12T08:58:41 | 2021-08-12T08:58:41 | 379,558,864 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,093 | java | import java.util.*;
public class Traversals {
public static class TreeNode {
TreeNode left = null;
TreeNode right = null;
int val = 0;
TreeNode(int val){
this.val = val;
}
}
public static TreeNode getRightMost(TreeNode node, TreeNode curr){
while(node.right!=null && node.right!=curr){
node = node.right;
}
return node;
}
public static ArrayList<Integer> morrisTraversal(TreeNode node) {
ArrayList<Integer> ans = new ArrayList<>();
TreeNode curr = node;
while (curr != null) {
TreeNode left = node.left;
if (left == null) {
ans.add(curr.val);
curr = curr.right;
} else {
TreeNode rightMost = getRightMost(left, curr);
if (rightMost.right == null) {
rightMost.right = curr;
curr = curr.left;
} else {
rightMost.right = null;
ans.add(curr.val);
curr = curr.right;
}
}
}
return ans;
}
public static void inorder(TreeNode root, ArrayList<Integer> ans){
if(root == null)
return;
inorder(root.left, ans);
ans.add(root.val);
inorder(root.right,ans);
}
public static boolean isValidBST_brute_force (TreeNode root) {
ArrayList<Integer> ans = new ArrayList<>();
inorder(root,ans);
for(int i = 0 ; i < ans.size()-1;i++){
if(ans.get(i) >= ans.get(i+1))
return false;
}
return true;
}
public static boolean isValidBST(TreeNode root, TreeNode[] prev) {
if(root == null)
return true;
if(!isValidBST(root.left,prev))
return false;
if(prev[0] != null && prev[0].val >= root.val)
return false;
prev[0] = root;
if(!isValidBST(root.right,prev))
return false;
return true;
}
public static boolean isValidBST_Recursive (TreeNode root) {
TreeNode[] prev =new TreeNode[1];
return isValidBST(root,prev);
}
public static boolean isValidBST_morris_traversal (TreeNode root) {
TreeNode curr = root;
long prev = -(long)1e18;
while(curr!=null){
TreeNode left = curr.left;
if(left == null){
if(prev >= curr.val)
return false;
prev = curr.val;
curr = curr.right;
}
else {
TreeNode rightMost = getRightMost(left,curr);
if(rightMost.right == null){
rightMost.right = curr;
curr = curr.left;
} else {
if(prev >= curr.val)
return false;
prev = curr.val;
curr = curr.right;
}
}
}
return false;
}
}
| [
"www.vipinkumar27@gmail.com"
] | www.vipinkumar27@gmail.com |
2d88c0cc6db5b855e222288ef01baa8c7bdecca3 | 909afcf0e060054fcbd6632832affbb6f74d128a | /src/home/practice/java/basics/TestClass.java | ec5b7b414c6cff1cb8f83d0e7bd6b77634714162 | [] | no_license | usmansaleemch/ocajp | 9cd7dc3ca235bd1d734f7139099d98652d757aac | 74097ea003ce4dd4dd377d344e857331e6106735 | refs/heads/master | 2021-01-22T18:24:44.745525 | 2017-08-27T01:05:49 | 2017-08-27T01:05:49 | 100,758,487 | 0 | 0 | null | 2017-08-21T10:28:48 | 2017-08-19T00:04:00 | Java | UTF-8 | Java | false | false | 162 | java | package home.practice.java.basics;
/**
* Test Class for accessing non package class
* 1. You can not import non-package class
*/
public class TestClass {
}
| [
"usaleemch@hotmail.com"
] | usaleemch@hotmail.com |
63242096832945aab448773e380da3da49542347 | cadd8ad00d61d6bcb713539bb9ad7aea6436f566 | /java/space-age/src/main/java/SpaceAge.java | db24acbf60f32e9e4c54fac7c65e12e103d3caa5 | [] | no_license | martymcflywa/exercism | ae9c237e6fa47cf2f71a12b0edba304c63d74522 | ce400aa66dc7c783598ba9d78aac5f76b648e50a | refs/heads/master | 2021-04-28T01:15:09.254614 | 2018-02-22T08:33:44 | 2018-02-22T08:36:00 | 122,271,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | class SpaceAge {
double seconds;
final double earthYearSeconds = 31557600;
SpaceAge(double seconds) {
this.seconds = seconds;
}
double getSeconds() {
return seconds;
}
double onEarth() {
return seconds / earthYearSeconds;
}
double onMercury() {
double mercuryPc = 0.2408467;
return seconds / (earthYearSeconds * mercuryPc);
}
double onVenus() {
double venusPc = 0.61519726;
return seconds / (earthYearSeconds * venusPc);
}
double onMars() {
double marsPc = 1.8808158;
return seconds / (earthYearSeconds * marsPc);
}
double onJupiter() {
double jupiterPc = 11.862615;
return seconds / (earthYearSeconds * jupiterPc);
}
double onSaturn() {
double saturnPc = 29.447498;
return seconds / (earthYearSeconds * saturnPc);
}
double onUranus() {
double uranusPc = 84.016846;
return seconds / (earthYearSeconds * uranusPc);
}
double onNeptune() {
double neptunePc = 164.79132;
return seconds / (earthYearSeconds * neptunePc);
}
}
| [
"doc.brown.83@gmail.com"
] | doc.brown.83@gmail.com |
04223fb3860930473f2274d642fe5412dcfbf777 | 8a03d9a5cdad9be9aa0517e8b7c653f69dc562a0 | /hystrix-travel/src/main/java/cn/homjie/hystrix/travel/multi/PrimarySecondaryCommand.java | 631871aed91b2ae6e49dba00a8bd155dda76be58 | [] | no_license | lemonguge/hystrix | c7940ab8428596f0766a2e96c045967c8b2714d1 | 8cb660c3a4af8d3b6fc3010f18d146f25fb069de | refs/heads/master | 2021-04-09T15:42:56.001894 | 2018-06-19T07:21:28 | 2018-06-19T07:21:28 | 125,481,597 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,346 | java | package cn.homjie.hystrix.travel.multi;
import com.netflix.config.DynamicBooleanProperty;
import com.netflix.config.DynamicPropertyFactory;
import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;
import com.netflix.hystrix.HystrixCommandKey;
import com.netflix.hystrix.HystrixThreadPoolKey;
import lombok.extern.slf4j.Slf4j;
import static com.netflix.hystrix.HystrixCommandProperties.ExecutionIsolationStrategy;
import static com.netflix.hystrix.HystrixCommandProperties.Setter;
/**
* @author jiehong.jh
* @date 2018/3/16
*/
@Slf4j
public class PrimarySecondaryCommand extends HystrixCommand<String> {
private final static DynamicBooleanProperty usePrimary = DynamicPropertyFactory.getInstance().getBooleanProperty(
"primarySecondary.usePrimary", true);
private final int id;
public PrimarySecondaryCommand(int id) {
super(
Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey("TravelGroup"))
.andCommandKey(HystrixCommandKey.Factory.asKey("PrimarySecondary"))
.andCommandPropertiesDefaults(
Setter().withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE)));
this.id = id;
}
@Override
protected String run() {
log.info("run command execute id= " + id);
if (usePrimary.get()) {
return new PrimaryCommand(id).execute();
} else {
return new SecondaryCommand(id).execute();
}
}
@Override
protected String getFallback() {
return "static-fallback-" + id;
}
@Override
protected String getCacheKey() {
return String.valueOf(id);
}
private static class PrimaryCommand extends HystrixCommand<String> {
private final int id;
private PrimaryCommand(int id) {
super(Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey("TravelGroup"))
.andCommandKey(HystrixCommandKey.Factory.asKey("Primary"))
.andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey("PrimaryPool"))
.andCommandPropertiesDefaults(
// we default to a 600ms timeout for primary
Setter().withExecutionTimeoutInMilliseconds(600)));
this.id = id;
}
@Override
protected String run() {
// perform expensive 'primary' service call
return "response from Primary-" + id;
}
}
private static class SecondaryCommand extends HystrixCommand<String> {
private final int id;
private SecondaryCommand(int id) {
super(Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey("TravelGroup"))
.andCommandKey(HystrixCommandKey.Factory.asKey("Secondary"))
.andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey("SecondaryPool"))
.andCommandPropertiesDefaults(
// we default to a 100ms timeout for secondary
Setter().withExecutionTimeoutInMilliseconds(100)));
this.id = id;
}
@Override
protected String run() {
// perform fast 'secondary' service call
return "response from Secondary-" + id;
}
}
}
| [
"jiehong.jh@alibaba-inc.com"
] | jiehong.jh@alibaba-inc.com |
9088503acfeff8fded8991d1861a149b64bb30ea | bd49625db02499b390c377d16baddb4fb54f6028 | /frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/IccFileHandler.java | 84125dc01b5e1d36264cdf81b6b86a2e4f086698 | [] | no_license | eudora-jia/android-p | c1d024ee2f1477687880b4c35077ffadc0f46437 | de4469604de639eb2df43660ae47371e18711c02 | refs/heads/master | 2020-07-06T21:23:31.588679 | 2019-08-02T09:23:48 | 2019-08-02T09:23:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,995 | java | /*
* Copyright (C) 2008 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.internal.telephony.uicc;
import android.os.*;
import com.android.internal.telephony.CommandsInterface;
import java.util.ArrayList;
/**
* {@hide}
*/
public abstract class IccFileHandler extends Handler implements IccConstants {
private static final boolean VDBG = false;
//from TS 11.11 9.1 or elsewhere
static protected final int COMMAND_READ_BINARY = 0xb0;
static protected final int COMMAND_UPDATE_BINARY = 0xd6;
static protected final int COMMAND_READ_RECORD = 0xb2;
static protected final int COMMAND_UPDATE_RECORD = 0xdc;
static protected final int COMMAND_SEEK = 0xa2;
static protected final int COMMAND_GET_RESPONSE = 0xc0;
// from TS 11.11 9.2.5
static protected final int READ_RECORD_MODE_ABSOLUTE = 4;
//***** types of files TS 11.11 9.3
static protected final int EF_TYPE_TRANSPARENT = 0;
static protected final int EF_TYPE_LINEAR_FIXED = 1;
static protected final int EF_TYPE_CYCLIC = 3;
//***** types of files TS 11.11 9.3
static protected final int TYPE_RFU = 0;
static protected final int TYPE_MF = 1;
static protected final int TYPE_DF = 2;
static protected final int TYPE_EF = 4;
// size of GET_RESPONSE for EF's
static protected final int GET_RESPONSE_EF_SIZE_BYTES = 15;
static protected final int GET_RESPONSE_EF_IMG_SIZE_BYTES = 10;
// Byte order received in response to COMMAND_GET_RESPONSE
// Refer TS 51.011 Section 9.2.1
static protected final int RESPONSE_DATA_RFU_1 = 0;
static protected final int RESPONSE_DATA_RFU_2 = 1;
static protected final int RESPONSE_DATA_FILE_SIZE_1 = 2;
static protected final int RESPONSE_DATA_FILE_SIZE_2 = 3;
static protected final int RESPONSE_DATA_FILE_ID_1 = 4;
static protected final int RESPONSE_DATA_FILE_ID_2 = 5;
static protected final int RESPONSE_DATA_FILE_TYPE = 6;
static protected final int RESPONSE_DATA_RFU_3 = 7;
static protected final int RESPONSE_DATA_ACCESS_CONDITION_1 = 8;
static protected final int RESPONSE_DATA_ACCESS_CONDITION_2 = 9;
static protected final int RESPONSE_DATA_ACCESS_CONDITION_3 = 10;
static protected final int RESPONSE_DATA_FILE_STATUS = 11;
static protected final int RESPONSE_DATA_LENGTH = 12;
static protected final int RESPONSE_DATA_STRUCTURE = 13;
static protected final int RESPONSE_DATA_RECORD_LENGTH = 14;
//***** Events
/** Finished retrieving size of transparent EF; start loading. */
static protected final int EVENT_GET_BINARY_SIZE_DONE = 4;
/** Finished loading contents of transparent EF; post result. */
static protected final int EVENT_READ_BINARY_DONE = 5;
/** Finished retrieving size of records for linear-fixed EF; now load. */
static protected final int EVENT_GET_RECORD_SIZE_DONE = 6;
/** Finished loading single record from a linear-fixed EF; post result. */
static protected final int EVENT_READ_RECORD_DONE = 7;
/** Finished retrieving record size; post result. */
static protected final int EVENT_GET_EF_LINEAR_RECORD_SIZE_DONE = 8;
/** Finished retrieving image instance record; post result. */
static protected final int EVENT_READ_IMG_DONE = 9;
/** Finished retrieving icon data; post result. */
static protected final int EVENT_READ_ICON_DONE = 10;
/** Finished retrieving size of record for EFimg now. */
static protected final int EVENT_GET_RECORD_SIZE_IMG_DONE = 11;
// member variables
public final CommandsInterface mCi;
protected final UiccCardApplication mParentApp;
protected final String mAid;
static class LoadLinearFixedContext {
int mEfid;
int mRecordNum, mRecordSize, mCountRecords;
boolean mLoadAll;
String mPath;
Message mOnLoaded;
ArrayList<byte[]> results;
LoadLinearFixedContext(int efid, int recordNum, Message onLoaded) {
mEfid = efid;
mRecordNum = recordNum;
mOnLoaded = onLoaded;
mLoadAll = false;
mPath = null;
}
LoadLinearFixedContext(int efid, int recordNum, String path, Message onLoaded) {
mEfid = efid;
mRecordNum = recordNum;
mOnLoaded = onLoaded;
mLoadAll = false;
mPath = path;
}
LoadLinearFixedContext(int efid, String path, Message onLoaded) {
mEfid = efid;
mRecordNum = 1;
mLoadAll = true;
mOnLoaded = onLoaded;
mPath = path;
}
LoadLinearFixedContext(int efid, Message onLoaded) {
mEfid = efid;
mRecordNum = 1;
mLoadAll = true;
mOnLoaded = onLoaded;
mPath = null;
}
}
/**
* Default constructor
*/
protected IccFileHandler(UiccCardApplication app, String aid, CommandsInterface ci) {
mParentApp = app;
mAid = aid;
mCi = ci;
}
public void dispose() {
}
//***** Public Methods
/**
* Load a record from a SIM Linear Fixed EF
*
* @param fileid EF id
* @param path Path of the EF on the card
* @param recordNum 1-based (not 0-based) record number
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is the byte[]
*
*/
public void loadEFLinearFixed(int fileid, String path, int recordNum, Message onLoaded) {
String efPath = (path == null) ? getEFPath(fileid) : path;
Message response
= obtainMessage(EVENT_GET_RECORD_SIZE_DONE,
new LoadLinearFixedContext(fileid, recordNum, efPath, onLoaded));
mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, efPath,
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, mAid, response);
}
/**
* Load a record from a SIM Linear Fixed EF
*
* @param fileid EF id
* @param recordNum 1-based (not 0-based) record number
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is the byte[]
*
*/
public void loadEFLinearFixed(int fileid, int recordNum, Message onLoaded) {
loadEFLinearFixed(fileid, getEFPath(fileid), recordNum, onLoaded);
}
/**
* Load a image instance record from a SIM Linear Fixed EF-IMG
*
* @param recordNum 1-based (not 0-based) record number
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is the byte[]
*
*/
public void loadEFImgLinearFixed(int recordNum, Message onLoaded) {
Message response = obtainMessage(EVENT_GET_RECORD_SIZE_IMG_DONE,
new LoadLinearFixedContext(IccConstants.EF_IMG, recordNum,
onLoaded));
mCi.iccIOForApp(COMMAND_GET_RESPONSE, IccConstants.EF_IMG,
getEFPath(IccConstants.EF_IMG), recordNum,
// MTK-START: SIM COMMON
READ_RECORD_MODE_ABSOLUTE, GET_RESPONSE_EF_SIZE_BYTES,
// MTK-END
null, null, mAid, response);
}
/**
* get record size for a linear fixed EF
*
* @param fileid EF id
* @param path Path of the EF on the card
* @param onLoaded ((AsnyncResult)(onLoaded.obj)).result is the recordSize[]
* int[0] is the record length int[1] is the total length of the EF
* file int[3] is the number of records in the EF file So int[0] *
* int[3] = int[1]
*/
public void getEFLinearRecordSize(int fileid, String path, Message onLoaded) {
String efPath = (path == null) ? getEFPath(fileid) : path;
Message response
= obtainMessage(EVENT_GET_EF_LINEAR_RECORD_SIZE_DONE,
new LoadLinearFixedContext(fileid, efPath, onLoaded));
mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, efPath,
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, mAid, response);
}
/**
* get record size for a linear fixed EF
*
* @param fileid EF id
* @param onLoaded ((AsnyncResult)(onLoaded.obj)).result is the recordSize[]
* int[0] is the record length int[1] is the total length of the EF
* file int[3] is the number of records in the EF file So int[0] *
* int[3] = int[1]
*/
public void getEFLinearRecordSize(int fileid, Message onLoaded) {
getEFLinearRecordSize(fileid, getEFPath(fileid), onLoaded);
}
/**
* Load all records from a SIM Linear Fixed EF
*
* @param fileid EF id
* @param path Path of the EF on the card
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is an ArrayList<byte[]>
*
*/
public void loadEFLinearFixedAll(int fileid, String path, Message onLoaded) {
String efPath = (path == null) ? getEFPath(fileid) : path;
Message response = obtainMessage(EVENT_GET_RECORD_SIZE_DONE,
new LoadLinearFixedContext(fileid, efPath, onLoaded));
mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, efPath,
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, mAid, response);
}
/**
* Load all records from a SIM Linear Fixed EF
*
* @param fileid EF id
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is an ArrayList<byte[]>
*
*/
public void loadEFLinearFixedAll(int fileid, Message onLoaded) {
loadEFLinearFixedAll(fileid, getEFPath(fileid), onLoaded);
}
/**
* Load a SIM Transparent EF
*
* @param fileid EF id
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is the byte[]
*
*/
public void loadEFTransparent(int fileid, Message onLoaded) {
Message response = obtainMessage(EVENT_GET_BINARY_SIZE_DONE,
fileid, 0, onLoaded);
mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(fileid),
0, 0, GET_RESPONSE_EF_SIZE_BYTES, null, null, mAid, response);
}
/**
* Load first @size bytes from SIM Transparent EF
*
* @param fileid EF id
* @param size
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is the byte[]
*
*/
public void loadEFTransparent(int fileid, int size, Message onLoaded) {
Message response = obtainMessage(EVENT_READ_BINARY_DONE,
fileid, 0, onLoaded);
mCi.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
0, 0, size, null, null, mAid, response);
}
/**
* Load a SIM Transparent EF-IMG. Used right after loadEFImgLinearFixed to
* retrive STK's icon data.
*
* @param fileid EF id
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is the byte[]
*
*/
public void loadEFImgTransparent(int fileid, int highOffset, int lowOffset,
int length, Message onLoaded) {
Message response = obtainMessage(EVENT_READ_ICON_DONE, fileid, 0,
onLoaded);
logd("IccFileHandler: loadEFImgTransparent fileid = " + fileid
+ " filePath = " + getEFPath(EF_IMG) + " highOffset = " + highOffset
+ " lowOffset = " + lowOffset + " length = " + length);
/* Per TS 31.102, for displaying of Icon, under
* DF Telecom and DF Graphics , EF instance(s) (4FXX,transparent files)
* are present. The possible image file identifiers (EF instance) for
* EF img ( 4F20, linear fixed file) are : 4F01 ... 4F05.
* It should be MF_SIM + DF_TELECOM + DF_GRAPHICS, same path as EF IMG
*/
mCi.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(EF_IMG),
highOffset, lowOffset, length, null, null, mAid, response);
}
/**
* Update a record in a linear fixed EF
* @param fileid EF id
* @param path Path of the EF on the card
* @param recordNum 1-based (not 0-based) record number
* @param data must be exactly as long as the record in the EF
* @param pin2 for CHV2 operations, otherwist must be null
* @param onComplete onComplete.obj will be an AsyncResult
* onComplete.obj.userObj will be a IccIoResult on success
*/
public void updateEFLinearFixed(int fileid, String path, int recordNum, byte[] data,
String pin2, Message onComplete) {
String efPath = (path == null) ? getEFPath(fileid) : path;
mCi.iccIOForApp(COMMAND_UPDATE_RECORD, fileid, efPath,
recordNum, READ_RECORD_MODE_ABSOLUTE, data.length,
IccUtils.bytesToHexString(data), pin2, mAid, onComplete);
}
/**
* Update a record in a linear fixed EF
* @param fileid EF id
* @param recordNum 1-based (not 0-based) record number
* @param data must be exactly as long as the record in the EF
* @param pin2 for CHV2 operations, otherwist must be null
* @param onComplete onComplete.obj will be an AsyncResult
* onComplete.obj.userObj will be a IccIoResult on success
*/
public void updateEFLinearFixed(int fileid, int recordNum, byte[] data,
String pin2, Message onComplete) {
mCi.iccIOForApp(COMMAND_UPDATE_RECORD, fileid, getEFPath(fileid),
recordNum, READ_RECORD_MODE_ABSOLUTE, data.length,
IccUtils.bytesToHexString(data), pin2, mAid, onComplete);
}
/**
* Update a transparent EF
* @param fileid EF id
* @param data must be exactly as long as the EF
*/
public void updateEFTransparent(int fileid, byte[] data, Message onComplete) {
mCi.iccIOForApp(COMMAND_UPDATE_BINARY, fileid, getEFPath(fileid),
0, 0, data.length,
IccUtils.bytesToHexString(data), null, mAid, onComplete);
}
//***** Abstract Methods
//***** Private Methods
// MTK-START: add on
protected void sendResult(Message response, Object result, Throwable ex) {
// MTK-END
if (response == null) {
return;
}
AsyncResult.forMessage(response, result, ex);
response.sendToTarget();
}
// MTK-START: add on
protected boolean processException(Message response, AsyncResult ar) {
// MTK-END
IccException iccException;
boolean flag = false;
IccIoResult result = (IccIoResult) ar.result;
if (ar.exception != null) {
sendResult(response, null, ar.exception);
flag = true;
} else {
iccException = result.getException();
if (iccException != null) {
sendResult(response, null, iccException);
flag = true;
}
}
return flag;
}
//***** Overridden from Handler
@Override
public void handleMessage(Message msg) {
AsyncResult ar;
IccIoResult result;
Message response = null;
String str;
LoadLinearFixedContext lc;
byte data[];
int size;
int fileid;
int recordSize[];
String path = null;
try {
switch (msg.what) {
case EVENT_GET_EF_LINEAR_RECORD_SIZE_DONE:
ar = (AsyncResult)msg.obj;
lc = (LoadLinearFixedContext) ar.userObj;
result = (IccIoResult) ar.result;
response = lc.mOnLoaded;
if (processException(response, (AsyncResult) msg.obj)) {
break;
}
data = result.payload;
if (TYPE_EF != data[RESPONSE_DATA_FILE_TYPE] ||
EF_TYPE_LINEAR_FIXED != data[RESPONSE_DATA_STRUCTURE]) {
throw new IccFileTypeMismatch();
}
recordSize = new int[3];
recordSize[0] = data[RESPONSE_DATA_RECORD_LENGTH] & 0xFF;
recordSize[1] = ((data[RESPONSE_DATA_FILE_SIZE_1] & 0xff) << 8)
+ (data[RESPONSE_DATA_FILE_SIZE_2] & 0xff);
recordSize[2] = recordSize[1] / recordSize[0];
sendResult(response, recordSize, null);
break;
case EVENT_GET_RECORD_SIZE_IMG_DONE:
case EVENT_GET_RECORD_SIZE_DONE:
ar = (AsyncResult)msg.obj;
lc = (LoadLinearFixedContext) ar.userObj;
result = (IccIoResult) ar.result;
response = lc.mOnLoaded;
if (processException(response, (AsyncResult) msg.obj)) {
loge("exception caught from EVENT_GET_RECORD_SIZE");
break;
}
data = result.payload;
path = lc.mPath;
if (TYPE_EF != data[RESPONSE_DATA_FILE_TYPE]) {
throw new IccFileTypeMismatch();
}
if (EF_TYPE_LINEAR_FIXED != data[RESPONSE_DATA_STRUCTURE]) {
throw new IccFileTypeMismatch();
}
lc.mRecordSize = data[RESPONSE_DATA_RECORD_LENGTH] & 0xFF;
size = ((data[RESPONSE_DATA_FILE_SIZE_1] & 0xff) << 8)
+ (data[RESPONSE_DATA_FILE_SIZE_2] & 0xff);
lc.mCountRecords = size / lc.mRecordSize;
if (lc.mLoadAll) {
lc.results = new ArrayList<byte[]>(lc.mCountRecords);
}
if (path == null) {
path = getEFPath(lc.mEfid);
}
mCi.iccIOForApp(COMMAND_READ_RECORD, lc.mEfid, path,
lc.mRecordNum,
READ_RECORD_MODE_ABSOLUTE,
lc.mRecordSize, null, null, mAid,
obtainMessage(EVENT_READ_RECORD_DONE, lc));
break;
case EVENT_GET_BINARY_SIZE_DONE:
ar = (AsyncResult)msg.obj;
response = (Message) ar.userObj;
result = (IccIoResult) ar.result;
if (processException(response, (AsyncResult) msg.obj)) {
break;
}
data = result.payload;
fileid = msg.arg1;
if (VDBG) {
logd(String.format("Contents of the Select Response for command %x: ", fileid)
+ IccUtils.bytesToHexString(data));
}
if (TYPE_EF != data[RESPONSE_DATA_FILE_TYPE]) {
throw new IccFileTypeMismatch();
}
if (EF_TYPE_TRANSPARENT != data[RESPONSE_DATA_STRUCTURE]) {
throw new IccFileTypeMismatch();
}
size = ((data[RESPONSE_DATA_FILE_SIZE_1] & 0xff) << 8)
+ (data[RESPONSE_DATA_FILE_SIZE_2] & 0xff);
mCi.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
0, 0, size, null, null, mAid,
obtainMessage(EVENT_READ_BINARY_DONE,
fileid, 0, response));
break;
case EVENT_READ_IMG_DONE:
case EVENT_READ_RECORD_DONE:
ar = (AsyncResult)msg.obj;
lc = (LoadLinearFixedContext) ar.userObj;
result = (IccIoResult) ar.result;
response = lc.mOnLoaded;
path = lc.mPath;
if (processException(response, (AsyncResult) msg.obj)) {
break;
}
if (!lc.mLoadAll) {
sendResult(response, result.payload, null);
} else {
lc.results.add(result.payload);
lc.mRecordNum++;
if (lc.mRecordNum > lc.mCountRecords) {
sendResult(response, lc.results, null);
} else {
if (path == null) {
path = getEFPath(lc.mEfid);
}
mCi.iccIOForApp(COMMAND_READ_RECORD, lc.mEfid, path,
lc.mRecordNum,
READ_RECORD_MODE_ABSOLUTE,
lc.mRecordSize, null, null, mAid,
obtainMessage(EVENT_READ_RECORD_DONE, lc));
}
}
break;
case EVENT_READ_BINARY_DONE:
case EVENT_READ_ICON_DONE:
ar = (AsyncResult)msg.obj;
response = (Message) ar.userObj;
result = (IccIoResult) ar.result;
if (processException(response, (AsyncResult) msg.obj)) {
break;
}
sendResult(response, result.payload, null);
break;
}} catch (Exception exc) {
if (response != null) {
sendResult(response, null, exc);
} else {
loge("uncaught exception" + exc);
}
}
}
/**
* Returns the root path of the EF file.
* i.e returns MasterFile + DFfile as a string.
* Ex: For EF_ADN on a SIM, it will return "3F007F10"
* This function handles only EFids that are common to
* RUIM, SIM, USIM and other types of Icc cards.
*
* @param efid of path to retrieve
* @return root path of the file.
*/
protected String getCommonIccEFPath(int efid) {
switch(efid) {
case EF_ADN:
case EF_FDN:
case EF_MSISDN:
case EF_SDN:
case EF_EXT1:
case EF_EXT2:
case EF_EXT3:
case EF_PSI:
return MF_SIM + DF_TELECOM;
case EF_ICCID:
case EF_PL:
return MF_SIM;
case EF_PBR:
// we only support global phonebook.
return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
case EF_IMG:
return MF_SIM + DF_TELECOM + DF_GRAPHICS;
}
return null;
}
protected abstract String getEFPath(int efid);
protected abstract void logd(String s);
protected abstract void loge(String s);
// MTK-START: add-on
public void loadEFLinearFixedAll(int fileid, Message onLoaded, boolean is7FFF) {
sendResult(onLoaded, null, new IccException("Default loadEFLinearFixedAll exception."));
}
public void loadEFLinearFixedAll(int fileid, int mode , Message onLoaded) {
sendResult(onLoaded, null, new IccException("Default loadEFLinearFixedAll exception."));
}
/**
* Load a SIM Transparent EF with path specified
*
* @param fileid EF id
* @param path EF path
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is the byte[]
*
*/
public void loadEFTransparent(int fileid, String path, Message onLoaded) {
sendResult(onLoaded, null, new IccException("Default loadEFTransparent exception."));
}
/**
* Update a transparent EF.
* @param fileid EF id
* @param path Path of the EF on the card
* @param data must be exactly as long as the EF
* @param onComplete onComplete.obj will be an AsyncResult
*/
public void updateEFTransparent(int fileid, String path, byte[] data, Message onComplete) {
sendResult(onComplete, null, new IccException("Default updateEFTransparent exception."));
}
/**
* Read a record from a SIM Linear Fixed EF
*
* @param fileid EF id
* @param recordNum 1-based (not 0-based) record number
* @param onLoaded
*
* ((AsyncResult)(onLoaded.obj)).result is the byte[]
*
*/
public void readEFLinearFixed(int fileid, int recordNum, int recordSize, Message onLoaded) {
sendResult(onLoaded, null, new IccException("Default readEFLinearFixed exception."));
}
/**
* select an EF file and get response
*
* @param fileid EF id
* @param onLoaded (EFResponseData)efData
*
*/
public void selectEFFile(int fileid, Message onLoaded) {
sendResult(onLoaded, null, new IccException("Default selectEFFile exception."));
}
// MTK-END
}
| [
"weiyawei@magcomm.cn"
] | weiyawei@magcomm.cn |
537181c1be790b2080d41af877920542afd70211 | 43508af029e7a27039fb4a56c24a33e9a26b1e99 | /cauli-test/src/main/java/org/cauli/junit/anno/Filter.java | a394dea52e05d61d23dbf693032d898a20d421eb | [] | no_license | celeskyking/cauli-parent | 164342cf59f5799909b8581c26868758492aa5f3 | fbb011759f802d30a0c0a97dc3651ef2b7c02ccb | refs/heads/master | 2023-03-21T16:22:39.702123 | 2015-07-06T13:27:19 | 2015-07-06T13:27:19 | 18,330,329 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package org.cauli.junit.anno;
import java.lang.annotation.*;
/**
* Created by celeskyking on 14-3-1
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
public @interface Filter {
String feature() default "default";
String release() default "";
int runLevel() default 2;
}
| [
"tianqing.wang@qunar.com"
] | tianqing.wang@qunar.com |
1bf0178f4c1459acc8d00cd91992edcda2ef3c7e | 7ec0aac0ffb76be661ec1303020c794500e3cca1 | /src/main/java/com/smalls0098/file/utils/ArrayUtil.java | 2f2ca464ba7d55fe2d05a36e6163d274203652ca | [
"Apache-2.0"
] | permissive | smalls0098/fast-file | d09973533caeb3936a43585eeddb237f5efd4d1e | c92499c55302bd49ab64c0c84a3a137a4e9a00e1 | refs/heads/master | 2022-12-13T11:07:37.418658 | 2020-09-18T11:51:18 | 2020-09-18T11:51:18 | 295,983,926 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 490 | java | package com.smalls0098.file.utils;
import java.util.Arrays;
/**
* 努力努力再努力!!!!!
* Author:smalls
* Github:https://github.com/smalls0098
* Email:smalls0098@gmail.com
* Date:2020/9/15 - 9:58
**/
public class ArrayUtil {
public static boolean arrayContainStr(final String[] arrays, final String str) {
if (arrays == null || arrays.length == 0) {
return true;
}
return Arrays.asList(arrays).contains(str);
}
}
| [
"smalls0098@gmail.com"
] | smalls0098@gmail.com |
7b39f03cb8c54b233a1af258fbf5da07e87cab10 | 4f009cbeac6473cb9a196b62c4d84d45d741f912 | /01.Java/Unidad 4/Leccion 3/EjercicioBurbuja/src/ejercicioburbuja/EjercicioBurbuja.java | c5b39ed6490769c21ec36ea81d191b5fb19f1554 | [] | no_license | JavierSLX/ConnectSocialNetworks | 970a4610ef1fde8d98004f4ac3dcedeb6fd6cd52 | ad35144d014fc72f9e06f4c46f2b5e3e86dd6751 | refs/heads/master | 2020-03-23T18:30:55.773890 | 2018-07-23T01:54:28 | 2018-07-23T01:54:28 | 141,914,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,538 | 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 ejercicioburbuja;
import java.util.Arrays;
import javax.swing.JOptionPane;
/**
*
* @author JavierSLX
*/
public class EjercicioBurbuja
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
int[] arreglo;
int n = 0;
try
{
n = Integer.parseInt(JOptionPane.showInputDialog(null, "Coloque el valor de N"));
} catch (Exception e)
{
JOptionPane.showMessageDialog(null, "Valor erroneo");
}
arreglo = new int[n];
for (int i = 0; i < arreglo.length; i++)
arreglo[i] = numeroRandom(100);
JOptionPane.showMessageDialog(null, Arrays.toString(arreglo));
burbuja(arreglo);
JOptionPane.showMessageDialog(null, Arrays.toString(arreglo));
}
private static int numeroRandom(int limite)
{
return (int) (Math.random() * limite);
}
private static void burbuja(int[] arreglo)
{
for (int i = 1; i < arreglo.length; i++)
for (int j = 0; j < arreglo.length-i; j++)
if (arreglo[j] > arreglo[j+1])
{
int aux = arreglo[j];
arreglo[j] = arreglo[j+1];
arreglo[j+1] = aux;
}
}
}
| [
"jserranolule@gmail.com"
] | jserranolule@gmail.com |
d366d6f437fd8b3ab9092196dd5ef1b604f57eb0 | 0fe83575bc53de5049b60bfb5f9dc340fd3bf456 | /app/src/main/java/com/example/gifo/testapplication/local/LocalContext.java | cd1de7a10a89af8e3f1f9e8fd97d3e5490c6a41b | [] | no_license | MrClaus/TestApplication | 79013dc11d77f1553878fcf8e83bf3e50160b1a0 | ad91a469ab243687099dd4044d9d86ec03a2a160 | refs/heads/master | 2021-06-02T07:43:26.875402 | 2019-11-13T14:14:11 | 2019-11-13T14:14:11 | 129,257,038 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,996 | java | package com.example.gifo.testapplication.local;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Configuration;
import android.os.Build;
import java.util.Locale;
/**
* Created by Muhammad on 07/01/2017.
* (https://gist.github.com/muhammad-naderi/)
*/
public class LocalContext extends ContextWrapper {
public LocalContext(Context base) {
super(base);
}
@SuppressWarnings("deprecation")
public static ContextWrapper wrap(Context context, String language) {
Configuration config = context.getResources().getConfiguration();
if (!language.equals("")) {
Locale locale = new Locale(language);
Locale.setDefault(locale);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
setSystemLocale(config, locale);
} else {
setSystemLocaleLegacy(config, locale);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
config.setLayoutDirection(locale);
context = context.createConfigurationContext(config);
} else {
context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics());
}
}
return new LocalContext(context);
}
@SuppressWarnings("deprecation")
public static Locale getSystemLocaleLegacy(Configuration config){
return config.locale;
}
@TargetApi(Build.VERSION_CODES.N)
public static Locale getSystemLocale(Configuration config){
return config.getLocales().get(0);
}
@SuppressWarnings("deprecation")
public static void setSystemLocaleLegacy(Configuration config, Locale locale){
config.locale = locale;
}
@TargetApi(Build.VERSION_CODES.N)
public static void setSystemLocale(Configuration config, Locale locale){
config.setLocale(locale);
}
}
| [
"girosoft@mail.ru"
] | girosoft@mail.ru |
f0b8fc4f52edbaf032378b99bd1387c0c9f6915a | b6618b68bcfde72a71cd50bc22b76f34e3e528c0 | /tests/org.jboss.tools.forge.ui.bot.test/src/org/jboss/tools/forge/ui/bot/test/util/DatabaseUtils.java | eadae72e4f2c9b6bc6f6b23066608c6bb189c862 | [] | no_license | ibuziuk/jbosstools-integration-tests | 55549324de5070d27255a88f369993c95a07484d | c832194438546d43f79abebe603d718583472582 | refs/heads/master | 2021-01-24T05:05:33.995094 | 2015-08-20T15:26:26 | 2015-08-31T12:20:50 | 41,677,117 | 1 | 0 | null | 2015-08-31T13:33:43 | 2015-08-31T13:33:43 | null | UTF-8 | Java | false | false | 2,823 | java | package org.jboss.tools.forge.ui.bot.test.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
/**
* Utility class for manipulating with test database
*
* @author Jan Richter
*
*/
public class DatabaseUtils {
private static final Logger LOG = Logger.getLogger(DatabaseUtils.class.getName());
private static Process sakila;
/**
* Start sakila db located in a set folder
*
* @param dbFolder
* folder the database is located in
*/
public static void runSakilaDB(String dbFolder) {
try {
String path = new File(dbFolder).getCanonicalPath();
ProcessBuilder pb = new ProcessBuilder("bash", "-c", "cd " + path + ";./runh2.sh");
sakila = pb.start();
// check if the process really started
long startTime = System.currentTimeMillis();
boolean isAlive = false;
while (System.currentTimeMillis() - startTime < 10000) {
if (isRunning(sakila)) {
isAlive = true;
break;
}
Thread.sleep(200);
}
if (!isAlive) {
throw new RuntimeException("Sakila Database startup failed");
}
LOG.info("Sakila DB started");
} catch (IOException | InterruptedException e) {
LOG.warning("An error occured starting sakila DB");
throw new RuntimeException(e);
}
}
/**
* Stop the sakila database instance if it exists
*/
public static void stopSakilaDB() {
// destroy the process itself
if (sakila != null) {
sakila.destroy();
sakila = null;
try {
List<String> processes = new ArrayList<String>();
Process p = Runtime.getRuntime().exec("jps -l");
p.waitFor();
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = input.readLine()) != null) {
processes.add(line);
}
input.close();
//and kill the java process it created
for (String process : processes) {
if (process.contains("org.h2.tools.Server")) {
int pid = Integer.parseInt(process.split(" ")[0]);
Process proc = null;
if (System.getProperty("os.name").toLowerCase().contains("win")) {
proc = Runtime.getRuntime().exec("taskkill /f /pid " + pid);
} else {
proc = Runtime.getRuntime().exec("kill -9 " + pid);
}
proc.waitFor();
break;
}
}
} catch (IOException | InterruptedException e) {
LOG.warning("An error occured stopping Sakila DB");
throw new RuntimeException(e);
}
} else {
LOG.warning("Sakila DB is not running");
}
}
private static boolean isRunning(Process process) {
try {
process.exitValue();
return false;
} catch (IllegalThreadStateException e) {
return true;
}
}
}
| [
"jrichter@redhat.com"
] | jrichter@redhat.com |
c319d4757ccd85227ebd92eb23277f5376fdcabb | 1ca2ac2593df483a7a79dddff9e0d1d2ff68ada8 | /app/src/androidTest/java/com/example/facebooklogindemo/ExampleInstrumentedTest.java | a0f3a7d89034c138e6249314f10d0ba4657c1f39 | [] | no_license | Vasantikaradage/FaceBookLogin | 8f4147096a4a5fe57cc03eda4f14e051d30bbb05 | a79bf679212edfbce833496b56f4c435f402c386 | refs/heads/master | 2020-12-26T16:52:44.600514 | 2020-02-01T06:21:30 | 2020-02-01T06:21:30 | 237,571,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 729 | java | package com.example.facebooklogindemo;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.facebooklogindemo", appContext.getPackageName());
}
}
| [
"pocketschoolapp@gmail.com"
] | pocketschoolapp@gmail.com |
e0c01c1ec0c1f62e0bdf1c6f7033103306d4f16c | 5faa49553218e2a958b3a726c479f6f5e3c9098e | /JYL-parent/JYL-Util/src/main/java/com/jyl/util/poi/entity/ExcelImportEntity.java | 4d3b6c42dc8807048c481ad8993003098304216f | [] | no_license | YuJhon/JYLFrame | 7bb2cc52dd9667e18e4a8ed4a765d6742cd05804 | 0be8c237533f898247cf4fa1f5d806d65b58b764 | refs/heads/master | 2021-05-04T10:44:59.310903 | 2017-10-20T09:37:23 | 2017-10-20T09:37:23 | 55,053,565 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,667 | java | package com.jyl.util.poi.entity;
import java.lang.reflect.Method;
import java.util.List;
/**
* <p>功能描述:</br> excel 导入工具类,对cell类型做映射</p>
*
* @className ExcelImportEntity
* @author jiangyu
* @date 2016年4月3日 下午5:19:11
* @version v1.0
*/
public class ExcelImportEntity
{
/**
* 对应exportName
*/
private String name;
/**
* 对应exportType
*/
private int type;
/**
* 对应 Collection NAME
*/
private String collectionName;
/**
* 保存图片的地址
*/
private String saveUrl;
/**
* 保存图片的类型,1是文件,2是数据库
*/
private int saveType;
/**
* 对应exportType
*/
private String classType;
/**
* 导入日期格式
*/
private String importFormat;
/**
* set 和convert 合并
*/
private Method setMethod;
private List<Method> setMethods;
private List<ExcelImportEntity> list;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public int getType()
{
return type;
}
public void setType(int type)
{
this.type = type;
}
public List<ExcelImportEntity> getList()
{
return list;
}
public void setList(List<ExcelImportEntity> list)
{
this.list = list;
}
public Method getSetMethod()
{
return setMethod;
}
public void setSetMethod(Method setMethod)
{
this.setMethod = setMethod;
}
public List<Method> getSetMethods()
{
return setMethods;
}
public void setSetMethods(List<Method> setMethods)
{
this.setMethods = setMethods;
}
public String getSaveUrl()
{
return saveUrl;
}
public void setSaveUrl(String saveUrl)
{
this.saveUrl = saveUrl;
}
public String getClassType()
{
return classType;
}
public void setClassType(String classType)
{
this.classType = classType;
}
public String getCollectionName()
{
return collectionName;
}
public void setCollectionName(String collectionName)
{
this.collectionName = collectionName;
}
public int getSaveType()
{
return saveType;
}
public void setSaveType(int saveType)
{
this.saveType = saveType;
}
public String getImportFormat()
{
return importFormat;
}
public void setImportFormat(String importFormat)
{
this.importFormat = importFormat;
}
}
| [
"704351844@qq.com"
] | 704351844@qq.com |
cfd4169ff07bdea43f08423de1486500e3cbcb5c | e1ea5309292e7bfae3a4a25fb72842a8e5ba559d | /src/main/java/io/swagger/client/JSON.java | 2c8555e96c04121450466ca5ea28f6aaeda581ff | [
"Apache-2.0"
] | permissive | wipobp/BranchFinderAPI | 0f17c3fd6cf2607554ffad1957249f2963878248 | a314727360f1b1dda2f36de47cac8f7c82a509fa | refs/heads/master | 2022-05-28T23:43:38.337731 | 2019-06-14T11:15:35 | 2019-06-14T11:15:35 | 191,930,272 | 0 | 0 | Apache-2.0 | 2022-05-20T21:00:32 | 2019-06-14T11:15:34 | Java | UTF-8 | Java | false | false | 6,893 | java | /**
* BranchFinderAPI
* Find nearest Branch
*
* OpenAPI spec version: 1.1.1
* Contact: contact@wipro.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* 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 io.swagger.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.io.StringReader;
import java.lang.reflect.Type;
import java.util.Date;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
public class JSON {
private ApiClient apiClient;
private Gson gson;
/**
* JSON constructor.
*
* @param apiClient An instance of ApiClient
*/
public JSON(ApiClient apiClient) {
this.apiClient = apiClient;
gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateAdapter(apiClient))
.registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter())
.registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter())
.create();
}
/**
* Get Gson.
*
* @return Gson
*/
public Gson getGson() {
return gson;
}
/**
* Set Gson.
*
* @param gson Gson
*/
public void setGson(Gson gson) {
this.gson = gson;
}
/**
* Serialize the given Java object into JSON string.
*
* @param obj Object
* @return String representation of the JSON
*/
public String serialize(Object obj) {
return gson.toJson(obj);
}
/**
* Deserialize the given JSON string to Java object.
*
* @param <T> Type
* @param body The JSON string
* @param returnType The type to deserialize inot
* @return The deserialized Java object
*/
@SuppressWarnings("unchecked")
public <T> T deserialize(String body, Type returnType) {
try {
if (apiClient.isLenientOnJson()) {
JsonReader jsonReader = new JsonReader(new StringReader(body));
// see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean)
jsonReader.setLenient(true);
return gson.fromJson(jsonReader, returnType);
} else {
return gson.fromJson(body, returnType);
}
} catch (JsonParseException e) {
// Fallback processing when failed to parse JSON form response body:
// return the response body string directly for the String return type;
// parse response body into date or datetime for the Date return type.
if (returnType.equals(String.class))
return (T) body;
else if (returnType.equals(Date.class))
return (T) apiClient.parseDateOrDatetime(body);
else throw(e);
}
}
}
class DateAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> {
private final ApiClient apiClient;
/**
* Constructor for DateAdapter
*
* @param apiClient Api client
*/
public DateAdapter(ApiClient apiClient) {
super();
this.apiClient = apiClient;
}
/**
* Serialize
*
* @param src Date
* @param typeOfSrc Type
* @param context Json Serialization Context
* @return Json Element
*/
@Override
public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) {
if (src == null) {
return JsonNull.INSTANCE;
} else {
return new JsonPrimitive(apiClient.formatDatetime(src));
}
}
/**
* Deserialize
*
* @param json Json element
* @param date Type
* @param typeOfSrc Type
* @param context Json Serialization Context
* @return Date
* @throw JsonParseException if fail to parse
*/
@Override
public Date deserialize(JsonElement json, Type date, JsonDeserializationContext context) throws JsonParseException {
String str = json.getAsJsonPrimitive().getAsString();
try {
return apiClient.parseDateOrDatetime(str);
} catch (RuntimeException e) {
throw new JsonParseException(e);
}
}
}
/**
* Gson TypeAdapter for Joda DateTime type
*/
class DateTimeTypeAdapter extends TypeAdapter<DateTime> {
private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime();
@Override
public void write(JsonWriter out, DateTime date) throws IOException {
if (date == null) {
out.nullValue();
} else {
out.value(formatter.print(date));
}
}
@Override
public DateTime read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String date = in.nextString();
return formatter.parseDateTime(date);
}
}
}
/**
* Gson TypeAdapter for Joda LocalDate type
*/
class LocalDateTypeAdapter extends TypeAdapter<LocalDate> {
private final DateTimeFormatter formatter = ISODateTimeFormat.date();
@Override
public void write(JsonWriter out, LocalDate date) throws IOException {
if (date == null) {
out.nullValue();
} else {
out.value(formatter.print(date));
}
}
@Override
public LocalDate read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String date = in.nextString();
return formatter.parseLocalDate(date);
}
}
}
| [
"singhalok392003@gmail.com"
] | singhalok392003@gmail.com |
c41761c940511d8152b861086543904d0c5a29b2 | 371e9a1498582cd95f16beec22021b2670f06fbc | /hotel management/projectTemplate/Backup/Project/M3/hotelproject/src/main/java/com/bitproject/controller/RoleController.java | 2173565f6c38606655a78d8371a9a9a056a3a35b | [] | no_license | rm1995/HRPM-Java | 951b038e1b53cde3f84f0225e85c441982f716f2 | 7350aa213ec51ecc67346424ff870f6081ec61ad | refs/heads/master | 2023-07-19T21:17:27.269562 | 2021-09-05T16:47:07 | 2021-09-05T16:47:07 | 403,356,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 717 | java | package com.bitproject.controller;
import com.bitproject.model.Role;
import com.bitproject.repository.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RequestMapping(value = "/role")
@RestController
public class RoleController {
@Autowired
private RoleRepository dao;
@GetMapping(value = "/list", produces = "application/json")
public List<Role> gender() {
return dao.list();
}
}
| [
"global.madushani@gmail.com"
] | global.madushani@gmail.com |
0bf62cd5faab38e0205c46e7d19e43d8984bc434 | d7c5121237c705b5847e374974b39f47fae13e10 | /airspan.netspan/src/main/java/Netspan/NBI_15_5/Status/LteSonPciGetResult.java | cba08ec8633e57ffcb646260a1bf5d8a2aca6da4 | [] | no_license | AirspanNetworks/SWITModules | 8ae768e0b864fa57dcb17168d015f6585d4455aa | 7089a4b6456621a3abd601cc4592d4b52a948b57 | refs/heads/master | 2022-11-24T11:20:29.041478 | 2020-08-09T07:20:03 | 2020-08-09T07:20:03 | 184,545,627 | 1 | 0 | null | 2022-11-16T12:35:12 | 2019-05-02T08:21:55 | Java | UTF-8 | Java | false | false | 5,028 | java |
package Netspan.NBI_15_5.Status;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for LteSonPciGetResult complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="LteSonPciGetResult">
* <complexContent>
* <extension base="{http://Airspan.Netspan.WebServices}WsResponse">
* <sequence>
* <element name="NodeResult" type="{http://Airspan.Netspan.WebServices}NodeStatusResultValues"/>
* <element name="Name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="NodeId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="PciStatus" type="{http://Airspan.Netspan.WebServices}ManualAutomaticValues" minOccurs="0"/>
* <element name="Cell" type="{http://Airspan.Netspan.WebServices}LtePciStatusWs" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LteSonPciGetResult", propOrder = {
"nodeResult",
"name",
"nodeId",
"pciStatus",
"cell"
})
public class LteSonPciGetResult
extends WsResponse
{
@XmlElement(name = "NodeResult", required = true)
@XmlSchemaType(name = "string")
protected NodeStatusResultValues nodeResult;
@XmlElement(name = "Name")
protected String name;
@XmlElement(name = "NodeId")
protected String nodeId;
@XmlElementRef(name = "PciStatus", namespace = "http://Airspan.Netspan.WebServices", type = JAXBElement.class, required = false)
protected JAXBElement<ManualAutomaticValues> pciStatus;
@XmlElement(name = "Cell")
protected List<LtePciStatusWs> cell;
/**
* Gets the value of the nodeResult property.
*
* @return
* possible object is
* {@link NodeStatusResultValues }
*
*/
public NodeStatusResultValues getNodeResult() {
return nodeResult;
}
/**
* Sets the value of the nodeResult property.
*
* @param value
* allowed object is
* {@link NodeStatusResultValues }
*
*/
public void setNodeResult(NodeStatusResultValues value) {
this.nodeResult = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the nodeId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNodeId() {
return nodeId;
}
/**
* Sets the value of the nodeId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNodeId(String value) {
this.nodeId = value;
}
/**
* Gets the value of the pciStatus property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link ManualAutomaticValues }{@code >}
*
*/
public JAXBElement<ManualAutomaticValues> getPciStatus() {
return pciStatus;
}
/**
* Sets the value of the pciStatus property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link ManualAutomaticValues }{@code >}
*
*/
public void setPciStatus(JAXBElement<ManualAutomaticValues> value) {
this.pciStatus = value;
}
/**
* Gets the value of the cell property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the cell property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCell().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LtePciStatusWs }
*
*
*/
public List<LtePciStatusWs> getCell() {
if (cell == null) {
cell = new ArrayList<LtePciStatusWs>();
}
return this.cell;
}
}
| [
"build.Airspan.com"
] | build.Airspan.com |
2378ce052af8d153fcc3ef1ac4698f14e6186a1c | 27ad432974ccd7f24b03500d7124e650e9fdd6c6 | /src/main/java/ir/torshizi/upload_with_base64/exception_handling/output_format/ApiValidationError.java | 5a41353475eb7a0a06f736c88e1405f647f74f3a | [] | no_license | alitorshizi/upload_with_base64 | 38e50788be5819101fc755725d3a77b70cee0ee7 | c694dc836f2c763ec2336f8d23d6691f100cee3f | refs/heads/master | 2023-01-25T01:10:21.418059 | 2020-12-06T14:15:05 | 2020-12-06T14:15:05 | 319,049,096 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 700 | java | package ir.torshizi.upload_with_base64.exception_handling.output_format;
import ir.torshizi.upload_with_base64.exception_handling.exceptions.MainException;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@AllArgsConstructor
public class ApiValidationError extends ApiSubError {
private String object;
private String field;
private Object rejectedValue;
private String message;
ApiValidationError(String object, String message) {
this.object = object;
this.message = message;
}
public String getObject() {
return MainException.getClassName(this.object);
}
}
| [
"torshizi.a@gmail.com"
] | torshizi.a@gmail.com |
bbe190c4eb2ff70f5872afc480ee677062697756 | 78393b497a401ae6db55827d8adfca5b736147e9 | /AULive/src/main/java/com/ilikezhibo/ggzb/step/FaXiangMuStep2Activity.java | 8604af344dbba6e0945c1c4994fd9d5694e4f952 | [] | no_license | ggzb/ggzb | 940d2818df187666bdda302484bc8ef4f629bcf2 | da48e32f90e2b2ba03f6abdfca8deda1a2ae1fa5 | refs/heads/master | 2020-03-08T15:58:00.691563 | 2018-04-05T16:39:31 | 2018-04-05T16:39:31 | 128,226,510 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,646 | java | package com.ilikezhibo.ggzb.step;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import com.jack.utils.UrlHelper;
import com.ilikezhibo.ggzb.BaseFragmentActivity;
import com.ilikezhibo.ggzb.R;
public class FaXiangMuStep2Activity extends BaseFragmentActivity {
private FaXiangMuStep2Fragment map;
private FragmentManager manager;
@Override
protected void setContentView() {
setContentView(R.layout.activity_zhaofang);
String id=getIntent().getStringExtra(FaXiangMuStep1Activity.PROJECT_ID);
map = new FaXiangMuStep2Fragment(id,UrlHelper.URL_HEAD + "/reg/job");
manager = getSupportFragmentManager();
manager.beginTransaction().replace(R.id.map, map, "map_fragment")
.commit();
}
@Override
protected void initializeViews() {
}
@Override
protected void initializeData() {
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
}
@Override
protected void onRestart() {
super.onRestart();
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onDestroy() {
manager.getFragments().clear();
super.onDestroy();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
}
| [
"sun_speed@163.com"
] | sun_speed@163.com |
55874e5aff26ee2391e6d97852a49f96bcba9180 | 7946e5f0f351d16b41273b502d7e3fb9bf6d0dc7 | /simple-activiti-hellow/src/test/java/com/renker/junit/LeaveTest.java | 9358b633db9974ac45b4cdc042372e89ff8ac259 | [] | no_license | renker/simple-activiti | a0bf5d3ef7a7ee248f8b161714e966b14879dab2 | 0edbbbfdcd0909fb7725a8463487d0d9b0f602ea | refs/heads/master | 2021-01-23T05:04:10.019603 | 2017-09-30T06:50:33 | 2017-09-30T06:50:33 | 102,456,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,455 | java | package com.renker.junit;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.spring.ProcessEngineFactoryBean;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:spring.xml"})
public class LeaveTest {
@Resource
private RepositoryService repositoryService;
@Resource
private RuntimeService runtimeService;
@Resource
private TaskService taskService;
@Resource
private HistoryService historyService;
@Resource
private ProcessEngineFactoryBean processEngineFactoryBean;
@Test
public void sayhelloleave(){
List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().listPage(0, 100);
for (ProcessDefinition processDefinition : processDefinitions) {
repositoryService.deleteDeployment(processDefinition.getDeploymentId());
}
// 部署流程定义文件
repositoryService.createDeployment().addClasspathResource("com/renker/activiti/hellow/leave.bpmn").deploy();
// 获取流程定义
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
System.out.println(processDefinition.getKey());
// 启动流程并返回流程实例
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("leave");
System.out.println(processInstance.getId()+" "+processInstance.getProcessDefinitionId());
}
@Test
public void SayHelloToLeave(){
List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().listPage(0, 100);
for (ProcessDefinition processDefinition : processDefinitions) {
repositoryService.deleteDeployment(processDefinition.getDeploymentId());
}
// 部署流程定义文件
repositoryService.createDeployment().addClasspathResource("com/renker/activiti/hellow/SayHellowToLeave.bpmn").deploy();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
System.out.println(processDefinition.getKey());
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("applyUser", "employee1");
variables.put("days", 3);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("SayHelloToLeave", variables);
Task taskOfDeptLeader = taskService.createTaskQuery().taskCandidateGroup("deptLeader").singleResult();
System.out.println("领导审批 \t"+taskOfDeptLeader.getName());
taskService.claim(taskOfDeptLeader.getId(), "leaderUser");
variables.clear();
variables.put("approved", true);
taskService.complete(taskOfDeptLeader.getId(), variables);
long count = historyService.createHistoricProcessInstanceQuery().finished().count();
System.out.println("完成数量 "+count);
}
}
| [
"caishenchen@163.com"
] | caishenchen@163.com |
5a0dd420e34de003a1447baf7fb4e61a51aa42e6 | da9f998ef10638a356482d9154e0e5951d820c7b | /app/src/main/java/com/example/duan/chao/DCZ_authenticator/testability/SharedPreferencesRenamingDelegatingContext.java | f3c5fc46cf27ccd7a1e636ac89958a65095aaa25 | [] | no_license | MakeysD/Maksys | 17540e19a2711bb963fb51c5a919611f3a52a19f | c6c4c252644bd6190c1de1d4c9d89fc3365266b5 | refs/heads/master | 2021-09-21T03:25:55.305248 | 2018-08-17T03:01:52 | 2018-08-17T03:01:52 | 143,666,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,433 | java | /*
* Copyright 2012 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.duan.chao.DCZ_authenticator.testability;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.SharedPreferences;
/**
* {@link ContextWrapper} that prefixes shared preference file names with the provided prefix and
* passes all other invocations through unmodified to the delegate {@link Context}.
*
* @author klyubin@google.com (Alex Klyubin)
*/
public class SharedPreferencesRenamingDelegatingContext extends ContextWrapper {
private final String mPrefix;
public SharedPreferencesRenamingDelegatingContext(Context delegate, String prefix) {
super(delegate);
mPrefix = prefix;
}
@Override
public SharedPreferences getSharedPreferences(String name, int mode) {
return super.getSharedPreferences(mPrefix + name, mode);
}
}
| [
"857999639@qq.com"
] | 857999639@qq.com |
2b4d8a5b24eb88abb5abdc38842a5209b480a76a | ed0feac1cadc64a49d4f891d608e60ef4f45c43b | /rest-api/src/test/java/gov/cms/qpp/conversion/api/RestApiApplicationTest.java | 380e8c34aeb43c7ac05235bc92474a3a43a7f0e5 | [
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | Gramos30/qpp-conversion-tool | 80fd9688319bbc506ddc6fedde053747ff13e826 | cb07b9923cb12a7a93e08babdaf870b9b4839a21 | refs/heads/master | 2020-03-08T04:20:37.564533 | 2018-03-26T20:38:40 | 2018-03-26T20:38:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package gov.cms.qpp.conversion.api;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RestApiApplication.class)
public class RestApiApplicationTest {
@Test
public void contextLoads() {
}
@Test
public void testMain() {
RestApiApplication.main(new String[] {
"--spring.main.web-environment=false"
});
}
}
| [
"ad@mharrison.us"
] | ad@mharrison.us |
b6c3e3daf86107913eb763aafbf6e92436a2d333 | 9697cfb3faed3e22aa69a52b5c07521c307f2676 | /mq/activemq/activemq/src/main/java/com/xych/activemq/p1/QueueConsumer1.java | 19e282f259aec4f8da2b13f2a8f9cbdd7100d259 | [] | no_license | Lanboo/java-coding | 62d4bfc7a4ba040f7049cfec055e03e4609340ae | 505855af69601a0160c63abf5a4b27619af23918 | refs/heads/master | 2023-04-26T16:04:33.095101 | 2021-08-18T01:27:31 | 2021-08-18T01:27:31 | 128,206,003 | 1 | 0 | null | 2023-04-17T19:08:23 | 2018-04-05T12:53:38 | Java | UTF-8 | Java | false | false | 1,444 | java | package com.xych.activemq.p1;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.ActiveMQConnectionFactory;
public class QueueConsumer1 {
public static void main(String[] args) {
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://127.0.0.1:61616");
Connection connection = null;
try {
// 连接
connection = connectionFactory.createConnection();
connection.start();
// 会话
Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
// 目的地
Destination destination = session.createQueue("xych-test-queue");
// 消息消费者
MessageConsumer messageConsumer = session.createConsumer(destination);
while(true) {
// 阻塞式接收消息
TextMessage message = (TextMessage) messageConsumer.receive();
System.out.println("QueueConsumer1:" + message.getText());
}
//session.commit();
//session.close();
// connection.close();
}
catch(JMSException e) {
e.printStackTrace();
}
}
}
| [
"549434510@qq.com"
] | 549434510@qq.com |
76c167832fdf56f82ab23dd5ee982b6032e5c157 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/aa/a/c.java | 72bb64a09fafcaa16f5299fac3077a8b00850a54 | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 723 | java | package com.tencent.mm.plugin.aa.a;
import com.tencent.matrix.trace.core.AppMethodBeat;
public final class c
implements com.tencent.mm.vending.c.b<b>
{
protected b glu;
public final c.a glv;
public c()
{
this(new b());
AppMethodBeat.i(40596);
AppMethodBeat.o(40596);
}
private c(b paramb)
{
AppMethodBeat.i(40597);
this.glv = new c.a(this);
this.glu = paramb;
AppMethodBeat.o(40597);
}
public final b aof()
{
return this.glu;
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes6-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.aa.a.c
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
c5d27743f7dd55a906a511f6688a4453a7f04cd5 | 67971ba3ffe8857f62ed97aeb6384e65bc0c9773 | /app/src/main/java/cn/ipathology/dp/activity/user/AboutUsActivity.java | fc9b37a6286d1bdef05476844c71ba1aa4e839bd | [] | no_license | 18363853135/DP | 47c173c7ac836225b3bd26000387f8c5ba2eb7fb | 90f0bae50e81e693cbfa81d01c49f91c297c85a5 | refs/heads/master | 2021-01-12T05:17:58.358599 | 2017-01-04T01:16:50 | 2017-01-04T01:16:50 | 77,901,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,687 | java | package cn.ipathology.dp.activity.user;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import cn.ipathology.dp.R;
import cn.ipathology.dp.activity.base.BarWebViewActivity;
public class AboutUsActivity extends BarWebViewActivity {
private ImageView imageView;
private TextView version;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_activity_about_us);
version = (TextView) findViewById(R.id.about_version);
initActionBar("返回","关于我们","");
linearRightImgOne.setVisibility(View.GONE);
linearRightImgTwo.setVisibility(View.GONE);
versionNumber();
imageView = (ImageView) findViewById(R.id.aboutus_imageView);
// DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(false).cacheOnDisk(false).displayer(new RoundedBitmapDisplayer(30)).build();
// ImageLoader.getInstance().displayImage("drawable://" + R.mipmap.ihc_2x, imageView, options);
}
public void versionNumber() {
try {
PackageInfo info = this.getPackageManager().getPackageInfo(this.getPackageName(), 0);
// 当前应用的版本名称
String versionName = info.versionName;
version.setText("云诊断平台Android版 v" + versionName);
} catch (PackageManager.NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"1173964585@qq.com"
] | 1173964585@qq.com |
ac32df98d405a190848135ab96cffdfc50a190b7 | 6614314a5f50e7d3423ac2f0f008fed36a15b178 | /scrumTools/src/main/java/ch/paru/scrumTools/capacity/shared/factories/TeamFactory.java | 98e90dd5a69def29ea24818ed1767698845f1d3c | [] | no_license | Ravikumarmaddi/Scrum-Tools | 5fc55ef0fbdaac7441c190111bae1bef5c8fb521 | 10a1feed0e49cb966d1038e497b595b2fccb98dc | refs/heads/master | 2021-01-15T21:08:21.301505 | 2014-06-02T13:28:45 | 2014-06-02T13:28:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 474 | java | package ch.paru.scrumTools.capacity.shared.factories;
import ch.paru.scrumTools.capacity.shared.data.Team;
import ch.paru.scrumTools.common.reflection.customs.AbstractFactory;
import ch.paru.scrumTools.common.reflection.customs.CustomFactory;
@CustomFactory
public class TeamFactory extends AbstractFactory {
public Team createTeam(String teamName) {
Class<? extends Team> instanceClass = getClassToUse(Team.class);
return getInstance(instanceClass, teamName);
}
}
| [
"git@paru.ch"
] | git@paru.ch |
f3c1c43243b2d2852163277933f18c92fe951b88 | 10a1d9a18dfb58d9b71c13aaa2ddcbca53e1ca0e | /app/src/main/java/com/example/projetparking/shared/HomeActivity.java | e4c84bf359c8cdb0a40a5f60feffa7173ac1c84d | [] | no_license | znipeur/Mobile | bf84c316b7b8d94e4cbdf9ae20ea4086b23e8a23 | 56217bf1294692b7e40fa27204982d2a868fae2c | refs/heads/master | 2020-11-30T06:44:35.806458 | 2020-01-10T03:41:48 | 2020-01-10T03:41:48 | 230,335,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,052 | java | package com.example.projetparking.shared;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.projetparking.R;
import com.example.projetparking.ShowParkingActivity;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class HomeActivity extends AppCompatActivity {
Button btnLogout;
FirebaseAuth mFirebaseAuth;
Button btnChemin,btnSubmit,btnParking,btnMessage;
EditText editUser,editCapacite,editAdresse;
//Progress Dialog
ProgressDialog pd;
//FireStore Instance
FirebaseFirestore db ;
String parkId,parkUser,parkAdresse,parkCapacite;
private FirebaseAuth.AuthStateListener mAuthStateListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
//Action Bar
ActionBar actionBar = getSupportActionBar();
//initialise composant de la page.
btnLogout = findViewById(R.id.logout);
btnSubmit = findViewById(R.id.submit);
btnParking = findViewById(R.id.parkBtn);
editCapacite = findViewById(R.id.editCapacite);
editAdresse = findViewById(R.id.editAdresse);
btnMessage = findViewById(R.id.btnMessage);
//Progress
pd = new ProgressDialog(this);
//Firestore
mFirebaseAuth = FirebaseAuth.getInstance();
db = FirebaseFirestore.getInstance();
btnLogout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FirebaseAuth.getInstance().signOut();
Intent intToMain = new Intent(HomeActivity.this, InscriptionActivity.class);
startActivity(intToMain);
}
});
//Show Parking
btnParking.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i =new Intent(HomeActivity.this, ShowParkingActivity.class);
startActivity(i);
finish();
}
});
btnMessage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i =new Intent(HomeActivity.this, MessageActivity.class);
i.putExtra("user",mFirebaseAuth.getCurrentUser().getEmail());
startActivity(i);
}
});
}
}
| [
"oussamasebbani@hotmail.fr"
] | oussamasebbani@hotmail.fr |
9a562bbb433668262244ee2e4541d637833ff0e7 | f210f8c086f8b2556b4ce5ce0ff2b1337430d719 | /vrplayer/src/main/java/com/appixiplugin/vrplayer/vr/filter/VrMonoDirectorFilter.java | f696a28f450c331199a18dad0ec10c958b9aa112 | [] | no_license | dtvtkien/vr-android | 2438af0bf5757ab8c433181fa77f0ec213e42c1c | 65db61d04d0faa9d92434819530eb86e5c4d4ab0 | refs/heads/master | 2023-02-02T12:16:01.866017 | 2020-12-15T03:57:08 | 2020-12-15T03:57:08 | 308,251,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package com.appixiplugin.vrplayer.vr.filter;
import com.asha.vrlib.MDVRLibrary;
public class VrMonoDirectorFilter implements MDVRLibrary.IDirectorFilter {
private static final int DEFAULT_ANGLE = 40;
private int filterAngle;
public VrMonoDirectorFilter() {
this.filterAngle = DEFAULT_ANGLE;
}
public VrMonoDirectorFilter(int filterAngle) {
this.filterAngle = filterAngle;
}
@Override
public float onFilterPitch(float input) {
if (input > filterAngle) {
return filterAngle;
}
if (input < -filterAngle) {
return -filterAngle;
}
return input;
}
@Override
public float onFilterRoll(float input) {
if (input < -filterAngle) {
return -filterAngle;
}
if (input > filterAngle) {
return filterAngle;
}
return input;
}
@Override
public float onFilterYaw(float input) {
if (input < -filterAngle) {
return -filterAngle;
}
if (input > filterAngle) {
return filterAngle;
}
return input;
}
}
| [
"dtvtdevelopersk58@gmail.com"
] | dtvtdevelopersk58@gmail.com |
77a9cba054bd68049d62e7ecd8b4db9a7dc876d2 | 9b467b53005cc1c24326dc56735453b8702def77 | /epragati-reg-services/src/main/java/org/epragati/tax/service/TaxService.java | 98d680cc8f41cbe0b008ec3caf685b1853de33d4 | [] | no_license | otkp/23-REG-SERVICES | 50c41626e6c6e457f819784ada305497d20c23a3 | b238d6ab8f8b7a26f58ff099e17ecdbdc32f430b | refs/heads/master | 2022-12-20T12:49:35.996628 | 2020-10-16T10:40:50 | 2020-10-16T10:40:50 | 304,596,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 525 | java | package org.epragati.tax.service;
import java.util.List;
import org.epragati.master.dto.StagingRegistrationDetailsDTO;
public interface TaxService {
/**
* getting tax details
* @param stagingRegDetails
* @return
*/
StagingRegistrationDetailsDTO getTaxDetails(StagingRegistrationDetailsDTO stagingRegDetails);
/**
*
* @param State
* @param classOfVehicle
* @param seatingCapacity
* @return
*/
List<String> getTaxTypes(String State, String classOfVehicle, Integer seatingCapacity,Integer gvw);
}
| [
"8186067656kpsr@gmail.com"
] | 8186067656kpsr@gmail.com |
d6b3d0460dff7163ac594c7001cc38e5063cf836 | f5142d1840e6c2000f63220af5457157469c08e0 | /src/main/java/org/ghk/dc/orderservice/domain/StaffDetails.java | 464c86647b2cc3dac896e0c7b42a8d3293d15ba4 | [] | no_license | roshanatl/oder-service | 949af53d54544bd4c986b69b6b9fffeb4a5e5761 | e082016b4af6cf3d4ad027f9fe2cef8d449f262e | refs/heads/master | 2022-11-18T04:21:58.137078 | 2020-06-16T18:14:19 | 2020-06-16T18:14:19 | 272,748,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package org.ghk.dc.orderservice.domain;
public class StaffDetails {
private String id;
private String group;
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getGroup() {
return group;
}
public void setGroup(String group) {
this.group = group;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "StaffDetails [id=" + id + ", group=" + group + ", name=" + name + "]";
}
}
| [
"roshan.rajendran@ibsplc.com"
] | roshan.rajendran@ibsplc.com |
3830ec25324a263fc9db84d3a8ea40ec84e5ecea | ab1b6e7b92517e4425bb3ae817041b7697f98558 | /drools-compiler/src/main/java/org/drools/compiler/xml/rules/FieldBindingHandler.java | f761b2ddd648cb8a1dc550362ac3dcd87fe30dbb | [] | no_license | jayzhk/drools51 | 2a1ee1a3a9284e79b294aa39d7050b35ffac6f31 | 98c4067df30c060ec19c0ae70244cc089ae43e56 | refs/heads/master | 2021-05-08T07:11:39.985092 | 2017-10-18T15:13:50 | 2017-10-18T15:13:50 | 106,695,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,132 | java | package org.drools.compiler.xml.rules;
/*
* Copyright 2005 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.util.HashSet;
import org.drools.lang.descr.FieldBindingDescr;
import org.drools.lang.descr.FieldConstraintDescr;
import org.drools.lang.descr.PatternDescr;
import org.drools.lang.descr.PredicateDescr;
import org.drools.xml.BaseAbstractHandler;
import org.drools.xml.ExtensibleXmlParser;
import org.drools.xml.Handler;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
/**
* @author mproctor
*/
public class FieldBindingHandler extends BaseAbstractHandler
implements
Handler {
public FieldBindingHandler() {
if ( (this.validParents == null) && (this.validPeers == null) ) {
this.validParents = new HashSet();
this.validParents.add( PatternDescr.class );
this.validPeers = new HashSet();
this.validPeers.add( null );
this.validPeers.add( FieldConstraintDescr.class );
this.validPeers.add( PredicateDescr.class );
this.validPeers.add( FieldBindingDescr.class );
this.allowNesting = false;
}
}
public Object start(final String uri,
final String localName,
final Attributes attrs,
final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder( localName,
attrs );
final String identifier = attrs.getValue( "identifier" );
final String fieldName = attrs.getValue( "field-name" );
emptyAttributeCheck( localName, "identifier", identifier, parser );
emptyAttributeCheck( localName, "fieldName", fieldName, parser );
final FieldBindingDescr fieldBindingDescr = new FieldBindingDescr( fieldName,
identifier );
return fieldBindingDescr;
}
public Object end(final String uri,
final String localName,
final ExtensibleXmlParser parser) throws SAXException {
final Element element = parser.endElementBuilder();
final FieldBindingDescr fieldBindingDescr = (FieldBindingDescr) parser.getCurrent();
final PatternDescr patternDescr = (PatternDescr) parser.getParent( );
patternDescr.addConstraint( fieldBindingDescr );
return fieldBindingDescr;
}
public Class generateNodeFor() {
return FieldBindingDescr.class;
}
} | [
"jay.zeng@hotmail.com"
] | jay.zeng@hotmail.com |
0bcf772e2e08dab105ebc031249f793de7dc2600 | 6e358ccbf3bf2a01fd1a3f66db77165f5598093a | /app/src/androidTest/java/com/example/archenemy/proandroid4media/ApplicationTest.java | 63ff3ed72b2894d13b7774449bab4dac2f90725b | [] | no_license | littlejavachild/simpleplayer | a3f1b3267c4b79a26a21a1c84271a08307cf9746 | c4464baba63c7e5a86fa54567e2a7355d5e9588d | refs/heads/master | 2021-01-10T08:44:58.363636 | 2016-01-06T21:30:42 | 2016-01-06T21:30:42 | 49,085,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.example.archenemy.proandroid4media;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"fasih.khatib@raweng.com"
] | fasih.khatib@raweng.com |
6af8bc141580dcda3d726c76ca41994acfca649a | c699fe58ca7b58a34f47cc3259fb8d567c676866 | /softwarereuse/reuze/demo/demoGIF.java | 1212f9d41891b120b30315a336f9202c14e04435 | [] | no_license | ammarblue/brad-baze-code-bank | 9b0b300ab09f5ed315ce6ac0a8352fcd8a6e03e8 | 0cc496fbdef4f7b466d4905c23ae0bedaf9624c9 | refs/heads/master | 2021-01-01T05:47:15.497877 | 2013-05-31T15:05:31 | 2013-05-31T15:05:31 | 39,472,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,205 | java | package reuze.demo;
//import java.awt.image.BufferedImage;
import java.util.ArrayList;
import com.software.reuze.z_BufferedImage;
import com.software.reuze.z_GIFDecoder;
import processing.core.PApplet;
import processing.core.PConstants;
import processing.core.PImage;
public class demoGIF extends PApplet {
ArrayList<PImage> animation;
public void setup() {
size(400, 200);
frameRate(10);
animation= new ArrayList<PImage>();
z_GIFDecoder d = new z_GIFDecoder();
d.read("./data/bonusmany.gif");
int n = d.getFrameCount();
for (int i = 0; i < n; i++) {
z_BufferedImage frame = d.getFrame(i); // frame i
int t = d.getDelay(i); // display duration of frame in milliseconds
System.out.println(i+" "+t);
PImage img=new PImage(frame.getWidth(),frame.getHeight(),PConstants.ARGB);
img.loadPixels();
frame.getRGB(0, 0, img.width, img.height, img.pixels, 0, img.width);
img.updatePixels();
img.resize(32,32);
animation.add(img);
}
}
int frame;
public void draw() {
background(255 / (float)height * (mouseY+1));
if (animation.size()!=0) {
int i=frame%animation.size();
image(animation.get(i),50,50);
frame++;
}
}
}
| [
"in_tech@mac.com"
] | in_tech@mac.com |
b28074573a7dd2df83e5a1cbafac9b7495ec7501 | c02c7147f8177d088085aca8f5160271e2310e54 | /src/main/java/org/dylim/service/MemberServiceImpl.java | 9640b4072408e8abfb713382b451050533b9aff9 | [] | no_license | daye-lim/NZNS | 745c6447eea532b076992e3053ace03519911004 | e3ada0c53034739aaf561c6ae1ae0f4f7b508671 | refs/heads/master | 2023-05-14T04:38:29.685130 | 2021-06-08T06:30:36 | 2021-06-08T06:30:36 | 374,856,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,714 | java | package org.dylim.service;
import org.dylim.domain.memberVO;
import org.dylim.domain.member_bVO;
import org.dylim.domain.member_iVO;
import org.dylim.mapper.MemberMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.Setter;
@Service
public class MemberServiceImpl implements MemberService {
@Setter(onMethod_ = @Autowired)
private MemberMapper membermapper;
@Override
public void m_register(member_iVO member) throws Exception {
membermapper.m_register(member);
}
@Override
public int idCheck(String id) throws Exception {
return membermapper.idCheck(id);
}
@Override
public memberVO Login(memberVO Allmember) throws Exception {
return membermapper.Login(Allmember);
}
@Override
public void b_register(member_bVO b_member) throws Exception {
membermapper.b_register(b_member);
}
@Override
public member_iVO readMember(String id, String password) throws Exception {
return membermapper.readMember(id, password);
}
@Override
public member_bVO readAgent(String id, String password) throws Exception {
return membermapper.readAgent(id, password);
}
@Override
public void updateAgent(member_bVO b_member) throws Exception {
membermapper.updateAgent(b_member);
}
@Override
public void updateMember(member_iVO member) throws Exception {
membermapper.updateMember(member);
}
@Override
public void deleteMember(String id) throws Exception {
membermapper.deleteMember(id);
}
@Override
public void deleteAgent(String id) throws Exception {
membermapper.deleteAgent(id);
}
}
| [
"kate09145@gmail.com"
] | kate09145@gmail.com |
d4e6a942d04ee6e4aebb6af4e5c62042e3755b93 | ca5bad282538e9d9471218268b813e29b8f6dfcb | /src/main/java/com/springboot/zqspringdatajpa/model/UserDetail.java | 36306e847c237dd837e340c51ea4c069e9ace500 | [] | no_license | peterGuo58/zq-spring-data-jpa | 08050abeceb765b4784280ef64ca9388fe79e5d1 | fdcb315dd84be283a002e309ad8e94efa0117359 | refs/heads/master | 2020-04-12T09:47:44.430292 | 2018-12-21T06:43:52 | 2018-12-21T06:43:52 | 162,408,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,143 | java | package com.springboot.zqspringdatajpa.model;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import javax.persistence.*;
import java.io.Serializable;
@Entity
public class UserDetail {
@Id
@GeneratedValue
private Long id;
@Column(nullable = false, unique = true)
private Long userId;
private Integer age;
private String realName;
private String status;
private String hobby;
private String introduction;
private String lastLoginIp;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getHobby() {
return hobby;
}
public void setHobby(String hobby) {
this.hobby = hobby;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public String getLastLoginIp() {
return lastLoginIp;
}
public void setLastLoginIp(String lastLoginIp) {
this.lastLoginIp = lastLoginIp;
}
@Override
public String toString() {
return "UserDetail{" +
"id=" + id +
", userId=" + userId +
", age=" + age +
", realName='" + realName + '\'' +
", status='" + status + '\'' +
", hobby='" + hobby + '\'' +
", introduction='" + introduction + '\'' +
", lastLoginIp='" + lastLoginIp + '\'' +
'}';
}
}
| [
"lorenzog@163.com"
] | lorenzog@163.com |
6a3c6a01934067d7248d167cde7679acf5e510c6 | c1ab930305e651d0ab0262f1bccee1d4c8436375 | /src/main/java/com/jobdiva/api/convertor/JsonToWeekendingTypeConverter.java | ecf39dbb9fd71226b1e2cb174ff0368aef91b22b | [] | no_license | omarkamoun1/SpringRestAPI | ad2c0e846965b364f5067c7a229482b6ee5a8b3a | 4a83b2f3dc097cc28eba2059873771679474f5d5 | refs/heads/master | 2023-04-30T08:47:37.804613 | 2021-05-20T10:33:11 | 2021-05-20T10:33:11 | 369,308,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package com.jobdiva.api.convertor;
import org.springframework.core.convert.converter.Converter;
import com.jobdiva.api.model.WeekendingType;
public class JsonToWeekendingTypeConverter implements Converter<String, WeekendingType> {
@Override
public WeekendingType convert(String source) {
for (WeekendingType WeekendingType : WeekendingType.values()) {
if (WeekendingType.getValue().equalsIgnoreCase(source)) {
return WeekendingType;
}
}
return null;
}
}
| [
"sktgater@gmail.com"
] | sktgater@gmail.com |
96a0eb35d91476fcc8ccef5c3224e22a654dcc62 | f210941da0759495b1f9d9dd1e283a48cb3c160e | /app/src/main/java/xyz/yisa/distressplus/models/Alert.java | 18fba67e89d2b7c294f09b2bafa6ef3e443b0fe2 | [] | no_license | aligorithm/corpalert-android | 674a6423e063eed219467207a25a5b698ce375d7 | 1641e25e3e148bf10e4a0741a9fca3f4fe60ab9a | refs/heads/master | 2020-04-07T12:23:26.393972 | 2018-08-15T01:52:37 | 2018-08-15T01:52:37 | 158,365,903 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package xyz.yisa.distressplus.models;
public class Alert {
public String name;
public String phone;
public int sender_id;
public String latitude;
public String longitude;
public String created_at;
}
| [
"aliyisa@outlook.com"
] | aliyisa@outlook.com |
0855fc40a7c12227928471f4de33b528a0680754 | 9a73614361c7fbf28db34173e8c9d16f661f635d | /src/com/imooc/javabasic/threaddemo/MyTest.java | a8e19b6fd55604c811f54b8421d27d8fe9baa025 | [] | no_license | DDAlert/javabasic | f8f5567a09a08f0013bc7fa083a542fb26e29114 | 502f1630c3afea32b6b55e5a926f8a90ed05abea | refs/heads/master | 2022-11-09T05:42:53.625267 | 2020-06-25T07:42:20 | 2020-06-25T07:42:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.imooc.javabasic.threaddemo;
/**
* 测试类
* 1:创建线程池类对象
* 2:提交多个任务
*/
public class MyTest {
public static void main(String[] args) {
//1:创建线程池类对象
MyThreadPool pool = new MyThreadPool(2,4,20);
//2:提交多个任务
for (int i = 0; i < 30; i++) {
//3:创建任务对象,并提交给线程池
MyTask myTask = new MyTask(i);
pool.submit(myTask);
}
}
}
| [
"465658284@qq.com"
] | 465658284@qq.com |
c88c2e6e70522d0e10c7a9753efe8620530e333e | a53b66f1139498eec57633e314daedc7faf5b24d | /src/main/java/com/Giz/service/metier/Person_resServiceImpl.java | 6a0f44899ebbe1930d9efc589715b637f06c3291 | [] | no_license | rich0502/GIZ | d3c4ab38b5310585667797d8176cd78cb098958a | 07d1dc15a72a5e1fc3b98d2730dd1f08e876b72d | refs/heads/master | 2023-06-15T21:34:53.315290 | 2021-07-13T19:02:57 | 2021-07-13T19:02:57 | 299,892,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,999 | java | package com.Giz.service.metier;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.Giz.data.domain.Person_res;
import com.Giz.repository.Person_resRepository;
@Service
public class Person_resServiceImpl implements Person_resService {
@Autowired
Person_resRepository person_resRepository;
@Override
public List<Person_res> ListPerson_res() {
// TODO Auto-generated method stub
return person_resRepository.findAll();
}
@Override
public void deletePerson_res(Long id_pr) {
person_resRepository.deleteById(id_pr);
}
@Override
public void addPerson_res(String code_village, String nomPrenom, String genre_pr, int annee_naiss,
boolean operationnalite, Date date_suivi, String types_services_dev) {
Person_res person_res = new Person_res();
person_res.setCode_village(code_village);
person_res.setNomPrenom(nomPrenom);
person_res.setGenre_pr(genre_pr.toLowerCase());
person_res.setAnnee_naiss(annee_naiss);
person_res.setOperationnalite(operationnalite);
person_res.setDate_suivi(date_suivi);
person_res.setTypes_services_dev(types_services_dev);
person_resRepository.save(person_res);
}
@Override
public void modifyPerson_res(Person_res person_res, String code_village, String nomPrenom, String genre_pr,
int annee_naiss, boolean operationnalite, Date date_suivi, String types_services_dev, Long id_pr) {
person_res.setCode_village(code_village);
person_res.setGenre_pr(genre_pr.toLowerCase());
person_res.setAnnee_naiss(annee_naiss);
person_res.setOperationnalite(operationnalite);
person_res.setDate_suivi(date_suivi);
person_res.setTypes_services_dev(types_services_dev);
person_resRepository.save(person_res);
}
@Override
public void deleteAllPr() {
// TODO Auto-generated method stub
person_resRepository.deleteAll();
}
}
| [
"liantso2011md@gmail.com"
] | liantso2011md@gmail.com |
e0241df6794124754e08d45531fd9ad6edbc6d9b | 1cfd265d8353335ad747512683924dcf9dad3db4 | /17_EmpresaJorge/src/entidad/Programador.java | b7e916b56855f75d8e0ba4753de499a255a3012e | [] | no_license | jorgesg7/WsJavaJorgito | eac896133d6c33ca4ca3c7f7f4690435aec0085b | a015127927820d768bbd0e1e4b8bba5915733a4b | refs/heads/master | 2022-06-22T05:51:25.652556 | 2020-02-25T12:43:54 | 2020-02-25T12:43:54 | 222,900,744 | 0 | 0 | null | 2022-06-21T04:07:01 | 2019-11-20T09:32:31 | Java | UTF-8 | Java | false | false | 376 | java | package entidad;
public class Programador extends Empleado {
@Override
public double calcularSalario() {
return getSalarioBase();
}
@Override
public String toString() {
return "Programador [getNombre()=" + getNombre() + ", getDni()=" + getDni() + ", getSalarioBase()="
+ getSalarioBase() + ", getEdad()=" + getEdad() + "]";
}
}
| [
"jorge@example.com"
] | jorge@example.com |
202b83258276e1c131a86ef054358207ce66fdff | 98612a42f3e9731eadd7ddd79392d43b67a61e82 | /app/src/test/java/pandam/stormy/ExampleUnitTest.java | 94b3d0decfa300d02ccea15f16599a70488a53f8 | [] | no_license | AdrianMalaran/StormyWeatherApp | 6c721a61e02e05d2a697c3a886fa45fd28e04ec8 | 64bd5592da77c2b547362579d9b9dba442bf1053 | refs/heads/master | 2020-12-10T03:19:47.803962 | 2017-06-27T02:02:57 | 2017-06-27T02:02:57 | 95,507,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package pandam.stormy;
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);
}
} | [
"adrianmalaran@InitiumAdmins-MacBook-Air-4.local"
] | adrianmalaran@InitiumAdmins-MacBook-Air-4.local |
799be86315748bfc4d3a829d59f958f748660e95 | 1455f48f30a3b5378fadf148b5cb23058b852c99 | /hframe-webgenerator/src/main/java/com/hframework/generator/web/constants/CreatorConst.java | 6678711f97c3b3028dda1043e138c502cedf0f55 | [] | no_license | luchao0111/hframework | 764d02d40e6b3ffbc77c5604eb03aaee2b52758c | 1ab0ebd8bd75c2aa305b55232fa96e7ac4cb85c4 | refs/heads/master | 2023-01-30T01:05:16.638719 | 2019-06-27T06:38:20 | 2019-06-27T06:38:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,061 | java | package com.hframework.generator.web.constants;
/**
* 生成器常量定义类
* @author zhangqh6
*
*/
public class CreatorConst {
// public static String PROJECT_BASE_FILE_PATH = "project_base_file_path";
public static String PROJECT_SRC_FILE_PATH = "project_src_file_path";
// public static String PROJECT_TOMCAT_BASE_FILE_PATH = "project_tomcat_base_file_path";
public static String SQL_FILE_PATH = "sql_file_path";
public static String TARGET_PROJECT_BASE_PATH = "target_project_base_path";
public static String GENERATOR_CONFIG_PATH = "generator_config_path";
public static String GENERATOR_TMP_DIR = "generator_tmp_dir";
public static String PO_CLASS_PACKAGE = "po_class_package";
public static String DAO_CLASS_PACKAGE = "dao_class_package";
public static String DAOIMPL_CLASS_PACKAGE = "daoimpl_class_package";
public static String SERVICE_CLASS_PACKAGE = "service_class_package";
public static String SERVICEIMPL_CLASS_PACKAGE = "serviceimpl_class_package";
public static String ACTION_CLASS_PACKAGE = "action_class_package";
}
| [
"zhangquanhong@ucfgroup.com"
] | zhangquanhong@ucfgroup.com |
83977239616f9da30b6d6264b15d21d066c39775 | b051f46bf2a5eab4a541acbec6dcc67a07e52ea6 | /spi/src/main/java/org/reactivestreams/api/Consumer.java | d9696edd1b9405f5b7470a94f8c38e177056b4a3 | [
"CC0-1.0"
] | permissive | mathieuancelin/reactive-streams | 0fb75780589b61047a8222cc3e7ea93e66ca31c6 | 74e2d3f5b9bb3851c9f40af2f03ee67af01f9f4d | refs/heads/master | 2021-01-14T12:44:18.945705 | 2014-04-23T14:23:06 | 2014-04-23T14:23:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package org.reactivestreams.api;
import org.reactivestreams.spi.Subscriber;
/**
* A Consumer is the logical sink of elements of a given type.
* The underlying implementation is done by way of a {@link org.reactivestreams.spi.Subscriber Subscriber}.
* This interface is the user-level API for a sink while a Subscriber is the SPI.
* <p>
* Implementations of this interface will typically offer domain- or language-specific
* methods for transforming or otherwise interacting with the stream of elements.
*/
public interface Consumer<T> {
/**
* Get the underlying {@link org.reactivestreams.spi.Subscriber Subscriber} for this Consumer. This method should only be used by
* implementations of this API.
* @return the underlying subscriber for this consumer
*/
public Subscriber<T> getSubscriber();
} | [
"viktor.klang@gmail.com"
] | viktor.klang@gmail.com |
0acee3d61f42f2ecf4d7ef01db1101ec254dd68b | 804270cdea572b2341e31146b4ce8c34f4938ba6 | /app/src/test/java/com/mrede003/takehome/farmlogs/farmnotepad/ExampleUnitTest.java | 7582991c37134c5cb2fbe6adce625e7285d0a7f0 | [] | no_license | mrede003/FarmNotePad | f0104bee40b454fd7e9e89a1d2698a08ff047783 | 077f1e1d29fb041acf576e7f1ef83f280e23dac2 | refs/heads/master | 2021-01-20T04:00:43.546644 | 2017-04-29T00:01:40 | 2017-04-29T00:01:40 | 89,621,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 931 | java | package com.mrede003.takehome.farmlogs.farmnotepad;
import org.junit.Test;
import android.content.Context;
import android.provider.ContactsContract;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
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 {
} | [
"mrede003@odu.edu"
] | mrede003@odu.edu |
6bcd656c8f6f9f4046928e1d7608f66ebd985c7e | f9ebb41158cd1491da1e4677f4f5f0cbaca910d5 | /src/main/java/org/killbill/billing/plugin/adyen/api/exceptions/PaymentMethodException.java | 1a6415f3b270bb9a8494dec6c534cbba942865eb | [
"Apache-2.0"
] | permissive | killbill/killbill-adyen-plugin | 34a73b864976511992d7ecbaf90d77d7a9ecea30 | 71ac8f3b48f2c03299296311ec2a1100a9bd788e | refs/heads/master | 2023-03-15T18:41:26.324109 | 2023-03-10T07:13:07 | 2023-03-10T07:13:07 | 26,882,862 | 9 | 31 | Apache-2.0 | 2023-03-10T07:13:09 | 2014-11-19T21:38:26 | Java | UTF-8 | Java | false | false | 1,041 | java | /*
* Copyright 2020-2023 Equinix, Inc
* Copyright 2014-2023 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package org.killbill.billing.plugin.adyen.api.exceptions;
public class PaymentMethodException extends RuntimeException {
public PaymentMethodException(String string) {
super(string);
}
public PaymentMethodException(String string, Exception e) {
super(string, e);
}
public PaymentMethodException(Exception e) {
super(e);
}
}
| [
"reshmabidikar@outlook.com"
] | reshmabidikar@outlook.com |
45eca1210b513708bd9ed4e1f6e8ed5d01006677 | 5507f8bc6f6206aa4466cca116ac31abc35eba68 | /impl/AbstractBaseList.java | ed7ad0ac133d224e359c8746fb5a8322e049b444 | [
"BSD-3-Clause"
] | permissive | jchildress/com.powerdata.openpa | 71a8b290a21a37dd2eb96c6e1131d796c34c8464 | a308dd4f8729e9874820a4c4c2f93adf2324315e | refs/heads/master | 2021-01-06T18:25:09.247831 | 2016-05-18T21:41:20 | 2016-05-18T21:41:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 966 | java | package com.powerdata.openpa.impl;
/*
* Copyright (c) 2016, PowerData Corporation, Incremental Systems Corporation
* All rights reserved.
* Licensed under the BSD-3 Clause License.
* See full license at https://powerdata.github.io/openpa/LICENSE.md
*/
import java.util.AbstractList;
import com.powerdata.openpa.BaseList;
import com.powerdata.openpa.BaseObject;
public abstract class AbstractBaseList<T extends BaseObject> extends AbstractList<T> implements BaseList<T>
{
protected int _size;
protected AbstractBaseList(int size)
{
_size = size;
}
protected AbstractBaseList()
{
_size = 0;
}
@Override
public int size()
{
return _size;
}
@Override
public boolean objEquals(int ndx, Object obj)
{
BaseObject o = (BaseObject) obj;
return getListMeta().equals(o.getList().getListMeta()) && getKey(ndx) == o.getKey();
}
@Override
public int objHash(int ndx)
{
return BaseList.CalcListHash(getListMeta(), getKey(ndx));
}
}
| [
"chris@powerdata.com"
] | chris@powerdata.com |
b61c7eb15352fa9501cc0677d68efc94e4964d79 | a2b30406a0b424ac96d9f1277024b8482b462145 | /method/HashTable/523_Continuous Subarray Sum.java | dc46566a2c8a2bec61c622a048ea83d6b842cd31 | [] | no_license | hxs162230/useful-material | 3c322cbe80705e304ebfc8a46e3ee53e96407847 | c7e822281b9c54cbf2bdf6d4bc58f78057a8abfd | refs/heads/master | 2022-03-19T23:11:24.050022 | 2022-02-11T22:57:26 | 2022-02-11T22:57:26 | 241,742,873 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,848 | java | 523. Continuous Subarray Sum
Given a list of non-negative numbers and a target integer k, write a function to check
if the array has a continuous subarray of size at least 2 that sums up to a multiple of k,
that is, sums up to n*k where n is also an integer.
Example 1:
Input: [23, 2, 4, 6, 7], k=6
Output: True
Explanation: Because [2, 4] is a continuous subarray of size 2 and sums up to 6.
Example 2:
Input: [23, 2, 6, 4, 7], k=6
Output: True
Explanation: Because [23, 2, 6, 4, 7] is an continuous subarray of size 5 and sums up to 42.
Note:
The length of the array won't exceed 10,000.
You may assume the sum of all the numbers is in the range of a signed 32-bit integer.
既然set可以做,一般来说用哈希表也可以做,这里我们建立余数和当前位置之间的映射,由于有了位置信息,
我们就不需要pre变量了,之前用保存的坐标和当前位置i比较判断就可以了,参见代码如下:
We iterate through the input array exactly once, keeping track of the running
sum mod k of the elements in the process.
If we find that a running sum value at index j has been previously seen before
in some earlier index i in the array, then we know that the sub-array (i,j] contains a desired sum.
class Solution {
public boolean checkSubarraySum(int[] nums, int k) {
int sum = 0;
HashMap<Integer,Integer> map = new HashMap<>();
map.put(0,-1);
for(int i=0;i<nums.length;i++){
sum+=nums[i];
int t=(k==0)?sum:sum%k;
if(map.containsKey(t)){
if(i-map.get(t)>1) return true;
}
else{
map.put(t,i);
}
}
return false;
}
}
sum%k
|_______________________|
sum% dividible
|________|______________|
| [
"hxs162230@utdallas.edu"
] | hxs162230@utdallas.edu |
74bda4403afbc30f1b975d55bc75f70003ead3da | d26228796b9a04ab5d0b9408e0670434988b09d0 | /app/src/main/java/com/mays/lookimage/activity/KeyActivity.java | 690d50bcfdc21f6198071a6fded1ebc4bc27c324 | [] | no_license | shangea/LookImage | 51ab30f92eff7b672f5939ad4c4ff2a033d79bb7 | 797dd36740cfa8bb890d759e07ab5a9f3702ff97 | refs/heads/master | 2021-04-05T23:45:13.788399 | 2018-03-09T10:11:10 | 2018-03-09T10:11:10 | 124,497,419 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,419 | java | package com.mays.lookimage.activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import com.mays.lookimage.R;
public class KeyActivity extends AppCompatActivity {
private EditText mEt;
private Context mContext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_key);
mContext = this;
initView();
initListener();
}
private void initView() {
mEt = (EditText) findViewById(R.id.act_key_et);
}
private void initListener() {
mEt.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if ("3".equals(s.toString())) {
Intent intent = new Intent(mContext, MainActivity.class);
startActivity(intent);
finish();
}
}
});
}
}
| [
"mys@eeepay.cn"
] | mys@eeepay.cn |
c4e0f3f6725c3707e7f1ee09a9a6085c101f0842 | b17e4dbc8e478dc6f95b38af0bcd7ebccbc07458 | /app/src/main/java/group787/utor/flylocity/flights/Flight.java | eb32b38334fb83edbed9bb0a7a959513211177ed | [] | no_license | jonypx09/csc207-project | 0a45b4fe615b82948dffe08453f07ce7e7a3bcf1 | f596871e146b5f976908f705acc2ae49f9b4a571 | refs/heads/master | 2020-05-05T09:07:36.784505 | 2019-04-06T22:06:27 | 2019-04-06T22:06:27 | 179,891,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,400 | java | package group787.utor.flylocity.flights;
import java.math.BigDecimal;
import java.util.GregorianCalendar;
/**
* A representation of a single flight with the appropriate characteristics
* including origin and destination.
*/
public class Flight {
// Information on a specific flight to be stored for this instance
private String flightNumber;
private String[] departureDateandTime;
private String[] arrivalDateandTime;
private String airline;
private String origin;
private String destination;
private BigDecimal cost;
private int numSeats;
/**
* Create an instance of a Flight.
* @param flightnumber the flight number of this Flight
* @param deperatureDateandTime the string array containing departure
* date and time
* @param arrivalDateandTime the string array containing arrival date
* and time
* @param airline the airline of this Flight
* @param origin the origin of this Flight
* @param destination the destination of this Flight
* @param cost the price of this Flight as a BigDecimal
*/
public Flight(String flightnumber, String[] deperatureDateandTime,
String[] arrivalDateandTime, String airline, String origin,
String destination, BigDecimal cost, int numSeats){
this.flightNumber = flightnumber;
this.departureDateandTime = deperatureDateandTime;
this.arrivalDateandTime = arrivalDateandTime;
this.airline = airline;
this.origin = origin;
this.destination = destination;
this.cost = cost;
this.numSeats = numSeats;
}
/**
* Returns the flight number of this Flight.
* @return flight number of this Flight
*/
public String getFlightnumber() {
return this.flightNumber;
}
/**
* Changes the flight number of this Flight.
* @param flightnumber of this Flight
*/
public void setFlightnumber(String flightnumber) {
this.flightNumber = flightnumber;
}
/**
* Get the departure date and time of this flight.
* @return array of the departure date and time
*/
public String[] getDepartureDateandTime() {
return departureDateandTime;
}
/**
* Set the departure date and time of this flight.
* @param departureDateandTime array of the departure date and time
*/
public void setDepartureDateandTime(String[] departureDateandTime) {
this.departureDateandTime = departureDateandTime;
}
/**
* Get the arrival date and time of this flight.
* @return array of the arrival date and time of this flight
*/
public String[] getArrivalDateandTime() {
return arrivalDateandTime;
}
/**
* Set arrival date and time of this flight.
* @param arrivalDateandTime array of the arrival date and time
* of this flight
*/
public void setArrivalDateandTime(String[] arrivalDateandTime) {
this.arrivalDateandTime = arrivalDateandTime;
}
/**
* Return the GregorianCalendar object of the departure
* date of this flight.
* @return Gregorian Calendar object of the departure date and time
*/
public GregorianCalendar getDepartureCalendar(){
String[] departDate = this.departureDateandTime[0].split("-");
String[] departTime = this.departureDateandTime[1].split(":");
int year = Integer.parseInt(departDate[0]);
int month = Integer.parseInt(departDate[1]);
int day = Integer.parseInt(departDate[2]);
int hour = Integer.parseInt(departTime[0]);
int min = Integer.parseInt(departTime[1]);
GregorianCalendar calendar =
new GregorianCalendar(year, month, day, hour, min);
return calendar;
}
/**
* Return the GregorianCalendar object of the arrival
* date of this flight.
* @return Gregorian Calendar object of the arrival date and time
*/
public GregorianCalendar getArrivalCalendar(){
String[] arrivalDate = this.arrivalDateandTime[0].split("-");
String[] arrivalTime = this.arrivalDateandTime[1].split(":");
int year = Integer.parseInt(arrivalDate[0]);
int month = Integer.parseInt(arrivalDate[1]);
int day = Integer.parseInt(arrivalDate[2]);
int hour = Integer.parseInt(arrivalTime[0]);
int min = Integer.parseInt(arrivalTime[1]);
GregorianCalendar calendar =
new GregorianCalendar(year, month, day, hour, min);
return calendar;
}
/**
* Returns name of the airline of this Flight.
* @return the airline name of this Flight
*/
public String getAirline() {
return this.airline;
}
/**
* Changes the name of the airline of this Flight.
* @param airline the name of the airline of this Flight
*/
public void setAirline(String airline) {
this.airline = airline;
}
/**
* Gets the origin of this Flight.
* @return the origin location of this Flight
*/
public String getOrigin() {
return this.origin;
}
/**
* Changes the origin of this Flight.
* @param origin location of this Flight
*/
public void setOrigin(String origin) {
this.origin = origin;
}
/**
* Returns the destination of this Flight
* @return destination
*/
public String getDestination() {
return this.destination;
}
/**
* Changes the destination of this Flight.
* @param destination location of this Flight
*/
public void setDestination(String destination) {
this.destination = destination;
}
/**
* Returns the cost of this Flight.
* @return cost of this Flight
*/
public BigDecimal getCost() {
return cost;
}
/**
* Changes the cost of this Flight.
* @param cost of this Flight
*/
public void setCost(BigDecimal cost) {
this.cost = cost;
}
/**
* Get the number of seats in this Flight.
* @return the number of seats in this Flight
*/
public int getNumSeats() {
return numSeats;
}
/**
* Get the number of seats in this Flight.
* @param numSeats the number of seats in this Flight
*/
public void setNumSeats(int numSeats) {
this.numSeats = numSeats;
}
/**
* Return the string representation of this flight,
* in the format:
* Number,DepartureDateTime,ArrivalDateTime,Airline,Origin,
* Destination,Price
*/
@Override
public String toString() {
String returnString = "";
returnString += this.flightNumber + ",";
returnString += this.departureDateandTime[0] + " ";
returnString += this.departureDateandTime[1] + ",";
returnString += this.arrivalDateandTime[0] + " ";
returnString += this.arrivalDateandTime[1] + ",";
returnString += this.airline + ",";
returnString += this.origin + ",";
returnString += this.destination + ",";
returnString += this.cost.toString();
return returnString;
}
}
| [
"jonathan.pelastine@gmail.com"
] | jonathan.pelastine@gmail.com |
b0b2afe4379bd9420420c701b93d70a1e2549a9c | c4402330c4ff8340a7f306cb6d528835c129acaf | /app/src/main/java/com/sendi/picture_recognition/model/abstract_act/AbsAlertUserInfoModel.java | 763f1879da2b54acb24007a005bb42d68d2d8c99 | [] | no_license | asendiLin/Picture_recognition | 1c6b172b80381f210307960f160662b9030b886c | 4991357dbfbf8d8d5a1b81adf93d2dbc33a639ae | refs/heads/master | 2021-09-01T01:33:25.689023 | 2017-12-24T05:48:19 | 2017-12-24T05:48:19 | 113,945,657 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,373 | java | package com.sendi.picture_recognition.model.abstract_act;
import android.content.Context;
import com.sendi.picture_recognition.base.BaseModel;
import com.sendi.picture_recognition.bean.BaseEntity;
import com.sendi.userdb.User;
import com.sendi.userdb.UserDao;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
/**
* Created by Administrator on 2017/12/8.
*/
public abstract class AbsAlertUserInfoModel extends BaseModel {
protected User mUser=null;
protected UserDao mUserDao=null;
public abstract Observable<BaseEntity<String>> alertUerPic(List<MultipartBody.Part> partList);
public abstract Observable<BaseEntity<String>> alertUerNickname(String nickname, String vId);
public abstract Observable<BaseEntity<String>> alertUserPhoneNumber(String phoneNumber, String code,
String userName);
public abstract Observable<BaseEntity<String>> alertUserGender(String gender, String vId);
public abstract Observable<BaseEntity<String>> alertUserHobbies(String hobbies,String vId);
public abstract Observable<BaseEntity<String>> getCode(String phoneNumber);
public abstract User initUser(Context context);
public User getUser(){
return mUser;
}
//更新数据库
public abstract void alertUser();
}
| [
"a_sendi@163.com"
] | a_sendi@163.com |
8ff0b15da12227c46b1ff09d85d4b198fe4fec18 | d383d855e48ee2f5da65791f4052533eca339369 | /src/test/java/com/alibaba/druid/bvt/sql/oceanbase/OceanbaseCreateTableTest_subPartition.java | 5131f927699a9e124c512d87497549ffdb2771af | [
"Apache-2.0"
] | permissive | liuxing7954/druid-source | 0e2dc0b1a2f498045b8689d6431764f4f4525070 | fc27b5ac4695dc42e1daa62db012adda7c217d36 | refs/heads/master | 2022-12-21T14:53:26.923986 | 2020-02-29T07:15:15 | 2020-02-29T07:15:15 | 243,908,145 | 1 | 1 | NOASSERTION | 2022-12-16T09:54:44 | 2020-02-29T05:07:04 | Java | UTF-8 | Java | false | false | 3,775 | java | /*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.bvt.sql.oceanbase;
import java.util.List;
import org.junit.Assert;
import com.alibaba.druid.sql.MysqlTest;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlSchemaStatVisitor;
public class OceanbaseCreateTableTest_subPartition extends MysqlTest {
public void test_0() throws Exception {
String sql = "CREATE TABLE ts (id INT, purchased DATE) " //
+ "PARTITION BY RANGE(YEAR(purchased)) " //
+ "SUBPARTITION BY HASH(TO_DAYS(purchased)) " //
+ "SUBPARTITIONS 2 ( " //
+ "PARTITION p0 VALUES LESS THAN (1990), " //
+ "PARTITION p1 VALUES LESS THAN (2000), " //
+ "PARTITION p2 VALUES LESS THAN MAXVALUE )"; //
MySqlStatementParser parser = new MySqlStatementParser(sql);
List<SQLStatement> stmtList = parser.parseStatementList();
SQLStatement stmt = stmtList.get(0);
{
String result = SQLUtils.toMySqlString(stmt);
Assert.assertEquals("CREATE TABLE ts ("
+ "\n\tid INT,"
+ "\n\tpurchased DATE"
+ "\n)"
+ "\nPARTITION BY RANGE (YEAR(purchased))"
+ "\nSUBPARTITION BY HASH (TO_DAYS(purchased)) SUBPARTITIONS 2 ("
+ "\n\tPARTITION p0 VALUES LESS THAN (1990),"
+ "\n\tPARTITION p1 VALUES LESS THAN (2000),"
+ "\n\tPARTITION p2 VALUES LESS THAN MAXVALUE"
+ "\n)",
result);
}
{
String result = SQLUtils.toMySqlString(stmt, SQLUtils.DEFAULT_LCASE_FORMAT_OPTION);
Assert.assertEquals("create table ts ("
+ "\n\tid INT,"
+ "\n\tpurchased DATE"
+ "\n)"
+ "\npartition by range (YEAR(purchased))"
+ "\nsubpartition by hash (TO_DAYS(purchased)) subpartitions 2 ("
+ "\n\tpartition p0 values less than (1990),"
+ "\n\tpartition p1 values less than (2000),"
+ "\n\tpartition p2 values less than maxvalue"
+ "\n)",
result);
}
Assert.assertEquals(1, stmtList.size());
MySqlSchemaStatVisitor visitor = new MySqlSchemaStatVisitor();
stmt.accept(visitor);
System.out.println("Tables : " + visitor.getTables());
System.out.println("fields : " + visitor.getColumns());
System.out.println("coditions : " + visitor.getConditions());
System.out.println("orderBy : " + visitor.getOrderByColumns());
Assert.assertEquals(1, visitor.getTables().size());
Assert.assertEquals(2, visitor.getColumns().size());
Assert.assertEquals(0, visitor.getConditions().size());
// Assert.assertTrue(visitor.getTables().containsKey(new TableStat.Name("t_basic_store")));
}
}
| [
"jixiaoyi@apexsoft.com.cn"
] | jixiaoyi@apexsoft.com.cn |
a100a291e70a5ab4c8b7797860d3e9d7ba701440 | 26e5528539f528bed3f19b051e0f613cea17950c | /app/src/main/java/com/ingdanielpadilla/gps/Gps2Activity.java | 657d41f9f1f378e4ea0462244fa4d475f6335544 | [] | no_license | dann1609/Gps | 4845a16640de7c8acbe4dfba60793e92b8c00189 | 02211118de5cd0b16169c596d5344257795a96ee | refs/heads/master | 2021-01-10T12:48:09.725308 | 2015-10-28T06:19:13 | 2015-10-28T06:19:13 | 45,027,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,216 | java | package com.ingdanielpadilla.gps;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;
import android.widget.ToggleButton;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
public class Gps2Activity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener,com.google.android.gms.location.LocationListener {
private GoogleApiClient mGoogleApiClient;
public static final long UPDATE_INTERVAL_IN_MILLISECONDS=10000,FASTED_UPDATE_INTERVAL_IN_MILLISECONDS=UPDATE_INTERVAL_IN_MILLISECONDS/2;
LocationRequest mLocationRequest;
TextView vlat,vlon, tdata;
String data;
Integer priority=LocationRequest.PRIORITY_LOW_POWER;
View.OnClickListener handler;
ToggleButton tb1,tb2,tb3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gps2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
tb1 = (ToggleButton)findViewById(R.id.tb1);
tb2 = (ToggleButton)findViewById(R.id.tb2);
tb3 = (ToggleButton)findViewById(R.id.tb3);
tb1.setChecked(true);
handler = new View.OnClickListener() {
@Override
public void onClick(View view) {
ToggleButton tg = (ToggleButton) view;
if (tg.isChecked()) {
switch (view.getId()) {
case R.id.tb1:
tb2.setChecked(false);
tb3.setChecked(false);
priority=LocationRequest.PRIORITY_LOW_POWER;
Snackbar.make(view, "gps1", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
break;
case R.id.tb2:
tb1.setChecked(false);
tb3.setChecked(false);
priority=LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY;
Snackbar.make(view, "gps2", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
break;
case R.id.tb3:
tb1.setChecked(false);
tb2.setChecked(false);
priority=LocationRequest.PRIORITY_HIGH_ACCURACY;
Snackbar.make(view, "gps2", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
break;
default:
break;
}
}
}
};
tb1.setOnClickListener(handler);
tb2.setOnClickListener(handler);
tb3.setOnClickListener(handler);
data="";
vlat = (TextView) findViewById(R.id.lat);
vlon = (TextView) findViewById(R.id.lon);
tdata= (TextView) findViewById(R.id.data);
mGoogleApiClient=new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
mLocationRequest=new LocationRequest();
mLocationRequest.setInterval(UPDATE_INTERVAL_IN_MILLISECONDS);
mLocationRequest.setFastestInterval(FASTED_UPDATE_INTERVAL_IN_MILLISECONDS);
mLocationRequest.setPriority(priority);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
protected void onStart() {
super.onStart();
mGoogleApiClient.connect();
Snackbar.make(findViewById(R.id.fab), "Connecting" , Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
@Override
public void onConnected(Bundle bundle) {
Snackbar.make(findViewById(R.id.fab), "Connected" , Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
@Override
public void onLocationChanged(Location location) {
vlat.setText(location.getLatitude() + "");
vlon.setText(location.getLongitude() + "");
data=data+Double.toString(location.getLatitude())+" "+ Double.toString(location.getLongitude())+" \n";
tdata.setText(data);
}
@Override
public void onStatusChanged(String s, int i, Bundle bundle) {
}
@Override
public void onProviderEnabled(String s) {
}
@Override
public void onProviderDisabled(String s) {
}
public void startGPS(View view) {
if(!mGoogleApiClient.isConnected())
{
mGoogleApiClient.connect();
}
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, (com.google.android.gms.location.LocationListener) this);
}
public void stopGPS(View view) {
stopLocationUpdates();
}
protected void stopLocationUpdates() {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, (com.google.android.gms.location.LocationListener) this);
}
}
| [
"danperzipa@hotmail.com"
] | danperzipa@hotmail.com |
857683e5080db7cb23f1abc6beb1c831d6b55a18 | 6ab4afd0aa20b953d8a03a7bc4d761540dcf6041 | /wxService/src/com/hd/util/CommonUtils.java | 6614bcc4f0ecc81c20dbb639af325d7e73e155a7 | [] | no_license | WatermelonKiller/WeiXinService | 4f9b3b71427bae0e7863da48772763e3c0edba5e | 968f0367bc2fead0f9d94f645fb58954ea62f6df | refs/heads/master | 2021-01-17T19:12:48.815259 | 2016-07-06T23:56:22 | 2016-07-06T23:56:22 | 62,524,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,288 | java | package com.hd.util;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.Random;
import javax.servlet.http.HttpServletRequest;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
public class CommonUtils
{
public CommonUtils()
{
}
/**
* 调用System.out.println()输出
* @param str
*/
public static void deBug(Object str)
{
System.out.println(str);
}
public static void deBug()
{
System.out.println();
}
/**
* 取值去空,如值等于null 匹配默认值
* @param request
* @param VarName
* @param DefaultValue
* @return
*/
public static String getParameter(HttpServletRequest request, String VarName, String DefaultValue)
{
String Value = request.getParameter(VarName);
Value = Value != null ? Value.trim() : DefaultValue;
return Value;
}
/**
* 取值转型(UTF-8)去空,如值等于null 匹配默认值
* @param request
* @param VarName
* @param DefaultValue
* @return
* @throws UnsupportedEncodingException
*/
public static String getParameterISO(HttpServletRequest request, String VarName, String DefaultValue) throws UnsupportedEncodingException
{
String Value =new String(request.getParameter(VarName).getBytes("ISO8859_1"),"UTF-8");
Value = Value != null ? Value.trim() : DefaultValue;
return Value;
}
/**
* 转型(UTF-8)
* @param str
* @return
*/
public static String getStr(String str)
{
if (str == null) return null;
try
{
byte[] temp_t = str.getBytes("UTF-8");
return new String(temp_t);
}
catch(Exception e)
{
e.printStackTrace();
}
return "";
}
/**
* TEXT 或 TEXTAREA 存库时使用
* @param src
* @return
*/
public static String HTMLEncode(String src)
{
StringBuffer newString = new StringBuffer();
if(src==null)
return " ";
char next;
for(int i=0;i<src.length();i++)
{
next = src.charAt(i);
/*if(next=='>')
newString.append(">");
else if(next=='<')
newString.append("<");
else if(next=='&')
newString.append("&");
else if(next=='"')
newString.append(""");
else if(next==39) // The "'"
newString.append("’");*/
if(next==13)
newString.append("<br>");
else if(next==' ')
newString.append(" ");
else
newString.append(next);
}
return newString.toString();
}
public static String HTMLEncodeAll(String src)
{
StringBuffer newString = new StringBuffer();
if(src==null)
return " ";
char next;
for(int i=0;i<src.length();i++)
{
next = src.charAt(i);
if(next=='>')
newString.append(">");
else if(next=='<')
newString.append("<");
else if(next=='&')
newString.append("&");
else if(next=='"')
newString.append(""");
else if(next==39) // The "'"
newString.append("’");
if(next==13)
newString.append("<br>");
else if(next==' ')
newString.append(" ");
else
newString.append(next);
}
return newString.toString();
}
/**
* TEXT 或 TEXTAREA 库中取值时使用
* @param src
* @return
*/
public static String HTMLReverse(String src){
if(src!=null){
src=src.replaceAll("<br>", "");
src=src.replaceAll(" ", " ");
}
return src;
}
public static String returnIdByAddZero(String id, int num)
{
int len = id.length();
if(len >= num )
return id;
String newId = "";
for(int x = 0 ; x < num - len ; x++)
{
newId = newId +"0";
}
return newId + id;
}
public static String getStrFour(String str){
String s="0";
for(int i=str.length();i<5;i++){
str=str.concat(s);
}
return str;
}
/**
* @author 矫健
* @time Feb 15, 2011
* @param e 异常
* 方法功能:打印异常信息
*/
public static void printE(Exception e)
{
e.printStackTrace() ;
}
/**
*
* @author 王闯
* @time 2011-8-1
* @param obj
* 方法功能:入参为标准javabean,将javabean中的所有String类型属性判空,如果为空则调用该属性setMethod将其赋为空字符串。
* 所属模块:用于所有前台页面显示,避免前台出现null列
*/
@SuppressWarnings("unchecked")
public static void beanTrimNull(Object obj){
//获得对象的Class
Class classType = obj.getClass();
//获得对象的所有属性
Field[] fields=classType.getDeclaredFields();
String returnType = "";
try {
for(int i=0;i<fields.length;i++){
//获取数组中对应的属性
Field field=fields[i];
String fieldName=field.getName();
String stringLetter=fieldName.substring(0, 1).toUpperCase();
//获得相应属性的getXXX和setXXX方法名称
String getName="get"+stringLetter+fieldName.substring(1);
String setName="set"+stringLetter+fieldName.substring(1);
//获取相应的方法
Method getMethod=classType.getMethod(getName, new Class[]{});
Method setMethod=classType.getMethod(setName, new Class[]{field.getType()});
//调用源对象的getXXX()方法
Object value=getMethod.invoke(obj, new Object[]{});
//如果为字符串类型,并且为Null 调用set方法置为空
returnType = getMethod.getReturnType().toString();
if("class java.lang.String".equalsIgnoreCase(returnType)){
if( null == value ){
setMethod.invoke(obj,new Object[]{""});
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* @param size 保留位数
* @param number 对应数字
* @return
* 方法功能: double型数字 四舍五入
*/
public static String formatDouble(int size,double number){
number=Roundoff4(number);
if(number==0d){
return "0";
}
String numStr = String.valueOf(number);
if(numStr.indexOf(".") != -1){
//取整数部分
String a = numStr.substring(0, numStr.indexOf("."));
int aint=Integer.parseInt(a);
//取小数部分
String b = numStr.substring(numStr.indexOf(".")+1);
//小数长度
int strLength = b.length();
//小数长度大于想要取的位数
if(strLength>size){
String aa = b.substring(size, size+1);
String aa1 = b.substring(0,size-1);
int aa1int=Integer.parseInt(aa1);
String bianwei = b.substring(size-1, size);
int bianweiInt = Integer.parseInt(bianwei);
String aa2 = b.substring(0, size);
int aaa = Integer.parseInt(aa);
if(aaa>=5){
bianweiInt = bianweiInt+1;
if(bianweiInt==10){
aa1int=aa1int+1;
bianweiInt=0;
if(aa1int==10){
aint=aint+1;
aa1int=0;
}
}
return aint+"."+aa1int+String.valueOf(bianweiInt);
}
if(aaa<5){
return "0".equals(aa2)? String.valueOf(aint) :aint+"."+aa2;
}
}
if(strLength<=size){
if("0".equals(b)){
return a;
}else{
return numStr;
}
}
}
return "0" ;
}
public static Double Roundoff4(Double num){
try {
BigDecimal b=new BigDecimal(num);
} catch (Exception e) {
return num;
}
if(num!=null){
BigDecimal b=new BigDecimal(num);
num=b.setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue();
return num;
}
return null;
}
//获取一个字母加数字的随机字符串:
public static String getCharacterAndNumber(int length) {
String password = "";
Random random = new Random();
for(int i = 0; i < length; i++) {
String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num"; // 输出字母还是数字
if("char".equalsIgnoreCase(charOrNum)){ // 字符串
int choice = random.nextInt(2) % 2 == 0 ? 65 : 97; //取得大写字母还是小写字母
password += (char) (choice + random.nextInt(26));
}else if("num".equalsIgnoreCase(charOrNum)) { // 数字
password += String.valueOf(random.nextInt(10));
}
}
return password;
}
//获取一个64位字母加数字的随机字符串:
public static String getCharacterAndNumber() {
String password = "";
Random random = new Random();
for(int i = 0; i < 64; i++) {
String charOrNum = random.nextInt(2) % 2 == 0 ? "char" : "num"; // 输出字母还是数字
if("char".equalsIgnoreCase(charOrNum)){ // 字符串
int choice = random.nextInt(2) % 2 == 0 ? 65 : 97; //取得大写字母还是小写字母
password += (char) (choice + random.nextInt(26));
}else if("num".equalsIgnoreCase(charOrNum)) { // 数字
password += String.valueOf(random.nextInt(10));
}
}
return password;
}
public static void main(String[] args) {
System.out.println(getCharacterAndNumber());
}
/**
* 将字符串中的中文转化为拼音,其他字符不变
*
* @param inputString
* @return
*/
public static String getPingYin(String inputString) {
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
format.setVCharType(HanyuPinyinVCharType.WITH_V);
char[] input = inputString.trim().toCharArray();
String output = "";
try {
for (int i = 0; i < input.length; i++) {
if (java.lang.Character.toString(input[i]).matches("[\\u4E00-\\u9FA5]+")) {
String[] temp = PinyinHelper.toHanyuPinyinStringArray(input[i], format);
output += temp[0];
} else {
output += java.lang.Character.toString(input[i]);
}
}
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
return output;
}
/**
* 获取汉字串拼音首字母,英文字符不变
* @param chinese 汉字串
* @return 汉语拼音首字母
*/
public static String getFirstSpell(String chinese) {
StringBuffer pybf = new StringBuffer();
char[] arr = chinese.toCharArray();
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
for (int i = 0; i < arr.length; i++) {
if (arr[i] > 128) {
try {
String[] temp = PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat);
if (temp != null) {
pybf.append(temp[0].charAt(0));
}
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
} else {
pybf.append(arr[i]);
}
}
return pybf.toString().replaceAll("\\W", "").trim();
}
/**
* 获取汉字串拼音,英文字符不变
* @param chinese 汉字串
* @return 汉语拼音
*/
public static String getFullSpell(String chinese) {
StringBuffer pybf = new StringBuffer();
char[] arr = chinese.toCharArray();
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
for (int i = 0; i < arr.length; i++) {
if (arr[i] > 128) {
try {
pybf.append(PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat)[0]);
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
} else {
pybf.append(arr[i]);
}
}
return pybf.toString();
}
}
| [
"edward19880502@vip.qq.com"
] | edward19880502@vip.qq.com |
cab01723541199ecaad623ed46a25c09b1f36584 | 38e61013f0cbdb290a83c7b901cf968b728d5f26 | /JPACRUDProjectCOPY/src/com/capgemini/jpa/service/EmployeeServiceImpl.java | b0f4da0f4e996a721e5c5b467562289f8f948593 | [] | no_license | Hitee/Test | 0614f62a137292dc287e7f7071c96d182368a0d9 | 0355d83b7d036e43e7e18965362132a73ebbd9ce | refs/heads/master | 2022-08-08T20:43:08.996370 | 2019-09-20T18:09:35 | 2019-09-20T18:09:35 | 209,848,264 | 0 | 0 | null | 2022-06-29T17:39:41 | 2019-09-20T17:42:40 | JavaScript | UTF-8 | Java | false | false | 1,429 | java | package com.capgemini.jpa.service;
import java.util.List;
import com.capgemini.jpa.dao.EmployeeDaoImpl;
import com.capgemini.jpa.dao.IEmployeeDAO;
import com.capgemini.jpa.entity.Employee;
import com.capgemini.jpa.exception.EmployeeException;
public class EmployeeServiceImpl implements IEmployeeService {
private IEmployeeDAO employeeDAO=new EmployeeDaoImpl();
@Override
public void addNewEmployee(Employee employee) throws EmployeeException {
employeeDAO.addNewEmployee(employee);
}
@Override
public void showEmployee(Integer accno, Integer pin) throws EmployeeException {
// TODO Auto-generated method stub
employeeDAO.showEmployee(accno, pin);
}
@Override
public void depositEmployee(Integer accno, Double dep) throws EmployeeException {
// TODO Auto-generated method stub
employeeDAO.depositEmployee(accno, dep);
}
@Override
public void withdrawEmployee(Integer accno, Double withdraw, Integer pin)
throws EmployeeException {
// TODO Auto-generated method stub
employeeDAO.withdrawEmployee(accno, withdraw, pin);
}
@Override
public void fundTransfer(Integer from, Integer to, Double transfer) throws EmployeeException {
// TODO Auto-generated method stub
employeeDAO.fundTransfer(from, to, transfer);
}
@Override
public void printTransaction(Integer accno)
throws EmployeeException {
// TODO Auto-generated method stub
employeeDAO.printTransaction(accno);
}
}
| [
"hiteesachdeva96@gmail.com"
] | hiteesachdeva96@gmail.com |
79b8d5f6904b10225fcb64ddf3f536e7064740d5 | f8305902a4e664d3491aafd1a5ae3c78194a1a21 | /src/main/java/ru/itis/controller/SearchController.java | 080e34c0083ff0ed32796fb53f6d2892625505df | [] | no_license | amourety/springshop | b77a1ff1735c582496a35f6a33f214ea487fbcdc | 090aee0b9278a03a64577e7551848aad6012d21e | refs/heads/master | 2022-12-23T12:33:05.775005 | 2020-03-06T08:24:16 | 2020-03-06T08:24:16 | 173,770,209 | 0 | 1 | null | 2022-12-16T08:47:57 | 2019-03-04T15:24:56 | JavaScript | UTF-8 | Java | false | false | 1,207 | java | package ru.itis.controller;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import ru.itis.models.Product;
import ru.itis.services.SearchService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Controller
@RequestMapping(value = "/search")
public class SearchController {
@Autowired
private SearchService service;
@SneakyThrows
@ResponseBody
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<List<Product>> search(HttpServletRequest req, HttpServletResponse resp){
req.setCharacterEncoding("UTF-8");
resp.setCharacterEncoding("UTF-8");
String query = req.getParameter("q");
if (query != null) {
List<Product> result = service.search(query);
return ResponseEntity.ok(result);
}
return null;
}
}
| [
"amourety@gmail.com"
] | amourety@gmail.com |
d8c3431ed1b18c3e92dd41b567d03a61266e8530 | b8d60239a3c5ea1fb16dfcd45b3190498dfb36a5 | /app/src/main/java/com/jinfukeji/jinyihuiup/adapter/ShangHaiJinAdapter.java | 0ec74728f2110fe6ae912d900ac04bc84d2db244 | [] | no_license | yuxinhui/HangZhou | b8fe4e55c65004eaa86ad84cc20276af84585fd2 | 90d80b6882077147f1fa755d2c9a3761f0961e85 | refs/heads/master | 2020-06-14T18:31:05.376058 | 2016-12-02T01:32:09 | 2016-12-02T01:32:09 | 75,346,799 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,540 | java | package com.jinfukeji.jinyihuiup.adapter;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.jinfukeji.jinyihuiup.R;
import com.jinfukeji.jinyihuiup.bean.ShangHaiJinData;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 包:com.yuxinhui.text.myapplication.adapter
* Create By:"于志渊"
* 时间:23:06
* 描述:在行情界面显示上海金的适配器
*/
public class ShangHaiJinAdapter extends BaseAdapter {
private List<ShangHaiJinData> list;
private Context context;
public ShangHaiJinAdapter(List<ShangHaiJinData> list, Context context) {
this.list = list;
this.context = context;
}
public void initList(ArrayList<ShangHaiJinData> list){
this.list.clear();
this.list.addAll(list);
notifyDataSetChanged();
}
@Override
public int getCount() {
if (list!=null){
return list.size();
}
return 0;
}
@Override
public ShangHaiJinData getItem(int position) {
if (list!=null){
return list.get(position);
}
return null;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
viewHodle holder;
if (convertView==null){
holder=new viewHodle();
LayoutInflater inflater= LayoutInflater.from(context);
convertView=inflater.inflate(R.layout.hangqing_item,null);
holder.name= (TextView) convertView.findViewById(R.id.name);
holder.newPrice= (TextView) convertView.findViewById(R.id.newPrice);
holder.changePercent= (TextView) convertView.findViewById(R.id.changePercent);
holder.time= (TextView) convertView.findViewById(R.id.uptime);
holder.low= (TextView) convertView.findViewById(R.id.low);
holder.high= (TextView) convertView.findViewById(R.id.high);
convertView.setTag(holder);
}else {
holder= (viewHodle) convertView.getTag();
}
ShangHaiJinData data = getItem(position);
/*try {
holder.name.setText(new String(data.getName().getBytes("ISO-8859-1"), "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}*/
holder.name.setText(data.getName());
holder.newPrice.setText(data.getNewPrice()+"");
double v = data.getChangePercent() * 100;
int textColor;
if(v<0){
textColor = Color.rgb(64, 205, 157);
}else {
textColor = Color.rgb(247, 90, 88);
}
holder.changePercent.setTextColor(textColor);
holder.newPrice.setTextColor(textColor);
DecimalFormat df=new DecimalFormat("#0.00");
holder.changePercent.setText(df.format(v)+"%");
SimpleDateFormat sdf=new SimpleDateFormat("hh:mm:ss");
String format = sdf.format(new Date(data.getTime()));
holder.time.setText(format);
holder.low.setText(data.getLow()+"");
holder.high.setText(data.getHigh()+"");
return convertView;
}
private class viewHodle{
private TextView name,newPrice,changePercent,time,low,high;
}
}
| [
"yuxinhui000000"
] | yuxinhui000000 |
b5010c3f3f48030775cea294a059d902ea67327a | 40cf42ca6afb5a5dac8bdf990272a46b71575f26 | /Core Java/1.Taking Input/Square.java | 29e88de19b0c475853721f522b85744ac2f75bfc | [] | no_license | imdurgeshpal/JavaPrograms | a25235a92570d020c39c6e2ecccbd17bcd065aeb | ec475d8ca56a10fd43cf178e46dda7a6ffa0a171 | refs/heads/master | 2021-07-10T14:34:45.690035 | 2017-10-14T07:10:56 | 2017-10-14T07:10:56 | 106,906,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | import java.util.*;
class Square{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter the number");
Double a=sc.nextDouble();
System.out.println("Square of the number is :"+(a*a));
}
} | [
"imdurgeshpal@gmail.com"
] | imdurgeshpal@gmail.com |
7ae28b8536e5c8cd9ce67af5a8b50e5bea428f0d | 2f2ac81b45a240e191c2ebe68efd88b7eaeeb325 | /src/main/java/viewGUI/ShowingDelete.java | 9834c79bea531d659d7b06df436f847d5908cbc8 | [] | no_license | gitpawelo/CinemaApp | 73caacf3febfe1ad984ea3be6a42e5ac64c9c132 | aea71fd93ed76efaa0f49bf870e5590019a8702a | refs/heads/master | 2022-12-08T12:04:07.433831 | 2019-07-11T11:47:27 | 2019-07-11T11:47:27 | 196,378,238 | 1 | 0 | null | 2022-11-24T07:52:24 | 2019-07-11T11:04:34 | Java | UTF-8 | Java | false | false | 2,361 | java | package viewGUI;
import model.Showing;
import model.dao.ShowingDAOImplement;
import utility.ComboBoxShowingModel;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ShowingDelete extends JFrame {
private JPanel mainPanel;
private JComboBox showingComboBox;
private JLabel showingLabel;
private JButton menuButton;
private JButton deleteButton;
private JButton adminPanelButton;
public ShowingDelete() {
setContentPane(mainPanel);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);
setSize(600, 300);
setLocationRelativeTo(null);
initComboBox();
menuButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new CRUDMovieShowing();
dispose();
}
});
adminPanelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new ChooseAdminClient();
dispose();
}
});
deleteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFrame frame = new JFrame();
ShowingDAOImplement showingDAOImplement = new ShowingDAOImplement();
Showing showing = (Showing) showingComboBox.getSelectedItem();
int confirm = JOptionPane.showConfirmDialog(frame, "Are you sure You want to delete " + showing + " from database?", "Please confirm", JOptionPane.YES_NO_OPTION);
if (confirm == JOptionPane.YES_OPTION) {
showingDAOImplement.removeShowing(showing);
dispose();
new ShowingDelete();
} else {
dispose();
new ShowingDelete();
}
}
});
}
public void initComboBox() {
ShowingDAOImplement showingDAOImplement = new ShowingDAOImplement();
showingComboBox.setModel(new ComboBoxShowingModel(showingDAOImplement.getShowingList()));
showingComboBox.setSelectedItem(ListSelectionModel.SINGLE_SELECTION);
}
}
| [
"gitpawelo@wp.pl"
] | gitpawelo@wp.pl |
757a2da0b6f8f8279d035ce246a9a8030dcd6c09 | be94654dfcc885efa0d5d032bc8c051dd02513be | /Source Code/Clones/game/com/luke/clones/sound/SoundManager.java | cf1bda69c24af75bf7fb646a2b3a045a662af196 | [
"MIT"
] | permissive | mosheepdev/ClonesOnline | 3d78d8f2f56c8767fb022a68f3659696ca2ed7c9 | 3715cf112b533b65114e9cf0c5ba0f5a92537ba4 | refs/heads/master | 2021-01-22T01:47:48.049027 | 2016-12-05T21:45:34 | 2016-12-05T21:45:34 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 2,727 | java | package com.luke.clones.sound;
import java.util.HashMap;
import java.util.Map;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Sound;
import com.luke.clones.settings.SettingType;
import com.luke.clones.settings.SettingsManager;
/* The MIT License (MIT)
Copyright (c) 2016 Łukasz Dziak
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. */
public class SoundManager {
public static final SoundManager INSTANCE = new SoundManager();
Map<SoundType, Sound> soundMap;
private SoundManager(){
soundMap = new HashMap<SoundType, Sound>();
soundMap.put(SoundType.JUMP, Gdx.audio.newSound(Gdx.files.internal("data/sounds/jump.wav")));
soundMap.put(SoundType.CLONE, Gdx.audio.newSound(Gdx.files.internal("data/sounds/clone.wav")));
soundMap.put(SoundType.LOSE, Gdx.audio.newSound(Gdx.files.internal("data/sounds/lose.wav")));
soundMap.put(SoundType.WIN, Gdx.audio.newSound(Gdx.files.internal("data/sounds/win.wav")));
soundMap.put(SoundType.CLICK, Gdx.audio.newSound(Gdx.files.internal("data/sounds/click2.wav")));
}
public void play(SoundType soundToPlayType){
if(isSoundOn()){
playSoundWithFullVolume(soundToPlayType);
}
}
public void play(SoundType soundToPlayType, float volume){
if(isSoundOn()){
playSoundWithSpecifiedVolume(soundToPlayType, volume);
}
}
private boolean isSoundOn(){
return SettingsManager.getSettingValue(SettingType.SOUND_ON);
}
private void playSoundWithFullVolume(SoundType soundToPlayType){
Sound soundToPlay = soundMap.get(soundToPlayType);
soundToPlay.play(soundToPlayType.getVolume());
}
private void playSoundWithSpecifiedVolume(SoundType soundToPlayType, float volume){
Sound soundToPlay = soundMap.get(soundToPlayType);
soundToPlay.play(volume);
}
} | [
"lukedd@gmail.com"
] | lukedd@gmail.com |
34410f5232952fa959fef2e1af0d38e5ab11051b | 194acce9999ebea39d5fd210000b71554ddbb5ed | /src/nl/mprog/projects/studentschoice10419667/MusicIntentReceiver.java | f5ed572cf99008db1bb02643fd3c2071e1a5b7fb | [] | no_license | FlorisTurkenburg/StudentChoice10419667 | 6cdbc21b4d248f49be676c7fcc968a3ca50b95aa | 2d585c19d2adf1144ee9332b00042a145d4de269 | refs/heads/master | 2021-01-23T08:38:41.497628 | 2014-10-22T20:34:29 | 2014-10-22T20:34:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | /*
* AudioPlayer app
*
* Author: Floris Turkenburg
* UvANetID: 10419667
* Email: sk8_floris@hotmail.com
*
* This is the Students Choice project for the Native Apps Studio course
*/
package nl.mprog.projects.studentschoice10419667;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class MusicIntentReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(android.media.AudioManager.ACTION_AUDIO_BECOMING_NOISY)) {
Intent signal = new Intent(context, MediaPlayerService.class);
signal.setAction(MediaPlayerService.ACTION_PAUSE);
context.startService(signal);
}
}
}
| [
"sk8_floris@hotmail.com"
] | sk8_floris@hotmail.com |
02cfd6ef7a5b6cd25a89938febfc8855b700e4a2 | 3ef3e65f1a00085a9c20cf9d13282cd85987788b | /app/src/main/java/com/example/administrator/util/SensorEventHelper.java | 851e5f92dd9de7d6ede50c03a3e856be7c6370aa | [] | no_license | unbelievablecj/Onestep | b2dca2ea79402de849fc281bfb9e296229cbe729 | 6b2b47b08b87d1b90a215df96d7dbbbd80727804 | refs/heads/master | 2020-04-11T15:43:42.616992 | 2018-12-25T12:49:23 | 2018-12-25T12:49:23 | 161,901,003 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,447 | java | package com.example.administrator.util;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.view.Display;
import android.view.Surface;
import android.view.WindowManager;
import com.amap.api.maps.model.Marker;
public class SensorEventHelper implements SensorEventListener {
private SensorManager mSensorManager;
private Sensor mSensor;
private long lastTime = 0;
private final int TIME_SENSOR = 100;
private float mAngle;
private Context mContext;
private Marker mMarker;
public SensorEventHelper(Context context) {
mContext = context;
mSensorManager = (SensorManager) context
.getSystemService(Context.SENSOR_SERVICE);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
}
public void registerSensorListener() {
mSensorManager.registerListener(this, mSensor,
SensorManager.SENSOR_DELAY_NORMAL);
}
public void unRegisterSensorListener() {
mSensorManager.unregisterListener(this, mSensor);
}
public void setCurrentMarker(Marker marker) {
mMarker = marker;
}
public Marker getCurrentMarker() {
return mMarker;
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// TODO Auto-generated method stub
}
@Override
public void onSensorChanged(SensorEvent event) {
if (System.currentTimeMillis() - lastTime < TIME_SENSOR) {
return;
}
switch (event.sensor.getType()) {
case Sensor.TYPE_ORIENTATION: {
float x = event.values[0];
x += getScreenRotationOnPhone(mContext);
x %= 360.0F;
if (x > 180.0F)
x -= 360.0F;
else if (x < -180.0F)
x += 360.0F;
if (Math.abs(mAngle - x) < 3.0f) {
break;
}
mAngle = Float.isNaN(x) ? 0 : x;
if (mMarker != null) {
mMarker.setRotateAngle(360-mAngle);
}
lastTime = System.currentTimeMillis();
}
}
}
public static int getScreenRotationOnPhone(Context context) {
final Display display = ((WindowManager) context
.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
switch (display.getRotation()) {
case Surface.ROTATION_0:
return 0;
case Surface.ROTATION_90:
return 90;
case Surface.ROTATION_180:
return 180;
case Surface.ROTATION_270:
return -90;
}
return 0;
}
}
| [
"unbelievablecj@outlook.com"
] | unbelievablecj@outlook.com |
402722cc89da6c36b766757eee2973faa04b2409 | 75c698765e2d58169280a1918a0d7a39a29ed62d | /CountingGame.java | 5500cbe95ba20f0a31e7f47daecb20913f796b9a | [] | no_license | melissacustard/counting-game | d9c43e06d3c1272e40c8c3a406b303f14265b966 | 9d0ef342246e94669e87b263ed8364cb53a3b4ed | refs/heads/master | 2021-01-22T11:15:33.450336 | 2016-01-25T23:26:02 | 2016-01-25T23:26:02 | 49,467,914 | 0 | 0 | null | 2016-01-12T02:03:23 | 2016-01-12T02:03:23 | null | UTF-8 | Java | false | false | 1,041 | java | /**
This Program will play a word game where a certain word
will print depending on what the # is divisible by.
Melissa Custard
*/
public class CountingGame
{
public static void main(String[]args)
{
String beep = "beep"; // 5
String buzz = "buzz"; // 8
String zap = "zap"; // 12
for (int i = 1; i <= 30; i++)
{
if (i%12 == 0 && i%8 == 0 && i%5 == 0)
{
System.out.println (zap + buzz + beep);
}
else if (i%12 == 0 && i%8 == 0)
{
System.out.println (zap + buzz);
}
else if (i%8 == 0 && i%5 == 0)
{
System.out.println (buzz + beep);
}
else if (i%12 == 0 && i%5 == 0)
{
System.out.println (zap + beep);
}
else if (i %12 == 0)
{
System.out.println (zap);
}
else if (i % 8 == 0)
{
System.out.println (buzz);
}
else if (i % 5 == 0)
{
System.out.println (beep);
}
else
{
System.out.println (i);
}
}
}
} | [
"frumpy852@gmail.com"
] | frumpy852@gmail.com |
678a8172a0839a4a30c6826f992b9f291cd4cbf7 | 66ec4dd2961ec17c4bd6aee02385929c0c215e21 | /src/main/java/com/example/demo/controller/DeptController.java | 3f9b14421cc720765c4399fc2aa2e44c46febed2 | [] | no_license | chenzhencici/demo | 55bf244118f5ffcbc835d2c9394519a9280a0897 | 1f6d30a626aafba943e59d730a7c0c09b72732c9 | refs/heads/master | 2022-07-11T23:18:28.890342 | 2019-08-20T07:09:14 | 2019-08-20T07:09:14 | 197,165,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | package com.example.demo.controller;
import com.example.demo.entity.ResultData;
import com.example.demo.entity.DeptQuery;
import com.example.demo.service.DeptService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/dept")
public class DeptController {
@Autowired
DeptService deptService;
@RequestMapping("/")
@ApiOperation(value = "跳转至部门页面",notes = "")
public String home(Model model){
return "/home";
}
@RequestMapping("/search")
@ResponseBody
public ResultData search(Model model, DeptQuery query){
ResultData result = new ResultData();
result = deptService.search(query);
return result;
}
}
| [
"18951355767@163.com"
] | 18951355767@163.com |
c6fc265ed64639533945f704dc089963cf511624 | fa3f41a6397ecb2cdba2480c39fb08a1faf3a74a | /app/src/main/java/nyc/esteban/android/buttley13/beanography/model/Beanography.java | 929409e14cf7a2eae83fa43099706002d6c584e6 | [] | no_license | SpoooonBK/Buttley1.3 | 28d65304b4496d363b2852ad9f72685341d92120 | 3d4a971e531d27a0c12c84c7b4c98c02a9cfeb94 | refs/heads/master | 2016-08-04T22:12:03.587086 | 2015-01-11T05:12:05 | 2015-01-11T05:12:05 | 29,002,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | package nyc.esteban.android.buttley13.beanography.model;
import java.util.List;
/**
* Created by Tara on 1/2/2015.
*/
public class Beanography {
List<BeanographyPost> beanographyPostList;
}
| [
"erodriguez927@gmail.com"
] | erodriguez927@gmail.com |
373562bc9a41e9dc82689257f7bfca6ec38eab68 | 8eefa83b437e8068275b0e8f59682bc8bc7b41fa | /android/src/main/java/com/kerence/rctamap/search/MyWeatherSearch.java | ad4beb100442bc471f7f0ae204d1dd0585be0435 | [
"MIT"
] | permissive | Kerence/react-native-amap-3d | cb1d193c4f74882ef5a8bf27088dac33719dcb37 | 318d3a42c910e06943a2ee48495e867805525166 | refs/heads/master | 2021-01-25T07:11:34.292038 | 2017-02-02T14:32:38 | 2017-02-02T14:32:38 | 80,696,550 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,628 | java | package com.kerence.rctamap.search;
import android.content.Context;
import com.amap.api.services.weather.LocalDayWeatherForecast;
import com.amap.api.services.weather.LocalWeatherForecast;
import com.amap.api.services.weather.LocalWeatherForecastResult;
import com.amap.api.services.weather.LocalWeatherLive;
import com.amap.api.services.weather.LocalWeatherLiveResult;
import com.amap.api.services.weather.WeatherSearch;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
/**
* Created by marshal on 16/6/7.
*/
class MyWeatherSearch extends AMapSearch implements WeatherSearch.OnWeatherSearchListener {
public WeatherSearch weatherSearch;
public MyWeatherSearch(Context context, String requestId) {
weatherSearch = new WeatherSearch(context);
this.setRequestId(requestId);
}
@Override
public void onWeatherLiveSearched(LocalWeatherLiveResult localWeatherLiveResult, int resultId) {
if (1000 != resultId) {
this.sendEventWithError("request weatherLive error");
return;
}
WritableArray array = Arguments.createArray();
WritableMap map = Arguments.createMap();
LocalWeatherLive live = localWeatherLiveResult.getLiveResult();
map.putString("city", live.getCity());
map.putString("province", live.getProvince());
map.putString("adCode", live.getAdCode());
map.putString("weather", live.getWeather());
map.putString("temperature", live.getTemperature());
map.putString("windDirection", live.getWindDirection());
map.putString("windPower", live.getWindPower());
map.putString("reportTime", live.getReportTime());
array.pushMap(map);
this.sendEventWithData(array);
}
@Override
public void onWeatherForecastSearched(LocalWeatherForecastResult localWeatherForecastResult, int resultId) {
if (1000 != resultId) {
this.sendEventWithError("request weatherForecast error");
return;
}
WritableArray array = Arguments.createArray();
WritableMap map = Arguments.createMap();
LocalWeatherForecast forecast = localWeatherForecastResult.getForecastResult();
map.putString("city", forecast.getCity());
map.putString("city", forecast.getCity());
map.putString("province", forecast.getProvince());
map.putString("adCode", forecast.getAdCode());
map.putString("reportTime", forecast.getReportTime());
WritableArray casts = Arguments.createArray();
for (LocalDayWeatherForecast cast: forecast.getWeatherForecast()
) {
WritableMap castMap = Arguments.createMap();
castMap.putString("date", cast.getDate());
castMap.putString("dayTemp", cast.getDayTemp());
castMap.putString("dayWeather", cast.getDayWeather());
castMap.putString("dayWindDirection", cast.getDayWindDirection());
castMap.putString("dayWindPower", cast.getDayWindPower());
castMap.putString("nightTemp", cast.getNightTemp());
castMap.putString("nightWeather", cast.getNightWeather());
castMap.putString("nightWindDirection", cast.getNightWindDirection());
castMap.putString("nightWindPower", cast.getNightWindPower());
castMap.putString("week", cast.getWeek());
casts.pushMap(castMap);
}
map.putArray("casts", casts);
array.pushMap(map);
this.sendEventWithData(array);
}
}
| [
"850751404@qq.com"
] | 850751404@qq.com |
f7f710d68db3c8780c0fd09ce6ef95a28294503c | fdf6af788d9dbcf2c540221c75218e26bd38483b | /app/src/main/java/com/yuanxin/clan/core/adapter/FragmentMyOrderAllAdapter.java | 4a9fa2e074b91bd55d36015ce6885d41842eebe3 | [] | no_license | RobertBaggio/yuanxinclan | 8b6b670d2bc818ff018c6e2bcfe77e74903ddbbd | 544918ce2f80975f32aa09a4990028b955fa5f6d | refs/heads/master | 2020-03-18T09:05:47.461683 | 2018-05-23T09:30:36 | 2018-05-23T09:30:36 | 134,544,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,700 | java | package com.yuanxin.clan.core.adapter;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.RequestParams;
import com.loopj.android.http.TextHttpResponseHandler;
import com.yuanxin.clan.R;
import com.yuanxin.clan.core.app.UserNative;
import com.yuanxin.clan.core.entity.FragmentMyOrderAllEntity;
import com.yuanxin.clan.core.http.Url;
import com.yuanxin.clan.core.util.TextUtil;
import com.yuanxin.clan.mvp.manager.ImageManager;
import com.yuanxin.clan.mvp.utils.ToastUtil;
import com.yuanxin.clan.mvp.view.BaseFragment;
import org.apache.http.Header;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by lenovo1 on 2017/4/14.
* 全部订单Adapter
*/
public class FragmentMyOrderAllAdapter extends RecyclerView.Adapter<FragmentMyOrderAllAdapter.ViewHolder> {
private Context context;
private OnItemClickListener mOnItemClickListener;
private boolean ifshowwl;
private boolean ifqr=true;
private FragmentMyOrderAllEntity entity;
private ViewHolder holder;
// private ArrayList<String> datas = new ArrayList<>();
private List<FragmentMyOrderAllEntity> entityList;//所有信息
public FragmentMyOrderAllAdapter(Context context, List<FragmentMyOrderAllEntity> entities) {
this.context = context;
this.entityList = entities;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_fragment_my_order_all, null);
holder = new ViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
try {
entity = entityList.get(position);
// ImageManager.load(context,entity.getEpImage1())
// .placeholder(R.drawable.by).error(R.drawable.by)
// .into(holder.itemCompanyInformationDetailImage);
// holder.itemFragmentMyOrderAllOrderNum.setText(entity.getOrderId());//订单号
holder.itemFragmentMyOrderAllOrderNum.setText(entity.getCreateDt());//时间
int number = entity.getNumber();
String all = entity.getTotal();
String status = entity.getOrderStatus();
if (status.equals("1")){
holder.itemFragmentMyOrderAllState.setText("待付款");//待付款
holder.ddwliuli.setVisibility(View.GONE);
holder.ddwliucontentli.setVisibility(View.GONE);
holder.ddwliuline.setVisibility(View.GONE);
holder.qrshouhuote.setVisibility(View.GONE);
}else if ("2,3,5,6".indexOf(status)>-1){
if (status.equals("2")){
holder.itemFragmentMyOrderAllState.setText("待发货");//待付款
holder.ddwliuli.setVisibility(View.GONE);
// holder.qrshouhuote.setVisibility(View.VISIBLE);
}else if (status.equals("5")){
holder.itemFragmentMyOrderAllState.setText("申请退款中");//待付款
holder.qrshouhuote.setVisibility(View.GONE);
}else if (status.equals("3")){
holder.itemFragmentMyOrderAllState.setText("待收货");//待付款
holder.qrshouhuote.setVisibility(View.VISIBLE);
}
}else if ("4,7".indexOf(status)>-1){
holder.itemFragmentMyOrderAllState.setText("已完成");//待付款
holder.qrshouhuote.setVisibility(View.GONE);
}
holder.ddnumte.setText("共(" + number + ")" + "件商品合计:" );
float aa = Float.parseFloat(entity.getPrice());
holder.ddallpayte.setText(aa*number+" 元");
holder.ddyunfeite.setText(entity.getCarriage());
holder.item_item_fragment_my_order_all_price.setText(entity.getPrice());
holder.item_item_fragment_my_order_all_name.setText(entity.getCommodityNm());
holder.item_item_fragment_my_order_all_choose_one.setText("规 格:"+entity.getCommoditySp());
holder.item_item_fragment_my_order_all_choose_two.setText("颜 色:"+entity.getCommodityColor());
ImageManager.load(context, entity.getCommodityImage1(),R.drawable.by,holder.item_item_fragment_my_order_all_image);
if (TextUtil.isEmpty(entity.getExpressCompany())){
holder.ddwliucontentname.setText("数据缺失~");
holder.ddwliucontentcode.setText("888888~");
holder.ddwliucontentname.setTextColor(context.getResources().getColor(R.color.gray_white));
holder.ddwliucontentcode.setTextColor(context.getResources().getColor(R.color.gray_white));
}else {
holder.ddwliucontentname.setText(entity.getExpressCompany());
holder.ddwliucontentcode.setText(entity.getExpressNumber());
}
holder.item_item_fragment_my_order_all_number.setText("x"+number);
// holder.itemFragmentMyOrderAllAll.setText("共(" + number + ")" + "件商品合计:" + all + "元(含运费¥" + carriage + ")");//数量 总价 运费
//holder.itemFragmentMyOrderAllRecyclerView//
//里面那个RecyclerView
}catch (Exception e){
e.printStackTrace();
}
holder.itemFragmentMyOrderAllRecyclerView.setLayoutManager(new LinearLayoutManager(context));
holder.itemFragmentMyOrderAllRecyclerView.setFocusable(false);//导航栏切换不再focuse
//判断是否设置了监听器
if (mOnItemClickListener != null) {
//为ItemView设置监听器-
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = holder.getLayoutPosition(); // 1
mOnItemClickListener.onItemClick(holder.itemView, position); // 2
}
});
holder.ddwliuli.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ifshowwl){
holder.ddwliucontentli.setVisibility(View.VISIBLE);
}else {
holder.ddwliucontentli.setVisibility(View.GONE);
}
ifshowwl=!ifshowwl;
}
});
holder.qrshouhuote.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// if (!ifqr){
// Toast.makeText(context, "已提交", Toast.LENGTH_SHORT).show();
// Log.v("lgq","...............yyy");
// return;
// }
showNormalDialogOne(holder, entity.getOrderId());
}
});
}
}
@Override
public int getItemCount() {
return entityList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.item_fragment_my_order_all)
TextView itemFragmentMyOrderAll;
@BindView(R.id.ddwliuline)
TextView ddwliuline;
@BindView(R.id.qrshouhuote)
TextView qrshouhuote;
@BindView(R.id.item_item_fragment_my_order_all_number)
TextView item_item_fragment_my_order_all_number;
@BindView(R.id.item_item_fragment_my_order_all_image)
ImageView item_item_fragment_my_order_all_image;
@BindView(R.id.item_fragment_my_order_all_order_num)
TextView itemFragmentMyOrderAllOrderNum;
@BindView(R.id.ddwliucontentname)
TextView ddwliucontentname;
@BindView(R.id.item_item_fragment_my_order_all_name)
TextView item_item_fragment_my_order_all_name;
@BindView(R.id.ddallpayte)
TextView ddallpayte;
@BindView(R.id.ddwliucontentcode)
TextView ddwliucontentcode;
@BindView(R.id.item_item_fragment_my_order_all_choose_two)
TextView item_item_fragment_my_order_all_choose_two;
@BindView(R.id.ddyunfeite)
TextView ddyunfeite;
@BindView(R.id.ddwliucontentnamestuta)
TextView ddwliucontentnamestuta;
@BindView(R.id.ddnumte)
TextView ddnumte;
@BindView(R.id.item_item_fragment_my_order_all_choose_one)
TextView item_item_fragment_my_order_all_choose_one;
@BindView(R.id.item_item_fragment_my_order_all_price)
TextView item_item_fragment_my_order_all_price;
@BindView(R.id.item_fragment_my_order_all_state)
TextView itemFragmentMyOrderAllState;
@BindView(R.id.item_fragment_my_order_all_recycler_view)
RecyclerView itemFragmentMyOrderAllRecyclerView;
@BindView(R.id.ddwliuli)
LinearLayout ddwliuli;
@BindView(R.id.ddwliucontentli)
LinearLayout ddwliucontentli;
@BindView(R.id.ddwliucontentnamestutali)
LinearLayout ddwliucontentnamestutali;
// @BindView(R.id.item_fragment_my_order_all_all)
// TextView itemFragmentMyOrderAllAll;
public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
public interface OnItemClickListener {
void onItemClick(View view, int position);
}
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
this.mOnItemClickListener = onItemClickListener;
}
private void qrshouhuo(final ViewHolder holder, String id) {
String url = Url.qrshouhuo;
RequestParams params = new RequestParams();
params.put("orderUuid",id );//企业id
params.put("userid", UserNative.getId());//企业id
params.put("usernm", UserNative.getName());//企业id
params.put("businessId", entity.getBusinessId());
params.put("orderPrice", entity.getTotal());
doHttpPost(url, params, new BaseFragment.RequestCallback() {
@Override
public void onFailure(int i, Header[] headers, String s, Throwable throwable) {
ToastUtil.showWarning(context, "网络连接异常", Toast.LENGTH_SHORT);
}
@Override
public void onSuccess(int i, Header[] headers, String s) {
try {
JSONObject object = new JSONObject(s);
if (object.getString("success").equals("true")) {
holder.qrshouhuote.setVisibility(View.GONE);
holder.itemFragmentMyOrderAllState.setText("已完成");
ifqr =false;
ToastUtil.showSuccess(context, object.getString("msg"), Toast.LENGTH_SHORT);
} else {
ToastUtil.showWarning(context, object.getString("msg"), Toast.LENGTH_SHORT);
}
} catch (JSONException e) {
ToastUtil.showWarning(context, "数据解析出错", Toast.LENGTH_SHORT);
}
}
});
}
private void showNormalDialogOne(final ViewHolder holder,final String id) {
/* @setIcon 设置对话框图标
* @setTitle 设置对话框标题
* @setMessage 设置对话框消息提示
* setXXX方法返回Dialog对象,因此可以链式设置属性
*/
final AlertDialog.Builder normalDialog = new AlertDialog.Builder(context);
// normalDialog.setIcon(R.drawable.icon_dialog);
normalDialog.setTitle("提示");
normalDialog.setMessage("您是否确定已收货!");
normalDialog.setPositiveButton("确定",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
qrshouhuo(holder, id);
Log.v("lgq","...........sss");
// finish();
// deleteList.add(entity);
//entityList.get(position).getUserId()
// deleteCompanyMemberToWeb(uid, position);
// notifyDataSetChanged();
}
});
normalDialog.setNegativeButton("取消",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
// 显示
normalDialog.show();
}
protected void doHttpPost(String url, RequestParams params, final BaseFragment.RequestCallback c) {
AsyncHttpClient client = new AsyncHttpClient();
String aesKes = UserNative.getAesKes();
// if (TextUtil.isEmpty(aesKes)) {
// ViewUtils.AlertDialog(context, "提示", "登陆信息失效,请重新登陆", "确定", "取消", new ViewUtils.DialogCallback() {
// @Override
// public void onConfirm() {
// Intent intent = new Intent(context, LoginActivity.class);
// context.startActivity(intent);
// }
//
// @Override
// public void onCancel() {
//
// }
// });
// } else {
params.put("key", aesKes);
client.post(url, params, new TextHttpResponseHandler() {
@Override
public void onFailure(int i, Header[] headers, String s, Throwable throwable) {
// Toast.makeText(getApplicationContext(), "网络连接异常", Toast.LENGTH_SHORT).show();
c.onFailure(i, headers, s, throwable);
}
@Override
public void onSuccess(int i, Header[] headers, String s) {
try {
c.onSuccess(i, headers, s);
} catch (Exception e) {
e.printStackTrace();
}
}
});
// }
}
}
| [
"baggiocomeback@163.com"
] | baggiocomeback@163.com |
566b25d4cc39966f2fd00e878645ea8e7a42501b | aaf8a5825dea06ac10c984121a2c0e8d62173531 | /netty/src/main/java/com/learn/sky/netty/jeep/handler/out/JeepMessageOutHandler.java | ea65cb62a05f7744025607ed8085e597b954b97a | [] | no_license | keitho00/LearnSky | 235e4d31097ffb8f8d178ad71858225d9897729c | 211c6f3976a96997d13ca9d4be744e2bddd75e98 | refs/heads/master | 2023-06-26T04:42:46.776773 | 2023-06-16T09:17:05 | 2023-06-16T09:17:05 | 119,021,613 | 0 | 1 | null | 2022-10-04T23:44:07 | 2018-01-26T07:43:10 | Java | UTF-8 | Java | false | false | 959 | java | package com.learn.sky.netty.jeep.handler.out;
import com.learn.sky.netty.jeep.entity.Header;
import com.learn.sky.netty.jeep.entity.JeepMessage;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
/**
* @Author: JiuBuKong
* @Date: 2019/4/26 上午11:05
*/
public class JeepMessageOutHandler extends ChannelOutboundHandlerAdapter {
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
JeepMessage jeepMessage = new JeepMessage();
Header header = new Header();
header.setLength(0);
header.setProtoType(0);
header.setClazzName(msg.getClass().getName());
header.setClazzLength(msg.getClass().getName().getBytes().length);
jeepMessage.setHeader(header);
jeepMessage.setBody(msg);
super.write(ctx, jeepMessage, promise);
}
}
| [
"wanghao3@douyu.tv"
] | wanghao3@douyu.tv |
7fd2aa482c8dd8622e9db91b2a39b9a2ad56e1c8 | c20f74f7d4eebcf0b545413fbc3d7924e665e1a3 | /impl/src/main/java/org/jboss/arquillian/ajocado/locator/JQueryLocator.java | e95a91f93082b94bfa5ae38129d2bdcac2b70d20 | [] | no_license | lfryc/arquillian-ajocado | 3dfccc1067b3e526015c8674aae836259699d359 | 82c5cdbae3a07872e1f150642d4f28ae3d49063f | refs/heads/master | 2021-07-08T10:26:43.488427 | 2012-08-02T21:02:03 | 2012-08-02T21:02:03 | 1,339,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,093 | java | /**
* JBoss, Home of Professional Open Source
* Copyright 2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.arquillian.ajocado.locator;
import org.jboss.arquillian.ajocado.format.SimplifiedFormat;
import org.jboss.arquillian.ajocado.locator.element.AbstractIterableLocator;
import org.jboss.arquillian.ajocado.locator.element.ElementLocationStrategy;
import org.jboss.arquillian.ajocado.locator.element.ExtendedLocator;
import org.jboss.arquillian.ajocado.locator.element.FilterableLocator;
/**
* <p>
* Locates the element using <a href="http://api.jquery.com/category/selectors/">JQuery Selector</a> syntax.
* </p>
*
* <p>
* This syntax is extended in AjaxSelenium by new filters similar to <tt><a
* href="http://api.jquery.com/contains-selector/">:contains(text)</a></tt>
* </p>
*
* <ul>
* <li><tt>:textStartsWith(textPattern)</tt> - trimmed element text are matched to start with given textPattern</li>
* <li><tt>:textEndsWith(textPattern)</tt> - trimmed element text are matched to end with given textPattern</li>
* <li><tt>:textEquals(textPattern)</tt> - trimmed element text are compared to exact match with given textPattern</li>
* </ul>
*
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
public class JQueryLocator extends AbstractIterableLocator<JQueryLocator> implements ExtendedLocator<JQueryLocator>,
FilterableLocator<JQueryLocator> {
/**
* Instantiates a new jQuery locator.
*
* @param jquerySelector
* the jquery selector
*/
public JQueryLocator(String jquerySelector) {
super(jquerySelector);
}
/*
* (non-Javadoc)
*
* @see org.jboss.arquillian.ajocado.locator.Locator#getLocationStrategy()
*/
public ElementLocationStrategy getLocationStrategy() {
return ElementLocationStrategy.JQUERY;
}
/*
* (non-Javadoc)
*
* @see org.jboss.arquillian.ajocado.locator.element.IterableLocator#get(int)
*/
public JQueryLocator get(int index) {
return new JQueryLocator(SimplifiedFormat.format("{0}:eq({1})", getRawLocator(), index - 1));
}
/*
* (non-Javadoc)
*
* @see
* org.jboss.arquillian.ajocado.locator.CompoundableLocator#getChild(org.jboss.test.selenium.locator.CompoundableLocator
* )
*/
public JQueryLocator getChild(JQueryLocator elementLocator) {
return new JQueryLocator(SimplifiedFormat.format("{0} > {1}", getRawLocator(), elementLocator.getRawLocator()));
}
/*
* (non-Javadoc)
*
* @see org.jboss.arquillian.ajocado.locator.CompoundableLocator#getDescendant
* (org.jboss.arquillian.ajocado.locator.CompoundableLocator )
*/
public JQueryLocator getDescendant(JQueryLocator elementLocator) {
return new JQueryLocator(SimplifiedFormat.format("{0} {1}", getRawLocator(), elementLocator.getRawLocator()));
}
@Override
public JQueryLocator format(Object... args) {
return (JQueryLocator) super.format(args);
}
@Override
public JQueryLocator filter(String extension) {
return new JQueryLocator(getRawLocator() + extension);
}
}
| [
"lfryc@redhat.com"
] | lfryc@redhat.com |
65c18316880399ee9743b192210cdae778cf6026 | 98f00bab503a91829878c7ec73d140cdf0ab5256 | /src/main/java/com/karthik/Service/RepositoryService.java | 757681eae2c9bd2588a4e3e0b7d7f682da078858 | [] | no_license | Karthik-Vijay/Gitdata-Fetch-Application | 0ca012bc126c9aac78bd219d9c2acd621ca8ed10 | 98f838236f3239de38f7486804f76a5e0a4b1be9 | refs/heads/master | 2022-11-12T12:41:11.622944 | 2020-03-14T18:09:22 | 2020-03-14T18:09:22 | 247,328,358 | 0 | 1 | null | 2022-10-25T17:05:48 | 2020-03-14T18:08:07 | Java | UTF-8 | Java | false | false | 3,546 | java | package com.karthik.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.util.UriComponentsBuilder;
import com.karthik.Constants.AppConstants;
import com.karthik.Handlers.RegexHandler;
import com.karthik.Handlers.RestCallHandler;
import com.karthik.Model.PullRequestModel;
import com.karthik.Model.RepositoryModel;
@Service
public class RepositoryService {
RestCallHandler restCallHandler;
RegexHandler regexHandler;
CommentService commentService;
// Constructor Dependency Injection
public RepositoryService(RestCallHandler restCallHandler, RegexHandler regexHandler,
CommentService commentService) {
this.restCallHandler = restCallHandler;
this.regexHandler = regexHandler;
this.commentService = commentService;
}
/**
*
* Building URL using UriComponentsBuilder and passing the url for rest call.
*/
public RepositoryModel getPullRequests(RepositoryModel repos) {
Map<String, String> urlParams = new HashMap<String, String>();
urlParams.put("owner", repos.getOwner());
urlParams.put("repo", repos.getName());
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(AppConstants.pullRequestAPIUrl)
.queryParam("state", "open")
.queryParam("per_page", "30")
.queryParam("page", repos.getPageNumber());
String url = builder.buildAndExpand(urlParams).toUriString();
ParameterizedTypeReference responseType = new ParameterizedTypeReference<List<PullRequestModel>>() {};
/**
* Performing a GET request to fetch github repository details from api.github.com
*/
ResponseEntity<List<PullRequestModel>> responseEntity = restCallHandler.performGetRequest(url, responseType);
HttpHeaders responseHeaders = responseEntity.getHeaders();
List<PullRequestModel> pullRequestResponse = responseEntity.getBody();
fetchCommentsCount(pullRequestResponse);
repos.setPullRequests(pullRequestResponse);
int count = 0;
int pageNumber = 1;
String linkHeader = responseHeaders.getFirst("Link");
if (linkHeader != null) {
// matches last page
String lastPageLink = regexHandler.extractString("<([^>]*)>; rel=\"last\"", linkHeader);
if (!lastPageLink.equalsIgnoreCase("")) {
url = lastPageLink.replace("<", "").replace(">; rel=\"last\"", "").trim();
pageNumber = Integer.parseInt(url.replaceAll("(.*?)&page=", ""));
responseEntity = restCallHandler.performGetRequest(url, responseType);
pullRequestResponse = responseEntity.getBody();
count = (pageNumber - 1) * 30;
} else {
count = (repos.getPageNumber() - 1) * 30;
}
}
count += pullRequestResponse.size();
repos.setPullRequestCount(count);
repos.setTotalPages(pageNumber);
return repos;
}
/**
* Iterating through list of pull requests for getting the CommentCount.
* @param pullRequestDomainList Object of model class PullRequestDomain
* @return pullRequestDomainList
*/
public List<PullRequestModel> fetchCommentsCount(List<PullRequestModel> pullRequestModelList){
for (PullRequestModel pulldata : pullRequestModelList) {
commentService.getCommentsCount(pulldata);
}
return pullRequestModelList;
}
}
| [
"rabodevops-11@sfol1959v7s2.am.rabonet.com"
] | rabodevops-11@sfol1959v7s2.am.rabonet.com |
6e24a69331f84dd8731df2f668e9c7db4e02540d | 42516804be55c5001a66c19b7f229a3f4383163b | /src/dev/apcsa/rpg/entities/creatures/enemies/Bat.java | 98bb94f03df4c8177bfbfd22df8ee2a5695c3b24 | [
"CC0-1.0"
] | permissive | OutdatedPine906/AdventureRPG | bc1c15794d4e593ceda01a5d6437889527aa893e | 06658943578306dc876b9be6c7f4bb1f61c329bd | refs/heads/master | 2020-03-16T16:08:10.146350 | 2018-06-13T14:19:33 | 2018-06-13T14:19:33 | 132,773,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,487 | java | package dev.apcsa.rpg.entities.creatures.enemies;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import dev.apcsa.rpg.Handler;
import dev.apcsa.rpg.entities.creatures.Creature;
import dev.apcsa.rpg.gfx.Animation;
import dev.apcsa.rpg.gfx.Assets;
import dev.apcsa.rpg.states.State;
public class Bat extends Enemy{
// Animations
private Animation down, up, left, right, attack_down, attack_up, attack_right, attack_left;
public Bat(Handler handler, float x, float y, int width, int height){
super(handler, x, y, Creature.DEFAULT_CREATURE_WIDTH, Creature.DEFAULT_CREATURE_HEIGHT, 10, 50, 400);
this.speed = 2.7f;
this.health = 200;
bounds.x = 12;
bounds.y = 30;
bounds.width = 35;
bounds.height = 20;
// Animations
down = new Animation(500, Assets.bat_down);
up = new Animation(500, Assets.bat_up);
right = new Animation(500, Assets.bat_right);
left = new Animation(500, Assets.bat_left);
attack_down = new Animation(500, Assets.bat_attack_down);
attack_up = new Animation(500, Assets.bat_attack_up);
attack_right = new Animation(500, Assets.bat_attack_right);
attack_left = new Animation(500, Assets.bat_attack_left);
}
@Override
public void tick(){
// Animations
down.tick();
up.tick();
left.tick();
right.tick();
attack_down.tick();
attack_up.tick();
attack_right.tick();
attack_left.tick();
//Movement
moveToPlayer();
move();
// Attack
checkAttacks();
}
private BufferedImage getCurrentAnimationFrame(){
if(attackDirection.equals("Left")) {
return attack_left.getCurrentFrame();
}
else if(attackDirection.equals("Right")) {
return attack_right.getCurrentFrame();
}
else if(attackDirection.equals("Up")) {
return attack_up.getCurrentFrame();
}
else if(attackDirection.equals("Down")) {
return attack_down.getCurrentFrame();
}
if(xMove < 0){
return left.getCurrentFrame();
} else if(xMove > 0){
return right.getCurrentFrame();
} else if(yMove < 0){
return up.getCurrentFrame();
} else{
return down.getCurrentFrame();
}
}
@Override
public void render(Graphics g){
g.drawImage(getCurrentAnimationFrame(), (int) (x - handler.getGameCamera().getxOffset()),
(int) (y - handler.getGameCamera().getyOffset()), width, height, null);
g.setColor(Color.green);
g.fillRect(280, 16, health * 2,32);
}
@Override
public void die(){
State.setState(handler.getGame().getVictoryState());
}
}
| [
"cbarnes547@gmail.com"
] | cbarnes547@gmail.com |
6c975608791564fe419ff66c9638a10ea8e5a0e1 | 4ddabeada50c1a121f12eece6d0b1cd3fc708c75 | /Exam_Assistant/src/Controller/UserController.java | bd4b24ef5f1fa4836445b23e9aae2550a1a9ffad | [] | no_license | Rajat39/ExamManagement | 1f17463890b25f7a2cc9c6c39a92da8631b916c8 | 1b774b591e0a7d3f334591af6d01859ac5a025e5 | refs/heads/master | 2020-04-03T17:20:59.449603 | 2018-10-30T19:03:23 | 2018-10-30T19:03:23 | 155,440,951 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,553 | java | package Controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import DAO.LoginDAO;
import DAO.UserDAO;
import VO.LoginVO;
import VO.UserVO;
/**
* Servlet implementation class UserController
*/
@WebServlet("/UserController")
public class UserController extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public UserController() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String flag=request.getParameter("flag");
System.out.println("Controller");
if(flag.equals("InsertUser"))
{
System.out.println("Controller2");
insert(request,response);
System.out.println("Controller3");
}
}
private void insert(HttpServletRequest request, HttpServletResponse response) throws IOException {
// TODO Auto-generated method stub
String fname=request.getParameter("fname");
String lname=request.getParameter("lname");
String email=request.getParameter("email");
String pswd=request.getParameter("pswd");
String department=request.getParameter("department");
String dob=request.getParameter("dob");
long phone=Long.parseLong(request.getParameter("Phone"));
String position=request.getParameter("position");
LoginVO loginVO=new LoginVO();
loginVO.setUsername(email);
loginVO.setPassword(pswd);
loginVO.setUserType(position);
LoginDAO loginDAO=new LoginDAO();
loginDAO.insertUser(loginVO);
UserVO userVO=new UserVO();
userVO.setDepartment(department);
userVO.setDob(dob);
userVO.setEmail(email);
userVO.setFname(fname);
userVO.setLname(lname);
userVO.setPhone(phone);
userVO.setPosition(position);
userVO.setPswd(pswd);
UserDAO userdao=new UserDAO();
userdao.insertUser(userVO);
response.sendRedirect("Project_Admin/login2.jsp");
}
}
| [
"rajatgu39@gmail.com"
] | rajatgu39@gmail.com |
c4882e74b2b753585bbec6293716588ee5bdacbf | de935f5e65a899552d487a4c6362011e6fec33ec | /app/src/main/java/com/vserve2019/vserve/Adapter/ServiceAdapter.java | 74e18971176438fd7f011f387f36f2335faa4a68 | [] | no_license | tanik27/VServe | 4db3def34efa7bdc70b2a78e2abe46cb19f2eafc | 694b70e8cf45bc9e44484e083199fe34f361b159 | refs/heads/master | 2020-05-19T08:27:13.090297 | 2019-05-04T16:13:03 | 2019-05-04T16:13:03 | 184,921,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,200 | java | package com.vserve2019.vserve.Adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.vserve2019.vserve.Listener.OnRecyclerListener;
import com.vserve2019.vserve.Model.Services;
import com.vserve2019.vserve.R;
import java.util.ArrayList;
public class ServiceAdapter extends RecyclerView.Adapter<ServiceAdapter.viewHolder> {
Context context;
int resource;
ArrayList<Services> objects;
OnRecyclerListener recyclerListener;
public void setOnRecyclerItemListener(OnRecyclerListener recyclerItemListener) {
this.recyclerListener = recyclerItemListener;
}
public ServiceAdapter(Context context,int resource,ArrayList<Services> objects){
this.context= context;
this.resource=resource;
this.objects=objects;
}
@NonNull
@Override
public ServiceAdapter.viewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view= LayoutInflater.from(context).inflate(resource,viewGroup,false);
final ServiceAdapter.viewHolder holder=new ServiceAdapter.viewHolder(view);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
recyclerListener.OnIemClick(holder.getAdapterPosition());
}
});
return holder;
}
@Override
public void onBindViewHolder(@NonNull ServiceAdapter.viewHolder viewHolder, int position) {
Services services=objects.get(position);
viewHolder.txtName.setText(services.Name);
viewHolder.txtPrice.setText(services.Price);
}
@Override
public int getItemCount() {
return objects.size();
}
class viewHolder extends RecyclerView.ViewHolder{
TextView txtName,txtPrice;
public viewHolder(@NonNull View itemView) {
super(itemView);
txtName=itemView.findViewById(R.id.textViewServiceName);
txtPrice=itemView.findViewById(R.id.textViewServicePrice);
}
}
}
| [
"tanikrp@gmail.com"
] | tanikrp@gmail.com |
9a9435f8c415ab7fa9e5ecc3aaf4536de707e80c | 9cc1342aeb146e6243f3bb852519beea7e8a99c7 | /src/modelo/conexion/Conexion.java | fb79c53d5d4dbf445c27529df3c85cfb74ef9052 | [] | no_license | jeisonjs/laboratorio-radiologia-java | 3b806325ba0f11a7f161bcbe0fe80c9f0e6f39df | a75b53b6749255d9cbcdf095f8f0dddfefe58f25 | refs/heads/master | 2021-09-11T17:40:32.887618 | 2017-11-09T03:53:40 | 2017-11-09T03:53:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,610 | 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.conexion;
import java.sql.*;
import javax.swing.JOptionPane;
/**
*
* @author Jeison Perez
*/
public class Conexion {
private static Conexion instancia;
//Indicando que use el Driver de MySQL. "dir"
private final static String direccion = "com.mysql.jdbc.Driver";
//Colocando el nombre de la BD a conectar. "bd"
private final static String miBasedDatos = "proyecto_radiodiagnostico";
// Direccion en donde se encuentra la BD. Usar la misma Variable de Arriba
// "miBasedDatos".
private final static String url = "jdbc:mysql://localhost:3306/"+miBasedDatos;
private final static String user = "root";
private final static String pass = "0000";
// ct
private Connection miConnection = null;
/*
* Metodo para saber si ya esta creada una instancia de conexion,
* si esta creada la utiliza, si no es asi, crea un nuevo objeto de
* tipo Conexion.
*
* synchronized: Si se estan realizando muchas peticiones se pondran
* en espera.
*/
public synchronized static Conexion saberEstado(){
if (instancia == null) {
instancia = new Conexion();
}
return instancia;
}
/*
* El patron DAO me pide que mi constructor Conexion sea de tipo
* privado, para que no se puedan crear instancias de tipo conexion
* desde afuera.
*/
private Conexion(){
try{
Class.forName(direccion).newInstance();
//haga la conexion
miConnection = DriverManager.getConnection(url,user,pass);
if (miConnection != null){
System.out.println("Se ha conectado a la base de datos con exito. :D \n");
}
}
catch(Exception e){
System.out.println("No se ha podido conectar a la base de datos. D: \n"+e);
}
}
public void Desconectar(){
instancia = null;
System.out.println("Desconectando de la base de datos... \n");
}
// Obtener la conexion creada.
// Crear los Statement
public Connection obtenerConexion(){
return miConnection;
}
public static void main(String[] args) {
Conexion c = new Conexion();
}
}
| [
"jeisonj_2008@hotmail.com"
] | jeisonj_2008@hotmail.com |
dbd35e794e863e5bf7fae270fac09bd22e912b47 | 3cf870ec335aa1b95e8776ea9b2a9d6495377628 | /admin-sponge/build/tmp/recompileMc/sources/net/minecraft/command/RecipeCommand.java | 29e7f8b1a69394a64788dad989035ae68ed31c50 | [] | no_license | yk133/MyMc | d6498607e7f1f932813178e7d0911ffce6e64c83 | e1ae6d97415583b1271ee57ac96083c1350ac048 | refs/heads/master | 2020-04-03T16:23:09.774937 | 2018-11-05T12:17:39 | 2018-11-05T12:17:39 | 155,402,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,731 | java | package net.minecraft.command;
import com.google.common.collect.Lists;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
public class RecipeCommand extends CommandBase
{
public String func_71517_b()
{
return "recipe";
}
public int func_82362_a()
{
return 2;
}
public String func_71518_a(ICommandSender p_71518_1_)
{
return "commands.recipe.usage";
}
public void func_184881_a(MinecraftServer p_184881_1_, ICommandSender p_184881_2_, String[] p_184881_3_) throws CommandException
{
if (p_184881_3_.length < 2)
{
throw new WrongUsageException("commands.recipe.usage", new Object[0]);
}
else
{
boolean flag = "give".equalsIgnoreCase(p_184881_3_[0]);
boolean flag1 = "take".equalsIgnoreCase(p_184881_3_[0]);
if (!flag && !flag1)
{
throw new WrongUsageException("commands.recipe.usage", new Object[0]);
}
else
{
for (EntityPlayerMP entityplayermp : func_193513_a(p_184881_1_, p_184881_2_, p_184881_3_[1]))
{
if ("*".equals(p_184881_3_[2]))
{
if (flag)
{
entityplayermp.func_192021_a(this.func_192556_d());
func_152373_a(p_184881_2_, this, "commands.recipe.give.success.all", new Object[] {entityplayermp.func_70005_c_()});
}
else
{
entityplayermp.func_192022_b(this.func_192556_d());
func_152373_a(p_184881_2_, this, "commands.recipe.take.success.all", new Object[] {entityplayermp.func_70005_c_()});
}
}
else
{
IRecipe irecipe = CraftingManager.func_193373_a(new ResourceLocation(p_184881_3_[2]));
if (irecipe == null)
{
throw new CommandException("commands.recipe.unknownrecipe", new Object[] {p_184881_3_[2]});
}
if (irecipe.isDynamic())
{
throw new CommandException("commands.recipe.unsupported", new Object[] {p_184881_3_[2]});
}
List<IRecipe> list = Lists.newArrayList(irecipe);
if (flag == entityplayermp.getRecipeBook().isUnlocked(irecipe))
{
String s = flag ? "commands.recipe.alreadyHave" : "commands.recipe.dontHave";
throw new CommandException(s, new Object[] {entityplayermp.func_70005_c_(), irecipe.getRecipeOutput().func_82833_r()});
}
if (flag)
{
entityplayermp.func_192021_a(list);
func_152373_a(p_184881_2_, this, "commands.recipe.give.success.one", new Object[] {entityplayermp.func_70005_c_(), irecipe.getRecipeOutput().func_82833_r()});
}
else
{
entityplayermp.func_192022_b(list);
func_152373_a(p_184881_2_, this, "commands.recipe.take.success.one", new Object[] {irecipe.getRecipeOutput().func_82833_r(), entityplayermp.func_70005_c_()});
}
}
}
}
}
}
private List<IRecipe> func_192556_d()
{
return Lists.newArrayList(CraftingManager.field_193380_a);
}
public List<String> func_184883_a(MinecraftServer p_184883_1_, ICommandSender p_184883_2_, String[] p_184883_3_, @Nullable BlockPos p_184883_4_)
{
if (p_184883_3_.length == 1)
{
return func_71530_a(p_184883_3_, new String[] {"give", "take"});
}
else if (p_184883_3_.length == 2)
{
return func_71530_a(p_184883_3_, p_184883_1_.getOnlinePlayerNames());
}
else
{
return p_184883_3_.length == 3 ? func_175762_a(p_184883_3_, CraftingManager.field_193380_a.getKeys()) : Collections.emptyList();
}
}
} | [
"1060682109@qq.com"
] | 1060682109@qq.com |
17bb2639cf528ecb4133dfb13a74521b34fbd0ac | a321ce616f4707119f02a2644b4e90886d3f905f | /src/main/java/org/odlabs/wiquery/core/commons/IWiQueryPlugin.java | 74aa872d0f4799537c0738f2efda28289334269a | [
"MIT"
] | permissive | magomi/wiquery | 2830fb634362f1b44e92d2c0892c5af4565de63b | 47c19c870cbe45750a0c881bce8e8df70764507c | refs/heads/master | 2020-06-14T16:33:39.480427 | 2011-01-12T10:04:16 | 2011-01-12T10:04:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,295 | java | /*
* Copyright (c) 2009 WiQuery team
*
* 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 org.odlabs.wiquery.core.commons;
import org.odlabs.wiquery.core.javascript.JsStatement;
/**
* $Id$
* <p>
* The {@link IWiQueryPlugin} interface defines all WiQuery plugins, e.g.
* all components outputing jQuery statements to function.
* </p>
* <p>
* WiQuery plugins are components generating JavaScript jQuery code. WiQuery
* manages the component, outputs the JavaScript needed to function and imports
* all JavaScript resources needed by the component.
* </p>
* <p>
* A WickeXt plugin is automatically managed by the
* {@link WiQueryInstantiationListener}
* </p>
*
* @author Lionel Armanet
* @since 0.5
* @see WiQueryInstantiationListener
* @see JsStatement
*/
public interface IWiQueryPlugin {
/**
* Declares resources (JavaScript and CSS files) to import.
* @param wiQueryResourceManager
* The {@link WiQueryResourceManager} instance managing this
* component resources.
*/
void contribute(WiQueryResourceManager wiQueryResourceManager);
/**
* Returns the main {@link JsStatement} used to create the plugin.
* @return The {@link JsStatement} corresponding to this component.
*/
JsStatement statement();
}
| [
"lionel.armanet@21b45634-0984-11de-b025-799c3e7cca98"
] | lionel.armanet@21b45634-0984-11de-b025-799c3e7cca98 |
09c409bd07b453fd04d5f4e9264da4309d95e23e | 7843847f8d60d26c00bb91c1e4067a9d847b2d7d | /bootstrap/src/main/java/com/dv/reactive/bootstrap/BaseCustomerService.java | 21e30794c8fa652174430b5bfd0e9036ca80bf12 | [] | no_license | dvwhitem/reactive-spring | ee85c810907e8ed4bebd80c780a5b6638042bdc9 | 6ed351bffd2898354e9eceb63af96b61bedb2702 | refs/heads/master | 2023-08-24T15:07:56.819059 | 2021-10-11T12:17:00 | 2021-10-11T12:17:00 | 413,152,280 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,057 | java | package com.dv.reactive.bootstrap;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.util.Assert;
import javax.sql.DataSource;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
public class BaseCustomerService implements CustomerService {
private final RowMapper<Customer> rowMapper =
(rs, i) -> new Customer(rs.getLong("id"), rs.getString("NAME"));
private final JdbcTemplate jdbcTemplate;
public BaseCustomerService(DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Override
public Collection<Customer> save(String... names) {
List<Customer> customerList = new ArrayList<>();
for (String name: names) {
KeyHolder keyHolder = new GeneratedKeyHolder();
this.jdbcTemplate.update(con -> {
PreparedStatement ps = con.prepareStatement(
"insert into CUSTOMERS (name) values (?)",
Statement.RETURN_GENERATED_KEYS
);
ps.setString(1, name);
return ps;
}, keyHolder);
Long keyHolderKey = Objects.requireNonNull(keyHolder.getKey()).longValue();
Customer customer = this.findById(keyHolderKey);
Assert.notNull(name, "the name given must not be null");
customerList.add(customer);
}
return customerList;
}
@Override
public Customer findById(Long id) {
String sql = "select * from CUSTOMERS where id = ?";
return this.jdbcTemplate.queryForObject(sql, this.rowMapper, id);
}
@Override
public Collection<Customer> findAll() {
return this.jdbcTemplate.query("select * from CUSTOMERS", this.rowMapper);
}
}
| [
"dvwhitem@gmail.com"
] | dvwhitem@gmail.com |
97da40c11767cd94f9a06f76c4fbf858f643becf | 337d3b0b2e3123a391b1aa4d5041e7b367c0e89b | /src/main/java/logistic/entity/User.java | b6cb82e1ffab02de4f9980bb3dcd6523617746c2 | [] | no_license | virendra038/logisticApp | fc4bfdce075c55177d34cbeaa6cda0645a37fd62 | ec8a8a07b4d51a79e91a6b9c024421737efa6c10 | refs/heads/master | 2021-01-10T01:30:16.188653 | 2016-03-15T10:22:59 | 2016-03-15T10:22:59 | 53,781,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,582 | java | package logistic.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class User {
@JsonIgnore
@ManyToOne
private Client client;
@Id
@GeneratedValue
private Long userId;
public String username,firstname,lastname,contact,location;
public String getUsername()
{
return username;
}
public Client getClient()
{
return client;
}
public Long getUserId()
{
return userId;
}
public String getFirstname()
{
return firstname;
}
public String getLastname()
{
return lastname;
}
public String getContact()
{
return contact;
}
public String getLocation()
{
return location;
}
public User(Client client,String username ,String firstname,String lastname,String contact,String location) {
this.username = username;
this.firstname = firstname;
this.lastname = lastname;
this.contact = contact;
this.location = location;
this.client = client;
}
User() { // jpa only
}
public void setUsername(String username) {
this.username = username;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public void setContact(String contact) {
this.contact = contact;
}
public void setLocation(String location) {
this.location = location;
}
}
| [
"virendrapratap038@gmail.com"
] | virendrapratap038@gmail.com |
37bce582d4d835c773f6cbd3f2de6a4d59ee10b2 | 7be6764f0d75d7aecdb173d9e91f3ab4ae995e83 | /src/main/java/au/gov/dva/sopapi/sopref/data/AzureStorageRepository.java | a5bae412a073964a8d9efb87ef62076d31987f6c | [
"Apache-2.0"
] | permissive | SamMonaghan/dva-sop-api | 1a79e5fa06177f9b403f0c07963f96dba10d803d | 275de81a5f9b7fc3c0c74b108f6d3da4efa78a34 | refs/heads/devtest | 2020-05-25T07:43:21.173145 | 2017-03-27T09:12:14 | 2017-03-27T09:12:14 | 84,922,401 | 0 | 0 | null | 2017-03-14T08:07:54 | 2017-03-14T08:07:54 | null | UTF-8 | Java | false | false | 19,992 | java | package au.gov.dva.sopapi.sopref.data;
import au.gov.dva.sopapi.ConfigurationError;
import au.gov.dva.sopapi.exceptions.RepositoryError;
import au.gov.dva.sopapi.interfaces.Repository;
import au.gov.dva.sopapi.interfaces.RuleConfigurationRepository;
import au.gov.dva.sopapi.interfaces.model.InstrumentChange;
import au.gov.dva.sopapi.interfaces.model.InstrumentChangeBase;
import au.gov.dva.sopapi.interfaces.model.ServiceDetermination;
import au.gov.dva.sopapi.interfaces.model.SoP;
import au.gov.dva.sopapi.sopref.data.servicedeterminations.StoredServiceDetermination;
import au.gov.dva.sopapi.sopref.data.sops.StoredSop;
import au.gov.dva.sopapi.sopsupport.ruleconfiguration.CsvRuleConfigurationRepository;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.microsoft.azure.storage.CloudStorageAccount;
import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.blob.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class AzureStorageRepository implements Repository {
private static Logger logger = LoggerFactory.getLogger(AzureStorageRepository.class);
private String _storageConnectionString = null;
private static final String SOP_CONTAINER_NAME = "sops";
private static final String SERVICE_DETERMINATIONS_CONTAINER_NAME = "servicedeterminations";
private static final String INSTRUMENT_CHANGES_CONTAINER_NAME = "instrumentchanges";
private static final String ARCHIVED_SOPS_CONTAINER_NAME = "archivedsops";
private static final String ARCHIVED_SERVICE_DETERMINATIONS_CONTAINER_NAME = "archivedservicedeterminations";
private static final String METADATA_CONTAINER_NAME = "metadata";
private static final String LAST_SOPS_UPDATE_BLOB_NAME = "lastsopsupdate";
private static final String RULE_CONFIG_CONTAINER_NAME = "ruleconfiguration";
private static final String RH_RULE_CONFIG_CSV_NAME = "rh.csv";
private static final String BOP_RULE_CONFIG_CSV_NAME = "bop.csv";
private CloudStorageAccount _cloudStorageAccount = null;
private CloudBlobClient _cloudBlobClient = null;
public AzureStorageRepository(String storageConnectionString) {
try {
_storageConnectionString = storageConnectionString;
_cloudStorageAccount = CloudStorageAccount.parse(_storageConnectionString);
_cloudBlobClient = _cloudStorageAccount.createCloudBlobClient();
} catch (Exception e) {
throw new RepositoryError(e);
}
}
private CloudBlobContainer getOrCreateContainer(String containerName) throws URISyntaxException, StorageException {
CloudBlobClient serviceClient = _cloudStorageAccount.createCloudBlobClient();
CloudBlobContainer container = serviceClient.getContainerReference(containerName);
if (!container.exists()) {
container.create();
BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
container.uploadPermissions(containerPermissions);
}
return container;
}
@Override
public void addSop(SoP sop) {
try {
CloudBlobContainer container = getOrCreateContainer(SOP_CONTAINER_NAME);
CloudBlockBlob blob = container.getBlockBlobReference(sop.getRegisterId());
blob.getProperties().setContentType("application/json");
blob.getProperties().setContentEncoding("UTF-8");
JsonNode jsonNode = StoredSop.toJson(sop);
blob.uploadText(Conversions.toString(jsonNode));
} catch (RuntimeException e) {
throw new RepositoryError(e);
} catch (Exception e) {
throw new RepositoryError(e);
}
}
@Override
public Optional<SoP> getSop(String registerId) {
try {
Optional<CloudBlob> cloudBlob = getBlobByName(SOP_CONTAINER_NAME, registerId);
if (!cloudBlob.isPresent())
return Optional.empty();
else {
return Optional.of(blobToSoP(cloudBlob.get()));
}
} catch (RuntimeException e) {
throw new RepositoryError(e);
} catch (Exception e) {
throw new RepositoryError(e);
}
}
@Override
public ImmutableSet<SoP> getAllSops() {
try {
CloudBlobContainer cloudBlobContainer = getOrCreateContainer(SOP_CONTAINER_NAME);
Iterable<ListBlobItem> blobs = cloudBlobContainer.listBlobs();
List<SoP> retrievedSops = new ArrayList<>();
for (ListBlobItem blobItem : blobs) {
if (blobItem instanceof CloudBlob) {
SoP sop = blobToSoP((CloudBlob) blobItem);
retrievedSops.add(sop);
}
}
return ImmutableSet.copyOf(retrievedSops);
} catch (RuntimeException e) {
throw new RepositoryError(e);
} catch (Exception e) {
throw new RepositoryError(e);
}
}
@Override
public void archiveSoP(String registerId) {
try {
Optional<CloudBlob> cloudBlob = getBlobByName(SOP_CONTAINER_NAME, registerId);
if (!cloudBlob.isPresent()) {
throw new RepositoryError(String.format("SoP with register ID does not exist: %s", registerId));
}
byte[] blobBytes = getBlobBytes(cloudBlob.get());
String archivedSopBlobName = String.format("%s_%s", registerId, UUID.randomUUID().toString());
saveBlob(ARCHIVED_SOPS_CONTAINER_NAME, archivedSopBlobName, blobBytes);
deleteBlob(SOP_CONTAINER_NAME, registerId);
} catch (URISyntaxException e) {
throw new RepositoryError(e);
} catch (StorageException e) {
throw new RepositoryError(e);
} catch (IOException e) {
throw new RepositoryError(e);
}
}
private static ServiceDetermination blobToServiceDetermination(CloudBlob cloudBlob) {
try {
JsonNode jsonNode = getJsonNode(cloudBlob);
ServiceDetermination serviceDetermination = StoredServiceDetermination.fromJson(jsonNode);
return serviceDetermination;
} catch (RuntimeException e) {
throw new RepositoryError(e);
} catch (Exception e) {
throw new RepositoryError(e);
}
}
private static SoP blobToSoP(CloudBlob cloudBlob) {
try {
JsonNode jsonNode = getJsonNode(cloudBlob);
SoP sop = StoredSop.fromJson(jsonNode);
return sop;
} catch (RuntimeException e) {
throw new RepositoryError(e);
} catch (Exception e) {
throw new RepositoryError(e);
}
}
private static JsonNode getJsonNode(CloudBlob cloudBlob) throws StorageException, IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
cloudBlob.download(outputStream);
String jsonString = outputStream.toString(Charsets.UTF_8.name());
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readTree(jsonString);
}
private static byte[] getBlobBytes(CloudBlob cloudBlob) throws StorageException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
cloudBlob.download(outputStream);
return outputStream.toByteArray();
}
private static String getBlobString(CloudBlob cloudBlob) throws StorageException, UnsupportedEncodingException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
cloudBlob.download(outputStream);
String s = outputStream.toString(Charsets.UTF_8.name());
return s;
}
@Override
public ImmutableSet<InstrumentChange> getInstrumentChanges() {
CloudBlobContainer cloudBlobContainer = null;
try {
cloudBlobContainer = getOrCreateContainer(INSTRUMENT_CHANGES_CONTAINER_NAME);
ImmutableSet.Builder<InstrumentChange> builder = new ImmutableSet.Builder<>();
for (ListBlobItem listBlobItem : cloudBlobContainer.listBlobs()) {
if (listBlobItem instanceof CloudBlob) {
blobToInstrumentChangeStream((CloudBlob) listBlobItem).forEach(builder::add);
}
}
} catch (URISyntaxException e) {
throw new RepositoryError(e);
} catch (StorageException e) {
throw new RepositoryError(e);
} catch (IOException e) {
throw new RepositoryError(e);
}
Stream<ListBlobItem> blobs = StreamSupport.stream(cloudBlobContainer.listBlobs().spliterator(), false);
return blobs.flatMap(listBlobItem -> {
try {
return blobToInstrumentChangeStream((CloudBlob) listBlobItem);
} catch (IOException e) {
throw new RepositoryError(e);
} catch (StorageException e) {
throw new RepositoryError(e);
}
}).collect(Collectors.collectingAndThen(Collectors.toList(), ImmutableSet::copyOf));
}
private static Stream<InstrumentChange> blobToInstrumentChangeStream(CloudBlob cloudBlob) throws IOException, StorageException {
JsonNode jsonNode = getJsonNode(cloudBlob);
ImmutableList<JsonNode> jsonObjects = JsonUtils.getChildrenOfArrayNode(jsonNode);
return jsonObjects.stream().map(n -> InstrumentChangeBase.fromJson(n));
}
@Override
public void addInstrumentChanges(ImmutableSet<InstrumentChange> instrumentChanges) {
try {
CloudBlobContainer container = getOrCreateContainer(INSTRUMENT_CHANGES_CONTAINER_NAME);
String newBlobName = createBlobNameForInstrumentChangeBatch(instrumentChanges);
CloudBlockBlob blob = container.getBlockBlobReference(newBlobName);
ObjectMapper objectMapper = new ObjectMapper();
ArrayNode root = objectMapper.createArrayNode();
instrumentChanges.stream().forEach(ic -> root.add(ic.toJson()));
blob.uploadText(Conversions.toString(root));
} catch (RuntimeException e) {
throw new RepositoryError(e);
} catch (Exception e) {
throw new RepositoryError(e);
}
}
private static String createBlobNameForInstrumentChangeBatch(ImmutableSet<InstrumentChange> instrumentChanges) {
// A blob name must conforming to the following naming rules:
// A blob name can contain any combination of characters.
// A blob name must be at least one character long and cannot be more than 1,024 characters long.
// Blob names are case-sensitive.
// Reserved URL characters must be properly escaped.
// The number of path segments comprising the blob name cannot exceed 254. A path segment is the string between consecutive delimiter characters (e.g., the forward slash '/') that corresponds to the name of a virtual directory.
int numberOfChanges = instrumentChanges.size();
String timeForBlobName = OffsetDateTime.now().format(DateTimeFormatter.ISO_INSTANT).replace(':', '-');
String uuid = UUID.randomUUID().toString();
String blobName = String.format("%s_%d_changes_%s.json", timeForBlobName, numberOfChanges, uuid);
return blobName;
}
@Override
public void addServiceDetermination(ServiceDetermination serviceDetermination) {
try {
CloudBlobContainer container = getOrCreateContainer(SERVICE_DETERMINATIONS_CONTAINER_NAME);
CloudBlockBlob blob = container.getBlockBlobReference(serviceDetermination.getRegisterId());
JsonNode jsonNode = StoredServiceDetermination.toJson(serviceDetermination);
blob.getProperties().setContentType("application/json");
blob.getProperties().setContentEncoding("UTF-8");
blob.uploadText(Conversions.toString(jsonNode));
} catch (RuntimeException e) {
throw new RepositoryError(e);
} catch (Exception e) {
throw new RepositoryError(e);
}
}
@Override
public void archiveServiceDetermination(String registerId) {
try {
Optional<CloudBlob> cloudBlob = getBlobByName(SERVICE_DETERMINATIONS_CONTAINER_NAME, registerId);
if (!cloudBlob.isPresent()) {
throw new RepositoryError(String.format("Service Determination with register ID does not exist: %s", registerId));
}
byte[] blobBytes = getBlobBytes(cloudBlob.get());
String archivedServiceDeterminationBlobName = String.format("%s_%s", registerId, UUID.randomUUID().toString());
saveBlob(ARCHIVED_SERVICE_DETERMINATIONS_CONTAINER_NAME, archivedServiceDeterminationBlobName, blobBytes);
deleteBlob(SERVICE_DETERMINATIONS_CONTAINER_NAME, registerId);
} catch (URISyntaxException e) {
throw new RepositoryError(e);
} catch (StorageException e) {
throw new RepositoryError(e);
} catch (IOException e) {
throw new RepositoryError(e);
}
}
@Override
public ImmutableSet<ServiceDetermination> getServiceDeterminations() {
try {
CloudBlobContainer cloudBlobContainer = getOrCreateContainer(SERVICE_DETERMINATIONS_CONTAINER_NAME);
Iterable<ListBlobItem> blobs = cloudBlobContainer.listBlobs();
List<ServiceDetermination> retrievedServiceDeterminations = new ArrayList<>();
for (ListBlobItem blobItem : blobs) {
if (blobItem instanceof CloudBlob) {
ServiceDetermination serviceDetermination = blobToServiceDetermination((CloudBlob) blobItem);
retrievedServiceDeterminations.add(serviceDetermination);
}
}
return ImmutableSet.copyOf(retrievedServiceDeterminations);
} catch (RuntimeException e) {
throw new RepositoryError(e);
} catch (Exception e) {
throw new RepositoryError(e);
}
}
@Override
public Optional<OffsetDateTime> getLastUpdated() {
try {
Optional<CloudBlob> updated = getBlobByName(METADATA_CONTAINER_NAME, LAST_SOPS_UPDATE_BLOB_NAME);
if (!updated.isPresent()) {
return Optional.empty();
}
String updateText = getBlobString(updated.get());
OffsetDateTime offsetDateTime = OffsetDateTime.parse(updateText, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
return Optional.of(offsetDateTime);
} catch (URISyntaxException e) {
throw new RepositoryError(e);
} catch (StorageException e) {
throw new RepositoryError(e);
} catch (UnsupportedEncodingException e) {
throw new RepositoryError(e);
} catch (DateTimeParseException e) {
throw new RepositoryError(e);
}
}
@Override
public void setLastUpdated(OffsetDateTime offsetDateTime) {
try {
CloudBlobContainer container = getOrCreateContainer(METADATA_CONTAINER_NAME);
CloudBlockBlob blob = container.getBlockBlobReference(LAST_SOPS_UPDATE_BLOB_NAME);
blob.getProperties().setContentType("text/plain");
blob.getProperties().setContentEncoding("UTF-8");
blob.uploadText(offsetDateTime.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
} catch (URISyntaxException e) {
throw new RepositoryError(e);
} catch (StorageException e) {
throw new RepositoryError(e);
} catch (IOException e) {
throw new RepositoryError(e);
}
}
@Override
public Optional<RuleConfigurationRepository> getRuleConfigurationRepository() {
try {
Optional<CloudBlob> rhCsv = getBlobByName(RULE_CONFIG_CONTAINER_NAME, RH_RULE_CONFIG_CSV_NAME);
Optional<CloudBlob> bopCsv = getBlobByName(RULE_CONFIG_CONTAINER_NAME,BOP_RULE_CONFIG_CSV_NAME);
if (!rhCsv.isPresent() || !bopCsv.isPresent())
{
return Optional.empty();
}
byte[] rhCsvUtf8 = getBlobBytes(rhCsv.get());
byte[] bopCsvUtf8 = getBlobBytes(bopCsv.get());
RuleConfigurationRepository repository = new CsvRuleConfigurationRepository(rhCsvUtf8,bopCsvUtf8);
return Optional.of(repository);
}
catch (ConfigurationError e){
throw new RepositoryError(e);
}
catch (StorageException e) {
throw new RepositoryError(e);
} catch (URISyntaxException e) {
throw new RepositoryError(e);
}
}
@Override
public void setRulesConfig(byte[] rhCsv, byte[] bopCsv) {
try {
saveBlob(RULE_CONFIG_CONTAINER_NAME,RH_RULE_CONFIG_CSV_NAME,rhCsv);
saveBlob(RULE_CONFIG_CONTAINER_NAME,BOP_RULE_CONFIG_CSV_NAME,bopCsv);
} catch (URISyntaxException e) {
throw new RepositoryError(e);
} catch (StorageException e) {
throw new RepositoryError(e);
} catch (IOException e) {
throw new RepositoryError(e);
}
}
private Optional<CloudBlob> getBlobByName(String containerName, String blobName) throws URISyntaxException, StorageException {
CloudBlobContainer cloudBlobContainer = getOrCreateContainer(containerName);
CloudBlob cloudBlob = null;
for (ListBlobItem blobItem : cloudBlobContainer.listBlobs()) {
// If the item is a blob, not a virtual directory.
if ((blobItem instanceof CloudBlob) && ((CloudBlob) blobItem).getName().equalsIgnoreCase(blobName)) {
CloudBlob blob = (CloudBlob) blobItem;
cloudBlob = blob;
}
}
if (cloudBlob == null)
return Optional.empty();
else return Optional.of(cloudBlob);
}
private void saveBlob(String containerName, String blobName, byte[] blobBytes) throws URISyntaxException, StorageException, IOException {
CloudBlobContainer container = getOrCreateContainer(containerName);
CloudBlockBlob blob = container.getBlockBlobReference(blobName);
blob.uploadFromByteArray(blobBytes, 0, blobBytes.length);
}
private void deleteBlob(String containerName, String blobName) throws URISyntaxException, StorageException {
CloudBlobContainer container = getOrCreateContainer(containerName);
CloudBlockBlob blob = container.getBlockBlobReference(blobName);
boolean success = blob.deleteIfExists();
if (!success) {
logger.trace(String.format("SoP not found, therefore not deleted: %s", blobName));
}
}
@Override
public void purge() {
for (CloudBlobContainer cloudBlobContainer : _cloudBlobClient.listContainers()) {
try {
cloudBlobContainer.deleteIfExists();
} catch (StorageException e) {
throw new RepositoryError(e);
}
}
}
}
| [
"nick.miller@govlawtech.com.au"
] | nick.miller@govlawtech.com.au |
f533ca8c5824c85584faf7ae6174ed1bb5d8d6dc | 5bb845e8fdcdaac109a145ea9583f93278673a04 | /src/main/java/com/example/miapp/aop/logging/LoggingAspect.java | f484e9ef8ec3b124af6195704beac48505301964 | [] | no_license | Lidsanvaz/appTFG | 054a95c4e4bb85da82691d1eb60b53a008857ab6 | 42e0c1ad06183dcc60930f8bebf3e7a40a1333f9 | refs/heads/master | 2023-05-12T01:10:36.207778 | 2019-09-02T15:19:58 | 2019-09-02T15:19:58 | 192,713,842 | 0 | 0 | null | 2023-05-06T02:31:45 | 2019-06-19T10:49:59 | Java | UTF-8 | Java | false | false | 3,890 | java | package com.example.miapp.aop.logging;
import io.github.jhipster.config.JHipsterConstants;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
import org.springframework.core.env.Profiles;
import java.util.Arrays;
/**
* Aspect for logging execution of service and repository Spring components.
*
* By default, it only runs with the "dev" profile.
*/
@Aspect
public class LoggingAspect {
private final Logger log = LoggerFactory.getLogger(this.getClass());
private final Environment env;
public LoggingAspect(Environment env) {
this.env = env;
}
/**
* Pointcut that matches all repositories, services and Web REST endpoints.
*/
@Pointcut("within(@org.springframework.stereotype.Repository *)" +
" || within(@org.springframework.stereotype.Service *)" +
" || within(@org.springframework.web.bind.annotation.RestController *)")
public void springBeanPointcut() {
// Method is empty as this is just a Pointcut, the implementations are in the advices.
}
/**
* Pointcut that matches all Spring beans in the application's main packages.
*/
@Pointcut("within(com.example.miapp.repository..*)"+
" || within(com.example.miapp.service..*)"+
" || within(com.example.miapp.web.rest..*)")
public void applicationPackagePointcut() {
// Method is empty as this is just a Pointcut, the implementations are in the advices.
}
/**
* Advice that logs methods throwing exceptions.
*
* @param joinPoint join point for advice.
* @param e exception.
*/
@AfterThrowing(pointcut = "applicationPackagePointcut() && springBeanPointcut()", throwing = "e")
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) {
log.error("Exception in {}.{}() with cause = \'{}\' and exception = \'{}\'", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL", e.getMessage(), e);
} else {
log.error("Exception in {}.{}() with cause = {}", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), e.getCause() != null? e.getCause() : "NULL");
}
}
/**
* Advice that logs when a method is entered and exited.
*
* @param joinPoint join point for advice.
* @return result.
* @throws Throwable throws {@link IllegalArgumentException}.
*/
@Around("applicationPackagePointcut() && springBeanPointcut()")
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
if (log.isDebugEnabled()) {
log.debug("Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs()));
}
try {
Object result = joinPoint.proceed();
if (log.isDebugEnabled()) {
log.debug("Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), result);
}
return result;
} catch (IllegalArgumentException e) {
log.error("Illegal argument: {} in {}.{}()", Arrays.toString(joinPoint.getArgs()),
joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName());
throw e;
}
}
}
| [
"lidsanvaz10@gmail.com"
] | lidsanvaz10@gmail.com |
8a23da379af8e3af94b54ef1960fb2290de888f9 | 04fddae1c52b031ba6297f6964f8aeccc3031af6 | /src/de/outlook_klon/logik/kontakte/Kontaktverwaltung.java | 16be833ea811ea374be3972eabe205bd7b0feefa | [] | no_license | DerImplementator/Outlook-Klon | 337b5dcc04b79c6c4e0f712ce87ee85a435f1269 | deb993ba7b52638c79364270d7d948bb1207e6dc | refs/heads/master | 2020-12-31T07:54:48.903503 | 2013-11-24T15:44:48 | 2013-11-24T15:44:48 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 953 | java | package de.outlook_klon.logik.kontakte;
import java.util.ArrayList;
import java.util.Iterator;
/**
* Diese Klasse stellt die Verwaltung für die Kontakte des Bentzers dar
*
* @author Hendrik Karwanni
*/
public class Kontaktverwaltung implements Iterable<Kontakt> {
private ArrayList<Kontakt> mKontakte;
/**
* Erstellt eine neue Instanz der Kontaktverwaltung
*/
public Kontaktverwaltung() {
mKontakte = new ArrayList<Kontakt>();
}
@Override
public Iterator<Kontakt> iterator() {
return mKontakte.iterator();
}
/**
* Fügt den übergebenen Kontakt der Verwaltung hinzu
* @param kontakt Der hinzuzufügende Kontakt
*/
public void addKontakt(Kontakt kontakt) {
mKontakte.add(kontakt);
}
/**
* Löscht den übergebenen Kontakt aus der Verwaltung
* @param kontakt Zu löschender Kontakt
*/
public void löscheKontakt(Kontakt kontakt) {
mKontakte.remove(kontakt);
}
}
| [
"henny-willy@hotmail.de"
] | henny-willy@hotmail.de |
1fc873b98735453292a831c9bb4126fcaead4a29 | 6c8e2341ef09c55b830d933b0ca3bf72001e0432 | /JLet/src/cloud/bd/UpdateCloudBDIn.java | 44a6518a4b8f6741a2f62db75a21ccf0ed9feb0d | [] | no_license | luisdientes/repojlet | 433a93e297109e926b20fc010d29051553c16447 | 1a37a65aba2d86f4b2b401dbdde4a84d28c8fb30 | refs/heads/master | 2021-01-10T07:41:21.952818 | 2016-01-16T18:43:03 | 2016-01-16T18:43:03 | 49,777,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 620 | java | package cloud.bd;
import arquitectura.objects.ObjectBD;
import arquitectura.objects.ObjectIO;
public class UpdateCloudBDIn extends ObjectBD {
public UpdateCloudBDIn()
{
super();
}
public UpdateCloudBDIn(ObjectIO bdata)
{
super(bdata);
}
public void defineVars() throws Exception {
addVariable("idemisor");
addVariable("propieta");
addVariable("permgrup");
addVariable("filepath");
addVariable("tipofich");
addVariable("txnombre");
addVariable("idtamano");
addVariable("cdestado");
}
}
| [
"luis.palacios@crinbusolutions.com"
] | luis.palacios@crinbusolutions.com |
bdca448f4f776b26fed226232c8c93e97e453574 | 1cb3aff9ab2e1b8917c793e180ad31d5d71f8058 | /cart/src/main/java/com/thoughtworks/cart/repository/OrderItemRepository.java | bb0e3bfbbd6baf395deb6308daf3b2ebf80ba67c | [] | no_license | RajeshJangra/ms | 5da3c8ac43d542bd5cef51fc46c5a3180b6bf40d | a7eb54d9c5ddfd82bd3ec7ac511e280b339a55ec | refs/heads/master | 2020-03-16T18:02:56.888499 | 2018-09-13T13:07:59 | 2018-09-13T13:07:59 | 132,857,238 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 293 | java | package com.thoughtworks.cart.repository;
import com.thoughtworks.cart.entity.OrderItem;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface OrderItemRepository extends CrudRepository<OrderItem, Long> {
}
| [
"kumar_rajesh@external.mckinsey.com"
] | kumar_rajesh@external.mckinsey.com |
a7ae8031d7889cd5d5c2d2abd5bc5cd6353046c2 | 0626ed1f70cdd4a5007ad71cda0cce222e1b995e | /src/PowerPlant.java | d2bfc209f9a3bdb500b5b4241d8515922a05dad0 | [] | no_license | trans1st/ZapGoat | af21ce10999fc54cce375adeaa82b1ef1e9f5819 | 7ba5bce1b12a9c5cc898374b8916ec8cb9a03fe2 | refs/heads/master | 2020-12-24T18:04:05.602937 | 2015-04-25T00:32:12 | 2015-04-25T00:32:12 | 33,681,430 | 0 | 2 | null | 2015-04-24T03:28:55 | 2015-04-09T16:59:55 | Java | UTF-8 | Java | false | false | 773 | java | public class PowerPlant {
private int number,
//The number on the card. Determines the minimum bid at auction and obsolescence
resourceConsumption,
//Resources needed to operate. Determines resource capacity
powerOutput;
//Power generated in operation
private String resourceType;
//Type of resource it burns
public PowerPlant() {
}
public int generate(int numberAvailable, String resourceName) {
return powerOutput;
}
public int getNumber() {
return number;
}
public int getResourceConsumption() {
return resourceConsumption;
}
public int getPowerOutput() {
return powerOutput;
}
public String getResourceType () {
return resourceType;
}
} | [
"ikantspel@gmail.com"
] | ikantspel@gmail.com |
5b39492d3a79478ce878fe49dcf56a71e1fc3e4f | 6dbf62f4d1a3b7238d5e1c226aa97b55ab667865 | /mq-an-mq/app/src/main/java/com/emiaoqian/app/mq/fragment/WorkFragment.java | b0b6b6147353a880e4368ae1e6c50ac7b9a3f724 | [] | no_license | cvvbbo/mqdemo | 0237a7d287e971d3013b48c29d6ed2cc3c4d19ab | aa5b3c4cee3162056781d3a1d2053761e8f31d62 | refs/heads/master | 2020-03-22T19:04:03.794292 | 2018-07-26T01:21:55 | 2018-07-26T01:21:55 | 140,501,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package com.emiaoqian.app.mq.fragment;
import com.emiaoqian.app.mq.activity.Mainactivity;
import com.emiaoqian.app.mq.utils.Constants;
import com.emiaoqian.app.mq.utils.LogUtil;
/**
* Created by xiong on 2017/10/10.
*/
public class WorkFragment extends BaseWebFragment {
@Override
public void initialize() {
super.initialize();
title.setText("工作台");
urlDefault =Constants.LOGIN;
loadUrl(Constants.LOGIN);
// urlDefault="https://www.emiaoqian.com";
// loadUrl("https://www.emiaoqian.com");
}
} | [
"xiongzheng@emiaoqian.com"
] | xiongzheng@emiaoqian.com |
7566256622825a38148e1b1885429b6cc485d3a1 | 0784d050558d40ab0f21088f2ee4da1133fcf4a8 | /processor/src/main/java/kendal/api/impl/builders/IdentifierBuilderImpl.java | e1b3e99f04a730545a85cf7627982dfbff2addf7 | [
"MIT"
] | permissive | projectkendal/kendal | 343cc7061f77cd76ba5f1238555722c45e7ae1a2 | 0d46218e268b7df9e0374642fca7ccb814f945c4 | refs/heads/master | 2020-04-08T04:52:50.192769 | 2019-01-13T18:40:14 | 2019-01-13T18:40:14 | 159,035,984 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 800 | java | package kendal.api.impl.builders;
import com.sun.tools.javac.tree.JCTree.JCIdent;
import com.sun.tools.javac.tree.TreeMaker;
import com.sun.tools.javac.util.Name;
import kendal.api.AstUtils;
import kendal.api.builders.IdentifierBuilder;
import kendal.model.Node;
import kendal.model.TreeBuilder;
public class IdentifierBuilderImpl extends AbstractBuilder implements IdentifierBuilder {
public IdentifierBuilderImpl(AstUtils astUtils, TreeMaker treeMaker) {
super(astUtils, treeMaker);
}
@Override
public Node<JCIdent> build(String name) {
return build(astUtils.nameFromString(name));
}
@Override
public Node<JCIdent> build(Name name) {
JCIdent jcIdentifier = treeMaker.Ident(name);
return TreeBuilder.buildNode(jcIdentifier);
}
}
| [
"arkadiusz.ryszewski@sollers.eu"
] | arkadiusz.ryszewski@sollers.eu |
73acd2aa456d63ce038f3af34028fd57bdfe1e11 | 7e5377ed442f27089312f2a973e59b1bd9a1f8ab | /app/src/main/java/com/prolificwebworks/theclubix/entities/SongsData.java | df96f6e5beac15ca25fd8370063681f8d9e5b0f7 | [] | no_license | 029vaibhav/Clubix | 7d08c392a3a6a17c0161b1224e04bcb8d52c41fb | 54cbe0ef84a64365f6b9312ef0c2dd57a5eb9dc4 | refs/heads/master | 2020-12-27T15:26:36.564992 | 2015-10-13T17:51:37 | 2015-10-13T17:51:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,428 | java | package com.prolificwebworks.theclubix.entities;
import java.util.List;
/**
* Created by vaibhav on 9/10/15.
*/
public class SongsData {
private String clx_youtube_url;
private String clx_song_artist_name;
private String clx_song_upload_url;
private String snap_isAutoPosted;
private String clx_soundcloud_url;
private String clx_song_name;
private List<SnapFB> snapFB;
private String postId;
private String post_content;
private String clx_itunes_url;
private String clx_song_release_date;
private String snapEdIT;
private String recurrence_every;
private String clx_song_description;
private String clx_beatport_url;
private String event_venue_name;
private String post_author;
private String song_image;
private String event_show_map;
private String post_title;
private List<SnapTW> snapTW;
private String clx_song_url;
private String post_date;
public String getClx_youtube_url ()
{
return clx_youtube_url;
}
public void setClx_youtube_url (String clx_youtube_url)
{
this.clx_youtube_url = clx_youtube_url;
}
public String getClx_song_artist_name ()
{
return clx_song_artist_name;
}
public void setClx_song_artist_name (String clx_song_artist_name)
{
this.clx_song_artist_name = clx_song_artist_name;
}
public String getClx_song_upload_url ()
{
return clx_song_upload_url;
}
public void setClx_song_upload_url (String clx_song_upload_url)
{
this.clx_song_upload_url = clx_song_upload_url;
}
public String getSnap_isAutoPosted ()
{
return snap_isAutoPosted;
}
public void setSnap_isAutoPosted (String snap_isAutoPosted)
{
this.snap_isAutoPosted = snap_isAutoPosted;
}
public String getClx_soundcloud_url ()
{
return clx_soundcloud_url;
}
public void setClx_soundcloud_url (String clx_soundcloud_url)
{
this.clx_soundcloud_url = clx_soundcloud_url;
}
public String getClx_song_name ()
{
return clx_song_name;
}
public void setClx_song_name (String clx_song_name)
{
this.clx_song_name = clx_song_name;
}
public List<SnapFB> getSnapFB ()
{
return snapFB;
}
public void setSnapFB (List<SnapFB> snapFB)
{
this.snapFB = snapFB;
}
public String getPostId ()
{
return postId;
}
public void setPostId (String postId)
{
this.postId = postId;
}
public String getPost_content ()
{
return post_content;
}
public void setPost_content (String post_content)
{
this.post_content = post_content;
}
public String getClx_itunes_url ()
{
return clx_itunes_url;
}
public void setClx_itunes_url (String clx_itunes_url)
{
this.clx_itunes_url = clx_itunes_url;
}
public String getClx_song_release_date ()
{
return clx_song_release_date;
}
public void setClx_song_release_date (String clx_song_release_date)
{
this.clx_song_release_date = clx_song_release_date;
}
public String getSnapEdIT ()
{
return snapEdIT;
}
public void setSnapEdIT (String snapEdIT)
{
this.snapEdIT = snapEdIT;
}
public String getRecurrence_every ()
{
return recurrence_every;
}
public void setRecurrence_every (String recurrence_every)
{
this.recurrence_every = recurrence_every;
}
public String getClx_song_description ()
{
return clx_song_description;
}
public void setClx_song_description (String clx_song_description)
{
this.clx_song_description = clx_song_description;
}
public String getClx_beatport_url ()
{
return clx_beatport_url;
}
public void setClx_beatport_url (String clx_beatport_url)
{
this.clx_beatport_url = clx_beatport_url;
}
public String getEvent_venue_name ()
{
return event_venue_name;
}
public void setEvent_venue_name (String event_venue_name)
{
this.event_venue_name = event_venue_name;
}
public String getPost_author ()
{
return post_author;
}
public void setPost_author (String post_author)
{
this.post_author = post_author;
}
public String getSong_image ()
{
return song_image;
}
public void setSong_image (String song_image)
{
this.song_image = song_image;
}
public String getEvent_show_map ()
{
return event_show_map;
}
public void setEvent_show_map (String event_show_map)
{
this.event_show_map = event_show_map;
}
public String getPost_title ()
{
return post_title;
}
public void setPost_title (String post_title)
{
this.post_title = post_title;
}
public List<SnapTW> getSnapTW ()
{
return snapTW;
}
public void setSnapTW (List<SnapTW> snapTW)
{
this.snapTW = snapTW;
}
public String getClx_song_url ()
{
return clx_song_url;
}
public void setClx_song_url (String clx_song_url)
{
this.clx_song_url = clx_song_url;
}
public String getPost_date ()
{
return post_date;
}
public void setPost_date (String post_date)
{
this.post_date = post_date;
}
@Override
public String toString()
{
return "ClassPojo [clx_youtube_url = "+clx_youtube_url+", clx_song_artist_name = "+clx_song_artist_name+", clx_song_upload_url = "+clx_song_upload_url+", snap_isAutoPosted = "+snap_isAutoPosted+", clx_soundcloud_url = "+clx_soundcloud_url+", clx_song_name = "+clx_song_name+", snapFB = "+snapFB+", postId = "+postId+", post_content = "+post_content+", clx_itunes_url = "+clx_itunes_url+", clx_song_release_date = "+clx_song_release_date+", snapEdIT = "+snapEdIT+", recurrence_every = "+recurrence_every+", clx_song_description = "+clx_song_description+", clx_beatport_url = "+clx_beatport_url+", event_venue_name = "+event_venue_name+", post_author = "+post_author+", song_image = "+song_image+", event_show_map = "+event_show_map+", post_title = "+post_title+", snapTW = "+snapTW+", clx_song_url = "+clx_song_url+", post_date = "+post_date+"]";
}
}
| [
"vaibs4007@rediff.com"
] | vaibs4007@rediff.com |
db29e23985b95c951bd4138360aa6256169c6a34 | 0c19960a2099be1ead0f42ea35bf08cb83ca3415 | /packages/SystemUI/src/com/android/systemui/qs/tiles/NavBarTile.java | 666384070d42b10ec689f670a87e826f9c147418 | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | Juancarlospr5/android_frameworks_base-1 | c97d31caa49cb65c761122a834ac962687e97b89 | ce5d20451b5cb0ea2f6d88a6e207e4a83ca9bb5d | refs/heads/lineage-16.0 | 2021-04-26T23:31:31.481253 | 2019-04-16T03:54:04 | 2019-04-16T03:54:04 | 124,009,404 | 0 | 0 | NOASSERTION | 2019-04-09T06:36:32 | 2018-03-06T02:36:41 | Java | UTF-8 | Java | false | false | 3,567 | java | /*
* Copyright (C) 2015 The Dirty Unicorns Project
* Copyright (C) 2018 Benzo Rom
*
* 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.systemui.qs.tiles;
import android.content.ComponentName;
import android.content.Intent;
import android.provider.Settings;
import android.service.quicksettings.Tile;
import com.android.systemui.R;
import com.android.systemui.plugins.qs.QSTile.BooleanState;
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.SecureSetting;
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
/** Quick settings tile: NavBarTile **/
public class NavBarTile extends QSTileImpl<BooleanState> {
private final SecureSetting mSetting;
public NavBarTile(QSHost host) {
super(host);
mSetting = new SecureSetting(mContext, mHandler,
Settings.Secure.NAVIGATION_BAR_VISIBLE) {
@Override
protected void handleValueChanged(int value, boolean observedChange) {
handleRefreshState(value);
}
};
}
@Override
public BooleanState newTileState() {
return new BooleanState();
}
@Override
protected void handleClick() {
mSetting.setValue(mState.value ? 0 : 1);
refreshState();
}
@Override
public Intent getLongClickIntent() {
return new Intent().setComponent(new ComponentName(
"com.android.settings", "com.android.settings.Settings$NavigationActivity"));
}
@Override
protected void handleUpdateState(BooleanState state, Object arg) {
if (mSetting == null) return;
final int value = arg instanceof Integer ? (Integer)arg : mSetting.getValue();
final boolean enable = value != 0;
state.value = enable;
state.label = mContext.getString(R.string.quick_settings_navbar_title);
state.icon = ResourceIcon.get(R.drawable.ic_qs_navbar);
if (enable) {
state.contentDescription = mContext.getString(
R.string.accessibility_quick_settings_navbar_on);
state.state = Tile.STATE_ACTIVE;
} else {
state.contentDescription = mContext.getString(
R.string.accessibility_quick_settings_navbar_off);
state.state = Tile.STATE_INACTIVE;
}
}
@Override
public CharSequence getTileLabel() {
return mContext.getString(R.string.quick_settings_navbar_title);
}
@Override
protected String composeChangeAnnouncement() {
if (mState.value) {
return mContext.getString(R.string.accessibility_quick_settings_navbar_changed_on);
} else {
return mContext.getString(R.string.accessibility_quick_settings_navbar_changed_off);
}
}
@Override
public int getMetricsCategory() {
return MetricsEvent.ARSENIC_SETTINGS;
}
@Override
public void handleSetListening(boolean listening) {
// Do nothing
}
}
| [
"tumayordeseo5@hotmail.com"
] | tumayordeseo5@hotmail.com |
5f7e05617ad3f02e1fdc2d4b17b6f2af7e4c6ec0 | b61747b3e5ddce5e5bf16e658d930dd8ca498f49 | /src/com/staff/Scanner/PostTask.java | 77adb70881070c69c75821927eea6fd3648c93fb | [] | no_license | StaffNowa/Scanner-with-API | 60344fc46d239f0047fcf1a0130664c712b16d67 | 2dd45b8d4e68d9673a2f51099b916ea15eefaf4d | refs/heads/master | 2016-09-06T18:42:54.237950 | 2014-08-11T22:22:05 | 2014-08-11T22:22:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,522 | java | package com.staff.Scanner;
import android.os.AsyncTask;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* Created by staff on 2014-08-12.
*/
public class PostTask extends AsyncTask<String, Void, Scanner> {
private Exception exception;
@Override
protected Scanner doInBackground(String... product) {
// Create a new HttpClient and Post Header
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://api.prado.lt/api.php");
try {
// Add new data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("product", product[0]));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse httpResponse = httpClient.execute(httpPost);
} catch (ClientProtocolException e) {
//TODO Auto-generated catch block
} catch (IOException e) {
//TODO Auto-generated catch block
}
return null;
}
}
| [
"vasilij@prado.lt"
] | vasilij@prado.lt |
1b4b374c0183e3270eeee14a8eaf3223ae80e970 | 499c7ae916fa668db673b513cbbf54675d8f61cd | /app/src/main/java/com/github/blockchain/VerifyApplication.java | e5c619bfb1616733219053db3d14661b4284ecad | [] | no_license | Reza-saeedi/Application-Identity | 0fee6d8c79cfa0fdf78d16de12e825aabe782bac | d9afddb1ceba1c0a4ef89e2bce418df04cf50eee | refs/heads/master | 2020-04-27T03:56:18.927365 | 2019-03-06T00:15:56 | 2019-03-06T00:15:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,621 | java | package com.github.blockchain;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatEditText;
import android.view.Menu;
import android.view.MenuItem;
import com.github.blockchain.utils.BlockChainManager;
import io.github.rajdeep1008.apkwizard.R;
public class VerifyApplication extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_verify_application);
setSupportActionBar(findViewById(R.id.toolbar));
getSupportActionBar().setTitle("Verify Application");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.add_application_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
AppCompatEditText editTextName =findViewById(R.id.name_et);
AppCompatEditText editTextPackaga=findViewById(R.id.package_et);
AppCompatEditText editTextPublic=findViewById(R.id.public_et);
int appId=0;
if(getIntent().getExtras()!=null)
appId=getIntent().getExtras().getInt("app_id",0);
if(item.getItemId()==R.id.action_add) {
BlockChainManager.getInstance().verifyApplication(editTextPackaga.getText().toString(), editTextName.getText().toString(), editTextPublic.getText().toString(), appId);
finish();
}
return super.onOptionsItemSelected(item);
}
} | [
"reza.saeedi9@yahoo.com"
] | reza.saeedi9@yahoo.com |
97354251c68217fdc304fe1d07ada2934e6b38ab | 0eea0fa35221137aca19e3a22e5cae132680d25a | /app/src/main/java/com/teampet/petsitter/Review.java | b24132c8758ac10d86cb4f1bb22ba9666259bf3f | [] | no_license | tmaguire6/teampetsitter | 1cd7da8286ba4f7edda481f9ce7451e7449992ee | 701e979b5e054b25b3f66fd3f26a3564b33b8427 | refs/heads/master | 2021-01-21T13:07:43.596508 | 2016-05-01T17:54:15 | 2016-05-01T17:54:15 | 54,837,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.teampet.petsitter;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
/**
* Created by Shiv on 4/5/2016.
*/
public class Review extends AppCompatActivity {
public void onCreate(Bundle savedInstanceState) {
// ...
super.onCreate(savedInstanceState);
setContentView(R.layout.content_reviewtest);
}
}
| [
"maguiretimo@gmail.com"
] | maguiretimo@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.