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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
141c5577402779a9be36f25511841e24f9f47de8 | 5e54fdda8ea68c9be533035ff029c5732a45aa46 | /src/main/java/main/userproduct/MacroNutrientsCalculator.java | f15f520a85935700d3655dd7bc5c3d88e8eb2144 | [] | no_license | must1/FitnessApplicationSB2.2.x | 270c2126453b2a959ed9b35222d51eb1dfb8fa77 | ec6bfafcdb90248651c1c61ff43a0d920fdaa48c | refs/heads/master | 2023-02-09T00:28:05.283176 | 2020-12-30T18:52:17 | 2020-12-30T18:52:17 | 289,705,978 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | package main.userproduct;
import lombok.experimental.UtilityClass;
import main.model.Product;
@UtilityClass
public class MacroNutrientsCalculator {
private final int ONE_HUNDRED_GRAMS = 100;
double countFatNumberOfGivenProduct(double gram, Product product) {
double fatNumber = product.getFatNumberPer100G();
return (fatNumber * gram) / ONE_HUNDRED_GRAMS;
}
double countProteinNumberOfGivenProduct(double gram, Product product) {
double proteinNumber = product.getProteinNumberPer100G();
return (proteinNumber * gram) / ONE_HUNDRED_GRAMS;
}
double countCarbohydratesNumberNumberOfGivenProduct(double gram, Product product) {
double carbohydratesNumber = product.getCarbohydratesNumberPer100G();
return (carbohydratesNumber * gram) / ONE_HUNDRED_GRAMS;
}
double countCaloriesOfGivenProduct(double gram, Product product) {
double kcalNumber = product.getKcalNumberPer100G();
return (kcalNumber * gram) / ONE_HUNDRED_GRAMS;
}
}
| [
"must.janik@gmail.com"
] | must.janik@gmail.com |
74315f37e057f40413468fe02dc630603e0ae4eb | d9a82b73677efb4f85641a04f1a1f9b124bd1029 | /fuxi0907.java | 1a8198f19cdb71a358f88d9f43ac8287ee36ae2d | [] | no_license | Kalen-Ssl/shilu | 5f338c47b57be040ec711f5a45438a8d49e6a505 | dd5d5443b94746b7c07580c65251c107e30b00d4 | refs/heads/master | 2021-07-24T14:25:50.267058 | 2020-10-19T13:46:28 | 2020-10-19T13:46:28 | 219,538,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,251 | java | package fuxi3;
import java.util.Stack;
public class fuxi0907 {
//二叉树的镜像
public class TreeNode{
int val=0;
TreeNode right=null;
TreeNode left=null;
public TreeNode(int val){
this.val=val;
}
}
public void Mirror(TreeNode node){
if(node==null){
return;
}
TreeNode temp=node.left;
node.left=node.right;
node.right=temp;
Mirror(node.left);
Mirror(node.right);
}
//循环二分查找
public static int binSearch_1(int key,int[] array){
int low=0;
int high=array.length-1;
int middle=0;
if(key<array[low]||key>array[high]||low>high){
return -1;
}
while(low<=high){
middle=(low+high)/2;
if(array[middle]==key){
return array[middle];
}else if(array[middle]<key){
low=middle+1;
}else{
high=middle-1;
}
}
return -1;
}
//递归二分查找
public static int binSearch_2(int key,int[] array,int low,int high){
if(key<array[low]||key>array[high]||low>high){
return -1;
}
int middle=(low+high)/2;
if(array[middle]>key){
return(binSearch_2(key,array,low,middle-1));
}else if(array[middle]<key){
return(binSearch_2(key,array,middle+1,high));
}else{
return array[middle];
}
}
//二分查找
public static void main(String[] args){
int[] array={1,2,3,4,6,7,8,9,10};
System.out.println(binSearch_2(7,array,0,8));
System.out.println(binSearch_1(7,array));
}
//两个栈实现队列
Stack<Integer> stack1 = new Stack<Integer>();
Stack<Integer> stack2 = new Stack<Integer>();
public void push(int node){
stack1.push(node);
}
public int pop() {
if(stack2.empty()){
while(stack1.size()>0){
stack2.push(stack1.pop());
}
}
return stack2.pop();
}
}
| [
"2071004049@qq.com"
] | 2071004049@qq.com |
975c80dfd0bfa6657d54897436e7f86f2133d070 | 8e6dcaf667137b9ee73550f7856a3294cd342970 | /org.abchip.mimo.core/src/org/abchip/mimo/MimoResourceFactoryImpl.java | 52c2c03a54542f937ca7d84c0b5bf87ade0c404c | [] | no_license | abchip/mimo | 98f3db3fad26d2dd8e0196d4a17fba8d7b8fbda0 | b9713ecacac883261d5ff04ac0dd6c98fbbba49d | refs/heads/master | 2022-12-18T10:19:11.707294 | 2021-03-18T20:35:21 | 2021-03-18T20:35:21 | 114,753,824 | 0 | 0 | null | 2022-12-14T00:59:04 | 2017-12-19T10:51:40 | Grammatical Framework | UTF-8 | Java | false | false | 6,290 | java | /**
* Copyright (c) 2017, 2021 ABChip and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*/
package org.abchip.mimo;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import org.abchip.mimo.context.Context;
import org.abchip.mimo.entity.EntityEnum;
import org.abchip.mimo.entity.EntityIdentifiable;
import org.abchip.mimo.entity.EntityPackage;
import org.abchip.mimo.entity.Frame;
import org.abchip.mimo.resource.Resource;
import org.abchip.mimo.resource.ResourceConfig;
import org.abchip.mimo.resource.ResourceException;
import org.abchip.mimo.resource.ResourceFactory;
import org.abchip.mimo.resource.ResourceProvider;
import org.abchip.mimo.resource.ResourceProviderRegistry;
import org.abchip.mimo.util.Frames;
import org.abchip.mimo.util.Logs;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
import org.osgi.service.log.Logger;
public class MimoResourceFactoryImpl extends ResourceFactoryImpl {
private static final Logger LOGGER = Logs.getLogger(MimoResourceFactoryImpl.class);
private MimoResourceSetImpl resourceSet;
private ResourceProviderRegistry resourceProviderRegistry;
private static Map<String, Frame<?>> FRAMES = new HashMap<String, Frame<?>>();
private static final ResourceConfig EMF_RESOURCE_CONFIG = ResourceFactory.eINSTANCE.createResourceConfig();
public MimoResourceFactoryImpl(MimoResourceSetImpl resourceSet, Map<URI, org.eclipse.emf.ecore.resource.Resource> uriResourceMap) {
super();
this.resourceSet = resourceSet;
this.resourceProviderRegistry = getContext().get(ResourceProviderRegistry.class);
EMF_RESOURCE_CONFIG.setLockSupport(true);
EMF_RESOURCE_CONFIG.setOrderSupport(true);
Context context = resourceSet.getContext();
if (FRAMES.isEmpty()) {
synchronized (FRAMES) {
if (FRAMES.isEmpty()) {
loadFrames();
}
}
}
@SuppressWarnings("unchecked")
Frame<Frame<?>> frame = (Frame<Frame<?>>) FRAMES.get(Frame.class.getSimpleName());
E4FrameClassResourceImpl<Frame<?>> frameResource = new E4FrameClassResourceImpl<Frame<?>>(context, frame, FRAMES);
frameResource.setResourceConfig(EMF_RESOURCE_CONFIG);
URI frameUri = URI.createHierarchicalURI("mimo", null, null, new String[] { Frame.class.getSimpleName() }, null, null);
uriResourceMap.put(frameUri, new MimoResourceImpl<Frame<?>>(frameResource, resourceSet, frameUri));
}
private Context getContext() {
return resourceSet.getContext();
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public org.eclipse.emf.ecore.resource.Resource createResource(URI uri) {
String frameId = uri.segment(0);
try {
Frame<EntityIdentifiable> frame = (Frame<EntityIdentifiable>) FRAMES.get(frameId);
Resource<EntityIdentifiable> resource = null;
if (frame.isEnum()) {
resource = new E4FrameEnumResourceImpl(resourceSet.getResourceSet().getContext(), frame, getEnumerators(frame));
resource.setResourceConfig(EMF_RESOURCE_CONFIG);
} else {
ResourceProvider resourceProvider = resourceProviderRegistry.getResourceProvider(getContext(), frameId);
resource = resourceProvider.createResource(getContext(), frame);
}
org.eclipse.emf.ecore.resource.Resource.Internal e4resource = new MimoResourceImpl(resource, this.resourceSet, uri);
((InternalEObject) resource).eSetResource(e4resource, null);
return e4resource;
} catch (ResourceException e) {
return null;
}
}
private void loadFrames() {
EntityPackage.eINSTANCE.getEntity();
Queue<EClassifier> eClassifiers = new LinkedList<EClassifier>();
eClassifiers.addAll(Frames.getEClassifiers().values());
// consuming order
{
// entity
EClass eClass = EntityPackage.eINSTANCE.getEntity();
if (eClassifiers.remove(eClass))
FRAMES.put(eClass.getName(), new E4FrameClassAdapter<>(null, eClass));
}
{
// entity identifiable
EClass eClass = EntityPackage.eINSTANCE.getEntityIdentifiable();
if (eClassifiers.remove(eClass))
FRAMES.put(eClass.getName(), new E4FrameClassAdapter<>(FRAMES.get(EntityPackage.eINSTANCE.getEntity().getName()), eClass));
}
{
// frame
EClass eClass = EntityPackage.eINSTANCE.getFrame();
if (eClassifiers.remove(eClass))
FRAMES.put(eClass.getName(), new E4FrameClassAdapter<>(FRAMES.get(EntityPackage.eINSTANCE.getEntityIdentifiable().getName()), eClass));
}
while (!eClassifiers.isEmpty()) {
EClassifier eClassifier = eClassifiers.poll();
if (eClassifier instanceof EClass) {
EClass eClass = (EClass) eClassifier;
// before parent
if (eClass.getESuperTypes().isEmpty()) {
LOGGER.warn("Invlaid class {}", eClass.getName());
continue;
}
EClass eSuperType = eClass.getESuperTypes().get(0);
if (eClassifiers.contains(eSuperType)) {
eClassifiers.add(eClass);
continue;
} else if (!FRAMES.containsKey(eSuperType.getName())) {
LOGGER.warn("Unknown class {}", eSuperType.getName());
continue;
}
FRAMES.put(eClass.getName(), new E4FrameClassAdapter<>(FRAMES.get(eSuperType.getName()), eClass));
} else if (eClassifier instanceof EEnum) {
EEnum eEnum = (EEnum) eClassifier;
FRAMES.put(eEnum.getName(), new E4FrameEnumAdapter<>(eEnum));
} else {
LOGGER.warn("Unknown classifier {}", eClassifier.getName());
}
}
FRAMES = Collections.unmodifiableMap(FRAMES);
}
private Map<String, EntityEnum> getEnumerators(Frame<EntityIdentifiable> frame) {
Map<String, EntityEnum> enums = new HashMap<String, EntityEnum>();
E4FrameEnumAdapter<?> frameEnum = (E4FrameEnumAdapter<?>) frame;
EEnum eEnum = frameEnum.getEEnum();
for (EEnumLiteral eEnumLiteral : eEnum.getELiterals()) {
EntityEnum entity = new E4EntityEnumAdapter(eEnumLiteral);
enums.put(eEnumLiteral.getName(), entity);
}
return enums;
}
}
| [
"dev@abchip.it"
] | dev@abchip.it |
35058606449cf1e0ddbe22b100d2a787c75024e1 | 9f36468376ed37ed02fa3ced6d029e411a61055f | /src/User/Card.java | a1c04495751916b1abc48eb93a3fdf9b84965596 | [] | no_license | seokk1209/T5_ATM | 7e19eb1ae5871a0dcf4957d43df626e84af5f326 | 645befb3819d5f7c45230a3326f4d64ad037cdc9 | refs/heads/master | 2020-03-17T21:19:11.850998 | 2018-05-18T12:51:50 | 2018-05-18T12:51:50 | 133,953,596 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 537 | java | package User;
import java.util.*;
/**
*
*/
public class Card {
/**
* Default constructor
*/
public Card() {
}
/**
*
*/
private int ID;
/**
*
*/
private int password;
/**
* @param inputID
* @return
*/
public int checkCardID(int inputID) {
// TODO implement here
return 0;
}
/**
* @param inputPW
* @return
*/
public int checkPW(int inputPW) {
// TODO implement here
return 0;
}
} | [
"minseokbang@Minseoks-MacBook-Air.local"
] | minseokbang@Minseoks-MacBook-Air.local |
56104206acb3f89f35238b22a4345cbe64739849 | 78d4c2f65b9178d6b91b9fee1590d3266dee46a8 | /Interviewbit/Stacks and Queues/EVALUATE EXPRESSION/Solution.java | 7292096793ebce0d220010e04cd767c7f8f52da8 | [] | no_license | hemansutanty/Programming-Websites | 8020f495c640f638e820f8eabea0a1afbd912203 | 96c8dbf332708eea3d5e9f4aa84bf8878f810395 | refs/heads/master | 2021-07-01T05:06:56.586470 | 2021-06-13T18:42:14 | 2021-06-13T18:42:14 | 48,264,406 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 994 | java | /*
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each operand may be an integer or another expression.
Examples:
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9
["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6
*/
//Solution
public class Solution {
public int evalRPN(ArrayList<String> a) {
Stack <Integer> stack = new Stack<Integer>();
String x = null;
Integer op1,op2;
for(int i=0;i<a.size();i++){
x = a.get(i);
if(x.equals("+")){
op1 = stack.pop();
op2 =stack.pop();
stack.push(op2+op1);
}
else if(x.equals("-")){
op1 = stack.pop();
op2 =stack.pop();
stack.push(op2-op1);
}
else if(x.equals("*")){
op1 = stack.pop();
op2 =stack.pop();
stack.push(op2*op1);
}
else if(x.equals("/")){
op1 = stack.pop();
op2 =stack.pop();
stack.push(op2/op1);
}
else {
stack.push(Integer.parseInt(x));
}
}
return stack.pop();
}
}
| [
"hemansu.tanty@gmail.com"
] | hemansu.tanty@gmail.com |
f3721e6288f8d9831090484038b359b63842819e | a6aab06da669f9716a769db9f4c0daf51da249c4 | /Git-DemoOneMyBatis/src/dao/StudentDao.java | 545dbc591e014e988d17fa085c5bfdc6f00a0a21 | [] | no_license | cccy-cy/Git-DemoOne | 51bf21050c482f7899167cc5eeb06fc53a0601e2 | a4288ee6bae8e4c93a60d0aef52f139f942cab39 | refs/heads/master | 2021-02-18T13:37:35.098107 | 2020-03-08T09:42:22 | 2020-03-08T09:42:22 | 245,200,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,044 | java | package dao;
import domain.Student;
import domain.Teacher;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
//一对多的dao
// 一端是Teacher
// 多端是student
public interface StudentDao {
@Results(
id = "selectTeacherOne",
value = {
@Result(property = "tid", column = "tid", id = true),
@Result(property = "tname", column = "tname"),
@Result(property = "tage", column = "tage"),
@Result(property = "subject", column = "subject"),
@Result(property = "studentList", column = "tid" , many = @Many(select = "teacherForStudent", fetchType = FetchType.LAZY)),
}
)
@Select("select tid, tname, tage, subject from teacher where tid = #{tid}")
public Teacher selectOneTeacher(@Param("tid") Integer tid);
@Select("select sid, sname, sage, gender, tid from student where tid = #{tid}")
public Student teacherForStudent(@Param("tid") Integer tid);
}
| [
"1003880711@qq.com"
] | 1003880711@qq.com |
5c751bc8d12bc45457d2b6a7271d62a587365534 | dd674d74a7bba206c7f17b612c0a573dfc211445 | /code-forces/src/com/app/problems/gfg/dp/sample/LongestRepeatingSubsequence.java | 298c34308a0f5a3253b59be904e1fc1dab9c171d | [] | no_license | TanayaKarmakar/ds_algo | 3f2ea4de9876922b007ae8dc3f9b5a406052d49d | 26344e9e4b5d76367355c3ec39c04550ccccb9b1 | refs/heads/master | 2021-06-23T02:28:32.446005 | 2021-05-21T01:41:06 | 2021-05-21T01:41:06 | 217,259,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 684 | java | package com.app.problems.gfg.dp.sample;
import java.util.Scanner;
public class LongestRepeatingSubsequence {
private static int lrs(String str) {
int n = str.length();
int[][] dp = new int[n + 1][n + 1];
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n; j++) {
if(i != j && str.charAt(i - 1) == str.charAt(j - 1)) {
dp[i][j] = 1 + dp[i - 1][j - 1];
} else {
dp[i][j] = Integer.max(dp[i - 1][j], dp[i][j - 1]);
}
}
}
return dp[n][n];
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String text = scanner.next();
int ans = lrs(text);
System.out.println(ans);
scanner.close();
}
}
| [
"karmakar.tanaya@gmail.com"
] | karmakar.tanaya@gmail.com |
4f2df41af1d770561cdf11fcd6bbc998f0950e65 | 8b85c2717f46289c7ee143ca4be9f82f253fbed4 | /app/src/main/java/com/pb/criconet/layout/VideoEncResolutionAdapter.java | 75c233d5d2aba0598a2a14b586003799395785a9 | [] | no_license | afzal-hussain-coder/n | b5a8c556501ecfc67f14acaaf5a7abf2b1233a38 | bd641e1dafc8253bc70d4af7836990b25b655792 | refs/heads/master | 2023-04-09T13:20:25.886022 | 2021-04-20T07:40:34 | 2021-04-20T07:40:34 | 359,784,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,695 | java | package com.pb.criconet.layout;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.pb.criconet.R;
import com.pb.criconet.models.ConstantApp;
public class VideoEncResolutionAdapter extends RecyclerView.Adapter {
private Context mContext;
private int mSelectedIdx;
public VideoEncResolutionAdapter(Context context, int selected) {
this.mContext = context;
this.mSelectedIdx = selected;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.video_enc_resolution_item, parent, false);
VideoEncResolutionViewHolder ph = new VideoEncResolutionViewHolder(v);
return ph;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
String resolution = mContext.getResources().getStringArray(R.array.string_array_resolutions)[position];
((VideoEncResolutionViewHolder) holder).mTextResolution.setText(resolution);
holder.itemView.setBackgroundResource(position == mSelectedIdx ? R.drawable.rounded_bg_for_btn : R.drawable.rounded_bg_for_btn_normal);
((VideoEncResolutionViewHolder) holder).mTextResolution.setTextColor(mContext.getResources().getColor(position == mSelectedIdx ? android.R.color.white : R.color.text_grey3));
}
@Override
public int getItemCount() {
return mContext.getResources().getStringArray(R.array.string_array_resolutions).length;
}
public class VideoEncResolutionViewHolder extends RecyclerView.ViewHolder {
public TextView mTextResolution;
public VideoEncResolutionViewHolder(View itemView) {
super(itemView);
mTextResolution = (TextView) itemView.findViewById(R.id.video_enc_resolution);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSelectedIdx = getLayoutPosition();
notifyDataSetChanged();
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(mContext);
SharedPreferences.Editor editor = pref.edit();
editor.putInt(ConstantApp.PrefManager.PREF_PROPERTY_VIDEO_ENC_RESOLUTION, mSelectedIdx);
editor.apply();
}
});
}
}
}
| [
"solutionspath21@gmail.com"
] | solutionspath21@gmail.com |
347f650239b74737f7dde532ce472f1073781e76 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/17/17_a019771b080b41e1bfe465bc7a52f10af082e052/USI_TRDR/17_a019771b080b41e1bfe465bc7a52f10af082e052_USI_TRDR_t.java | 1118bc56dc10c8a3f78e1043c814e36b2cedb642 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,588 | java | package instructions;
import static assemblernator.ErrorReporting.makeError;
import assemblernator.ErrorReporting.ErrorHandler;
import assemblernator.Instruction;
import assemblernator.Module;
import assemblernator.OperandChecker;
/**
* The TRDR instruction.
*
* @author Generate.java
* @date Apr 08, 2012; 08:26:19
* @specRef JT4
*/
public class USI_TRDR extends Instruction {
/**
* The operation identifier of this instruction; while comments should not
* be treated as an instruction, specification says they must be included in
* the user report. Hence, we will simply give this class a semicolon as its
* instruction ID.
*/
private static final String opId = "TRDR";
/** This instruction's identifying opcode. */
private static final int opCode = 0x00000024; // 0b10010000000000000000000000000000
/** The static instance for this instruction. */
static USI_TRDR staticInstance = new USI_TRDR(true);
/** @see assemblernator.Instruction#getNewLC(int, Module) */
@Override public int getNewLC(int lc, Module mod) {
return lc+1;
}
String dest = "";
String src = "";
/** @see assemblernator.Instruction#check(ErrorHandler) */
@Override public boolean check(ErrorHandler hErr) {
boolean isValid = true;
//not enough operand check
if(this.operands.size() < 2){
isValid=false;
hErr.reportError(makeError("instructionMissingOp", this.getOpId(), ""), this.lineNum, -1);
//checks combos for 2 operands
}else if(this.operands.size() == 2){
if(this.hasOperand("DM")){
dest="DM";
//range check
isValid = OperandChecker.isValidMem(this.getOperand("DM"));
if(!isValid) hErr.reportError(makeError("OORmemAddr", "DM", this.getOpId()), this.lineNum, -1);
if(this.hasOperand("FR")){
src="FR";
//range checking
isValid = OperandChecker.isValidReg(this.getOperand("FR"));
if(!isValid) hErr.reportError(makeError("OORidxReg", "FR", this.getOpId()), this.lineNum, -1);
}else if(this.hasOperand("FX")){
src="FX";
//range checking
isValid = OperandChecker.isValidIndex(this.getOperand("FX"));
if(!isValid) hErr.reportError(makeError("OORidxReg", "FX", this.getOpId()), this.lineNum, -1);
}else{
isValid=false;
hErr.reportError(makeError("instructionMissingOp", this.getOpId(), "FR or FX"), this.lineNum, -1);
}
}else{
isValid=false;
hErr.reportError(makeError("instructionMissingOp", this.getOpId(), "DM"), this.lineNum, -1);
}
//checks combos for 3 operands
}else if(this.operands.size() == 3){
if(this.hasOperand("DX") && this.hasOperand("DM")){
dest="DMDX";
//range check
isValid = OperandChecker.isValidIndex(this.getOperand("DX"));
if(!isValid) hErr.reportError(makeError("OORidxReg", "DX", this.getOpId()), this.lineNum, -1);
isValid = OperandChecker.isValidMem(this.getOperand("DM"));
if(!isValid) hErr.reportError(makeError("OORmemAddr", "DM", this.getOpId()), this.lineNum, -1);
if(this.hasOperand("FR")){
src="FR";
//range checking
isValid = OperandChecker.isValidReg(this.getOperand("FR"));
if(!isValid) hErr.reportError(makeError("OORidxReg", "FR", this.getOpId()), this.lineNum, -1);
}else if(this.hasOperand("FX")){
src="FX";
//range checking
isValid = OperandChecker.isValidIndex(this.getOperand("FX"));
if(!isValid) hErr.reportError(makeError("OORidxReg", "FX", this.getOpId()), this.lineNum, -1);
}else{
isValid=false;
hErr.reportError(makeError("instructionMissingOp", this.getOpId(), "FR or FX"), this.lineNum, -1);
}
}else{
isValid=false;
hErr.reportError(makeError("instructionMissingOp", this.getOpId(), "DX or DM"), this.lineNum, -1);
}
//to many operands
}else{
isValid =false;
hErr.reportError(makeError("extraOperandsIns", this.getOpId()), this.lineNum, -1);
}
return isValid; // TODO: IMPLEMENT
}
/** @see assemblernator.Instruction#assemble() */
@Override public int[] assemble() {
return null; // TODO: IMPLEMENT
}
/** @see assemblernator.Instruction#execute(int) */
@Override public void execute(int instruction) {
// TODO: IMPLEMENT
}
// =========================================================
// === Redundant code ======================================
// =========================================================
// === This code's the same in all instruction classes, ====
// === But Java lacks the mechanism to allow stuffing it ===
// === in super() where it belongs. ========================
// =========================================================
/**
* @see Instruction
* @return The static instance of this instruction.
*/
public static Instruction getInstance() {
return staticInstance;
}
/** @see assemblernator.Instruction#getOpId() */
@Override public String getOpId() {
return opId;
}
/** @see assemblernator.Instruction#getOpcode() */
@Override public int getOpcode() {
return opCode;
}
/** @see assemblernator.Instruction#getNewInstance() */
@Override public Instruction getNewInstance() {
return new USI_TRDR();
}
/**
* Calls the Instance(String,int) constructor to track this instruction.
*
* @param ignored
* Unused parameter; used to distinguish the constructor for the
* static instance.
*/
private USI_TRDR(boolean ignored) {
super(opId, opCode);
}
/** Default constructor; does nothing. */
private USI_TRDR() {}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
66d8279a9f4bf489cc40fd39e19af369a143953a | c3a3e1451f2037b9606e5337b659742ef0a118e4 | /backend/src/main/java/com/devsuperior/dsdeliver/controllers/ProductController.java | 55ad946051918b20b59225660f22eef1f6946fbe | [] | no_license | JoseVieira1996/dsdeliver-sds2 | 19b8295c525706a7d9c71e512348352900c40d41 | f09f9745d2461b52550a3c84e074a9604f466ca2 | refs/heads/main | 2023-06-02T22:39:05.207768 | 2021-06-19T22:36:00 | 2021-06-19T22:36:00 | 327,172,195 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package com.devsuperior.dsdeliver.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.devsuperior.dsdeliver.dto.ProductDTO;
import com.devsuperior.dsdeliver.services.ProductService;
@RestController
@RequestMapping(value= "/products")
public class ProductController {
@Autowired
private ProductService service;
@GetMapping
public ResponseEntity <List<ProductDTO>> findAll(){
List<ProductDTO> list = service.findAll();
return ResponseEntity.ok().body(list);
}
}
| [
"jose.adm@outlook.com"
] | jose.adm@outlook.com |
c8770ce3995556270ad24bc30a33f3cf4a70b2b3 | ecd911f907194ea7798f35074ef5cf006be51f43 | /src/Entity/User.java | 3d6f15aed96775c07ca7cd68e38bf0b3284c1d58 | [] | no_license | ABahramii/web-project | 49407a3371ff90833ec32d4ffeed33a2aaeaf25d | 183e8daf51a6fbc91cb4c6ca9f42cc59dd1b7d4c | refs/heads/master | 2022-04-25T11:59:37.281222 | 2020-04-19T19:48:24 | 2020-04-19T19:48:24 | 257,085,477 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package Entity;
public class User {
public static boolean isValid(String name, String password)
{
return name.equals("Amir Mohammad") && password.equals("admin123");
}
}
| [
"amirbahraami99@gmail.com"
] | amirbahraami99@gmail.com |
810f70dc57c6e485b6e550e370e630d8e234d04e | 83ef0ebe47c7e0ce41d91f92281d03c634983021 | /src/plateOCR/ImgAPI.java | 9d154681fda11663e8f14cb9150f708b3d182785 | [] | no_license | spectral369/Old_Learning_Files | 262691b5ed9f26e78de5f141ef830fb71d9e59ad | f024f10423afaa12641c1ad6d188169356a6c397 | refs/heads/master | 2020-04-27T14:02:32.867408 | 2019-03-07T18:22:22 | 2019-03-07T18:22:22 | 174,394,209 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,859 | java | package plateOCR;
/*package com.func.img;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
public class ImgAPI {
ImagePlate plate =null;
PlateToReadable read= null;
Mat plateImg = null;
public ImgAPI() {
// TODO Auto-generated constructor stub
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
plate = new ImagePlate();
read = new PlateToReadable();
}
public BufferedImage getLicenseNumbers(){
BufferedImage img = new BufferedImage(read.ste.width(), read.getlicense().height(), BufferedImage.TYPE_BYTE_GRAY);
byte[] data = ((DataBufferByte) img.getRaster().getDataBuffer()).getData();
read.getlicense().get(0, 0, data);
return img;
}
public BufferedImage getCountryCode(){
//Imgcodecs.imwrite("before.jpg",read.getcountryL());
//chestii ciudate se intampla cand transformam mat->to->bufferedImage
BufferedImage img = null ;
img = matToBufferedImage(read.getCountryCode(), img);
File f= new File("after.jpg");
try {
ImageIO.write(img, "jpg", f);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return img;
}
public void ProcessPlate(){
read.setOrigImg(plate.getOrig());
read.setPlate(plate);
read.defaultPreProcessing(plateImg);
}
public void setPlateReadArgs(BufferedImage originalImg,BufferedImage plate){
read.setOrigImg(bufferedImageToMat(originalImg));
read.setPlate(bufferedImageToMat2(plate));
}
public BufferedImage getPlate(){
if(plateImg == null){
plateImg = new Mat();
plateImg =plate.findPlate();
}
BufferedImage img = new BufferedImage(plateImg.width(), plateImg.height(), BufferedImage.TYPE_INT_BGR);
byte[] data = ((DataBufferByte) img.getRaster().getDataBuffer()).getData();
plateImg.get(0, 0, data);
return img;
}
public void findPlate(){
plateImg = new Mat();
plateImg =plate.findPlate();
}
public void setOriginalImage(BufferedImage img){
if(!plate.getOrig().empty())
System.out.println("Original Image changed ");
plate.setOrigImg(bufferedImageToMat(img));
}
public BufferedImage getOriginalImage(){
BufferedImage img = new BufferedImage(plate.getOrig().width(), plate.getOrig().height(), BufferedImage.TYPE_INT_RGB);
byte[] data = ((DataBufferByte) img.getRaster().getDataBuffer()).getData();
plate.getOrig().get(0, 0, data);
return img;
}
private Mat bufferedImageToMat2(BufferedImage bi) {
BufferedImage image = new BufferedImage(bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_INT_BGR);
image.getGraphics().drawImage(bi, 0, 0, null);
System.out.println(image.getType());
File outputfile = new File("buf.jpg");
try {
ImageIO.write(image, "jpg", outputfile);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
byte[] data = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
Mat mat = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8UC4);
mat.put(0, 0, data);
Imgcodecs.imwrite("intomat.jpg", mat);
return mat;
}
private Mat bufferedImageToMat(BufferedImage bi) {
BufferedImage image = bi;
byte[] data = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
Mat mat = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8UC3);
mat.put(0, 0, data);
return mat;
}
private BufferedImage matToBufferedImage(Mat matrix, BufferedImage bimg)
{
if ( matrix != null ) {
//necesar pentru ca....
matrix = matrix.colRange(matrix.cols() - matrix.cols(), matrix.cols());
int cols = matrix.cols();
int rows = matrix.rows();
int elemSize = (int)matrix.elemSize();
byte[] data = new byte[cols * rows * elemSize];
int type;
matrix.get(0, 0, data);
switch (matrix.channels()) {
case 1:
type = BufferedImage.TYPE_BYTE_GRAY;
break;
case 3:
type = BufferedImage.TYPE_3BYTE_BGR;
// bgr to rgb
byte b;
for(int i=0; i<data.length; i=i+3) {
b = data[i];
data[i] = data[i+2];
data[i+2] = b;
}
break;
default:
return null;
}
// Reuse existing BufferedImage if possible
if (bimg == null || bimg.getWidth() != cols || bimg.getHeight() != rows || bimg.getType() != type) {
bimg = new BufferedImage(cols, rows, type);
}
bimg.getRaster().setDataElements(0, 0, cols, rows, data);
} else { // mat was null
bimg = null;
}
return bimg;
}
}
*/ | [
"spectral369@spectral-pc"
] | spectral369@spectral-pc |
a830346ded09bbb17999504f58087dc2485f81bc | 2330da5086535da3e88fc0b26cde15a5d9606911 | /src/test/java/bitmap/transformer/BitmapTest.java | 498491956baacf96e7bd752846f2790aa1982ff5 | [] | no_license | twardcox/bitmap-transformer | 783970af43b82c9ce784bcf11983c06be4df8afa | eda00ba0f83a68f333dbb68eba6e092817b66364 | refs/heads/master | 2020-07-02T10:10:18.047925 | 2019-08-09T20:40:22 | 2019-08-09T20:40:22 | 201,497,292 | 0 | 1 | null | 2019-08-09T20:40:23 | 2019-08-09T15:51:12 | Java | UTF-8 | Java | false | false | 1,098 | java | /*
* This Java source file was generated by the Gradle 'init' task.
*/
package bitmap.transformer;
import org.junit.Test;
import java.nio.file.Files;
import java.nio.file.Paths;
import static org.junit.Assert.*;
public class BitmapTest {
@Test public void testConvertBW() {
Bitmap classUnderTest = new Bitmap("Coffee", "convertBW", "convertBW");
assertTrue("app should create a file named CopyCoffee in the main resources file.", Files.exists(Paths.get("./src/main/resources/convertBW.bmp")));
}
@Test public void testFlipImage() {
Bitmap classUnderTest = new Bitmap("Coffee", "flipImage", "flipImage");
assertTrue("app should create a file named CopyCoffee in the main resources file.", Files.exists(Paths.get("./src/main/resources/flipImage.bmp")));
}
@Test public void testHalfSizeIt() {
Bitmap classUnderTest = new Bitmap("Coffee", "halfSizeIt", "halfSizeIt");
assertTrue("app should create a file named CopyCoffee in the main resources file.", Files.exists(Paths.get("./src/main/resources/halfSizeIt.bmp")));
}
}
| [
"t.ward.cox@gmail.com"
] | t.ward.cox@gmail.com |
10fc3084481dc42d2e56c5d4febb207bc29a9d1e | e97f9f10cc13c5d35509fa8ff5c4695ffa503899 | /problems/pascal's_triangle_ii/solution.java | 24e0d84bf0cb05ab07418798bc09e8496f7931db | [] | no_license | texhnolyzze/leetcode-solutions | f8ee9741e6369d84484d571c1125a6197a12cb43 | 2359b90375d25183f1fb0dfdfd288dd18462f856 | refs/heads/main | 2023-08-16T11:50:10.785841 | 2021-10-15T08:55:51 | 2021-10-15T08:55:51 | 378,673,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,020 | java | class Solution {
public List<Integer> getRow(int rowIndex) {
if (rowIndex == 0)
return Arrays.asList(1);
if (rowIndex == 1)
return Arrays.asList(1, 1);
List<Integer> prevRow = new LinkedList(Arrays.asList(1, 1));
List<Integer> row = new LinkedList<>(Arrays.asList(1, null, 1));
for (int i = 2;;i++) {
ListIterator<Integer> rowIterator = row.listIterator();
ListIterator<Integer> prevRowIterator = prevRow.listIterator();
rowIterator.next(); // skip first "1"
int j = prevRowIterator.next(), k;
while (prevRowIterator.hasNext()) {
rowIterator.next();
k = prevRowIterator.next();
Integer sum = j + k;
rowIterator.set(sum);
prevRowIterator.set(sum);
j = k;
}
if (i == rowIndex)
return row;
row.add(1);
prevRow.add(1);
}
}
} | [
"ilyaskarimullin1997@gmail.com"
] | ilyaskarimullin1997@gmail.com |
4d3e195e30d3df5e9ca6172a29b455101aa82f8d | fabf53c3ae043d88b6bfa39a1688366b94c61160 | /DataStructures/Proximity/Proximity Part 3/src/gr/auth/ee/dsproject/proximity/defplayers/MinMaxPlayer.java | 7aaacbdf3b66220f027269969ad270cdfe3f440d | [] | no_license | gakonst/University_Projects | 98d63c421f7b36da8dc14b228f8397dc6ce8916f | 46ae9b604ff331805207b73ec4ed4fe9243e3a50 | refs/heads/master | 2021-01-17T08:52:23.808205 | 2017-03-05T12:46:08 | 2017-03-05T12:46:08 | 83,967,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,775 | java | package gr.auth.ee.dsproject.proximity.defplayers;
import java.util.ArrayList;
import gr.auth.ee.dsproject.proximity.board.Board;
import gr.auth.ee.dsproject.proximity.board.ProximityUtilities;
import gr.auth.ee.dsproject.proximity.board.Tile;
import gr.auth.ee.dsproject.proximity.defplayers.Node81288173;
public class MinMaxPlayer implements AbstractPlayer
{
int score;
int id;
String name;
int numOfTiles;
public MinMaxPlayer (Integer pid)
{
id = pid;
name = "MinMaxPlayer";
}
public String getName ()
{
return name;
}
public int getNumOfTiles ()
{
return numOfTiles;
}
public void setNumOfTiles (int tiles)
{
numOfTiles = tiles;
}
public int getId ()
{
return id;
}
public void setScore (int score)
{
this.score = score;
}
public int getScore ()
{
return score;
}
public void setId (int id)
{
this.id = id;
}
public void setName (String name)
{
this.name = name;
}
public int[] getNextMove (Board board, int randomNumber)
{
//Create a root for out MinMax tree
int[] emptyArray = {-1, -1, randomNumber};
Node81288173 root = new Node81288173(null, 0, emptyArray, board);
//Create the tree that spans beneath the root
createMySubTree(root, 1);
//Apply minmax algorithm to the tree
int index = chooseMinMaxMove(root);
//Return the value that was given to the root by the minmax algorithm
return root.getChildren().get(index).getNodeMove();
}
public void createMySubTree (Node81288173 parent, int depth)
{
//The possible moves will be on the empty tiles of the parent's board
Board parentBoard = parent.getBoard();
for(int i = 0; i < ProximityUtilities.NUMBER_OF_COLUMNS; i++) {
for(int j = 0; j < ProximityUtilities.NUMBER_OF_ROWS; j++) {
//If the tile is empty create a new child Node that contains that possible move
if (parentBoard.getTile(i, j).getPlayerId() == 0) {
int[] nodeMove = {i, j, parent.getNodeMove()[2]};
Node81288173 child = new Node81288173(parent, depth, nodeMove,
ProximityUtilities.boardAfterMove(this.id, parentBoard, nodeMove));
parent.addChild(child);
createOpponentSubtree(child, depth + 1);
}
}
}
}
public void createOpponentSubtree (Node81288173 parent, int depth)
{
Board parentBoard = parent.getBoard();
for(int i = 0; i < ProximityUtilities.NUMBER_OF_COLUMNS; i++) {
for(int j = 0; j < ProximityUtilities.NUMBER_OF_ROWS; j++) {
//If the tile is empty create a new child Node that contains the enemy possible move
if (parentBoard.getTile(i, j).getPlayerId() == 0) {
//Choose enemy number that will be played
int enemyRandomNumber = 20;
int enemyID;
if (this.id == 1) {
enemyID = 2;
} else {
enemyID = 1;
}
int[] nodeMove = {i, j, enemyRandomNumber};
Node81288173 child = new Node81288173(parent, depth, nodeMove,
ProximityUtilities.boardAfterMove(enemyID, parentBoard, nodeMove));
parent.addChild(child);
}
}
}
}
int chooseMinMaxMove(Node81288173 node) {
//The index of the child(move) we will be returning
int childIndex = 0;;
//If node given is a leaf
if (node.getChildren() == null) {
node.evaluate();
/*If node is not a leaf do the same for each of its children and put the min/max value
*depending on the node depth
*/
} else {
//Evaluate each of the children nodes
for (int i = 0;i < node.getChildren().size(); i++) {
chooseMinMaxMove(node.getChildren().get(i));
}
//Get their min or max value
//If it is our move get max value of children
if (node.getNodeDepth() % 2 == 0) {
double max = node.getChildren().get(0).getNodeEvaluation();
childIndex = 0;
for(int i = 1; i < node.getChildren().size(); i++) {
double potentialMax = node.getChildren().get(i).getNodeEvaluation();
if (potentialMax > max) {
max = potentialMax;
childIndex = i;
}
}
node.setNodeEvaluation(max);
//If it is enemy's move get min value of children
} else {
double min = node.getChildren().get(0).getNodeEvaluation();
for(int i = 1; i < node.getChildren().size(); i++) {
double potentialMin = node.getChildren().get(i).getNodeEvaluation();
childIndex = 0;
if (potentialMin < min) {
min = potentialMin;
childIndex = i;
}
}
node.setNodeEvaluation(min);
}
}
return childIndex;
}
}
| [
"geokonst95@gmail.com"
] | geokonst95@gmail.com |
5e26dd39c3102233fd78383c6092cad2cbed159e | 3470bff16f74b053ea284552f37f798be97764b7 | /jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsSdkTableLoader.java | a91f38f92230d8e412837e02c076da54b7f9b741 | [
"Apache-2.0"
] | permissive | gshakhn/intellij-community | 707dc4cd0951a43221aa78a569232cf1cd41d20d | f1402616a3b23db8802a5571d0bcc4f2880d1f65 | refs/heads/master | 2021-01-15T19:39:34.792819 | 2012-07-27T12:58:56 | 2012-07-27T12:58:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,910 | java | package org.jetbrains.jps.model.serialization;
import com.intellij.openapi.util.JDOMUtil;
import org.jdom.Element;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.java.JpsJavaSdkType;
import org.jetbrains.jps.model.java.JpsJavaSdkTypeWrapper;
import org.jetbrains.jps.model.library.*;
import org.jetbrains.jps.model.module.JpsSdkReferencesTable;
import org.jetbrains.jps.service.JpsServiceManager;
import java.util.HashMap;
import java.util.Map;
/**
* @author nik
*/
public class JpsSdkTableLoader {
private static final Map<String, JpsOrderRootType> PREDEFINED_ROOT_TYPES = new HashMap<String, JpsOrderRootType>();
static {
PREDEFINED_ROOT_TYPES.put("classPath", JpsOrderRootType.COMPILED);
PREDEFINED_ROOT_TYPES.put("sourcePath", JpsOrderRootType.SOURCES);
}
public static void loadSdks(@Nullable Element sdkListElement, JpsLibraryCollection result) {
for (Element sdkElement : JDOMUtil.getChildren(sdkListElement, "jdk")) {
result.addLibrary(loadSdk(sdkElement));
}
}
private static JpsLibrary loadSdk(Element sdkElement) {
String name = getAttributeValue(sdkElement, "name");
String typeId = getAttributeValue(sdkElement, "type");
JpsSdkPropertiesLoader<?> loader = getSdkPropertiesLoader(typeId);
final JpsLibrary library = createSdk(name, loader, sdkElement);
final Element roots = sdkElement.getChild("roots");
for (Element rootTypeElement : JDOMUtil.getChildren(roots)) {
JpsOrderRootType rootType = getRootType(rootTypeElement.getName());
if (rootType != null) {
for (Element rootElement : JDOMUtil.getChildren(rootTypeElement)) {
loadRoots(rootElement, library, rootType);
}
}
}
return library;
}
private static void loadRoots(Element rootElement, JpsLibrary library, JpsOrderRootType rootType) {
final String type = rootElement.getAttributeValue("type");
if (type.equals("composite")) {
for (Element element : JDOMUtil.getChildren(rootElement)) {
loadRoots(element, library, rootType);
}
}
else if (type.equals("simple")) {
library.addRoot(rootElement.getAttributeValue("url"), rootType);
}
}
@Nullable
private static JpsOrderRootType getRootType(String typeId) {
final JpsOrderRootType rootType = PREDEFINED_ROOT_TYPES.get(typeId);
if (rootType != null) {
return rootType;
}
for (JpsModelLoaderExtension extension : JpsServiceManager.getInstance().getExtensions(JpsModelLoaderExtension.class)) {
final JpsOrderRootType type = extension.getSdkRootType(typeId);
if (type != null) {
return type;
}
}
return null;
}
private static <P extends JpsSdkProperties> JpsLibrary createSdk(String name, JpsSdkPropertiesLoader<P> loader, Element sdkElement) {
String versionString = getAttributeValue(sdkElement, "version");
String homePath = getAttributeValue(sdkElement, "homePath");
return JpsElementFactory.getInstance().createLibrary(name, loader.getType(), loader.loadProperties(homePath, versionString, sdkElement.getChild("additional")));
}
public static JpsSdkPropertiesLoader<?> getSdkPropertiesLoader(String typeId) {
for (JpsModelLoaderExtension extension : JpsServiceManager.getInstance().getExtensions(JpsModelLoaderExtension.class)) {
for (JpsSdkPropertiesLoader<?> loader : extension.getSdkPropertiesLoaders()) {
if (loader.getTypeId().equals(typeId)) {
return loader;
}
}
}
return new JpsSdkPropertiesLoader<JpsSdkProperties>("JavaSDK", JpsJavaSdkType.INSTANCE) {
@Override
public JpsSdkProperties loadProperties(String homePath, String version, Element propertiesElement) {
return new JpsSdkProperties(homePath, version);
}
};
}
@Nullable
private static String getAttributeValue(Element element, String childName) {
final Element child = element.getChild(childName);
return child != null ? child.getAttributeValue("value") : null;
}
public static JpsSdkType<?> getSdkType(String typeId) {
return getSdkPropertiesLoader(typeId).getType();
}
public static void setSdkReference(final JpsSdkReferencesTable table, String sdkName, JpsSdkType<?> sdkType) {
JpsLibraryReference reference = JpsElementFactory.getInstance().createSdkReference(sdkName, sdkType);
table.setSdkReference(sdkType, reference);
if (sdkType instanceof JpsJavaSdkTypeWrapper) {
JpsLibrary jpsLibrary = reference.resolve();
if (jpsLibrary != null) {
String name = ((JpsJavaSdkTypeWrapper)sdkType).getJavaSdkName((JpsSdkProperties)jpsLibrary.getProperties());
if (name != null) {
table.setSdkReference(JpsJavaSdkType.INSTANCE, JpsElementFactory.getInstance().createSdkReference(name, JpsJavaSdkType.INSTANCE));
}
}
}
}
}
| [
"Nikolay.Chashnikov@jetbrains.com"
] | Nikolay.Chashnikov@jetbrains.com |
b563af811c63f8157a2ddbf807f15fa997f5c428 | ec0ca7ddb7e1e4f943055343320ad31d59d8d3fc | /JAVA-SE/12.【Object类、常用API】/src/main/java/com/aurora/demo01/Object/Demo01ToString.java | 6efa5e289020a6ea391b0deb4bf1391e44154563 | [] | no_license | liuxuan-scut/JavaSE | eab815b49880b193380782b120e975aabec4390c | aa8f78164e6d2884e4c2d87869374cf6f8438f3c | refs/heads/master | 2022-11-24T11:30:09.724248 | 2020-07-31T05:35:24 | 2020-07-31T05:35:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,592 | java | package com.aurora.demo01.Object;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
/*
java.lang.Object
类 Object 是类层次结构的根(父)类。
每个类(Person,Student...)都使用 Object 作为超(父)类。
所有对象(包括数组)都实现这个类的方法。
*/
public class Demo01ToString{
public static void main(String[] args) {
/*
Person类默认继承了Object类,所以可以使用Object类中的toString方法
String toString() 返回该对象的字符串表示。
*/
Person p = new Person("张三",18);
String s = p.toString();
System.out.println(s);//com.itheima.demo01.Object.Person@75412c2f | abc | Person{name=张三 ,age=18}
//直接打印对象的名字,其实就是调用对象的toString p=p.toString();
System.out.println(p);//com.itheima.demo01.Object.Person@5f150435 | abc | Person{name=张三 ,age=18}
//看一个类是否重写了toString,直接打印这个类的对象即可,如果没有重写toString方法那么打印的是对象的地址值
Random r = new Random();
System.out.println(r);//java.util.Random@3f3afe78 没有重写toString方法
Scanner sc = new Scanner(System.in);
System.out.println(sc);//java.util.Scanner[delimiters=\p{javaWhitespace}+.. 重写toString方法
ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
list.add(3);
System.out.println(list);//[1, 2, 3] 重写toString方法
}
}
| [
"wh14787946648@outlook.com"
] | wh14787946648@outlook.com |
ee6e628878badb6080ae65f1a595bf873b0d65e0 | b8f4bec79f5ae3453951d224405bc2149a3f381f | /src/main/java/com/itisacat/retry/demo/RetryApplication.java | dae2ef69d43ca47082951d01310a6644a4351075 | [] | no_license | gaoqiuling/javaagentdemo | aa4e72dbe10d1df62c40d64bd4bb609933146eda | 9d10e2e5f0be8691776de91a9479547b4647c798 | refs/heads/main | 2023-02-07T23:07:13.136709 | 2020-12-24T08:20:35 | 2020-12-24T08:20:35 | 319,584,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package com.itisacat.retry.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.retry.annotation.EnableRetry;
@SpringBootApplication(scanBasePackages = "com.itisacat.retry.demo")
@EnableRetry
public class RetryApplication {
public static void main(String[] args) {
SpringApplication.run(RetryApplication.class, args);
}
}
| [
"gaoqiuling@hujiang.com"
] | gaoqiuling@hujiang.com |
1bbda46dd54f5487000754158591340a11a52963 | 75a6d9cc4aed30812bb3c8852cc1273e4b32ea73 | /src/main/java/com/ers/v1/servlet/prediction/PredictionServlet.java | 4f06496c44cb2c19a4bdb66ea713134e7406ac40 | [] | no_license | firecat8/web | 75322c57d380c0085e0081441813f1aa8464e99d | 198118d77e43ac15f63d9c1aa7e43b024a4fc125 | refs/heads/master | 2022-07-22T23:06:33.994048 | 2020-02-05T09:22:47 | 2020-02-05T09:22:47 | 162,112,622 | 0 | 0 | null | 2021-04-26T18:44:16 | 2018-12-17T10:20:22 | JavaScript | UTF-8 | Java | false | false | 5,882 | java | /*
* EuroRisk Systems (c) Ltd. All rights reserved.
*/
package com.ers.v1.servlet.prediction;
import com.ers.v1.adapter.PredictionAdapter;
import com.ers.v1.converter.PredictionConfigVoConverter;
import com.ers.v1.converter.PredictionResultsConverter;
import com.ers.v1.entities.MarketFactorInfoHolder;
import com.ers.v1.servlet.ServletHelper;
import com.eurorisksystems.riskengine.ws.v1_1.vo.ServiceStatusVo;
import com.eurorisksystems.riskengine.ws.v1_1.vo.StateVo;
import com.eurorisksystems.riskengine.ws.v1_1.vo.market.factor.InstrumentMarketFactorVo;
import com.eurorisksystems.riskengine.ws.v1_1.vo.prediction.PredictionConfigVo;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import javax.servlet.annotation.WebServlet;
import com.ers.v1.utils.ConverterUtils;
import com.eurorisksystems.riskengine.ws.v1_1.vo.portfolio.evaluation.EvaluationIdVo;
import com.google.gson.JsonSyntaxException;
import java.util.Calendar;
import java.util.TreeMap;
import javax.servlet.http.HttpSession;
/**
*
* @author gdimitrova
*/
@WebServlet(name = "PredictionServlet", urlPatterns = {"/predict"})
public class PredictionServlet extends HttpServlet {
private final static Logger LOGGER = Logger.getLogger(PredictionServlet.class.getCanonicalName());
private final JsonParser JSON_PARSER = new JsonParser();
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.sendError(405, "Method GET Not Allowed");
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
PredictionAdapter adapter = new PredictionAdapter();
response.setContentType("application/json;charset=UTF-8;");
PrintWriter writer = response.getWriter();
ServletHelper servletHelper = new ServletHelper();
JsonObject inputJsonObj = JSON_PARSER.parse(
ConverterUtils.INSTANCE.convertToStringFromOneReadLine(
request.getInputStream())).getAsJsonObject();
if (inputJsonObj.get("mfId") == null || inputJsonObj.get("mfId").getAsString().equals("")) {
response.sendError(400, "Please upload Excel file.");
return;
}
String mfId = inputJsonObj.get("mfId").getAsString();
HttpSession session = request.getSession();
MarketFactorInfoHolder marketFactorInfoHolder = (MarketFactorInfoHolder) session.getAttribute(mfId);
InstrumentMarketFactorVo marketFactorVo = marketFactorInfoHolder.getMarketFactorVo();
String underlyingId = marketFactorVo.getInstrumentId();
if (underlyingId == null) {
response.sendError(404, "Not found series!");
return;
}
TreeMap<Calendar, Double> quotes = (TreeMap)marketFactorInfoHolder.getQuotes();
if ("dummy".equals(underlyingId) || !underlyingId.contains("CommodityINEA_")) {
adapter.createInstrument(mfId);
if (servletHelper.checkErrors(adapter, response)) {
return;
}
marketFactorVo = adapter.getMarketFactorVo();
session.setAttribute(mfId, new MarketFactorInfoHolder(marketFactorInfoHolder.getFilename(), marketFactorVo,quotes));
}else{
adapter.setMarketFactorVo(marketFactorVo);
}
final String evalId = startPrediction(inputJsonObj.get("config").toString(), adapter,quotes.lastKey());
if (servletHelper.checkErrors(adapter, response)) {
return;
}
String predictResultsJson = PredictionResultsConverter.INSTANCE.toString(adapter.getResults());
JsonObject resultsJsonObject = new JsonParser()
.parse(predictResultsJson)
.getAsJsonObject();
session.setAttribute(evalId,
resultsJsonObject.get("results").getAsJsonArray());
resultsJsonObject.addProperty("evalID", evalId);
resultsJsonObject.addProperty("seriesID", marketFactorVo.getId());
writer.write(resultsJsonObject.toString());
} catch (JsonSyntaxException | IOException | InterruptedException ex) {
response.sendError(500, ex.getMessage());
LOGGER.log(Level.SEVERE, null, ex);
}
}
private void checkStatus(PredictionAdapter adapter) throws InterruptedException {
ServiceStatusVo status;
do {
TimeUnit.SECONDS.sleep(5);
status = adapter.checkStatus();
if (status == null) {
break;
}
LOGGER.log(Level.INFO, " {0} {1}", new Object[]{status.getDescription(), status.getState().value()});
} while (status.getState() == StateVo.WORKING);
}
private String startPrediction(String config, PredictionAdapter adapter,Calendar lastDate) throws InterruptedException {
PredictionConfigVo predictionConfigVo = PredictionConfigVoConverter.INSTANCE.toObject(config);
EvaluationIdVo evalId = adapter.createEvaluation(predictionConfigVo,lastDate);
checkStatus(adapter);
adapter.predictFundPrice();
checkStatus(adapter);
adapter.getPredictionResults();
adapter.deleteEval();
return evalId.getName();
}
}
| [
"geriii1993@gmail.com"
] | geriii1993@gmail.com |
90d30ab53c2af6b4f433037f9c744779d76109a9 | 80335729b4f362157bcee2446c66518510255873 | /forx-core/src/main/java/com/github/s262316/forx/box/relayouter/LayoutResult.java | 86ebf573eefab34cfd5bead40b1e8bc275fae67e | [] | no_license | s262316/forx | b2573c2ef4226296d586989424ec4468c7b6888d | a93261206b033bd5c2ec820d10eb297d51ad2714 | refs/heads/master | 2020-07-02T11:21:06.728449 | 2018-11-14T00:20:00 | 2018-11-14T00:20:00 | 74,310,919 | 0 | 0 | null | 2018-11-14T00:20:01 | 2016-11-21T00:04:19 | Java | UTF-8 | Java | false | false | 455 | java | package com.github.s262316.forx.box.relayouter;
import com.google.common.base.Optional;
public class LayoutResult
{
private boolean success;
private Optional<Relayouter> relayouter;
public LayoutResult(boolean success, Optional<Relayouter> relayouter)
{
this.success = success;
this.relayouter = relayouter;
}
public boolean isSuccess()
{
return success;
}
public Optional<Relayouter> getRelayouter()
{
return relayouter;
}
}
| [
"s262316@users.noreply.github.com"
] | s262316@users.noreply.github.com |
91189524c0a9bebee569c784fc218072b0d08ce0 | 961ce07c652a6f6d06a49c46b760a5354ac2b9f6 | /src/main/java/String/Removespecialcharacters.java | 5105e610918424804110142a275239baa601fb44 | [] | no_license | meetparag81/JavaIMP | f8e5b2f3b890634ae330e8d0951acf967a2a8c41 | c17823d3cbad15f9739945374f296d4b6bb0fd0b | refs/heads/master | 2022-10-01T00:36:45.184717 | 2022-09-11T09:12:26 | 2022-09-11T09:12:26 | 148,194,910 | 0 | 0 | null | 2022-09-11T09:12:26 | 2018-09-10T17:43:36 | Java | UTF-8 | Java | false | false | 234 | java | package String;
public class Removespecialcharacters {
public static void main(String[] args) {
String s = "Selenium.#$^n1265><@#%^&?";
//using reqular expression
s.replaceAll("[^a-zA-Z0-9]", " ");
System.out.println(s);
}
}
| [
"paragborawake81@gmail.com"
] | paragborawake81@gmail.com |
6a432d551650a985d461e8575ddb2be5698599c2 | d3471d7958974e695ff94848c47e2c4ad32972af | /src/com/fastsync/client/FSNativeLib.java | 890a5f684603d4e12472b41dd11250b252b35563 | [] | no_license | mjpguerra/SFA-Agrindus | 77c18c17308240172eb48f10f50e27d2e826a3ca | d929b076f00fc35571ff9077870b8f82fe760f01 | refs/heads/master | 2020-07-18T21:16:21.750961 | 2019-10-15T20:40:38 | 2019-10-15T20:40:38 | 206,311,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.fastsync.client;
public class FSNativeLib {
static {
System.loadLibrary("fastsync");
}
public native int StartSync(String ip, int port, String user, String serial, int tout, String group, String dbpath, String dbname);
public native String hello();
} | [
"mfilho@MacBook-Pro-de-Mario.local"
] | mfilho@MacBook-Pro-de-Mario.local |
e00654abf8ef7e83c21895057309ff160537986b | 0a308a16a768ab8d44e5a47c45a4efabd9ee6963 | /app/src/main/java/com/example/bokjirock/introActivity.java | b3760cb6b63eeb711099d99ea0bfb52befef8e15 | [] | no_license | jaeyoon1015/Seoul_app | ace502c8a39c663c029eb3b4c2c1fe1cca1950b8 | 30c7a2737a19aca1a6c169e55dfa73bb72e1cb7a | refs/heads/master | 2020-07-25T22:10:00.345378 | 2019-09-30T03:49:17 | 2019-09-30T03:49:17 | 208,437,493 | 0 | 2 | null | 2019-09-29T08:25:30 | 2019-09-14T12:30:01 | Java | UTF-8 | Java | false | false | 802 | java | package com.example.bokjirock;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class introActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.intro_activity);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
Intent intent = new Intent(introActivity.this, MainActivity.class);
startActivity(intent);
// 뒤로가기 했을경우 안나오도록 없애주기 >> finish!!
finish();
}
}, 2000);
}
}
| [
"apfhd9043@naver.com"
] | apfhd9043@naver.com |
38eb3df71232d2f0f767d4a0b60a390d1a432a71 | 4667358951c1212933a443b0ca34c7ec0e54ef8f | /vowelConsonant/src/ConsonantOrVowels.java | 2f642eb4aba4f9bd184a6b7bb3095ef8d794bd50 | [] | no_license | dk241294/Java-samples | 7fdaccee7df79b39186ebb7d4f47791478acf7a5 | 7bc3336e4debce5909a827793ba51c87852a2220 | refs/heads/master | 2020-05-15T21:00:12.056817 | 2019-08-30T16:38:08 | 2019-08-30T16:38:08 | 182,491,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 776 | java | public class ConsonantOrVowels {
public static boolean constantOrNot(char ch) {
// isVowel = false;
switch (ch) {
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
case 'A':
case 'E':
case 'O':
case 'U':
System.out.println(" is a vowels " + ch);
return true;
default:
if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) {
System.out.println(" is a consonant " + ch);
return false;
} else {
System.out.println("is not alphabet");
return false;
}
}
}
}
| [
"deepak24121994@gmail.com"
] | deepak24121994@gmail.com |
f1649a608c75b8af4aa13bdae87badaacec8021b | 6cf787b7585baa4061dd6e4cf5a1932e2d13db13 | /src/main/java/SendInvite.java | 2714c942429d35f4a929cbee02d738ab28385bf5 | [] | no_license | henri-tremblay/sendinvite | 97000671b42b79b4979f6a379a10c896a0b09ef3 | 5e0b46030146b7988dc277aaef8272594a253a3e | refs/heads/master | 2023-02-10T05:21:41.364892 | 2021-01-12T22:04:19 | 2021-01-12T22:04:19 | 327,791,597 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,411 | java | import com.google.api.client.util.DateTime;
import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.EventAttendee;
import com.google.api.services.calendar.model.EventDateTime;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class SendInvite {
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm z");
private final Calendar calendar;
private final Map<String, String> people;
public SendInvite(Calendar calendar, Map<String, String> people) {
this.calendar = calendar;
this.people = people;
}
public static void main(String[] args) throws Exception {
Map<String, String> people = readPeople();
CalendarFactory calendarFactory = new CalendarFactory();
Calendar calendar = calendarFactory.newCalendar();
SendInvite service = new SendInvite(calendar, people);
Files.lines(Paths.get("slots.csv"), StandardCharsets.UTF_8)
.skip(1)
.map(line -> line.split(";"))
.map(tokens -> new Object() {
// Day,Room,Time (EST),Title,Speaker 1,Speaker 2,Moderator,Guest URL,YouTube URL
final String day = tokens[0];
final String room = tokens[1];
final String time = tokens[2];
final String title = tokens[3];
final String speaker1 = tokens[4];
final String speaker2 = tokens[5];
final String moderator = tokens[6];
final String guestUrl = tokens[7];
final String youtubeUrl = tokens[8];
})
.map(tuple -> new Object() {
final String summary = "jChampion Conference slot: " + tuple.title;
final String location = tuple.guestUrl;
final String description = "Hi,\nDon't forget, you are presenting or moderating a session at jChampions Conference.\nHere is the information you need:\n"
+ "Room (gmail account to use to connect to StreamYard): " + tuple.room + "\n"
+ "Title: " + tuple.title + "\n"
+ "Speaker 1: " + tuple.speaker1 + "\n"
+ "Speaker 2: " + tuple.speaker2 + "\n"
+ "Moderator: " + tuple.moderator + "\n"
+ "Speaker URL: " + tuple.guestUrl + "\n"
+ "Youtube URL: " + tuple.youtubeUrl + "\n"
+ "\n"
+ "Thanks a lot, have fun!\n"
+ "jChampions Conference organizers";
final ZonedDateTime startTime = getZonedDateTime(tuple.day + " " + tuple.time + " EST");
private ZonedDateTime getZonedDateTime(String time) {
return ZonedDateTime.parse(time, FORMATTER);
}
final ZonedDateTime endTime = startTime.plusHours(1);
final String[] attendees = Stream.of(tuple.speaker1, tuple.speaker2, tuple.moderator)
.filter(p -> p != null && !p.isBlank())
.map(p -> {
String email = people.get(p);
if(email == null) {
throw new IllegalArgumentException("Unknown name: " + p);
}
return email;
})
.toArray(String[]::new);
})
.forEach(tuple -> service.createInvitation(
tuple.summary,
tuple.location,
tuple.description,
tuple.startTime,
tuple.endTime,
tuple.attendees
));
}
private static Map<String, String> readPeople() {
try {
return Files.lines(Paths.get("people.csv"), StandardCharsets.UTF_8)
.map(line -> line.split(";"))
.map(tokens -> new Object() {
final String name = tokens[0];
final String email = tokens[1];
})
.collect(Collectors.toMap(tuple -> tuple.name, tuple -> tuple.email));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
private void createInvitation(String summary, String location, String description, ZonedDateTime startTime, ZonedDateTime endTime, String... recipients) {
Event event = new Event()
.setSummary(summary)
.setLocation(location)
.setDescription(description);
DateTime startDateTime = new DateTime(startTime.toInstant().toEpochMilli());
EventDateTime start = new EventDateTime()
.setDateTime(startDateTime)
.setTimeZone("America/Toronto");
event.setStart(start);
DateTime endDateTime = new DateTime(endTime.toInstant().toEpochMilli());
EventDateTime end = new EventDateTime()
.setDateTime(endDateTime)
.setTimeZone("America/Toronto");
event.setEnd(end);
List<EventAttendee> attendees = Stream.of(recipients)
.map(recipient -> new EventAttendee().setEmail(recipient))
.collect(Collectors.toList());
event.setAttendees(attendees);
System.out.println(event);
String calendarId = "primary";
try {
event = calendar.events().insert(calendarId, event)
.setSendNotifications(true)
.execute();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
System.out.printf("Event created: %s\n", event.getHtmlLink());
}
}
| [
"henri.tremblay@gmail.com"
] | henri.tremblay@gmail.com |
6ef461215b1f87c2afbaadf54a1b7e208b56316f | fe04bc38a5b04139ab244347c3d9b7c1da508060 | /src/RatanpurScaling/PortSetting.java | 0d5cd6425891680690e479390907777bf5a68602 | [] | no_license | mamuncse1112/Digital-Scale-Automation | 764f561143dd55041b7b971e654b732f52496d19 | fc1a75e858e0015ff5b4da3475dde99059683252 | refs/heads/master | 2023-07-26T02:24:45.621283 | 2021-09-04T14:39:47 | 2021-09-04T14:39:47 | 403,079,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,239 | 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 RatanpurScaling;
/**
*
* @author MOSTAFA
*/
public class PortSetting extends javax.swing.JFrame {
/**
* Creates new form PortSetting
*/
public PortSetting() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
comboport = new javax.swing.JComboBox<>();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(51, 153, 255));
comboport.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Select Port", "4800", "9600", "19200", "38400", "57600", "115200", "230400" }));
jButton1.setText("OK");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(133, 133, 133)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(103, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboport, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(63, 63, 63)
.addComponent(comboport, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton1)
.addContainerGap(70, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
String port = comboport.getSelectedItem().toString();
int portInt = Integer.valueOf(port);
ReceiveDataFromScale rcv = new ReceiveDataFromScale();
rcv.setbaudrate(portInt);
dispose();
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PortSetting.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(PortSetting.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(PortSetting.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(PortSetting.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PortSetting().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JComboBox<String> comboport;
private javax.swing.JButton jButton1;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
}
| [
"mamunor.rashid@selise.ch"
] | mamunor.rashid@selise.ch |
7f1c9a4f8a625d82b41a7e147cac4bdcb81115b7 | ab3bb5beed239119812dea1e9493b6e0845e1969 | /rqueue-core/src/main/java/com/github/sonus21/rqueue/core/MessageScheduler.java | a6e0a1eb0fb1dc11bf9f954a11e53adcdea011c3 | [
"Apache-2.0"
] | permissive | jinofstar/rqueue | 9c24ba492eec2d1c2372c934cbc99e0a94436589 | 22bc73f0ac2f3cb2b743a1aa795032d3e59079d3 | refs/heads/master | 2023-02-19T13:07:43.264763 | 2021-01-23T15:10:55 | 2021-01-23T15:10:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,517 | java | /*
* Copyright 2020 Sonu Kumar
*
* 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.
*/
package com.github.sonus21.rqueue.core;
import static com.github.sonus21.rqueue.utils.Constants.MAX_MESSAGES;
import static com.github.sonus21.rqueue.utils.Constants.MIN_DELAY;
import static java.lang.Math.max;
import static java.lang.Math.min;
import com.github.sonus21.rqueue.config.RqueueSchedulerConfig;
import com.github.sonus21.rqueue.core.RedisScriptFactory.ScriptType;
import com.github.sonus21.rqueue.listener.QueueDetail;
import com.github.sonus21.rqueue.models.event.RqueueBootstrapEvent;
import com.github.sonus21.rqueue.utils.Constants;
import com.github.sonus21.rqueue.utils.ThreadUtils;
import java.time.Instant;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
import lombok.AllArgsConstructor;
import lombok.ToString;
import org.slf4j.Logger;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationListener;
import org.springframework.data.redis.RedisSystemException;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultScriptExecutor;
import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.data.redis.listener.ChannelTopic;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
public abstract class MessageScheduler
implements DisposableBean, ApplicationListener<RqueueBootstrapEvent> {
@Autowired protected RqueueSchedulerConfig rqueueSchedulerConfig;
private RedisScript<Long> redisScript;
private MessageSchedulerListener messageSchedulerListener;
private DefaultScriptExecutor<String> defaultScriptExecutor;
private Map<String, Boolean> queueRunningState;
private Map<String, ScheduledTaskDetail> queueNameToScheduledTask;
private Map<String, String> channelNameToQueueName;
private Map<String, Long> queueNameToLastMessageSeenTime;
private ThreadPoolTaskScheduler scheduler;
@Autowired private RqueueRedisListenerContainerFactory rqueueRedisListenerContainerFactory;
@Autowired
@Qualifier("rqueueRedisLongTemplate")
private RedisTemplate<String, Long> redisTemplate;
protected abstract Logger getLogger();
protected abstract long getNextScheduleTime(String queueName, Long value);
protected abstract String getChannelName(String queueName);
protected abstract String getZsetName(String queueName);
protected abstract String getThreadNamePrefix();
protected abstract int getThreadPoolSize();
protected abstract boolean isProcessingQueue(String queueName);
private void doStart() {
for (String queueName : queueRunningState.keySet()) {
startQueue(queueName);
}
}
private void subscribeToRedisTopic(String queueName) {
if (isRedisEnabled()) {
String channelName = getChannelName(queueName);
getLogger().debug("Queue {} subscribe to channel {}", queueName, channelName);
this.rqueueRedisListenerContainerFactory
.getContainer()
.addMessageListener(messageSchedulerListener, new ChannelTopic(channelName));
channelNameToQueueName.put(channelName, queueName);
}
}
private void startQueue(String queueName) {
if (Boolean.TRUE.equals(queueRunningState.get(queueName))) {
return;
}
queueRunningState.put(queueName, true);
if (scheduleTaskAtStartup() || !isRedisEnabled()) {
long scheduleAt = System.currentTimeMillis() + MIN_DELAY;
schedule(queueName, scheduleAt, false);
}
subscribeToRedisTopic(queueName);
}
private void doStop() {
if (CollectionUtils.isEmpty(queueRunningState)) {
return;
}
for (Map.Entry<String, Boolean> runningStateByQueue : queueRunningState.entrySet()) {
if (Boolean.TRUE.equals(runningStateByQueue.getValue())) {
stopQueue(runningStateByQueue.getKey());
}
}
waitForRunningQueuesToStop();
queueNameToScheduledTask.clear();
}
private void waitForRunningQueuesToStop() {
for (Map.Entry<String, Boolean> runningState : queueRunningState.entrySet()) {
String queueName = runningState.getKey();
ScheduledTaskDetail scheduledTaskDetail = queueNameToScheduledTask.get(queueName);
if (scheduledTaskDetail != null) {
Future<?> future = scheduledTaskDetail.getFuture();
boolean completedOrCancelled = future.isCancelled() || future.isDone();
if (!completedOrCancelled) {
future.cancel(true);
}
}
}
}
private void stopQueue(String queueName) {
Assert.isTrue(
queueRunningState.containsKey(queueName),
"Queue with name '" + queueName + "' does not exist");
queueRunningState.put(queueName, false);
}
private boolean scheduleTaskAtStartup() {
return rqueueSchedulerConfig.isAutoStart();
}
private boolean isRedisEnabled() {
return rqueueSchedulerConfig.isRedisEnabled();
}
@Override
public void destroy() throws Exception {
doStop();
if (scheduler != null) {
scheduler.destroy();
}
}
private void createScheduler(int queueCount) {
if (queueCount == 0) {
return;
}
int threadPoolSize = min(getThreadPoolSize(), queueCount);
String threadNamePrefix = getThreadNamePrefix();
int terminationTime = 60;
scheduler = ThreadUtils.createTaskScheduler(threadPoolSize, threadNamePrefix, terminationTime);
}
private boolean isQueueActive(String queueName) {
Boolean val = queueRunningState.get(queueName);
if (val == null) {
return false;
}
return val;
}
private void addTask(MessageMoverTask timerTask, ScheduledTaskDetail scheduledTaskDetail) {
getLogger().debug("Timer: {} Task {}", timerTask, scheduledTaskDetail);
queueNameToScheduledTask.put(timerTask.getName(), scheduledTaskDetail);
}
protected synchronized void schedule(String queueName, Long startTime, boolean forceSchedule) {
boolean isQueueActive = isQueueActive(queueName);
if (!isQueueActive || scheduler == null) {
return;
}
long lastSeenTime = queueNameToLastMessageSeenTime.getOrDefault(queueName, 0L);
long currentTime = System.currentTimeMillis();
// ignore too frequents events
if (!forceSchedule && currentTime - lastSeenTime < MIN_DELAY) {
return;
}
queueNameToLastMessageSeenTime.put(queueName, currentTime);
ScheduledTaskDetail scheduledTaskDetail = queueNameToScheduledTask.get(queueName);
QueueDetail queueDetail = EndpointRegistry.get(queueName);
String zsetName = getZsetName(queueName);
if (scheduledTaskDetail == null || forceSchedule) {
long requiredDelay = max(1, startTime - currentTime);
long taskStartTime = startTime;
MessageMoverTask timerTask =
new MessageMoverTask(
queueDetail.getName(),
queueDetail.getQueueName(),
zsetName,
isProcessingQueue(queueDetail.getName()));
Future<?> future;
if (requiredDelay < MIN_DELAY) {
future = scheduler.submit(timerTask);
taskStartTime = currentTime;
} else {
future = scheduler.schedule(timerTask, Instant.ofEpochMilli(currentTime + requiredDelay));
}
addTask(timerTask, new ScheduledTaskDetail(taskStartTime, future));
return;
}
// run existing tasks continue
long existingDelay = scheduledTaskDetail.getStartTime() - currentTime;
Future<?> submittedTask = scheduledTaskDetail.getFuture();
boolean completedOrCancelled = submittedTask.isDone() || submittedTask.isCancelled();
// tasks older than TASK_ALIVE_TIME are considered dead
if (!completedOrCancelled
&& existingDelay < MIN_DELAY
&& existingDelay > Constants.TASK_ALIVE_TIME) {
ThreadUtils.waitForTermination(
getLogger(),
submittedTask,
Constants.DEFAULT_SCRIPT_EXECUTION_TIME,
"LIST: {} ZSET: {}, Task: {} failed",
queueDetail.getQueueName(),
zsetName,
scheduledTaskDetail);
}
// Run was succeeded or cancelled submit new one
MessageMoverTask timerTask =
new MessageMoverTask(
queueDetail.getName(),
queueDetail.getQueueName(),
zsetName,
isProcessingQueue(zsetName));
Future<?> future =
scheduler.schedule(
timerTask, Instant.ofEpochMilli(getNextScheduleTime(queueName, startTime)));
addTask(timerTask, new ScheduledTaskDetail(startTime, future));
}
protected void initialize() {
List<String> queueNames = EndpointRegistry.getActiveQueues();
defaultScriptExecutor = new DefaultScriptExecutor<>(redisTemplate);
redisScript = RedisScriptFactory.getScript(ScriptType.MOVE_EXPIRED_MESSAGE);
queueRunningState = new ConcurrentHashMap<>(queueNames.size());
queueNameToScheduledTask = new ConcurrentHashMap<>(queueNames.size());
channelNameToQueueName = new ConcurrentHashMap<>(queueNames.size());
queueNameToLastMessageSeenTime = new ConcurrentHashMap<>(queueNames.size());
createScheduler(queueNames.size());
if (isRedisEnabled()) {
messageSchedulerListener = new MessageSchedulerListener();
}
for (String queueName : queueNames) {
queueRunningState.put(queueName, false);
}
}
@Override
@Async
public void onApplicationEvent(RqueueBootstrapEvent event) {
doStop();
if (event.isStartup()) {
if (EndpointRegistry.getActiveQueueCount() == 0) {
getLogger().warn("No queues are configured");
return;
}
initialize();
doStart();
}
}
@ToString
@AllArgsConstructor
private class MessageMoverTask implements Runnable {
private final String name;
private final String queueName;
private final String zsetName;
private final boolean processingQueue;
@Override
public void run() {
getLogger().debug("Running {}", this);
try {
if (isQueueActive(name)) {
long currentTime = System.currentTimeMillis();
Long value =
defaultScriptExecutor.execute(
redisScript,
Arrays.asList(queueName, zsetName),
currentTime,
MAX_MESSAGES,
processingQueue ? 1 : 0);
long nextExecutionTime = getNextScheduleTime(name, value);
schedule(name, nextExecutionTime, true);
}
} catch (RedisSystemException e) {
// no op
} catch (Exception e) {
getLogger().warn("Task execution failed for the queue: {}", name, e);
}
}
public String getName() {
return this.name;
}
}
private class MessageSchedulerListener implements MessageListener {
@Override
public void onMessage(Message message, byte[] pattern) {
if (message.getBody().length == 0 || message.getChannel().length == 0) {
return;
}
String body = new String(message.getBody());
String channel = new String(message.getChannel());
getLogger().debug("Body: {} Channel: {}", body, channel);
try {
Long startTime = Long.parseLong(body);
String queueName = channelNameToQueueName.get(channel);
if (queueName == null) {
getLogger().warn("Unknown channel name {}", channel);
return;
}
schedule(queueName, startTime, false);
} catch (Exception e) {
getLogger().error("Error occurred on a channel {}, body: {}", channel, body, e);
}
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
80751a88e30199d2f9bf456b8f0f4fcdb9e4ace0 | fec4c1754adce762b5c4b1cba85ad057e0e4744a | /jf-base/src/main/java/com/jf/entity/ProductPropExtExample.java | fa1990578be1db3c5e8cf133dfe69f2b8b4301ae | [] | no_license | sengeiou/workspace_xg | 140b923bd301ff72ca4ae41bc83820123b2a822e | 540a44d550bb33da9980d491d5c3fd0a26e3107d | refs/heads/master | 2022-11-30T05:28:35.447286 | 2020-08-19T02:30:25 | 2020-08-19T02:30:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,236 | java | package com.jf.entity;
import com.jf.common.ext.query.QueryObject;
import com.jf.common.ext.util.StrKit;
public class ProductPropExtExample extends ProductPropExample{
private QueryObject queryObject;
public QueryObject getQueryObject() {
if(queryObject == null) queryObject = new QueryObject();
return queryObject;
}
public ProductPropExtExample fill(){
if(queryObject == null) return this;
if(StrKit.notBlank(queryObject.getSortString())){
setOrderByClause(queryObject.getSortString());
}
if(queryObject.getLimitSize() > 0){
setLimitStart(0);
setLimitSize(queryObject.getLimitSize());
}
return this;
}
public ProductPropExtExample fillPage(){
if(queryObject == null) queryObject = new QueryObject();
if(StrKit.notBlank(queryObject.getSortString())){
setOrderByClause(queryObject.getSortString());
}
setLimitStart(queryObject.getLimitStart());
setLimitSize(queryObject.getPageSize());
return this;
}
@Override
public ProductPropExtCriteria createCriteria() {
ProductPropExtCriteria criteria = new ProductPropExtCriteria();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
public class ProductPropExtCriteria extends Criteria{
}
}
| [
"397716215@qq.com"
] | 397716215@qq.com |
5db5e18fc4dba36317926e45a25d7325a9c1d2d1 | 8fe12c0e1e85141969ab1dcd4ea2660de0f5708c | /thinking-in-java/src/main/java/com/rengzailushang/thinkinginjava/init/array/NewVarArgs.java | c663c37ab67c9e54e20deab8f88ad618618f8400 | [] | no_license | rengx/java-exercises | bb3233caf5006ef29c1275242e57c1936fbf5039 | be4fb29421810676ba89c29ada5a331156b43621 | refs/heads/master | 2021-06-19T06:27:22.633577 | 2017-06-18T12:04:48 | 2017-06-18T12:04:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package com.rengzailushang.thinkinginjava.init.array;
/**
* Using array syntax to create variable argument listes.
*
*/
public class NewVarArgs {
// 可变参数列表
static void printArray(Object... args) {
for (Object o : args) {
System.out.print(o);
}
System.out.println();
}
public static void main(String[] args) {
printArray(new Integer(47), new Float(3.14), new Double(11.11));
printArray(47, 3.14, 11.11);
printArray("one", "two");
// 数组
printArray(new Integer[] { 1, 2, 3 });
printArray();
}
}
| [
"rengzailushang@gmail.com"
] | rengzailushang@gmail.com |
424371781b673eb417f2caf34ad4e0175c61aca1 | deeda50f4a0d2b59a6ace8a3fabea72b4d571588 | /src/main/java/com/learn/git/StartEmployee.java | a4e568c1dbf1b9193eda81fdbe43fd9ecfb2d4cf | [] | no_license | arindac/repo1 | b8742f163f91ca068faabe898c44cc054ea89738 | 8957808cbe597d1e9782fde87b2519e83130dfa2 | refs/heads/master | 2020-03-28T05:18:05.183041 | 2018-09-07T04:15:25 | 2018-09-07T04:15:25 | 147,767,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.learn.git;
public class StartEmployee {
public static void main(String[] args) {
Employee emp = new Employee();
emp.setAge(22);
emp.setName("Arindam");
emp.setSal(1000.00);
System.out.println(emp);
}
public int createEmp() {
Employee emp = new Employee();
emp.setAge(22);
emp.setName("Arindam");
emp.setSal(1000.00);
return 1;
}
}
| [
"roychar@americas.manulife.net"
] | roychar@americas.manulife.net |
97e53b726ac2f47948cacfe621b4907ed4ba8cef | 7e14ff5d3f9d109751936311ccfe8a54139613ce | /app/src/main/java/com/maxwell/bodysensor/dialogfragment/dialog/DlgSwitchMode.java | cf88ee0f1315cf6a8638a0bd94df9112bd5e44e1 | [] | no_license | Sidharth666/YUFIT | d244766b6c0f944e6171b8f6a24722b643142f62 | 277d710c1284915f37fd92312d67cbf583579b9d | refs/heads/master | 2021-01-19T06:13:06.228428 | 2015-07-15T07:21:30 | 2015-07-15T07:21:30 | 35,328,774 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,659 | java | package com.maxwell.bodysensor.dialogfragment.dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import com.maxwell.bodysensor.MXWActivity;
import com.maxwell.bodysensor.MXWApp;
import com.maxwell.bodysensor.MainActivity;
import com.maxwell.bodysensor.R;
import com.maxwell.bodysensor.data.DBProgramData;
import com.maxwell.bodysensor.data.DeviceData;
import com.maxwell.bodysensor.dialogfragment.DFBase;
import com.maxwell.bodysensor.util.UtilDBG;
import com.maxwellguider.bluetooth.activitytracker.MGActivityTracker;
import com.maxwellguider.bluetooth.activitytracker.MGActivityTrackerApi;
import java.util.List;
/**
* Created by ryanhsueh on 15/3/17.
*/
public class DlgSwitchMode extends DFBase implements
View.OnClickListener {
private MGActivityTrackerApi mMaxwellBLE;
private DBProgramData mPD;
private View mViewDismiss;
private Button mBtnSwitch;
private ListView mListView;
private String mStringSwitch = null;
private String mTargetDeviceMac = null;
List<DeviceData> mDeviceList;
private int mIndex;
// return true, to close DlgMessageYN; otherwise, return false;
public interface btnHandler {
boolean onBtnHandler();
}
private btnHandler mHandlerSwitchMode;
private btnHandler mHandlerSwitchDevice;
@Override
public String getDialogTag() {
return MXWActivity.DLG_SWITCH_MODE;
}
@Override
public int getDialogTheme() {
return R.style.app_dlg_scale_tt;
}
@Override
public void saveData() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
UtilDBG.logMethod();
MXWActivity activity = (MXWActivity) getActivity();
mMaxwellBLE = MGActivityTracker.getInstance(activity);
mPD = DBProgramData.getInstance();
View view = inflater.inflate(R.layout.dlg_switch_mode, container);
mViewDismiss = view.findViewById(R.id.layout_dismiss);
mBtnSwitch = (Button) view.findViewById(R.id.btn_switch_mode);
if (mStringSwitch!=null) {
mBtnSwitch.setText(mStringSwitch);
}
mViewDismiss.setOnClickListener(this);
mBtnSwitch.setOnClickListener(this);
mListView = (ListView) view.findViewById(R.id.list_switch_devices);
if (activity instanceof MainActivity) {
initDeviceList();
} else {
mListView.setVisibility(View.GONE);
}
return view;
}
private void initDeviceList() {
mDeviceList = mPD.getDeviceList();
if (mDeviceList != null && mDeviceList.size() > 0) {
mTargetDeviceMac = mPD.getTargetDeviceMac();
mIndex = 0;
for (DeviceData device : mDeviceList) {
if (mTargetDeviceMac.equalsIgnoreCase(device.mac)) {
break;
}
mIndex++;
}
mListView.setAdapter(new SingleListAdapter());
mListView.setItemChecked(mIndex, true);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position,
long id) {
DeviceData device = mDeviceList.get(position);
String newTargetMac = device.mac;
String currentMac = mPD.getTargetDeviceMac();
// update user focus device & connect it
if (!currentMac.equalsIgnoreCase(newTargetMac)) {
if (MXWApp.isPowerWatch(newTargetMac)) {
mPD.setTargetDeviceMac(newTargetMac);
mMaxwellBLE.connect(newTargetMac, 0);
}
}
if (mHandlerSwitchDevice != null) {
mHandlerSwitchDevice.onBtnHandler();
}
dismissIt();
}
});
} else {
mListView.setVisibility(View.GONE);
}
}
public DlgSwitchMode setSwitchDeviceButton(btnHandler h) {
mHandlerSwitchDevice = h;
return this;
}
public DlgSwitchMode setSwitchModeButton(String text, btnHandler h) {
if (text!=null) {
mStringSwitch = text;
}
mHandlerSwitchMode = h;
return this;
}
private void dismissIt() {
if (getDialog() != null) {
getDialog().dismiss();
}
}
@Override
public void onClick(View v) {
UtilDBG.d("DlgSwitchMode, onClick !!!!!!!!!!!!!");
if (v==mBtnSwitch) {
if (mHandlerSwitchMode != null) {
if (mHandlerSwitchMode.onBtnHandler()) {
dismissIt();
}
} else {
dismissIt();
}
// } else if (v==mViewDismiss) {
// dismissIt();
} else {
dismissIt();
UtilDBG.e("DlgMessageYN, unexpected onClick()");
}
}
/*
* Issue :
* Android customized single choice ListView
*
* solution :
* http://stackoverflow.com/questions/19812809/custom-listview-with-single-choice-selection
*/
protected class SingleListAdapter extends BaseAdapter {
private final LayoutInflater mInflater;
public SingleListAdapter() {
mInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return mDeviceList.size();
}
@Override
public DeviceData getItem(int position) {
return mDeviceList.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.listitem_switch_devices, null);
}
DeviceData device = mDeviceList.get(position);
((TextView) convertView.findViewById(R.id.text_name)).setText(device.displayName);
return convertView;
}
}
}
| [
"bhansidharth87@gmai.com"
] | bhansidharth87@gmai.com |
436460b5591df4ef1e4361808132618e818d428a | e737fe6cefd75b8672a288d3dcff4c2d323983ba | /src/main/java/Lesson3/Pogreshnost.java | 0b683bbca7147db90582d204b3546a0d90077db7 | [] | no_license | kitekat196/SampleProject | c39df7840a17ca9f80768ce9339838247a06427f | 63776f4eb313d3e3d514f792a74ea53910dcb62b | refs/heads/master | 2020-07-29T20:59:50.216816 | 2019-10-24T18:32:27 | 2019-10-24T18:32:27 | 209,957,458 | 0 | 0 | null | 2019-09-21T09:25:06 | 2019-09-21T09:25:06 | null | UTF-8 | Java | false | false | 537 | java | package Lesson3;
import java.util.Scanner;
public class Pogreshnost {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
float length = sc.nextFloat();
float el = sc.nextFloat();
float num = -1;
while(num != 0){
num = sc.nextFloat();
if(num < length - el || num > length + el)
{
System.out.println("No, Bad");
} else {
System.out.println("Well, Good");
}
}
}
} | [
"89854821428@yandex.ru"
] | 89854821428@yandex.ru |
b204bf7beb958e1a50a09744064d01447515d8cb | 6bd054934879ff73a50f9fc9b1017aaf010b2244 | /src/main/java/artwork/security/SpringSecurityAuditorAware.java | 097a81ae1abfcc670dc6c50c773a434e63d8ce21 | [] | no_license | Corneyeski/ArtWork | fcfc2a9da34d97d17a3ed79fb0fb6d8499aa522a | 94d8561a6536ef8e9ee8aabd93d4995cb4f0d4c7 | refs/heads/master | 2021-05-15T09:11:52.606187 | 2018-06-17T23:00:03 | 2018-06-17T23:00:03 | 108,019,346 | 3 | 1 | null | 2020-09-18T15:05:19 | 2017-10-23T18:02:51 | TypeScript | UTF-8 | Java | false | false | 514 | java | package artwork.security;
import artwork.config.Constants;
import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;
/**
* Implementation of AuditorAware based on Spring Security.
*/
@Component
public class SpringSecurityAuditorAware implements AuditorAware<String> {
@Override
public String getCurrentAuditor() {
String userName = SecurityUtils.getCurrentUserLogin();
return userName != null ? userName : Constants.SYSTEM_ACCOUNT;
}
}
| [
"cristinarodriguez.palmer@gmail.com"
] | cristinarodriguez.palmer@gmail.com |
d4a6460c012522e3bd7598801ec10026dfdb54ae | 06f5637b73990dec0c3c963cbbea0d1f3d4a3beb | /src/com/sinaapp/zhangboss/weixin/message/req/VoiceMessage.java | 54aef583f2c8d37c8c0be37a3b44b47f26ace8f3 | [] | no_license | virusea/zhangboss | fa79585ccab1b186ad848cf881517ad7d87db8c2 | 328245ca08a8e5476f4e0a91975a5d2b730dd1a3 | refs/heads/master | 2021-01-09T21:54:13.820509 | 2015-10-09T10:05:51 | 2015-10-09T10:05:51 | 43,946,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 509 | java | package com.sinaapp.zhangboss.weixin.message.req;
/**
* 音频消息
*
* @author liufeng
* @date 2013-05-19
*/
public class VoiceMessage extends BaseMessage {
// 媒体ID
private String MediaId;
// 语音格式
private String Format;
public String getMediaId() {
return MediaId;
}
public void setMediaId(String mediaId) {
MediaId = mediaId;
}
public String getFormat() {
return Format;
}
public void setFormat(String format) {
Format = format;
}
}
| [
"ssitxihc@qq.com"
] | ssitxihc@qq.com |
36cbdcc4a6bfb10f5397c8754ba427628dd923e1 | 8633792c569b7e5fd715ca1ba062b3dedf350208 | /FirstExam/src/club/football/employees/Employee.java | 00d06c215ff41dc0a8bd1b4b743cd39be54f7d7f | [] | no_license | RoxanaYaneva/Contemporary-Java-Technologies | c3d9cd12649fb188f66486b1b1fe05eecbb8d1e8 | 5d9544488a6281cca0fe49f49551212659ce535c | refs/heads/master | 2020-05-23T08:20:37.304461 | 2017-03-12T23:16:02 | 2017-03-12T23:16:02 | 84,756,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,207 | java | package club.football.employees;
import java.time.LocalDate;
public abstract class Employee implements Comparable<Employee> {
private String name;
private int age;
private LocalDate finalDateOfContract;
private double salary;
public Employee(String name, int age, LocalDate finalDateOfContract) {
this.name = name;
this.age = age;
this.finalDateOfContract = finalDateOfContract;
}
public LocalDate getFinalDateOfContract() {
return finalDateOfContract;
}
public void setFinalDateOfContract(LocalDate finalDateOfContract) {
this.finalDateOfContract = finalDateOfContract;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
@Override
public String toString() {
return "Name : " + name + ", age : " + age + ", final Date Of Contract : " + finalDateOfContract + ", salary : " + salary;
}
public abstract double calculateSalary();
@Override
public int compareTo(Employee employee) {
if (employee.getFinalDateOfContract().isAfter(this.getFinalDateOfContract())) {
return 1;
} else if (employee.getFinalDateOfContract().isBefore(this.getFinalDateOfContract())) {
return -1;
}
return employee.name.compareTo(this.name);
}
}
| [
"roxy.1569@gmail.com"
] | roxy.1569@gmail.com |
e9048df99050b70e80297d6d37c861e125cf74bd | c4e988577e2ef37cc9de04b1598754eddf57993f | /BCP_infra_nova/WEB-INF/src/com/gvs/crm/model/impl/EmissorImpl.java | eaa68c166d6f49009186fa105f336038b2689dae | [] | no_license | giovanni1182/bcp | e3155d39eff093fd8a164dcfe9340fff1b7e2678 | 148c200e0e394b4cef2a0e5b14134c39cbd2892f | refs/heads/master | 2021-01-12T11:36:30.439677 | 2016-10-28T18:44:17 | 2016-10-28T18:44:17 | 72,227,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,988 | java | package com.gvs.crm.model.impl;
import com.gvs.crm.model.Emissor;
import infra.sql.SQLQuery;
import infra.sql.SQLUpdate;
public class EmissorImpl extends EntidadeImpl implements Emissor
{
private int codigo;
private String descricao;
public void incluir() throws Exception
{
super.incluir();
SQLUpdate insert = this.getModelManager().createSQLUpdate("crm","insert into emissor(id,codigo,descricao) values(?,?,?)");
insert.addLong(this.obterId());
insert.addInt(this.codigo);
insert.addString(this.descricao);
insert.execute();
}
public void atribuirCodigo(int codigo)
{
this.codigo = codigo;
}
public void atribuirDescricao(String descricao)
{
this.descricao = descricao;
}
public int obterCodigo() throws Exception
{
if(this.codigo == 0)
{
SQLQuery query = this.getModelManager().createSQLQuery("crm","select descricao from emissor where id = ?");
query.addLong(this.obterId());
this.codigo = query.executeAndGetFirstRow().getInt("codigo");
}
return this.codigo;
}
public String obterDescricao() throws Exception
{
if(this.descricao == null)
{
SQLQuery query = this.getModelManager().createSQLQuery("crm","select descricao from emissor where id = ?");
query.addLong(this.obterId());
this.descricao = query.executeAndGetFirstRow().getString("descricao");
}
return this.descricao;
}
public void atualizarCodigo(int codigo) throws Exception
{
SQLUpdate update = this.getModelManager().createSQLUpdate("crm","update emissor set codigo = ? where id = ?");
update.addInt(codigo);
update.addLong(this.obterId());
update.execute();
}
public void atualizarDescricao(String descricao) throws Exception
{
SQLUpdate update = this.getModelManager().createSQLUpdate("crm","update emissor set descricao = ? where id = ?");
update.addString(descricao);
update.addLong(this.obterId());
update.execute();
}
}
| [
"giovanni@gdsd.com.br"
] | giovanni@gdsd.com.br |
4675adde497f6788b3cd9c07f52339c37b45efb9 | e513b81cb6f4cf4615a46a35b486ea56e23acf2f | /src/main/java/jpabook/jpashop/domain/OrderItem.java | bbb5d2e099d3e11671400a2d6d4f1fc0363dd92f | [] | no_license | S-Tiger/jpashop | e43b86a08f44e6f39ec57209247aaa7a8186c06b | 87325c3f66170a662bbaa0e8a37f7c44bb4feeec | refs/heads/master | 2023-01-01T14:32:15.290181 | 2020-10-12T05:08:32 | 2020-10-12T05:08:32 | 303,282,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,412 | java | package jpabook.jpashop.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.BatchSize;
import javax.persistence.*;
@BatchSize(size = 100) //many쪽에선 클래스 위에 선언하다
@Entity
@Table(name = "ORDER_ITEM")
@Getter @Setter
public class OrderItem {
@Id
@GeneratedValue
@Column(name = "ORDER_ITEM_ID")
private Long id;
@JsonIgnore //양방향에선 무한루프에 안빠지도록 작성해야하는 어노테이션
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ORDER_ID")
private Order order; //주문
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ITEM_ID")
private Item item; //주문상품
private int orderPrice; //주문가격
private int count; //주문수량
//==생성 메서드==//
public static OrderItem createOrderItem(Item item, int orderPrice, int count) {
OrderItem orderItem = new OrderItem();
orderItem.setItem(item);
orderItem.setOrderPrice(orderPrice);
orderItem.setCount(count);
item.removeStock(count); // 생성 될 때, 재고를 까고 생성된다.
return orderItem;
}
//==비즈니스 로직==//
public void cancel() {
getItem().addStock(count);
}
public int getTotalPrice() {
return orderPrice * count;
}
}
| [
"tjdghek98@naver.com"
] | tjdghek98@naver.com |
d262fa8175b5de0b9f71e74eca470d18fbbe70df | 92c9b7631c6f9232339eee7b81d5d6cf7aafe38f | /JavaBigAssesmentBigBigBig/src/EmployeManagerServer/DataHandler/CSVDatareader.java | b1855ee3ebec878bd6857a181cf9af3a3672dc43 | [] | no_license | CodecoolMSC2015/javabigfinalassessment-Papuss | 8486b7fdf5fc61f477932e4ea732ca39f20c1adf | 0452e1fd9861c2179765343a9cfc179c44e41a12 | refs/heads/master | 2020-12-26T11:16:05.547108 | 2016-03-16T15:56:15 | 2016-03-16T15:56:15 | 54,018,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,091 | java | package EmployeManagerServer.DataHandler;
import java.io.*;
import java.net.Socket;
import java.util.*;
public class CSVDatareader extends Datareader {
static Socket socket = null;
static ObjectInputStream objectInputStream;
static ObjectOutputStream objectOutputStream;
private String csvFilePath;
public CSVDatareader(String csvFilePath) {
this.csvFilePath = csvFilePath;
}
public List<String> getPersons(List<String> searchcriteria) throws IOException {
List<String> personList = new ArrayList<String>();
for (String item : searchcriteria) {
Scanner scanner = new Scanner(new File(csvFilePath));
scanner.useDelimiter(";");
while (scanner.hasNext()) {
scanner.useDelimiter(";");
String nl = scanner.nextLine();
{
if (nl.contains(item)) {
personList.add(nl);
}
}
}
scanner.close();
}
return personList;
}
}
| [
"mrpapsu@gmail.com"
] | mrpapsu@gmail.com |
95d58a2ca7fd951a1d00352757d3022c01db15e9 | 7ce57ff4690416cbe1526417e970573f67ab966c | /src/controller/UploadServlet.java | 1011e11761b123b19f4887f0fed2cfd650b5daf2 | [] | no_license | meetparikh51/CLEAN | 73748b06aac96a9ba46e33c337c9b439aade6071 | 72eda31166dce214a06b813da90dd06d50c61f5f | refs/heads/master | 2021-07-05T03:09:53.120612 | 2017-09-27T22:08:38 | 2017-09-27T22:08:38 | 105,074,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,524 | java | package controller;
import java.io.File;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
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 org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
@WebServlet("/UploadServlet")
public class UploadServlet extends HttpServlet {
private boolean isMultipart;
private String filePath;
private int maxFileSize = 5000 * 2024;
private int maxMemSize = 400 * 1024;
private File file ;
public void init( ){
// Get the file location where it would be stored.
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, java.io.IOException {
// Check that we have a file upload request
filePath = getServletContext().getRealPath(request.getServletPath());
int path = filePath.lastIndexOf('\\');
String path1= filePath.substring(0, path) +"\\doc\\";
System.out.println(path1);
filePath =path1;
HttpSession session1 = request.getSession();
session1.setAttribute("url", path1);
isMultipart = ServletFileUpload.isMultipartContent(request);
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter( );
if( !isMultipart )
{
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet upload</title>");
out.println("</head>");
out.println("<body>");
out.println("<p>No file uploaded</p>");
out.println("</body>");
out.println("</html>");
return;
}
DiskFileItemFactory factory = new DiskFileItemFactory();
// maximum size that will be stored in memory
factory.setSizeThreshold(maxMemSize);
// Location to save data that is larger than maxMemSize.
String path2= filePath.substring(0, path) +"\\temp\\";
factory.setRepository(new File(path2));
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// maximum file size to be uploaded.
upload.setSizeMax( maxFileSize );
try{
// Parse the request to get file items.
List fileItems = upload.parseRequest(request);
// Process the uploaded file items
Iterator i = fileItems.iterator();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet upload</title>");
out.println("</head>");
out.println("<body>");
while ( i.hasNext () )
{
FileItem fi = (FileItem)i.next();
if ( !fi.isFormField () )
{
// Get the uploaded file parameters
String fileName = fi.getName();
/* String fieldName = fi.getFieldName();
String contentType = fi.getContentType();
boolean isInMemory = fi.isInMemory();
long sizeInBytes = fi.getSize();*/
// Write the file
if( fileName.lastIndexOf("\\") >= 0 ){
file = new File( filePath +
fileName.substring( fileName.lastIndexOf("\\"))) ;
}else{
file = new File( filePath +
fileName.substring(fileName.lastIndexOf("\\")+1)) ;
}
String src = path1.concat(encryptFileName(fileName));
File f3 = new File(src);
fi.write(f3);
List myFileList=null;
HttpSession session = request.getSession();
myFileList = (List) session.getAttribute("fileList");
if(myFileList != null){
myFileList.add(f3.getName());
}else{
myFileList = new ArrayList<String>();
myFileList.add(f3.getName());
}
session.setAttribute("fileList", myFileList);
}
}
out.println("</body>");
out.println("</html>");
/*Below code is to fetch the list of upload file name's */
/*Begin*/
HttpSession session = request.getSession();
List myFileList = (List) session.getAttribute("fileList");
Iterator itr = myFileList.iterator();
System.out.println("Fetching file Names from session :");
int j = 0 ;
while (itr.hasNext()) {
System.out.println(" File Name "+ (++j) +" :"+itr.next());
}
/*Ends*/
response.sendRedirect(request.getContextPath()+"/fileupload.jsp");
}catch(Exception ex) {
System.out.println(ex);
}
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, java.io.IOException {
/* throw new ServletException("GET method used with " +
getClass( ).getName( )+": POST method required."); */
response.sendRedirect(request.getContextPath()+"/fileupload.jsp");
}
private String encryptFileName(String fileName){
Random r = new Random();
String file[] = fileName.split("\\.");
byte[] unencodedFile = file[0].getBytes();
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (Exception e) {}
md.reset();
md.update(unencodedFile);
byte[] encodedFile = md.digest();
StringBuffer buf = new StringBuffer();
for (int i = 0; i < encodedFile.length; i++) {
if (((int) encodedFile[i] & 0xff) < 0x10) {
buf.append("0");
}
buf.append(Long.toString((int) encodedFile[i] & 0xff, 16));
}
String encryptedFileName=(buf.toString()).concat(String.valueOf(r.nextInt()));
return encryptedFileName+"."+file[1];
}
} | [
"meetparikh51@gmail.com"
] | meetparikh51@gmail.com |
ea85baf498916fed9a5f60232c8b7f87776f747a | a9d4dec330035454f9752ebcbcd166ff7805a41f | /src/ConfirmIssue.java | d9e2d636fbbc9199727db59d234f1a559b6ccff2 | [] | no_license | midhunkr/JavaAssignmentInApp | 3556e44e5f86e5216bc0c0d427e3b176fb580334 | c146ee026639fe9733793c89bd5e5b5c021c967a | refs/heads/master | 2023-04-25T15:56:11.062351 | 2021-05-10T12:49:50 | 2021-05-10T12:49:50 | 366,037,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,820 | java |
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.time.LocalDate;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/ConfirmIssue")
public class ConfirmIssue extends HttpServlet {
private static final long serialVersionUID = 1L;
String url="jdbc:postgresql://localhost/librarymanagement";
String user="postgres";
String pas="fermions";
public ConfirmIssue() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out=response.getWriter();
try {
Class.forName("org.postgresql.Driver");
Connection con=DriverManager.getConnection(url,user,pas);
PreparedStatement ps=con.prepareStatement("insert into issue_ledger(book_id,username) values(?,?)");
ps.setInt(1, Integer.parseInt(request.getParameter("bookid")));
ps.setString(2, request.getParameter("username"));
// ps.setDate(2,java.sql.Date.valueOf(request.getParameter("date_issued")));
// ps.setDate(3,java.sql.Date.valueOf(request.getParameter("due_date")));
int i=ps.executeUpdate();
if(i>0) {
out.print("Book Issued");
out.print(request.getParameter("date_issued"));
}
}catch(Exception e){out.print(e);}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"midun.kr@inapp.com"
] | midun.kr@inapp.com |
d52fa558d694cd2f2d5c77c4089cb3dca2881079 | a0caa255f3dbe524437715adaee2094ac8eff9df | /HOLD/sources/defpackage/cug.java | 5c9c968c76b90b672c8af3c2dcd0ece9140fd8ac | [] | no_license | AndroidTVDeveloper/com.google.android.tvlauncher | 16526208b5b48fd48931b09ed702fe606fe7d694 | 0f959c41bbb5a93e981145f371afdec2b3e207bc | refs/heads/master | 2021-01-26T07:47:23.091351 | 2020-02-26T20:58:19 | 2020-02-26T20:58:19 | 243,363,961 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 576 | java | package defpackage;
import com.google.android.tvlauncher.home.view.ChannelView;
/* renamed from: cug reason: default package */
/* compiled from: PG */
public final class cug implements Runnable {
public final /* synthetic */ ChannelView a;
public cug(ChannelView channelView) {
this.a = channelView;
}
public final void run() {
if (this.a.b.o()) {
this.a.b.x.a(new cuf(this));
return;
}
ChannelView channelView = this.a;
if (!channelView.I) {
channelView.c();
}
}
}
| [
"eliminater74@gmail.com"
] | eliminater74@gmail.com |
888490dba4bae4a5264361cf6aed004ca628798b | e79c47ed2b12778728330fdd1cbbe64e6f9d7911 | /模範解答/01_入門/実力診断/Exam0515.java | 051a1dcc19db91b9ee4a112eae545014415ef41f | [] | no_license | mk-mercury/java_learning | 98bd4926974042b78db71c5139bc72a67374b262 | 38ef637c8725af9c1493a7026196af4b667d5c4b | refs/heads/master | 2020-04-23T10:29:04.701113 | 2019-12-26T16:56:05 | 2019-12-26T16:56:05 | 171,105,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,450 | java | package introduction;
import java.util.Scanner;
public class Exam0515 {
static int sum = 0;
static int data_count = 0;
static int oldNumber = 0;
public static void main(String[] args) {
var stdin = new Scanner(System.in);
while(true) {
System.out.printf("input number (more than 0) : ");
int number = stdin.nextInt();
if (number <= 0) {
// 0未満が入力された場合、再入力を行う
System.out.println("input more than 0, please.");
} else {
if (avg_display(number) == 0) {
// 連続した値が入力された場合、処理を終了する
break;
}
}
}
// 終了処理
stdin.close();
}
/**
整数値の値を受け取り、その値を毎回加算していき、その時点で平均値を求める関数
@param int 入力した値
@return int 値が連続した場合は 0 それ以外は 1
*/
private static int avg_display(int number)
{
if (number != oldNumber) {
// 前回と異なる値だった場合
sum += number;
data_count++;
// 平均を計算して出力
double average = (double)sum / (double)data_count;
System.out.printf("SUM : %d / DATA_COUNT : %d / AVERAGE : %.2f", sum, data_count, average);
System.out.println();
// 値を保持して 1 を返す
oldNumber = number;
return 1;
}
// 前回と同じ値だった場合は 0 を返す
return 0;
}
}
| [
"k_mizuta@freestyles.jp"
] | k_mizuta@freestyles.jp |
8e8b9957f65a303bd7830cb3e3ba19f5b3a852d7 | 61455ce6d8fb76840791f1fe6223bb2e7a49afdc | /src/main/java/com/movie/reviews/security/LoginAuthenticationProvider.java | 83f5f04702bf846904a90f19e8ef268a9eb94687 | [] | no_license | mar-io/movies-spring-boot-rest-api | fbb21984fc6a5032e1cdd57bff61ae528d37c807 | 396f66ffa3d7bb5522c9fde9cfeb00eae6ddd2bf | refs/heads/master | 2022-04-12T23:20:34.682452 | 2019-10-19T09:17:45 | 2019-10-19T09:17:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,093 | java | package com.movie.reviews.security;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import com.movie.reviews.domain.UserEntity;
public class LoginAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider {
public LoginAuthenticationProvider(UserDetailsServiceImpl userDetailsServiceImpl) {
super();
this.userDetailsServiceImpl = userDetailsServiceImpl;
}
private UserDetailsServiceImpl userDetailsServiceImpl;
private static final Logger LOG = LoggerFactory.getLogger(UserDetailsServiceImpl.class);
@Override
protected UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication)
throws AuthenticationException {
LOG.info("Retrieve User...");
UserEntity userEntity = userDetailsServiceImpl.fetchUserByEmailId(username);
if (null == userEntity)
throw new AuthenticationServiceException("Username doesn't exist...");
boolean passwordValid = userDetailsServiceImpl.validatePassword(authentication, userEntity);
if (!passwordValid)
throw new AuthenticationServiceException("Invalid Password...");
return new User(userEntity.getId(), userEntity.getFirstName(), userEntity.getLastName(),
userEntity.getEmailId(), userEntity.getAdmin(), userEntity.getActive());
}
@Override
protected void additionalAuthenticationChecks(UserDetails userDetails,
UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
LOG.info("Additional Authentication Checks...");
}
public void setUserDetailsServiceImpl(UserDetailsServiceImpl userDetailsServiceImpl) {
this.userDetailsServiceImpl = userDetailsServiceImpl;
}
}
| [
"nijanth.niji@gmail.com"
] | nijanth.niji@gmail.com |
50564ec5bce254b1d0ce89c2e7d6860dae3d3df1 | de3221cf1c5d10a935e43ac1890d1e00b3bb5cb4 | /src/main/java/com/okta/quarkus/jwt/Kayak.java | 3ed011e3f4c819bdaf65a63617c8d3fb9de6b988 | [] | no_license | moksamedia/okta-quarkus | f551e3212a7ab040205e8cf8d722af52d005f0fe | 3bc16cd646bde8a5725428854dd827c7dba97d2f | refs/heads/master | 2020-07-02T23:14:38.512201 | 2019-08-11T01:23:11 | 2019-08-11T01:23:11 | 201,701,787 | 0 | 1 | null | 2019-09-20T22:28:17 | 2019-08-11T01:22:48 | Java | UTF-8 | Java | false | false | 376 | java | package com.okta.quarkus.jwt;
import lombok.Data;
import java.util.Objects;
@Data
public class Kayak {
private String make;
private String model;
private Integer length;
public Kayak() {
}
public Kayak(String make, String model, Integer length) {
this.make = make;
this.model = model;
this.length = length;
}
}
| [
"andrewcarterhughes@gmail.com"
] | andrewcarterhughes@gmail.com |
04de6f9738e3bdb48399d45fb6db1ad2cea46010 | b45fa72360bce818ad0c015495257e286bd304e7 | /src/main/java/br/edu/fiponline/psi/bancodigitalquestoes/gerador/persistence/model/Assignment.java | 6a50008dca3a32a53d63bdfd81a1ab07fdd4276a | [] | no_license | lucasandradearaujo/gerador | 26f7899f52c548e20865a698987bc69e44406640 | 6a1cedbbede8495a4a6d19c537c0fd758a39d5ef | refs/heads/master | 2022-08-18T17:35:22.739088 | 2020-05-24T19:52:56 | 2020-05-24T19:52:56 | 256,065,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,732 | java | package br.edu.fiponline.psi.bancodigitalquestoes.gerador.persistence.model;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotEmpty;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import java.time.LocalDateTime;
@Entity
public class Assignment extends AbstractEntity {
@NotEmpty(message = "O cmapo de título não pode ser vazio")
@ApiModelProperty(notes = "Título da tarefa")
private String title;
private LocalDateTime createdAt = LocalDateTime.now();
@ManyToOne(optional = false)
private Course course;
@ManyToOne(optional = false)
private Professor professor;
private String accessCode;
public String getAccessCode() {
return accessCode;
}
public void setAccessCode(String accessCode) {
this.accessCode = accessCode;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public Course getCourse() {
return course;
}
public void setCourse(Course course) {
this.course = course;
}
public Professor getProfessor() {
return professor;
}
public void setProfessor(Professor professor) {
this.professor = professor;
}
public static final class Builder {
private Assignment assignment;
private Builder() {
assignment = new Assignment();
}
public static Builder newAssignment() {
return new Builder();
}
public Builder id(Long id) {
assignment.setId(id);
return this;
}
public Builder enabled(boolean enabled) {
assignment.setEnabled(enabled);
return this;
}
public Builder title(String title) {
assignment.setTitle(title);
return this;
}
public Builder createdAt(LocalDateTime createdAt) {
assignment.setCreatedAt(createdAt);
return this;
}
public Builder course(Course course) {
assignment.setCourse(course);
return this;
}
public Builder professor(Professor professor) {
assignment.setProfessor(professor);
return this;
}
public Builder accessCode(String accessCode) {
assignment.setAccessCode(accessCode);
return this;
}
public Assignment build() {
return assignment;
}
}
}
| [
"lucasaraujo@si.fiponline.edu.br"
] | lucasaraujo@si.fiponline.edu.br |
274a419bcc29b5501b3ee8abad93db244fffd61a | a54174bb687ff2b82fa4c6774c8c54a9cef9b49d | /src/Loc/Search/BinarySearch.java | 8ea5a4402d32ff403890a33d29a98b47646f1168 | [] | no_license | VannLord/Liverpool | 8767ce942a9d9ef0a2a60a0c4f00ee90eb386367 | 94da2e3e0f7694a8364dc048e3836ca61ebe6d99 | refs/heads/master | 2020-04-05T12:18:07.836794 | 2019-11-01T08:31:12 | 2019-11-01T08:31:12 | 156,864,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package Loc.Search;
public class BinarySearch {
static int[] list = {1,3,4,7,9,11,15,27,30};
static int binarySearch(int[] list,int key){
int high = list.length-1;
int low = 0;
while(high >= low ){
int mid =(high+low)/2;
if(list[mid] > key) high = mid - 1;
else if (list[mid] < key) low = mid + 1;
else return mid;
}
return -1;
}
public static void main(String[] args) {
System.out.println(binarySearch(list, 1));
System.out.println(binarySearch(list, 7));
System.out.println(binarySearch(list, 9));
System.out.println(binarySearch(list, 15));
System.out.println(binarySearch(list, 20));
System.out.println(binarySearch(list, 27));
}
}
| [
"tangvanloc8@gmail.com"
] | tangvanloc8@gmail.com |
80f5cb94801011e8594152287a80c27a2e689e09 | 109d2bbdddf2ac2d2267d2bb0a691b5a47d08670 | /Parser/openscad-parser/src/main/java/be/unamur/bamand/openscad/ast/LetGenerator.java | ea3eba76fe480cf29c1bd2fbf7df8809d6098c43 | [] | no_license | maxcordy/mlvm | a7ea7b7860470978d0172a043d9bb8d746c3c33d | 87dd548059a1bd69974999981d28b1c92c32a84d | refs/heads/master | 2018-11-13T07:18:33.256181 | 2018-09-09T16:10:50 | 2018-09-09T16:10:50 | 110,086,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package be.unamur.bamand.openscad.ast;
import java.util.ArrayList;
public class LetGenerator implements Generator {
private ArrayList<Argument> args;
private Generator child;
private Location startLocation;
private Location endLocation;
@Override
public Location getStartLocation() {
return startLocation;
}
@Override
public Location getEndLocation() {
return endLocation;
}
@Override
public void setLocation(Location start, Location end) {
startLocation = start;
endLocation = end;
}
public LetGenerator(ArrayList<Argument> args, Generator child) {
this.args = args;
this.child = child;
}
public ArrayList<Argument> getArgs() {
return args;
}
public Generator getChild() {
return child;
}
}
| [
"amand.Benoit@gmail.com"
] | amand.Benoit@gmail.com |
59df696f0ed1961148b521646781521b6f1a287d | 386e8e7746619d5a3ba45cca009808ee3e493cfd | /springside3/tags/3.3.0/examples/showcase/src/test/java/org/springside/examples/showcase/unit/security/UserDetailsServiceImplTest.java | 8e8a1dd330903aaab44c27517d63cbe43509131b | [
"Apache-2.0"
] | permissive | stzdzyhs/springside | 7ba5402ea753ca7e2fad73cdb46386f56954216b | a641f8975b6883fae96d6186bc4c169d4410ab8d | refs/heads/master | 2021-01-22T23:26:07.371095 | 2012-12-17T02:25:31 | 2012-12-17T02:25:31 | 41,462,872 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,580 | java | package org.springside.examples.showcase.unit.security;
import org.easymock.classextension.EasyMock;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.security.authentication.encoding.ShaPasswordEncoder;
import org.springframework.security.core.authority.GrantedAuthorityImpl;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springside.examples.showcase.common.entity.Role;
import org.springside.examples.showcase.common.entity.User;
import org.springside.examples.showcase.common.service.AccountManager;
import org.springside.examples.showcase.security.OperatorDetails;
import org.springside.examples.showcase.security.UserDetailsServiceImpl;
public class UserDetailsServiceImplTest extends Assert {
private UserDetailsServiceImpl userDetailsService;
private AccountManager mockAccountManager;
@Before
public void setUp() {
userDetailsService = new UserDetailsServiceImpl();
mockAccountManager = EasyMock.createMock(AccountManager.class);
userDetailsService.setAccountManager(mockAccountManager);
}
@After
public void tearDown() {
EasyMock.verify(mockAccountManager);
}
@Test
public void loadUserExist() {
//准备数据
User user = new User();
user.setLoginName("admin");
user.setShaPassword(new ShaPasswordEncoder().encodePassword("admin", null));
Role role1 = new Role();
role1.setName("admin");
Role role2 = new Role();
role2.setName("user");
user.getRoleList().add(role1);
user.getRoleList().add(role2);
//录制脚本
EasyMock.expect(mockAccountManager.findUserByLoginName("admin")).andReturn(user);
EasyMock.replay(mockAccountManager);
//执行测试
OperatorDetails operator = (OperatorDetails) userDetailsService.loadUserByUsername(user.getLoginName());
//校验结果
assertEquals(user.getLoginName(), operator.getUsername());
assertEquals(new ShaPasswordEncoder().encodePassword("admin", null), operator.getPassword());
assertEquals(2, operator.getAuthorities().size());
assertEquals(new GrantedAuthorityImpl("ROLE_admin"), operator.getAuthorities().iterator().next());
assertNotNull(operator.getLoginTime());
}
@Test(expected = UsernameNotFoundException.class)
public void loadUserByWrongUserName() {
//录制脚本
EasyMock.expect(mockAccountManager.findUserByLoginName("foo")).andReturn(null);
EasyMock.replay(mockAccountManager);
assertNull(userDetailsService.loadUserByUsername("foo"));
}
}
| [
"calvinxiu@fa9a2031-a219-0410-832a-cdfdc9972eb7"
] | calvinxiu@fa9a2031-a219-0410-832a-cdfdc9972eb7 |
94dfca3fa9b9b53d5f3a439f956e96ac5001610e | ad164b989e97c3dfc0a421fdbe8ee056e1fcb886 | /src/AssignmentPrograms/_7_ReverseString.java | 2aad416c70d221268bbe56bd87c0d4e50ee650ca | [] | no_license | rainitin3/Basic-java | 78615c956dde765eaa362502023b88096f6e15a6 | 3ffcca9697dc3538e6e422403ea06762556deffc | refs/heads/master | 2023-07-11T11:40:21.846327 | 2021-08-19T09:05:44 | 2021-08-19T09:05:44 | 393,581,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package AssignmentPrograms;
public class _7_ReverseString {
public static void main(String[] args) {
String str = "Programming";
int size = str.length();
String rev = "";
for(int i = size-1; i>=0;i--) {
rev=rev+str.charAt(i);
}
System.out.println(str);
System.out.println(rev);
}
}
| [
"rainitin3@gmail.com"
] | rainitin3@gmail.com |
a6fe87b5ca90a56b198f1977dafbd0f59ca23125 | b6be8220f1a1937fbb7b37f1ddbeebad968ab969 | /src/main/java/com/lettucetech/me2/common/springmvc/SpringContextHolder.java | f775e84c55211e947a2d15ec923510f89ffeb854 | [] | no_license | DansonFu/me2 | b81b6b515f5669e4811d8b9d75bc98ce334cc227 | f8dac3212abac20aad8bc837e7756d36a0f00c92 | refs/heads/master | 2021-01-01T04:04:38.875436 | 2017-07-14T03:40:04 | 2017-07-14T03:40:04 | 97,119,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,906 | java | package com.lettucetech.me2.common.springmvc;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
* 以静态变量保存Spring ApplicationContext, 可在任何代码任何地方任何时候中取出ApplicaitonContext.
*/
public class SpringContextHolder implements ApplicationContextAware {
/**
* 以静态变量保存ApplicationContext,可在任意代码中取出ApplicaitonContext.
*/
private static ApplicationContext applicationContext;
/**
* 实现ApplicationContextAware接口的context注入函数, 将其存入静态变量.
*/
public void setApplicationContext(ApplicationContext applicationContext) {
SpringContextHolder.applicationContext = applicationContext; // NOSONAR
}
/**
* 取得存储在静态变量中的ApplicationContext.
*/
public static ApplicationContext getApplicationContext() {
checkApplicationContext();
return applicationContext;
}
/**
* 从静态变量ApplicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) {
checkApplicationContext();
return (T) applicationContext.getBean(name);
}
/**
* 从静态变量ApplicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(Class<T> clazz) {
checkApplicationContext();
return (T) applicationContext.getBeansOfType(clazz);
}
/**
* 清除applicationContext静态变量.
*/
public static void cleanApplicationContext() {
applicationContext = null;
}
private static void checkApplicationContext() {
if (applicationContext == null) {
throw new IllegalStateException("applicaitonContext未注入,请在applicationContext.xml中定义SpringContextHolder");
}
}
} | [
"joesong168@qq.com"
] | joesong168@qq.com |
b791d36f3417ef04b0038c36120b853d4eda03ee | b68649864f7319e33831d803f7e0a8b4d2184ba7 | /spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java | 9eea6916f6ea9c542975d9afc12df7649517e77f | [
"Apache-2.0"
] | permissive | HappyDogYear/spring-framework-5.2.x | 3104f645b839a2f7cfec2a5e3065fccadbb1c1e0 | 0bfdc3b8cf86f84f17115991f6889622d506d0b7 | refs/heads/master | 2023-02-03T01:42:27.615233 | 2020-12-22T09:40:16 | 2020-12-22T09:40:16 | 323,563,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 38,949 | java | /*
* Copyright 2002-2020 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.
*/
package org.springframework.beans;
import java.beans.PropertyChangeEvent;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.lang.reflect.UndeclaredThrowableException;
import java.security.PrivilegedActionException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.CollectionFactory;
import org.springframework.core.ResolvableType;
import org.springframework.core.convert.ConversionException;
import org.springframework.core.convert.ConverterNotFoundException;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
* A basic {@link ConfigurablePropertyAccessor} that provides the necessary
* infrastructure for all typical use cases.
*
* <p>This accessor will convert collection and array values to the corresponding
* target collections or arrays, if necessary. Custom property editors that deal
* with collections or arrays can either be written via PropertyEditor's
* {@code setValue}, or against a comma-delimited String via {@code setAsText},
* as String arrays are converted in such a format if the array itself is not
* assignable.
*
* @author Juergen Hoeller
* @author Stephane Nicoll
* @author Rod Johnson
* @author Rob Harrop
* @see #registerCustomEditor
* @see #setPropertyValues
* @see #setPropertyValue
* @see #getPropertyValue
* @see #getPropertyType
* @see BeanWrapper
* @see PropertyEditorRegistrySupport
* @since 4.2
*/
public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyAccessor {
/**
* We'll create a lot of these objects, so we don't want a new logger every time.
*/
private static final Log logger = LogFactory.getLog(AbstractNestablePropertyAccessor.class);
private int autoGrowCollectionLimit = Integer.MAX_VALUE;
@Nullable
Object wrappedObject;
private String nestedPath = "";
@Nullable
Object rootObject;
/**
* Map with cached nested Accessors: nested path -> Accessor instance.
*/
@Nullable
private Map<String, AbstractNestablePropertyAccessor> nestedPropertyAccessors;
/**
* Create a new empty accessor. Wrapped instance needs to be set afterwards.
* Registers default editors.
*
* @see #setWrappedInstance
*/
protected AbstractNestablePropertyAccessor() {
this(true);
}
/**
* Create a new empty accessor. Wrapped instance needs to be set afterwards.
*
* @param registerDefaultEditors whether to register default editors
* (can be suppressed if the accessor won't need any type conversion)
* @see #setWrappedInstance
*/
protected AbstractNestablePropertyAccessor(boolean registerDefaultEditors) {
if (registerDefaultEditors) {
registerDefaultEditors();
}
this.typeConverterDelegate = new TypeConverterDelegate(this);
}
/**
* Create a new accessor for the given object.
*
* @param object the object wrapped by this accessor
*/
protected AbstractNestablePropertyAccessor(Object object) {
registerDefaultEditors();
setWrappedInstance(object);
}
/**
* Create a new accessor, wrapping a new instance of the specified class.
*
* @param clazz class to instantiate and wrap
*/
protected AbstractNestablePropertyAccessor(Class<?> clazz) {
registerDefaultEditors();
setWrappedInstance(BeanUtils.instantiateClass(clazz));
}
/**
* Create a new accessor for the given object,
* registering a nested path that the object is in.
*
* @param object the object wrapped by this accessor
* @param nestedPath the nested path of the object
* @param rootObject the root object at the top of the path
*/
protected AbstractNestablePropertyAccessor(Object object, String nestedPath, Object rootObject) {
registerDefaultEditors();
setWrappedInstance(object, nestedPath, rootObject);
}
/**
* Create a new accessor for the given object,
* registering a nested path that the object is in.
*
* @param object the object wrapped by this accessor
* @param nestedPath the nested path of the object
* @param parent the containing accessor (must not be {@code null})
*/
protected AbstractNestablePropertyAccessor(Object object, String nestedPath, AbstractNestablePropertyAccessor parent) {
setWrappedInstance(object, nestedPath, parent.getWrappedInstance());
setExtractOldValueForEditor(parent.isExtractOldValueForEditor());
setAutoGrowNestedPaths(parent.isAutoGrowNestedPaths());
setAutoGrowCollectionLimit(parent.getAutoGrowCollectionLimit());
setConversionService(parent.getConversionService());
}
/**
* Specify a limit for array and collection auto-growing.
* <p>Default is unlimited on a plain accessor.
*/
public void setAutoGrowCollectionLimit(int autoGrowCollectionLimit) {
this.autoGrowCollectionLimit = autoGrowCollectionLimit;
}
/**
* Return the limit for array and collection auto-growing.
*/
public int getAutoGrowCollectionLimit() {
return this.autoGrowCollectionLimit;
}
/**
* Switch the target object, replacing the cached introspection results only
* if the class of the new object is different to that of the replaced object.
*
* @param object the new target object
*/
public void setWrappedInstance(Object object) {
setWrappedInstance(object, "", null);
}
/**
* Switch the target object, replacing the cached introspection results only
* if the class of the new object is different to that of the replaced object.
*
* @param object the new target object
* @param nestedPath the nested path of the object
* @param rootObject the root object at the top of the path
*/
public void setWrappedInstance(Object object, @Nullable String nestedPath, @Nullable Object rootObject) {
this.wrappedObject = ObjectUtils.unwrapOptional(object);
Assert.notNull(this.wrappedObject, "Target object must not be null");
this.nestedPath = (nestedPath != null ? nestedPath : "");
this.rootObject = (!this.nestedPath.isEmpty() ? rootObject : this.wrappedObject);
this.nestedPropertyAccessors = null;
this.typeConverterDelegate = new TypeConverterDelegate(this, this.wrappedObject);
}
public final Object getWrappedInstance() {
Assert.state(this.wrappedObject != null, "No wrapped object");
return this.wrappedObject;
}
public final Class<?> getWrappedClass() {
return getWrappedInstance().getClass();
}
/**
* Return the nested path of the object wrapped by this accessor.
*/
public final String getNestedPath() {
return this.nestedPath;
}
/**
* Return the root object at the top of the path of this accessor.
*
* @see #getNestedPath
*/
public final Object getRootInstance() {
Assert.state(this.rootObject != null, "No root object");
return this.rootObject;
}
/**
* Return the class of the root object at the top of the path of this accessor.
*
* @see #getNestedPath
*/
public final Class<?> getRootClass() {
return getRootInstance().getClass();
}
@Override
public void setPropertyValue(String propertyName, @Nullable Object value) throws BeansException {
AbstractNestablePropertyAccessor nestedPa;
try {
nestedPa = getPropertyAccessorForPropertyPath(propertyName);
} catch (NotReadablePropertyException ex) {
throw new NotWritablePropertyException(getRootClass(), this.nestedPath + propertyName,
"Nested property in path '" + propertyName + "' does not exist", ex);
}
PropertyTokenHolder tokens = getPropertyNameTokens(getFinalPath(nestedPa, propertyName));
nestedPa.setPropertyValue(tokens, new PropertyValue(propertyName, value));
}
@Override
public void setPropertyValue(PropertyValue pv) throws BeansException {
PropertyTokenHolder tokens = (PropertyTokenHolder) pv.resolvedTokens;
if (tokens == null) {
String propertyName = pv.getName();
AbstractNestablePropertyAccessor nestedPa;
try {
nestedPa = getPropertyAccessorForPropertyPath(propertyName);
} catch (NotReadablePropertyException ex) {
throw new NotWritablePropertyException(getRootClass(), this.nestedPath + propertyName,
"Nested property in path '" + propertyName + "' does not exist", ex);
}
tokens = getPropertyNameTokens(getFinalPath(nestedPa, propertyName));
if (nestedPa == this) {
pv.getOriginalPropertyValue().resolvedTokens = tokens;
}
nestedPa.setPropertyValue(tokens, pv);
} else {
setPropertyValue(tokens, pv);
}
}
protected void setPropertyValue(PropertyTokenHolder tokens, PropertyValue pv) throws BeansException {
if (tokens.keys != null) {
processKeyedProperty(tokens, pv);
} else {
processLocalProperty(tokens, pv);
}
}
@SuppressWarnings("unchecked")
private void processKeyedProperty(PropertyTokenHolder tokens, PropertyValue pv) {
Object propValue = getPropertyHoldingValue(tokens);
PropertyHandler ph = getLocalPropertyHandler(tokens.actualName);
if (ph == null) {
throw new InvalidPropertyException(
getRootClass(), this.nestedPath + tokens.actualName, "No property handler found");
}
Assert.state(tokens.keys != null, "No token keys");
String lastKey = tokens.keys[tokens.keys.length - 1];
if (propValue.getClass().isArray()) {
Class<?> requiredType = propValue.getClass().getComponentType();
int arrayIndex = Integer.parseInt(lastKey);
Object oldValue = null;
try {
if (isExtractOldValueForEditor() && arrayIndex < Array.getLength(propValue)) {
oldValue = Array.get(propValue, arrayIndex);
}
Object convertedValue = convertIfNecessary(tokens.canonicalName, oldValue, pv.getValue(),
requiredType, ph.nested(tokens.keys.length));
int length = Array.getLength(propValue);
if (arrayIndex >= length && arrayIndex < this.autoGrowCollectionLimit) {
Class<?> componentType = propValue.getClass().getComponentType();
Object newArray = Array.newInstance(componentType, arrayIndex + 1);
System.arraycopy(propValue, 0, newArray, 0, length);
setPropertyValue(tokens.actualName, newArray);
propValue = getPropertyValue(tokens.actualName);
}
Array.set(propValue, arrayIndex, convertedValue);
} catch (IndexOutOfBoundsException ex) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + tokens.canonicalName,
"Invalid array index in property path '" + tokens.canonicalName + "'", ex);
}
} else if (propValue instanceof List) {
Class<?> requiredType = ph.getCollectionType(tokens.keys.length);
List<Object> list = (List<Object>) propValue;
int index = Integer.parseInt(lastKey);
Object oldValue = null;
if (isExtractOldValueForEditor() && index < list.size()) {
oldValue = list.get(index);
}
Object convertedValue = convertIfNecessary(tokens.canonicalName, oldValue, pv.getValue(),
requiredType, ph.nested(tokens.keys.length));
int size = list.size();
if (index >= size && index < this.autoGrowCollectionLimit) {
for (int i = size; i < index; i++) {
try {
list.add(null);
} catch (NullPointerException ex) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + tokens.canonicalName,
"Cannot set element with index " + index + " in List of size " +
size + ", accessed using property path '" + tokens.canonicalName +
"': List does not support filling up gaps with null elements");
}
}
list.add(convertedValue);
} else {
try {
list.set(index, convertedValue);
} catch (IndexOutOfBoundsException ex) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + tokens.canonicalName,
"Invalid list index in property path '" + tokens.canonicalName + "'", ex);
}
}
} else if (propValue instanceof Map) {
Class<?> mapKeyType = ph.getMapKeyType(tokens.keys.length);
Class<?> mapValueType = ph.getMapValueType(tokens.keys.length);
Map<Object, Object> map = (Map<Object, Object>) propValue;
// IMPORTANT: Do not pass full property name in here - property editors
// must not kick in for map keys but rather only for map values.
TypeDescriptor typeDescriptor = TypeDescriptor.valueOf(mapKeyType);
Object convertedMapKey = convertIfNecessary(null, null, lastKey, mapKeyType, typeDescriptor);
Object oldValue = null;
if (isExtractOldValueForEditor()) {
oldValue = map.get(convertedMapKey);
}
// Pass full property name and old value in here, since we want full
// conversion ability for map values.
Object convertedMapValue = convertIfNecessary(tokens.canonicalName, oldValue, pv.getValue(),
mapValueType, ph.nested(tokens.keys.length));
map.put(convertedMapKey, convertedMapValue);
} else {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + tokens.canonicalName,
"Property referenced in indexed property path '" + tokens.canonicalName +
"' is neither an array nor a List nor a Map; returned value was [" + propValue + "]");
}
}
private Object getPropertyHoldingValue(PropertyTokenHolder tokens) {
// Apply indexes and map keys: fetch value for all keys but the last one.
Assert.state(tokens.keys != null, "No token keys");
PropertyTokenHolder getterTokens = new PropertyTokenHolder(tokens.actualName);
getterTokens.canonicalName = tokens.canonicalName;
getterTokens.keys = new String[tokens.keys.length - 1];
System.arraycopy(tokens.keys, 0, getterTokens.keys, 0, tokens.keys.length - 1);
Object propValue;
try {
propValue = getPropertyValue(getterTokens);
} catch (NotReadablePropertyException ex) {
throw new NotWritablePropertyException(getRootClass(), this.nestedPath + tokens.canonicalName,
"Cannot access indexed value in property referenced " +
"in indexed property path '" + tokens.canonicalName + "'", ex);
}
if (propValue == null) {
// null map value case
if (isAutoGrowNestedPaths()) {
int lastKeyIndex = tokens.canonicalName.lastIndexOf('[');
getterTokens.canonicalName = tokens.canonicalName.substring(0, lastKeyIndex);
propValue = setDefaultValue(getterTokens);
} else {
throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + tokens.canonicalName,
"Cannot access indexed value in property referenced " +
"in indexed property path '" + tokens.canonicalName + "': returned null");
}
}
return propValue;
}
private void processLocalProperty(PropertyTokenHolder tokens, PropertyValue pv) {
PropertyHandler ph = getLocalPropertyHandler(tokens.actualName);
if (ph == null || !ph.isWritable()) {
if (pv.isOptional()) {
if (logger.isDebugEnabled()) {
logger.debug("Ignoring optional value for property '" + tokens.actualName +
"' - property not found on bean class [" + getRootClass().getName() + "]");
}
return;
}
if (this.suppressNotWritablePropertyException) {
// Optimization for common ignoreUnknown=true scenario since the
// exception would be caught and swallowed higher up anyway...
return;
}
throw createNotWritablePropertyException(tokens.canonicalName);
}
Object oldValue = null;
try {
Object originalValue = pv.getValue();
Object valueToApply = originalValue;
if (!Boolean.FALSE.equals(pv.conversionNecessary)) {
if (pv.isConverted()) {
valueToApply = pv.getConvertedValue();
} else {
if (isExtractOldValueForEditor() && ph.isReadable()) {
try {
oldValue = ph.getValue();
} catch (Exception ex) {
if (ex instanceof PrivilegedActionException) {
ex = ((PrivilegedActionException) ex).getException();
}
if (logger.isDebugEnabled()) {
logger.debug("Could not read previous value of property '" +
this.nestedPath + tokens.canonicalName + "'", ex);
}
}
}
valueToApply = convertForProperty(
tokens.canonicalName, oldValue, originalValue, ph.toTypeDescriptor());
}
pv.getOriginalPropertyValue().conversionNecessary = (valueToApply != originalValue);
}
ph.setValue(valueToApply);
} catch (TypeMismatchException ex) {
throw ex;
} catch (InvocationTargetException ex) {
PropertyChangeEvent propertyChangeEvent = new PropertyChangeEvent(
getRootInstance(), this.nestedPath + tokens.canonicalName, oldValue, pv.getValue());
if (ex.getTargetException() instanceof ClassCastException) {
throw new TypeMismatchException(propertyChangeEvent, ph.getPropertyType(), ex.getTargetException());
} else {
Throwable cause = ex.getTargetException();
if (cause instanceof UndeclaredThrowableException) {
// May happen e.g. with Groovy-generated methods
cause = cause.getCause();
}
throw new MethodInvocationException(propertyChangeEvent, cause);
}
} catch (Exception ex) {
PropertyChangeEvent pce = new PropertyChangeEvent(
getRootInstance(), this.nestedPath + tokens.canonicalName, oldValue, pv.getValue());
throw new MethodInvocationException(pce, ex);
}
}
@Override
@Nullable
public Class<?> getPropertyType(String propertyName) throws BeansException {
try {
PropertyHandler ph = getPropertyHandler(propertyName);
if (ph != null) {
return ph.getPropertyType();
} else {
// Maybe an indexed/mapped property...
Object value = getPropertyValue(propertyName);
if (value != null) {
return value.getClass();
}
// Check to see if there is a custom editor,
// which might give an indication on the desired target type.
Class<?> editorType = guessPropertyTypeFromEditors(propertyName);
if (editorType != null) {
return editorType;
}
}
} catch (InvalidPropertyException ex) {
// Consider as not determinable.
}
return null;
}
@Override
@Nullable
public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException {
try {
AbstractNestablePropertyAccessor nestedPa = getPropertyAccessorForPropertyPath(propertyName);
String finalPath = getFinalPath(nestedPa, propertyName);
PropertyTokenHolder tokens = getPropertyNameTokens(finalPath);
PropertyHandler ph = nestedPa.getLocalPropertyHandler(tokens.actualName);
if (ph != null) {
if (tokens.keys != null) {
if (ph.isReadable() || ph.isWritable()) {
return ph.nested(tokens.keys.length);
}
} else {
if (ph.isReadable() || ph.isWritable()) {
return ph.toTypeDescriptor();
}
}
}
} catch (InvalidPropertyException ex) {
// Consider as not determinable.
}
return null;
}
@Override
public boolean isReadableProperty(String propertyName) {
try {
PropertyHandler ph = getPropertyHandler(propertyName);
if (ph != null) {
return ph.isReadable();
} else {
// Maybe an indexed/mapped property...
getPropertyValue(propertyName);
return true;
}
} catch (InvalidPropertyException ex) {
// Cannot be evaluated, so can't be readable.
}
return false;
}
@Override
public boolean isWritableProperty(String propertyName) {
try {
PropertyHandler ph = getPropertyHandler(propertyName);
if (ph != null) {
return ph.isWritable();
} else {
// Maybe an indexed/mapped property...
getPropertyValue(propertyName);
return true;
}
} catch (InvalidPropertyException ex) {
// Cannot be evaluated, so can't be writable.
}
return false;
}
@Nullable
private Object convertIfNecessary(@Nullable String propertyName, @Nullable Object oldValue,
@Nullable Object newValue, @Nullable Class<?> requiredType, @Nullable TypeDescriptor td)
throws TypeMismatchException {
Assert.state(this.typeConverterDelegate != null, "No TypeConverterDelegate");
try {
return this.typeConverterDelegate.convertIfNecessary(propertyName, oldValue, newValue, requiredType, td);
} catch (ConverterNotFoundException | IllegalStateException ex) {
PropertyChangeEvent pce =
new PropertyChangeEvent(getRootInstance(), this.nestedPath + propertyName, oldValue, newValue);
throw new ConversionNotSupportedException(pce, requiredType, ex);
} catch (ConversionException | IllegalArgumentException ex) {
PropertyChangeEvent pce =
new PropertyChangeEvent(getRootInstance(), this.nestedPath + propertyName, oldValue, newValue);
throw new TypeMismatchException(pce, requiredType, ex);
}
}
@Nullable
protected Object convertForProperty(
String propertyName, @Nullable Object oldValue, @Nullable Object newValue, TypeDescriptor td)
throws TypeMismatchException {
return convertIfNecessary(propertyName, oldValue, newValue, td.getType(), td);
}
@Override
@Nullable
public Object getPropertyValue(String propertyName) throws BeansException {
AbstractNestablePropertyAccessor nestedPa = getPropertyAccessorForPropertyPath(propertyName);
PropertyTokenHolder tokens = getPropertyNameTokens(getFinalPath(nestedPa, propertyName));
return nestedPa.getPropertyValue(tokens);
}
@SuppressWarnings("unchecked")
@Nullable
protected Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
String propertyName = tokens.canonicalName;
String actualName = tokens.actualName;
PropertyHandler ph = getLocalPropertyHandler(actualName);
if (ph == null || !ph.isReadable()) {
throw new NotReadablePropertyException(getRootClass(), this.nestedPath + propertyName);
}
try {
Object value = ph.getValue();
if (tokens.keys != null) {
if (value == null) {
if (isAutoGrowNestedPaths()) {
value = setDefaultValue(new PropertyTokenHolder(tokens.actualName));
} else {
throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + propertyName,
"Cannot access indexed value of property referenced in indexed " +
"property path '" + propertyName + "': returned null");
}
}
StringBuilder indexedPropertyName = new StringBuilder(tokens.actualName);
// apply indexes and map keys
for (int i = 0; i < tokens.keys.length; i++) {
String key = tokens.keys[i];
if (value == null) {
throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + propertyName,
"Cannot access indexed value of property referenced in indexed " +
"property path '" + propertyName + "': returned null");
} else if (value.getClass().isArray()) {
int index = Integer.parseInt(key);
value = growArrayIfNecessary(value, index, indexedPropertyName.toString());
value = Array.get(value, index);
} else if (value instanceof List) {
int index = Integer.parseInt(key);
List<Object> list = (List<Object>) value;
growCollectionIfNecessary(list, index, indexedPropertyName.toString(), ph, i + 1);
value = list.get(index);
} else if (value instanceof Set) {
// Apply index to Iterator in case of a Set.
Set<Object> set = (Set<Object>) value;
int index = Integer.parseInt(key);
if (index < 0 || index >= set.size()) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
"Cannot get element with index " + index + " from Set of size " +
set.size() + ", accessed using property path '" + propertyName + "'");
}
Iterator<Object> it = set.iterator();
for (int j = 0; it.hasNext(); j++) {
Object elem = it.next();
if (j == index) {
value = elem;
break;
}
}
} else if (value instanceof Map) {
Map<Object, Object> map = (Map<Object, Object>) value;
Class<?> mapKeyType = ph.getResolvableType().getNested(i + 1).asMap().resolveGeneric(0);
// IMPORTANT: Do not pass full property name in here - property editors
// must not kick in for map keys but rather only for map values.
TypeDescriptor typeDescriptor = TypeDescriptor.valueOf(mapKeyType);
Object convertedMapKey = convertIfNecessary(null, null, key, mapKeyType, typeDescriptor);
value = map.get(convertedMapKey);
} else {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
"Property referenced in indexed property path '" + propertyName +
"' is neither an array nor a List nor a Set nor a Map; returned value was [" + value + "]");
}
indexedPropertyName.append(PROPERTY_KEY_PREFIX).append(key).append(PROPERTY_KEY_SUFFIX);
}
}
return value;
} catch (IndexOutOfBoundsException ex) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
"Index of out of bounds in property path '" + propertyName + "'", ex);
} catch (NumberFormatException | TypeMismatchException ex) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
"Invalid index in property path '" + propertyName + "'", ex);
} catch (InvocationTargetException ex) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
"Getter for property '" + actualName + "' threw exception", ex);
} catch (Exception ex) {
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
"Illegal attempt to get property '" + actualName + "' threw exception", ex);
}
}
/**
* Return the {@link PropertyHandler} for the specified {@code propertyName}, navigating
* if necessary. Return {@code null} if not found rather than throwing an exception.
*
* @param propertyName the property to obtain the descriptor for
* @return the property descriptor for the specified property,
* or {@code null} if not found
* @throws BeansException in case of introspection failure
*/
@Nullable
protected PropertyHandler getPropertyHandler(String propertyName) throws BeansException {
Assert.notNull(propertyName, "Property name must not be null");
AbstractNestablePropertyAccessor nestedPa = getPropertyAccessorForPropertyPath(propertyName);
return nestedPa.getLocalPropertyHandler(getFinalPath(nestedPa, propertyName));
}
/**
* Return a {@link PropertyHandler} for the specified local {@code propertyName}.
* Only used to reach a property available in the current context.
*
* @param propertyName the name of a local property
* @return the handler for that property, or {@code null} if it has not been found
*/
@Nullable
protected abstract PropertyHandler getLocalPropertyHandler(String propertyName);
/**
* Create a new nested property accessor instance.
* Can be overridden in subclasses to create a PropertyAccessor subclass.
*
* @param object the object wrapped by this PropertyAccessor
* @param nestedPath the nested path of the object
* @return the nested PropertyAccessor instance
*/
protected abstract AbstractNestablePropertyAccessor newNestedPropertyAccessor(Object object, String nestedPath);
/**
* Create a {@link NotWritablePropertyException} for the specified property.
*/
protected abstract NotWritablePropertyException createNotWritablePropertyException(String propertyName);
private Object growArrayIfNecessary(Object array, int index, String name) {
if (!isAutoGrowNestedPaths()) {
return array;
}
int length = Array.getLength(array);
if (index >= length && index < this.autoGrowCollectionLimit) {
Class<?> componentType = array.getClass().getComponentType();
Object newArray = Array.newInstance(componentType, index + 1);
System.arraycopy(array, 0, newArray, 0, length);
for (int i = length; i < Array.getLength(newArray); i++) {
Array.set(newArray, i, newValue(componentType, null, name));
}
setPropertyValue(name, newArray);
Object defaultValue = getPropertyValue(name);
Assert.state(defaultValue != null, "Default value must not be null");
return defaultValue;
} else {
return array;
}
}
private void growCollectionIfNecessary(Collection<Object> collection, int index, String name,
PropertyHandler ph, int nestingLevel) {
if (!isAutoGrowNestedPaths()) {
return;
}
int size = collection.size();
if (index >= size && index < this.autoGrowCollectionLimit) {
Class<?> elementType = ph.getResolvableType().getNested(nestingLevel).asCollection().resolveGeneric();
if (elementType != null) {
for (int i = collection.size(); i < index + 1; i++) {
collection.add(newValue(elementType, null, name));
}
}
}
}
/**
* Get the last component of the path. Also works if not nested.
*
* @param pa property accessor to work on
* @param nestedPath property path we know is nested
* @return last component of the path (the property on the target bean)
*/
protected String getFinalPath(AbstractNestablePropertyAccessor pa, String nestedPath) {
if (pa == this) {
return nestedPath;
}
return nestedPath.substring(PropertyAccessorUtils.getLastNestedPropertySeparatorIndex(nestedPath) + 1);
}
/**
* Recursively navigate to return a property accessor for the nested property path.
*
* @param propertyPath property path, which may be nested
* @return a property accessor for the target bean
*/
protected AbstractNestablePropertyAccessor getPropertyAccessorForPropertyPath(String propertyPath) {
int pos = PropertyAccessorUtils.getFirstNestedPropertySeparatorIndex(propertyPath);
// Handle nested properties recursively.
if (pos > -1) {
String nestedProperty = propertyPath.substring(0, pos);
String nestedPath = propertyPath.substring(pos + 1);
AbstractNestablePropertyAccessor nestedPa = getNestedPropertyAccessor(nestedProperty);
return nestedPa.getPropertyAccessorForPropertyPath(nestedPath);
} else {
return this;
}
}
/**
* Retrieve a Property accessor for the given nested property.
* Create a new one if not found in the cache.
* <p>Note: Caching nested PropertyAccessors is necessary now,
* to keep registered custom editors for nested properties.
*
* @param nestedProperty property to create the PropertyAccessor for
* @return the PropertyAccessor instance, either cached or newly created
*/
private AbstractNestablePropertyAccessor getNestedPropertyAccessor(String nestedProperty) {
if (this.nestedPropertyAccessors == null) {
this.nestedPropertyAccessors = new HashMap<>();
}
// Get value of bean property.
PropertyTokenHolder tokens = getPropertyNameTokens(nestedProperty);
String canonicalName = tokens.canonicalName;
Object value = getPropertyValue(tokens);
if (value == null || (value instanceof Optional && !((Optional<?>) value).isPresent())) {
if (isAutoGrowNestedPaths()) {
value = setDefaultValue(tokens);
} else {
throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + canonicalName);
}
}
// Lookup cached sub-PropertyAccessor, create new one if not found.
AbstractNestablePropertyAccessor nestedPa = this.nestedPropertyAccessors.get(canonicalName);
if (nestedPa == null || nestedPa.getWrappedInstance() != ObjectUtils.unwrapOptional(value)) {
if (logger.isTraceEnabled()) {
logger.trace("Creating new nested " + getClass().getSimpleName() + " for property '" + canonicalName + "'");
}
nestedPa = newNestedPropertyAccessor(value, this.nestedPath + canonicalName + NESTED_PROPERTY_SEPARATOR);
// Inherit all type-specific PropertyEditors.
copyDefaultEditorsTo(nestedPa);
copyCustomEditorsTo(nestedPa, canonicalName);
this.nestedPropertyAccessors.put(canonicalName, nestedPa);
} else {
if (logger.isTraceEnabled()) {
logger.trace("Using cached nested property accessor for property '" + canonicalName + "'");
}
}
return nestedPa;
}
private Object setDefaultValue(PropertyTokenHolder tokens) {
PropertyValue pv = createDefaultPropertyValue(tokens);
setPropertyValue(tokens, pv);
Object defaultValue = getPropertyValue(tokens);
Assert.state(defaultValue != null, "Default value must not be null");
return defaultValue;
}
private PropertyValue createDefaultPropertyValue(PropertyTokenHolder tokens) {
TypeDescriptor desc = getPropertyTypeDescriptor(tokens.canonicalName);
if (desc == null) {
throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + tokens.canonicalName,
"Could not determine property type for auto-growing a default value");
}
Object defaultValue = newValue(desc.getType(), desc, tokens.canonicalName);
return new PropertyValue(tokens.canonicalName, defaultValue);
}
private Object newValue(Class<?> type, @Nullable TypeDescriptor desc, String name) {
try {
if (type.isArray()) {
Class<?> componentType = type.getComponentType();
// TODO - only handles 2-dimensional arrays
if (componentType.isArray()) {
Object array = Array.newInstance(componentType, 1);
Array.set(array, 0, Array.newInstance(componentType.getComponentType(), 0));
return array;
} else {
return Array.newInstance(componentType, 0);
}
} else if (Collection.class.isAssignableFrom(type)) {
TypeDescriptor elementDesc = (desc != null ? desc.getElementTypeDescriptor() : null);
return CollectionFactory.createCollection(type, (elementDesc != null ? elementDesc.getType() : null), 16);
} else if (Map.class.isAssignableFrom(type)) {
TypeDescriptor keyDesc = (desc != null ? desc.getMapKeyTypeDescriptor() : null);
return CollectionFactory.createMap(type, (keyDesc != null ? keyDesc.getType() : null), 16);
} else {
Constructor<?> ctor = type.getDeclaredConstructor();
if (Modifier.isPrivate(ctor.getModifiers())) {
throw new IllegalAccessException("Auto-growing not allowed with private constructor: " + ctor);
}
return BeanUtils.instantiateClass(ctor);
}
} catch (Throwable ex) {
throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + name,
"Could not instantiate property type [" + type.getName() + "] to auto-grow nested property path", ex);
}
}
/**
* Parse the given property name into the corresponding property name tokens.
*
* @param propertyName the property name to parse
* @return representation of the parsed property tokens
*/
private PropertyTokenHolder getPropertyNameTokens(String propertyName) {
String actualName = null;
List<String> keys = new ArrayList<>(2);
int searchIndex = 0;
while (searchIndex != -1) {
int keyStart = propertyName.indexOf(PROPERTY_KEY_PREFIX, searchIndex);
searchIndex = -1;
if (keyStart != -1) {
int keyEnd = getPropertyNameKeyEnd(propertyName, keyStart + PROPERTY_KEY_PREFIX.length());
if (keyEnd != -1) {
if (actualName == null) {
actualName = propertyName.substring(0, keyStart);
}
String key = propertyName.substring(keyStart + PROPERTY_KEY_PREFIX.length(), keyEnd);
if (key.length() > 1 && (key.startsWith("'") && key.endsWith("'")) ||
(key.startsWith("\"") && key.endsWith("\""))) {
key = key.substring(1, key.length() - 1);
}
keys.add(key);
searchIndex = keyEnd + PROPERTY_KEY_SUFFIX.length();
}
}
}
PropertyTokenHolder tokens = new PropertyTokenHolder(actualName != null ? actualName : propertyName);
if (!keys.isEmpty()) {
tokens.canonicalName += PROPERTY_KEY_PREFIX +
StringUtils.collectionToDelimitedString(keys, PROPERTY_KEY_SUFFIX + PROPERTY_KEY_PREFIX) +
PROPERTY_KEY_SUFFIX;
tokens.keys = StringUtils.toStringArray(keys);
}
return tokens;
}
private int getPropertyNameKeyEnd(String propertyName, int startIndex) {
int unclosedPrefixes = 0;
int length = propertyName.length();
for (int i = startIndex; i < length; i++) {
switch (propertyName.charAt(i)) {
case PropertyAccessor.PROPERTY_KEY_PREFIX_CHAR:
// The property name contains opening prefix(es)...
unclosedPrefixes++;
break;
case PropertyAccessor.PROPERTY_KEY_SUFFIX_CHAR:
if (unclosedPrefixes == 0) {
// No unclosed prefix(es) in the property name (left) ->
// this is the suffix we are looking for.
return i;
} else {
// This suffix does not close the initial prefix but rather
// just one that occurred within the property name.
unclosedPrefixes--;
}
break;
}
}
return -1;
}
@Override
public String toString() {
String className = getClass().getName();
if (this.wrappedObject == null) {
return className + ": no wrapped object set";
}
return className + ": wrapping object [" + ObjectUtils.identityToString(this.wrappedObject) + ']';
}
/**
* A handler for a specific property.
*/
protected abstract static class PropertyHandler {
private final Class<?> propertyType;
private final boolean readable;
private final boolean writable;
public PropertyHandler(Class<?> propertyType, boolean readable, boolean writable) {
this.propertyType = propertyType;
this.readable = readable;
this.writable = writable;
}
public Class<?> getPropertyType() {
return this.propertyType;
}
public boolean isReadable() {
return this.readable;
}
public boolean isWritable() {
return this.writable;
}
public abstract TypeDescriptor toTypeDescriptor();
public abstract ResolvableType getResolvableType();
@Nullable
public Class<?> getMapKeyType(int nestingLevel) {
return getResolvableType().getNested(nestingLevel).asMap().resolveGeneric(0);
}
@Nullable
public Class<?> getMapValueType(int nestingLevel) {
return getResolvableType().getNested(nestingLevel).asMap().resolveGeneric(1);
}
@Nullable
public Class<?> getCollectionType(int nestingLevel) {
return getResolvableType().getNested(nestingLevel).asCollection().resolveGeneric();
}
@Nullable
public abstract TypeDescriptor nested(int level);
@Nullable
public abstract Object getValue() throws Exception;
public abstract void setValue(@Nullable Object value) throws Exception;
}
/**
* Holder class used to store property tokens.
*/
protected static class PropertyTokenHolder {
public PropertyTokenHolder(String name) {
this.actualName = name;
this.canonicalName = name;
}
public String actualName;
public String canonicalName;
@Nullable
public String[] keys;
}
}
| [
"mdzxzhao@163.com"
] | mdzxzhao@163.com |
5da5806384ed0fd99d7f8f4eb0436bc7471b026c | f17a8f4dd140532ee10730639f86b62683985c58 | /src/main/java/com/cisco/axl/api/_8/UpdateCommonDeviceConfigReq.java | 8505ac3a1caa708f5c9c9aa67f821c7700a2643d | [
"Apache-2.0"
] | permissive | alexpekurovsky/cucm-http-api | 16f1b2f54cff4dcdc57cf6407c2a40ac8302a82a | a1eabf49cc9a05c8293ba07ae97f2fe724a6e24d | refs/heads/master | 2021-01-15T14:19:10.994351 | 2013-04-04T15:32:08 | 2013-04-04T15:32:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,735 | java |
package com.cisco.axl.api._8;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for UpdateCommonDeviceConfigReq complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="UpdateCommonDeviceConfigReq">
* <complexContent>
* <extension base="{http://www.cisco.com/AXL/API/8.0}NameAndGUIDRequest">
* <sequence>
* <element name="newName" type="{http://www.cisco.com/AXL/API/8.0}UniqueString50" minOccurs="0"/>
* <element name="softkeyTemplateName" type="{http://www.cisco.com/AXL/API/8.0}XFkType" minOccurs="0"/>
* <element name="userLocale" type="{http://www.cisco.com/AXL/API/8.0}XUserLocale" minOccurs="0"/>
* <element name="networkHoldMohAudioSourceId" type="{http://www.cisco.com/AXL/API/8.0}XMOHAudioSourceId" minOccurs="0"/>
* <element name="userHoldMohAudioSourceId" type="{http://www.cisco.com/AXL/API/8.0}XMOHAudioSourceId" minOccurs="0"/>
* <element name="mlppDomainId" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
* <element name="mlppIndicationStatus" type="{http://www.cisco.com/AXL/API/8.0}XStatus" minOccurs="0"/>
* <element name="useTrustedRelayPoint" type="{http://www.cisco.com/AXL/API/8.0}boolean" minOccurs="0"/>
* <element name="preemption" type="{http://www.cisco.com/AXL/API/8.0}XPreemption" minOccurs="0"/>
* <element name="ipAddressingMode" type="{http://www.cisco.com/AXL/API/8.0}XIPAddressingMode" minOccurs="0"/>
* <element name="ipAddressingModePreferenceControl" type="{http://www.cisco.com/AXL/API/8.0}XIPAddressingModePrefControl" minOccurs="0"/>
* <element name="allowAutoConfigurationForPhones" type="{http://www.cisco.com/AXL/API/8.0}XStatus" minOccurs="0"/>
* <element name="useImeForOutboundCalls" type="{http://www.cisco.com/AXL/API/8.0}XStatus" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UpdateCommonDeviceConfigReq", propOrder = {
"newName",
"softkeyTemplateName",
"userLocale",
"networkHoldMohAudioSourceId",
"userHoldMohAudioSourceId",
"mlppDomainId",
"mlppIndicationStatus",
"useTrustedRelayPoint",
"preemption",
"ipAddressingMode",
"ipAddressingModePreferenceControl",
"allowAutoConfigurationForPhones",
"useImeForOutboundCalls"
})
public class UpdateCommonDeviceConfigReq
extends NameAndGUIDRequest
{
protected String newName;
@XmlElementRef(name = "softkeyTemplateName", type = JAXBElement.class)
protected JAXBElement<XFkType> softkeyTemplateName;
@XmlElementRef(name = "userLocale", type = JAXBElement.class)
protected JAXBElement<String> userLocale;
@XmlElementRef(name = "networkHoldMohAudioSourceId", type = JAXBElement.class)
protected JAXBElement<String> networkHoldMohAudioSourceId;
@XmlElementRef(name = "userHoldMohAudioSourceId", type = JAXBElement.class)
protected JAXBElement<String> userHoldMohAudioSourceId;
@XmlElementRef(name = "mlppDomainId", type = JAXBElement.class)
protected JAXBElement<Integer> mlppDomainId;
@XmlElement(defaultValue = "Default")
protected String mlppIndicationStatus;
@XmlElement(defaultValue = "false")
protected String useTrustedRelayPoint;
@XmlElement(defaultValue = "Default")
protected String preemption;
@XmlElement(defaultValue = "IPv4 and IPv6")
protected String ipAddressingMode;
@XmlElement(defaultValue = "Use System Default")
protected String ipAddressingModePreferenceControl;
@XmlElement(defaultValue = "Default")
protected String allowAutoConfigurationForPhones;
@XmlElement(defaultValue = "Default")
protected String useImeForOutboundCalls;
/**
* Gets the value of the newName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNewName() {
return newName;
}
/**
* Sets the value of the newName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNewName(String value) {
this.newName = value;
}
/**
* Gets the value of the softkeyTemplateName property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link XFkType }{@code >}
*
*/
public JAXBElement<XFkType> getSoftkeyTemplateName() {
return softkeyTemplateName;
}
/**
* Sets the value of the softkeyTemplateName property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link XFkType }{@code >}
*
*/
public void setSoftkeyTemplateName(JAXBElement<XFkType> value) {
this.softkeyTemplateName = ((JAXBElement<XFkType> ) value);
}
/**
* Gets the value of the userLocale property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public JAXBElement<String> getUserLocale() {
return userLocale;
}
/**
* Sets the value of the userLocale property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public void setUserLocale(JAXBElement<String> value) {
this.userLocale = ((JAXBElement<String> ) value);
}
/**
* Gets the value of the networkHoldMohAudioSourceId property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public JAXBElement<String> getNetworkHoldMohAudioSourceId() {
return networkHoldMohAudioSourceId;
}
/**
* Sets the value of the networkHoldMohAudioSourceId property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public void setNetworkHoldMohAudioSourceId(JAXBElement<String> value) {
this.networkHoldMohAudioSourceId = ((JAXBElement<String> ) value);
}
/**
* Gets the value of the userHoldMohAudioSourceId property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public JAXBElement<String> getUserHoldMohAudioSourceId() {
return userHoldMohAudioSourceId;
}
/**
* Sets the value of the userHoldMohAudioSourceId property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link String }{@code >}
*
*/
public void setUserHoldMohAudioSourceId(JAXBElement<String> value) {
this.userHoldMohAudioSourceId = ((JAXBElement<String> ) value);
}
/**
* Gets the value of the mlppDomainId property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link Integer }{@code >}
*
*/
public JAXBElement<Integer> getMlppDomainId() {
return mlppDomainId;
}
/**
* Sets the value of the mlppDomainId property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link Integer }{@code >}
*
*/
public void setMlppDomainId(JAXBElement<Integer> value) {
this.mlppDomainId = ((JAXBElement<Integer> ) value);
}
/**
* Gets the value of the mlppIndicationStatus property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMlppIndicationStatus() {
return mlppIndicationStatus;
}
/**
* Sets the value of the mlppIndicationStatus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMlppIndicationStatus(String value) {
this.mlppIndicationStatus = value;
}
/**
* Gets the value of the useTrustedRelayPoint property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUseTrustedRelayPoint() {
return useTrustedRelayPoint;
}
/**
* Sets the value of the useTrustedRelayPoint property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUseTrustedRelayPoint(String value) {
this.useTrustedRelayPoint = value;
}
/**
* Gets the value of the preemption property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPreemption() {
return preemption;
}
/**
* Sets the value of the preemption property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPreemption(String value) {
this.preemption = value;
}
/**
* Gets the value of the ipAddressingMode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIpAddressingMode() {
return ipAddressingMode;
}
/**
* Sets the value of the ipAddressingMode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIpAddressingMode(String value) {
this.ipAddressingMode = value;
}
/**
* Gets the value of the ipAddressingModePreferenceControl property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIpAddressingModePreferenceControl() {
return ipAddressingModePreferenceControl;
}
/**
* Sets the value of the ipAddressingModePreferenceControl property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIpAddressingModePreferenceControl(String value) {
this.ipAddressingModePreferenceControl = value;
}
/**
* Gets the value of the allowAutoConfigurationForPhones property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAllowAutoConfigurationForPhones() {
return allowAutoConfigurationForPhones;
}
/**
* Sets the value of the allowAutoConfigurationForPhones property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAllowAutoConfigurationForPhones(String value) {
this.allowAutoConfigurationForPhones = value;
}
/**
* Gets the value of the useImeForOutboundCalls property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUseImeForOutboundCalls() {
return useImeForOutboundCalls;
}
/**
* Sets the value of the useImeForOutboundCalls property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUseImeForOutboundCalls(String value) {
this.useImeForOutboundCalls = value;
}
}
| [
"martin@filliau.com"
] | martin@filliau.com |
e81eea5c7173249c35b29c7d85027ff5cb6a3ef9 | f638b707b65a45716a966ceea9668833416a5bf2 | /Eureka_Spring_Ribbon/Eurekha_Client_User/Eurekha_Client_Account/src/main/java/com/example/microservice/controller/AccountController.java | a430653035ae69cdbb621f20b80da1d908c469a5 | [] | no_license | shyampadma007/Eureka-Client-Server-Ribbon | 5b1c399ba62830298e10db81d14d90ce0ed815c2 | 2385b0957cb347defdbc6f93d532451e78a0e7a2 | refs/heads/main | 2023-08-17T02:55:49.527196 | 2021-09-24T16:57:24 | 2021-09-24T16:57:24 | 410,038,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 822 | java | package com.example.microservice.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.example.microservice.model.Account;
import com.example.microservice.service.AccountService;
@RestController
public class AccountController {
@Autowired
private AccountService accountService;
@GetMapping(value="/accounts/{empId}")
public List<Account>getAccountsByEmpId(@PathVariable String empId) {
System.out.println("EmpId------" + empId);
List<Account> empAccountList = accountService.findAccountsByEmpId(empId);
return empAccountList;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e1338da9592057be9627159d2bf9841231b7f28f | 6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386 | /google/cloud/aiplatform/v1beta1/google-cloud-aiplatform-v1beta1-java/proto-google-cloud-aiplatform-v1beta1-java/src/main/java/com/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/AutoMlVideoActionRecognitionInputsOrBuilder.java | 301e7ea04f57345abbb5f22e2f84aba39ea81627 | [
"Apache-2.0"
] | permissive | oltoco/googleapis-gen | bf40cfad61b4217aca07068bd4922a86e3bbd2d5 | 00ca50bdde80906d6f62314ef4f7630b8cdb6e15 | refs/heads/master | 2023-07-17T22:11:47.848185 | 2021-08-29T20:39:47 | 2021-08-29T20:39:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 1,066 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/automl_video_action_recognition.proto
package com.google.cloud.aiplatform.v1beta1.schema.trainingjob.definition;
public interface AutoMlVideoActionRecognitionInputsOrBuilder extends
// @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.schema.trainingjob.definition.AutoMlVideoActionRecognitionInputs)
com.google.protobuf.MessageOrBuilder {
/**
* <code>.google.cloud.aiplatform.v1beta1.schema.trainingjob.definition.AutoMlVideoActionRecognitionInputs.ModelType model_type = 1;</code>
* @return The enum numeric value on the wire for modelType.
*/
int getModelTypeValue();
/**
* <code>.google.cloud.aiplatform.v1beta1.schema.trainingjob.definition.AutoMlVideoActionRecognitionInputs.ModelType model_type = 1;</code>
* @return The modelType.
*/
com.google.cloud.aiplatform.v1beta1.schema.trainingjob.definition.AutoMlVideoActionRecognitionInputs.ModelType getModelType();
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
] | bazel-bot-development[bot]@users.noreply.github.com |
7e02a44ab8e2f09a29607d0f030e94f192f82abc | 8caba2a86790afe235233c6f622154487a3e0567 | /app/src/main/java/cn/lc/model/framework/utils/ScreenUtils.java | 0d3b2cd4b56923595092bc47772bb3035e77d084 | [] | no_license | Catfeeds/zhihuihouqin_service | 05d70556e5ed2ceaf3cdbe1fe095ad45fffdaeb5 | 1fb0b205c9fe634fe713b2981d7181148fc55f7d | refs/heads/master | 2020-04-05T17:29:18.036913 | 2018-01-12T07:11:32 | 2018-01-12T07:11:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,784 | java | package cn.lc.model.framework.utils;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import cn.lc.model.framework.base.SystemBarTintManager;
/**
* 获得屏幕相关的辅助类
*
* @author zhy
*/
public class ScreenUtils {
private ScreenUtils() {
/* cannot be instantiated */
throw new UnsupportedOperationException("cannot be instantiated");
}
/**
* 获得屏幕高度
*
* @param context
* @return
*/
public static int getScreenWidth(Context context) {
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics outMetrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(outMetrics);
return outMetrics.widthPixels;
}
/**
* 获得屏幕宽度
*
* @param context
* @return
*/
public static int getScreenHeight(Context context) {
WindowManager wm = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics outMetrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(outMetrics);
return outMetrics.heightPixels;
}
/**
* 获得状态栏的高度
*
* @param context
* @return
*/
public static int getStatusHeight(Context context) {
int statusHeight = -1;
try {
Class<?> clazz = Class.forName("com.android.internal.R$dimen");
Object object = clazz.newInstance();
int height = Integer.parseInt(clazz.getField("status_bar_height")
.get(object).toString());
statusHeight = context.getResources().getDimensionPixelSize(height);
} catch (Exception e) {
e.printStackTrace();
}
return statusHeight;
}
/**
* 获得状态栏的高度
*
* @param context
* @return
*/
public static int getStatusHeight1(Context context) {
/**
* 获取状态栏高度——方法1
* */
int statusHeight = -1;
//获取status_bar_height资源的ID
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
//根据资源ID获取响应的尺寸值
statusHeight = context.getResources().getDimensionPixelSize(resourceId);
}
return statusHeight;
}
/**
* 获取当前屏幕截图,包含状态栏
*
* @param activity
* @return
*/
public static Bitmap snapShotWithStatusBar(Activity activity) {
View view = activity.getWindow().getDecorView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap bmp = view.getDrawingCache();
int width = getScreenWidth(activity);
int height = getScreenHeight(activity);
Bitmap bp = null;
bp = Bitmap.createBitmap(bmp, 0, 0, width, height);
view.destroyDrawingCache();
return bp;
}
/**
* 获取当前屏幕截图,不包含状态栏
*
* @param activity
* @return
*/
public static Bitmap snapShotWithoutStatusBar(Activity activity) {
View view = activity.getWindow().getDecorView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap bmp = view.getDrawingCache();
Rect frame = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int statusBarHeight = frame.top;
int width = getScreenWidth(activity);
int height = getScreenHeight(activity);
Bitmap bp = null;
bp = Bitmap.createBitmap(bmp, 0, statusBarHeight, width, height
- statusBarHeight);
view.destroyDrawingCache();
return bp;
}
/**
* 设置状态栏背景状态
*/
public static void setTranslucentStatus(Activity act, int colorResId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window win = act.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
winParams.flags |= bits;
win.setAttributes(winParams);
}
SystemBarTintManager tintManager = new SystemBarTintManager(act);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(colorResId);// 状态栏无背景
}
}
| [
"wulaifengye@163.com"
] | wulaifengye@163.com |
bf53f07ae533d293858236169503c2f6c291302b | ae7f919d2222e2d1a798266a56fac10d95ec289f | /src/main/java/com/seko/vgau/entities/Sex.java | 44b04efda3e854ed2e1b98c68e823649c155446d | [] | no_license | oleg172/calculator | d9a3c523faf2b1eec4b20256746eb979e33effc9 | 4a2161093a2f7df07af91ba7a46c74549448b2dc | refs/heads/master | 2022-07-03T20:21:37.144727 | 2020-05-08T16:57:59 | 2020-05-08T16:57:59 | 262,379,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 73 | java | package com.seko.vgau.entities;
public enum Sex {
MAN,
WOMAN
}
| [
"milyaev.172@gmail.com"
] | milyaev.172@gmail.com |
23104ce22abd7258cfd90072dbb384ed98e8036f | d2738599e36defd9f431624b0949ec89fa046d40 | /app/src/androidTest/java/com/study/dx/jrgj1/ApplicationTest.java | b88bb09b53cf8bd38ca0ca85a479369f2d8bc827 | [] | no_license | dengshizhen/Interest_rate | 165e1c4964ab6705ec0e16f4799e7148782a7a21 | d6994459e18e1c93aaac331a36628b29523f93a7 | refs/heads/master | 2020-12-24T06:10:58.729904 | 2016-11-08T10:02:39 | 2016-11-08T10:02:39 | 73,172,813 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.study.dx.jrgj1;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"659155324@qq.com"
] | 659155324@qq.com |
f90ce69d40215941a5249b54d36e2bf20b1eba10 | 56f3d79240efc9d5529a8499be7703c726425655 | /src/main/java/net/tntchina/util/GuiUtil.java | a0b540bbbb911bb44c67c147750c80624882a25b | [] | no_license | TNTChinaAAA/TNTBase | 455b6531b7fc0d85697fd18239242e7a90585059 | 2a7963784d2f0658332591e18f984da42dbf503c | refs/heads/master | 2020-05-09T10:14:35.649545 | 2019-04-12T15:41:57 | 2019-04-12T15:41:57 | 181,033,519 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,528 | java | package net.tntchina.util;
import java.awt.Color;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL30;
import org.newdawn.slick.opengl.PNGDecoder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
public class GuiUtil {
public static int reAlpha(int color, float alpha) {
Color c = new Color(color);
float r = ((float) 1 / 255) * c.getRed();
float g = ((float) 1 / 255) * c.getGreen();
float b = ((float) 1 / 255) * c.getBlue();
return new Color(r, g, b, alpha).getRGB();
}
public static void drawRect(double x, double y, double width, double height, int color) {
double left = x;
double top = y;
double right = x + width;
double bottom = y + height;
if (left < right) {
double i = left;
left = right;
right = i;
}
if (top < bottom) {
double j = top;
top = bottom;
bottom = j;
}
float f3 = (float) (color >> 24 & 255) / 255.0F;
float f = (float) (color >> 16 & 255) / 255.0F;
float f1 = (float) (color >> 8 & 255) / 255.0F;
float f2 = (float) (color & 255) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(f, f1, f2, f3);
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
worldrenderer.pos((double) left, (double) bottom, 0.0D).endVertex();
worldrenderer.pos((double) right, (double) bottom, 0.0D).endVertex();
worldrenderer.pos((double) right, (double) top, 0.0D).endVertex();
worldrenderer.pos((double) left, (double) top, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
//Gui.drawRect(x, y, (x + width), (y + height), color);
}
public static int getCenterStringX(String text, int x, int width) {
if (GuiUtil.getFontRenderer() == null) {
return 0;
} else {
return ((width - GuiUtil.getStringWidth(text)) / 2) + x;
}
}
public static int getCenterStringY(String text, int y, int height) {
if (GuiUtil.getFontRenderer() == null) {
return -1 + 1 - 23 + 23 - 999999 + (999 * 1000) + 999;
} else {
return ((height - GuiUtil.getStringHeight()) / 2) + y;
}
}
public static FontRenderer getFontRenderer() {
return Minecraft.getMinecraft().fontRendererObj != null ? Minecraft.getMinecraft().fontRendererObj : null;
}
public static int getStringHeight() {
return GuiUtil.getFontRenderer() != null ? GuiUtil.getFontRenderer().FONT_HEIGHT : 0;
}
public static int getStringWidth(String text) {
return GuiUtil.getFontRenderer() != null ? GuiUtil.getFontRenderer().getStringWidth(text) : 0;
}
public static double getBigString(int x, String text, double big) {
int width = GuiUtil.getStringWidth(text);
return ((x - width) / big) - (width / big);
}
public static void drawBackground(boolean b1, boolean b2, ResourceLocation background) {
ScaledResolution scaledRes = new ScaledResolution(Minecraft.getMinecraft());
GlStateManager.disableDepth();
GlStateManager.depthMask(b1);
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableAlpha();
Minecraft.getMinecraft().getTextureManager().bindTexture(background);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex();
worldrenderer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex();
worldrenderer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex();
worldrenderer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex();
tessellator.draw();
GlStateManager.depthMask(b2);
GlStateManager.enableDepth();
GlStateManager.enableAlpha();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
public static void drawImage(File f, int x, int y, int width, int height) {
ByteBuffer buf = null;
int tWidth = 0;
int tHeight = 0;
try {
InputStream in = new FileInputStream(f);
PNGDecoder decoder = new PNGDecoder(in);
tWidth = decoder.getWidth();
tHeight = decoder.getHeight();
buf = ByteBuffer.allocateDirect( 4 * decoder.getWidth() * decoder.getHeight());
decoder.decode(buf, decoder.getWidth() * 4, PNGDecoder.RGBA);
buf.flip();
in.close();
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
int textureId = GL11.glGenTextures();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL13.glActiveTexture(textureId);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, tWidth, tHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buf);
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
}
public static void drawImage(ResourceLocation resource, int x, int y, int width, int height) {
double par1 = x + width;
double par2 = y + height;
GlStateManager.disableDepth();
GlStateManager.depthMask(false);
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableAlpha();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(resource);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(x, par2, -90.0D).tex(0.0, 1.0D).endVertex();
worldrenderer.pos(par1, par2, -90.0D).tex(1.0D, 1.0D).endVertex();
worldrenderer.pos(par1, y, -90.0D).tex(1.0D, 0.0).endVertex();
worldrenderer.pos(x, y, -90.0D).tex(0.0, 0.0).endVertex();
tessellator.draw();
GlStateManager.depthMask(true);
GlStateManager.enableDepth();
GlStateManager.enableAlpha();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
} | [
"40199850+TNTChinaAAA@users.noreply.github.com"
] | 40199850+TNTChinaAAA@users.noreply.github.com |
a5d92913accad99e7cc8e207ed5c980759463234 | aaabffe8bf55973bfb1390cf7635fd00ca8ca945 | /src/main/java/com/microsoft/graph/requests/extensions/OnenoteOperationCollectionRequest.java | ebd4b00e3207103447b4835671d37237daca2a63 | [
"MIT"
] | permissive | rgrebski/msgraph-sdk-java | e595e17db01c44b9c39d74d26cd925b0b0dfe863 | 759d5a81eb5eeda12d3ed1223deeafd108d7b818 | refs/heads/master | 2020-03-20T19:41:06.630857 | 2018-03-16T17:31:43 | 2018-03-16T17:31:43 | 137,648,798 | 0 | 0 | null | 2018-06-17T11:07:06 | 2018-06-17T11:07:05 | null | UTF-8 | Java | false | false | 1,534 | java | // ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.requests.extensions;
import com.microsoft.graph.concurrency.*;
import com.microsoft.graph.core.*;
import com.microsoft.graph.models.extensions.*;
import com.microsoft.graph.models.generated.*;
import com.microsoft.graph.http.*;
import com.microsoft.graph.requests.extensions.*;
import com.microsoft.graph.requests.generated.*;
import com.microsoft.graph.options.*;
import com.microsoft.graph.serializer.*;
import java.util.Arrays;
import java.util.EnumSet;
// This file is available for extending, afterwards please submit a pull request.
/**
* The class for the Onenote Operation Collection Request.
*/
public class OnenoteOperationCollectionRequest extends BaseOnenoteOperationCollectionRequest implements IOnenoteOperationCollectionRequest {
/**
* The request for this collection of Onenote
*
* @param requestUrl the request URL
* @param client the service client
* @param requestOptions the options for this request
*/
public OnenoteOperationCollectionRequest(final String requestUrl, final IBaseClient client, final java.util.List<? extends Option> requestOptions) {
super(requestUrl, client, requestOptions);
}
}
| [
"caitbal@microsoft.com"
] | caitbal@microsoft.com |
ccdac5858512f507ac1f30c68dbf70d0af97843d | 1a9baa85e859e15d2cc893ea71f59dfa3b1b2ee1 | /java-basic-codes/ReversingNumber.java | 6812ffe7406d8a921dd6d8f5a2ef60270d619c3a | [] | no_license | tanim913/essential_codes | 801dad7ae0c2d94f0f25bd76569502243c7a7de5 | 874be274618c2905cb10b19135486beaf7f08f0c | refs/heads/main | 2023-03-15T15:50:52.869930 | 2021-03-03T19:43:37 | 2021-03-03T19:43:37 | 331,721,387 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 569 | java |
import java.util.Scanner;
public class ReversingNumber {
public static void main(String[] args) {
Scanner i= new Scanner (System.in);
int n, temp, sum=0, r;
System.out.println("Enter a number : ");
n=i.nextInt();
temp=n;
System.out.print("The digits are : ");
while(temp!=0){
r=temp%10;
System.out.print(r+" ");
sum=sum*10+r;
temp=temp/10;
}
System.out.println("\nThe reverse number of "+n+" is : "+sum);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f4b708d0c19e6cf19625bfab19f55c308795df8b | a254c38bdda4043e0307af8a6bfc317698cf43f4 | /src/main/java/weibo4j/util/BareBonesBrowserLaunch.java | b1b84417b1b30527d4c8d71efff85ce61565039d | [] | no_license | wenx999/weibo4j | 68ef5f53991cceb192feaa60e2e1f3229274664e | fb6026698d86e9032fa124462880a2e2b0d75d8f | refs/heads/master | 2021-01-22T16:26:32.397283 | 2014-01-06T07:35:03 | 2014-01-06T07:35:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,136 | java | package weibo4j.util;
// ///////////////////////////////////////////////////////
// Bare Bones Browser Launch //
// Version 1.5 (December 10, 2005) //
// By Dem Pilafian //
// Supports: Mac OS X, GNU/Linux, Unix, Windows XP //
// Example Usage: //
// String url = "http://www.centerkey.com/"; //
// BareBonesBrowserLaunch.openURL(url); //
// Public Domain Software -- Free to Use as You Like //
// ///////////////////////////////////////////////////////
/**
* @author Dem Pilafian
* @author John Kristian
*/
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.swing.JOptionPane;
public class BareBonesBrowserLaunch {
public static void openURL(String url) {
try {
browse(url);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error attempting to launch web browser:\n"
+ e.getLocalizedMessage());
}
}
private static void browse(String url) throws ClassNotFoundException, IllegalAccessException,
IllegalArgumentException, InterruptedException, InvocationTargetException, IOException,
NoSuchMethodException {
String osName = System.getProperty("os.name", "");
if (osName.startsWith("Mac OS")) {
Class fileMgr = Class.forName("com.apple.eio.FileManager");
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class});
openURL.invoke(null, new Object[] {url});
} else if (osName.startsWith("Windows")) {
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
} else { // assume Unix or Linux
String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape"};
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor() == 0)
browser = browsers[count];
if (browser == null)
throw new NoSuchMethodException("Could not find web browser");
else
Runtime.getRuntime().exec(new String[] {browser, url});
}
}
}
| [
"belerweb@gmail.com"
] | belerweb@gmail.com |
ac45a2517a92065f5c327f17b4887b4debcd35d7 | 027714204609992bf6296476fbcd102b97e35735 | /src/main/java/me/yqiang/book_interface/OrderService.java | a13cea571f9d83b0699ac51b7218eb63a7fd9897 | [] | no_license | zqpnb/book | 7508d2dadd1c88929b5726017b6905c0ebb5676d | 4d9e1c7f435d407fa376ff391c8a3bf829916450 | refs/heads/master | 2023-03-22T03:51:11.858259 | 2018-05-28T10:06:33 | 2018-05-28T10:06:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 514 | java | package me.yqiang.book_interface;
import me.yqiang.book_pojo.Order;
import me.yqiang.book_pojo.Orderdetail;
import me.yqiang.pojo.BResult;
import me.yqiang.pojo.Product;
import java.util.List;
public interface OrderService {
BResult add(Long userId, Product[] product);
List<Order> orderList(Long userId);
List<Orderdetail> orderdetailList(Long orderId);
BResult del(Long id);
BResult orderdetailComment(Long id, float rate, String comment);
List<Order> orderAllList(Long userId);
}
| [
"quentinyy@gmail.com"
] | quentinyy@gmail.com |
d79bcd86f9c44bac3d4920b1277d51ef4fbb4a8f | 2540578ded15a632e7d05c80ab0e2a0adc929ee1 | /src/test/java/cybertek/Do_while_Loops/GetUniqueChars.java | 606cb39d25fe61c921f10a86dee68d2d9f0573e4 | [] | no_license | zsalieva/GitDay3 | fe3c741a75d3733dcf34bc79f2f4e2b3395ea1e6 | f7fcece4e7cf0f324eb58ae038a99882155d6424 | refs/heads/master | 2021-12-15T01:54:29.383225 | 2019-12-11T19:48:57 | 2019-12-11T19:48:57 | 213,830,070 | 0 | 0 | null | 2021-12-14T21:34:48 | 2019-10-09T05:40:06 | Java | UTF-8 | Java | false | false | 572 | java | package cybertek.Do_while_Loops;
public class GetUniqueChars {
public static void main(String[] args) {
CharUnique("HHBBTrTDDS");
System.out.println(CharUnique("HHBBTrTDDSTS1"));
}
public static String CharUnique(String str){
String res ="";
for(int i=0 ; i<str.length();i++){
String w1 = str.charAt(i)+"";
if(res.contains(w1)){
System.out.println(w1 +" <-- Dublicate");
}
else{
res=res+w1;
}
}
return res;
}
}
| [
"zuhrasalieva@gmail.com"
] | zuhrasalieva@gmail.com |
9d7197a3ceb7910c0ddeb78cefe3c053e3c40f77 | a458e0a85b39d7ba02ac117e416c79f54f2dfefa | /sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/ReadmeSamples.java | 9261f8e79c0e369239f35e4b2d6306ca9225592a | [
"LGPL-2.1-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0",
"LicenseRef-scancode-generic-cla"
] | permissive | kyle-patterson/azure-sdk-for-java | eada6c5c769063b49e7b0b397f0266b9d9484163 | c53e29e48d477e1f0abc547b2472f4e8040ccac6 | refs/heads/main | 2023-03-17T22:53:37.544823 | 2023-03-07T21:34:33 | 2023-03-07T21:34:33 | 321,455,126 | 0 | 0 | MIT | 2020-12-14T19:44:42 | 2020-12-14T19:44:41 | null | UTF-8 | Java | false | false | 24,933 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.ai.textanalytics;
import com.azure.ai.textanalytics.models.AnalyzeActionsOperationDetail;
import com.azure.ai.textanalytics.models.AnalyzeActionsOptions;
import com.azure.ai.textanalytics.models.AnalyzeHealthcareEntitiesOperationDetail;
import com.azure.ai.textanalytics.models.AnalyzeHealthcareEntitiesOptions;
import com.azure.ai.textanalytics.models.CategorizedEntity;
import com.azure.ai.textanalytics.models.ClassificationCategory;
import com.azure.ai.textanalytics.models.ClassifyDocumentOperationDetail;
import com.azure.ai.textanalytics.models.ClassifyDocumentResult;
import com.azure.ai.textanalytics.models.DetectLanguageInput;
import com.azure.ai.textanalytics.models.DetectedLanguage;
import com.azure.ai.textanalytics.models.DocumentSentiment;
import com.azure.ai.textanalytics.models.EntityDataSource;
import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult;
import com.azure.ai.textanalytics.models.ExtractKeyPhrasesAction;
import com.azure.ai.textanalytics.models.HealthcareEntity;
import com.azure.ai.textanalytics.models.PiiEntityCollection;
import com.azure.ai.textanalytics.models.RecognizeCustomEntitiesOperationDetail;
import com.azure.ai.textanalytics.models.RecognizeEntitiesResult;
import com.azure.ai.textanalytics.models.RecognizePiiEntitiesAction;
import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult;
import com.azure.ai.textanalytics.models.TextAnalyticsActions;
import com.azure.ai.textanalytics.models.TextDocumentInput;
import com.azure.ai.textanalytics.util.AnalyzeActionsResultPagedIterable;
import com.azure.ai.textanalytics.util.AnalyzeHealthcareEntitiesPagedIterable;
import com.azure.ai.textanalytics.util.ClassifyDocumentPagedIterable;
import com.azure.ai.textanalytics.util.RecognizeCustomEntitiesPagedIterable;
import com.azure.core.credential.AzureKeyCredential;
import com.azure.core.credential.TokenCredential;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.http.HttpClient;
import com.azure.core.http.netty.NettyAsyncHttpClientBuilder;
import com.azure.core.util.Context;
import com.azure.core.util.IterableStream;
import com.azure.core.util.polling.SyncPoller;
import com.azure.identity.DefaultAzureCredentialBuilder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* WARNING: MODIFYING THIS FILE WILL REQUIRE CORRESPONDING UPDATES TO README.md FILE. LINE NUMBERS ARE USED TO EXTRACT
* APPROPRIATE CODE SEGMENTS FROM THIS FILE. ADD NEW CODE AT THE BOTTOM TO AVOID CHANGING LINE NUMBERS OF EXISTING CODE
* SAMPLES.
*
* Class containing code snippets that will be injected to README.md.
*/
public class ReadmeSamples {
private TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder().buildClient();
/**
* Code snippet for configuring http client.
*/
public void configureHttpClient() {
// BEGIN: readme-sample-configureHttpClient
HttpClient client = new NettyAsyncHttpClientBuilder()
.port(8080)
.wiretap(true)
.build();
// END: readme-sample-configureHttpClient
}
/**
* Code snippet for getting sync client using the AzureKeyCredential authentication.
*/
public void useAzureKeyCredentialSyncClient() {
// BEGIN: readme-sample-createTextAnalyticsClientWithKeyCredential
TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder()
.credential(new AzureKeyCredential("{key}"))
.endpoint("{endpoint}")
.buildClient();
// END: readme-sample-createTextAnalyticsClientWithKeyCredential
}
/**
* Code snippet for getting async client using AzureKeyCredential authentication.
*/
public void useAzureKeyCredentialAsyncClient() {
// BEGIN: readme-sample-createTextAnalyticsAsyncClientWithKeyCredential
TextAnalyticsAsyncClient textAnalyticsAsyncClient = new TextAnalyticsClientBuilder()
.credential(new AzureKeyCredential("{key}"))
.endpoint("{endpoint}")
.buildAsyncClient();
// END: readme-sample-createTextAnalyticsAsyncClientWithKeyCredential
}
/**
* Code snippet for getting async client using AAD authentication.
*/
public void useAadAsyncClient() {
// BEGIN: readme-sample-createTextAnalyticsAsyncClientWithAAD
TokenCredential defaultCredential = new DefaultAzureCredentialBuilder().build();
TextAnalyticsAsyncClient textAnalyticsAsyncClient = new TextAnalyticsClientBuilder()
.endpoint("{endpoint}")
.credential(defaultCredential)
.buildAsyncClient();
// END: readme-sample-createTextAnalyticsAsyncClientWithAAD
}
/**
* Code snippet for rotating AzureKeyCredential of the client
*/
public void rotatingAzureKeyCredential() {
// BEGIN: readme-sample-rotatingAzureKeyCredential
AzureKeyCredential credential = new AzureKeyCredential("{key}");
TextAnalyticsClient textAnalyticsClient = new TextAnalyticsClientBuilder()
.credential(credential)
.endpoint("{endpoint}")
.buildClient();
credential.update("{new_key}");
// END: readme-sample-rotatingAzureKeyCredential
}
/**
* Code snippet for handling exception
*/
public void handlingException() {
// BEGIN: readme-sample-handlingException
List<DetectLanguageInput> documents = Arrays.asList(
new DetectLanguageInput("1", "This is written in English.", "us"),
new DetectLanguageInput("1", "Este es un documento escrito en Español.", "es")
);
try {
textAnalyticsClient.detectLanguageBatchWithResponse(documents, null, Context.NONE);
} catch (HttpResponseException e) {
System.out.println(e.getMessage());
}
// END: readme-sample-handlingException
}
/**
* Code snippet for analyzing sentiment of a document.
*/
public void analyzeSentiment() {
// BEGIN: readme-sample-analyzeSentiment
String document = "The hotel was dark and unclean. I like microsoft.";
DocumentSentiment documentSentiment = textAnalyticsClient.analyzeSentiment(document);
System.out.printf("Analyzed document sentiment: %s.%n", documentSentiment.getSentiment());
documentSentiment.getSentences().forEach(sentenceSentiment ->
System.out.printf("Analyzed sentence sentiment: %s.%n", sentenceSentiment.getSentiment()));
// END: readme-sample-analyzeSentiment
}
/**
* Code snippet for detecting language in a document.
*/
public void detectLanguages() {
// BEGIN: readme-sample-detectLanguages
String document = "Bonjour tout le monde";
DetectedLanguage detectedLanguage = textAnalyticsClient.detectLanguage(document);
System.out.printf("Detected language name: %s, ISO 6391 name: %s, confidence score: %f.%n",
detectedLanguage.getName(), detectedLanguage.getIso6391Name(), detectedLanguage.getConfidenceScore());
// END: readme-sample-detectLanguages
}
/**
* Code snippet for recognizing category entity in a document.
*/
public void recognizeEntity() {
// BEGIN: readme-sample-recognizeEntity
String document = "Satya Nadella is the CEO of Microsoft";
textAnalyticsClient.recognizeEntities(document).forEach(entity ->
System.out.printf("Recognized entity: %s, category: %s, subcategory: %s, confidence score: %f.%n",
entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore()));
// END: readme-sample-recognizeEntity
}
/**
* Code snippet for recognizing linked entity in a document.
*/
public void recognizeLinkedEntity() {
// BEGIN: readme-sample-recognizeLinkedEntity
String document = "Old Faithful is a geyser at Yellowstone Park.";
textAnalyticsClient.recognizeLinkedEntities(document).forEach(linkedEntity -> {
System.out.println("Linked Entities:");
System.out.printf("Name: %s, entity ID in data source: %s, URL: %s, data source: %s.%n",
linkedEntity.getName(), linkedEntity.getDataSourceEntityId(), linkedEntity.getUrl(), linkedEntity.getDataSource());
linkedEntity.getMatches().forEach(match ->
System.out.printf("Text: %s, confidence score: %f.%n", match.getText(), match.getConfidenceScore()));
});
// END: readme-sample-recognizeLinkedEntity
}
/**
* Code snippet for extracting key phrases in a document.
*/
public void extractKeyPhrases() {
// BEGIN: readme-sample-extractKeyPhrases
String document = "My cat might need to see a veterinarian.";
System.out.println("Extracted phrases:");
textAnalyticsClient.extractKeyPhrases(document).forEach(keyPhrase -> System.out.printf("%s.%n", keyPhrase));
// END: readme-sample-extractKeyPhrases
}
/**
* Code snippet for recognizing Personally Identifiable Information entity in a document.
*/
public void recognizePiiEntity() {
// BEGIN: readme-sample-recognizePiiEntity
String document = "My SSN is 859-98-0987";
PiiEntityCollection piiEntityCollection = textAnalyticsClient.recognizePiiEntities(document);
System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText());
piiEntityCollection.forEach(entity -> System.out.printf(
"Recognized Personally Identifiable Information entity: %s, entity category: %s, entity subcategory: %s,"
+ " confidence score: %f.%n",
entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore()));
// END: readme-sample-recognizePiiEntity
}
/**
* Code snippet for recognizing healthcare entities in documents.
*/
public void recognizeHealthcareEntities() {
// BEGIN: readme-sample-recognizeHealthcareEntities
List<TextDocumentInput> documents = Arrays.asList(new TextDocumentInput("0",
"RECORD #333582770390100 | MH | 85986313 | | 054351 | 2/14/2001 12:00:00 AM | "
+ "CORONARY ARTERY DISEASE | Signed | DIS | Admission Date: 5/22/2001 "
+ "Report Status: Signed Discharge Date: 4/24/2001 ADMISSION DIAGNOSIS: "
+ "CORONARY ARTERY DISEASE. HISTORY OF PRESENT ILLNESS: "
+ "The patient is a 54-year-old gentleman with a history of progressive angina over the past"
+ " several months. The patient had a cardiac catheterization in July of this year revealing total"
+ " occlusion of the RCA and 50% left main disease , with a strong family history of coronary"
+ " artery disease with a brother dying at the age of 52 from a myocardial infarction and another"
+ " brother who is status post coronary artery bypass grafting. The patient had a stress"
+ " echocardiogram done on July , 2001 , which showed no wall motion abnormalities,"
+ " but this was a difficult study due to body habitus. The patient went for six minutes with"
+ " minimal ST depressions in the anterior lateral leads , thought due to fatigue and wrist pain,"
+ " his anginal equivalent. Due to the patient's increased symptoms and family history and"
+ " history left main disease with total occasional of his RCA was referred"
+ " for revascularization with open heart surgery."
));
AnalyzeHealthcareEntitiesOptions options = new AnalyzeHealthcareEntitiesOptions().setIncludeStatistics(true);
SyncPoller<AnalyzeHealthcareEntitiesOperationDetail, AnalyzeHealthcareEntitiesPagedIterable>
syncPoller = textAnalyticsClient.beginAnalyzeHealthcareEntities(documents, options, Context.NONE);
syncPoller.waitForCompletion();
syncPoller.getFinalResult().forEach(
analyzeHealthcareEntitiesResultCollection -> analyzeHealthcareEntitiesResultCollection.forEach(
healthcareEntitiesResult -> {
System.out.println("Document entities: ");
AtomicInteger ct = new AtomicInteger();
healthcareEntitiesResult.getEntities().forEach(healthcareEntity -> {
System.out.printf("\ti = %d, Text: %s, category: %s, subcategory: %s, confidence score: %f.%n",
ct.getAndIncrement(), healthcareEntity.getText(), healthcareEntity.getCategory(),
healthcareEntity.getSubcategory(), healthcareEntity.getConfidenceScore());
IterableStream<EntityDataSource> healthcareEntityDataSources =
healthcareEntity.getDataSources();
if (healthcareEntityDataSources != null) {
healthcareEntityDataSources.forEach(healthcareEntityLink -> System.out.printf(
"\t\tEntity ID in data source: %s, data source: %s.%n",
healthcareEntityLink.getEntityId(), healthcareEntityLink.getName()));
}
});
// Healthcare entity relation groups
healthcareEntitiesResult.getEntityRelations().forEach(entityRelation -> {
System.out.printf("\tRelation type: %s.%n", entityRelation.getRelationType());
entityRelation.getRoles().forEach(role -> {
final HealthcareEntity entity = role.getEntity();
System.out.printf("\t\tEntity text: %s, category: %s, role: %s.%n",
entity.getText(), entity.getCategory(), role.getName());
});
System.out.printf("\tRelation confidence score: %f.%n", entityRelation.getConfidenceScore());
});
}));
// END: readme-sample-recognizeHealthcareEntities
}
/**
* Code snippet for recognizing custom entities in documents.
*/
public void recognizeCustomEntities() {
// BEGIN: readme-sample-custom-entities-recognition
List<String> documents = new ArrayList<>();
documents.add(
"A recent report by the Government Accountability Office (GAO) found that the dramatic increase "
+ "in oil and natural gas development on federal lands over the past six years has stretched the"
+ " staff of the BLM to a point that it has been unable to meet its environmental protection "
+ "responsibilities.");
documents.add(
"David Schmidt, senior vice president--Food Safety, International Food"
+ " Information Council (IFIC), Washington, D.C., discussed the physical activity component."
);
// See the service documentation for regional support and how to train a model to recognize the custom entities,
// see https://aka.ms/azsdk/textanalytics/customentityrecognition
SyncPoller<RecognizeCustomEntitiesOperationDetail, RecognizeCustomEntitiesPagedIterable> syncPoller =
textAnalyticsClient.beginRecognizeCustomEntities(documents, "{project_name}", "{deployment_name}");
syncPoller.waitForCompletion();
syncPoller.getFinalResult().forEach(documentsResults -> {
System.out.printf("Project name: %s, deployment name: %s.%n",
documentsResults.getProjectName(), documentsResults.getDeploymentName());
for (RecognizeEntitiesResult documentResult : documentsResults) {
System.out.println("Document ID: " + documentResult.getId());
if (!documentResult.isError()) {
for (CategorizedEntity entity : documentResult.getEntities()) {
System.out.printf(
"\tText: %s, category: %s, confidence score: %f.%n",
entity.getText(), entity.getCategory(), entity.getConfidenceScore());
}
} else {
System.out.printf("\tCannot recognize custom entities. Error: %s%n",
documentResult.getError().getMessage());
}
}
});
// END: readme-sample-custom-entities-recognition
}
/**
* Code snippet for executing single-label classification in documents.
*/
public void singleLabelClassification() {
// BEGIN: readme-sample-single-label-classification
List<String> documents = new ArrayList<>();
documents.add(
"A recent report by the Government Accountability Office (GAO) found that the dramatic increase "
+ "in oil and natural gas development on federal lands over the past six years has stretched the"
+ " staff of the BLM to a point that it has been unable to meet its environmental protection "
+ "responsibilities.");
documents.add(
"David Schmidt, senior vice president--Food Safety, International Food"
+ " Information Council (IFIC), Washington, D.C., discussed the physical activity component."
);
documents.add(
"I need a reservation for an indoor restaurant in China. Please don't stop the music. Play music "
+ "and add it to my playlist"
);
// See the service documentation for regional support and how to train a model to classify your documents,
// see https://aka.ms/azsdk/textanalytics/customfunctionalities
SyncPoller<ClassifyDocumentOperationDetail, ClassifyDocumentPagedIterable> syncPoller =
textAnalyticsClient.beginSingleLabelClassify(documents, "{project_name}", "{deployment_name}");
syncPoller.waitForCompletion();
syncPoller.getFinalResult().forEach(documentsResults -> {
System.out.printf("Project name: %s, deployment name: %s.%n",
documentsResults.getProjectName(), documentsResults.getDeploymentName());
for (ClassifyDocumentResult documentResult : documentsResults) {
System.out.println("Document ID: " + documentResult.getId());
if (!documentResult.isError()) {
for (ClassificationCategory classification : documentResult.getClassifications()) {
System.out.printf("\tCategory: %s, confidence score: %f.%n",
classification.getCategory(), classification.getConfidenceScore());
}
} else {
System.out.printf("\tCannot classify category of document. Error: %s%n",
documentResult.getError().getMessage());
}
}
});
// END: readme-sample-single-label-classification
}
/**
* Code snippet for executing multi-label classification in documents.
*/
public void multiLabelClassification() {
// BEGIN: readme-sample-multi-label-classification
List<String> documents = new ArrayList<>();
documents.add(
"I need a reservation for an indoor restaurant in China. Please don't stop the music."
+ " Play music and add it to my playlist"
);
// See the service documentation for regional support and how to train a model to classify your documents,
// see https://aka.ms/azsdk/textanalytics/customfunctionalities
SyncPoller<ClassifyDocumentOperationDetail, ClassifyDocumentPagedIterable> syncPoller =
textAnalyticsClient.beginMultiLabelClassify(documents, "{project_name}", "{deployment_name}");
syncPoller.waitForCompletion();
syncPoller.getFinalResult().forEach(documentsResults -> {
System.out.printf("Project name: %s, deployment name: %s.%n",
documentsResults.getProjectName(), documentsResults.getDeploymentName());
for (ClassifyDocumentResult documentResult : documentsResults) {
System.out.println("Document ID: " + documentResult.getId());
if (!documentResult.isError()) {
for (ClassificationCategory classification : documentResult.getClassifications()) {
System.out.printf("\tCategory: %s, confidence score: %f.%n",
classification.getCategory(), classification.getConfidenceScore());
}
} else {
System.out.printf("\tCannot classify category of document. Error: %s%n",
documentResult.getError().getMessage());
}
}
});
// END: readme-sample-multi-label-classification
}
/**
* Code snippet for executing actions in a batch of documents.
*/
public void analyzeActions() {
// BEGIN: readme-sample-analyzeActions
List<TextDocumentInput> documents = Arrays.asList(
new TextDocumentInput("0",
"We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore"
+ " the spot! They provide marvelous food and they have a great menu. The chief cook happens to be"
+ " the owner (I think his name is John Doe) and he is super nice, coming out of the kitchen and "
+ "greeted us all. We enjoyed very much dining in the place! The Sirloin steak I ordered was tender"
+ " and juicy, and the place was impeccably clean. You can even pre-order from their online menu at"
+ " www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! The"
+ " only complaint I have is the food didn't come fast enough. Overall I highly recommend it!")
);
SyncPoller<AnalyzeActionsOperationDetail, AnalyzeActionsResultPagedIterable> syncPoller =
textAnalyticsClient.beginAnalyzeActions(documents,
new TextAnalyticsActions().setDisplayName("{tasks_display_name}")
.setExtractKeyPhrasesActions(new ExtractKeyPhrasesAction())
.setRecognizePiiEntitiesActions(new RecognizePiiEntitiesAction()),
new AnalyzeActionsOptions().setIncludeStatistics(false),
Context.NONE);
syncPoller.waitForCompletion();
syncPoller.getFinalResult().forEach(analyzeActionsResult -> {
System.out.println("Key phrases extraction action results:");
analyzeActionsResult.getExtractKeyPhrasesResults().forEach(actionResult -> {
AtomicInteger counter = new AtomicInteger();
if (!actionResult.isError()) {
for (ExtractKeyPhraseResult extractKeyPhraseResult : actionResult.getDocumentsResults()) {
System.out.printf("%n%s%n", documents.get(counter.getAndIncrement()));
System.out.println("Extracted phrases:");
extractKeyPhraseResult.getKeyPhrases()
.forEach(keyPhrases -> System.out.printf("\t%s.%n", keyPhrases));
}
}
});
System.out.println("PII entities recognition action results:");
analyzeActionsResult.getRecognizePiiEntitiesResults().forEach(actionResult -> {
AtomicInteger counter = new AtomicInteger();
if (!actionResult.isError()) {
for (RecognizePiiEntitiesResult entitiesResult : actionResult.getDocumentsResults()) {
System.out.printf("%n%s%n", documents.get(counter.getAndIncrement()));
PiiEntityCollection piiEntityCollection = entitiesResult.getEntities();
System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText());
piiEntityCollection.forEach(entity -> System.out.printf(
"Recognized Personally Identifiable Information entity: %s, entity category: %s, "
+ "entity subcategory: %s, offset: %s, confidence score: %f.%n",
entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getOffset(),
entity.getConfidenceScore()));
}
}
});
});
}
// END: readme-sample-analyzeActions
}
| [
"noreply@github.com"
] | noreply@github.com |
b8473561a6b623198b76b592f17dc2e44a5bdd9d | 82f581a93c6e619c1417fcf7e67e6af180701999 | /cagrid/Software/general/demos/06annual/workflow/JRProteomicsGridSkeletonValue-1.0/src/org/globus/cagrid/RProteomics/common/RProteomicsI.java | 8d71ee56b7addc5445a205ca3cefdd696f8f487b | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | NCIP/cagrid | e9ad9121d41d03185df7b1f08381ad19745a0ce6 | b1b99fdeaa4d4f15117c01c5f1e5eeb2cb8180bb | refs/heads/master | 2023-03-13T15:50:00.120900 | 2014-04-02T19:15:14 | 2014-04-02T19:15:14 | 9,086,195 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 12,324 | java | package org.globus.cagrid.RProteomics.common;
import java.rmi.RemoteException;
/**
* This class is autogenerated, DO NOT EDIT.
*
* @created by Introduce Toolkit version 1.0
*
*/
public interface RProteomicsI {
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_log(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_log10(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_log2(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_sqrt(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_square(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_cubeRoot(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_power(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.ExponentType exponent) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_byMax(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_usingMinAndMax(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_IOC(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] normalize_quantile(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.QuantileType startQuantile) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] normalize_quantileByValue(edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXml,edu.duke.cabig.rproteomics.domain.serviceinterface.QuantileType startQuantile) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] denoise_MAD(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.PercentileType percentile,edu.duke.cabig.rproteomics.domain.serviceinterface.ValuesNearToCutoffType valuesNearCutoff,edu.duke.cabig.rproteomics.domain.serviceinterface.LambdaType lambda) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] denoise_MADNormalize(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.PercentileType percentile,edu.duke.cabig.rproteomics.domain.serviceinterface.ValuesNearToCutoffType valuesNearCutoff,edu.duke.cabig.rproteomics.domain.serviceinterface.LambdaType lambda,edu.duke.cabig.rproteomics.domain.serviceinterface.NoiseType minNoise) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] denoise_waveletUDWT(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.ThresholdType thresholdMultiplier) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] denoise_waveletUDWTW(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.ThresholdType thresholdMultiplier) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] denoise_waveletUDWTWByValue(edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXml,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.ThresholdType thresholdMultiplier) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] denoise_highPass(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.CoefficientsType numCoeffsToDrop) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] denoise_highPassW(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.CoefficientsType numCoeffsToDrop) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] denoise_PCAFilter(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.CoefficientsType numCoeffsToDrop) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] denoise_q5_PCAFilter(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.CoefficientsType numCoeffsToDrop) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] denoise_loess(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.SpanType span,edu.duke.cabig.rproteomics.domain.serviceinterface.PolynomialDegreeType degree) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] removeBackground_runningQuantile(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.PercentileType percentile) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] removeBackground_runningQuantileByValue(edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXml,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.PercentileType percentile) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] removeBackground_loess(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize,edu.duke.cabig.rproteomics.domain.serviceinterface.SpanType span) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] removeBackground_linearFit(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] removeBackground_exponentialFit(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] removeBackground_logistic(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] removeBackground_quadraticFit(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids,edu.duke.cabig.rproteomics.domain.serviceinterface.WindowType windowSize) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] removeBackground_minus(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids1,edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids2) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] removeBackground_minusByValue(edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXml1,edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXml2) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.JpegImageType plot_2DStacked(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsidsTop,edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsidsBottom) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.JpegImageType plot_2DStackedByValue(edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXmlTop,edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXmlBottom) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.JpegImageType plot_2D(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.JpegImageType plot_2DByValue(edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXml) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] general_interpolate(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] general_interpolateByValue(edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXml) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] align_alignx(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] align_alignxByValue(edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXml) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] echo(edu.duke.cabig.rproteomics.domain.serviceinterface.LsidType[] lsids) throws RemoteException ;
public edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] echoByValue(edu.duke.cabig.rproteomics.domain.serviceinterface.ScanFeaturesType[] scanFeaturesXml) throws RemoteException ;
public void throwException() throws RemoteException ;
}
| [
"mccon012"
] | mccon012 |
2f6c3da3ef4e71868a174ba6cd6aaeef9cfc6fb4 | 6c04e7793b8d415efa756a7c6b576cd7c4876103 | /LeetCode/src/tree/easy/SameTree100.java | 2d9c49e554144e66c7658998283e2e5e53cc3bee | [] | no_license | xuwuji/LeetCode | 290644248834d61a07ff0c7fd449e06b695cda4a | c502a8da86f97e253fe70aa27c2029f3cedf9cf3 | refs/heads/master | 2021-01-10T01:22:02.918680 | 2019-09-26T09:02:22 | 2019-09-26T09:02:22 | 47,496,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package tree.easy;
public class SameTree100 {
public boolean isSameTree(TreeNode p, TreeNode q) {
if (p == null && q == null) {
return true;
}
if (p != null && q != null && p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right)) {
return true;
}
return false;
}
}
| [
"craigxu@foxmail.com"
] | craigxu@foxmail.com |
e0c035e8648a3196a19963963b5ba6eb36aca880 | 489e62aeadc2f3fad723ebe7c904c364f9aa21bb | /test/LineMatcherTest.java | c5f31f47fef5627c743234d98cb456d6246a4d73 | [] | no_license | jrodzon/LawDecryptor | e35bc2c50c8f75ae1b8ed38579e5048c9375a967 | 4f0964b9ea5840e608faa0cc840000e9d3875f91 | refs/heads/master | 2021-08-31T20:55:09.722331 | 2017-12-22T22:04:25 | 2017-12-22T22:04:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,101 | java | import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class LineMatcherTest {
@Test
void parse() {
LineMatcher lineMatcher = new LineMatcher();
assertTrue(lineMatcher.getIsConstitution());
TypeAndIndex typeAndIndex = lineMatcher.parse("USTAWA JANUSZA ĄĘŹĆŻŚŃĆÓŁ");
assertTrue(typeAndIndex.getIndex().equals("") && typeAndIndex.getType() == ActElementType.Podsekcja);
typeAndIndex = lineMatcher.parse("Rozdział IVA");
assertTrue(typeAndIndex.getIndex().equals("IVA") && typeAndIndex.getType() == ActElementType.Sekcja);
typeAndIndex = lineMatcher.parse("DZIAŁ IVA");
assertTrue(typeAndIndex.getIndex().equals("IVA") && typeAndIndex.getType() == ActElementType.Sekcja);
assertFalse(lineMatcher.getIsConstitution());
typeAndIndex = lineMatcher.parse("Rozdział 1a");
assertTrue(typeAndIndex.getIndex().equals("") && typeAndIndex.getType() == ActElementType.Podsekcja);
typeAndIndex = lineMatcher.parse("Art. 13a.");
assertTrue(typeAndIndex.getIndex().equals("13a") && typeAndIndex.getType() == ActElementType.Artykul);
typeAndIndex = lineMatcher.parse("1a. Zamiar koncentracji podlega zgłoszeniu Prezesowi Urzędu, jeżeli:");
assertTrue(typeAndIndex.getIndex().equals("1a") && typeAndIndex.getType() == ActElementType.Ustep);
typeAndIndex = lineMatcher.parse("2a) łączny obrót na terytorium Rzeczypospolitej Polskiej przedsiębiorców");
assertTrue(typeAndIndex.getIndex().equals("2a") && typeAndIndex.getType() == ActElementType.Punkt);
typeAndIndex = lineMatcher.parse("c) członkowie jego zarządu lub rady nadzorczej stanowią więcej niż połowę");
assertTrue(typeAndIndex.getIndex().equals("c") && typeAndIndex.getType() == ActElementType.Litera);
typeAndIndex = lineMatcher.parse("przedsiębiorców oraz między przedsiębiorcami i ich związkami albo");
assertTrue(typeAndIndex.getIndex().equals("") && typeAndIndex.getType() == ActElementType.Tekst);
}
} | [
"rodzonjan97@gmail.com"
] | rodzonjan97@gmail.com |
02e249c9dc7adec5911215e0a26f93d8774c6b33 | af890aee93352ef79ca035d1da29acfbe553d328 | /travelagency-client/src/main/java/cz/muni/fi/pa165/travelagencyclient/web/CustomerClientController.java | e2a051ca6a7f048631be640ee77e1e48e5bd11b7 | [] | no_license | dsimansk/pa165-travelagency | 2e7922661dda758eb851d763a244999152c4b033 | 4f115b7044982ce9fd4cf5299c30c38622178042 | refs/heads/master | 2021-01-17T07:45:14.351901 | 2016-05-25T11:40:14 | 2016-05-25T11:40:14 | 20,645,691 | 0 | 0 | null | 2015-10-26T11:34:03 | 2014-06-09T12:27:39 | Java | UTF-8 | Java | false | false | 7,103 | java | package cz.muni.fi.pa165.travelagencyclient.web;
import cz.muni.fi.pa165.travelagencyclient.web.dto.CustomerDTO;
import cz.muni.fi.pa165.travelagencyclient.web.dto.CustomerDTOResponse;
import cz.muni.fi.pa165.travelagencyclient.web.validator.CustomerValidator;
import java.io.IOException;
import javax.annotation.PostConstruct;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.ModelAndView;
/**
*
* @author Michal Jurc
*/
@Controller
@RequestMapping("/customer")
public class CustomerClientController {
private CustomerDTO addedCustomerBackingBean;
private CustomerDTO editedCustomerBackingBean;
@Autowired
@Qualifier("customerValidator")
private CustomerValidator customerValidator;
private String remoteHost = "http://localhost:8080/pa165/rest/";
@Autowired
private RestTemplate rest;
@PostConstruct
public void init() {
addedCustomerBackingBean = new CustomerDTO();
}
@RequestMapping(method = RequestMethod.GET)
public ModelAndView renderList() {
String url = remoteHost + "customer/";
CustomerDTOResponse resp = rest.getForObject(url, CustomerDTOResponse.class);
ModelAndView mav = new ModelAndView();
mav.addObject("customers", resp.getListData());
mav.setViewName("customer/list");
return mav;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ModelAndView renderDetail(@PathVariable String id) {
String url = remoteHost + "customer/" + id;
ModelAndView mav = new ModelAndView();
mav.addObject("customer", getRemoteCustomer(id));
mav.setViewName("customer/detail");
return mav;
}
@RequestMapping(value = "/add", method = RequestMethod.GET)
public ModelAndView renderAdd() {
ModelAndView mav = new ModelAndView();
mav.addObject("addedCustomer", addedCustomerBackingBean);
mav.setViewName("customer/add");
return mav;
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
public String addCustomer(@ModelAttribute("addedCustomer") CustomerDTO customerDTO,
BindingResult result, ModelMap modelMap) {
customerValidator.validate(customerDTO, result);
String url = remoteHost + "customer/";
if (result.hasErrors()) {
addedCustomerBackingBean = customerDTO;
modelMap.put(BindingResult.class.getName() + "addedCustomer", result);
return "customer/add";
} else {
rest.postForObject(url, customerDTO, CustomerDTO.class);
return "redirect:/customer/add/success";
}
}
@RequestMapping(value = "/add/success", method = RequestMethod.GET)
public ModelAndView addSuccess() {
ModelAndView mav = new ModelAndView();
mav.addObject("successMessage", "customer.add.success");
mav.setViewName("customer/success");
return mav;
}
@RequestMapping(value = "/edit/{id}", method = RequestMethod.GET)
public ModelAndView renderEdit(@PathVariable String id) {
ModelAndView mav = new ModelAndView();
editedCustomerBackingBean = getRemoteCustomer(id);
mav.addObject("editedCustomer", editedCustomerBackingBean);
mav.setViewName("customer/edit");
return mav;
}
@RequestMapping(value = "/edit/{id}", method = RequestMethod.POST)
public String editCustomer(@ModelAttribute("editedCustomer") CustomerDTO editedCustomer,
@PathVariable String id, BindingResult result, ModelMap modelMap) {
customerValidator.validate(editedCustomer, result);
String url = remoteHost + "customer/";
if (result.hasErrors()) {
modelMap.put("editedCustomer", editedCustomer);
modelMap.put(BindingResult.class.getName() + "editedCustomer", result);
return "customer/edit";
} else {
rest.put(url, editedCustomer);
return "redirect:/customer/edit/success";
}
}
@RequestMapping(value = "/edit/success", method = RequestMethod.GET)
public ModelAndView editSuccess() {
ModelAndView mav = new ModelAndView();
mav.addObject("successMessage", "customer.edit.success");
mav.setViewName("customer/success");
return mav;
}
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
public ModelAndView renderDelete(@PathVariable String id) {
ModelAndView mav = new ModelAndView();
CustomerDTO deletedCustomer = getRemoteCustomer(id);
mav.addObject("deletedCustomer", deletedCustomer);
mav.setViewName("customer/delete");
return mav;
}
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
public String deleteCustomer(@PathVariable String id) {
String url = remoteHost + "customer/" + id;
rest.delete(url);
return "redirect:/customer/delete/success";
}
@RequestMapping(value = "/delete/success", method = RequestMethod.GET)
public ModelAndView deleteSuccess() {
ModelAndView mav = new ModelAndView();
mav.addObject("successMessage", "customer.delete.success");
mav.setViewName("customer/success");
return mav;
}
@ExceptionHandler(RestClientException.class)
public ModelAndView badFormat(RestClientException ex) {
ModelAndView mav = new ModelAndView();
mav.addObject("error", "Remote host " + remoteHost + " returned error code:");
if (ex.contains(IOException.class)) {
mav.addObject("code", "503 Service Unavailable");
} else {
mav.addObject("code", ex.getMessage());
}
mav.setViewName("customer/error");
return mav;
}
private CustomerDTO getRemoteCustomer(String id) throws RestClientException {
String url = remoteHost + "customer/" + id;
CustomerDTOResponse resp = rest.getForObject(url, CustomerDTOResponse.class);
CustomerDTO tour = resp.getCustomerDTO();
return tour;
}
}
| [
"dsimansk@redhat.com"
] | dsimansk@redhat.com |
027f5ce1b92ad2e0cbb25d69a5ce5eca13180e33 | dce503d5e17117836f4cb17865fe335c5cb22e50 | /src/main/java/com/github/zk/spring/security/demo/service/IUser.java | 9a6cdaaced653d50d13ad96c7fc5eb15a8b7c9bc | [] | no_license | zk-api/spring-security-demo | 46b964a5c20584aac17bcca3ee89cc77a2af8402 | 2d59867fccb586323f7c8dd109bf26f20444dc9c | refs/heads/master | 2023-06-12T06:36:47.777441 | 2021-07-07T06:15:47 | 2021-07-07T06:15:47 | 334,026,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 147 | java | package com.github.zk.spring.security.demo.service;
/**
* 用户接口
*
* @author zk
* @date 2021/1/15 14:35
*/
public interface IUser {
}
| [
"506683059@qq.com"
] | 506683059@qq.com |
ccf1e742d589fe84a81f6acba609b0aaf7909b1f | 85fdb917f38076910b708fcfaa3e7ab180959c37 | /CommandPattern-算命/src/FibonacciTask.java | 8700c4308d4eb7276a4bdf6e2ded8abb91831734 | [] | no_license | YaoEmily/DesignPatterns | 35dfdbfa578437c2ff156599d7e3fab474b3a07f | d72f6b782320ce2458d250afd294d852d1e00785 | refs/heads/master | 2016-08-12T09:10:52.443211 | 2016-04-16T02:42:00 | 2016-04-16T02:42:00 | 54,130,664 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java |
public class FibonacciTask implements Task {
public int n1=0;
public int n2=1;
public int num;
public FibonacciTask(){}
@Override
public void performTask() {
num = n1+n2;
System.out.println("Next Fibonacci num is "+num);
n1=n2;
n2=num;
}
public String toString()
{
return "Fibonacci Sequence Task";
}
}
| [
"1084355983@qq.com"
] | 1084355983@qq.com |
dbd0bf91e29b67f58a5c5e820985eaae8340538e | a0be99ac4aa226ce36e7cc68c92215ebd720cf47 | /Financial/gen/ac/jfa/BuildConfig.java | 794d409fa75c20afafddeb9eca7b99b65bb132d7 | [] | no_license | yangasahi/Financial | 75c158b41ebadf043a8ed59e507528a66d83bdf8 | 0f370e402803a9f6c6120677fb7b6cdb2eae24a7 | refs/heads/master | 2021-01-21T00:16:32.837500 | 2013-08-30T04:22:03 | 2013-08-30T04:22:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | /** Automatically generated file. DO NOT MODIFY */
package ac.jfa;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"xuxu_1111@126.com"
] | xuxu_1111@126.com |
fd0b3f95d936dddf56e4e1624b93eebd8e4ef8a5 | bd3da267648cbdaf4f1bb5651d441ba9eb432dd0 | /src/data/Block.java | 13708a16a6eb29313dad48b8dc92611e256d2aab | [] | no_license | t-ho/enggdemo | 425028af99831c4019bf3b1166920ee769144b01 | 2c9d9cdf50cf584435ee4fec4ae8168b3ec7a7c3 | refs/heads/master | 2020-04-09T15:24:04.083083 | 2015-09-07T09:21:41 | 2015-09-07T09:21:41 | 42,043,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 237 | java | package data;
import java.io.Serializable;
/**
*
* @author ToanHo
*/
public abstract class Block implements Serializable{
protected String type;
public abstract void processing();
public String getType() {
return type;
}
}
| [
"t.ho26010@gmail.com"
] | t.ho26010@gmail.com |
338b96ebf6bf3b3672fd81467b45e318ca483636 | dc5864c49333ac1b63cb8c82d7135009c846a2ab | /com/android/webview/chromium/WebViewChromiumFactoryProvider.java | 5111105e56db7ec60d186104c0b0ca64e5bee9d0 | [] | no_license | AndroidSDKSources/android-sdk-sources-for-api-level-MNC | c78523c6251e1aefcc423d0166015fd550f3712d | 277d2349e5762fdfaffb8b346994a5e4d7f367e1 | refs/heads/master | 2021-01-22T00:10:20.275475 | 2015-07-03T12:37:41 | 2015-07-03T12:37:41 | 38,491,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,735 | java | /*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.webview.chromium;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.app.ActivityManager;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Looper;
import android.os.StrictMode;
import android.util.Log;
import android.webkit.CookieManager;
import android.webkit.GeolocationPermissions;
import android.webkit.WebIconDatabase;
import android.webkit.WebStorage;
import android.webkit.WebView;
import android.webkit.WebViewDatabase;
import android.webkit.WebViewFactory;
import android.webkit.WebViewFactoryProvider;
import android.webkit.WebViewProvider;
import com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate;
import org.chromium.android_webview.AwBrowserContext;
import org.chromium.android_webview.AwBrowserProcess;
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.AwContentsStatics;
import org.chromium.android_webview.AwCookieManager;
import org.chromium.android_webview.AwDevToolsServer;
import org.chromium.android_webview.AwFormDatabase;
import org.chromium.android_webview.AwGeolocationPermissions;
import org.chromium.android_webview.AwQuotaManagerBridge;
import org.chromium.android_webview.AwResource;
import org.chromium.android_webview.AwSettings;
import org.chromium.base.CommandLine;
import org.chromium.base.MemoryPressureListener;
import org.chromium.base.PathService;
import org.chromium.base.PathUtils;
import org.chromium.base.ResourceExtractor;
import org.chromium.base.ThreadUtils;
import org.chromium.base.TraceEvent;
import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.content.app.ContentMain;
import org.chromium.content.browser.ContentViewStatics;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
private static final String TAG = "WebViewChromiumFactoryProvider";
private static final String CHROMIUM_PREFS_NAME = "WebViewChromiumPrefs";
private static final String VERSION_CODE_PREF = "lastVersionCodeUsed";
private static final String COMMAND_LINE_FILE = "/data/local/tmp/webview-command-line";
// Guards accees to the other members, and is notifyAll() signalled on the UI thread
// when the chromium process has been started.
private final Object mLock = new Object();
// Initialization guarded by mLock.
private AwBrowserContext mBrowserContext;
private Statics mStaticMethods;
private GeolocationPermissionsAdapter mGeolocationPermissions;
private CookieManagerAdapter mCookieManager;
private WebIconDatabaseAdapter mWebIconDatabase;
private WebStorageAdapter mWebStorage;
private WebViewDatabaseAdapter mWebViewDatabase;
private AwDevToolsServer mDevToolsServer;
private ArrayList<WeakReference<WebViewChromium>> mWebViewsToStart =
new ArrayList<WeakReference<WebViewChromium>>();
// Read/write protected by mLock.
private boolean mStarted;
private SharedPreferences mWebViewPrefs;
private WebViewDelegate mWebViewDelegate;
/**
* Constructor called by the API 21 version of {@link WebViewFactory} and earlier.
*/
public WebViewChromiumFactoryProvider() {
initialize(WebViewDelegateFactory.createApi21CompatibilityDelegate());
}
/**
* Constructor called by the API 22 version of {@link WebViewFactory} and later.
*/
public WebViewChromiumFactoryProvider(android.webkit.WebViewDelegate delegate) {
initialize(WebViewDelegateFactory.createProxyDelegate(delegate));
}
private void initialize(WebViewDelegate webViewDelegate) {
mWebViewDelegate = webViewDelegate;
if (isBuildDebuggable()) {
// Suppress the StrictMode violation as this codepath is only hit on debugglable builds.
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
CommandLine.initFromFile(COMMAND_LINE_FILE);
StrictMode.setThreadPolicy(oldPolicy);
} else {
CommandLine.init(null);
}
CommandLine cl = CommandLine.getInstance();
// TODO: currently in a relase build the DCHECKs only log. We either need to insall
// a report handler with SetLogReportHandler to make them assert, or else compile
// them out of the build altogether (b/8284203). Either way, so long they're
// compiled in, we may as unconditionally enable them here.
cl.appendSwitch("enable-dcheck");
ThreadUtils.setWillOverrideUiThread();
// Load chromium library.
AwBrowserProcess.loadLibrary();
final PackageInfo packageInfo = WebViewFactory.getLoadedPackageInfo();
// Register the handler that will append the WebView version to logcat in case of a crash.
AwContentsStatics.registerCrashHandler(
"Version " + packageInfo.versionName + " (code " + packageInfo.versionCode + ")");
// Load glue-layer support library.
System.loadLibrary("webviewchromium_plat_support");
// Use shared preference to check for package downgrade.
mWebViewPrefs = mWebViewDelegate.getApplication().getSharedPreferences(
CHROMIUM_PREFS_NAME, Context.MODE_PRIVATE);
int lastVersion = mWebViewPrefs.getInt(VERSION_CODE_PREF, 0);
int currentVersion = packageInfo.versionCode;
if (lastVersion > currentVersion) {
// The WebView package has been downgraded since we last ran in this application.
// Delete the WebView data directory's contents.
String dataDir = PathUtils.getDataDirectory(mWebViewDelegate.getApplication());
Log.i(TAG, "WebView package downgraded from " + lastVersion + " to " + currentVersion +
"; deleting contents of " + dataDir);
deleteContents(new File(dataDir));
}
if (lastVersion != currentVersion) {
mWebViewPrefs.edit().putInt(VERSION_CODE_PREF, currentVersion).apply();
}
// Now safe to use WebView data directory.
}
private static boolean isBuildDebuggable() {
return !Build.TYPE.equals("user");
}
private static void deleteContents(File dir) {
File[] files = dir.listFiles();
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
deleteContents(file);
}
if (!file.delete()) {
Log.w(TAG, "Failed to delete " + file);
}
}
}
}
private void initPlatSupportLibrary() {
DrawGLFunctor.setChromiumAwDrawGLFunction(AwContents.getAwDrawGLFunction());
AwContents.setAwDrawSWFunctionTable(GraphicsUtils.getDrawSWFunctionTable());
AwContents.setAwDrawGLFunctionTable(GraphicsUtils.getDrawGLFunctionTable());
}
private void ensureChromiumStartedLocked(boolean onMainThread) {
assert Thread.holdsLock(mLock);
if (mStarted) { // Early-out for the common case.
return;
}
Looper looper = !onMainThread ? Looper.myLooper() : Looper.getMainLooper();
Log.v(TAG, "Binding Chromium to " +
(Looper.getMainLooper().equals(looper) ? "main":"background") +
" looper " + looper);
ThreadUtils.setUiThread(looper);
if (ThreadUtils.runningOnUiThread()) {
startChromiumLocked();
return;
}
// We must post to the UI thread to cover the case that the user has invoked Chromium
// startup by using the (thread-safe) CookieManager rather than creating a WebView.
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
synchronized (mLock) {
startChromiumLocked();
}
}
});
while (!mStarted) {
try {
// Important: wait() releases |mLock| the UI thread can take it :-)
mLock.wait();
} catch (InterruptedException e) {
// Keep trying... eventually the UI thread will process the task we sent it.
}
}
}
private void startChromiumLocked() {
assert Thread.holdsLock(mLock) && ThreadUtils.runningOnUiThread();
// The post-condition of this method is everything is ready, so notify now to cover all
// return paths. (Other threads will not wake-up until we release |mLock|, whatever).
mLock.notifyAll();
if (mStarted) {
return;
}
// We don't need to extract any paks because for WebView, they are
// in the system image.
ResourceExtractor.setMandatoryPaksToExtract("");
try {
LibraryLoader.ensureInitialized();
} catch(ProcessInitException e) {
throw new RuntimeException("Error initializing WebView library", e);
}
PathService.override(PathService.DIR_MODULE, "/system/lib/");
// TODO: DIR_RESOURCE_PAKS_ANDROID needs to live somewhere sensible,
// inlined here for simplicity setting up the HTMLViewer demo. Unfortunately
// it can't go into base.PathService, as the native constant it refers to
// lives in the ui/ layer. See ui/base/ui_base_paths.h
final int DIR_RESOURCE_PAKS_ANDROID = 3003;
PathService.override(DIR_RESOURCE_PAKS_ANDROID,
"/system/framework/webview/paks");
// Make sure that ResourceProvider is initialized before starting the browser process.
Context context = getWrappedCurrentApplicationContext();
setUpResources(context);
initPlatSupportLibrary();
AwBrowserProcess.start(context);
if (isBuildDebuggable()) {
setWebContentsDebuggingEnabled(true);
}
TraceEvent.setATraceEnabled(mWebViewDelegate.isTraceTagEnabled());
mWebViewDelegate.setOnTraceEnabledChangeListener(
new WebViewDelegate.OnTraceEnabledChangeListener() {
@Override
public void onTraceEnabledChange(boolean enabled) {
TraceEvent.setATraceEnabled(enabled);
}
});
mStarted = true;
for (WeakReference<WebViewChromium> wvc : mWebViewsToStart) {
WebViewChromium w = wvc.get();
if (w != null) {
w.startYourEngine();
}
}
mWebViewsToStart.clear();
mWebViewsToStart = null;
}
boolean hasStarted() {
return mStarted;
}
void startYourEngines(boolean onMainThread) {
synchronized (mLock) {
ensureChromiumStartedLocked(onMainThread);
}
}
private Context getWrappedCurrentApplicationContext() {
return ResourcesContextWrapperFactory.get(mWebViewDelegate.getApplication());
}
AwBrowserContext getBrowserContext() {
synchronized (mLock) {
return getBrowserContextLocked();
}
}
private AwBrowserContext getBrowserContextLocked() {
assert Thread.holdsLock(mLock);
assert mStarted;
if (mBrowserContext == null) {
mBrowserContext = new AwBrowserContext(mWebViewPrefs);
}
return mBrowserContext;
}
private void setWebContentsDebuggingEnabled(boolean enable) {
if (Looper.myLooper() != ThreadUtils.getUiThreadLooper()) {
throw new RuntimeException(
"Toggling of Web Contents Debugging must be done on the UI thread");
}
if (mDevToolsServer == null) {
if (!enable) return;
mDevToolsServer = new AwDevToolsServer();
}
mDevToolsServer.setRemoteDebuggingEnabled(enable);
}
private void setUpResources(Context context) {
// The resources are always called com.android.webview even if the manifest has had the
// package renamed.
ResourceRewriter.rewriteRValues(
mWebViewDelegate.getPackageId(context.getResources(), "com.android.webview"));
AwResource.setResources(context.getResources());
AwResource.setErrorPageResources(android.R.raw.loaderror,
android.R.raw.nodomain);
AwResource.setConfigKeySystemUuidMapping(
android.R.array.config_keySystemUuidMapping);
}
@Override
public Statics getStatics() {
synchronized (mLock) {
if (mStaticMethods == null) {
// TODO: Optimization potential: most these methods only need the native library
// loaded and initialized, not the entire browser process started.
// See also http://b/7009882
ensureChromiumStartedLocked(true);
mStaticMethods = new WebViewFactoryProvider.Statics() {
@Override
public String findAddress(String addr) {
return ContentViewStatics.findAddress(addr);
}
@Override
public String getDefaultUserAgent(Context context) {
return AwSettings.getDefaultUserAgent();
}
@Override
public void setWebContentsDebuggingEnabled(boolean enable) {
// Web Contents debugging is always enabled on debug builds.
if (!isBuildDebuggable()) {
WebViewChromiumFactoryProvider.this.
setWebContentsDebuggingEnabled(enable);
}
}
// TODO enable after L release to AOSP
//@Override
public void clearClientCertPreferences(Runnable onCleared) {
AwContentsStatics.clearClientCertPreferences(onCleared);
}
@Override
public void freeMemoryForTests() {
if (ActivityManager.isRunningInTestHarness()) {
MemoryPressureListener.maybeNotifyMemoryPresure(
ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
}
}
// TODO: Add @Override.
public void enableSlowWholeDocumentDraw() {
WebViewChromium.enableSlowWholeDocumentDraw();
}
@Override
public Uri[] parseFileChooserResult(int resultCode, Intent intent) {
return FileChooserParamsAdapter.parseFileChooserResult(resultCode, intent);
}
};
}
}
return mStaticMethods;
}
@Override
public WebViewProvider createWebView(WebView webView, WebView.PrivateAccess privateAccess) {
WebViewChromium wvc = new WebViewChromium(this, webView, privateAccess);
synchronized (mLock) {
if (mWebViewsToStart != null) {
mWebViewsToStart.add(new WeakReference<WebViewChromium>(wvc));
}
}
return wvc;
}
@Override
public GeolocationPermissions getGeolocationPermissions() {
synchronized (mLock) {
if (mGeolocationPermissions == null) {
ensureChromiumStartedLocked(true);
mGeolocationPermissions = new GeolocationPermissionsAdapter(
getBrowserContextLocked().getGeolocationPermissions());
}
}
return mGeolocationPermissions;
}
@Override
public CookieManager getCookieManager() {
synchronized (mLock) {
if (mCookieManager == null) {
if (!mStarted) {
// We can use CookieManager without starting Chromium; the native code
// will bring up just the parts it needs to make this work on a temporary
// basis until Chromium is started for real. The temporary cookie manager
// needs the application context to have been set.
ContentMain.initApplicationContext(getWrappedCurrentApplicationContext());
}
mCookieManager = new CookieManagerAdapter(new AwCookieManager());
}
}
return mCookieManager;
}
@Override
public WebIconDatabase getWebIconDatabase() {
synchronized (mLock) {
if (mWebIconDatabase == null) {
ensureChromiumStartedLocked(true);
mWebIconDatabase = new WebIconDatabaseAdapter();
}
}
return mWebIconDatabase;
}
@Override
public WebStorage getWebStorage() {
synchronized (mLock) {
if (mWebStorage == null) {
ensureChromiumStartedLocked(true);
mWebStorage = new WebStorageAdapter(AwQuotaManagerBridge.getInstance());
}
}
return mWebStorage;
}
@Override
public WebViewDatabase getWebViewDatabase(Context context) {
synchronized (mLock) {
if (mWebViewDatabase == null) {
ensureChromiumStartedLocked(true);
AwBrowserContext browserContext = getBrowserContextLocked();
mWebViewDatabase = new WebViewDatabaseAdapter(
browserContext.getFormDatabase(),
browserContext.getHttpAuthDatabase(context));
}
}
return mWebViewDatabase;
}
WebViewDelegate getWebViewDelegate() {
return mWebViewDelegate;
}
}
| [
"root@ifeegoo.com"
] | root@ifeegoo.com |
99927bf2402fea37b1d5cdf3df896d1b7ab2532d | d4cbf9dd6c9e73dee82d4c89c447a4bcd1c8dd36 | /Lab4a/src/гл4а/Region.java | e4dfea48a9103e51923ddd189096b82cbc72544a | [] | no_license | Killteepackage/MyLabs | 4903748db1ca669bfbc0766c9b0d784068c3278c | 3dae62eb2e4e3139c63c04fdb0c90ecd939e3761 | refs/heads/master | 2023-05-14T04:30:41.533506 | 2021-06-04T19:46:27 | 2021-06-04T19:46:27 | 373,933,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,390 | java | package гл4а;
public class Region extends District {
public int numberd;
public District[] Districts = new District[numberd + 10];
public Region() {
}
public Region(String name, City capitalCity) {
super(name, capitalCity);
}
public Region(String name, City capitalCity, int number, District[] districts) {
super(name, capitalCity);
this.numberd = number;
Districts = districts;
}
@Override
public double CalculateSquare() {
double S=0;
for(int i=0; i<numberd; i++)
S += Districts[i].CalculateSquare();
return S;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (!super.equals(obj)) return false;
Region region = (Region) obj;
return !(name != null ? !name.equals(region.name) : region.name != null);
}
@Override
public String toString() {
return "Region{" +
"name='" + name + '\'' +
", CapitalCity='" + CapitalCity + '\'' +
", square=" + square +
'}';
}
}
| [
"veragricel002@gmail.com"
] | veragricel002@gmail.com |
466969dd5a1c2e2b492dd001a20141821f213ea9 | e97db5bfc278c1dc81390043b8a102f9477a76ed | /OnlineAuctionSystem/src/services/AdminService.java | 7b3ffded3a89926574e3e752a70ede69246bb040 | [] | no_license | sahushivam/Mini_Projects | 46ec2f301208ab93cdd3b821ec2fa6e20e71177a | 27dff27cb8e60a12fa40668a99d751ae66ac93ee | refs/heads/master | 2023-04-05T09:28:09.554329 | 2023-03-25T13:27:33 | 2023-03-25T13:27:33 | 176,437,465 | 0 | 1 | null | 2022-09-22T19:24:17 | 2019-03-19T06:13:42 | Java | UTF-8 | Java | false | false | 211 | java | package services;
import java.util.UUID;
public interface AdminService {
UUID registerSeller(String name);
UUID registerBidder(String name);
void startAuctionForItem(UUID itemId);
}
| [
"noreply@github.com"
] | noreply@github.com |
c036ad3f9ecf9b8395546c10a93ff0467546268e | 4798392958bfea53b23f322b3d6079b943a528ba | /app/src/main/java/com/holidayme/data/UserDTO.java | f8576fef9af32ccf28ef4539bea9a3ade7bea832 | [] | no_license | devrath123/HolidayMe | 04923998d3e5014de9fc9596e14cc4acfe8172ae | 2c1e1aa2c2ba94ff23568dc000cfc7aeb44ba8e9 | refs/heads/master | 2020-12-02T17:46:47.697152 | 2017-07-06T13:00:43 | 2017-07-06T13:00:43 | 96,424,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,563 | java | package com.holidayme.data;
/**
* Created by santosh.patar on 10-08-2015.
* <p/>
* <p> to save user information </p>
* <p> This is singleton class , UserDto calss will use through out of appplication to get language and currency </p>
*/
public class UserDTO {
private volatile static UserDTO instance;
private String firstName,lastName,language,currency,token,userSecret,userIP,cityName, countryCode,userName,emailID,destinationName,SessionId,UserTrackingId;
private double latitude,longitude;
private int cityId,drawerSelectedPosition,AccountId;
/**
* is hotel to determine selected destination is hotel or City
*/
private boolean isHotel;
private UserDTO() {
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public static UserDTO getInstance() {
return instance;
}
public static void setInstance(UserDTO instance) {
UserDTO.instance = instance;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getUserSecret() {
return userSecret;
}
public void setUserSecret(String userSecret) {
this.userSecret = userSecret;
}
public String getUserIP() {
return userIP;
}
public void setUserIP(String userIP) {
this.userIP = userIP;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getDestinationName() {
return destinationName;
}
public void setDestinationName(String destinationName) {
this.destinationName = destinationName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getEmailID() {
return emailID;
}
public void setEmailID(String emailID) {
this.emailID = emailID;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public int getCityId() {
return cityId;
}
public void setCityId(int cityId) {
this.cityId = cityId;
}
public int getDrawerSelectedPosition() {
return drawerSelectedPosition;
}
public void setDrawerSelectedPosition(int drawerSelectedPosition) {
this.drawerSelectedPosition = drawerSelectedPosition;
}
public boolean isHotel() {
return isHotel;
}
public void setHotel(boolean hotel) {
isHotel = hotel;
}
public String getSessionId() {
return SessionId;
}
public void setSessionId(String sessionId) {
SessionId = sessionId;
}
public String getUserTrackingId() {
return UserTrackingId;
}
public void setUserTrackingId(String userTrackingId) {
UserTrackingId = userTrackingId;
}
public int getAccountId() {
return AccountId;
}
public void setAccountId(int accountId) {
AccountId = accountId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* Makes sure that only one instance of StoreCusomerRegistrationData is possible.
* <p>double checked locking principle is used.</p>
*
* @return
*/
public static synchronized UserDTO getUserDTO() {
if (instance == null) {
synchronized (UserDTO.class) {
if (instance == null) {
instance = new UserDTO();
}
}
}
return instance;
}
}
| [
"devrath.rathee@holidayme.com"
] | devrath.rathee@holidayme.com |
6d515e74341ceb7b5e5ad1fe18000653d942cca7 | 649d9e287b6536d67b4075120c19eeceee343fba | /playground/android/playground/src/androidTest/java/org/apache/weex/uitest/uitest/TC_AG/AG_Margin_Video_Margin_Bottom.java | 19e0fcea6dc051bda1b53b62ea280ea33aac3239 | [
"LicenseRef-scancode-unicode",
"MIT",
"BSL-1.0",
"Apache-2.0",
"ICU",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | alibaba/weex | 79c83bb4d002af7b819326ebca35e880e2ea8473 | 8f3f2b7d511d3f966dcd00ea44da8771d955fc13 | refs/heads/master | 2023-03-12T20:57:22.129120 | 2022-09-28T06:06:08 | 2022-09-28T06:06:08 | 53,658,802 | 20,773 | 2,915 | Apache-2.0 | 2023-08-23T10:57:36 | 2016-03-11T10:18:11 | C++ | UTF-8 | Java | false | false | 1,751 | 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 org.apache.weex.uitest.TC_AG;
import org.apache.weex.WXPageActivity;
import org.apache.weex.util.TestFlow;
import java.util.TreeMap;
import org.junit.Before;
import org.junit.Test;
public class AG_Margin_Video_Margin_Bottom extends TestFlow {
public AG_Margin_Video_Margin_Bottom() {
super(WXPageActivity.class);
}
@Before
public void setUp() throws InterruptedException {
super.setUp();
TreeMap testMap = new <String, Object> TreeMap();
testMap.put("testComponet", "AG_Margin");
testMap.put("testChildCaseInit", "AG_Margin_Video_Margin_Bottom");
testMap.put("step1",new TreeMap(){
{
put("click", "10");
put("screenshot", "AG_Margin_Video_Margin_Bottom_01_10");
}
});
testMap.put("step2",new TreeMap(){
{
put("click", "20");
put("screenshot", "AG_Margin_Video_Margin_Bottom_02_20");
}
});
super.setTestMap(testMap);
}
@Test
public void doTest(){
super.testByTestMap();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
329da464ab680c9da7e23495b4ab18d2a3c2c03a | 92d296cb3d9fd44625a1e9debf43e765677642ad | /src/ai/comma/tinkerhax/ShareResPatchInfo.java | d430a1f99cb11757ce9a881b450c0d17ff604137 | [] | no_license | commaai/apkpatch | c28ce55efda0cd9538f753bff2e35449ae749c12 | 95e4d414d15e1c802f8df4ad93ebcb1df8af8434 | refs/heads/master | 2020-03-23T07:32:49.599424 | 2018-01-17T04:39:49 | 2018-07-17T11:32:45 | 141,278,351 | 2 | 5 | null | null | null | null | UTF-8 | Java | false | false | 7,417 | java | /*
* Tencent is pleased to support the open source community by making Tinker available.
*
* Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
* Copyright (C) 2017 comma.ai
*
* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* 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.tencent.tinker.loader.shareutil;
package ai.comma.tinkerhax;
// import com.tencent.tinker.loader.TinkerRuntimeException;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.regex.Pattern;
/**
* Created by zhangshaowen on 16/8/9.
*/
public class ShareResPatchInfo {
public String arscBaseCrc = null;
public String resArscMd5 = null;
public ArrayList<String> addRes = new ArrayList<>();
public ArrayList<String> deleteRes = new ArrayList<>();
public ArrayList<String> modRes = new ArrayList<>();
public HashMap<String, File> storeRes = new HashMap<>();
//use linkHashMap instead?
public ArrayList<String> largeModRes = new ArrayList<>();
public HashMap<String, LargeModeInfo> largeModMap = new HashMap<>();
public HashSet<Pattern> patterns = new HashSet<>();
public static void parseAllResPatchInfo(String meta, ShareResPatchInfo info) {
if (meta == null || meta.length() == 0) {
return;
}
String[] lines = meta.split("\n");
for (int i = 0; i < lines.length; i++) {
String line = lines[i];
if (line == null || line.length() <= 0) {
continue;
}
if (line.startsWith(ShareConstants.RES_TITLE)) {
final String[] kv = line.split(",", 3);
info.arscBaseCrc = kv[1];
info.resArscMd5 = kv[2];
} else if (line.startsWith(ShareConstants.RES_PATTERN_TITLE)) {
final String[] kv = line.split(":", 2);
int size = Integer.parseInt(kv[1]);
for (; size > 0; size--) {
info.patterns.add(convertToPatternString(lines[i + 1]));
i++;
}
} else if (line.startsWith(ShareConstants.RES_ADD_TITLE)) {
final String[] kv = line.split(":", 2);
int size = Integer.parseInt(kv[1]);
for (; size > 0; size--) {
info.addRes.add(lines[i + 1]);
i++;
}
} else if (line.startsWith(ShareConstants.RES_MOD_TITLE)) {
final String[] kv = line.split(":", 2);
int size = Integer.parseInt(kv[1]);
for (; size > 0; size--) {
info.modRes.add(lines[i + 1]);
i++;
}
} else if (line.startsWith(ShareConstants.RES_LARGE_MOD_TITLE)) {
final String[] kv = line.split(":", 2);
int size = Integer.parseInt(kv[1]);
for (; size > 0; size--) {
String nextLine = lines[i + 1];
final String[] data = nextLine.split(",", 3);
String name = data[0];
LargeModeInfo largeModeInfo = new LargeModeInfo();
largeModeInfo.md5 = data[1];
largeModeInfo.crc = Long.parseLong(data[2]);
info.largeModRes.add(name);
info.largeModMap.put(name, largeModeInfo);
i++;
}
} else if (line.startsWith(ShareConstants.RES_DEL_TITLE)) {
final String[] kv = line.split(":", 2);
int size = Integer.parseInt(kv[1]);
for (; size > 0; size--) {
info.deleteRes.add(lines[i + 1]);
i++;
}
} else if (line.startsWith(ShareConstants.RES_STORE_TITLE)) {
final String[] kv = line.split(":", 2);
int size = Integer.parseInt(kv[1]);
for (; size > 0; size--) {
info.storeRes.put(lines[i + 1], null);
i++;
}
}
}
}
public static boolean checkFileInPattern(HashSet<Pattern> patterns, String key) {
if (!patterns.isEmpty()) {
for (Iterator<Pattern> it = patterns.iterator(); it.hasNext();) {
Pattern p = it.next();
if (p.matcher(key).matches()) {
return true;
}
}
}
return false;
}
public static boolean checkResPatchInfo(ShareResPatchInfo info) {
if (info == null) {
return false;
}
String md5 = info.resArscMd5;
if (md5 == null || md5.length() != ShareConstants.MD5_LENGTH) {
return false;
}
return true;
}
private static Pattern convertToPatternString(String input) {
//convert \\.
if (input.contains(".")) {
input = input.replaceAll("\\.", "\\\\.");
}
//convert ?to .
if (input.contains("?")) {
input = input.replaceAll("\\?", "\\.");
}
//convert * to.*
if (input.contains("*")) {
input = input.replace("*", ".*");
}
Pattern pattern = Pattern.compile(input);
return pattern;
}
public static void parseResPatchInfoFirstLine(String meta, ShareResPatchInfo info) {
if (meta == null || meta.length() == 0) {
return;
}
String[] lines = meta.split("\n");
String firstLine = lines[0];
if (firstLine == null || firstLine.length() <= 0) {
throw new RuntimeException("res meta Corrupted:" + meta);
}
final String[] kv = firstLine.split(",", 3);
info.arscBaseCrc = kv[1];
info.resArscMd5 = kv[2];
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("resArscMd5:" + resArscMd5 + "\n");
sb.append("arscBaseCrc:" + arscBaseCrc + "\n");
for (Pattern pattern : patterns) {
sb.append("pattern:" + pattern + "\n");
}
for (String add : addRes) {
sb.append("addedSet:" + add + "\n");
}
for (String mod : modRes) {
sb.append("modifiedSet:" + mod + "\n");
}
for (String largeMod : largeModRes) {
sb.append("largeModifiedSet:" + largeMod + "\n");
}
for (String del : deleteRes) {
sb.append("deletedSet:" + del + "\n");
}
for (String store : storeRes.keySet()) {
sb.append("storeSet:" + store + "\n");
}
return sb.toString();
}
public static class LargeModeInfo {
public String md5 = null;
public long crc;
public File file = null;
}
}
| [
"espes@pequalsnp.com"
] | espes@pequalsnp.com |
5e564ad46c8d698bc01d71a110a6c044e68a6021 | 5d3f7124c5bd33fb6970cd411b69e92c86a9710f | /mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerSegmentUrl.java | 9683ded571a8e948428906c3e46dd1494e7f02d9 | [
"MIT"
] | permissive | bhewett/mozu-java | 51690a1ec2f0304e2f75c2ef9fa4700804be942d | ea3697897d90c6e8a157176475f1b2ca0c2fb49a | refs/heads/master | 2021-01-15T12:31:26.092996 | 2016-05-02T22:50:31 | 2016-05-02T22:50:31 | 18,610,274 | 0 | 0 | null | 2014-06-18T19:09:47 | 2014-04-09T19:31:48 | Java | UTF-8 | Java | false | false | 2,417 | java | /**
* This code was auto-generated by a Codezu.
*
* Changes to this file may cause incorrect behavior and will be lost if
* the code is regenerated.
*/
package com.mozu.api.urls.commerce.customer.accounts;
import org.joda.time.DateTime;
import com.mozu.api.MozuUrl;
import com.mozu.api.utils.UrlFormatter;
public class CustomerSegmentUrl
{
/**
* Get Resource Url for GetAccountSegments
* @param accountId Unique identifier of the customer account.
* @param filter A set of expressions that consist of a field, operator, and value and represent search parameter syntax when filtering results of a query. Valid operators include equals (eq), does not equal (ne), greater than (gt), less than (lt), greater than or equal to (ge), less than or equal to (le), starts with (sw), or contains (cont). For example - "filter=IsDisplayed+eq+true"
* @param pageSize The number of results to display on each page when creating paged results from a query. The maximum value is 200.
* @param responseFields Use this field to include those fields which are not included by default.
* @param sortBy The property by which to sort results and whether the results appear in ascending (a-z) order, represented by ASC or in descending (z-a) order, represented by DESC. The sortBy parameter follows an available property. For example: "sortBy=productCode+asc"
* @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with a PageSize of 25, to get the 51st through the 75th items, use startIndex=3.
* @return String Resource Url
*/
public static MozuUrl getAccountSegmentsUrl(Integer accountId, String filter, Integer pageSize, String responseFields, String sortBy, Integer startIndex)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/segments/?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&filter={filter}&responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("filter", filter);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("sortBy", sortBy);
formatter.formatUrl("startIndex", startIndex);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
}
}
| [
"bob_hewett@L02968.corp.volusion.com"
] | bob_hewett@L02968.corp.volusion.com |
8d5e5d67dcdf54027f1714e513b1446d407733da | 12c686ca81b885338abe10490aaf310510c14ace | /src/cs401/k142109/a1p3/CS401K142109A1P3.java | 0c8b09627ea7df3877ef07b00720bafbd262774b | [] | no_license | sam17896/Depth-First-Search | c649110504e5e1cf01258b7789e9dfb7cd9811b5 | 7298c2cfe7f84dcfb82d71c9dcccd37864fdefef | refs/heads/master | 2021-01-22T18:43:45.365348 | 2017-03-15T19:33:48 | 2017-03-15T19:33:48 | 85,113,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,200 | java | package cs401.k142109.a1p3;
import java.io.BufferedReader;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Stack;
class Node{
int x;
int y;
int value;
boolean visited;
Node parent;
Node(int x , int y){
this.x = x;
this.y = y;
value = 1;
parent = null;
visited = false;
}
Node getParent(){
return parent;
}
void setParent(Node n){
parent = n;
}
int getX(){
return x;
}
int getY(){
return y;
}
void setX(int x){
this.x = x;
}
void setY(int y){
this.y = y;
}
int getValue(){
return value;
}
boolean isVisited(){
return visited;
}
void setValue(int x) {
value = x;
}
}
class DFS{
Stack<Node> stack = new Stack();
Node[] nodes;
int[][] maze;
Node size;
Node start;
Node goal;
Node curr;
int count=0;
void Action(){
int a = curr.getX();
int b = curr.getY();
int sx = size.getX();
int sy = size.getY();
int x;
int y;
//DownRight
x = a+1;
y = b+1;
if(y < sy && x < sx){
if(nodes[x*sy+y].getValue() == 0 && !nodes[x*sy+y].isVisited()){
stack.push(nodes[x*sy+y]);
nodes[x*sy+y].visited = true;
nodes[x*sy+y].setParent(curr);
// System.out.println(a+" "+b+" " + "RIGHTDOWN");
}
}
//RightUP
x = a-1;
y = b+1;
if(x > -1 && y < sy){
if(nodes[x*sy+y].getValue() == 0 && !nodes[x*sy+y].isVisited()){
stack.push(nodes[x*sy+y]);
nodes[x*sy+y].visited = true;
nodes[x*sy+y].setParent(curr);
// System.out.println(a+" "+b+" " + "RightUP");
}
}
//DownLeft
x = a+1;
y = b-1;
if(y > -1 && x < sx){
if(nodes[x*sy+y].getValue() == 0 && !nodes[x*sy+y].isVisited()){
stack.push(nodes[x*sy+y]);
nodes[x*sy+y].visited = true;
nodes[x*sy+y].setParent(curr);
// System.out.println(a+" "+b+" " + "DownLeft");
}
}
//UPLEFT
x = a-1;
y = b-1;
if(x > -1 && y > -1){
if(nodes[x*sy+y].getValue() == 0 && !nodes[x*sy+y].isVisited()){
stack.push(nodes[x*sy+y]);
nodes[x*sy+y].visited = true;
nodes[x*sy+y].setParent(curr);
// System.out.println(a+" "+b+" " + "UPLEFT");
}
}
//Left
x = a;
y = b-1;
if(y > -1){
if(nodes[x*sy+y].getValue() == 0 && !nodes[x*sy+y].isVisited()){
stack.push(nodes[x*sy+y]);
nodes[x*sy+y].visited = true;
nodes[x*sy+y].setParent(curr);
// System.out.println(a+" "+b+" " + "LEFT");
}
}
//right
x = a;
y = b+1;
if(y < sy){
if(nodes[x*sy+y].getValue() == 0 && !nodes[x*sy+y].isVisited()){
stack.push(nodes[x*sy+y]);
nodes[x*sy+y].visited = true;
nodes[x*sy+y].setParent(curr);
// System.out.println(a+" "+b+" " + "right");
}
}
//down
x = a+1;
y = b;
if(x < sx){
if(nodes[x*sy+y].getValue() == 0 && !nodes[x*sy+y].isVisited()){
stack.push(nodes[x*sy+y]);
nodes[x*sy+y].visited = true;
nodes[x*sy+y].setParent(curr);
// System.out.println(a+" "+b+" " + "Down");
}
}
//up
x = a-1;
y = b;
if(x > -1 && y > -1){
if(nodes[x*sy+y].getValue() == 0 && !nodes[x*sy+y].isVisited()){
stack.push(nodes[x*sy+y]);
nodes[x*sy+y].visited = true;
nodes[x*sy+y].setParent(curr);
// System.out.println(a+" "+b+" " + "UP");
}
}
}
boolean DepthFirst(){
if(maze[start.getX()][start.getY()]==1){
System.out.println("Invalid start Position!");
return false;
}
if(maze[goal.getX()][goal.getY()]==1){
System.out.println("Invalid goal Position!");
return false;
}
stack.push(start);
// System.out.println("Explored Nodes");
nodes[start.x*size.y+start.y].visited = true;
while(!stack.isEmpty()){
count++;
curr = stack.pop();
if(GoalTest(curr))
return true;
else
{
Action();
// System.out.println("("+curr.getX()+","+curr.getY()+")");
}
}
return false;
}
boolean GoalTest(Node n){
return n.getX()==goal.getX()&&n.getY()==goal.getY();
}
String print(){
int cost = 0 ;
String path = "";
Stack<Node> s = new Stack();
while(curr != null){
s.push(curr);
curr = curr.getParent();
cost++;
}
while(!s.isEmpty()){
Node n = s.pop();
path += n.getX() + " " + n.getY() + "\n";
}
path = path.trim();
path += "\n";
path += cost;
return path;
}
}
public class CS401K142109A1P3 {
public static void main(String[] args) {
int x, y = -1, sx, sy, fx, fy;
DFS dfs = new DFS();
int maze[][] = null;
String words[];
Charset charset = Charset.forName("US-ASCII");
try (BufferedReader reader = Files.newBufferedReader(Paths.get("input.txt"), charset);)
{
String line;
int i = 0;
while((line = reader.readLine()) != null){
switch(i){
case 0:
words = line.split(" ");
x = Integer.parseInt(words[0]);
y = Integer.parseInt(words[1]);
if(x > 500 || y > 500 || x < 0 || y < 0){
System.out.println("Maze out of size");
}
else{
dfs.maze = new int[x][y];
dfs.size = new Node(x,y);
}
i++;
break;
case 1:
words = line.split(" ");
sx = Integer.parseInt(words[0]);
sy = Integer.parseInt(words[1]);
i++;
dfs.start = new Node(sx, sy);
break;
case 2:
words = line.split(" ");
fx = Integer.parseInt(words[0]);
fy = Integer.parseInt(words[1]);
dfs.goal = new Node(fx,fy);
i++;
break;
default:
words = line.split(" ");
for(int j=0; j<y; j++){
dfs.maze[i-3][j] = Integer.parseInt(words[j]);
}
i++;
break;
}
}
} catch (IOException e) {
System.err.format("IOException: %s%n", e);
}
int k = 0;
dfs.nodes = new Node[dfs.size.getX()*dfs.size.getY()];
for(int i=0;i<dfs.size.getX();i++){
for(int j=0;j<dfs.size.getY();j++){
dfs.nodes[k] = new Node(i,j);
dfs.nodes[k].setValue(dfs.maze[i][j]);
// System.out.print(dfs.nodes[k].getValue()+" ");
k++;
}
// System.out.println("");
}
if(dfs.DepthFirst()){
String path = dfs.print();
try(FileWriter out = new FileWriter("CS401-K142109-A1P3Output.txt");){
out.write(path);
out.close();
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
else{
System.out.println("Path Not Found");
try(FileWriter out = new FileWriter("CS401-K142109-A1P3Output.txt");){
out.write("Path Not Found");
out.close();
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
System.out.println(dfs.count);
}
}
| [
"k142109@nu.edu.pk"
] | k142109@nu.edu.pk |
cee1ce0caa0eb33de8e6d4a4015ff33ab030a332 | 2598c240609b868d46980c30d5eb5cbbd9d0b407 | /src/main/java/com/example/mobileapp/service/impl/AuthServiceImpl.java | 9a0cadb3ecab2f9d14a7c298d379c2de089f1710 | [] | no_license | nikolaytsvyatkov/mobile-app | 5a4080ba17c999806c0a424364ed2ed6c19fc1b0 | 822fd8242252d0144f4636aec81f012e6dd845f1 | refs/heads/main | 2023-03-02T08:06:43.721164 | 2021-02-12T10:24:37 | 2021-02-12T10:24:37 | 336,498,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,123 | java | package com.example.mobileapp.service.impl;
import com.example.mobileapp.exception.InvalidEntityException;
import com.example.mobileapp.model.enums.Role;
import com.example.mobileapp.model.User;
import com.example.mobileapp.service.AuthService;
import com.example.mobileapp.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class AuthServiceImpl implements AuthService {
@Autowired
private UserService userService;
@Override
public User register(User user) {
if(user.getRoles().contains(Role.ADMIN) ) {
throw new InvalidEntityException("Admins can not self-register.");
}
return userService.createUser(user);
}
@Override
public User login(String username, String password) {
User user = userService.getUserByUsername(username);
if (user == null) {
return null;
}
if(user.getPassword().equals(password)) {
return user;
}
return null;
}
}
| [
"nikolay.tsvyatkov99@gmail.com"
] | nikolay.tsvyatkov99@gmail.com |
475f1b1bf4b8ec8a7bd50ab106937affb9b1f7d4 | bfdc3c553e5fb0e38bd028c81d917e93dd68b272 | /fw/src/test/java/com/jettmarks/vers/ManivestVersionTest.java | e521ed8f2922ee1a85d41c23d08c6972194225f8 | [
"Apache-2.0"
] | permissive | jettmarks/frameWork | 3cffec8634ce35f3f9a85061833803feb48f9ffe | 94f7d5c4c8369d8c1d963e4f0802aadc0bf2b3ba | refs/heads/master | 2016-09-11T00:56:50.108028 | 2015-02-05T02:57:11 | 2015-02-05T02:57:11 | 30,334,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | /**
* Created Jun 9, 2009
*/
package com.jettmarks.vers;
import junit.framework.TestCase;
/**
*
* @author Jett Marks
*/
public class ManivestVersionTest extends TestCase
{
/**
* Test method for
* {@link com.jettmarks.vers.ManifestVersion#printVersion(java.lang.Class)}.
*/
public void testPrintVersion()
{
}
}
| [
"jettmarks@bellsouth.net"
] | jettmarks@bellsouth.net |
b38bf6ae5212277513d39ce8a078b71b6586f440 | 925e5f757754dfe9512a9da5a6675930a4b300e9 | /sdkcreationmw/sdkruntimes/MIDP/nei/tsrc/epoc/classes/com/symbian/tools/j2me/sei/emulator/Confirmation.java | d2a782aa07568079591729d02038f24ea423f7f9 | [] | no_license | fedor4ever/packaging | d86342573ee2d738531904150748bbeee6c44f5d | cf25a1b5292e6c94c9bb6434f0f6ab1138c8329b | refs/heads/master | 2021-01-15T18:09:15.875194 | 2015-04-12T12:03:13 | 2015-04-12T12:03:13 | 33,689,077 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,088 | java | /*
* Copyright (c) 1999 - 2004 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
package com.symbian.tools.j2me.sei.emulator;
import com.symbian.tools.j2me.sei.preferences.*;
import com.symbian.utils.Debug;
import com.symbian.tools.j2me.sei.SDKTestsProperties;
import javax.swing.*;
import java.io.*;
import java.net.*;
/**
* Base class for confirmation
*/
public abstract class Confirmation {
/**
* Used when a double ping is required - i.e. tests with 2 MIDlets
*/
private boolean iDoubleConfirmation = false;
private int iConfirmationsCounter = 0;
Confirmation(boolean aSignSuite) {
try{
//override the preferences.
//this is required because the Non-Interactive confirmation must be signed
//when reverting back to Interactive, need to remove this dependency.
UserPreferences up = UserPreferences.load();
SecurityPreferences sp = up.getSecurityPreferences();
//set signature indicator
sp.setAlwaysAddSignature(aSignSuite);
//al the rest is ignored is (aSignSuite == false)
sp.setKeyAlias("dummyca");
JPasswordField jpf1 = new JPasswordField("keypwd");
sp.setKeyPassword(jpf1.getPassword());
sp.setKeystoreFile("V:\\Java\\tools\\jadtool\\midptck.ks");
JPasswordField jpf2 = new JPasswordField("keystorepwd");
sp.setKeystorePassword(jpf2.getPassword());
sp.setRequiredPermissions(new String[] {
"javax.microedition.io.Connector.socket"});
up.save();
}
catch(Exception e){
e.printStackTrace();
}
}
public abstract boolean confirm(String aTest);
public abstract void abort();
public void setDoubleConfirmation(){
iDoubleConfirmation = true;
}
public boolean isDoubleConfirmation(){
return iDoubleConfirmation;
}
public boolean isSingleConfirmation(){
return !iDoubleConfirmation;
}
public void setConfirmationReceived(){
iConfirmationsCounter++;
}
public boolean isFirstConfirmationReceived(){
return iConfirmationsCounter >= 1;
}
public boolean isSecondConfirmationReceived(){
return iConfirmationsCounter >= 2;
}
}
/**
* Interactive confirmation
*/
class InteractiveConfirmation extends Confirmation {
private final String iMessage;
public InteractiveConfirmation(String aMessage){
super(false);
iMessage = aMessage;
}
public synchronized boolean confirm(String aTest) {
//TODO: no support for double confirmation at the moment
boolean rc = JOptionPane.showConfirmDialog(null,
iMessage,
aTest,
JOptionPane.YES_NO_CANCEL_OPTION)
== JOptionPane.YES_OPTION;
Debug.println(this, "received interactive confirmation [" + aTest + "] == " + rc);
return rc;
}
public void abort(){
synchronized (this) {
notify();
}
}
}
/**
* NON-Interactive confirmation
*/
class NonInteractiveConfirmation extends Confirmation {
private static final int PING_INTERVAL = 60 * 1000;
private static final int SO_TIMEOUT = 2 * 60 * 1000;
private static final String REMOTE_HOST = SDKTestsProperties.CONFIRMATION_PING_REMOTE_HOST;
private static int REMOTE_PORT;
private static int LOCAL_PORT;
private static final int INTERVAL = 100;
private final boolean iServerMode = true;
private ServerSocket iServerSocket;
private Socket iSocket;
private boolean iTestAborted;
{
try{
REMOTE_PORT = Integer.parseInt(SDKTestsProperties.CONFIRMATION_PING_REMOTE_PORT);
}
catch(Exception e){}
try{
LOCAL_PORT = Integer.parseInt(SDKTestsProperties.CONFIRMATION_LISTEN_LOCAL_PORT);
}
catch(Exception e){}
}
public NonInteractiveConfirmation(){
super(true);
}
public synchronized boolean confirm(String aTest) {
if (iServerMode) {
return listen(aTest);
}
else {
return ping(aTest);
}
}
public boolean listen(String aTest){
boolean rc = false;
Socket s = null;
try {
Debug.println(this, "+ non-interactive confirmation [" + aTest + "] listening on " + LOCAL_PORT);
System.out.println("+ non-interactive confirmation [" + aTest + "] listening on " + LOCAL_PORT);
if(!isFirstConfirmationReceived()){
//this is the first confirmation out of 2 required
//OR the single confirmation that we actually need
iServerSocket = new ServerSocket(LOCAL_PORT);
iServerSocket.setSoTimeout(SO_TIMEOUT);
}
synchronized (this) {
if(!iTestAborted){
s = iServerSocket.accept();
}
}
s.getInputStream().read();
setConfirmationReceived();
Debug.println(this, "- received non-interactive confirmation [" + aTest + "]");
System.out.println("- received non-interactive confirmation [" + aTest + "]");
//set to passed
rc = true;
//cleanup
s.close();
if(isSingleConfirmation() ||
(isDoubleConfirmation() && isSecondConfirmationReceived())){
//Close the server socket only if no other confirmation is expected.
//Otherwise, MIDlet might ping before new ServerSocket was created.
Debug.print(this, "Closing Confirmation ServerSocket");
iServerSocket.close();
}
}
catch (Exception ex) {
//set to failed
rc = false;
//cleanup
try {
Debug.print(this, "Closing Confirmation ServerSocket because of caught " + ex);
iServerSocket.close();
s.close();
}
catch (Exception e2) {}
finally{
iServerSocket = null;
}
//Log state and error
if(iTestAborted){
Debug.println(this, "Test was aborted.");
}
if(ex instanceof InterruptedIOException){
Debug.println(this, "SO_TIMEOUT timed out for test " + aTest.toString());
}
ex.printStackTrace();
}
return rc;
}
/**
* NOT USED!!
* since in naive session the VM runs without SystemAMS and therefor cannot
* open server connection which are managed by the missing SystemAMS
*/
public boolean ping(String aTest) {
Debug.println(this, "non-interactive confirmation [" + aTest + "] pings " + REMOTE_HOST + ":" + REMOTE_PORT);
System.out.println("non-interactive confirmation [" + aTest + "] pings " + REMOTE_HOST + ":" + REMOTE_PORT);
long end = System.currentTimeMillis() + PING_INTERVAL;
boolean connected = false;
Socket s = null;
while(System.currentTimeMillis() < end && !connected){
try {
s = new Socket(REMOTE_HOST, REMOTE_PORT);
connected = true;
Debug.println(this, "received non-interactive confirmation [" + aTest + "]");
System.out.println("received non-interactive confirmation [" + aTest + "]");
}
catch (Exception ex) {
synchronized (this) {
try {
wait(INTERVAL);
}
catch (InterruptedException iex){}
}
}
finally{
try {
s.close();
}
catch (Exception ex) {}
}
}
return connected;
}
public synchronized void abort(){
iTestAborted = true;
if (iServerMode) {
try {
iServerSocket.close();
iServerSocket = null;
}
catch (Exception ex) {
Debug.printStackTrace(this, ex);
}
}
else {
//not supported
}
}
}
| [
"devnull@localhost"
] | devnull@localhost |
20d3e3f5604e780e487cbc0450a44a9d59a697aa | a55ae6d8dff57c04fdec21380062d59834a99c4b | /.metadata/.plugins/org.eclipse.core.resources/.history/ee/f0f77f50101200171a8ccddb08a3e635 | e25ac0d4b3adabcf321990bd2b94e2c7478f9b7d | [] | no_license | cbyad/AlgorithmeToussaint | 459bee542e53f6709635683e020156bbbc574279 | ecaa73d6dd58c07df4cf33b09fc2a7ce223558bc | refs/heads/master | 2020-04-05T08:01:06.194596 | 2017-03-28T10:34:43 | 2017-03-28T10:34:43 | 156,697,630 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,160 | package com.cpa.tools;
import java.awt.Point;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;
/**
* Utilitaire pour gérer les fichiers en input. Sous forme de singleton.
*
* @author Maxime Bonnet
*
*/
public class TestFilesManager {
// L'instance du singleton
private static TestFilesManager instance;
// L'index du fichier actuel dans le dossier
private int currentIndex;
// Le dossier dans lequel sont situés les fichiers de test.
private File directory;
// Le nom du fichier actuel
private String currentFileName;
private TestFilesManager() {
directory = new File("samples/");
currentIndex = 0;
}
/**
* Retourne l'instance de la classe. Méthode principale de l'implémentation
* du singleton
*
* @return l'instance de la classe.
*/
public static TestFilesManager getInstance() {
if (instance == null) {
instance = new TestFilesManager();
}
return instance;
}
/**
* Parcours du fichier et renvoie la liste des points dont les coordonnées
* sont écrites dans le fichier
*
* @param filename
* Le nom du fichier a parcourir.
* @return La liste des points correspondante au fichier passé en paramètre.
*/
public ArrayList<Point.Double> getPointsFromFile(String filename) {
ArrayList<Point.Double> points = new ArrayList<Point.Double>();
try {
BufferedReader bReader = new BufferedReader(
new FileReader(filename));
String line;
String[] coordinates;
while ((line = bReader.readLine()) != null) {
coordinates = line.split(" ");
points.add(new Point.Double(Integer.parseInt(coordinates[0]),
Integer.parseInt(coordinates[1])));
}
} catch (IOException e) {
e.printStackTrace(System.err);
}
return points;
}
/**
* Retourne une liste de 256 points dont les coordonnées sont aléatoirement
* choisies entre 300 et 500.
*
* @return Une liste de points aléatoires.
*/
public ArrayList<Point.Double> getRandomList() {
Random r = new Random();
ArrayList<Point.Double> resultat = new ArrayList<Point.Double>();
for (int i = 0; i < 256; ++i) {
resultat.add(new Point.Double(r.nextDouble() * 200 + 300, r
.nextDouble() * 200 + 300));
}
return resultat;
}
/**
* Retourne la liste des points du prochain fichier dans le dossier.
*
* @return la liste des points du prochain fichier dans le dossier
*/
public ArrayList<Point.Double> getNextFile() {
currentIndex = (currentIndex + 1);
if (currentIndex >= directory.listFiles().length)
return null;
while (!(directory.listFiles()[currentIndex].isFile())) {
currentIndex = (currentIndex + 1);
if (currentIndex >= directory.listFiles().length)
return null;
}
currentFileName = directory.listFiles()[currentIndex].getName();
return getPointsFromFile("samples/"
+ directory.listFiles()[currentIndex].getName());
}
/**
* Retourne le nom du fichier courrant (pendant le parcours du dossier)
*
* @return le nom du fichier courrant
*/
public String getCurrentFileName() {
return currentFileName;
}
} | [
"cbyannick@gmail.com"
] | cbyannick@gmail.com | |
6cbd43c2e0e8a5cf8d6e69cccefe462add39181c | c30ce39cd3974a0366caaba2ac28045d82355f3e | /src/test/java/com/test/TestUser.java | f89211b3f5eda3788c09ff68570d649120f66df2 | [] | no_license | zhaoyangaa2/ssh | 854f7c66a9410de6780636f12bcf04162cd85d77 | cbf9628eb9d237b0ed5da964d4b92fe5a6bcfbea | refs/heads/master | 2021-01-18T19:55:54.474856 | 2017-05-09T14:59:27 | 2017-05-09T14:59:27 | 86,922,331 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,317 | java | package com.test;
import java.util.List;
import java.util.Set;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.hibernate3.HibernateTemplate;
import com.tedu.dao.UserDao;
import com.tedu.entity.Family;
import com.tedu.entity.User;
public class TestUser {
/*private HibernateTemplate template;
@Before
public void init(){
//实例化Spring容器
String conf = "spring-hibernate.xml";
ApplicationContext ac = new ClassPathXmlApplicationContext(conf);
template = ac.getBean("template",HibernateTemplate.class);
}
@Test//测试UserDao
public void test5(){
String conf = "spring-hibernate.xml";
ApplicationContext ac = new ClassPathXmlApplicationContext(conf);
UserDao userDao = ac.getBean("userDao",UserDao.class);
//List<User> list = userDao.findAll();
///for(User user:list){
// System.out.println(user.getUsername());
//}
}
@Test//测试Template
public void test2(){
User user = new User();
user.setUsername("ssh");
user.setPassword("123344");
template.save(user);
}
@Test//测试HQL
public void test3(){
String hql = "from User";
List<User> list = template.find(hql);
for(User user:list){
System.out.println(user.getUsername());
}
}
@Test//测试带参数HQL
public void test4(){
String hql = "from User where username like ?";
Object[] params = {"%o%"};
List<User> list = template.find(hql, params);
for(User user:list){
System.out.println(user.getUsername());
}
}
// String hql = "from Family where familyId = ?";
// Object[] params = {1};
// List<Family> familys = template.find(hql, params);
//
// System.out.println(familys.get(0));
// Set<User_family> services = familys.get(0).getUser_familys();
// System.out.println(services.getClass().getName());
// for (User_family service : services) {
// System.out.println(service);
//
// }*/
@Test
public void test1(){
String a="1,2,,3";
String[] collection=a.split(",");
System.out.println(collection);
}
}
| [
"980633957@qq.com"
] | 980633957@qq.com |
93117192987692742163395a89f9d58a5d5a0445 | 6889f8f30f36928a2cd8ba880032c855ac1cc66c | /dev/SemplestServiceMSN/src/semplest/services/msncloud/NameServiceUniqueMsnPsuedoRandom.java | 9d2301e8a337fc697bc2af63ddfb39ebfc231a99 | [] | no_license | enterstudio/semplest2 | 77ceb4fe6d076f8c161d24b510048802cd029b67 | 44eeade468a78ef647c62deb4cec2bea4318b455 | refs/heads/master | 2022-12-28T18:35:54.723459 | 2012-11-20T15:39:09 | 2012-11-20T15:39:09 | 86,645,696 | 0 | 0 | null | 2020-10-14T08:14:22 | 2017-03-30T01:32:35 | Roff | UTF-8 | Java | false | false | 548 | java | package semplest.services.msncloud;
public class NameServiceUniqueMsnPsuedoRandom implements NameServiceUniqueMsn {
@Override
public String getNextUserName() {
StringBuilder name = new StringBuilder("U");
long currentTimeMillis = System.currentTimeMillis();
name.append(currentTimeMillis);
return name.toString();
}
@Override
public String getNextAdGroupName() {
StringBuilder name = new StringBuilder("A");
long currentTimeMillis = System.currentTimeMillis();
name.append(currentTimeMillis);
return name.toString();
}
}
| [
"Nan@02200ff9-b5b2-46f0-9171-221b09c08c7b"
] | Nan@02200ff9-b5b2-46f0-9171-221b09c08c7b |
785aff466a783cf4807e8131c9fb0611427b1eba | 34fc390b18a63e3c218d02506415880815b74f39 | /android/app/src/main/java/com/small_paper_27376/MainApplication.java | 3e8f9510a5ee3185491323e6a7852ab1a0486163 | [] | no_license | crowdbotics-apps/small-paper-27376 | adc5166dfcdaa48d14342f3b873bc57a52b8fe7a | 8eaa1045d0af12525febfcf4c0e01ad28675b785 | refs/heads/master | 2023-04-29T16:41:19.669928 | 2021-05-25T14:34:14 | 2021-05-25T14:34:14 | 370,723,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,617 | java | package com.small_paper_27376;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.small_paper_27376.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"team@crowdbotics.com"
] | team@crowdbotics.com |
0c3ae89f8916b67ebd47aa927b84aa5a1d882a26 | 7205e0a2cf43bfbece0e474fae2cd31568212e33 | /ITtalantsHomework2Loops/src/Task3.java | 89664c79a1f7fb17e518a6d4a2a4fb6476754ced | [] | no_license | AKokoshyan/JavaT | 89c242439ef597f6ceca3b391af4ef141e5cf319 | 4b7e27109bbbd81eaeaebe27896a89b5e4bc981a | refs/heads/master | 2021-06-22T20:56:35.076807 | 2017-08-17T21:04:13 | 2017-08-17T21:04:13 | 100,280,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 255 | java |
public class Task3 {
/**
* To be made a program which is printing all odd numbers from -10 to 10!
*/
public static void main(String[] args) {
for (int i = -10; i <= 10; i++) {
if (i % 2 != 0) {
System.out.print(i + " ");
}
}
}
}
| [
"akokoshqn@gmail.com"
] | akokoshqn@gmail.com |
45a8be946f81cf643783d8e93264b1357928250a | f607a97d0ddcc46b9206f2d98d01896a8739a741 | /src/main/java/edu/renidev/kafka/ProductsPopulator.java | 75d256fb2be35c543fb3b02c8a248f381e936c08 | [] | no_license | rhuanca/samples-kafka-infoappender | 5bb3f4b380c3867d397b1a656b08e40474f30e5d | b2d03da49f1044c959a7d3b09553fca7cc7e53c5 | refs/heads/master | 2021-01-11T14:35:21.799487 | 2017-01-27T00:26:35 | 2017-01-27T00:26:35 | 80,168,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 858 | java | package edu.renidev.kafka;
public class ProductsPopulator {
public static void main(String args[]) {
String servers = "172.18.0.80:9092";
String topic = "products";
Utils.publishMessage(servers, topic, 0, "P1", "Product1Name,Product1Description");
Utils.publishMessage(servers, topic, 1, "P2", "Product2Name,Product2Description");
Utils.publishMessage(servers, topic, 0, "P3", "Product3Name,Product3Description");
Utils.publishMessage(servers, topic, 1, "P4", "Product4Name,Product4Description");
Utils.publishMessage(servers, topic, 0, "P5", "Product5Name,Product5Description");
Utils.publishMessage(servers, topic, 1, "P6", "Product6Name,Product6Description");
Utils.publishMessage(servers, topic, 0, "P7", "Product7Name,Product7Description");
Utils.publishMessage(servers, topic, 1, "P8", "Product8Name,Product8Description");
}
}
| [
"renan.huanca@mojix.com"
] | renan.huanca@mojix.com |
a8168c1430ed7dec9b2fa5f28a767c52de85ed7a | e26f2622523ec10f168df10e8e2d73399e78f932 | /src/main/java/ru/sawoder/epam/seabattle/model/ship/Destroyer.java | 03e660cd30518699d559e667a953ef157b36232d | [] | no_license | Sawoder/hw-epm | 5a6b4997e92e0e67975c071f8064b8caf2cff97d | cdcb89b392f16aa620556abfff05ab393cba3fbe | refs/heads/master | 2020-03-28T23:08:54.906101 | 2018-11-23T18:10:01 | 2018-11-23T18:10:01 | 149,273,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package ru.sawoder.epam.seabattle.model.ship;
/**
* Destroyer has length equal 2.
*
* @author Ilya Lebedev
* @version 1.0
* @since 1.8
*/
public class Destroyer extends Ship{
public Destroyer() {
super(2);
}
}
| [
"sawoder@gmail.com"
] | sawoder@gmail.com |
20810b25e0c8ee4efb91b682dc1155130fb7327d | c697b14836a01be88e6bbf43ac648be83426ade0 | /Algorithms/1001-2000/1794. Count Pairs of Equal Substrings With Minimum Difference/Solution.java | 78090d5a7bcd8cc101fe97802be244c9624efa17 | [] | no_license | jianyimiku/My-LeetCode-Solution | 8b916d7ebbb89606597ec0657f16a8a9e88895b4 | 48058eaeec89dc3402b8a0bbc8396910116cdf7e | refs/heads/master | 2023-07-17T17:50:11.718015 | 2021-09-05T06:27:06 | 2021-09-05T06:27:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,402 | java | class Solution {
public int countQuadruples(String firstString, String secondString) {
Map<Character, Integer> map1 = new HashMap<Character, Integer>();
Map<Character, Integer> map2 = new HashMap<Character, Integer>();
int length1 = firstString.length(), length2 = secondString.length();
for (int i = length1 - 1; i >= 0; i--) {
char c = firstString.charAt(i);
map1.put(c, i);
}
for (int i = 0; i < length2; i++) {
char c = secondString.charAt(i);
map2.put(c, i);
}
int minDifference = Integer.MAX_VALUE;
Set<Character> keySet = map1.keySet();
for (char c : keySet) {
int index1 = map1.get(c);
if (map2.containsKey(c)) {
int index2 = map2.get(c);
int difference = index1 - index2;
minDifference = Math.min(minDifference, difference);
}
}
if (minDifference == Integer.MAX_VALUE)
return 0;
int quadruples = 0;
for (char c : keySet) {
int index1 = map1.get(c);
if (map2.containsKey(c)) {
int index2 = map2.get(c);
int difference = index1 - index2;
if (difference == minDifference)
quadruples++;
}
}
return quadruples;
}
} | [
"chenyi_storm@sina.com"
] | chenyi_storm@sina.com |
0140818f72adda62157477c1b393aaa2ab3fa982 | ae907979553c97db558df97ff191d5099ce61b0d | /app/src/main/java/com/ashfaaq/android/fitnessappv2/RunningActivity.java | df8036cefe3503d4aa4968266b4678fb471c1ca2 | [] | no_license | ashfaaq77/FitnessApp | 512438c336a8a79c05cea94de0da44a3122b9a36 | 42549db3c7a305761986c1acff157b40cf4d7f86 | refs/heads/master | 2021-05-12T00:17:22.650415 | 2018-01-15T10:45:10 | 2018-01-15T10:45:10 | 117,531,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,687 | java | package com.ashfaaq.android.fitnessappv2;
import android.Manifest;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.text.DecimalFormat;
public class RunningActivity extends AppCompatActivity {
//Button
Button playButton;
Button stopButton;
public static boolean active = false;
//Binder connection
private MyBoundService.MyBinder myService = null;
//variable
private int state = 0; //play==1, pause==2, stop==0
private Boolean permissionGranted = false; //checking permission
private static final int PERMISSIONS_REQUEST_LOCATION = 7676;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_running);
//initialisation
init();
//checking permission
checkPermission();
if(active) {
state = 1;
playButton.setBackground(getResources().getDrawable(R.drawable.ic_pause_circle_filled_black_24dp));
stopButton.setEnabled(false);
stopButton.setBackground(getResources().getDrawable(R.drawable.ic_stop_screen_share_black_24dp));
}
this.startService(new Intent(this, MyBoundService.class));
this.bindService(new Intent(this, MyBoundService.class), serviceConnection, Context.BIND_AUTO_CREATE);
}
private void init() {
//init of button
playButton = (Button) findViewById(R.id.play);
stopButton = (Button) findViewById(R.id.stop);
}
//stop button
public void stopB(View v) {
state = 0; //stop
this.unbindService(serviceConnection);
this.stopService(new Intent(this, MyBoundService.class));
active = false;
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
//play button
public void playB(View v) {
//check if it is playing or not
if (state == 2 || state == 0) {
state = 1;
playButton.setBackground(getResources().getDrawable(R.drawable.ic_pause_circle_filled_black_24dp));
stopButton.setEnabled(false);
stopButton.setBackground(getResources().getDrawable(R.drawable.ic_stop_screen_share_black_24dp));
myService.setState();
} else { //it is playing
state = 2;
playButton.setBackground(getResources().getDrawable(R.drawable.ic_play_circle_filled_black_24dp));
stopButton.setBackground(getResources().getDrawable(R.drawable.ic_stop_black_24dp));
stopButton.setVisibility(View.VISIBLE);
stopButton.setEnabled(true);
myService.setState();
}
}
private ServiceConnection serviceConnection = new ServiceConnection()
{
@Override
public void onServiceConnected(ComponentName name, IBinder service) {;
myService = (MyBoundService.MyBinder) service;
myService.registerCallback(callback);
}
@Override
public void onServiceDisconnected(ComponentName name) {
myService.unregisterCallback(callback);
myService = null;
}
};
CallbackInterface callback = new CallbackInterface() {
@Override
public void setTimeD(final float disT, final String time) {
runOnUiThread(new Runnable() {
@Override
public void run() {
TextView distance = (TextView) findViewById(R.id.distance);
TextView timer = (TextView) findViewById(R.id.timer);
if(disT < 0) {
DecimalFormat twoSF = new DecimalFormat("#.00");
String dist = (twoSF.format(disT));
distance.setText("0" + dist);
}else {
DecimalFormat twoSF = new DecimalFormat("#.00");
distance.setText(twoSF.format(disT));
}
timer.setText(time);
}
});
}
public void changeState(final int check) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if(check == 0) {
state = 2;
playButton.setBackground(getResources().getDrawable(R.drawable.ic_play_circle_filled_black_24dp));
stopButton.setBackground(getResources().getDrawable(R.drawable.ic_stop_black_24dp));
stopButton.setVisibility(View.VISIBLE);
stopButton.setEnabled(true);
}else {
// active = false;
state = 2;
playButton.setBackground(getResources().getDrawable(R.drawable.ic_play_circle_filled_black_24dp));
stopButton.setBackground(getResources().getDrawable(R.drawable.ic_stop_black_24dp));
stopButton.setVisibility(View.VISIBLE);
stopButton.setEnabled(true);
}
}
});
}
};
@Override
protected void onDestroy() {
super.onDestroy();
/* if(serviceConnection!=null) {
unbindService(serviceConnection);
serviceConnection = null;
}*/
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
active = true;
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
active = true;
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
}
private void checkPermission() {
//checking if the user has allowed access to FINE_LOCATION and COARSE_LOCATION
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION}, PERMISSIONS_REQUEST_LOCATION);
} else {
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
permissionGranted = false;
switch (requestCode) {
case PERMISSIONS_REQUEST_LOCATION:
if (grantResults.length > 0) {
for (int i = 0; i < grantResults.length; i++) {
if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
permissionGranted = false;
return;
}
}
permissionGranted = true;
checkPermission();
}
default:
}
}
}
| [
"ashfaaq77@live.co.uk"
] | ashfaaq77@live.co.uk |
f0363236f1d431b6d6849370af4ac383e4a6883a | 17f76f8c471673af9eae153c44e5d9776c82d995 | /convertor/java_code/vidhrdw/nitedrvr.java | 9ddafa7f74e928081bd92a7dad0ccf6e9eb30a2a | [] | no_license | javaemus/arcadeflex-067 | ef1e47f8518cf214acc5eb246b1fde0d6cbc0028 | 1ea6e5c6a73cf8bca5d234b26d2b5b6312df3931 | refs/heads/main | 2023-02-25T09:25:56.492074 | 2021-02-05T11:40:36 | 2021-02-05T11:40:36 | 330,649,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,959 | java | /***************************************************************************
Atari Night Driver hardware
***************************************************************************/
/*
* ported to v0.67
* using automatic conversion tool v0.01
*/
package vidhrdw;
public class nitedrvr
{
/* local */
unsigned char *nitedrvr_hvc;
public static WriteHandlerPtr nitedrvr_hvc_w = new WriteHandlerPtr() {public void handler(int offset, int data)
{
nitedrvr_hvc[offset & 0x3f] = data;
// if ((offset & 0x30) == 0x30)
// ; /* Watchdog called here */
return;
} };
static void nitedrvr_draw_block(struct mame_bitmap *bitmap, int bx, int by, int ex, int ey)
{
int x,y;
for (y=by; y<ey; y++)
{
for (x=bx; x<ex; x++)
{
if ((y<256) && (x<256))
plot_pixel(bitmap, x, y, Machine->pens[1]);
}
}
return;
}
/***************************************************************************
Draw the game screen in the given mame_bitmap.
Do NOT call osd_update_display() from this function, it will be called by
the main emulation engine.
***************************************************************************/
VIDEO_UPDATE( nitedrvr )
{
int offs,roadway;
char gear_buf[] = {0x07,0x05,0x01,0x12,0x00,0x00}; /* "GEAR " */
char track_buf[] = {0x0e,0x0f,0x16,0x09,0x03,0x05, /* "NOVICE" */
0x05,0x18,0x10,0x05,0x12,0x14, /* "EXPERT" */
0x00,0x00,0x00,0x10,0x12,0x0f};/* " PRO" */
/* for every character in the Video RAM, check if it has been modified */
/* since last time and update it accordingly. */
for (offs = videoram_size - 1;offs >= 0;offs--)
{
if (dirtybuffer[offs])
{
int charcode;
int sx,sy;
dirtybuffer[offs]=0;
charcode = videoram.read(offs)& 0x3f;
sx = 8 * (offs % 32);
sy = 16 * (offs / 32);
drawgfx(tmpbitmap,Machine->gfx[0],
charcode, 0,
0,0,sx,sy,
&Machine->visible_area,TRANSPARENCY_NONE,0);
}
}
/* copy the character mapped graphics */
copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->visible_area,TRANSPARENCY_NONE,0);
/* Draw roadway */
for (roadway=0; roadway < 16; roadway++)
{
int bx, by, ex, ey;
bx = nitedrvr_hvc[roadway];
by = nitedrvr_hvc[roadway + 16];
ex = bx + ((nitedrvr_hvc[roadway + 32] & 0xf0) >> 4);
ey = by + (16 - (nitedrvr_hvc[roadway + 32] & 0x0f));
nitedrvr_draw_block(bitmap,bx,by,ex,ey);
}
/* gear shift indicator - not a part of the original game!!! */
gear_buf[5]=0x30 + nitedrvr_gear;
for (offs = 0; offs < 6; offs++)
drawgfx(bitmap,Machine->gfx[0],
gear_buf[offs],0,
0,0,(offs)*8,31*8,
&Machine->visible_area,TRANSPARENCY_NONE,0);
/* track indicator - not a part of the original game!!! */
for (offs = 0; offs < 6; offs++)
drawgfx(bitmap,Machine->gfx[0],
track_buf[offs + 6*nitedrvr_track],0,
0,0,(offs+26)*8,31*8,
&Machine->visible_area,TRANSPARENCY_NONE,0);
}
}
| [
"giorgosmrls@gmail.com"
] | giorgosmrls@gmail.com |
ceb73809f8436373b2bfb66379110f8bdf7d0ee3 | 6ed324da3b1eefaa0553ce2898add53e01486359 | /src/main/java/com/nexmo/client/numbers/Type.java | 27d3b872d9eaa6079afddcd0819aec05a6585347 | [
"MIT"
] | permissive | Nexmo/nexmo-java | 397c1890d299cac482c7866781dae83fb2e5a200 | 656f42571d9772e0dc9ff18412df46a5ae8a9fe6 | refs/heads/master | 2022-12-06T16:59:00.702529 | 2022-10-17T10:04:00 | 2022-10-17T10:04:00 | 289,290,252 | 13 | 8 | MIT | 2022-06-02T08:54:16 | 2020-08-21T14:32:31 | Java | UTF-8 | Java | false | false | 2,036 | java | /*
* Copyright (c) 2011-2019 Nexmo Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.nexmo.client.numbers;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
/**
* Enumeration representing the type of number.
*/
public enum Type {
LANDLINE("landline"),
MOBILE_LVN("mobile-lvn"),
LANDLINE_TOLL_FREE("landline-toll-free"),
UNKNOWN("unknown");
private static final Map<String, Type> TYPE_INDEX = new HashMap<>();
static {
for (Type type : Type.values()) {
TYPE_INDEX.put(type.type, type);
}
}
private String type;
Type(String type) {
this.type = type;
}
@JsonValue
public String getType() {
return type;
}
@JsonCreator
public static Type fromString(String type) {
Type foundType = TYPE_INDEX.get(type);
return (foundType != null) ? foundType : UNKNOWN;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
07f7d4e38b58f27cb6f3fdbdcf1b974d171ffa7f | b52feb20530d8ab6b069bc46c958f0297c2df9f7 | /utils/CATIA/MECMODTYPELIB/HybridShapeLineAngle.java | fb1bf564046e4edbcb917c560e657e1cc910329c | [] | no_license | pawelsadlo2/CatiaV5Com4j | e9a1c8c62163117c70c8166c462247bf87ca3df5 | e985324b4d79e8b5a37662beeb6b914948b86758 | refs/heads/master | 2020-05-05T00:35:01.191353 | 2019-08-05T15:01:08 | 2019-08-05T15:01:08 | 179,579,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,213 | java | import com4j.*;
@IID("{89D765EC-F7B5-0000-0280-020E60000000}")
public interface HybridShapeLineAngle extends Line {
// Methods:
/**
* <p>
* Getter method for the COM property "Curve"
* </p>
* @return Returns a value of type Reference
*/
@DISPID(1611071488) //= 0x60070000. The runtime will prefer the VTID if present
@VTID(32)
Reference curve();
/**
* <p>
* Setter method for the COM property "Curve"
* </p>
* @param oCurve Mandatory Reference parameter.
*/
@DISPID(1611071488) //= 0x60070000. The runtime will prefer the VTID if present
@VTID(33)
void curve(
Reference oCurve);
/**
* <p>
* Getter method for the COM property "Point"
* </p>
* @return Returns a value of type Reference
*/
@DISPID(1611071490) //= 0x60070002. The runtime will prefer the VTID if present
@VTID(34)
Reference point();
/**
* <p>
* Setter method for the COM property "Point"
* </p>
* @param oPoint Mandatory Reference parameter.
*/
@DISPID(1611071490) //= 0x60070002. The runtime will prefer the VTID if present
@VTID(35)
void point(
Reference oPoint);
/**
* <p>
* Getter method for the COM property "Surface"
* </p>
* @return Returns a value of type Reference
*/
@DISPID(1611071492) //= 0x60070004. The runtime will prefer the VTID if present
@VTID(36)
Reference surface();
/**
* <p>
* Setter method for the COM property "Surface"
* </p>
* @param oSurface Mandatory Reference parameter.
*/
@DISPID(1611071492) //= 0x60070004. The runtime will prefer the VTID if present
@VTID(37)
void surface(
Reference oSurface);
/**
* <p>
* Getter method for the COM property "Orientation"
* </p>
* @return Returns a value of type int
*/
@DISPID(1611071494) //= 0x60070006. The runtime will prefer the VTID if present
@VTID(38)
int orientation();
/**
* <p>
* Setter method for the COM property "Orientation"
* </p>
* @param oOrientation Mandatory int parameter.
*/
@DISPID(1611071494) //= 0x60070006. The runtime will prefer the VTID if present
@VTID(39)
void orientation(
int oOrientation);
/**
* <p>
* Getter method for the COM property "Geodesic"
* </p>
* @return Returns a value of type boolean
*/
@DISPID(1611071496) //= 0x60070008. The runtime will prefer the VTID if present
@VTID(40)
boolean geodesic();
/**
* <p>
* Setter method for the COM property "Geodesic"
* </p>
* @param oGeod Mandatory boolean parameter.
*/
@DISPID(1611071496) //= 0x60070008. The runtime will prefer the VTID if present
@VTID(41)
void geodesic(
boolean oGeod);
/**
* <p>
* Getter method for the COM property "BeginOffset"
* </p>
* @return Returns a value of type Length
*/
@DISPID(1611071498) //= 0x6007000a. The runtime will prefer the VTID if present
@VTID(42)
Length beginOffset();
/**
* <p>
* Getter method for the COM property "EndOffset"
* </p>
* @return Returns a value of type Length
*/
@DISPID(1611071499) //= 0x6007000b. The runtime will prefer the VTID if present
@VTID(43)
Length endOffset();
/**
* <p>
* Getter method for the COM property "Angle"
* </p>
* @return Returns a value of type Angle
*/
@DISPID(1611071500) //= 0x6007000c. The runtime will prefer the VTID if present
@VTID(44)
Angle angle();
/**
* @return Returns a value of type int
*/
@DISPID(1611071501) //= 0x6007000d. The runtime will prefer the VTID if present
@VTID(45)
int getLengthType();
/**
* @param iType Mandatory int parameter.
*/
@DISPID(1611071502) //= 0x6007000e. The runtime will prefer the VTID if present
@VTID(46)
void setLengthType(
int iType);
/**
* @param iSym Mandatory boolean parameter.
*/
@DISPID(1611071503) //= 0x6007000f. The runtime will prefer the VTID if present
@VTID(47)
void setSymmetricalExtension(
boolean iSym);
/**
* @return Returns a value of type boolean
*/
@DISPID(1611071504) //= 0x60070010. The runtime will prefer the VTID if present
@VTID(48)
boolean getSymmetricalExtension();
// Properties:
}
| [
"pawelsadlo2@gmail.com"
] | pawelsadlo2@gmail.com |
654236dcf723916c61387e39470c4c6e87fde6b8 | 8ae46b91c916ca940aa4bdcfd4a4a06963eb91ad | /Chapter003Notes/com/christopheradams/ch3Notes/JavaChapter3Part3SwitchStatement.java | 2d60af86f9df9fdb17d73d07d0a2f94b6133a380 | [] | no_license | gitchrisadams/StartingOutJavaNotes | 01663aaabdd4010361146b48e23f5dba57246b72 | dcfa17e9072a15140841cfd16e8b7baf498f77d5 | refs/heads/master | 2021-01-09T20:46:11.272539 | 2016-08-16T16:10:13 | 2016-08-16T16:10:13 | 65,025,032 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,484 | java | package com.christopheradams.ch3Notes;
// Import statements:
import java.util.Scanner; // Allows getting input from the user.
import javax.swing.JOptionPane; // Allows access to gui dialog messages and prompts.
/*
Christopher Adams
04/29/2016
Java Chapter 3 Examples
*/
/**
This is an example of a java doc comment that starts with /** and ents with * /
This program explains concepts explained in chapter 3 of the text book.
*/
// Name Class same as the .java file name:
public class JavaChapter3Part3SwitchStatement
{
public static void main(String[] args)
{
/********************************* The Switch Statement *********************************/
//Create variables:(Uncomment other months to use different data)
//String month = "January";
//String month = "Whatever month";
String month = "April";
// Decision is based on the string month:
switch(month)
{
// Is the month "April"?
case "April":
System.out.println("The month is April.\n");
break;
// Is the month "January"?
case "January":
System.out.println("The month is January.\n");
break;
// If month is anything else Besides April or January, print default statement.
default:
System.out.println("Not sure what month it is to be honest");
break;
}
/********************************* End The Switch Statement *********************************/
// Causes program to properly end. Required if use JOptionPane class:
System.exit(0);
}
} | [
"chrismichaeladams@gmail.com"
] | chrismichaeladams@gmail.com |
c1e66c6ffb1da56e0aa7957c52f29c37e638d9e3 | 2d5af741db7999753ecf2e27b675b5538c6d0ef0 | /chapter4/bean/src/main/java/camelinaction/InvokeWithProcessorSpringRoute.java | 38127ecd89db16daf54986bd64fef973a3dc1827 | [
"Apache-2.0"
] | permissive | camelinaction/camelinaction2 | b03f00391a735d40a0bd3cf467c3132a4e873710 | 0f07f42a6cc078eba5e7d9c88e11b31fd4a837d8 | refs/heads/master | 2022-12-25T11:30:52.873815 | 2022-01-24T12:38:26 | 2022-01-24T12:38:26 | 38,632,660 | 636 | 447 | Apache-2.0 | 2022-01-24T12:38:27 | 2015-07-06T16:50:52 | Java | UTF-8 | Java | false | false | 1,103 | java | package camelinaction;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Using a Processor in the route to invoke HelloBean.
*/
public class InvokeWithProcessorSpringRoute extends RouteBuilder {
@Autowired
private HelloBean hello;
@Override
public void configure() throws Exception {
from("direct:hello")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
// extract the name parameter from the Camel message which we want to use
// when invoking the bean
String name = exchange.getIn().getBody(String.class);
// invoke the bean which should have been injected by Spring
String answer = hello.hello(name);
// store the reply from the bean on the OUT message
exchange.getOut().setBody(answer);
}
});
}
}
| [
"claus.ibsen@gmail.com"
] | claus.ibsen@gmail.com |
678b89c9af13f866c4fb7abe1912313c448e0dc7 | 86c64072755648bcc053e28a67d30384925e0e10 | /Iesb/src/triangulo/teste.java | 882d86f52705b053ccdf6546369ef5640f10a0de | [] | no_license | igorMatsunaga/listaExercicio1 | 3cc97a17075c0b4100431b07d8bd2199ce9ac704 | f2ac5460a8798afba180080d74965a43d548425f | refs/heads/master | 2020-03-27T00:46:37.571961 | 2018-08-22T04:35:29 | 2018-08-22T04:35:29 | 145,655,988 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,895 | java | package triangulo;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class teste extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
teste frame = new teste();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public teste() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblLado = new JLabel("Lado 1");
lblLado.setBounds(31, 42, 46, 14);
contentPane.add(lblLado);
JLabel lblLado_1 = new JLabel("Lado 2");
lblLado_1.setBounds(31, 78, 46, 14);
contentPane.add(lblLado_1);
JLabel lblLado_2 = new JLabel("Lado 3");
lblLado_2.setBounds(31, 115, 46, 14);
contentPane.add(lblLado_2);
textField = new JTextField();
textField.setBounds(87, 39, 86, 20);
contentPane.add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setBounds(87, 75, 86, 20);
contentPane.add(textField_1);
textField_1.setColumns(10);
textField_2 = new JTextField();
textField_2.setBounds(87, 112, 86, 20);
contentPane.add(textField_2);
textField_2.setColumns(10);
JLabel label = new JLabel("");
label.setBounds(232, 78, 150, 14);
contentPane.add(label);
JButton btnVerificarTriangulo = new JButton("Verificar Triangulo");
btnVerificarTriangulo.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
String lado1 = textField.getText();
String lado2 = textField_1.getText();
String lado3 = textField_2.getText();
if (lado1.equals(lado2) && lado1.equals(lado3)){
label.setText("Triângulo Equilátero");
}else if( (lado1.equals(lado2) || lado1.equals(lado3)) || (lado2.equals(lado3))){
label.setText("Triângulo Isósceles");
}else
label.setText("Triângulo Escaleno");
}
});
btnVerificarTriangulo.setBounds(122, 149, 156, 23);
contentPane.add(btnVerificarTriangulo);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
eb21ba6ef83287d8188fe19e80d8b39bdc35acd7 | 4de2fffaa957330430744b7011824b62e06973c0 | /src/main/java/br/ufc/great/tsd/entity/PictureEntity.java | cd9eefd1e53262849c372857a99cbec294c28ede | [] | no_license | topicos-sistemas-distribuidos/systagramgae | f20f74914000f7cd0f04a97e22285f2af8f84550 | fffde686d288ecdf900c03031e9e91b20b8270d5 | refs/heads/master | 2022-12-23T02:56:48.375822 | 2019-05-26T20:12:33 | 2019-05-26T20:12:33 | 183,124,840 | 0 | 0 | null | 2022-12-10T03:45:34 | 2019-04-24T01:41:58 | Java | UTF-8 | Java | false | false | 1,388 | java | package br.ufc.great.tsd.entity;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonBackReference;
@Entity
@Table(name="PictureEntity")
public class PictureEntity extends AbstractModel<Long>{
private static final long serialVersionUID = 1L;
private String name;
private String path;
private String systemName;
@JsonBackReference(value="picture-person")
@OneToOne(fetch = FetchType.LAZY)
private PersonEntity person;
@JsonBackReference(value="picture-post")
@OneToOne(fetch = FetchType.LAZY, cascade=CascadeType.ALL)
private PostEntity post;
public PictureEntity() {
}
public PersonEntity getPerson() {
return person;
}
public void setPerson(PersonEntity person) {
this.person = person;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getSystemName() {
return systemName;
}
public void setSystemName(String systemName) {
this.systemName = systemName;
}
public PostEntity getPost() {
return post;
}
public void setPost(PostEntity post) {
this.post = post;
}
}
| [
"armando.sousa@gmail.com"
] | armando.sousa@gmail.com |
f3653b92e4413720f7acd09c80451cccf1fef202 | 7269c8c706d354beb2bfbf0b86eea566771bc10e | /src/application/controller/services/BillService.java | 6a7593d3733a64de8a3ededdddaebde693cdd461 | [] | no_license | quannguyen1999/manage-disks | 697cd489cc03228be56aace4944803c461d7184c | 30ff0b8d94b6392505d1df037e0089bbc4f1f7d1 | refs/heads/master | 2023-05-26T01:41:02.842611 | 2021-06-08T02:54:12 | 2021-06-08T02:54:12 | 292,857,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 951 | java | package application.controller.services;
import java.util.ArrayList;
import java.util.List;
import application.entities.Bill;
import application.entities.BillDetail;
public interface BillService {
public boolean addBill(Bill Bill);
public boolean addBillDetail(BillDetail BillDetail);
public boolean removeBill(String id);
public boolean removeBillDetail(String id);
public Bill updateBill(Bill BillUpdate,String id);
public BillDetail updateBillDetail(BillDetail billDetailUpdate, String id);
public Bill findBillById(String id);
public BillDetail findBillDetailById(String id);
public List<Bill> listBill();
public List<Bill> findAllBillByIdCustomer(String id);
public List<Bill> findAllBillByPhoneCustomer(String phone);
public List<BillDetail> findAllBillDetailByIdBill(ArrayList<Bill> listIdBill);
public List<BillDetail> findAllBillDetailByProductId(String id);
public List<BillDetail> listBillDetail();
}
| [
"nguyendanganhquan99@gmail.com"
] | nguyendanganhquan99@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.