blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
8ce7e4e9e7a92bfa48e6007163962feee8619483
a837e5b21776e7931be1812a0b7edd06f03cf2d7
/bpmn-model/src/main/java/org/camunda/bpm/model/bpmn/impl/instance/SendTaskImpl.java
4ec0dc35897238b126022a14bbceadb85843e215
[ "Apache-2.0" ]
permissive
meyerdan/camunda-bpmn-model
65bab4a8123f3dcc698a6d8991b9ca25bb6ffba7
7609d467da24989447e8e722ba5b0250fbee0fb5
refs/heads/master
2021-01-15T08:30:53.346132
2014-02-06T09:51:43
2014-02-06T09:51:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,294
java
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.camunda.bpm.model.bpmn.impl.instance; import org.camunda.bpm.model.bpmn.instance.Message; import org.camunda.bpm.model.bpmn.instance.Operation; import org.camunda.bpm.model.bpmn.instance.SendTask; import org.camunda.bpm.model.bpmn.instance.Task; import org.camunda.bpm.model.xml.ModelBuilder; import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext; import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder; import org.camunda.bpm.model.xml.type.attribute.Attribute; import org.camunda.bpm.model.xml.type.reference.AttributeReference; import static org.camunda.bpm.model.bpmn.impl.BpmnModelConstants.*; import static org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider; /** * The BPMN sendTask element * * @author Sebastian Menski */ public class SendTaskImpl extends TaskImpl implements SendTask { private static Attribute<String> implementationAttribute; private static AttributeReference<Message> messageRefAttribute; private static AttributeReference<Operation> operationRefAttribute; public static void registerType(ModelBuilder modelBuilder) { ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(SendTask.class, BPMN_ELEMENT_SEND_TASK) .namespaceUri(BPMN20_NS) .extendsType(Task.class) .instanceProvider(new ModelTypeInstanceProvider<SendTask>() { public SendTask newInstance(ModelTypeInstanceContext instanceContext) { return new SendTaskImpl(instanceContext); } }); implementationAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_IMPLEMENTATION) .defaultValue("##WebService") .build(); messageRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_MESSAGE_REF) .qNameAttributeReference(Message.class) .build(); operationRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_OPERATION_REF) .qNameAttributeReference(Operation.class) .build(); typeBuilder.build(); } public SendTaskImpl(ModelTypeInstanceContext context) { super(context); } public String getImplementation() { return implementationAttribute.getValue(this); } public void setImplementation(String implementation) { implementationAttribute.setValue(this, implementation); } public Message getMessage() { return messageRefAttribute.getReferenceTargetElement(this); } public void setMessage(Message message) { messageRefAttribute.setReferenceTargetElement(this, message); } public Operation getOperation() { return operationRefAttribute.getReferenceTargetElement(this); } public void setOperation(Operation operation) { operationRefAttribute.setReferenceTargetElement(this, operation); } }
21875716405ea72dfb1ce047b0780e886801b37f
6c2405119d8a4ce2c5794e1ae63cbbb970270dcb
/fanes/src/com/TDiJoy/fane/util/Base64.java
cda67555c2ffcd2886127b30c4d61819f8c6deec
[]
no_license
xulingyun/fanes
083cab3d967bbfece2f9c38c151bea5f2a5f1b93
34ddba9e1fdcc3151f6aa47128ee04c1a93ed99c
refs/heads/master
2021-01-10T22:03:44.219807
2014-10-26T08:57:49
2014-10-26T08:57:49
null
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
3,802
java
package com.TDiJoy.fane.util; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; public class Base64 { private static final char[] legalChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray(); /** * data[]½øÐбàÂë * @param data * @return */ public static String encode(byte[] data) { int start = 0; int len = data.length; StringBuffer buf = new StringBuffer(data.length * 3 / 2); int end = len - 3; int i = start; int n = 0; while (i <= end) { int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 0x0ff) << 8) | (((int) data[i + 2]) & 0x0ff); buf.append(legalChars[(d >> 18) & 63]); buf.append(legalChars[(d >> 12) & 63]); buf.append(legalChars[(d >> 6) & 63]); buf.append(legalChars[d & 63]); i += 3; if (n++ >= 14) { n = 0; buf.append(" "); } } if (i == start + len - 2) { int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 255) << 8); buf.append(legalChars[(d >> 18) & 63]); buf.append(legalChars[(d >> 12) & 63]); buf.append(legalChars[(d >> 6) & 63]); buf.append("="); } else if (i == start + len - 1) { int d = (((int) data[i]) & 0x0ff) << 16; buf.append(legalChars[(d >> 18) & 63]); buf.append(legalChars[(d >> 12) & 63]); buf.append("=="); } return buf.toString(); } private static int decode(char c) { if (c >= 'A' && c <= 'Z') return ((int) c) - 65; else if (c >= 'a' && c <= 'z') return ((int) c) - 97 + 26; else if (c >= '0' && c <= '9') return ((int) c) - 48 + 26 + 26; else switch (c) { case '+': return 62; case '/': return 63; case '=': return 0; default: throw new RuntimeException("unexpected code: " + c); } } /** * Decodes the given Base64 encoded String to a new byte array. The byte * array holding the decoded data is returned. */ public static byte[] decode(String s) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { decode(s, bos); } catch (IOException e) { throw new RuntimeException(); } byte[] decodedBytes = bos.toByteArray(); try { bos.close(); bos = null; } catch (IOException ex) { System.err.println("Error while decoding BASE64: " + ex.toString()); } return decodedBytes; } private static void decode(String s, OutputStream os) throws IOException { int i = 0; int len = s.length(); while (true) { while (i < len && s.charAt(i) <= ' ') i++; if (i == len) break; int tri = (decode(s.charAt(i)) << 18) + (decode(s.charAt(i + 1)) << 12) + (decode(s.charAt(i + 2)) << 6) + (decode(s.charAt(i + 3))); os.write((tri >> 16) & 255); if (s.charAt(i + 2) == '=') break; os.write((tri >> 8) & 255); if (s.charAt(i + 3) == '=') break; os.write(tri & 255); i += 4; } } }
0a47f8abadfc017f7267561930b7abe078649d45
f1efaa9c11fb973d2a14cd5c6e0ca77e36930576
/app/src/main/java/com/wzl/WzlWeather/modules/about/domain/Version.java
b59817e9210671ea78e6394b67c0d3bda3327fe6
[ "Apache-2.0" ]
permissive
wzl822/WzlWeather
a452e139e95d382670e0205dd2f165e41ec8ed80
73a2aeee78fdc6170ea406f46bdba50e9f28330a
refs/heads/master
2021-04-26T23:01:19.458561
2018-03-05T12:41:26
2018-03-05T12:41:26
123,915,565
0
0
null
null
null
null
UTF-8
Java
false
false
808
java
package com.wzl.WzlWeather.modules.about.domain; import com.google.gson.annotations.SerializedName; public class Version { @SerializedName("name") public String name; @SerializedName("version") public String version; @SerializedName("changelog") public String changelog; @SerializedName("updated_at") public int updatedAt; @SerializedName("versionShort") public String versionShort; @SerializedName("build") public String build; @SerializedName("install_url") public String installUrl; @SerializedName("direct_install_url") public String directInstallUrl; @SerializedName("update_url") public String updateUrl; @SerializedName("binary") public BinaryEntity binary; public static class BinaryEntity { @SerializedName("fsize") public int fsize; } }
1bdc22154d450a3311957128001c56b446f54f50
2475616ec471597534cc7f2def37c0f9b6f8d7dd
/src/Easy/LC206.java
c07a109d59518eef7f0584bf717e6a561c374377
[]
no_license
Yunssss4410/LeetCode
96264b4596df2062601e039879c29abc43933afc
621dd2490cd70b9c91f895dbdebb6af6f6a0d0db
refs/heads/dev
2023-01-11T10:42:33.805991
2020-11-12T02:22:47
2020-11-12T02:22:47
264,596,089
0
0
null
2020-05-18T09:36:44
2020-05-17T06:08:26
Java
UTF-8
Java
false
false
413
java
package Easy; import Extension.ListNode; public class LC206 { /* 206. 反转链表 */ class Solution { public ListNode reverseList(ListNode head) { if (head == null || head.next == null) return head; ListNode cur = reverseList(head.next); head.next.next = head; head.next = null; return cur; } } }
bc52b3ab8a2d2eb2920b7dcf43d3f425f20964c6
d60d72dc8afce46eb5125027d536bab8d43367e3
/module/CMSJava-core/src/shu/cms/devicemodel/lcd/PLCCModel.java
5d9e6f3624ce9e8da5267f5d8e8761c3571a2137
[]
no_license
enessssimsek/cmsjava
556cd61f4cab3d1a31f722138d7a6a488c055eeb
59988c118159ba49496167b41cd0cfa9ea2e3c74
refs/heads/master
2023-03-18T12:35:16.160707
2018-10-29T08:22:16
2018-10-29T08:22:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,206
java
package shu.cms.devicemodel.lcd; import java.util.*; import shu.cms.*; import shu.cms.colorspace.depend.*; import shu.cms.colorspace.independ.*; import shu.cms.devicemodel.*; import shu.cms.lcd.*; import shu.cms.util.*; import shu.math.lut.*; /** * <p>Title: Colour Management System</p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2006</p> * * <p>Company: </p> * * @author cms.shu.edu.tw * @version 1.0 */ public class PLCCModel extends ChannelIndependentModel { public PLCCModel(LCDTarget lcdTarget) { super(lcdTarget); } /** * 使用模式 * @param factor LCDModelFactor */ public PLCCModel(LCDModelFactor factor) { super(factor); } public PLCCModel(String modelFactorFilename) { this( (LCDModelFactor) Load.modelFactorFile(modelFactorFilename)); } public static class Factor extends LCDModelBase.Factor { GammaCorrector rCorrector; RGBBase.Channel channel; /** * * @return double[] */ public double[] getVariables() { return null; } public Factor() { } public Factor(GammaCorrector rCorrector, RGBBase.Channel channel) { this.rCorrector = rCorrector; this.channel = channel; } } protected Factor[] makeFactor() { Factor[] factors = new Factor[] { new Factor(correct._RrCorrector, RGBBase.Channel.R), new Factor(correct._GrCorrector, RGBBase.Channel.G), new Factor(correct._BrCorrector, RGBBase.Channel.B)}; return factors; } protected Factor[] _produceFactor() { singleChannel.produceRGBPatch(); correct.produceGammaCorrector(); Factor[] factors = makeFactor(); return factors; } protected static Interpolation1DLUT produceSingleChannelPLCC_LUT(Set<Patch> singleChannelPatch, RGBBase.Channel ch) { int size = singleChannelPatch.size(); double[][] keyValue = new double[2][size]; int index = 0; for (Patch p : singleChannelPatch) { keyValue[0][index] = p.getRGB().getValue(ch); keyValue[1][index] = p.getXYZ().Y; index++; } Interpolation1DLUT lut = new Interpolation1DLUT(keyValue[0], keyValue[1]); return lut; } /** * * @param rgb RGB * @param factor Factor[] * @return CIEXYZ */ public CIEXYZ _getXYZ(RGB rgb, LCDModel.Factor[] factor) { RGB newRGB = getLuminanceRGB(rgb, factor); getXYZRGB = newRGB; return matries.RGBToXYZByMaxMatrix(newRGB); } /** * * @param XYZ CIEXYZ * @param factor Factor[] * @return RGB */ protected RGB _getRGB(CIEXYZ XYZ, LCDModel.Factor[] factor) { RGB rgb = matries.XYZToRGBByMaxMatrix(XYZ); double[] originalRGBValues = rgb.getValues(new double[3], RGB.MaxValue.Double1); originalRGBValues = correct.gammaUncorrect(originalRGBValues); RGB originalRGB = new RGB(rgb.getRGBColorSpace(), originalRGBValues); return originalRGB; } public static void main(String[] args) { LCDTarget target = LCDTarget.Instance.getFromCA210Logo("auo_T370HW02", LCDTarget.Number.Ramp1021, "091225"); LCDTarget.Operator.gradationReverseFix(target); PLCCModel model = new PLCCModel(target); model.produceFactor(); List<Patch> patchList = target.filter.grayPatch(true); int size = patchList.size(); for (int x = size - 1; x >= 0; x--) { Patch p = patchList.get(x); CIEXYZ XYZ = p.getXYZ(); RGB rgb = model.matries.XYZToRGBByMaxMatrix(XYZ); rgb.changeMaxValue(RGB.MaxValue.Double100); System.out.println(x + " " + rgb); } } public String getDescription() { return "PLCC"; } /** * * @param rgb RGB * @param factor Factor[] * @return RGB */ protected RGB getLuminanceRGB(RGB rgb, LCDModel.Factor[] factor) { // correct._RrCorrector = ( (Factor) factor[0]).rCorrector; // correct._GrCorrector = ( (Factor) factor[1]).rCorrector; // correct._BrCorrector = ( (Factor) factor[2]).rCorrector; double[] correctValues = rgb.getValues(new double[3], RGB.MaxValue.Double1); correctValues = correct.gammaCorrect(correctValues); return new RGB(rgb.getRGBColorSpace(), correctValues); } }
4fefd05d24e29b153553d848f5deec8b097ce293
7fed48b319a342083674e4873a135d4123fd8211
/src/main/java/leetcode/daily/y2020m11/D20201112_922.java
3d938b54c67050366277cd1edab370310a89453d
[]
no_license
dubulingbo/shuati
581006fda22ea9ebb236284316450d29bcd6eee1
b804e4e512a21899942a7165c22d6e0d2cbd3a07
refs/heads/main
2023-05-29T08:12:38.460109
2021-06-01T03:08:47
2021-06-01T03:08:47
315,934,395
0
0
null
null
null
null
UTF-8
Java
false
false
2,739
java
package leetcode.daily.y2020m11; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * @author DubLBo * @since 2020-11-12 08:59 * i believe i can i do */ public class D20201112_922 { // 922. 按奇偶排序数组 II // 给定一个非负整数数组 A, A 中一半整数是奇数,一半整数是偶数。 // 对数组进行排序,以便当 A[i] 为奇数时,i 也是奇数;当 A[i] 为偶数时, i 也是偶数。 // 你可以返回任何满足上述条件的数组作为答案。 public int[] sortArrayByParityII(int[] A) { // 奇偶双指针 int even = 0, odd = 1; while (even < A.length) { // 找第一个出现偶数下标中存放的是奇数的位置 while (even < A.length && A[even] % 2 == 0) even += 2; // 偶数位置都已经找到,就没有必要再循环奇数位置了 if (even == A.length) break; // 找第一个出现奇数下标中存放的是偶数的位置 while (odd < A.length && A[odd] % 2 != 0) odd += 2; // 需要交换 if (odd < A.length) { int t = A[even]; A[even] = A[odd]; A[odd] = t; } } return A; } public int[] sortArrayByParityII01(int[] A) { // 奇偶双指针 // int even = 0, odd = 1; List<Integer> even = new ArrayList<>(); List<Integer> odd = new ArrayList<>(); for (int i = 0; i < A.length; i += 2) { if (A[i] % 2 != 0) even.add(i); if (A[i + 1] % 2 == 0) odd.add(i + 1); } // 交换 for (int i = 0; i < even.size() && i < odd.size(); i++) { swap(A, even.get(i), odd.get(i)); } return A; } public int[] sortArrayByParityII02(int[] A) { // 奇偶双指针:对偶数下标循环,再起冲突时,循环奇数下标,再交换,以此类推! int odd = 1; for (int even = 0; even < A.length; even += 2) { if (A[even] % 2 == 1) { while (A[odd] % 2 == 1) { odd += 2; } // 交换 A[even] 与 A[odd] // swap(A, even, odd); int t = A[even]; A[even] = A[odd]; A[odd] = t; } } return A; } private void swap(int[] arr, int i, int j) { int t = arr[i]; arr[i] = arr[j]; arr[j] = t; } public static void main(String[] args) { System.out.println(Arrays.toString(new D20201112_922().sortArrayByParityII01(new int[]{2, 3, 1, 1, 4, 0, 0, 4, 3, 3}))); } }
eed9e81b9017bab8214d61c1604f561acc2e1a08
0cf17f9a64755c5533437a69d29ab295467b9d83
/app/src/main/java/com/mdb/example/administrator/Utils/MyEditText.java
8880cbbd0ea08769eeb8f92ac4fa036610f4b832
[]
no_license
as425017946/shangjiaxiche
57fa38c5f23a7c3580639f41e07e8d5567a9cc3c
7b2b05c49803f1e7fa9eaed3fe9bd196bd261aa0
refs/heads/master
2020-04-26T01:54:30.726630
2019-03-01T02:09:55
2019-03-01T02:09:55
173,218,756
0
0
null
null
null
null
UTF-8
Java
false
false
1,284
java
package com.mdb.example.administrator.Utils; import android.content.Context; import android.support.v7.widget.AppCompatEditText; import android.util.AttributeSet; import android.view.MotionEvent; public class MyEditText extends AppCompatEditText { private long lastTime = 0; public MyEditText(Context context) { super(context); } public MyEditText(Context context, AttributeSet attrs) { super(context, attrs); } public MyEditText(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onSelectionChanged(int selStart, int selEnd) { super.onSelectionChanged(selStart, selEnd); this.setSelection(this.getText().length()); } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: long currentTime = System.currentTimeMillis(); if (currentTime - lastTime < 500) { lastTime = currentTime; return true; } else { lastTime = currentTime; } break; } return super.onTouchEvent(event); } }
951546e80c236067a7dab462545fdc619e729a11
05f15ac1d30be14f1562edeade6117292c28530f
/eskyzdt-server/src/main/java/cn/eskyzdt/modules/threadAfter0503/c_018/Exchanger.java
baad80b68539bc32f56837e82431cc0783e3198e
[]
no_license
eskyzdt/eskyzdt
57798bdc1961f7799b330228677868e527a9c87a
4a28e1aceb77260df4504e57609af76ba8c8d0af
refs/heads/V1.0
2023-08-16T22:34:44.423083
2023-08-15T06:53:46
2023-08-15T06:53:46
206,766,628
1
0
null
2022-10-14T06:12:21
2019-09-06T10:03:01
JavaScript
UTF-8
Java
false
false
1,777
java
package cn.eskyzdt.modules.threadAfter0503.c_018; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /** * 交换器 * * 交换只能两两交换 * exchange的时候exchanger会阻塞 * 如果只有一个exchange()执行,那么会阻塞,exchange和wait比较像 * * */ public class Exchanger { static java.util.concurrent.Exchanger<String> exchanger = new java.util.concurrent.Exchanger<>(); public static void main(String[] args) { new Thread(()->{ String t1 = "t1"; String result = null; String exchange = null; try { // 交换后的结果 exchange = exchanger.exchange(t1, 10, TimeUnit.SECONDS); result = exchanger.exchange(t1); } catch (InterruptedException e) { e.printStackTrace(); } catch (TimeoutException e) { e.printStackTrace(); } finally { System.out.println(Thread.currentThread().getName() + result + "11111111111"); System.out.println(exchange + "+================="); } },"t1").start(); new Thread(()->{ String t2 = "t2"; String result = null; try { // 交换后的结果 result = exchanger.exchange(t2); result = exchanger.exchange(t2,10, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); } catch (TimeoutException e) { e.printStackTrace(); } finally { System.out.println(Thread.currentThread().getName() + result + "22222222222"); } }, "t2").start(); } }
6e06261d569ebe858da2dee239a080aa684a8f75
b57e8a634264e5859e17caa172360c4c4561b086
/exemplos-spring/src/main/java/br/senac/tads4/dsw/exemplosspring/ExemplosSpringApplication.java
94b878d0480594a8e941a5cbd637acbe0e52034d
[ "MIT" ]
permissive
ftsuda-senac/tads4-dswb-2018-1
ab6b25b430f34204ea2695a467691ec406efe19e
9c87f0bdbc1761d1a2248cbfd7cefdaf4b80f28a
refs/heads/master
2021-01-25T10:20:56.628610
2018-05-17T02:02:56
2018-05-17T02:02:56
123,347,250
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package br.senac.tads4.dsw.exemplosspring; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @SpringBootApplication public class ExemplosSpringApplication { public static void main(String[] args) { SpringApplication.run(ExemplosSpringApplication.class, args); } }
e03a48a887830d99933b86a00ec20202ee560c6c
6872b7e2ad8422cb69bae8d72cfc4143b01b16c5
/src/main/java/operators/OperatorDIV.java
ac8ec41b8313ae47d0bb3eb51a80467892930acb
[]
no_license
karatsuba/simple-calculator
2a2e65905b01eb146c08bf2bd17911fa0b4176d4
adb32fe116dd2be11d3e7d4ae9b76127b2109514
refs/heads/master
2020-03-23T00:11:34.477152
2018-07-13T14:04:39
2018-07-13T14:04:39
140,849,559
0
0
null
null
null
null
UTF-8
Java
false
false
433
java
package operators; import operand.Operand; public class OperatorDIV implements Operator{ public Number evaluate(Operand leftOperand, Operand rightOperand) throws Exception{ if (rightOperand.getValue() == 0){ throw new Exception("ERROR: you can divide by zero"); } return leftOperand.getValue() / rightOperand.getValue(); } public String toString() { return "DIV"; } }
2bfe03c6e4304fc51c75056307c8b22acdce43cb
7fcb1efdb5678c16eaedcf380ba28579e2d90c23
/src/com/example/prox/ForgotPassword.java
b02e929eee512364e182db9e9b79cf30a8b38c0b
[]
no_license
jeffwdg/ProX_v2
bc11fc5c18eb7463f437133c4191803c7fa18695
bca5ae0a37d6f5d40aed14a4122bd255d69031bc
refs/heads/master
2016-09-06T05:04:59.900165
2014-03-08T15:49:16
2014-03-08T15:49:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,370
java
package com.example.prox; import com.parse.ParseException; import com.parse.ParseUser; import com.parse.RequestPasswordResetCallback; import com.radaee.reader.R; import android.app.ActionBar; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.app.Dialog; import android.telephony.SmsManager; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.net.Uri; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; public class ForgotPassword extends Activity{ TextView txtforgotPass; Button emailPassword; Utilities util= new Utilities(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.forgotpassword); ActionBar actionBar = this.getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); txtforgotPass = (TextView)findViewById(R.id.emailforgotPassword); emailPassword=(Button)findViewById(R.id.btnforgotPassword); // Set On ClickListener emailPassword.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // get The User name and Password final String email=txtforgotPass.getText().toString(); View focusView = null; boolean cancel = false; String email_pattern = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; if(util.isOnline(getApplicationContext()) == true) { Toast.makeText(getApplicationContext(), "Resetting password...", Toast.LENGTH_SHORT).show(); Log.d("ProX Forgot Password","" +email); // check if any of the fields are vacant if(TextUtils.isEmpty(email)) { txtforgotPass.setError(getString(R.string.required_field)); focusView = txtforgotPass; cancel = true; }else if(!email.matches(email_pattern)){ txtforgotPass.setError(getString(R.string.invalid_email)); focusView = txtforgotPass; cancel = true; } if(cancel == false){ ParseUser.requestPasswordResetInBackground(email,new RequestPasswordResetCallback() { public void done(ParseException e) { if (e == null) { // An email was successfully sent with reset instructions. Log.d("ProX Forgot Password","An email notification was sent to " + email); util.showAlertDialog(ForgotPassword.this, "Forgot Password", "An email notification was sent to your email to continue reset your password.", false); } else { util.showAlertDialog(ForgotPassword.this, "Forgot Password", " An error occured. Please check your internet connection and try again.", false); Log.d("ProX Forgot Password","Unsuccessful"); } } }); }else{focusView.requestFocus();} }else{ util.showAlertDialog(ForgotPassword.this, "Network Error", "Please check your internet connection and try again.", false); } } }); } @Override protected void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); } }
15464f7f4ae24a3f4ecf60946d5e969b4b7e9d62
5d13d9329c561856f1f50305be1dd03c5f960dcf
/services/hrdb/src/com/auto_gmifufqtjm/hrdb/dao/DepartmentDao.java
7f7f7098a9314dba8b004ef2f30085f992c05381
[]
no_license
wavemakerapps/Auto_GmIFUFQtjM
cc296c51a78627290923d0e3d82c758802889f89
1da0229f1562023c018a686611cdf25b6e85b608
refs/heads/master
2021-09-02T13:09:32.208635
2018-01-02T23:09:21
2018-01-02T23:09:21
116,066,006
0
0
null
null
null
null
UTF-8
Java
false
false
1,203
java
/*Copyright (c) 2015-2016 wavemaker.com All Rights Reserved. This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the source code license agreement you entered into with wavemaker.com*/ package com.auto_gmifufqtjm.hrdb.dao; /*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.orm.hibernate5.HibernateTemplate; import org.springframework.stereotype.Repository; import com.wavemaker.runtime.data.dao.WMGenericDaoImpl; import com.auto_gmifufqtjm.hrdb.Department; /** * Specifies methods used to obtain and modify Department related information * which is stored in the database. */ @Repository("hrdb.DepartmentDao") public class DepartmentDao extends WMGenericDaoImpl<Department, Integer> { @Autowired @Qualifier("hrdbTemplate") private HibernateTemplate template; public HibernateTemplate getTemplate() { return this.template; } }
792db3b5ee81e3c2346d38e5787485a866c43ee5
6e39e31f656c951e125c6a8bb376e503d6e7b66a
/app/src/main/java/de/cleopa/chentschel/gpsactivity/main/KarteAnzeigenSaved.java
e9978e6a918777018494d1d7d1fefdfd1d8c2ae2
[]
no_license
kristalis24/GPSActivity
565632341dbe8ec0aeb883ff129b2e17b5d90db0
2fb5e10ac8a498562c58c2dac817c7688a7c32e5
refs/heads/master
2021-01-17T07:56:28.976728
2016-07-09T11:32:26
2016-07-09T11:32:26
60,083,837
0
0
null
null
null
null
UTF-8
Java
false
false
9,096
java
package de.cleopa.chentschel.gpsactivity.main; import android.app.Activity; import android.app.Dialog; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.graphics.Color; import android.location.Geocoder; import android.location.Location; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.util.Log; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.MapsInitializer; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.Polyline; import com.google.android.gms.maps.model.PolylineOptions; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.lang.ref.WeakReference; import de.cleopa.chentschel.gpsactivity.R; import de.cleopa.chentschel.gpsactivity.service.GeoPositionsService; import de.cleopa.chentschel.gpsactivity.service.GeoPositionsService.GeoPositionsServiceBinder; public class KarteAnzeigenSaved extends Activity { private static final String TAG = KarteAnzeigenSaved.class.getSimpleName(); private static final float DEFAULT_ZOOM_LEVEL = 17.5f; public static Location mMeinePosition; private Marker mMeinMarker; private MapView mMapView; private GoogleMap mMap; // public static final String IN_PARAM_GEO_POSITION = "location"; // public static final int TYP_EIGENE_POSITION = 1; private static Handler mKarteAnzeigenCallbackHandler; private Polyline mVerbindungslinie; LatLng latLngA; LatLng latLng; // boolean newFile = true; // StringBuilder s = null; // ArrayList<LatLng> list = new ArrayList<LatLng>(); double latitude; double longitude; double höhe; long time; // public static GPXDocument mDocument = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.karte_anzeigen_saved); if (mMeinePosition != null && mVerbindungslinie != null) { mVerbindungslinie.remove(); } if (mMap != null && mMeinMarker != null) { mMeinMarker.remove(); } mKarteAnzeigenCallbackHandler = new KarteAnzeigenCallbackHandler(this); mMapView = (MapView) findViewById(R.id.karte_anzeigen_saved); mMapView.onCreate(savedInstanceState); initMapView(); final Intent geoIntent = new Intent(this, GeoPositionsService.class); bindService(geoIntent, mGeoPositionsServiceConnection, Context.BIND_AUTO_CREATE); } protected void onDestroy() { mMapView.onDestroy(); mKarteAnzeigenCallbackHandler.removeCallbacksAndMessages(null); unbindService(mGeoPositionsServiceConnection); stopService(new Intent(this, GeoPositionsService.class)); super.onDestroy(); } @Override protected void onStart() { super.onStart(); } @Override protected void onResume() { // stopService(new Intent(this, GeoPositionsService.class)); if (mMapView != null) { // null, wenn Google Play Store nicht installiert ist mMapView.onResume(); } super.onResume(); } @Override protected void onPause() { mMapView.onPause(); super.onPause(); } @Override public void onLowMemory() { super.onLowMemory(); mMapView.onLowMemory(); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mMapView.onSaveInstanceState(outState); } private void initMapView() { boolean usePlayService = isGooglePlayServiceAvailable(); if (usePlayService) { MapsInitializer.initialize(this); if (mMap == null) { mMap = mMapView.getMap(); if (mMap != null) { mMap.getUiSettings().setZoomControlsEnabled(true); mMap.getUiSettings().setCompassEnabled(true); mMap.setMyLocationEnabled(true); mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); mMap.setIndoorEnabled(true); mMap.setTrafficEnabled(true); mMap.animateCamera(CameraUpdateFactory.zoomTo(DEFAULT_ZOOM_LEVEL)); } } } else { finish(); } } private boolean isGooglePlayServiceAvailable() { int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (errorCode != ConnectionResult.SUCCESS) { Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(errorCode, this, -1); if (errorDialog != null) { errorDialog.show(); return false; } } return true; } public void handleMessage(Message msg) throws IOException, XmlPullParserException { final Bundle bundle = msg.getData(); final Location location = (Location) bundle.get("location"); final String file = new File(getExternalFilesDir(null), "gpsactivity.gpx").toString(); // FileInputStream openFileInput = new FileInputStream(file); // try (BufferedReader in = new BufferedReader(new InputStreamReader(openFileInput))) { // String zeile; // while ((zeile = in.readLine()) != null) { // String inhalt[] = zeile.split(","); // time = Long.parseLong(inhalt[0]); // höhe = Double.parseDouble(inhalt[1]); // latitude = Double.parseDouble(inhalt[2]); // longitude = Double.parseDouble(inhalt[3]); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser xpp = factory.newPullParser(); xpp.setInput(new FileReader(file)); processStartElement(xpp); if (location != null) { latLng = new LatLng(latitude, longitude); // list.add(new LatLng(latitude, longitude)); } if (latLngA == null) { latLngA = latLng; } final MarkerOptions markerOption = new MarkerOptions(); markerOption.position(latLng); markerOption.title(getAddressFromLatLng(latLng)); mMeinMarker = mMap.addMarker(markerOption); mVerbindungslinie = mMap.addPolyline(new PolylineOptions().add(latLngA, latLng).width(5).color(Color.BLUE)); mMeinMarker.showInfoWindow(); mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng)); latLngA = latLng; } // } // } public void processStartElement (XmlPullParser xpp){ String name = xpp.getName(); String uri = xpp.getNamespace(); if ("".equals (uri)) { Log.d(TAG, "--->\n\nStart element: " + name); } else { Log.d(TAG, "--->\n\nStart element: {" + uri + "}" + name); } } private String getAddressFromLatLng(LatLng latLng){ Geocoder geocoder = new Geocoder(getBaseContext()); String address = ""; try { address=geocoder.getFromLocation(latLng.latitude, latLng.longitude, 1).get(0).getAddressLine(0); } catch (IOException e){ e.printStackTrace(); } return address; } private ServiceConnection mGeoPositionsServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName className, IBinder binder) { ((GeoPositionsServiceBinder) binder).setzeActivityCallbackHandler(mKarteAnzeigenCallbackHandler); } @Override public void onServiceDisconnected(ComponentName className) { } }; static class KarteAnzeigenCallbackHandler extends Handler{ private WeakReference<KarteAnzeigenSaved> mActivity; KarteAnzeigenCallbackHandler(KarteAnzeigenSaved acticity){ mActivity = new WeakReference<>(acticity); } @Override public void handleMessage(Message msg){ KarteAnzeigenSaved activity = mActivity.get(); if (activity != null){ try {activity.handleMessage(msg); } catch (Exception e){ Log.e(TAG, "Dateizugriff fehlerhaft.", e); } } } } }
819b6b11b44e1e461d33c45e43d47c8ef853d499
0da6bc5b991d1343af05a6cc6be768ffced5296b
/src/com/moonyue/Main.java
a4c71883f1086eebc2561244330a783feaf84e7a
[]
no_license
FebFirst/concurrent-learning
c9481181730a184b2c91bdc42c4958afa20e48dc
81f371b5374317a9a948583db50751d87339992e
refs/heads/master
2020-04-04T13:35:55.873978
2018-11-14T12:24:21
2018-11-14T12:24:21
155,967,701
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
package com.moonyue; import com.moonyue.chapter4.MoonYueHttpServer; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; public class Main { public static void main(String[] args) throws Exception{ // write your code here // ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); // ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(false, false); // for(ThreadInfo threadInfo : threadInfos){ // System.out.println(threadInfo.getThreadId() + "---" + threadInfo.getThreadName()); // } MoonYueHttpServer.setPort(5200); MoonYueHttpServer.setBasePath("/home/muyue/Downloads"); MoonYueHttpServer.start(); } }
37776b34116db2ace266fb59f8eaffcdebc2c3f5
c061a9cbbd7c727b1498022d37e09c7c1c9393b4
/src/main/java/com/springboot/netclodx/auth/ResourceServerConfig.java
e518f0ef4c2983e6729fb7cedacd0da9886a12f8
[]
no_license
olivo1990/spring-services-netclodx-usuario
3e1c1fb671a92e62255d6b4ecb55e75bbe7e0209
a2c103443bed2d94e49e0755940520b95ec6a2ca
refs/heads/master
2020-09-06T05:33:13.355190
2019-11-17T23:37:44
2019-11-17T23:37:44
220,339,675
0
0
null
null
null
null
UTF-8
Java
false
false
2,405
java
package com.springboot.netclodx.auth; import java.util.Arrays; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; @Configuration @EnableResourceServer public class ResourceServerConfig extends ResourceServerConfigurerAdapter { @Override public void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers(HttpMethod.GET, "/api/usuarios/**").permitAll() /*.antMatchers(HttpMethod.GET, "/api/clientes/{id}").permitAll() .antMatchers(HttpMethod.GET, "/api/clientes/facturas/**").permitAll() .antMatchers(HttpMethod.GET, "/api/clientes/{id}").hasAnyRole("ADMIN", "USER") .antMatchers(HttpMethod.POST, "/api/clientes/upload").hasAnyRole("ADMIN", "USER") .antMatchers(HttpMethod.GET, "/api/clientes/crear").hasRole("ADMIN") .antMatchers("/api/clientes/**").hasRole("ADMIN")*/ .anyRequest().authenticated(); } @Bean public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration config = new CorsConfiguration(); config.setAllowedOrigins(Arrays.asList("http://localhost:4200")); config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS")); config.setAllowCredentials(true); config.setAllowedHeaders(Arrays.asList("Content-Type", "Authorization")); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", config); return source; } @Bean public FilterRegistrationBean<CorsFilter> corsFilter(){ FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<CorsFilter>(new CorsFilter(corsConfigurationSource())); bean.setOrder(Ordered.HIGHEST_PRECEDENCE); return bean; } }
23656e94ff6ef28bd8869fc3a46b7260cfff3d11
7c1430c53b4d66ad0e96dd9fc7465a5826fdfb77
/uims-support/src/cn/edu/sdu/uims/graph/form/InfoPhotoForm.java
c49bfb47c745860ac02a643424defdd665409147
[]
no_license
wang3624270/online-learning-server
ef97fb676485f2bfdd4b479235b05a95ad62f841
2d81920fef594a2d0ac482efd76669c8d95561f1
refs/heads/master
2020-03-20T04:33:38.305236
2019-05-22T06:31:05
2019-05-22T06:31:05
137,187,026
1
0
null
null
null
null
UTF-8
Java
false
false
2,480
java
package cn.edu.sdu.uims.graph.form; import javax.sql.rowset.serial.SerialBlob; /** * 人员照片信息 * InfoPhoto generated by MyEclipse - Hibernate Tools */ public class InfoPhotoForm extends AddedAttributeForm implements java.io.Serializable { // Fields private Integer id; private String photoType;//照片类型 private String remark;//备注 private SerialBlob photo; private String fileName; private Integer personId; private String perName; private String perTypeCode; private String perNum; private String perAddress; private String perTelephone; private String exameeType; // Constructors public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } /** default constructor */ public InfoPhotoForm() { } /** minimal constructor */ // Property accessors public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } public String getPhotoType() { return this.photoType; } public void setPhotoType(String photoType) { this.photoType = photoType; } public String getRemark() { return this.remark; } public void setRemark(String remark) { this.remark = remark; } public SerialBlob getPhoto() { return photo; } public void setPhoto(SerialBlob photo) { this.photo = photo; } public Integer getPersonId() { return personId; } public void setPersonId(Integer personId) { this.personId = personId; } public String getPerName() { return perName; } public void setPerName(String perName) { this.perName = perName; } public String getPerNum() { return perNum; } public void setPerNum(String perNum) { this.perNum = perNum; } public String getPerAddress() { return perAddress; } public void setPerAddress(String perAddress) { this.perAddress = perAddress; } public String getPerTelephone() { return perTelephone; } public void setPerTelephone(String perTelephone) { this.perTelephone = perTelephone; } public String getPerTypeCode() { return perTypeCode; } public void setPerTypeCode(String perTypeCode) { this.perTypeCode = perTypeCode; } public String getExameeType() { return exameeType; } public void setExameeType(String exameeType) { this.exameeType = exameeType; } }
d967c555d1ba4f6a2fe87fcb5b539777671559be
aee1dd7d4c2eed9b706eb4e8c7fac6a3dfc5e199
/zqsign-saas-client-demo/src/main/java/com/zqsign/client/contract/bykeyword/SignByKeywordIV.java
02b99dc8fe91389d3ef7a49352aa407c28f1d433
[]
no_license
zhangzk223/testgit
a11c98030aebd44a6fd5af51716785cafde1b5d4
4664a013fe3f6be4eb9f6cc181b83c28859c4b15
refs/heads/master
2021-09-06T11:27:46.750883
2018-02-06T02:19:35
2018-02-06T02:19:35
108,485,438
0
0
null
null
null
null
UTF-8
Java
false
false
3,788
java
package com.zqsign.client.contract.bykeyword; import java.util.HashMap; import java.util.Map; import com.alibaba.fastjson.JSONObject; import com.zqsign.common.base64.Base64Utils; import com.zqsign.common.constants.ZqsignManage; import com.zqsign.common.utils.httpclient.HttpClientUtil; import com.zqsign.common.utils.rsa.RsaSign; /** * * @ClassName: SignAuto * @Description: 图片验证关键字签署 * @date: 2017年3月28日 下午2:32:06 * */ public class SignByKeywordIV { public static void main(String[] agrs) throws Exception { String private_key = ZqsignManage.PRIVATE_KEY; String request_url = ZqsignManage.REQUEST_URL + "signByKeywordIV"; String zqid = ZqsignManage.ZQID; byte[] fileToByte = Base64Utils.fileToByte("D:\\1.jpg"); String signature = Base64Utils.encode(fileToByte); Map<String, String> map = new HashMap<String, String>(); map.put("zqid", zqid);// ---------需要用户修改 map.put("no", "12345");// ---------需要用户修改 map.put("keyword", "dddddddddddddddddddddddddddddddd");// ---------签署关键字 map.put("user_code", "user100");// ---------需要用户修改 map.put("signature", signature);// ---------签名图片 map.put("sign_width", "50");// ---------签名图片宽 map.put("sign_height", "50");// ---------签名图片高 map.put("sms_id", "5f95ece949e144f4ae9ec63592f0e479");// ---------验证码id map.put("sms_code", "854493");// ---------用户输入的验证码 //签名 String content = RsaSign.createLinkString(map); String sign_val = RsaSign.sign(content,private_key); System.out.println(sign_val); map.put("sign_val", sign_val); // 请求参数的签名值 String response_str = HttpClientUtil.sendPost(request_url, map);// 向服务端发送请求,并接收请求结果 System.out.println("请求结果:" + response_str);// 输出服务器响应结果 } /** * * @param no-----合同编号 * @param keyword----关键字 * @param userCode----用户id * @param signature--签名图片 * @param sign_width-----签名图片宽 * @param sign_height----签名图片高 * @param sms_id---验证码id * @param sms_code------用户输入的验证码 * @return * @throws Exception */ public static String signByKeywordIV(String no,String keyword,String userCode,String signature,String sign_width,String sign_height,String sms_id,String sms_code) throws Exception { String private_key = ZqsignManage.PRIVATE_KEY; String request_url = ZqsignManage.REQUEST_URL + "signByKeywordIV"; String zqid = ZqsignManage.ZQID; Map<String, String> map = new HashMap<String, String>(); map.put("zqid", zqid);// ---------需要用户修改 map.put("no", no);// ---------需要用户修改 map.put("keyword", keyword);// ---------签署关键字 map.put("user_code",userCode );// ---------需要用户修改 map.put("signature", signature);// ---------签名图片 map.put("sign_width", sign_width);// ---------签名图片宽 map.put("sign_height", sign_height);// ---------签名图片高 map.put("sms_id", sms_id);// ---------验证码id map.put("sms_code", sms_code);// ---------用户输入的验证码 //签名 String content = RsaSign.createLinkString(map); String sign_val = RsaSign.sign(content,private_key); map.put("sign_val", sign_val); // 请求参数的签名值 String response_str = HttpClientUtil.sendPost(request_url, map);// 向服务端发送请求,并接收请求结果 System.out.println("请求结果:" + response_str);// 输出服务器响应结果 JSONObject ob = JSONObject.parseObject(response_str); String s = ob.getString("msg"); return s; } }
399520fa768fae4f6681a411ae212741065c834f
9c6be468eb6d86ebbf0851352699030cf3fae9ec
/instrumentation/servlet/servlet-3.0-no-wrapping/src/test/java/io/opentelemetry/javaagent/instrumentation/hypertrace/servlet/v3_0/nowrapping/WrappingFilter.java
58f00cff638dc784cd4d831571ebb46376912d8e
[ "Apache-2.0" ]
permissive
samarth-gupta-traceable/javaagent
57d7ab645ccfb41e97837d43b671c7540066388d
bacb322b2b5928ac04c00b1f98108803bcf4be8a
refs/heads/main
2023-03-11T01:44:45.466155
2021-02-24T09:59:37
2021-02-24T09:59:37
340,388,566
0
0
Apache-2.0
2021-02-19T14:11:08
2021-02-19T14:11:07
null
UTF-8
Java
false
false
3,512
java
/* * Copyright The Hypertrace Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.opentelemetry.javaagent.instrumentation.hypertrace.servlet.v3_0.nowrapping; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.ServletOutputStream; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import org.DelegatingBufferedReader; import org.DelegatingPrintWriter; import org.DelegatingServletInputStream; import org.DelegatingServletOutputStream; public class WrappingFilter implements Filter { @Override public void init(FilterConfig filterConfig) {} @Override public void destroy() {} @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) request; HttpServletResponse httpServletResponse = (HttpServletResponse) response; ReqWrapper reqWrapper = new ReqWrapper(httpServletRequest); RespWrapper respWrapper = new RespWrapper(httpServletResponse); chain.doFilter(reqWrapper, respWrapper); } static class ReqWrapper extends HttpServletRequestWrapper { private ServletInputStream servletInputStream; private BufferedReader bufferedReader; public ReqWrapper(HttpServletRequest request) { super(request); } @Override public ServletInputStream getInputStream() throws IOException { if (servletInputStream == null) { servletInputStream = new DelegatingServletInputStream(super.getInputStream()); } return servletInputStream; } @Override public BufferedReader getReader() throws IOException { if (bufferedReader == null) { bufferedReader = new DelegatingBufferedReader(super.getReader()); } return bufferedReader; } } static class RespWrapper extends HttpServletResponseWrapper { private ServletOutputStream servletOutputStream; private PrintWriter printWriter; public RespWrapper(HttpServletResponse response) { super(response); } @Override public ServletOutputStream getOutputStream() throws IOException { if (servletOutputStream == null) { servletOutputStream = new DelegatingServletOutputStream(super.getOutputStream()); } return servletOutputStream; } @Override public PrintWriter getWriter() throws IOException { if (printWriter == null) { printWriter = new DelegatingPrintWriter(super.getWriter()); } return printWriter; } } }
6296b10226e2abf5be0fc7184e93e97b32228ee6
370bcbce8c056fdf1f651f533b3b2ac41382ec34
/app/src/main/java/com/example/ecommerce/Model/Users.java
ddd0c67b322a1bd16079a49094889cfefc6b3a5b
[]
no_license
Ashutosh730/eCommerce
f273a5ad47a8c13f54f982ac75a7b1b6b234f16a
ad947245e3074bfe14864b3ac5c2fadccb3167ec
refs/heads/master
2023-04-27T22:55:19.019235
2021-05-14T10:54:54
2021-05-14T10:54:54
365,934,787
0
0
null
null
null
null
UTF-8
Java
false
false
705
java
package com.example.ecommerce.Model; public class Users { protected String name, phone, password; public Users(){} public Users(String name, String password, String phone) { this.name = name; this.phone = phone; this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
0a50a8bc5bbcef5caae199725322b14daf9f08d5
3e7cfd9ba8ce893af5a864dfa089e09512d6ce53
/AndroidAsync/src/com/koushikdutta/async/http/server/BoundaryEmitter.java
8da7e0912ed556d2cae6888a9d0aff04ea8b9752
[ "Apache-2.0" ]
permissive
nseidm1/AndroidAsync
f8c136638b25fdd42126ceb42622ca4da760627f
c0267e4e5c6ef2d28c92332b3ec3090d406035f4
refs/heads/master
2021-01-24T04:19:11.295555
2013-04-16T03:01:23
2013-04-16T03:01:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,658
java
package com.koushikdutta.async.http.server; import java.nio.ByteBuffer; import junit.framework.Assert; import com.koushikdutta.async.ByteBufferList; import com.koushikdutta.async.DataEmitter; import com.koushikdutta.async.FilteredDataEmitter; public class BoundaryEmitter extends FilteredDataEmitter { private byte[] boundary; public void setBoundary(String boundary) { this.boundary = ("--" + boundary).getBytes(); } public String getBoundary() { if (boundary == null) return null; return new String(boundary, 2, boundary.length - 2); } public String getBoundaryStart() { Assert.assertNotNull(boundary); return new String(boundary); } public String getBoundaryEnd() { Assert.assertNotNull(boundary); return new String(boundary) + "--\r\n"; } protected void onBoundaryStart() { } protected void onBoundaryEnd() { } // >= 0 matching // -1 matching - (start of boundary end) or \r (boundary start) // -2 matching - (end of boundary end) // -3 matching \r after boundary // -4 matching \n after boundary // defunct: -5 matching start - MUST match the start of the first boundary int state = 0; @Override public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) { // System.out.println(bb.getString()); // System.out.println("chunk: " + bb.remaining()); // System.out.println("state: " + state); // if we were in the middle of a potential match, let's throw that // at the beginning of the buffer and process it too. if (state > 0) { ByteBuffer b = ByteBuffer.wrap(boundary, 0, state).duplicate(); bb.add(0, b); state = 0; } int last = 0; byte[] buf = new byte[bb.remaining()]; bb.get(buf); for (int i = 0; i < buf.length; i++) { if (state >= 0) { if (buf[i] == boundary[state]) { state++; if (state == boundary.length) state = -1; } else if (state > 0) { // let's try matching again one byte after the start // of last match occurrence i -= state; state = 0; } } else if (state == -1) { if (buf[i] == '\r') { state = -4; int len = i - last - boundary.length - 2; if (len >= 0) { ByteBuffer b = ByteBuffer.wrap(buf, last, len); ByteBufferList list = new ByteBufferList(); list.add(b); super.onDataAvailable(this, list); } else { // len can be -1 on the first boundary Assert.assertEquals(-2, len); } // System.out.println("bstart"); onBoundaryStart(); } else if (buf[i] == '-') { state = -2; } else { report(new Exception("Invalid multipart/form-data. Expected \r or -")); return; } } else if (state == -2) { if (buf[i] == '-') { state = -3; } else { report(new Exception("Invalid multipart/form-data. Expected -")); return; } } else if (state == -3) { if (buf[i] == '\r') { state = -4; ByteBuffer b = ByteBuffer.wrap(buf, last, i - last - boundary.length - 4); ByteBufferList list = new ByteBufferList(); list.add(b); super.onDataAvailable(this, list); // System.out.println("bend"); onBoundaryEnd(); } else { report(new Exception("Invalid multipart/form-data. Expected \r")); return; } } else if (state == -4) { if (buf[i] == '\n') { last = i + 1; state = 0; } else { report(new Exception("Invalid multipart/form-data. Expected \n")); } } // else if (state == -5) { // Assert.assertEquals(i, 0); // if (buf[i] == boundary[i]) { // state = 1; // } // else { // report(new Exception("Invalid multipart/form-data. Expected boundary start: '" + (char)boundary[i] + "'")); // return; // } // } else { Assert.fail(); report(new Exception("Invalid multipart/form-data. Unknown state?")); } } if (last < buf.length) { // System.out.println("amount left at boundary: " + (buf.length - last)); // System.out.println(state); int keep = Math.max(state, 0); ByteBuffer b = ByteBuffer.wrap(buf, last, buf.length - last - keep); ByteBufferList list = new ByteBufferList(); list.add(b); super.onDataAvailable(this, list); } } }
440a707f06eafe1e0027cae8d9849de5d186fd8c
06d503c5ea50d73bbb16d40234e87c4b13cd7071
/Acheron Source/src/server/model/players/skills/Smithing.java
b0d3b9596bbccdf668bd008e779c53a39c53e091
[]
no_license
Bdavey98/Runescape-SeniorProject
b3c8abfd434047a2ba7a8ba990fb6e822e67adf1
5bb7b879dc0c6f1e9941232f69e54b30789f7cb4
refs/heads/master
2022-11-22T07:51:02.258601
2020-07-27T17:39:28
2020-07-27T17:39:28
258,374,295
0
0
null
null
null
null
UTF-8
Java
false
false
26,544
java
package server.model.players.skills; import server.Config; import server.model.players.Client; /** * Smithing.java * * @author Sanity * **/ public class Smithing { private Client c; private final int[] SMELT_BARS = {2349,2351,2355,2353,2357,2359,2361,2363}; private final int[] SMELT_FRAME = {2405,2406,2407,2409,2410,2411,2412,2413}; private final int[] BAR_REQS = {1,15,20,30,40,50,70,85}; private final int[] ORE_1 = {438,440,-1,440,444,447,449,451}; private final int[] ORE_2 = {436,-1,-1,453,-1,-1,-1,-1}; private final int[] SMELT_EXP = {6,13,-1,18,23,30,38,50}; public int item; public int xp; public int remove; public int removeamount; public int maketimes; private int exp; private int oreId; private int oreId2; private int barId; public Smithing(Client c) { this.c = c; } public void sendSmelting() { for (int j = 0; j < SMELT_FRAME.length; j++) { c.getPA().sendFrame246(SMELT_FRAME[j], 150, SMELT_BARS[j]); } c.getPA().sendFrame164(2400); c.smeltInterface = true; } public void startSmelting(int barType) { if (canSmelt(barType)) { if (hasOres(barType)) { this.exp = getExp(barType); this.oreId = getOre(barType); this.oreId2 = getOre2(barType); this.barId = barType; c.smeltAmount = c.getItems().getItemAmount(getOre(barType)); smelt(barType); } else { c.sendMessage("You do not have the required ores to smelt this."); c.getPA().resetVariables(); } } else { c.sendMessage("You must have a higher smithing level to smith this."); c.getPA().resetVariables(); } } public void smelt(int barType) { if (c.smeltAmount > 0) { if (hasOres(barType)) { c.startAnimation(899); c.getItems().deleteItem(oreId, c.getItems().getItemSlot(oreId), 1); if (oreId2 > 0) c.getItems().deleteItem(oreId2, c.getItems().getItemSlot(oreId2), 1); c.getItems().addItem(barId,1); c.getPA().addSkillXP(exp * Config.SMITHING_EXPERIENCE, c.playerSmithing); c.getPA().refreshSkill(c.playerSmithing); c.smeltAmount--; } else { c.sendMessage("You do not have the required ores to smelt this."); c.getPA().removeAllWindows(); c.smeltAmount = 0; } } else { c.getPA().removeAllWindows(); } } public int getExp(int barType) { for (int j = 0; j < SMELT_BARS.length; j++) { if (barType == SMELT_BARS[j]) { return SMELT_EXP[j]; } } return 0; } public int getOre(int barType) { for (int j = 0; j < SMELT_BARS.length; j++) { if (barType == SMELT_BARS[j]) { //c.sendMessage("" + ORE_1[j]); return ORE_1[j]; } } return 0; } public int getOre2(int barType) { for (int j = 0; j < SMELT_BARS.length; j++) { if (barType == SMELT_BARS[j]) { //c.sendMessage("" + ORE_2[j]); return ORE_2[j]; } } return 0; } public boolean canSmelt(int barType) { for (int j = 0; j < SMELT_BARS.length; j++) { if (barType == SMELT_BARS[j]) { //c.sendMessage("" + c.playerLevel + " bar: " + BAR_REQS[j]); return c.playerLevel[c.playerSmithing] >= BAR_REQS[j]; } } return false; } public boolean hasOres(int barType) { if (getOre2(barType) > 0) return c.getItems().playerHasItem(getOre(barType)) && c.getItems().playerHasItem(getOre2(barType)); else return c.getItems().playerHasItem(getOre(barType)); } public void readInput(int level, String type, Client c, int amounttomake) { if (c.getItems().getItemName(Integer.parseInt(type)).contains("Bronze")) { CheckBronze(c, level, amounttomake, type); } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Iron")) { CheckIron(c, level, amounttomake, type); } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Steel")) { CheckSteel(c, level, amounttomake, type); } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Mith")) { CheckMith(c, level, amounttomake, type); } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Adam") || c.getItems().getItemName(Integer.parseInt(type)).contains("Addy")) { CheckAddy(c, level, amounttomake, type); } else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Rune") || c.getItems().getItemName(Integer.parseInt(type)).contains("Runite")) { CheckRune(c, level, amounttomake, type); } c.sendMessage("Item: " + type); } private void CheckIron(Client c, int level, int amounttomake, String type) { remove = 2351; if (type.equalsIgnoreCase("1349") && level >= 16) //Axe { xp = 25; item = 1349; removeamount = 1; maketimes = amounttomake; } else if (type.equalsIgnoreCase("1203") && level >= 15) //Dagger { xp = 25; item = 1203; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1420") && level >= 17) //Mace { xp = 25; item = 1420; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1137") && level >= 18) //Med helm { xp = 25; item = 1137; removeamount = 1; maketimes = amounttomake; } else if (type.equals("9140") && level >= 19) //Dart tips { xp = 25; item = 9140; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1279") && level >= 19) //Sword (s) { xp = 25; item = 1277; removeamount = 1; maketimes = amounttomake; } else if (type.equals("4820") && level >= 19) //Nails { xp = 25; item = 4820; removeamount = 1; maketimes = amounttomake; } else if (type.equals("40") && level >= 20) //Arrow tips { xp = 25; item = 40; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1323") && level >= 20)//Scim { xp = 50; item = 1323; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1293") && level >= 21) //Longsword { xp = 50; item = 1293; removeamount = 2; maketimes = amounttomake; } else if (type.equals("863") && level >= 22) //Knives { xp = 25; item = 863; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1153") && level >= 22) //Full Helm { xp = 50; item = 1153; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1175") && level >= 23) //Square shield { xp = 50; item = 1175; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1335") && level >= 24) //Warhammer { xp = 38; item = 1335; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1363") && level >= 25) //Battle axe { xp = 75; item = 1363; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1101") && level >= 26) //Chain { xp = 75; item = 1101; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1191") && level >= 27) //Kite { xp = 75; item = 1191; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1309") && level >= 29) //2h Sword { xp = 75; item = 1309; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1067") && level >= 31) //Platelegs { xp = 75; item = 1067; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1081") && level >= 31) //PlateSkirt { xp = 75; item = 1081; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1115") && level >= 33) //Platebody { xp = 100; item = 1115; removeamount = 5; maketimes = amounttomake; } else { c.sendMessage("You don't have a high enough level to make this Item!"); return; } doaction(c, item, remove, removeamount, maketimes, -1, -1, xp); } private void CheckSteel(Client c, int level, int amounttomake, String type) { remove = 2353; //c.sendMessage("0" + type); if(type == Integer.toString(2)) { xp = 35; item = 2; removeamount = 1; maketimes = amounttomake; c.sendMessage(type); } else { c.sendMessage("2 " + type); c.sendMessage("fuck this"); } if (type.equalsIgnoreCase("1353") && level >= 31) //Axe { xp = 38; item = 1353; removeamount = 1; maketimes = amounttomake; } else if (type.equalsIgnoreCase("1207") && level >= 30) //Dagger { xp = 50; item = 1207; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1424") && level >= 32) //Mace { xp = 50; item = 1424; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1141") && level >= 33) //Med helm { xp = 50; item = 1141; removeamount = 1; maketimes = amounttomake; } else if (type.equals("9141") && level >= 34) //Dart tips { xp = 50; item = 9141; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1281") && level >= 34) //Sword (s) { xp = 50; item = 1281; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1539") && level >= 34) //Nails { xp = 50; item = 1539; removeamount = 1; maketimes = amounttomake; } else if (type.equals("41") && level >= 35) //Arrow tips { xp = 50; item = 41; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1325") && level >= 35)//Scim { xp = 75; item = 1325; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1295") && level >= 36) //Longsword { xp = 75; item = 1295; removeamount = 2; maketimes = amounttomake; } else if (type.equals("865") && level >= 37) //Knives { xp = 50; item = 865; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1157") && level >= 37) //Full Helm { xp = 75; item = 1157; removeamount = 2; maketimes = amounttomake; } // else if (type.equals("2") && level >= 37) //cannon ball // { // xp = 35; // item = 2; // removeamount = 1; // maketimes = amounttomake; // } else if (type.equals("1177") && level >= 38) //Square shield { c.sendMessage(type); xp = 75; item = 2; removeamount = 2; maketimes = amounttomake; //c.sendMessage("i worked"); } else if (type.equals("1339") && level >= 39) //Warhammer { xp = 113; item = 1339; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1365") && level >= 40) //Battle axe { xp = 113; item = 1365; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1105") && level >= 41) //Chain { xp = 113; item = 1105; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1193") && level >= 42) //Kite { xp = 113; item = 1193; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1311") && level >= 44) //2h Sword { xp = 113; item = 1311; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1069") && level >= 46) //Platelegs { xp = 113; item = 1069; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1083") && level >= 46) //PlateSkirt { xp = 113; item = 1083; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1119") && level >= 48) //Platebody { xp = 188; item = 1119; removeamount = 5; maketimes = amounttomake; } else { c.sendMessage("You don't have a high enough level to make this Item!"); return; } //c.sendMessage(Integer.toString(item)); doaction(c, item, remove, removeamount, maketimes, -1, -1, xp); } private void CheckMith(Client c, int level, int amounttomake, String type) { remove = 2359; if (type.equalsIgnoreCase("1355") && level >= 51) //Axe { xp = 50; item = 1355; removeamount = 1; maketimes = amounttomake; } else if (type.equalsIgnoreCase("1209") && level >= 50) //Dagger { xp = 50; item = 1209; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1428") && level >= 52) //Mace { xp = 50; item = 1428; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1143") && level >= 53) //Med helm { xp = 50; item = 1143; removeamount = 1; maketimes = amounttomake; } else if (type.equals("9142") && level >= 54) //Dart tips { xp = 50; item = 9142; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1285") && level >= 54) //Sword (s) { xp = 50; item = 1285; removeamount = 1; maketimes = amounttomake; } else if (type.equals("4822") && level >= 54) //Nails { xp = 50; item = 4822; removeamount = 1; maketimes = amounttomake; } else if (type.equals("42") && level >= 55) //Arrow tips { xp = 50; item = 42; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1329") && level >= 55)//Scim { xp = 100; item = 1329; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1299") && level >= 56) //Longsword { xp = 100; item = 1299; removeamount = 2; maketimes = amounttomake; } else if (type.equals("866") && level >= 57) //Knives { xp = 50; item = 866; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1159") && level >= 57) //Full Helm { xp = 100; item = 1159; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1181") && level >= 58) //Square shield { xp = 100; item = 1181; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1343") && level >= 59) //Warhammer { xp = 150; item = 1343; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1369") && level >= 60) //Battle axe { xp = 150; item = 1369; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1109") && level >= 61) //Chain { xp = 150; item = 1109; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1197") && level >= 62) //Kite { xp = 150; item = 1197; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1315") && level >= 64) //2h Sword { xp = 150; item = 1315; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1071") && level >= 66) //Platelegs { xp = 150; item = 1071; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1085") && level >= 66) //PlateSkirt { xp = 150; item = 1085; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1121") && level >= 68) //Platebody { xp = 250; item = 1121; removeamount = 5; maketimes = amounttomake; } else { c.sendMessage("You don't have a high enough level to make this Item!"); return; } doaction(c, item, remove, removeamount, maketimes, -1, -1, xp); } private void CheckRune(Client c, int level, int amounttomake, String type) { remove = 2363; if (type.equalsIgnoreCase("1359") && level >= 86) //Axe { xp = 75; item = 1359; removeamount = 1; maketimes = amounttomake; } else if (type.equalsIgnoreCase("1213") && level >= 85) //Dagger { xp = 75; item = 1213; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1432") && level >= 87) //Mace { xp = 75; item = 1432; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1147") && level >= 88) //Med helm { xp = 75; item = 1147; removeamount = 1; maketimes = amounttomake; } else if (type.equals("9144") && level >= 89) //Dart tips { xp = 75; item = 9144; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1289") && level >= 89) //Sword (s) { xp = 75; item = 1289; removeamount = 1; maketimes = amounttomake; } else if (type.equals("4824") && level >= 89) //Nails { xp = 75; item = 4824; removeamount = 1; maketimes = amounttomake; } else if (type.equals("44") && level >= 90) //Arrow tips { xp = 75; item = 44; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1333") && level >= 90)//Scim { xp = 150; item = 1333; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1303") && level >= 91) //Longsword { xp = 150; item = 1303; removeamount = 2; maketimes = amounttomake; } else if (type.equals("868") && level >= 92) //Knives { xp = 75; item = 868; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1163") && level >= 92) //Full Helm { xp = 150; item = 1163; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1185") && level >= 93) //Square shield { xp = 150; item = 1185; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1347") && level >= 94) //Warhammer { xp = 225; item = 1347; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1373") && level >= 95) //Battle axe { xp = 225; item = 1373; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1113") && level >= 96) //Chain { xp = 225; item = 1113; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1201") && level >= 97) //Kite { xp = 225; item = 1201; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1319") && level >= 99) //2h Sword { xp = 225; item = 1319; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1079") && level >= 99) //Platelegs { xp = 225; item = 1079; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1093") && level >= 99) //PlateSkirt { xp = 225; item = 1093; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1127") && level >= 99) //Platebody { xp = 313; item = 1127; removeamount = 5; maketimes = amounttomake; } else { c.sendMessage("You don't have a high enough level to make this Item!"); return; } doaction(c, item, remove, removeamount, maketimes, -1, -1, xp); } private void CheckAddy(Client c, int level, int amounttomake, String type) { remove = 2361; if (type.equalsIgnoreCase("1357") && level >= 71) //Axe { xp = 63; item = 1357; removeamount = 1; maketimes = amounttomake; } else if (type.equalsIgnoreCase("1211") && level >= 70) //Dagger { xp = 63; item = 1211; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1430") && level >= 72) //Mace { xp = 63; item = 1430; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1145") && level >= 73) //Med helm { xp = 63; item = 1145; removeamount = 1; maketimes = amounttomake; } else if (type.equals("9143") && level >= 74) //Dart tips { xp = 63; item = 9143; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1287") && level >= 74) //Sword (s) { xp = 63; item = 1287; removeamount = 1; maketimes = amounttomake; } else if (type.equals("4823") && level >= 74) //Nails { xp = 63; item = 4823; removeamount = 1; maketimes = amounttomake; } else if (type.equals("43") && level >= 75) //Arrow tips { xp = 63; item = 43; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1331") && level >= 75)//Scim { xp = 125; item = 1331; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1301") && level >= 76) //Longsword { xp = 125; item = 1301; removeamount = 2; maketimes = amounttomake; } else if (type.equals("867") && level >= 77) //Knives { xp = 63; item = 867; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1161") && level >= 77) //Full Helm { xp = 125; item = 1161; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1183") && level >= 78) //Square shield { xp = 125; item = 1183; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1345") && level >= 79) //Warhammer { xp = 188; item = 1345; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1371") && level >= 80) //Battle axe { xp = 188; item = 1371; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1111") && level >= 81) //Chain { xp = 188; item = 1111; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1199") && level >= 82) //Kite { xp = 188; item = 1199; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1317") && level >= 84) //2h Sword { xp = 188; item = 1317; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1073") && level >= 86) //Platelegs { xp = 188; item = 1073; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1091") && level >= 86) //PlateSkirt { xp = 188; item = 1091; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1123") && level >= 88) //Platebody { xp = 313; item = 1123; removeamount = 5; maketimes = amounttomake; } else { c.sendMessage("You don't have a high enough level to make this Item!"); return; } doaction(c, item, remove, removeamount, maketimes, -1, -1, xp); } private void CheckBronze(Client c, int level, int amounttomake,String type) { if (type.equalsIgnoreCase("1351") && level >= 1) { xp = 13; item = 1351; remove = 2349; removeamount = 1; maketimes = amounttomake; } else if (type.equalsIgnoreCase("1205") && level >= 1) { xp = 13; item = 1205; remove = 2349; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1422") && level >= 2) { xp = 13; item = 1422; remove = 2349; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1139") && level >= 3) { xp = 13; item = 1139; remove = 2349; removeamount = 1; maketimes = amounttomake; } else if (type.equals("819") && level >= 4) { xp = 13; item = 819; remove = 2349; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1277") && level >= 4) { xp = 13; item = 1277; remove = 2349; removeamount = 1; maketimes = amounttomake; } else if (type.equals("4819") && level >= 4) { xp = 13; item = 4819; remove = 2349; removeamount = 1; maketimes = amounttomake; } else if (type.equals("39") && level >= 5) { xp = 13; item = 39; remove = 2349; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1321") && level >= 5) { xp = 25; item = 1321; remove = 2349; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1291") && level >= 6) { xp = 25; item = 1291; remove = 2349; removeamount = 2; maketimes = amounttomake; } else if (type.equals("864") && level >= 7) { xp = 25; item = 864; remove = 2349; removeamount = 1; maketimes = amounttomake; } else if (type.equals("1155") && level >= 7) { xp = 25; item = 1155; remove = 2349; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1173") && level >= 8) { xp = 25; item = 1173; remove = 2349; removeamount = 2; maketimes = amounttomake; } else if (type.equals("1337") && level >= 9) { xp = 38; item = 1337; remove = 2349; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1375") && level >= 10) { xp = 38; item = 1375; remove = 2349; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1103") && level >= 11) { xp = 38; item = 1103; remove = 2349; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1189") && level >= 12) { xp = 38; item = 1189; remove = 2349; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1307") && level >= 14) { xp = 38; item = 1307; remove = 2349; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1075") && level >= 16) { xp = 38; item = 1075; remove = 2349; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1087") && level >= 16) { xp = 38; item = 1087; remove = 2349; removeamount = 3; maketimes = amounttomake; } else if (type.equals("1117") && level >= 18) { xp = 63; item = 1117; remove = 2349; removeamount = 5; maketimes = amounttomake; } else { c.sendMessage("You don't have a high enough level to make this Item!"); return; } doaction(c, item, remove, removeamount, maketimes, -1, -1, xp); } public boolean doaction(Client c, int toadd, int toremove, int toremove2, int timestomake, int NOTUSED, int NOTUSED2, int xp) { int maketimes = timestomake; c.getPA().closeAllWindows(); if (c.getItems().playerHasItem(toremove, toremove2)) { c.startAnimation(898); if (maketimes > 1 && c.getItems().playerHasItem(toremove, toremove2 * 2)) { c.sendMessage("You make some " + c.getItems().getItemName(toadd) +"s"); } else { c.sendMessage("You make a " + c.getItems().getItemName(toadd)); } while (maketimes > 0) { if (c.getItems().playerHasItem(toremove, toremove2)) { c.getItems().deleteItem2(toremove, toremove2); if (c.getItems().getItemName(toadd).contains("bolt")) { c.getItems().addItem(toadd, 10); } else if (c.getItems().getItemName(toadd).contains("nail")) { c.getItems().addItem(toadd, 15); } else if (c.getItems().getItemName(toadd).contains("arrow")) { c.getItems().addItem(toadd, 15); } else if (c.getItems().getItemName(toadd).contains("knife")) { c.getItems().addItem(toadd, 5); } else if (c.getItems().getItemName(toadd).contains("cannon")) { c.getItems().addItem(toadd, 4); } else { c.getItems().addItem(toadd, 1); } c.getPA().addSkillXP(xp * Config.SMITHING_EXPERIENCE, 13); c.getPA().refreshSkill(13); maketimes--; } else { break; } } } else { c.sendMessage("You don't have enough bars to make this item!"); return false; } return true; } }
99c484c239241e0eb728e24e8fb5425ac44da976
73c1a2870b57b7287a8ea82e2d62934e5ce238c6
/Pattern3.java
e837bd627a3e42ad37cec70c8b52576ca9a11f9c
[]
no_license
venkatsaiprasad58/pattern-and-basic-modular-progrmas
f319f1d03ba6fe9e1d19aed50ed7cb723a9f7b11
dc755d2c43404b39652fa956fabbc3e8e2e3d453
refs/heads/main
2023-04-12T00:42:45.006429
2021-05-12T04:05:34
2021-05-12T04:05:34
366,586,856
0
0
null
null
null
null
UTF-8
Java
false
false
540
java
package com.ojas.patternPrograms; public class Pattern3 { public static void main(String[] args) { String str = ""; for (int i = 1; i <= 7; i++) { for (int j = 1; j <= i; j++) { str += j + " "; } str += "\r"; } for (int i = 6; i >= 1; i--) { for (int j = 1; j <= i; j++) { str += j + " "; } str += "\r"; } System.out.println(str); } } //Output : // 1 // 1 2 // 1 2 3 // 1 2 3 4 // 1 2 3 4 5 // 1 2 3 4 5 6 // 1 2 3 4 5 6 7 // 1 2 3 4 5 6 // 1 2 3 4 5 // 1 2 3 4 // 1 2 3 // 1 2 // 1
0c21726376e0a33bf9d4024b87bf4009efd22177
2a863e48ae4f01f4b99a64c4f3fad92629fa9df1
/src/main/java/me/wbars/compiler/semantic/models/ArrayTypeNode.java
dbaf79889957532b0919753ff2652a7269cbfcf4
[]
no_license
wbars/compiler
c8ca870a547782b99a09d46947f96c73bedb6964
e7433af32eeb1664aa3e2e70e3e1a1589653657d
refs/heads/master
2021-05-01T08:25:19.021084
2017-04-06T20:09:21
2017-04-06T20:09:21
79,703,541
2
0
null
null
null
null
UTF-8
Java
false
false
2,326
java
package me.wbars.compiler.semantic.models; import me.wbars.compiler.parser.models.Tokens; import me.wbars.compiler.scanner.models.Token; import me.wbars.compiler.scanner.models.TokenFactory; import me.wbars.compiler.semantic.models.types.Type; import me.wbars.compiler.semantic.models.types.TypeRegistry; import java.util.Collection; import java.util.List; import static java.util.Collections.singletonList; import static java.util.stream.Collectors.toList; import static java.util.stream.Stream.of; import static me.wbars.compiler.utils.CollectionsUtils.merge; public class ArrayTypeNode extends CompoundTypeNode { private List<SubrangeTypeNode> indexes; private ASTNode componentType; public ArrayTypeNode(String name, List<SubrangeTypeNode> indexes, ASTNode componentType, boolean packed) { super(name, packed); this.indexes = indexes; this.componentType = componentType; } public ArrayTypeNode(String name, boolean packed) { this(name, null, null, packed); } public void setIndexes(List<SubrangeTypeNode> indexes) { this.indexes = indexes; } public void setComponentType(ASTNode componentType) { this.componentType = componentType; } public ASTNode getComponentType() { return componentType; } @Override protected Type getType(TypeRegistry typeRegistry) { return typeRegistry.processType(this); } @Override protected void replaceChild(int index, ASTNode node) { if (index == 0) componentType = node; else indexes.set(index - 1, (SubrangeTypeNode) node); } @Override public List<ASTNode> children() { return of(singletonList(componentType), indexes) .flatMap(Collection::stream) .collect(toList()); } @Override public List<Token> tokens() { return merge( singletonList(Token.create(Tokens.IDENTIFIER, value)), singletonList(TokenFactory.createRelOp("=")), singletonList(Token.keyword(Tokens.ARRAY)), singletonList(Token.keyword(Tokens.OF)), componentType.tokens(), singletonList(TokenFactory.createSemicolon()) ); } public int size() { return indexes.size(); } }
653a2372281d031cbb11e8dc7d8b82a1745f9085
f07b41266b86a62ee423f8743ef056a9d87ac2f3
/BethaCodeExamples/src/model/AnimalRepository.java
eedf39c1de7d3b6c38d51344baec52e6067ab816
[]
no_license
emanuelmelo87/betha-code
789ed62496d45e6d53d4b95824bf1dd97b9c62e2
a6cf923320087e91287b669737b3a22762a0efa0
refs/heads/main
2023-07-06T22:05:19.172066
2021-08-07T11:36:26
2021-08-07T11:36:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
226
java
package model; public class AnimalRepository { public void findAnimal() { Animal animal = new Animal("toto",0.47,20.1,"pitbull",true,"branco"); animal.setPeso(40.00); animal.getPeso(); } }
de811811fb64a4e62dc18d9b6b69a99b51ffe9d2
6cec98dc39601f8288f62b8cbcd202ca993e8358
/src/main/java/testingil/webinar/testability/ex2/visibility/Adder.java
0cda45741fc82fd0c56e99ee1ac7413aa09a9ea6
[]
no_license
gilzilberfeld/webinar-testability
a3f3820bbc2643ca45e302d45ab3a7c74b8dd6b6
fb90bffff09aa1dcdb91760eea05297d09b341eb
refs/heads/master
2023-05-22T12:47:00.411461
2021-06-09T15:34:19
2021-06-09T15:34:19
325,826,267
1
1
null
null
null
null
UTF-8
Java
false
false
303
java
package testingil.webinar.testability.ex2.visibility; public class Adder { private int temporaryResult=0; public void add(int a, int b) { storeAndAdd(a); storeAndAdd(b); } private void storeAndAdd(int a) { temporaryResult +=a; } public int getResult() { return temporaryResult; } }
afa7618b15f511ef45df8b20d0397b1ace9d441b
842619f475bb91c1ca0d443bae3c6c4b10458b84
/src/main/Java/org/jbpm/jsf/core/handler/SuspendHandler.java
6430bd6396563b80f4cdfb889d7316976de098ab
[]
no_license
rajprins/jbpm-dashboard
ae9faa0d9305792e0778702137a79786e2605cd2
253cc453e188793bcc75f44d3e50960fd68f67fc
refs/heads/master
2016-09-06T09:19:10.163562
2011-06-28T08:54:23
2011-06-28T08:54:23
32,142,864
0
0
null
null
null
null
UTF-8
Java
false
false
1,139
java
package org.jbpm.jsf.core.handler; import org.jboss.gravel.common.annotation.TldAttribute; import org.jboss.gravel.common.annotation.TldTag; import org.jbpm.jsf.JbpmActionListener; import org.jbpm.jsf.core.action.SuspendActionListener; import com.sun.facelets.FaceletContext; import com.sun.facelets.tag.TagAttribute; import com.sun.facelets.tag.TagConfig; /** * */ @TldTag ( name = "suspend", description = "Suspend a running task, token, or process instance.", attributes = { @TldAttribute ( name = "value", description = "The item to suspend.", required = true, deferredType = Object.class ) } ) public final class SuspendHandler extends AbstractHandler { private final TagAttribute valueTagAttribute; public SuspendHandler(final TagConfig config) { super(config); valueTagAttribute = getRequiredAttribute("value"); } protected JbpmActionListener getListener(final FaceletContext ctx) { return new SuspendActionListener( getValueExpression(valueTagAttribute, ctx, Object.class) ); } }
[ "[email protected]@9e6ae388-d4ed-05de-5285-0939cd39b3d6" ]
[email protected]@9e6ae388-d4ed-05de-5285-0939cd39b3d6
1ce7df916c1da55085ed28538dfd8b78773a9c8c
62cb0acf78d786a957b0c61e33a692e3e4a259fd
/src/test/java/hu/akarnokd/rxjava2/internal/operators/nbp/NbpOperatorMapNotificationTest.java
1c10c39f783d093fd4fa57d5069742c003828fdd
[ "Apache-2.0" ]
permissive
josenaves/rxjava2-backport
4ba34e62c0ee620cfc7fcf56a0cc91cfe4f12d81
9cac47e86a9b48b2f021d27e3d0031132b57711e
refs/heads/master
2020-12-24T12:06:01.695465
2016-08-24T13:48:52
2016-08-24T13:48:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,940
java
/** * Copyright 2015 David Karnok and Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See * the License for the specific language governing permissions and limitations under the License. */ package hu.akarnokd.rxjava2.internal.operators.nbp; import org.junit.Test; import hu.akarnokd.rxjava2.NbpObservable; import hu.akarnokd.rxjava2.functions.*; import hu.akarnokd.rxjava2.subscribers.nbp.NbpTestSubscriber; public class NbpOperatorMapNotificationTest { @Test public void testJust() { NbpTestSubscriber<Object> ts = new NbpTestSubscriber<Object>(); NbpObservable.just(1) .flatMap( new Function<Integer, NbpObservable<Object>>() { @Override public NbpObservable<Object> apply(Integer item) { return NbpObservable.just((Object)(item + 1)); } }, new Function<Throwable, NbpObservable<Object>>() { @Override public NbpObservable<Object> apply(Throwable e) { return NbpObservable.error(e); } }, new Supplier<NbpObservable<Object>>() { @Override public NbpObservable<Object> get() { return NbpObservable.never(); } } ).subscribe(ts); ts.assertNoErrors(); ts.assertNotComplete(); ts.assertValue(2); } }
47ab8232f5114c2e843f28bb9128962c2a440fa2
db579f64fde2d538f4bce1681e0d5667e039a4f9
/YiBoLibrary/src/com/cattong/weibo/impl/twitter/ProxyBasicAuth.java
e234ad7624e82d50db5dabf7456b43937074bc55
[ "Apache-2.0" ]
permissive
ax003d/YiBo
dc3a57464e8b6a878d4dc081ecab00a68f8ba23a
b49c25e614926aaf9bb88e33c72db79414c10b82
refs/heads/master
2021-01-18T08:50:15.549797
2013-03-18T09:38:02
2013-03-18T09:38:02
8,870,741
0
1
null
null
null
null
UTF-8
Java
false
false
865
java
package com.cattong.weibo.impl.twitter; import com.cattong.commons.ServiceProvider; import com.cattong.commons.http.auth.Authorization; public class ProxyBasicAuth extends Authorization { /** serialVersionUID */ private static final long serialVersionUID = -7108008646051298533L; private String restApiServer; private String searchApiServer; public ProxyBasicAuth(String authToken, String authSecret, ServiceProvider serviceProvider) { super(serviceProvider, authToken, authSecret); } public String getRestApiServer() { return restApiServer; } public void setRestApiServer(String restApiServer) { this.restApiServer = restApiServer; } public String getSearchApiServer() { return searchApiServer; } public void setSearchApiServer(String searchApiServer) { this.searchApiServer = searchApiServer; } }
[ "cattong@cattong-THINK" ]
cattong@cattong-THINK
f23192c966ce3e1147f7583ad466ca916e77ee76
0ae6312049513c5cab73199ce62701335e5a848b
/app/src/main/java/com/dudencovgmail/news/model/Repository.java
590ca600f3f4bf0d2af3ae9a445cf46b81479208
[]
no_license
AlexanderDudenkov/NEWS
cf81fd21305ac46131120c0e90593dee632b2547
e173d51725e850c6e1669672f51c14c3e5900300
refs/heads/master
2020-03-15T10:41:54.494821
2018-05-08T09:39:42
2018-05-08T09:39:42
132,105,064
0
0
null
null
null
null
UTF-8
Java
false
false
2,589
java
package com.dudencovgmail.news.model; import android.content.Context; import android.widget.ImageView; import com.dudencovgmail.news.model.realm.RealmDB; import com.dudencovgmail.news.model.rest.NetConnection; import java.io.File; import io.reactivex.Observable; import io.realm.RealmList; import io.realm.RealmResults; public class Repository implements RepositoryIF { private NetConnection mNetConnection = new NetConnection(); private LoadPhotoUrl mLoadPhotoUrl = new LoadPhotoUrl(); private RealmDB mRealmDB = new RealmDB(); @Override public Observable<Model> getLatestArticles(int page) { return mNetConnection.getLatestArticles(page); } @Override public Observable<Model> getPopularArticles(int page) { return mNetConnection.getPopularArticles(page); } @Override public Observable<Model> getNewsFor2018(int page) { return mNetConnection.getNews2018Articles(page); } @Override public Observable<Model> getLatestUaArticles(int page) { return mNetConnection.getLatestUaArticles(page); } @Override public Observable<Model> getScienceArticles(int page) { return mNetConnection.getScienceArticles(page); } @Override public RealmList<Article> readFromCash() { return Cash.getInstance().readFromCash(); } @Override public Article readFromCash(int position) { return Cash.getInstance().readFromCash(position); } @Override public void writeToCash(RealmList<Article> articles) { Cash.getInstance().writeToCash(articles); } @Override public void clearCash() { Cash.getInstance().clearCash(); } @Override public void loadPhoto(Context context, ImageView imageView, String url) { mLoadPhotoUrl.loadPhoto(context, imageView, url); } @Override public File getImageFile(Article article) { return mLoadPhotoUrl.getImageFile(article); } @Override public void deleteImageFile(Article article) { mLoadPhotoUrl.deleteImage(article); } @Override public void writeResult(Article result) { mRealmDB.writeResult(result); } @Override public RealmResults<Article> readResuls() { return mRealmDB.readResuls(); } @Override public void deleteResult(int position) { mRealmDB.deleteResult(position); } @Override public void closeDB() { mRealmDB.closeDB(); } }
aaeb78c9965c19cec517d901b2ba39d07aaa36d7
3cd036a374eae6bbfcc7a4fb576a9f8771807fca
/src/main/java/paterns/structyre/bridge/first/bank/account/Account.java
a2482c2655ee17d37fbcb03fe01934a37bf2d598
[]
no_license
YuriiShmorgun/mvc
9dd22d265eb88781569ac17b258e10697ec32ea7
fc74d2881c53d108eb1256130a075d0f66bab839
refs/heads/master
2020-04-23T22:30:22.724988
2019-03-06T15:13:13
2019-03-06T15:13:13
171,504,067
1
0
null
null
null
null
UTF-8
Java
false
false
739
java
package paterns.structyre.bridge.first.bank.account; import paterns.structyre.bridge.first.bank.Action; public abstract class Account { private int id; private double amount; private Action action; protected Account(Action action) { this.action = action; } public Action getAction() { return action; } protected void setAction(Action action) { this.action = action; } public int getId() { return id; } public void setId(int id) { this.id = id; } public double getAmount() { return amount; } public void setAmount(double amount) { this.amount = amount; } public abstract boolean takeSum(double sum); }
3ce8d75e5cef536bc5b73f5327257a0751aa71dc
a5b548432c14df05aa78bcd6b6f47b89fdc38fa8
/src/test/java/com/INF2015/app/Parsing/JSONFileReaderTest.java
902ab672c2f61a4f8f2e934844733bdb24361b06
[]
no_license
tremblayEric/JSONExampleWithMavenAndCobertura
388987b7a62d994319bd70040d86d14428bb038c
b777b4b450e1d4099d4b22c8ade6c9723b75e415
refs/heads/master
2016-09-06T06:33:36.619774
2013-04-21T17:47:15
2013-04-21T17:47:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
693
java
/* Copyright 2013 jpokou pdarveau sayonCisse tremblayEric UQAM hiver 2013 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.INF2015.app.Parsing; public class JSONFileReaderTest { }
d0fbc64137ea6f4c40ca166a7b2463ab63988622
0b43f456a4ca064d0bf7379e3f813a8d4dd4a379
/app/src/test/java/com/example/android/farmer/ExampleUnitTest.java
93ecac126a6851d25996fdb404c51a64bd427be8
[]
no_license
raghuladhitya/farmer
e876c38aac1935e4173582197d7e959e5c8ff586
40cff10cf31e88d4e585c8249011251d896acf45
refs/heads/master
2020-04-22T00:15:09.430894
2019-02-14T12:33:12
2019-02-14T12:33:12
169,972,608
0
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.example.android.farmer; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
041373a4b7618ab2068f06b1506c30a9028cb8e5
a98e2bf2bebedfa8a6e240d15cf8fc8b0debdb73
/Lab4/A4-SemanticAnalysis/src/gen/lang/ast/Opt.java
d5864b7ca2218c188f8776ff9f5117b270c68115
[]
no_license
miquelpuigmena/CompilerSimpliCInJava
9b0e2a93de0b02345d4832c81013984cfe7b494a
674b622e0d225a9ad2222e3362ae90aed850ed2e
refs/heads/master
2020-07-24T02:23:26.719621
2019-10-22T11:00:51
2019-10-22T11:00:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,420
java
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.3.2 */ package lang.ast; import java.util.Set; import java.util.TreeSet; import java.io.PrintStream; import java.util.Optional; import java.util.Iterator; import java.io.ByteArrayOutputStream; import java.lang.reflect.InvocationTargetException; /** * @ast node * @astdecl Opt : ASTNode; * @production Opt : {@link ASTNode}; */ public class Opt<T extends ASTNode> extends ASTNode<T> implements Cloneable { /** * @declaredat ASTNode:1 */ public Opt() { super(); } /** * Initializes the child array to the correct size. * Initializes List and Opt nta children. * @apilevel internal * @ast method * @declaredat ASTNode:10 */ public void init$Children() { } /** * @declaredat ASTNode:12 */ public Opt(T opt) { setChild(opt, 0); } /** @apilevel internal * @declaredat ASTNode:16 */ public void flushAttrCache() { super.flushAttrCache(); } /** @apilevel internal * @declaredat ASTNode:20 */ public void flushCollectionCache() { super.flushCollectionCache(); } /** @apilevel internal * @declaredat ASTNode:24 */ public Opt<T> clone() throws CloneNotSupportedException { Opt node = (Opt) super.clone(); return node; } /** @apilevel internal * @declaredat ASTNode:29 */ public Opt<T> copy() { try { Opt node = (Opt) clone(); node.parent = null; if (children != null) { node.children = (ASTNode[]) children.clone(); } return node; } catch (CloneNotSupportedException e) { throw new Error("Error: clone not supported for " + getClass().getName()); } } /** * Create a deep copy of the AST subtree at this node. * The copy is dangling, i.e. has no parent. * @return dangling copy of the subtree at this node * @apilevel low-level * @deprecated Please use treeCopy or treeCopyNoTransform instead * @declaredat ASTNode:48 */ @Deprecated public Opt<T> fullCopy() { return treeCopyNoTransform(); } /** * Create a deep copy of the AST subtree at this node. * The copy is dangling, i.e. has no parent. * @return dangling copy of the subtree at this node * @apilevel low-level * @declaredat ASTNode:58 */ public Opt<T> treeCopyNoTransform() { Opt tree = (Opt) copy(); if (children != null) { for (int i = 0; i < children.length; ++i) { ASTNode child = (ASTNode) children[i]; if (child != null) { child = child.treeCopyNoTransform(); tree.setChild(child, i); } } } return tree; } /** * Create a deep copy of the AST subtree at this node. * The subtree of this node is traversed to trigger rewrites before copy. * The copy is dangling, i.e. has no parent. * @return dangling copy of the subtree at this node * @apilevel low-level * @declaredat ASTNode:78 */ public Opt<T> treeCopy() { Opt tree = (Opt) copy(); if (children != null) { for (int i = 0; i < children.length; ++i) { ASTNode child = (ASTNode) getChild(i); if (child != null) { child = child.treeCopy(); tree.setChild(child, i); } } } return tree; } /** @apilevel internal * @declaredat ASTNode:92 */ protected boolean is$Equal(ASTNode node) { return super.is$Equal(node); } }
021829f327e010362a1b4f65e67b676b81f5a4e4
112e7dc20a4cc09c3b89e9fe22ee547f369f36ac
/src/main/java/cz/i/pirin/mapper/FactValueMapper.java
8df3dcab8e9a6eeba6577e02be731774c62b845c
[]
no_license
hadasj/pyrin
7ca6d3dee58dcd3af37e185509ea825e0c00e56b
8f5122ca74b1aba608785d55761653dbe993e2be
refs/heads/master
2021-08-31T13:42:22.094206
2017-12-21T14:43:58
2017-12-21T14:43:58
112,621,632
0
0
null
null
null
null
UTF-8
Java
false
false
1,841
java
package cz.i.pirin.mapper; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import cz.i.pirin.entity.db.fact.FactValueDb; import cz.i.pirin.entity.db.fact.ValueDb; import cz.i.pirin.model.entity.dimension.Dimension; import cz.i.pirin.model.entity.dimension.ValueType; import cz.i.pirin.model.entity.fact.FactValue; /** * @author [email protected] */ @Component public class FactValueMapper { @Autowired private DimensionMapper dimensionMapper; public List<FactValue> mapFactValues(List<FactValueDb> factValuesDb) { List<FactValue> factValues = new ArrayList<>(); if (factValuesDb != null) { for (FactValueDb factValueDb : factValuesDb) { factValues.add(mapFactValue(factValueDb)); } } return factValues; } public FactValue mapFactValue(FactValueDb factValueDb) { if (factValueDb == null) return null; String id = factValueDb.getId().toString(); Dimension dimension = dimensionMapper.mapDimension(factValueDb.getDimension()); List<ValueDb> valuesDb = factValueDb.getValues(); boolean first = true; ValueType valueType = null; List<Object> values = new ArrayList<>(); for(ValueDb valueDb : valuesDb) { if (first) { valueType = valueDb.getValueType(); first = false; } else { if (valueDb.getValueType() != valueType) throw new IllegalStateException("Fact value " + factValueDb.getId() + "with different value types!!"); } values.add(valueDb.getValue()); } return new FactValue(id, dimension, valueType, values); } }
a5ac8646b9ba109df1bee04b90bc69baeabe8fad
7bcb476985e26b6c6dd5b459ab9eb83f5b7714fa
/shopping-mall/src/com/nonage/controller/action/LogoutAction.java
259b866f353bb1b52c0f3ff3f436847a62110cd7
[]
no_license
kimeuntea/shopping-mall
6941729a46d563c8b9ec3e57b2efdb848c130008
606808b6314cbc40d7e329667b443b5c31aaf573
refs/heads/master
2021-01-10T20:57:56.349116
2015-05-14T01:38:30
2015-05-14T01:39:51
35,584,124
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
825
java
package com.nonage.controller.action; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import dao.MemberDao; public class LogoutAction implements Action{ @Override public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String url = "NonageServlet?command=index"; HttpSession session = request.getSession(); session.invalidate(); System.out.println("·Î±×¾Æ¿ô"); RequestDispatcher dispatcher = request.getRequestDispatcher(url); dispatcher.forward(request, response); // TODO Auto-generated method stub } }
[ "euntae@Euntea" ]
euntae@Euntea
3814ffe8d0f271a968485632e12234ea5d027f67
30d37df0a81aa9f95f651654e5396807756cc27a
/app/src/main/java/com/example/mary/graduationproject/Adapter/scanItemCityRv2Adapter.java
be9f311e7a7df24e99c94dbd1813f6a301954c7b
[]
no_license
ageniusmary/GraduationProject
df94ee2e2496d3915af583f54f0d2bfc1760fb1e
6e6a8f9c5b62fa8d9366caa52b3ef856b1d6dc61
refs/heads/master
2020-09-15T22:21:59.760563
2019-11-23T10:11:34
2019-11-23T10:11:34
223,568,927
0
0
null
null
null
null
UTF-8
Java
false
false
1,565
java
package com.example.mary.graduationproject.Adapter; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.example.mary.graduationproject.R; /** * 创建时间:2019/3/4 * 作者:Mary * 描述: */ public class scanItemCityRv2Adapter extends RecyclerView.Adapter<scanItemCityRv2Adapter.MyHolderView>{ //当前上下文对象 Context context; @NonNull @Override public MyHolderView onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(context).inflate(R.layout.scan_item_city_rv2_item,parent,false); return new MyHolderView(view); } @Override public void onBindViewHolder(@NonNull MyHolderView holder, int position) { //holder.imageView.setImageResource(); //holder.textView_city.setText(); //holder.textView_money.setText(); } @Override public int getItemCount() { return 0; } class MyHolderView extends RecyclerView.ViewHolder { public ImageView imageView; public TextView textView_city; public TextView textView_money; public MyHolderView(View itemView) { super(itemView); imageView = itemView.findViewById(R.id.scan_item_city_iv2); textView_city = itemView.findViewById(R.id.scan_item_city_tv2); textView_money = itemView.findViewById(R.id.scan_item_city_tv_money); } } }
61dd32f8d7f81716c2ea18b9f8f3ae64453c630b
030595eb8fa9e38414d76bbc519d23f8d20fc3ca
/app/src/main/java/com/example/user/finalexam/Adapter/MyAdapter.java
4912ec8f4cc7cf6581b132c71352b66fe25aa53b
[]
no_license
NguyenHuyHoangCodeGym-C0718L01/VietPro_Android_LastProject
a36e9a77fafc546ab3e4592c42e11915ae67d80a
3e1cb09d1d3b4fdc469d4f0f4e0dc333ce69d665
refs/heads/master
2020-04-18T18:29:06.101264
2019-01-26T12:15:58
2019-01-26T12:15:58
167,685,037
0
0
null
null
null
null
UTF-8
Java
false
false
2,907
java
package com.example.user.finalexam.Adapter; import android.app.Activity; import android.app.FragmentTransaction; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.example.user.finalexam.Fragment.MapsActivity; import com.example.user.finalexam.Object.City; import com.example.user.finalexam.Object.Event; import com.example.user.finalexam.Object.Info; import com.example.user.finalexam.R; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.List; /** * Created by User on 1/20/2018. */ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder>{ private List<Info>listInfo; public MyAdapter(List<Info>listInfo){ this.listInfo=listInfo; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_item_view, parent, false); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(final ViewHolder holder, int position) { final Info info = listInfo.get(position); Picasso.with(holder.imgImage.getContext()).load(info.getImage()).into(holder.imgImage); holder.txtName.setText(info.getName()); holder.txtPrice.setText(info.getPrice()); holder.txtRestaurant.setText(info.getRestaurant()); holder.txtAddress.setText(info.getAddress()); holder.txtAddress.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // android.app.FragmentManager fragmentManager = ((Activity)view.getContext()).getFragmentManager(); } }); } @Override public int getItemCount() { return listInfo.size(); } public static class ViewHolder extends RecyclerView.ViewHolder{ ImageView imgImage; TextView txtName, txtPrice, txtRestaurant, txtAddress; // Button btnMoreInfo; public ViewHolder(View itemView){ super(itemView); // btnMoreInfo=(Button)itemView.findViewById(R.id.btn_more_info); imgImage=(ImageView)itemView.findViewById(R.id.img_image); txtName=(TextView) itemView.findViewById(R.id.txt_name); txtPrice=(TextView)itemView.findViewById(R.id.txt_price); txtRestaurant=(TextView)itemView.findViewById(R.id.txt_restaurant); txtAddress=(TextView)itemView.findViewById(R.id.txt_address); } } }
fa2dfcf986e321cf709b449f462489684e572622
39e8b8798140342183f27f645e3e9d394cf2de1d
/.svn/pristine/55/5563062fa48d70032cff863ca6650afc1dc74f38.svn-base
cbc3c7073c5fec34b68a1899eb80a576d53aba71
[]
no_license
iwulh/study
c92b1f6ac3a8443c4b7571f796eb37b55cdd50f8
77b1f2570bed65db6f165944b66fe9d0c26ab36a
refs/heads/master
2020-04-01T08:53:16.757180
2018-10-15T03:58:38
2018-10-15T03:58:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
871
package com.common.basedb.conn; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.mybatis.spring.SqlSessionTemplate; /** * 基本数据连接 * @author Administrator * */ public interface ConnectionDao { /** * 获得连接 * @return */ public Connection getConnection(SqlSessionTemplate sqlSessionTemplate) throws SQLException; /** * 开始事物 * @param conn */ public void connTransBegin(Connection conn) throws SQLException; /** * 提交事务 * @param conn */ public void connTransComit(Connection conn) throws SQLException; /** * 事务回滚 * @param conn */ public void connTransRollBack(Connection conn) throws SQLException; /** * 关闭连接 */ public void closeSession(Connection conn,PreparedStatement pstmt,ResultSet rs); }
58e33eb15cbe033efb9c471b5de454764da98506
944254ecb2fec30f3714c2dab67fb21f7bcb3a47
/ch15/sec02/HashMapExample.java
0dd0dbed1e0b21e9a5d4079c61d231164136f6d7
[]
no_license
rn0614/java
f05a49bbe053b9f1c9016e9841b18377622def10
485585c344bff8234e0706eafeb2493574f76521
refs/heads/master
2023-03-25T01:22:13.664325
2021-03-23T16:35:34
2021-03-23T16:35:34
349,104,599
0
0
null
null
null
null
UTF-8
Java
false
false
138
java
package ch15.sec02; public class HashMapExample { public static void main(String[] args) { // TODO Auto-generated method stub } }
b8ee2db22d558c035b51edc5cdec67ec20a78641
ae6ff9954c60feb0c15100704669f63e6532d270
/src/main/java/com/firststep/utils/DataStructure.java
7e09fedf3782d9cc0c63729dde19b55b2dc8c3c0
[]
no_license
nagappan080810/FirstStep
be9fbe87e2b61f1d145db6e4c128f0bc3d9545cd
5248fd84549d3853403b16fe9595e15f0fd6d75a
refs/heads/master
2021-01-22T19:30:56.369763
2018-10-17T15:48:22
2018-10-17T15:48:22
42,559,854
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package com.firststep.utils; import java.util.Arrays; public class DataStructure { public static void main(String[] args) { System.out.println("2nd row attr2 value is "+getValueForKey(2, "attr2")); } private static String getValueForKey(int row, String key){ String keysDomain[] = new String[]{"attr1", "attr2", "attr3"}; //if keysDomain is not in the same order, then while adding the value to valuesDomain, //check for the attribute postion and then put the value in that postion //if attr3, then position is 3 so it should be put in valuesDomain. String valuesDomain[][] = new String [][]{{"value11","value12","value13"}, {"value21","value22","value23"}, {"value31","value32","value33"}}; int keyPosition = Arrays.binarySearch(keysDomain, key); return valuesDomain[row-1][keyPosition]; } }
4475698acc097bf95df074c513d5d204e895559a
cc1048c17bfde5cd7a800f847e90dc43c4793384
/FullStackDemo/backend-loanapp-1/src/main/java/com/loanapp/services/CustomUserDetailsService.java
4c7524176085dc6ee9c666525b4c0d0f85bb4df8
[]
no_license
govardhan6495/REFERENCES
d6039913872ac748ea277e79072971048bf33810
270765851f3f6bf89652472dac81cccb2e4ea4ee
refs/heads/main
2023-06-05T02:17:45.732341
2021-06-26T17:53:08
2021-06-26T17:53:08
380,552,862
0
0
null
null
null
null
UTF-8
Java
false
false
1,123
java
package com.loanapp.services; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.loanapp.domain.User; import com.loanapp.repositories.UserRepository; @Service public class CustomUserDetailsService implements UserDetailsService { @Autowired private UserRepository userRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username); if(user==null) new UsernameNotFoundException("User not found"); return user; } @Transactional public User loadUserById(Long id){ User user = userRepository.getById(id); if(user==null) new UsernameNotFoundException("User not found"); return user; } }
12027429b6c4cf1fdf52c3c9e40cf0a0cfe5720b
cbb75ebbee3fb80a5e5ad842b7a4bb4a5a1ec5f5
/com/jd/fridge/widget/EmptyLayout.java
990d6a090f6b2176349fb93b0262ddec5c0afe49
[]
no_license
killbus/jd_decompile
9cc676b4be9c0415b895e4c0cf1823e0a119dcef
50c521ce6a2c71c37696e5c131ec2e03661417cc
refs/heads/master
2022-01-13T03:27:02.492579
2018-05-14T11:21:30
2018-05-14T11:21:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,602
java
package com.jd.fridge.widget; import android.content.Context; import android.content.Intent; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; import android.widget.FrameLayout; import android.widget.FrameLayout.LayoutParams; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.jd.fridge.R; import com.jd.fridge.base.NoNetworkActivity; import com.jd.fridge.util.t; /* compiled from: TbsSdkJava */ public class EmptyLayout extends FrameLayout { public ImageView a; private ProgressBar b; private final Context c; private int d; private String e = ""; private TextView f; private TextView g; private View h; private View i; private View j; private TextView k; private ImageView l; private t m; public EmptyLayout(Context context) { super(context); this.c = context; b(); } public EmptyLayout(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.c = context; b(); } private void b() { this.m = new t(this.c); View inflate = View.inflate(this.c, R.layout.view_error_layout, null); this.a = (ImageView) inflate.findViewById(R.id.img_error_layout); this.f = (TextView) inflate.findViewById(R.id.tv_error_layout); this.g = (TextView) inflate.findViewById(R.id.refrush_btn); this.b = (ProgressBar) inflate.findViewById(R.id.animProgress); this.h = inflate.findViewById(R.id.layout_error); this.i = inflate.findViewById(R.id.layout_unbind); this.j = inflate.findViewById(R.id.layout_float); this.k = (TextView) inflate.findViewById(R.id.tv_float_error_layout); this.l = (ImageView) inflate.findViewById(R.id.iv_float_error_arrow); this.j.setOnClickListener(new OnClickListener(this) { final /* synthetic */ EmptyLayout a; { this.a = r1; } public void onClick(View view) { this.a.c.startActivity(new Intent(this.a.c, NoNetworkActivity.class)); } }); addView(inflate, new LayoutParams(-1, -1)); } public int getErrorState() { return this.d; } public void setErrorImg(int i) { try { this.a.setImageResource(i); } catch (Exception e) { } } public void setRefresh(OnClickListener onClickListener) { if (onClickListener != null) { this.g.setOnClickListener(onClickListener); } } public void setErrorType(int i) { switch (i) { case 1: this.d = 1; setVisibility(0); this.h.setVisibility(0); this.i.setVisibility(8); this.j.setVisibility(8); this.f.setVisibility(0); this.f.setText(R.string.error_view_app_offline_error); this.a.setVisibility(0); this.a.setImageResource(R.drawable.ic_no_wifi); this.b.setVisibility(8); this.g.setVisibility(0); return; case 2: this.d = 2; setVisibility(0); this.h.setVisibility(0); this.i.setVisibility(8); this.j.setVisibility(8); this.f.setVisibility(8); this.a.setVisibility(8); this.b.setVisibility(0); this.g.setVisibility(8); return; case 3: this.d = 3; setVisibility(0); this.h.setVisibility(0); this.i.setVisibility(8); this.j.setVisibility(8); this.a.setVisibility(8); this.b.setVisibility(8); this.f.setVisibility(0); a(); this.g.setVisibility(8); return; case 4: setVisibility(8); this.b.setVisibility(8); return; case 7: this.d = 7; setVisibility(0); this.h.setVisibility(8); this.i.setVisibility(8); this.j.setVisibility(0); this.k.setText(getResources().getString(R.string.error_view_pad_offline_error)); this.l.setVisibility(8); this.j.setEnabled(false); return; case 8: this.d = 8; setVisibility(0); this.h.setVisibility(0); this.i.setVisibility(8); this.j.setVisibility(8); this.f.setVisibility(0); this.f.setText(R.string.error_view_service_error); this.a.setVisibility(0); this.a.setImageResource(R.drawable.ic_server_error); this.b.setVisibility(8); this.g.setVisibility(8); return; case 9: this.d = 9; setVisibility(0); this.h.setVisibility(8); this.i.setVisibility(0); this.j.setVisibility(8); return; case 10: this.d = 10; setVisibility(0); this.h.setVisibility(8); this.i.setVisibility(8); this.j.setVisibility(0); this.k.setText(getResources().getString(R.string.error_view_service_float_error)); this.l.setVisibility(8); this.j.setEnabled(false); return; case 11: this.d = 11; setVisibility(8); this.h.setVisibility(8); this.i.setVisibility(8); this.j.setVisibility(8); this.k.setText(getResources().getString(R.string.error_view_app_offline_float_error)); this.l.setVisibility(0); this.j.setEnabled(true); return; default: return; } } public void setNoDataContent(String str) { this.e = str; } public void a() { if (this.e.equals("")) { this.f.setText(R.string.error_view_no_data); } else { this.f.setText(this.e); } } public void setVisibility(int i) { if (i == 8) { this.d = 4; } super.setVisibility(i); } }
8ebf1b16217db237e03de2b74102dec4fb9e79f0
245b16b9995266a813cd265b14ff4e36a4ff32a0
/src/com/etc/frame/ShowAdminFrame.java
585282dda00eea2fe5aeb10c5055eb62af3e5d43
[]
no_license
usadu/music
a730c9b292ecc5ca1c3c02ebb8d9f115090fc273
59393f56479c36e30006945642ccab37946f0255
refs/heads/master
2020-04-26T15:36:05.010954
2019-03-04T01:26:27
2019-03-04T01:26:27
null
0
0
null
null
null
null
GB18030
Java
false
false
3,412
java
package com.etc.frame; import java.awt.EventQueue; import javax.swing.JFrame; import com.etc.entity.Admin; import javax.swing.JLabel; import javax.swing.JPanel; import java.awt.Font; import java.awt.Color; import javax.swing.ImageIcon; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.event.AncestorListener; import javax.swing.event.AncestorEvent; public class ShowAdminFrame extends JFrame { /** * 把管理员登录成功后的一个admin传进来 */ // 定义图片 private ImageIcon bgImg = new ImageIcon(this.getClass().getResource("/image/Login.png")); private JLabel imgLabel = new JLabel(bgImg); /** * Launch the application. */ /*public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { ShowAdminthis window = new ShowAdminthis(); window.this.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }*/ /** * Create the application. */ public ShowAdminFrame(Admin admin) { initialize(admin); } /** * Initialize the contents of the this. */ private void initialize(Admin admin) { this.getContentPane().setBackground(Color.WHITE); this.getContentPane().setForeground(Color.BLACK); this.setBounds(100, 100, 366, 640); this.setDefaultCloseOperation(this.EXIT_ON_CLOSE); this.getRootPane().setWindowDecorationStyle(0);//关闭的样式没有,所以不能关闭 // 将Jthis上自带的面板设置为透明,否则背景图片不会显示出来 ((JPanel) getContentPane()).setOpaque(false); JLabel imgLabel = new JLabel(bgImg); this.getLayeredPane().add(imgLabel, new Integer(Integer.MIN_VALUE)); imgLabel.setBounds(0, 0, bgImg.getIconWidth(), bgImg.getIconHeight()); this.setLocationRelativeTo(null); this.getContentPane().setLayout(null); this.setLocationRelativeTo(null); JLabel label = new JLabel(admin.getAdmin_name()); label.setBounds(137, 80, 97, 50); label.setFont(new Font("宋体", Font.BOLD, 16)); this.getContentPane().add(label); /** * 进入管理歌曲界面 */ JButton button = new JButton("\u8FDB\u5165\u6B4C\u66F2\u7BA1\u7406\u754C\u9762"); button.setBounds(88, 161, 176, 70); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ShowMusic showMusic=new ShowMusic(); } }); button.setFont(new Font("宋体", Font.BOLD, 13)); button.setBackground(Color.WHITE); this.getContentPane().add(button); /** * 进入用户管理界面 */ JButton btnNewButton = new JButton("\u8FDB\u5165\u7528\u6237\u7BA1\u7406\u754C\u9762"); btnNewButton.setBounds(88, 293, 176, 70); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ShowUserFrame showUserthis=new ShowUserFrame(); } }); btnNewButton.setBackground(Color.WHITE); btnNewButton.setFont(new Font("宋体", Font.BOLD, 13)); this.getContentPane().add(btnNewButton); // JLabel lblNewLabel = new JLabel("New label"); // lblNewLabel.setIcon(new ImageIcon("C:\\Users\\Administrator\\Desktop\\Login.png")); // lblNewLabel.setBounds(0, 0, 350, 597); // this.getContentPane().add(lblNewLabel); this.setVisible(true); } }
aa9a2f5dc52e8b9d2fa2bbe5c371172ab2c4f3d4
21671a486ffb80e217de3270bf9e6d8b880d2f03
/smile_android/src/com/holding/smile/protocol/PCartItemDetail.java
410661519e535dbb072ecca30cf59015fd7e69be
[]
no_license
rememberlostcode/flyhz
ff4904fe5c8d80a89b41a1cd995abff47a8d94ab
9602028cd1af9b9e56c8a396034702e014fa7652
refs/heads/master
2020-04-02T12:22:27.069231
2015-07-16T23:17:25
2015-07-16T23:17:25
18,166,238
1
1
null
null
null
null
UTF-8
Java
false
false
348
java
package com.holding.smile.protocol; import com.holding.smile.entity.CartItem; /** * 类说明:订单信息 * * @author robin 2014-4-22下午3:26:09 * */ public class PCartItemDetail extends PBase { private CartItem data; public CartItem getData() { return data; } public void setData(CartItem data) { this.data = data; } }
b035d525b303f018a1aa3e3cb92c7397f374023b
d60e8f6f62699a4a0828563ce72dbe439335202c
/src/main/java/ru/prolog/util/io/ErrorListener.java
8c5e708f7c52583c9e201b1cda42aeffdeec138d
[]
no_license
FalaleevMaxim/Prolog
12f950f693386b46bf415a82d556f4ff79f7bbec
cade77b90cb7a1bfb56b20eb514ad72288736998
refs/heads/master
2021-06-26T07:58:14.930858
2020-06-22T08:01:50
2020-06-22T08:01:50
133,159,535
1
1
null
2020-10-13T09:17:36
2018-05-12T15:40:00
Java
UTF-8
Java
false
false
257
java
package ru.prolog.util.io; import ru.prolog.etc.exceptions.runtime.PrologRuntimeException; public interface ErrorListener extends OutputDevice { void prologRuntimeException (PrologRuntimeException e); void runtimeException (RuntimeException e); }
042858966cc62df7efd44b0c8f9b2e52a4af9d6f
1d6a46cda434d101248cffce0783115ec3c037a3
/src/test/java/com/tinsa/poc/proxy/MensajeTest.java
80e73cd31d4d96aca31ebe87cd8f957d48a3917a
[]
no_license
epriscogfi/TINSA_POC
d419fc5d265bac712dc0ee590ca1adf9ca864a3e
5313a8d732da01ced5d38936ed238a071649652c
refs/heads/master
2021-01-25T11:15:53.174584
2017-06-14T14:15:30
2017-06-14T14:15:30
93,921,233
0
0
null
null
null
null
UTF-8
Java
false
false
1,421
java
package com.tinsa.poc.proxy; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Before; import org.junit.Test; import com.tinsa.poc.utils.Constantes; public class MensajeTest { Mensaje mensaje; @Before public void SetUp(){ mensaje = new Mensaje(Constantes.DESTINO, Constantes.TIPO_ENVIO, Constantes.MENSAJE); } @Test public void givenNotificacionObjectWhenCallGettersThenReturnItsProperties(){ //GIVEN Mensaje mensajeTest = mensaje; //WHEN String destino = mensajeTest.getDestino(); String tipoEnvio = mensajeTest.getTipoEnvio(); String mensaje = mensajeTest.getMensaje(); //THEN assertThat(destino.equals(Constantes.DESTINO)); assertThat(tipoEnvio.equals(Constantes.TIPO_ENVIO)); assertThat(mensaje.equals(Constantes.MENSAJE)); } @Test public void givenNotificacionObjectWhenSetValuesToItsPropertiesThenGettersReturnSameValues(){ //GIVEN Mensaje mensajeTest = mensaje; //WHEN mensajeTest.setDestino(Constantes.OTRO_DESTINO); mensajeTest.setMensaje(Constantes.OTRO_MENSAJE); mensajeTest.setTipoEnvio(Constantes.TIPO_ENVIO); //THEN assertThat(mensajeTest.getDestino().equals(Constantes.OTRO_DESTINO)); assertThat(mensajeTest.getMensaje().equals(Constantes.OTRO_MENSAJE)); assertThat(mensajeTest.getTipoEnvio().equals(Constantes.OTRO_TIPO_ENVIO)); } }
d0ad13dbc01f5958d719737e4263a270bc01d344
46e11c2bd7fe2642d57143fce2de5c16618338fe
/StreamTP/src/module-info.java
b4ddd1ac8b4e7198435c55d783a200a103234a69
[]
no_license
brahamax/livrable
8eebe81a0ae57404628de33997f0a7c44ea92cdb
bc19c5530c644483ad11d27b28d4b89afb7b4a77
refs/heads/master
2021-05-16T22:54:48.036609
2020-03-27T10:29:51
2020-03-27T10:29:51
250,504,213
0
0
null
null
null
null
UTF-8
Java
false
false
23
java
module StreamTP { }
2dc77c7818b029ba6b696ca0b5ee7fa15dbb8172
bcba593f9f3e6b41e0803dd7145e093574a4449f
/x-mail/src/com/net/client/TextViewer.java
a294246aa61a6dd5efc85a14d0a9d33b865b49d0
[]
no_license
xuanj/x-test
08e95516b1c813e7fff9ea72d0945ae97592d4c2
121b6dbaaaa57ee15bf73318c5912338bc55b5e5
refs/heads/master
2021-01-17T19:17:46.399090
2018-01-08T14:13:49
2018-01-08T14:13:49
60,441,498
0
0
null
null
null
null
UTF-8
Java
false
false
3,256
java
package com.net.client; /* * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Oracle nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.awt.*; import java.io.*; import java.beans.*; import javax.activation.*; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JScrollPane; /** * A very simple TextViewer Bean for the MIMEType "text/plain" * * @author Christopher Cotton */ public class TextViewer extends JPanel implements CommandObject { private JTextArea text_area = null; private DataHandler dh = null; private String verb = null; /** * Constructor */ public TextViewer() { super(new GridLayout(1,1)); // create the text area text_area = new JTextArea(); text_area.setEditable(false); text_area.setLineWrap(true); // create a scroll pane for the JTextArea JScrollPane sp = new JScrollPane(); sp.setPreferredSize(new Dimension(300, 300)); sp.getViewport().add(text_area); add(sp); } public void setCommandContext(String verb, DataHandler dh) throws IOException { this.verb = verb; this.dh = dh; this.setInputStream( dh.getInputStream() ); } /** * set the data stream, component to assume it is ready to * be read. */ public void setInputStream(InputStream ins) { int bytes_read = 0; // check that we can actually read ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte data[] = new byte[1024]; try { while((bytes_read = ins.read(data)) >0) baos.write(data, 0, bytes_read); ins.close(); } catch(Exception e) { e.printStackTrace(); } // convert the buffer into a string // place in the text area text_area.setText(baos.toString()); } }
534bb6b16280b30766d63a47c2da4daa3b9d9ff2
3f4cbe3cc5fb8b4bad9e6d4f2921d9e5620e18de
/src/main/java/springbootstart/service/ProductofferServiceImpl.java
61d05ed443c4eb42c570750569b7833ce8c4a688
[]
no_license
codesweetcat/SpringBootCRUD
28e35544bcdf42c90ae7c02174ff113475349b02
df499cb3e68e76a0a15eda1b67014fb10ac10264
refs/heads/master
2021-05-12T08:11:37.118820
2018-01-27T10:58:04
2018-01-27T10:58:04
117,270,465
0
0
null
null
null
null
UTF-8
Java
false
false
1,449
java
package springbootstart.service; import springbootstart.model.Product; import springbootstart.repository.ProductRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; @Component @Service public class ProductofferServiceImpl implements ProductofferService { @Autowired private ProductRepository PIR; @Override public Product findOne(Long id) { Product productby_id = PIR.findOne(id); return productby_id; } @Override public Product update(Product iproduct) { //find a project Product updatedProject = findOne(iproduct.getProduct_id()); if (updatedProject == null) { return null; } //5 properties updatedProject.setProduct_name(iproduct.getProduct_name()); updatedProject.setPricePerSingle(iproduct.getPricePerSingle()); updatedProject.setQuality(iproduct.getQuality()); updatedProject.setQuality(iproduct.getQuality()); updatedProject.setTotalPrice(iproduct.getTotalPrice()); Product updatedProduct = PIR.save(updatedProject); return updatedProduct; } @Override public Product saveProduct(Product iproduct) { return PIR.save(iproduct); } @Override public void removeProject(Product iproduct){ PIR.delete(iproduct); } }
1da5b0e7100d1f7d32eba8790fcf49dbba59b17d
fc0545fbd5998d96d9ef9b57d472238617ca85f3
/src/main/java/opennlp/tools/similarity/apps/RelatedSentenceFinder.java
619c0f90d160430857241d88cb54d24534b215a9
[ "Apache-2.0" ]
permissive
bgalitsky/syntmatcher
43d183e930cf99fb955eebf8f470dc5c799f0cf2
6e6d780e44aa9c573bbb2c429bf4f8cf651103dc
refs/heads/master
2021-01-23T08:15:30.089613
2011-09-29T19:07:31
2011-09-29T19:07:31
2,470,148
1
0
null
null
null
null
UTF-8
Java
false
false
19,542
java
package opennlp.tools.similarity.apps; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import opennlp.tools.parser.Parse; import opennlp.tools.similarity.apps.utils.PageFetcher; import opennlp.tools.similarity.apps.utils.StringDistanceMeasurer; import opennlp.tools.similarity.apps.utils.Utils; import opennlp.tools.textsimilarity.LemmaPair; import opennlp.tools.textsimilarity.ParseTreeChunk; import opennlp.tools.textsimilarity.ParseTreeChunkListScorer; import opennlp.tools.textsimilarity.SentencePairMatchResult; import opennlp.tools.textsimilarity.SyntMatcher; import org.apache.commons.lang.StringUtils; import org.slf4j.LoggerFactory; public class RelatedSentenceFinder { // TODO outsource the timeout value PageFetcher pFetcher = new PageFetcher(); private ParseTreeChunkListScorer parseTreeChunkListScorer = new ParseTreeChunkListScorer(); private ParseTreeChunk parseTreeChunk = new ParseTreeChunk(); private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(RelatedSentenceFinder.class); static StringDistanceMeasurer STRING_DISTANCE_MEASURER = new StringDistanceMeasurer(); // used to indicate that a sentence is an opinion, so more appropriate static List<String> MENTAL_VERBS = new ArrayList<String>(Arrays.asList(new String[] { "want", "know", "believe", "appeal", "ask", "accept", "agree", "allow", "appeal", "ask", "assume", "believe", "check", "confirm", "convince", "deny", "disagree", "explain", "ignore", "inform", "remind", "request", "suggest", "suppose", "think", "threaten", "try", "understand" })); private static final int MAX_FRAGMENT_SENTS = 10; public RelatedSentenceFinder() { } public List<HitBase> findRelatedOpinionsForSentenceFastAndDummy(String word, List<String> sents) throws Exception { YahooQueryRunner yrunner = new YahooQueryRunner(); List<HitBase> searchResult = yrunner.runSearch(word); return searchResult; } public List<HitBase> findRelatedOpinionsForSentence(String sentence, List<String> sents) throws Exception { List<HitBase> opinionSentencesToAdd = new ArrayList<HitBase>(); System.out.println(" \n\n=== Sentence = " + sentence); List<String> nounPhraseQueries = buildSearchEngineQueryFromSentence(sentence); YahooQueryRunner yrunner = new YahooQueryRunner(); for (String query : nounPhraseQueries) { System.out.println("\nquery = " + query); // query += " "+join(MENTAL_VERBS, " OR ") ; List<HitBase> searchResult = yrunner.runSearch(query); if (searchResult != null) { for (HitBase item : searchResult) { // got some text from .html if (item.getAbstractText() != null && !(item.getUrl().indexOf(".pdf") > 0)) { // exclude // pdf opinionSentencesToAdd.add(augmentWithMinedSentencesAndVerifyRelevance(item, sentence, sents)); } } } } opinionSentencesToAdd = removeDuplicatesFromResultantHits(opinionSentencesToAdd); return opinionSentencesToAdd; } /* * Main content generation function which takes a seed as a rock group name and produce a list of text fragments by * web mining for this rock group (or other similar entity). */ public List<HitBase> findActivityDetailsForEventGroupName(String sentence) throws Exception { List<HitBase> opinionSentencesToAdd = new ArrayList<HitBase>(); System.out.println(" \n=== Entity to write about = " + sentence); List<String> nounPhraseQueries = new ArrayList<String>(); String[] frequentPerformingVerbs = { " born raised meet learn ", " graduated enter discover", " facts inventions life ", "accomplishments childhood timeline", " acquire befriend encounter", " achieve reache describe ", " invent innovate improve ", " impress outstanding award", " curous sceptical pessimistic", " spend enroll assume point", " explain discuss dispute", " learn teach study investigate", " propose suggest indicate", " pioneer explorer discoverer ", " advance promote lead", " direct control simulate ", " guide lead assist ", " inspire first initial", " vision predict foresee", " prediction inspiration achievement", " approve agree confirm", " deny argue disagree", " emotional loud imagination", " release announce celebrate discover", "introduce enjoy follow", " open present show", "meet enjoy follow create", "discover continue produce" }; nounPhraseQueries.add(sentence + frequentPerformingVerbs); YahooQueryRunner yrunner = new YahooQueryRunner(); for (String verbAddition : frequentPerformingVerbs) { List<HitBase> searchResult = yrunner.runSearch(sentence + " " + verbAddition); if (searchResult != null) { for (HitBase item : searchResult) { // got some text from .html if (item.getAbstractText() != null && !(item.getUrl().indexOf(".pdf") > 0)) { // exclude pdf opinionSentencesToAdd.add(augmentWithMinedSentencesAndVerifyRelevance(item, sentence, null)); } } } } opinionSentencesToAdd = removeDuplicatesFromResultantHits(opinionSentencesToAdd); return opinionSentencesToAdd; } public static List<String> buildSearchEngineQueryFromSentence(String sentence) { ParseTreeChunk matcher = new ParseTreeChunk(); SyntMatcher pos = SyntMatcher.getInstance(); List<List<ParseTreeChunk>> sent1GrpLst = null; List<LemmaPair> origChunks1 = new ArrayList<LemmaPair>(); String[] sents1 = pos.getSentenceDetectorME().sentDetect(sentence); for (String s1 : sents1) { Parse[] parses1 = pos.parseLine(s1, pos.getParser(), 1); origChunks1.addAll(pos.getAllPhrasesTWPairs(parses1[0])); } List<ParseTreeChunk> chunk1List = matcher.buildChunks(origChunks1); sent1GrpLst = matcher.groupChunksAsParses(chunk1List); // System.out.println(origChunks1); // System.out.println("=== Grouped chunks 1 "+ sent1GrpLst.get(0)); List<ParseTreeChunk> nPhrases = sent1GrpLst.get(0); List<String> queryArrayStr = new ArrayList<String>(); for (ParseTreeChunk ch : nPhrases) { String query = ""; int size = ch.getLemmas().size(); for (int i = 0; i < size; i++) { if (ch.getPOSs().get(i).startsWith("N") || ch.getPOSs().get(i).startsWith("J")) { query += ch.getLemmas().get(i) + " "; } } query = query.trim(); int len = query.split(" ").length; if (len < 2 || len > 5) continue; if (len < 4) { // every word should start with capital String[] qs = query.split(" "); boolean bAccept = true; for (String w : qs) { if (w.toLowerCase().equals(w)) // idf only two words then // has to be person name, // title or geo location bAccept = false; } if (!bAccept) continue; } query = query.trim().replace(" ", " +"); query = " +" + query; queryArrayStr.add(query); } if (queryArrayStr.size() < 1) { // release constraints on NP down to 2 // keywords for (ParseTreeChunk ch : nPhrases) { String query = ""; int size = ch.getLemmas().size(); for (int i = 0; i < size; i++) { if (ch.getPOSs().get(i).startsWith("N") || ch.getPOSs().get(i).startsWith("J")) { query += ch.getLemmas().get(i) + " "; } } query = query.trim(); int len = query.split(" ").length; if (len < 2) continue; query = query.trim().replace(" ", " +"); query = " +" + query; queryArrayStr.add(query); } } queryArrayStr = removeDuplicatesFromQueries(queryArrayStr); queryArrayStr.add(sentence); return queryArrayStr; } // remove dupes from queries to easy cleaning dupes and repetitive search // afterwards public static List<String> removeDuplicatesFromQueries(List<String> hits) { StringDistanceMeasurer meas = new StringDistanceMeasurer(); double dupeThresh = 0.8; // if more similar, then considered dupes was // 0.7 List<Integer> idsToRemove = new ArrayList<Integer>(); List<String> hitsDedup = new ArrayList<String>(); try { for (int i = 0; i < hits.size(); i++) for (int j = i + 1; j < hits.size(); j++) { String title1 = hits.get(i); String title2 = hits.get(j); if (StringUtils.isEmpty(title1) || StringUtils.isEmpty(title2)) continue; if (meas.measureStringDistance(title1, title2) > dupeThresh) { idsToRemove.add(j); // dupes found, later list member to // be deleted } } for (int i = 0; i < hits.size(); i++) if (!idsToRemove.contains(i)) hitsDedup.add(hits.get(i)); if (hitsDedup.size() < hits.size()) { LOG.debug("Removed duplicates from formed query, including " + hits.get(idsToRemove.get(0))); } } catch (Exception e) { LOG.error("Problem removing duplicates from query list"); } return hitsDedup; } public static List<HitBase> removeDuplicatesFromResultantHits(List<HitBase> hits) { StringDistanceMeasurer meas = new StringDistanceMeasurer(); double dupeThresh = 0.8; // if more similar, then considered dupes was // 0.7 List<Integer> idsToRemove = new ArrayList<Integer>(); List<HitBase> hitsDedup = new ArrayList<HitBase>(); try { for (int i = 0; i < hits.size(); i++) for (int j = i + 1; j < hits.size(); j++) { String title1 = hits.get(i).toString(); String title2 = hits.get(j).toString(); if (StringUtils.isEmpty(title1) || StringUtils.isEmpty(title2)) continue; if (meas.measureStringDistance(title1, title2) > dupeThresh) { idsToRemove.add(j); // dupes found, later list member to // be deleted } } for (int i = 0; i < hits.size(); i++) if (!idsToRemove.contains(i)) hitsDedup.add(hits.get(i)); if (hitsDedup.size() < hits.size()) { LOG.debug("Removed duplicates from formed query, including " + hits.get(idsToRemove.get(0))); } } catch (Exception e) { LOG.error("Problem removing duplicates from query list"); } return hitsDedup; } public HitBase augmentWithMinedSentencesAndVerifyRelevance(HitBase item, String originalSentence, List<String> sentsAll) { if (sentsAll == null) sentsAll = new ArrayList<String>(); // put orig sentence in structure List<String> origs = new ArrayList<String>(); origs.add(originalSentence); item.setOriginalSentences(origs); String title = item.getTitle().replace("<b>", " ").replace("</b>", " ").replace(" ", " ").replace(" ", " "); // generation results for this sentence List<Fragment> result = new ArrayList<Fragment>(); // form plain text from snippet String snapshot = item.getAbstractText().replace("<b>", " ").replace("</b>", " ").replace(" ", " ") .replace(" ", " "); SyntMatcher sm = SyntMatcher.getInstance(); // fix a template expression which can be substituted by original if // relevant String snapshotMarked = snapshot.replace("...", " _should_find_orig_ ."); String[] fragments = sm.getSentenceDetectorME().sentDetect(snapshotMarked); List<String> allFragms = new ArrayList<String>(); allFragms.addAll(Arrays.asList(fragments)); String[] sents = null; String downloadedPage; try { if (snapshotMarked.length() != snapshot.length()) { downloadedPage = pFetcher.fetchPage(item.getUrl()); if (downloadedPage != null && downloadedPage.length() > 100) { item.setPageContent(downloadedPage); String pageContent = Utils.fullStripHTML(item.getPageContent()); pageContent = pageContent.trim().replaceAll(" [A-Z]", ". $0")// .replace(" ", ". ") .replace("..", ".").replace(". . .", " ").trim(); // sometimes html breaks are converted into // ' ' (two spaces), so we need to put '.' sents = sm.getSentenceDetectorME().sentDetect(pageContent); sents = cleanListOfSents(sents); } } } catch (Exception e) { // TODO Auto-generated catch block // e.printStackTrace(); System.err.println("Problem downloading the page and splitting into sentences"); return item; } for (String fragment : allFragms) { String followSent = null; if (fragment.length() < 50) continue; String pageSentence = ""; // try to find original sentence from webpage if (fragment.indexOf("_should_find_orig_") > -1 && sents != null && sents.length > 0) try { String[] mainAndFollowSent = getFullOriginalSentenceFromWebpageBySnippetFragment( fragment.replace("_should_find_orig_", ""), sents); pageSentence = mainAndFollowSent[0]; followSent = mainAndFollowSent[1]; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } else // or get original snippet pageSentence = fragment; if (pageSentence != null) pageSentence.replace("_should_find_orig_", ""); // resultant sentence SHOULD NOT be longer than twice the size of // snippet fragment if (pageSentence != null && (float) pageSentence.length() / (float) fragment.length() < 4.0) { // was 2.0, but since snippet sentences are rather short now... try { // get score from syntactic match between sentence in // original text and mined sentence double measScore = 0.0, syntScore = 0.0, mentalScore = 0.0; SentencePairMatchResult matchRes = sm.assessRelevance(pageSentence + " " + title, originalSentence); List<List<ParseTreeChunk>> match = matchRes.getMatchResult(); if (!matchRes.isVerbExists() || matchRes.isImperativeVerb()) { System.out.println("Rejected Sentence : No verb OR Yes imperative verb :" + pageSentence); continue; } syntScore = parseTreeChunkListScorer.getParseTreeChunkListScore(match); System.out.println(parseTreeChunk.listToString(match) + " " + syntScore + "\n pre-processed sent = '" + pageSentence); if (syntScore < 1.5) { // trying other sents for (String currSent : sentsAll) { if (currSent.startsWith(originalSentence)) continue; match = sm.matchOrigSentencesCache(currSent, pageSentence); double syntScoreCurr = parseTreeChunkListScorer.getParseTreeChunkListScore(match); if (syntScoreCurr > syntScore) { syntScore = syntScoreCurr; } } if (syntScore > 1.5) { System.out.println("Got match with other sent: " + parseTreeChunk.listToString(match) + " " + syntScore); } } measScore = STRING_DISTANCE_MEASURER.measureStringDistance(originalSentence, pageSentence); // now possibly increase score by finding mental verbs // indicating opinions for (String s : MENTAL_VERBS) { if (pageSentence.indexOf(s) > -1) { mentalScore += 0.3; break; } } if ((syntScore > 1.5 || measScore > 0.5 || mentalScore > 0.5) && measScore < 0.8 && pageSentence.length() > 70) // >40 { String pageSentenceProc = GeneratedSentenceProcessor.acceptableMinedSentence(pageSentence); if (pageSentenceProc != null) { pageSentenceProc = GeneratedSentenceProcessor.processSentence(pageSentenceProc); if (followSent != null) { pageSentenceProc += " " + GeneratedSentenceProcessor.processSentence(followSent); } pageSentenceProc = Utils.convertToASCII(pageSentenceProc); Fragment f = new Fragment(pageSentenceProc, syntScore + measScore + mentalScore + (double) pageSentenceProc.length() / (double) 50); f.setSourceURL(item.getUrl()); f.fragment = fragment; result.add(f); System.out.println("Accepted sentence: " + pageSentenceProc + "| with title= " + title); System.out.println("For fragment = " + fragment); } else System.out.println("Rejected sentence due to wrong area at webpage: " + pageSentence); } else System.out.println("Rejected sentence due to low score: " + pageSentence); // } } catch (Throwable t) { System.out.println("exception " + t); } } } item.setFragments(result); return item; } public static String[] cleanListOfSents(String[] sents) { List<String> sentsClean = new ArrayList<String>(); for (String s : sents) { if (s == null || s.trim().length() < 30 || s.length() < 20) continue; sentsClean.add(s); } return (String[]) sentsClean.toArray(new String[0]); } // given a fragment from snippet, finds an original sentence at a webpage by optimizing alignmemt score public static String[] getFullOriginalSentenceFromWebpageBySnippetFragment(String fragment, String[] sents) { if (fragment.trim().length() < 15) return null; StringDistanceMeasurer meas = new StringDistanceMeasurer(); Double dist = 0.0; String result = null, followSent = null; for (int i = 0; i < sents.length; i++) { String s = sents[i]; if (s == null || s.length() < 30) continue; Double distCurr = meas.measureStringDistance(s, fragment); if (distCurr > dist && distCurr > 0.4) { result = s; dist = distCurr; if (i < sents.length - 1 && sents[i + 1].length() > 60) { followSent = sents[i + 1]; } } } return new String[] { result, followSent }; } // given a fragment from snippet, finds an original sentence at a webpage by optimizing alignmemt score public static String[] getBestFullOriginalSentenceFromWebpageBySnippetFragment(String fragment, String[] sents) { if (fragment.trim().length() < 15) return null; int bestSentIndex = -1; StringDistanceMeasurer meas = new StringDistanceMeasurer(); Double distBest = 10.0; // + sup String result = null, followSent = null; for (int i = 0; i < sents.length; i++) { String s = sents[i]; if (s == null || s.length() < 30) continue; Double distCurr = meas.measureStringDistance(s, fragment); if (distCurr > distBest) { distBest = distCurr; bestSentIndex = i; } } if (distBest > 0.4) { result = sents[bestSentIndex]; if (bestSentIndex < sents.length - 1 && sents[bestSentIndex + 1].length() > 60) { followSent = sents[bestSentIndex + 1]; } } return new String[] { result, followSent }; } public static void main(String[] args) { RelatedSentenceFinder f = new RelatedSentenceFinder(); List<HitBase> hits = null; try { // uncomment the sentence you would like to serve as a seed sentence for content generation for an event // description // uncomment the sentence you would like to serve as a seed sentence for content generation for an event // description hits = f.findActivityDetailsForEventGroupName("Albert Einstein" // "Britney Spears - The Femme Fatale Tour" // "Rush Time Machine", // "Blue Man Group" , // "Belly Dance With Zaharah", // "Hollander Musicology Lecture: Danielle Fosler-Lussier, Guest Lecturer", // "Jazz Master and arguably the most famous jazz musician alive, trumpeter Wynton Marsalis", ); System.out.println(HitBase.toString(hits)); System.out.println(HitBase.toResultantString(hits)); } catch (Exception e) { e.printStackTrace(); } } }
48542ca016efdb3bc6bc2a3b54b1ccfefa2d5e35
ff17aa326a62de027a014fab99a652f593c7381f
/module_mine/src/main/java/com/example/bean/ProvinceBean.java
035af183a72adb9dc63c2b7541db291288d6debf
[]
no_license
majiaxue/jikehui
401aa2db1a3846bbbef9d29a29cdb934cb18b4c2
9b30feb8dbf058954fe59676303fd260ab5282c8
refs/heads/master
2022-08-22T18:25:08.014789
2020-05-23T10:40:22
2020-05-23T10:40:22
263,837,386
1
1
null
null
null
null
UTF-8
Java
false
false
1,672
java
package com.example.bean; import android.os.Parcel; import android.os.Parcelable; import java.util.ArrayList; public class ProvinceBean implements Parcelable { private String id; /*110101*/ private String name; /*东城区*/ private ArrayList<City2Bean> cityList; @Override public String toString() { return name ; } public String getId() { return id == null ? "" : id; } public void setId(String id) { this.id = id; } public String getName() { return name == null ? "" : name; } public void setName(String name) { this.name = name; } public ArrayList<City2Bean> getCityList() { return cityList; } public void setCityList(ArrayList<City2Bean> cityList) { this.cityList = cityList; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.id); dest.writeString(this.name); dest.writeTypedList(this.cityList); } public ProvinceBean() { } protected ProvinceBean(Parcel in) { this.id = in.readString(); this.name = in.readString(); this.cityList = in.createTypedArrayList(City2Bean.CREATOR); } public static final Creator<ProvinceBean> CREATOR = new Creator<ProvinceBean>() { @Override public ProvinceBean createFromParcel(Parcel source) { return new ProvinceBean(source); } @Override public ProvinceBean[] newArray(int size) { return new ProvinceBean[size]; } }; }
000dc8166ad244393605e1de4a0206a3742a70ba
10fddcbfbf38d6341a97483e5978bbab4e8bf20b
/java_stack/springProjects/dojoninjas/src/main/java/com/codingdojo/dojoninjas/models/Dojo.java
3a2d4e7335d5b448f5bafb19712cd406d9794b13
[]
no_license
bghebrit/dojo_assignments
ac8abdf08cf04dcef3e122d6f7e30ed8a90744ad
39411bcd82a8a43e1bc08b4b85a79ef1ba6108e7
refs/heads/master
2021-06-27T08:20:36.985328
2020-07-20T19:56:42
2020-07-20T19:56:42
232,712,477
0
0
null
2021-06-10T22:28:24
2020-01-09T03:18:58
Python
UTF-8
Java
false
false
1,381
java
package com.codingdojo.dojoninjas.models; import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name="dojos") public class Dojo { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; @Column(updatable=false) private Date createdAt; private Date updatedAt; @OneToMany(mappedBy="dojo", fetch = FetchType.LAZY) private List<Ninja> ninjas; public Dojo() { } public Dojo(Long id, String name) { this.id = id; this.name = name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getCreatedAt() { return createdAt; } public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } public Date getUpdatedAt() { return updatedAt; } public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; } public List<Ninja> getNinjas() { return ninjas; } public void setNinjas(List<Ninja> ninjas) { this.ninjas = ninjas; } }
b545882421122c22a0d0adefe775b5ab5967d5f0
ce7db6bc43f66264cdf3a25486e45d27429b1960
/src/main/java/com/georgiev/xml/xml_app/App.java
a8fed2946a094568529a3a6f386b86d0ba2de584
[]
no_license
mazen17/xml-app
91e16051d6892cc14f50f11b0cea44f52e1876d7
684f3efd3ac961f9f376e492f24bda5827ab0b76
refs/heads/master
2020-06-21T10:23:50.460372
2016-11-25T19:19:02
2016-11-25T19:19:02
74,791,121
0
0
null
null
null
null
UTF-8
Java
false
false
3,557
java
package com.georgiev.xml.xml_app; import java.io.FileOutputStream; import javax.xml.bind.*; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFFont; import org.apache.poi.hssf.usermodel.HSSFPalette; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFColor; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import com.georgiev.xml.entity.Customer; /** * Hello world! * */ public class App { public static void main(String[] args) throws Exception { System.out.println("Start"); JAXBContext jc = JAXBContext.newInstance(Customer.class); Customer customer = new Customer(); customer.setFirstName("Jane"); customer.setLastName("Doe"); customer.setID(123); customer.setAddress("test"); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(customer, System.out); HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet(); HSSFRow row = sheet.createRow((short) 0); HSSFCell cell = row.createCell((short) 0); cell.setCellValue("Default Palette"); // apply some colors from the standard palette, // as in the previous examples. // we'll use red text on a lime background HSSFCellStyle style = wb.createCellStyle(); style.setFillForegroundColor(HSSFColor.LIME.index); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); HSSFFont font = wb.createFont(); font.setColor(HSSFColor.RED.index); style.setFont(font); cell.setCellStyle(style); // save with the default palette FileOutputStream out = new FileOutputStream("default_palette.xls"); wb.write(out); out.close(); // now, let's replace RED and LIME in the palette // with a more attractive combination // (lovingly borrowed from freebsd.org) cell.setCellValue("Modified Palette"); // creating a custom palette for the workbook HSSFPalette palette = wb.getCustomPalette(); // replacing the standard red with freebsd.org red palette.setColorAtIndex(HSSFColor.RED.index, (byte) 153, // RGB red // (0-255) (byte) 0, // RGB green (byte) 0 // RGB blue ); // replacing lime with freebsd.org gold palette.setColorAtIndex(HSSFColor.LIME.index, (byte) 255, (byte) 204, (byte) 102); // save with the modified palette // note that wherever we have previously used RED or LIME, the // new colors magically appear out = new FileOutputStream("modified_palette.xls"); wb.write(out); out.close(); //save with the default palette FileOutputStream out1 = new FileOutputStream("Xdefault_palette.xlsx"); XSSFWorkbook wb1 = new XSSFWorkbook(); XSSFSheet sheet1 = wb1.createSheet(); XSSFRow row1 = sheet1.createRow(0); XSSFCell cell1 = row1.createCell( 0); cell1.setCellValue("custom XSSF colors"); XSSFCellStyle style1 = wb1.createCellStyle(); style1.setFillForegroundColor(new XSSFColor(new java.awt.Color(128, 0, 128))); style1.setFillPattern(CellStyle.SOLID_FOREGROUND); wb1.write(out1); out1.close(); } }
[ "mazen17" ]
mazen17
7d974493f8f82dedc3f930e43faec80bb2f5b845
0907c886f81331111e4e116ff0c274f47be71805
/sources/com/google/android/gms/common/api/internal/BackgroundDetector.java
c5579ad41ec3e486916fb61d39ed4d325e4fa716
[ "MIT" ]
permissive
Minionguyjpro/Ghostly-Skills
18756dcdf351032c9af31ec08fdbd02db8f3f991
d1a1fb2498aec461da09deb3ef8d98083542baaf
refs/heads/Android-OS
2022-07-27T19:58:16.442419
2022-04-15T07:49:53
2022-04-15T07:49:53
415,272,874
2
0
MIT
2021-12-21T10:23:50
2021-10-09T10:12:36
Java
UTF-8
Java
false
false
3,904
java
package com.google.android.gms.common.api.internal; import android.app.Activity; import android.app.ActivityManager; import android.app.Application; import android.content.ComponentCallbacks2; import android.content.res.Configuration; import android.os.Bundle; import com.google.android.gms.common.util.PlatformVersion; import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; /* compiled from: com.google.android.gms:play-services-basement@@17.3.0 */ public final class BackgroundDetector implements Application.ActivityLifecycleCallbacks, ComponentCallbacks2 { private static final BackgroundDetector zza = new BackgroundDetector(); private final AtomicBoolean zzb = new AtomicBoolean(); private final AtomicBoolean zzc = new AtomicBoolean(); private final ArrayList<BackgroundStateChangeListener> zzd = new ArrayList<>(); private boolean zze = false; /* compiled from: com.google.android.gms:play-services-basement@@17.3.0 */ public interface BackgroundStateChangeListener { void onBackgroundStateChanged(boolean z); } private BackgroundDetector() { } public final void onActivityDestroyed(Activity activity) { } public final void onActivityPaused(Activity activity) { } public final void onActivitySaveInstanceState(Activity activity, Bundle bundle) { } public final void onActivityStarted(Activity activity) { } public final void onActivityStopped(Activity activity) { } public final void onConfigurationChanged(Configuration configuration) { } public final void onLowMemory() { } public static BackgroundDetector getInstance() { return zza; } public static void initialize(Application application) { synchronized (zza) { if (!zza.zze) { application.registerActivityLifecycleCallbacks(zza); application.registerComponentCallbacks(zza); zza.zze = true; } } } public final boolean readCurrentStateIfPossible(boolean z) { if (!this.zzc.get()) { if (!PlatformVersion.isAtLeastJellyBean()) { return z; } ActivityManager.RunningAppProcessInfo runningAppProcessInfo = new ActivityManager.RunningAppProcessInfo(); ActivityManager.getMyMemoryState(runningAppProcessInfo); if (!this.zzc.getAndSet(true) && runningAppProcessInfo.importance > 100) { this.zzb.set(true); } } return isInBackground(); } public final boolean isInBackground() { return this.zzb.get(); } public final void addListener(BackgroundStateChangeListener backgroundStateChangeListener) { synchronized (zza) { this.zzd.add(backgroundStateChangeListener); } } public final void onActivityCreated(Activity activity, Bundle bundle) { boolean compareAndSet = this.zzb.compareAndSet(true, false); this.zzc.set(true); if (compareAndSet) { zza(false); } } public final void onActivityResumed(Activity activity) { boolean compareAndSet = this.zzb.compareAndSet(true, false); this.zzc.set(true); if (compareAndSet) { zza(false); } } public final void onTrimMemory(int i) { if (i == 20 && this.zzb.compareAndSet(false, true)) { this.zzc.set(true); zza(true); } } private final void zza(boolean z) { synchronized (zza) { ArrayList arrayList = this.zzd; int size = arrayList.size(); int i = 0; while (i < size) { Object obj = arrayList.get(i); i++; ((BackgroundStateChangeListener) obj).onBackgroundStateChanged(z); } } } }
0f953813da858817043de90c878fa856043602b8
492427711ab6b3e0b72d69ade968dc168130af2a
/src/main/java/org/spongepowered/asm/mixin/transformer/TargetClassContext.java
beb19bf342c9aae3168a1f247fbd3e7ecdae1d8c
[]
no_license
SkidFxcte/Hydrawareplus-cracked
c0124401af7c0071721f1e891f0855cae5c709ac
6f06cd554581b5f0db738a0fa16b685ca75ce6e8
refs/heads/main
2023-08-20T09:36:35.461529
2021-10-21T13:57:29
2021-10-21T13:57:29
419,727,981
4
1
null
null
null
null
UTF-8
Java
false
false
8,399
java
//Deobfuscated with https://github.com/SimplyProgrammer/Minecraft-Deobfuscator3000 using mappings "C:\Users\User\Desktop\Source\Minecraft-Deobfuscator3000-master\1.12 stable mappings"! //Decompiled by Procyon! package org.spongepowered.asm.mixin.transformer; import org.spongepowered.asm.mixin.transformer.ext.*; import org.spongepowered.asm.mixin.struct.*; import org.spongepowered.asm.mixin.injection.struct.*; import java.util.*; import org.spongepowered.asm.mixin.*; import java.lang.annotation.*; import org.spongepowered.asm.util.*; import java.io.*; import org.spongepowered.asm.lib.tree.*; import org.apache.logging.log4j.*; class TargetClassContext extends ClassContext implements ITargetClassContext { private static final Logger logger; private final MixinEnvironment env; private final Extensions extensions; private final String sessionId; private final String className; private final ClassNode classNode; private final ClassInfo classInfo; private final SourceMap sourceMap; private final ClassSignature signature; private final SortedSet<MixinInfo> mixins; private final Map<String, Target> targetMethods; private final Set<MethodNode> mixinMethods; private int nextUniqueMethodIndex; private int nextUniqueFieldIndex; private boolean applied; private boolean forceExport; TargetClassContext(final MixinEnvironment env, final Extensions extensions, final String sessionId, final String name, final ClassNode classNode, final SortedSet<MixinInfo> mixins) { this.targetMethods = new HashMap<String, Target>(); this.mixinMethods = new HashSet<MethodNode>(); this.env = env; this.extensions = extensions; this.sessionId = sessionId; this.className = name; this.classNode = classNode; this.classInfo = ClassInfo.fromClassNode(classNode); this.signature = this.classInfo.getSignature(); this.mixins = mixins; (this.sourceMap = new SourceMap(classNode.sourceFile)).addFile(this.classNode); } public String toString() { return this.className; } boolean isApplied() { return this.applied; } boolean isExportForced() { return this.forceExport; } Extensions getExtensions() { return this.extensions; } String getSessionId() { return this.sessionId; } String getClassRef() { return this.classNode.name; } String getClassName() { return this.className; } public ClassNode getClassNode() { return this.classNode; } List<MethodNode> getMethods() { return (List<MethodNode>)this.classNode.methods; } List<FieldNode> getFields() { return (List<FieldNode>)this.classNode.fields; } public ClassInfo getClassInfo() { return this.classInfo; } SortedSet<MixinInfo> getMixins() { return this.mixins; } SourceMap getSourceMap() { return this.sourceMap; } void mergeSignature(final ClassSignature signature) { this.signature.merge(signature); } void addMixinMethod(final MethodNode method) { this.mixinMethods.add(method); } void methodMerged(final MethodNode method) { if (!this.mixinMethods.remove(method)) { TargetClassContext.logger.debug("Unexpected: Merged unregistered method {}{} in {}", new Object[] { method.name, method.desc, this }); } } MethodNode findMethod(final Deque<String> aliases, final String desc) { return this.findAliasedMethod(aliases, desc, true); } MethodNode findAliasedMethod(final Deque<String> aliases, final String desc) { return this.findAliasedMethod(aliases, desc, false); } private MethodNode findAliasedMethod(final Deque<String> aliases, final String desc, final boolean includeMixinMethods) { final String alias = aliases.poll(); if (alias == null) { return null; } for (final MethodNode target : this.classNode.methods) { if (target.name.equals(alias) && target.desc.equals(desc)) { return target; } } if (includeMixinMethods) { for (final MethodNode target : this.mixinMethods) { if (target.name.equals(alias) && target.desc.equals(desc)) { return target; } } } return this.findAliasedMethod(aliases, desc); } FieldNode findAliasedField(final Deque<String> aliases, final String desc) { final String alias = aliases.poll(); if (alias == null) { return null; } for (final FieldNode target : this.classNode.fields) { if (target.name.equals(alias) && target.desc.equals(desc)) { return target; } } return this.findAliasedField(aliases, desc); } Target getTargetMethod(final MethodNode method) { if (!this.classNode.methods.contains(method)) { throw new IllegalArgumentException("Invalid target method supplied to getTargetMethod()"); } final String targetName = method.name + method.desc; Target target = this.targetMethods.get(targetName); if (target == null) { target = new Target(this.classNode, method); this.targetMethods.put(targetName, target); } return target; } String getUniqueName(final MethodNode method, final boolean preservePrefix) { final String uniqueIndex = Integer.toHexString(this.nextUniqueMethodIndex++); final String pattern = preservePrefix ? "%2$s_$md$%1$s$%3$s" : "md%s$%s$%s"; return String.format(pattern, this.sessionId.substring(30), method.name, uniqueIndex); } String getUniqueName(final FieldNode field) { final String uniqueIndex = Integer.toHexString(this.nextUniqueFieldIndex++); return String.format("fd%s$%s$%s", this.sessionId.substring(30), field.name, uniqueIndex); } void applyMixins() { if (this.applied) { throw new IllegalStateException("Mixins already applied to target class " + this.className); } this.applied = true; final MixinApplicatorStandard applicator = this.createApplicator(); applicator.apply((SortedSet)this.mixins); this.applySignature(); this.upgradeMethods(); this.checkMerges(); } private MixinApplicatorStandard createApplicator() { if (this.classInfo.isInterface()) { return (MixinApplicatorStandard)new MixinApplicatorInterface(this); } return new MixinApplicatorStandard(this); } private void applySignature() { this.getClassNode().signature = this.signature.toString(); } private void checkMerges() { for (final MethodNode method : this.mixinMethods) { if (!method.name.startsWith("<")) { TargetClassContext.logger.debug("Unexpected: Registered method {}{} in {} was not merged", new Object[] { method.name, method.desc, this }); } } } void processDebugTasks() { if (!this.env.getOption(MixinEnvironment.Option.DEBUG_VERBOSE)) { return; } final AnnotationNode classDebugAnnotation = Annotations.getVisible(this.classNode, (Class<? extends Annotation>)Debug.class); if (classDebugAnnotation != null) { this.forceExport = Boolean.TRUE.equals(Annotations.getValue(classDebugAnnotation, "export")); if (Boolean.TRUE.equals(Annotations.getValue(classDebugAnnotation, "print"))) { Bytecode.textify(this.classNode, System.err); } } for (final MethodNode method : this.classNode.methods) { final AnnotationNode methodDebugAnnotation = Annotations.getVisible(method, (Class<? extends Annotation>)Debug.class); if (methodDebugAnnotation != null && Boolean.TRUE.equals(Annotations.getValue(methodDebugAnnotation, "print"))) { Bytecode.textify(method, System.err); } } } static { logger = LogManager.getLogger("mixin"); } }
e63321209f0a319f7ed8509f59f6ff9aa0580c6e
b532db2789f54486a9282671e8bca504938777b0
/android/app/src/main/java/com/noteproject/MainActivity.java
0c672aad8a92cad772a800a6defb0c769ad5f363
[]
no_license
hrinternship2018/react_note_app
1df033b34c624bf5367b84d623f38dc488165631
4e7b3adba4d991bcf4464712f456373debf16bee
refs/heads/master
2020-05-17T13:45:58.122700
2019-04-28T05:47:11
2019-04-28T05:47:11
183,744,861
0
0
null
null
null
null
UTF-8
Java
false
false
367
java
package com.noteproject; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "noteProject"; } }
e4e00c0a050322f2e537303d1adc628a1c4940d5
d18c4dbeb041a9a3b7e53343d5c221793a93cb01
/src/main/java/pers/zjh/shop/mapper/ProductImageMapper.java
7eb40a2e281c2e705d5fa817db35790ba048d6e6
[]
no_license
zjh123456789/ttp1-shop
0441691a9231b70f81c221286a5884b713619695
994b0d415a506bc49e2b033c9a9d83dbf66be16e
refs/heads/master
2020-04-03T18:27:06.109675
2018-10-31T02:06:08
2018-10-31T02:06:08
155,484,741
18
5
null
null
null
null
UTF-8
Java
false
false
1,435
java
package pers.zjh.shop.mapper; import java.util.List; import pers.zjh.shop.pojo.ProductImage; import pers.zjh.shop.pojo.ProductImageExample; public interface ProductImageMapper { /** * @Describe 根据id删除商品图片 * @param id * @return int */ int deleteByPrimaryKey(Integer id); /** * @Describe 添加商品图片 * @param record * @return int */ int insert(ProductImage record); /** * @Describe 添加商品图片,选择性插入数据 * @param record * @return int */ int insertSelective(ProductImage record); /** * @Describe 根据设置的条件查询一堆商品图片 * @param example * @return List<ProductImage> */ List<ProductImage> selectByExample(ProductImageExample example); /** * @Describe 根据主键id 查询商品图片 * @param id * @return ProductImage */ ProductImage selectByPrimaryKey(Integer id); /** * @Describe 对字段进行判断再更新商品图片(如果为Null就忽略更新) * @param record * @return int */ int updateByPrimaryKeySelective(ProductImage record); /** * @Describe 对注入的字段全部更新 * @param record * @return int */ int updateByPrimaryKey(ProductImage record); }
9d2ee280c584e0e6e3dc3676fd57b7ea1d911153
8efe6c0c7bc0b530ee02dee1ea6c24bfdaee3b63
/javatestlib/src/main/java/com/ObserverModel/MyTestClass.java
dd7b33e6daaa6d71ac37544131c87cbb3d1abcc8
[]
no_license
bruceearly/MulFunProject
a803e4fbb985f8a0d851ab3ca43321d80732d190
5bb3add046be00276338becee0f038b0315a0f1a
refs/heads/master
2020-12-25T14:23:02.810692
2016-09-05T08:25:56
2016-09-05T08:25:56
67,402,147
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package com.ObserverModel; import java.awt.Event; /** * Created by mijia on 16/8/8. */ public class MyTestClass { public void test(){} public static void main(String[] args) { EventBus eventBus = EventBus.getInstance(); ExecutionSub sub1 = new ExecutionSub(); ExecutionSub sub2 = new ExecutionSub(); ExecutionSub sub3 = new ExecutionSub(); eventBus.regist(sub1); eventBus.regist(sub2); eventBus.regist(sub3); eventBus.post(null); eventBus.unRegist(sub3); for (int i = 0; i < 3; i++) { eventBus.post(sub1); } eventBus.post(null); ThreadLocal<MyTestClass> local = new ThreadLocal<>(); local.get(); } }
328fdd5f0eebd67e516e35aababc007e450ddac8
fb64147e1047151d396c6c9b23f6b3c30110928e
/src/main/java/com/baeldung/jira/service/UserLimitService.java
cfabd4016d95b2f564f3c95c8701c02842a036b0
[]
no_license
rajaneeshm/JiraTaskAutomation
3ffe7e6db2ea8916abe4ebdeecd57984f61cd4a1
ef00a1afc031994857e0168af5a762b502bbaaa3
refs/heads/master
2021-08-31T17:07:46.194589
2017-12-20T18:23:01
2017-12-20T18:23:01
114,652,555
1
1
null
2017-12-22T05:58:34
2017-12-18T14:48:21
Java
UTF-8
Java
false
false
3,233
java
package com.baeldung.jira.service; import java.util.HashMap; import java.util.ResourceBundle; import java.util.concurrent.ExecutionException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; import com.atlassian.jira.rest.client.api.SearchRestClient; import com.atlassian.jira.rest.client.api.UserRestClient; import com.atlassian.jira.rest.client.api.domain.Issue; import com.atlassian.jira.rest.client.api.domain.SearchResult; import com.atlassian.jira.rest.client.api.domain.User; import com.atlassian.util.concurrent.Promise; @Service("userLimitAndNotifyService") @PropertySource({ "classpath:jqlquery.properties" }) public class UserLimitService { private final Logger LOGGER = LoggerFactory.getLogger(getClass()); @Autowired private Environment env; @Autowired private SearchRestClient searchRestClient; @Autowired private UserRestClient userRestClient; @Autowired private NotificationService notificationService; @Autowired @Qualifier("userThreadsLimit") private HashMap<String, Double> userThreadsLimit; @Autowired @Qualifier("statusRating") private HashMap<String, Double> statusRating; public void notifyUsers() throws InterruptedException, ExecutionException { ResourceBundle resourceBundle = ResourceBundle.getBundle("jqlquery"); for (String jqlQuery : resourceBundle.keySet()) { Promise<SearchResult> searchResults = searchByJQL(env.getProperty(jqlQuery)); double openThreads = 0; String jiraUser = ""; String userEmail = ""; for (Issue issue : searchResults.get().getIssues()) { issue.getAssignee(); String issueStatus = issue.getStatus().getName(); openThreads += statusRating.get(issueStatus); /** * TODO , Need to check whether assingnee might be null for any issue? * in case should I consider assingee as ADMIN? */ jiraUser = issue.getAssignee().getName(); userEmail = issue.getAssignee().getEmailAddress(); LOGGER.info(issue.getKey() + " assinned to " + issue.getAssignee().getName() + " in state " + issueStatus); } LOGGER.info("Total points to Assaigned user " + jiraUser + " is " + openThreads + " and His limt is : " + userThreadsLimit.get(jiraUser)); if (openThreads > userThreadsLimit.get(jiraUser)) { notificationService.notifyUser(userEmail, jiraUser, getRestUser("admin").getEmailAddress()); } } } public Promise<SearchResult> searchByJQL(String jql) throws InterruptedException, ExecutionException { return searchRestClient.searchJql(jql); } public User getRestUser(String userName) { Promise<User> restUser = userRestClient.getUser(userName); return restUser.claim(); } }
073948db69964e46beffb231205079aa25a330cd
456d43c584fb66f65c6a7147cdd22595facf8bd9
/jpa/deferred/src/main/java/example/model/Customer903.java
24f5ca4462c66f799b5cd8df59b2bcb6fd8086a1
[ "Apache-2.0" ]
permissive
niushapaks/spring-data-examples
283eec991014e909981055f48efe67ff1e6e19e6
1ad228b04523e958236d58ded302246bba3c1e9b
refs/heads/main
2023-08-21T14:25:55.998574
2021-09-29T13:14:33
2021-09-29T13:14:33
411,679,335
1
0
Apache-2.0
2021-09-29T13:11:03
2021-09-29T13:11:02
null
UTF-8
Java
false
false
624
java
package example.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class Customer903 { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; private String firstName; private String lastName; protected Customer903() {} public Customer903(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } @Override public String toString() { return String.format("Customer903[id=%d, firstName='%s', lastName='%s']", id, firstName, lastName); } }
86f0893bd9edaf730638d19aafb74675ba1aa020
eac6bc474bff9b52c16555309a1ec6bbd6744557
/ms-employee/src/test/java/org/nazareko/webfluxgateway/WebfluxGatewayApplicationTests.java
83c2ad1f4167c67433d7e5329db5a98c46037518
[]
no_license
DenNazarenko/webflux-vs-mvc
40a6e28ef2dd0442298c565312a069ccbfad2cb2
9feb1e4f7b7d4c5834acd7fb6cecfe46db17f130
refs/heads/master
2021-05-17T17:02:57.190600
2020-03-28T20:41:45
2020-03-28T20:41:45
250,886,250
0
0
null
null
null
null
UTF-8
Java
false
false
236
java
package org.nazareko.webfluxgateway; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class WebfluxGatewayApplicationTests { @Test void contextLoads() { } }
3e1d9b5229e85fb29a830b64568bce3c00357838
659cb377097b3cf1f35fe54f7122e240e056e76c
/possystem/src/com/project/dao/interfaces/IInvoicetaxshipDAO.java
975cf5fe349a9dc97eb094134626ea8da3de09d4
[]
no_license
krishJsoft/jpos
9f49923fb4661499c805b0da740a2eb19e81c3e4
4f724e025181c63f73a7728b762160517d41c830
refs/heads/main
2023-03-06T07:30:55.862527
2021-02-23T06:00:04
2021-02-23T06:00:04
335,437,923
0
0
null
null
null
null
UTF-8
Java
false
false
683
java
package com.project.dao.interfaces; import java.util.List; import com.project.model.his.Invoicetaxship; public interface IInvoicetaxshipDAO { public boolean createInvoicetaxship(Invoicetaxship invoicetaxship) throws Exception; public boolean updateInvoicetaxship(Invoicetaxship invoicetaxship) throws Exception; public boolean deleteInvoicetaxship(Invoicetaxship invoicetaxship) throws Exception; public Invoicetaxship getInvoicetaxshipDetails(Integer invoiceTaxShipId) throws Exception; public Invoicetaxship getInvoicetaxshipDetails(String invoiceNo) throws Exception; public List<Invoicetaxship> getInvoicetaxshipList(String invoiceNo) throws Exception; }
094d4fd99c3878d3c484b54afdc07203e7e85a31
d6c77f7afcc11b8186fab42b9fe257a76b481297
/9º Periodo/Sistemas distribuidos/WebServiceSoapServidor/src/java/Beans/ListCategoria.java
e4d34069991a27f837a4a38ca535e7348600251f
[]
no_license
joaororiz/joaororiz
7d487c0a37dd7aeaaa1d720c88f31737bc565344
80838cf615735f470c3a2487775137818c14d103
refs/heads/master
2021-01-25T14:10:12.765611
2019-12-05T09:30:03
2019-12-05T09:30:03
123,659,212
0
1
null
null
null
null
UTF-8
Java
false
false
382
java
package Beans; import java.util.List; /** * * @author João Otávio Mota Roriz */ public class ListCategoria { private List<String> categorias; public ListCategoria() { } public List<String> getCategorias() { return categorias; } public void setCategorias(List<String> categorias) { this.categorias = categorias; } }
08e7419e2e39b3e732da69d995e245e2dbf2f3d0
c4118b78e8ea224d767d0cac9bb70c91d0fa4726
/PlanetEngineer2020/app/src/main/java/com/example/planetengineer2020/ui/send/SendFragment.java
58f2964c25e08720528244bcb69068c4ed11ae96
[]
no_license
aditya30-stack/planet_engineers_app
e6dfe91bf668d417954e6062be2c9b2b2bd5dea3
a7a7f55fbcc41f9843b739b60c6f6b249ded3e35
refs/heads/master
2022-06-20T16:40:14.004197
2020-05-12T05:42:24
2020-05-12T05:42:24
261,971,833
0
0
null
null
null
null
UTF-8
Java
false
false
1,145
java
package com.lnct.planetengineer2020.ui.send; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import com.lnct.planetengineer2020.R; public class SendFragment extends Fragment { private SendViewModel sendViewModel; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { sendViewModel = ViewModelProviders.of(this).get(SendViewModel.class); View root = inflater.inflate(R.layout.fragment_send, container, false); final TextView textView = root.findViewById(R.id.text_send); sendViewModel.getText().observe(this, new Observer<String>() { @Override public void onChanged(@Nullable String s) { textView.setText(s); } }); return root; } }
205e030f59606ae7be9294aab805f1255caf7cb5
18b72c00986f53cfc4cb1e74efe9eea2f910beb9
/backend/myriad/src/main/java/io/sweetcodehellabro/MyriadApplication.java
c1993b96ed65cf74697c80e5a609ba14cce5fa70
[]
no_license
SweetBroHellaCode/myriad
af42f65b6b2a21add13227a73c0e13c769fee149
3bae770b215c87d14b11e3bfc6e28b759ee7ebda
refs/heads/master
2021-01-10T15:06:51.697661
2016-01-02T00:38:08
2016-01-02T00:38:08
48,337,020
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package io.sweetcodehellabro; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MyriadApplication { public static void main(String[] args) { SpringApplication.run(MyriadApplication.class, args); } }
dfd477b9674eaf88c4b5874526e90080aa3d855f
d0e7ba495f39dbf08d296aea3e22b4ce8567934b
/CPrincipal.java
b701fe38be040c02791d5335da66879869f412a5
[]
no_license
mluisx/frg-pre
752012cec2da7aed0e6f1e56ed714ec3d8f27fea
53ca5f6aa62685998c9c0d3ce34c7fd96c4d10c0
refs/heads/master
2021-01-02T22:45:00.531555
2012-07-20T22:38:41
2012-07-20T22:38:41
null
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
584
java
// Ver 0.6.4 - Última Corriendo en Prune Posadas // package Caja; public class CPrincipal { public static CGUI Main; public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Main = new CGUI(); Main.setVisible(true); } }); } } // Sistema De Stock Ver 0.3.0 // /** * Para Hacer: * 1) Permitir que queden saldos negativos (haberes) en el sistema. * 2) Ver si puedo cargar historial de clientes en jGrid. * 3) Permitir cargar vales de compras que permitan descontar valores en ventas de clientes. **/
bfee9e45db2e9bc3e1288e69e7ed169b18884517
04ed1b3c8d086776361e365afee0e87e8afaeb1e
/src/de/guntram/bukkit/hiab/AsyncBuilder.java
450f11e836e6bb892ce6f05c96129f23d3eece55
[]
no_license
gbl/HouseInABox
edb7cc002d32581704d96f53b4375d5e21ba8182
f72627a6fd83486ab6a60925774cd9fe876385fa
refs/heads/master
2021-01-10T23:38:02.940352
2016-11-28T20:42:52
2016-11-28T20:42:52
70,415,079
0
0
null
null
null
null
UTF-8
Java
false
false
7,191
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 de.guntram.bukkit.hiab; import com.sk89q.worldedit.CuboidClipboard; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Firework; import org.bukkit.entity.Player; import org.bukkit.inventory.meta.FireworkMeta; /** * * @author gbl */ public class AsyncBuilder implements Runnable { private int taskID; private int currentTurn; private int currentHeight; private final HouseInABoxPlugin plugin; private final CuboidClipboard clipboard; private final Vector position; private final EditSession session; private final int rotation; private final Location location; private final Player player; private final String doneMessage; private static Material[] matValues; private static Vector up; private final int INVALIDTASKID=-1; AsyncBuilder(HouseInABoxPlugin plugin, CuboidClipboard clipboard, Vector position, EditSession session, int rotation, Location location, Player player, String doneMessage) { this.plugin=plugin; this.clipboard=clipboard; this.position=position; this.session=session; this.rotation=rotation; this.location=location; this.player=player; this.doneMessage=doneMessage; if (matValues==null) matValues=Material.values(); if (up==null) up=new Vector(0, 1, 0); currentTurn=currentHeight=0; taskID=INVALIDTASKID; } public void setTaskID(int id) { taskID=id; } @Override public void run() { // Just to make sure the async scheduler doesn't call us before our // creator had a chance to set the task id ... if (taskID==INVALIDTASKID) return; if (currentTurn==2) { if (player!=null && doneMessage!=null) player.sendMessage(doneMessage); plugin.getServer().getScheduler().cancelTask(taskID); return; } if (plugin.getShowFireWorks()) { Firework fw=(Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK); FireworkMeta fwm=fw.getFireworkMeta(); FireworkEffect fwe=FireworkEffect.builder() .flicker(true) .withColor(currentTurn==0 ? Color.RED : Color.GREEN) .with(currentTurn==0 ? Type.BURST : Type.CREEPER) .trail(true) .build(); fwm.addEffect(fwe); fwm.setPower(2); fw.setFireworkMeta(fwm); } // This is, more or less, copied. from worldEdit's CuboidClipboard.paste // going bottom to up and solid blocks first. Also, we avoid // AsyncWorldEdit and it's physics. try { for (int x=0; x<clipboard.getSize().getBlockX(); x++) { for (int z=0; z<clipboard.getSize().getBlockZ(); z++) { Vector where=new Vector(x, currentHeight, z); BaseBlock block=clipboard.getBlock(where); if (block==null) continue; Material material=matValues[block.getId()]; boolean placeInFirstRound=material.isOccluding(); if ((currentTurn==0) == placeInFirstRound) { if (plugin.getFixWorldEditDoorGateRotation() && rotation!=0) { if ( material==Material.SPRUCE_FENCE_GATE || material==Material.BIRCH_FENCE_GATE || material==Material.JUNGLE_FENCE_GATE || material==Material.DARK_OAK_FENCE_GATE || material==Material.ACACIA_FENCE_GATE ) { int data=block.getData(); switch (rotation) { case 90: block.setData(((data+3)&3) | (data&~3)); break; case 180: block.setData(((data+2)&3) | (data&~3)); break; case 270: block.setData(((data+1)&3) | (data&~3)); break; } } if ( material==Material.SPRUCE_DOOR || material==Material.BIRCH_DOOR || material==Material.JUNGLE_DOOR || material==Material.DARK_OAK_DOOR || material==Material.ACACIA_DOOR ) { int data=block.getData(); if ((data&8)==0) { switch (rotation) { case 90: block.setData(((data+1)&3) | (data&~3)); break; case 180: block.setData(((data+2)&3) | (data&~3)); break; case 270: block.setData(((data+3)&3) | (data&~3)); break; } } } } if (material==Material.DOUBLE_PLANT) { // Build double plants at once to stop the single // lower part from breaking int data=block.getData(); if ((data&8)==0) { session.setBlock(where.add(position), block); block.setData(data|8); session.setBlock(where.add(position).add(up), block); } } else { session.setBlock(where.add(position), block); } } else if (currentTurn==0) { // Replace all non-opaque blocks with air so we don't // get falling sand and stuff session.setBlock(where.add(position), new BaseBlock(0)); } } } if (++currentHeight>=clipboard.getHeight()) { currentHeight=0; currentTurn++; } } catch (MaxChangedBlocksException ex) { session.undo(session); plugin.getServer().getScheduler().cancelTask(taskID); } } }
963c74d7f1c210e617c9702c917f9b21b8d17dc9
80cb2caddcbb9cc45ac63d3d14be681db11410f1
/src/com/kookykraftmc/pink/Pink.java
e361c28c1a7fd9e5fecd105fa5943a410f2a8f9e
[]
no_license
Kraise/Pink
ce84199419b8fad15964222fcb787fd64bdc512c
86ef107ae2457d2cc37ea0431295e0bb416b2357
refs/heads/master
2016-08-12T19:09:12.870338
2016-05-06T17:08:27
2016-05-06T17:08:27
55,096,088
0
0
null
null
null
null
UTF-8
Java
false
false
1,999
java
package com.kookykraftmc.pink; import java.util.Random; import java.util.logging.Logger; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; public class Pink extends JavaPlugin { public static String prefix = ChatColor.DARK_PURPLE + "[Pink]" + ChatColor.LIGHT_PURPLE; public static String cPrefix = "[Pink]"; static Logger log = Logger.getLogger("Pink"); static int[] colList = {2,10,6}; static Random rdm = new Random(); static boolean pinkChat = true; public void onEnable() { getServer().getPluginManager().registerEvents(new PinkListener(this), this); this.getCommand("pink").setExecutor(new CommandPink(this)); PluginDescriptionFile pdf = getDescription(); log.info(ChatColor.DARK_PURPLE + pdf.getName() + " " + pdf.getVersion() + " is now enabled"); } public void onDisable() { PluginDescriptionFile pdf = getDescription(); log.info(pdf.getName() + pdf.getVersion() + " is now disabled"); } public void reloadCfg() { this.reloadConfig(); PinkListener.loadCfg(); } @SuppressWarnings("deprecation") public static void pinkinate(Location loc, int amount) { int pX = loc.getBlockX(); int pY = loc.getBlockY(); int pZ = loc.getBlockZ(); World w = loc.getWorld(); Location newLoc; for(int xCount = -amount; xCount<=amount; xCount++) { for(int yCount = -amount; yCount<=amount; yCount++) { for(int zCount = -amount; zCount<=amount; zCount++) { newLoc = new Location(w, pX + xCount, pY + yCount, pZ + zCount); if(!newLoc.getBlock().getType().isTransparent()) { newLoc.getBlock().setTypeIdAndData(35, (byte) colList[rdm.nextInt(3)], true); } } } } } }
b187709df7dbabc3b4da8ed58646aa36aafa504f
061a807e6e382768c363edb6f24979d00d99d56d
/zj22-gudao-server/zj22-gudao-server/gudao-server-web/src/main/java/me/zj22/gudao/server/web/pojo/dto/Rebate.java
6187281f4f9e89ae278af32000abde0bb28b071a
[]
no_license
kyson4idea/gudao
02acb8492b3470f46e2abca0204cc817dabea500
f71d6822ae25be5cd22ee1df20539bc9946cde34
refs/heads/master
2022-08-26T23:15:58.879044
2018-11-08T13:55:00
2018-11-08T13:55:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,175
java
package me.zj22.gudao.server.web.pojo.dto; import me.zj22.gudao.server.web.utils.TimeParse; /** * @Program:zj22-gudao-server * @Description:返点表 * @Author Gqjian * @Create 2018/2/5 15:38:07 */ public class Rebate { private Integer rebateId; private Double rebateRatio; //返点比例 private Byte available; //是否可用,1,可用,0,不可用 private Long createTime; //创建时间 private String createUser; //创建人 private Long updateTime; //修改时间 private String updateUser; //修改人 public String getAvailableStatus(){ if(available == 0) return "不可用"; return "可用"; } public String getCreateTimeToString() { //时间装换 return TimeParse.NUIX2Time((int)(createTime/1000)); } public String getUpdateTimeToString() { //时间装换 return TimeParse.NUIX2Time((int)(updateTime/1000)); } public Integer getRebateId() { return rebateId; } public void setRebateId(Integer rebateId) { this.rebateId = rebateId; } public Double getRebateRatio() { return rebateRatio; } public void setRebateRatio(Double rebateRatio) { this.rebateRatio = rebateRatio; } public Byte getAvailable() { return available; } public void setAvailable(Byte available) { this.available = available; } public Long getCreateTime() { return createTime; } public void setCreateTime(Long createTime) { this.createTime = createTime; } public String getCreateUser() { return createUser; } public void setCreateUser(String createUser) { this.createUser = createUser == null ? null : createUser.trim(); } public Long getUpdateTime() { return updateTime; } public void setUpdateTime(Long updateTime) { this.updateTime = updateTime; } public String getUpdateUser() { return updateUser; } public void setUpdateUser(String updateUser) { this.updateUser = updateUser == null ? null : updateUser.trim(); } }
ca8d93a5f6b43f927d60e1536220746bb6f95544
407e16162ffc804e1d73e7aceb14256bcd3635a7
/src/trello/User_Management.java
176e9817cc65a06bf256ab4e85a93b80ab9d0c3c
[]
no_license
Ubaid488/Trello-Application
df4f6b7fc0e7b9b506193ba5c426a41ad0eb4423
97cbf8ff1bebe96c7b47cd13e7d4cbbbee3a12f8
refs/heads/master
2020-08-12T03:32:15.372492
2019-10-12T16:41:28
2019-10-12T16:41:28
212,561,968
0
0
null
null
null
null
UTF-8
Java
false
false
3,794
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 trello; import java.util.ArrayList; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; /** * * @author ubaidullah */ public class User_Management { private static ArrayList<User> UsersRegistered; private static User_Management instance=new User_Management(); public User_Management() { UsersRegistered=new ArrayList<User>(); } public ArrayList<User> getUsersRegistered() { return UsersRegistered; } public static User_Management getInstance(){ UsersRegistered=new ArrayList<User>(); String url = "jdbc:derby://localhost:1527/TrelloApp"; try{ Connection myConnection = DriverManager.getConnection(url,"ubaid","12345"); Statement myStatement = myConnection.createStatement(); ResultSet myResult = myStatement.executeQuery("Select * from Users "); while(myResult.next()) { User u=new User(myResult.getString(2),myResult.getString(3),myResult.getString(1)); //System.out.println(myResult.getString(2)+" "+myResult.getString(3)+" "+myResult.getString(1)); UsersRegistered.add(u); //System.out.println(myResult.getString(1)); } } catch(Exception e){ e.printStackTrace(); } return instance; } private static void initum(){ } void AddUser(User u1){ UsersRegistered.add(u1); } boolean CheckEmail(String x){ boolean flag=false; for (int i=0;i<UsersRegistered.size();i++){ if(UsersRegistered.get(i).getEmail().equals(x)){ flag=true; break; } } return flag; } boolean CheckUsername(String x){ boolean flag=false; for (int i=0;i<UsersRegistered.size();i++){ if(UsersRegistered.get(i).getName().equals(x)){ flag=true; break; } } return flag; } String getPassword(String x){ String y=""; for (int i=0;i<UsersRegistered.size();i++){ if(UsersRegistered.get(i).getEmail().equals(x)){ y=UsersRegistered.get(i).getPassword(); break; } } return y; } String getUsername(String x){ String y=""; for (int i=0;i<UsersRegistered.size();i++){ if(UsersRegistered.get(i).getEmail().equals(x)){ y=UsersRegistered.get(i).getName(); break; } } return y; } boolean CheckLogin(String x,String y){ boolean flag=false; for (int i=0;i<UsersRegistered.size();i++){ if(UsersRegistered.get(i).getEmail().equals(x)){ if(UsersRegistered.get(i).getPassword().equals(y)){ flag=true; } break; } } return flag; } boolean update(String em,String nm,String pw){ boolean flag=false; for (int i=0;i<UsersRegistered.size();i++){ if(UsersRegistered.get(i).getEmail().equals(em)){ UsersRegistered.get(i).setName(nm); UsersRegistered.get(i).setPassword(pw); flag=true; break; } } return flag; } }
81ed3e38b0c7108d0bcbeff183f5e3f0dd1599be
a27563bdf9ba7993f75cca451b6edfb7e7f47021
/untitled1/src/Studentmethod.java
89ae7ab023cc1243c0c710705d8781cb6e356995
[]
no_license
tanxiangwen/JDBC-Practice
321eb70a21cb3d62369b2a4778726122fdfc4e19
9fc137f0d43f3fb31db9e89c08f04be7a32d8e95
refs/heads/main
2023-06-04T00:43:21.382586
2021-06-24T10:34:44
2021-06-24T10:34:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,319
java
import java.sql.*; import java.util.ResourceBundle; import java.util.Scanner; /** * 学生可以进行的功能:浏览自己的成绩 * 查看自己的排名 */ public class Studentmethod { public void see() { java.util.Scanner s = new java.util.Scanner(System.in); // System.out.println("---------欢迎来到自助平台-----------"); System.out.println("请输入自己的学号:"); String s1 = s.nextLine(); // boolean t1=false; Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try { DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver()); ResourceBundle bandle = ResourceBundle.getBundle("jdbc"); String url = bandle.getString("url"); String name = bandle.getString("name"); String password = bandle.getString("password"); con = DriverManager.getConnection(url, name, password); //取消自动提交机制 con.setAutoCommit(false); //创建预编译的数据库操作对象 String sql = "select * from t_studentifm where sno= ?"; //预编译 ps = con.prepareStatement(sql); //传值 ps.setString(1, s1); //执行 rs = ps.executeQuery(); if (rs.next()) { String a1 = rs.getString("sno"); String a2 = rs.getString("name"); String a3 = rs.getString("Chinese"); String a4 = rs.getString("Math"); String a5 = rs.getString("英语"); String a6 = rs.getString("total"); System.out.println("你的信息: " + "学号: " + a1 + "姓名: " + a2 + " 语文: " + a3 + "数学: " + a4 + "英语: " + a5 + "总分 " + a6); } //自动提交 con.commit(); } catch (SQLException e) { if (con != null) { try { con.rollback(); } catch (SQLException ex) { ex.printStackTrace(); } } e.printStackTrace(); } } //查找自己总分的名次 public void rank() { System.out.println("请输入你的学号:"); Scanner s = new Scanner(System.in); String a = s.nextLine(); Connection con = null; PreparedStatement ps = null; Statement st = null; ResultSet rs = null; ResultSet rs1 = null; //注册驱动 try { DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver()); //建立链接 ResourceBundle bandle = ResourceBundle.getBundle("jdbc"); String url = bandle.getString("url"); String name = bandle.getString("name"); String password = bandle.getString("password"); con = DriverManager.getConnection(url, name, password); con.setAutoCommit(false); //得到对应学号人的总分; String sql1 = "select total from t_studentifm where sno=?"; ps = con.prepareStatement(sql1); ps.setString(1, a); rs1 = ps.executeQuery(); if (rs1.next()) { System.out.println("查询成功"); ///Double s1 = rs1.getDouble("total"); } else { System.out.println("学号不存在"); rank(); } Double s1 = rs1.getDouble("total"); //创建预编译的sql语句 String sql = "select * from t_studentifm AS stu where stu.total>=? "; //预编译 ps = con.prepareStatement(sql); //传值 ps.setDouble(1, s1); //编译 rs = ps.executeQuery(); int count = 0; while (rs.next()) { count = count + 1; } System.out.println("在班级的名次:" + count); con.commit(); } catch (SQLException e) { if (con != null) { try { con.rollback(); } catch (SQLException ex) { ex.printStackTrace(); } } e.printStackTrace(); } } public void Main() { Scanner s = new Scanner(System.in); boolean t=true; while (t) { System.out.println("---------欢迎来到学生平台----------"); System.out.println("---------1.浏览自己的成绩----------"); System.out.println("---------2.查看自己的排名----------"); System.out.println("---------3.退出----------"); System.out.println("请输入你的选择:"); int b = s.nextInt(); switch (b) { case 1: see(); break; case 2: rank(); break; case 3: t=false; break; } } } }
5638a0d731c702dca4e3b01b879e14b7a0c882d7
f2d1729e6197929340414d9064007ff013dd348e
/src/main/java/cn/network/repository/FiletypeRepository.java
0fbce8579706cd2d32d143692fbce5bd116b0575
[ "MIT" ]
permissive
bennans/network
4b7d85c2c41a572ab58a9c3d036ba10ef9528857
381ebca81b26c81234af7fce05c00e7341b208c5
refs/heads/master
2020-03-22T21:35:09.605102
2018-07-12T12:10:20
2018-07-12T12:13:51
140,698,166
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package cn.network.repository; import cn.network.model.Filetype; import org.springframework.data.jpa.repository.JpaRepository; public interface FiletypeRepository extends JpaRepository<Filetype,Integer> { }
b95237d2f4391ca74ecc317d81fa60ff3c814228
47266a6e073295cf7e1248fef367420425a765ac
/com/epsilon/model/input/impl/ChangePassword.java
0ef357a9cc3f9439ad89078ba51caa5de8dbf1ac
[]
no_license
StraterAU/Epsilon
86d4e392c2fad892e7c6b141506d5a42458d576e
6b89b34fba253314d93cd9ae09ea3a9737cb7482
refs/heads/master
2021-03-24T13:02:28.476618
2017-04-02T12:23:14
2017-04-02T12:23:14
86,983,755
0
0
null
null
null
null
UTF-8
Java
false
false
2,355
java
package com.epsilon.model.input.impl; import java.sql.PreparedStatement; import com.epsilon.GameSettings; import com.epsilon.model.input.Input; import com.epsilon.util.NameUtils; import com.epsilon.world.entity.impl.player.Player; import mysql.MySQLController; import mysql.MySQLDatabase; import mysql.MySQLController.Database; public class ChangePassword extends Input { @Override public void handleSyntax(Player player, String syntax) { player.getPacketSender().sendInterfaceRemoval(); if(syntax == null || syntax.length() <= 2 || syntax.length() > 15 || !NameUtils.isValidName(syntax)) { player.getPacketSender().sendMessage("That password is invalid. Please try another password."); return; } if(syntax.contains("_")) { player.getPacketSender().sendMessage("Your password can not contain underscores."); return; } if(player.getBankPinAttributes().hasBankPin()) { player.getPacketSender().sendMessage("Please visit the nearest bank and enter your pin before doing this."); return; } boolean success = false; /* if(GameSettings.MYSQL_ENABLED == true){ MySQLDatabase recovery = MySQLController.getController().getDatabase(Database.RECOVERY); if(!recovery.active || recovery.getConnection() == null) { player.getPacketSender().sendMessage("This service is currently unavailable."); return; } //boolean success = false; try { PreparedStatement preparedStatement = recovery.getConnection().prepareStatement("DELETE FROM users WHERE USERNAME = ?"); preparedStatement.setString(1, player.getUsername()); preparedStatement.executeUpdate(); preparedStatement = recovery.getConnection().prepareStatement("INSERT INTO users (username,password,email) VALUES (?, ?, ?)"); preparedStatement.setString(1, player.getUsername()); preparedStatement.setString(2, player.getPassword()); preparedStatement.setString(3, syntax); preparedStatement.executeUpdate(); success = true; } catch(Exception e) { e.printStackTrace(); success = false; } }else{ success = true; }*/ if(success) { player.setPassword(syntax); player.getPacketSender().sendMessage("Your account's password is now: "+syntax); } else { player.getPacketSender().sendMessage("An error occured. Please try again."); } } }
[ "Taylan Selvi@Taylan" ]
Taylan Selvi@Taylan
380a58d06776dae7522cd971d46045d104e3cd10
041c2e45c9746c1a3213650b35c4de81525f50b7
/TP_09072020/src/com/antoinelamoureux/tp2/Compte.java
1937996e41f907f93757ca24c6c4f31309dfb352
[]
no_license
antoinelamoureux/java
daa853bfdfbc03312f5a6d7875eff803c9fe454c
c88df6687affc1a238fc0e2c30108cefa6430732
refs/heads/master
2022-11-19T10:40:26.421943
2020-07-10T12:13:33
2020-07-10T12:13:33
274,418,509
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
package com.antoinelamoureux.tp2; import java.util.Scanner; public class Compte { protected double solde; private static int code = 0; { setCode(getCode() + 1); } public Compte() { super(); } public Compte(double solde) { super(); this.solde = solde; } private int getCode() { return code; } private void setCode(int code) { Compte.code = code; } public double getSolde() { return solde; } public double deposer() { Scanner sc = new Scanner(System.in); System.out.print("Entrer un montant à déposer: "); return solde = solde + sc.nextDouble(); } public double retirer() { Scanner sc = new Scanner(System.in); System.out.print("Entrer un montant à retirer: "); return solde = solde - sc.nextDouble(); } }
ca9db9902384b1c263604392694a10165601ffaa
a2860675a4431dfc31b5a4b22aa8fc4489fa1202
/mobile/src/main/java/technology/mainthread/apps/isitup/data/db/IsItUpDbHelper.java
748b1d27b7685bd990a935b51ad7f8aa616db559
[ "Apache-2.0" ]
permissive
mainthread-technology/is-it-up-android
6abd2bee7429582e882321c4aa7913353e69babe
21cb810c40832ff3bcd855d4b63e64842b6284c0
refs/heads/master
2020-12-24T17:44:26.798135
2015-12-08T22:03:39
2015-12-08T22:03:39
40,918,861
0
0
null
null
null
null
UTF-8
Java
false
false
1,273
java
package technology.mainthread.apps.isitup.data.db; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import static technology.mainthread.apps.isitup.background.service.CheckerIntentService.getCheckerIntentService; public class IsItUpDbHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 2; private static final String DATABASE_NAME = "IS_IT_UP_DB"; private final Context mContext; public IsItUpDbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); mContext = context; } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(SyncFavouritesTable.DATABASE_CREATE); db.execSQL(SyncFavouritesTable.INSERT_SAMPLE_1); db.execSQL(SyncFavouritesTable.INSERT_SAMPLE_2); db.execSQL(SyncFavouritesTable.INSERT_SAMPLE_3); db.execSQL(SyncFavouritesTable.INSERT_SAMPLE_4); mContext.startService(getCheckerIntentService(mContext)); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + SyncFavouritesTable.TABLE_FAVOURITES); onCreate(db); } }
47e59a8d7eef083b10afeb57c15866d62ba8fe74
2bb4ea8651d3ea956c1177ce803a8dca04cf48e5
/app/src/main/java/com/mema/muslimkeyboard/adapter/ContactListAdapter.java
b2fe0292a118b681572f97b6ab9506d5c8092dba
[]
no_license
supermobile0211/emojichat_android
e9b094e13f48692c8f6342f9d2da887124f3e0f3
77dcb619d23ae3f53ac28cb78b0dfa6a06567ab3
refs/heads/master
2021-08-16T15:40:37.699803
2017-11-20T03:46:21
2017-11-20T03:46:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,694
java
package com.mema.muslimkeyboard.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.SectionIndexer; import android.widget.TextView; import com.mema.muslimkeyboard.R; import com.mema.muslimkeyboard.bean.User; import com.mema.muslimkeyboard.utility.FirebaseManager; import com.mema.muslimkeyboard.utility.Util; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Locale; /** * Created by cano-02 on 4/4/17. */ public class ContactListAdapter extends BaseAdapter implements SectionIndexer { private String mSections = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private ArrayList<User> mCurrentList; private ArrayList<User> mFilterList; private Context mContext; public ContactListAdapter(ArrayList<User> listData, Context mContext) { super(); this.mContext = mContext; this.mCurrentList = new ArrayList<>(); this.mFilterList = new ArrayList<>(); if (listData != null) { this.mCurrentList.addAll(listData); this.mFilterList.addAll(listData); } } @Override public int getCount() { if (mFilterList != null) return mFilterList.size(); else return 0; } @Override public User getItem(int position) { if (mFilterList != null) return mFilterList.get(position); else return null; } @Override public long getItemId(int position) { return position; } public void onItemSelected(int position) { } public void filter(String charText) { charText = charText.toLowerCase(Locale.getDefault()); mCurrentList.clear(); mCurrentList.addAll(FirebaseManager.getInstance().friendList); Collections.sort(mCurrentList, new ContactListAdapter.UserNameComparator()); mFilterList.clear(); if (charText.length() == 0) { mFilterList.addAll(mCurrentList); } else { for (User wp : FirebaseManager.getInstance().friendList) { if (wp.username != null && !wp.username.equals("")) if (wp.username.toLowerCase().contains(charText)) { mFilterList.add(wp); } } } notifyDataSetChanged(); } @Override public View getView(int position, View convertView, ViewGroup parent) { final int p = position; LayoutInflater inflater = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (convertView == null) convertView = inflater.inflate(R.layout.activity_contact_list_sel_item, null); try { TextView textRow = (TextView) convertView.findViewById(R.id.tv_name); User user = getItem(position); textRow.setText(user.username); TextView textLetter = (TextView) convertView.findViewById(R.id.tv_letter); textLetter.setText(""); User curUser = getItem(position); String curFirstLetter = curUser.username.toLowerCase().substring(0, 1); View sectionDivider = (View) convertView.findViewById(R.id.sectionDivider); sectionDivider.setVisibility(View.INVISIBLE); if (position != 0) { User prevUser = getItem(position - 1); String prevFirstLetter = prevUser.username.substring(0, 1).toLowerCase(); if (prevFirstLetter.equals(curFirstLetter)) { textLetter.setText(""); } else { textLetter.setText(curFirstLetter.toUpperCase()); sectionDivider.setVisibility(View.VISIBLE); } } else { textLetter.setText(curFirstLetter.toUpperCase()); } ImageView ivCheck = (ImageView) convertView.findViewById(R.id.check_image); boolean bExist = false; for (User u : Util.getInstance().selFriends) { if (u.email.equals(curUser.email)) { bExist = true; break; } } if (bExist) { ivCheck.setImageResource(R.mipmap.checked); } else { ivCheck.setImageResource(R.mipmap.unchecked); } TextView tvLastSeen = (TextView) convertView.findViewById(R.id.tv_lastseen); if (user.lastSeen == 0) tvLastSeen.setText(""); else tvLastSeen.setText(String.valueOf(user.lastSeen)); } catch (Exception e) { } return convertView; } @Override public int getPositionForSection(int section) { for (int j = 0; j < getCount(); j++) { if (section == 0) { // For numeric section for (int k = 0; k <= 9; k++) { String text = null; try { User user = mFilterList.get(j); text = user.username; } catch (Exception e) { } if (text == null) return 0; else if (String.valueOf(text.charAt(0)).toLowerCase().equals(String.valueOf(String.valueOf(k)).toString().toLowerCase())) return j; } } else { String artist = null; try { User user = mFilterList.get(j); artist = user.username; } catch (Exception e) { } if (artist == null) return 0; else if (String.valueOf(artist.charAt(0)).toLowerCase().equals(String.valueOf(mSections.charAt(section)).toString().toLowerCase())) { return j; } } } return 0; } @Override public int getSectionForPosition(int position) { return 0; } @Override public Object[] getSections() { String[] sections = new String[mSections.length()]; for (int i = 0; i < mSections.length(); i++) sections[i] = String.valueOf(mSections.charAt(i)); return sections; } public class UserNameComparator implements Comparator<User> { public int compare(User left, User right) { return left.username.compareTo(right.username); } } }
bc26ad46796a6105393e79e5f7d1a72edd0a273d
b747b98042f3232e974acb9d0c8d06d431720cf1
/src/main/java/com/ane/domain/UserRole.java
c442828a67f420f9ff33ac0a5c696a13c901ea00
[]
no_license
xiaojunjas/ane_user
cc66877120c04e3d9ac7eae37b13abfa2d35060d
501fcee66bea509bb8844f1c6638b5ab5b30a913
refs/heads/master
2021-08-14T10:35:17.549576
2017-11-15T11:20:00
2017-11-15T11:20:00
107,525,879
0
0
null
null
null
null
UTF-8
Java
false
false
891
java
package com.ane.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown=true) public class UserRole { private Long id; private Long userId; private Integer type; //0用户角色 1组织角色 private Long refId; private Integer isDeleted; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } public Long getRefId() { return refId; } public void setRefId(Long refId) { this.refId = refId; } public Integer getIsDeleted() { return isDeleted; } public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } }
[ "xiaojun@DESKTOP-ERCUHFH" ]
xiaojun@DESKTOP-ERCUHFH
4b5f8f3573d3ca7797118b68fab340336b2e3276
92b9f7b4e2a1b0eaddb3b09b099a87ecea1942f3
/src/com/luv2code/hibernate/demo/GetInstructorCoursesDemo.java
9d21e7a4ec12deed3bf1f43455b027dd2b41e5fa
[]
no_license
FedotovDV/2020-Hibernate-Practice-hb-05-many-to-many
9d8cf1cc6c0dbc6c70ca4bddf19b45dab4b52e1d
0be86cd380ea96d8b975966ed79b4674d573c2b5
refs/heads/master
2022-07-29T05:09:06.804702
2020-05-22T19:24:08
2020-05-22T19:24:08
266,313,710
0
0
null
null
null
null
UTF-8
Java
false
false
1,171
java
package com.luv2code.hibernate.demo; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import com.luv2code.hibernate.demo.entity.Course; import com.luv2code.hibernate.demo.entity.Instructor; import com.luv2code.hibernate.demo.entity.InstructorDetail; public class GetInstructorCoursesDemo { public static void main(String[] args) { try (SessionFactory factory = new Configuration().configure("hibernate.cfg.xml") .addAnnotatedClass(Instructor.class).addAnnotatedClass(InstructorDetail.class) .addAnnotatedClass(Course.class).buildSessionFactory(); Session session = factory.getCurrentSession()) { // start a transaction session.beginTransaction(); // get the instructor from db int theId = 1; Instructor tempInstructor = session.get(Instructor.class, theId); System.out.println("Instructor: " + tempInstructor); // get courses for the instructor System.out.println("Courses: " + tempInstructor.getCourses()); // commit transaction session.getTransaction().commit(); System.out.println("Done!"); } catch (Exception exc) { exc.printStackTrace(); } } }
cf92a8b06dae842481342859ff5dc30eee4446c4
4aa90348abcb2119011728dc067afd501f275374
/app/src/main/java/com/tencent/mm/plugin/wallet_payu/remittance/ui/PayURemittanceDetailUI$3$1.java
bcf054eecec64622f61f656e14894ae2444225fb
[]
no_license
jambestwick/HackWechat
0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6
6a34899c8bfd50d19e5a5ec36a58218598172a6b
refs/heads/master
2022-01-27T12:48:43.446804
2021-12-29T10:36:30
2021-12-29T10:36:30
249,366,791
0
0
null
2020-03-23T07:48:32
2020-03-23T07:48:32
null
UTF-8
Java
false
false
507
java
package com.tencent.mm.plugin.wallet_payu.remittance.ui; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import com.tencent.mm.plugin.wallet_payu.remittance.ui.PayURemittanceDetailUI.3; class PayURemittanceDetailUI$3$1 implements OnClickListener { final /* synthetic */ 3 tdD; PayURemittanceDetailUI$3$1(3 3) { this.tdD = 3; } public final void onClick(DialogInterface dialogInterface, int i) { this.tdD.tdB.bnW(); } }
77ed4cb4d449287cf7d64f2adaa65048612541db
d3e0b5feedd4f97718699edf7a4c8accd7b9c2a0
/datavec-hadoop/src/test/java/org/datavec/hadoop/records/reader/TestMapFileRecordReaderMultipleParts.java
26a89d1f263b438551dc89f0fcdf93ef1cee7109
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
benmccann/DataVec
e52e4bdec08d7f00c9b632fcc2c3557341db605c
19616a8e1b6aae5a3c2bba3126f929585440e4e9
refs/heads/master
2021-01-15T22:01:58.611786
2017-08-09T10:22:21
2017-08-09T10:22:21
99,883,336
0
0
null
2017-08-10T05:05:31
2017-08-10T05:05:31
null
UTF-8
Java
false
false
11,083
java
/*- * * Copyright 2017 Skymind, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. */ package org.datavec.hadoop.records.reader; import com.google.common.io.Files; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.*; import org.datavec.api.berkeley.Pair; import org.datavec.api.records.reader.RecordReader; import org.datavec.api.records.reader.SequenceRecordReader; import org.datavec.api.split.FileSplit; import org.datavec.api.split.InputSplit; import org.datavec.api.util.RandomUtils; import org.datavec.api.writable.DoubleWritable; import org.datavec.api.writable.IntWritable; import org.datavec.api.writable.Text; import org.datavec.hadoop.records.reader.mapfile.IndexToKey; import org.datavec.hadoop.records.reader.mapfile.MapFileRecordReader; import org.datavec.hadoop.records.reader.mapfile.MapFileSequenceRecordReader; import org.datavec.hadoop.records.reader.mapfile.index.LongIndexToKey; import org.datavec.hadoop.records.reader.mapfile.record.RecordWritable; import org.datavec.hadoop.records.reader.mapfile.record.SequenceRecordWritable; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.io.IOException; import java.lang.reflect.Field; import java.net.URI; import java.util.*; import static org.junit.Assert.*; /** * Basically the same as TestMapfileRecordReader, but we have multiple parts as per say a Spark save operation * Paths are like * /part-r-00000/data * /part-r-00000/index * /part-r-00001/data * /part-r-00001/index * /part-r-00002/data * /part-r-00002/index */ public class TestMapFileRecordReaderMultipleParts { private static File tempDirSeq; private static File tempDir; private static Path seqMapFilePath; private static Path mapFilePath; private static Map<LongWritable, SequenceRecordWritable> seqMap; private static Map<LongWritable, RecordWritable> recordMap; @BeforeClass public static void buildMapFiles() throws IOException { //----- Sequence RR setup ----- Configuration c = new Configuration(); Class<? extends WritableComparable> keyClass = LongWritable.class; Class<? extends Writable> valueClass = SequenceRecordWritable.class; SequenceFile.Writer.Option[] opts = new SequenceFile.Writer.Option[] {MapFile.Writer.keyClass(keyClass), SequenceFile.Writer.valueClass(valueClass)}; tempDirSeq = Files.createTempDir(); File[] subdirs = new File[3]; Path[] paths = new Path[subdirs.length]; MapFile.Writer[] writers = new MapFile.Writer[subdirs.length]; for (int i = 0; i < subdirs.length; i++) { subdirs[i] = new File(tempDirSeq, "part-r-0000" + i); subdirs[i].mkdir(); paths[i] = new Path("file:///" + subdirs[i].getAbsolutePath()); writers[i] = new MapFile.Writer(c, paths[i], opts); } seqMapFilePath = new Path("file:///" + tempDirSeq.getAbsolutePath()); seqMap = new HashMap<>(); for (int i = 0; i < 9; i++) { seqMap.put(new LongWritable(i), new SequenceRecordWritable(Arrays.asList( Arrays.<org.datavec.api.writable.Writable>asList(new Text(i + "-0"), new IntWritable(3 * i), new DoubleWritable(3 * i)), Arrays.<org.datavec.api.writable.Writable>asList(new Text(i + "-1"), new IntWritable(3 * i + 1), new DoubleWritable(3 * i + 1.0)), Arrays.<org.datavec.api.writable.Writable>asList(new Text(i + "-2"), new IntWritable(3 * i + 2), new DoubleWritable(3 * i + 2.0))))); } //Need to write in order, to different map files separately for (int i = 0; i < seqMap.size(); i++) { int mapFileIdx = i / writers.length; LongWritable key = new LongWritable(i); SequenceRecordWritable value = seqMap.get(key); writers[mapFileIdx].append(key, value); } for (MapFile.Writer m : writers) { m.close(); } //----- Standard RR setup ----- valueClass = RecordWritable.class; opts = new SequenceFile.Writer.Option[] {MapFile.Writer.keyClass(keyClass), SequenceFile.Writer.valueClass(valueClass)}; tempDir = Files.createTempDir(); subdirs = new File[3]; paths = new Path[subdirs.length]; writers = new MapFile.Writer[subdirs.length]; for (int i = 0; i < subdirs.length; i++) { subdirs[i] = new File(tempDir, "part-r-0000" + i); subdirs[i].mkdir(); paths[i] = new Path("file:///" + subdirs[i].getAbsolutePath()); writers[i] = new MapFile.Writer(c, paths[i], opts); } mapFilePath = new Path("file:///" + tempDir.getAbsolutePath()); recordMap = new HashMap<>(); for (int i = 0; i < 9; i++) { recordMap.put(new LongWritable(i), new RecordWritable(Arrays.<org.datavec.api.writable.Writable>asList( new Text(String.valueOf(i)), new IntWritable(i), new DoubleWritable(i)))); } //Need to write in order for (int i = 0; i < recordMap.size(); i++) { int mapFileIdx = i / writers.length; LongWritable key = new LongWritable(i); RecordWritable value = recordMap.get(key); writers[mapFileIdx].append(key, value); } for (MapFile.Writer m : writers) { m.close(); } } @AfterClass public static void destroyMapFiles() { tempDirSeq.delete(); tempDirSeq = null; seqMapFilePath = null; seqMap = null; tempDir.delete(); tempDir = null; mapFilePath = null; seqMap = null; } @Test public void testSequenceRecordReader() throws Exception { SequenceRecordReader seqRR = new MapFileSequenceRecordReader(); URI uri = seqMapFilePath.toUri(); InputSplit is = new FileSplit(new File(uri)); seqRR.initialize(is); //Check number of records calculation Field f = MapFileSequenceRecordReader.class.getDeclaredField("indexToKey"); f.setAccessible(true); IndexToKey itk = (IndexToKey) f.get(seqRR); assertEquals(seqMap.size(), itk.getNumRecords()); //Check indices for each map file List<Pair<Long, Long>> expReaderExampleIdxs = new ArrayList<>(); expReaderExampleIdxs.add(new Pair<>(0L, 2L)); expReaderExampleIdxs.add(new Pair<>(3L, 5L)); expReaderExampleIdxs.add(new Pair<>(6L, 8L)); f = LongIndexToKey.class.getDeclaredField("readerIndices"); f.setAccessible(true); assertEquals(expReaderExampleIdxs, f.get(itk)); // System.out.println(f.get(itk)); //Check standard iteration order (no randomization) assertTrue(seqRR.hasNext()); int count = 0; while (seqRR.hasNext()) { List<List<org.datavec.api.writable.Writable>> l = seqRR.sequenceRecord(); assertEquals(seqMap.get(new LongWritable(count)).getSequenceRecord(), l); count++; } assertFalse(seqRR.hasNext()); assertEquals(seqMap.size(), count); seqRR.close(); //Try the same thing, but with random order seqRR = new MapFileSequenceRecordReader(new Random(12345)); seqRR.initialize(is); //Check order is defined and as expected f = MapFileSequenceRecordReader.class.getDeclaredField("order"); f.setAccessible(true); int[] order = (int[]) f.get(seqRR); assertNotNull(order); int[] expOrder = new int[9]; for (int i = 0; i < expOrder.length; i++) { expOrder[i] = i; } RandomUtils.shuffleInPlace(expOrder, new Random(12345)); assertArrayEquals(expOrder, order); // System.out.println(Arrays.toString(expOrder)); count = 0; while (seqRR.hasNext()) { List<List<org.datavec.api.writable.Writable>> l = seqRR.sequenceRecord(); assertEquals(seqMap.get(new LongWritable(expOrder[count])).getSequenceRecord(), l); count++; } } @Test public void testRecordReaderMultipleParts() throws Exception { RecordReader rr = new MapFileRecordReader(); URI uri = mapFilePath.toUri(); InputSplit is = new FileSplit(new File(uri)); rr.initialize(is); //Check number of records calculation Field f = MapFileRecordReader.class.getDeclaredField("indexToKey"); f.setAccessible(true); IndexToKey itk = (IndexToKey) f.get(rr); assertEquals(seqMap.size(), itk.getNumRecords()); //Check indices for each map file List<Pair<Long, Long>> expReaderExampleIdxs = new ArrayList<>(); expReaderExampleIdxs.add(new Pair<>(0L, 2L)); expReaderExampleIdxs.add(new Pair<>(3L, 5L)); expReaderExampleIdxs.add(new Pair<>(6L, 8L)); f = LongIndexToKey.class.getDeclaredField("readerIndices"); f.setAccessible(true); assertEquals(expReaderExampleIdxs, f.get(itk)); assertTrue(rr.hasNext()); int count = 0; while (rr.hasNext()) { List<org.datavec.api.writable.Writable> l = rr.next(); assertEquals(recordMap.get(new LongWritable(count)).getRecord(), l); count++; } assertEquals(recordMap.size(), count); rr.close(); //Try the same thing, but with random order rr = new MapFileRecordReader(new Random(12345)); rr.initialize(is); f = MapFileRecordReader.class.getDeclaredField("order"); f.setAccessible(true); int[] order = (int[]) f.get(rr); assertNotNull(order); int[] expOrder = new int[9]; for (int i = 0; i < expOrder.length; i++) { expOrder[i] = i; } RandomUtils.shuffleInPlace(expOrder, new Random(12345)); assertArrayEquals(expOrder, order); count = 0; while (rr.hasNext()) { List<org.datavec.api.writable.Writable> l = rr.next(); assertEquals(recordMap.get(new LongWritable(expOrder[count])).getRecord(), l); count++; } } }
a5633a37a154bf6b9fa4e3471db5e26fd41623a7
46146c193d8119ebc8cfbd49006441a6d83f7265
/components/test/src/main/java/com/sun/j2ee/blueprints/test/jdbc/DatabasePopulator.java
cb9399f2f392722992aea71541f41b27c9b37f75
[]
no_license
mahendrakawde/springstore
c9223bdee21e138754052bfffd05de29b322e634
ebc0c44a7c8b4baae3525869cf346f25349cb544
refs/heads/master
2021-01-10T07:49:10.246233
2009-10-07T10:36:34
2009-10-07T10:36:34
43,947,345
1
0
null
null
null
null
UTF-8
Java
false
false
3,240
java
package com.sun.j2ee.blueprints.test.jdbc; import javax.sql.DataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.core.io.Resource; import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; import org.springframework.test.jdbc.SimpleJdbcTestUtils; import org.springframework.util.Assert; /** * @author M. Deinum ([email protected]) */ public class DatabasePopulator implements InitializingBean, DisposableBean { private final Logger logger = LoggerFactory.getLogger(DatabasePopulator.class); // configurable properties private Resource schemaLocation; private Resource dropSchemaLocation; private Resource testDataLocation; private DataSource dataSource; private SimpleJdbcTemplate simpleJdbcTemplate; private boolean dropBeforeCreate; /** * Sets the location of the file containing the schema DDL to export to the test database. * @param schemaLocation the location of the database schema DDL */ public void setSchemaLocation(Resource schemaLocation) { this.schemaLocation = schemaLocation; } /** * Sets the location of the file containing the schema DDL to drop to the test database. * @param schemaLocation the location of the drop-schema DDL */ public void setDropSchemaLocation(Resource dropSchemaLocation) { this.dropSchemaLocation = dropSchemaLocation; } /** * Sets the location of the file containing the test data to load into the database. * @param testDataLocation the location of the test data file */ public void setTestDataLocation(Resource testDataLocation) { this.testDataLocation = testDataLocation; } public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; this.simpleJdbcTemplate=new SimpleJdbcTemplate(this.dataSource); } public void setDropBeforeCreate(boolean dropBeforeCreate) { this.dropBeforeCreate = dropBeforeCreate; } @Override public void afterPropertiesSet() throws Exception { Assert.notNull(this.dataSource, "DataSource is required."); Assert.notNull(this.schemaLocation, "SchemaLocation is required."); Assert.notNull(this.testDataLocation, "TestDataLocation is required."); if (dropBeforeCreate) { Assert.notNull(this.dropSchemaLocation, "dropBeforeCreate is true, dropSchemaLocation must be specified"); } populateDataSource(); if (logger.isDebugEnabled()) { logger.debug("Exported schema in {}", schemaLocation); logger.debug("Loaded test data in {}", testDataLocation); } } // internal helper methods private void populateDataSource() { if (dropBeforeCreate) { SimpleJdbcTestUtils.executeSqlScript(simpleJdbcTemplate, dropSchemaLocation, true); } SimpleJdbcTestUtils.executeSqlScript(simpleJdbcTemplate, this.schemaLocation, false); SimpleJdbcTestUtils.executeSqlScript(simpleJdbcTemplate, this.testDataLocation, true); } public void destroy() throws Exception { if (dropSchemaLocation != null) { SimpleJdbcTestUtils.executeSqlScript(simpleJdbcTemplate, dropSchemaLocation, true); } } }
[ "mdeinum@e78a211c-9125-0410-a6bc-1d1e04c0b581" ]
mdeinum@e78a211c-9125-0410-a6bc-1d1e04c0b581
3f4dab28ff0664b8fc26d6743ad34f73b0f3566f
83c016b032e1931efeade0d2c1b238002dc970bf
/fcf-fhir-cdshooks/src/main/java/org/fujionclinical/cdshooks/CdsHooksUtil.java
3d130faa453ba43c5fed7ad71c209b69c786b67e
[]
no_license
fujionclinical/fujion-clinical-fhir
5a73ea84bdaa316f71872651dfe92f130a33275f
5a681aa6d1f49e54ab2d54327a9a650afe0b8b79
refs/heads/master
2023-07-28T03:25:06.925648
2023-07-05T20:00:03
2023-07-05T20:00:03
140,999,551
1
0
null
2022-12-14T20:55:35
2018-07-15T04:59:30
Java
UTF-8
Java
false
false
3,717
java
/* * #%L * Fujion Clinical Framework * %% * Copyright (C) 2020 fujionclinical.org * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * This Source Code Form is also subject to the terms of the Health-Related * Additional Disclaimer of Warranty and Limitation of Liability available at * * http://www.fujionclinical.org/licensing/disclaimer * * #L% */ package org.fujionclinical.cdshooks; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.rest.client.api.IGenericClient; import com.google.gson.*; import org.fujion.common.Assert; import org.opencds.hooks.lib.json.JsonUtil; import org.opencds.hooks.model.dstu2.util.Dstu2JsonUtil; import org.opencds.hooks.model.r4.util.R4JsonUtil; import org.opencds.hooks.model.r5.util.R5JsonUtil; import org.opencds.hooks.model.response.Indicator; import org.opencds.hooks.model.stu3.util.Stu3JsonUtil; import java.lang.reflect.Type; /** * Static utility methods. */ public class CdsHooksUtil { private static class IndicatorDeserializer implements JsonDeserializer<Indicator> { @Override public Indicator deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { String value = json.getAsString(); return Indicator.resolve(value); } } public static final Gson GSON; public static final JsonUtil JSON_DSTU2 = new Dstu2JsonUtil(); public static final JsonUtil JSON_STU3 = new Stu3JsonUtil(); public static final JsonUtil JSON_R4 = new R4JsonUtil(); public static final JsonUtil JSON_R5 = new R5JsonUtil(); static { GsonBuilder builder = new GsonBuilder(); builder.registerTypeAdapter(Indicator.class, new IndicatorDeserializer()); GSON = builder.create(); } public static JsonUtil getJsonUtil(IGenericClient fhirClient) { return getJsonUtil(fhirClient.getFhirContext()); } public static JsonUtil getJsonUtil(FhirContext fhirContext) { return getJsonUtil(fhirContext.getVersion().getVersion()); } public static JsonUtil getJsonUtil(FhirVersionEnum version) { switch (version) { case DSTU2: case DSTU2_HL7ORG: return JSON_DSTU2; case DSTU3: return JSON_STU3; case R4: return JSON_R4; case R5: return JSON_R5; default: return Assert.fail("Unsupported FHIR version: %s", version.getFhirVersionString()); } } /** * Constructs a CDS Hook event name. * * @param eventType The event type. * @param components Additional components to append to the event. * @return The constructed event. */ public static String makeEventName(String eventType, String... components) { StringBuilder sb = new StringBuilder("cdshook.").append(eventType); for (String component: components) { sb.append(".").append(component.replace(".", "_")); } return sb.toString(); } private CdsHooksUtil() { } }
38615dda3dea7be3e98a864f79aa212f5d420c5a
32cd70512c7a661aeefee440586339211fbc9efd
/aws-java-sdk-inspector/src/main/java/com/amazonaws/services/inspector/model/AssessmentTarget.java
58b734a6731004d0aaa58d1517913c462ba54a1a
[ "Apache-2.0" ]
permissive
twigkit/aws-sdk-java
7409d949ce0b0fbd061e787a5b39a93db7247d3d
0b8dd8cf5e52ad7ae57acd2ce7a584fd83a998be
refs/heads/master
2020-04-03T16:40:16.625651
2018-05-04T12:05:14
2018-05-04T12:05:14
60,255,938
0
1
Apache-2.0
2018-05-04T12:48:26
2016-06-02T10:40:53
Java
UTF-8
Java
false
false
10,394
java
/* * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights * Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.inspector.model; import java.io.Serializable; /** * <p> * Contains information about an Amazon Inspector application. This data type is * used as the response element in the <a>DescribeAssessmentTargets</a> action. * </p> */ public class AssessmentTarget implements Serializable, Cloneable { /** * <p> * The ARN that specifies the Amazon Inspector assessment target. * </p> */ private String arn; /** * <p> * The name of the Amazon Inspector assessment target. * </p> */ private String name; /** * <p> * The ARN that specifies the resource group that is associated with the * assessment target. * </p> */ private String resourceGroupArn; /** * <p> * The time at which the assessment target is created. * </p> */ private java.util.Date createdAt; /** * <p> * The time at which <a>UpdateAssessmentTarget</a> is called. * </p> */ private java.util.Date updatedAt; /** * <p> * The ARN that specifies the Amazon Inspector assessment target. * </p> * * @param arn * The ARN that specifies the Amazon Inspector assessment target. */ public void setArn(String arn) { this.arn = arn; } /** * <p> * The ARN that specifies the Amazon Inspector assessment target. * </p> * * @return The ARN that specifies the Amazon Inspector assessment target. */ public String getArn() { return this.arn; } /** * <p> * The ARN that specifies the Amazon Inspector assessment target. * </p> * * @param arn * The ARN that specifies the Amazon Inspector assessment target. * @return Returns a reference to this object so that method calls can be * chained together. */ public AssessmentTarget withArn(String arn) { setArn(arn); return this; } /** * <p> * The name of the Amazon Inspector assessment target. * </p> * * @param name * The name of the Amazon Inspector assessment target. */ public void setName(String name) { this.name = name; } /** * <p> * The name of the Amazon Inspector assessment target. * </p> * * @return The name of the Amazon Inspector assessment target. */ public String getName() { return this.name; } /** * <p> * The name of the Amazon Inspector assessment target. * </p> * * @param name * The name of the Amazon Inspector assessment target. * @return Returns a reference to this object so that method calls can be * chained together. */ public AssessmentTarget withName(String name) { setName(name); return this; } /** * <p> * The ARN that specifies the resource group that is associated with the * assessment target. * </p> * * @param resourceGroupArn * The ARN that specifies the resource group that is associated with * the assessment target. */ public void setResourceGroupArn(String resourceGroupArn) { this.resourceGroupArn = resourceGroupArn; } /** * <p> * The ARN that specifies the resource group that is associated with the * assessment target. * </p> * * @return The ARN that specifies the resource group that is associated with * the assessment target. */ public String getResourceGroupArn() { return this.resourceGroupArn; } /** * <p> * The ARN that specifies the resource group that is associated with the * assessment target. * </p> * * @param resourceGroupArn * The ARN that specifies the resource group that is associated with * the assessment target. * @return Returns a reference to this object so that method calls can be * chained together. */ public AssessmentTarget withResourceGroupArn(String resourceGroupArn) { setResourceGroupArn(resourceGroupArn); return this; } /** * <p> * The time at which the assessment target is created. * </p> * * @param createdAt * The time at which the assessment target is created. */ public void setCreatedAt(java.util.Date createdAt) { this.createdAt = createdAt; } /** * <p> * The time at which the assessment target is created. * </p> * * @return The time at which the assessment target is created. */ public java.util.Date getCreatedAt() { return this.createdAt; } /** * <p> * The time at which the assessment target is created. * </p> * * @param createdAt * The time at which the assessment target is created. * @return Returns a reference to this object so that method calls can be * chained together. */ public AssessmentTarget withCreatedAt(java.util.Date createdAt) { setCreatedAt(createdAt); return this; } /** * <p> * The time at which <a>UpdateAssessmentTarget</a> is called. * </p> * * @param updatedAt * The time at which <a>UpdateAssessmentTarget</a> is called. */ public void setUpdatedAt(java.util.Date updatedAt) { this.updatedAt = updatedAt; } /** * <p> * The time at which <a>UpdateAssessmentTarget</a> is called. * </p> * * @return The time at which <a>UpdateAssessmentTarget</a> is called. */ public java.util.Date getUpdatedAt() { return this.updatedAt; } /** * <p> * The time at which <a>UpdateAssessmentTarget</a> is called. * </p> * * @param updatedAt * The time at which <a>UpdateAssessmentTarget</a> is called. * @return Returns a reference to this object so that method calls can be * chained together. */ public AssessmentTarget withUpdatedAt(java.util.Date updatedAt) { setUpdatedAt(updatedAt); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getArn() != null) sb.append("Arn: " + getArn() + ","); if (getName() != null) sb.append("Name: " + getName() + ","); if (getResourceGroupArn() != null) sb.append("ResourceGroupArn: " + getResourceGroupArn() + ","); if (getCreatedAt() != null) sb.append("CreatedAt: " + getCreatedAt() + ","); if (getUpdatedAt() != null) sb.append("UpdatedAt: " + getUpdatedAt()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof AssessmentTarget == false) return false; AssessmentTarget other = (AssessmentTarget) obj; if (other.getArn() == null ^ this.getArn() == null) return false; if (other.getArn() != null && other.getArn().equals(this.getArn()) == false) return false; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getResourceGroupArn() == null ^ this.getResourceGroupArn() == null) return false; if (other.getResourceGroupArn() != null && other.getResourceGroupArn().equals( this.getResourceGroupArn()) == false) return false; if (other.getCreatedAt() == null ^ this.getCreatedAt() == null) return false; if (other.getCreatedAt() != null && other.getCreatedAt().equals(this.getCreatedAt()) == false) return false; if (other.getUpdatedAt() == null ^ this.getUpdatedAt() == null) return false; if (other.getUpdatedAt() != null && other.getUpdatedAt().equals(this.getUpdatedAt()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getArn() == null) ? 0 : getArn().hashCode()); hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getResourceGroupArn() == null) ? 0 : getResourceGroupArn() .hashCode()); hashCode = prime * hashCode + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode()); hashCode = prime * hashCode + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode()); return hashCode; } @Override public AssessmentTarget clone() { try { return (AssessmentTarget) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException( "Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
c0f25c63657e8c264d0a874299107af459fac28b
d0f60a3621fc04b8f7dc3d3b414c05f6edcc2de0
/zhaopin-admin/src/main/java/com/zgc/zhaopin/controller/RenderController.java
b8eefac076ad50603cb17eddb53b628a74ca6272
[]
no_license
SmallTiger1998/zgc-ems
9d8574ff23ac5f1b019ad0b970bca40daef6135e
a26cdd71faf22f22c2b6b05733d0175679d11556
refs/heads/master
2022-12-14T17:27:09.445481
2020-09-18T00:36:04
2020-09-18T00:36:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,093
java
package com.zgc.zhaopin.controller; import org.apache.shiro.authz.annotation.RequiresAuthentication; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; import lombok.extern.slf4j.Slf4j; import com.zgc.zhaopin.util.ResultUtil; /** * 页面跳转类 * * @author emirio * @version 1.0 * @date 2019/4/24 14:37 * @since 1.0 */ @Slf4j @Controller public class RenderController { @RequiresAuthentication @GetMapping(value = {"", "/index"}) public ModelAndView home() { return ResultUtil.view("index"); } @RequiresPermissions("users") @GetMapping("/users") public ModelAndView user() { return ResultUtil.view("user/list"); } @RequiresPermissions("resources") @GetMapping("/resources") public ModelAndView resources() { return ResultUtil.view("resources/list"); } @RequiresPermissions("roles") @GetMapping("/roles") public ModelAndView roles() { return ResultUtil.view("role/list"); } @RequiresPermissions("dept") @GetMapping("/dept") public ModelAndView dept() { return ResultUtil.view("dept/list"); } @RequiresPermissions("upload") @GetMapping("/upload") public ModelAndView upload() { return ResultUtil.view("upload/list"); } @RequiresPermissions("download") @GetMapping("/download") public ModelAndView download() { return ResultUtil.view("download/list"); } @RequiresPermissions("employee") @GetMapping("/employee") public ModelAndView employee() { return ResultUtil.view("employee/list"); } @RequiresPermissions("swagger") @GetMapping("/swagger") public ModelAndView swagger() { return ResultUtil.redirect("/swagger-ui.html"); } @RequiresPermissions("knife4j") @GetMapping("/knife4j") public ModelAndView knife4j() { return ResultUtil.redirect("/doc.html"); } }
5564d3b472fb7ab07b0d7ba0eed960b26cc79149
6556cbbffe85267562ab0db5123b2ffd7b4e3249
/src/main/java/com/bhst/wq/request/WqCivilizedSupervisionAddRequest.java
523e071e03d8e1b783dfeb0f61607c5122690111
[]
no_license
suhaihao/wq
30ee2e584223a9c8f4440fa4be70b61a8fce4e68
239c5c6ae8bb711a27d4c4aae92a7f79dbb2f8d4
refs/heads/master
2022-11-24T03:12:09.640703
2020-07-30T03:48:54
2020-07-30T03:48:54
266,343,526
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package com.bhst.wq.request; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; @Data @EqualsAndHashCode(callSuper = false) @ApiModel("文明监督添加修改请求体") public class WqCivilizedSupervisionAddRequest { @ApiModelProperty("唯一id") private Integer id; @ApiModelProperty("图片") private String img; @ApiModelProperty("内容") private String content; @ApiModelProperty("链接") private String link; @ApiModelProperty("地址") private String address; @ApiModelProperty("讨厌数") private Integer dislikes; }
c7a36d6d1b3ca2885662f5b73dbb4c69ac4878f4
370283f27146369a59b8047fa1e45959628e405a
/tms/tms/src/java/com/unify/webcenter/form/empleadoForm.java
da45889a79af5af2df411f03c1cf9f4b58d6a45b
[]
no_license
tebanSalas/TMS
6c947f9270fb7ddea3ec9e79feb0cb37b0f23de3
2a3d166e0c4b74adb22443fb0380b8128fbab143
refs/heads/master
2021-01-19T20:33:08.711289
2017-07-19T14:40:09
2017-07-19T14:40:09
88,516,422
0
0
null
null
null
null
UTF-8
Java
false
false
1,698
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.unify.webcenter.form; import org.apache.struts.validator.ValidatorActionForm; /** * * @author esper */ public class empleadoForm extends ValidatorActionForm{ private int id; private String name; private String firstName; private String operation; private int id_account; /** * @return the id */ public int getId() { return id; } /** * @param id the id to set */ public void setId(int id) { this.id = id; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the firstName */ public String getFirstName() { return firstName; } /** * @param firstName the firstName to set */ public void setFirstName(String firstName) { this.firstName = firstName; } /** * @return the operation */ public String getOperation() { return operation; } /** * @param operation the operation to set */ public void setOperation(String operation) { this.operation = operation; } /** * @return the account */ public int getAccount() { return id_account; } /** * @param account the account to set */ public void setAccount(int account) { this.id_account = account; } }
2923d06c4f8a1e21886ddc65647acfee0bf2a1a1
3c20c4f2d5eccbd056d3611f02f5b7d726ac4d0c
/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromMaybeTest.java
eb6932b07a622f7def855dd145d4f307e08af8d4
[ "Apache-2.0" ]
permissive
scope-demo/RxJava
1129c2c47a6ed6d83d6cd41d984311963e45601b
24113ad45f21e5b422e0cc51973ca5b9abe534c5
refs/heads/3.x
2023-08-04T16:54:32.998785
2021-04-17T16:00:37
2021-04-17T16:00:37
196,037,906
0
0
Apache-2.0
2023-01-17T21:02:05
2019-07-09T15:39:45
Java
UTF-8
Java
false
false
2,554
java
/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See * the License for the specific language governing permissions and limitations under the License. */ package io.reactivex.rxjava3.internal.operators.flowable; import static org.junit.Assert.*; import org.junit.Test; import io.reactivex.rxjava3.core.*; import io.reactivex.rxjava3.exceptions.TestException; import io.reactivex.rxjava3.internal.fuseable.QueueFuseable; import io.reactivex.rxjava3.subjects.MaybeSubject; import io.reactivex.rxjava3.subscribers.TestSubscriber; import io.reactivex.rxjava3.testsupport.TestSubscriberEx; public class FlowableFromMaybeTest extends RxJavaTest { @Test public void success() { Flowable.fromMaybe(Maybe.just(1).hide()) .test() .assertResult(1); } @Test public void empty() { Flowable.fromMaybe(Maybe.empty().hide()) .test() .assertResult(); } @Test public void error() { Flowable.fromMaybe(Maybe.error(new TestException()).hide()) .test() .assertFailure(TestException.class); } @Test public void cancelComposes() { MaybeSubject<Integer> ms = MaybeSubject.create(); TestSubscriber<Integer> ts = Flowable.fromMaybe(ms) .test(); ts.assertEmpty(); assertTrue(ms.hasObservers()); ts.cancel(); assertFalse(ms.hasObservers()); } @Test public void asyncFusion() { TestSubscriberEx<Integer> ts = new TestSubscriberEx<>(); ts.setInitialFusionMode(QueueFuseable.ASYNC); Flowable.fromMaybe(Maybe.just(1)) .subscribe(ts); ts .assertFuseable() .assertFusionMode(QueueFuseable.ASYNC) .assertResult(1); } @Test public void syncFusionRejected() { TestSubscriberEx<Integer> ts = new TestSubscriberEx<>(); ts.setInitialFusionMode(QueueFuseable.SYNC); Flowable.fromMaybe(Maybe.just(1)) .subscribe(ts); ts .assertFuseable() .assertFusionMode(QueueFuseable.NONE) .assertResult(1); } }
37969c8c28a9957d34e9ed919c7e269e6b266e13
52c2ed4a534f157598fdfa7fcdca2181dcb6be80
/microservicecloud/microservicecloud-eureka-7003/src/test/java/com/imooc/springcloud/MicroservicecloudEureka7003ApplicationTests.java
8e93729f32fd36252b6f5ed6b50df9334f5bfcf3
[]
no_license
cbeann/springclouddemo
f21a8f352677283ea7b0f2341ffb471a02d1c92e
75b14804419f52e16ded185f778969da5c26de03
refs/heads/master
2022-07-02T03:54:13.232171
2019-07-26T07:36:17
2019-07-26T07:36:17
198,409,735
1
0
null
2022-06-21T01:32:38
2019-07-23T10:40:47
Java
UTF-8
Java
false
false
368
java
package com.imooc.springcloud; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class MicroservicecloudEureka7003ApplicationTests { @Test public void contextLoads() { } }
[ "15910076071Aa" ]
15910076071Aa
ca25d85e7ed92515b408bbed2cc314acedfa248e
aaa8a24cd40d6aa5c55c94906cfcbaab3c455819
/src/main/java/br/gov/sp/fatec/WebController/AlunoController.java
56b34795eafff10e6b1d1bd180fcb6687a6cf90f
[]
no_license
torresgustavo/ProjectsSpring
9bbd036335808c8a81e00dbcc5855bbcca264238
e498176921ed0a2f7123538f1d3f48367afa7a64
refs/heads/master
2022-05-14T21:52:54.820449
2019-05-18T22:10:39
2019-05-18T22:10:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,391
java
package br.gov.sp.fatec.WebController; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.hibernate.HibernateException; import org.hibernate.id.IdentifierGenerationException; import org.hibernate.validator.constraints.NotBlank; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestClientResponseException; import org.springframework.web.server.ResponseStatusException; import com.fasterxml.jackson.annotation.JsonView; import br.gov.sp.fatec.model.Aluno; import br.gov.sp.fatec.model.Turma; import br.gov.sp.fatec.service.AlunoService; import br.gov.sp.fatec.View.*; @RequestMapping(value = "/aluno") @RestController public class AlunoController { @Autowired private AlunoService alunoService; public void setAlunoService(AlunoService alunoService) { this.alunoService = alunoService; } @RequestMapping(value = "/") public String hello() { return ("Olá Mundo"); } @RequestMapping(value = "/get", method = RequestMethod.GET) @JsonView(View.AlunoCompleto.class) public ResponseEntity get(String ra) { Aluno aluno = alunoService.buscar(ra); if (aluno == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Não foi encontrado aluno com esse RA."); } return ResponseEntity.status(HttpStatus.OK).body(aluno); } @RequestMapping(value = "/getAll", method = RequestMethod.GET) @JsonView(View.AlunoResumo.class) public ResponseEntity getAll() { try { return ResponseEntity.status(HttpStatus.OK).body(alunoService.todos()); } catch (Exception e) { // TODO: handle exception return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Não foi encontrado registro !"); } } @RequestMapping(value = "/getStudents", method = RequestMethod.GET) @JsonView(View.AlunoResumo.class) public ResponseEntity getStudents(String nome, String turma) { List<Aluno> alunos = new ArrayList<Aluno>(); alunos = alunoService.alunosPersonalizados(nome, turma); if (alunos.isEmpty()) { return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Não foram encontrado alunos com os seguintes parâmetros !"); } return ResponseEntity.status(HttpStatus.OK).body(alunos); } @RequestMapping(value = "/cadastrar", method = RequestMethod.POST) @JsonView(View.AlunoCompleto.class) public ResponseEntity save(@RequestBody Aluno aluno, HttpServletRequest request, HttpServletResponse response) { if (aluno.getNome() == null || aluno.getRa() == null || aluno.getTurma().getId() == null) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Os campos obrigatórios não foram preenchidos"); } response.addHeader("Location", request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/usuario/getById?id=" + aluno.getRa()); return ResponseEntity.status(HttpStatus.CREATED).body(alunoService.salvar(aluno)); } }
90241f8dfa719d9a67ea03be7090b72f0054c630
a4441c03b97d3d2c1b55d943a0adb79e71679bd4
/src/Oving4/SSLExample.java
feed1c8b3879111ac17434cfc58296efd6c67ff7
[]
no_license
6Kwecky6/webDev
75cf7b75a3941f15c88a5d3f7a1e3d52b27205f4
905eb31c73b89e626eba39785ab9e66e38eba933
refs/heads/master
2021-10-26T12:00:52.353993
2019-04-12T14:56:34
2019-04-12T14:56:34
174,500,760
0
0
null
null
null
null
UTF-8
Java
false
false
2,871
java
package Oving4; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.SSLServerSocketFactory; import javax.net.ssl.SSLSocketFactory; /** * @web http://java-buddy.blogspot.com/ */ class JavaSSLServer { static final int port = 8000; public static void main(String[] args) { SSLServerSocketFactory sslServerSocketFactory = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault(); try { ServerSocket sslServerSocket = sslServerSocketFactory.createServerSocket(port); System.out.println("SSL ServerSocket started"); System.out.println(sslServerSocket.toString()); Socket socket = sslServerSocket.accept(); System.out.println("ServerSocket accepted"); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); try (BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(socket.getInputStream()))) { String line; while((line = bufferedReader.readLine()) != null){ System.out.println(line); out.println(line); } } System.out.println("Closed"); } catch (IOException ex) { Logger.getLogger(JavaSSLServer.class.getName()) .log(Level.SEVERE, null, ex); } } } class JavaSSLClient { static final int port = 8000; public static void main(String[] args) { SSLSocketFactory sslSocketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); try { Socket socket = sslSocketFactory.createSocket("localhost", port); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); try (BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(socket.getInputStream()))) { Scanner scanner = new Scanner(System.in); while(true){ System.out.println("Enter something:"); String inputLine = scanner.nextLine(); if(inputLine.equals("q")){ break; } out.println(inputLine); System.out.println(bufferedReader.readLine()); } } } catch (IOException ex) { Logger.getLogger(JavaSSLClient.class.getName()) .log(Level.SEVERE, null, ex); } } }
868b7a92ca8e811924247773cd9288eaf03cb8cd
c564a51cb2bf1f868d641e7cea1fa0a799571d26
/HeroesOfEmpire/web/src/main/java/hu/oenik/web/HeroServlet.java
bbe3cd2b20b86718bba49f5b163d16a83c9f16b8
[]
no_license
baranyviki/JavaEE_OENIK_19_osz
328be839ca3a8f9d43d2b4e7b99cc62749739e37
95607ac7556f0ef0cc80ebc4b113adc65d144588
refs/heads/master
2020-07-28T09:29:51.274850
2019-10-02T07:57:35
2019-10-02T07:57:35
209,380,536
0
0
null
2019-10-02T15:01:58
2019-09-18T18:44:48
Java
UTF-8
Java
false
false
2,905
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 hu.oenik.web; import empire.EnvironmentTypes; import hu.oenik.data.Hero; import hu.oenik.data.Hybrid; import hu.oenik.data.Species; import hu.oenik.data.SpeciesRepository; import hu.oenik.data.User; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Viki */ @WebServlet(name = "HeroServlet", urlPatterns = {"/newHero"}) public class HeroServlet extends HttpServlet { // @Inject // UserRepository users; // UserRepository users = new UserRepository(); // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Hero h = new Hero(request.getParameter("name"), request.getParameter("desc")); for (Species s : SpeciesRepository.instance.getSpecies()) { try { Byte b = Byte.parseByte(request.getParameter(s.getName())); Hybrid newHybrid = new Hybrid(s, b); h.getHybrids().add(newHybrid); } catch (NumberFormatException ex) { Logger.getLogger(LoginServlet.class.getName()).log(Level.SEVERE, null, ex); } //response.getWriter().print(s.getName() + " - " + request.getParameter(s.getName())); } User sess = ((User) request.getSession().getAttribute("user")); sess.getHeroes().add(h); request.setAttribute("heroes", sess.getHeroes()); request.setAttribute("empires", sess.getEmpires()); request.setAttribute("species", SpeciesRepository.instance.getSpecies()); List<EnvironmentTypes> envtypes = new ArrayList<>(Arrays.asList(EnvironmentTypes.values())); request.setAttribute("envtypes",envtypes); getServletContext().getRequestDispatcher("/UserHome.jsp").include(request, response); } }
ff8484516393bcbe64bb201b7aa5e0c15a3cb985
cc5cecf031ec154e1a3c564f5be0e272712553d7
/sources/cammentsdk/src/main/java/tv/camment/cammentsdk/events/LoginStatusChangedEvent.java
025df39336c2aeb992020d22c15f6da1e63658cc
[ "MIT" ]
permissive
camment/sdk-android
3e0bcac7bd9929b3a1ca92c6e4c9c9b352c5d8cb
825aa0ef177254561ab8de328b0436593194d52b
refs/heads/master
2018-12-08T07:16:53.242823
2018-09-20T11:18:01
2018-09-20T11:18:01
105,154,501
0
0
null
null
null
null
UTF-8
Java
false
false
87
java
package tv.camment.cammentsdk.events; public final class LoginStatusChangedEvent { }
3dbfdfa0e708e0ee89e72e26b0fd7688164346ca
6a49e54fbd1b34181f1dc647c8b89d0cb85c850d
/src/main/java/edu/nju/dao/BugScoreDao.java
c9d3c8b4f0b08555ed98ae0db9d79b798b2440bd
[]
no_license
BugReportOrg/Bug
85c71859df3e3b2782dd9b7f08116541e732aec2
65a84a6d093cb95c6949de1c51d6cc2a0e53beb4
refs/heads/master
2020-03-19T06:10:15.156806
2018-06-04T08:11:17
2018-06-04T08:11:17
135,996,705
0
0
null
2018-06-04T08:47:07
2018-06-04T08:47:07
null
UTF-8
Java
false
false
937
java
package edu.nju.dao; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Repository; import edu.nju.entities.BugScore; @Repository public class BugScoreDao { @Autowired private MongoOperations mongoOperations; public void save(BugScore score) { mongoOperations.save(score); } public BugScore findById(String id) { Query query = new Query(); query.addCriteria(Criteria.where("_id").is(id)); return mongoOperations.find(query, BugScore.class).get(0); } public List<BugScore> findByIds(List<String> list) { Query query = new Query(); query.addCriteria(Criteria.where("_id").in(list)); return mongoOperations.find(query, BugScore.class); } }
6592824e87bbbc63b02ed8cb2b538c74a57b3acc
d01aeed138d977d761d45124d94d1ce46c5501a2
/src/main/java/FileContentSearch/FileContentSearch/FileComparator.java
11fbce12c3988ed57e227fea61143cf481e2d72e
[]
no_license
ivanlutov/FileContentSearch
b699cad7464b0aa1ade317e5e9f62adeb24e77bf
285759461c6bcb6bcb34d54ad1edbae4f11ae9a8
refs/heads/master
2020-03-20T00:18:43.843246
2018-06-12T08:17:48
2018-06-12T08:17:48
137,039,352
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package FileContentSearch.FileContentSearch; import java.util.Comparator; public class FileComparator implements Comparator<SearchFile> { public int compare(SearchFile f1, SearchFile f2) { if (f1.getSize() == f2.getSize()) { return f1.getName().compareTo(f2.getName()); } //ascending order return Long.compare(f1.getSize(), f2.getSize()); } }
cc99b4d5adcc0af757ba407b8eecc692e17b5efe
cc4c47c54e1f1cfda9e4548051f7d5d0cfca866d
/ametiste-redgreen-driver-streaming/src/main/java/org/ametiste/redgreen/driver/StreamingRequestDriverFactory.java
f707ad9da5d43c42c91e5aa48e25a70b8f31d448
[]
no_license
ametiste-oss/redgreen
6963f61f3fee8a0ee8714d79f2be246fe1475178
e0d88aaff756babae83f27cffe87b9b2d6dd35f5
refs/heads/master
2021-01-10T14:28:03.239369
2015-12-04T11:49:35
2015-12-04T11:49:35
36,320,764
0
0
null
2015-11-09T20:10:21
2015-05-26T20:05:59
Java
UTF-8
Java
false
false
463
java
package org.ametiste.redgreen.driver; import org.ametiste.redgreen.application.request.RequestDriver; import org.ametiste.redgreen.application.request.RequestDriverFactory; /** * * @since */ public class StreamingRequestDriverFactory implements RequestDriverFactory { public static final String DRIVER_FACTORY_NAME = "simpleStreamDriver"; @Override public RequestDriver createComponent() { return new StreamingRequestDriver(); } }
638443ea67ef3ac8f4cb7e2bdfc62ffcf4832739
81b905ad003559a2a68fd30d1e5af975eeeabbc7
/src/br/net/christiano322/PlayMoreSounds/listeners/sounds/JoinServer.java
bd4ca426a9447652be477ef908b5b02a25804be5
[]
no_license
AndyYu168/PlayMoreSounds
1fb596131db4d71b5ba52201e06837be4f43dee6
e8f57bda501ee321a6801ab1ce312df2e3791e02
refs/heads/master
2020-04-05T03:50:44.860945
2018-11-07T10:29:02
2018-11-07T10:29:02
156,529,284
0
0
null
null
null
null
UTF-8
Java
false
false
1,597
java
package br.net.christiano322.PlayMoreSounds.listeners.sounds; import br.net.christiano322.PlayMoreSounds.*; import br.net.christiano322.PlayMoreSounds.api.PlayMoreSounds.*; import br.net.christiano322.PlayMoreSounds.utils.*; import org.bukkit.*; import org.bukkit.entity.*; import org.bukkit.event.*; import org.bukkit.event.player.*; import org.bukkit.scheduler.*; public class JoinServer implements Listener { PMS main; public JoinServer(PMS main) { this.main = main; } @EventHandler(priority = EventPriority.HIGHEST) public void MakeJoin(PlayerLoginEvent e) { final Player p = e.getPlayer(); new BukkitRunnable() { @Override public void run() { if (p.isOnline()) { if (p.hasPlayedBefore()) { EventName event = EventName.JOIN_SERVER; String name = event.toName(); new SoundPlayer(main).playSound(event, main.soundsFile, main.sounds, p, name, null, null, true, null); } else { EventName event = EventName.FIRST_JOIN; String name = event.toName(); new SoundPlayer(main).playSound(event, main.soundsFile, main.sounds, p, name, null, null, true, null); } } } }.runTaskLater(main, 1); if (main.updateFound) { if (p.hasPermission("playmoresounds.update.joinmessage")) { p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&a* PlayMoreSounds has a new update available! *\n > " + main.updateLink)); } } if (main.getConfig().getBoolean("EnableSoundsAfterRelog")) { if (main.ignoredPlayers.contains(p.getName())) { main.ignoredPlayers.remove(p.getName()); } } } }
9544aa3ea7282ef86d637ce6ad0b479c10399681
81d7a90a012bf3539ea5e29e4dbceb60394aef7a
/header/avro-schema-header/src/test/java/com/liveperson/migdalor/avro/TestEvolutionDecoder.java
cb9c72cfe40f92635c7f85865ad4b3bd75dd5517
[ "BSD-3-Clause" ]
permissive
ransilberman/migdalor
169a406fe04b1e07f1e963272c65f39266948bb0
923266b6dad82de6b5c2d40f535cda3f1cb683b6
refs/heads/master
2020-12-26T10:14:08.040720
2013-11-25T08:35:45
2013-11-25T08:35:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,508
java
package com.liveperson.migdalor.avro;/** * Created with IntelliJ IDEA. * User: ehudl * Date: 6/11/13 * Time: 5:50 PM * To change this template use File | Settings | File Templates. */ import com.liveperson.global.CommonHeader; import com.liveperson.global.TestExample; import com.liveperson.migdalor.header.impl.MigdalorHeaderByteSerializer; import com.liveperson.migdalor.schema.api.SchemaDecoder; import com.liveperson.migdalor.schema.api.SchemaEncoder; import com.liveperson.migdalor.schema.exception.MigdalorEncodingException; import com.liveperson.schema.RepoException; import com.liveperson.schema.SchemaRepo; import com.liveperson.schema.impl.InMemSchemaRepo; import org.apache.avro.Schema; import org.apache.avro.generic.GenericData; import org.apache.avro.generic.GenericDatumWriter; import org.apache.avro.generic.GenericRecord; import org.apache.avro.io.Encoder; import org.apache.avro.io.EncoderFactory; import org.codehaus.jackson.JsonFactory; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.JsonParser; import org.codehaus.jackson.map.ObjectMapper; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.util.LinkedList; import java.util.List; public class TestEvolutionDecoder { /** * slf4j Logger */ private static final Logger LOG = LoggerFactory.getLogger(TestEvolutionDecoder.class); public static final String HEADER = "header"; public static final String BODY = "body"; private MigdalorHeaderByteSerializer migdalorHeaderByteSerializer = new MigdalorHeaderByteSerializer(); private static final String runTimeField = "runTimeField"; private static final String runTimeFieldSchema = "{\"type\":\"string\",\"name\":\"%s\",\"default\":\"\"}"; private SchemaEncoder<TestExample> schemaEncoder; private SchemaDecoder<TestExample> schemaDecoder; private SchemaRepo<String> schemaRepo; public final static String version = "1.0"; private Schema schema; @Before public void setUp() throws Exception { TestExample event = TestExample.class.newInstance(); event.setHeader(new CommonHeader()); schema = event.getSchema(); schemaRepo = new InMemSchemaRepo<String>(); schemaEncoder = new AvroEncoderImpl<TestExample>(schemaRepo,schema.toString(), version); schemaDecoder = new AvroDecoderImpl<TestExample>(schemaRepo,schema.toString()); } @Test(expected = MigdalorEncodingException.class) public void testNullRevision() throws MigdalorEncodingException { byte[] encodedWithHeader = migdalorHeaderByteSerializer.baseWrapEvent(new byte[0], "notExistRevision"); TestExample event = schemaDecoder.decode(ByteBuffer.wrap(encodedWithHeader)); } @Test public void testAddFieldCompatible() throws IOException, MigdalorEncodingException, RepoException { String newSchemaRevision = version + "_testBackwardCompatible"; List<Schema.Field> newFields = createNewFields(schema, createRuntimeStringField(runTimeField)); Schema myNewSchema = createNewSchema(schema, newFields); schemaRepo.addSchema(newSchemaRevision, myNewSchema.toString()); GenericRecord datum = createDatum(myNewSchema); LOG.debug("original event [{}]", datum); byte[] encodedWithHeader = migdalorHeaderByteSerializer.baseWrapEvent(datumToBytes(myNewSchema, datum), newSchemaRevision); TestExample event = schemaDecoder.decode(ByteBuffer.wrap(encodedWithHeader)); LOG.debug("event after decoding [{}]", event); CommonHeader originalHeader = (CommonHeader)datum.get(HEADER); Assert.assertEquals(originalHeader.getType().toString(),event.getHeader().getType().toString()); Assert.assertEquals(originalHeader.getTime(),event.getHeader().getTime()); Assert.assertEquals(datum.get(BODY).toString(),event.getBody().toString()); } @Test(expected = MigdalorEncodingException.class) public void testAddFieldCompatibleBadSchema() throws IOException, RepoException, MigdalorEncodingException { String newSchemaRevision = version + "_testBackwardCompatible"; List<Schema.Field> newFields = createNewFields(schema, createRuntimeStringField(runTimeField)); Schema myNewSchema = createNewSchema(schema, newFields); //here i put the original schema instead the new one schemaRepo.addSchema(newSchemaRevision, schema.toString()); GenericRecord datum = createDatum(myNewSchema); LOG.debug("original event [{}]", datum); byte[] encodedWithHeader = migdalorHeaderByteSerializer.baseWrapEvent(datumToBytes(myNewSchema, datum), newSchemaRevision); //should return exception schemaDecoder.decode(ByteBuffer.wrap(encodedWithHeader)); } @Test public void testRemoveField() throws IOException, MigdalorEncodingException, RepoException { String newSchemaRevision = version + "_testForwardCompatible"; List<Schema.Field> newFields = createNewFields(schema, null); removeField(newFields, BODY); Schema myNewSchema = createNewSchema(schema, newFields); schemaRepo.addSchema(newSchemaRevision, myNewSchema.toString()); GenericRecord datum = createDatumNoBody(myNewSchema); LOG.debug("original event [{}]", datum); MigdalorHeaderByteSerializer migdalorHeaderByteSerializer = new MigdalorHeaderByteSerializer(); byte[] encodedWithHeader = migdalorHeaderByteSerializer.baseWrapEvent(datumToBytes(myNewSchema, datum), newSchemaRevision); TestExample event = schemaDecoder.decode(ByteBuffer.wrap(encodedWithHeader)); LOG.debug("event after decoding [{}]", event); CommonHeader original = (CommonHeader)datum.get("header"); Assert.assertEquals(original.getType().toString(),event.getHeader().getType().toString()); Assert.assertEquals(original.getTime(),event.getHeader().getTime()); Assert.assertEquals("",event.getBody().toString()); } private List<Schema.Field> removeField(List<Schema.Field> fields, String fieldName) { int j = getIndexOf(fields, fieldName); if (j != -1) { fields.remove(j); } else { LOG.error("can not remove field [{}] it is not exist", fieldName); } return fields; } private int getIndexOf(List<Schema.Field> fields, String fieldName) { int j = -1; for (int i = 0; i < fields.size(); i++) { if (fields.get(i).name().equals(fieldName)) { j = i; break; } } return j; } private byte[] datumToBytes(Schema myNewSchema, GenericRecord datum) throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Encoder e = EncoderFactory.get().binaryEncoder(outputStream, null); GenericDatumWriter w = new GenericDatumWriter(myNewSchema); w.write(datum, e); e.flush(); return outputStream.toByteArray(); } private GenericRecord createDatum(Schema myNewSchema) { GenericRecord datum = createDatumNoBody(myNewSchema); datum.put(runTimeField, "my run time field "); datum.put(BODY, "this is my body message"); return datum; } private GenericRecord createDatumNoBody(Schema myNewSchema) { GenericRecord datum = new GenericData.Record(myNewSchema); CommonHeader commonHeader = new CommonHeader(); commonHeader.setType("TEST_TYPE"); commonHeader.setTime(System.currentTimeMillis()); datum.put(HEADER, commonHeader); return datum; } private Schema createNewSchema(Schema schema, List<Schema.Field> newFields) { Schema myNewSchema = Schema.createRecord(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.isError()); myNewSchema.setFields(newFields); return myNewSchema; } private List<Schema.Field> createNewFields(Schema originalSchema, Schema.Field field) { List<Schema.Field> oldFields = originalSchema.getFields(); List<Schema.Field> newFields = new LinkedList<Schema.Field>(); if (field != null){ newFields.add(field); } for (Schema.Field curre : oldFields) { newFields.add(new Schema.Field(curre.name(), curre.schema(), curre.doc(), curre.defaultValue())); } return newFields; } public static Schema.Field createRuntimeStringField(String field) throws IOException { Schema runTimeFieldSchemaObj = new Schema.Parser().parse(String.format(runTimeFieldSchema, field)); return new Schema.Field(field, runTimeFieldSchemaObj, "doc", create()); } @SuppressWarnings("no idea what this is but it is working !!") private static JsonNode create() throws IOException { JsonFactory factory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(); JsonParser jp = factory.createJsonParser("{\"k1\":\"v1\"}"); JsonNode actualObj = mapper.readTree(jp); return actualObj; } }
ad2ef648f21971c195e254ac844f43c78a2f0e12
cf611a6cb3966ecdc5f81a8462296f692269ce53
/src/main/java/com/rahnemacollege/domain/AuctionDetail.java
bca9cf66e662cc2fc4a087ad7ffdb9368903a671
[]
no_license
YarandiY/AuctionApplication
aed36c838f7f9689187235f4e0bc1373442c2313
573028f52ee2fad282fa53200cba957985af4d34
refs/heads/main
2023-01-30T02:29:54.357561
2020-12-14T06:46:38
2020-12-14T08:24:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,429
java
package com.rahnemacollege.domain; import lombok.Data; import java.util.List; @Data public class AuctionDetail { private String title; private String description; private long basePrice = -1; private long date = -1; private int categoryId; private int maxNumber = -1; private boolean bookmark = false; private boolean mine = false; private int id; private List<String> pictures; private int current; private Long latestBidTime = null; private int state = 0; private UserDomain winner; public AuctionDetail(AuctionDomain auctionDomain, String description, long lastPrice, UserDomain winner, Long latestBidTime) { this.title = auctionDomain.getTitle(); this.description = description; this.basePrice = lastPrice; this.date = auctionDomain.getDate(); this.categoryId = auctionDomain.getCategoryId(); this.maxNumber = auctionDomain.getMaxNumber(); this.pictures = auctionDomain.getPictures(); this.mine = auctionDomain.isMine(); this.bookmark = auctionDomain.isBookmark(); this.id = auctionDomain.getId(); this.current = auctionDomain.getCurrent(); this.latestBidTime = latestBidTime; this.state = auctionDomain.getState(); this.winner = winner; } }
735a823d572dd8837231b62d0c89169ce50b1276
8b0dae921fab29ce32bd89494871ee7e154a8782
/Fragments/app/src/test/java/br/unitins/fragments/ExampleUnitTest.java
66a83ae76329dec334b547cc755f84ed7c1df81d
[]
no_license
LucasReisss/dispositivos-moveis-1
ed765ad5b2e4dc43d42b52e4d0b5ba3ae64f2ff5
982efc355edb350eb919f2d4c94eaaff89fbe898
refs/heads/main
2023-01-22T12:30:58.842783
2020-12-06T02:43:02
2020-12-06T02:43:02
303,211,793
0
0
null
null
null
null
UTF-8
Java
false
false
381
java
package br.unitins.fragments; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
d4e081c34ce32d806e0b31f9b89abcb94c1c4513
595c6694cfbaab57a0e9a25b235799ce0d605ee1
/app/src/main/java/mondal/sanat/googlemapsgoogleplaces/PlaceAutocompleteAdapter.java
dd631b10276639e36d60fa202b9b10bdb7eed755
[]
no_license
smondalcse/GoogleMapsGooglePlaces
f56035a72f03d2845e11669af0e4940aada0cb1f
9a326306e1143446e3b6b1fbf23ca947587815d7
refs/heads/master
2018-08-29T04:45:35.624280
2018-06-03T14:39:25
2018-06-03T14:39:25
110,223,632
0
0
null
null
null
null
UTF-8
Java
false
false
9,012
java
package mondal.sanat.googlemapsgoogleplaces; import android.content.Context; import android.graphics.Typeface; import android.text.style.CharacterStyle; import android.text.style.StyleSpan; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Filter; import android.widget.Filterable; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.PendingResult; import com.google.android.gms.common.api.Status; import com.google.android.gms.common.data.DataBufferUtils; import com.google.android.gms.location.places.AutocompleteFilter; import com.google.android.gms.location.places.AutocompletePrediction; import com.google.android.gms.location.places.AutocompletePredictionBuffer; import com.google.android.gms.location.places.Places; import com.google.android.gms.maps.model.LatLngBounds; import java.util.ArrayList; import java.util.concurrent.TimeUnit; /** * Adapter that handles Autocomplete requests from the Places Geo Data API. * {@link AutocompletePrediction} results from the API are frozen and stored directly in this * adapter. (See {@link AutocompletePrediction#freeze()}.) * <p> * Note that this adapter requires a valid {@link com.google.android.gms.common.api.GoogleApiClient}. * The API client must be maintained in the encapsulating Activity, including all lifecycle and * connection states. The API client must be connected with the {@link Places#GEO_DATA_API} API. */ public class PlaceAutocompleteAdapter extends ArrayAdapter<AutocompletePrediction> implements Filterable { private static final String TAG = "PlaceAutocompleteAdapter"; private static final CharacterStyle STYLE_BOLD = new StyleSpan(Typeface.BOLD); /** * Current results returned by this adapter. */ private ArrayList<AutocompletePrediction> mResultList; /** * Handles autocomplete requests. */ private GoogleApiClient mGoogleApiClient; /** * The bounds used for Places Geo Data autocomplete API requests. */ private LatLngBounds mBounds; /** * The autocomplete filter used to restrict queries to a specific set of place types. */ private AutocompleteFilter mPlaceFilter; /** * Initializes with a resource for text rows and autocomplete query bounds. * * @see android.widget.ArrayAdapter#ArrayAdapter(android.content.Context, int) */ public PlaceAutocompleteAdapter(Context context, GoogleApiClient googleApiClient, LatLngBounds bounds, AutocompleteFilter filter) { super(context, android.R.layout.simple_expandable_list_item_2, android.R.id.text1); mGoogleApiClient = googleApiClient; mBounds = bounds; mPlaceFilter = filter; } /** * Sets the bounds for all subsequent queries. */ public void setBounds(LatLngBounds bounds) { mBounds = bounds; } /** * Returns the number of results received in the last autocomplete query. */ @Override public int getCount() { return mResultList.size(); } /** * Returns an item from the last autocomplete query. */ @Override public AutocompletePrediction getItem(int position) { return mResultList.get(position); } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = super.getView(position, convertView, parent); // Sets the primary and secondary text for a row. // Note that getPrimaryText() and getSecondaryText() return a CharSequence that may contain // styling based on the given CharacterStyle. AutocompletePrediction item = getItem(position); TextView textView1 = (TextView) row.findViewById(android.R.id.text1); TextView textView2 = (TextView) row.findViewById(android.R.id.text2); textView1.setText(item.getPrimaryText(STYLE_BOLD)); textView2.setText(item.getSecondaryText(STYLE_BOLD)); return row; } /** * Returns the filter for the current set of autocomplete results. */ @Override public Filter getFilter() { return new Filter() { @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults results = new FilterResults(); // We need a separate list to store the results, since // this is run asynchronously. ArrayList<AutocompletePrediction> filterData = new ArrayList<>(); // Skip the autocomplete query if no constraints are given. if (constraint != null) { // Query the autocomplete API for the (constraint) search string. filterData = getAutocomplete(constraint); } results.values = filterData; if (filterData != null) { results.count = filterData.size(); } else { results.count = 0; } return results; } @Override protected void publishResults(CharSequence constraint, FilterResults results) { if (results != null && results.count > 0) { // The API returned at least one result, update the data. mResultList = (ArrayList<AutocompletePrediction>) results.values; notifyDataSetChanged(); } else { // The API did not return any results, invalidate the data set. notifyDataSetInvalidated(); } } @Override public CharSequence convertResultToString(Object resultValue) { // Override this method to display a readable result in the AutocompleteTextView // when clicked. if (resultValue instanceof AutocompletePrediction) { return ((AutocompletePrediction) resultValue).getFullText(null); } else { return super.convertResultToString(resultValue); } } }; } /** * Submits an autocomplete query to the Places Geo Data Autocomplete API. * Results are returned as frozen AutocompletePrediction objects, ready to be cached. * objects to store the Place ID and description that the API returns. * Returns an empty list if no results were found. * Returns null if the API client is not available or the query did not complete * successfully. * This method MUST be called off the main UI thread, as it will block until data is returned * from the API, which may include a network request. * * @param constraint Autocomplete query string * @return Results from the autocomplete API or null if the query was not successful. * @see Places#GEO_DATA_API#getAutocomplete(CharSequence) * @see AutocompletePrediction#freeze() */ private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) { if (mGoogleApiClient.isConnected()) { // Log.i(TAG, "Starting autocomplete query for: " + constraint); // Submit the query to the autocomplete API and retrieve a PendingResult that will // contain the results when the query completes. PendingResult<AutocompletePredictionBuffer> results = Places.GeoDataApi .getAutocompletePredictions(mGoogleApiClient, constraint.toString(), mBounds, mPlaceFilter); // This method should have been called off the main UI thread. Block and wait for at most 60s // for a result from the API. AutocompletePredictionBuffer autocompletePredictions = results .await(60, TimeUnit.SECONDS); // Confirm that the query completed successfully, otherwise return null final Status status = autocompletePredictions.getStatus(); if (!status.isSuccess()) { Toast.makeText(getContext(), "Error contacting API: " + status.toString(), Toast.LENGTH_SHORT).show(); // Log.e(TAG, "Error getting autocomplete prediction API call: " + status.toString()); autocompletePredictions.release(); return null; } //Log.i(TAG, "Query completed. Received " + autocompletePredictions.getCount() + " predictions."); // Freeze the results immutable representation that can be stored safely. return DataBufferUtils.freezeAndClose(autocompletePredictions); } //Log.e(TAG, "Google API client is not connected for autocomplete query."); return null; } }