blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cde2676d207501e19b537c32677c1d755f211ed8 | 0a32ddba7733180bfd75aca15ce2e02ea1742ab9 | /backend/app/src/main/java/com/store/exception/FileContentTypeNotAcceptedException.java | 0f2f84dc49b28256d52378b8f43913f413aabd90 | [] | no_license | lequangphi0611/SKI2015-store-app | 350cca219a39c0125ec811253ced88d24ef27115 | 626c1b0f7391592bcce029513f53c90554bf81dc | refs/heads/master | 2023-01-07T14:21:28.593146 | 2019-06-21T02:37:29 | 2019-06-21T02:37:29 | 188,442,302 | 0 | 0 | null | 2023-01-07T05:57:53 | 2019-05-24T15:06:26 | CSS | UTF-8 | Java | false | false | 511 | java | package com.store.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
public class FileContentTypeNotAcceptedException extends Exception {
private static final long serialVersionUID = -8204749078055441347L;
public FileContentTypeNotAcceptedException() {
super();
}
public FileContentTypeNotAcceptedException(String message) {
super(message);
}
} | [
"lequangphi0611@gmail.com"
] | lequangphi0611@gmail.com |
5e73a1996bc8d70d34785b773ddc0f535b38ceb2 | 92fa805e320fe9f261fb035cb2007137bf948ad7 | /src/Model/AnswerTable_API.java | b75141bbe4b97b84ac027b696eb53e04db561fcd | [] | no_license | imyanyijie/ResearchProject | b408d5a5c50645f98dc5ede74beab2e63a4e5092 | 9205da0240c7d6d0cac800d55d759dc34f39d89b | refs/heads/master | 2020-06-14T20:51:34.161308 | 2016-12-15T19:58:04 | 2016-12-15T19:58:04 | 75,339,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 132 | java | package Model;
import java.util.List;
public interface AnswerTable_API {
void addAnswer(Answer a);
List <Answer> getAnswer();
}
| [
"imyanyijie@gmail.com"
] | imyanyijie@gmail.com |
892c5a121ff236613287a07442aeb018c2d99469 | 0fb8166e06972f61658a9181c80d07d2d4597ce0 | /src/main/java/netty/TimeServerHandler.java | e1d7d4365fddcbce1ae11a8b521dbf62f1f7994a | [] | no_license | XiongBangze/cjs_jvm | 4790ccde2581ba0c231b4e0b8bdb641b302f79d9 | 160abfd2cfabfcfa659a537ea924e2ecdab5f997 | refs/heads/master | 2020-03-23T06:55:17.252272 | 2019-01-24T02:55:11 | 2019-01-24T02:55:11 | 141,237,263 | 0 | 0 | null | 2018-07-17T05:45:26 | 2018-07-17T05:45:26 | null | UTF-8 | Java | false | false | 976 | java | package netty;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
public class TimeServerHandler extends ChannelInboundHandlerAdapter {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
ByteBuf time = ctx.alloc().buffer(4);
time.writeInt((int)(System.currentTimeMillis()/1000L+2208988800L));
ChannelFuture f = ctx.writeAndFlush(time); // (3)
f.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) {
assert f == future;
ctx.close();
}
}); // (4)
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace();
ctx.close();
}
}
| [
"Aa123456"
] | Aa123456 |
38012192a18f32c12d9f7d503447ca07a965495d | 29aa4205be3752a04b8089a8370866d78867ce88 | /src/test/java/com/cgr/CgrApplicationTests.java | 4ef2f01af76c15e7025059bd919c8192732d7cbc | [] | no_license | JeffersonLuizCruz/cgr | ebb58761b41def1ad488ab797a2c8bc7024cf8b0 | 2a6786118f5ccf71560e5716561de791d4a04ceb | refs/heads/main | 2023-05-05T16:42:23.078696 | 2021-05-26T17:45:34 | 2021-05-26T18:38:46 | 371,117,555 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | package com.cgr;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CgrApplicationTests {
@Test
void contextLoads() {
}
}
| [
"jefferson.luiz.cruz@gmail.com"
] | jefferson.luiz.cruz@gmail.com |
ce6ccab858168f4ce303c91cb53d1a64f72621e2 | 37864b256c53445672e99ee6b377fda8b673f625 | /src/test/MyBigInteger.java | e4db65707e9c0d98faeb1a6de005eca80977c15b | [] | no_license | pretty2010kit0/_00_practice | f0f8287c1e2fdb45e4236391394b70954601370e | 7acd2fc1c582f7041dfe54a87eaa8cecaf121e73 | refs/heads/master | 2021-01-10T19:09:37.387944 | 2015-08-19T01:02:11 | 2015-08-19T01:02:11 | 40,954,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package test;
/**
* 设计100亿的计算器时需要这个类
* 见BreakOk.java
* 完整代码参考JDK中的BigInteger类,十分复杂。
* */
public class MyBigInteger {
int sign;//运算符号
byte[] val;//字节数组表示数值的二进制数
public MyBigInteger(String val) {
sign=0;
val=null;
}
public MyBigInteger add(MyBigInteger other){
return null;
}
public MyBigInteger subtract(MyBigInteger other){
return null;
}
public MyBigInteger multiply(MyBigInteger other){
return null;
}
public MyBigInteger divide(MyBigInteger other){
return null;
}
}
| [
"53202955@qq.com"
] | 53202955@qq.com |
9bbd561a81c98449cf9aabcbcfebf951b8db598b | 095e86dcfa99113641afa50ed151a37813320162 | /src/test/java/InstitutionAuthTests.java | 0fd05fdf14bad8241601f4bc848093fe06b97c8f | [
"MIT"
] | permissive | GauravMohla/gereco | 63162c0dd074f84d1dee72d7cdc96b84aa9e4a46 | b46bb750e127730652db74c404b06e6a81ae5271 | refs/heads/master | 2020-08-21T12:58:21.013244 | 2019-10-19T10:04:45 | 2019-10-19T10:04:45 | 216,165,306 | 0 | 0 | MIT | 2019-10-19T07:15:44 | 2019-10-19T07:15:44 | null | UTF-8 | Java | false | false | 1,049 | java | import helpers.InstitutionAuth;
import models.Institution;
import org.junit.Test;
import static helpers.InstitutionAuth.encryptPassword;
import static junit.framework.TestCase.*;
public class InstitutionAuthTests {
private InstitutionAuth institutionAuth = new InstitutionAuth();
@Test
public void encyptPassword(){
String encryptedPassword = "28970aab014cf552b44cf480a4e9a9db47cfc1d6ecd29d8a23a8b4a0aba7395f33ca1695fde9f9" +
"dd36aa3f4eb4404c02a29454fb47632d68f16e26ffeb7bed42";
assertEquals(encryptedPassword, encryptPassword("1234"));
}
@Test
public void successLogin(){
String institutionEmail = "etec@etec.com";
String institutionPassword = "12345";
assertTrue(institutionAuth.login(institutionEmail, institutionPassword));
}
@Test
public void failureLogin(){
String institutionEmail = "etec@etec.com";
String institutionPassword = "1234";
assertFalse(institutionAuth.login(institutionEmail, institutionPassword));
}
}
| [
"pedrogneri@gmail.com"
] | pedrogneri@gmail.com |
79b55f2ac6b1a8303e8da3b9de8efdf4c9577029 | cc93fcf137ad446d1882d2ff210cee9dfceba53a | /src/main/java/paulevs/betternether/world/NetherBiomeAccessType.java | 3547c4cdd85a157740586ac6f018ae6739293a5a | [] | no_license | 2A5F/BetterNether | f891cf586adf8f19c152ec65b312a169c3aaae68 | f5c2f609c0b4af8c75adb5c597e8d9814d2de878 | refs/heads/master | 2023-04-07T09:47:01.364946 | 2020-09-13T16:27:32 | 2020-09-13T16:27:32 | 274,848,071 | 0 | 0 | null | 2023-04-04T00:57:58 | 2020-06-25T06:50:02 | Java | UTF-8 | Java | false | false | 1,359 | java | package paulevs.betternether.world;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeAccess.Storage;
import net.minecraft.world.biome.source.BiomeAccessType;
import paulevs.betternether.config.Config;
import paulevs.betternether.noise.OpenSimplexNoise;
public enum NetherBiomeAccessType implements BiomeAccessType
{
INSTANCE;
private static BiomeMap map;
private static final OpenSimplexNoise NOISE_X = new OpenSimplexNoise(0);
private static final OpenSimplexNoise NOISE_Y = new OpenSimplexNoise(1);
private static final OpenSimplexNoise NOISE_Z = new OpenSimplexNoise(2);
@Override
public Biome getBiome(long seed, int x, int y, int z, Storage storage)
{
double px = x * 0.2;
double py = y * 0.2;
double pz = z * 0.2;
int nx = (int) (NOISE_X.eval(pz, py) * 6 + x);
int ny = (int) (NOISE_Y.eval(px, pz) * 6 + y);
int nz = (int) (NOISE_Z.eval(py, px) * 6 + z);
return map.getBiome(nx, ny, nz);//storage.getBiomeForNoiseGen(nx >> 2, ny >> 2, nz >> 2);
//return storage.getBiomeForNoiseGen(x >> 2, y >> 2, z >> 2);
}
public static void reInitMap(long seed)
{
int sizeXZ = Config.getInt("generator_world", "biome_size_xz", 200);
int sizeY = Config.getInt("generator_world", "biome_size_y", 40);
map = new BiomeMap(seed, sizeXZ, sizeY, true);
}
} | [
"paulevs@yandex.ru"
] | paulevs@yandex.ru |
d63f206f3508f2c87de165bdb3e8b4d814a8b69e | 8e0db6b971b4775bb367893a2f6895104212c924 | /src/dsalgo/easy/grokking/dp/unboundedknapsack/hard/RibbonCut.java | 89b3f5aa0210361078adaab615ec133e7fd5e610 | [] | no_license | JMDTarun/dsalgo | cd05e8cb4ffc2084e13146705be9846bc12db89a | 154c2ba8b6362675ea80e408dc7e2db7eac19880 | refs/heads/master | 2023-05-10T07:43:28.906090 | 2021-06-19T11:50:45 | 2021-06-19T11:50:45 | 253,158,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,528 | java | package dsalgo.easy.grokking.dp.unboundedknapsack.hard;
import java.util.ArrayList;
import java.util.List;
public class RibbonCut {
// Polycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way
// that fulfils the following two conditions:
//
// After the cutting each ribbon piece should have length a, b or c.
// After the cutting the number of ribbon pieces should be maximum.
//
// Help Polycarpus and find the number of ribbon pieces after the required
// cutting.
//
// Constraints-
// 1 <= n, a, b, c <= 4000 The numbers a, b and c can coincide.
//
// Problem Solution
// This seems like a greedy problem but actually is a DP problem. We will create
// an array dp[] to memoize values.
//
// dp[i]=number of ribbon peices for n=i
//
// We will initialize dp[0]=0 and then proceed in a bottom up fashion to
// tabulate the array.
//
// Expected Input and Output
// Case-1:
//
//
// n=5
// a=5
// b=3
// c=2
//
// Expected result=2 (5=3+2)
// Case-2:
//
//
// n=7
// a=5
// b=5
// c=2
//
// Expected result=2 (7=5+2)
// Case-3:
//
//
// n=16
// a=7
// b=5
// c=3
//
// Expected result=4 (16=7+3+3+3)
int maxValue = Integer.MIN_VALUE;
private static List<Integer> list = new ArrayList<Integer>();
public static int cutRibbons(int[] sizes, int length) {
if (length == 0) {
System.out.println(list);
return 0;
}
if (length < 0) {
return 0;
}
int max = Integer.MIN_VALUE;
for (int i = 0; i < sizes.length; i++) {
if (length >= sizes[i]) {
list.add(sizes[i]);
int currentMax = cutRibbons(sizes, length - sizes[i]);
if (currentMax != Integer.MIN_VALUE) {
max = Math.max(max, currentMax + 1);
}
list.remove(list.size() - 1);
}
}
return max;
}
public static int cutRibbonsTopDown(int[] sizes, int length) {
int[] matrix1 = new int[length + 1];
for (int i = 1; i <= length; i++) {
matrix1[i] = Integer.MIN_VALUE;
}
for (int i = 1; i <= length; i++) {
for (int j = 0; j < sizes.length; j++) {
if (i >= sizes[j]) {
int max = matrix1[i - sizes[j]];
if (max != Integer.MIN_VALUE) {
matrix1[i] = Math.max(matrix1[i], 1 + max);
}
}
}
}
return matrix1[length];
}
public static void main(String[] args) {
System.out.println(cutRibbons(new int[] { 3, 5, 7 }, 16));
System.out.println(cutRibbonsTopDown(new int[] { 3, 5, 7 }, 16));
}
}
| [
"jointarun@gmail.com"
] | jointarun@gmail.com |
0846efca02061919028c12d099b3b28dfcffc0b0 | f8ed4b43283225681b1611b1d851bd9693a5396c | /Weekthree/src/weekthree/FormulaTwo.java | 64fee7166ec4d60c4660634225a302b298885e32 | [] | no_license | firnasreyhan/NetBeansProjects | 036e25cf03a94e59dd2704f391869a8b17ad67c6 | c1c833518313dc534b23e9eed7d7669e03066cb2 | refs/heads/master | 2020-04-08T00:38:17.359183 | 2018-12-11T01:26:25 | 2018-12-11T01:26:25 | 158,859,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 703 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package weekthree;
/**
*
* @author Rey
*/
public class FormulaTwo {
public static void main(String[] args) {
float L, panjang, lebar, a, t;
panjang = 78f;
lebar = 17.5f;
L = 2 * (panjang + lebar);
System.out.println("Keliling persegi panjang\t= "+L);
System.out.println("");
a = 53f;
t = 20.5f;
L = 0.5f * a * t;
System.out.println("Luas segitiga\t\t\t= "+L);
}
}
| [
"firnasreyhan@gmail.com"
] | firnasreyhan@gmail.com |
53bcfdc7b7bfc2de19d70dc688874f9135fcfabf | b6120f9d3d3366cf8ba99a150cf48676e34c8fc6 | /src/model/interfaces/IHumiditySensor.java | c201bb552dc2820fe7e2e367f2cc18e01e297f01 | [] | no_license | aldo03/SmartMobilityTesiM | b80639c20ca3bcc974deb310d797baddb7dffbf4 | b84672ac5e797b4133d19797a2d48131df1be085 | refs/heads/master | 2021-01-23T16:17:42.419446 | 2017-09-07T12:55:53 | 2017-09-07T12:55:53 | 102,736,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 283 | java | package model.interfaces;
/**
* Interface that models a humidity sensor that perceives data from the environment
* @author BBC
*
*/
public interface IHumiditySensor {
/**
* gets the current humidity
* @return the humidity
*/
double getCurrentHumidity();
}
| [
"matteo.aldini03@gmail.com"
] | matteo.aldini03@gmail.com |
d6941c37839b53e471c5f76673e541b1bcf10ad2 | 8f4699951453f5cef786c4b1352db1e1085d2c9d | /src/p06/textbook/s061001/Calculator.java | c51cedf3eea4e05f233079bbbe86fbf17efe37f9 | [] | no_license | jungwooparkkk/java20210325 | af808827baa0f15068cbbc0e9f6cae95ffce8494 | 7df220c5070db40cbe85291f38393993760284b6 | refs/heads/master | 2023-04-17T09:53:41.752433 | 2021-05-04T08:09:41 | 2021-05-04T08:09:41 | 351,269,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package p06.textbook.s061001;
public class Calculator {
static double pi = 3.14159;
static int plus(int x, int y) {
return x + y;
}
static int minus(int x, int y) {
return x - y;
}
}
| [
"pjw7935@naver.com"
] | pjw7935@naver.com |
0ebf9d5f260ebd8091f0393a3dadf135c76465a3 | 2a71e2f96ee2eafbe44907c72357d28294ed37f3 | /app/src/androidTest/java/com/ripplehi/ripplehi/ExampleInstrumentedTest.java | 3f578d1ff81b3e4375c4f398b473302b34e39efc | [] | no_license | tom200989/RippleHii | ca9df29502c779c6eea7b55615b7436dd790033e | 959e54975f90f3a1553dea21b71c6bce3db9434e | refs/heads/master | 2021-01-11T16:39:44.542830 | 2017-01-29T04:21:34 | 2017-01-29T04:21:34 | 80,134,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package com.ripplehi.ripplehi;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.ripplehi.ripplehi", appContext.getPackageName());
}
}
| [
"you@example.com"
] | you@example.com |
4acad2d8784deaad0c72f8d53e8ba78ddbb29ef5 | 49e33b856035e9aea77fde07209e072359e53a22 | /java_project/FirstJava/src/ch07/PersonMain.java | 434c4a418661f9c5fc35def0f3d97f2c351bb6d5 | [] | no_license | kimeunbibi/java205 | b013e69ddac5568c0716e5c79ae37af3263b559a | 8ef3a6215a0799bf21394f3e5452d85ed16ff9a7 | refs/heads/main | 2023-07-09T17:23:03.245888 | 2021-08-09T00:14:45 | 2021-08-09T00:14:45 | 370,221,959 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 128 | java | package ch07;
public class PersonMain {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"84178283+kimeunbibi@users.noreply.github.com"
] | 84178283+kimeunbibi@users.noreply.github.com |
5018093d8c51bf6f7fd31004b06d2d7eaebc76d7 | 409dfe85b72f8b3fc82860c2bf0b1679716a9791 | /src/main/java/com/ibm/HelloGreeting/HelloGreetingApplication.java | e02b130300e90a1116fc6b50921cb565e4bffb59 | [] | no_license | shobhit-git2/hellogreeting2 | 75d159e200ee33998b6c1579e6fa77ae92873aa5 | b75a041140611b61198afe186d28dd7a8c5f1fa8 | refs/heads/master | 2020-09-24T00:50:49.338612 | 2019-12-03T16:13:32 | 2019-12-03T16:13:32 | 225,622,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.ibm.HelloGreeting;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HelloGreetingApplication {
public static void main(String[] args) {
SpringApplication.run(HelloGreetingApplication.class, args);
}
}
| [
"shoagraw@in.ibm.com"
] | shoagraw@in.ibm.com |
ea9b181c630c3e93d15fcb8ad918d4518c9bc384 | 4e05bcd2b9d95e52564423fb34c6f83f1c6dca74 | /library/src/test/java/com/github/gfx/android/orma/test/model/ModelWithNamedColumnAndConstructor.java | 79662d512a257e832bd5f598454ae52bc25fe9a7 | [
"Apache-2.0",
"MIT"
] | permissive | TakumaHarada/Android-Orma | 3f8b75d38f66ef24ebe3cc2a95859ff08e4197b8 | 40408cccc2d146f32d7c41136dd4bb8e03ee04ee | refs/heads/master | 2020-08-17T23:51:13.467371 | 2019-10-24T06:45:26 | 2019-10-24T06:45:26 | 215,725,687 | 0 | 0 | NOASSERTION | 2019-10-17T07:05:51 | 2019-10-17T07:05:51 | null | UTF-8 | Java | false | false | 1,487 | java | /*
* Copyright (c) 2015 FUJI Goro (gfx).
*
* 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.github.gfx.android.orma.test.model;
import com.github.gfx.android.orma.annotation.Column;
import com.github.gfx.android.orma.annotation.PrimaryKey;
import com.github.gfx.android.orma.annotation.Setter;
import com.github.gfx.android.orma.annotation.Table;
import android.provider.BaseColumns;
/**
* regression: https://github.com/gfx/Android-Orma/issues/222
*/
@Table
public class ModelWithNamedColumnAndConstructor {
@Column(value = BaseColumns._ID)
@PrimaryKey(autoincrement = true)
private final long id;
@Column(value = "count")
private final int count;
@Setter
public ModelWithNamedColumnAndConstructor(@Setter(BaseColumns._ID) long id, @Setter("count") int count) {
this.id = id;
this.count = count;
}
public long getId() {
return id;
}
public int getCount() {
return count;
}
}
| [
"gfuji@cpan.org"
] | gfuji@cpan.org |
317ebbb2bc37c2979c6047cea5651ba9f074a320 | 02e3ecd5ffd5d65b2a4d63f32b7647c2ab7c7061 | /first-websocket/src/main/java/com/first/demo/websocket/redis/RedisCacheUtil.java | d30fafa587ffaf44198e8fdf70ac1dac6e327b17 | [] | no_license | 1467842/websocket | 7f8901109d4de4ad86503e5ccd665485da2d7fcb | d83f380e85b02d9140a0ecd3597e35be1e17d7f4 | refs/heads/master | 2020-03-26T23:23:54.552680 | 2018-08-22T10:27:01 | 2018-08-22T10:27:01 | 145,534,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,304 | java | package com.first.demo.websocket.redis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotNull;
/**
* Created with IntelliJ IDEA.
* Description:
* User: 郑志辉
* Date: 2018-04-10
* Time: 上午10:01
*/
@Component
public class RedisCacheUtil {
@Autowired
private StringRedisTemplate template;
public void putHash(@NotNull String tk, @NotNull String key, @NotNull String value) {
HashOperations<String, String, String> ops = template.opsForHash();
ops.put(tk, key, value);
}
public String getHashValue(@NotNull String tk, @NotNull String key) {
HashOperations<String, String, String> ops = template.opsForHash();
return ops.get(tk, key);
}
public void removeHash(@NotNull String tk, @NotNull String key) {
HashOperations<String, String, String> ops = template.opsForHash();
ops.delete(tk, key);
}
public boolean hasKey(@NotNull String tk, @NotNull String key) {
HashOperations<String, String, String> ops = template.opsForHash();
return ops.hasKey(tk, key);
}
}
| [
"zhangyunlong@dcjinchan.com"
] | zhangyunlong@dcjinchan.com |
e1e69d99206cdeb0063096f1d34f07eb6515ff3e | b2cffbd02ba407f685a6753296b3ea4351b21b50 | /src/main/java/com/example/apiuser/controller/HealthcheckController.java | dd9d8e661f1bbf15dd39b03d75749b745da2d034 | [] | no_license | ArakakiAriel/java-user-api | ce360383e4a0ea4a7920d5b349c7bcdb59d0a1c7 | 040d451c3569ac836c37e0a37980ee7cb7ba3e0f | refs/heads/master | 2023-07-08T05:11:36.999497 | 2021-08-17T10:33:01 | 2021-08-17T10:33:01 | 369,190,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 677 | java | package com.example.apiuser.controller;
import com.example.apiuser.utils.response.CommonResponse;
import com.example.apiuser.utils.response.Response;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin(origins = "http://localhost:8081")
@RestController
@RequestMapping("/api/v1/healthcheck")
public class HealthcheckController {
@GetMapping()
public Response healthCheck(){
return CommonResponse.setResponseWithOk(null, "Server is on",200);
}
}
| [
"arakaki.arielkenji@gmail.com"
] | arakaki.arielkenji@gmail.com |
dae45c7ee4aa9e82af51de45aadc28e179c373ee | ee2fece384c0b7b58cd40f10227960c9058d2ee6 | /src/main/java/com/homeapp/app/security/SpringSecurityAuditorAware.java | f157f206a22511457dec03657f91a762da869953 | [] | no_license | FredPi17/HomeAutomationApp | 302289b94b4f4a1109c2a81db6f25486c3f38867 | 1e9a98aa091982dd943a866b0ea919deeb9b49db | refs/heads/master | 2022-12-22T15:00:58.568671 | 2020-03-09T18:50:24 | 2020-03-09T18:50:24 | 244,335,080 | 0 | 0 | null | 2022-12-16T05:13:17 | 2020-03-02T09:49:13 | Java | UTF-8 | Java | false | false | 540 | java | package com.homeapp.app.security;
import com.homeapp.app.config.Constants;
import java.util.Optional;
import org.springframework.data.domain.AuditorAware;
import org.springframework.stereotype.Component;
/**
* Implementation of {@link AuditorAware} based on Spring Security.
*/
@Component
public class SpringSecurityAuditorAware implements AuditorAware<String> {
@Override
public Optional<String> getCurrentAuditor() {
return Optional.of(SecurityUtils.getCurrentUserLogin().orElse(Constants.SYSTEM_ACCOUNT));
}
}
| [
"fpinaud17@gmail.com"
] | fpinaud17@gmail.com |
f9b8b3bd682f55883ef161870d263a641aa94626 | 7dc02565b237f6342268d37c0551fbc7bcc93690 | /scouter.common/src/scouter/util/CompressUtil.java | 6818d80a38f54cf0c9d1c601f0e433e349ef038d | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | Hanium-RealTimeScouter/Hanium-Scouter | b9de08c2735d62d0341b67c1d355c97615088d03 | 695ee6e0cd5b50270b71057a29b01902dcf3fcce | refs/heads/master | 2020-12-30T13:08:41.951502 | 2017-08-19T06:49:43 | 2017-08-19T06:49:43 | 91,330,797 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,437 | java | /*
* Copyright 2015 the original author or authors.
* @https://github.com/scouter-project/scouter
*
* 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 scouter.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public class CompressUtil {
public static byte[] doZip(byte[] data) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
java.util.zip.GZIPOutputStream gout = new GZIPOutputStream(out);
gout.write(data);
gout.close();
return out.toByteArray();
}
public static byte[] unZip(byte[] data) throws IOException {
ByteArrayInputStream in = new ByteArrayInputStream(data);
java.util.zip.GZIPInputStream gin = new GZIPInputStream(in);
data = FileUtil.readAll(gin);
gin.close();
return data;
}
} | [
"occidere@naver.com"
] | occidere@naver.com |
c5495f3c6412718d80f360bf0c9c1d820a0a4396 | f47ab0338caee17b44179222d0fb50b51be8a9cf | /springboot-mybatis-annotation-multidatasource/src/test/java/com/example/demo/SpringbootMybatisAnnotationMultidatasourceApplicationTests.java | 77742ea1e29bae02b70990a9afefd96680eafd74 | [] | no_license | jiaozg/spring-boot-all | dec335e10251d747a003e1ba86ca8b00cd07215a | 88bbb08c118d278bcdbbe46e869585e27d4db3f3 | refs/heads/master | 2021-01-23T08:44:57.932265 | 2018-04-10T15:02:33 | 2018-04-10T15:02:33 | 102,546,613 | 91 | 70 | null | 2018-03-06T08:30:26 | 2017-09-06T01:14:58 | JavaScript | UTF-8 | Java | false | false | 369 | java | package com.example.demo;
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 SpringbootMybatisAnnotationMultidatasourceApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"jiaozhiguang@126.com"
] | jiaozhiguang@126.com |
c9b3fee1c8dfec378df4713b7c7dd0b048c85303 | b2b0f00fd6a06e7aab45f96339be0b97edc077e6 | /networking/src/com/emptyPockets/test/controls/menus/EntityMenu.java | beeb54356db68aa27cec16ff14c55d585ed817b0 | [] | no_license | cdbhimani/joeydevolopmenttesting | ecb5d8b6bed2401a972bc4f72226550f6fb2ffbf | 7f5ad39c9bea54db2a6bc26a84905e541fd7c3d5 | refs/heads/master | 2020-03-27T22:40:44.688037 | 2018-02-08T07:28:54 | 2018-02-08T07:28:54 | 40,646,759 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,905 | java | package com.emptyPockets.test.controls.menus;
import java.util.ArrayList;
import com.emptyPockets.test.controls.entities.BaseEntity;
import com.emptyPockets.test.controls.inputs.handlers.EntityInputHandler;
public class EntityMenu implements EntityInputHandler {
BaseEntity owner;
ArrayList<EntityMenuItem> items;
boolean visible = false;
public EntityMenu() {
items = new ArrayList<EntityMenuItem>();
}
public void setOwner(BaseEntity owner) {
this.owner = owner;
}
public BaseEntity getOwner() {
return owner;
}
public ArrayList<EntityMenuItem> getMenuItems() {
return items;
}
public void update() {
synchronized (items) {
for (EntityMenuItem item : items) {
item.updateMenuItem(this);
}
}
}
public void addMenuItem(EntityMenuItem item) {
synchronized (items) {
items.add(item);
}
}
public void removeMenuItem(EntityMenuItem item) {
synchronized (items) {
items.remove(item);
}
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
update();
}
@Override
public boolean touchDown(BaseEntity entity, float x, float y) {
boolean returnValue = false;
synchronized (items) {
for (EntityMenuItem item : items) {
if (item.contains(x, y)) {
if (item.touchDown(x, y)) {
returnValue = true;
}
}
}
}
return returnValue;
}
@Override
public boolean touchUp(BaseEntity entity, float x, float y) {
boolean returnValue = false;
synchronized (items) {
for (EntityMenuItem item : items) {
if (item.contains(x, y)) {
if (item.touchUp(x, y)) {
returnValue = true;
}
}
}
}
return returnValue;
}
@Override
public boolean clicked(BaseEntity entity, float x, float y) {
boolean returnValue = false;
synchronized (items) {
for (EntityMenuItem item : items) {
if (item.contains(x, y)) {
if (item.clicked(x, y)) {
returnValue = true;
}
}
}
}
return returnValue;
}
@Override
public boolean dragged(BaseEntity entity, float x, float y, float offX, float offY) {
boolean returnValue = false;
synchronized (items) {
for (EntityMenuItem item : items) {
if (item.contains(x, y)) {
if (item.dragged(x, y)) {
returnValue = true;
}
}
}
}
return returnValue;
}
@Override
public void selected(BaseEntity entity) {
// TODO Auto-generated method stub
}
@Override
public void unSelected(BaseEntity entity) {
// TODO Auto-generated method stub
}
public boolean contains(float x, float y) {
boolean returnValue = false;
synchronized (items) {
for (EntityMenuItem item : items) {
if (item.contains(x, y)) {
returnValue = true;
}
}
}
return returnValue;
}
}
| [
"joey.enfield@gmail.com"
] | joey.enfield@gmail.com |
7a71334fb4e5518e71075d09f4fd6726fd410e4e | 0f0f4facbb29b172eb62384c2a72e559495eda28 | /src/Practice.java | 049cef24183aa7c7586cd94f84a4e76c7fb2e553 | [] | no_license | RuslanBilyk7/departments | 89b19778b8ac5d65ad3fde65f02d97b6b4381f7c | 926de6b17c61331ff515c7df7782b76817919850 | refs/heads/master | 2020-04-03T20:27:31.239740 | 2018-10-31T11:27:10 | 2018-10-31T11:27:10 | 155,205,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 454 | java | /**
* Created by RUSLAN77 on 23.02.2018 in Ukraine
*/
class Practice {
static int x;
void increment() {
++x;
}
static class static_use {
public static void main(String[] args) {
Practice obj1 = new Practice();
Practice obj2 = new Practice();
obj1.x = 0;
obj1.increment();
obj2.increment();
System.out.println(obj1.x + obj2.x);
}
}
}
| [
"ruslan01234567890123@gmail.com"
] | ruslan01234567890123@gmail.com |
b6254e385bb2556fcd5621d083f84a493a39eb06 | 3af899d503fa6e358ca6e01c22dd5dc75077317d | /src/main/java/com/fh/shop/admin/biz/goods/GoodsServiceImpl.java | f3ee331743269f5c1b14f5a6584a30fe6c45c74e | [] | no_license | zwt-1907/zwt-1977 | 2abe53daaac7f8b14dc481d455783e9eab9cdb11 | c6e2b531aa6dc25368c83829b794e8d9b69d3db7 | refs/heads/master | 2020-04-08T05:09:51.984666 | 2018-11-25T16:06:03 | 2018-11-25T16:06:03 | 159,048,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,172 | java | package com.fh.shop.admin.biz.goods;
import com.fh.shop.admin.common.ServerResponse;
import com.fh.shop.admin.mapper.goods.GoodsDao;
import com.fh.shop.admin.po.Goods;
import com.fh.shop.admin.util.CosUploadFile;
import com.fh.shop.admin.util.DataTableResult;
import com.fh.shop.admin.util.SystemConst;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.File;
import java.util.List;
@Service("goodsService")
public class GoodsServiceImpl implements GoodsService{
@Autowired
private GoodsDao goodsDao;
@Override
public List<Goods> findGoods(Goods goods) {
return goodsDao.findGoods(goods);
}
@Override
public void addGoods(Goods goods) {
goodsDao.addGoods(goods);
}
@Override
public void deleteGoods(List<Integer> ids) {
goodsDao.deleteGoods(ids);
}
@Override
public Goods toUpdateGoods(Integer id) {
return goodsDao.toUpdateGoods(id);
}
@Override
public void updateGoods(Goods goods, String realPath) {
String oldFilePath = goods.getOldGoodsFile();
String newFilePath = goods.getGoodsPhoto();
if (!oldFilePath.equals(newFilePath)){
//删除老图片
/* String filePath = realPath+oldFilePath;
File file = new File(filePath);
if (file.exists()){
file.delete();
}*/
CosUploadFile.deleteFile(oldFilePath.replace(SystemConst.COS_URL,""));
}
goodsDao.updateGoods(goods);
}
@Override
public ServerResponse findgoodsAndCount(Goods goods, Integer draw) {
if (goods.getGoodsName() != null){
goods.setGoodsName("%"+goods.getGoodsName()+"%");
}
int count = goodsDao.pageCount(goods);
List<Goods> goodsList = goodsDao.findGoods(goods);
DataTableResult dataTable = new DataTableResult();
dataTable.setDraw(draw);
dataTable.setiTotalRecords(count);
dataTable.setiTotalDisplayRecords(count);
dataTable.setData(goodsList);
return ServerResponse.success(dataTable);
}
}
| [
"17557288807@163.com"
] | 17557288807@163.com |
b96a677d71b6c15dc610134742eba61fa08da47d | ad68d5d19dc6c6925c0c8e46f826954d761e5d94 | /src/main/java/de/greyshine/utils/beta/objectfilestorage/Metainfo.java | 2a4634d7018544f45d114c2470af993fdafdb6eb | [
"MIT"
] | permissive | greyshine/java-utils | e3353f5115892c34c2a0d1a7bd881f78f7008ac3 | b8369ec3040db24d51792a2e0d240fe629d76939 | refs/heads/master | 2022-11-16T15:49:00.908549 | 2021-04-02T18:51:06 | 2021-04-02T18:51:06 | 45,518,287 | 0 | 0 | NOASSERTION | 2022-11-16T08:33:15 | 2015-11-04T05:53:38 | Java | UTF-8 | Java | false | false | 2,060 | java | package de.greyshine.utils.beta.objectfilestorage;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributes;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import de.greyshine.utils.Timer;
import de.greyshine.utils.Utils;
import de.greyshine.utils.beta.JsonPersister;
public class Metainfo {
private static final JsonPersister JSON_PERSISTER = new JsonPersister();
static final String DTF = "yyyy-mm-dd HH:mm:ss:SSS";
private File file;
/**
* do not rely on the os's file system stamps since the file system could have been copied in the meantime
*/
public LocalDateTime created = Timer.DEFAULT.getLocaDateTime();
public LocalDateTime modified = created;
public String md5;
public String sha256;
final List<String> tags = new ArrayList<>(0);
public Metainfo(File inFile) {
if ( Utils.isNoFile( inFile ) ) {
throw new IllegalArgumentException( inFile +" is no readable file" );
}
file = inFile;
try {
final BasicFileAttributes attr = Files.readAttributes(inFile.toPath(), BasicFileAttributes.class);
attr.creationTime().toInstant();
created = Utils.millisToLocalDateTime( attr.creationTime().toMillis() );
modified = Utils.millisToLocalDateTime( attr.creationTime().toMillis() );
} catch (IOException e) {
throw Utils.toRuntimeException(e);
}
md5 = Utils.getMd5( inFile );
sha256 = Utils.getSha256( inFile );
}
public static Metainfo loadForFile(File inFile) throws IOException {
final File theInfoFile = new File( inFile.getParentFile(), inFile.getName()+".info" );
return JSON_PERSISTER.read(theInfoFile, Metainfo.class);
}
public void write() throws IOException {
final File theInfoFile = new File( file.getParentFile(), file.getName()+".info" );
JSON_PERSISTER.save(theInfoFile, this);
}
public void resetModified() {
modified = Timer.DEFAULT.getLocaDateTime();
md5 = Utils.getMd5( file );
sha256 = Utils.getSha256( file );
}
}
| [
"greyshine@dirks-macbookair.fritz.box"
] | greyshine@dirks-macbookair.fritz.box |
3ada996903894742140ec9cba16fe41bb1f04652 | ff0660c34de230c6157e281657d2c40303d834cf | /pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/comparison/ComparisonResult.java | 78ebfbfeb8c53adf31fffea9ba95e6de8349918c | [
"Apache-2.0"
] | permissive | gipplab/mathosphere | 6fec4aad69dba36c2a5a5c4945ce29844bcfec84 | 557bb3ebf7a410070641eea333ec571286e0305b | refs/heads/master | 2022-12-10T04:53:12.837193 | 2021-12-14T21:26:29 | 2021-12-14T21:26:29 | 21,352,848 | 0 | 0 | Apache-2.0 | 2022-12-10T04:51:53 | 2014-06-30T13:55:04 | Java | UTF-8 | Java | false | false | 1,245 | java | package com.formulasearchengine.mathosphere.pomlp.comparison;
import com.formulasearchengine.mathosphere.pomlp.convertor.Converters;
/**
* @author Andre Greiner-Petter
*/
public class ComparisonResult {
private final int index;
private Double contDist, presDist;
private final Converters converter;
public ComparisonResult(int index, Converters conv ){
this.index = index;
this.converter = conv;
}
public void setContentDistance( double distance ){
this.contDist = distance;
}
public Double getContentDistance(){
return contDist;
}
public void setPresentationDistance( double distance ){
this.presDist = distance;
}
public Double getPresentationDistance(){
return presDist;
}
public int getIndex() {
return index;
}
public Converters getConverter() {
return converter;
}
public String resultToString(){
String dis = contDist != null ? contDist.toString() : "-";
dis += "(" + (presDist != null ? presDist.toString() : "-") + ")";
return dis;
}
@Override
public String toString(){
return converter.name() + ":" + index + "=" + resultToString();
}
}
| [
"andre.greiner-petter@t-online.de"
] | andre.greiner-petter@t-online.de |
9e99b9642c90dff16d7c5476fa615de854a7c9f1 | 48486790cac8126cde4d3917c57d21405d7ea7f0 | /src/main/java/com/ronin/model/constant/Banka.java | 2886cb2ddf2aea5c6f535d015eaa39eae67c669e | [] | no_license | emre5444/remasis-2 | f42187c981210e0cfbae39a9bac47154a0b0bdae | 43694096a1e3018373d27164681c25e2936495f9 | refs/heads/master | 2021-01-16T01:01:29.431247 | 2015-05-12T20:04:23 | 2015-05-12T20:04:23 | 35,674,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,418 | java | package com.ronin.model.constant;
import com.ronin.model.Interfaces.IAbstractEntity;
import org.hibernate.annotations.*;
import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Created by ealtun on 09.03.2014.
*/
@Entity
@Table(name = "banka")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Banka.findAll", query = "SELECT r FROM Banka r")})
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Banka implements IAbstractEntity {
public enum ENUM {
////Buradaki siralama veri tabanindaki siralamadir.
AKBANK(1L,"durum.aktif"),//1
GARANTI(2L,"durum.pasif");//2
private Long id;
private String label;
private ENUM(Long id,String label){
this.id=id;
this.label=label;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
@Id
@GeneratedValue
@Column(name = "id")
private Long id;
@Column(name = "kisa_aciklama")
private String kisaAciklama;
@Column(name = "aciklama")
private String aciklama;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getKisaAciklama() {
return kisaAciklama;
}
public void setKisaAciklama(String kisaAciklama) {
this.kisaAciklama = kisaAciklama;
}
public String getAciklama() {
return aciklama;
}
public void setAciklama(String aciklama) {
this.aciklama = aciklama;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Banka)) return false;
Banka banka = (Banka) o;
if (id != null ? !id.equals(banka.id) : banka.id != null) return false;
return true;
}
@Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
}
}
| [
"fatihcabi@8c96c0c0-8daa-e585-a0db-5c7ea11d28f7"
] | fatihcabi@8c96c0c0-8daa-e585-a0db-5c7ea11d28f7 |
94833145716aefb67801dacd36083d08011f10bd | 52e2a8dfac88650182f4c83ab2ad74f03e8c6369 | /app/src/main/java/com/android/sunuerico/tourguideapp/SitesActivity.java | bd7217c30efe27aa800dd79ba04f4e04958db95c | [] | no_license | ElikplimSunu/Tour-Guide-App | fc91c88df0f8a550fcb7ad05d4f1224ce4ee1e31 | 72bfcdf8e68ad5eb9ffb9d603717f6801c016869 | refs/heads/master | 2022-11-13T16:00:42.073387 | 2020-06-22T00:07:24 | 2020-06-22T00:07:24 | 274,003,363 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 459 | java | package com.android.sunuerico.tourguideapp;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class SitesActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category);
getSupportFragmentManager().beginTransaction()
.replace(R.id.container_of_layout, new SitesFragment())
.commit();
}
}
| [
"sunuerico@gmail.com"
] | sunuerico@gmail.com |
bd1618bcfd19ae5b22a850038179c61e8d453054 | 048813522c16ac0b7fc5fe2f863ac2ab896ce458 | /problems/UVa/shortest_paths/10557/Main.java | b4fbaf770266df1a8869a674ccf46df0851f9c78 | [] | no_license | pkien01/Competitive-Programming-Grind | 5a66b0c815dec56e1bbbe1f20e6faf790ec0c6be | b30d81a17b61ca6ccc964d8f5b2565a3e7b08b7f | refs/heads/main | 2023-09-02T03:53:02.404634 | 2021-11-19T23:53:28 | 2021-11-19T23:53:28 | 365,571,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,954 | java | /*input
4
0 1 2
-100 1 3
1 1 4
0 0
-1
*/
import java.util.*;
import java.io.*;
public class Main {
static void runFromFile() {
final String IODir = "D:/Kien/competitive_programming/io";
final File inputFile = new File(IODir + "/input.txt");
final File outputFile = new File(IODir + "/output.txt");
try {
System.setIn(new FileInputStream(inputFile));
System.setOut(new PrintStream(outputFile));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
static int n;
static int[] energy;
static ArrayList<Integer>[] adj;
static final int inf = (int)2e8;
static boolean solve() {
int[] dist = new int[n];
Arrays.fill(dist, -inf); dist[0] = 100;
for (int i = 0; i < n - 1; i++) {
for (int u = 0; u < n; u++) {
for (Integer v: adj[u]) {
if (dist[u] + energy[v] > 0 && dist[u] + energy[v] > dist[v])
dist[v] = dist[u] + energy[v];
}
}
}
for (int i = 0; i < 2; i++) {
for (int u = 0; u < n; u++) {
if (dist[u] == -inf) continue;
for (Integer v: adj[u])
if (dist[u] + energy[v] > 0 && dist[u] + energy[v] > dist[v]) dist[v] = inf;
}
}
return dist[n - 1] > 0;
}
public static void main(String[] args) {
runFromFile();
Scanner inp = new Scanner(System.in);
//PrintWriter out = new PrintWriter(System.out);
while (true) {
n = inp.nextInt();
if (n == -1) break;
energy = new int[n];
adj = new ArrayList[n];
for (int i = 0; i < n; i++) {
energy[i] = inp.nextInt();
int m = inp.nextInt();
adj[i] = new ArrayList<>();
while (m-- > 0) adj[i].add(inp.nextInt() - 1);
}
System.out.println(solve()? "winnable" : "hopeless");
}
//out.close();
}
} | [
"phamkienxmas2001@gmail.com"
] | phamkienxmas2001@gmail.com |
16b417db842219eac05d410eb035e992e195fa8a | 7c28effc0e4535007729c46c68d474591f34efda | /ShoppingProject/src/java/utils/CheckMD5.java | 490c8116d4ec9126b57dafac92b37acf1110ebd7 | [] | no_license | YuukiHase/ShoppingProjectJavaWebApplication | cd2b8219d29bd264b6660c284f15cce3245af579 | 5facf96f53c5ba9259e01450b13157110c5e8548 | refs/heads/master | 2020-04-29T18:43:44.848929 | 2019-04-17T08:05:22 | 2019-04-17T08:05:22 | 176,332,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 971 | 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 utils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
*
* @author tabal
*/
public class CheckMD5 {
public static String getMD5(String input) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] messageDigest = md.digest(input.getBytes());
return convertByteToHex(messageDigest);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
private static String convertByteToHex(byte[] data) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < data.length; i++) {
sb.append(Integer.toString((data[i] & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
}
}
| [
"42062856+YuukiHase@users.noreply.github.com"
] | 42062856+YuukiHase@users.noreply.github.com |
f54835fa6f7dc01b80517fb6ec231c576a1ee1eb | 00b09c7ca5232d31390f486b92e1809310058d49 | /app/src/main/java/com/talat/pms/dao/DriverQnADao.java | e7be2a46be2476fa8b2598028d4db93a15b8064d | [] | no_license | julie0919/teamproject-talat | 2928023acf754f3717b3cfaa44cdcce98c3f2534 | 8a97c3cc5332a8a00f7faa38c3fbaf6077568126 | refs/heads/main | 2023-05-12T02:11:47.047583 | 2021-06-04T05:12:52 | 2021-06-04T05:12:52 | 365,981,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package com.talat.pms.dao;
import java.util.List;
import com.talat.pms.domain.DriverQnA;
public interface DriverQnADao {
int insert(DriverQnA driverQnA) throws Exception;
List<DriverQnA> findAll() throws Exception;
List<DriverQnA> findByKeyword(String keyword) throws Exception;
DriverQnA findByNo(int no) throws Exception;
int update(DriverQnA driverQnA) throws Exception;
int managerUpdate(DriverQnA driverQnA) throws Exception;
int deleteByJourneyNo(int journeyNo) throws Exception;
int delete(int no) throws Exception;
}
| [
"jinsis0908@naver.com"
] | jinsis0908@naver.com |
993218ffd509616cfefc33b5aa422a217737cbbe | c1e8f12d20e24eeca21b0a63409df82fe923c5ac | /Viet_Anh/src/com/example/basic/PlayBasic.java | 715b0c023d2fcd101803189ebd43743eb2310fcf | [] | no_license | danhhoang19/project | a33361e34caaedcac8f99a5716a12d659313913e | 11121f291577dd9ddc2eee5249a471b2a9827001 | refs/heads/master | 2021-01-20T11:54:58.782416 | 2014-11-05T03:24:22 | 2014-11-05T03:27:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,886 | java | package com.example.basic;
import android.app.ActionBar.LayoutParams;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.AvoidXfermode;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageSwitcher;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewSwitcher.ViewFactory;
import com.example.storage.Activity_Storage;
import com.example.viet_anh.R;
public class PlayBasic extends Activity implements OnClickListener {
private ImageSwitcher switcherl;
private int mPosition = 0;
private ImageView lNext, ivnghe;
private TextView transLearn, textLearn, textView1;
MediaPlayer mediaPlayer;
// private Dialog dialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.playbasic);
textView1 = (TextView) findViewById(R.id.textView1);
ivnghe = (ImageView) findViewById(R.id.ivnghe);
transLearn = (TextView) findViewById(R.id.transLearn);
textLearn = (TextView) findViewById(R.id.textLearn);
switcherl = (ImageSwitcher) findViewById(R.id.switcherl);
switcherl.setFactory(new ViewFactory() {
@Override
public View makeView() {
ImageView myView = new ImageView(getApplicationContext());
myView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
myView.setLayoutParams(new ImageSwitcher.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
return myView;
}
});
Animation in = AnimationUtils.loadAnimation(this,
android.R.anim.slide_in_left);
Animation out = AnimationUtils.loadAnimation(this,
android.R.anim.slide_out_right);
switcherl.setInAnimation(in);
switcherl.setOutAnimation(out);
lNext = (ImageView) findViewById(R.id.lNext);
lNext.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
doPlay();
}
});
}
protected void doPlay() {
switcherl.setImageResource(Activity_Storage.ABC_IMAGE[mPosition]);
transLearn.setText(Activity_Storage.ABC_TEXT2[mPosition]);
textLearn.setText(Activity_Storage.ABC_TEXT[mPosition]);
mediaPlayer = MediaPlayer.create(this,
Activity_Storage.ABC_MEDIA[mPosition]);
mediaPlayer.start();
mPosition = (mPosition + 1) % Activity_Storage.ABC_IMAGE.length;
textView1.setText((mPosition) + " of 26");
// Sự kiện nút nghe
ivnghe.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mediaPlayer.start();
}
});
if (mPosition == 5) {
doDialog();
}
}
private void doDialog() {
mediaPlayer.stop();
final Dialog dialog = new Dialog(PlayBasic.this);
dialog.setContentView(R.layout.dialogbasic);
dialog.getWindow().setBackgroundDrawable(
new ColorDrawable(Color.argb(50, 255, 255, 255)));
dialog.show();
ImageButton button1 = (ImageButton) dialog.findViewById(R.id.button1);
button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mPosition = 0;
dialog.dismiss();
}
});
ImageButton button3 = (ImageButton) dialog.findViewById(R.id.button3);
button3.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent listen = new Intent(PlayBasic.this, ListenBasic.class);
startActivity(listen);
}
});
}
@Override
public void onClick(View v) {
}
}
| [
"mvanhoang7@gmail.com"
] | mvanhoang7@gmail.com |
165486f22a725c6093e190d24e8e01bb8d0eefa8 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-ws/results/MATH-81b-3-10-Single_Objective_GGA-WeightedSum/org/apache/commons/math/linear/EigenDecompositionImpl_ESTest_scaffolding.java | a232ce56163e20b4204ea96a8236975d89c9794f | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,096 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Mar 30 14:45:46 UTC 2020
*/
package org.apache.commons.math.linear;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class EigenDecompositionImpl_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.math.linear.EigenDecompositionImpl";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(EigenDecompositionImpl_ESTest_scaffolding.class.getClassLoader() ,
"org.apache.commons.math.MathException",
"org.apache.commons.math.linear.EigenDecompositionImpl",
"org.apache.commons.math.linear.DecompositionSolver",
"org.apache.commons.math.ConvergenceException",
"org.apache.commons.math.linear.AnyMatrix",
"org.apache.commons.math.MathRuntimeException",
"org.apache.commons.math.linear.InvalidMatrixException",
"org.apache.commons.math.linear.RealVector",
"org.apache.commons.math.MathRuntimeException$1",
"org.apache.commons.math.linear.RealMatrix",
"org.apache.commons.math.MathRuntimeException$2",
"org.apache.commons.math.MaxIterationsExceededException",
"org.apache.commons.math.MathRuntimeException$3",
"org.apache.commons.math.MathRuntimeException$4",
"org.apache.commons.math.MathRuntimeException$5",
"org.apache.commons.math.linear.EigenDecomposition",
"org.apache.commons.math.MathRuntimeException$6",
"org.apache.commons.math.MathRuntimeException$7",
"org.apache.commons.math.MathRuntimeException$8",
"org.apache.commons.math.MathRuntimeException$10",
"org.apache.commons.math.MathRuntimeException$9"
);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
7052b6fa26c07632b1c567326f040f584920bba8 | eea98aee9bf5fe9f731fe73da622d99218583b3c | /Boletin9_4/src/boletin9_4/Tabla.java | 21756eadb6352f01222595497f6b120265919f7b | [] | no_license | aparcerozas/Boletin9 | edf820d30ea7389d6d91c4d6386be729d0ae67ed | 03c2803a74222e8f76a430802eaf6a4bfbfd8143 | refs/heads/master | 2020-04-05T20:57:45.707345 | 2018-11-13T09:59:53 | 2018-11-13T09:59:53 | 157,201,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 873 | 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 boletin9_4;
import javax.swing.JOptionPane;
/**
*
* @author aparcerozas
*/
public class Tabla {
public void tablaMultiplicar(){
int num;
do{
num = Integer.parseInt(JOptionPane.showInputDialog("Introduzca un número entero positivo:"));
if(num > 0){
System.out.println("Tabla de multiplicar del número " + num + ":");
for(int i = 1; i < 11; i++){
System.out.println(num + " * " + i + " = " + num*i);
}
}
else{
JOptionPane.showMessageDialog(null, "Número inválido. Inténtelo de nuevo");
}
}while(num != 0);
}
}
| [
"aparcerozas@victoria11.danielcastelao.org"
] | aparcerozas@victoria11.danielcastelao.org |
4ea0a9563a3f3d7c31bd2f6bccdb0407fb573847 | 2093dd9b55dc4bccea0d0c96fcad68999a45646f | /src/main/java/cn/edu/zust/model/Page.java | 79c1aa061c414303b217ef1749c762cbb9989521 | [] | no_license | JinXin1995/studyonline | 0707cd62b65310c393cc5f2abc83060929c019f8 | c2018011474f2949d6c16d1fccf659bc0bcf2724 | refs/heads/master | 2020-12-03T18:16:28.010324 | 2018-03-16T14:49:54 | 2018-03-16T14:49:54 | 65,961,684 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 811 | java | package cn.edu.zust.model;
import java.util.List;
/**
* Created by King on 2016/10/10 0010.
*/
public class Page<T> {
private int pageNo;
private int pageSize;
private int totalPage;
private List<T> result;
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public List<T> getResult() {
return result;
}
public void setResult(List<T> result) {
this.result = result;
}
}
| [
"807507011@qq.com"
] | 807507011@qq.com |
0d40b5279ae5abddaaa87bd1bf44e81ede639015 | 3d05618ae85fd3aa9d1df2dfe7d36f33cfbc4494 | /stm/src/main/java/org/chenile/stm/model/Transition.java | 24c0ef6dab9bc83a060b10d5f0e04eacb16b34c6 | [
"MIT"
] | permissive | dewesh/chenile | fc375dc481b799c5f37eac17f78ad0f22a6e240e | 88b0634d295a13b23c59c6a835bc517cb0e15399 | refs/heads/master | 2022-12-28T18:42:07.198407 | 2019-11-27T02:38:47 | 2019-11-27T02:38:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,294 | java | package org.chenile.stm.model;
public class Transition extends EventInformation {
public Transition(EventInformation eventInformation) {
this.eventId = eventInformation.eventId;
this.metadata = eventInformation.metadata;
this.transitionAction = eventInformation.transitionAction;
}
public Transition() {}
public String getNewStateId() {
return newStateId;
}
public void setNewStateId(String newStateId) {
this.newStateId = newStateId;
}
public void setNewFlowId(String newFlowId) {
this.newFlowId = newFlowId;
}
public String getNewFlowId() {
return newFlowId;
}
public boolean isRetrievalTransition() {
return retrievalTransition;
}
public void setRetrievalTransition(boolean retrievalTransition) {
this.retrievalTransition = retrievalTransition;
}
public String getStateId() {
return stateId;
}
public void setStateId(String stateId) {
this.stateId = stateId;
}
private String[] acls;
private boolean isInvokableOnlyFromStm = false;
private String newStateId;
private String newFlowId;
private boolean retrievalTransition;
private String stateId;
@Override
public String toString() {
return "Transition [eventId=" + eventId + ", newStateId=" + newStateId
+ ", newFlowId=" + newFlowId + ", retrievalTransition="
+ retrievalTransition + ", transitionAction="
+ transitionAction + ", metadata=" + metadata + "]";
}
public String[] getAcls() {
return acls;
}
public void setAclString(String acl){
if (acl == null) return;
setAcls(acl.split(","));
}
public void setAcls(String[] acls) {
this.acls = acls;
}
public boolean isInvokableOnlyFromStm() {
return isInvokableOnlyFromStm;
}
public void setInvokableOnlyFromStm(boolean isInvokableOnlyFromStm) {
this.isInvokableOnlyFromStm = isInvokableOnlyFromStm;
}
public String toXml(){
StringBuilder sb = new StringBuilder();
sb.append("<transition eventId='" + eventId + "' >\n");
sb.append("<newStateId>" + newStateId + "</newStateId>\n");
sb.append("<newFlowId>" + newFlowId + "</newFlowId>\n");
sb.append("<retrievalTransition>" + retrievalTransition + "</retrievalTransition>\n");
sb.append("<transitionAction>" + transitionAction + "</transitionAction>\n");
sb.append("</transition>\n");
return sb.toString();
}
}
| [
"raja.shankar@meratransport.com"
] | raja.shankar@meratransport.com |
e40a3a0105509ace198f2e78488086dd7ff9f2fb | dd4f8885c3213be09d6bc09286c6d60d625f37b7 | /app/src/main/java/pl/test/face/facetest/MainActivity.java | 420577d0f31d67985a388306023bab318de1c6e1 | [] | no_license | Marchuck/LetsFaceIt | ef9addbf71d8b27978ca13e920a04dff9cea5450 | 105c1f5be888596e7d3a7bf4288ac09030929db9 | refs/heads/master | 2021-01-01T05:19:23.042156 | 2016-04-18T18:22:12 | 2016-04-18T18:22:12 | 56,187,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,207 | java | package pl.test.face.facetest;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import com.facebook.FacebookException;
import com.facebook.internal.WebDialog;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
/*String appID = getResources().getString(R.string.facebook_app_id);
WebDialog dialog = new WebDialog.Builder(this,appID,action,null).setOnCompleteListener(new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
}
}).build();
*/
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"lukasz@MacBook-Pro-ukasz.local"
] | lukasz@MacBook-Pro-ukasz.local |
4bd26b02918abcfa5138445af52208b860cdf650 | 34fcf71e5962a8388ac94c19f46b30f571f13e71 | /fine.java | 6f0a9dbf3c7e7e96cf3bd5348bd717297f2ddce4 | [] | no_license | DevArenaCN/Library_management_system | 5a182c17b012971fc16d1588e746516352ba3389 | 988fb9dfcd8b2b10b0ee44f3b873fa37fa5ef08a | refs/heads/master | 2021-01-10T17:07:19.689867 | 2016-02-22T22:10:54 | 2016-02-22T22:10:54 | 52,309,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,071 | java | /* UNDO: after read check_out_date and eturn date,
if check_out_date is not between 9-12 Friday, can't borrow
if return date after Thuesday 18, can't borrow(date.getDay())
else people can borrow check whether the cam_id avaliable
if not avaliable
add to table waiting list
else
add to table borrow
end
*/
import java.io.*;
import java.sql.*;
import java.util.Scanner;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.text.ParseException;
public class fine {
static final String jdbcURL
= "jdbc:oracle:thin:@ora.csc.ncsu.edu:1521:orcl";
public static void start(String userId) throws ParseException {
SimpleDateFormat df = new SimpleDateFormat("MM/dd/yy");
SimpleDateFormat edf = new SimpleDateFormat("MM/dd/yy HH");
try {
// Load the driver. This creates an instance of the driver
// and calls the registerDriver method to make Oracle Thin
// driver available to clients.
Class.forName("oracle.jdbc.driver.OracleDriver");
String user = "ychen71"; // For example, "jsmith"
String passwd = "200099159"; // Your 9 digit student ID number
//String available_cam = "CREATE VIEW CAMERA_AVAILABLE AS SELECT * FROM CAMERA WHERE NOT EXIST (SELECT fCam_Borrow.cam_id,sCam_Borrow.cam_id FROM fCam_Borrow, sCam_Borrow WHERE fCam_Borrow.cam_id = CAMERA.cam_id AND sCam_Borrow.cam_id = CAMERA.cam_id)";
//get sid from main function
String sid = userId;
Connection conn = null;
Statement searchcam = null;
Statement stmt = null;
ResultSet rs = null;
ResultSet r = null;
PreparedStatement pstmt = null;
String camid = null;
long bfine = 0;
long cfine = 0;
try {
// Get a connection from the first driver in the
// DriverManager list that recognizes the URL jdbcURL
conn = DriverManager.getConnection(jdbcURL, user, passwd);
// Create a statement object that will be sending your
// SQL statements to the DBMS
searchcam = conn.createStatement();
stmt = conn.createStatement();
Scanner x = new Scanner(System.in);
System.out.println("--------------------menu-------------------");
System.out.println("choose function");
System.out.println("1.check fine");
System.out.println("2.clear fine");
int i = x.nextInt();
if(i==1)
{
// searchcam2 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
//camera fine
String selectot = "select * from sCamBorrow where sid='"+sid+"' and OtMark=1";
rs = searchcam.executeQuery(selectot);
while(rs.next())
{
Date checkotmark = rs.getTimestamp("eTime");
String checkottemp = edf.format(checkotmark);
Date checkot = edf.parse(checkottemp);
Date nowt = new Date();
String nowti = edf.format(nowt);
Date nowtime = edf.parse(nowti);
//String camid = rs.getString("cam_id");
//System.out.println(nowti);
//System.out.println(checkottemp);
Long ccfine = nowtime.getTime() - checkot.getTime();
cfine = ccfine/1000/60/60;
//System.out.println("cfine = "+cfine);
}
//book fine
String selectot2 = "select * from sBookBorrow where sid='"+sid+"' and OtMark=1";
rs = searchcam.executeQuery(selectot2);
while(rs.next())
{
Date checkotmark2 = rs.getDate("eTime");
String checkottemp2 = df.format(checkotmark2);
Date checkot2 = df.parse(checkottemp2);
Date nowt2 = new Date();
String nowti2 = df.format(nowt2);
Date nowtime2 = df.parse(nowti2);
//String camid = rs.getString("cam_id");
//System.out.println(nowti2);
//System.out.println(checkottemp2);
Long bbfine = nowtime2.getTime() - checkot2.getTime();
bfine = bbfine/(1000*60*60*12);
//System.out.println("bfine = "+bfine);
}
long fine = (bfine+cfine);
System.out.println("You total fine is "+fine);
String judge = "select * from sfine where sid ='"+sid+"'";
rs = searchcam.executeQuery(judge);
if(rs.next())
{
String updatesfine="update sfine set bookfine ='"+bfine+"' ,camfine ='" +cfine+"' where sid ='"+sid+"'";
stmt.executeUpdate(updatesfine);
}
else
{
String insertsfine="insert into sfine values('"+sid+"' ,'"+bfine+"' ,'"+cfine+" ')";
stmt.executeQuery(insertsfine);
}
}
else if(i==2)
{
String deletefine = "update sfine set bookfine = 0,camfine = 0 where sid ='"+sid+"'";
stmt.executeUpdate(deletefine);
}
else
{
System.out.println("Wrong Input");
}
} finally {
close(rs);
close(searchcam);
close(conn);
}
} catch(Throwable oops) {
oops.printStackTrace();
}
/*
else
{
System.out.println("Today is not Friday, you can't borrow");
}
*/
}
static void close(Connection conn) {
if(conn != null) {
try { conn.close(); } catch(Throwable whatever) {}
}
}
static void close(Statement st) {
if(st != null) {
try { st.close(); } catch(Throwable whatever) {}
}
}
static void close(ResultSet rs) {
if(rs != null) {
try { rs.close(); } catch(Throwable whatever) {}
}
}
}
| [
"ychen71@ncsu.edu"
] | ychen71@ncsu.edu |
db1f54e94ea4a23ded7126ffb15177cb0976535e | e7ee311e20b40c87bf6d23a53a1d7b11fd29d2c3 | /src/chosun/ciis/ss/sls/rdr/ds/SS_A_VSCDDataSet.java | 74f802b505471df6eceee9f18e47f05d28ffada7 | [] | no_license | nosmoon/misdevteam | 4e3695ef7bbdcd231bb84d7d8d7df54a23ff0a60 | 1829d5bd489eb6dd307ca244f0e183a31a1de773 | refs/heads/master | 2020-04-15T15:57:05.480056 | 2019-01-10T01:12:01 | 2019-01-10T01:12:01 | 164,812,547 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 2,786 | java | /***************************************************************************************************
* 파일명 : SS_A_VSCDDataSet.java
* 기능 : 독자현황-VacationStop-등록,수정,삭제를 위한 DataSet
* 작성일자 : 2004-03-20
* 작성자 : 김대섭
***************************************************************************************************/
/***************************************************************************************************
* 수정내역 :
* 수정자 :
* 수정일자 :
* 백업 :
***************************************************************************************************/
package chosun.ciis.ss.sls.rdr.ds;
import java.sql.*;
import java.util.*;
import somo.framework.db.*;
import somo.framework.util.*;
import chosun.ciis.ss.sls.rdr.dm.*;
import chosun.ciis.ss.sls.rdr.rec.*;
/**
* 독자현황-VacationStop-등록,수정,삭제를 위한 DataSet
*/
public class SS_A_VSCDDataSet extends somo.framework.db.BaseDataSet implements java.io.Serializable{
public String errcode;
public String errmsg;
public SS_A_VSCDDataSet(){}
public SS_A_VSCDDataSet(String errcode, String errmsg){
this.errcode = errcode;
this.errmsg = errmsg;
}
public void setErrcode(String errcode){
this.errcode = errcode;
}
public void setErrmsg(String errmsg){
this.errmsg = errmsg;
}
public String getErrcode(){
return this.errcode;
}
public String getErrmsg(){
return this.errmsg;
}
public void getValues(CallableStatement cstmt) throws SQLException{
this.errcode = Util.checkString(cstmt.getString(1));
this.errmsg = Util.checkString(cstmt.getString(2));
}
}/*----------------------------------------------------------------------------------------------------
Web Tier에서 DataSet 객체 관련 코드 작성시 사용하십시오.
<%
SS_A_VSCDDataSet ds = (SS_A_VSCDDataSet)request.getAttribute("ds");
%>
Web Tier에서 Record 객체 관련 코드 작성시 사용하십시오.
----------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------
Web Tier에서 DataSet 객체의 <%= %> 작성시 사용하십시오.
<%= ds.getErrcode()%>
<%= ds.getErrmsg()%>
----------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------
Web Tier에서 Record 객체의 <%= %> 작성시 사용하십시오.
----------------------------------------------------------------------------------------------------*/
/* 작성시간 : Mon Mar 29 11:39:03 KST 2004 */ | [
"DLCOM000@172.16.30.11"
] | DLCOM000@172.16.30.11 |
31fc34c0c1c441ed48cc6062b1f899b2ffd0689f | 2ad5236ca6679a98f60219982dbc3d728ee1b1e4 | /Me/Me/Global/FrameWorkSource/Java/Framework/Presentation/Web/Ajax/JMaki/Utils/MenuYahooWidgetsExt.java | b7aca866d228dfe5f8bf1a8a46b3b4251188e263 | [
"Apache-2.0"
] | permissive | bydan/scode | 2097ddcc41b33145812b560d8e102284961abfb9 | 4ac143d579437e969602ecc71575ca6e17fb21b9 | refs/heads/master | 2020-12-08T06:54:41.010177 | 2016-08-31T19:08:59 | 2016-08-31T19:08:59 | 67,065,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,956 | java | package ByDan.Framework.Presentation.Web.Ajax.JMaki.Utils;
import java.util.ArrayList;
import ByDan.Seguridad.Business.Entities.Usuario;
import ByDan.Seguridad.Business.Entities.Funcionalidad;
public class MenuYahooWidgetsExt {
static String startKey="{";
static String endKey="}";
MenuAuxYahooWidgetsExt auxMenuYahoo;
public static void StartCreateMenu(StringBuilder tableAjax)
{
tableAjax.append(startKey);
}
public static void EndCreateMenu(StringBuilder tableAjax)
{
tableAjax.append(endKey);
}
public static String TraerPaginas(ArrayList<Funcionalidad> paginas)
{
StringBuilder tableAjax=new StringBuilder();
Integer count=1;
StartCreateMenu(tableAjax) ;
for(Funcionalidad pagina:paginas)
{
MenuAuxYahooWidgetsExt auxMenuYahoo=new MenuAuxYahooWidgetsExt();
if(count.equals(1))
{
auxMenuYahoo.setEsInicio(true);
}
auxMenuYahoo.setLabel(pagina.getField_strNombre());
auxMenuYahoo.setUrl(pagina.getField_strPath());
if(count.equals(paginas.size()))
{
auxMenuYahoo.setEsUltimo(true);
}
auxMenuYahoo.buildMenu(tableAjax);
count++;
}
EndCreateMenu(tableAjax) ;
return tableAjax.toString();
}
public static String TraerUsuarios(ArrayList<Usuario> usuarios)
{
StringBuilder tableAjax=new StringBuilder();
Integer count=1;
StartCreateMenu(tableAjax) ;
for(Usuario usuario:usuarios)
{
MenuAuxYahooWidgetsExt auxMenuYahoo=new MenuAuxYahooWidgetsExt();
if(count.equals(1))
{
auxMenuYahoo.setEsInicio(true);
}
//auxMenuYahoo.setLabel(usuario.getNombre());
//auxMenuYahoo.setUrl(usuario.getClave());
if(count.equals(usuarios.size()))
{
auxMenuYahoo.setEsUltimo(true);
}
auxMenuYahoo.buildMenu(tableAjax);
count++;
}
EndCreateMenu(tableAjax) ;
return tableAjax.toString();
}
public static String TraerUsuariosHijos(ArrayList<Usuario> usuarios)
{
StringBuilder tableAjax=new StringBuilder();
Integer count=1;
StartCreateMenu(tableAjax) ;
ArrayList<MenuAuxYahooWidgetsExt> auxMenusYahoo= new ArrayList<MenuAuxYahooWidgetsExt>();
MenuAuxYahooWidgetsExt auxMenuYahoo=new MenuAuxYahooWidgetsExt();
auxMenuYahoo.setLabel("test");
auxMenuYahoo.setUrl("test");
auxMenuYahoo.setEsInicio(true);
auxMenuYahoo.setEsUltimo(true);
for(Usuario usuario:usuarios)
{
MenuAuxYahooWidgetsExt auxMenuYahoo1=new MenuAuxYahooWidgetsExt();
//auxMenuYahoo1.setLabel(usuario.getNombre());
//auxMenuYahoo1.setUrl(usuario.getClave());
auxMenusYahoo.add(auxMenuYahoo1);
count++;
}
auxMenuYahoo.setAuxMenusYahoo(auxMenusYahoo);
auxMenuYahoo.buildMenu(tableAjax);
EndCreateMenu(tableAjax) ;
return tableAjax.toString();
}
public static String TraerPaginasPadresHijos(ArrayList<Funcionalidad> paginas)
{
StringBuilder tableAjax=new StringBuilder();
Integer count=1;
StartCreateMenu(tableAjax) ;
ArrayList<MenuAuxYahooWidgetsExt> auxMenusYahoo= new ArrayList<MenuAuxYahooWidgetsExt>();
MenuAuxYahooWidgetsExt auxMenuYahoo=new MenuAuxYahooWidgetsExt();
auxMenuYahoo.setLabel("test");
auxMenuYahoo.setUrl("test");
auxMenuYahoo.setEsInicio(true);
auxMenuYahoo.setEsUltimo(true);
for(Funcionalidad pagina:paginas)
{
MenuAuxYahooWidgetsExt auxMenuYahoo1=new MenuAuxYahooWidgetsExt();
auxMenuYahoo1.setLabel(pagina.getField_strNombre());
auxMenuYahoo1.setUrl(pagina.getField_strPath());
auxMenusYahoo.add(auxMenuYahoo1);
count++;
}
auxMenuYahoo.setAuxMenusYahoo(auxMenusYahoo);
auxMenuYahoo.buildMenu(tableAjax);
EndCreateMenu(tableAjax) ;
return tableAjax.toString();
}
}
| [
"byrondanilo10@hotmail.com"
] | byrondanilo10@hotmail.com |
56552b5af525bca0e83ef1325930c777131b63fa | fd374f4e80646f8f303605565bbc8299dadd569b | /persistencedemo/src/test/java/other/HtmlDecode.java | a31a4713735f598c6f6c3c7bcb4c8e8c8bf81b79 | [] | no_license | zlasy/belt-and-road | 5aec49a08d24a762448060ea8c63b48f3888fe28 | 4341ea194fe5a83aea12eafc682c7ad3b2bc37f9 | refs/heads/master | 2022-12-27T14:18:45.866469 | 2020-02-05T14:10:05 | 2020-02-05T14:10:05 | 91,453,645 | 0 | 0 | null | 2022-10-19T00:06:41 | 2017-05-16T12:04:57 | Java | UTF-8 | Java | false | false | 467 | java | package other;
public class HtmlDecode {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "<a href='http://www.qq.com'>QQ</a><script>";
System.out.println(org.springframework.web.util.HtmlUtils.htmlEscape(str));
String str1 = "生活•读书•新知三联书店有限公司";
System.out.println(org.springframework.web.util.HtmlUtils.htmlUnescape(str1));
}
}
| [
"zhangle@dangdang.com"
] | zhangle@dangdang.com |
eb607d906b25db169b116cd742158eb718c2d1c5 | 047e8ed9425e902a4c9cd89e89b0356c5ed13654 | /src/com/jeztech/repomanager/action/PayAction.java | f052c02450db89e3794de6421134ec02ba75dd7d | [] | no_license | vdustleo/ReposityManager | b41f184a0010d0a58c7ce3750cde9d477a1180c4 | 0fd619887602c61f46d81549fd603ae878252a87 | refs/heads/master | 2021-09-01T14:27:28.043925 | 2017-12-27T13:10:16 | 2017-12-27T13:10:16 | 115,521,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,527 | java | package com.jeztech.repomanager.action;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import lombok.Getter;
import lombok.Setter;
import com.jeztech.repomanager.model.PayInfo;
import com.jeztech.repomanager.service.IPayManage;
import com.jeztech.repomanager.util.CommonUtils;
import com.opensymphony.xwork2.ActionSupport;
public class PayAction extends ActionSupport{
/**
* serialVersionUID
*/
private static final long serialVersionUID = -8906144945281317185L;
@Resource
private IPayManage payManage;
/**
* 库存信息
*/
@Setter
@Getter
private PayInfo info;
@Setter
@Getter
private PayInfo cond;
/**
* 增加记录
*
* @return
*/
public String add() {
payManage.pay(info);
return SUCCESS;
}
/**
* 查询总价
*
* @return
*/
public String queryMoney() {
info = payManage.queryMoney(cond);
info.setOwePrice(parseValidValue(info.getOwePrice()));
info.setPayPrice(parseValidValue(info.getPayPrice()));
info.setTotalPrice(parseValidValue(info.getTotalPrice()));
if(info != null){
payPrice();
}
return SUCCESS;
}
private void payPrice(){
Double money = Double.valueOf(info.getTotalPrice()) - Double.valueOf(info.getOwePrice());
info.setPayPrice(CommonUtils.convertMoneyString(String.valueOf(money)));
}
private String parseValidValue(String value){
if(StringUtils.isEmpty(value)){
return "0.0";
}
return value;
}
}
| [
"vdust.leo@163.com"
] | vdust.leo@163.com |
0ebd401d0b99819dbf50a41a77e9f70bb8974c6d | 9fc5502b24e18737244ea8029be08c799ac84238 | /src/test/java/qube/qai/network/formal/FormalNetworkTest.java | 8c6952e7f384b441993f1b2aceb80d951f0b6a44 | [] | no_license | neuroph12/Qai | 2402ec1b866f77b78f3ad0c5b49fb2b1369411b7 | d229c4ac372b59a475070b7ddf74bfedfe0d155f | refs/heads/master | 2020-12-08T22:17:40.781957 | 2018-05-07T14:13:09 | 2018-05-07T14:13:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,005 | java | /*
* Copyright 2017 Qoan Wissenschaft & Software. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*
*/
package qube.qai.network.formal;
import junit.framework.TestCase;
public class FormalNetworkTest extends TestCase {
public void testFormalNetwork() throws Exception {
FormalNetwork network = new FormalNetwork();
assertNotNull(network);
fail("for the time being there is no implementation for the whole- regard this as a TODO message");
}
}
| [
"zenpunk137@gmail.com"
] | zenpunk137@gmail.com |
70d1176017e9fde0caa5d6a4d7e7db02112bc1ec | 8377d16b0bbd6854c8fb3f6b3b2e07892199850a | /src/com/retro/engine/util/list/UOList.java | 1eaf1fd9143f21ea46d1c3a18612aac9bb65cf48 | [] | no_license | msg138/RetroEngine | 00ab7e74bfe4d405860d078c2f38957674cbb8f9 | ce8d93cf1349ca69db587d3a265766a963586963 | refs/heads/master | 2021-01-11T07:21:53.617532 | 2016-12-26T03:10:03 | 2016-12-26T03:10:03 | 69,994,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,048 | java | package com.retro.engine.util.list;
/**
* Created by Michael on 7/15/2016.
*/
public class UOList<T> implements RetroList{
// Constant to know the default list size if undefined.
public final int c_defaultListSize = 64;
// The current max list size of the list
private int m_maxListSize;
// The current list size of the list
private int m_listSize;
// Whether or not someone has editted the contents of this list.
private boolean m_tamper = false;
// Data within the list
private T[] data;
/**
* Creates an Unordered List with DefaultListSize
*/
public UOList(){
this(64);
}
/**
* Creates an Unordered List with cap 'Cap'
* @param cap Max capacity for the list.
*/
public UOList(int cap){
setMaxCapacity(cap).resetList();
}
/**
* Set the max capacity of the list
* @param cap max capacity
* @return list
*/
public UOList setMaxCapacity(int cap)
{
m_maxListSize = cap;
return this;
}
/**
* Get maxCapacity
* @return m_maxListSize
*/
public int getMaxCapacity(){
return m_maxListSize;
}
/**
* Get the current size of the list.
* @return m_listSize;
*/
public int getSize(){
return m_listSize;
}
/**
* An alias for getSize()
* @return size of the list.
*/
public int size(){
return getSize();
}
/**
* Whether or not the array has been messed with.
* @return
*/
public boolean tamperred(){
return m_tamper;
}
/**
* Resets the list and creates a new data array.
* @return
*/
public UOList resetList(){
if(tamperred()){
// TODO make it copy contents to a larger list.
}
data = (T[])new Object[getMaxCapacity()];
return this;
}
/**
* Remove an item from the list, and returns it back.
* @param index index of the item.
* @return Item.
*/
public T remove(int index){
T t = data[index];
data[index] = data[m_listSize--];
data[m_listSize] = null;
return t;
}
/**
* Removes and returns the last element in the list.
* @return
*/
public T removeLast(){
if(m_listSize > 0){
T t = data[m_listSize--];
data[m_listSize] = null;
return t;
}
return null;
}
/**
* Removes a predetermined item from the list.
* @param t item to remove.
* @return
*/
public boolean remove(T t){
for(int i = 0;i<m_listSize;i++)
{
T t1 = data[i];
if(t == t1)
{
data[i] = data[m_listSize--];
data[m_listSize] = null;
return true;
}
}
return false;
}
/**
* Returns whether the element can be found within the list ornaw.
* @param t Item to find.
* @return
*/
public boolean contains(T t){
for(int i=0;i<m_listSize;i++)
if(t == data[i])
return true;
return false;
}
/**
* Gets the item at specified index.
* @param index index to locate.
* @return
*/
public T get(int index){
return data[index];
}
/**
* Checks whether or not the index is within the bounds of the list.
* @param index index to check.
* @return
*/
public boolean isIndexWithinBounds(int index){
return index < getMaxCapacity();
}
/**
* Returns whether or not the list is empty
* @return
*/
public boolean isEmpty(){
return getSize() == 0;
}
/**
* Adds an item to the list, and returns the index of the newly added item.
* @param t Item to add
* @return Index of the item added.
*/
public int addReturnIndex(T t){
data[m_listSize++] = t;
return m_listSize;
}
/**
* Add an item to the list.
* @param t Item to add.
*/
public void add(T t){
addReturnIndex(t);
}
/**
* Set an item to the specified index.
* @param index Index for item to replace or take hold of
* @param t Item that is being inserted into the list.
*/
public void set(int index, T t){
if(isIndexWithinBounds(index)){
data[index] = t;
}else{
grow(index+1);
set(index, t);
}
// TODO add grow function to make bigger when not enough room.
}
/**
* Clear the list, removing all data.
*/
public void clear(){
for(int i=0;i<m_listSize;i++)
{
data[i] = null;
}
m_listSize = 0;
}
public void grow(int newSize){
T[] newData = (T[])new Object[newSize];
for(int i=0;i<getMaxCapacity();i++){
newData[i] = data[i];
}
setMaxCapacity(newSize);
data = newData;
}
}
| [
"streetbard16@hotmail.com"
] | streetbard16@hotmail.com |
78d23bcc75c1d9b6c414f33ee2339bc8fcb6ea93 | 9c0fd4b5514e2eae9e9a491cad3e8f3d2b361080 | /SIC/src/Login/ventas/ingresoU6.java | a5272cd153ac231295433a6aef0250fc3feae4ba | [] | no_license | Angelmath/SIC | 13222ef765bb71941d99c4fcb4de8f4d22b04ae5 | aafe0de1242e4bd535c449c87fcc0bb73a9c20da | refs/heads/master | 2016-09-01T11:42:54.963100 | 2015-11-13T14:54:16 | 2015-11-13T14:54:16 | 45,936,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,917 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Login.ventas;
import Login.Entidad.Instalacion;
import Login.Entidad.Login;
import Login.Entidad.Notificaciones;
import Login.Entidad.Report;
import Login.Entidad.Ticket;
import Login.servicio.Funcion;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import Login.servicio.ServiceHb;
import java.awt.Component;
import java.util.Date;
/**
*
* @author Angelmath
*/
public final class ingresoU6 extends javax.swing.JDialog {
marco padre;
instalacion empl;
String cl;
int toca;
Ticket tk;
Login usuario;
Instalacion clie;
String cliente;
String estado;
/**
* Creates new form ingresoU
*/
public ingresoU6(java.awt.Frame parent, marco padre, boolean modal,String id, Login usuario,String cliente) {
super(parent,modal);
initComponents();
List<Report> list4;
this.padre=padre;
this.usuario=usuario;
this.cliente=cliente;
setSize(530,420);
setLocationRelativeTo(null);
try {
ServiceHb neo = new ServiceHb();
neo.iniciarTransaccion();
tk= (Ticket) neo.obtenerObjeto(Ticket.class,Integer.parseInt(id));
clie = neo.getlistaInstalacionpyl(tk.getId());
list4= neo.getlistaReporta(Integer.toString(clie.getId()),clie.getSelectt());
neo.cerrarSesion();
getjTextField1().setText(tk.getNumero());//cliente
getjTextField3().setText(tk.getCliente());//cliente
getjTextField4().setText(tk.getContacto());//contacto
getjTextField5().setText(tk.getProyecto());//proyecto
getjTextField6().setText(tk.getEstado());//estado
getjTextArea1().setText(tk.getDetalle());
if(tk.getEstado().equalsIgnoreCase("Culminada")){
//getjButton1().setText("En Curso");
}
if(tk.getEstado().equalsIgnoreCase("En Curso")){
//getjButton1().setText("Culminada");
if(list4==null){
getjButton1().setVisible(false);
}else{
getjButton1().setVisible(true);
}
}
estado=tk.getEstado();
} catch (Exception ex) {
Logger.getLogger(ingresoU6.class.getName()).log(Level.SEVERE, null, ex);
}
setVisible(true);
}
public Ticket getTk() {
return tk;
}
public void setTk(Ticket tk) {
this.tk = tk;
}
public JButton getjButton5() {
return jButton5;
}
public void setjButton5(JButton jButton5) {
this.jButton5 = jButton5;
}
public JButton getjButton6() {
return jButton6;
}
public void setjButton6(JButton jButton6) {
this.jButton6 = jButton6;
}
public marco getPadre() {
return padre;
}
public void setPadre(marco padre) {
this.padre = padre;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel11 = new javax.swing.JLabel();
jButton4 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField6 = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jTextField5 = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Ingreso");
setMinimumSize(new java.awt.Dimension(500, 400));
getContentPane().setLayout(null);
jLabel11.setBackground(new java.awt.Color(255, 255, 255));
jLabel11.setFont(new java.awt.Font("Roboto Light", 0, 12)); // NOI18N
jLabel11.setText("jLabel8");
jLabel11.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED, new java.awt.Color(214, 214, 214), new java.awt.Color(214, 214, 214), new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204)));
jLabel11.setOpaque(true);
getContentPane().add(jLabel11);
jLabel11.setBounds(0, 0, 70, 25);
jLabel11.setVisible(false);
jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Login/imagenes/boton-salir.png"))); // NOI18N
jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton4MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jButton4MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jButton4MouseExited(evt);
}
});
getContentPane().add(jButton4);
jButton4.setBounds(370, 340, 49, 29);
jLabel2.setFont(new java.awt.Font("Roboto Medium", 3, 18)); // NOI18N
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("Ticket");
getContentPane().add(jLabel2);
jLabel2.setBounds(90, 10, 340, 30);
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Login/imagenes/boton-aceptar.png"))); // NOI18N
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jButton1MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jButton1MouseExited(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(110, 340, 49, 29);
jLabel3.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jLabel3.setText("N°:");
getContentPane().add(jLabel3);
jLabel3.setBounds(90, 80, 90, 30);
jLabel4.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jLabel4.setText("Cliente:");
getContentPane().add(jLabel4);
jLabel4.setBounds(90, 110, 120, 30);
jLabel5.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jLabel5.setText("Proyecto:");
getContentPane().add(jLabel5);
jLabel5.setBounds(90, 170, 120, 30);
jLabel6.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jLabel6.setText("Contacto:");
getContentPane().add(jLabel6);
jLabel6.setBounds(90, 140, 110, 30);
jLabel8.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jLabel8.setText("Detalle:");
getContentPane().add(jLabel8);
jLabel8.setBounds(90, 230, 100, 30);
jLabel9.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jLabel9.setText("Estado:");
getContentPane().add(jLabel9);
jLabel9.setBounds(90, 200, 110, 30);
jTextField1.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jTextField1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jTextField1.setText("0000000");
getContentPane().add(jTextField1);
jTextField1.setBounds(220, 80, 180, 30);
jTextField3.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jTextField3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
getContentPane().add(jTextField3);
jTextField3.setBounds(220, 110, 180, 30);
jTextField4.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jTextField4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
getContentPane().add(jTextField4);
jTextField4.setBounds(220, 140, 180, 30);
jTextField6.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jTextField6.setHorizontalAlignment(javax.swing.JTextField.CENTER);
getContentPane().add(jTextField6);
jTextField6.setBounds(220, 200, 180, 30);
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Roboto Light", 0, 13)); // NOI18N
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(220, 230, 230, 60);
jTextField5.setFont(new java.awt.Font("Roboto Light", 0, 11)); // NOI18N
jTextField5.setHorizontalAlignment(javax.swing.JTextField.CENTER);
getContentPane().add(jTextField5);
jTextField5.setBounds(220, 170, 180, 30);
jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Login/imagenes/boton-eliminar.png"))); // NOI18N
jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton5MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jButton5MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jButton5MouseExited(evt);
}
});
getContentPane().add(jButton5);
jButton5.setBounds(280, 340, 49, 29);
jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Login/imagenes/boton-editar.png"))); // NOI18N
jButton6.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton6MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jButton6MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jButton6MouseExited(evt);
}
});
getContentPane().add(jButton6);
jButton6.setBounds(190, 340, 49, 29);
jLabel1.setBackground(new java.awt.Color(242, 242, 242));
jLabel1.setOpaque(true);
getContentPane().add(jLabel1);
jLabel1.setBounds(0, 0, 530, 400);
getAccessibleContext().setAccessibleParent(null);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseClicked
dispose();
}//GEN-LAST:event_jButton4MouseClicked
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
try {
ServiceHb neo = new ServiceHb();
neo.iniciarTransaccion();
Notificaciones noti= new Notificaciones();
Instalacion in = clie;
Date d = new Date();
noti.setFecha(d);
noti.setVisto("NO");
noti.setResponsable(usuario.getNombre());
noti.setInformacion("El Cliente "+cliente+" con proyecto "+in.getDetalle()+" cambio de estado");
tk.setCliente(getjTextField3().getText());
tk.setContacto(getjTextField4().getText());
tk.setDetalle(getjTextArea1().getText());
if(tk.getEstado().equalsIgnoreCase("Culminada")){
tk.setEstado("En Curso");
clie.setProceso("En Curso");
}else{
tk.setEstado("Culminada");
clie.setProceso("Culminada");
Date da= new Date();
clie.setFechafin(Funcion.DateFormat(da));
}
noti.setModulo("PYL");
noti.setInstalacion(in.getProceso());
tk.setDiseno(clie.getTipo());
tk.setNumero(getjTextField1().getText());
tk.setProyecto(getjTextField5().getText());
neo.actualizarObjeto(clie);
neo.crearObjeto(noti);
neo.actualizarObjeto(tk);
neo.confirmarTransaccion();
neo.cerrarSesion();
} catch (Exception ex) {
Logger.getLogger(ingresoU6.class.getName()).log(Level.SEVERE, null, ex);
}
JOptionPane.showMessageDialog(null, "Confirmado");
dispose();
}//GEN-LAST:event_jButton1MouseClicked
private void jButton6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton6MouseClicked
try {
ServiceHb neo = new ServiceHb();
neo.iniciarTransaccion();
tk.setDetalle(getjTextArea1().getText());
neo.actualizarObjeto(tk);
neo.confirmarTransaccion();
neo.cerrarSesion();
} catch (Exception ex) {
Logger.getLogger(ingresoU6.class.getName()).log(Level.SEVERE, null, ex);
}
dispose();
}//GEN-LAST:event_jButton6MouseClicked
private void jButton5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MouseClicked
String selectedSiteName = JOptionPane.showInputDialog(null,"Clave ");
if(selectedSiteName.equalsIgnoreCase("cajamarca")){
try {
ServiceHb neo = new ServiceHb();
neo.iniciarTransaccion();
Instalacion in = clie;
in.setTick(null);
in.setTicket_1("");
in.setProceso("Aceptada por Cliente");
neo.actualizarObjeto(in);
neo.confirmarTransaccion();
neo = new ServiceHb();
neo.iniciarTransaccion();
neo.eliminarObjeto(tk);
neo.confirmarTransaccion();
neo.cerrarSesion();
} catch (Exception ex) {
Logger.getLogger(ingresoU6.class.getName()).log(Level.SEVERE, null, ex);
}
}
dispose();
}//GEN-LAST:event_jButton5MouseClicked
private void jButton1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseEntered
if(tk.getEstado().equalsIgnoreCase("Culminada")){
if(usuario.getNivel().equalsIgnoreCase("Contable")){
alt(jButton1,"Facturar Ticket");
}else{
alt(jButton1,"Regresar Ticket");
}
}else{
alt(jButton1,"Culminar Ticket");
}
}//GEN-LAST:event_jButton1MouseEntered
private void jButton6MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton6MouseEntered
alt(jButton6,"Editar Ticket");
}//GEN-LAST:event_jButton6MouseEntered
private void jButton5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MouseEntered
alt(jButton5,"Eliminar Ticket");
}//GEN-LAST:event_jButton5MouseEntered
private void jButton4MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseEntered
alt(jButton4,"Salir");
}//GEN-LAST:event_jButton4MouseEntered
private void jButton1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseExited
jLabel11.setVisible(false);
}//GEN-LAST:event_jButton1MouseExited
private void jButton6MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton6MouseExited
jLabel11.setVisible(false);
}//GEN-LAST:event_jButton6MouseExited
private void jButton5MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MouseExited
jLabel11.setVisible(false);
}//GEN-LAST:event_jButton5MouseExited
private void jButton4MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseExited
jLabel11.setVisible(false);
}//GEN-LAST:event_jButton4MouseExited
public instalacion getEmpl() {
return empl;
}
public void setEmpl(instalacion empl) {
this.empl = empl;
}
public String getCl() {
return cl;
}
public void setCl(String cl) {
this.cl = cl;
}
public int getToca() {
return toca;
}
public JTextField getjTextField5() {
return jTextField5;
}
public void setjTextField5(JTextField jTextField5) {
this.jTextField5 = jTextField5;
}
public void alt (Component bt, String text){
jLabel11.setVisible(true);
jLabel11.setText(text);
jLabel11.setSize((int)jLabel11.getMinimumSize().getWidth(), 25);
jLabel11.setLocation(bt.getX()+bt.getWidth(), bt.getY()-25);
}
public void setToca(int toca) {
this.toca = toca;
}
public JButton getjButton1() {
return jButton1;
}
public void setjButton1(JButton jButton1) {
this.jButton1 = jButton1;
}
public JButton getjButton4() {
return jButton4;
}
public void setjButton4(JButton jButton4) {
this.jButton4 = jButton4;
}
public JLabel getjLabel1() {
return jLabel1;
}
public void setjLabel1(JLabel jLabel1) {
this.jLabel1 = jLabel1;
}
public JLabel getjLabel2() {
return jLabel2;
}
public void setjLabel2(JLabel jLabel2) {
this.jLabel2 = jLabel2;
}
public JLabel getjLabel3() {
return jLabel3;
}
public void setjLabel3(JLabel jLabel3) {
this.jLabel3 = jLabel3;
}
public JLabel getjLabel4() {
return jLabel4;
}
public void setjLabel4(JLabel jLabel4) {
this.jLabel4 = jLabel4;
}
public JLabel getjLabel5() {
return jLabel5;
}
public void setjLabel5(JLabel jLabel5) {
this.jLabel5 = jLabel5;
}
public JLabel getjLabel6() {
return jLabel6;
}
public void setjLabel6(JLabel jLabel6) {
this.jLabel6 = jLabel6;
}
public JLabel getjLabel8() {
return jLabel8;
}
public void setjLabel8(JLabel jLabel8) {
this.jLabel8 = jLabel8;
}
public JLabel getjLabel9() {
return jLabel9;
}
public void setjLabel9(JLabel jLabel9) {
this.jLabel9 = jLabel9;
}
public JScrollPane getjScrollPane1() {
return jScrollPane1;
}
public void setjScrollPane1(JScrollPane jScrollPane1) {
this.jScrollPane1 = jScrollPane1;
}
public JTextArea getjTextArea1() {
return jTextArea1;
}
public void setjTextArea1(JTextArea jTextArea1) {
this.jTextArea1 = jTextArea1;
}
public JTextField getjTextField1() {
return jTextField1;
}
public void setjTextField1(JTextField jTextField1) {
this.jTextField1 = jTextField1;
}
public JTextField getjTextField3() {
return jTextField3;
}
public void setjTextField3(JTextField jTextField3) {
this.jTextField3 = jTextField3;
}
public JTextField getjTextField4() {
return jTextField4;
}
public void setjTextField4(JTextField jTextField4) {
this.jTextField4 = jTextField4;
}
public JTextField getjTextField6() {
return jTextField6;
}
public void setjTextField6(JTextField jTextField6) {
this.jTextField6 = jTextField6;
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ingresoU6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ingresoU6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ingresoU6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ingresoU6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
// End of variables declaration//GEN-END:variables
}
| [
"matheuspuero@gmail.com"
] | matheuspuero@gmail.com |
70ddbdb81ac7fa3cb2a82ba9f320f9649cd96c8c | 9675c76a6f3f4e50e8c764e2f9317672f971dbc6 | /src/com/findhotel/model/Utility.java | 04b3394872ee61133735864adab0caa56d786486 | [] | no_license | vinamilvinamil/FindHotel | 452e5227ff76bfbdf80d47a34064a4c467837424 | ddd309b72d1e0def64eeac027a12e53c7a6d84dc | refs/heads/master | 2020-12-26T03:23:31.599487 | 2015-09-27T15:50:38 | 2015-09-27T15:50:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,120 | java | package com.findhotel.model;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
import android.content.Context;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.google.android.gms.maps.model.LatLng;
public class Utility {
/**
* Check if connect to network or not.
* @param mContext
* The context of current activity.
* @return boolean value.
*/
public static boolean isNetworkConnected(Context mContext) {
ConnectivityManager connManager = (ConnectivityManager) mContext
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = connManager.getActiveNetworkInfo();
return (mNetworkInfo != null && mNetworkInfo.isConnectedOrConnecting());
}
/**
* Check GPS
*/
public static boolean isGpsConnected(Context mContext){
LocationManager locationManager =(LocationManager)mContext.getSystemService(Context.LOCATION_SERVICE);
return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
}
/**
* Count distance between two point
*/
public static float CalulationByDistance (LatLng start,LatLng end){
//Bán kính trái đất
float Radius=6371;
double lat1 = start.latitude;
double lat2 = end.latitude;
double long1 = start.longitude;
double long2 = end.longitude;
double dLat = Math.toRadians(lat2-lat1);
double dLong = Math.toRadians(long2-long1);
double a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *
Math.sin(dLong/2) * Math.sin(dLong/2);
double c = 2 * Math.asin(Math.sqrt(a));
double valueResult = Radius*c;
DecimalFormat decimalFormat = (DecimalFormat)NumberFormat.getNumberInstance(Locale.US);
decimalFormat.applyPattern("#.##");
float kmInDec = Float.valueOf(decimalFormat.format(valueResult));
return kmInDec;
}
}
| [
"giatuyentiensinh@gmail.com"
] | giatuyentiensinh@gmail.com |
75a897ae6796fcdc2e23967df032504153c1fe6c | 6ac41caa50166da82e0174cee3e5c2b1c1a9c9c6 | /src/main/java/com/tencent/easycount/udfnew/GenericUDFBinaryLeftShift.java | 7ddd2c50bf90cd2d5dca348a936d55b42713a1c2 | [] | no_license | bobqiu/EasyCount | dcbbd7b7bb24ee8cc0ab29056f83d3aae6903eba | 5327b4eb5175f1b9ea805dda6e8f981a6ad8b6aa | refs/heads/master | 2020-05-27T05:53:21.505874 | 2017-12-21T02:49:58 | 2017-12-21T02:49:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,132 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencent.easycount.udfnew;
import java.util.Arrays;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.BinaryObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.IntObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
import org.apache.hadoop.io.BytesWritable;
/**
* deterministic version of UDFUnixTimeStamp. enforces argument
*/
@Description(name = "bit_rsft", value = "_FUNC_(date[, pattern]) - Returns the UNIX timestamp", extended = "Converts the specified time to number of seconds since 1970-01-01.")
public class GenericUDFBinaryLeftShift extends GenericUDF {
private transient BinaryObjectInspector inputOI;
private transient IntObjectInspector sftlenOI;
@Override
public ObjectInspector initialize(ObjectInspector[] arguments)
throws UDFArgumentException {
if (arguments.length < 2) {
throw new UDFArgumentLengthException("The function bit_rsft "
+ "requires at least 2 argument");
}
if (!(arguments[0] instanceof BinaryObjectInspector)) {
throw new UDFArgumentException("The function "
+ getName().toUpperCase() + " takes only binary types");
}
inputOI = (BinaryObjectInspector) arguments[0];
if (!(arguments[1] instanceof IntObjectInspector)) {
throw new UDFArgumentException("The function "
+ getName().toUpperCase() + " takes only int types");
}
sftlenOI = (IntObjectInspector) arguments[1];
return PrimitiveObjectInspectorFactory.writableBinaryObjectInspector;
}
protected String getName() {
return "bit_lsft";
}
protected transient final BytesWritable retValue = new BytesWritable();
@Override
public Object evaluate(DeferredObject[] arguments) throws HiveException {
BytesWritable retValue1 = (BytesWritable) ObjectInspectorUtils
.copyToStandardObject(arguments[0].get(), inputOI);
int sftlen = sftlenOI.get(arguments[1].get());
byte[] data = retValue1.getBytes();
byte[] datares = new byte[data.length];
Arrays.fill(datares, (byte) 0);
if (sftlen >= 0 && sftlen < data.length * 8) {
int bytenum = sftlen / 8;
int bitnum = sftlen % 8;
int tmp = 0;
int tmp1 = 0;
for (int i = data.length - 1; i >= bytenum; i--) {
tmp = data[i] & 0x0ff;
data[i] = (byte) ((tmp >> bitnum) | tmp1);
tmp1 = tmp << (8 - bitnum);
}
System.arraycopy(data, bytenum, datares, 0, data.length - bytenum);
}
retValue.set(datares, 0, datares.length);
return retValue;
}
@Override
public String getDisplayString(String[] children) {
StringBuilder sb = new StringBuilder(32);
sb.append(getName());
sb.append('(');
sb.append(StringUtils.join(children, ','));
sb.append(')');
return sb.toString();
}
}
| [
"tianwp@gmail.com"
] | tianwp@gmail.com |
9c1e9bd59c9b222f9640c115a9cbec4452ea1825 | 46672d34727c03917ad57a8a9f986c7829eebeeb | /src/test/java/com/kashifi/commercial/AdvancedBusinessReportTest.java | f09c7130c161418f18b94df4a0ff7d800e55c00b | [] | no_license | EngCpp/RegressionTests | d44f9ec4b84706e9ed15219abe9b6dc3f784575a | 8a463c191e241040386a39c78843f9343763eb42 | refs/heads/master | 2020-03-12T08:50:21.615838 | 2018-07-02T11:17:29 | 2018-07-02T11:17:29 | 130,537,312 | 0 | 1 | null | 2018-07-04T09:38:02 | 2018-04-22T05:13:22 | Java | UTF-8 | Java | false | false | 1,811 | java | package com.kashifi.commercial;
import org.openqa.selenium.WebDriver;
import org.testng.AssertJUnit;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.engcpp.Login;
import com.engcpp.ProductsTab;
import com.engcpp.individual.utils.ReportOptions;
import com.engcpp.utils.Constants;
import com.engcpp.utils.DriverFactory;
import com.kashifi.commercial.AdvancedBusinessReport.advBizrptMenu;
public class AdvancedBusinessReportTest {
private WebDriver driver;
private Login login;
@BeforeMethod
public void setUp() {
driver = DriverFactory.newChromeInstance();
login = new Login(Constants.IQC_URL, driver)
.withUsername(Constants.USERNAME)
.withPassword(Constants.PASSWORD)
.login();
}
@AfterMethod
public void tearDown() {
driver.quit();
}
@Test(enabled = true)
public void testBizReport() throws InterruptedException {
if (new ProductsTab(driver).businessClick()) {
advBizrptMenu menu = new AdvancedBusinessReport(driver).withCommrpt("YEASTIE BOYS LIMITED").submit();
AssertJUnit.assertNotNull(menu);
if (menu != null) {
boolean reportOk = menu.SelectBizrpt()
.withReportOptions(new ReportOptions()
.withAccessPurposeCode("For investigating a case of suspected insurance fraud")
.withPrivateCodeConsent(true).withDirectorshipAffiliationSearch(true))
.submit();
AssertJUnit.assertTrue(reportOk);
login.logout();
}
}
}
}
| [
"engcpp@yahoo.com.br"
] | engcpp@yahoo.com.br |
c60f1f4239e76dfc8b2afe8c9f88e1ab4b594f14 | cdc1c14104b9ea36d42332fd53ebe4eb23a2040c | /convertmail/src/main/java/test/convertmail/authentication/DomainCredentials.java | dbcf0fe9c99bbae0724680f93e9cfc11d06f5a86 | [] | no_license | michikhi/mciproject | cd6afcf198d50ea2470ff227c87758f7561e45a7 | 34d9ea1ab0fc45b48efae6264cf83c32968eb097 | refs/heads/master | 2020-12-24T17:54:46.360868 | 2014-10-01T12:31:41 | 2014-10-01T12:31:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package test.convertmail.authentication;
public class DomainCredentials {
private String userEmailAddress;
private String serviceAccountEmail;
private String certificatePath;
public String getUserEmailAddress() {
return userEmailAddress;
}
public void setUserEmailAddress(String userEmailAddress) {
this.userEmailAddress = userEmailAddress;
}
public String getServiceAccountEmail() {
return serviceAccountEmail;
}
public void setServiceAccountEmail(String serviceAccountEmail) {
this.serviceAccountEmail = serviceAccountEmail;
}
public String getCertificatePath() {
return certificatePath;
}
public void setCertificatePath(String certificatePath) {
this.certificatePath = certificatePath;
}
} | [
"mimoun.chikhi@capgemini-sogeti.com"
] | mimoun.chikhi@capgemini-sogeti.com |
3ccdaf2c2d2d7c93f8f365da8a8f8073b82d1bca | 1f87e11c6a89961fb0093d8d4e5b39afbc786fb1 | /app/src/main/java/pl/orangeapi/warsawcitygame/db/pojo/GameObject.java | 87b5ae48eca04b821c5da07a135583bee97e2189 | [] | no_license | tomaszbondaruk/WarsawCitiGame | 6091f5762b4018c9f3addbf3754eae9e30037099 | c287ef1a48248f0544dbf3eb95c49d9b93b81581 | refs/heads/master | 2021-01-10T02:39:07.988344 | 2016-01-26T20:15:01 | 2016-01-26T20:15:01 | 47,355,328 | 0 | 0 | null | 2015-12-27T14:41:15 | 2015-12-03T19:32:52 | Java | UTF-8 | Java | false | false | 611 | java | package pl.orangeapi.warsawcitygame.db.pojo;
import java.io.Serializable;
/**
* Created by Grzegorz on 2016-01-09.
*/
public abstract class GameObject implements Serializable{
protected Double longitude;
protected Double latitude;
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public abstract String getDescription();
}
| [
"bond_t@wp.pl"
] | bond_t@wp.pl |
e13716313c5780ee390184c735fc934fc3164486 | bbae915b5cb39b9bf655ebfefb8ee7954777a773 | /src/main/java/org/heuros/data/model/AirportView.java | f70dd9c346f0282dd0f0600b75bebb92aba5b872 | [
"Apache-2.0"
] | permissive | bahadrzeren/heuros-core | 237a5c6d2c1401a099ca943d62f2c0a5c9d56012 | 283f2bba8c86cd7193fa1926b0f0c222d3998d92 | refs/heads/master | 2022-12-07T16:38:37.478111 | 2019-06-05T17:45:16 | 2019-06-05T17:45:16 | 141,831,510 | 0 | 0 | Apache-2.0 | 2022-11-16T05:36:11 | 2018-07-21T17:07:27 | Java | UTF-8 | Java | false | false | 887 | java | package org.heuros.data.model;
import org.heuros.core.data.base.View;
/**
* Getter only class used in rule implementations to access Airport instances.
*
* @author bahadrzeren
*
*/
public interface AirportView extends View {
public String getCode();
public boolean isAnyHb();
public boolean isAnyNonHb();
public int getHbNdx();
public boolean isHb(int hbNdx);
public boolean isNonHb(int hbNdx);
public boolean isDomestic();
public boolean isInternational();
public boolean isDhNotAllowedIfHBDepOrArr();
public boolean isCritical();
public boolean isAgDg();
public boolean isOneDutyStation();
public boolean isAcChangeAllowed();
public boolean isSpecialEuroStation();
public boolean isLayoverAllowed();
public boolean isEndDutyIfTouches();
public boolean isMandatoryFirstLayover();
public int getGroupId();
public boolean isLegConnectionExceptionStation();
}
| [
"36567337+bahadrzeren@users.noreply.github.com"
] | 36567337+bahadrzeren@users.noreply.github.com |
6b0f0cdb2fd139600af87a24f6ddf4122602a8ce | 3f9c93e512eea0b2733c12d890f522626f5821af | /spring5_demo2/src/com/dlq/spring5/autowite/Dept.java | 40935ee1ddaa6d9ceb3e62e3128348ba6c90ee18 | [] | no_license | DLQ666/Spring5 | 38280ca752e877485731b13d698c853782ce7f90 | aa84aad2861b0dd48743515f2e435040f23e9089 | refs/heads/master | 2023-01-12T14:13:46.163656 | 2020-11-18T15:04:08 | 2020-11-18T15:04:08 | 282,425,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package com.dlq.spring5.autowite;
/**
*@program: Spring5
*@description:
*@author: Hasee
*@create: 2020-07-26 14:28
*/
public class Dept {
@Override
public String toString() {
return "Dept{}";
}
}
| [
"1114626450@qq.com"
] | 1114626450@qq.com |
3f45b7eb775d36b34f185e215d87cd84a7599e82 | a567c69c8b91e110ccf77d7a42ca0d2ac40a0a4a | /NetaProject/src/com/me/neta/Moveable.java | 18bf2d7f5da3ca22a119d0b6273ef353462b16a9 | [] | no_license | sashonk/netaproject | 593dcbca8db109eacaf44fefac6032a35ba52999 | 5b19d314a71cfbfbfcfbc71a4f5956f5305fe987 | refs/heads/master | 2023-08-18T03:28:39.920644 | 2014-09-20T16:14:15 | 2014-09-20T16:14:15 | 408,254,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 430 | java | package com.me.neta;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.utils.DragListener;
public interface Moveable{
public boolean isDisposable();
}
| [
"sashonk@9faebf61-7de2-4690-a8d6-888312a489b9"
] | sashonk@9faebf61-7de2-4690-a8d6-888312a489b9 |
509da402309f8edb6af407d2654aff077d482dc9 | bd92f89cd91b138653f0cace13d69079a4569dcc | /28-ImplementstrStr()-1.java | 800235c050f29eeea088cd544f8f738ec6d05d67 | [] | no_license | winterfly/Leetcode | 9e7b32f6203d8a7788bd32653e47775daead45f3 | c7739098e548e85616b60343e6ad8d38e2bec77b | refs/heads/master | 2021-01-21T12:59:38.873485 | 2016-04-23T00:09:54 | 2016-04-23T00:09:54 | 54,126,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | public class Solution {
public int strStr(String haystack, String needle) {
if (haystack==null||needle==null) return -1;
int n=haystack.length();
int m=needle.length();
if (m>n) return -1;
for (int i=0;i<=n-m;i++) {
boolean flag=true;
for (int j=i;j<i+m;j++) {
if (haystack.charAt(j)!=needle.charAt(j-i)) {
flag=false;
break;
}
}
if (flag) return i;
}
return -1;
}
}
| [
"winterflyfei@gmail.com"
] | winterflyfei@gmail.com |
c3ca8084af86b44c26e7e23ca28f4d4a247a7249 | 77ed8ef81c623adac9e8604b96a22d4267c81e82 | /Proyecto/Tagle Cliente/src/cliente/GestionarReclamo/GUIBuscarRegistrante.java | 120c0c050254ba57e9d388a204f2d6ee66a1ede7 | [] | no_license | Matias-Bernal/tagle-gardien | bc67ffa4082135b90cc51452eb7ea750d99cc5fe | 6f259defda353db597b01faeb39aab84c0a3903a | refs/heads/master | 2021-01-23T11:40:20.457990 | 2014-07-10T07:45:33 | 2014-07-10T07:45:33 | 32,119,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | package cliente.GestionarReclamo;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
public class GUIBuscarRegistrante extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
GUIBuscarRegistrante frame = new GUIBuscarRegistrante();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public GUIBuscarRegistrante() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
}
public GUIBuscarRegistrante(MediadorReclamo mediadorReclamo) {
// TODO Auto-generated constructor stub
}
}
| [
"payomaty666@gmail.com@7b2b483b-7b46-f909-ec13-8b39806d40dd"
] | payomaty666@gmail.com@7b2b483b-7b46-f909-ec13-8b39806d40dd |
5a51ab940a0d14f04ee1ae31bbe3f86dd546e742 | d26a43aa1914974435b546aa78c3fcf730493897 | /hodo/util/NumberUtil.java | 22459cb01549ab8c7087c821228ae5a60147afc6 | [] | no_license | 15974431690/BANK | d394f5749ffa47fcfd17d4c3e2ea5294848addfb | 917f943ae6b446c89648c3bb9dc4d72cae72d9ae | refs/heads/master | 2023-02-16T14:47:14.809635 | 2021-01-09T16:55:04 | 2021-01-09T16:55:04 | 328,192,890 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package com.hodo.util;
public class NumberUtil {
/**
* 判断String是否是整数
*/
public static boolean isInteger(String s){
if((s != null)&&(s!=""))
return s.matches("^[0-9]*$");
else
return false;
}
/**
* 判断字符串是否是浮点数
*/
public static boolean isDouble(String value) {
try {
Double.parseDouble(value);
if (value.contains("."))
return true;
return false;
} catch (NumberFormatException e) {
return false;
}
}
/**
* 判断字符串是否是数字
*/
public static boolean isNumber(String value) {
return isInteger(value) || isDouble(value);
}
}
| [
"1793052036@qq.com"
] | 1793052036@qq.com |
128bcfb24299090970761bc3caf8efcace033114 | 9ca19f0f15381729456007552576ee7f48791855 | /src/test/java/org/sd/util/range/TestIntegerRange.java | a11c73d5a581238b20cc9a12a98b123907c7917b | [
"Apache-2.0"
] | permissive | KoehlerSB747/sd-tools | 395f7dd3e82150853dc4f702acc2a1900d6dc04c | 03ef03e3582b9b11b3ff352589b4a9a296a6dd9a | refs/heads/master | 2021-01-24T06:30:03.225670 | 2017-03-03T03:54:00 | 2017-03-03T03:54:00 | 34,475,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,085 | java | /*
Copyright 2009 Semantic Discovery, Inc. (www.semanticdiscovery.com)
This file is part of the Semantic Discovery Toolkit.
The Semantic Discovery Toolkit is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The Semantic Discovery Toolkit is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with The Semantic Discovery Toolkit. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sd.util.range;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import java.util.List;
/**
* JUnit Tests for the IntegerRange class.
* <p>
* @author Spence Koehler
*/
public class TestIntegerRange extends TestCase {
public TestIntegerRange(String name) {
super(name);
}
public void verify(IntegerRange range, int[] low, boolean[] includeLow, int[] high, boolean[] includeHigh, String asString, Integer size) {
final List<AbstractNumericRange.SimpleRange> simpleRanges = range.getSimpleRanges();
assertEquals(low.length, simpleRanges.size());
int index = 0;
for (AbstractNumericRange.SimpleRange simpleRange : simpleRanges) {
verify(simpleRange, low[index], includeLow[index], high[index], includeHigh[index]);
++index;
}
assertEquals(asString, range.asString());
assertEquals(size, range.size());
}
public void verify(AbstractNumericRange.SimpleRange range, int low, boolean includeLow, int high, boolean includeHigh) {
final int rangeLow = range.getLowAsInt(false);
final int rangeHigh = range.getHighAsInt(false);
assertEquals(low, rangeLow);
assertEquals(high, rangeHigh);
assertEquals(includeLow, range.includesLow());
assertEquals(includeHigh, range.includesHigh());
assertEquals(includeLow, range.includes(low));
assertEquals(includeLow, range.includes(Integer.toString(low)));
assertEquals(includeLow, range.includes((double)low));
assertEquals(includeHigh, range.includes(high));
assertEquals(includeHigh, range.includes(Integer.toString(high)));
assertEquals(includeHigh, range.includes((double)high));
for (int i = low + 1; i < high && i < (low + 100); ++i) {
assertTrue(range.includes(i));
assertTrue(range.includes(Integer.toString(i)));
assertTrue(range.includes((double)i));
}
for (int i = high - 100; i > low + 1 && i < high; ++i) {
assertTrue(range.includes(i));
assertTrue(range.includes(Integer.toString(i)));
assertTrue(range.includes((double)i));
}
if (low != Integer.MIN_VALUE) {
for (int i = low - 5; i < low; ++i) {
assertFalse(range.includes(i));
assertFalse(range.includes(Integer.toString(i)));
assertFalse(range.includes((double)i));
}
}
if (high != Integer.MAX_VALUE) {
for (int i = high + 1; i < high + 5; ++i) {
assertFalse(range.includes(i));
assertFalse(range.includes(Integer.toString(i)));
assertFalse(range.includes((double)i));
}
}
}
public void testIncrementalConstruction() {
final IntegerRange range = new IntegerRange();
assertEquals(0, range.getLow());
assertEquals(0, range.getHigh());
range.add(3, true, 7, true);
assertEquals(3, range.getLow());
assertEquals(7, range.getHigh());
range.add(5, true, 8, true);
assertEquals(3, range.getLow());
assertEquals(8, range.getHigh());
}
public void testUnspecifiedBoundsString() {
final IntegerRange range = new IntegerRange("3-8");
assertEquals(3, range.getLow());
assertEquals(8, range.getHigh());
}
public void testSingleValue() {
IntegerRange range = null;
range = new IntegerRange(5);
verify(range, new int[]{5}, new boolean[]{true}, new int[]{5}, new boolean[]{true}, "5", 1);
range = new IntegerRange("5");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{5}, new boolean[]{true}, "5", 1);
range = new IntegerRange("(5)");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{5}, new boolean[]{true}, "5", 1);
range = new IntegerRange("[5]");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{5}, new boolean[]{true}, "5", 1);
range = new IntegerRange("(5]");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{5}, new boolean[]{true}, "5", 1);
range = new IntegerRange("[5)");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{5}, new boolean[]{true}, "5", 1);
range = new IntegerRange("[ 5 ]");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{5}, new boolean[]{true}, "5", 1);
range = new IntegerRange("5-5");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{5}, new boolean[]{true}, "5", 1);
range = new IntegerRange(" 5 - 5 ");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{5}, new boolean[]{true}, "5", 1);
}
public void testForwardRange() {
IntegerRange range = null;
range = new IntegerRange(3, true, 7, true);
verify(range, new int[]{3}, new boolean[]{true}, new int[]{7}, new boolean[]{true}, "3-7", 5);
range = new IntegerRange(3, false, 7, false);
verify(range, new int[]{3}, new boolean[]{false}, new int[]{7}, new boolean[]{false}, "(3-7)", 3);
range = new IntegerRange(3, false, 7, true);
verify(range, new int[]{3}, new boolean[]{false}, new int[]{7}, new boolean[]{true}, "(3-7]", 4);
range = new IntegerRange(3, true, 7, false);
verify(range, new int[]{3}, new boolean[]{true}, new int[]{7}, new boolean[]{false}, "[3-7)", 4);
range = new IntegerRange("3-7");
verify(range, new int[]{3}, new boolean[]{true}, new int[]{7}, new boolean[]{true}, "3-7", 5);
range = new IntegerRange("[3-7]");
verify(range, new int[]{3}, new boolean[]{true}, new int[]{7}, new boolean[]{true}, "3-7", 5);
range = new IntegerRange("(3-7)");
verify(range, new int[]{3}, new boolean[]{false}, new int[]{7}, new boolean[]{false}, "(3-7)", 3);
range = new IntegerRange("(3-7]");
verify(range, new int[]{3}, new boolean[]{false}, new int[]{7}, new boolean[]{true}, "(3-7]", 4);
range = new IntegerRange("[3-7)");
verify(range, new int[]{3}, new boolean[]{true}, new int[]{7}, new boolean[]{false}, "[3-7)", 4);
}
public void testBackwardRange() {
IntegerRange range = null;
range = new IntegerRange(7, true, 3, true);
verify(range, new int[]{3}, new boolean[]{true}, new int[]{7}, new boolean[]{true}, "3-7", 5);
range = new IntegerRange(7, false, 3, false);
verify(range, new int[]{3}, new boolean[]{false}, new int[]{7}, new boolean[]{false}, "(3-7)", 3);
range = new IntegerRange(7, false, 3, true);
verify(range, new int[]{3}, new boolean[]{true}, new int[]{7}, new boolean[]{false}, "[3-7)", 4);
range = new IntegerRange(7, true, 3, false);
verify(range, new int[]{3}, new boolean[]{false}, new int[]{7}, new boolean[]{true}, "(3-7]", 4);
range = new IntegerRange("(3-7]");
verify(range, new int[]{3}, new boolean[]{false}, new int[]{7}, new boolean[]{true}, "(3-7]", 4);
range = new IntegerRange("[7-3)");
verify(range, new int[]{3}, new boolean[]{false}, new int[]{7}, new boolean[]{true}, "(3-7]", 4);
range = new IntegerRange(" ( 3 - 7 ] ");
verify(range, new int[]{3}, new boolean[]{false}, new int[]{7}, new boolean[]{true}, "(3-7]", 4);
}
public void testToleranceRange() {
IntegerRange range = null;
range = new IntegerRange(3, 7, true, true);
verify(range, new int[]{-4}, new boolean[]{true}, new int[]{10}, new boolean[]{true}, "-4-10", 15);
range = new IntegerRange(3, 7, false, false);
verify(range, new int[]{-4}, new boolean[]{false}, new int[]{10}, new boolean[]{false}, "(-4-10)", 13);
range = new IntegerRange(3, 7, false, true);
verify(range, new int[]{-4}, new boolean[]{false}, new int[]{10}, new boolean[]{true}, "(-4-10]", 14);
range = new IntegerRange(3, 7, true, false);
verify(range, new int[]{-4}, new boolean[]{true}, new int[]{10}, new boolean[]{false}, "[-4-10)", 14);
range = new IntegerRange("[3^7)");
verify(range, new int[]{-4}, new boolean[]{true}, new int[]{10}, new boolean[]{false}, "[-4-10)", 14);
range = new IntegerRange(" [ 3 ^ 7 ) ");
verify(range, new int[]{-4}, new boolean[]{true}, new int[]{10}, new boolean[]{false}, "[-4-10)", 14);
}
public void testMerge1() {
IntegerRange range = null;
range = new IntegerRange("5, 6");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{6}, new boolean[]{true}, "5-6", 2);
range = new IntegerRange("6, 5");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{6}, new boolean[]{true}, "5-6", 2);
range = new IntegerRange("5-7,8,9-11");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{11}, new boolean[]{true}, "5-11", 7);
range = new IntegerRange("[5-7),8,(9-11]");
verify(range,
new int[]{5, 8, 9}, new boolean[]{true, true, false},
new int[]{7, 8, 11}, new boolean[]{false, true, true},
"[5-7),8,(9-11]", 5);
}
public void testUnbounded() {
IntegerRange range = null;
range = new IntegerRange("(5-)");
verify(range, new int[]{5}, new boolean[]{false}, new int[]{Integer.MAX_VALUE}, new boolean[]{true}, "(5-", null);
range = new IntegerRange("(-5)");
verify(range, new int[]{-5}, new boolean[]{true}, new int[]{-5}, new boolean[]{true}, "-5", 1);
range = new IntegerRange("-5");
verify(range, new int[]{-5}, new boolean[]{true}, new int[]{-5}, new boolean[]{true}, "-5", 1);
range = new IntegerRange("-(-5)");
verify(range, new int[]{Integer.MIN_VALUE}, new boolean[]{true}, new int[]{-5}, new boolean[]{false}, "-(-5)", null);
range = new IntegerRange("-(5)");
verify(range, new int[]{Integer.MIN_VALUE}, new boolean[]{true}, new int[]{5}, new boolean[]{false}, "-(5)", null);
range = new IntegerRange("-");
verify(range, new int[]{Integer.MIN_VALUE}, new boolean[]{true}, new int[]{Integer.MAX_VALUE}, new boolean[]{true}, "-", null);
range = new IntegerRange("(5-");
verify(range, new int[]{5}, new boolean[]{false}, new int[]{Integer.MAX_VALUE}, new boolean[]{true}, "(5-", null);
range = new IntegerRange("5-");
verify(range, new int[]{5}, new boolean[]{true}, new int[]{Integer.MAX_VALUE}, new boolean[]{true}, "5-", null);
range = new IntegerRange("-5-");
verify(range, new int[]{-5}, new boolean[]{true}, new int[]{Integer.MAX_VALUE}, new boolean[]{true}, "-5-", null);
range = new IntegerRange("--5");
verify(range, new int[]{Integer.MIN_VALUE}, new boolean[]{true}, new int[]{-5}, new boolean[]{true}, "-(-5]", null);
range = new IntegerRange("--5)");
verify(range, new int[]{Integer.MIN_VALUE}, new boolean[]{true}, new int[]{-5}, new boolean[]{false}, "-(-5)", null);
}
public void testAmbiguous() {
IntegerRange range = null;
range = new IntegerRange("-5-3");
verify(range, new int[]{-5}, new boolean[]{true}, new int[]{3}, new boolean[]{true}, "-5-3", 9);
range = new IntegerRange("-5--3");
verify(range, new int[]{-5}, new boolean[]{true}, new int[]{-3}, new boolean[]{true}, "-5--3", 3);
}
public void testDontAddNonContiguousDuplicate() {
final IntegerRange range = new IntegerRange(1947);
range.add(13, false);
range.add(1947, false);
assertEquals("13,1947", range.toString());
}
public static Test suite() {
TestSuite suite = new TestSuite(TestIntegerRange.class);
return suite;
}
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
}
| [
"skoehler@ancestry.com"
] | skoehler@ancestry.com |
d0402716f5e1e329059b696f19c5f71215dfa657 | 7e887c4f81e3961733c9f7222b7b707ff57b224b | /crm_parent/crm_common/src/main/java/com/dt/common/aspect/AbstractRestControllerAspect.java | aa7f758050cccb02fc8431a26fccc62d9633db6e | [] | no_license | lixiaofengbj/DT_CRM | e8dc47fea36c62a771057b048219eae516a7d360 | d27fb2219267cdcdf8454e2a976411e8882ffbc6 | refs/heads/master | 2022-06-27T05:31:46.079309 | 2019-11-01T09:07:22 | 2019-11-01T09:07:22 | 198,740,762 | 1 | 0 | null | 2022-06-17T02:22:29 | 2019-07-25T02:19:07 | Java | UTF-8 | Java | false | false | 2,715 | java | package com.dt.common.aspect;
import com.dt.common.annotation.LogOperator;
import com.dt.common.bean.ResponseBean;
import com.dt.common.constant.ErrorEnum;
import com.dt.common.utils.CommonUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
@Component
public abstract class AbstractRestControllerAspect {
private Logger logger = LoggerFactory.getLogger(this.getClass());
public Object methodAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
Object object = null;
Object[] args = proceedingJoinPoint.getArgs();
MethodSignature signature = (MethodSignature) proceedingJoinPoint.getSignature();
Class targetClass = proceedingJoinPoint.getTarget().getClass();
String methodName = signature.getName();
Method method = signature.getMethod();
LogOperator logOperator = method.getDeclaredAnnotation(LogOperator.class);
try {
object = proceedingJoinPoint.proceed(args);
Object rs = object;
if (!(object instanceof ResponseBean)) {
ResponseBean responseBean = new ResponseBean();
responseBean.setData(object);
object = responseBean;
}
if (CommonUtils.isNotNull(logOperator)) {
this.logPrint(logOperator, proceedingJoinPoint, args, rs);
}
} catch (Throwable throwable) {
logger.error("异常报错:[类名:{},方法名:{}],error:{}", targetClass.getName(), methodName, CommonUtils.getExceptioniInformation(throwable));
ErrorEnum errorEnum = ErrorEnum.ERROR;
String errorMessage = null;
Throwable throwableCause = throwable.getCause();
String errorDetails = CommonUtils.getExceptioniInformation(throwable);
String errorMsg = throwable.toString();
if (CommonUtils.isNotNull(throwableCause)) {
errorMessage = throwableCause.getMessage();
} else {
errorMessage = throwable.getMessage();
}
object = new ResponseBean(errorEnum.getErrorCode(), errorMessage);
}
return object;
}
/**
* 方法标有logOperator注解的处理函数
*
* @param logOperator
* @param proceedingJoinPoint
* @param args
*/
protected abstract void logPrint(LogOperator logOperator, ProceedingJoinPoint proceedingJoinPoint, Object[] args, Object returnData);
}
| [
"m18210682571@163.com"
] | m18210682571@163.com |
52a8f5fbc95c7b4f57dbbd64f3440b99f678fadf | 0962390c2761f734484f83b8e4abad2b4824b84c | /person-management/src/main/java/com/liurq/server/model/UserRegistrationExample.java | 65d264647f297a70ce4aa369c963bbe5dbe591ab | [] | no_license | dobulekill/hospital-registration-i | 74cc212f00bb9d705ef7fd36ac760335bcf97dea | b15c4ecd34f6979cbb200048c01420f9116e482d | refs/heads/master | 2023-02-26T10:07:52.374905 | 2021-02-04T08:57:55 | 2021-02-04T08:57:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,234 | java | package com.liurq.server.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class UserRegistrationExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public UserRegistrationExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andHospitalIdIsNull() {
addCriterion("hospital_id is null");
return (Criteria) this;
}
public Criteria andHospitalIdIsNotNull() {
addCriterion("hospital_id is not null");
return (Criteria) this;
}
public Criteria andHospitalIdEqualTo(String value) {
addCriterion("hospital_id =", value, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdNotEqualTo(String value) {
addCriterion("hospital_id <>", value, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdGreaterThan(String value) {
addCriterion("hospital_id >", value, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdGreaterThanOrEqualTo(String value) {
addCriterion("hospital_id >=", value, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdLessThan(String value) {
addCriterion("hospital_id <", value, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdLessThanOrEqualTo(String value) {
addCriterion("hospital_id <=", value, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdLike(String value) {
addCriterion("hospital_id like", value, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdNotLike(String value) {
addCriterion("hospital_id not like", value, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdIn(List<String> values) {
addCriterion("hospital_id in", values, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdNotIn(List<String> values) {
addCriterion("hospital_id not in", values, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdBetween(String value1, String value2) {
addCriterion("hospital_id between", value1, value2, "hospitalId");
return (Criteria) this;
}
public Criteria andHospitalIdNotBetween(String value1, String value2) {
addCriterion("hospital_id not between", value1, value2, "hospitalId");
return (Criteria) this;
}
public Criteria andDepartmentIdIsNull() {
addCriterion("department_id is null");
return (Criteria) this;
}
public Criteria andDepartmentIdIsNotNull() {
addCriterion("department_id is not null");
return (Criteria) this;
}
public Criteria andDepartmentIdEqualTo(String value) {
addCriterion("department_id =", value, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdNotEqualTo(String value) {
addCriterion("department_id <>", value, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdGreaterThan(String value) {
addCriterion("department_id >", value, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdGreaterThanOrEqualTo(String value) {
addCriterion("department_id >=", value, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdLessThan(String value) {
addCriterion("department_id <", value, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdLessThanOrEqualTo(String value) {
addCriterion("department_id <=", value, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdLike(String value) {
addCriterion("department_id like", value, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdNotLike(String value) {
addCriterion("department_id not like", value, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdIn(List<String> values) {
addCriterion("department_id in", values, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdNotIn(List<String> values) {
addCriterion("department_id not in", values, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdBetween(String value1, String value2) {
addCriterion("department_id between", value1, value2, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdNotBetween(String value1, String value2) {
addCriterion("department_id not between", value1, value2, "departmentId");
return (Criteria) this;
}
public Criteria andDoctorIdIsNull() {
addCriterion("doctor_id is null");
return (Criteria) this;
}
public Criteria andDoctorIdIsNotNull() {
addCriterion("doctor_id is not null");
return (Criteria) this;
}
public Criteria andDoctorIdEqualTo(String value) {
addCriterion("doctor_id =", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdNotEqualTo(String value) {
addCriterion("doctor_id <>", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdGreaterThan(String value) {
addCriterion("doctor_id >", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdGreaterThanOrEqualTo(String value) {
addCriterion("doctor_id >=", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdLessThan(String value) {
addCriterion("doctor_id <", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdLessThanOrEqualTo(String value) {
addCriterion("doctor_id <=", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdLike(String value) {
addCriterion("doctor_id like", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdNotLike(String value) {
addCriterion("doctor_id not like", value, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdIn(List<String> values) {
addCriterion("doctor_id in", values, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdNotIn(List<String> values) {
addCriterion("doctor_id not in", values, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdBetween(String value1, String value2) {
addCriterion("doctor_id between", value1, value2, "doctorId");
return (Criteria) this;
}
public Criteria andDoctorIdNotBetween(String value1, String value2) {
addCriterion("doctor_id not between", value1, value2, "doctorId");
return (Criteria) this;
}
public Criteria andRegDateIsNull() {
addCriterion("reg_date is null");
return (Criteria) this;
}
public Criteria andRegDateIsNotNull() {
addCriterion("reg_date is not null");
return (Criteria) this;
}
public Criteria andRegDateEqualTo(Date value) {
addCriterion("reg_date =", value, "regDate");
return (Criteria) this;
}
public Criteria andRegDateNotEqualTo(Date value) {
addCriterion("reg_date <>", value, "regDate");
return (Criteria) this;
}
public Criteria andRegDateGreaterThan(Date value) {
addCriterion("reg_date >", value, "regDate");
return (Criteria) this;
}
public Criteria andRegDateGreaterThanOrEqualTo(Date value) {
addCriterion("reg_date >=", value, "regDate");
return (Criteria) this;
}
public Criteria andRegDateLessThan(Date value) {
addCriterion("reg_date <", value, "regDate");
return (Criteria) this;
}
public Criteria andRegDateLessThanOrEqualTo(Date value) {
addCriterion("reg_date <=", value, "regDate");
return (Criteria) this;
}
public Criteria andRegDateIn(List<Date> values) {
addCriterion("reg_date in", values, "regDate");
return (Criteria) this;
}
public Criteria andRegDateNotIn(List<Date> values) {
addCriterion("reg_date not in", values, "regDate");
return (Criteria) this;
}
public Criteria andRegDateBetween(Date value1, Date value2) {
addCriterion("reg_date between", value1, value2, "regDate");
return (Criteria) this;
}
public Criteria andRegDateNotBetween(Date value1, Date value2) {
addCriterion("reg_date not between", value1, value2, "regDate");
return (Criteria) this;
}
public Criteria andCreateDateIsNull() {
addCriterion("create_date is null");
return (Criteria) this;
}
public Criteria andCreateDateIsNotNull() {
addCriterion("create_date is not null");
return (Criteria) this;
}
public Criteria andCreateDateEqualTo(Date value) {
addCriterion("create_date =", value, "createDate");
return (Criteria) this;
}
public Criteria andCreateDateNotEqualTo(Date value) {
addCriterion("create_date <>", value, "createDate");
return (Criteria) this;
}
public Criteria andCreateDateGreaterThan(Date value) {
addCriterion("create_date >", value, "createDate");
return (Criteria) this;
}
public Criteria andCreateDateGreaterThanOrEqualTo(Date value) {
addCriterion("create_date >=", value, "createDate");
return (Criteria) this;
}
public Criteria andCreateDateLessThan(Date value) {
addCriterion("create_date <", value, "createDate");
return (Criteria) this;
}
public Criteria andCreateDateLessThanOrEqualTo(Date value) {
addCriterion("create_date <=", value, "createDate");
return (Criteria) this;
}
public Criteria andCreateDateIn(List<Date> values) {
addCriterion("create_date in", values, "createDate");
return (Criteria) this;
}
public Criteria andCreateDateNotIn(List<Date> values) {
addCriterion("create_date not in", values, "createDate");
return (Criteria) this;
}
public Criteria andCreateDateBetween(Date value1, Date value2) {
addCriterion("create_date between", value1, value2, "createDate");
return (Criteria) this;
}
public Criteria andCreateDateNotBetween(Date value1, Date value2) {
addCriterion("create_date not between", value1, value2, "createDate");
return (Criteria) this;
}
public Criteria andUpdateDateIsNull() {
addCriterion("update_date is null");
return (Criteria) this;
}
public Criteria andUpdateDateIsNotNull() {
addCriterion("update_date is not null");
return (Criteria) this;
}
public Criteria andUpdateDateEqualTo(Date value) {
addCriterion("update_date =", value, "updateDate");
return (Criteria) this;
}
public Criteria andUpdateDateNotEqualTo(Date value) {
addCriterion("update_date <>", value, "updateDate");
return (Criteria) this;
}
public Criteria andUpdateDateGreaterThan(Date value) {
addCriterion("update_date >", value, "updateDate");
return (Criteria) this;
}
public Criteria andUpdateDateGreaterThanOrEqualTo(Date value) {
addCriterion("update_date >=", value, "updateDate");
return (Criteria) this;
}
public Criteria andUpdateDateLessThan(Date value) {
addCriterion("update_date <", value, "updateDate");
return (Criteria) this;
}
public Criteria andUpdateDateLessThanOrEqualTo(Date value) {
addCriterion("update_date <=", value, "updateDate");
return (Criteria) this;
}
public Criteria andUpdateDateIn(List<Date> values) {
addCriterion("update_date in", values, "updateDate");
return (Criteria) this;
}
public Criteria andUpdateDateNotIn(List<Date> values) {
addCriterion("update_date not in", values, "updateDate");
return (Criteria) this;
}
public Criteria andUpdateDateBetween(Date value1, Date value2) {
addCriterion("update_date between", value1, value2, "updateDate");
return (Criteria) this;
}
public Criteria andUpdateDateNotBetween(Date value1, Date value2) {
addCriterion("update_date not between", value1, value2, "updateDate");
return (Criteria) this;
}
public Criteria andNumIsNull() {
addCriterion("num is null");
return (Criteria) this;
}
public Criteria andNumIsNotNull() {
addCriterion("num is not null");
return (Criteria) this;
}
public Criteria andNumEqualTo(String value) {
addCriterion("num =", value, "num");
return (Criteria) this;
}
public Criteria andNumNotEqualTo(String value) {
addCriterion("num <>", value, "num");
return (Criteria) this;
}
public Criteria andNumGreaterThan(String value) {
addCriterion("num >", value, "num");
return (Criteria) this;
}
public Criteria andNumGreaterThanOrEqualTo(String value) {
addCriterion("num >=", value, "num");
return (Criteria) this;
}
public Criteria andNumLessThan(String value) {
addCriterion("num <", value, "num");
return (Criteria) this;
}
public Criteria andNumLessThanOrEqualTo(String value) {
addCriterion("num <=", value, "num");
return (Criteria) this;
}
public Criteria andNumLike(String value) {
addCriterion("num like", value, "num");
return (Criteria) this;
}
public Criteria andNumNotLike(String value) {
addCriterion("num not like", value, "num");
return (Criteria) this;
}
public Criteria andNumIn(List<String> values) {
addCriterion("num in", values, "num");
return (Criteria) this;
}
public Criteria andNumNotIn(List<String> values) {
addCriterion("num not in", values, "num");
return (Criteria) this;
}
public Criteria andNumBetween(String value1, String value2) {
addCriterion("num between", value1, value2, "num");
return (Criteria) this;
}
public Criteria andNumNotBetween(String value1, String value2) {
addCriterion("num not between", value1, value2, "num");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("status is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("status is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("status =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("status <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("status >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("status >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("status <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("status <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("status like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("status not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("status in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("status not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("status between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("status not between", value1, value2, "status");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table tb_user_registration
*
* @mbggenerated do_not_delete_during_merge Wed Feb 03 19:23:50 CST 2021
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table tb_user_registration
*
* @mbggenerated Wed Feb 03 19:23:50 CST 2021
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"buyi0509@163.com"
] | buyi0509@163.com |
f31d45bd1ad54d88083bfeaf21fd46e9b1b14cbd | 578e4c5bcced3d0900a046cf19549e96f7399197 | /回归预测分析源码/forecast/src/org/forecast/sevlet/getdata/GetTableName.java | 7379c56f458bfe0d2b10dd640c326040df62d258 | [] | no_license | sspeng/multiinfo-data | 2352a4d9d85a26c3b3422d73575737b0c4d36cec | e0cdf5dd7f9a142869badc10aa833e3c65432494 | refs/heads/master | 2020-04-17T16:36:54.859912 | 2016-06-01T14:43:47 | 2016-06-01T14:43:47 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,502 | java | package org.forecast.sevlet.getdata;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.forecast.db.factory.DBFactory;
import org.forecast.exception.ObjectToObjectException;
import org.forecast.parse.ObjectToObject;
import org.forecast.parse.ObjectToString;
import org.forecast.pojo.DataBaseMessage;
/**
* 得到用户的所有表的名称
*/
public class GetTableName extends HttpServlet {
public GetTableName() {
super();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// 得到页面的数据
String databaseKind = null;
String ip = null;
String dataBase = null;
String userName = null;
String password = null;
DataBaseMessage dbm = new DataBaseMessage();
if (!"".equals(request.getParameter("databaseKind"))
&& null != request.getParameter("databaseKind")) {
dbm.setDatabaseKind(request.getParameter("databaseKind"));// 传入的数据库类型不为空则赋值
} else {
// 出错。。数据不完整
// 跳转到消息页面
// 保存消息
request.setAttribute("message", "数据库类型不能为空!");
request.getRequestDispatcher("message.jsp").forward(request,
response);
return;
}
if (!"".equals(request.getParameter("ip"))
&& null != request.getParameter("ip")) {
dbm.setIp(request.getParameter("ip"));// 传入的ip不为空则赋值
} else {
// 出错。。数据不完整
// 跳转到消息页面
// 保存消息
request.setAttribute("message", "IP不能为空!");
request.getRequestDispatcher("message.jsp").forward(request,
response);
return;
}
if (!"".equals(request.getParameter("dataBase"))
&& null != request.getParameter("dataBase")) {
dbm.setDataBase(request.getParameter("dataBase"));// 传入的数据库不为空则赋值
} else {
// 出错。。数据不完整
// 跳转到消息页面
// 保存消息
request.setAttribute("message", "数据库不能为空!");
request.getRequestDispatcher("message.jsp").forward(request,
response);
return;
}
if (!"".equals(request.getParameter("userName"))
&& null != request.getParameter("userName")) {
dbm.setUserName(request.getParameter("userName"));// 传入的用户名不为空则赋值
} else {
// 出错。。数据不完整
// 跳转到消息页面
// 保存消息
request.setAttribute("message", "数据库用户名不能为空!");
request.getRequestDispatcher("message.jsp").forward(request,
response);
return;
}
if (!"".equals(request.getParameter("password"))
&& null != request.getParameter("password")) {
dbm.setPassword(request.getParameter("password"));// 传入的密码不为空则赋值
} else {
// 出错。。数据不完整
// 跳转到消息页面
// 保存消息
request.setAttribute("message", "数据库密码不能为空!");
request.getRequestDispatcher("message.jsp").forward(request,
response);
return;
}
// 从数据库得到表名
List allTableName = null;
DBFactory dbf = new DBFactory(dbm);
try {
allTableName = dbf.factory();
} catch (RuntimeException e1) {
// 出错。。数据不完整
// 跳转到消息页面
// 保存消息
request.setAttribute("message", "无法连接数据库,确认输入无误,保证数据库服务处于开启状态!");
request.getRequestDispatcher("message.jsp").forward(request,
response);
return;
}
// 序列化用户填写的对象
ObjectToObject oto = new ObjectToString();
String objStr = null;// 用来存储对象字符串
try {
objStr = (String) oto.transform(dbm);
} catch (ObjectToObjectException e) {
// 跳转到消息页面
// 保存消息
e.printStackTrace();
request.setAttribute("message", "对象转换错误");
request.getRequestDispatcher("message.jsp").forward(request,
response);
return;
}
// 封装表名,填写的对象数据
request.setAttribute("allTableName", allTableName);
request.setAttribute("objStr", objStr);
// 跳转
request.getRequestDispatcher("allTables.jsp")
.forward(request, response);
return;
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doGet(request, response);
}
}
| [
"806507587@qq.com"
] | 806507587@qq.com |
eec5c0892fac59b4905e1058924f4dd1d005d155 | 91297ffb10fb4a601cf1d261e32886e7c746c201 | /css.lib/src/org/netbeans/modules/css/lib/api/Node.java | f8adb1d6015b544b6d91b39396c5fe95b2c4a2e7 | [] | no_license | JavaQualitasCorpus/netbeans-7.3 | 0b0a49d8191393ef848241a4d0aa0ecc2a71ceba | 60018fd982f9b0c9fa81702c49980db5a47f241e | refs/heads/master | 2023-08-12T09:29:23.549956 | 2019-03-16T17:06:32 | 2019-03-16T17:06:32 | 167,005,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,526 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 Oracle and/or its affiliates. All rights reserved.
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common
* Development and Distribution License("CDDL") (collectively, the
* "License"). You may not use this file except in compliance with the
* License. You can obtain a copy of the License at
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
* specific language governing permissions and limitations under the
* License. When distributing the software, include this License Header
* Notice in each file and include the License file at
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the
* License Header, with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* If you wish your version of this file to be governed by only the CDDL
* or only the GPL Version 2, indicate your decision by adding
* "[Contributor] elects to include this software in this distribution
* under the [CDDL or GPL Version 2] license." If you do not indicate a
* single choice of license, a recipient has the option to distribute
* your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above.
* However, if you add GPL Version 2 code and therefore, elected the GPL
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
*
* Contributor(s):
*
* Portions Copyrighted 2011 Sun Microsystems, Inc.
*/
package org.netbeans.modules.css.lib.api;
import java.util.List;
import java.util.Map;
/**
* Node of the css source parse tree.
*
* @author marekfukala
*/
public interface Node {
public int from();
public int to();
public String name();
public NodeType type();
public List<Node> children();
public Node parent();
public CharSequence image();
}
| [
"taibi@sonar-scheduler.rd.tut.fi"
] | taibi@sonar-scheduler.rd.tut.fi |
c0b49191e14e17d3004977930bc1fab31281ca67 | acefb83d398bd807e853d6dce247c971a544efe8 | /aula06/src/Universidade/Pessoa.java | 416992074f45943b0efb22f4cecfe7edf118a8ef | [
"MIT"
] | permissive | thalysonalexr/oop-class | 22c7ba1eb655d7333da6b60417d16ef569768080 | c87d74bed33e8cb9e688598bc02a41d5dfcdcda0 | refs/heads/master | 2022-04-07T02:44:23.372463 | 2020-03-12T18:57:03 | 2020-03-12T18:57:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,755 | 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 Universidade;
/**
*
* @author Lab
*/
public class Pessoa {
private String cpf;
private int idade;
private String nome;
private String telefone;
public Pessoa() {
}
public Pessoa(String cpf, int idade, String nome, String telefone) {
this.cpf = cpf;
this.idade = idade;
this.nome = nome;
this.telefone = telefone;
}
/**
* @return the cpf
*/
public String getCpf() {
return cpf;
}
/**
* @param cpf the cpf to set
*/
public void setCpf(String cpf) {
this.cpf = cpf;
}
/**
* @return the idade
*/
public int getIdade() {
return idade;
}
/**
* @param idade the idade to set
*/
public void setIdade(int idade) {
this.idade = idade;
}
/**
* @return the nome
*/
public String getNome() {
return nome;
}
/**
* @param nome the nome to set
*/
public void setNome(String nome) {
this.nome = nome;
}
/**
* @return the telefone
*/
public String getTelefone() {
return telefone;
}
/**
* @param telefone the telefone to set
*/
public void setTelefone(String telefone) {
this.telefone = telefone;
}
@Override
public String toString() {
return " CPF: " + this.cpf + "\n"
+ " - Idade: " + this.idade + "\n"
+ " - Nome: " + this.nome + "\n"
+ " - Telefone: " + this.telefone + "\n";
}
}
| [
"thalysonrodrigues.dev@gmail.com"
] | thalysonrodrigues.dev@gmail.com |
45ffa893e250426dfdb8cd187c6ea25ad7822932 | 1ede374a8b2fe45d41a6969433c51bc8c055e0b1 | /family_sys/src/main/java/org/yxyqcy/family/sys/security/SystemFormAuthenticationFilter.java | 8a93306e7b26f09d5a76e749c8f3a388c5a141b6 | [] | no_license | carlisle5899/family | 3ee24463a1b4400d6d5debbc599225c4ca69d822 | 4cf1978ae91425f255df71809d724519b0e8c66d | refs/heads/master | 2020-03-12T13:33:44.034263 | 2018-04-23T06:48:24 | 2018-04-23T06:48:24 | 130,645,115 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 11,977 | java | package org.yxyqcy.family.sys.security;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.yxyqcy.family.common.constant.MessageConstant;
import org.yxyqcy.family.common.constant.SysConstants;
import org.yxyqcy.family.common.message.AjaxResponse;
import org.yxyqcy.family.common.util.SystemUtil;
import org.yxyqcy.family.common.util.WebUtil;
import org.yxyqcy.family.sys.cache.CacheUtil;
import org.yxyqcy.family.sys.controller.LoginController;
import org.yxyqcy.family.sys.security.stateless.StatelessToken;
import org.yxyqcy.family.sys.util.UserUtils;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Created with family.
* author: cy
* Date: 16/6/1
* Time: 下午2:24
* description: 表单验证 过滤器
*/
@Component
public class SystemFormAuthenticationFilter extends FormAuthenticationFilter {
public static final String DEFAULT_CAPTCHA_PARAM = "validateCode";
private static final Logger log = LoggerFactory.getLogger(SystemFormAuthenticationFilter.class);
private String captchaParam = DEFAULT_CAPTCHA_PARAM;
public String getCaptchaParam() {
return captchaParam;
}
protected String getCaptcha(ServletRequest request) {
return WebUtils.getCleanParam(request, getCaptchaParam());
}
@Override
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) {
String username = getUsername(request);
String password = getPassword(request);
if (password==null){
password = "";
}
boolean rememberMe = isRememberMe(request);
String host = getHost(request);
String captcha = getCaptcha(request);
return new SystemUsernamePasswordToken(username, password.toCharArray(), rememberMe, host, captcha);
}
/**
* 主要是针对登入成功的处理方法。对于请求头是AJAX的之间返回JSON字符串。
* @param token
* @param subject
* @param request
* @param response
* @return
* @throws Exception
*/
@Override
protected boolean onLoginSuccess(AuthenticationToken token, Subject subject,
ServletRequest request, ServletResponse response) throws Exception {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
//remove 验证码
httpServletRequest.getSession().removeAttribute("isValidateCodeLogin");
//设备登录 /adminLogin = authc 所以 不能进入无状态filter
if(WebUtil.isMobileDevice(httpServletRequest)){
this.printAjaxReponse(httpServletResponse,true,MessageConstant.MESSAGE_ALERT_LOGIN_SUCCESS,UserUtils.getUser());
}
//ajax
else if(WebUtil.isAjaxRequest(httpServletRequest)){
this.printAjaxReponse(httpServletResponse,true,MessageConstant.MESSAGE_ALERT_LOGIN_SUCCESS,UserUtils.getUser());
/*login 验证码 清空*/
boolean loginResult = LoginController.isValidateCodeLogin(UserUtils.getUser().getLoginName(), false, true);
httpServletRequest.getSession().setAttribute("isValidateCodeLogin",false);
/*login 验证码 清空 end*/
}else{
issueSuccessRedirect(request, response);
}
//we handled the success redirect directly, prevent the chain from continuing:
return false;
}
/**
* 主要是针对登入失败的处理方法。对于请求头是AJAX的之间返回JSON字符串。
* @param token
* @param e
* @param request
* @param response
* @return
*/
@Override
protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e,
ServletRequest request, ServletResponse response) {
Map<String, Integer> loginFailMap = (Map<String, Integer>) CacheUtil.get("loginFailMap");
SystemUsernamePasswordToken authToken = (SystemUsernamePasswordToken) token;
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
//设备登录 /adminLogin = authc 所以 不能进入无状态filter
if(WebUtil.isMobileDevice(httpServletRequest)){
try {
String message = e.getClass().getSimpleName();
if ("IncorrectCredentialsException".equals(message)) {
this.printAjaxReponse(httpServletResponse,false,"密码错误",loginFailMap.get(authToken.getUsername()));
} else if ("UnknownAccountException".equals(message)) {
this.printAjaxReponse(httpServletResponse,false,"账号不存在",null);
} else if ("LockedAccountException".equals(message)) {
this.printAjaxReponse(httpServletResponse,false,"账号被锁定",null);
} else if ("CaptchaException".equals(message)) {
this.printAjaxReponse(httpServletResponse,false,"验证码错误",loginFailMap.get(authToken.getUsername()));
} else if("AuthenticationException".equals(message)) {
//动态设置realm时 出现的异常
this.printAjaxReponse(httpServletResponse,false,e.getCause().getMessage(),loginFailMap.get(authToken.getUsername()));
}else{
this.printAjaxReponse(httpServletResponse,false,"未知错误",null);
}
//return false
//不能跳转 response.writer.print 信息后 如果继续到跳转
//@RequestMapping(value = "adminLogin", method = RequestMethod.POST) 则会报错
return false;
} catch (Exception e1) {
e1.printStackTrace();
}
}
//ajax
else if(WebUtil.isAjaxRequest(httpServletRequest)){
try {
String message = e.getClass().getSimpleName();
if ("IncorrectCredentialsException".equals(message)) {
/*login 验证码*/
boolean loginResult = LoginController.isValidateCodeLogin(authToken.getUsername(), true, false);
httpServletRequest.getSession().setAttribute("isValidateCodeLogin",loginResult);
/*login 验证码 end*/
this.printAjaxReponse(httpServletResponse,false,"密码错误",loginFailMap.get(authToken.getUsername()));
} else if ("UnknownAccountException".equals(message)) {
this.printAjaxReponse(httpServletResponse,false,"账号不存在",null);
} else if ("LockedAccountException".equals(message)) {
this.printAjaxReponse(httpServletResponse,false,"账号被锁定",null);
} else if ("CaptchaException".equals(message)) {
/*login 验证码*/
boolean loginResult = LoginController.isValidateCodeLogin(authToken.getUsername(), true, false);
httpServletRequest.getSession().setAttribute("isValidateCodeLogin",loginResult);
/*login 验证码 end*/
this.printAjaxReponse(httpServletResponse,false,"验证码错误",loginFailMap.get(authToken.getUsername()));
} else if("AuthenticationException".equals(message)) {
//动态设置realm时 出现的异常
this.printAjaxReponse(httpServletResponse,false,e.getCause().getMessage(),loginFailMap.get(authToken.getUsername()));
}else{
this.printAjaxReponse(httpServletResponse,false,"未知错误",null);
}
//return false
//不能跳转 response.writer.print 信息后 如果继续到跳转
//@RequestMapping(value = "adminLogin", method = RequestMethod.POST) 则会报错
return false;
} catch (Exception e1) {
e1.printStackTrace();
}
}else{
setFailureAttribute(request, e);
//login failed, let request continue back to the login page:
}
return true;
}
/*@Override
无权权限 ajax 扩展
<!--权限不足-->
<prop key="org.apache.shiro.authz.UnauthorizedException">redirect:/global/noAuthorization</prop>
1.目前采取 get post 区分ajax请求 进行处理
2.也可以采取重写 onAccessDenied 进行扩展
**/
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
Subject subject = getSubject(request, response);
//login get请求
if (isLoginRequest(request, response)) {
//login post请求
if (isLoginSubmission(request, response)) {
if (log.isTraceEnabled()) {
log.trace("Login submission detected. Attempting to execute login.");
}
return executeLogin(request, response);
} else {
if (log.isTraceEnabled()) {
log.trace("Login page view.");
}
//allow them to see the login page ;)
return true;
}
} else {
if (log.isTraceEnabled()) {
log.trace("Attempting to access a path which requires authentication. Forwarding to the " +
"Authentication url [" + getLoginUrl() + "]");
}
/**
* ajax 请求 判断 return false;
*/
if(subject.getPrincipal() == null && WebUtil.isAjaxRequest(httpRequest)) {
this.printAjaxReponse(httpResponse,false,MessageConstant.MESSAGE_ALERT_NOAUTHENTICATION,AjaxResponse.ErrorAjaxCode.ERROR_CODE_NOAUTHENTICATION);
return false;
}else if(subject.getPrincipal() != null && WebUtil.isAjaxRequest(httpRequest)) {
this.printAjaxReponse(httpResponse,false,MessageConstant.MESSAGE_ALERT_NOAUTHORIZATION,AjaxResponse.ErrorAjaxCode.ERROR_CODE_NOAUTHORIZATION);
return false;
}
/*ajax 请求 判断 end*/
saveRequestAndRedirectToLogin(request, response);
return false;
}
}
/**
* print ajax response
* @param response
* @return
* @throws Exception
*/
private void printAjaxReponse(HttpServletResponse response,boolean success,String message,Object result) throws Exception{
/**
* ajax 请求 判断 return false;
*/
AjaxResponse ajax = new AjaxResponse();
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = null;
out = response.getWriter();
if(success)
ajax.setSuccessMessage(message,result);
else
ajax.setErrorMessage(message,result);
out.print(JSONObject.toJSONString(ajax,
SerializerFeature.WriteMapNullValue));
out.flush();
out.close();
}
}
| [
"carlisle5899@163.com"
] | carlisle5899@163.com |
8012ce8fd780488834802d2e13b510ff6f6c2d71 | ba6355c82fc97182c994b3c36799969a8ebdc10b | /oasp4j-boot-restaurant/src/main/java/io/oasp/gastronomy/restaurant/offermanagement/dataaccess/api/ProductEntity.java | 1a021051d68d200e23ec8ef7aa73a881a193b5f2 | [
"Apache-2.0"
] | permissive | jkarbowiak/oasp4j-sample | 51df9ec6de5111a93b40aa3a4bc03ae3f95cae8b | 7d18062e63395a0030ab40c73e73c6a868bc455d | refs/heads/master | 2021-01-18T12:17:47.348650 | 2014-12-02T12:24:53 | 2014-12-02T12:24:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 996 | java | package io.oasp.gastronomy.restaurant.offermanagement.dataaccess.api;
import io.oasp.gastronomy.restaurant.offermanagement.common.api.Product;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
/**
* {@link io.oasp.gastronomy.restaurant.general.dataaccess.api.ApplicationPersistenceEntity
* Entity} for {@link io.oasp.gastronomy.restaurant.offermanagement.common.api.Product} .
*
* @author loverbec
*/
@Entity(name = "Product")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "dtype", discriminatorType = DiscriminatorType.STRING)
public abstract class ProductEntity extends MenuItemEntity implements Product {
private static final long serialVersionUID = 1L;
// TODO oasp/oasp4j#52
// private byte[] picture;
/**
* The constructor.
*/
public ProductEntity() {
super();
}
}
| [
"artur.otrzonsek@capgemini.com"
] | artur.otrzonsek@capgemini.com |
275720a1d978fe5b920a1cf4dac05962eae54a11 | 61df3136fa96310113861698ab9a3427693e7adf | /src/main/java/cn/vtyc/website/service/RoleService.java | 0f401d2a9bafee48fa2521185a7c4cf545500142 | [] | no_license | Doubleh06/website | 21194367b5f05870a77e6a2d78069393eacb3955 | 67d49b6c1d381be1afbc492f3ebd79b258fb982d | refs/heads/master | 2020-04-13T10:49:48.862084 | 2019-03-11T08:06:37 | 2019-03-11T08:06:37 | 163,153,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,314 | java | package cn.vtyc.website.service;
import cn.vtyc.website.core.AbstractService;
import cn.vtyc.website.core.BaseDao;
import cn.vtyc.website.core.jqGrid.JqGridParam;
import cn.vtyc.website.dao.MenuDao;
import cn.vtyc.website.dao.RoleDao;
import cn.vtyc.website.dao.RoleMenuDao;
import cn.vtyc.website.dto.RoleJqGridParam;
import cn.vtyc.website.entity.Role;
import cn.vtyc.website.entity.RoleMenu;
import cn.vtyc.website.security.MySecurityMetadataSource;
import cn.vtyc.website.util.SpringContextUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import tk.mybatis.mapper.entity.Condition;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @author fonlin
* @date 2018/4/25
*/
@Service
public class RoleService extends AbstractService<Role> {
@Resource
private RoleDao roleDao;
@Resource
private RoleMenuDao roleMenuDao;
@Resource
private MenuDao menuDao;
@Override
protected BaseDao<Role> getDao() {
return roleDao;
}
@Override
protected List<Role> selectByJqGridParam(JqGridParam param) {
RoleJqGridParam roleJqGridParam = (RoleJqGridParam) param;
StringBuilder sql = new StringBuilder();
sql.append("1=1 ");
if (StringUtils.isNotEmpty(roleJqGridParam.getName())) {
sql.append("and name like '%").append(roleJqGridParam.getName()).append("%' ");
}
if (StringUtils.isNotEmpty(roleJqGridParam.getRoleKey())) {
sql.append("and role_key like '%").append(roleJqGridParam.getRoleKey()).append("%' ");
}
if (StringUtils.isNotEmpty(roleJqGridParam.getSidx())) {
sql.append("order by ").append(roleJqGridParam.getSidx()).append(" ").append(roleJqGridParam.getSord()).append("");
}
return roleDao.selectBySql("role", sql.toString());
}
@Transactional
public void savePermission(Integer roleId, List<String> codes) {
//先删除所有的
Condition condition = new Condition(RoleMenu.class);
Example.Criteria criteria = condition.createCriteria();
criteria.andEqualTo("roleId", roleId);
roleMenuDao.deleteByExample(condition);
if (!CollectionUtils.isEmpty(codes)) {
List<Integer> menuIds = menuDao.selectAllIdByCode(codes);
List<RoleMenu> roleMenus = new ArrayList<>();
for (Integer menuId : menuIds) {
RoleMenu roleMenu = new RoleMenu();
roleMenu.setMenuId(menuId);
roleMenu.setRoleId(roleId);
roleMenus.add(roleMenu);
}
roleMenuDao.insertList(roleMenus);
}
SpringContextUtil.getBean(MySecurityMetadataSource.class).refreshResources();
}
public List<Role> selectAllByUser(Integer userId) {
return roleDao.selectAllByUser(userId);
}
public void deleteRole(Integer id) {
Role role = new Role();
role.setId(id);
roleDao.delete(role);
RoleMenu roleMenu = new RoleMenu();
roleMenu.setRoleId(id);
roleMenuDao.delete(roleMenu);
}
}
| [
"811069167@qq.com"
] | 811069167@qq.com |
2609fb6c08fe70c6d4513c4f34f167a90c7d3ce4 | 47686bbdcf8be3ee0cda1442d32fd61465a917d3 | /ppl-engine-ds/src/main/java/com/sap/research/primelife/ds/pdp/matching/PolicyUpdater.java | ca86a00f34ca58f4c1d4db8425368c1762d913d0 | [] | no_license | jjsendor/fiware-ppl | f08e8cb2e7336eaae39389936cab58cfc931a09a | 841b01e89b929c1104b5689a23bb826337183646 | refs/heads/master | 2021-01-09T07:03:00.610271 | 2014-04-30T14:09:06 | 2014-04-30T14:09:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,728 | java | /*******************************************************************************
* Copyright (c) 2013, SAP AG
* 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 the SAP AG 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 HOLDER 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.
******************************************************************************/
package com.sap.research.primelife.ds.pdp.matching;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sap.research.primelife.dao.DaoImpl;
import com.sap.research.primelife.dao.PolicyDao;
import com.sap.research.primelife.exceptions.SyntaxException;
import com.sap.research.primelife.exceptions.WritingException;
//import com.sap.research.primelife.obligation.matching.client.IOMEService;
//import com.sap.research.primelife.obligation.matching.client.IOMEServiceGetMatchingPreferencePPLDeserializationExceptionFaultFaultMessage;
//import com.sap.research.primelife.obligation.matching.client.IOMEServiceGetMatchingPreferencePPLStickyPolicyExceptionFaultFaultMessage;
//import com.sap.research.primelife.obligation.matching.client.OMEService;
import eu.primelife.ppl.policy.impl.AuthorizationType;
import eu.primelife.ppl.policy.impl.AuthorizationsSetType;
import eu.primelife.ppl.policy.impl.DataHandlingPolicyType;
import eu.primelife.ppl.policy.impl.DataHandlingPreferencesType;
import eu.primelife.ppl.policy.impl.ObjectFactory;
import eu.primelife.ppl.policy.obligation.impl.ObligationsSet;
/**
* Contains the logic to update data handling preferences.
* Depends on the HandyAuthorizationsSet and the ObligationMatching Webservice.
* For an overview of the matching and updating algorithm, see the file authorizationMatching.pdf
*
*
*/
public class PolicyUpdater {
private static DaoImpl<DataHandlingPreferencesType> dao = new DaoImpl<DataHandlingPreferencesType>();
private static DaoImpl<AuthorizationsSetType> authDao = new DaoImpl<AuthorizationsSetType>();
@SuppressWarnings("unused")
private static DaoImpl<ObligationsSet> oblDao = new DaoImpl<ObligationsSet>();
private static PolicyDao polDao = new PolicyDao();
private static ObjectFactory ofPrimelife = new ObjectFactory();
private static final Logger LOGGER = LoggerFactory.getLogger(PolicyUpdater.class);
/**
* Updates data handling preferences in the database to match against the policy.
* @param dhprefs - the preferences to be updated and persisted
* @param policy - the policy to match against
*/
public static void updatePreferences(DataHandlingPreferencesType dhprefs,
DataHandlingPolicyType policy) {
AuthorizationsSetType auth = null;
LOGGER.info("updating Preferences");
try {
// because we don't know in advance which attributes have to be changed or added,
// we simply create a new authorizationsSet and remove the old one
auth = polDao.cloneAuthorizationSet(dhprefs.getAuthorizationsSet());
} catch (SyntaxException e) {
LOGGER.error("Failed cloning the authorizationSet", e);
} catch (WritingException e) {
LOGGER.error("Failed cloning the authorizationSet", e);
} catch (JAXBException e) {
LOGGER.error("Failed cloning the authorizationSet", e);
}
//deleting the old authorizationsSet would be nice, but does not work
// authDao.deleteObject(dhprefs.getAuthorizationsSet());
AuthorizationsSetType newAuthSet = mergeAuthorizations(auth, policy.getAuthorizationsSet());
// persist the updated authorizationsSet
if (newAuthSet != null) {
authDao.persistObject(newAuthSet);
}
// set the updated authorizationsSet
dhprefs.setAuthorizationsSet(newAuthSet);
dao.updateObject(dhprefs);
// create an updated obligationsSet, call the ome
// ObligationsSet obl = policy.getObligationsSet();
// oblDao.deleteObject(policy.getObligationsSet());
// ObligationsSet newObligations = mergeObligations(obl, policy.getObligationsSet());
// oblDao.persistObject(newObligations);
// dhprefs.setObligationsSet(newObligations);
// dao.updateObject(dhprefs);
}
// private static ObligationsSet mergeObligations(ObligationsSet prefs,
// ObligationsSet policy) {
// OMEService service = new OMEService();
// IOMEService ome = service.getBasicHttpBindingIOMEService();
//
// try {
// return ome.getMatchingPreference(prefs, policy);
// } catch (IOMEServiceGetMatchingPreferencePPLDeserializationExceptionFaultFaultMessage e) {
// LOGGER.error("Failed to call OME", e);
// e.printStackTrace();
// } catch (IOMEServiceGetMatchingPreferencePPLStickyPolicyExceptionFaultFaultMessage e) {
// LOGGER.error("Failed to call OME", e);
// e.printStackTrace();
// }
// return null;
// }
/**
* Matches an {@link AuthorizationsSet} policy against {@link AuthorizationsSet} preferences.
* @param authorizationsPolicy
* the DataHandlingPolicy of the ACP
* @param authorizationsPreferences
* the DataHandlingPreference of the DS preferences of one PII
* @return
* {@link AuthorizationsSet} sticky policy
*/
public static AuthorizationsSetType mergeAuthorizations(AuthorizationsSetType authorizationsPreferences,
AuthorizationsSetType authorizationsPolicy) {
HandyAuthorizationsSet policy = new HandyAuthorizationsSet(authorizationsPolicy);
HandyAuthorizationsSet pref = new HandyAuthorizationsSet(authorizationsPreferences);
if (policy.isEmpty()) {
//nothing is allowed in the policy, every preference will match
//so we don't change the preferences
LOGGER.info("the policy is empty, we don't have to update the preferences.");
return authorizationsPreferences;
}
LOGGER.info("comparing authorization elements of policy with preferences.");
// update authorization elements
AuthorizationsSetType finalAuth = ofPrimelife.createAuthorizationsSetType();
// updated the auth for downstream usage explicitly
JAXBElement<? extends AuthorizationType> dsu = policy.getAuthzForDownstreamUsage().createUpdatedPreference(pref.getAuthzForDownstreamUsage());
// update the auth for purpose explicitly
JAXBElement<? extends AuthorizationType> purp = policy.getAuthzForPurpose().createUpdatedPreference(pref.getAuthzForPurpose());
finalAuth.getAuthorization().add(dsu);
finalAuth.getAuthorization().add(purp);
return finalAuth;
}
}
| [
"francesco.di.cerbo@sap.com"
] | francesco.di.cerbo@sap.com |
43594f86abb5178e9cd5c40e335b4193bc1d1d61 | 9e34ce3da5cfc18f994526168700c51542216161 | /src/test/java/io/gaguru/github/IssueTestWithSteps.java | e98c384308711dab963e87c242c33ca4c7636a99 | [] | no_license | igor-QA/Allure_gaguru_project | d0178906717e75e16ace1f6d0da9414442a0b9cc | 29d159bf7e4860a3703f02c0d3305880a9096ffb | refs/heads/main | 2023-01-15T11:04:01.379068 | 2020-11-28T13:50:44 | 2020-11-28T13:50:44 | 315,062,075 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,921 | java | package io.gaguru.github;
import com.codeborne.selenide.Configuration;
import com.codeborne.selenide.logevents.SelenideLogger;
import io.gaguru.github.steps.WebSteps;
import io.qameta.allure.Feature;
import io.qameta.allure.Owner;
import io.qameta.allure.Story;
import io.qameta.allure.selenide.AllureSelenide;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static io.gaguru.github.config.Config.config;
@Feature("Job with Issue")
@Story("Использование Steps")
@Owner("Pavlov Igor")
public class IssueTestWithSteps {
@BeforeAll
static void setup() {
Configuration.startMaximized = true;
}
private static final String REPOSITORY = config().getRepository();
private static final String USERNAME = config().getUserName();
private static final String PASSWORD = config().getPassword();
private static final String ISSUE_TITLE = "Новая Задача Issue";
private static final String BUG_LABEL = "bug";
private final WebSteps webSteps = new WebSteps();
@BeforeEach
public void initLogger() {
SelenideLogger.addListener("allure", new AllureSelenide()
.savePageSource(true)
.screenshots(true));
}
@Test
@DisplayName("User should be able to create the new Issue")
public void createNewIssueWithSteps() {
webSteps.openLoginForm();
webSteps.loginAs(USERNAME, PASSWORD);
webSteps.searchForRepository(REPOSITORY);
webSteps.openRepositoryByLink(REPOSITORY);
webSteps.openIssuesPage();
webSteps.clickNewIssueButton();
webSteps.selectAssignee();
webSteps.addLabelsToIssue(BUG_LABEL);
webSteps.setIssueTitle(ISSUE_TITLE);
webSteps.submitNewIssue();
webSteps.checkIssueCreation(ISSUE_TITLE);
}
}
| [
"igortvk@ya.ru"
] | igortvk@ya.ru |
2a7216018e1665fc27c362ec339c70edd31ea101 | c561eb31c07d34448a61f1bdceafc10f6ffc5968 | /src/main/java/com/lg/leetcode/other/practice1/BalancedBinaryTree.java | 47bf52b97bba00759e348598b484bff774a62371 | [] | no_license | x55555lg/data-structure-and-algorithm | 4d9ab12b3f23b401f2a89f1fe0226dc8702dfe66 | 025c0c7b85af11549491319e38cace2a4fbf926b | refs/heads/master | 2022-07-06T11:30:38.343970 | 2021-11-28T12:32:27 | 2021-11-28T12:32:27 | 216,988,364 | 2 | 0 | null | 2022-06-17T02:37:12 | 2019-10-23T06:53:49 | Java | UTF-8 | Java | false | false | 1,280 | java | package com.lg.leetcode.other.practice1;
/**
* @author Xulg
* Description: leetcode_110
* Created in 2021-05-28 10:31
*/
class BalancedBinaryTree {
/*
* Given a binary tree, determine if it is height-balanced.
* For this problem, a height-balanced binary tree is defined as:
* a binary tree in which the left and right subtrees of every node
* differ in height by no more than 1.
*
* Example 1:
* Input: root = [3,9,20,null,null,15,7]
* Output: true
*
* Example 2:
* Input: root = [1,2,2,3,3,null,null,4,4]
* Output: false
*
* Example 3:
* Input: root = []
* Output: true
*
* Constraints:
* The number of nodes in the tree is in the range [0, 5000].
* -104 <= Node.val <= 104
*------------------------------------------------------------
* 判断是否是一个平衡二叉树
*/
public static boolean isBalanced(TreeNode root) {
return false;
}
private static class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int val) {
this.val = val;
}
@Override
public String toString() {
return "TreeNode{" + "val=" + val + '}';
}
}
}
| [
"15268848628@163.com"
] | 15268848628@163.com |
80974eb95eff3d98f826de262cdc440daca77d22 | e44759c6e645b4d024e652ab050e7ed7df74eba3 | /src/org/ace/insurance/medical/process/persistence/ProcessDAO.java | 5e834e7c660ea58ede762be791111835f8846950 | [] | no_license | LifeTeam-TAT/MI-Core | 5f779870b1328c23b192668308ee25c532ab6280 | 8c5c4466da13c7a8bc61df12a804f840417e2513 | refs/heads/master | 2023-04-04T13:36:11.616392 | 2021-04-02T14:43:34 | 2021-04-02T14:43:34 | 354,033,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,244 | java | package org.ace.insurance.medical.process.persistence;
import java.util.List;
import javax.persistence.PersistenceException;
import javax.persistence.Query;
import org.ace.insurance.common.TableName;
import org.ace.insurance.medical.process.Process;
import org.ace.insurance.medical.process.persistence.interfaces.IProcessDAO;
import org.ace.java.component.persistence.BasicDAO;
import org.ace.java.component.persistence.exception.DAOException;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/***************************************************************************************
* @author HS
* @Date 2013-02-11
* @Version 1.0
* @Purpose This class serves as the DAO to manipulate the <code>Process</code>
* object.
*
***************************************************************************************/
@Repository("ProcessDAO")
public class ProcessDAO extends BasicDAO implements IProcessDAO {
/**
* @see org.ace.insurance.medical.process.persistence.interfaces.IProcessDAO
* #insert(org.ace.insurance.medical.process.Process)
*/
@Transactional(propagation = Propagation.REQUIRED)
public void insert(Process process) throws DAOException {
try {
em.persist(process);
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to insert Process", pe);
}
}
/**
* @see org.ace.insurance.medical.process.persistence.interfaces.IProcessDAO
* #update(org.ace.insurance.medical.process.Process)
*/
@Transactional(propagation = Propagation.REQUIRED)
public void update(Process process) throws DAOException {
try {
em.merge(process);
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to update Process", pe);
}
}
/**
* @see org.ace.insurance.medical.process.persistence.interfaces.IProcessDAO
* #delete(org.ace.insurance.medical.process.Process)
*/
@Transactional(propagation = Propagation.REQUIRED)
public void delete(Process process) throws DAOException {
try {
process = em.merge(process);
em.remove(process);
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to update Process", pe);
}
}
/**
* @see org.ace.insurance.medical.process.persistence.interfaces.IProcessDAO
* #findAll()
*/
@Transactional(propagation = Propagation.REQUIRED)
public List<Process> findAll() throws DAOException {
List<Process> result = null;
try {
Query q = em.createNamedQuery("Process.findAll");
Query qq = em.createNamedQuery("Process.findByName");
result = q.getResultList();
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to find all of Process", pe);
}
return result;
}
@Transactional(propagation = Propagation.REQUIRED)
public String findByName(String name) throws DAOException {
String result = "";
try {
Query qq = em.createNamedQuery("Process.findByName");
qq.setParameter("processName", name);
result = (String) qq.getSingleResult();
em.flush();
} catch (PersistenceException pe) {
throw translate("Failed to find all of Process", pe);
}
return result;
}
}
| [
"lifeteam.tat@gmail.com"
] | lifeteam.tat@gmail.com |
0cef3aa1fedcf20de7368c0e8a392fb22ee0acb4 | 34742e70c5f7c6e58bbf69c0ae96cec5a685d62d | /app/src/main/java/me/pwcong/tankattack/App.java | 1e40e7e24fed53fd8f9cd85b82a00af85924d879 | [] | no_license | pwcong/TankAttack | 698da8f64da90545ff13d35c28da22ee38c5a4e7 | 356ce543bdb21693ef7592c318ceb7a948cd3ca2 | refs/heads/master | 2020-06-14T09:41:39.212270 | 2016-12-25T07:44:13 | 2016-12-25T07:44:13 | 75,202,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package me.pwcong.tankattack;
import android.app.Application;
/**
* Created by Pwcong on 2016/11/30.
*/
public class App extends Application {
private static App instance;
@Override
public void onCreate() {
super.onCreate();
instance = this;
}
public static App getInstance() {
return instance;
}
}
| [
"pwcong@foxmail.com"
] | pwcong@foxmail.com |
139c3987852d132dbf288fbcfb4c4cf214d21f59 | e524dca676f885501ed5ef70cda35e915f423430 | /AndroidApp/app/src/main/java/com/example/android/hackeam/adapter/AnganPatientAdapter.java | e875245d4da6ce31c1789f1c3d873ab374fa9fff | [] | no_license | Anjalizi/Safe9-old | 6fde5c49c24a27992bb6b136f4c2193a65c57001 | 4b70257307788e3ecb94980f5a8bf245ddbd9710 | refs/heads/master | 2021-09-10T04:18:27.686686 | 2018-03-21T00:29:50 | 2018-03-21T00:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,687 | java | package com.example.android.hackeam.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.android.hackeam.R;
import com.example.android.hackeam.model.AnganPatient;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Adapter to populate patient data for Anganwadi workers obtained from server
*/
public class AnganPatientAdapter extends RecyclerView.Adapter<AnganPatientAdapter.ViewHolder> {
private List<AnganPatient> mAnganPatientList;
private Context mContext;
private AnganPatientAdapter.UserOnClickHandler mClickHandler;
public AnganPatientAdapter(Context context, List<AnganPatient> patients, AnganPatientAdapter.UserOnClickHandler handler) {
this.mContext = context;
this.mAnganPatientList = patients;
this.mClickHandler = handler;
}
@Override
public AnganPatientAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View createdView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.anganwadi_list_item,null);
return new AnganPatientAdapter.ViewHolder(createdView);
}
@Override
public void onBindViewHolder(AnganPatientAdapter.ViewHolder viewHolder, int position) {
AnganPatient patient = mAnganPatientList.get(position);
viewHolder.mNameTextView.setText(patient.getmName());
viewHolder.mWeeksTextView.setText(String.valueOf(patient.getmWeeks())+ " weeks");
}
@Override
public int getItemCount() {
return mAnganPatientList == null ? 0 : mAnganPatientList.size();
}
public interface UserOnClickHandler {
void onClick(AnganPatient selectedAPatient);
}
public class ViewHolder extends RecyclerView.ViewHolder implements
View.OnClickListener {
@BindView(R.id.tv_anganwadi_patient_name)
TextView mNameTextView;
@BindView(R.id.tv_anganwadi_patient_weeks)
TextView mWeeksTextView;
public ViewHolder(View itemLayoutView) {
super(itemLayoutView);
ButterKnife.bind(this, itemLayoutView);
itemLayoutView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
int adapterPosition = getAdapterPosition();
AnganPatient patient = mAnganPatientList.get(adapterPosition);
mClickHandler.onClick(patient);
}
}
public List<AnganPatient> getPatientList() {
return mAnganPatientList;
}
} | [
"aj2966@gmail.com"
] | aj2966@gmail.com |
7799c82f36f5ed0060f4e1ef30a4dbbda4915b37 | e466db77bdda8fff73629bf3c36bf4e8531d8884 | /BD/fig/AutoSuggestor.java | f8551ca6c6d78b22ffa3ac56ca0f91f9aed8d749 | [] | no_license | lucasvillard/followyourgenes | 92a0d588e59484782cd1f5dc6a20981d22375c5a | da13a1b76dcdb184acc4d5b6296cfbd56f0557f3 | refs/heads/master | 2020-04-17T09:23:45.361998 | 2019-01-18T18:44:20 | 2019-01-18T18:44:20 | 166,455,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,492 | java | package fig;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import javax.swing.AbstractAction;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JWindow;
import javax.swing.KeyStroke;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
public class AutoSuggestor {
private final JTextField textField;
private final Window container;
private JPanel suggestionsPanel;
private JWindow autoSuggestionPopUpWindow;
private String typedWord;
private final ArrayList<String> dictionary = new ArrayList<>();
private int currentIndexOfSpace, tW, tH;
private DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent de) {
checkForAndShowSuggestions();
}
@Override
public void removeUpdate(DocumentEvent de) {
checkForAndShowSuggestions();
}
@Override
public void changedUpdate(DocumentEvent de) {
checkForAndShowSuggestions();
}
};
private final Color suggestionsTextColor;
private final Color suggestionFocusedColor;
public AutoSuggestor(JTextField textField, Window mainWindow, ArrayList<String> words, Color popUpBackground, Color textColor, Color suggestionFocusedColor, float opacity) {
this.textField = textField;
this.suggestionsTextColor = textColor;
this.container = mainWindow;
this.suggestionFocusedColor = suggestionFocusedColor;
this.textField.getDocument().addDocumentListener(documentListener);
setDictionary(words);
typedWord = "";
currentIndexOfSpace = 0;
tW = 0;
tH = 0;
autoSuggestionPopUpWindow = new JWindow(mainWindow);
autoSuggestionPopUpWindow.setOpacity(opacity);
suggestionsPanel = new JPanel();
suggestionsPanel.setLayout(new GridLayout(0, 1));
suggestionsPanel.setBackground(popUpBackground);
addKeyBindingToRequestFocusInPopUpWindow();
}
private void addKeyBindingToRequestFocusInPopUpWindow() {
textField.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0, true), "Down released");
textField.getActionMap().put("Down released", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent ae) {//focuses the first label on popwindow
for (int i = 0; i < suggestionsPanel.getComponentCount(); i++) {
if (suggestionsPanel.getComponent(i) instanceof SuggestionLabel) {
((SuggestionLabel) suggestionsPanel.getComponent(i)).setFocused(true);
autoSuggestionPopUpWindow.toFront();
autoSuggestionPopUpWindow.requestFocusInWindow();
suggestionsPanel.requestFocusInWindow();
suggestionsPanel.getComponent(i).requestFocusInWindow();
break;
}
}
}
});
suggestionsPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0, true), "Down released");
suggestionsPanel.getActionMap().put("Down released", new AbstractAction() {
int lastFocusableIndex = 0;
@Override
public void actionPerformed(ActionEvent ae) {//allows scrolling of labels in pop window (I know very hacky for now :))
ArrayList<SuggestionLabel> sls = getAddedSuggestionLabels();
int max = sls.size();
if (max > 1) {//more than 1 suggestion
for (int i = 0; i < max; i++) {
SuggestionLabel sl = sls.get(i);
if (sl.isFocused()) {
if (lastFocusableIndex == max - 1) {
lastFocusableIndex = 0;
sl.setFocused(false);
autoSuggestionPopUpWindow.setVisible(false);
setFocusToTextField();
checkForAndShowSuggestions();//fire method as if document listener change occured and fired it
} else {
sl.setFocused(false);
lastFocusableIndex = i;
}
} else if (lastFocusableIndex <= i) {
if (i < max) {
sl.setFocused(true);
autoSuggestionPopUpWindow.toFront();
autoSuggestionPopUpWindow.requestFocusInWindow();
suggestionsPanel.requestFocusInWindow();
suggestionsPanel.getComponent(i).requestFocusInWindow();
lastFocusableIndex = i;
break;
}
}
}
} else {//only a single suggestion was given
autoSuggestionPopUpWindow.setVisible(false);
setFocusToTextField();
checkForAndShowSuggestions();//fire method as if document listener change occured and fired it
}
}
});
}
private void setFocusToTextField() {
container.toFront();
container.requestFocusInWindow();
textField.requestFocusInWindow();
}
public ArrayList<SuggestionLabel> getAddedSuggestionLabels() {
ArrayList<SuggestionLabel> sls = new ArrayList<>();
for (int i = 0; i < suggestionsPanel.getComponentCount(); i++) {
if (suggestionsPanel.getComponent(i) instanceof SuggestionLabel) {
SuggestionLabel sl = (SuggestionLabel) suggestionsPanel.getComponent(i);
sls.add(sl);
}
}
return sls;
}
private void checkForAndShowSuggestions() {
typedWord = getCurrentlyTypedWord();
suggestionsPanel.removeAll();//remove previos words/jlabels that were added
//used to calcualte size of JWindow as new Jlabels are added
tW = 0;
tH = 0;
boolean added = wordTyped(typedWord);
if (!added) {
if (autoSuggestionPopUpWindow.isVisible()) {
autoSuggestionPopUpWindow.setVisible(false);
}
} else {
showPopUpWindow();
setFocusToTextField();
}
}
protected void addWordToSuggestions(String word) {
SuggestionLabel suggestionLabel = new SuggestionLabel(word, suggestionFocusedColor, suggestionsTextColor, this);
calculatePopUpWindowSize(suggestionLabel);
suggestionsPanel.add(suggestionLabel);
}
public String getCurrentlyTypedWord() {//get newest word after last white spaceif any or the first word if no white spaces
String text = textField.getText();
String wordBeingTyped = "";
if (text.contains(" ")) {
int tmp = text.lastIndexOf(" ");
if (tmp >= currentIndexOfSpace) {
currentIndexOfSpace = tmp;
wordBeingTyped = text.substring(text.lastIndexOf(" "));
}
} else {
wordBeingTyped = text;
}
return wordBeingTyped.trim();
}
private void calculatePopUpWindowSize(JLabel label) {
//so we can size the JWindow correctly
if (tW < label.getPreferredSize().width) {
tW = label.getPreferredSize().width;
}
tH += label.getPreferredSize().height;
}
private void showPopUpWindow() {
autoSuggestionPopUpWindow.getContentPane().add(suggestionsPanel);
autoSuggestionPopUpWindow.setMinimumSize(new Dimension(textField.getWidth(), 30));
autoSuggestionPopUpWindow.setSize(tW, tH);
autoSuggestionPopUpWindow.setVisible(true);
int windowX = 0;
int windowY = 0;
windowX = container.getX() + textField.getX() + 5;
if (suggestionsPanel.getHeight() > autoSuggestionPopUpWindow.getMinimumSize().height) {
windowY = container.getY() + textField.getY() + textField.getHeight() + autoSuggestionPopUpWindow.getMinimumSize().height;
} else {
windowY = container.getY() + textField.getY() + textField.getHeight() + autoSuggestionPopUpWindow.getHeight();
}
autoSuggestionPopUpWindow.setLocation(windowX, windowY);
autoSuggestionPopUpWindow.setMinimumSize(new Dimension(textField.getWidth(), 30));
autoSuggestionPopUpWindow.revalidate();
autoSuggestionPopUpWindow.repaint();
}
public void setDictionary(ArrayList<String> words) {
dictionary.clear();
if (words == null) {
return;//so we can call constructor with null value for dictionary without exception thrown
}
for (String word : words) {
dictionary.add(word);
}
}
public JWindow getAutoSuggestionPopUpWindow() {
return autoSuggestionPopUpWindow;
}
public Window getContainer() {
return container;
}
public JTextField getTextField() {
return textField;
}
public void addToDictionary(String word) {
dictionary.add(word);
}
boolean wordTyped(String typedWord) {
if (typedWord.isEmpty()) {
return false;
}
//System.out.println("Typed word: " + typedWord);
boolean suggestionAdded = false;
for (String word : dictionary) {//get words in the dictionary which we added
boolean fullymatches = true;
for (int i = 0; i < typedWord.length(); i++) {//each string in the word
if (!typedWord.toLowerCase().startsWith(String.valueOf(word.toLowerCase().charAt(i)), i)) {//check for match
fullymatches = false;
break;
}
}
if (fullymatches) {
addWordToSuggestions(word);
suggestionAdded = true;
}
}
return suggestionAdded;
}
}
| [
"lucasvillard@hotmail.fr"
] | lucasvillard@hotmail.fr |
008647d2cf54a17136ed82d86e268ea57916c4fa | a5aebe2ca30c7b7a414e3086fa88b811f2fcb322 | /app/src/test/java/com/example/gabrielbur/assesment_formulario/ExampleUnitTest.java | e15fe4c9ce5e007e66459eab4c3833a91edbc918 | [] | no_license | Gabriel-Bur/Assesment-Formulario | ca7ddfbcc9965b9e0bc7e93368e18b760e1fe5b8 | 687a090a73080607b2ce8ed33aa1fdf8f8850849 | refs/heads/master | 2021-05-06T15:25:59.572145 | 2017-12-08T13:00:12 | 2017-12-08T13:00:12 | 113,574,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.example.gabrielbur.assesment_formulario;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"bielbur@gmail.com"
] | bielbur@gmail.com |
161e36f4802aad950bfb7269739f9f2b0c57ed87 | c948409357ae4f9183727820efc5ae1b16112182 | /src/main/java/learn/java/Patterns/behavioral/strategy/PayByCreditCard.java | 4d6f6bc0572a1f723a02f1f14aed8feb6553b829 | [] | no_license | dimon1165/Java_Fundamentals | d020b5909aeb426567f61b9abed137e5e8c17c6c | c130833da2c2c436bc6716ce84e713383df40607 | refs/heads/master | 2021-06-22T00:41:39.334652 | 2017-08-21T18:03:23 | 2017-08-21T18:03:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,641 | java | package learn.java.Patterns.behavioral.strategy;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Created by dvorop on 15.08.2017.
*/
public class PayByCreditCard implements PayStrategy {
private final BufferedReader READER = new BufferedReader(new InputStreamReader(System.in));
private CreditCard card;
/**
* Собираем данные карты клиента.
*/
@Override
public void collectPaymentDetails() {
try {
System.out.print("Enter card number: ");
String number = READER.readLine();
System.out.print("Enter date 'mm/yy': ");
String date = READER.readLine();
System.out.print("Enter cvv code: ");
String cvv = READER.readLine();
card = new CreditCard(number, date, cvv);
// Валидируем номер карты.
} catch (IOException ex) {
ex.printStackTrace();
}
}
/**
* После проверки карты мы можем совершить оплату. Если клиент продолжает
* покупки, мы не запрашиваем карту заново.
*/
@Override
public boolean pay(int paymentAmount) {
if (cardIsPresent()) {
System.out.println("Paying " + paymentAmount + " using Credit Card");
card.setAmount(card.getAmount() - paymentAmount);
return true;
} else {
return false;
}
}
private boolean cardIsPresent() {
return card != null;
}
}
| [
"dimon1165@gmail.com"
] | dimon1165@gmail.com |
c9efca30ce2a067649d8df648fe247709033690b | 47352bd211a27f2c23ee01f49d81ce1080a8d261 | /src/com/etrade/framework/core/sys/service/SystemSechduleService.java | 4cf4860f69562eb12198f3e9223db74be8eed077 | [] | no_license | ancin/NetTrade | bcd7064204c0f52d26163f2871b9312dcc757a04 | e8075a6da50f794ba4f6f9c592426a62aa9cf2ce | refs/heads/master | 2021-04-09T10:15:03.825278 | 2018-03-16T00:59:03 | 2018-03-16T00:59:03 | 125,444,242 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,072 | java | package com.etrade.framework.core.sys.service;
import java.util.List;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.etrade.framework.core.sys.entity.PubPost;
@Component
public class SystemSechduleService {
private final Logger logger = LoggerFactory.getLogger(SystemSechduleService.class);
@Autowired
private PubPostService pubPostService;
public void pubPostCacheRefreshTimely() {
logger.debug("Timely check and refresh PubPost spring cache...");
List<PubPost> items = pubPostService.findPublished();
for (PubPost pubPost : items) {
if (new DateTime(pubPost.getPublishTime()).isAfterNow()) {
pubPostService.evictCache();
return;
}
if (new DateTime(pubPost.getExpireTime()).isBeforeNow()) {
pubPostService.evictCache();
return;
}
}
}
}
| [
"songkejun@mobanker.com"
] | songkejun@mobanker.com |
1ef1b65fbaa08327cbe4df93097339e97fb66572 | 66b8e0f1762b6c084246d4840ae4cd14c2285968 | /src/com/test/ws/entities/AttendanceId.java | e88c720ee4dec91767dea878f6fa8bab4a3b33e1 | [] | no_license | Ankitdet/YRest | 146febbee391b1b1e72d1685df3dcd611b983597 | 1bb2319899a7d50e735720d16a321b513a551c44 | refs/heads/master | 2018-10-05T08:44:00.539197 | 2018-06-11T17:55:48 | 2018-06-11T17:55:48 | 116,979,345 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,140 | java | package com.test.ws.entities;
// Generated Jan 1, 2018 2:31:13 PM by Hibernate Tools 4.0.0
import javax.persistence.Column;
import javax.persistence.Embeddable;
/**
* AttendanceId generated by hbm2java
*/
@Embeddable
public class AttendanceId implements java.io.Serializable {
private int attendanceId;
private int userId;
private int sabhaId;
private int isAttended;
public AttendanceId() {
}
public AttendanceId(int attendanceId, int userId, int sabhaId,
int isAttended) {
this.attendanceId = attendanceId;
this.userId = userId;
this.sabhaId = sabhaId;
this.isAttended = isAttended;
}
@Column(name = "attendance_id", nullable = false)
public int getAttendanceId() {
return this.attendanceId;
}
public void setAttendanceId(int attendanceId) {
this.attendanceId = attendanceId;
}
@Column(name = "user_id", nullable = false)
public int getUserId() {
return this.userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
@Column(name = "sabha_id", nullable = false)
public int getSabhaId() {
return this.sabhaId;
}
public void setSabhaId(int sabhaId) {
this.sabhaId = sabhaId;
}
@Column(name = "is_attended", nullable = false)
public int getIsAttended() {
return this.isAttended;
}
public void setIsAttended(int isAttended) {
this.isAttended = isAttended;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof AttendanceId))
return false;
AttendanceId castOther = (AttendanceId) other;
return (this.getAttendanceId() == castOther.getAttendanceId())
&& (this.getUserId() == castOther.getUserId())
&& (this.getSabhaId() == castOther.getSabhaId())
&& (this.getIsAttended() == castOther.getIsAttended());
}
public int hashCode() {
int result = 17;
result = 37 * result + this.getAttendanceId();
result = 37 * result + this.getUserId();
result = 37 * result + this.getSabhaId();
result = 37 * result + this.getIsAttended();
return result;
}
}
| [
"ankitdetroja@gmail.com"
] | ankitdetroja@gmail.com |
98c450d8b2fdfc44d59a00955e793e219389e51e | 70c64b5d230c3f9425e965882fc0f5457abd7aee | /src/main/java/com/lc/test/thread/providerconsumer/evolution/LockProviderConsumer.java | 583d8af324d5462066011d0b8bdc293d71474ce8 | [] | no_license | wlccomeon/base_test | c468e2ce8bf9eae3eac18313e5f058a02c77eb01 | b385302b6d59940a259c20a657e3a018a5ba481f | refs/heads/master | 2022-12-09T13:45:43.259759 | 2022-04-13T14:19:49 | 2022-04-13T14:19:49 | 185,627,171 | 0 | 0 | null | 2022-11-16T00:45:14 | 2019-05-08T14:54:41 | Java | UTF-8 | Java | false | false | 2,478 | java | package com.lc.test.thread.providerconsumer.evolution;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* @Description: 生产者与消费者,使用不同方式进行演进
* 1.synchronized+notify+wait
* 2.lock+await+signal
* 3.blockingqueue
* 本类中采用第二版
* //口诀:
* //1.线程 操作 资源类
* //2.判断 干活 通知
* //3.防止虚假唤醒
* @author wlc
* @date: 2019/6/21 0021 0:19
**/
public class LockProviderConsumer {
public static void main(String[] args) {
ShareResourceForLock shareResourceForLock = new ShareResourceForLock();
//消费线程
for (int i=1; i<= 2; i++){
new Thread(()->{
shareResourceForLock.decrement();
},"consumer"+String.valueOf(i)).start();
}
//生产线程
for (int i=1; i<= 2; i++){
new Thread(()->{
shareResourceForLock.increment();
},"provider"+String.valueOf(i)).start();
}
//result:
//consumer1 is waiting for provider...
//consumer2 is waiting for provider...
//provider1 1
//provider2 is waiting for consumer...
//consumer1 0
//consumer2 is waiting for provider...
//provider2 1
//consumer2 0
}
}
/**
* 资源类
*/
class ShareResourceForLock{
/**操作资源*/
private int num = 0;
/**使用可重入锁*/
private Lock lock = new ReentrantLock();
/**设置条件*/
private Condition condition = lock.newCondition();
/**
* 生产方法
*/
public void increment(){
lock.lock();
try {
//判断,num不为0,则需要等待消费者。
while (num!=0){
System.out.println(Thread.currentThread().getName()+" is waiting for consumer...");
condition.await();
}
//干活
num++;
System.out.println(Thread.currentThread().getName()+"\t"+num);
//通知,随意一个消费者
condition.signalAll();
}catch (Exception e){
e.printStackTrace();
}finally {
lock.unlock();
}
}
/**
* 消费方法
*/
public void decrement(){
lock.lock();
try {
//判断,num为0,则需要等待生产
while (num==0){
System.out.println(Thread.currentThread().getName()+" is waiting for provider...");
condition.await();
}
//干活
num--;
System.out.println(Thread.currentThread().getName()+"\t"+num);
//通知
condition.signalAll();
}catch (Exception e){
e.printStackTrace();
}finally {
lock.unlock();
}
}
} | [
"wlccomeon@163.com"
] | wlccomeon@163.com |
d52d539d4b488ac8b3ee5e482745a25cb8b074ca | 0a0acea114c7560013dbe7040d4554c44d9405f9 | /src/main/java/net/vergessxner/gungame/command/StatsCommand.java | 9461b3d2f225eb7b6b69a6f7ba6bf7a197a0a631 | [] | no_license | JxstJonas/GunGame | 1c45bae8d9fcb4e4c8db5a4f17865a6125369600 | f00b65746aa864c1901d76a43a352c0fec5a90ee | refs/heads/master | 2023-03-31T10:53:36.559056 | 2021-04-09T16:59:50 | 2021-04-09T16:59:50 | 320,403,865 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,416 | java | package net.vergessxner.gungame.command;
import net.vergessxner.gungame.GunGame;
import net.vergessxner.gungame.utils.GunGamePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
* @author Jonas
* Created: 11.12.2020
* Class: StatsCommand
*/
public class StatsCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) return false;
Player player = (Player) sender;
if(args.length == 0) {
GunGamePlayer gunGamePlayer = GunGame.getINSTANCE().getDataBase().getStatsProvider().getPlayer(player.getUniqueId());
player.sendMessage(GunGame.PREFIX + "§7Deine Stats:");
player.sendMessage(GunGame.PREFIX + "");
player.sendMessage(GunGame.PREFIX + "Kills: " + gunGamePlayer.getKills());
player.sendMessage(GunGame.PREFIX + "Deaths: " + gunGamePlayer.getDeaths());
player.sendMessage(GunGame.PREFIX + "K/D: " + gunGamePlayer.getKD());
player.sendMessage(GunGame.PREFIX + "Max-Level: " + gunGamePlayer.getMaxLevel());
player.sendMessage(GunGame.PREFIX + "");
}else player.sendMessage(GunGame.PREFIX + "Verwende: §cA/stats");
return false;
}
}
| [
"vergessxner@gmail.com"
] | vergessxner@gmail.com |
67950c44e06a10f2e7a150ebebe21f15bcd99a17 | bf2966abae57885c29e70852243a22abc8ba8eb0 | /aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/transform/APNSVoipSandboxChannelResponseJsonUnmarshaller.java | 23a74f11bf15538054e6dac715220877b56109a3 | [
"Apache-2.0"
] | permissive | kmbotts/aws-sdk-java | ae20b3244131d52b9687eb026b9c620da8b49935 | 388f6427e00fb1c2f211abda5bad3a75d29eef62 | refs/heads/master | 2021-12-23T14:39:26.369661 | 2021-07-26T20:09:07 | 2021-07-26T20:09:07 | 246,296,939 | 0 | 0 | Apache-2.0 | 2020-03-10T12:37:34 | 2020-03-10T12:37:33 | null | UTF-8 | Java | false | false | 5,794 | java | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.pinpoint.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.pinpoint.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* APNSVoipSandboxChannelResponse JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class APNSVoipSandboxChannelResponseJsonUnmarshaller implements Unmarshaller<APNSVoipSandboxChannelResponse, JsonUnmarshallerContext> {
public APNSVoipSandboxChannelResponse unmarshall(JsonUnmarshallerContext context) throws Exception {
APNSVoipSandboxChannelResponse aPNSVoipSandboxChannelResponse = new APNSVoipSandboxChannelResponse();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("ApplicationId", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setApplicationId(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("CreationDate", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setCreationDate(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("DefaultAuthenticationMethod", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setDefaultAuthenticationMethod(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("Enabled", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setEnabled(context.getUnmarshaller(Boolean.class).unmarshall(context));
}
if (context.testExpression("HasCredential", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setHasCredential(context.getUnmarshaller(Boolean.class).unmarshall(context));
}
if (context.testExpression("HasTokenKey", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setHasTokenKey(context.getUnmarshaller(Boolean.class).unmarshall(context));
}
if (context.testExpression("Id", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setId(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("IsArchived", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setIsArchived(context.getUnmarshaller(Boolean.class).unmarshall(context));
}
if (context.testExpression("LastModifiedBy", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setLastModifiedBy(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("LastModifiedDate", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setLastModifiedDate(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("Platform", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setPlatform(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("Version", targetDepth)) {
context.nextToken();
aPNSVoipSandboxChannelResponse.setVersion(context.getUnmarshaller(Integer.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return aPNSVoipSandboxChannelResponse;
}
private static APNSVoipSandboxChannelResponseJsonUnmarshaller instance;
public static APNSVoipSandboxChannelResponseJsonUnmarshaller getInstance() {
if (instance == null)
instance = new APNSVoipSandboxChannelResponseJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
63b60d59428dd2af7faabc5a149f5d20110ab14a | e42afd54dcc0add3d2b8823ee98a18c50023a396 | /java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/MetadataStoreName.java | f720b87ef54ecb076edcdf368760213b745c6f35 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | degloba/google-cloud-java | eea41ebb64f4128583533bc1547e264e730750e2 | b1850f15cd562c659c6e8aaee1d1e65d4cd4147e | refs/heads/master | 2022-07-07T17:29:12.510736 | 2022-07-04T09:19:33 | 2022-07-04T09:19:33 | 180,201,746 | 0 | 0 | Apache-2.0 | 2022-07-04T09:17:23 | 2019-04-08T17:42:24 | Java | UTF-8 | Java | false | false | 6,531 | java | /*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.aiplatform.v1beta1;
import com.google.api.pathtemplate.PathTemplate;
import com.google.api.resourcenames.ResourceName;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
@Generated("by gapic-generator-java")
public class MetadataStoreName implements ResourceName {
private static final PathTemplate PROJECT_LOCATION_METADATA_STORE =
PathTemplate.createWithoutUrlEncoding(
"projects/{project}/locations/{location}/metadataStores/{metadata_store}");
private volatile Map<String, String> fieldValuesMap;
private final String project;
private final String location;
private final String metadataStore;
@Deprecated
protected MetadataStoreName() {
project = null;
location = null;
metadataStore = null;
}
private MetadataStoreName(Builder builder) {
project = Preconditions.checkNotNull(builder.getProject());
location = Preconditions.checkNotNull(builder.getLocation());
metadataStore = Preconditions.checkNotNull(builder.getMetadataStore());
}
public String getProject() {
return project;
}
public String getLocation() {
return location;
}
public String getMetadataStore() {
return metadataStore;
}
public static Builder newBuilder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder(this);
}
public static MetadataStoreName of(String project, String location, String metadataStore) {
return newBuilder()
.setProject(project)
.setLocation(location)
.setMetadataStore(metadataStore)
.build();
}
public static String format(String project, String location, String metadataStore) {
return newBuilder()
.setProject(project)
.setLocation(location)
.setMetadataStore(metadataStore)
.build()
.toString();
}
public static MetadataStoreName parse(String formattedString) {
if (formattedString.isEmpty()) {
return null;
}
Map<String, String> matchMap =
PROJECT_LOCATION_METADATA_STORE.validatedMatch(
formattedString, "MetadataStoreName.parse: formattedString not in valid format");
return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("metadata_store"));
}
public static List<MetadataStoreName> parseList(List<String> formattedStrings) {
List<MetadataStoreName> list = new ArrayList<>(formattedStrings.size());
for (String formattedString : formattedStrings) {
list.add(parse(formattedString));
}
return list;
}
public static List<String> toStringList(List<MetadataStoreName> values) {
List<String> list = new ArrayList<>(values.size());
for (MetadataStoreName value : values) {
if (value == null) {
list.add("");
} else {
list.add(value.toString());
}
}
return list;
}
public static boolean isParsableFrom(String formattedString) {
return PROJECT_LOCATION_METADATA_STORE.matches(formattedString);
}
@Override
public Map<String, String> getFieldValuesMap() {
if (fieldValuesMap == null) {
synchronized (this) {
if (fieldValuesMap == null) {
ImmutableMap.Builder<String, String> fieldMapBuilder = ImmutableMap.builder();
if (project != null) {
fieldMapBuilder.put("project", project);
}
if (location != null) {
fieldMapBuilder.put("location", location);
}
if (metadataStore != null) {
fieldMapBuilder.put("metadata_store", metadataStore);
}
fieldValuesMap = fieldMapBuilder.build();
}
}
}
return fieldValuesMap;
}
public String getFieldValue(String fieldName) {
return getFieldValuesMap().get(fieldName);
}
@Override
public String toString() {
return PROJECT_LOCATION_METADATA_STORE.instantiate(
"project", project, "location", location, "metadata_store", metadataStore);
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o != null || getClass() == o.getClass()) {
MetadataStoreName that = ((MetadataStoreName) o);
return Objects.equals(this.project, that.project)
&& Objects.equals(this.location, that.location)
&& Objects.equals(this.metadataStore, that.metadataStore);
}
return false;
}
@Override
public int hashCode() {
int h = 1;
h *= 1000003;
h ^= Objects.hashCode(project);
h *= 1000003;
h ^= Objects.hashCode(location);
h *= 1000003;
h ^= Objects.hashCode(metadataStore);
return h;
}
/** Builder for projects/{project}/locations/{location}/metadataStores/{metadata_store}. */
public static class Builder {
private String project;
private String location;
private String metadataStore;
protected Builder() {}
public String getProject() {
return project;
}
public String getLocation() {
return location;
}
public String getMetadataStore() {
return metadataStore;
}
public Builder setProject(String project) {
this.project = project;
return this;
}
public Builder setLocation(String location) {
this.location = location;
return this;
}
public Builder setMetadataStore(String metadataStore) {
this.metadataStore = metadataStore;
return this;
}
private Builder(MetadataStoreName metadataStoreName) {
this.project = metadataStoreName.project;
this.location = metadataStoreName.location;
this.metadataStore = metadataStoreName.metadataStore;
}
public MetadataStoreName build() {
return new MetadataStoreName(this);
}
}
}
| [
"neenushaji@google.com"
] | neenushaji@google.com |
b59675005fd93fef936de9716be2a3f8d308be12 | f39a6a02c32028313ac5ffbc6ad6cf3efff4fad9 | /src/de/fhflensburg/graveyardmanager/core/layers/entities/EntityGenerator.java | a02b56b0317fe28288871fe5fff7107a7b5191ad | [] | no_license | simso/Friedhofsmanager | e70e9492d69bcf102ff0396a81f940dee967c57e | 74d4404f1fd8bb8f0c1d66a6448b1fdcf6e8baa8 | refs/heads/master | 2020-05-27T16:53:03.415183 | 2013-03-10T01:25:34 | 2013-03-10T01:25:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,604 | java | package de.fhflensburg.graveyardmanager.core.layers.entities;
import de.fhflensburg.graveyardmanager.core.layers.entities.buildings.*;
import de.fhflensburg.graveyardmanager.states.InGameView;
/**
* Hodie mihi, Cras tibi - Der Friedhofsmanager
* Casual Game im Kurs Game Design an der FH Flensburg
*
* Created with IntelliJ IDEA.
* Author: Stefano Kowalke
* Date: 18.12.12
* Time: 18:17
*/
public class EntityGenerator
{
public static ActiveEntity createActiveEntityFromMap(InGameView engine, int type, float x, float y)
{
ActiveEntity activeEntity = createEntity(engine, type, -1);
activeEntity.setLocation(x, y);
return activeEntity;
}
public static ActiveEntity createEntity(InGameView engine, int type, int playerId)
{
if (EntityData.isBuilding(type))
{
switch (type)
{
case EntityData.BUILDING_CHAPEL:
return new Chapel(engine, playerId);
case EntityData.BUILDING_CHURCH:
return new Church(engine, playerId);
case EntityData.BUILDING_HOUSE:
return new House(engine, playerId);
default:
return null;
}
}
else if (EntityData.isTombstone(type))
{
switch (type)
{
case EntityData.TOMBSTONE_WATER:
return new TombstoneWater(engine, playerId);
case EntityData.TOMBSTONE_CROSS_WOODEN:
return new TombstoneWoodenCross(engine, playerId);
case EntityData.TOMBSTONE_GRANITE:
return new TombstoneGranite(engine, playerId);
case EntityData.TOMBSTONE_SANDSTONE:
return new TombstoneSandstone(engine, playerId);
default:
return null;
}
}
else
{
return null;
}
}
}
| [
"jai.white@gmx.de"
] | jai.white@gmx.de |
78e7cd810e26cd84263247f3e01d730b62816ab4 | 7fcd9a68e97f063ac0aa3ccdf247720d85685807 | /src/main/java/said/ahmad/javafx/tracker/datatype/ImageInfoHolder.java | 94c2800b6edfd2657fa07095e0871ff6a972e50c | [
"MIT"
] | permissive | Ahmad-Said/tracker-explorer | c3f1bb61b6a28372c25ce24a2b7499f57c9afde9 | 103edba46f9ef7854448efc42b0b44e5ef93b31a | refs/heads/master | 2023-07-25T21:12:20.178780 | 2023-02-05T16:16:51 | 2023-02-05T16:16:51 | 184,921,979 | 1 | 0 | MIT | 2023-06-14T22:55:29 | 2019-05-04T16:57:43 | Java | UTF-8 | Java | false | false | 278 | java | package said.ahmad.javafx.tracker.datatype;
import javafx.geometry.Dimension2D;
import javafx.scene.image.Image;
public class ImageInfoHolder {
public Image image;
public Dimension2D originalImageDimension;
public boolean isFullyLoaded;
public ImagePosition position;
}
| [
"47715383+Dark-Hunter752@users.noreply.github.com"
] | 47715383+Dark-Hunter752@users.noreply.github.com |
7feed1d2f5c3a20942a60af0e1a44f55a4ef8a06 | a9cbd6bdb43843f4905d668f42dda66dda8265ec | /nalu-plugin-gwt-processor/src/test/resources/com/github/nalukit/nalu/processor/application/applicationAnnotationOnClass/ApplicationAnnotationInterfaceOnAClass.java | 4896585e59f78db4cba3bcf07428157dc8fc2f5d | [
"Apache-2.0"
] | permissive | RaulPampliegaMayoral/nalu | 0b96954941b5ed904ad67797627fc2befd6e7523 | a717108fff4a0b787af2edc5166dfefd3faf8b20 | refs/heads/master | 2020-09-06T11:37:26.260269 | 2019-11-06T19:58:31 | 2019-11-06T19:58:31 | 188,907,687 | 0 | 0 | Apache-2.0 | 2019-11-08T07:29:01 | 2019-05-27T20:51:20 | Java | UTF-8 | Java | false | false | 1,164 | java | /*
* Copyright (c) 2018 - 2019 - Frank Hossfeld
*
* 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.github.nalukit.nalu.processor.application.applicationAnnotationOnClass;
import com.github.nalukit.nalu.client.application.IsApplication;
import com.github.nalukit.nalu.client.application.annotation.Application;
import com.github.nalukit.nalu.processor.common.MockContext;
import com.github.nalukit.nalu.processor.common.MockShell;
@Application(shell = MockShell.class,
startRoute = "/search",
context = MockContext.class)
public class ApplicationAnnotationInterfaceOnAClass
implements IsApplication {
}
| [
"frank.hossfeld@googlemail.com"
] | frank.hossfeld@googlemail.com |
595b80e499d93fa619bf96f9b0ec3363c940402c | d3e0717902c7fc04daa1fa30ea4b26cb17bcee11 | /consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java | 029898d37d28d6867a58130e203503e24d75952e | [] | no_license | vramik/gatein-wsrp | 293df2faa1496cc65bc91ae07aa36fdfc666a037 | fddcc3ec91f228d16484cff2aa5d0b5b0ffb960f | refs/heads/master | 2021-01-18T03:51:08.902159 | 2013-04-12T11:04:38 | 2013-04-12T11:04:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48,023 | java | /*
* JBoss, a division of Red Hat
* Copyright 2012, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.gatein.wsrp.consumer;
import org.gatein.common.NotYetImplemented;
import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.InvokerUnavailableException;
import org.gatein.pc.api.NoSuchPortletException;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.info.EventInfo;
import org.gatein.pc.api.info.TypeInfo;
import org.gatein.wsrp.SupportsLastModified;
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.consumer.portlet.WSRPPortlet;
import org.gatein.wsrp.consumer.portlet.info.WSRPEventInfo;
import org.gatein.wsrp.consumer.portlet.info.WSRPPortletInfo;
import org.gatein.wsrp.consumer.spi.ConsumerRegistrySPI;
import org.gatein.wsrp.servlet.UserAccess;
import org.gatein.wsrp.spec.v2.WSRP2Constants;
import org.oasis.wsrp.v2.CookieProtocol;
import org.oasis.wsrp.v2.EventDescription;
import org.oasis.wsrp.v2.ExportDescription;
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.ExtensionDescription;
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.ItemDescription;
import org.oasis.wsrp.v2.Lifetime;
import org.oasis.wsrp.v2.ModelDescription;
import org.oasis.wsrp.v2.ModelTypes;
import org.oasis.wsrp.v2.ModifyRegistrationRequired;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.PortletPropertyDescriptionResponse;
import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.RegistrationData;
import org.oasis.wsrp.v2.ResourceList;
import org.oasis.wsrp.v2.ServiceDescription;
import org.oasis.wsrp.v2.WSRPV2PortletManagementPortType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.namespace.QName;
import javax.xml.ws.Holder;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision: 12692 $
* @since 2.6
*/
public class ProducerInfo extends SupportsLastModified
{
private final static Logger log = LoggerFactory.getLogger(ProducerInfo.class);
private final static boolean debug = log.isDebugEnabled();
public static final Integer DEFAULT_CACHE_VALUE = 300;
// Persistent information
/** persistence key */
private String key;
/** Configuration of the remote WS endpoints */
private EndpointConfigurationInfo persistentEndpointInfo;
/** Registration information */
private RegistrationInfo persistentRegistrationInfo;
/** The Producer's identifier */
private String persistentId;
/** The cache expiration duration (in seconds) for cached values */
private Integer persistentExpirationCacheSeconds = DEFAULT_CACHE_VALUE;
/** The activated status of the associated Consumer */
private boolean persistentActive;
/**
* GTNWSRP-239: whether or not this ProducerInfo requires ModifyRegistration to be called, currently persisted via
* mixin
*/
private boolean isModifyRegistrationRequired;
// Transient information
/** The Cookie handling policy required by the Producer */
private transient CookieProtocol requiresInitCookie;
/** The Producer-Offered Portlets (handle -> WSRPPortlet) */
private transient Map<String, Portlet> popsMap;
/** A cache for Consumer-Configured Portlets (handle -> WSRPPortlet) */
private transient Map<String, Portlet> ccpsMap;
/** Portlet groups. */
private transient Map<String, Set<Portlet>> portletGroups;
/** Time at which the cache expires */
private transient long expirationTimeMillis;
private transient final ConsumerRegistrySPI registry;
private static final String ERASED_LOCAL_REGISTRATION_INFORMATION = "Erased local registration information!";
private transient RegistrationInfo expectedRegistrationInfo;
private transient Map<String, ItemDescription> customModes;
private transient Map<String, ItemDescription> customWindowStates;
/** Events */
private transient Map<QName, EventInfo> eventDescriptions;
/** Supported options */
private transient Set<String> supportedOptions = Collections.emptySet();
/*protected org.oasis.wsrp.v1.ItemDescription[] userCategoryDescriptions;
protected org.oasis.wsrp.v1.ItemDescription[] customUserProfileItemDescriptions;
protected java.lang.String[] locales;
protected org.oasis.wsrp.v1.ResourceList resourceList;*/
public ProducerInfo(ConsumerRegistrySPI consumerRegistry)
{
persistentEndpointInfo = new EndpointConfigurationInfo();
persistentRegistrationInfo = RegistrationInfo.createUndeterminedRegistration(this);
this.registry = consumerRegistry;
}
@Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
ProducerInfo that = (ProducerInfo)o;
if (key != null ? !key.equals(that.key) : that.key != null)
{
return false;
}
if (!getId().equals(that.getId()))
{
return false;
}
return true;
}
@Override
public int hashCode()
{
int result = key != null ? key.hashCode() : 0;
result = 31 * result + getId().hashCode();
return result;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append("ProducerInfo");
sb.append("{key='").append(key).append('\'');
sb.append(", id='").append(getId()).append('\'');
sb.append('}');
return sb.toString();
}
public ConsumerRegistrySPI getRegistry()
{
return registry;
}
public String getKey()
{
return key;
}
public void setKey(String key)
{
this.key = key;
}
public Set<String> getSupportedCustomModes()
{
if (customModes == null)
{
return Collections.emptySet();
}
return Collections.unmodifiableSet(customModes.keySet());
}
public Set<String> getSupportedCustomWindowStates()
{
if (customWindowStates == null)
{
return Collections.emptySet();
}
return Collections.unmodifiableSet(customWindowStates.keySet());
}
public EndpointConfigurationInfo getEndpointConfigurationInfo()
{
return persistentEndpointInfo;
}
public void setEndpointConfigurationInfo(EndpointConfigurationInfo endpointConfigurationInfo)
{
ParameterValidation.throwIllegalArgExceptionIfNull(endpointConfigurationInfo, "EndpointConfigurationInfo");
this.persistentEndpointInfo = endpointConfigurationInfo;
}
public RegistrationInfo getRegistrationInfo()
{
// update parent since it might not be set when unfrozen from persistence
persistentRegistrationInfo.setParent(this);
return persistentRegistrationInfo;
}
public void setRegistrationInfo(RegistrationInfo registrationInfo)
{
ParameterValidation.throwIllegalArgExceptionIfNull(registrationInfo, "RegistrationInfo");
this.persistentRegistrationInfo = registrationInfo;
}
public boolean isRegistered()
{
return persistentRegistrationInfo.isRegistered();
}
public boolean isRegistrationRequired()
{
return persistentRegistrationInfo.isRegistrationDeterminedRequired();
}
public boolean isRegistrationChecked()
{
return persistentRegistrationInfo.isRegistrationRequired() != null;
}
public boolean hasLocalRegistrationInfo()
{
return persistentRegistrationInfo.hasLocalInfo();
}
/**
* Determines whether the associated consumer is active.
*
* @return
*/
public boolean isActive()
{
return persistentActive/* && persistentEndpointInfo.isAvailable()*/;
}
/**
* Activates or de-activate this Consumer. Note that this shouldn't be called directly as ConsumersRegistry will
* handle activation.
*
* @param active
*/
public void setActive(boolean active)
{
setInternalActive(active);
}
private boolean setInternalActive(boolean active)
{
final boolean modified = modifyNowIfNeeded(persistentActive, active);
this.persistentActive = active;
return modified;
}
public String getId()
{
return persistentId;
}
public void setId(String id)
{
modifyNowIfNeeded(persistentId, id);
this.persistentId = id;
}
public void setActiveAndSave(boolean active)
{
if (setInternalActive(active))
{
registry.updateProducerInfo(this);
}
}
public boolean isModifyRegistrationRequired()
{
return isModifyRegistrationRequired || persistentRegistrationInfo.isModifyRegistrationNeeded();
}
// FIX-ME: remove when a better dirty management is in place at property level
public void setModifyRegistrationRequired(boolean modifyRegistrationRequired)
{
modifyNowIfNeeded(isModifyRegistrationRequired, modifyRegistrationRequired);
this.isModifyRegistrationRequired = modifyRegistrationRequired;
}
public CookieProtocol getRequiresInitCookie()
{
return requiresInitCookie;
}
public RegistrationInfo getExpectedRegistrationInfo()
{
return expectedRegistrationInfo;
}
/**
* Refreshes the producer's information from the service description if required.
*
* @param forceRefresh whether or not to force a refresh regardless of whether one would have been required based on
* cache expiration
* @return <code>true</code> if the producer's information was just refreshed, <code>false</code> otherwise
* @throws PortletInvokerException if registration was required but couldn't be achieved properly
*/
public boolean refresh(boolean forceRefresh) throws PortletInvokerException
{
return detailedRefresh(forceRefresh).didRefreshHappen();
}
public RefreshResult detailedRefresh(boolean forceRefresh) throws PortletInvokerException
{
RefreshResult result = internalRefresh(forceRefresh);
// if the refresh failed, return immediately
if (RefreshResult.Status.FAILURE.equals(result.getStatus()))
{
setActiveAndSave(false);
return result;
}
// update DB
if (result.didRefreshHappen())
{
// mark as inactive if the refresh had issues...
if (result.hasIssues())
{
setActive(false);
// record what the Producer's expectations are if we managed to get a service description
expectedRegistrationInfo = new RegistrationInfo(this.persistentRegistrationInfo);
expectedRegistrationInfo.refresh(result.getServiceDescription(), getId(), true, true, true);
}
else
{
// mark as active if it wasn't already
if (!isActive())
{
setActive(true);
}
// if we didn't have any issues, then the expected registration info is the one we have
expectedRegistrationInfo = persistentRegistrationInfo;
}
registry.updateProducerInfo(this);
}
return result;
}
private RefreshResult internalRefresh(boolean forceRefresh) throws PortletInvokerException
{
ServiceDescription serviceDescription;
if (isModifyRegistrationRequired())
{
return new RefreshResult(RefreshResult.Status.MODIFY_REGISTRATION_REQUIRED);
}
// might neeed a different cache value: right now, we cache the whole producer info but we might want to cache
// POPs and rest of producer info separetely...
if (forceRefresh || isRefreshNeeded(true))
{
log.debug("Refreshing info for producer '" + getId() + "'");
RefreshResult result = new RefreshResult(); // success by default!
try
{
persistentEndpointInfo.refresh();
}
catch (InvokerUnavailableException e)
{
log.debug("Couldn't refresh endpoint information, attempting a second time: " + e, e);
// try again as refresh on a failed service factory will fail without attempting the refresh
try
{
persistentEndpointInfo.forceRefresh();
}
catch (InvokerUnavailableException e1)
{
result.setStatus(RefreshResult.Status.FAILURE);
return result;
}
}
// get the service description from the producer
try
{
// if we don't yet have registration information, get an unregistered service description
serviceDescription = getUnmanagedServiceDescription(persistentRegistrationInfo.isUndetermined());
result.setServiceDescription(serviceDescription);
}
catch (OperationFailed operationFailedFault)
{
// if we have local registration info, the OperationFailedFault might indicate a need to call modifyRegistration
if (hasLocalRegistrationInfo())
{
log.debug("OperationFailedFault occurred, might indicate a need to modify registration", operationFailedFault);
return handleModifyRegistrationNeeded(result);
}
else
{
serviceDescription = rethrowAsInvokerUnvailable(operationFailedFault);
}
}
catch (InvalidRegistration invalidRegistrationFault)
{
log.debug("InvalidRegistrationFault occurred", invalidRegistrationFault);
// attempt to get unregistered service description
serviceDescription = getServiceDescription(true);
result.setServiceDescription(serviceDescription);
// check our registration information against what is sent in the service description
RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, false, true, true);
if (registrationResult.hasIssues())
{
setActiveAndSave(false);
rethrowAsInvokerUnvailable(invalidRegistrationFault);
}
return refreshInfo(false, serviceDescription, result);
}
catch (ModifyRegistrationRequired modifyRegistrationRequired)
{
return handleModifyRegistrationNeeded(result);
}
return refreshInfo(forceRefresh, serviceDescription, result);
}
return new RefreshResult(RefreshResult.Status.BYPASSED);
}
private RefreshResult handleModifyRegistrationNeeded(RefreshResult result) throws PortletInvokerException
{
ServiceDescription serviceDescription;// attempt to get unregistered service description
serviceDescription = getServiceDescription(true);
result.setServiceDescription(serviceDescription);
// re-validate the registration information
RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, false, true, true);
if (registrationResult.hasIssues())
{
// if the registration validation has issues, we need to modify our local information
setModifyRegistrationRequired(true);
setActive(false);
}
else
{
// we might be in a situation where the producer changed the registration back to the initial state
// which is, granted, pretty rare... attempt modifyRegistration
log.debug("modifyRegistration was called after OperationFailedFault when a check of registration data didn't reveal any issue...");
modifyRegistration(true);
}
result.setRegistrationResult(registrationResult);
return result;
}
private RefreshResult refreshInfo(boolean forceRefresh, ServiceDescription serviceDescription, RefreshResult result)
throws PortletInvokerException
{
// do we need to call initCookie or not?
requiresInitCookie = serviceDescription.getRequiresInitCookie();
log.debug("Requires initCookie: " + requiresInitCookie);
// supported options
final List<String> supportedOptions = serviceDescription.getSupportedOptions();
if (ParameterValidation.existsAndIsNotEmpty(supportedOptions))
{
this.supportedOptions = new HashSet<String>(supportedOptions);
}
// custom mode descriptions
customModes = toMap(serviceDescription.getCustomModeDescriptions());
// custom window state descriptions
customWindowStates = toMap(serviceDescription.getCustomWindowStateDescriptions());
// event descriptions
List<EventDescription> eventDescriptions = serviceDescription.getEventDescriptions();
if (!eventDescriptions.isEmpty())
{
this.eventDescriptions = new HashMap<QName, EventInfo>(eventDescriptions.size());
for (final EventDescription event : eventDescriptions)
{
QName name = event.getName();
EventInfo eventInfo = new WSRPEventInfo(
name,
WSRPUtils.convertToCommonLocalizedStringOrNull(event.getLabel()),
WSRPUtils.convertToCommonLocalizedStringOrNull(event.getDescription()),
new TypeInfo()
{
public String getName()
{
return event.getType().toString();
}
public XmlRootElement getXMLBinding()
{
throw new NotYetImplemented(); // todo
}
},
event.getAliases());
this.eventDescriptions.put(name, eventInfo);
}
}
// do we need to register?
if (serviceDescription.isRequiresRegistration())
{
// refresh and force check for extra props if the registered SD failed
// todo: deal with forcing check of extra registration properties properly (if needed)
RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, true, forceRefresh, false);
// attempt to register and determine if the current service description can be used to extract POPs
if (!registrationResult.hasIssues())
{
registrationResult = register(serviceDescription, false);
if (!registrationResult.hasIssues())
{
// registration occurred, so we should ask for a new service description
serviceDescription = getServiceDescription(false);
}
// extract the POPs
extractOfferedPortlets(serviceDescription);
}
result.setRegistrationResult(registrationResult);
}
else
{
log.debug("Registration not required");
persistentRegistrationInfo = new RegistrationInfo(this, false);
extractOfferedPortlets(serviceDescription);
}
modifyNow();
return result;
}
private Map<String, ItemDescription> toMap(List<ItemDescription> itemDescriptions)
{
if (itemDescriptions == null)
{
return null;
}
else
{
Map<String, ItemDescription> result = new HashMap<String, ItemDescription>(itemDescriptions.size());
for (ItemDescription itemDescription : itemDescriptions)
{
result.put(itemDescription.getItemName(), itemDescription);
}
return result;
}
}
/**
* Extracts a map of offered Portlet objects from ServiceDescription
*
* @param sd
* @return a Map (portlet handle -> Portlet) of the offered portlets.
*/
private Map extractOfferedPortlets(ServiceDescription sd)
{
if (sd == null)
{
throw new IllegalArgumentException("Provided ServiceDescription can't be null");
}
List<PortletDescription> portletDescriptions = sd.getOfferedPortlets();
if (portletDescriptions != null)
{
int length = portletDescriptions.size();
log.debug("Extracting " + length + " portlets.");
popsMap = new LinkedHashMap<String, Portlet>(length);
portletGroups = new HashMap<String, Set<Portlet>>();
for (PortletDescription portletDescription : portletDescriptions)
{
WSRPPortlet wsrpPortlet = createWSRPPortletFromPortletDescription(portletDescription);
if (wsrpPortlet != null)
{
popsMap.put(wsrpPortlet.getContext().getId(), wsrpPortlet);
}
}
}
else
{
popsMap = Collections.emptyMap();
portletGroups = Collections.emptyMap();
}
//todo: could extract more information here... and rename method more appropriately
resetCacheTimerIfNeeded();
return popsMap;
}
/**
* @param portletDescription
* @return
* @since 2.6
*/
WSRPPortlet createWSRPPortletFromPortletDescription(PortletDescription portletDescription)
{
ParameterValidation.throwIllegalArgExceptionIfNull(portletDescription, "PortletDescription");
String portletHandle = portletDescription.getPortletHandle();
log.debug("Extracting info for '" + portletHandle + "' portlet");
WSRPPortletInfo info = new WSRPPortletInfo(portletDescription, this);
WSRPPortlet wsrpPortlet = null;
if (info.isUsesMethodGet())
{
log.warn("Portlet '" + portletHandle
+ "' uses the GET method in forms. Since we don't handle this, this portlet will be excluded from " +
"the list of offered portlets for producer " + getId());
}
else
{
if (info.isHasUserSpecificState())
{
log.debug("Portlet '" + portletHandle + "' will store persistent state for each user.");
}
wsrpPortlet = new WSRPPortlet(PortletContext.createPortletContext(portletHandle, false), info);
// add the portlet to the appropriate group if needed
String portletGroupId = portletDescription.getGroupID();
if (portletGroupId != null)
{
Set<Portlet> groupedPortlets = portletGroups.get(portletGroupId);
if (groupedPortlets == null)
{
groupedPortlets = new HashSet<Portlet>();
portletGroups.put(portletGroupId, groupedPortlets);
}
groupedPortlets.add(wsrpPortlet);
}
}
return wsrpPortlet;
}
public Portlet getPortlet(PortletContext portletContext) throws PortletInvokerException
{
String portletHandle = portletContext.getId();
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "Portlet handle", "getPortlet");
log.debug("Retrieving portlet '" + portletHandle + "'");
// check if we need to refresh
boolean justRefreshed = refresh(false);
// First try caches if caches are still valid or we just refreshed
Portlet portlet = getPortletFromCaches(portletHandle, justRefreshed);
if (portlet != null) // we had a match in cache, return it
{
log.debug("Portlet was cached");
return portlet;
}
else // otherwise, retrieve just the information for the appropriate portlet
{
log.debug("Trying to retrieve portlet via getPortletDescription");
try
{
Holder<PortletDescription> descriptionHolder = new Holder<PortletDescription>();
persistentEndpointInfo.getPortletManagementService().getPortletDescription(
getRegistrationContext(),
WSRPUtils.convertToWSRPPortletContext(portletContext),
UserAccess.getUserContext(),
WSRPConstants.getDefaultLocales(), // todo: deal with locales better
descriptionHolder,
new Holder<ResourceList>(),
new Holder<List<Extension>>());
portlet = createWSRPPortletFromPortletDescription(descriptionHolder.value);
// add the portlet to the CCP cache
if (ccpsMap == null)
{
ccpsMap = new HashMap<String, Portlet>();
}
ccpsMap.put(portletHandle, portlet);
return portlet;
}
catch (InvalidHandle invalidHandleFault)
{
throw new NoSuchPortletException(invalidHandleFault, portletHandle);
}
catch (Exception e)
{
log.debug("Couldn't get portlet via getPortletDescription for producer '" + getId()
+ "'. Attempting to retrieve it from the service description as this producer might not support the PortletManagement interface.", e);
justRefreshed = refresh(true);
portlet = getPortletFromCaches(portletHandle, justRefreshed);
if (portlet == null)
{
throw new NoSuchPortletException(portletHandle);
}
else
{
return portlet;
}
}
}
}
private Portlet getPortletFromCaches(String portletHandle, boolean justRefreshed)
{
Portlet portlet = null;
if (justRefreshed || (useCache() && !isCacheExpired()))
{
log.debug("Trying cached POPs");
portlet = popsMap.get(portletHandle);
if (portlet == null && ccpsMap != null)
{
log.debug("Trying cached CCPs");
portlet = ccpsMap.get(portletHandle);
}
}
return portlet;
}
Map<String, Set<Portlet>> getPortletGroupMap() throws PortletInvokerException
{
return portletGroups;
}
public Map<String, Portlet> getProducerOffereedPortletMap() throws PortletInvokerException
{
refresh(false);
return popsMap;
}
public Map<String, Portlet> getAllPortletsMap() throws PortletInvokerException
{
// calling getNumberOfPortlets refreshes the information if needed so no need to redo it here
Map<String, Portlet> all = new LinkedHashMap<String, Portlet>(getNumberOfPortlets());
if(popsMap != null)
{
all.putAll(popsMap);
}
if (ccpsMap != null)
{
all.putAll(ccpsMap);
}
return all;
}
public int getNumberOfPortlets() throws PortletInvokerException
{
refresh(false);
int portletNb = popsMap != null ? popsMap.size() : 0;
portletNb = portletNb + (ccpsMap != null ? ccpsMap.size() : 0);
return portletNb;
}
// Cache support ****************************************************************************************************
private boolean useCache()
{
return persistentExpirationCacheSeconds != null && persistentExpirationCacheSeconds > 0;
}
private void resetCacheTimerIfNeeded()
{
expirationTimeMillis = nowForCache() + (getSafeExpirationCacheSeconds() * 1000);
}
/**
* @return
* @since 2.6
*/
private boolean isCacheExpired()
{
boolean result = !useCache() || nowForCache() > expirationTimeMillis || popsMap == null
|| portletGroups == null;
if (result)
{
log.debug("Cache expired or not used");
}
return result;
}
public Integer getExpirationCacheSeconds()
{
return persistentExpirationCacheSeconds;
}
public void setExpirationCacheSeconds(Integer expirationCacheSeconds)
{
if (modifyNowIfNeeded(persistentExpirationCacheSeconds, expirationCacheSeconds))
{
// record the previous cache expiration duration
Integer previousMS = getSafeExpirationCacheSeconds() * 1000;
// assign the new value
this.persistentExpirationCacheSeconds = expirationCacheSeconds;
// recompute the expiration time based on previous value and new one
long lastExpirationTimeChange = expirationTimeMillis - previousMS;
int newMS = getSafeExpirationCacheSeconds() * 1000;
if (lastExpirationTimeChange > 0)
{
expirationTimeMillis = lastExpirationTimeChange + newMS;
}
else
{
expirationTimeMillis = nowForCache();
}
}
}
/**
* Returns the cache expiration duration in seconds as a positive value or zero so that it's safe to use in cache
* expiration time computations.
*
* @return
*/
private int getSafeExpirationCacheSeconds()
{
return useCache() ? persistentExpirationCacheSeconds : 0;
}
private ServiceDescription getUnmanagedServiceDescription(boolean asUnregistered) throws PortletInvokerException, OperationFailed, InvalidRegistration, ModifyRegistrationRequired
{
//todo: might need to implement customization of default service description
ServiceDescription serviceDescription;
try
{
Holder<Boolean> requiresRegistration = new Holder<Boolean>();
Holder<List<PortletDescription>> offeredPortlets = new Holder<List<PortletDescription>>();
Holder<List<ItemDescription>> userCategoryDescriptions = new Holder<List<ItemDescription>>();
Holder<List<ItemDescription>> windowStateDescriptions = new Holder<List<ItemDescription>>();
Holder<List<ItemDescription>> modeDescriptions = new Holder<List<ItemDescription>>();
Holder<CookieProtocol> requiresInitCookie = new Holder<CookieProtocol>();
Holder<ModelDescription> registrationPropertyDescription = new Holder<ModelDescription>();
Holder<List<String>> locales = new Holder<List<String>>();
Holder<ResourceList> resourceList = new Holder<ResourceList>();
Holder<List<EventDescription>> eventDescriptions = new Holder<List<EventDescription>>();
Holder<ModelTypes> schemaTypes = new Holder<ModelTypes>();
Holder<List<String>> supportedOptions = new Holder<List<String>>();
Holder<ExportDescription> exportDescription = new Holder<ExportDescription>();
Holder<Boolean> mayReturnRegistrationState = new Holder<Boolean>();
final Holder<List<ExtensionDescription>> extensionDescriptions = new Holder<List<ExtensionDescription>>();
final Holder<List<Extension>> extensions = new Holder<List<Extension>>();
// invocation
persistentEndpointInfo.getServiceDescriptionService().getServiceDescription(
asUnregistered ? null : getRegistrationContext(),
WSRPConstants.getDefaultLocales(), // todo: deal with locales better
null, // todo: provide a way to only request info on some portlets?
UserAccess.getUserContext(),
requiresRegistration,
offeredPortlets,
userCategoryDescriptions,
extensionDescriptions,
windowStateDescriptions,
modeDescriptions,
requiresInitCookie,
registrationPropertyDescription,
locales,
resourceList,
eventDescriptions,
schemaTypes,
supportedOptions,
exportDescription,
mayReturnRegistrationState,
extensions);
// TODO: fix-me
serviceDescription = WSRPTypeFactory.createServiceDescription(requiresRegistration.value);
serviceDescription.setRegistrationPropertyDescription(registrationPropertyDescription.value);
serviceDescription.setRequiresInitCookie(requiresInitCookie.value);
serviceDescription.setResourceList(resourceList.value);
serviceDescription.setSchemaType(schemaTypes.value);
serviceDescription.setExportDescription(exportDescription.value);
serviceDescription.setMayReturnRegistrationState(mayReturnRegistrationState.value);
if (ParameterValidation.existsAndIsNotEmpty(modeDescriptions.value))
{
serviceDescription.getCustomModeDescriptions().addAll(modeDescriptions.value);
}
if (ParameterValidation.existsAndIsNotEmpty(windowStateDescriptions.value))
{
serviceDescription.getCustomWindowStateDescriptions().addAll(windowStateDescriptions.value);
}
if (ParameterValidation.existsAndIsNotEmpty(locales.value))
{
serviceDescription.getLocales().addAll(locales.value);
}
if (ParameterValidation.existsAndIsNotEmpty(offeredPortlets.value))
{
serviceDescription.getOfferedPortlets().addAll(offeredPortlets.value);
}
if (ParameterValidation.existsAndIsNotEmpty(userCategoryDescriptions.value))
{
serviceDescription.getUserCategoryDescriptions().addAll(userCategoryDescriptions.value);
}
if (ParameterValidation.existsAndIsNotEmpty(eventDescriptions.value))
{
serviceDescription.getEventDescriptions().addAll(eventDescriptions.value);
}
if (ParameterValidation.existsAndIsNotEmpty(extensionDescriptions.value))
{
serviceDescription.getExtensionDescriptions().addAll(extensionDescriptions.value);
}
if (ParameterValidation.existsAndIsNotEmpty(extensions.value))
{
serviceDescription.getExtensions().addAll(extensions.value);
}
if (ParameterValidation.existsAndIsNotEmpty(supportedOptions.value))
{
serviceDescription.getSupportedOptions().addAll(supportedOptions.value);
}
return serviceDescription;
}
catch (Exception e)
{
log.debug("Caught Exception in getServiceDescription:\n", e);
// de-activate
setActiveAndSave(false);
if (e instanceof InvalidRegistration)
{
resetRegistration();
throw (InvalidRegistration)e;
}
else if (e instanceof OperationFailed)
{
throw (OperationFailed)e; // rethrow to deal at higher level as meaning can vary depending on context
}
else if (e instanceof ModifyRegistrationRequired)
{
throw (ModifyRegistrationRequired)e;
}
return rethrowAsInvokerUnvailable(e);
}
}
ServiceDescription getServiceDescription(boolean asUnregistered) throws PortletInvokerException
{
try
{
return getUnmanagedServiceDescription(asUnregistered);
}
catch (OperationFailed operationFailedFault)
{
return rethrowAsInvokerUnvailable(operationFailedFault);
}
catch (InvalidRegistration invalidRegistrationFault)
{
return rethrowAsInvokerUnvailable(invalidRegistrationFault);
}
catch (ModifyRegistrationRequired modifyRegistrationRequired)
{
return rethrowAsInvokerUnvailable(modifyRegistrationRequired);
}
}
private ServiceDescription rethrowAsInvokerUnvailable(Exception e) throws InvokerUnavailableException
{
Throwable cause = e.getCause();
throw new InvokerUnavailableException("Problem getting service description for producer "
+ getId() + ", please see the logs for more information. ", cause == null ? e : cause);
}
public RegistrationContext getRegistrationContext() throws PortletInvokerException
{
if (persistentRegistrationInfo.isUndetermined())
{
refresh(false);
}
return persistentRegistrationInfo.getRegistrationContext();
}
public void resetRegistration() throws PortletInvokerException
{
persistentRegistrationInfo.resetRegistration();
invalidateCache();
modifyNow();
registry.updateProducerInfo(this);
}
// make package only after package reorg
public PortletPropertyDescriptionResponse getPropertyDescriptionsFor(String portletHandle)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
try
{
WSRPV2PortletManagementPortType service = getEndpointConfigurationInfo().getPortletManagementService();
Holder<ModelDescription> modelDescription = new Holder<ModelDescription>();
Holder<ResourceList> resourceList = new Holder<ResourceList>();
service.getPortletPropertyDescription(
getRegistrationContext(),
WSRPTypeFactory.createPortletContext(portletHandle),
UserAccess.getUserContext(),
WSRPConstants.getDefaultLocales(),
modelDescription,
resourceList,
new Holder<List<Extension>>());
PortletPropertyDescriptionResponse response = WSRPTypeFactory.createPortletPropertyDescriptionResponse(null);
response.setModelDescription(modelDescription.value);
response.setResourceList(resourceList.value);
return response;
}
catch (InvalidHandle invalidHandleFault)
{
throw new IllegalArgumentException("Unknown portlet '" + portletHandle + "'");
}
catch (InvalidRegistration invalidRegistrationFault)
{
try
{
resetRegistration();
}
catch (PortletInvokerException e)
{
throw new RuntimeException("Couldn't reset registration", e);
}
throw new IllegalArgumentException("Couldn't get property descriptions for portlet '" + portletHandle
+ "' because the provided registration is invalid!");
}
catch (Exception e)
{
// if we receive an exception that we cannot handle, since the support for PortletManagement is optional,
// just return null as if the portlet had no properties
log.debug("Couldn't get property descriptions for portlet '" + portletHandle + "'", e);
return null;
}
}
public void register() throws PortletInvokerException
{
try
{
register(null, false);
}
catch (PortletInvokerException e)
{
registry.updateProducerInfo(this);
throw e;
}
}
/**
* Attempts to register with the producer.
*
* @param serviceDescription
* @param forceRefresh
* @return <code>true</code> if the client code should ask for a new service description, <code>false</code> if the
* specified description is good to be further processed
* @throws PortletInvokerException
* @since 2.6
*/
private RefreshResult register(ServiceDescription serviceDescription, boolean forceRefresh) throws PortletInvokerException
{
if (!isRegistered())
{
persistentEndpointInfo.refresh();
if (serviceDescription == null)
{
serviceDescription = getServiceDescription(false);
}
if (serviceDescription.isRequiresRegistration())
{
// check if the configured registration information is correct and if we can get the service description
RefreshResult result = persistentRegistrationInfo.refresh(serviceDescription, getId(), true, forceRefresh, false);
if (!result.hasIssues())
{
try
{
log.debug("Attempting registration");
RegistrationData registrationData = persistentRegistrationInfo.getRegistrationData();
Holder<String> registrationHandle = new Holder<String>();
Holder<byte[]> registrationState = new Holder<byte[]>();
// invocation
persistentEndpointInfo.getRegistrationService().register(
registrationData,
null, // todo: support leasing?
UserAccess.getUserContext(),
registrationState,
new Holder<Lifetime>(),
new Holder<List<Extension>>(),
registrationHandle
);
RegistrationContext registrationContext = WSRPTypeFactory.createRegistrationContext(registrationHandle.value);
registrationContext.setRegistrationState(registrationState.value);
persistentRegistrationInfo.setRegistrationContext(registrationContext);
if (debug)
{
String msg = "Consumer with id '" + getId() + "' successfully registered with handle: '"
+ registrationContext.getRegistrationHandle() + "'";
log.debug(msg);
}
RefreshResult res = new RefreshResult();
res.setRegistrationResult(result);
return res;
}
catch (Exception e)
{
persistentRegistrationInfo.resetRegistration();
setActive(false);
throw new PortletInvokerException("Couldn't register with producer '" + getId() + "'", e);
}
}
else
{
log.debug(result.getStatus().toString());
setActive(false);
throw new PortletInvokerException("Consumer is not ready to be registered with producer because of missing or invalid registration information.");
}
}
}
return new RefreshResult(RefreshResult.Status.BYPASSED);
}
public void deregister() throws PortletInvokerException
{
if (isRegistered())
{
persistentEndpointInfo.refresh();
try
{
RegistrationContext registrationContext = getRegistrationContext();
persistentEndpointInfo.getRegistrationService().deregister(registrationContext, UserAccess.getUserContext());
log.info("Consumer with id '" + getId() + "' deregistered.");
}
catch (Exception e)
{
throw new PortletInvokerException("Couldn't deregister with producer '" + getId() + "'", e);
}
finally
{
resetRegistration();
}
}
else
{
throw new IllegalStateException("Cannot deregister producer '" + getId() + "' as it's not registered");
}
}
public void modifyRegistration() throws PortletInvokerException
{
try
{
modifyRegistration(false);
}
finally
{
registry.updateProducerInfo(this);
}
}
private void modifyRegistration(boolean force) throws PortletInvokerException
{
if (persistentRegistrationInfo.getRegistrationHandle() != null)
{
persistentEndpointInfo.refresh();
if (force || isModifyRegistrationRequired())
{
try
{
RegistrationContext registrationContext = getRegistrationContext();
Holder<byte[]> registrationState = new Holder<byte[]>();
// invocation
persistentEndpointInfo.getRegistrationService().modifyRegistration(
registrationContext,
persistentRegistrationInfo.getRegistrationData(),
UserAccess.getUserContext(),
registrationState,
new Holder<Lifetime>(),
new Holder<List<Extension>>());
// force refresh of internal RegistrationInfo state
persistentRegistrationInfo.setRegistrationValidInternalState();
// registration is not modified anymore :)
setModifyRegistrationRequired(false);
// update state
persistentRegistrationInfo.setRegistrationState(registrationState.value);
log.info("Consumer with id '" + getId() + "' sucessfully modified its registration.");
// reset cache to be able to see new offered portlets on the next refresh
invalidateCache();
}
catch (Exception e)
{
throw new PortletInvokerException("Couldn't modify registration with producer '" + getId() + "'", e);
}
}
}
else
{
throw new IllegalStateException("Cannot modify registration for producer '" + getId()
+ "' as it's not registered");
}
}
private void invalidateCache()
{
if (useCache())
{
expirationTimeMillis = nowForCache();
}
}
private static long nowForCache()
{
return System.currentTimeMillis();
}
private RefreshResult internalRefreshRegistration(ServiceDescription serviceDescription, boolean mergeWithLocalInfo, boolean forceRefresh, boolean forceCheckOfExtraProps) throws PortletInvokerException
{
RefreshResult result =
persistentRegistrationInfo.refresh(serviceDescription, getId(), mergeWithLocalInfo, forceRefresh, forceCheckOfExtraProps);
log.debug("Refreshed registration information for consumer with id '" + getId() + "'");
return result;
}
public boolean isRefreshNeeded(boolean considerCache)
{
boolean result = (considerCache && isCacheExpired())
|| persistentRegistrationInfo.isRefreshNeeded()
|| persistentEndpointInfo.isRefreshNeeded();
if (result)
{
log.debug("Refresh needed for producer '" + getId() + "'");
}
return result;
}
void removeHandleFromCaches(String portletHandle)
{
log.debug("Removing '" + portletHandle + "' from caches.");
ccpsMap.remove(portletHandle);
popsMap.remove(portletHandle);
}
public void eraseRegistrationInfo()
{
persistentRegistrationInfo = RegistrationInfo.createUndeterminedRegistration(this);
registry.updateProducerInfo(this);
log.warn(ERASED_LOCAL_REGISTRATION_INFORMATION);
}
public EventInfo getInfoForEvent(QName name)
{
if (eventDescriptions == null)
{
return null;
}
else
{
return eventDescriptions.get(name);
}
}
public Collection<String> getSupportedOptions()
{
return Collections.unmodifiableSet(supportedOptions);
}
/**
* Public for tests
*
* @param option
*/
public void setSupportedOption(String option)
{
if (WSRP2Constants.OPTIONS_COPYPORTLETS.equals(option) || WSRP2Constants.OPTIONS_EVENTS.equals(option)
|| WSRP2Constants.OPTIONS_EXPORT.equals(option) || WSRP2Constants.OPTIONS_IMPORT.equals(option)
|| WSRP2Constants.OPTIONS_LEASING.equals(option))
{
if (supportedOptions.isEmpty())
{
supportedOptions = new HashSet<String>(5);
}
supportedOptions.add(option);
}
else
{
throw new IllegalArgumentException("Invalid option: " + option);
}
}
}
| [
"metacosm@gmail.com"
] | metacosm@gmail.com |
30b505d6b5f5d26c63e341449085b5ef775b0bf5 | 592b22f2b4024c3c0f14abf9a1986dfe1fff5982 | /EverythingSearchLibrary/src/dataImporter/storeType/FragmentedStore.java | 70e91151598be0407986f9fea5cc392f2978295e | [
"MIT"
] | permissive | yashsaboo/RA-at-FORWARD_Data_Lab | 30c61047aecfe0b617e66900d854b8ae9d4e12a0 | e996eb47ef8ece147e0af9f6e0ee5117c81932e8 | refs/heads/master | 2020-12-21T12:12:03.416829 | 2020-01-27T05:45:37 | 2020-01-27T05:45:37 | 236,427,241 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package dataImporter.storeType;
import java.util.ArrayList;
public class FragmentedStore implements Store {
@Override
public void createAndAddHeader(String fileName, ArrayList<String> columnNames, int columnDatatype) {
// TODO Auto-generated method stub
}
@Override
public void addData(ArrayList<Object> tuples) {
// TODO Auto-generated method stub
}
}
| [
"yashsaboo99@gmail.com"
] | yashsaboo99@gmail.com |
cd65f93207bb768896bf333b90dd26bfa78ec53d | c136a8dd11c106fb4598858eebf8c64ff32c3be2 | /app/src/main/java/com/jlanka/tripplanner/Model/FoundSuggestion.java | 42b852ee70624a6175829f52a626e6975a670037 | [] | no_license | chathuraedirisinghe/tripplanner | c4190c7260cbdcb913050ce3316c82f922d09a83 | 3710f4a2cd3ab677399a9cb5f6f7a09fd7b226e1 | refs/heads/master | 2020-03-27T05:54:55.347253 | 2018-09-06T17:42:07 | 2018-09-06T17:42:07 | 146,061,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package com.jlanka.tripplanner.Model;
import android.annotation.SuppressLint;
import android.os.Parcel;
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion;
/**
* Created by User on 1/11/2018.
*/
@SuppressLint("ParcelCreator")
public class FoundSuggestion implements SearchSuggestion {
private final String id;
private String desc;
public FoundSuggestion(String id, String desc){
this.id=id;
this.desc=desc;
}
public String getId(){ return id;}
@Override
public String getBody() {
return desc;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
}
| [
"thiwanka.narth@gmail.com"
] | thiwanka.narth@gmail.com |
57dda8da98937d34282b69989851f6592f0795f4 | 64f6926232852c5c039e83cce84697e19611b025 | /src/main/java/com/markmcguill/express/routing/ExpressRouteToken.java | 6a0b141e4bd210818b749358e6d458d3a906aa92 | [
"MIT"
] | permissive | mmcguill/express-routing | bcbe7febd76cbbf49471f8abafa44cdc885a8526 | 69516e952d7f6a2a5a5312a4a067b9c804c07a0a | refs/heads/master | 2021-06-10T09:04:55.547189 | 2017-06-27T14:57:30 | 2017-06-27T14:57:30 | 95,568,778 | 9 | 3 | MIT | 2019-02-25T06:25:27 | 2017-06-27T14:43:50 | Java | UTF-8 | Java | false | false | 2,281 | java | package com.markmcguill.express.routing;
/**
* Created by mark on 13/06/2017.
*/
public class ExpressRouteToken {
private final String name;
private final String prefix;
private final String delimiter;
private final boolean optional;
private final boolean repeat;
private final boolean partial;
private final String asterisk;
private final String pattern;
private final ExpressRouteTokenType type;
public ExpressRouteToken(String name) {
this.name = name;
prefix = null;
delimiter = null;
optional = false;
repeat = false;
partial = false;
asterisk = null;
pattern = null;
this.type = ExpressRouteTokenType.PATH_FRAGMENT;
}
public ExpressRouteToken(String name, String prefix, String delimiter, boolean optional, boolean repeat, boolean partial, String asterisk, String pattern) {
this.name = name;
this.prefix = prefix;
this.delimiter = delimiter;
this.optional = optional;
this.repeat = repeat;
this.partial = partial;
this.asterisk = asterisk;
this.pattern = pattern;
this.type = ExpressRouteTokenType.PARAMETRIC;
}
public ExpressRouteTokenType getType() {
return type;
}
public String getName() {
return name;
}
public String getPrefix() {
return prefix;
}
public String getDelimiter() {
return delimiter;
}
public boolean isOptional() {
return optional;
}
public boolean isRepeat() {
return repeat;
}
public boolean isPartial() {
return partial;
}
public String getAsterisk() {
return asterisk;
}
public String getPattern() {
return pattern;
}
@Override
public String toString() {
return "ExpressRouteToken{" +
"name='" + name + '\'' +
", prefix='" + prefix + '\'' +
", delimiter='" + delimiter + '\'' +
", optional=" + optional +
", repeat=" + repeat +
", partial=" + partial +
", asterisk='" + asterisk + '\'' +
", pattern='" + pattern + '\'' +
'}';
}
}
| [
"mark@lon2002345.csr.pstars"
] | mark@lon2002345.csr.pstars |
1b2f688a7335a63afbc7c1e4b761edb72faef775 | 55db510884b2dae68b8ee44b90207d9166b8aa0a | /pet-clinic-web/src/main/java/deavila/richard/petclinic/bootstrap/DataLoader.java | 7fcb2e50724baefafd6fe12aae336d0c8f558a51 | [
"Apache-2.0"
] | permissive | rdeavila94/pet-clinic | 1089a624b624f885fb9ca59e9714709b68e11920 | 1a7bb0298991d3338108635707f803dd529fa7fa | refs/heads/master | 2020-03-28T19:04:55.117659 | 2018-09-17T04:26:47 | 2018-09-17T04:26:47 | 148,942,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,528 | java | package deavila.richard.petclinic.bootstrap;
import deavila.richard.petclinic.model.Owner;
import deavila.richard.petclinic.model.Vet;
import deavila.richard.petclinic.service.OwnerService;
import deavila.richard.petclinic.service.VetService;
import deavila.richard.petclinic.service.map.OwnerServiceMap;
import deavila.richard.petclinic.service.map.VetServiceMap;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Component
public class DataLoader implements CommandLineRunner {
private final VetService vetService;
private final OwnerService ownerService;
public DataLoader() {
this.vetService = new VetServiceMap();
this.ownerService = new OwnerServiceMap();
}
@Override
public void run(String... args) throws Exception {
init();
}
public void init() {
Owner owner = new Owner();
owner.setFirstName("Richard");
owner.setLastName("DeAvila");
owner.setId(1L);
Owner owner2 = new Owner();
owner2.setFirstName("Ricky");
owner2.setLastName("Dees");
owner2.setId(2L);
Vet vet = new Vet();
vet.setFirstName("Jonh");
vet.setLastName("Smith");
vet.setId(1L);
Vet vet2 = new Vet();
vet2.setFirstName("Jame");
vet2.setLastName("Doe");
vet2.setId(2L);
ownerService.save(owner);
ownerService.save(owner2);
vetService.save(vet);
vetService.save(vet2);
}
}
| [
"crayonsrcool@hotmail.com"
] | crayonsrcool@hotmail.com |
9fba3a335b75c1f45084c5e112ada7b37e05746d | bb41cafc1372b3f4932fb705b8878160409767e0 | /app/src/main/java/com/example/rholbrook/tickettoride/authentication/AuthenticationActivity.java | 738b2ef29e7a4072d4cf3f8ea7ad744832fa057e | [] | no_license | Rockwell-Holbrook/ticket_to_ride | 9b2c0a3563bc55dcbaa6fbbdf081e57fd8664ed1 | 213164be910b2beddd0607ce6719f7ac844621bc | refs/heads/master | 2020-04-15T23:25:57.616092 | 2019-02-19T18:09:50 | 2019-02-19T18:09:50 | 165,105,784 | 1 | 2 | null | 2019-04-15T20:16:18 | 2019-01-10T17:51:17 | Java | UTF-8 | Java | false | false | 2,262 | java | package com.example.rholbrook.tickettoride.authentication;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.widget.FrameLayout;
import com.example.rholbrook.tickettoride.R;
import com.example.rholbrook.tickettoride.login.LoginFragment;
import com.example.rholbrook.tickettoride.main.MainActivity;
import com.example.rholbrook.tickettoride.register.RegisterFragment;
public class AuthenticationActivity extends AppCompatActivity implements
AuthenticationActivityContract.View,
AuthenticationActivityModel.CallBack {
private FrameLayout fragmentContainer;
private AuthenticationActivityContract.Presenter mPresenter;
private static final int AUTHENTICATION_SUCCESS = 1;
private static final int SWITCH_FRAGMENT = 0;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_authentication);
fragmentContainer = findViewById(R.id.authentication_fragment_container);
mPresenter = new AuthenticationActivityPresenter(this);
mPresenter.init();
Fragment loginFragment = LoginFragment.newInstance();
((LoginFragment) loginFragment).setCallback(this);
getSupportFragmentManager().beginTransaction().add(R.id.authentication_fragment_container, loginFragment).commit();
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onCall(int key) {
switch (key) {
case AUTHENTICATION_SUCCESS:
//Switch to Main
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
this.finish();
break;
case SWITCH_FRAGMENT:
Fragment registerFragment = RegisterFragment.newInstance();
((RegisterFragment) registerFragment).setCallback(this);
getSupportFragmentManager().beginTransaction().add(R.id.authentication_fragment_container, registerFragment).commit();
break;
}
}
}
| [
"adam.ure@microfocus.com"
] | adam.ure@microfocus.com |
85cf1cd20e6d13ae137080c2e90145b18c5599b9 | 4889c48e5f5b9463ec10852cf5e10e77f8640ebf | /02-java-oop/04-zoo-keeper-pt2/Bat.java | b30ccd53273fca32208468b8a724d7968264bd31 | [] | no_license | java-september-2021/TimL-Assignments | 07569516234afb60e8c05a05dcb2197880aae6d3 | 849047533f93e47d5f97284e00fe66ca309bb5e7 | refs/heads/master | 2023-08-15T16:09:04.011789 | 2021-10-12T04:05:47 | 2021-10-12T04:05:47 | 400,955,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | public class Bat extends Mammal{
public Bat(int energyLevel){
super(energyLevel);
}
public void fly(){
System.out.println("zoom-zoom.");
this.energyLevel -= 50;
}
public void eatHumans(){
System.out.println("so- well, never mind.");
this.energyLevel += 25;
}
public void attackTown(){
System.out.println("boom-boom.");
this.energyLevel -= 100;
}
}
| [
"85093613+timliu24@users.noreply.github.com"
] | 85093613+timliu24@users.noreply.github.com |
674e3db1af8556bcbc2062fd2a4b052b8af2ba7d | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Hibernate/Hibernate5925.java | b9b7cf257669c7e23575d221552734ac4e50af2b | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | @Test
@TestForIssue( jiraKey = "" )
public void testStaticMetamodel() {
EntityManagerFactory emf = TestingEntityManagerFactoryGenerator.generateEntityManagerFactory(
AvailableSettings.LOADED_CLASSES,
Arrays.asList( Company.class )
);
try {
assertNotNull( "'Company_.id' should not be null)", Company_.id );
assertNotNull( "'Company_.address' should not be null)", Company_.address );
assertNotNull( "'AbstractAddressable_.address' should not be null)", AbstractAddressable_.address );
}
finally {
emf.close();
}
}
| [
"Qing.Mi@my.cityu.edu.hk"
] | Qing.Mi@my.cityu.edu.hk |
b78e1ab4f9540ce44ece17f541ecde798bd1b6f3 | c3b9b6a97d135b2df6c66314c32fe6c5070427bb | /spring-core/src/main/java/org/springframework/core/io/InputStreamSource.java | 841de9b8ed4e676389f791fafdaf7c4e316171da | [
"Apache-2.0"
] | permissive | wsdcoding/spring-framework-5.1.x | b69c52765621df633e57c0a41be7dadeadfcd85b | 1ef2ddbbd5d528d77ba3a683e9d09cc26fa3e2f1 | refs/heads/master | 2023-01-29T00:47:42.495908 | 2020-12-08T16:33:51 | 2020-12-08T16:33:51 | 268,751,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,518 | java | /*
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.io;
import java.io.IOException;
import java.io.InputStream;
/**
* Simple interface for objects that are sources for an {@link InputStream}.
*
* <p>This is the base interface for Spring's more extensive {@link Resource} interface.
*
* <p>For single-use streams, {@link InputStreamResource} can be used for any
* given {@code InputStream}. Spring's {@link ByteArrayResource} or any
* file-based {@code Resource} implementation can be used as a concrete
* instance, allowing one to read the underlying content stream multiple times.
* This makes this interface useful as an abstract content source for mail
* attachments, for example.
*
* @author Juergen Hoeller
* @since 20.01.2004
* @see java.io.InputStream
* @see Resource
* @see InputStreamResource
* @see ByteArrayResource
*/
public interface InputStreamSource {
/**
* Return an {@link InputStream} for the content of an underlying resource.
* <p>It is expected that each call creates a <i>fresh</i> stream.
* <p>This requirement is particularly important when you consider an API such
* as JavaMail, which needs to be able to read the stream multiple times when
* creating mail attachments. For such a use case, it is <i>required</i>
* that each {@code getInputStream()} call returns a fresh stream.
* @return the input stream for the underlying resource (must not be {@code null})
* @throws java.io.FileNotFoundException if the underlying resource doesn't exist
* @throws IOException if the content stream could not be opened
*
*/
/**
* InputStreamSource 类只提供了一个 getInputStream 方法,该方法返回一个 InputStream,
* 也就是说,InputStreamSource 会将传入的 File 等资源,封装成一个 InputStream 再重新返回。
* @return InputStream
* @throws IOException
*/
InputStream getInputStream() throws IOException;
}
| [
"weishide1@gmail.com"
] | weishide1@gmail.com |
ea920a02265ccb242f663e3058ebfe6bc3776ba4 | 9d1f52192244faf8f450c2e3e659997ad08c3ef1 | /src/test/java/framework/BaseAction.java | fbcd63dcc8790c1a5ee70c64cd7e87c51095f531 | [] | no_license | VitaliKuchynski/appium.android | 5673ac12dbdc6a0c410e3baa9cb2ea50a7e4c86f | 15bac5954d4de3a6c74a9a299489175fd139266e | refs/heads/master | 2020-03-07T12:30:28.468422 | 2018-03-30T23:00:55 | 2018-03-30T23:00:55 | 127,479,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,800 | java | package framework;
import io.appium.java_client.MobileBy;
import io.appium.java_client.MobileElement;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.support.PageFactory;
import java.util.concurrent.TimeUnit;
import static stepdefinition.SharedSD.getAppiumDriver;
public class BaseAction {
/**
* This is a constructor which initializes initPageElements()
*/
public BaseAction() {
initPageElements();
}
/**
* This method handles wait functionality for mobile actions, which means if the element is not found
* during test then the app will re-try and wait up to 15 seconds before failing the test step
*/
protected void initPageElements() {
PageFactory.initElements(new AppiumFieldDecorator(getAppiumDriver(), 15, TimeUnit.SECONDS), this);
}
/**
* This method is used to tap on element
*
* @param mobileElement element to tap on
*/
protected void tapOn(MobileElement mobileElement) {
try {
if (mobileElement.isEnabled()) {
mobileElement.click();
}
} catch (NoSuchElementException e) {
e.printStackTrace();
throw new NoSuchElementException("Unable to locate the Element using: " + mobileElement.toString());
}
}
/**
* This method is used to set value in text field
*
* @param mobileElement
* @param setValue
*/
protected void setValue(MobileElement mobileElement, String setValue) {
try {
mobileElement.sendKeys(setValue);
} catch (NoSuchElementException e) {
e.printStackTrace();
throw new NoSuchElementException("Unable to locate the Element using: " + mobileElement.toString());
}
}
//Verifies is element enabled
protected boolean isEnabled(MobileElement mobileElement){
return mobileElement.isEnabled();
}
// Example 1
// public void testScroll()throws Exception
// {
// getAppiumDriver().findElementByAccessibilityId("Views").click();
// AndroidElement list = (AndroidElement) getAppiumDriver().findElement(By.id("android:id/mobile_list"));
// MobileElement listGroup = list
// .findElement(MobileBy
// .AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView("
// + "new UiSelector().text(\" List item:25\"));"));
// assertNotNull(listGroup.getLocation());
// listGroup.click();
// }
// Example 2
// TouchAction tAction=new TouchAction(SharedSD.getAppiumDriver());
// int startx = SharedSD.getAppiumDriver().findElement(By.id("com.hcom.android:id/rewards_free_moon_image")).getLocation().getX();
// int starty = SharedSD.getAppiumDriver().findElement(By.id("com.hcom.android:id/rewards_free_moon_image")).getLocation().getY();
// int endx = SharedSD.getAppiumDriver().findElement(By.id("com.hcom.android:id/need_a_hotel_message")).getLocation().getX();
// int endy = SharedSD.getAppiumDriver().findElement(By.id("com.hcom.android:id/need_a_hotel_message")).getLocation().getY();
// System.out.println(startx + " ::::::: " + starty + " ::::::: " + endx + " ::::::: " + endy);
//
// tAction.press(startx,starty).waitAction(1000).moveTo(endx+20,endy-400).release().perform();
// UtilHelp.pauseScript(2000);
//Scrolls to element by string value
protected void scrollTo(String text) {
getAppiumDriver().findElement(MobileBy
.AndroidUIAutomator("new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textContains(\""+text+"\").instance(0))"));
}
}
| [
"vitali.kuchynski@gmail.com"
] | vitali.kuchynski@gmail.com |
50431a52a3161b0bf8f718ee6e41c29e05c8b256 | 4a4c12c9210f3d763690c65c3a1bb3d5255a72b1 | /app/src/main/java/com/minilook/minilook/ui/gallery/adapter/SelectedAdapter.java | 5091565630e310cfe93d80507cfd5d18f916b8be | [] | no_license | sjyun87/minilook | f6fd0d745955a97eb0f9462d8623187e96baf239 | 5e4dfcb684cfaf00f6db46e10209a7a52671a563 | refs/heads/master | 2023-04-01T07:40:13.654554 | 2021-04-16T08:33:01 | 2021-04-16T08:33:01 | 275,824,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,543 | java | package com.minilook.minilook.ui.gallery.adapter;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.minilook.minilook.data.model.gallery.PhotoDataModel;
import com.minilook.minilook.ui.gallery.viewholder.SelectedItemVH;
import com.minilook.minilook.ui.base.BaseAdapterDataModel;
import com.minilook.minilook.ui.base.BaseAdapterDataView;
import java.util.ArrayList;
import java.util.List;
public class SelectedAdapter extends RecyclerView.Adapter<SelectedItemVH> implements
BaseAdapterDataModel<PhotoDataModel>, BaseAdapterDataView<PhotoDataModel> {
private final List<PhotoDataModel> items = new ArrayList<>();
@NonNull @Override
public SelectedItemVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new SelectedItemVH(parent);
}
@Override public void onBindViewHolder(@NonNull SelectedItemVH holder, int position) {
holder.bind(items.get(position));
}
@Override public int getItemCount() {
return getSize();
}
@Override public void add(PhotoDataModel $item) {
items.add($item);
}
@Override public void add(int $index, PhotoDataModel $item) {
items.add($index, $item);
}
@Override public void addAll(List<PhotoDataModel> $items) {
items.addAll($items);
}
@Override public void set(int $index, PhotoDataModel $item) {
items.set($index, $item);
}
@Override public void set(List<PhotoDataModel> $items) {
items.clear();
items.addAll($items);
}
@Override public PhotoDataModel get(int $index) {
return items.get($index);
}
@Override public List<PhotoDataModel> get() {
return items;
}
@Override public int get(PhotoDataModel $item) {
return items.indexOf($item);
}
@Override public void remove(int $index) {
items.remove($index);
}
@Override public void remove(PhotoDataModel $item) {
items.remove($item);
}
@Override public void removeAll() {
items.clear();
}
@Override public void clear() {
items.clear();
}
@Override public int getSize() {
return items.size();
}
@Override public void refresh() {
notifyDataSetChanged();
}
@Override public void refresh(int $position) {
notifyItemChanged($position);
}
@Override public void refresh(int $start, int $row) {
notifyItemRangeInserted($start, $row);
}
}
| [
"saira_@naver.com"
] | saira_@naver.com |
5aba345c948142b582e480b79aace26b3832b5b6 | ad7b260a60fae18914f8c07b0cc91dc66b9cba52 | /src/main/java/com/gdrc/panda/plugin/SQLKeyGenerator.java | c8525497218c455a4366b08dc59148da01d0d36b | [] | no_license | bj15828/pandax | 5f719a2da154da5f28072b83d1f48e658517a148 | 84e59ce72c2fafd3f1354439a34facd41f544474 | refs/heads/master | 2021-01-20T06:07:49.748162 | 2017-08-26T12:49:29 | 2017-08-26T12:49:29 | 101,485,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package com.gdrc.panda.plugin;
import com.gdrc.panda.command.Command;
/**
* for App generate cmdKey
* */
public class SQLKeyGenerator implements IKeyGenerator{
public String key(Command cmd){
return null;
}
}
| [
"bj15828@163.com"
] | bj15828@163.com |
0962ff3a9e046c2d820057e74b270604b329e64b | 214b3352b74ae4e40862819625e9b578e0513b3c | /PD-Proxy/src/main/java/com/ly/proxy/pojo/ProxyIPInfo.java | d16cba2d9215a445551e9727e1552c87db55dbcc | [] | no_license | yorkLiu/Pagoda | 4cf729958fc355abcaa314a1f71aa0215da3f9de | 5a4947946c096f0923b587a9d31cdfd92b6e8b98 | refs/heads/master | 2020-05-21T23:54:43.761858 | 2019-05-08T03:38:07 | 2019-05-08T03:38:07 | 62,616,716 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,345 | java | package com.ly.proxy.pojo;
import org.springframework.util.StringUtils;
/**
* Created by yongliu on 12/29/16.
*
* @author <a href="mailto:yong.liu@ozstrategy.com">Yong Liu</a>
* @version 12/30/2016 10:08
*/
public class ProxyIPInfo {
//~ Instance fields --------------------------------------------------------------------------------------------------
/** 透明, 匿名, 高匿. */
private String anonymousType;
private String delay;
private Boolean hasUsed = Boolean.FALSE;
private Boolean invalid = Boolean.FALSE;
private String ip;
private String port;
private String province;
/** the value parse from @delay. */
private Float speed;
/**
* TODO: DOCUMENT ME!
*
* @type Http or Https
*/
private String type;
//~ Methods ----------------------------------------------------------------------------------------------------------
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override public boolean equals(Object o) {
if (this == o) {
return true;
}
if ((o == null) || (getClass() != o.getClass())) {
return false;
}
ProxyIPInfo that = (ProxyIPInfo) o;
if ((ip != null) ? (!ip.equals(that.ip)) : (that.ip != null)) {
return false;
}
if ((port != null) ? (!port.equals(that.port)) : (that.port != null)) {
return false;
}
if ((province != null) ? (!province.equals(that.province)) : (that.province != null)) {
return false;
}
if ((anonymousType != null) ? (!anonymousType.equals(that.anonymousType)) : (that.anonymousType != null)) {
return false;
}
if ((type != null) ? (!type.equals(that.type)) : (that.type != null)) {
return false;
}
return (delay != null) ? delay.equals(that.delay) : (that.delay == null);
} // end method equals
//~ ------------------------------------------------------------------------------------------------------------------
/**
* getter method for anonymous type.
*
* @return String
*/
public String getAnonymousType() {
return anonymousType;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* getter method for delay.
*
* @return String
*/
public String getDelay() {
return delay;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* get full IP address.
*
* @return ip:port
*/
public String getFullIpAddress() {
return ip + ":" + port;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* getter method for has used.
*
* @return Boolean
*/
public Boolean getHasUsed() {
return hasUsed;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* getter method for invalid.
*
* @return Boolean
*/
public Boolean getInvalid() {
return invalid;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* getter method for ip.
*
* @return String
*/
public String getIp() {
return ip;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* getter method for port.
*
* @return String
*/
public String getPort() {
return port;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* getter method for province.
*
* @return String
*/
public String getProvince() {
return province;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* getter method for speed.
*
* @return Float
*/
public Float getSpeed() {
return speed;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* getter method for type.
*
* @return String
*/
public String getType() {
return type;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* @see java.lang.Object#hashCode()
*/
@Override public int hashCode() {
int result = (ip != null) ? ip.hashCode() : 0;
result = (31 * result) + ((port != null) ? port.hashCode() : 0);
result = (31 * result) + ((province != null) ? province.hashCode() : 0);
result = (31 * result) + ((anonymousType != null) ? anonymousType.hashCode() : 0);
result = (31 * result) + ((type != null) ? type.hashCode() : 0);
result = (31 * result) + ((delay != null) ? delay.hashCode() : 0);
return result;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* setter method for anonymous type.
*
* @param anonymousType String
*/
public void setAnonymousType(String anonymousType) {
this.anonymousType = anonymousType;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* setter method for delay.
*
* @param delay String
*/
public void setDelay(String delay) {
if ((delay != null) && StringUtils.hasText(delay)) {
delay = delay.replace("秒", "");
try {
setSpeed(Float.parseFloat(delay.trim()));
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
this.delay = delay;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* setter method for has used.
*
* @param hasUsed Boolean
*/
public void setHasUsed(Boolean hasUsed) {
this.hasUsed = hasUsed;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* setter method for invalid.
*
* @param invalid Boolean
*/
public void setInvalid(Boolean invalid) {
this.invalid = invalid;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* setter method for ip.
*
* @param ip String
*/
public void setIp(String ip) {
this.ip = ip;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* setter method for port.
*
* @param port String
*/
public void setPort(String port) {
this.port = port;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* setter method for province.
*
* @param province String
*/
public void setProvince(String province) {
this.province = province;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* setter method for speed.
*
* @param speed Float
*/
public void setSpeed(Float speed) {
this.speed = speed;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* setter method for type.
*
* @param type String
*/
public void setType(String type) {
this.type = type;
}
//~ ------------------------------------------------------------------------------------------------------------------
/**
* @see java.lang.Object#toString()
*/
@Override public String toString() {
final StringBuffer sb = new StringBuffer("ProxyIPInfo{");
sb.append("ip='").append(ip).append('\'');
sb.append(", port='").append(port).append('\'');
sb.append(", province='").append(province).append('\'');
sb.append(", anonymousType='").append(anonymousType).append('\'');
sb.append(", type='").append(type).append('\'');
sb.append(", delay='").append(delay).append('\'');
sb.append('}');
return sb.toString();
}
} // end class ProxyIPInfo
| [
"yong.liu@ozstrategy.com"
] | yong.liu@ozstrategy.com |
8781078f527e459816a208609ba7b27c4d53cbc9 | 40f0321ee37528aeb2c452c2caf03b2e95a26543 | /src/main/java/eu/learnpad/monitoring/glimpse/impl/EventsBufferImpl.java | 569c24f43236dcab52c5355735052f047f3a6b6b | [] | no_license | tomjorquera/lp-monitoring | 513a330c4e71d2eb5b3ad3e923ae8e5ed693c42f | ae38a1677add3c74fa7baf515785498f699dfe16 | refs/heads/master | 2021-01-22T21:41:16.943243 | 2015-07-16T13:10:04 | 2015-07-16T13:21:47 | 39,186,884 | 0 | 0 | null | 2015-07-16T08:54:26 | 2015-07-16T08:54:26 | null | UTF-8 | Java | false | false | 1,999 | java | /*
* GLIMPSE: A generic and flexible monitoring infrastructure.
* For further information: http://labsewiki.isti.cnr.it/labse/tools/glimpse/public/main
*
* Copyright (C) 2011 Software Engineering Laboratory - ISTI CNR - Pisa - Italy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package eu.learnpad.monitoring.glimpse.impl;
import eu.learnpad.monitoring.glimpse.buffer.EventsBuffer;
import eu.learnpad.monitoring.glimpse.event.GlimpseBaseEvent;
import eu.learnpad.monitoring.glimpse.utils.DebugMessages;
import java.util.ArrayList;
import org.apache.commons.net.ntp.TimeStamp;
public class EventsBufferImpl <T> implements EventsBuffer<T> {
public ArrayList<GlimpseBaseEvent<T>> myBuffer = new ArrayList<GlimpseBaseEvent<T>>();
public void add(GlimpseBaseEvent<T> evt)
{
myBuffer.add(evt);
DebugMessages.println(TimeStamp.getCurrentTime(),this.getClass().getSimpleName(),"New element add to the buffer. New buffer size = " + myBuffer.size());
}
public void remove(GlimpseBaseEvent<T> evt)
{
myBuffer.remove(evt);
}
public GlimpseBaseEvent<T> getElementAt(int index)
{
return myBuffer.get(index);
}
public void removeElementAt(int index)
{
myBuffer.remove(index);
}
public void clear()
{
myBuffer.clear();
}
public void setDimension(int newSize)
{
//
}
public int getSize()
{
return myBuffer.size();
}
}
| [
"antonello.calabro@isti.cnr.it"
] | antonello.calabro@isti.cnr.it |
2f1b53b8b73ad5f79a992846c479c238f59380cf | 95c49f466673952b465e19a5ee3ae6eff76bee00 | /src/main/java/com/baidu/tts/p270d/p271a/EngineDownloadHandler.java | 47dfddfbc3caeaa4bb2fd7581fa7898972865b7d | [] | no_license | Phantoms007/zhihuAPK | 58889c399ae56b16a9160a5f48b807e02c87797e | dcdbd103436a187f9c8b4be8f71bdf7813b6d201 | refs/heads/main | 2023-01-24T01:34:18.716323 | 2020-11-25T17:14:55 | 2020-11-25T17:14:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,394 | java | package com.baidu.tts.p270d.p271a;
import com.baidu.tts.chainofresponsibility.logger.LoggerProxy;
import com.baidu.tts.p270d.p271a.DownloadEngine;
import java.util.concurrent.Future;
/* renamed from: com.baidu.tts.d.a.e */
/* compiled from: EngineDownloadHandler */
public class EngineDownloadHandler {
/* renamed from: a */
private Future<Void> f10413a;
/* renamed from: b */
private DownloadEngine.CallableC2609a f10414b;
/* renamed from: a */
public void mo20975a(Future<Void> future) {
this.f10413a = future;
}
/* renamed from: a */
public void mo20974a(DownloadEngine.CallableC2609a aVar) {
this.f10414b = aVar;
}
/* renamed from: a */
public void mo20973a() {
LoggerProxy.m10812d("EngineDownloadHandler", "before stop");
try {
LoggerProxy.m10812d("EngineDownloadHandler", "stop fileId=" + this.f10414b.mo20960c().mo20965a());
} catch (Exception unused) {
}
Future<Void> future = this.f10413a;
if (future != null) {
boolean cancel = future.cancel(true);
LoggerProxy.m10812d("EngineDownloadHandler", "unDone = " + cancel);
}
DownloadEngine.CallableC2609a aVar = this.f10414b;
if (aVar != null) {
aVar.mo20959b();
}
LoggerProxy.m10812d("EngineDownloadHandler", "after stop");
}
}
| [
"seasonpplp@qq.com"
] | seasonpplp@qq.com |
4ac2a9822dc805fccb9ac0f1a35a9787be481e5c | b287cbcc7d41f12a198112c4c5f19f6c73d864e4 | /app/src/main/java/com/example/bozhilun/android/b15p/b15pdb/B15PBloodDB.java | 09a007f93bb3843e5690d16f184c929b7989571a | [
"Apache-2.0"
] | permissive | sengeiou/RaceFitPro | dffc24ee4a70bae7f944f47696ed09bc799e0e83 | 8487da3a9cea4eefed27c727e02fc6786a91b603 | refs/heads/master | 2022-11-16T18:38:02.142577 | 2020-07-08T08:43:17 | 2020-07-08T08:43:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,520 | java | package com.example.bozhilun.android.b15p.b15pdb;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;
@Entity
public class B15PBloodDB {
@Id(autoincrement = true)
private Long _id;
private String devicesMac;
private String bloodData;
private String bloodTime;
private int bloodNumberH;
private int bloodNumberL;
private int isUpdata;
@Generated(hash = 1076682131)
public B15PBloodDB(Long _id, String devicesMac, String bloodData,
String bloodTime, int bloodNumberH, int bloodNumberL, int isUpdata) {
this._id = _id;
this.devicesMac = devicesMac;
this.bloodData = bloodData;
this.bloodTime = bloodTime;
this.bloodNumberH = bloodNumberH;
this.bloodNumberL = bloodNumberL;
this.isUpdata = isUpdata;
}
@Generated(hash = 478437982)
public B15PBloodDB() {
}
public Long get_id() {
return _id;
}
public void set_id(Long _id) {
this._id = _id;
}
public String getDevicesMac() {
return devicesMac;
}
public void setDevicesMac(String devicesMac) {
this.devicesMac = devicesMac;
}
public String getBloodData() {
return bloodData;
}
public void setBloodData(String bloodData) {
this.bloodData = bloodData;
}
public String getBloodTime() {
return bloodTime;
}
public void setBloodTime(String bloodTime) {
this.bloodTime = bloodTime;
}
public int getBloodNumberH() {
return bloodNumberH;
}
public void setBloodNumberH(int bloodNumberH) {
this.bloodNumberH = bloodNumberH;
}
public int getBloodNumberL() {
return bloodNumberL;
}
public void setBloodNumberL(int bloodNumberL) {
this.bloodNumberL = bloodNumberL;
}
public int getIsUpdata() {
return isUpdata;
}
public void setIsUpdata(int isUpdata) {
this.isUpdata = isUpdata;
}
@Override
public String toString() {
return "B15PBloodDB{" +
"_id=" + _id +
", devicesMac='" + devicesMac + '\'' +
", bloodData='" + bloodData + '\'' +
", bloodTime='" + bloodTime + '\'' +
", bloodNumberH=" + bloodNumberH +
", bloodNumberL=" + bloodNumberL +
", isUpdata=" + isUpdata +
'}';
}
}
| [
"758378737@qq.com"
] | 758378737@qq.com |
e2e1860ec0b2b9699ca5fc9cf004f5871d616ccf | 02c51349cfcb777add358c5d2a259b9b98b3dfa8 | /grb-article-service/src/main/java/tn/gov/cni/dpp/GrbArticleServiceApplication.java | 5febd7d7408eb2051ad4c468afb91d262ce40bfa | [] | no_license | cherifgit/grb-training | 01193db78e44176f9b10cb6613bf5402870d3f74 | 3ce7796f6bb8ba948fc19ce77e5690288fb4e32e | refs/heads/master | 2020-12-30T05:35:56.214476 | 2020-02-07T10:04:44 | 2020-02-07T10:04:44 | 238,878,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,155 | java | package tn.gov.cni.dpp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.ApplicationContext;
import tn.gov.cni.dpp.domaine.Article;
import tn.gov.cni.dpp.repository.ArticleRepository;
@SpringBootApplication
@EnableCircuitBreaker
@EnableHystrixDashboard
@EnableDiscoveryClient
public class GrbArticleServiceApplication {
public static void main(String[] args) {
ApplicationContext applicationContext = SpringApplication.run(GrbArticleServiceApplication.class, args);
ArticleRepository articleRepository = applicationContext.getBean(ArticleRepository.class);
Article article=new Article("pantallon");
articleRepository.save(article);
Article article2=new Article("chemise");
articleRepository.save(article2);
Article article3=new Article("cravate");
articleRepository.save(article3);
}
}
| [
"you@example.com"
] | you@example.com |
647e6b0ac10c5cde49f3d1358b560d23e915ff71 | 5124050f0b2d5f86f49b20186eaa324c4b73f08c | /Messanger/app/src/main/java/com/example/messanger/Inputlogin.java | 1a91c95cdb7f662ee9f8ac4573979ed7406271cf | [] | no_license | asushnikk/Messanger | 271788f14dfa045cf6929e8e626e4526b8753cc5 | ac6256503170880fd5727476760dec47e656b05b | refs/heads/master | 2020-03-30T05:09:44.522909 | 2018-09-28T19:27:51 | 2018-09-28T19:27:51 | 95,440,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,137 | java | package com.example.messanger;
import java.io.IOException;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import com.neovisionaries.ws.client.WebSocket;
import com.neovisionaries.ws.client.WebSocketException;
public class Inputlogin extends Activity {
public static String login;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.inputlogin);
}
public void logIN(View view)
{
Intent intent;
intent = new Intent(Inputlogin.this, MyActivity.class);
startActivity(intent);
login = ((EditText)findViewById(R.id.edittextlogin)).getText().toString();
Log.d("Inputlogin", login);
WebSocket ws;
try
{
ws = Connection.connect(login);
}
catch (Exception e)
{
Log.d("Inputlogin", "IO " + e.getMessage());
e.printStackTrace();
}
}
} | [
"vnuchokacademica@yandex.ru"
] | vnuchokacademica@yandex.ru |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.