blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
02d751a5141bb31fbf3aa6d2755f7a34a375fc7c | 6a6cd3432c0292a5551bc65c684f63b01b102b38 | /chen-upms/chen-upms-admin/src/main/java/com/chen/upms/admin/UpmsAdminApplication.java | 5d3c13d29ac0e7283a81c3b0f939789935dad485 | [] | no_license | deyuanchen/chen | e0a5095933abb5625e39c580ecca9c872217967c | 8f7f1cc51228e6fe89421d1262c62803bad47416 | refs/heads/master | 2021-01-18T15:47:41.483190 | 2017-08-22T14:30:48 | 2017-08-22T14:30:48 | 99,184,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | package com.chen.upms.admin;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
/**
* <p>Tiltle: com.chen.upms.admin </p>
* <p>Description: 后台管理 </p>
*
* @Author chen
* @data: 2017-08-16
* @version: 1.0
*/
@SpringCloudApplication
public class UpmsAdminApplication {
public static void main(String[] args) {
SpringApplication.run(UpmsAdminApplication.class, args);
}
}
| [
"321097355@qq.com"
] | 321097355@qq.com |
449667aebcbbc5c31fd472ae4a19cd376c83c855 | 96898af658009a0a65693e50f0fe4bf28f3a2d34 | /src/main/java/com/api/jsonata4java/expressions/functions/MergeFunction.java | a1b8f44e35d3237a32253d4da8bb631a3a95db66 | [
"Apache-2.0"
] | permissive | FudgeAdmin/JSONata4Java | 2bee58115939b97d51afac35e39fa6fc45d83aff | 6bee2a57dda3a83cc9a739bd3d51194f511305de | refs/heads/master | 2020-07-11T14:40:37.898987 | 2019-08-26T17:22:03 | 2019-08-26T17:22:03 | 204,571,662 | 1 | 0 | Apache-2.0 | 2019-08-27T00:22:13 | 2019-08-26T22:22:12 | null | UTF-8 | Java | false | false | 3,969 | java | /**
* (c) Copyright 2018, 2019 IBM Corporation
* 1 New Orchard Road,
* Armonk, New York, 10504-1722
* United States
* +1 914 499 1900
* support: Nathaniel Mills wnm3@us.ibm.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 com.api.jsonata4java.expressions.functions;
import java.util.Iterator;
import com.api.jsonata4java.expressions.EvaluateRuntimeException;
import com.api.jsonata4java.expressions.ExpressionsVisitor;
import com.api.jsonata4java.expressions.generated.MappingExpressionParser.Function_callContext;
import com.api.jsonata4java.expressions.utils.Constants;
import com.api.jsonata4java.expressions.utils.FunctionUtils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* From http://docs.jsonata.org/object-functions.html
*
* $merge(array<object>)
*
* Returns the merger of the objects in an array of objects. It is an error if
* the input is not an array of objects.
*
* Example
*
* $merge([{"a":1},{"b":2}])=={"a":1, "b":2}
*
*/
public class MergeFunction extends FunctionBase implements Function {
public static String ERR_BAD_CONTEXT = String.format(Constants.ERR_MSG_BAD_CONTEXT, Constants.FUNCTION_MERGE);
public static String ERR_ARG1BADTYPE = String.format(Constants.ERR_MSG_ARG1_BAD_TYPE, Constants.FUNCTION_MERGE);
public static String ERR_ARG2BADTYPE = String.format(Constants.ERR_MSG_ARG2_BAD_TYPE, Constants.FUNCTION_MERGE);
public static String ERR_ARG1_MUST_BE_OBJECT_ARRAY = String.format(Constants.ERR_MSG_ARG1_MUST_BE_ARRAY_OF_OBJECTS,
Constants.FUNCTION_MERGE);
public JsonNode invoke(ExpressionsVisitor expressionVisitor, Function_callContext ctx) {
// Create the variable to return
ObjectNode result = JsonNodeFactory.instance.objectNode();
// Retrieve the number of arguments
JsonNode argArray = JsonNodeFactory.instance.nullNode();
boolean useContext = FunctionUtils.useContextVariable(ctx, getSignature());
int argCount = getArgumentCount(ctx);
if (useContext) {
argArray = FunctionUtils.getContextVariable(expressionVisitor);
argCount++;
}
// Make sure that we have the right number of arguments
if (argCount == 1) {
if (!useContext) {
argArray = FunctionUtils.getValuesListExpression(expressionVisitor, ctx, 0);
}
String key = null;
if (argArray == null) {
return null;
}
if (argArray.isArray()) {
ArrayNode array = (ArrayNode) argArray;
for (int i = 0; i < array.size(); i++) {
JsonNode obj = array.get(i);
if (obj.isObject()) {
ObjectNode cell = (ObjectNode) obj;
for (Iterator<String> it = cell.fieldNames(); it.hasNext();) {
key = it.next();
result.set(key, cell.get(key));
}
} else {
throw new EvaluateRuntimeException(ERR_ARG1_MUST_BE_OBJECT_ARRAY);
}
}
} else {
if (argArray.isObject()) {
result = (ObjectNode) argArray;
} else {
/*
* The input argument is not an array. Throw a suitable exception
*/
throw new EvaluateRuntimeException(ERR_ARG1BADTYPE);
}
}
} else {
throw new EvaluateRuntimeException(argCount == 0 ? ERR_ARG1BADTYPE : ERR_ARG2BADTYPE);
}
return result;
}
@Override
public String getSignature() {
// accepts a number (or context variable), returns a number
return "<a<0>-:o>";
}
}
| [
"wnm3@us.ibm.com"
] | wnm3@us.ibm.com |
af398271dad901b548d69070bfb589de869f615d | 6d54a4c941649954192fd46a3fafd0133864b565 | /J1.L.P0021 - Student/src/Manager/Validation.java | 205f6e145e11e2acc8cc0e310cbb07af1f91c504 | [] | no_license | sonyrich/K14-JAVA-LAB-OOP | 0dc7a27e5fa498b48f8ab049657098f9575e1f7b | 3fce9fa57302ae6cb90800ee923951b7ff280f08 | refs/heads/master | 2021-02-14T04:59:58.442013 | 2020-04-11T13:35:21 | 2020-04-11T13:35:21 | 244,771,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,904 | java | package Manager;
import Entity.Student;
import Entity.Report;
import java.util.ArrayList;
import java.util.Scanner;
public class Validation {
private final static Scanner in = new Scanner(System.in);
//check user input number limit
public static int checkInputIntLimit(int min, int max) {
//loop until user input correct
while (true) {
try {
int result = Integer.parseInt(in.nextLine().trim());
if (result < min || result > max) {
throw new NumberFormatException();
}
return result;
} catch (NumberFormatException e) {
System.err.println("Please input number in rage [" + min + ", " + max + "]");
System.out.print("Enter again: ");
}
}
}
//check user input string
public static String checkInputString() {
//loop until user input correct
while (true) {
String result = in.nextLine().trim();
if (result.isEmpty()) {
System.err.println("Not empty");
System.out.print("Enter again: ");
} else {
return result;
}
}
}
//check user input yes/ no
public static boolean checkInputYN() {
//loop until user input correct
while (true) {
String result = checkInputString();
//return true if user input y/Y
if (result.equalsIgnoreCase("Y")) {
return true;
}
//return false if user input n/N
if (result.equalsIgnoreCase("N")) {
return false;
}
System.err.println("Please input y/Y or n/N.");
System.out.print("Enter again: ");
}
}
//check user input u / d
public static boolean checkInputUD() {
//loop until user input correct
while (true) {
String result = checkInputString();
//return true if user input u/U
if (result.equalsIgnoreCase("U")) {
return true;
}
//return false if user input d/D
if (result.equalsIgnoreCase("D")) {
return false;
}
System.err.println("Please input u/U or d/D.");
System.out.print("Enter again: ");
}
}
//check user input course
public static String checkInputCourse() {
//loop until user input correct
while (true) {
String result = checkInputString();
//check input course in java/ .net/ c/c++
if (result.equalsIgnoreCase("java")
|| result.equalsIgnoreCase(".net")
|| result.equalsIgnoreCase("c/c++")) {
return result;
}
System.err.println("There are only three courses: Java, .Net, C/C++");
System.out.print("Enter again: ");
}
}
//check student exist
public static boolean checkStudentExist(ArrayList<Student> ls, String id,
String studentName, String semester, String courseName) {
int size = ls.size();
for (Student student : ls) {
if (id.equalsIgnoreCase(student.getId())
&& studentName.equalsIgnoreCase(student.getStudentName())
&& semester.equalsIgnoreCase(student.getSemester())
&& courseName.equalsIgnoreCase(student.getCourseName())) {
return false;
}
}
return true;
}
//check report exist
public static boolean checkReportExist(ArrayList<Report> lr, String name,
String course, int total) {
for (Report report : lr) {
if (name.equalsIgnoreCase(report.getStudentName())
&& course.equalsIgnoreCase(report.getCourseName())
&& total == report.getTotalCourse()) {
return false;
}
}
return true;
}
//check id and exist
public static boolean checkIdExist(ArrayList<Student> ls, String id, String name) {
for (Student student : ls) {
if (id.equalsIgnoreCase(student.getId())
&& !name.equalsIgnoreCase(student.getStudentName())) {
return false;
}
}
return true;
}
//check user change or not
public static boolean checkChangeInfomation(Student student, String id,
String name, String semester, String course) {
if (id.equalsIgnoreCase(student.getId())
&& name.equalsIgnoreCase(student.getStudentName())
&& semester.equalsIgnoreCase(student.getSemester())
&& course.equalsIgnoreCase(student.getCourseName())) {
return false;
}
return true;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
85f6c5f49aa07e9e7c74d95466667016490c8ec2 | 84c0616a1d34149ea9d8d6e0959810278e3ab418 | /CheckPrime.java | c806a7a535a72d43019273664dbe9fd2f9dcbbe1 | [] | no_license | nazneenbee/Java-assignment | 25dad912680d0dc2f877e68ed2157bea784ea46a | 68376b43f51eb2736b3e3c3a5885cab49e7a469c | refs/heads/master | 2022-12-24T21:45:39.427633 | 2020-10-07T04:28:53 | 2020-10-07T04:28:53 | 296,770,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | import java.util.Scanner;
class CheckPrime
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("enter number");
int num = sc.nextInt();
int count=0;
for(int i=2; i<num-1; i++)
{
if(num==2)
{
count++;
break;
}
if(num%i==0)
{
count++;
}
}
if(count>0)
{
System.out.println("number is not prime");
}
else
{
System.out.println("number is prime");
}
}
} | [
"beenazneen@gmail.com"
] | beenazneen@gmail.com |
04095407f1a62b6d1de604bbe8c5d7b639bf5b84 | 15c5d4cb5dc7a453512a56ff8418cdf24e890c6e | /src/main/java/WayofTime/bloodmagic/tile/base/TileTicking.java | 83ccaab6188738bb343ebed1c3dac0f194eb4d4e | [
"CC-BY-4.0"
] | permissive | Arcaratus/BloodMagic | debad67b0a21d769e8681eb109b55ff091456738 | 730b26b5ac152e0585ceb7322e877783df84f21b | refs/heads/1.9 | 2021-07-19T23:05:00.741844 | 2017-06-22T03:10:32 | 2017-06-22T03:10:32 | 312,914,527 | 0 | 0 | NOASSERTION | 2020-11-14T22:38:18 | 2020-11-14T22:38:16 | null | UTF-8 | Java | false | false | 1,478 | java | package WayofTime.bloodmagic.tile.base;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ITickable;
/**
* Base class for tiles that tick. Allows disabling the ticking programmatically.
*/
// TODO - Move implementations that depend on existed ticks to new methods from here.
public abstract class TileTicking extends TileBase implements ITickable
{
private int ticksExisted;
private boolean shouldTick = true;
@Override
public final void update()
{
if (shouldTick()) {
ticksExisted++;
onUpdate();
}
}
@Override
void deserializeBase(NBTTagCompound tagCompound)
{
this.ticksExisted = tagCompound.getInteger("ticksExisted");
this.shouldTick = tagCompound.getBoolean("shouldTick");
}
@Override
NBTTagCompound serializeBase(NBTTagCompound tagCompound)
{
tagCompound.setInteger("ticksExisted", getTicksExisted());
tagCompound.setBoolean("shouldTick", shouldTick());
return tagCompound;
}
/**
* Called every tick that {@link #shouldTick()} is true.
*/
public abstract void onUpdate();
public int getTicksExisted()
{
return ticksExisted;
}
public void resetLifetime()
{
ticksExisted = 0;
}
public boolean shouldTick()
{
return shouldTick;
}
public void setShouldTick(boolean shouldTick)
{
this.shouldTick = shouldTick;
}
}
| [
"speedynutty68@gmail.com"
] | speedynutty68@gmail.com |
0bec097396d4e50721658d222ff81d587e2ebbf8 | 845ad55bbad2d00c277ca88ca442e85388a86a95 | /src/cyl/simpledatastruc/mythread/MyLock.java | 7c798d6ec153b3d39aafc3f95b434bfcbc78f5f3 | [] | no_license | cheng-ger/dailyPractice | 1f2e2d33db643eb587a092b4b4f609bae5a4fbd3 | d4a8fe80e4e9dd3788e83771d5d17ad29ac5579e | refs/heads/master | 2020-06-19T23:05:28.057044 | 2019-07-16T05:37:29 | 2019-07-16T05:37:29 | 196,906,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package cyl.simpledatastruc.mythread;
/**
* @author chengyuanliang
* @desc synchronized和锁的区别,什么情况下使用synchronized和 ReentrantLock
* @since 2019-06-10
*/
public class MyLock {
}
| [
"noreply@github.com"
] | noreply@github.com |
2a45bcf08918a102b53b1caea17f81cf703485bc | 056514b496d5de44672bd667e06f80de1645aec1 | /app/src/main/java/com/octohub/pil4u/ui/Fragments/CivilScoreCheckFragment.java | 218e62e582e6a86591f5b8b078685224cb6803f4 | [] | no_license | surirohith77/PIL4U | 401c273bc03b16673dec99e1ef2893361d0d8cff | c13a9c448e276ed0bae1dee8cab232318a5f1723 | refs/heads/master | 2023-07-08T02:19:05.686365 | 2020-08-05T03:11:35 | 2020-08-05T03:11:35 | 285,164,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 885 | java | package com.octohub.pil4u.ui.Fragments;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.octohub.pil4u.R;
public class CivilScoreCheckFragment extends Fragment {
Activity activity;
View view ;
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (Activity)context;
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.civil_score_check_fragment,container,false);
return view;
}
}
| [
"surirohith77@gmail.com"
] | surirohith77@gmail.com |
27a78d56447227124e0d38a42ec1eb8d6059f6a1 | 29aca0016c391e8e6736ada525e55e42836fac7b | /src/main/java/com/orientalbank/chatbot/json/model/GenericAttachment.java | 9211133ff1ce7280288750f83eb7a1d597c6009c | [] | no_license | sdutta6897/ElasticSearch | cff78e8314f82abfde1a6ef6b82e5a3ead3dc032 | 3c8be1303aed5862a07be3f887230988ceda358f | refs/heads/master | 2023-01-20T16:17:44.744190 | 2020-12-02T06:20:42 | 2020-12-02T06:20:42 | 317,189,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,449 | java |
package com.orientalbank.chatbot.json.model;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"title",
"subTitle",
"buttons",
"imageUrl",
"attachmentLinkUrl"
})
public class GenericAttachment {
@JsonProperty("title")
private Object title;
@JsonProperty("subTitle")
private Object subTitle;
@JsonProperty("buttons")
private List<Button> buttons = null;
@JsonProperty("imageUrl")
private Object imageUrl;
@JsonProperty("attachmentLinkUrl")
private Object attachmentLinkUrl;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("title")
public Object getTitle() {
return title;
}
@JsonProperty("title")
public void setTitle(Object title) {
this.title = title;
}
@JsonProperty("subTitle")
public Object getSubTitle() {
return subTitle;
}
@JsonProperty("subTitle")
public void setSubTitle(Object subTitle) {
this.subTitle = subTitle;
}
@JsonProperty("buttons")
public List<Button> getButtons() {
return buttons;
}
@JsonProperty("buttons")
public void setButtons(List<Button> buttons) {
this.buttons = buttons;
}
@JsonProperty("imageUrl")
public Object getImageUrl() {
return imageUrl;
}
@JsonProperty("imageUrl")
public void setImageUrl(Object imageUrl) {
this.imageUrl = imageUrl;
}
@JsonProperty("attachmentLinkUrl")
public Object getAttachmentLinkUrl() {
return attachmentLinkUrl;
}
@JsonProperty("attachmentLinkUrl")
public void setAttachmentLinkUrl(Object attachmentLinkUrl) {
this.attachmentLinkUrl = attachmentLinkUrl;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| [
"408957@cognizant.com"
] | 408957@cognizant.com |
e6741a8b36293003c0d310db8331528852fad881 | b52bdef128ecebcc8808ed95f8287bc97a4c4174 | /core/src/main/java/com/orientechnologies/orient/core/sql/parser/OUpdateOperations.java | 4ba595d5bcee5d9b9b8a19b818dccc8546df1b49 | [
"Apache-2.0",
"CDDL-1.0",
"BSD-3-Clause"
] | permissive | saeedtabrizi/orientdb | 4736d86e82e713b34d21566ca844db5af177f53a | 361cf4816b6597ab7d5cd356745ee3f7f475116d | refs/heads/develop | 2021-01-15T14:43:20.379474 | 2019-09-09T12:20:03 | 2019-09-09T12:20:03 | 56,811,541 | 0 | 0 | Apache-2.0 | 2019-09-09T12:22:10 | 2016-04-21T23:24:41 | Java | UTF-8 | Java | false | false | 5,829 | java | /* Generated By:JJTree: Do not edit this line. OUpdateOperations.java Version 4.3 */
/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
package com.orientechnologies.orient.core.sql.parser;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class OUpdateOperations extends SimpleNode {
public static final int TYPE_SET = 0;
public static final int TYPE_PUT = 1;
public static final int TYPE_MERGE = 2;
public static final int TYPE_CONTENT = 3;
public static final int TYPE_INCREMENT = 4;
public static final int TYPE_ADD = 5;
public static final int TYPE_REMOVE = 6;
protected int type;
protected List<OUpdateItem> updateItems = new ArrayList<OUpdateItem>();
protected List<OUpdatePutItem> updatePutItems = new ArrayList<OUpdatePutItem>();
protected OJson json;
protected List<OUpdateIncrementItem> updateIncrementItems = new ArrayList<OUpdateIncrementItem>();
protected List<OUpdateRemoveItem> updateRemoveItems = new ArrayList<OUpdateRemoveItem>();
public OUpdateOperations(int id) {
super(id);
}
public OUpdateOperations(OrientSql p, int id) {
super(p, id);
}
/**
* Accept the visitor.
**/
public Object jjtAccept(OrientSqlVisitor visitor, Object data) {
return visitor.visit(this, data);
}
public void toString(Map<Object, Object> params, StringBuilder builder) {
boolean first = true;
switch (type) {
case TYPE_SET:
builder.append("SET ");
for (OUpdateItem item : this.updateItems) {
if (!first) {
builder.append(", ");
}
item.toString(params, builder);
first = false;
}
break;
case TYPE_PUT:
builder.append("PUT ");
for (OUpdatePutItem item : this.updatePutItems) {
if (!first) {
builder.append(", ");
}
item.toString(params, builder);
first = false;
}
break;
case TYPE_MERGE:
builder.append("MERGE ");
json.toString(params, builder);
break;
case TYPE_CONTENT:
builder.append("CONTENT ");
json.toString(params, builder);
break;
case TYPE_INCREMENT:
builder.append("INCREMENT ");
for (OUpdateIncrementItem item : this.updateIncrementItems) {
if (!first) {
builder.append(", ");
}
item.toString(params, builder);
first = false;
}
break;
case TYPE_ADD:
builder.append("ADD ");
for (OUpdateIncrementItem item : this.updateIncrementItems) {
if (!first) {
builder.append(", ");
}
item.toString(params, builder);
first = false;
}
break;
case TYPE_REMOVE:
builder.append("REMOVE ");
for (OUpdateRemoveItem item : this.updateRemoveItems) {
if (!first) {
builder.append(", ");
}
item.toString(params, builder);
first = false;
}
break;
}
}
public OUpdateOperations copy() {
OUpdateOperations result = new OUpdateOperations(-1);
result.type = type;
result.updateItems = updateItems == null ? null : updateItems.stream().map(x -> x.copy()).collect(Collectors.toList());
result.updatePutItems = updatePutItems == null ? null : updatePutItems.stream().map(x -> x.copy()).collect(Collectors.toList());
result.json = json == null ? null : json.copy();
result.updateIncrementItems =
updateIncrementItems == null ? null : updateIncrementItems.stream().map(x -> x.copy()).collect(Collectors.toList());
result.updateRemoveItems =
updateRemoveItems == null ? null : updateRemoveItems.stream().map(x -> x.copy()).collect(Collectors.toList());
return result;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
OUpdateOperations that = (OUpdateOperations) o;
if (type != that.type)
return false;
if (updateItems != null ? !updateItems.equals(that.updateItems) : that.updateItems != null)
return false;
if (updatePutItems != null ? !updatePutItems.equals(that.updatePutItems) : that.updatePutItems != null)
return false;
if (json != null ? !json.equals(that.json) : that.json != null)
return false;
if (updateIncrementItems != null ? !updateIncrementItems.equals(that.updateIncrementItems) : that.updateIncrementItems != null)
return false;
if (updateRemoveItems != null ? !updateRemoveItems.equals(that.updateRemoveItems) : that.updateRemoveItems != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = type;
result = 31 * result + (updateItems != null ? updateItems.hashCode() : 0);
result = 31 * result + (updatePutItems != null ? updatePutItems.hashCode() : 0);
result = 31 * result + (json != null ? json.hashCode() : 0);
result = 31 * result + (updateIncrementItems != null ? updateIncrementItems.hashCode() : 0);
result = 31 * result + (updateRemoveItems != null ? updateRemoveItems.hashCode() : 0);
return result;
}
public int getType() {
return type;
}
public List<OUpdateItem> getUpdateItems() {
return updateItems;
}
public List<OUpdatePutItem> getUpdatePutItems() {
return updatePutItems;
}
public OJson getJson() {
return json;
}
public List<OUpdateIncrementItem> getUpdateIncrementItems() {
return updateIncrementItems;
}
public List<OUpdateRemoveItem> getUpdateRemoveItems() {
return updateRemoveItems;
}
}
/* JavaCC - OriginalChecksum=0eca3b3e4e3d96c42db57b7cd89cf755 (do not edit this line) */
| [
"luigi.dellaquila@gmail.com"
] | luigi.dellaquila@gmail.com |
48bf21afcf9575d76e5ae9702f16300d8bfb50b7 | 1966a3c144aeab99cdd69ff2170613468bdf49c9 | /abc/abc157/c/src/main/java/com/solver/atcoder/abc/abc157/c/Main.java | b8290f5acddfea11d70a563d85528fcc68bd1d70 | [] | no_license | fujigon/atcoder | 2a85e6c2fea0e3903dd4f65d1310a9457e3af3a2 | 1f7e24fa4c11767f3af5b86cc9e12e60252b5479 | refs/heads/master | 2021-08-08T06:29:03.763205 | 2020-05-17T11:52:03 | 2020-05-17T11:52:03 | 179,859,160 | 0 | 0 | null | 2020-05-17T11:52:05 | 2019-04-06T16:36:33 | Java | UTF-8 | Java | false | false | 5,751 | java | package com.solver.atcoder.abc.abc157.c;
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
solve(System.in, System.out);
}
static void solve(InputStream is, PrintStream os) {
Scanner sc = new Scanner(is);
/* read */
int n = sc.nextInt();
int m = sc.nextInt();
Map<Integer, Integer> validation = new HashMap<>();
for (int i = 0; i < m; i++) {
int s = sc.nextInt() - 1;
int c = sc.nextInt();
if (validation.containsKey(s) && validation.get(s) != c) {
os.println(-1);
return;
}
validation.put(s, c);
}
for (int i = 0; i < (int) Math.pow(10, n); i++) {
String s = String.valueOf(i);
if (s.length() != n) continue;
if (isValid(s, validation)) {
os.println(i);
return;
}
}
os .println(-1);
}
private static boolean isValid(String s, Map<Integer, Integer> validation) {
for (Integer index : validation.keySet()) {
if (s.charAt(index) - '0' != validation.get(index)) return false;
}
return true;
}
private static long gcd(long m, long n) {
if (m < n) {
return gcd(n, m);
}
if (n == 0) {
return m;
}
return gcd(n, m % n);
}
private static long lcm(long m, long n) {
return m / gcd(m, n) * n;
}
private static class Modular {
private final long mod;
private Modular(long mod) {
this.mod = mod;
}
private long inverse(long n) {
return pow(n, mod - 2) % mod;
}
private long pow(long x, long n) {
/*
long ans = 1;
while (n > 0) {
if ((n & 1) == 1) {
ans = ans * x % mod;
}
x = x * x % mod;
n >>= 1;
}
return ans;
*/
if (n == 0) {
return 1;
}
return n % 2 == 0 ?
pow(x * x % mod, n / 2) % mod :
x % mod * pow(x, n - 1) % mod;
}
}
private static class ModularNFixedCombination {
private final Modular modular;
private final long[] comb;
private final long N;
public ModularNFixedCombination(long N, int size, long mod) {
this.modular = new Modular(mod);
this.comb = new long[size + 1];
this.N = N;
comb[0] = 1;
for (int i = 1; i <= size; i++) {
comb[i] = ((comb[i - 1] * (N - (i - 1))) % mod * modular.inverse(i)) % mod;
}
}
long combination(int n, int k) {
if (n != N) {
throw new IllegalStateException();
}
return comb[k];
}
long repeatedCombination(int n, int k) {
return combination(n + k - 1, k);
}
}
private static class ModularCombination {
private final long fact[];
private final long mod;
private final Modular modular;
public ModularCombination(int size, long mod) {
this.fact = new long[size + 1];
this.mod = mod;
this.modular = new Modular(mod);
this.fact[0] = 1;
for (int i = 1; i <= size; i++) {
fact[i] = (fact[i - 1] * i) % mod;
}
}
private long factorial(int n) {
return fact[n];
}
long combination(int n, int k) {
return
(
(
(
factorial(n) * modular.inverse(factorial(n - k))
) % mod
) * modular.inverse(factorial(k))
) % mod;
}
long repeatedCombination(int n, int k) {
return combination(n + k - 1, k);
}
}
private static class Scanner {
private final InputStream is;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
Scanner(InputStream is) {
this.is = is;
}
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = is.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte()) {
return buffer[ptr++];
} else {
return -1;
}
}
private static boolean isPrintableChar(int c) {
return 33 <= c && c <= 126;
}
public boolean hasNext() {
while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
ptr++;
}
return hasNextByte();
}
public String next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) {
throw new NoSuchElementException();
}
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
throw new NumberFormatException();
}
return (int) nl;
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
}
| [
"dec12.kaz@gmail.com"
] | dec12.kaz@gmail.com |
016e6c0ead740fc82a309b2d80f96a633567d931 | c83097ea0204b261cb71eec812cfc6d0b5f3cd82 | /omod/src/test/java/org/openmrs/module/flowsheet/definition/models/QuestionDefinitionTest.java | b38dae9d786636e320a9d815d67d149de962465f | [] | no_license | Bahmni/openmrs-module-flowsheet | fed23345c9425cf1b9efc9183d6439ad259e5f49 | 1a7c2b895bf9f5fbc48960af9b71ddaab4efca7b | refs/heads/master | 2022-05-21T13:14:57.600210 | 2022-03-16T07:52:48 | 2022-03-16T07:52:48 | 71,447,593 | 0 | 3 | null | 2022-03-16T07:52:49 | 2016-10-20T09:36:58 | Java | UTF-8 | Java | false | false | 876 | java | package org.openmrs.module.flowsheet.definition.models;
import org.openmrs.module.flowsheet.api.QuestionType;
import org.openmrs.module.flowsheet.api.models.Question;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.openmrs.Concept;
import java.util.Arrays;
import java.util.LinkedHashSet;
import static org.junit.Assert.assertNotNull;
public class QuestionDefinitionTest {
@Mock
Concept systolic;
@Mock
Concept diastolic;
QuestionDefinition questionDefinition;
@Before
public void setUp() {
questionDefinition = new QuestionDefinition("Blood Pressure", new LinkedHashSet<>(Arrays.asList(systolic, diastolic)), QuestionType.OBS);
}
@Test
public void shouldCreateQuestion() {
Question question = questionDefinition.createQuestion();
assertNotNull(question);
}
} | [
"vikashgupta2000@gmail.com"
] | vikashgupta2000@gmail.com |
c2c855c99256b8829dfc63eeeb260921e1d8cf57 | 414ee9af7ad993f6159e955eb64e4b732c757a68 | /plugins/org.reclipse.structure.specification.edit/src/org/reclipse/structure/specification/provider/PSCombinedFragmentItemProvider.java | bb32b38d4c608104770a3ddf2b26592ad671e83b | [
"Apache-2.0"
] | permissive | CloudScale-Project/StaticSpotter | 699b7008d4cf3a8cfe6745551a48c77a18f58a42 | e1473a5b6026860eab9b488086287401930fa48c | refs/heads/master | 2020-05-07T20:45:22.725306 | 2015-02-17T10:54:05 | 2015-02-17T10:54:05 | 30,912,563 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,628 | java | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.reclipse.structure.specification.provider;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.fujaba.commons.identifier.provider.IdentifierItemProvider;
import org.reclipse.structure.specification.PSCombinedFragment;
import org.reclipse.structure.specification.SpecificationFactory;
import org.reclipse.structure.specification.SpecificationPackage;
/**
* This is the item provider adapter for a {@link org.reclipse.structure.specification.PSCombinedFragment} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class PSCombinedFragmentItemProvider
extends IdentifierItemProvider
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource
{
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PSCombinedFragmentItemProvider(AdapterFactory adapterFactory)
{
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object)
{
if (itemPropertyDescriptors == null)
{
itemPropertyDescriptors = new ArrayList<IItemPropertyDescriptor>();
addWeightPropertyDescriptor(object);
addChildrenPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Weight feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addWeightPropertyDescriptor(Object object)
{
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_PSItem_weight_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_PSItem_weight_feature", "_UI_PSItem_type"),
SpecificationPackage.Literals.PS_ITEM__WEIGHT,
true,
false,
false,
ItemPropertyDescriptor.REAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Parents feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addParentsPropertyDescriptor(Object object)
{
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_PSCombinedFragmentItem_parents_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_PSCombinedFragmentItem_parents_feature", "_UI_PSCombinedFragmentItem_type"),
SpecificationPackage.Literals.PS_COMBINED_FRAGMENT_ITEM__PARENTS,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Children feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addChildrenPropertyDescriptor(Object object)
{
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_PSCombinedFragment_children_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_PSCombinedFragment_children_feature", "_UI_PSCombinedFragment_type"),
SpecificationPackage.Literals.PS_COMBINED_FRAGMENT__CHILDREN,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Kind feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addKindPropertyDescriptor(Object object)
{
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_PSCombinedFragment_kind_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_PSCombinedFragment_kind_feature", "_UI_PSCombinedFragment_type"),
SpecificationPackage.Literals.PS_COMBINED_FRAGMENT__KIND,
false,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object)
{
if (childrenFeatures == null)
{
super.getChildrenFeatures(object);
childrenFeatures.add(SpecificationPackage.Literals.PS_COMBINED_FRAGMENT__CONSTRAINT);
}
return childrenFeatures;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EStructuralFeature getChildFeature(Object object, Object child)
{
// Check the type of the specified child object and return the proper feature to use for
// adding (see {@link AddCommand}) it as a child.
return super.getChildFeature(object, child);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean hasChildren(Object object)
{
return hasChildren(object, false);
}
/**
* This returns PSCombinedFragment.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object)
{
return overlayImage(object, getResourceLocator().getImage("full/obj16/PSCombinedFragment"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String getText(Object object)
{
String label = ((PSCombinedFragment)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_PSCombinedFragment_type") :
getString("_UI_PSCombinedFragment_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification)
{
updateChildren(notification);
switch (notification.getFeatureID(PSCombinedFragment.class))
{
case SpecificationPackage.PS_COMBINED_FRAGMENT__WEIGHT:
case SpecificationPackage.PS_COMBINED_FRAGMENT__KIND:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case SpecificationPackage.PS_COMBINED_FRAGMENT__CONSTRAINT:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
{
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(SpecificationPackage.Literals.PS_COMBINED_FRAGMENT__CONSTRAINT,
SpecificationFactory.eINSTANCE.createPSFuzzyMetricConstraint()));
newChildDescriptors.add
(createChildParameter
(SpecificationPackage.Literals.PS_COMBINED_FRAGMENT__CONSTRAINT,
SpecificationFactory.eINSTANCE.createPSFuzzySetRatingConstraint()));
newChildDescriptors.add
(createChildParameter
(SpecificationPackage.Literals.PS_COMBINED_FRAGMENT__CONSTRAINT,
SpecificationFactory.eINSTANCE.createPSAttributeConstraint()));
newChildDescriptors.add
(createChildParameter
(SpecificationPackage.Literals.PS_COMBINED_FRAGMENT__CONSTRAINT,
SpecificationFactory.eINSTANCE.createPSMetricConstraint()));
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator()
{
return SpecificationEditPlugin.INSTANCE;
}
}
| [
"jure.polutnik@gmail.com"
] | jure.polutnik@gmail.com |
ac3de0c334d9fe4448b6b43ec85082af40f6770e | 64b9668fdf34ed0a39d4b039abb8433f48a6e010 | /src/view.java | 1671cb107257f168769ce25d3083ae341ff61ec8 | [] | no_license | shreyas0204/DMS | a9e57e7a5a8b9997e74c476b2e9da8bce6178fe6 | 195598edfb660df257cbfcfb9c115c609b23b750 | refs/heads/master | 2020-03-08T22:29:16.646615 | 2018-04-07T12:24:11 | 2018-04-07T12:24:11 | 128,432,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,425 | java |
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.RequestDispatcher;
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 com.dexpert.main.databaseconnection.DBConnection;
/**
* Servlet implementation class view
*/
@WebServlet("/view")
public class view extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public view() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
* DBConnection connection = new DBConnection();
*/
DBConnection connection = new DBConnection();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//response.getWriter().append("Served at: ").append(request.getContextPath());
//System.out.println("I am inside doGet");
int a=Integer.parseInt(request.getParameter("id"));
System.out.println("print partner id="+a);
try
{
Connection con=connection.getConnection();
Statement statement = (Statement) con.createStatement();
System.out.println("before query");
ResultSet rs3=statement.executeQuery("select * from dms.defect_info where id="+a+"");
System.out.println("after query"+a);
RequestDispatcher rd3= null;
request.setAttribute("viewpartner", rs3);
System.out.println("afetr request");
rd3=request.getRequestDispatcher("/view.jsp");
rd3.forward(request, response);
}
catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("I am inside doPost");
doGet(request, response);
}
}
| [
"Shreyas@192.168.1.12"
] | Shreyas@192.168.1.12 |
0abd1f4e0ad9dec5b3417b5038198b3563e24dd5 | a40a12e3d38a33359f4a22ea05aae119800cf54a | /app/src/androidTest/java/documents/diego/belatrixcodingtest/ExampleInstrumentedTest.java | ea5796e687dc836a9a9f2380ca5eff388f1be005 | [] | no_license | diegomlowe/belatrixAndroidTest | 08911791c7234ce0547572491a3bd75390654cbf | b0982ea3a66e66f1ccc4856f383f10fdb7a2c69b | refs/heads/master | 2020-05-03T06:04:40.305995 | 2019-04-01T22:10:51 | 2019-04-01T22:10:51 | 178,453,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package documents.diego.belatrixcodingtest;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.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("documents.diego.belatrixcodingtest", appContext.getPackageName());
}
}
| [
"diegomlowe@gmail.com"
] | diegomlowe@gmail.com |
8b25f7b7e8a3c24957db4f2b929750f7db051dc6 | 8116e2b93b079a703ed2cd5315e4c5989e896569 | /Module2/src/bai7_abstract_class_interface/thuc_hanh/list_geometric/RectangleComparatorTest.java | a6e8d302a89e2476e99fb8d5a70b23d13d4c3682 | [] | no_license | PhanGiaKhanh/C0221G1-CodeGym. | 657e451e21d2c43d9b4018cc617c5eb5c94a8f4c | d28288850f4ace937146df2d556a40bdf71ada7a | refs/heads/main | 2023-08-19T20:02:22.677147 | 2021-09-29T09:52:26 | 2021-09-29T09:52:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 832 | java | package bai7_abstract_class_interface.thuc_hanh.list_geometric;
import bai6_inheritance.thuc_hanh.shape.Rectangle;
import java.util.Arrays;
import java.util.Comparator;
public class RectangleComparatorTest {
public static void main(String[] args) {
Rectangle[] rectangles = new Rectangle[4];
rectangles[0] = new Rectangle(10,20);
rectangles[1] = new Rectangle();
rectangles[2] = new Rectangle(1,2,"RED",true);
rectangles[3] = new Rectangle(20,10,"RED",true);
for (Rectangle R : rectangles){
System.out.println(" >>> "+R);
}
Comparator rectangleComparator = new RectangleComparator();
Arrays.sort(rectangles, rectangleComparator);
for (Rectangle R : rectangles){
System.out.println(">>> " + R);
}
}
}
| [
"phangiakhanh90@gmail.com"
] | phangiakhanh90@gmail.com |
025721e45c88a93c4e74df7cebecd145464287bb | 4dafdf6eff20fdaf96db3478e19570f4a9acc6ca | /src/main/java/cn/com/zfyc/utils/SendSmsUtil.java | e5b041e2506b64f0d477290809fc88f2d47db417 | [] | no_license | moukunlin/ZFYC | 1a4968af45130c1fbacc078cf478db5cf1f29efb | 8ebc4c15a106e4f6cf20e320c71512d1bff79cd8 | refs/heads/master | 2020-04-27T00:10:18.212504 | 2019-03-30T15:20:17 | 2019-03-30T15:20:17 | 173,925,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,849 | java | package cn.com.zfyc.utils;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
public class SendSmsUtil {
private final static Log log = LogFactory.get();
private final static String SignName = "中富元创";
private final static String TemplateCode = "SMS_159772661";
private final static String AccessKeyId = "LTAI1UytqQh20MPH";
private final static String AccessKeySecret = "OAgrGVRU7IXe2xCGZj75rQB4Gxmi5l";
public static Map<String,Object> sendVerifyCode(String phoneNumbers){
Map<String,Object> result = new HashMap<>();
int code = (int) ((Math.random()*9+1)*100000);
DefaultProfile profile = DefaultProfile.getProfile("default", AccessKeyId, AccessKeySecret);
IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest();
//request.setProtocol(ProtocolType.HTTPS);
request.setMethod(MethodType.POST);
request.setDomain("dysmsapi.aliyuncs.com");
request.setVersion("2017-05-25");
request.setAction("SendSms");
request.setConnectTimeout(5000);
request.setReadTimeout(5000);
request.putQueryParameter("SignName",SignName);
request.putQueryParameter("TemplateCode", TemplateCode);
request.putQueryParameter("PhoneNumbers",phoneNumbers);
request.putQueryParameter("TemplateParam","{\"code\":\"" + code + "\"}");
try {
CommonResponse response = client.getCommonResponse(request);
Map<String, ?> map = JacksonMapper.INSTANCE.readJsonToObject(response.getData());
if (!StringUtils.isEmpty(map.get("Code")) && map.get("Code").toString().equalsIgnoreCase("OK")){
log.info("向用户{}发送验证码成功",phoneNumbers);
result.put("status","SUCCESS");
result.put("verifyCode",code);
}else {
log.info("向用户{}发送验证码失败,失败信息:{}",phoneNumbers,map.get("Message"));
result.put("status","FAIL");
}
} catch (ServerException e) {
log.error("验证码发送服务异常,异常信息:{}",e.getMessage());
result.put("status","FAIL");
} catch (ClientException e) {
log.error("验证码发送服务异常,异常信息:{}",e.getMessage());
result.put("status","FAIL");
}
return result;
}
}
| [
"moukunlin@bonc.com.cn"
] | moukunlin@bonc.com.cn |
9f6e40b07c5c866371ff16629e100c75c7a2629e | a8bd35d135f4e5b430941e923490bc925a7b8198 | /app/src/main/java/net/smallchat/im/widget/FlowView.java | 42d8787eb4453ea6f4072ca9be5d9780abfbbc22 | [] | no_license | sahujaunpuri/smallchat_android-master | 8d53c5da814276bfda20de272d242aa6a485f74a | 44f46f7f3c5ed57c6487b3c8b56fa6a511612be4 | refs/heads/master | 2020-04-08T08:53:33.870909 | 2018-09-13T09:58:43 | 2018-09-13T09:58:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,046 | java | package net.smallchat.im.widget;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import net.smallchat.im.R;
import net.smallchat.im.global.FeatureFunction;
public class FlowView extends ImageView{
/*private String namespace = "http://shadow.com";
private int color;
*/
//private AnimationDrawable loadingAnimation;
private FlowTag flowTag;
private Context context;
public Bitmap bitmap;
//private ImageLoaderTask task;
private int columnIndex;// 图片属于第几列
private int rowIndex;// 图片属于第几行
private Handler viewHandler;
public FlowView(Context c, AttributeSet attrs, int defStyle) {
super(c, attrs, defStyle);
this.context = c;
Init();
}
public FlowView(Context c, AttributeSet attrs) {
super(c, attrs);
// color=Color.parseColor(attrs.getAttributeValue(namespace,"BorderColor"));
this.context = c;
Init();
}
public FlowView(Context c) {
super(c);
this.context = c;
Init();
}
private void Init() {
//setOnClickListener(this);
//this.setOnLongClickListener(this);
setAdjustViewBounds(true);
setScaleType(ScaleType.FIT_XY);
}
/*@Override
public boolean onLongClick(View v) {
Log.d("FlowView", "LongClick");
Toast.makeText(context, "长按:" + this.flowTag.getFlowId(),
Toast.LENGTH_SHORT).show();
return true;
}
@Override
public void onClick(View v) {
Log.d("FlowView", "Click");
Toast.makeText(context, "单击:" + this.flowTag.getFlowId(),
Toast.LENGTH_SHORT).show();
}*/
/* @Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Rect rec=canvas.getClipBounds();
rec.bottom--;
rec.right--;
Paint paint=new Paint();
paint.setColor(color);
paint.setStyle(Paint.Style.STROKE);
canvas.drawRect(rec, paint);
}*/
/**
* 加载图片
*/
public void LoadImage() {
if (getFlowTag() != null) {
new LoadImageThread().start();
}
}
/**
* 重新加载图片
*/
public void Reload() {
if (this.bitmap == null && getFlowTag() != null) {
new ReloadImageThread().start();
}
}
/**
* 回收内存
*/
public void recycle() {
setImageBitmap(null);
if ((this.bitmap == null) || (this.bitmap.isRecycled()))
return;
this.bitmap.recycle();
this.bitmap = null;
}
public FlowTag getFlowTag() {
if(flowTag == null){
Log.e("flowTag", "flowTag is null");
}
return flowTag;
}
public void setFlowTag(FlowTag flowTag) {
this.flowTag = flowTag;
}
public int getColumnIndex() {
return columnIndex;
}
public void setColumnIndex(int columnIndex) {
this.columnIndex = columnIndex;
}
public int getRowIndex() {
return rowIndex;
}
public void setRowIndex(int rowIndex) {
this.rowIndex = rowIndex;
}
public Handler getViewHandler() {
return viewHandler;
}
public FlowView setViewHandler(Handler viewHandler) {
this.viewHandler = viewHandler;
return this;
}
class ReloadImageThread extends Thread {
@Override
public void run() {
if (flowTag != null) {
bitmap= FeatureFunction.downLoadImage(flowTag.getThumbPicUrl());
((Activity) context).runOnUiThread(new Runnable() {
public void run() {
if (bitmap==null) {
bitmap=BitmapFactory.decodeResource(context.getResources(),R.drawable.noraml_album);
}
if (bitmap != null) {// 此处在线程过多时可能为null
setImageBitmap(bitmap);
}
}
});
}
}
}
class LoadImageThread extends Thread {
LoadImageThread() {
}
public void run() {
if (flowTag != null) {
bitmap= FeatureFunction.downLoadImage(flowTag.getThumbPicUrl());
//bitmap = BitmapFactory.decodeStream(buf);
// 此处不能直接更新UI,否则会发生异常:
// CalledFromWrongThreadException: Only the original thread that
// created a view hierarchy can touch its views.
// 也可以使用Handler或者Looper发送Message解决这个问题
((Activity) context).runOnUiThread(new Runnable() {
public void run() {
if (bitmap==null) {
bitmap=BitmapFactory.decodeResource(context.getResources(),R.drawable.default_image);
}
if (bitmap != null) {// 此处在线程过多时可能为null
int width = bitmap.getWidth();// 获取真实宽高
int height = bitmap.getHeight();
LayoutParams lp = getLayoutParams();
int layoutHeight = (height * flowTag.getItemWidth())
/ width;// 调整高度
if (lp == null) {
lp = new LayoutParams(flowTag.getItemWidth(),
layoutHeight);
}
setLayoutParams(lp);
setImageBitmap(bitmap);
Handler h = getViewHandler();
Message m = h.obtainMessage(flowTag.what, width,
layoutHeight, FlowView.this);
h.sendMessage(m);
}
}
});
// }
}
}
}
}
| [
"present810209@gmail.com"
] | present810209@gmail.com |
cde4ea1fe74d4c35042c69eb23df3e031df317ff | 89ee68c9ca3dc6350cb28ada00a10623c162274d | /src/main/java/cn/xing/modules/sys/controller/SysLoginController.java | 9be12588dbd5c67eb02d5c73504ba5a4525b4589 | [
"Apache-2.0"
] | permissive | Fudeveloper/message-push | 03fe9e66463ab39fc45881fb36ab19631a5f258b | 864176f7b4f8cd622d4f194260ae84b39012c574 | refs/heads/master | 2023-04-25T00:08:02.238103 | 2021-05-16T01:10:29 | 2021-05-16T01:10:29 | 367,558,533 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,763 | java | /**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package cn.xing.modules.sys.controller;
import cn.xing.common.utils.R;
import cn.xing.modules.sys.entity.SysUserEntity;
import cn.xing.modules.sys.form.SysLoginForm;
import cn.xing.modules.sys.service.SysCaptchaService;
import cn.xing.modules.sys.service.SysUserService;
import cn.xing.modules.sys.service.SysUserTokenService;
import org.apache.commons.io.IOUtils;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Map;
/**
* 登录相关
*
* @author Mark sunlightcs@gmail.com
*/
@RestController
public class SysLoginController extends AbstractController {
@Autowired
private SysUserService sysUserService;
@Autowired
private SysUserTokenService sysUserTokenService;
@Autowired
private SysCaptchaService sysCaptchaService;
/**
* 验证码
*/
@GetMapping("captcha.jpg")
public void captcha(HttpServletResponse response, String uuid)throws IOException {
response.setHeader("Cache-Control", "no-store, no-cache");
response.setContentType("image/jpeg");
//获取图片验证码
BufferedImage image = sysCaptchaService.getCaptcha(uuid);
ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
IOUtils.closeQuietly(out);
}
/**
* 登录
*/
@PostMapping("/sys/login")
public Map<String, Object> login(@RequestBody SysLoginForm form)throws IOException {
boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha());
if(!captcha){
return R.error("验证码不正确");
}
//用户信息
SysUserEntity user = sysUserService.queryByUserName(form.getUsername());
//账号不存在、密码错误
if(user == null || !user.getPassword().equals(new Sha256Hash(form.getPassword(), user.getSalt()).toHex())) {
return R.error("账号或密码不正确");
}
//账号锁定
if(user.getStatus() == 0){
return R.error("账号已被锁定,请联系管理员");
}
//生成token,并保存到数据库
R r = sysUserTokenService.createToken(user.getUserId());
return r;
}
/**
* 退出
*/
@PostMapping("/sys/logout")
public R logout() {
sysUserTokenService.logout(getUserId());
return R.ok();
}
}
| [
"1178981326@qq.com"
] | 1178981326@qq.com |
84aa18573dbcdb275d5a2b9c69b97c831b29831b | 5b245b72fafcf6ebeeff79d0fe05d7f5029eb4eb | /src/main/java/com/qa/pages/BillPage.java | 7072a71fa47bb012085a99d9bf257cece1ab8c26 | [] | no_license | Sravan-Kumar-K/NetSuiteProcessAutomation | b616acd51b8b9a0de246aaa93117f862cdb72dfe | 274e384b0825f592a6783241762e7a59ab9eb78b | refs/heads/master | 2023-02-06T01:11:50.343636 | 2020-12-24T16:12:49 | 2020-12-24T16:12:49 | 324,192,877 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,005 | java | package com.qa.pages;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.aventstack.extentreports.ExtentTest;
import com.qa.util.TestBase;
public class BillPage extends TestBase{
@FindBy(xpath = "//input[@id='inpt_customform1']")
WebElement vbForm;
@FindBy(xpath = "//div[@class='dropdownDiv']//div")
List<WebElement> selectForm;
@FindBy(xpath = "//input[@id='btn_multibutton_submitter']")
WebElement saveBtn;
@FindBy(xpath = "//div[@class='descr']")
WebElement confirmationMsg;
@FindBy(xpath = "//input[@id='edit']")
WebElement editBtn;
@FindBy(xpath = "//input[@id='inpt_approvalstatus4']")
WebElement approvalStatus;
@FindBy(xpath = "//div[@class='dropdownDiv']//div")
List<WebElement> approvalStatusList;
@FindBy(xpath = "//div[@class='uir-record-status']")
WebElement billStatus;
@FindBy(xpath = "//input[@id='payment']")
WebElement paymentBtn;
@FindBy(xpath = "//input[@id='return']")
WebElement returnBtn;
@FindBy(xpath = "//a[@id='rlrcdstabtxt']")
WebElement relatedRecordsTab;
@FindBy(xpath = "//a[@id='purchaseorderstxt']")
WebElement poSubTab;
@FindBy(xpath = "//a[@id='purchaseorders_displayval']")
WebElement poLink;
public BillPage() {
PageFactory.initElements(driver, this);
}
public void approveBill() throws InterruptedException {
editBtn.click();
Thread.sleep(10000);
eleClickable(driver, By.xpath("//input[@id='inpt_approvalstatus4']"), 10);
approvalStatus.click();
for(int i=0;i<approvalStatusList.size();i++) {
String statusValue = approvalStatusList.get(i).getText().trim();
if(statusValue.equals("Approved")) {
approvalStatusList.get(i).click();
}
}
saveBtn.click();
}
public void verifyBillApproval(ExtentTest logInfo) {
eleAvailability(driver, By.xpath("//div[@class='descr']"), 20);
String confirmationMessage = confirmationMsg.getText().trim();
String billStatusText = billStatus.getText().trim();
if(confirmationMessage.equals("Transaction successfully Saved") && billStatusText.equals("OPEN")) {
System.out.println("Invoice approved successfully with '"+billStatusText+"' status");
logInfo.pass("Invoice approved successfully with '"+billStatusText+"' status");
}else {
logInfo.fail("Invoice is not approved");
}
}
public PaymentPage clickOnPaymentBtn() {
paymentBtn.click();
return new PaymentPage();
}
public void generateVendorBill() throws InterruptedException {
// Change the Form to "Standard Vendor Bill"
Thread.sleep(10000);
eleClickable(driver, By.xpath("//input[@id='inpt_customform1']"), 10);
vbForm.click();
for(int i=0;i<selectForm.size();i++) {
String formValue = selectForm.get(i).getText().trim();
if(formValue.equals("Standard Vendor Bill")) {
selectForm.get(i).click();
}
}
Thread.sleep(10000);
// Save the Vendor Bill
saveBtn.click();
}
public void verifyVBCreation(ExtentTest logInfo) {
eleAvailability(driver, By.xpath("//div[@class='descr']"), 20);
String confirmationMessage = confirmationMsg.getText().trim();
if(confirmationMessage.equals("Transaction successfully Saved")) {
System.out.println("Vendor Bill created successfully");
logInfo.pass("Vendor Bill created successfully");
}else {
logInfo.fail("Vendor Bill not created");
}
}
public void clickOnPOLink() throws InterruptedException {
Thread.sleep(10000);
JavascriptExecutor je = (JavascriptExecutor) driver;
je.executeScript("window.scrollBy(0,document.body.scrollHeight)");
relatedRecordsTab.click();
poSubTab.click();
eleClickable(driver, By.xpath("//a[@id='purchaseorders_displayval']"), 5);
poLink.click();
}
}
| [
"Sravan Kumar@DESKTOP-4T9R7PN"
] | Sravan Kumar@DESKTOP-4T9R7PN |
4b15fc42175bffb536ec85e893cbdb101661bea0 | d76b66b8e3b2da224b0cfb49b11ce70678d30fc6 | /Test/NewFile.java | 2930d8f23be9ca9aec6b55c86b3ca38d70c87dde | [] | no_license | shanth98/hello-world | ee8c774e05380609ceb6b80bd757f97c65b4e20a | fa4b38b2927f8954a63a78624c6c4aadb5a787f8 | refs/heads/main | 2023-02-16T00:04:44.790547 | 2021-01-17T11:01:48 | 2021-01-17T11:01:48 | 330,358,316 | 0 | 0 | null | 2021-01-17T10:15:51 | 2021-01-17T09:46:17 | null | UTF-8 | Java | false | false | 25 | java | This is a test java file
| [
"noreply@github.com"
] | noreply@github.com |
cf690bae6dfea6e45a02399da37b2b2a1e3f3280 | 2bf4a0773dd02fd1f87b6d80532b0f3f009aeaf6 | /Course Work/module-1/m1-capstone-java-cateringsystem-solution/src/main/java/com/techelevator/money/InvalidAmountException.java | 733fb0c9fa42e4f8f3185cd110893d3884ee8942 | [] | no_license | ConnerBabb/Java | 19a4cff3175388a264ae7d7be4be7c2f6b5a787a | c3c906eedbd590b84caca1c50de441ce32c23b74 | refs/heads/main | 2023-05-23T06:36:23.103076 | 2021-06-09T21:11:10 | 2021-06-09T21:11:10 | 306,211,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package com.techelevator.money;
public class InvalidAmountException extends Exception {
private static final long serialVersionUID = -4998352410403476336L;
private double newAmount;
public InvalidAmountException(String message, double newAmount) {
super(message);
this.newAmount = newAmount;
}
public double getNewAmount() {
return newAmount;
}
}
| [
"connerbabb@gmail.com"
] | connerbabb@gmail.com |
5f8a3c6e274249bc6fd958fadfbf32de2c5f42a0 | 8f22a9ecc62ac90ded9e50ce5f8cca5f55bf4d78 | /src/instant/Context.java | e2f1713dc0c588733286213fa4fca65815e1ab57 | [] | no_license | MironSz/InstantLanguageCompiler | b5792e2ffa211c5c8bed77dd29c4ed6ee7df2c3b | 8646cf270001640fa045fa283fc474f667cb1173 | refs/heads/master | 2023-01-19T01:55:38.587562 | 2020-11-15T13:11:50 | 2020-11-15T13:11:50 | 313,034,182 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,806 | java | package instant;
import instant.Absyn.Expression;
import instant.Absyn.LiteralExpression;
import instant.Absyn.VarExpression;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Context {
private int registerCount = 0;
private List<Integer> registerStack;
private Map<Expression, String> expressiontoRegisterMap = new HashMap<>();
private Map<String,String> identToRegister = new HashMap<>();
public String getNewRegister(Expression expression) {
if (expression instanceof LiteralExpression){
return getResultOfExpression(expression);
}
if (expressiontoRegisterMap.containsKey(expression)) {
return expressiontoRegisterMap.get(expression);
}
String name = expression.getName() + registerCount;
registerCount++;
expressiontoRegisterMap.put(expression, name);
return "%"+name;
}
public String getResultOfExpression(Expression expression) {
if (expression instanceof LiteralExpression)
return "%"+Integer.toString( ((LiteralExpression)expression).integer_);
if (expression instanceof VarExpression)
return "%"+identToRegister.getOrDefault(((VarExpression) expression).ident_,"umdefined_variable");
return "%"+expressiontoRegisterMap.getOrDefault(expression, "register_was_not_defined");
}
public void setNewVarRegister(String ident,Expression expression){
String registerName = this.getResultOfExpression(expression);
identToRegister.put(ident,registerName);
}
public String assignNewRegister(String ident){
String newRegister = ident+registerCount;
registerCount++;
identToRegister.put(ident,newRegister);
return "%"+newRegister;
}
}
| [
"miron.szewczyk@autonomik.pl"
] | miron.szewczyk@autonomik.pl |
93a99b08aea2dd7ecf86ebc6fb1b3efeeef1aba1 | 5a89e429830902214437be7957706c6eb696b9fb | /src/main/java/com/myboard/mapper/BoardMapper.java | d861ee1bd29ba5443ff856e587625f102e365e51 | [] | no_license | hyeok713/SpringBoot-myboard | 9be67cb07a61f571ac6002882badfad6d103cd2e | 755e435614208df4975065b84bf0ea4b66352b20 | refs/heads/main | 2023-01-03T09:31:42.038796 | 2020-10-22T12:21:05 | 2020-10-22T12:21:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | package com.myboard.mapper;
import java.util.List;
import com.myboard.domain.BoardVO;
public interface BoardMapper {
// -- .xml 파일에서 입력된 쿼리를 실행합니다. !! 해당 메서드는 id로 입력받는다 !!
//글작성
public void boardInsert(BoardVO vo)throws Exception;
//글목록
public List<BoardVO>boardList()throws Exception;
//글보기
public BoardVO boardView(int bno)throws Exception;
//조회수 증가
public void hitPlus(int bno)throws Exception;
//글수정
public void boardUpdate(BoardVO vo)throws Exception;
//글삭제
public void boardDelete(int bno)throws Exception;
} | [
"part1shb@gmail.com"
] | part1shb@gmail.com |
cd0e9eb84c8457913221b061d6017df2ca784404 | 01340816f7165798fd857f33b4b4414fa9bf192c | /src/main/java/coding/MyTest/getRecentSpeed.java | 8c8f3a2a5e59bfa50986e175dae68de4d96700fd | [] | no_license | EarWheat/LeetCode | 250f181c2c697af29ce6f76b1fdf7c7b0d7fb02c | f440e6c76efb4554e0404cacf137dc1f6677e2e1 | refs/heads/master | 2023-08-31T06:25:35.460107 | 2023-08-30T06:41:10 | 2023-08-30T06:41:10 | 145,558,499 | 2 | 1 | null | 2023-06-14T22:51:49 | 2018-08-21T12:05:56 | Java | UTF-8 | Java | false | false | 20,515 | java | package coding.MyTest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author liuzhaoluliuzhaolu
* @date 2021/6/11 下午3:46
* @desc
* @prd
* @Modification History:
* Date Author Description
* ------------------------------------------ *
*/
public class getRecentSpeed {
public String getRecentSpeed(String trail){
try {
JSONArray points = JSONArray.parseArray(trail);
List<JSONObject> pointList = new ArrayList<>();
points.forEach(point -> {
pointList.add(JSONObject.parseObject(JSONObject.toJSONString(point)));
});
Comparator<JSONObject> comparator = new Comparator<JSONObject>() {
@Override
public int compare(JSONObject o1, JSONObject o2) {
if(o1.getLong("timestamp") > o2.getLong("timestamp")){
return -1;
} else if(o1.getLong("timestamp") < o2.getLong("timestamp")) {
return 1;
}
return 0;
}
};
JSONObject lastPoint = pointList.stream().sorted(comparator).collect(Collectors.toList()).get(0);
return lastPoint.toJSONString();
} catch (Exception e){
return "";
}
}
public static void main(String[] args) {
getRecentSpeed getRecentSpeed = new getRecentSpeed();
String trail = "[{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":38.128570556640625,\"point_speed\":0.10341079533100128,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":-1.0,\"timestamp\":1623397180},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":214.4737548828125,\"point_speed\":3.7177605628967285,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397181},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":17.125646591186523,\"point_speed\":0.67821204662323,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397182},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":22.86370086669922,\"point_speed\":0.8489248156547546,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397183},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":26.70897102355957,\"point_speed\":0.503868579864502,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397185},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":26.70897102355957,\"point_speed\":0.503868579864502,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397186},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":15.811924934387207,\"point_speed\":0.145355224609375,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397187},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":309.7276306152344,\"point_speed\":0.06193390116095543,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397189},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":229.59625244140625,\"point_speed\":0.21124516427516937,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397190},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":230.8455352783203,\"point_speed\":0.22482842206954956,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397191},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":230.8455352783203,\"point_speed\":0.22482842206954956,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397192},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":237.07171630859375,\"point_speed\":0.1179519072175026,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397193},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":237.07171630859375,\"point_speed\":0.1179519072175026,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397194},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":233.4619598388672,\"point_speed\":0.03637836128473282,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397195},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":44.83707809448242,\"point_speed\":0.06180955469608307,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397196},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":51.544315338134766,\"point_speed\":0.09303855150938034,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397197},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":58.192623138427734,\"point_speed\":0.05415237322449684,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397199},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":58.192623138427734,\"point_speed\":0.05415237322449684,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397200},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":8.407227516174316,\"point_speed\":0.13053549826145172,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397201},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":8.407227516174316,\"point_speed\":0.13053549826145172,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397203},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":270.0,\"point_speed\":9.772853227332234E-4,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397204},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":270.0,\"point_speed\":0.0027512444648891687,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397205},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":231.7843017578125,\"point_speed\":0.0979095920920372,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397206},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":231.7843017578125,\"point_speed\":0.0979095920920372,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397207},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":231.2342071533203,\"point_speed\":0.092951200902462,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397209},{\"lat\":-143999,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849224,\"point_direction\":228.02420043945312,\"point_speed\":3.5833663940429688,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":4.9780445816537835,\"timestamp\":1623397210},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":156.85806274414062,\"point_speed\":0.12834906578063965,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":4.9780445816537835,\"timestamp\":1623397211},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":58.00662612915039,\"point_speed\":0.6510172486305237,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397212},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":0.0,\"point_speed\":8.642945322208107E-4,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397214},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":180.0,\"point_speed\":7.600568351335824E-4,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397215},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":180.0,\"point_speed\":0.0016117056366056204,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397216},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":180.0,\"point_speed\":0.0016117056366056204,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397217},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":47.47124099731445,\"point_speed\":0.07973742485046387,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397218},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":47.47124099731445,\"point_speed\":0.07973742485046387,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397219},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":44.6475830078125,\"point_speed\":0.2577688992023468,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397222},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":46.82905578613281,\"point_speed\":0.20832759141921997,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397223},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":46.79231262207031,\"point_speed\":0.10500649362802505,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397224},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":46.79231262207031,\"point_speed\":0.10500649362802505,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397225},{\"lat\":-143995,\"link_id_vec\":[9488775440],\"link_id_vecIterator\":[9488775440],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":22.805477142333984,\"point_speed\":0.00429224967956543,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397226},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":230.94969177246094,\"point_speed\":0.04945831000804901,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397229},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":294.5211486816406,\"point_speed\":0.05861182510852814,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397231},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":238.67393493652344,\"point_speed\":0.16895045340061188,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397233},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":235.25086975097656,\"point_speed\":0.153849259018898,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397234},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":231.57772827148438,\"point_speed\":0.15728838741779327,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397236},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":231.57772827148438,\"point_speed\":0.15728838741779327,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397237},{\"lat\":-143995,\"link_id_vec\":[9488775441],\"link_id_vecIterator\":[9488775441],\"link_id_vecSize\":1,\"lng\":-4849222,\"point_direction\":233.8119659423828,\"point_speed\":0.06213017553091049,\"setLat\":true,\"setLink_id_vec\":true,\"setLng\":true,\"setPoint_direction\":true,\"setPoint_speed\":true,\"setSpherical_distance\":true,\"setTimestamp\":true,\"spherical_distance\":0.0,\"timestamp\":1623397238}]";
System.out.println(getRecentSpeed.getRecentSpeed(trail));
}
}
| [
"2636965138@qq.com"
] | 2636965138@qq.com |
8c4fdf12f2dd4e3d7a6ba27981ab2376b4252a04 | e3a226df111a2dfa4eafcc6bc61010b3cb3f0f81 | /push/src/main/java/com/bearever/push/PushTargetManager.java | 2363aba19309b7fe8697b19a309e68e46c25aa55 | [] | no_license | beasonshu/Push | 1924d0048fe6a1468f306985e48d45f02717a619 | aa287b3a0ef0edad4c0ff2c7bf48e16a2ed3d304 | refs/heads/master | 2020-05-17T06:18:51.568134 | 2019-04-26T04:30:45 | 2019-04-26T04:30:45 | 183,555,695 | 0 | 0 | null | 2019-04-26T04:16:50 | 2019-04-26T04:16:49 | null | UTF-8 | Java | false | false | 5,918 | java | package com.bearever.push;
import android.app.Activity;
import android.app.Application;
import com.bearever.push.handle.PushReceiverHandleManager;
import com.bearever.push.model.PushTargetEnum;
import com.bearever.push.model.ReceiverInfo;
import com.bearever.push.target.BasePushTargetInit;
import com.bearever.push.target.huawei.HuaweiInit;
import com.bearever.push.target.jiguang.JPushInit;
import com.bearever.push.target.meizu.MeizuInit;
import com.bearever.push.target.oppo.OppoInit;
import com.bearever.push.target.xiaomi.XiaomiInit;
import com.huawei.android.hms.agent.HMSAgent;
import com.huawei.android.hms.agent.common.handler.ConnectHandler;
/**
* 初始化推送服务的管家,根据设备判断初始化哪个平台的推送服务;
* *********
* 有两种方式来监听推送消息,一种是是实现handle/impl里面的类的handle方法:
* HandleReceiverAlias----------------别名设置之后执行
* HandleReceiverMessage--------------接收到消息之后执行,不会主动显示通知
* HandleReceiverNotification---------接收到消息之后执行,主动显示通知
* HandleReceiverNotificationOpened---用户点击了通知之后执行
* --------------------
* 另外一种是添加回调接口监听,执行@link addPushReceiverListener()添加推送回调接口
* *********
* Created by luoming on 2018/5/28.
*/
public class PushTargetManager {
private static final String TAG = "PushTargetManager";
private static PushTargetManager instance;
private PushTargetEnum mTarget = PushTargetEnum.JPUSH; //当前的推送平台
private BasePushTargetInit mPushTarget; //当前选择的推送方式
public static PushTargetManager getInstance() {
if (instance == null) {
synchronized (PushTargetManager.class) {
if (instance == null) {
instance = new PushTargetManager();
}
}
}
return instance;
}
/**
* 初始化
*
* @param context
*/
public PushTargetManager init(Application context) {
String mobile_brand = android.os.Build.MANUFACTURER;
mobile_brand = mobile_brand.toUpperCase();
//根据设备厂商选择推送平台
//小米的使用小米推送,华为使用华为推送...其他的使用极光推送
if (PushTargetEnum.XIAOMI.brand.equals(mobile_brand)) {
this.mTarget = PushTargetEnum.XIAOMI;
mPushTarget = new XiaomiInit(context);
} else if (PushTargetEnum.HUAWEI.brand.equals(mobile_brand)) {
this.mTarget = PushTargetEnum.HUAWEI;
mPushTarget = new HuaweiInit(context);
} else if (PushTargetEnum.OPPO.brand.equals(mobile_brand)) {
this.mTarget = PushTargetEnum.OPPO;
mPushTarget = new OppoInit(context);
} else if (PushTargetEnum.MEIZU.brand.equals(mobile_brand)) {
this.mTarget = PushTargetEnum.MEIZU;
mPushTarget = new MeizuInit(context);
} else {
this.mTarget = PushTargetEnum.JPUSH;
mPushTarget = new JPushInit(context);
}
PushReceiverHandleManager.getInstance().setPushTargetInit(mPushTarget);
return this;
}
/**
* 初始化华为推送
*
* @param activity
*/
@Deprecated
public void initHuaweiPush(Activity activity) {
if (getPushTarget() != PushTargetEnum.HUAWEI) {
return;
}
HMSAgent.connect(activity, new ConnectHandler() {
@Override
public void onConnect(int rst) {
if (rst == HMSAgent.AgentResultCode.HMSAGENT_SUCCESS) {
//连接成功就获取token和设置打开推送等
HMSAgent.Push.getPushState(null);
HMSAgent.Push.getToken(null);
}
}
});
}
/**
* 设置别名,华为不可用,需要通过@link HandleReceiverAlias 的 handle方法回调取得
*
* @param alias 别名
*/
public PushTargetManager setAliasNotWithHuawei(String alias) {
if (mPushTarget == null) {
throw new NullPointerException("请先执行init(),然后在设置别名");
}
PushReceiverHandleManager.getInstance().setAlias(alias);
return this;
}
/**
* 添加推送监听
*
* @param key
* @param listener
*/
public void addPushReceiverListener(String key, OnPushReceiverListener listener) {
PushReceiverHandleManager.getInstance().addPushReceiverListener(key, listener);
}
/**
* 移除一个推送监听
*
* @param key
*/
public void removePushReceiverListener(String key) {
PushReceiverHandleManager.getInstance().removePushReceiverListener(key);
}
/**
* 清空推送监听
*/
public void clearPushReceiverListener() {
PushReceiverHandleManager.getInstance().clearPushReceiverListener();
}
/**
* 获取当前选择的推送平台
*
* @return
*/
public PushTargetEnum getPushTarget() {
return this.mTarget;
}
public interface OnPushReceiverListener {
/**
* 注册成功回调
*
* @param info
*/
void onRegister(ReceiverInfo info);
/**
* 别名设置完成回调
*
* @param info
*/
void onAlias(ReceiverInfo info);
/**
* 收到穿透消息的回调
*
* @param info
*/
void onMessage(ReceiverInfo info);
/**
* 收到通知的回调
*
* @param info
*/
void onNotification(ReceiverInfo info);
/**
* 点击通知的回调
*
* @param info
*/
void onOpened(ReceiverInfo info);
}
}
| [
"luomingbear@163.com"
] | luomingbear@163.com |
9fb3e465fabeb9471d1fcd3ed79f59ff984d3cc1 | 3caacb461a6b1b7891952d1c62a79e5d2adce723 | /app/src/main/java/com/pinlinx/ui/activity/VideoGalleryActivity.java | 1a911416c5f126f457a4b8949471d809878d862f | [] | no_license | freelanceapp/Sport4Sport | b66bc65fc6a744d871c506a1d50f38b9ff92266f | a91ab834402f059e82fc21c5664714a66cf3faf3 | refs/heads/master | 2020-06-18T07:10:25.579094 | 2019-04-26T12:43:41 | 2019-04-26T12:43:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,763 | java | package com.pinlinx.ui.activity;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import java.util.ArrayList;
import com.pinlinx.R;
import com.pinlinx.adapter.VideoListAdapter;
import com.pinlinx.modal.VideoListModel;
import com.pinlinx.utils.BaseActivity;
public class VideoGalleryActivity extends BaseActivity implements View.OnClickListener {
private VideoListAdapter obj_adapter;
private ArrayList<VideoListModel> al_video = new ArrayList<>();
private RecyclerView recyclerView;
private RecyclerView.LayoutManager recyclerViewLayoutManager;
private static final int REQUEST_PERMISSIONS = 100;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_video_gallery);
mContext = this;
init();
}
private void init() {
recyclerView = (RecyclerView) findViewById(R.id.recycler_view1);
recyclerViewLayoutManager = new GridLayoutManager(getApplicationContext(), 3);
recyclerView.setLayoutManager(recyclerViewLayoutManager);
fn_checkpermission();
}
private void fn_checkpermission() {
/*RUN TIME PERMISSIONS*/
if ((ContextCompat.checkSelfPermission(getApplicationContext(),
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) && (ContextCompat.checkSelfPermission(getApplicationContext(),
Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)) {
if ((ActivityCompat.shouldShowRequestPermissionRationale(VideoGalleryActivity.this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)) && (ActivityCompat.shouldShowRequestPermissionRationale(VideoGalleryActivity.this,
Manifest.permission.READ_EXTERNAL_STORAGE))) {
} else {
ActivityCompat.requestPermissions(VideoGalleryActivity.this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE},
REQUEST_PERMISSIONS);
}
} else {
Log.e("Else", "Else");
fn_video();
}
}
public void fn_video() {
int int_position = 0;
Uri uri;
Cursor cursor;
int column_index_data, column_index_folder_name, column_id, thum;
String absolutePathOfImage = null;
uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
String[] projection = {MediaStore.MediaColumns.DATA, MediaStore.Video.Media.BUCKET_DISPLAY_NAME,
MediaStore.Video.Media._ID, MediaStore.Video.Thumbnails.DATA};
final String orderBy = MediaStore.Images.Media.DATE_TAKEN;
cursor = getApplicationContext().getContentResolver().query(uri, projection, null, null, orderBy + " DESC");
column_index_data = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
column_index_folder_name = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.BUCKET_DISPLAY_NAME);
column_id = cursor.getColumnIndexOrThrow(MediaStore.Video.Media._ID);
thum = cursor.getColumnIndexOrThrow(MediaStore.Video.Thumbnails.DATA);
while (cursor.moveToNext()) {
absolutePathOfImage = cursor.getString(column_index_data);
Log.e("Column", absolutePathOfImage);
Log.e("Folder", cursor.getString(column_index_folder_name));
Log.e("column_id", cursor.getString(column_id));
Log.e("thum", cursor.getString(thum));
VideoListModel obj_model = new VideoListModel();
obj_model.setBoolean_selected(false);
obj_model.setStr_path(absolutePathOfImage);
obj_model.setStr_thumb(cursor.getString(thum));
al_video.add(obj_model);
}
obj_adapter = new VideoListAdapter(getApplicationContext(), al_video, VideoGalleryActivity.this, this);
recyclerView.setAdapter(obj_adapter);
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case REQUEST_PERMISSIONS: {
for (int i = 0; i < grantResults.length; i++) {
if (grantResults.length > 0 && grantResults[i] == PackageManager.PERMISSION_GRANTED) {
fn_video();
} else {
Toast.makeText(VideoGalleryActivity.this, "The app was not allowed to read or write to your storage. Hence, it cannot function properly. Please consider granting it this permission", Toast.LENGTH_LONG).show();
}
}
}
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.rl_select:
int pos = Integer.parseInt(v.getTag().toString());
String strVideoPath = al_video.get(pos).getStr_path();
Intent intent_gallery = new Intent(mContext, VideoTrimerActivity.class);
intent_gallery.putExtra("video_path", strVideoPath);
startActivity(intent_gallery);
break;
}
}
}
| [
"amardeep.infobite@gmail.com"
] | amardeep.infobite@gmail.com |
5a99f522381e2c45753d315858a2d531e003b198 | cd587e9e1697279ab6414ee17fd02941f3cb3389 | /src/Appenmeier/kapitel56/Rental.java | 4c9489b1017e7b804a52e7445a9a06fba0c482b9 | [] | no_license | jonas181199/Semester2_Appenmaier_x_Schilling_x_Sonstiges | 0985e31e1ef9a5207c96d14605862608e3a2a958 | 55f87d422490c934a2f148aa5c9e21902d0a0a66 | refs/heads/main | 2023-05-02T23:45:44.624804 | 2021-05-11T20:08:16 | 2021-05-11T20:08:16 | 363,113,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package Appenmeier.kapitel56;
import java.util.ArrayList;
public class Rental implements Partner {
private String name;
ArrayList<Vehicle> vehicles = new ArrayList<>();
Vehicle vehicle;
// Truck truck1 = new Truck("MAN", "S500", Engine.DIESEL, 26);
// Truck truck2 = new Truck("MB", "St200", Engine.PETROL, 20);
public Rental(String name) {
this.name = name;
}
public void addVehicle(Vehicle vehicle) {
this.vehicles.add(vehicle);
}
public void transformAllTrucks() {
for (Vehicle v : vehicles) {
if (v instanceof Truck) { //downcast
if (((Truck) v).isTransformed()) {
System.out.println(v.getMake() + " " + v.getModel() + " sagt: I am already transformed bro!");
} else {
((Truck) v).transform(true);
}
}
}
}
public void print() {
System.out.println(this.name);
System.out.println();
System.out.println("Unsere Fahrzeuge:");
for (Vehicle v : vehicles) {
v.print(); // Vehicle print
}
}
}
| [
"jonasschirm@web.de"
] | jonasschirm@web.de |
99d168064b0303ebe38f497bd8baa0a14f3b8437 | 95606654de750ceb316f7cad3538498384879147 | /src/plugins/rongCloud/src/java/com/rong/models/QueryBlacklistUserResult.java | 522a46af145ae5e975ead3f5800026ddbe1c32c5 | [
"Apache-2.0"
] | permissive | Lucianhz/custom-openfire | 77c1df782b5bee0cb1951b11eec0c8e140922d22 | d81b587a481190cd35a7a797a3ad67e364fbab9b | refs/heads/master | 2020-03-08T14:25:52.499074 | 2018-04-05T08:20:34 | 2018-04-05T08:20:34 | 126,585,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package com.rong.models;
import com.rong.util.GsonUtil;
/**
* queryBlacklistUser返回结果
*/
public class QueryBlacklistUserResult {
// 返回码,200 为正常。
Integer code;
// 黑名单用户列表。
String[] users;
// 错误信息。
String errorMessage;
public QueryBlacklistUserResult(Integer code, String[] users, String errorMessage) {
this.code = code;
this.users = users;
this.errorMessage = errorMessage;
}
/**
* 设置code
*
*/
public void setCode(Integer code) {
this.code = code;
}
/**
* 获取code
*
* @return Integer
*/
public Integer getCode() {
return code;
}
/**
* 设置users
*
*/
public void setUsers(String[] users) {
this.users = users;
}
/**
* 获取users
*
* @return String[]
*/
public String[] getUsers() {
return users;
}
/**
* 设置errorMessage
*
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
/**
* 获取errorMessage
*
* @return String
*/
public String getErrorMessage() {
return errorMessage;
}
@Override
public String toString() {
return GsonUtil.toJson(this, QueryBlacklistUserResult.class);
}
}
| [
"luffy.ja@gmail.com"
] | luffy.ja@gmail.com |
85471a737d5b641436f5d0063102dd56bb6469da | a8953b81b258fa6d85dfa25a24b7fc82c4b1a6ad | /app/src/main/java/com/mango/bc/view/likeview/AnimHelper.java | caa37fd8e8e20f02fbafbf5f7d5fe8bab564e142 | [] | no_license | yangxinbin/bc | 39cbbb050365ee2f2661d68d2f6e299b8e26b919 | 1b0becf4bf6e6b3e7fb11ec0a254308b1e4d3b43 | refs/heads/master | 2021-07-23T09:41:51.467120 | 2018-12-15T15:56:17 | 2018-12-15T15:56:17 | 147,203,009 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,050 | java | package com.mango.bc.view.likeview;
import android.animation.Animator;
import android.view.View;
import android.view.animation.Interpolator;
import java.util.ArrayList;
import java.util.List;
/**
* Created by admin on 2018/9/17.
*/
public class AnimHelper {
private static final long DURATION = BaseViewAnimator.DURATION;
private static final long NO_DELAY = 0;
/**
*实例化得到AnimationComposer的唯一接口
*/
public static AnimationComposer with(BaseViewAnimator animator) {
return new AnimationComposer(animator);
}
/**
*定义与动画效果相关联的各种参数,
*使用这种方法可以保证对象的构建和他的表示相互隔离开来
*/
public static final class AnimationComposer {
private List<Animator.AnimatorListener> callbacks = new ArrayList<Animator.AnimatorListener>();
private BaseViewAnimator animator;
private long duration = DURATION;
private long delay = NO_DELAY;
private Interpolator interpolator;
private View target;
private AnimationComposer(BaseViewAnimator animator) {
this.animator = animator;
}
public AnimationComposer duration(long duration) {
this.duration = duration;
return this;
}
public AnimationComposer delay(long delay) {
this.delay = delay;
return this;
}
public AnimationComposer interpolate(Interpolator interpolator) {
this.interpolator = interpolator;
return this;
}
public AnimationComposer withListener(Animator.AnimatorListener listener) {
callbacks.add(listener);
return this;
}
public AnimManager playOn(View target) {
this.target = target;
return new AnimManager(play(), this.target);
}
private BaseViewAnimator play() {
animator.setTarget(target);
animator.setDuration(duration)
.setInterpolator(interpolator)
.setStartDelay(delay);
if (callbacks.size() > 0) {
for (Animator.AnimatorListener callback : callbacks) {
animator.addAnimatorListener(callback);
}
}
animator.animate();
return animator;
}
}
/**
*动画管理类
*/
public static final class AnimManager{
private BaseViewAnimator animator;
private View target;
private AnimManager(BaseViewAnimator animator, View target){
this.target = target;
this.animator = animator;
}
public boolean isStarted(){
return animator.isStarted();
}
public boolean isRunning(){
return animator.isRunning();
}
public void stop(boolean reset){
animator.cancel();
if(reset)
animator.reset(target);
}
}
} | [
"yangxinbin@hotmail.com"
] | yangxinbin@hotmail.com |
df25e9964ef08ad8b5e2d30e2b86e358368e3ffc | e5b2d06557740c72536b0b1526ddd78a59e6cd5b | /firstday/MaxSequence.java | 5624cfcc52b72e4fbe2c5d572bb917b506e64062 | [] | no_license | karthicksri002/Sample | c254f3a1f3b4091788a9f111da1155b744837945 | 6ebf47a8e482cf48e0d8bcc6986cea60daa9a899 | refs/heads/master | 2020-09-09T13:31:39.547162 | 2019-11-13T13:59:42 | 2019-11-13T13:59:42 | 221,459,235 | 0 | 0 | null | 2019-11-13T13:59:43 | 2019-11-13T12:54:55 | Java | UTF-8 | Java | false | false | 899 | java | package firstday;
import java.util.Scanner;
public class MaxSequence {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
//Taking rows value from the user
System.out.println("How many rows you want in this pattern?");
int rows = sc.nextInt();
System.out.println("Here is your pattern....!!!");
for (int i = 1; i <= rows; i++)
{
for (int j = 1; j <= i; j++)
{
System.out.print(" ");
}
for (int j = i; j <= rows; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
//Close the resources
sc.close();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
afb6e98b556638e25285d85a675b9a00e48ada1a | 56a3ac4587f486d9b64b3503339475cd75885d04 | /app/src/main/java/com/juborajsarker/agecalculator/activity/MainActivity.java | 8eb2333f2d713ea88bc98f427dc099b88c2fa57c | [] | no_license | Juboraj-Sarker/AgeCalculator | 673a51e3e4d6dfda9134856dd9ba8845968477e3 | 71a0cbd042e03d303fb3040f5ba47ddd478c53cd | refs/heads/master | 2021-01-20T08:31:56.166241 | 2018-01-09T14:13:13 | 2018-01-09T14:13:13 | 90,162,329 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,048 | java | package com.juborajsarker.agecalculator.activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.inputmethod.InputMethodManager;
import com.juborajsarker.agecalculator.R;
import com.juborajsarker.agecalculator.fragment.AgeCalculatorFragment;
import com.juborajsarker.agecalculator.fragment.TimePeriodFragment;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private Toolbar toolbar;
private TabLayout tabLayout;
private ViewPager viewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
viewPager = (ViewPager) findViewById(R.id.viewpager);
setupViewPager(viewPager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
private void setupViewPager(ViewPager viewPager) {
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
adapter.addFragment(new AgeCalculatorFragment(), "Age Calculator");
adapter.addFragment(new TimePeriodFragment(), "Time Period");
viewPager.setAdapter(adapter);
}
class ViewPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public ViewPagerAdapter(FragmentManager manager) {
super(manager);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFragment(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
InputMethodManager inputManager = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
AlertDialog.Builder builder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder = new AlertDialog.Builder(this, android.R.style.Theme_Material_Light_Dialog);
} else {
builder = new AlertDialog.Builder(this);
}
builder.setTitle("Thanks for using my app")
.setMessage("\nAre you sure you want to really exit?")
.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
AppExit();
}
})
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
})
.show();
default:
return super.onOptionsItemSelected(item);
}
}
public void AppExit() {
this.finish();
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
/*int pid = android.os.Process.myPid();=====> use this if you want to kill your activity. But its not a good one to do.
android.os.Process.killProcess(pid);*/
}
public void rateApp(MenuItem item) {
rateApps();
}
public void shareApp(MenuItem item) {
ApplicationInfo app = getApplicationContext().getApplicationInfo();
String filePath = app.sourceDir;
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("*/*");
intent.createChooser(intent,"Age Calculator");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(filePath)));
startActivity(Intent.createChooser(intent, "share Age Calculator using"));
}
public void moreApps(MenuItem item) {
Intent intent;
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/dev?id=6155570899607409709&hl"));
startActivity(intent);
}
public void goToAboutActivity(MenuItem item) {
startActivity(new Intent(MainActivity.this, AboutActivity.class));
}
public void rateApps() {
try
{
Intent rateIntent = rateIntentForUrl("market://details");
startActivity(rateIntent);
}
catch (ActivityNotFoundException e)
{
Intent rateIntent = rateIntentForUrl("https://play.google.com/store/apps/details");
startActivity(rateIntent);
}
}
private Intent rateIntentForUrl(String url)
{
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("%s?id=%s", url, getPackageName())));
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
if (Build.VERSION.SDK_INT >= 21)
{
flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
}
else
{
flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
}
intent.addFlags(flags);
return intent;
}
}
| [
"juborajsarker001@gmail.com"
] | juborajsarker001@gmail.com |
4b212221af0f46fb71c02f217c795478ddc3d036 | a5f1da80efdc5ae8dfda2e18af2a1042e2ff9234 | /src/com/cyb/xml/bean/Student.java | 8228529acf4e95cbc3dd57a4b7b49403f29e37ac | [] | no_license | iechenyb/sina1.0 | fb2b7b9247c7f6504e10d8301ee581a3b960bac2 | aac363143e920a418f0cc3a8e3cadcb91cdb3acf | refs/heads/master | 2021-05-23T04:47:39.852726 | 2020-05-15T00:32:27 | 2020-05-15T00:32:27 | 81,402,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,724 | java | package com.cyb.xml.bean;
/**
*作者 : iechenyb<br>
*类描述: 说点啥<br>
*创建时间: 2018年3月19日
*/
import java.util.Date;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
@XmlRootElement
public class Student {
@XmlElement(name="myname") // 如果
//@XmlElement
private String name;
@XmlElement
private int age;
@XmlElement
private Date birthday;
@XmlElement
private Role role;
@XmlAttribute
private Integer id;
@XmlTransient
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlTransient
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@XmlTransient
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
@XmlTransient
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
@XmlTransient
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Override
public String toString() {
return "Student [name=" + name + ", age=" + age + ", birthday=" + birthday + ", role=" + role + ", id=" + id + "]";
}
}
| [
"zzuchenyb@sina.com"
] | zzuchenyb@sina.com |
c6a454866b20bf12a11c7d89c8726ca1dfe1cec3 | 211bac45cfe4492e92db63f8c68012f6571f849b | /AmoebaEngine/src/org/amoeba/graphics/utilities/BufferUtilities.java | ac9a6d5109cad6b9911532863448c154fac1061e | [] | no_license | jsantangelo/amoeba-engine | a3d6cbe423cd2a3b821f22cd0a17a38f7a5bc31a | 036d382c96f568e17a1a8844e8efe25387f9c203 | refs/heads/master | 2016-09-05T09:26:22.712712 | 2014-01-18T23:17:10 | 2014-01-18T23:17:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | package org.amoeba.graphics.utilities;
import java.nio.Buffer;
import org.amoeba.graphics.vbo.VertexBufferObjectAttribute;
/**
* BufferUtilities contains OpenGL functions for VBOs.
*/
public interface BufferUtilities
{
/**
* Bind a Vertex Buffer Attribute in OpenGL.
* @param attribute The attribute to be bound.
* @param buffer The buffer containing the data.
* @param stride The stride bytes for the buffer.
*/
public void bindVertexAttribute(final VertexBufferObjectAttribute attribute, final Buffer buffer, final int stride);
/**
* Render primitives from the stored data.
* @param mode The kind of primitives to render.
* @param offset The offset to the data to be rendered.
* @param count The number of vertices to be rendered.
*/
public void drawVertexBuffer(final int mode, final int offset, final int count);
}
| [
"mrtesten@gmail.com"
] | mrtesten@gmail.com |
cfd30931cef0c8fda7d8c2f75315bca74e7e5c69 | 56ae790ef1b0a65643a5e8c7e14a6f5d2e88cbdd | /spedfiscal/src/main/java/com/t2tierp/model/bean/cadastros/Colaborador.java | 4343f69490def49d2e57c2639aebf4cc58b48cd3 | [
"MIT"
] | permissive | herculeshssj/T2Ti-ERP-2.0-Java-WEB | 6751db19b82954116f855fe107c4ac188524d7d5 | 275205e05a0522a2ba9c36d36ba577230e083e72 | refs/heads/master | 2023-01-04T21:06:24.175662 | 2020-10-30T11:00:46 | 2020-10-30T11:00:46 | 286,570,333 | 0 | 0 | null | 2020-08-10T20:16:56 | 2020-08-10T20:16:56 | null | UTF-8 | Java | false | false | 15,401 | java | /*
* The MIT License
*
* Copyright: Copyright (C) 2014 T2Ti.COM
*
* 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.
*
* The author may be contacted at: t2ti.com@gmail.com
*
* @author Claudio de Barros (T2Ti.com)
* @version 2.0
*/
package com.t2tierp.model.bean.cadastros;
import com.t2tierp.model.bean.contabilidade.ContabilConta;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name = "COLABORADOR")
public class Colaborador implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID")
private Integer id;
@Column(name = "MATRICULA")
private String matricula;
@Column(name = "FOTO_34")
private String foto34;
@Temporal(TemporalType.DATE)
@Column(name = "DATA_CADASTRO")
private Date dataCadastro;
@Temporal(TemporalType.DATE)
@Column(name = "DATA_ADMISSAO")
private Date dataAdmissao;
@Temporal(TemporalType.DATE)
@Column(name = "VENCIMENTO_FERIAS")
private Date vencimentoFerias;
@Temporal(TemporalType.DATE)
@Column(name = "DATA_TRANSFERENCIA")
private Date dataTransferencia;
@Column(name = "FGTS_OPTANTE")
private String fgtsOptante;
@Temporal(TemporalType.DATE)
@Column(name = "FGTS_DATA_OPCAO")
private Date fgtsDataOpcao;
@Column(name = "FGTS_CONTA")
private Integer fgtsConta;
@Column(name = "PAGAMENTO_FORMA")
private String pagamentoForma;
@Column(name = "PAGAMENTO_BANCO")
private String pagamentoBanco;
@Column(name = "PAGAMENTO_AGENCIA")
private String pagamentoAgencia;
@Column(name = "PAGAMENTO_AGENCIA_DIGITO")
private String pagamentoAgenciaDigito;
@Column(name = "PAGAMENTO_CONTA")
private String pagamentoConta;
@Column(name = "PAGAMENTO_CONTA_DIGITO")
private String pagamentoContaDigito;
@Temporal(TemporalType.DATE)
@Column(name = "EXAME_MEDICO_ULTIMO")
private Date exameMedicoUltimo;
@Temporal(TemporalType.DATE)
@Column(name = "EXAME_MEDICO_VENCIMENTO")
private Date exameMedicoVencimento;
@Temporal(TemporalType.DATE)
@Column(name = "PIS_DATA_CADASTRO")
private Date pisDataCadastro;
@Column(name = "PIS_NUMERO")
private String pisNumero;
@Column(name = "PIS_BANCO")
private String pisBanco;
@Column(name = "PIS_AGENCIA")
private String pisAgencia;
@Column(name = "PIS_AGENCIA_DIGITO")
private String pisAgenciaDigito;
@Column(name = "CTPS_NUMERO")
private String ctpsNumero;
@Column(name = "CTPS_SERIE")
private String ctpsSerie;
@Temporal(TemporalType.DATE)
@Column(name = "CTPS_DATA_EXPEDICAO")
private Date ctpsDataExpedicao;
@Column(name = "CTPS_UF")
private String ctpsUf;
@Column(name = "DESCONTO_PLANO_SAUDE")
private String descontoPlanoSaude;
@Column(name = "SAI_NA_RAIS")
private String saiNaRais;
@Column(name = "CATEGORIA_SEFIP")
private String categoriaSefip;
@Column(name = "OBSERVACAO")
private String observacao;
@Column(name = "OCORRENCIA_SEFIP")
private Integer ocorrenciaSefip;
@Column(name = "CODIGO_ADMISSAO_CAGED")
private Integer codigoAdmissaoCaged;
@Column(name = "CODIGO_DEMISSAO_CAGED")
private Integer codigoDemissaoCaged;
@Column(name = "CODIGO_DEMISSAO_SEFIP")
private Integer codigoDemissaoSefip;
@Temporal(TemporalType.DATE)
@Column(name = "DATA_DEMISSAO")
private Date dataDemissao;
@Column(name = "CODIGO_TURMA_PONTO")
private String codigoTurmaPonto;
@Column(name = "CAGED_APRENDIZ")
private String cagedAprendiz;
@Column(name = "CAGED_DEFICIENCIA")
private String cagedDeficiencia;
@JoinColumn(name = "ID_SETOR", referencedColumnName = "ID")
@ManyToOne(optional = false)
private Setor setor;
@JoinColumn(name = "ID_CARGO", referencedColumnName = "ID")
@ManyToOne(optional = false)
private Cargo cargo;
@JoinColumn(name = "ID_TIPO_COLABORADOR", referencedColumnName = "ID")
@ManyToOne(optional = false)
private TipoColaborador tipoColaborador;
@JoinColumn(name = "ID_NIVEL_FORMACAO", referencedColumnName = "ID")
@ManyToOne(optional = false)
private NivelFormacao nivelFormacao;
@JoinColumn(name = "ID_PESSOA", referencedColumnName = "ID")
@ManyToOne(optional = false)
private Pessoa pessoa;
@JoinColumn(name = "ID_SITUACAO_COLABORADOR", referencedColumnName = "ID")
@ManyToOne(optional = false)
private SituacaoColaborador situacaoColaborador;
@JoinColumn(name = "ID_TIPO_ADMISSAO", referencedColumnName = "ID")
@ManyToOne
private TipoAdmissao tipoAdmissao;
@JoinColumn(name = "ID_SINDICATO", referencedColumnName = "ID")
@ManyToOne
private Sindicato sindicato;
@JoinColumn(name = "ID_CONTABIL_CONTA", referencedColumnName = "ID")
@ManyToOne
private ContabilConta contabilConta;
public Colaborador() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getMatricula() {
return matricula;
}
public void setMatricula(String matricula) {
this.matricula = matricula;
}
public String getFoto34() {
return foto34;
}
public void setFoto34(String foto34) {
this.foto34 = foto34;
}
public Date getDataCadastro() {
return dataCadastro;
}
public void setDataCadastro(Date dataCadastro) {
this.dataCadastro = dataCadastro;
}
public Date getDataAdmissao() {
return dataAdmissao;
}
public void setDataAdmissao(Date dataAdmissao) {
this.dataAdmissao = dataAdmissao;
}
public Date getVencimentoFerias() {
return vencimentoFerias;
}
public void setVencimentoFerias(Date vencimentoFerias) {
this.vencimentoFerias = vencimentoFerias;
}
public Date getDataTransferencia() {
return dataTransferencia;
}
public void setDataTransferencia(Date dataTransferencia) {
this.dataTransferencia = dataTransferencia;
}
public String getFgtsOptante() {
return fgtsOptante;
}
public void setFgtsOptante(String fgtsOptante) {
this.fgtsOptante = fgtsOptante;
}
public Date getFgtsDataOpcao() {
return fgtsDataOpcao;
}
public void setFgtsDataOpcao(Date fgtsDataOpcao) {
this.fgtsDataOpcao = fgtsDataOpcao;
}
public Integer getFgtsConta() {
return fgtsConta;
}
public void setFgtsConta(Integer fgtsConta) {
this.fgtsConta = fgtsConta;
}
public String getPagamentoForma() {
return pagamentoForma;
}
public void setPagamentoForma(String pagamentoForma) {
this.pagamentoForma = pagamentoForma;
}
public String getPagamentoBanco() {
return pagamentoBanco;
}
public void setPagamentoBanco(String pagamentoBanco) {
this.pagamentoBanco = pagamentoBanco;
}
public String getPagamentoAgencia() {
return pagamentoAgencia;
}
public void setPagamentoAgencia(String pagamentoAgencia) {
this.pagamentoAgencia = pagamentoAgencia;
}
public String getPagamentoAgenciaDigito() {
return pagamentoAgenciaDigito;
}
public void setPagamentoAgenciaDigito(String pagamentoAgenciaDigito) {
this.pagamentoAgenciaDigito = pagamentoAgenciaDigito;
}
public String getPagamentoConta() {
return pagamentoConta;
}
public void setPagamentoConta(String pagamentoConta) {
this.pagamentoConta = pagamentoConta;
}
public String getPagamentoContaDigito() {
return pagamentoContaDigito;
}
public void setPagamentoContaDigito(String pagamentoContaDigito) {
this.pagamentoContaDigito = pagamentoContaDigito;
}
public Date getExameMedicoUltimo() {
return exameMedicoUltimo;
}
public void setExameMedicoUltimo(Date exameMedicoUltimo) {
this.exameMedicoUltimo = exameMedicoUltimo;
}
public Date getExameMedicoVencimento() {
return exameMedicoVencimento;
}
public void setExameMedicoVencimento(Date exameMedicoVencimento) {
this.exameMedicoVencimento = exameMedicoVencimento;
}
public Date getPisDataCadastro() {
return pisDataCadastro;
}
public void setPisDataCadastro(Date pisDataCadastro) {
this.pisDataCadastro = pisDataCadastro;
}
public String getPisNumero() {
return pisNumero;
}
public void setPisNumero(String pisNumero) {
this.pisNumero = pisNumero;
}
public String getPisBanco() {
return pisBanco;
}
public void setPisBanco(String pisBanco) {
this.pisBanco = pisBanco;
}
public String getPisAgencia() {
return pisAgencia;
}
public void setPisAgencia(String pisAgencia) {
this.pisAgencia = pisAgencia;
}
public String getPisAgenciaDigito() {
return pisAgenciaDigito;
}
public void setPisAgenciaDigito(String pisAgenciaDigito) {
this.pisAgenciaDigito = pisAgenciaDigito;
}
public String getCtpsNumero() {
return ctpsNumero;
}
public void setCtpsNumero(String ctpsNumero) {
this.ctpsNumero = ctpsNumero;
}
public String getCtpsSerie() {
return ctpsSerie;
}
public void setCtpsSerie(String ctpsSerie) {
this.ctpsSerie = ctpsSerie;
}
public Date getCtpsDataExpedicao() {
return ctpsDataExpedicao;
}
public void setCtpsDataExpedicao(Date ctpsDataExpedicao) {
this.ctpsDataExpedicao = ctpsDataExpedicao;
}
public String getCtpsUf() {
return ctpsUf;
}
public void setCtpsUf(String ctpsUf) {
this.ctpsUf = ctpsUf;
}
public String getDescontoPlanoSaude() {
return descontoPlanoSaude;
}
public void setDescontoPlanoSaude(String descontoPlanoSaude) {
this.descontoPlanoSaude = descontoPlanoSaude;
}
public String getSaiNaRais() {
return saiNaRais;
}
public void setSaiNaRais(String saiNaRais) {
this.saiNaRais = saiNaRais;
}
public String getCategoriaSefip() {
return categoriaSefip;
}
public void setCategoriaSefip(String categoriaSefip) {
this.categoriaSefip = categoriaSefip;
}
public String getObservacao() {
return observacao;
}
public void setObservacao(String observacao) {
this.observacao = observacao;
}
public Integer getOcorrenciaSefip() {
return ocorrenciaSefip;
}
public void setOcorrenciaSefip(Integer ocorrenciaSefip) {
this.ocorrenciaSefip = ocorrenciaSefip;
}
public Integer getCodigoAdmissaoCaged() {
return codigoAdmissaoCaged;
}
public void setCodigoAdmissaoCaged(Integer codigoAdmissaoCaged) {
this.codigoAdmissaoCaged = codigoAdmissaoCaged;
}
public Integer getCodigoDemissaoCaged() {
return codigoDemissaoCaged;
}
public void setCodigoDemissaoCaged(Integer codigoDemissaoCaged) {
this.codigoDemissaoCaged = codigoDemissaoCaged;
}
public Integer getCodigoDemissaoSefip() {
return codigoDemissaoSefip;
}
public void setCodigoDemissaoSefip(Integer codigoDemissaoSefip) {
this.codigoDemissaoSefip = codigoDemissaoSefip;
}
public Date getDataDemissao() {
return dataDemissao;
}
public void setDataDemissao(Date dataDemissao) {
this.dataDemissao = dataDemissao;
}
public String getCodigoTurmaPonto() {
return codigoTurmaPonto;
}
public void setCodigoTurmaPonto(String codigoTurmaPonto) {
this.codigoTurmaPonto = codigoTurmaPonto;
}
public String getCagedAprendiz() {
return cagedAprendiz;
}
public void setCagedAprendiz(String cagedAprendiz) {
this.cagedAprendiz = cagedAprendiz;
}
public String getCagedDeficiencia() {
return cagedDeficiencia;
}
public void setCagedDeficiencia(String cagedDeficiencia) {
this.cagedDeficiencia = cagedDeficiencia;
}
public Setor getSetor() {
return setor;
}
public void setSetor(Setor setor) {
this.setor = setor;
}
public Cargo getCargo() {
return cargo;
}
public void setCargo(Cargo cargo) {
this.cargo = cargo;
}
public TipoColaborador getTipoColaborador() {
return tipoColaborador;
}
public void setTipoColaborador(TipoColaborador tipoColaborador) {
this.tipoColaborador = tipoColaborador;
}
public NivelFormacao getNivelFormacao() {
return nivelFormacao;
}
public void setNivelFormacao(NivelFormacao nivelFormacao) {
this.nivelFormacao = nivelFormacao;
}
public Pessoa getPessoa() {
return pessoa;
}
public void setPessoa(Pessoa pessoa) {
this.pessoa = pessoa;
}
public SituacaoColaborador getSituacaoColaborador() {
return situacaoColaborador;
}
public void setSituacaoColaborador(SituacaoColaborador situacaoColaborador) {
this.situacaoColaborador = situacaoColaborador;
}
public TipoAdmissao getTipoAdmissao() {
return tipoAdmissao;
}
public void setTipoAdmissao(TipoAdmissao tipoAdmissao) {
this.tipoAdmissao = tipoAdmissao;
}
public Sindicato getSindicato() {
return sindicato;
}
public void setSindicato(Sindicato sindicato) {
this.sindicato = sindicato;
}
public ContabilConta getContabilConta() {
return contabilConta;
}
public void setContabilConta(ContabilConta contabilConta) {
this.contabilConta = contabilConta;
}
@Override
public String toString() {
return "com.t2tierp.model.bean.cadastros.Colaborador[id=" + id + "]";
}
}
| [
"claudiobsi@gmail.com"
] | claudiobsi@gmail.com |
e8e4a3f65932190e22c0eacd26b9834a958ef3bb | 2d7bb6920ca1d1b0d6c448e09c15f71764a2b032 | /src/main/java/com/kevin/service/CommentService.java | 68bde3a45baca730d5a29679c5a528408a497e70 | [] | no_license | shikaiwen/jobspider | 7492bd017a5f717466f35c704ac8045635050bce | f50fa3fc5f938c0047d9a0707e2eb2d1088d6d2a | refs/heads/master | 2021-01-21T06:19:22.312744 | 2017-03-23T09:46:53 | 2017-03-23T09:46:53 | 83,213,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,995 | java | package com.kevin.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.serializer.ValueFilter;
import com.kevin.constant.Const;
import com.kevin.db.MongoConnector;
import com.kevin.entity.CsdnComment;
import com.kevin.utils.BeanUtils;
import com.mongodb.Block;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.model.Filters;
import com.mongodb.client.result.DeleteResult;
import org.apache.commons.collections.CollectionUtils;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.bson.types.ObjectId;
import org.jsoup.Jsoup;
import javax.print.Doc;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by kaiwen on 10/03/2017.
*/
public class CommentService {
static ArticleService articleService = ServiceFactory.getService(ArticleService.class);
/**
* 根据文章去获取评论
* csdn会返回所有的评论
* http://blog.csdn.net/huanghm88/comment/list/3965218?page=1
* 通过测试发现url中的用户名对返回结果没影响(只要用户存在即可),也就是说csdn其实是根据articleId去获取评论的
*/
public List<CsdnComment> getCommentListByArticleId(Integer articleId){
String commentUrl = "http://blog.csdn.net/shikaiwencn/comment/list/"+articleId+"?page=1";
List <CsdnComment> comments = new ArrayList<>();
try {
String body = Jsoup.connect(commentUrl)
.header("User-Agent","zeneyang")
.ignoreContentType(true)
.execute().body();
JSONObject parse = (JSONObject) JSON.parse(body);
if (parse == null) {
return comments;
}
List<Map> commentList = (List<Map>)parse.get("list");
Type type = new TypeReference<List<CsdnComment>>(){}.getType();
comments = JSON.parseObject(JSON.toJSONString(commentList), type);
} catch (IOException e) {
e.printStackTrace();
}
return comments == null ? new ArrayList <>() : comments;
}
/**
* 查询用来获取用户名的评论
* authorExtracted=0的记录
*/
public List<CsdnComment> getCommentToExtractUser(int count){
List <CsdnComment> commentList = new ArrayList <>();
MongoCollection<Document> commentCols = MongoConnector.getCommentCols();
org.bson.Document bson = new org.bson.Document();
int startVersion = 0;
Document sortDoc = new Document();
//升序
sortDoc.put("version", 1);
FindIterable<Document> documents = commentCols.find(bson).sort(sortDoc).limit(count);
if(documents.iterator().hasNext()) {
documents.forEach((Block <? super Document>) (doc) -> {
CsdnComment c = new CsdnComment();
String s = JSON.toJSONString(doc, new ValueFilter() {
@Override
public Object process(Object object, String name, Object value) {
if ("_id".equals(name) && value instanceof ObjectId) {
return value.toString();
}
return value;
}
});
CsdnComment csdnComment = JSON.parseObject(s, CsdnComment.class);
commentList.add(csdnComment);
});
}
if (CollectionUtils.isNotEmpty(commentList)) {
upgradeVersion(commentList,CsdnComment.class);
}
return commentList;
}
/**
* 通用更新版本号
* @param objectList
* @param objType
*/
public void upgradeVersion(List objectList,Class objType){
if (CsdnComment.class.equals(objType)) {
List <org.bson.Document> documentList = new ArrayList <>();
List idList = new ArrayList();
objectList.forEach((obj)->{
CsdnComment comment = (CsdnComment)obj;
// comment.setVersion(comment.getVersion() + 1);
// org.bson.Document doc = new org.bson.Document();
// doc.putAll(BeanUtils.copyPropertiesToMap(comment));
// documentList.add(doc);
idList.add(new ObjectId(comment.get_id()));
});
MongoCollection <org.bson.Document> commentCols = MongoConnector.getCommentCols();
// QueryBuilder builder = new QueryBuilder();
Bson query = Filters.in("_id", idList);
// org.bson.Document queryDoc = new org.bson.Document();
org.bson.Document updateDoc = new org.bson.Document();
updateDoc.put("$inc",new org.bson.Document("version", 1));
commentCols.updateMany(query, updateDoc);
}
}
/**
* 根据文章删除评论
* @param articleId
* @return
*/
public boolean deleteCommentByArticle(Integer articleId){
MongoCollection <Document> commentCols = MongoConnector.getCommentCols();
DeleteResult deleteResult = commentCols.deleteMany(new Document("ArticleId", articleId));
return deleteResult.wasAcknowledged();
}
/**
* save comments to db
* @param articleList
*/
public void saveComment(List <CsdnComment> commentList) {
MongoCollection <org.bson.Document> collection = MongoConnector.getCommentCols();
List <org.bson.Document> docList = new ArrayList <>();
commentList.forEach((comment)->{
org.bson.Document doc = new org.bson.Document();
Map stringObjectMap = BeanUtils.copyPropertiesToMap(comment, Const.DB_ID);
doc.putAll(stringObjectMap);
docList.add(doc);
});
collection.insertMany(docList);
}
}
| [
"googlevsbing@126.com"
] | googlevsbing@126.com |
38fb050854a8ec926af95c3ab46ad913872eb080 | 02c8768cfb145141ebd5df9793b5788d138cccfd | /src/main/java/com/emanuel/cursocm/services/exceptions/AuthorizationException.java | d8c1aa7e9a81e18c56eef4c93e88b975263e7df5 | [] | no_license | emanuelqa/cursocm | 72e34c3b647dcf3e198051f888dc08dac86633bb | 8ebdd9b901f476ac590700537da4333b7890c5fd | refs/heads/master | 2021-06-08T11:49:57.765407 | 2020-07-29T01:09:05 | 2020-07-29T01:09:05 | 162,211,986 | 0 | 0 | null | 2021-04-26T20:32:11 | 2018-12-18T01:23:44 | Java | UTF-8 | Java | false | false | 318 | java | package com.emanuel.cursocm.services.exceptions;
public class AuthorizationException extends RuntimeException{
private static final long serialVersionUID = 1L;
public AuthorizationException(String msg) {
super(msg);
}
public AuthorizationException(String msg, Throwable cause) {
super(msg, cause);
}
}
| [
"emanuel.qa@gmail.com"
] | emanuel.qa@gmail.com |
ad4844c0b94aed873fb6c7b2174e76aa20ef4b01 | 25676e5f2918e1beee60bf2a662f2df01cb94002 | /src/HomeWork/greatestComDiv.java | a5e679effa9ca9c0779c638a7ccef781bb404e34 | [] | no_license | Piumal1999/JavaClass | eef1f8287b1a5a9c21673dd36e9934968b286b90 | 224cf9d5ce023480737873716800555f88c5f3db | refs/heads/master | 2020-07-15T06:13:03.777875 | 2019-10-06T03:59:34 | 2019-10-06T03:59:34 | 205,497,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,431 | java | package HomeWork;
import java.util.*;
public class greatestComDiv {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("***Greatest Common Divider Finder***");
System.out.println("------------------------------------\n");
System.out.print("Enter first Number: ");
int n1 = input.nextInt();
System.out.print("Enter second Number: ");
int n2 = input.nextInt();
int GCD = 1;
for (int i = 1; i <= 100; i++) {
if (n1 > n2) {
if (n1 % n2 == 0) {
GCD = n2;
break;
}
int rem = n1 % n2;
n1 = n2;
n2 = rem;
} else if (n2 > n1) {
if (n2 % n1 == 0) {
GCD = n1;
break;
}
int rem = n2 % n1;
n2 = n1;
n1 = rem;
}
}
System.out.println("The Greatest Common Divider of " + n1 + " and " + n2 + " is: " + GCD);
}
public static void GCD() {
Scanner input = new Scanner(System.in);
System.out.println("***Greatest Common Divider Finder***");
System.out.println("-----------------------------------\n");
System.out.print("Enter first Number: ");
int n1 = input.nextInt();
System.out.print("Enter second Number: ");
int n2 = input.nextInt();
int GCD = 0;
if(n1>n2){
for (int i=1; i<=n2; i++){
if(n1%i==0 && n2%i==0){
GCD = i;
}
}
}else{
for (int i=1; i<=n1; i++){
if(n1%i==0 && n2%i==0){
GCD = i;
}
}
}
}
// public static void nextPrime(){
// int n=10;
// for (int i = n; i<=1000 ; i++){
// int factors = 0;
// for (int r=1; r<=i; r++){
// if (i%r==0){
// factors +=1;
// if (factors==3){
// break;
// }
// }
// }
// if(factors==2){
// System.out.println(i);
// n = i;
// break;
// }
//
// }
// System.out.println(n);
// }
}
| [
"piumalrathnayake@hotmail.com"
] | piumalrathnayake@hotmail.com |
d383c27c534aabd7056ce8498cec9b7fc779cbdc | 906f13d0342e412dd4698d6d584c902e88be0c0f | /app/src/main/java/com/dekhke/app/fragments/FragmentDummy.java | ad561979de9d7db54852e788e813bcb50d13c925 | [] | no_license | aenky23/dekhkeProject | cc7a2a809c37514e429598349656318228f15503 | 4df47fa99d893a92e202aea6d17519981c0f2046 | refs/heads/master | 2021-01-10T14:50:13.660373 | 2015-10-15T15:32:29 | 2015-10-15T15:32:29 | 44,326,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,273 | java | package com.dekhke.app.fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import materialtest.vivz.slidenerd.materialtest.R;
import com.dekhke.app.network.VolleySingleton;
/**
* Created by Windows on 23-01-2015.
*/
public class FragmentDummy extends Fragment {
private TextView textView;
public static FragmentDummy getInstance(int position) {
FragmentDummy fragmentDummy = new FragmentDummy();
Bundle args = new Bundle();
args.putInt("position", position);
fragmentDummy.setArguments(args);
return fragmentDummy;
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_my, container, false);
textView = (TextView) layout.findViewById(R.id.position);
Bundle bundle = getArguments();
if (bundle != null) {
textView.setText("The Page Selected Is " + bundle.getInt("position"));
}
return layout;
}
/*
Havent called this method anywhere
*/
private void demoNetworkCallWithVolley() {
RequestQueue requestQueue = VolleySingleton.getInstance().getRequestQueue();
StringRequest request = new StringRequest(Request.Method.GET, "http://php.net/", new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(getActivity(), "RESPONSE " + response, Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getActivity(), "ERROR " + error.getMessage(), Toast.LENGTH_SHORT).show();
}
});
requestQueue.add(request);
}
} | [
"aenky23@gmail.com"
] | aenky23@gmail.com |
f0fab9b63fae90bcf5987c195e27be6048a306e3 | e7814e077f2042443c50ee663bc99cfec78a580c | /app/src/main/java/com/bwie/luchengju20190308exam/di/model/ShoppingCartModelImpl.java | bceafea221419222fbb2c30f81ac3a4b5772c432 | [] | no_license | Boyerrc/MyApplication | 5f3496be01c690fde71152c8b4d1d8e22d994af9 | 0627f3302dbc32b3e891e48a73142f547c86a0e0 | refs/heads/master | 2020-04-27T16:46:20.895696 | 2019-03-08T07:50:13 | 2019-03-08T07:50:13 | 174,492,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package com.bwie.luchengju20190308exam.di.model;
import com.bwie.luchengju20190308exam.data.content.Constant;
import com.bwie.luchengju20190308exam.di.contract.IContract;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
public class ShoppingCartModelImpl implements IContract.ShoppingCartModel {
@Override
public void containData(final CallBack callBack) {
OkGo.<String>get(Constant.SHOPPING_URL).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
String resposneData = response.body().toString();
//回传给P层
callBack.CallBack(resposneData);
}
});
}
}
| [
"3087436811@qq.com"
] | 3087436811@qq.com |
1f58e07d1309070ebbe5e27adcd4219c972c7088 | 09540f6066c431b2774f6bcd56a3c4be6310ec8e | /util/modifier/ease/EaseStrongOut.java | 829aef189d92fd103cef50ced09a41bf2eb0c416 | [] | no_license | jamesburton/AndEngine.net | 642a0dbc9549dd4f17997b141b76f62ffa5fbb69 | e99d81dc5a728e575d3dcbde72cf61baf40caaf4 | refs/heads/master | 2020-12-24T16:49:29.742637 | 2011-04-26T12:02:31 | 2011-04-26T12:02:31 | 1,478,307 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,730 | java | package org.anddev.andengine.util.modifier.ease;
/**
* @author Gil, Nicolas Gramlich
* @since 16:52:11 - 26.07.2010
*/
public class EaseStrongOut : IEaseFunction {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private static EaseStrongOut INSTANCE;
// ===========================================================
// Constructors
// ===========================================================
private EaseStrongOut() {
}
public static EaseStrongOut getInstance() {
if(INSTANCE == null) {
INSTANCE = new EaseStrongOut();
}
return INSTANCE;
}
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public float getPercentageDone(float pSecondsElapsed, final float pDuration, final float pMinValue, final float pMaxValue) {
return pMaxValue * ((pSecondsElapsed = pSecondsElapsed / pDuration - 1) * pSecondsElapsed * pSecondsElapsed * pSecondsElapsed * pSecondsElapsed + 1) + pMinValue;
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
| [
"james@code-consultants.co.uk"
] | james@code-consultants.co.uk |
bcec6a2e6ea01fc792518e1c3b2bc74618a1c9c2 | 957f8a45d7caa36904cdcf92d94de721465d214a | /Lab2/Conversion/mm_cpp2java_cleaned/src/mastermind/package-info.java | be2a832bffdb2e2822547e380fcd889d69b7af21 | [] | no_license | csimon1/LOG530 | 82d78769b8e0b87a6c0a2775c3bb3fb63cefe5f8 | 53a7dcb485b6118fe43c9189a68d2df51dae83a5 | refs/heads/master | 2021-01-10T13:16:44.396090 | 2015-08-12T18:28:37 | 2015-08-12T18:28:37 | 36,089,946 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 68 | java | /**
*
*/
/**
* @author AJ98150
*
*/
package mastermind; | [
"lightaisme@gmail.com"
] | lightaisme@gmail.com |
97398d557cec115b40e4628206532a9e4a45141a | 440e5bff3d6aaed4b07eca7f88f41dd496911c6b | /myapplication/src/main/java/com/vlocker/locker/c/ap.java | 87e9e08d7d4fb0191ceb2e2340f426e54d3b824f | [] | no_license | freemanZYQ/GoogleRankingHook | 4d4968cf6b2a6c79335b3ba41c1c9b80e964ddd3 | bf9affd70913127f4cd0f374620487b7e39b20bc | refs/heads/master | 2021-04-29T06:55:00.833701 | 2018-01-05T06:14:34 | 2018-01-05T06:14:34 | 77,991,340 | 7 | 5 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | package com.vlocker.locker.c;
import com.vlocker.ui.cover.r;
import java.util.List;
class ap implements r {
final /* synthetic */ ao a;
ap(ao aoVar) {
this.a = aoVar;
}
public void a() {
}
public void a(List list) {
if (list != null) {
this.a.a(list);
}
}
public void b() {
}
public void b(List list) {
}
}
| [
"zhengyuqin@youmi.net"
] | zhengyuqin@youmi.net |
21e15e507211ef086ca50c70122f87c0849dbf8d | cdc8813290b037ac5c2089b45542a545274be71a | /src/dsa/dp/ShortestCommonSupersequence.java | 649d3e87ad8d0f25d2216a5700ce348dd47db8a7 | [] | no_license | akashsinha13/DSA | 8549b2ffec56139c4a76fb5e9f6c24ebe8c1db63 | abb9cae1b590e0eb29ef472dd4495a6b749dc9b3 | refs/heads/main | 2023-06-25T23:33:36.006316 | 2021-07-29T10:36:18 | 2021-07-29T10:36:18 | 340,651,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 785 | java | package dsa.dp;
public class ShortestCommonSupersequence {
static int lcs(char[] a, int m, char[] b, int n) {
int[][] t = new int[m+1][n+1];
for(int i=1 ; i<=m ; i++) {
for(int j=1 ; j<=n ; j++) {
if(a[i-1] == b[j-1]){
t[i][j] = 1 + t[i-1][j-1];
} else {
t[i][j] = Math.max(t[i-1][j], t[i][j-1]);
}
}
}
return t[m][n];
}
public static void main(String[] args) {
String s1 = "geek";
String s2 = "eke";
char[] a = s1.toCharArray();
char[] b = s2.toCharArray();
int lcs = lcs(a, a.length, b, b.length);
int scs = a.length + b.length - lcs;
System.out.println(scs);
}
}
| [
"sinhaakashak@gmail.com"
] | sinhaakashak@gmail.com |
4a5ceff00bccc52e9651b10b2b7b52ab2e13eae4 | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/u6/a/j0/h.java | 7115934467ddad22b3e353d456d3f67f10fea1fa | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,023 | java | package u6.a.j0;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlinx.coroutines.flow.FlowKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@DebugMetadata(c = "kotlinx.coroutines.flow.FlowKt__CollectionKt", f = "Collection.kt", i = {0, 0, 0}, l = {32}, m = "toCollection", n = {"$this$toCollection", "destination", "$this$collect$iv"}, s = {"L$0", "L$1", "L$2"})
public final class h extends ContinuationImpl {
public /* synthetic */ Object a;
public int b;
public Object c;
public Object d;
public Object e;
public h(Continuation continuation) {
super(continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
@Nullable
public final Object invokeSuspend(@NotNull Object obj) {
this.a = obj;
this.b |= Integer.MIN_VALUE;
return FlowKt.toCollection(null, null, this);
}
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
e159acd4fc6169e76d1c941a1fcd490e6875a99b | 0fb7a2ed774983f2ac12c8403b6269808219e9bc | /yikatong-core/src/main/java/com/alipay/api/domain/AgreementParams.java | 2fce18d73e5a8330ee89bd4d6b7cf7a50a23239b | [] | no_license | zhangzh56/yikatong-parent | e605b4025c934fb4099d5c321faa3a48703f8ff7 | 47e8f627ba3471eff71f593189e82c6f08ceb1a3 | refs/heads/master | 2020-03-19T11:23:47.000077 | 2018-04-26T02:26:48 | 2018-04-26T02:26:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,415 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 用于传递用户和支付宝的协议相关信息,json格式
*
* @author auto create
* @since 1.0, 2018-01-10 14:56:36
*/
public class AgreementParams extends AlipayObject {
private static final long serialVersionUID = 1214438337323675884L;
/**
* 支付宝系统中用以唯一标识用户签约记录的编号(用户签约成功后的协议号 )
*/
@ApiField("agreement_no")
private String agreementNo;
/**
* 鉴权申请token,其格式和内容,由支付宝定义。在需要做支付鉴权校验时,该参数不能为空。
*/
@ApiField("apply_token")
private String applyToken;
/**
* 鉴权确认码,在需要做支付鉴权校验时,该参数不能为空
*/
@ApiField("auth_confirm_no")
private String authConfirmNo;
public String getAgreementNo() {
return this.agreementNo;
}
public void setAgreementNo(String agreementNo) {
this.agreementNo = agreementNo;
}
public String getApplyToken() {
return this.applyToken;
}
public void setApplyToken(String applyToken) {
this.applyToken = applyToken;
}
public String getAuthConfirmNo() {
return this.authConfirmNo;
}
public void setAuthConfirmNo(String authConfirmNo) {
this.authConfirmNo = authConfirmNo;
}
}
| [
"xiangyu.zhang@foxmail.com"
] | xiangyu.zhang@foxmail.com |
e3d4e785a0ba22b415b2d247e25c39c1f1ca2042 | cdd780a2ac7b2b49d0449852aedc41e1eb7632cb | /src/main/java/com/jp/baking/service/controller/UserController.java | cc26495cb9f512939b9b49cb2f95ad938da713d8 | [] | no_license | JuanBallena/Baking_Service_Spring_Boot | 048c4b2925c7b8aa2e60da30f3ba24a6290fb3d1 | d0eddab11661d8ad99b7f211a625b5041b204803 | refs/heads/master | 2023-07-14T13:24:56.987170 | 2021-08-27T17:41:00 | 2021-08-27T17:41:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,227 | java | package com.jp.baking.service.controller;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.jp.baking.service.definition.ResponseDefinition;
import com.jp.baking.service.dto.user.AuthenticatedUserDto;
import com.jp.baking.service.dto.user.CreateUserDto;
import com.jp.baking.service.dto.user.CredentialsDto;
import com.jp.baking.service.dto.user.UserDto;
import com.jp.baking.service.error.ErrorMessageCreator;
import com.jp.baking.service.interf.Dto;
import com.jp.baking.service.manager.UserManager;
import com.jp.baking.service.response.ServiceResponse;
@RestController
public class UserController {
private static final String LOGIN = "Login";
private static final String INVALID_CREDENTIALS = "Los datos de autenticación introducidos son incorrectos. Inténtelo de nuevo.";
private static final String USER = "User";
private ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
private Validator validator = factory.getValidator();
@Autowired
private UserManager userManager;
@PostMapping("/users")
public ServiceResponse saveUser(@RequestBody CreateUserDto dto) {
ServiceResponse serviceResponse = new ServiceResponse();
try {
serviceResponse.setType(USER);
Set<ConstraintViolation<Dto>> violations = validator.validate(dto);
if (violations.isEmpty()) {
UserDto userDto = userManager.save(dto);
serviceResponse.addResponseCreated();
serviceResponse.setData(userDto);
return serviceResponse;
}
serviceResponse.addResponseBadRequest();
serviceResponse.setErrorsMessage(ErrorMessageCreator.create(violations));
return serviceResponse;
} catch (Exception e) {
e.printStackTrace();
}
return serviceResponse;
}
@PostMapping("/login")
public ServiceResponse login(@RequestBody CredentialsDto dto) {
ServiceResponse serviceResponse = new ServiceResponse();
try {
serviceResponse.setType(LOGIN);
Set<ConstraintViolation<Dto>> violations = validator.validate(dto);
if (violations.isEmpty()) {
AuthenticatedUserDto authenticatedUserDto = userManager.login(dto);
if (authenticatedUserDto == null) {
serviceResponse.setData(authenticatedUserDto);
serviceResponse.setResponseCode(ResponseDefinition.RESPONSE_CODE_BAD_REQUEST);
serviceResponse.setResponseMessage(INVALID_CREDENTIALS);
return serviceResponse;
}
serviceResponse.setToken(userManager.getToken(authenticatedUserDto.getUsername()));
serviceResponse.addResponseOk();
serviceResponse.setData(authenticatedUserDto);
return serviceResponse;
}
serviceResponse.addResponseBadRequest();
serviceResponse.setErrorsMessage(ErrorMessageCreator.create(violations));
return serviceResponse;
} catch (Exception e) {
e.printStackTrace();
}
return serviceResponse;
}
}
| [
"jpbu911@hotmail.com"
] | jpbu911@hotmail.com |
514bf72f53c8f3e4836de0af8bf159f32c7a9bbc | 100e8431193de9cf1bc04a64157b57223fef9a57 | /src/test/java/org/jboss/cdi/showcase/test/PaymentProcessorTest.java | fdfae41348b33cfa329cdc4ea8dbaf047052c81e | [] | no_license | pmuir/cdi-showcase | ee7960b63ab294357084f104f4b269fab5437787 | 9255d4e5dcf1f93fac0610479d3b69999e29713a | refs/heads/master | 2021-01-19T11:16:23.959203 | 2014-08-21T10:31:21 | 2014-08-21T10:31:21 | 23,182,382 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,237 | java | /*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
* contributors by the @authors tag. See the copyright.txt in the
* distribution for a full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.cdi.showcase.test;
import static org.junit.Assert.assertEquals;
import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.cdi.showcase.payments.CreditCard;
import org.jboss.cdi.showcase.payments.PayPal;
import org.jboss.cdi.showcase.payments.PaymentProcessor;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(Arquillian.class)
public class PaymentProcessorTest {
@Deployment
public static Archive<?> createTestArchive() {
return ShrinkWrap.create(WebArchive.class, "test.war")
// Add all our beans
.addPackage(PaymentProcessor.class.getPackage())
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Inject
@CreditCard
PaymentProcessor creditCardPaymentProcessor;
@Inject
@PayPal
PaymentProcessor payPalPaymentProcessor;
@Test
public void testCreditCardPaymentProcessor() throws Exception {
assertEquals(new String[] { "Visa", "Mastercard", "American Express" },
creditCardPaymentProcessor.getSupportedMethods());
}
@Test
public void testPayPalPaymentProcessor() throws Exception {
assertEquals(new String[] { "PayPal" },
payPalPaymentProcessor.getSupportedMethods());
}
}
| [
"pmuir@bleepbleep.org.uk"
] | pmuir@bleepbleep.org.uk |
f1621376c3ace81320da768f1df326fb5f70f124 | f1a233666e953c2b5ddb73c457937e81ccb096e9 | /src/main/java/pl/sdacademy/session/SessionServlet.java | 19ff94f384c43c6d4d5c132064cbf51ff8c6bf97 | [] | no_license | MKoper9/user-db | d0731d273b59a28f8dbacdcd1a21212511b77c44 | e6d1b7a745d9740dfd8816c024a91735e53b0de6 | refs/heads/master | 2021-06-28T00:02:33.847485 | 2020-02-09T11:58:43 | 2020-02-09T11:58:43 | 233,380,413 | 0 | 2 | null | 2021-06-16T17:52:34 | 2020-01-12T11:19:02 | Java | UTF-8 | Java | false | false | 959 | java | package pl.sdacademy.session;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@WebServlet("/session")
public class SessionServlet extends HttpServlet {
public static final String NAME_FROM_SESSION = "nameFromSession";
@Override
protected void doPost(HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException {
HttpSession session = req.getSession();
String name = req.getParameter("name");
session.setAttribute(NAME_FROM_SESSION, name);
resp.sendRedirect("session");
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getRequestDispatcher("nameSessionForm.jsp")
.forward(req, resp);
}
}
| [
"mike@buildmysoftware.pro"
] | mike@buildmysoftware.pro |
004b27c3985424d949bacd72be83430e44446c2b | 2987226488542e970a98ef8386fa5bc0f5b1ad12 | /java-concurrency/book/examples/WebCrawler.java | 7ff938853d7caef0e8fcbbbaf52dc023ce84eca7 | [] | no_license | vmnchg/java-research | cbfb4ce1f152465573dacd60e6f9f294a3571cec | 7b9d040656df479d1a846e122376f0b7c58ce2a8 | refs/heads/master | 2021-01-10T01:33:16.339943 | 2015-07-14T23:12:57 | 2015-07-14T23:12:57 | 36,853,264 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,298 | java | package examples;
import java.net.URL;
import java.util.*;
import java.util.concurrent.*;
import net.jcip.annotations.*;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
/**
* WebCrawler
* <p/>
* Using TrackingExecutorService to save unfinished tasks for later execution
*
* @author Brian Goetz and Tim Peierls
*/
public abstract class WebCrawler {
private volatile TrackingExecutor exec;
@GuardedBy("this") private final Set<URL> urlsToCrawl = new HashSet<URL>();
private final ConcurrentMap<URL, Boolean> seen = new ConcurrentHashMap<URL, Boolean>();
private static final long TIMEOUT = 500;
private static final TimeUnit UNIT = MILLISECONDS;
public WebCrawler(URL startUrl) {
urlsToCrawl.add(startUrl);
}
public synchronized void start() {
exec = new TrackingExecutor(Executors.newCachedThreadPool());
for (URL url : urlsToCrawl) submitCrawlTask(url);
urlsToCrawl.clear();
}
public synchronized void stop() throws InterruptedException {
try {
saveUncrawled(exec.shutdownNow());
if (exec.awaitTermination(TIMEOUT, UNIT))
saveUncrawled(exec.getCancelledTasks());
} finally {
exec = null;
}
}
protected abstract List<URL> processPage(URL url);
private void saveUncrawled(List<Runnable> uncrawled) {
for (Runnable task : uncrawled)
urlsToCrawl.add(((CrawlTask) task).getPage());
}
private void submitCrawlTask(URL u) {
exec.execute(new CrawlTask(u));
}
private class CrawlTask implements Runnable {
private final URL url;
CrawlTask(URL url) {
this.url = url;
}
private int count = 1;
boolean alreadyCrawled() {
return seen.putIfAbsent(url, true) != null;
}
void markUncrawled() {
seen.remove(url);
System.out.printf("marking %s uncrawled%n", url);
}
public void run() {
for (URL link : processPage(url)) {
if (Thread.currentThread().isInterrupted())
return;
submitCrawlTask(link);
}
}
public URL getPage() {
return url;
}
}
}
| [
"v.m.chhieng@gmail.com"
] | v.m.chhieng@gmail.com |
69349c49511f99a4cd44936a7fae15d0a6c9dcb9 | 74117b56dc8c4cef7562df72f96ad0ae3d24e5ed | /src/ginterface/iresponsemessage.java | b3096f3ea9638521103561e05d338c09f56eab1f | [] | no_license | andykuria/virtualbank | 5dd2c19a246c5b255ddc66f320ecf51635d3afdb | d5cf0885d4dbbee113ea39fc001a4133a5b8beff | refs/heads/master | 2016-09-11T03:38:23.167236 | 2014-05-29T09:46:51 | 2014-05-29T09:46:51 | 42,576,794 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ginterface;
import datamanager.messagePatternLoader;
import globalutils.KeyExhType;
import iso8583.IsoMessage;
import iso8583.msgSecurity;
import processing.networkConfigQueue;
/**
*
* @author minhdbh
*/
public interface iresponsemessage {
public IsoMessage makeResponseMsg(IsoMessage pmsg, messagePatternLoader msgPattern);
public IsoMessage makeNetworkResponseMsg(IsoMessage pmsg, messagePatternLoader msgPattern);
public void setConfiguration(iqueryactionable pconfiguration);
public IsoMessage changeNetworkConfig(IsoMessage pmsg);
public IsoMessage saveNetworkCfg(IsoMessage pmsg);
public void setCfgNetwork(networkConfigQueue pcfgNetwork);
}
| [
"minhdbh@gmail.com"
] | minhdbh@gmail.com |
08c68f4c92ed2dcf21adfaab023cfa4dd2045b6a | 24bed13466f46e4bcc38df48bfa392e0594aff56 | /sgpbid/ejb/src/main/java/br/com/empresa/sgpbid/generico/Entity.java | 6ad2d0d4a1fcc89d1428161026e00a69228d8b2a | [] | no_license | jeanvargas14/SGP-BID | 42782880e91020fcda8fb47311ded320eef8da23 | 08e0de941356d30c39f7976ec43b03f267ae9a5e | refs/heads/master | 2020-04-12T05:33:10.021688 | 2016-10-06T16:54:15 | 2016-10-06T16:55:06 | 60,530,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | /**
*
*/
package br.com.empresa.sgpbid.generico;
/**
* 2 de set de 2016
* @author roberto.conceicao
*
*/
public class Entity {
}
| [
"roberto.conceicao@softplan.com.br"
] | roberto.conceicao@softplan.com.br |
a51a237d06244ff88d4272b47b70af3b86763a3f | e873994f51b6837610216a127d7d365b526a676e | /java/src/main/java/com/aliyun/eventbridge/models/ListAliyunOfficialRequest.java | 1b3bf613b47c2e57b19100f945524baddb59172a | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-eventbridge-sdk | 520ba864b8ec936386a4ec5a99549f5d638b6e1d | b8683bd739d39e6a2fe23eacd45c907fe3cb4820 | refs/heads/master | 2023-07-05T15:31:01.576624 | 2023-04-26T01:53:02 | 2023-04-26T10:03:06 | 294,324,589 | 7 | 16 | null | 2023-04-26T10:03:08 | 2020-09-10T06:37:25 | Java | UTF-8 | Java | false | false | 942 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.eventbridge.models;
import com.aliyun.tea.*;
/**
* The request of listAliyunOfficialEventSources
*/
public class ListAliyunOfficialRequest extends TeaModel {
@NameInMap("NextToken")
public String nextToken;
@NameInMap("Limit")
public Integer limit;
public static ListAliyunOfficialRequest build(java.util.Map<String, ?> map) {
ListAliyunOfficialRequest self = new ListAliyunOfficialRequest();
return TeaModel.build(map, self);
}
public ListAliyunOfficialRequest setNextToken(String nextToken) {
this.nextToken = nextToken;
return this;
}
public String getNextToken() {
return this.nextToken;
}
public ListAliyunOfficialRequest setLimit(Integer limit) {
this.limit = limit;
return this;
}
public Integer getLimit() {
return this.limit;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
1406541a290eaeb585d2bafb07f64ac580c7e924 | 49525caa2ae7107e2df393a818aa1cdf65c9a33d | /app/src/main/java/com/example/wave_20/DataEvent.java | 9f17ad4e0beff830d891d1f6ebf05613fe7e12be | [] | no_license | Karl-Sikorsky/wave_2.0 | fa7badc8479008ce9e8ac9b165e08b62a2bffa48 | d54ddbea4a3e34ab18f55d4feb2f9aafd23269a7 | refs/heads/master | 2020-05-25T18:55:10.184585 | 2017-03-21T02:23:03 | 2017-03-21T02:23:03 | 84,955,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package com.example.wave_20;
/**
* Created by ПОДАРУНКОВИЙ on 12.03.2017.
*/
public class DataEvent {
public final String message;
public DataEvent(String message) {
this.message = message;
}
} | [
"Kalevych_tech@ukr.net"
] | Kalevych_tech@ukr.net |
653154e93dda4674b93f3347aaec79104908d8dc | c343d06c280e03f148c4f8715b7b0397bfcbd159 | /integration/javacv/src/boofcv/io/javacv/JavaCVVideo.java | da8156ff590d12acc4ca4a6ad5d56e435a911e45 | [
"LicenseRef-scancode-takuya-ooura",
"Apache-2.0"
] | permissive | Nomanghous/BoofCV | ec80ff7633c6a46fdbdd53188ed5136f75f57e94 | b7b34725465cbcf85c014d6a36d63f4d8d18f9a6 | refs/heads/master | 2021-01-01T18:38:58.655293 | 2017-07-21T15:16:14 | 2017-07-21T15:16:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,134 | java | /*
* Copyright (c) 2011-2016, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* 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 boofcv.io.javacv;
import boofcv.io.image.SimpleImageSequence;
import boofcv.io.video.VideoInterface;
import boofcv.struct.image.ImageBase;
import boofcv.struct.image.ImageType;
/**
* @author Peter Abeles
*/
public class JavaCVVideo implements VideoInterface {
@Override
public <T extends ImageBase> SimpleImageSequence<T>
load(String fileName, ImageType<T> imageType) {
return new JavaCVVideoImageSequence<>(fileName, imageType);
}
}
| [
"peter.abeles@gmail.com"
] | peter.abeles@gmail.com |
b0aecc5e7ebe3d7df4e0124a7a57c69aaff9b18a | e673dade43f5afcec5374af20f2411e1da10d982 | /src/main/java/net/sourceforge/jaad/mp4/boxes/impl/fd/GroupIDToNameBox.java | f73fb0e529d00768cbe7a27bf5f977421436f922 | [
"CC-PDDC",
"LicenseRef-scancode-public-domain"
] | permissive | candrews/JAADec | ab946f02f62d0d66408c6609a86d828c9f2c7ed4 | 970a87d256d383da7ddb9f3a14d313dc7cef3774 | refs/heads/master | 2023-04-07T00:05:15.407668 | 2016-06-13T19:48:50 | 2016-06-14T14:33:23 | 60,644,703 | 0 | 1 | NOASSERTION | 2023-04-03T23:29:32 | 2016-06-07T20:37:04 | Java | UTF-8 | Java | false | false | 908 | java | package net.sourceforge.jaad.mp4.boxes.impl.fd;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import net.sourceforge.jaad.mp4.MP4InputStream;
import net.sourceforge.jaad.mp4.boxes.FullBox;
public class GroupIDToNameBox extends FullBox {
private final Map<Long, String> map;
public GroupIDToNameBox() {
super("Group ID To Name Box");
map = new HashMap<Long, String>();
}
@Override
public void decode(MP4InputStream in) throws IOException {
super.decode(in);
final int entryCount = (int) in.readBytes(2);
long id;
String name;
for(int i = 0; i<entryCount; i++) {
id = in.readBytes(4);
name = in.readUTFString((int) getLeft(in), MP4InputStream.UTF8);
map.put(id, name);
}
}
/**
* Returns the map that contains the ID-name-pairs for all groups.
*
* @return the ID to name map
*/
public Map<Long, String> getMap() {
return map;
}
}
| [
"keeneraustin@yahoo.com"
] | keeneraustin@yahoo.com |
88b29c673f6e93da1a8febfddccfdf08d7403539 | 41f29841def03c1dc4fd9c6e27aa0db92a839d37 | /app/src/main/java/com/ranapromo/nara/ranapromo3/adapters/HomeRecyclerAdapter.java | f9125fcdac53701c66dbea03c4a890fe6e41a1e8 | [] | no_license | farlam/RanaPromo3 | d91f2d02c35d4f5fc3c6c0819d784673b109a171 | be915e105c56f1c03e9e7002bfa43b85a208b08c | refs/heads/master | 2016-08-11T06:22:36.570492 | 2016-02-08T21:52:56 | 2016-02-08T21:52:56 | 50,873,997 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,701 | java | package com.ranapromo.nara.ranapromo3.adapters;
import android.support.v4.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
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.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.ranapromo.nara.ranapromo3.Data.MarqueDataHolder;
import com.ranapromo.nara.ranapromo3.Data.Promotion;
import com.ranapromo.nara.ranapromo3.comman.Util;
import com.ranapromo.nara.ranapromo3.ui.MarqueActivity;
import com.ranapromo.nara.ranapromo3.ui.MarqueDetail;
import com.ranapromo.nara.ranapromo3.R;
import com.ranapromo.nara.ranapromo3.Data.HomeData;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Adapter for the grid layout recycler in the first tab
*/
public class HomeRecyclerAdapter extends RecyclerView.Adapter<HomeRecyclerAdapter.ViewHolder> {
private LayoutInflater inflater;
private Fragment fargment;
private Context context;
List<MarqueDataHolder> data = Collections.emptyList();
public HomeRecyclerAdapter(Fragment fargment, List<MarqueDataHolder> data){
this.fargment = fargment;
this.context = fargment.getContext();
inflater= LayoutInflater.from(context);
this.data = data;
}
public synchronized void add(MarqueDataHolder marque) {
data.add(0, marque);
notifyItemInserted(0);
}
public void clearData() {
int size = data.size();
if (size > 0) {
for (int i = 0; i < size; i++) {
data.remove(0);
}
this.notifyItemRangeRemoved(0, size);
}
}
@Override
public HomeRecyclerAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View view;
if(i != (data.size()-1))
{
view = inflater.inflate(R.layout.home_marque_item, viewGroup, false);
} else{
view = inflater.inflate(R.layout.marque_item, viewGroup, false);
}
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(HomeRecyclerAdapter.ViewHolder viewHolder, int position) {
if(position != (data.size())){
MarqueDataHolder current = data.get(position);
String a = current.getOccNumber()+"";
viewHolder.discription.setText(a);
viewHolder.marqueID = current.getMarque();
String dest = context.getCacheDir() + "/"+current.getMarque()+".jpg";
if(Util.isMustDownload(dest)){
Util.logDebug("le fichier de marque existe");
viewHolder.img.setImageBitmap(BitmapFactory.decodeFile(dest));
} else
{
Util.logDebug("Le fichier "+dest+" n'existe pas");
new MyImageLoader().execute(new ParamHolder(viewHolder.img, dest));
}
//viewHolder.img.setBackgroundResource(current.imageID);
} else{
viewHolder.img.setBackgroundResource(R.drawable.ic_add_black);
viewHolder.mFrameLayout.setVisibility(View.GONE); // set visibilité gone if marque has 0 notification
}
}
@Override
public synchronized int getItemCount() {
return data.size()+1;
}
class ParamHolder{
public ParamHolder(ImageView v,String desfile){
theView =v;
this.desfile = desfile;
}
ImageView theView;
String desfile;
}
class MyImageLoader extends AsyncTask<ParamHolder, Void, Bitmap> {
ParamHolder container;
@Override
protected void onPreExecute() {
}
@Override
protected Bitmap doInBackground(ParamHolder... params) {
container = params[0];
Bitmap btm = null;
File file = new File(container.desfile);
String fileName = file.getName();
String url = context.getString(R.string.server_base_url)+fileName;
Log.d(Util.DEBUG_VAL, "le fichier n'existe pas téléchargment depuis le serveur " + container.desfile);
btm = Util.getBitmapFromURL(url, container.desfile);
return btm;
}
@Override
protected void onPostExecute(Bitmap result) {
if (result != null){
//imageView.setBackgroundResource(mResources[position]);
container.theView.setImageBitmap(result);
}
}
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
TextView discription;
ImageView img;
FrameLayout mFrameLayout;
String marqueID;
public ViewHolder(View itemView) {
super(itemView);
discription = (TextView) itemView.findViewById(R.id.textnumber);
img = (ImageView) itemView.findViewById(R.id.marqueview);
mFrameLayout = (FrameLayout)itemView.findViewById(R.id.notif_layout);
img.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if(getAdapterPosition() == data.size())
{
Intent i = new Intent(context,MarqueActivity.class);
fargment.startActivityForResult(i,100);
//view.getContext().startActivity(i);
} else {
Intent intent = new Intent(context,MarqueDetail.class);
intent.putExtra("marqueId",marqueID);
view.getContext().startActivity(intent);
}
}
}
} | [
"fsmati@example.com"
] | fsmati@example.com |
17478af08ffe8b7e9223609f2b218a3b8f0de937 | a78e998b0cb3c096a6d904982bb449da4003ff8b | /app/src/main/java/com/alipay/api/domain/AlipayOpenPublicPersonalizedExtensionSetModel.java | d06fc857d3709f7b9d1cfb43180b499815ad2e4f | [
"Apache-2.0"
] | permissive | Zhengfating/F2FDemo | 4b85b598989376b3794eefb228dfda48502ca1b2 | 8654411f4269472e727e2230e768051162a6b672 | refs/heads/master | 2020-05-03T08:30:29.641080 | 2019-03-30T07:50:30 | 2019-03-30T07:50:30 | 178,528,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,076 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 个性化扩展区上下线接口
*
* @author auto create
* @since 1.0, 2017-04-27 10:50:31
*/
public class AlipayOpenPublicPersonalizedExtensionSetModel extends AlipayObject {
private static final long serialVersionUID = 3414177332994639114L;
/**
* 扩展区套id,调用创建个性化扩展区接口时返回
*/
@ApiField("extension_key")
private String extensionKey;
/**
* 扩展区操作类型,支持2个值:ON、OFF,ON代表上线操作,OFF代表下线操作。当上线一个扩展区时,若存在同样的标签规则,且状态为上线的扩展区,该扩展区会自动下线
*/
@ApiField("status")
private String status;
public String getExtensionKey() {
return this.extensionKey;
}
public void setExtensionKey(String extensionKey) {
this.extensionKey = extensionKey;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
}
| [
"452139060@qq.com"
] | 452139060@qq.com |
915873b62a4e4c969ad1f36e3472257e15f53b1e | 6f8982e475e558754b9360e97201c2f2462df51c | /app/src/main/java/com/app/oktpus/requestModel/Attributes.java | daf6a39ac518afa9ec748dc79d6ffbdf43b4b106 | [] | no_license | rajivgh/oktpusandroid | 6033b54240d7080c566722bb21810d1257fe08d5 | 30a2c71f1d76317514dfb6d19852371873d2d4e9 | refs/heads/master | 2020-03-25T11:13:47.019069 | 2018-08-06T12:40:21 | 2018-08-06T12:40:21 | 143,723,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,487 | java | package com.app.oktpus.requestModel;
/**
* Created by Gyandeep on 30/11/16.
*/
public class Attributes {
@CustomSerializedName("city")
private FlagsMustHave city;
@CustomSerializedName("make")
private FlagsMustHave make;
@CustomSerializedName("country")
private FlagsMustHave country;
@CustomSerializedName("model")
private FlagsMustHave model;
@CustomSerializedName("price")
private FlagsMustHave price;
@CustomSerializedName("year")
private FlagsMustHave year;
@CustomSerializedName("kilometers")
private FlagsMustHave kilometers;
@CustomSerializedName("doors")
private FlagsMustHave doors;
@CustomSerializedName("drivetrain")
private FlagsMustHave drivetrain;
@CustomSerializedName("body")
private FlagsMustHave body;
@CustomSerializedName("transmission")
private FlagsMustHave transmission;
@CustomSerializedName("colour")
private FlagsMustHave colour;
@CustomSerializedName("below_market_average_percent")
private FlagsMustHave bmaPercent;
@CustomSerializedName("image0")
private FlagsMustHave img0;
@CustomSerializedName("user_type")
private FlagsMustHave userType;
public void setUserType(FlagsMustHave userType) { this.userType = userType;}
public void setCountry(FlagsMustHave country) {this.country = country; }
public void setCity(FlagsMustHave city) {
this.city = city;
}
public void setMake(FlagsMustHave make) {
this.make = make;
}
public void setModel(FlagsMustHave model) {
this.model = model;
}
public void setPrice(FlagsMustHave price) {
this.price = price;
}
public void setYear(FlagsMustHave year) {
this.year = year;
}
public void setKilometers(FlagsMustHave kilometers) {
this.kilometers = kilometers;
}
public void setBody(FlagsMustHave body) {
this.body = body;
}
public void setTransmission(FlagsMustHave transmission) {
this.transmission = transmission;
}
public void setBmaPercent(FlagsMustHave bmaPercent) { this.bmaPercent = bmaPercent; }
public void setImage0(FlagsMustHave img0) { this.img0 = img0; }
public void setColour(FlagsMustHave colour) {
this.colour = colour;
}
public void setDoors(FlagsMustHave doors) {
this.doors = doors;
}
public void setDrivetrain(FlagsMustHave drivetrain) {
this.drivetrain = drivetrain;
}
}
| [
"rajiv.mca140.com@gmail.com"
] | rajiv.mca140.com@gmail.com |
ca58b25650b619e4349f108a96c89a7353f3bccd | e5466ec73e13907532aae6abec76282a12e4c622 | /lib_common/src/main/java/com/pt/lib_common/easyhttp/request/EasyRequestParams.java | caa4beb7e9f542cb505c6d5245ed64ef1761f869 | [] | no_license | xiaoyuncanghai/PlatformTrading | 2fc8911e667813bcc9c7a1b297ae45053c9cefb3 | c122c4d9141cb31d6db8e02e1c0914c4ea1595bf | refs/heads/master | 2023-01-01T21:01:53.030960 | 2020-10-26T15:10:50 | 2020-10-26T15:10:50 | 286,169,941 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,265 | java | package com.pt.lib_common.easyhttp.request;
import java.util.concurrent.ConcurrentHashMap;
public class EasyRequestParams {
private ConcurrentHashMap<String, String> mRequestParams = new ConcurrentHashMap<>();
private ConcurrentHashMap<String, String> mRequestHeaders = new ConcurrentHashMap<>();
public void put(String key, String value) {
if (key != null && value != null) {
mRequestParams.put(key, value);
}
}
public ConcurrentHashMap<String, String> getRequestParams() {
return mRequestParams;
}
public void addHeader(String key, String value) {
if (key != null && value != null) {
mRequestHeaders.put(key, value);
}
}
public ConcurrentHashMap<String, String> getRequestHeaders() {
return mRequestHeaders;
}
@Override
public String toString() {
StringBuilder result = new StringBuilder();
for (ConcurrentHashMap.Entry<String, String> entry : mRequestParams.entrySet()) {
if (result.length() > 0)
result.append("&");
result.append(entry.getKey());
result.append("=");
result.append(entry.getValue());
}
return result.toString();
}
}
| [
"2501050940@qq.com"
] | 2501050940@qq.com |
a33716d9f6fb85a8a1c779d07709def32bd4b093 | 28dca1305b13432b7953729c43a6e774fc707f9e | /xds/src/main/java/io/grpc/xds/LoadStatsManager.java | ae58d80f4456c8fc8a909099c678baa7795b272d | [
"Apache-2.0"
] | permissive | dfawley/grpc-java | f8ccb08df72099d35b9b27134b142f6f7ebffa20 | 458b0e4447d1cfb8fddd81847b41c884acd2824d | refs/heads/master | 2021-06-24T20:43:46.145708 | 2021-01-15T19:26:34 | 2021-01-15T19:26:34 | 209,878,254 | 0 | 0 | Apache-2.0 | 2021-01-15T21:21:45 | 2019-09-20T20:45:49 | Java | UTF-8 | Java | false | false | 6,214 | java | /*
* Copyright 2019 The gRPC Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.grpc.xds;
import static com.google.common.base.Preconditions.checkState;
import com.google.common.annotations.VisibleForTesting;
import io.grpc.xds.EnvoyProtoData.ClusterStats;
import io.grpc.xds.EnvoyProtoData.Locality;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
/**
* Manages all stats for client side load.
*/
final class LoadStatsManager {
private final LoadStatsStoreFactory loadStatsStoreFactory;
private final Map<String, Map<String, ReferenceCounted<LoadStatsStore>>> loadStatsStores
= new HashMap<>();
LoadStatsManager() {
this(LoadStatsStoreImpl.getDefaultFactory());
}
@VisibleForTesting
LoadStatsManager(LoadStatsStoreFactory factory) {
this.loadStatsStoreFactory = factory;
}
/**
* Adds and retrieves the stats object for tracking loads for the given cluster:cluster_service.
* The returned {@link LoadStatsStore} is reference-counted, caller should use
* {@link #removeLoadStats} to release the reference when it is no longer used.
*/
LoadStatsStore addLoadStats(String cluster, @Nullable String clusterService) {
if (!loadStatsStores.containsKey(cluster)) {
loadStatsStores.put(cluster, new HashMap<String, ReferenceCounted<LoadStatsStore>>());
}
Map<String, ReferenceCounted<LoadStatsStore>> clusterLoadStatsStores
= loadStatsStores.get(cluster);
if (!clusterLoadStatsStores.containsKey(clusterService)) {
clusterLoadStatsStores.put(
clusterService,
ReferenceCounted.wrap(loadStatsStoreFactory.newLoadStatsStore(cluster, clusterService)));
}
ReferenceCounted<LoadStatsStore> ref = clusterLoadStatsStores.get(clusterService);
ref.retain();
return ref.get();
}
/**
* Discards stats object used for tracking loads for the given cluster:cluster_service.
*/
void removeLoadStats(String cluster, @Nullable String clusterService) {
checkState(
loadStatsStores.containsKey(cluster)
&& loadStatsStores.get(cluster).containsKey(clusterService),
"stats for cluster %s, cluster service %s not exits");
Map<String, ReferenceCounted<LoadStatsStore>> clusterLoadStatsStores =
loadStatsStores.get(cluster);
ReferenceCounted<LoadStatsStore> ref = clusterLoadStatsStores.get(clusterService);
ref.release();
if (ref.getReferenceCount() == 0) {
clusterLoadStatsStores.remove(clusterService);
}
if (clusterLoadStatsStores.isEmpty()) {
loadStatsStores.remove(cluster);
}
}
/**
* Generates reports summarizing the stats recorded for loads sent to the given cluster for
* the interval between calls of this method or {@link #getAllLoadReports}. A cluster may send
* loads to more than one cluster_service, they are included in separate stats reports.
*/
List<ClusterStats> getClusterLoadReports(String cluster) {
List<ClusterStats> res = new ArrayList<>();
Map<String, ReferenceCounted<LoadStatsStore>> clusterLoadStatsStores =
loadStatsStores.get(cluster);
if (clusterLoadStatsStores == null) {
return res;
}
for (ReferenceCounted<LoadStatsStore> ref : clusterLoadStatsStores.values()) {
res.add(ref.get().generateLoadReport());
}
return res;
}
/**
* Generates reports summarized the stats recorded for loads sent to all clusters for the
* interval between calls of this method or {@link #getClusterLoadReports}. Each report
* includes stats for one cluster:cluster_service.
*/
List<ClusterStats> getAllLoadReports() {
List<ClusterStats> res = new ArrayList<>();
for (Map<String, ReferenceCounted<LoadStatsStore>> clusterLoadStatsStores
: loadStatsStores.values()) {
for (ReferenceCounted<LoadStatsStore> ref : clusterLoadStatsStores.values()) {
res.add(ref.get().generateLoadReport());
}
}
return res;
}
// Introduced for testing.
@VisibleForTesting
interface LoadStatsStoreFactory {
LoadStatsStore newLoadStatsStore(String cluster, String clusterService);
}
/**
* Interface for client side load stats store. A {@link LoadStatsStore} instance holds the load
* stats for a cluster from an gRPC client's perspective by maintaining a set of locality
* counters for each locality it is tracking loads for.
*/
interface LoadStatsStore {
/**
* Generates a report based on recorded load stats (including RPC counts, backend metrics and
* dropped calls) for the interval since the previous call of this method.
*/
ClusterStats generateLoadReport();
/**
* Adds tracking for load stats sent to the given {@code locality}. Returns the counter
* object responsible for tracking the client load stats to the given {@code locality}.
* Only load stats for tracked localities will be included in generated load reports.
*/
ClientLoadCounter addLocality(Locality locality);
/**
* Drops tracking for load stats sent to the given {@code locality}. Load stats for removed
* localities will no longer be included in future generated load reports after
* their currently recording stats have been fully reported.
*/
void removeLocality(Locality locality);
/**
* Records a drop decision with the given category.
*
* <p>This method must be thread-safe.
*/
void recordDroppedRequest(String category);
/**
* Records a uncategorized drop decision.
*
* <p>This method must be thread-safe.
*/
void recordDroppedRequest();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b433a63de6286b370de3529eba5cb9c5be8fac71 | 74c9224f281482d894f655d4ca732f836f5f106a | /Musar (server)/src/musar/ClockwerkAPI.java | c278dfd1095186edb65fbff9731426be2284cb03 | [] | no_license | HeshamAmer/Musar | 14cd690ebdcefd3e8f877117b5de2aa49a3d9c5b | 2ef93fe13aa2149301160a54ec0bc2f5837b7725 | refs/heads/master | 2021-01-13T02:03:27.792843 | 2015-08-07T12:58:34 | 2015-08-07T12:58:34 | 40,359,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,382 | java | package musar;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
public class ClockwerkAPI {
static String Key = "8eeacf25f9b8877aebe82d314dd96dca10564aef";
public void SendSMS(String phNumber,String salt) throws Exception{
String url="https://api.clockworksms.com/http/send.aspx?key="+Key+"&to="+phNumber+"&content=Security_Token:"+salt;
System.out.println(url);
excutePost(url,"" );
//https://api.clockworksms.com/http/send.aspx?key=KEY&to=PhNumber&content=Security_Code
}
public static String excutePost(String targetURL, String urlParameters)
{
URL url;
HttpURLConnection connection = null;
try {
//Create connection
url = new URL(targetURL);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
connection.setRequestProperty("Content-Length", "" +
Integer.toString(urlParameters.getBytes().length));
connection.setRequestProperty("Content-Language", "en-US");
connection.setUseCaches (false);
connection.setDoInput(true);
connection.setDoOutput(true);
//Send request
DataOutputStream wr = new DataOutputStream (
connection.getOutputStream ());
wr.writeBytes (urlParameters);
wr.flush ();
wr.close ();
//Get Response
InputStream is = connection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
String line;
StringBuffer response = new StringBuffer();
while((line = rd.readLine()) != null) {
response.append(line);
response.append('\r');
}
rd.close();
return response.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if(connection != null) {
connection.disconnect();
}
}
}
public static void main(String[] args) throws Exception{
ClockwerkAPI CWA=new ClockwerkAPI();
CWA.SendSMS("+201202027206","gedy");
}
}
| [
"HeshamHamdyAmer@gmail.com"
] | HeshamHamdyAmer@gmail.com |
cb9eb80ce9b22d6fa84b81f3a42828fa3debfb58 | 06993cea23599368fdc9da00664603b689106051 | /src/main/java/com/badou/project/moduleDemo/web/fun3/children/Fun3DemoChildEditAction.java | 55daa8b83e83d99242e8c03c7b92c8f0ed39b7f2 | [] | no_license | llzz9595/badou-study | da021d63bdbd560f43121df39ebe9de09491e800 | 1e463a1c79de223f2fdb7db920a6c64e0a277470 | refs/heads/master | 2021-01-21T17:14:07.568721 | 2017-05-21T09:08:52 | 2017-05-21T09:08:52 | 91,943,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,361 | java | package com.badou.project.moduleDemo.web.fun3.children;
import java.io.Serializable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import com.shengdai.ui.ligerui.struts2.JsonEditTemplateAction;
import com.badou.project.moduleDemo.model.Fun3DemoChildEntity;
import com.badou.project.moduleDemo.service.IFun3DemoChildService;
import com.badou.project.moduleDemo.service.IFun3DemoService;
import com.badou.project.moduleDemo.web.form.Fun3DemoChildForm;
/**
* 功能1示例编辑
* <p>对应的请求路径是:${context}/moduledemo/children/Fun3/Fun3demoedit/方法名.do
* <p>对应的请求默认页面是:${context}/WEB-INF/jsp/moduledemo/children/Fun3/Fun3demoedit_edit.jsp
* @author xiangsf 2013-1-18
*
*/
@Controller
public class Fun3DemoChildEditAction extends JsonEditTemplateAction<Fun3DemoChildEntity, Serializable, Fun3DemoChildForm> {
/**
*
*/
private static final long serialVersionUID = 5580776894637809336L;
@Autowired
private IFun3DemoService Fun3DemoService;
@Autowired
private IFun3DemoChildService Fun3DemoChildService;
@Autowired
public void setFun3DemoChildService(IFun3DemoChildService Fun3DemoChildService) {
this.Fun3DemoChildService = Fun3DemoChildService;
super.setBaseService(Fun3DemoChildService);
}
}
| [
"llzLEE9599@gmail.com"
] | llzLEE9599@gmail.com |
8f8e8845c02004edbd789b881d8a3820f7677350 | 64c57612768b56f6989a1ea1d1281c0bc7112f32 | /octavianmodul/src/main/java/co/id/gmedia/coremodul/ItemValidation.java | 62a06a63c203a2dc97d786519856ca963e0b242b | [] | no_license | octa-vian/octa-vian-Kartika-apps | ce71b68c41c97fd7c832aeb53ec50149966ad82d | 23c392b41a8b2a534da998d1f47ece5273af9547 | refs/heads/master | 2021-05-18T06:46:27.283205 | 2021-05-04T05:53:21 | 2021-05-04T05:53:21 | 251,163,618 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 38,857 | java | package co.id.gmedia.coremodul;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.DatePickerDialog;
import android.content.ContentUris;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Base64;
import android.util.TypedValue;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import androidx.appcompat.widget.AppCompatDrawableManager;
import androidx.core.app.ActivityCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.loader.content.CursorLoader;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class ItemValidation {
private final String TAG = "Item.Validation";
public String getToday(String format){
Calendar c = Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat(format);
String formattedDate = df.format(c.getTime());
return formattedDate;
}
public boolean validateCustomDate(final EditText edt, final String format){
String textDate = edt.getText().toString();
if(!isValidFormat(format,textDate)){
edt.requestFocus();
return false;
}else{
return true;
}
}
public String getCurrentDate(String format){
return new SimpleDateFormat(format).format(new Date());
}
public static boolean isValidFormat(String format, String value) {
Date date = null;
try {
SimpleDateFormat sdf = new SimpleDateFormat(format);
date = sdf.parse(value);
if (!value.equals(sdf.format(date))) {
date = null;
}
} catch (ParseException ex) {
ex.printStackTrace();
}
return date != null;
}
public void CustomDateFormatCorrection(final EditText edt){
edt.addTextChangedListener(new TextWatcher() {
boolean changeChar = true;
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(edt.getText().length() == 5 || edt.getText().length() == 8){
if(edt.getText().toString().charAt(edt.getText().length() - 1) == '-' ){
changeChar = false;
}
}
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
if((edt.getText().length() == 4 || edt.getText().length() == 7) && changeChar){
edt.setText(edt.getText().toString() + "-");
edt.setSelection(edt.getText().length());
}
changeChar = true;
}
});
}
public String ChangeFormatDateString(String date, String formatDateFrom, String formatDateTo){
if (!date.isEmpty()){
String result = date;
SimpleDateFormat sdf = new SimpleDateFormat(formatDateFrom);
SimpleDateFormat sdfCustom = new SimpleDateFormat(formatDateTo);
Date date1 = null;
try {
date1 = sdf.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return (date1 == null || date.isEmpty()) ? "" : sdfCustom.format(date1);
}else{
return "";
}
}
public int dpToPx(Context context, int dp) {
Resources r = context.getResources();
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics()));
}
public int[] getScreenResolution(Context context){
Display display = ((Activity)context).getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
int[] sizeArray = new int[2];
sizeArray[0] = width;
sizeArray[1] = height;
return sizeArray;
}
public boolean isMoreThanCurrentDate(EditText edt, EditText edt2, String format){
SimpleDateFormat sdf = new SimpleDateFormat(format);
Date dateToCompare = null;
Date dateCompare = null;
try {
dateToCompare = sdf.parse(edt.getText().toString());
dateCompare = sdf.parse(edt2.getText().toString());
} catch (ParseException e) {
e.printStackTrace();
}
if(dateToCompare.after(dateCompare) || dateToCompare.equals(dateCompare)){
return true;
}else{
return false;
}
}
public String sumDate(String date1, int numberOfDay, String format){
SimpleDateFormat sdf = new SimpleDateFormat(format);
Calendar c = Calendar.getInstance();
try {
c.setTime(sdf.parse(date1));
} catch (ParseException e) {
e.printStackTrace();
}
c.add(Calendar.DATE, numberOfDay);
return sdf.format(c.getTime());
}
public String sumMinutes(String date1, int numberOfMinutes, String format){
SimpleDateFormat sdf = new SimpleDateFormat(format);
Calendar c = Calendar.getInstance();
try {
c.setTime(sdf.parse(date1));
} catch (ParseException e) {
e.printStackTrace();
}
c.add(Calendar.MINUTE, numberOfMinutes);
return sdf.format(c.getTime());
}
//endregion
//region Datepicker
public void datePickerEvent(final Context context, final EditText edt, final String drawablePosition, final String formatDate){
edt.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int prePosition;
final Calendar customDate;
switch (drawablePosition.toUpperCase()){
case "LEFT":
prePosition = 0;
break;
case "TOP":
prePosition = 1;
break;
case "RIGHT":
prePosition = 2;
break;
case "Bottom":
prePosition = 3;
break;
default:
prePosition = 2;
}
final int position = prePosition;
if(event.getAction() == MotionEvent.ACTION_UP) {
if(event.getRawX() >= (edt.getRight() - edt.getCompoundDrawables()[position].getBounds().width())) {
/*Log.d(TAG, "onTouch: ");
// set format date
customDate = Calendar.getInstance();
final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int date) {
customDate.set(Calendar.YEAR,year);
customDate.set(Calendar.MONTH,month);
customDate.set(Calendar.DATE,date);
SimpleDateFormat sdFormat = new SimpleDateFormat(formatDate, Locale.US);
edt.setText(sdFormat.format(customDate.getTime()));
}
};
new DatePickerDialog(context,date,customDate.get(Calendar.YEAR),customDate.get(Calendar.MONTH),customDate.get(Calendar.DATE)).show();
return true;*/
}
customDate = Calendar.getInstance();
final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int date) {
customDate.set(Calendar.YEAR,year);
customDate.set(Calendar.MONTH,month);
customDate.set(Calendar.DATE,date);
SimpleDateFormat sdFormat = new SimpleDateFormat(formatDate, Locale.US);
edt.setText(sdFormat.format(customDate.getTime()));
}
};
new DatePickerDialog(context,date,customDate.get(Calendar.YEAR),customDate.get(Calendar.MONTH),customDate.get(Calendar.DATE)).show();
return true;
}
return false;
}
});
}
public void datePickerEvent(final Context context, final EditText edt, final String drawablePosition, final String formatDate, final String value){
edt.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int prePosition;
final Calendar customDate;
switch (drawablePosition.toUpperCase()){
case "LEFT":
prePosition = 0;
break;
case "TOP":
prePosition = 1;
break;
case "RIGHT":
prePosition = 2;
break;
case "Bottom":
prePosition = 3;
break;
default:
prePosition = 2;
}
final int position = prePosition;
if(event.getAction() == MotionEvent.ACTION_UP) {
if(event.getRawX() >= (edt.getRight() - edt.getCompoundDrawables()[position].getBounds().width())) {
/*Log.d(TAG, "onTouch: ");
// set format date
customDate = Calendar.getInstance();
final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int date) {
customDate.set(Calendar.YEAR,year);
customDate.set(Calendar.MONTH,month);
customDate.set(Calendar.DATE,date);
SimpleDateFormat sdFormat = new SimpleDateFormat(formatDate, Locale.US);
edt.setText(sdFormat.format(customDate.getTime()));
}
};
new DatePickerDialog(context,date,customDate.get(Calendar.YEAR),customDate.get(Calendar.MONTH),customDate.get(Calendar.DATE)).show();
return true;*/
}
SimpleDateFormat sdf = new SimpleDateFormat(formatDate);
Date dateValue = null;
try {
dateValue = sdf.parse(value);
} catch (ParseException e) {
e.printStackTrace();
}
customDate = Calendar.getInstance();
final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int date) {
customDate.set(Calendar.YEAR,year);
customDate.set(Calendar.MONTH,month);
customDate.set(Calendar.DATE,date);
SimpleDateFormat sdFormat = new SimpleDateFormat(formatDate, Locale.US);
edt.setText(sdFormat.format(customDate.getTime()));
}
};
SimpleDateFormat yearOnly = new SimpleDateFormat("yyyy");
new DatePickerDialog(context,date, parseNullInteger(yearOnly.format(dateValue)),dateValue.getMonth(),dateValue.getDate()).show();
return true;
}
return false;
}
});
}
//endregion
//endregion
//region Number
/* Change Number to Rupiah*/
public String ChangeToCurrencyFormat(String number){
NumberFormat format = NumberFormat.getCurrencyInstance();
DecimalFormatSymbols symbols = ((DecimalFormat) format).getDecimalFormatSymbols();
symbols.setCurrencySymbol("");
((DecimalFormat) format).setDecimalFormatSymbols(symbols);
format.setMaximumFractionDigits(0);
String hasil = String.valueOf(format.format(parseNullDouble(number)));
/*String stringConvert = "0";
try {
stringConvert = format.format(1000);
}catch (NumberFormatException e){
e.printStackTrace();
}
if(!stringConvert.contains(",")){
hasil += ",00";
}*/
return hasil;
}
public String ChangeToCurrencyFormat(Double number){
NumberFormat format = NumberFormat.getCurrencyInstance();
DecimalFormatSymbols symbols = ((DecimalFormat) format).getDecimalFormatSymbols();
symbols.setCurrencySymbol("");
((DecimalFormat) format).setDecimalFormatSymbols(symbols);
format.setMaximumFractionDigits(0);
String hasil = String.valueOf(format.format(number));
/*String stringConvert = "0";
try {
stringConvert = format.format(1000);
}catch (NumberFormatException e){
e.printStackTrace();
}
if(!stringConvert.contains(",")){
hasil += ",00";
}*/
return hasil;
}
public String ChangeToCurrencyFormat(int number){
NumberFormat format = NumberFormat.getCurrencyInstance();
DecimalFormatSymbols symbols = ((DecimalFormat) format).getDecimalFormatSymbols();
symbols.setCurrencySymbol("");
((DecimalFormat) format).setDecimalFormatSymbols(symbols);
format.setMaximumFractionDigits(0);
String hasil = String.valueOf(format.format(number));
/*String stringConvert = "0";
try {
stringConvert = format.format(1000);
}catch (NumberFormatException e){
e.printStackTrace();
}
if(!stringConvert.contains(",")){
hasil += ",00";
}*/
return hasil;
}
public String ChangeToRupiahFormat(String number){
double value = parseNullDouble(number);
NumberFormat format = NumberFormat.getCurrencyInstance();
DecimalFormatSymbols symbols = ((DecimalFormat) format).getDecimalFormatSymbols();
symbols.setCurrencySymbol("Rp ");
((DecimalFormat) format).setDecimalFormatSymbols(symbols);
format.setMaximumFractionDigits(0);
String hasil = String.valueOf(format.format(value));
return hasil;
}
public String ChangeToRupiahFormat(Float number){
NumberFormat format = NumberFormat.getCurrencyInstance();
DecimalFormatSymbols symbols = ((DecimalFormat) format).getDecimalFormatSymbols();
symbols.setCurrencySymbol("Rp ");
((DecimalFormat) format).setDecimalFormatSymbols(symbols);
format.setMaximumFractionDigits(0);
String hasil = String.valueOf(format.format(number));
/*String stringConvert = "0";
try {
stringConvert = format.format(1000);
}catch (NumberFormatException e){
e.printStackTrace();
}
if(!stringConvert.contains(",")){
hasil += ",00";
}*/
return hasil;
}
public String ChangeToRupiahFormat(Double number){
NumberFormat format = NumberFormat.getCurrencyInstance();
DecimalFormatSymbols symbols = ((DecimalFormat) format).getDecimalFormatSymbols();
symbols.setCurrencySymbol("Rp ");
((DecimalFormat) format).setDecimalFormatSymbols(symbols);
format.setMaximumFractionDigits(0);
String hasil = String.valueOf(format.format(number));
return hasil;
}
public String ChangeToRupiahFormat(Long number){
NumberFormat format = NumberFormat.getCurrencyInstance();
DecimalFormatSymbols symbols = ((DecimalFormat) format).getDecimalFormatSymbols();
symbols.setCurrencySymbol("Rp ");
((DecimalFormat) format).setDecimalFormatSymbols(symbols);
format.setMaximumFractionDigits(0);
String hasil = String.valueOf(format.format(number));
return hasil;
}
//endregion
//region Progressbar
public void ProgressbarEvent(final LinearLayout llItem, final ProgressBar pbItem, final Button btnItem, String condition){
if (condition.toUpperCase().equals("SHOW")){
llItem.setVisibility(View.VISIBLE);
pbItem.setVisibility(View.VISIBLE);
btnItem.setVisibility(View.GONE);
}else if(condition.toUpperCase().equals("ERROR")){
llItem.setVisibility(View.VISIBLE);
pbItem.setVisibility(View.GONE);
btnItem.setVisibility(View.VISIBLE);
}else if(condition.toUpperCase().equals("GONE")){
llItem.setVisibility(View.GONE);
pbItem.setVisibility(View.GONE);
btnItem.setVisibility(View.GONE);
}
}
//endregion
//region Nullable value
public int parseNullInteger(String s){
int result = 0;
if(s != null && s.length() > 0){
try {
result = Integer.parseInt(s);
}catch (Exception e){
result = 0;
e.printStackTrace();
}
}
return result;
}
//region Nullable value
public long parseNullLong(String s){
long result = 0;
if(s != null && s.length() > 0){
try {
result = Long.parseLong(s);
}catch (Exception e){
e.printStackTrace();
}
}
return result;
}
//nullable value
public float parseNullFloat(String s){
float result = 0;
if(s != null && s.length() > 0){
try {
result = Float.parseFloat(s);
}catch (Exception e){
e.printStackTrace();
}
}
return result;
}
public Double parseNullDouble(String s){
double result = 0;
if(s != null && s.length() > 0){
try {
result = Double.parseDouble(s);
}catch (Exception e){
e.printStackTrace();
}
}
return result;
}
public String doubleToString(Double number, String numberOfDouble){
return String.format("%."+ numberOfDouble+"f", number).replace(",",".");
}
public String doubleToString(Double number){
return String.format("%.1f", number).replace(",",".");
}
public String doubleToStringRound(Double number){
return String.format("%.0f", number).replace(",",".");
}
public String doubleToStringFull(Double number){
return String.format("%s", number).replace(",",".");
}
public String parseNullString(String s){
String result = "";
if(s != null){
result = s;
}
return result;
}
public int floatToInteger(float f){
int result = 0;
String temp = "0";
temp = String.format("%.0f", f);
if(temp != null){
try {
result = Integer.parseInt(temp);
}catch (Exception e){
e.printStackTrace();
}
}
return result;
}
public String toPercent(String value){
return String.valueOf(Float.parseFloat(value) * 100) + " %";
}
//endregion
public TextWatcher textChangeListenerCurrency(final EditText editText) {
return 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) {
editText.removeTextChangedListener(this);
String originalString = s.toString();
/*if(originalString.contains(",")){
originalString = originalString.replaceAll(",", "");
}
if(originalString.contains(".")){
originalString = originalString.replaceAll("\\.", "");
}*/
originalString = originalString.replace(",", "").replace(".","");
DecimalFormat formatter = new DecimalFormat();
String stringConvert = "0";
try {
stringConvert = formatter.format(Double.parseDouble(originalString));
}catch (NumberFormatException e){
e.printStackTrace();
}
editText.setText(stringConvert);
editText.setSelection(editText.getText().length());
editText.addTextChangedListener(this);
}
};
}
public void setCurrencyFormatOnFocus(final EditText edt){
edt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean b) {
if(b){
String originalString = edt.getText().toString();
originalString = originalString.replaceAll(",", "");
edt.setText(originalString);
}else{
String originalString = edt.getText().toString();
if(originalString.length() > 0 && !originalString.trim().equals("0")){
String pattern = "#,##0.00";
DecimalFormat formatter = new DecimalFormat(pattern);
String formattedString = formatter.format(parseNullFloat(edt.getText().toString()));
//setting text after format to EditText
edt.setText(formattedString);
}
}
}
});
}
//endregion
public void hideSoftKey(Context context){
try {
InputMethodManager inputManager =
(InputMethodManager) context.
getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(
((Activity) context).getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS); ((Activity) context).getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN
);
}catch (Exception e){
e.printStackTrace();
}
}
public boolean isServiceRunning(Context context, Class<?> serviceClass) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
public Bitmap getBitmapFromVectorDrawable(Context context, int drawableId) {
@SuppressLint("RestrictedApi") Drawable drawable = AppCompatDrawableManager.get().getDrawable(context, drawableId);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
drawable = (DrawableCompat.wrap(drawable)).mutate();
}
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return bitmap;
}
public static void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null)
return;
int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.UNSPECIFIED);
int totalHeight = 0;
View view = null;
for (int i = 0; i < listAdapter.getCount(); i++) {
view = listAdapter.getView(i, view, listView);
if (i == 0)
view.setLayoutParams(new ViewGroup.LayoutParams(desiredWidth, ViewGroup.LayoutParams.WRAP_CONTENT));
view.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
totalHeight += view.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
listView.setLayoutParams(params);
}
public String sha256(String message, String key) {
Mac sha256_HMAC = null;
try {
sha256_HMAC = Mac.getInstance("HmacSHA256");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(), "HmacSHA256");
try {
sha256_HMAC.init(secretKey);
} catch (InvalidKeyException e) {
e.printStackTrace();
}
String hash = Base64.encodeToString(sha256_HMAC.doFinal(message.getBytes()), Base64.DEFAULT);
return hash;
}
public String encodeBase64(String value){
String hasil = value;
try {
byte[] encodeValue = Base64.encode(value.getBytes(), Base64.DEFAULT);
hasil = new String(encodeValue);
}catch (Exception e){
e.printStackTrace();
hasil = "";
}
return hasil;
}
public String decodeBase64(String value){
String hasil = value;
try {
byte[] decodeValue = Base64.decode(value.getBytes(), Base64.DEFAULT);
hasil = new String(decodeValue);
}catch (Exception e){
hasil = "";
}
return hasil;
}
public String encodeMD5(String text) {
String result = "";
MessageDigest mdEnc;
try {
mdEnc = MessageDigest.getInstance("MD5");
mdEnc.update(text.getBytes(), 0, text.length());
text = new BigInteger(1, mdEnc.digest()).toString(16);
while (text.length() < 32) {
text = "0" + text;
}
result = text;
} catch (NoSuchAlgorithmException e1) {
e1.printStackTrace();
}
return result;
}
public int getActionBarHeight(Context context) {
final TypedArray styledAttributes = context.getTheme().obtainStyledAttributes(
new int[] { android.R.attr.actionBarSize });
int mActionBarSize = (int) styledAttributes.getDimension(0, 0);
return mActionBarSize;
}
public String getPathFromUri(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {
realPath = getRealPathFromURI_API11to18(context, fileUri);
}
// SDK > 19 (Android 4.4) and up
else {
realPath = getRealPathFromURI_API19(context, fileUri);
}
return realPath;
}
@SuppressLint("NewApi")
public String getRealPathFromURI_API11to18(Context context, Uri contentUri) {
String[] proj = {MediaStore.Images.Media.DATA};
String result = null;
CursorLoader cursorLoader = new CursorLoader(context, contentUri, proj, null, null, null);
Cursor cursor = cursorLoader.loadInBackground();
if (cursor != null) {
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
result = cursor.getString(column_index);
cursor.close();
}
return result;
}
public String getRealPathFromURI_BelowAPI11(Context context, Uri contentUri) {
String[] proj = {MediaStore.Images.Media.DATA};
Cursor cursor = context.getContentResolver().query(contentUri, proj, null, null, null);
int column_index = 0;
String result = "";
if (cursor != null) {
column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
result = cursor.getString(column_index);
cursor.close();
return result;
}
return result;
}
/**
* Get a file path from a Uri. This will get the the path for Storage Access
* Framework Documents, as well as the _data field for the MediaStore and
* other file-based ContentProviders.
*
* @param context The context.
* @param uri The Uri to query.
* @author paulburke
*/
@SuppressLint("NewApi")
public String getRealPathFromURI_API19(final Context context, final Uri uri) {
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider
if (isExternalStorageDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
if ("primary".equalsIgnoreCase(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
// TODO handle non-primary volumes
}
// DownloadsProvider
else if (isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null);
}
// MediaProvider
else if (isMediaDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
Uri contentUri = null;
if ("image".equals(type)) {
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else if ("video".equals(type)) {
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
} else if ("audio".equals(type)) {
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
}
final String selection = "_id=?";
final String[] selectionArgs = new String[]{
split[1]
};
return getDataColumn(context, contentUri, selection, selectionArgs);
}
}
// MediaStore (and general)
else if ("content".equalsIgnoreCase(uri.getScheme())) {
// Return the remote address
if (isGooglePhotosUri(uri))
return uri.getLastPathSegment();
return getDataColumn(context, uri, null, null);
}
// File
else if ("file".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
return null;
}
/**
* Get the value of the data column for this Uri. This is useful for
* MediaStore Uris, and other file-based ContentProviders.
*
* @param context The context.
* @param uri The Uri to query.
* @param selection (Optional) Filter used in the query.
* @param selectionArgs (Optional) Selection arguments used in the query.
* @return The value of the _data column, which is typically a file path.
*/
public String getDataColumn(Context context, Uri uri, String selection,
String[] selectionArgs) {
Cursor cursor = null;
final String column = "_data";
final String[] projection = {
column
};
try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
null);
if (cursor != null && cursor.moveToFirst()) {
final int index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(index);
}
} finally {
if (cursor != null)
cursor.close();
}
return null;
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is ExternalStorageProvider.
*/
public boolean isExternalStorageDocument(Uri uri) {
return "com.android.externalstorage.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is DownloadsProvider.
*/
public boolean isDownloadsDocument(Uri uri) {
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is MediaProvider.
*/
public boolean isMediaDocument(Uri uri) {
return "com.android.providers.media.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is Google Photos.
*/
public boolean isGooglePhotosUri(Uri uri) {
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
}
public boolean isImage(String extiontion){
return (extiontion.equals(".jpeg") || extiontion.equals(".jpg") || extiontion.equals(".png") || extiontion.equals(".bmp"));
}
public static ArrayList<String> getIMEI(Context context) {
ArrayList<String> imeiList = new ArrayList<>();
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try {
if (Build.VERSION.SDK_INT >= 21) {
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
Class<?>[] parameter = new Class[1];
parameter[0] = int.class;
Method getFirstMethod = telephonyClass.getMethod("getDeviceId", parameter);
//Log.d("SimData", getFirstMethod.toString());
Object[] obParameter = new Object[1];
obParameter[0] = 0;
TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String first = (String) getFirstMethod.invoke(telephony, obParameter);
if (first != null && !first.equals("")) imeiList.add(first);
//Log.d("SimData", "first :" + first);
obParameter[0] = 1;
String second = (String) getFirstMethod.invoke(telephony, obParameter);
if (second != null && !second.equals("")) imeiList.add(second);
//Log.d("SimData", "Second :" + second);
} else {
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
}
@SuppressLint("MissingPermission") String first = telephony.getDeviceId();
imeiList.add(first);
}
} catch (Exception e) {
e.printStackTrace();
}
return imeiList;
}
public int exifToDegrees(int exifOrientation) {
if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) { return 90; }
else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) { return 180; }
else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) { return 270; }
return 0;
}
}
| [
"octab39@gmail.com"
] | octab39@gmail.com |
371db34e0bb8c3be44dfec3153cb66b2bb4640ef | e7ba1202e01b54c9b04cd9586de43bc41b839479 | /src/test/java/deliveryConfiguration_Tuseef/step_def/Login_StepDef.java | 2298e973110bd2ccb9849705b132fdd1d29dfea9 | [] | no_license | tuseefmo/TestRepo2nchE | 7c497cd7d33c33f8023cf25af6e4990445aab99f | 62f243e967de012e966c6f7a8d06a6a22115cc46 | refs/heads/master | 2023-06-27T16:01:49.555029 | 2021-08-04T01:59:34 | 2021-08-04T01:59:34 | 392,509,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,187 | java | package deliveryConfiguration_Tuseef.step_def;
import deliveryConfiguration_Tuseef.pages.Login;
import deliveryConfiguration_Tuseef.utilities.BrowserUtils;
import deliveryConfiguration_Tuseef.utilities.ConfigurationReader;
import deliveryConfiguration_Tuseef.utilities.DriverFactory;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.junit.Assert;
import org.openqa.selenium.Keys;
public class Login_StepDef {
Login login = new Login();
@Given("I am on the website")
public void i_am_on_the_website() {
DriverFactory.getDriver().get(ConfigurationReader.getProperty("url"));
BrowserUtils.wait(5);
}
@When("I enter the correct credentials")
public void i_enter_the_correct_credentials() {
login.setLogin();
}
@Then("I should be able to login successfully")
public void i_should_be_able_to_login_successfully() {
String expectedTitle = "Client Center";
//BrowserUtils.waitVisibilityOf(DriverFactory.getDriver().findElement(By.xpath("//title")));
BrowserUtils.wait(1);
Assert.assertEquals("Title verification is failed!!!", "Client Center", DriverFactory.getDriver().getTitle());
}
}
/*
@Given("I am on the search box")
public void iAmOnTheSearchBox() {
System.out.println("I am on the search box");
BrowserUtils.wait(3);
}
@When("I search in as {string}")
public void iSearchInAs(String Canada) {
BrowserUtils.wait(3);
login.searchBox.sendKeys("Canada"+ Keys.ENTER);
}
@Then("I should verify the result shows Canada data sources")
public void iShouldVerifyTheResultShowsCanadaDataSources() {
BrowserUtils.wait(3);
String actual= login.canada.getText();
System.out.println(actual);
BrowserUtils.wait(3);
String expected="Canada Beauty POS Monthly - FF Profile";
Assert.assertEquals(expected,actual);
}
@When("I view the first Run Daemon checkbox")
public void iViewTheFirstRunDaemonCheckbox() {
BrowserUtils.wait(3);
login.firstRD.isSelected();
BrowserUtils.wait(3);
}
@Then("I should verify that the first checkbox is selected")
public void iShouldVerifyThatTheFirstCheckboxIsSelected() {
BrowserUtils.wait(3);
if(login.firstRD.isSelected()){
System.out.println("1st checkbox is selected");
}else{
System.out.println("1st checkbox is NOT selected");}
}
@And("I click the second Run Daemon button to uncheck the box")
public void iClickTheSecondRunDaemonButtonToUncheckTheBox() {
BrowserUtils.wait(3);
login.secondRD.click();
}
@Then("I should verify that second Run Daemon check box is selected")
public void iShouldVerifyThatSecondRunDaemonCheckBoxIsSelected() {
BrowserUtils.wait(3);
if (!login.secondRD.isSelected()) {
System.out.println("2nd checkbox is NOT selected");
}else{
System.out.println("2nd checkbox is selected");
}
*/
| [
"tuseef.mohammed@npd.com"
] | tuseef.mohammed@npd.com |
a88d12f385297d8ef0014f4af507a19b8255534b | d2d8c690576ef68d8ce788eb8da1753d3cc25294 | /src/main/java/com/konduto/sdk/models/KondutoHotelRoom.java | 7dd8de04f47e406d9376fae809cb97e486773534 | [] | no_license | wendelas/java-sdk | cf3bb4b9d5d7f3e03400425babcfd08fbf5ef92d | c4e890a53ea5237a86e9fcb422484d4a6a204807 | refs/heads/master | 2021-01-19T17:11:48.114653 | 2016-11-23T16:21:41 | 2016-11-23T16:21:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,248 | java | package com.konduto.sdk.models;
import com.google.gson.annotations.SerializedName;
import com.google.gson.JsonParseException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/**
*
* Hotel Room model.
*
* @see <a href="http://docs.konduto.com">Konduto API Spec</a>
*
*/
public class KondutoHotelRoom extends KondutoModel {
private String number;
private String code;
private String type;
@SerializedName("check_in_date")
private String checkinDate; // format: yyyy-MM-ddT2018-12-25T18:00Z
@SerializedName("check_out_date")
private String checkoutDate; // format: yyyy-MM-ddT2018-12-25T18:00Z
@SerializedName("number_of_guests")
private int numberOfGuests;
@SerializedName("board_basis")
private String boardBasis;
private Collection<KondutoGuest> guests;
public KondutoHotelRoom(){}
/* Equals */
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
KondutoHotelRoom that = (KondutoHotelRoom) object;
if (numberOfGuests != that.numberOfGuests) return false;
if (number != null ? !number.equals(that.number) : that.number != null) return false;
if (code != null ? !code.equals(that.code) : that.code != null) return false;
if (type != null ? !type.equals(that.type) : that.type != null) return false;
if (checkinDate != null ? !checkinDate.equals(that.checkinDate) : that.checkinDate != null) return false;
if (checkoutDate != null ? !checkoutDate.equals(that.checkoutDate) : that.checkoutDate != null) return false;
if (boardBasis != null ? !boardBasis.equals(that.boardBasis) : that.boardBasis != null) return false;
if (guests != null ? !guests.equals(that.guests) : that.guests != null) return false;
return true;
}
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (number != null ? number.hashCode() : 0);
result = 31 * result + (code != null ? code.hashCode() : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (checkinDate != null ? checkinDate.hashCode() : 0);
result = 31 * result + (checkoutDate != null ? checkoutDate.hashCode() : 0);
result = 31 * result + numberOfGuests;
result = 31 * result + (boardBasis != null ? boardBasis.hashCode() : 0);
result = 31 * result + (guests != null ? guests.hashCode() : 0);
return result;
}
public static final String dateFormat = "yyyy-MM-dd";
private Date deserializeDate(String date) throws JsonParseException {
try {
return new SimpleDateFormat(dateFormat, Locale.US).parse(date);
} catch (ParseException e) {
e.printStackTrace();
throw new JsonParseException("Unparseable date: \"" + date
+ "\". Supported format: " + dateFormat);
}
}
private String serializeDate(Date src) {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
return sdf.format(src).replace("+0000", "Z");
}
/* Getters and Setters */
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Date getCheckinDate() {
return deserializeDate(checkinDate);
}
public void setCheckinDate(Date checkinDate) {
this.checkinDate = serializeDate(checkinDate);
}
public Date getCheckoutDate() {
return deserializeDate(checkoutDate);
}
public void setCheckoutDate(Date checkoutDate) {
this.checkoutDate = serializeDate(checkoutDate);
}
public int getNumberOfGuests() {
return numberOfGuests;
}
public void setNumberOfGuests(int numberOfGuests) {
this.numberOfGuests = numberOfGuests;
}
public String getBoardBasis() {
return boardBasis;
}
public void setBoardBasis(String boardBasis) {
this.boardBasis = boardBasis;
}
public Collection<KondutoGuest> getGuests() {
return guests;
}
public void setGuests(Collection<KondutoGuest> guests) {
this.guests = guests;
}
} | [
"andre@konduto.com"
] | andre@konduto.com |
2152303badc5c7c0be2a5c331fece20e953777f3 | c8cb0df2189886e205672fcbdcf77e65b08f0a0f | /src/main/java/xyz/enhorse/BaseRecorder.java | d5c78ccff59d7992177a6e7709ad4435c5114931 | [
"MIT"
] | permissive | pavelkalinin/contents-for-md | 3a9dea116dc2482605c6fad8e913fd3712f70914 | 22f2151f02eeefdfdc7160067791d6325aeb7488 | refs/heads/master | 2020-05-25T15:41:21.304268 | 2016-10-12T16:09:10 | 2016-10-12T16:09:10 | 70,313,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,104 | java | package xyz.enhorse;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
/**
* @author <a href="mailto:pavel13kalinin@gmail.com">Pavel Kalinin</a>
* 08/10/16
*/
public class BaseRecorder implements Recorder {
private final BufferedWriter writer;
public BaseRecorder(final Writer writer) {
this.writer = initialize(writer);
}
@Override
public void record(final String string) {
try {
writer.write(string);
writer.flush();
} catch (IOException e) {
throw new IllegalStateException("Error record the string: \'" + string + '\'');
}
}
@Override
public void close() throws IOException {
writer.close();
}
private static BufferedWriter initialize(final Writer writer) {
if (writer == null) {
throw new IllegalStateException("Initialization error: Writer is null");
}
return (writer instanceof BufferedWriter)
? (BufferedWriter) writer
: new BufferedWriter(writer);
}
}
| [
"pavel13kalinin@gmail.com"
] | pavel13kalinin@gmail.com |
8e280ac1869ca67f0fb95cc825249b966c47eea6 | d280800ca4ec277f7f2cdabc459853a46bf87a7c | /spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/package-info.java | 190ef4607d79b57093c46a7728d08465fef8f2cc | [
"Apache-2.0"
] | permissive | qqqqqcjq/spring-boot-2.1.x | e5ca46d93eeb6a5d17ed97a0b565f6f5ed814dbb | 238ffa349a961d292d859e6cc2360ad53b29dfd0 | refs/heads/master | 2023-03-12T12:50:11.619493 | 2021-03-01T05:32:52 | 2021-03-01T05:32:52 | 343,275,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 743 | java | /*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Server side TCP tunnel support.
*/
package org.springframework.boot.devtools.tunnel.server;
| [
"caverspark@163.com"
] | caverspark@163.com |
d94c4a251741c56f7a827efb159e6b37e9639d1c | 98f035e1128399725a8f2afd679fabc4bae8d0ab | /src/org/moeaframework/algorithm/AbstractEvolutionaryAlgorithm.java | bf7a72163c9f7f8137280c8d5f7917d1db0f0ba5 | [] | no_license | mutazaltarawneh/iFogSim-NSGA | e24b8c8158f8e39c57b0a6a56b792563b92451c6 | 7b3742e7ad079f99fb99a383cc92132fe59d74bb | refs/heads/master | 2023-01-30T04:30:58.736264 | 2020-12-14T12:15:54 | 2020-12-14T12:15:54 | 321,310,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,540 | java | /* Copyright 2009-2018 David Hadka
*
* This file is part of the MOEA Framework.
*
* The MOEA Framework 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 3 of the License, or (at your
* option) any later version.
*
* The MOEA Framework 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 the MOEA Framework. If not, see <http://www.gnu.org/licenses/>.
*/
package org.moeaframework.algorithm;
import java.io.NotSerializableException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.moeaframework.core.EvolutionaryAlgorithm;
import org.moeaframework.core.Initialization;
import org.moeaframework.core.NondominatedPopulation;
import org.moeaframework.core.Population;
import org.moeaframework.core.Problem;
import org.moeaframework.core.Solution;
/**
* Abstract class providing default implementations for several
* {@link EvolutionaryAlgorithm} methods. Primarily, the {@link #initialize()}
* method generates and evaluates the initial population, adding the solutions
* to the archive if available. The {@link #getResult()} method returns the
* non-dominated solutions from the population and, if available, the archive.
* The majority of evolutionary algorithms should only need to override the
* {@link #iterate()} method.
*/
public abstract class AbstractEvolutionaryAlgorithm extends AbstractAlgorithm
implements EvolutionaryAlgorithm {
/**
* The current population.
*/
protected final Population population;
/**
* The archive storing the non-dominated solutions.
*/
protected final NondominatedPopulation archive;
/**
* The initialization operator.
*/
protected final Initialization initialization;
/**
* Constructs an abstract evolutionary algorithm.
*
* @param problem the problem being solved
* @param population the population
* @param archive the archive storing the non-dominated solutions
* @param initialization the initialization operator
*/
public AbstractEvolutionaryAlgorithm(Problem problem,
Population population, NondominatedPopulation archive,
Initialization initialization) {
super(problem);
this.population = population;
this.archive = archive;
this.initialization = initialization;
}
@Override
public NondominatedPopulation getResult() {
Population population = getPopulation();
NondominatedPopulation archive = getArchive();
NondominatedPopulation result = new NondominatedPopulation();
result.addAll(population);
if (archive != null) {
result.addAll(archive);
}
return result;
}
@Override
protected void initialize() {
super.initialize();
Population population = getPopulation();
NondominatedPopulation archive = getArchive();
Solution[] initialSolutions = initialization.initialize();
evaluateAll(initialSolutions);
population.addAll(initialSolutions);
if (archive != null) {
archive.addAll(population);
}
}
@Override
public NondominatedPopulation getArchive() {
return archive;
}
@Override
public Population getPopulation() {
return population;
}
@Override
public Serializable getState() throws NotSerializableException {
if (!isInitialized()) {
throw new AlgorithmInitializationException(this,
"algorithm not initialized");
}
List<Solution> populationList = new ArrayList<Solution>();
List<Solution> archiveList = new ArrayList<Solution>();
for (Solution solution : population) {
populationList.add(solution);
}
if (archive != null) {
for (Solution solution : archive) {
archiveList.add(solution);
}
}
return new EvolutionaryAlgorithmState(getNumberOfEvaluations(),
populationList, archiveList);
}
@Override
public void setState(Object objState) throws NotSerializableException {
super.initialize();
EvolutionaryAlgorithmState state = (EvolutionaryAlgorithmState)objState;
numberOfEvaluations = state.getNumberOfEvaluations();
population.addAll(state.getPopulation());
if (archive != null) {
archive.addAll(state.getArchive());
}
}
/**
* Proxy for serializing and deserializing the state of an
* {@code AbstractEvolutionaryAlgorithm}. This proxy supports saving
* the {@code numberOfEvaluations}, {@code population} and {@code archive}.
*/
private static class EvolutionaryAlgorithmState implements Serializable {
private static final long serialVersionUID = -6186688380313335557L;
/**
* The number of objective function evaluations.
*/
private final int numberOfEvaluations;
/**
* The population stored in a serializable list.
*/
private final List<Solution> population;
/**
* The archive stored in a serializable list.
*/
private final List<Solution> archive;
/**
* Constructs a proxy to serialize and deserialize the state of an
* {@code AbstractEvolutionaryAlgorithm}.
*
* @param numberOfEvaluations the number of objective function
* evaluations
* @param population the population stored in a serializable list
* @param archive the archive stored in a serializable list
*/
public EvolutionaryAlgorithmState(int numberOfEvaluations,
List<Solution> population, List<Solution> archive) {
super();
this.numberOfEvaluations = numberOfEvaluations;
this.population = population;
this.archive = archive;
}
/**
* Returns the number of objective function evaluations.
*
* @return the number of objective function evaluations
*/
public int getNumberOfEvaluations() {
return numberOfEvaluations;
}
/**
* Returns the population stored in a serializable list.
*
* @return the population stored in a serializable list
*/
public List<Solution> getPopulation() {
return population;
}
/**
* Returns the archive stored in a serializable list.
*
* @return the archive stored in a serializable list
*/
public List<Solution> getArchive() {
return archive;
}
}
}
| [
"user@Users-iMac.local"
] | user@Users-iMac.local |
0a77a205640bcf879e9fcb0b222b1881a2433ec5 | b2612fafa5a9e094ad263adbfebe63632aa34e12 | /gx-etl-core/src/main/java/com/geostax/etl/serialization/EventDeserializer.java | c5eb62dd7d75d25f7cc5e69fd2cf82b11849c57f | [] | no_license | geostax/gx-etl | e11f841054fdb5a29837a84b50a99427f11250fa | 574bc98eca290b24a096eac6e241767ea50c29c7 | refs/heads/master | 2021-09-01T09:45:06.904173 | 2017-11-29T10:37:14 | 2017-12-26T09:21:02 | 109,246,506 | 3 | 5 | null | null | null | null | UTF-8 | Java | false | false | 3,104 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.geostax.etl.serialization;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import org.apache.flume.Event;
import com.geostax.etl.Context;
import com.geostax.etl.annotations.InterfaceAudience;
import com.geostax.etl.annotations.InterfaceStability;
/**
* Establishes a contract for reading events stored in arbitrary formats from
* reliable, resettable streams.
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface EventDeserializer extends Resettable, Closeable {
/**
* Read a single event from the underlying stream.
* @return Deserialized event or {@code null} if no events could be read.
* @throws IOException
* @see #mark()
* @see #reset()
*/
public Event readEvent() throws IOException;
/**
* Read a batch of events from the underlying stream.
* @param numEvents Maximum number of events to return.
* @return List of read events, or empty list if no events could be read.
* @throws IOException
* @see #mark()
* @see #reset()
*/
public List<Event> readEvents(int numEvents) throws IOException;
/**
* Marks the underlying input stream, indicating that the events previously
* returned by this EventDeserializer have been successfully committed.
* @throws IOException
* @see #reset()
*/
@Override
public void mark() throws IOException;
/**
* Resets the underlying input stream to the last known mark (or beginning
* of the stream if {@link #mark()} was never previously called. This should
* be done in the case of inability to commit previously-deserialized events.
* @throws IOException
* @see #mark()
*/
@Override
public void reset() throws IOException;
/**
* Calls {@link #reset()} on the stream and then closes it.
* In the case of successful completion of event consumption,
* {@link #mark()} MUST be called before {@code close()}.
* @throws IOException
* @see #mark()
* @see #reset()
*/
@Override
public void close() throws IOException;
/**
* Knows how to construct this deserializer.<br/>
* <b>Note: Implementations MUST provide a public a no-arg constructor.</b>
*/
public interface Builder {
public EventDeserializer build(Context context, ResettableInputStream in);
}
}
| [
"lsgi.xiaofei@gmail.com"
] | lsgi.xiaofei@gmail.com |
86b03f2ef2de9f689e3ed52f22c7431cef8e48ac | 0c798709f260558d5eb7cae20ba2ac79a5a59d85 | /Learn/src/com/omt/learn/algo/allAlgos/NextHigherNumber.java | b03d64d4c66e356f60417f6c317c149c5e07181a | [] | no_license | sonalirungta/learning | 300fe11b79490d93495a3bdba37311b4d5e7c4df | ba31064e0561072afd23cdaf2483715512ffa20f | refs/heads/master | 2020-07-07T23:21:54.063485 | 2019-07-03T15:53:01 | 2019-07-03T15:53:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,019 | java | package com.omt.learn.algo.allAlgos;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class NextHigherNumber {
public static void main(String[] args) {
System.out.println("Next Highter Number from 1234 is :" + getNextHigherNumber(1234));
System.out.println("Next Highter Number from 4132 is :" + getNextHigherNumber(4132));
System.out.println("Next Highter Number from 4321 is :" + getNextHigherNumber(4321));
System.out.println("Next Highter Number from 32876 is :" + getNextHigherNumber(32876));
System.out.println("Next Highter Number from 32841 is :" + getNextHigherNumber(32841));
}
public static int getNextHigherNumber(int number) {
int n = 0;
int d1Index = -1;
int d2Index = -1;
int count = 0;
List<Integer> numbers = getNumbers(number);
for (int i = numbers.size() - 1; i > count; i--) {
if (d1Index < 0) {
if (numbers.get(i - 1) < numbers.get(i)) {
d1Index = i - 1;
count = d1Index;
i = numbers.size();
}
} else if (d1Index == i) {
break;
} else if (numbers.get(i) > numbers.get(d1Index)) {
d2Index = i;
int d1 = numbers.get(d1Index);
int d2 = numbers.get(d2Index);
numbers.remove(d1Index);
numbers.add(d1Index, d2);
numbers.remove(d2Index);
numbers.add(d2Index, d1);
break;
}
}
if (d1Index > -1 && d2Index > -1) {
int a[] = new int[numbers.size() - 1 - d1Index];
int j = 0;
for (int i = d1Index + 1; i < numbers.size(); i++) {
a[j++] = numbers.get(i);
}
Arrays.sort(a);
String ns = "";
for (int i = 0; i < d1Index + 1; i++) {
ns += numbers.get(i);
}
for (int i : a) {
ns += i;
}
n = Integer.parseInt(ns);
}
return n;
}
public static List<Integer> getNumbers(int number) {
List<Integer> l = new ArrayList<>();
if (number > 9) {
int result = number / 10;
int carry = number % 10;
l.addAll(getNumbers(result));
l.addAll(getNumbers(carry));
} else {
l.add(number);
}
return l;
}
}
| [
"dhiralpandya@gmail.com"
] | dhiralpandya@gmail.com |
b13c6392c3627befa164b93921962bade9215a0d | 9d17e32d50117cd71e2a55b822d3bfdbb85931e0 | /src/main/java/com/wanda/bean/ReceptionRecord.java | 8a48bac3a85cadffb6d8a927996cf87d17443b61 | [] | no_license | lzy645892551/springmvc | 0bb3abb364ddd523e881105106cc0bb358c39a9f | d98b757c2e7f3f76ff27bc7fd0d0909d94eecab9 | refs/heads/master | 2020-03-23T04:53:01.342071 | 2018-07-16T08:38:24 | 2018-07-16T08:38:24 | 141,110,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,478 | java | package com.wanda.bean;
import java.util.Date;
public class ReceptionRecord {
private String receptionRecordId;
private String userId;
private String userName;
private String number;
private Date receptionTime;
private String receptionMode;
private String receptionContent;
private String customerId;
private String customerName;
private Integer times;
private String updateUser;
private Date updateTime;
private String deleteUser;
private Date deleteTime;
private String deleteState;
public String getReceptionRecordId() {
return receptionRecordId;
}
public void setReceptionRecordId(String receptionRecordId) {
this.receptionRecordId = receptionRecordId == null ? null : receptionRecordId.trim();
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number == null ? null : number.trim();
}
public Date getReceptionTime() {
return receptionTime;
}
public void setReceptionTime(Date receptionTime) {
this.receptionTime = receptionTime;
}
public String getReceptionMode() {
return receptionMode;
}
public void setReceptionMode(String receptionMode) {
this.receptionMode = receptionMode == null ? null : receptionMode.trim();
}
public String getReceptionContent() {
return receptionContent;
}
public void setReceptionContent(String receptionContent) {
this.receptionContent = receptionContent == null ? null : receptionContent.trim();
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId == null ? null : customerId.trim();
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName == null ? null : customerName.trim();
}
public Integer getTimes() {
return times;
}
public void setTimes(Integer times) {
this.times = times;
}
public String getUpdateUser() {
return updateUser;
}
public void setUpdateUser(String updateUser) {
this.updateUser = updateUser == null ? null : updateUser.trim();
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getDeleteUser() {
return deleteUser;
}
public void setDeleteUser(String deleteUser) {
this.deleteUser = deleteUser == null ? null : deleteUser.trim();
}
public Date getDeleteTime() {
return deleteTime;
}
public void setDeleteTime(Date deleteTime) {
this.deleteTime = deleteTime;
}
public String getDeleteState() {
return deleteState;
}
public void setDeleteState(String deleteState) {
this.deleteState = deleteState == null ? null : deleteState.trim();
}
} | [
"645892551@qq.com"
] | 645892551@qq.com |
0f97c763513ce8c110c61ec8d5bc3cbe8186df47 | dd3eec242deb434f76d26b4dc0e3c9509c951ce7 | /2018-work/jiuy-biz/jiuy-biz-core/src/main/java/com/store/service/ShopCategoryService.java | 8a2ebf95965819ab0fe1ecd3aab41a9ccbb39321 | [] | no_license | github4n/other_workplace | 1091e6368abc51153b4c7ebbb3742c35fb6a0f4a | 7c07e0d078518bb70399e50b35e9f9ca859ba2df | refs/heads/master | 2020-05-31T10:12:37.160922 | 2019-05-25T15:48:54 | 2019-05-25T15:48:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,214 | java | package com.store.service;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jiuyuan.constant.DateConstants;
import com.jiuyuan.constant.MemcachedKey;
import com.jiuyuan.service.common.MemcachedService;
import com.store.dao.mapper.CategoryMapper;
import com.store.entity.ShopCategory;
@Service
public class ShopCategoryService {
@Autowired
private CategoryMapper categoryMapper;
@Autowired
private MemcachedService memcachedService;
@SuppressWarnings("unchecked")
public List<ShopCategory> getCategories() {
String groupKey = MemcachedKey.GROUP_KEY_CATEGORY;
String key = "all";
Object obj = memcachedService.get(groupKey, key);
if (obj != null) {
return (List<ShopCategory>) obj;
}
List<ShopCategory> categories = categoryMapper.getCategories();
if (CollectionUtils.isNotEmpty(categories)) {
memcachedService.set(groupKey, key, DateConstants.SECONDS_TEN_MINUTES, categories);
}
return categories;
}
public List<ShopCategory> getCategoriesByIdsArr(String [] arr) {
return categoryMapper.getCategoriesByIdsArr( arr);
}
public List<ShopCategory> getParentCategories() {
String groupKey = MemcachedKey.GROUP_KEY_CATEGORY;
String key = "parent";
Object obj = memcachedService.get(groupKey, key);
if (obj != null) {
return (List<ShopCategory>) obj;
}
List<ShopCategory> categories = categoryMapper.getParentCategories();
if (CollectionUtils.isNotEmpty(categories)) {
memcachedService.set(groupKey, key, DateConstants.SECONDS_TEN_MINUTES, categories);
}
return categories;
}
public List<ShopCategory> getAllParentCategories() {
List<ShopCategory> categories = categoryMapper.getAllParentCategories();
return categories;
}
public List<ShopCategory> getChildCategoryByParentId(long parentId) {
List<ShopCategory> childCategories = categoryMapper.getChildCategoryByParentId(parentId);
return childCategories;
}
} | [
"nessary@foxmail.com"
] | nessary@foxmail.com |
dc7804e717bd3cabf2b21b20f898de8d13879de3 | cbeec50eee99e3fd603d2144f9e6d51b1d63593e | /Gestion_de_stock_mvc/src/main/resources/com/stock/mvc/services/impl/FournisseurServiceImpl.java | 1c4d7a5f9e1450fb4a7f0ee2061bab255da12504 | [] | no_license | waeelll/mvc | fb374ec8548add914d7f1b00e9bb6a702fb369b0 | 3ee4bf518b37ff6ff0021e75fd317a1cacbe5ef2 | refs/heads/master | 2022-12-26T07:05:53.912157 | 2019-06-27T14:45:53 | 2019-06-27T14:45:53 | 193,480,989 | 0 | 0 | null | 2022-12-16T00:57:15 | 2019-06-24T10:05:26 | CSS | UTF-8 | Java | false | false | 1,362 | java | package com.stock.mvc.services.impl;
import java.util.List;
import com.stock.mvc.services.IFournisseurService;
import com_stock_mvc_entities.Fournisseur;
public class FournisseurServiceImpl implements IFournisseurService{
@Override
public Fournisseur save(Fournisseur entity) {
// TODO Auto-generated method stub
return null;
}
@Override
public Fournisseur update(Fournisseur entity) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Fournisseur> selectAll() {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Fournisseur> selectAll(String sortfiled, String sort) {
// TODO Auto-generated method stub
return null;
}
@Override
public Fournisseur getById(long id) {
// TODO Auto-generated method stub
return null;
}
@Override
public void remove(long id) {
// TODO Auto-generated method stub
}
@Override
public Fournisseur findone(String paramName, Object paramValue) {
// TODO Auto-generated method stub
return null;
}
@Override
public Fournisseur findOne(String[] paramNames, Object[] paramValues) {
// TODO Auto-generated method stub
return null;
}
@Override
public int findCountBy(String paramNames, String paramValues) {
// TODO Auto-generated method stub
return 0;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
875c42e750f5f2a36c32a0cf0917431d1e689eb4 | 1f245bd89fc6c290bea3bb706b7e8a896920bf4b | /src/main/java/com/example/javase/controller/sbstractController.java | 1f340d502f5f002849ee555698009d2ff2add7f7 | [] | no_license | lilacfover/javaSE | 76f974e9a8fc328b8a0ccbe895b3e666cb3a1a8b | 8bdc3709f6cd3618a59db5486650535bb279735c | refs/heads/master | 2021-06-17T06:10:39.543738 | 2019-10-25T09:54:59 | 2019-10-25T09:54:59 | 199,389,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package com.example.javase.controller;
import com.example.javase.templatedesign.templatefuntion.SubDemo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.example.javase.templatedesign.templatefuntion.*;
import org.springframework.web.bind.annotation.ResponseBody;
/*
作者:蔡伟
时间:2019/8/7
描述:
*/
@Controller
public class sbstractController {
private static final Logger logger = LoggerFactory.getLogger(sbstractController.class);
@RequestMapping(value = "abstract")
@ResponseBody
public String test() {
SubDemo subDemo = new SubDemo();
subDemo.getTime();
TestGetTimeDemo testGetTimeDemo = new TestGetTimeDemo();
testGetTimeDemo.getTime();
return "success";
}
}
| [
"1522933428@qq.com"
] | 1522933428@qq.com |
aa2abf4fc3e46747fe68d84ea1494011b56720c5 | 4aa90348abcb2119011728dc067afd501f275374 | /app/src/main/java/com/tencent/mm/plugin/wallet_core/ui/view/c.java | 862cac767623325826c11d6dafbc9c14d04d717f | [] | no_license | jambestwick/HackWechat | 0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6 | 6a34899c8bfd50d19e5a5ec36a58218598172a6b | refs/heads/master | 2022-01-27T12:48:43.446804 | 2021-12-29T10:36:30 | 2021-12-29T10:36:30 | 249,366,791 | 0 | 0 | null | 2020-03-23T07:48:32 | 2020-03-23T07:48:32 | null | UTF-8 | Java | false | false | 2,666 | java | package com.tencent.mm.plugin.wallet_core.ui.view;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import com.tencent.mm.modelsfs.FileOp;
import com.tencent.mm.platformtools.i;
import com.tencent.mm.platformtools.i.a;
import com.tencent.mm.platformtools.i.b;
import com.tencent.mm.sdk.platformtools.d;
import com.tencent.mm.sdk.platformtools.x;
import java.io.File;
import java.io.IOException;
public final class c implements i {
private b lif = new 1(this);
private String url;
public c(String str) {
this.url = str;
}
public final String Wf() {
return com.tencent.mm.plugin.wallet_core.d.b.Hu(this.url);
}
public final String Wg() {
return this.url;
}
public final String Wh() {
return this.url;
}
public final String Wi() {
return this.url;
}
public final boolean Wj() {
return true;
}
public final boolean Wk() {
return false;
}
public final Bitmap Wl() {
return null;
}
public final Bitmap a(Bitmap bitmap, a aVar, String str) {
if (a.NET == aVar) {
if (bitmap == null || bitmap.getNinePatchChunk() == null) {
try {
d.a(bitmap, 100, CompressFormat.PNG, com.tencent.mm.plugin.wallet_core.d.b.Hu(this.url), false);
} catch (IOException e) {
try {
File file = new File(com.tencent.mm.plugin.wallet_core.d.b.bMk());
if (!file.exists()) {
file.mkdir();
}
x.w("MicroMsg.WalletGetPicStrategy", " retry saving bitmap");
d.a(bitmap, 100, CompressFormat.PNG, com.tencent.mm.plugin.wallet_core.d.b.Hu(this.url), false);
} catch (Throwable e2) {
x.printErrStackTrace("MicroMsg.WalletGetPicStrategy", e2, "", new Object[0]);
x.w("MicroMsg.WalletGetPicStrategy", "save bitmap fail");
}
}
} else {
x.v("MicroMsg.WalletGetPicStrategy", " get the ninePathchChunk");
FileOp.x(str, com.tencent.mm.plugin.wallet_core.d.b.Hu(this.url));
return bitmap;
}
}
x.d("MicroMsg.WalletGetPicStrategy", "get bitmap, from %s", aVar.toString());
return bitmap;
}
public final void Wm() {
}
public final void N(String str, boolean z) {
}
public final void a(a aVar, String str) {
}
public final b We() {
return this.lif;
}
}
| [
"malin.myemail@163.com"
] | malin.myemail@163.com |
cda1472326a7ac09203d0f01d1b448fccefde61d | 7867b235aab22cb2c4499f11c429294758891697 | /app/src/main/java/com/codemountain/shoppadiclient/utils/BottomNavHelper.java | 342393e34af6537660eb080c3edccfc30f61ac03 | [] | no_license | HenryUdorji/Shop-padi | 3ff9486950e6b3acdb4d5e82638059d77e70a076 | 074ddd2543cd6c697ca8a7f2bcd9665fd6c56c99 | refs/heads/master | 2023-01-27T15:12:04.013322 | 2020-12-05T01:08:49 | 2020-12-05T01:08:49 | 296,990,459 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,105 | java | package com.codemountain.shoppadiclient.utils;
import android.content.Context;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.codemountain.shoppadiclient.R;
import com.codemountain.shoppadiclient.activity.HomeActivity;
import com.codemountain.shoppadiclient.fragments.AccountFragment;
import com.codemountain.shoppadiclient.fragments.CartFragment;
import com.codemountain.shoppadiclient.fragments.HomeFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;
public class BottomNavHelper {
public static void enableNavigation(final Context context, BottomNavigationView bottomNavigationView){
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
FragmentManager manager;
FragmentTransaction transaction;
switch (item.getItemId()){
case R.id.nav_home:
//context.startActivity(new Intent(context, HomeActivity.class));
//((HomeActivity)context).overridePendingTransition(R.anim.fadein, R.anim.fadeout);
HomeFragment homeFragment= new HomeFragment();
manager = ((HomeActivity)context).getSupportFragmentManager();
transaction = manager.beginTransaction();
transaction.replace(R.id.container, homeFragment, "HOME");
transaction.commit();
return true;
case R.id.nav_cart:
//context.startActivity(new Intent(context, CartActivity.class));
//((HomeActivity)context).overridePendingTransition(R.anim.fadein, R.anim.fadeout);
CartFragment cartFragment = new CartFragment();
manager = ((HomeActivity)context).getSupportFragmentManager();
transaction = manager.beginTransaction();
transaction.replace(R.id.container, cartFragment, "CART");
transaction.commit();
return true;
case R.id.nav_account:
//context.startActivity(new Intent(context, AccountActivity.class));
//((CartActivity)context).overridePendingTransition(R.anim.fadein, R.anim.fadeout);
AccountFragment accountFragment = new AccountFragment();
manager = ((HomeActivity)context).getSupportFragmentManager();
transaction = manager.beginTransaction();
transaction.replace(R.id.container, accountFragment, "ACCOUNT");
transaction.commit();
return true;
}
return false;
}
});
}
}
| [
"henryUdorji@gmail.com"
] | henryUdorji@gmail.com |
0f16e91c79e61e3efc3e24fdfe2ae43c8f1e0a3d | de764192481a850baaf3251120c430882911afd9 | /src/com/gxb/threadcoreknowledge/juc/pool/CompletableFutureDemo.java | 518be82b68dca50ce1b48352d5fd78d0a11c979e | [] | no_license | zyyawin/JavaNotebook | 9f25c60c3da1d911c3541962659600c3f23d88ea | 0632d4cf529bff731efef169e92891f1a653560e | refs/heads/master | 2022-04-17T20:57:03.921493 | 2020-04-19T14:29:48 | 2020-04-19T14:29:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package com.gxb.threadcoreknowledge.juc.pool;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
public class CompletableFutureDemo {
public static void main(String[] args) throws ExecutionException, InterruptedException {
//同步、异步回调
CompletableFuture<Void> voidCompletableFuture = CompletableFuture.runAsync(() -> {
System.out.println(Thread.currentThread().getName() + "\t completableFuture1");
});
System.out.println(voidCompletableFuture.get());
//异步回调
CompletableFuture<Integer> integerCompletableFuture = CompletableFuture.supplyAsync(() -> {
System.out.println(Thread.currentThread().getName() + "\t completableFuture2");
// int i = 10 / 0;
return 1024;
});
System.out.println(integerCompletableFuture.whenComplete((integer, throwable) -> {
System.out.println("integer:" + integer);
System.out.println("throwable:" + throwable.getMessage());
}).exceptionally(throwable -> {
System.out.println("exception:" + throwable.getMessage());
return 404;
}).get());
}
}
| [
"535758155@qq.com"
] | 535758155@qq.com |
9091049f6e6170db62cc533414baff7573f824b1 | 2c59f0be7c7c4c9b70169c1ac705b4f354c85590 | /LAB4/EXTRA/DFSIterator.java | 31b218fd3d580bc2e6c2b36ff978b95a62a0bd73 | [] | no_license | chrismessiah/KTH-SoftwareEngineering | 43149385a731ea080f6347b0a9d01c858986a12f | 9fa8cfecd303bf42b187db047752e6771a3d790a | refs/heads/master | 2021-05-01T11:50:06.193096 | 2016-10-21T12:21:43 | 2016-10-21T12:21:43 | 59,345,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | import java.util.Stack;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.List;
public class DFSIterator implements Iterator {
Stack<Component> staq;
public DFSIterator(Composite compositeData) {
staq = new Stack<Component>();
staq.push(compositeData);
}
private void listElemsToStack(Composite compositeData, Stack<Component> stack) {
List<Component> componentList = compositeData.getContent();
int size = componentList.size();
for (int i=size-1; i<size; i--) {
Component temp = componentList.get(i);
stack.push(temp);
if (i == 0) {break;}
}
}
public boolean hasNext() {
if (staq.empty()) {
return false;
}
return true;
}
// depth first search
public Component next() {
Component top = staq.pop();
if (top instanceof Composite) {
Composite topComp = (Composite)top;
listElemsToStack(topComp, staq);
}
return top;
}
public void remove() {} // not needed for lab
}
| [
"chrabd@kth.se"
] | chrabd@kth.se |
61de1a5cf71c79d2ada924c09ffa04a7a5623986 | 0a6ed0714cebd25c452a7cd5861614972a366c04 | /src/test/java/com/mycompany/myapp/web/rest/JugadorResourceIntTest.java | a5921ec372c82b785f1c6ae2843789f27c6d772c | [] | no_license | Anunnakifree/liga-baloncesto-j | f851168fefd048594390fb78294a977e29d4992d | 47a90ec7254c3f3cb6e69a1d1340b3349bfbc96e | refs/heads/master | 2016-09-01T11:12:18.506466 | 2016-02-03T20:27:48 | 2016-02-03T20:27:48 | 49,733,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,462 | java | package com.mycompany.myapp.web.rest;
import com.mycompany.myapp.Application;
import com.mycompany.myapp.domain.Jugador;
import com.mycompany.myapp.repository.JugadorRepository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.hamcrest.Matchers.hasItem;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the JugadorResource REST controller.
*
* @see JugadorResource
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@IntegrationTest
public class JugadorResourceIntTest {
private static final String DEFAULT_NOMBRE = "AAAAA";
private static final String UPDATED_NOMBRE = "BBBBB";
private static final LocalDate DEFAULT_FECHA_NACIMIENTO = LocalDate.ofEpochDay(0L);
private static final LocalDate UPDATED_FECHA_NACIMIENTO = LocalDate.now(ZoneId.systemDefault());
private static final Integer DEFAULT_CANASTAS_TOTALES = 1;
private static final Integer UPDATED_CANASTAS_TOTALES = 2;
private static final Integer DEFAULT_REBOTES_TOTALES = 1;
private static final Integer UPDATED_REBOTES_TOTALES = 2;
private static final Integer DEFAULT_ASISTENCIAS_TOTALES = 1;
private static final Integer UPDATED_ASISTENCIAS_TOTALES = 2;
private static final String DEFAULT_POSICION = "AAAAA";
private static final String UPDATED_POSICION = "BBBBB";
@Inject
private JugadorRepository jugadorRepository;
@Inject
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Inject
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
private MockMvc restJugadorMockMvc;
private Jugador jugador;
@PostConstruct
public void setup() {
MockitoAnnotations.initMocks(this);
JugadorResource jugadorResource = new JugadorResource();
ReflectionTestUtils.setField(jugadorResource, "jugadorRepository", jugadorRepository);
this.restJugadorMockMvc = MockMvcBuilders.standaloneSetup(jugadorResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setMessageConverters(jacksonMessageConverter).build();
}
@Before
public void initTest() {
jugador = new Jugador();
jugador.setNombre(DEFAULT_NOMBRE);
jugador.setFechaNacimiento(DEFAULT_FECHA_NACIMIENTO);
jugador.setCanastasTotales(DEFAULT_CANASTAS_TOTALES);
jugador.setRebotesTotales(DEFAULT_REBOTES_TOTALES);
jugador.setAsistenciasTotales(DEFAULT_ASISTENCIAS_TOTALES);
jugador.setPosicion(DEFAULT_POSICION);
}
@Test
@Transactional
public void createJugador() throws Exception {
int databaseSizeBeforeCreate = jugadorRepository.findAll().size();
// Create the Jugador
restJugadorMockMvc.perform(post("/api/jugadors")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(jugador)))
.andExpect(status().isCreated());
// Validate the Jugador in the database
List<Jugador> jugadors = jugadorRepository.findAll();
assertThat(jugadors).hasSize(databaseSizeBeforeCreate + 1);
Jugador testJugador = jugadors.get(jugadors.size() - 1);
assertThat(testJugador.getNombre()).isEqualTo(DEFAULT_NOMBRE);
assertThat(testJugador.getFechaNacimiento()).isEqualTo(DEFAULT_FECHA_NACIMIENTO);
assertThat(testJugador.getCanastasTotales()).isEqualTo(DEFAULT_CANASTAS_TOTALES);
assertThat(testJugador.getRebotesTotales()).isEqualTo(DEFAULT_REBOTES_TOTALES);
assertThat(testJugador.getAsistenciasTotales()).isEqualTo(DEFAULT_ASISTENCIAS_TOTALES);
assertThat(testJugador.getPosicion()).isEqualTo(DEFAULT_POSICION);
}
@Test
@Transactional
public void getAllJugadors() throws Exception {
// Initialize the database
jugadorRepository.saveAndFlush(jugador);
// Get all the jugadors
restJugadorMockMvc.perform(get("/api/jugadors?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.[*].id").value(hasItem(jugador.getId().intValue())))
.andExpect(jsonPath("$.[*].nombre").value(hasItem(DEFAULT_NOMBRE.toString())))
.andExpect(jsonPath("$.[*].fechaNacimiento").value(hasItem(DEFAULT_FECHA_NACIMIENTO.toString())))
.andExpect(jsonPath("$.[*].canastasTotales").value(hasItem(DEFAULT_CANASTAS_TOTALES)))
.andExpect(jsonPath("$.[*].rebotesTotales").value(hasItem(DEFAULT_REBOTES_TOTALES)))
.andExpect(jsonPath("$.[*].asistenciasTotales").value(hasItem(DEFAULT_ASISTENCIAS_TOTALES)))
.andExpect(jsonPath("$.[*].posicion").value(hasItem(DEFAULT_POSICION.toString())));
}
@Test
@Transactional
public void getJugador() throws Exception {
// Initialize the database
jugadorRepository.saveAndFlush(jugador);
// Get the jugador
restJugadorMockMvc.perform(get("/api/jugadors/{id}", jugador.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.id").value(jugador.getId().intValue()))
.andExpect(jsonPath("$.nombre").value(DEFAULT_NOMBRE.toString()))
.andExpect(jsonPath("$.fechaNacimiento").value(DEFAULT_FECHA_NACIMIENTO.toString()))
.andExpect(jsonPath("$.canastasTotales").value(DEFAULT_CANASTAS_TOTALES))
.andExpect(jsonPath("$.rebotesTotales").value(DEFAULT_REBOTES_TOTALES))
.andExpect(jsonPath("$.asistenciasTotales").value(DEFAULT_ASISTENCIAS_TOTALES))
.andExpect(jsonPath("$.posicion").value(DEFAULT_POSICION.toString()));
}
@Test
@Transactional
public void getNonExistingJugador() throws Exception {
// Get the jugador
restJugadorMockMvc.perform(get("/api/jugadors/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateJugador() throws Exception {
// Initialize the database
jugadorRepository.saveAndFlush(jugador);
int databaseSizeBeforeUpdate = jugadorRepository.findAll().size();
// Update the jugador
jugador.setNombre(UPDATED_NOMBRE);
jugador.setFechaNacimiento(UPDATED_FECHA_NACIMIENTO);
jugador.setCanastasTotales(UPDATED_CANASTAS_TOTALES);
jugador.setRebotesTotales(UPDATED_REBOTES_TOTALES);
jugador.setAsistenciasTotales(UPDATED_ASISTENCIAS_TOTALES);
jugador.setPosicion(UPDATED_POSICION);
restJugadorMockMvc.perform(put("/api/jugadors")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(jugador)))
.andExpect(status().isOk());
// Validate the Jugador in the database
List<Jugador> jugadors = jugadorRepository.findAll();
assertThat(jugadors).hasSize(databaseSizeBeforeUpdate);
Jugador testJugador = jugadors.get(jugadors.size() - 1);
assertThat(testJugador.getNombre()).isEqualTo(UPDATED_NOMBRE);
assertThat(testJugador.getFechaNacimiento()).isEqualTo(UPDATED_FECHA_NACIMIENTO);
assertThat(testJugador.getCanastasTotales()).isEqualTo(UPDATED_CANASTAS_TOTALES);
assertThat(testJugador.getRebotesTotales()).isEqualTo(UPDATED_REBOTES_TOTALES);
assertThat(testJugador.getAsistenciasTotales()).isEqualTo(UPDATED_ASISTENCIAS_TOTALES);
assertThat(testJugador.getPosicion()).isEqualTo(UPDATED_POSICION);
}
@Test
@Transactional
public void deleteJugador() throws Exception {
// Initialize the database
jugadorRepository.saveAndFlush(jugador);
int databaseSizeBeforeDelete = jugadorRepository.findAll().size();
// Get the jugador
restJugadorMockMvc.perform(delete("/api/jugadors/{id}", jugador.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isOk());
// Validate the database is empty
List<Jugador> jugadors = jugadorRepository.findAll();
assertThat(jugadors).hasSize(databaseSizeBeforeDelete - 1);
}
}
| [
"carlos.carlosrodiba@gmail.com"
] | carlos.carlosrodiba@gmail.com |
674506728efe31198e8e80e3296d2dd4ead641b0 | 05b5bef9cb9c51388246afcf0daf3d9c07890e52 | /src/main/java/net/avalara/avatax/rest/client/models/IsoCountryModel.java | 776b54da074c17bb268b61c8f3efacf2c93518a8 | [
"Apache-2.0"
] | permissive | junfengcode/AvaTax-REST-V2-JRE-SDK | fb52e989b595846a09021d84738378f98a62238d | 90be726643c804a2ea689f60b4faec5900deb37f | refs/heads/master | 2021-01-19T23:07:56.396666 | 2017-03-16T17:39:31 | 2017-03-16T17:39:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,669 | java | package net.avalara.avatax.rest.client.models;
import net.avalara.avatax.rest.client.enums.*;
import net.avalara.avatax.rest.client.serializer.JsonSerializer;
import java.lang.Override;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
/**
* Represents an ISO 3166 recognized country
*/
public class IsoCountryModel {
private String code;
/**
* Getter for code - Represents an ISO 3166 recognized country
*/
public String getCode() {
return this.code;
}
/**
* Setter for code - Represents an ISO 3166 recognized country
*/
public void setCode(String code) {
this.code = code;
}
private String name;
/**
* Getter for name - Represents an ISO 3166 recognized country
*/
public String getName() {
return this.name;
}
/**
* Setter for name - Represents an ISO 3166 recognized country
*/
public void setName(String name) {
this.name = name;
}
private Boolean isEuropeanUnion;
/**
* Getter for isEuropeanUnion - Represents an ISO 3166 recognized country
*/
public Boolean getIsEuropeanUnion() {
return this.isEuropeanUnion;
}
/**
* Setter for isEuropeanUnion - Represents an ISO 3166 recognized country
*/
public void setIsEuropeanUnion(Boolean isEuropeanUnion) {
this.isEuropeanUnion = isEuropeanUnion;
}
/**
* Returns a JSON string representation of IsoCountryModel.
*/
@Override
public String toString() {
return JsonSerializer.SerializeObject(this);
}
}
| [
"dustin.welden@avalara.com"
] | dustin.welden@avalara.com |
4b4f6d08a17c0c2dffd179abbee9f2e9d59c37f5 | f1c8ef4faa89cad0011db6f873572afa2386cb17 | /src/com/practicepizza/app/Main.java | 5a4182edb161297436df3b15c1065e8e042501b4 | [] | no_license | yorkglez/PracticePizza | e99db52da4d2f9c8a3c66b837085908e23ec1467 | 87f435800b27d156502c0619cbeca20fb9522e80 | refs/heads/master | 2020-08-10T11:38:11.722620 | 2019-10-11T03:21:26 | 2019-10-11T03:21:26 | 214,334,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 808 | java | package com.practicepizza.app;
import java.util.Scanner;
public class Main {
public static void main (String[] args){
//Declarations
byte PizzaSize = 0;
String PizzaType = "";
//Implement scanner
Scanner in = new Scanner(System.in);
//Input from user
System.out.print("Write the size of your pizza: ");
PizzaSize = in.nextByte();
//Process
if(PizzaSize <= 7){
PizzaType = "little";
}
else if(PizzaSize == 12){
PizzaType = "median";
}
else if(PizzaSize == 15){
PizzaType = "big";
}
else if(PizzaSize > 15){
PizzaType = "mega";
}
//Output result
System.out.println("You're pizza is "+PizzaType);
}
}
| [
"bobo_12yors@hotmail.com"
] | bobo_12yors@hotmail.com |
ca2d47a999c456b786a0bff6f0427a52bc2806c6 | 4be8ae384a9148b3518065379fcf25f074faa65f | /Splitwise/src/main/java/com/practice/splitwise/service/impl/UserServiceImpl.java | c9f12ff41258b333d4d933b5857b434aeb6c3548 | [] | no_license | theanubhava/qwertyu | 04cd45c810c0abcbb0a9501732e2e71cc29c5394 | fcc21e44e1e7204db98a30931c39daa6bd53a8ca | refs/heads/master | 2020-09-07T16:38:26.392587 | 2019-11-10T20:47:44 | 2019-11-10T20:47:44 | 220,846,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,454 | java | package com.practice.splitwise.service.impl;
import com.practice.splitwise.dao.UserDAO;
import com.practice.splitwise.pojo.*;
import com.practice.splitwise.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class UserServiceImpl implements UserService {
@Autowired
UserDAO userDAO;
@Override
public String createUsers(List<UserBean> userList) {
return userDAO.createUsers(userList);
}
@Override
public String updateUsers(CreateExpenseRequest expenseReq) {
List<String> userIDList = new ArrayList<>();
userIDList.addAll(expenseReq.getInvolvedUsersID());
userIDList.add(expenseReq.getPaidByUserId());
List<UserBean> userBeanList = userDAO.getUserList(userIDList);
Map<String, UserBean> userIDMap = new HashMap<>();
for (UserBean userBean : userBeanList) {
userIDMap.put(userBean.getId(), userBean);
}
String paidByUserID = expenseReq.getPaidByUserId();
List<UserBean> updatedUserBeanList = new ArrayList<>();
for (Map.Entry<String, Double> e : expenseReq.getPerUserShareMap().entrySet()) {
String paidForUserID = e.getKey();
if(!paidForUserID.equalsIgnoreCase(paidByUserID)) {
UserBean userBean = userIDMap.get(paidForUserID);
userBean.setPaidForMeAmt(userBean.getPaidForMeAmt() + e.getValue());
updatedUserBeanList.add(userBean);
}
}
UserBean userBean = userIDMap.get(paidByUserID);
userBean.setPaidByMeAmt(userBean.getPaidByMeAmt() + expenseReq.getTotAmt() );
updatedUserBeanList.add(userBean);
return userDAO.updateUsers(updatedUserBeanList);
}
@Override
public List<UserBean> getUsers(List<String> userIDList) {
if (userIDList.size() == 0)
return userDAO.getAllUsers();
return userDAO.getUserList(userIDList);
}
@Override
public UserBalances settleUser(String userID) {
List<Transaction> paidByUserTRList = userDAO.getPaidByUserTRList(userID);
List<Transaction> paidForUserTRList = userDAO.getPaidForUserTRList(userID);
Map<String, Double> userBalanceMapCombined = new HashMap<>();
for (Transaction tr : paidByUserTRList) {
if (tr.getPaidByUserID().equalsIgnoreCase(userID)) {
String paidForUser = tr.getPaidForUserID();
double amount = tr.getAmount();
if (userBalanceMapCombined.get(paidForUser) == null)
userBalanceMapCombined.put(paidForUser, amount);
else
userBalanceMapCombined.put(paidForUser, userBalanceMapCombined.get(paidForUser) + amount);
}
}
for (Transaction tr : paidForUserTRList) {
if (tr.getPaidForUserID().equalsIgnoreCase(userID)) {
String paidByUserID = tr.getPaidByUserID();
double amount = tr.getAmount();
if (userBalanceMapCombined.get(paidByUserID) == null)
userBalanceMapCombined.put(paidByUserID, -1 * amount);
else
userBalanceMapCombined.put(paidByUserID, userBalanceMapCombined.get(paidByUserID) - amount);
}
}
UserBalances userBalances = getUserBalanceFromCombiMap(userBalanceMapCombined);
return userBalances;
}
private UserBalances getUserBalanceFromCombiMap(Map<String, Double> userBalanceMapCombined) {
UserBalances userBalances = new UserBalances();
for (Map.Entry<String, Double> en : userBalanceMapCombined.entrySet()) {
if (en.getValue() > 0) {
Map<String, Double> collectMap = new HashMap<>();
collectMap.put(en.getKey(), en.getValue());
userBalances.getCollectFrom().add(collectMap);
}
if (en.getValue() < 0) {
Map<String, Double> payMap = new HashMap<>();
payMap.put(en.getKey(), en.getValue());
userBalances.getPayTo().add(payMap);
}
}
return userBalances;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6a0f94871ad65ae653796a6d35a3ef6f0936623e | d42cecc97ee49203ad1b2b9cc03c9f25a168f73a | /app/src/main/java/totoro/application/xkf/totoroweather/util/TextUtil.java | a198ca9aa969d78311e8e9b13acfa442460dd59f | [] | no_license | BigChaChi/TotoroWeather | f44146c1d33c77823dc2535b3d5b35969f8fd0f1 | bf96f080f10d59d4746b09a630f14a3a0b1a8a17 | refs/heads/master | 2021-01-24T04:20:57.750251 | 2017-10-10T03:26:08 | 2017-10-10T03:26:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,677 | java | package totoro.application.xkf.totoroweather.util;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.List;
public class TextUtil {
public static String addText(String oldText, String newText) {
if (TextUtils.isEmpty(oldText)) {
return newText;
}
return oldText + "&" + newText;
}
public static List<String> getCitys(String all) {
if (TextUtils.isEmpty(all)) {
return null;
}
List<String> list = new ArrayList<>();
String[] names = all.split("&");
for (String str : names) {
String[] city = str.split("@");
list.add(city[0]);
}
return list;
}
public static List<String> getIds(String all) {
if (TextUtils.isEmpty(all)) {
return null;
}
List<String> list = new ArrayList<>();
String[] names = all.split("&");
for (String str : names) {
String[] city = str.split("@");
list.add(city[1]);
}
return list;
}
public static boolean hasCommonCity(String cityId, List<String> allCityId) {
if (allCityId == null) {
return true;
}
for (String id : allCityId) {
if (id.equals(cityId)) {
return true;
}
}
return false;
}
public static String deleteCity(String city, String id, String all) {
int start = all.indexOf(city);
int end = start + city.length() + 1 + id.length();
StringBuilder builder = new StringBuilder(all);
return builder.delete(start - 1, end).toString();
}
} | [
"1131225133@qq.com"
] | 1131225133@qq.com |
ab48a3b838a99714aa316134277e422cea2b1e27 | b75b83b4578b0d4267d6d66764b9a3f4a7eafc6e | /app/src/main/java/com/shridevlopment/batterystasu/MainActivity.java | c744b633d0358acbb09d56e757aeaad848be0aed | [] | no_license | shriguddodagi/batterystatus | 17767c69ff1994ac43b81f9e8f426835905e928a | 24d0b0f81f1e9e36dc8ea7adf1afde02529aebf6 | refs/heads/master | 2022-06-18T06:37:09.233611 | 2020-05-06T06:45:45 | 2020-05-06T06:45:45 | 261,667,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package com.shridevlopment.batterystasu;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import com.shridevlopment.batterystasu.R;
public class MainActivity extends AppCompatActivity {
private BatteryReceiver mBatteryReceiver = new BatteryReceiver();
private IntentFilter mIntentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
protected void onResume() {
super.onResume();
registerReceiver(mBatteryReceiver, mIntentFilter);
}
@Override
protected void onPause() {
unregisterReceiver(mBatteryReceiver);
super.onPause();
}
}
| [
"shrikantguddodagi@gmail.com"
] | shrikantguddodagi@gmail.com |
b6ec81641194f1b90ad90ca16aedc5abcebeb543 | 7459349fedf28266bac72e21e72c0c674793c86d | /game/screen/ScreenCrash.java | 8a25cd0a1513b3f1fddd5f164ac21298eb1d30f3 | [] | no_license | teknogeek/Substrate | 93c773573a6e5930406a122f83679719392708ee | 01c2cf62ef361e0b2fe08e3d308bf73fc50d71c0 | refs/heads/master | 2021-01-15T16:46:42.494050 | 2013-09-23T18:08:20 | 2013-09-23T18:08:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 880 | java | package game.screen;
import game.Game;
import game.utils.SpriteSheet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
public class ScreenCrash extends Screen {
private String crashdump;
public ScreenCrash(int width, int height, SpriteSheet sheet,
String crashdump) {
super(width, height, sheet);
this.crashdump = crashdump;
}
@Override
public void render(Graphics g) {
Game.log("Game crash - Report the information below at http://github.com/UnacceptableUse/Susbtrate/issues");
Game.log(crashdump);
game.getFontRenderer().drawString("Game Crash.", 20, 20, 2, Color.red);
game.getFontRenderer().drawString("See console for more details.", 20,
45, 2, Color.red);
game.getFontRenderer().drawString(crashdump, 20, 65, 1);
}
@Override
public void keyPressed(KeyEvent e) {
}
}
| [
"unacceptableuse@live.co.uk"
] | unacceptableuse@live.co.uk |
6a51c60ded3797020e740d1c437c6ff9c1263ddc | 283119432a573414ae9740b72172232e71c98d95 | /src/main/java/com/kaneki/service/SupplierService.java | 7e5272c23d02aaabf498cda6c0a9b140eaf167c6 | [] | no_license | kanekiNongMo/ERPSimple | f8d37efe7b4f194fea4d6f946601847c3ebdc1e0 | 4fd1c7c94a928461a5918321817de3ea2fe35d56 | refs/heads/master | 2020-04-12T13:49:58.698430 | 2018-12-29T06:30:40 | 2018-12-29T06:30:40 | 162,532,838 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | java | package com.kaneki.service;
import java.util.List;
import com.kaneki.pojo.Page;
import com.kaneki.pojo.Supplier;
/**
*
* @author LiJiezhou
*
*/
public interface SupplierService {
// 添加供应商信息
public int addSupplier(Supplier supplier);
// 修改供应商信息
public int updateSupplier(Supplier supplier);
// 删除供应商信息
public int deleteSupplier(Integer supplierId);
// 根据编号获取供应商信息
public Supplier findSupplierByID(Integer supplierId);
// 分页查询供应商信息
public Page<Supplier> findAllSupplier(Integer page, Integer pageRows, Supplier supplier);
// 获取所有供应商
public List<Supplier> getSup();
}
| [
"1165201419@qq.com"
] | 1165201419@qq.com |
858855e9ec7850087398b66fb8440c738e8ca3fd | de01380c556c28c2a87bd7610d63ba0f683a9d77 | /gmall-pms/src/main/java/com/atguigu/gmall/pms/controller/BrandController.java | e64ecd1824177da55dcac769569b6cb6e3ae14ef | [
"Apache-2.0"
] | permissive | zhao3976zhi/gmall | 76b55456938425f148a436fe8b89a3245ec908ca | 7eb1741df73c9339a454aea20de71317c594a5e7 | refs/heads/master | 2020-09-17T10:34:34.891197 | 2019-11-19T05:37:55 | 2019-11-19T05:37:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,291 | java | package com.atguigu.gmall.pms.controller;
import java.util.Arrays;
import java.util.Map;
import com.atguigu.core.bean.PageVo;
import com.atguigu.core.bean.QueryCondition;
import com.atguigu.core.bean.Resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import com.atguigu.gmall.pms.entity.BrandEntity;
import com.atguigu.gmall.pms.service.BrandService;
/**
* 品牌
*
* @author breeze
* @email gentle@breeze.com
* @date 2019-10-28 18:25:21
*/
@Api(tags = "品牌 管理")
@RestController
@RequestMapping("pms/brand")
public class BrandController {
@Autowired
private BrandService brandService;
/**
* 列表
*/
@ApiOperation("分页查询(排序)")
@GetMapping("/list")
@PreAuthorize("hasAuthority('pms:brand:list')")
public Resp<PageVo> list(QueryCondition queryCondition) {
PageVo page = brandService.queryPage(queryCondition);
return Resp.ok(page);
}
/**
* 信息
*/
@ApiOperation("详情查询")
@GetMapping("/info/{brandId}")
@PreAuthorize("hasAuthority('pms:brand:info')")
public Resp<BrandEntity> info(@PathVariable("brandId") Long brandId){
BrandEntity brand = brandService.getById(brandId);
return Resp.ok(brand);
}
/**
* 保存
*/
@ApiOperation("保存")
@PostMapping("/save")
@PreAuthorize("hasAuthority('pms:brand:save')")
public Resp<Object> save(@RequestBody BrandEntity brand){
brandService.save(brand);
return Resp.ok(null);
}
/**
* 修改
*/
@ApiOperation("修改")
@PostMapping("/update")
@PreAuthorize("hasAuthority('pms:brand:update')")
public Resp<Object> update(@RequestBody BrandEntity brand){
brandService.updateById(brand);
return Resp.ok(null);
}
/**
* 删除
*/
@ApiOperation("删除")
@PostMapping("/delete")
@PreAuthorize("hasAuthority('pms:brand:delete')")
public Resp<Object> delete(@RequestBody Long[] brandIds){
brandService.removeByIds(Arrays.asList(brandIds));
return Resp.ok(null);
}
}
| [
"819974025@qq.com"
] | 819974025@qq.com |
ab74c5df4144c34a828df1793dc995d388603370 | edec4dbebb7a743338e4c7d70870d89d8bd4e43b | /src/main/java/org/thomnichols/pythonwebconsole/ValidationException.java | 00fdb290924d4718331008cc43b6d560fd4ec902 | [] | no_license | greisch/Python-Web-Console | 08b7568dc3830c5c7cd637dfa4878a8e6cf7491e | 67d61a86213c47ad27ad84dfa00a7a169d61466f | refs/heads/master | 2021-01-17T10:10:07.812868 | 2010-04-16T21:12:40 | 2010-04-16T21:12:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package org.thomnichols.pythonwebconsole;
public class ValidationException extends Exception {
private static final long serialVersionUID = 1981584012591853004L;
public ValidationException() { super(); }
public ValidationException( String msg ) { super(msg); }
public ValidationException( Throwable cause ) { super(cause); }
public ValidationException( String msg, Throwable cause ) { super(msg,cause); }
}
| [
"tmnichols@gmail.com"
] | tmnichols@gmail.com |
06113031707a15d81ca89ec1a307088c1107d6b2 | c2feeaa106e3faceb39b59c24a2bd1c39b60a96a | /src/main/java/com/haiwen/smart/framework/util/CollectionUtil.java | 2eadf3d10ea580d88958ef8e5ae0563451b11e70 | [] | no_license | HaiwenZhang/smart-framework | ebbae995d74648079571c6fe9d26e5e9f9ab7e43 | ac53cf34d0b121a78575cbf86d51c4eeb019b0e8 | refs/heads/master | 2020-03-27T15:28:16.773055 | 2018-09-03T03:38:19 | 2018-09-03T03:38:19 | 146,720,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package com.haiwen.smart.framework.util;
import java.util.Collection;
import org.apache.commons.collections.CollectionUtils;
public class CollectionUtil {
public static boolean isNotEmpty(Collection<?> collection) {
return CollectionUtils.isNotEmpty(collection);
}
public static boolean isEmpty(Collection<?> collection) {
return CollectionUtils.isEmpty(collection);
}
}
| [
"haiwensummer@gmail.com"
] | haiwensummer@gmail.com |
ecc0d080c670f5303d480e899b1f1d202f2a41e8 | f3073ed112bf411ceaeafefc482a05604d9c1319 | /app/src/main/java/com/qingwing/safebox/net/request/CodeIsDueReq.java | be9f0e5297564dba9b6eb0a7bc3dad1354a3a732 | [] | no_license | shoxgov/UserApp_AS_2 | ab20fc6935fc99643b167fa227b866d617e0ad24 | ce892818fbc2072fda38aec52c614a9f17f30328 | refs/heads/master | 2021-08-22T12:28:54.632535 | 2017-11-30T06:32:37 | 2017-11-30T06:32:37 | 109,775,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,206 | java | package com.qingwing.safebox.net.request;
import com.qingwing.safebox.net.BaseCommReq;
import com.qingwing.safebox.net.BaseResponse;
import com.qingwing.safebox.net.response.CodeIsDueResponse;
import com.qingwing.safebox.network.ServerAddress;
import java.util.HashMap;
import java.util.Map;
/**
* @Class: BindNewTelephoneReq
*/
public class CodeIsDueReq extends BaseCommReq {
private String url = ServerAddress.CODEISDUE;
private String mobile;
private CodeIsDueResponse codeIsDueResponse;
private Map<String, String> postParams = new HashMap<String, String>();
@Override
public String generUrl() {
setTag("CodeIsDueReq");
postParams.put("mobile", mobile);
setPostParam(postParams);
return url;
}
@Override
public Class getResClass() {
return CodeIsDueResponse.class;
}
@Override
public BaseResponse getResBean() {
if (codeIsDueResponse == null) {
codeIsDueResponse = new CodeIsDueResponse();
}
return codeIsDueResponse;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
}
| [
"shoxgov@126.com"
] | shoxgov@126.com |
843329ffc7dbdd0af30961b20c779cc414397ddd | 24afcc832e0b1fa5324450823069f6c146208dd0 | /src/com/leroymerlin/commit/CommitPanel.java | c4ed99ed9c76c5f1743c98699644907522217621 | [
"Apache-2.0"
] | permissive | liaolintao/commit-template-idea-plugin | 96e2089e2d4a6183797da79c3dc18a0f1f5c5ab9 | 613859de66749a21258a6fb8826e66208ae7d2df | refs/heads/master | 2021-08-24T04:58:55.283595 | 2017-12-08T04:16:35 | 2017-12-08T04:16:35 | 113,424,451 | 0 | 0 | null | 2017-12-07T08:38:20 | 2017-12-07T08:38:20 | null | UTF-8 | Java | false | false | 1,211 | java | package com.leroymerlin.commit;
import com.intellij.openapi.ui.DialogWrapper;
import javax.swing.*;
/**
* @author Damien Arrachequesne
*/
public class CommitPanel {
private JPanel mainPanel;
private JComboBox changeType;
private JTextField changeScope;
private JTextField shortDescription;
private JTextArea longDescription;
private JTextField closedIssues;
private JTextField breakingChanges;
CommitPanel(DialogWrapper dialog) {
for (ChangeType type : ChangeType.values()) {
changeType.addItem(type);
}
}
JPanel getMainPanel() {
return mainPanel;
}
String getChangeType() {
ChangeType type = (ChangeType) changeType.getSelectedItem();
return type.label();
}
String getChangeScope() {
return changeScope.getText().trim();
}
String getShortDescription() {
return shortDescription.getText().trim();
}
String getLongDescription() {
return longDescription.getText().trim();
}
String getBreakingChanges() {
return breakingChanges.getText().trim();
}
String getClosedIssues() {
return closedIssues.getText().trim();
}
}
| [
"damien.arrachequesne@gmail.com"
] | damien.arrachequesne@gmail.com |
3f1675cd4cd06ece8eba926478ad1ab747beec99 | cd21a0a0682a60f7e2f5f412c78d7fba532ee0a0 | /src/main/java/me/daoke/renrenfm/entity/AccusationRecordInfo.java | 407fdbce40abde3ae775a1fdc7634a992d622099 | [] | no_license | lynnchae/renrenbo | f62014b50d6fb1fc53341274bfe9d41364e935a5 | 2ee3e4bfc34cc3550308438b90e5c7c3d0700598 | refs/heads/master | 2021-01-10T07:41:47.997032 | 2015-12-24T05:41:34 | 2015-12-24T05:41:34 | 48,526,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,841 | java | package me.daoke.renrenfm.entity;
import java.util.Date;
/**
* 举报信息
* Created by zhaoym on 2015/9/11.
*/
public class AccusationRecordInfo extends BaseEntity{
/**
* 主键
*/
private int id;
/**
* 举报人ID
*/
private String accountID;
/**
* 举报人姓名
*/
private String reportName;
/**
* 被举报人ID
*/
private String beAccountID;
/**
* 身份证号
*/
private String idCard;
/**
* 主播状态
*/
private String status;
/**
* 被举报人姓名
*/
private String beReportName;
/**
* 举报的内容
*/
private String accusationContent;
/**
* 吐槽的时间
*/
private Date accusationTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getAccountID() {
return accountID;
}
public void setAccountID(String accountID) {
this.accountID = accountID;
}
public String getReportName() {
return reportName;
}
public void setReportName(String reportName) {
this.reportName = reportName;
}
public String getBeReportName() {
return beReportName;
}
public void setBeReportName(String beReportName) {
this.beReportName = beReportName;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getBeAccountID() {
return beAccountID;
}
public void setBeAccountID(String beAccountID) {
this.beAccountID = beAccountID;
}
public String getAccusationContent() {
return accusationContent;
}
public void setAccusationContent(String accusationContent) {
this.accusationContent = accusationContent;
}
public Date getAccusationTime() {
return accusationTime;
}
public void setAccusationTime(Date accusationTime) {
this.accusationTime = accusationTime;
}
@Override
public String toString() {
return "AccusationRecordInfo{" +
"id=" + id +
", accountID='" + accountID + '\'' +
", reportName='" + reportName + '\'' +
", beAccountID='" + beAccountID + '\'' +
", idCard='" + idCard + '\'' +
", status='" + status + '\'' +
", beReportName='" + beReportName + '\'' +
", accusationContent='" + accusationContent + '\'' +
", accusationTime=" + accusationTime +
'}';
}
}
| [
"cailinfeng@mobanker.com"
] | cailinfeng@mobanker.com |
f6e861955675c89b466350bc68d5108a122779f7 | 95d6e1d199f7d6a5292829b3583eae6ebeed55e5 | /Gymok/src/java/com/gym/dao/GrupoMuscularDAO.java | 0f786cf01391c2e96375b6805b816e27fb0fec35 | [] | no_license | alexisCata/NetBeansProjects | da35c652e9f7331cfa6e99b4308ca571393ae101 | 5c427b2eb75c51ee07fe1a8cc761f9f474d3664e | refs/heads/master | 2021-05-27T08:23:44.505203 | 2014-04-21T16:14:49 | 2014-04-21T16:14:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,784 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.gym.dao;
import com.gym.entities.GrupoMuscular;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
/**
*
* @author alexis
*/
public class GrupoMuscularDAO {
private Session sesion;
private Transaction tx;
private void iniciaOperacion() throws HibernateException{
sesion = HibernateUtil.getSessionFactory().openSession();
tx = sesion.beginTransaction();
}
private void manejaExcepcion (HibernateException he) throws HibernateException{
tx.rollback();
throw new HibernateException("Ocurrió un error en la capa de acceso a datos",he);
}
public Integer guardaGrupoMuscular(GrupoMuscular grupom){
Integer id = 0;
try{
iniciaOperacion();
id = (Integer)sesion.save(grupom);
tx.commit();
}catch(HibernateException he){
manejaExcepcion(he);
//throw he;
}finally{
sesion.close();
}
return id;
}
public void actualizaGrupoMuscular(GrupoMuscular grupom) throws HibernateException{
try{
iniciaOperacion();
sesion.update(grupom);
tx.commit();
}catch(HibernateException he){
manejaExcepcion(he);
throw he;
}finally{
sesion.close();
}
}
public void eliminaGrupoMuscular(GrupoMuscular grupom) throws HibernateException{
try{
iniciaOperacion();
sesion.delete(grupom);
tx.commit();
}catch(HibernateException he){
manejaExcepcion(he);
throw he;
}finally{
sesion.close();
}
}
public GrupoMuscular obtenGrupoMuscular(Integer idGrupoMuscular) throws HibernateException{
GrupoMuscular contacto = null;
try{
iniciaOperacion();
contacto = (GrupoMuscular) sesion.get(GrupoMuscular.class, idGrupoMuscular);
}finally{
sesion.close();
}
return contacto;
}
public List<GrupoMuscular> obtenListaGrupoMusculars() throws HibernateException{
List<GrupoMuscular> listaContactos = null;
try{
iniciaOperacion();
listaContactos = sesion.createQuery("from GrupoMuscular").list();
}finally{
sesion.close();
}
return listaContactos;
}
}
| [
"alexisfloresortega@gmail.com"
] | alexisfloresortega@gmail.com |
a439a34e18ca433a40e000892bf15841380f134d | 9b35343f656aff30880d3b5c69eba0c800f887aa | /src/test/java/com/lm/test/model/ProductTest.java | b1a0b48943ec78ff33a741d4b1b8f628fd030147 | [] | no_license | acampolm/lm_test | 2045400b49841e3a3fe737fb17b14b3e5f924eae | 4aec0c3e02cd87f7ce41bfd965730e1e137f6866 | refs/heads/master | 2021-07-16T20:37:01.321033 | 2019-11-03T14:41:08 | 2019-11-03T14:41:08 | 219,305,613 | 0 | 1 | null | 2020-10-13T17:10:54 | 2019-11-03T13:32:17 | Java | UTF-8 | Java | false | false | 5,214 | java | package com.lm.test.model;
import junit.framework.TestCase;
import org.junit.Test;
public class ProductTest extends TestCase
{
public static final String GOOD_ITEM_LINE = "1 product name at 12.34";
public static final String GOOD_IMPORTED_ITEM_LINE = "1 imported product at 12.34";
public static final String ONLY_BASIC_TAX_PRODUCT = "1 product name at 1";
public static final String ONLY_IMPORTED_TAX_PRODUCT = "1 imported book at 1";
public static final String ONLY_COMBINED_TAX_PRODUCT = "1 imported other at 1";
public static final String MULTIPLE_COMBINED_TAX_PRODUCT = "2 imported other at 1";
public static final String BAD_ITEM_LINE = "THIS IS WROOOOONG!";
public static final String BAD_PRICE_LINE = "1 product at none";
public static final String BAD_AMOUNT_LINE = "none product at 12.34";
@Test
public void testGoodLineParsing() {
Product p = Product.generateProduct(GOOD_ITEM_LINE);
assertEquals("Only 1 item was expected",1, p.getAmount());
assertEquals("Product name should be 'product name' ","product name", p.getProductName());
assertEquals("Price should be 12.34",12.34f, p.getPrice(), 0.001f);
assertFalse("the product isn't imported", p.isImported());
}
@Test
public void testImportedProduct() {
Product p = Product.generateProduct(GOOD_IMPORTED_ITEM_LINE);
assertEquals("Only 1 item was expected",1, p.getAmount());
assertEquals("Product name should be 'product name' ","imported product", p.getProductName());
assertEquals("Price should be 12.34",12.34f, p.getPrice(), 0.001f);
assertTrue("the product is imported", p.isImported());
}
@Test
public void testBadItemLine() {
try {
Product.generateProduct(BAD_ITEM_LINE);
assertTrue("this shouldn't be executed", false);
} catch (IllegalArgumentException ex) {
assertEquals("Bad message received", "The product " + BAD_ITEM_LINE + " doesn't match the expected format", ex.getMessage());
}
}
@Test
public void testBadItemPrice() {
try {
Product.generateProduct(BAD_PRICE_LINE);
assertTrue("this shouldn't be executed", false);
} catch (IllegalArgumentException ex) {
assertEquals("Bad message received", "The product " + BAD_PRICE_LINE + " doesn't match the expected format", ex.getMessage());
}
}
@Test
public void testBadItemAmount() {
try {
Product.generateProduct(BAD_AMOUNT_LINE);
assertTrue("this shouldn't be executed", false);
} catch (IllegalArgumentException ex) {
assertEquals("Bad message received", "The product " + BAD_AMOUNT_LINE + " doesn't match the expected format", ex.getMessage());
}
}
@Test
public void testBasicTax() {
Product p = Product.generateProduct(ONLY_BASIC_TAX_PRODUCT);
assertEquals("Only 1 item was expected",1, p.getAmount());
assertEquals("Product name should be 'product name' ","product name", p.getProductName());
assertEquals("Price should be 1",1.00f, p.getPrice(), 0.001f);
assertFalse("the product isn't imported", p.isImported());
assertEquals("expected taxes for product 0.1", 0.1f, p.getTaxes());
assertEquals("expected final cost for product 1.1", 1.1f, p.getFullPrice());
}
@Test
public void testImportedTax() {
Product p = Product.generateProduct(ONLY_IMPORTED_TAX_PRODUCT);
assertEquals("Only 1 item was expected",1, p.getAmount());
assertEquals("Product name should be 'product name' ","imported book", p.getProductName());
assertEquals("Price should be 1",1.00f, p.getPrice(), 0.001f);
assertTrue("the product is imported", p.isImported());
assertEquals("expected taxes for product 0.05", 0.05f, p.getTaxes());
assertEquals("expected final cost for product 1.05", 1.05f, p.getFullPrice());
}
@Test
public void testCombinedTax() {
Product p = Product.generateProduct(ONLY_COMBINED_TAX_PRODUCT);
assertEquals("Only 1 item was expected",1, p.getAmount());
assertEquals("Product name should be 'product name' ","imported other", p.getProductName());
assertEquals("Price should be 1",1.00f, p.getPrice(), 0.001f);
assertTrue("the product is imported", p.isImported());
assertEquals("expected taxes for product 0.15", 0.15f, p.getTaxes());
assertEquals("expected final cost for product 1.15", 1.15f, p.getFullPrice());
}
@Test
public void testMultiProduct() {
Product p = Product.generateProduct(MULTIPLE_COMBINED_TAX_PRODUCT);
assertEquals("Only 2 item was expected",2, p.getAmount());
assertEquals("Product name should be 'product name' ","imported other", p.getProductName());
assertEquals("Price should be 1",1.00f, p.getPrice(), 0.001f);
assertTrue("the product is imported", p.isImported());
assertEquals("expected taxes for product 0.15", 0.15f, p.getTaxes());
assertEquals("expected final cost for product 1.15", 1.15f, p.getFullPrice());
}
}
| [
"adelcampo@tuenti.com"
] | adelcampo@tuenti.com |
ab43add52cf4406564c170b9bf636237b18821d2 | b0136f3721cafdefa19c98dcb375b909ed43dc41 | /src/test/java/com/lijian/sm3/Sm3Test.java | e57b880b30c382b0199fa1330b3d2aecab8723c5 | [] | no_license | dalijian/json | 3e6c15763e1cc7af9e999f71943e47baa8815b36 | c46aafd56ce97b524cad62a3ea01df87cedcd31b | refs/heads/master | 2023-04-26T13:39:10.864777 | 2023-04-15T05:04:35 | 2023-04-15T05:04:35 | 160,699,643 | 0 | 0 | null | 2022-12-10T05:20:37 | 2018-12-06T16:10:41 | Java | UTF-8 | Java | false | false | 771 | java | package com.lijian.sm3;
import org.bouncycastle.crypto.digests.SM3Digest;
public class Sm3Test {
/**
* sm3 加密
* @param args
*/
public static void main(String[] args) {
byte[] asciiArray = ascii("gybx1234");
SM3Digest sm3Digest = new SM3Digest();
sm3Digest.update(asciiArray, 0, asciiArray.length);
byte[] encyptByte = new byte[sm3Digest.getDigestSize()];
sm3Digest.doFinal(encyptByte,0);
System.out.println(encyptByte);
}
public static byte[] ascii(String str) {
char [] ch= str.toCharArray();
byte[] bytesArray = new byte[ch.length];
for (int i = 0; i < ch.length; i++) {
bytesArray[i]=(byte)ch[i];
}
return bytesArray;
}
}
| [
"237922011@qq.com"
] | 237922011@qq.com |
659e4ab2ab6c6784dedc39ece9b6581e0f9a765c | f932282c7d9d2d7057f46798b3e0b26a58939e11 | /src/main/java/com/yimew/service/sys/impl/JedisServiceImpl.java | f768907c730b6499821746e8ae35e22819c12e36 | [] | no_license | 457190180/beauty | 93741b61f390f57173d583e882fa87818b8b052e | 1ce6b6f31e3a1abd646c6ee75ab2a6d3255e3ed4 | refs/heads/master | 2020-03-08T04:25:27.654247 | 2018-04-05T04:18:03 | 2018-04-05T04:18:03 | 127,920,900 | 0 | 0 | null | 2018-04-04T06:32:54 | 2018-04-03T14:27:58 | Java | UTF-8 | Java | false | false | 1,599 | java | package com.yimew.service.sys.impl;
import com.yimew.config.base.service.BaseServiceImpl;
import com.yimew.service.sys.JedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
/**
* * @author 作者 E-mail: * @date 创建时间:2017年11月1日 下午1:09:04 * @version 1.0
* * @parameter * @since * @return
*/
@Service("jedisService")
@Transactional
public class JedisServiceImpl extends BaseServiceImpl implements JedisService {
// private Jedis jedis = null;
@Autowired
private JedisPool jedisPool;
private Integer index = 1;
@Override
public Jedis getJedis() {
Jedis jedis = null;
if (jedisPool != null) {
if (jedis == null) {
jedis = jedisPool.getResource();
// jedis.auth(Const.REDIS_PASSWORD);
}
}
return jedis;
}
@Override
public void returnResource(Jedis jedis) {
if (null != jedis) {
//System.out.println("第 " +index +"次关闭jedis"+jedis.toString());
int numActive = jedisPool.getNumActive();
//System.out.println("活动链接" + numActive);
int numIdle = jedisPool.getNumIdle();
//System.out.println(numIdle);
int numWaiters = jedisPool.getNumWaiters();
//System.out.println("等待链接" + numWaiters);
jedis.close();
}
}
}
| [
"liangxinyu@kindertime.cn"
] | liangxinyu@kindertime.cn |
1dca03fb63056988603be6528f0871b76813c983 | 37e0e2080bfe7e1aace9c63c7a744484447ebd29 | /src/test/java/com/hhli/springbootstduy/concurrent/Join.java | 038ac7f9758380e592fa053ca7202da8e05f4475 | [] | no_license | hhli/springboot-study | 8ec55f6cf7af89ef0b42d73129997d48066aac31 | f4fdadd41ae1560decc85f4a84d693ddffec4e6d | refs/heads/master | 2023-05-11T02:06:11.653079 | 2022-12-04T08:24:27 | 2022-12-04T08:24:27 | 145,272,079 | 2 | 1 | null | 2023-05-09T18:08:32 | 2018-08-19T04:10:16 | Java | UTF-8 | Java | false | false | 1,065 | java | package com.hhli.springbootstduy.concurrent;
import java.util.concurrent.TimeUnit;
/**
* @author 李辉辉
* @date 2019/3/12 9:11
* @description
*/
public class Join {
public static void main(String[] args) throws InterruptedException {
Thread previous = Thread.currentThread();
for (int i = 0; i < 10; i++) {
Thread thread = new Thread(new Domino(previous), String.valueOf(i));
thread.start();
previous = thread;
}
//TimeUnit.SECONDS.sleep(5);
System.out.println(Thread.currentThread().getName() + " terminate.");
}
static class Domino implements Runnable{
private Thread thread;
public Domino(Thread thread){
this.thread = thread;
}
@Override
public void run() {
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + " terminate.");
}
}
}
| [
"hhli@users.noreply.github.com"
] | hhli@users.noreply.github.com |
a3a44aa3418a0d743f72e81d7861c73d2aefafba | 54a65f5a170c01cc807a3180e1113ea12288341c | /workcraft/PetrifyPlugin/src/org/workcraft/plugins/petrify/commands/StandardCelementSynthesisCommand.java | a745a69afd12476b9f41dcd5fd7ab0d2010e590c | [
"MIT"
] | permissive | ARandomOWL/workcraft | 8ccbbdd3e6b5678ff7721f490aa3b2988236f2ed | 6b1ea5cefd9054f9587f9b22fd4ed848a070e682 | refs/heads/master | 2023-01-16T04:50:26.035294 | 2020-11-25T19:57:46 | 2020-11-25T19:57:56 | 292,818,851 | 0 | 0 | MIT | 2020-09-04T10:25:41 | 2020-09-04T10:25:41 | null | UTF-8 | Java | false | false | 773 | java | package org.workcraft.plugins.petrify.commands;
import java.util.Collections;
import java.util.List;
public class StandardCelementSynthesisCommand extends AbstractSynthesisCommand {
@Override
public List<String> getSynthesisParameter() {
return Collections.singletonList("-mc");
}
@Override
public String getDisplayName() {
return "Standard C-element [Petrify]";
}
@Override
public Position getPosition() {
return Position.BOTTOM_MIDDLE;
}
@Override
public boolean boxSequentialComponents() {
return false;
}
@Override
public boolean boxCombinationalComponents() {
return false;
}
@Override
public boolean sequentialAssign() {
return true;
}
}
| [
"danilovesky@gmail.com"
] | danilovesky@gmail.com |
89c9e778bcf3baca407fa543065d83e45e599414 | 212f23ce7577ef82e1a59f40bebd04f507a46353 | /src/main/java/pl/sda/model/discount/NoDiscount.java | 03ccfe3e5ab5f2fec59bb47078b89e9415a56de9 | [] | no_license | ArekBielecki/FirstSpringExerciseProject | 72a2cc46ec1d12ecbffea5f6ba8f52892a1c2bbb | 41a54a8abe1005aa2ea1d6c60cef096725302197 | refs/heads/master | 2020-03-25T08:24:00.685013 | 2018-08-05T13:28:08 | 2018-08-05T13:28:08 | 143,610,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package pl.sda.model.discount;
import org.springframework.stereotype.Service;
@Service
public class NoDiscount implements Discount {
@Override
public int calculate(int price) {
return 0;
}
}
| [
"a.k.bielecki@gmail.com"
] | a.k.bielecki@gmail.com |
32483b9d09249cdb6d7913502bee93a4040dee80 | a12cec1c55ab58e9dfa11806c1143594a67aa7e6 | /pipeline/src/mekhails/pipeline/ILexemeSemantic.java | 967651f5ae47b040b88db5f7a9de51699eaf8674 | [] | no_license | MekhailS/java-assignment3 | 2d76ebfe915f63451ed6930298d2afffe19bed80 | 5db68b496acc80abc76cfdeea506be9eb3879764 | refs/heads/master | 2023-01-29T14:02:32.365469 | 2020-12-15T21:43:32 | 2020-12-15T21:43:32 | 320,856,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java | package mekhails.pipeline;
public interface ILexemeSemantic
{
SemanticAnalyzer.Semantic getSemantic();
}
| [
"shagvaliev.mikhail@gmail.com"
] | shagvaliev.mikhail@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.