blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
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
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bc1578201871d244ebbdbcd66526f001a712e80b | 0124e565b2ca5d223fddd10dd9d851437ab59dc2 | /myjdk/src/com/sun/corba/se/spi/activation/InvalidORBid.java | cefa4bc69852b2572fc7fed0281c29cd9d6a8381 | []
| no_license | lvcs123456/syncMore | 331db4092017ba17b38ead80ab47fc4c6615683e | 43074b41851cf6514e4b28037e2465fb806b46b1 | refs/heads/master | 2023-01-23T11:29:02.755417 | 2020-11-04T12:14:37 | 2020-11-04T12:14:37 | 309,552,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 647 | java | package com.sun.corba.se.spi.activation;
/**
* com/sun/corba/se/spi/activation/InvalidORBid.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/ade/jenkins/workspace/8-2-build-windows-i586-cygwin/jdk8u241/331/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl
* Wednesday, December 11, 2019 10:25:11 AM UTC
*/
public final class InvalidORBid extends org.omg.CORBA.UserException
{
public InvalidORBid ()
{
super(InvalidORBidHelper.id());
} // ctor
public InvalidORBid (String $reason)
{
super(InvalidORBidHelper.id() + " " + $reason);
} // ctor
} // class InvalidORBid
| [
"[email protected]"
]
| |
9781ff0f16765fc17847398a9941573e31a2e297 | ed9774247f38554a0b0d6d2efec75f0743b39b3b | /src/main/java/org/cjh/javabasic/format/uuid/UUIDTest.java | 0503c0084641b0e7a12dd17a29f3ce35dd09ba4d | []
| no_license | maskedmarker/javabasic | 87ab9b0037f1e611b952e12100f291de91f22891 | 1e046ab682bb21f7eda0c0733a88afa08072fb7d | refs/heads/master | 2020-03-16T01:08:04.014430 | 2018-06-30T10:02:52 | 2018-06-30T10:02:52 | 132,433,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package org.cjh.javabasic.format.uuid;
import java.util.UUID;
public class UUIDTest {
public static void main(String[] args) {
UUID uid = UUID.randomUUID();
System.out.println(uid.toString());
System.out.println(uid.toString().replace("-", ""));
System.out.println(uid.toString().replace("-", "").hashCode());
}
}
| [
"[email protected]"
]
| |
3706a95e1f48afb19aa4bdc4153d870c856ea515 | 0cf283de2ce6a631958173ed5049f35f055671b5 | /core/src/main/java/com/jai/overriding/Vehicle.java | 47b734fc1f9848ec9659863b2524eb23b3ee50fe | []
| no_license | jjayaraman/corejava | 6cd940df827dcf1aedc27678f4f2bc3ca7f0085f | 8e2eda4dad12f68cc457a4984b2600133e8051df | refs/heads/master | 2021-07-08T02:47:20.070458 | 2020-04-25T06:16:55 | 2020-04-25T06:16:55 | 70,928,536 | 0 | 0 | null | 2021-04-26T17:48:22 | 2016-10-14T16:36:04 | Java | UTF-8 | Java | false | false | 245 | java | package com.jai.overriding;
public class Vehicle {
void maxSpeed() {
System.out.println("Vehicle max speed 30mph");
}
public int add(int x, int y) {
System.out.println("Vehicle add..");
return x+y;
}
}
| [
"[email protected]"
]
| |
db92b0e99dbb43c260a1c392735d74dc56fe71d8 | e90122fc6c3d480284619ed761578ecc79e63f58 | /app/src/main/java/marcos/movieapp/utils/schedulers/BaseSchedulerProvider.java | dbb6163b2492b180dd22b203f635d762a23fc106 | []
| no_license | suviano/MovieApp | 9bea6943586ed48df9ab53b15ccadc2d1c457caa | db2d2077d9c5daad86ce54fd0f43e20467c073a7 | refs/heads/master | 2021-08-19T01:41:38.071540 | 2017-11-24T11:20:12 | 2017-11-24T11:20:12 | 82,694,198 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 263 | java | package marcos.movieapp.utils.schedulers;
import android.support.annotation.NonNull;
import rx.Scheduler;
public interface BaseSchedulerProvider {
@NonNull
Scheduler computation();
@NonNull
Scheduler io();
@NonNull
Scheduler ui();
}
| [
"[email protected]"
]
| |
3bec0b602f750e28b845f65bc58ea6187f19152a | dcf03934ba39c7950b7bbbea512942edcca3d1e1 | /app/src/test/java/com/example/tanvi/otpscreens/ExampleUnitTest.java | ff08cc8d7ad540157f99a63af3720037591286f2 | []
| no_license | Tanvi-Goyal/OTP-Assignment | a3da8ec26c5f6ee8a89d4d0c9d2d84548547bdf9 | ff4c54fe50064efe6f3778e0dfdd73940a3af11b | refs/heads/master | 2020-04-15T05:51:56.330280 | 2019-01-09T14:12:50 | 2019-01-09T14:12:50 | 164,439,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.example.tanvi.otpscreens;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
3dfc1a58995f80b3a7cafe028597c4fcb0da66bc | 9261c01dae85871dafc45b19f0ac69ea530fe33a | /src/main/java/letscode/sarafan/repo/MessageRepo.java | 18953f23d2ac441994babc69e599ec53c38b24d0 | []
| no_license | davydoff001/sarafan | 6cfdb4bcdffa4fada9b41c42e704e5a59ecb0d01 | bf8d6531e8b55e165f5dd8d172a571140f7486ca | refs/heads/master | 2020-05-03T16:39:56.159724 | 2019-04-27T17:16:24 | 2019-04-27T17:16:24 | 178,728,102 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | 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 letscode.sarafan.repo;
import letscode.sarafan.domain.Message;
import org.springframework.data.jpa.repository.JpaRepository;
/**
*
* @author Alexandr
*/
public interface MessageRepo extends JpaRepository<Message, Long>{
}
| [
"Alexandr@Home-PC"
]
| Alexandr@Home-PC |
60d59eb921021e2cdd5fac41000d356fa58a962a | 045572fccef8b3695ed5b66d72be6e80b8bb285d | /app/src/main/java/com/xjhsk/exampad/utils/Md5CaculateUtil.java | a1bc951ad5a6d24e5e6680ef8c4c3ec06bd56370 | []
| no_license | arthur5987/ExamPad | a171ecd0c1b0338f47c60b17359cfacbac804e74 | a15bb654ce42f760b528c3f5ec04ff7ec0889d1e | refs/heads/master | 2020-03-25T01:36:11.449747 | 2018-07-26T06:05:48 | 2018-07-26T06:05:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 954 | java | package com.xjhsk.exampad.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.digest.DigestUtils;
public class Md5CaculateUtil {
public static String getHash(String fileName) throws IOException, NoSuchAlgorithmException{
File f = new File(fileName);
InputStream ins = new FileInputStream(f);
byte[] buffer = new byte[8192];
MessageDigest md5 = MessageDigest.getInstance("MD5");
int len;
while((len = ins.read(buffer)) != -1){
md5.update(buffer, 0, len);
}
ins.close();
// 也可以用apache自带的计算MD5方法
return new String(Hex.encodeHex(DigestUtils.md5(md5.digest())));
}
} | [
"[email protected]"
]
| |
23228f2d664dbf4ca54f777bc378e76d6216346b | ea7d2090ba1d66fc5bf91b255742ae07e1f74c3d | /2019/CONFidence/pudliszki/pudliszki_java/kotlin/text/UStringsKt.java | 3208dcdc48a996aa556b06825e72cd185ad08c78 | []
| no_license | arty-hlr/CTF-writeups | 1a3e29b9a3c3b80e33df0c9489cacd6ec09e46fe | 64bcda1d1d8893c2ece308f82348755a2c62ca9e | refs/heads/master | 2022-08-04T20:26:07.428393 | 2022-07-30T11:11:34 | 2022-07-30T11:11:34 | 167,851,059 | 4 | 3 | null | 2022-07-30T10:55:11 | 2019-01-27T19:47:03 | Python | UTF-8 | Java | false | false | 20,203 | java | package kotlin.text;
import kotlin.ExperimentalUnsignedTypes;
import kotlin.SinceKotlin;
import kotlin.UInt;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
@kotlin.Metadata(mv={1, 1, 13}, bv={1, 0, 3}, k=2, d1={"\000,\n\000\n\002\020\016\n\002\030\002\n\000\n\002\020\b\n\002\b\002\n\002\030\002\n\002\b\002\n\002\030\002\n\002\b\002\n\002\030\002\n\002\b\023\032\036\020\000\032\0020\001*\0020\0022\006\020\003\032\0020\004H\007ø\001\000¢\006\004\b\005\020\006\032\036\020\000\032\0020\001*\0020\0072\006\020\003\032\0020\004H\007ø\001\000¢\006\004\b\b\020\t\032\036\020\000\032\0020\001*\0020\n2\006\020\003\032\0020\004H\007ø\001\000¢\006\004\b\013\020\f\032\036\020\000\032\0020\001*\0020\r2\006\020\003\032\0020\004H\007ø\001\000¢\006\004\b\016\020\017\032\024\020\020\032\0020\002*\0020\001H\007ø\001\000¢\006\002\020\021\032\034\020\020\032\0020\002*\0020\0012\006\020\003\032\0020\004H\007ø\001\000¢\006\002\020\022\032\021\020\023\032\004\030\0010\002*\0020\001H\007ø\001\000\032\031\020\023\032\004\030\0010\002*\0020\0012\006\020\003\032\0020\004H\007ø\001\000\032\024\020\024\032\0020\007*\0020\001H\007ø\001\000¢\006\002\020\025\032\034\020\024\032\0020\007*\0020\0012\006\020\003\032\0020\004H\007ø\001\000¢\006\002\020\026\032\021\020\027\032\004\030\0010\007*\0020\001H\007ø\001\000\032\031\020\027\032\004\030\0010\007*\0020\0012\006\020\003\032\0020\004H\007ø\001\000\032\024\020\030\032\0020\n*\0020\001H\007ø\001\000¢\006\002\020\031\032\034\020\030\032\0020\n*\0020\0012\006\020\003\032\0020\004H\007ø\001\000¢\006\002\020\032\032\021\020\033\032\004\030\0010\n*\0020\001H\007ø\001\000\032\031\020\033\032\004\030\0010\n*\0020\0012\006\020\003\032\0020\004H\007ø\001\000\032\024\020\034\032\0020\r*\0020\001H\007ø\001\000¢\006\002\020\035\032\034\020\034\032\0020\r*\0020\0012\006\020\003\032\0020\004H\007ø\001\000¢\006\002\020\036\032\021\020\037\032\004\030\0010\r*\0020\001H\007ø\001\000\032\031\020\037\032\004\030\0010\r*\0020\0012\006\020\003\032\0020\004H\007ø\001\000\002\004\n\002\b\031¨\006 "}, d2={"toString", "", "Lkotlin/UByte;", "radix", "", "toString-LxnNnR4", "(BI)Ljava/lang/String;", "Lkotlin/UInt;", "toString-V7xB4Y4", "(II)Ljava/lang/String;", "Lkotlin/ULong;", "toString-JSWoG40", "(JI)Ljava/lang/String;", "Lkotlin/UShort;", "toString-olVBNx4", "(SI)Ljava/lang/String;", "toUByte", "(Ljava/lang/String;)B", "(Ljava/lang/String;I)B", "toUByteOrNull", "toUInt", "(Ljava/lang/String;)I", "(Ljava/lang/String;I)I", "toUIntOrNull", "toULong", "(Ljava/lang/String;)J", "(Ljava/lang/String;I)J", "toULongOrNull", "toUShort", "(Ljava/lang/String;)S", "(Ljava/lang/String;I)S", "toUShortOrNull", "kotlin-stdlib"})
@kotlin.jvm.JvmName(name="UStringsKt")
public final class UStringsKt
{
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@NotNull
public static final String toString-LxnNnR4(byte $receiver, int radix)
{
int i = $receiver;i &= 0xFF; String tmp16_13 = Integer.toString(i, CharsKt.checkRadix(radix));Intrinsics.checkExpressionValueIsNotNull(tmp16_13, "java.lang.Integer.toStri…(this, checkRadix(radix))");return tmp16_13;
}
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@NotNull
public static final String toString-olVBNx4(short $receiver, int radix)
{
int i = $receiver;i &= 0xFFFF; String tmp15_12 = Integer.toString(i, CharsKt.checkRadix(radix));Intrinsics.checkExpressionValueIsNotNull(tmp15_12, "java.lang.Integer.toStri…(this, checkRadix(radix))");return tmp15_12;
}
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@NotNull
public static final String toString-V7xB4Y4(int $receiver, int radix)
{
int i = $receiver;long l = i & 0xFFFFFFFF; String tmp17_14 = Long.toString(l, CharsKt.checkRadix(radix));Intrinsics.checkExpressionValueIsNotNull(tmp17_14, "java.lang.Long.toString(this, checkRadix(radix))");return tmp17_14;
}
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@NotNull
public static final String toString-JSWoG40(long $receiver, int radix)
{
long l = $receiver;return kotlin.UnsignedKt.ulongToString(l, CharsKt.checkRadix(radix));
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
public static final byte toUByte(@NotNull String $receiver)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: invokestatic 70 kotlin/text/UStringsKt:toUByteOrNull (Ljava/lang/String;)Lkotlin/UByte;
// 10: dup
// 11: ifnull +9 -> 20
// 14: invokevirtual 76 kotlin/UByte:unbox-impl ()B
// 17: goto +10 -> 27
// 20: pop
// 21: aload_0
// 22: invokestatic 82 kotlin/text/StringsKt:numberFormatError (Ljava/lang/String;)Ljava/lang/Void;
// 25: aconst_null
// 26: athrow
// 27: ireturn
// Line number table:
// Java source line #57 -> byte code offset #6
// Local variable table:
// start length slot name signature
// 0 28 0 $receiver String
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
public static final byte toUByte(@NotNull String $receiver, int radix)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: iload_1
// 8: invokestatic 87 kotlin/text/UStringsKt:toUByteOrNull (Ljava/lang/String;I)Lkotlin/UByte;
// 11: dup
// 12: ifnull +9 -> 21
// 15: invokevirtual 76 kotlin/UByte:unbox-impl ()B
// 18: goto +10 -> 28
// 21: pop
// 22: aload_0
// 23: invokestatic 82 kotlin/text/StringsKt:numberFormatError (Ljava/lang/String;)Ljava/lang/Void;
// 26: aconst_null
// 27: athrow
// 28: ireturn
// Line number table:
// Java source line #66 -> byte code offset #6
// Local variable table:
// start length slot name signature
// 0 29 0 $receiver String
// 0 29 1 radix int
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
public static final short toUShort(@NotNull String $receiver)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: invokestatic 93 kotlin/text/UStringsKt:toUShortOrNull (Ljava/lang/String;)Lkotlin/UShort;
// 10: dup
// 11: ifnull +9 -> 20
// 14: invokevirtual 98 kotlin/UShort:unbox-impl ()S
// 17: goto +10 -> 27
// 20: pop
// 21: aload_0
// 22: invokestatic 82 kotlin/text/StringsKt:numberFormatError (Ljava/lang/String;)Ljava/lang/Void;
// 25: aconst_null
// 26: athrow
// 27: ireturn
// Line number table:
// Java source line #75 -> byte code offset #6
// Local variable table:
// start length slot name signature
// 0 28 0 $receiver String
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
public static final short toUShort(@NotNull String $receiver, int radix)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: iload_1
// 8: invokestatic 102 kotlin/text/UStringsKt:toUShortOrNull (Ljava/lang/String;I)Lkotlin/UShort;
// 11: dup
// 12: ifnull +9 -> 21
// 15: invokevirtual 98 kotlin/UShort:unbox-impl ()S
// 18: goto +10 -> 28
// 21: pop
// 22: aload_0
// 23: invokestatic 82 kotlin/text/StringsKt:numberFormatError (Ljava/lang/String;)Ljava/lang/Void;
// 26: aconst_null
// 27: athrow
// 28: ireturn
// Line number table:
// Java source line #84 -> byte code offset #6
// Local variable table:
// start length slot name signature
// 0 29 0 $receiver String
// 0 29 1 radix int
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
public static final int toUInt(@NotNull String $receiver)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: invokestatic 108 kotlin/text/UStringsKt:toUIntOrNull (Ljava/lang/String;)Lkotlin/UInt;
// 10: dup
// 11: ifnull +9 -> 20
// 14: invokevirtual 113 kotlin/UInt:unbox-impl ()I
// 17: goto +10 -> 27
// 20: pop
// 21: aload_0
// 22: invokestatic 82 kotlin/text/StringsKt:numberFormatError (Ljava/lang/String;)Ljava/lang/Void;
// 25: aconst_null
// 26: athrow
// 27: ireturn
// Line number table:
// Java source line #92 -> byte code offset #6
// Local variable table:
// start length slot name signature
// 0 28 0 $receiver String
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
public static final int toUInt(@NotNull String $receiver, int radix)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: iload_1
// 8: invokestatic 117 kotlin/text/UStringsKt:toUIntOrNull (Ljava/lang/String;I)Lkotlin/UInt;
// 11: dup
// 12: ifnull +9 -> 21
// 15: invokevirtual 113 kotlin/UInt:unbox-impl ()I
// 18: goto +10 -> 28
// 21: pop
// 22: aload_0
// 23: invokestatic 82 kotlin/text/StringsKt:numberFormatError (Ljava/lang/String;)Ljava/lang/Void;
// 26: aconst_null
// 27: athrow
// 28: ireturn
// Line number table:
// Java source line #101 -> byte code offset #6
// Local variable table:
// start length slot name signature
// 0 29 0 $receiver String
// 0 29 1 radix int
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
public static final long toULong(@NotNull String $receiver)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: invokestatic 123 kotlin/text/UStringsKt:toULongOrNull (Ljava/lang/String;)Lkotlin/ULong;
// 10: dup
// 11: ifnull +9 -> 20
// 14: invokevirtual 128 kotlin/ULong:unbox-impl ()J
// 17: goto +10 -> 27
// 20: pop
// 21: aload_0
// 22: invokestatic 82 kotlin/text/StringsKt:numberFormatError (Ljava/lang/String;)Ljava/lang/Void;
// 25: aconst_null
// 26: athrow
// 27: lreturn
// Line number table:
// Java source line #109 -> byte code offset #6
// Local variable table:
// start length slot name signature
// 0 28 0 $receiver String
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
public static final long toULong(@NotNull String $receiver, int radix)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: iload_1
// 8: invokestatic 132 kotlin/text/UStringsKt:toULongOrNull (Ljava/lang/String;I)Lkotlin/ULong;
// 11: dup
// 12: ifnull +9 -> 21
// 15: invokevirtual 128 kotlin/ULong:unbox-impl ()J
// 18: goto +10 -> 28
// 21: pop
// 22: aload_0
// 23: invokestatic 82 kotlin/text/StringsKt:numberFormatError (Ljava/lang/String;)Ljava/lang/Void;
// 26: aconst_null
// 27: athrow
// 28: lreturn
// Line number table:
// Java source line #118 -> byte code offset #6
// Local variable table:
// start length slot name signature
// 0 29 0 $receiver String
// 0 29 1 radix int
}
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@org.jetbrains.annotations.Nullable
public static final kotlin.UByte toUByteOrNull(@NotNull String $receiver)
{
Intrinsics.checkParameterIsNotNull($receiver, "receiver$0");return toUByteOrNull($receiver, 10);
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@org.jetbrains.annotations.Nullable
public static final kotlin.UByte toUByteOrNull(@NotNull String $receiver, int radix)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: iload_1
// 8: invokestatic 117 kotlin/text/UStringsKt:toUIntOrNull (Ljava/lang/String;I)Lkotlin/UInt;
// 11: dup
// 12: ifnull +9 -> 21
// 15: invokevirtual 113 kotlin/UInt:unbox-impl ()I
// 18: goto +6 -> 24
// 21: pop
// 22: aconst_null
// 23: areturn
// 24: istore_2
// 25: iload_2
// 26: istore_3
// 27: iconst_m1
// 28: istore 4
// 30: iload_3
// 31: istore 5
// 33: iload 4
// 35: istore 6
// 37: iload 6
// 39: sipush 255
// 42: iand
// 43: invokestatic 136 kotlin/UInt:constructor-impl (I)I
// 46: istore 6
// 48: iload 5
// 50: iload 6
// 52: invokestatic 140 kotlin/UnsignedKt:uintCompare (II)I
// 55: ifle +5 -> 60
// 58: aconst_null
// 59: areturn
// 60: iload_2
// 61: istore_3
// 62: iload_3
// 63: istore 4
// 65: iload 4
// 67: i2b
// 68: invokestatic 143 kotlin/UByte:constructor-impl (B)B
// 71: invokestatic 147 kotlin/UByte:box-impl (B)Lkotlin/UByte;
// 74: areturn
// Line number table:
// Java source line #141 -> byte code offset #6
// Java source line #142 -> byte code offset #25
// Java source line #142 -> byte code offset #58
// Java source line #143 -> byte code offset #60
// Local variable table:
// start length slot name signature
// 0 75 0 $receiver String
// 0 75 1 radix int
// 25 50 2 int int
}
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@org.jetbrains.annotations.Nullable
public static final kotlin.UShort toUShortOrNull(@NotNull String $receiver)
{
Intrinsics.checkParameterIsNotNull($receiver, "receiver$0");return toUShortOrNull($receiver, 10);
}
/* Error */
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@org.jetbrains.annotations.Nullable
public static final kotlin.UShort toUShortOrNull(@NotNull String $receiver, int radix)
{
// Byte code:
// 0: aload_0
// 1: ldc 63
// 3: invokestatic 66 kotlin/jvm/internal/Intrinsics:checkParameterIsNotNull (Ljava/lang/Object;Ljava/lang/String;)V
// 6: aload_0
// 7: iload_1
// 8: invokestatic 117 kotlin/text/UStringsKt:toUIntOrNull (Ljava/lang/String;I)Lkotlin/UInt;
// 11: dup
// 12: ifnull +9 -> 21
// 15: invokevirtual 113 kotlin/UInt:unbox-impl ()I
// 18: goto +6 -> 24
// 21: pop
// 22: aconst_null
// 23: areturn
// 24: istore_2
// 25: iload_2
// 26: istore_3
// 27: iconst_m1
// 28: istore 4
// 30: iload_3
// 31: istore 5
// 33: iload 4
// 35: istore 6
// 37: iload 6
// 39: ldc 41
// 41: iand
// 42: invokestatic 136 kotlin/UInt:constructor-impl (I)I
// 45: istore 6
// 47: iload 5
// 49: iload 6
// 51: invokestatic 140 kotlin/UnsignedKt:uintCompare (II)I
// 54: ifle +5 -> 59
// 57: aconst_null
// 58: areturn
// 59: iload_2
// 60: istore_3
// 61: iload_3
// 62: istore 4
// 64: iload 4
// 66: i2s
// 67: invokestatic 153 kotlin/UShort:constructor-impl (S)S
// 70: invokestatic 156 kotlin/UShort:box-impl (S)Lkotlin/UShort;
// 73: areturn
// Line number table:
// Java source line #163 -> byte code offset #6
// Java source line #164 -> byte code offset #25
// Java source line #164 -> byte code offset #57
// Java source line #165 -> byte code offset #59
// Local variable table:
// start length slot name signature
// 0 74 0 $receiver String
// 0 74 1 radix int
// 25 49 2 int int
}
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@org.jetbrains.annotations.Nullable
public static final UInt toUIntOrNull(@NotNull String $receiver)
{
Intrinsics.checkParameterIsNotNull($receiver, "receiver$0");return toUIntOrNull($receiver, 10);
}
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@org.jetbrains.annotations.Nullable
public static final UInt toUIntOrNull(@NotNull String $receiver, int radix)
{
Intrinsics.checkParameterIsNotNull($receiver, "receiver$0");CharsKt.checkRadix(radix);
int length = $receiver.length();
if (length == 0) { return null;
}
int limit = -1;
int start;
char firstChar = $receiver.charAt(0);
if (firstChar < '0') {
if ((length == 1) || (firstChar != '+')) return null;
start = 1;
} else {
start = 0;
}
int i = radix;int uradix = UInt.constructor-impl(i);
int j = limit;int limitBeforeMul = kotlin.UnsignedKt.uintDivide-J1ME1BU(j, uradix);
int result = 0;
int k = start; int i; for (int m = length; k < m; i++) {
int digit = CharsKt.digitOf($receiver.charAt(i), radix);
if (digit < 0) return null;
int n = result; if (kotlin.UnsignedKt.uintCompare(n, limitBeforeMul) > 0) { return null;
}
n = result;result = UInt.constructor-impl(n * uradix);
int beforeAdding = result;
int i1 = result;int i2 = digit;i2 = UInt.constructor-impl(i2);result = UInt.constructor-impl(i1 + i2);
i1 = result; if (kotlin.UnsignedKt.uintCompare(i1, beforeAdding) < 0) { return null;
}
}
return UInt.box-impl(result);
}
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@org.jetbrains.annotations.Nullable
public static final kotlin.ULong toULongOrNull(@NotNull String $receiver)
{
Intrinsics.checkParameterIsNotNull($receiver, "receiver$0");return toULongOrNull($receiver, 10);
}
@SinceKotlin(version="1.3")
@ExperimentalUnsignedTypes
@org.jetbrains.annotations.Nullable
public static final kotlin.ULong toULongOrNull(@NotNull String $receiver, int radix)
{
Intrinsics.checkParameterIsNotNull($receiver, "receiver$0");CharsKt.checkRadix(radix);
int length = $receiver.length();
if (length == 0) { return null;
}
long limit = -1L;
int start;
char firstChar = $receiver.charAt(0);
if (firstChar < '0') {
if ((length == 1) || (firstChar != '+')) return null;
start = 1;
} else {
start = 0;
}
int i = radix;int uradix = UInt.constructor-impl(i);
long l1 = limit;long l2 = l1;int m = uradix;long l3 = kotlin.ULong.constructor-impl(m & 0xFFFFFFFF);long limitBeforeMul = kotlin.UnsignedKt.ulongDivide-eb3DHEI(l2, l3);
long result = 0L;
int j = start; int i; for (int k = length; j < k; i++) {
int digit = CharsKt.digitOf($receiver.charAt(i), radix);
if (digit < 0) return null;
l3 = result; if (kotlin.UnsignedKt.ulongCompare(l3, limitBeforeMul) > 0) { return null;
}
l3 = result;long l4 = l3;int n = uradix;long l5 = kotlin.ULong.constructor-impl(n & 0xFFFFFFFF);result = kotlin.ULong.constructor-impl(l4 * l5);
long beforeAdding = result;
l4 = result;n = digit;n = UInt.constructor-impl(n);l5 = l4;int i1 = n;long l6 = kotlin.ULong.constructor-impl(i1 & 0xFFFFFFFF);result = kotlin.ULong.constructor-impl(l5 + l6);
l4 = result; if (kotlin.UnsignedKt.ulongCompare(l4, beforeAdding) < 0) { return null;
}
}
return kotlin.ULong.box-impl(result);
}
}
| [
"[email protected]"
]
| |
211f467b33522097ce5586504653030ba4a8cb48 | 687fa1cabf5743dcd974d041c81078b92d6e7282 | /src/main/java/com/yjh/demo/application/permission/representation/PermissionRepresentation.java | 282b0da79eef0e80a60ac53734529ff6aeaf0051 | []
| no_license | KINGYJH/YJH_DEMO | 2a9f9f4d606ec4c386d4ddf009d4896f15994f70 | ba13d6d0e348ea19f3a49efbeb902097672e9356 | refs/heads/master | 2021-01-18T22:34:14.972468 | 2016-06-03T08:34:48 | 2016-06-03T08:34:48 | 55,053,002 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,838 | java | package com.yjh.demo.application.permission.representation;
import com.yjh.demo.application.appkey.representation.AppKeyRepresentation;
import com.yjh.demo.core.enums.EnableStatus;
import java.util.Date;
/**
* Created by YJH on 2016/3/30 0030.
*/
public class PermissionRepresentation {
private String id;
private Integer version;
private Date createDate;
private String name; //权限名称
private String description; //权限描述
private String value; //权限默认值
private AppKeyRepresentation appKey; //应用标识
private EnableStatus status; //状态
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public AppKeyRepresentation getAppKey() {
return appKey;
}
public void setAppKey(AppKeyRepresentation appKey) {
this.appKey = appKey;
}
public EnableStatus getStatus() {
return status;
}
public void setStatus(EnableStatus status) {
this.status = status;
}
}
| [
"[email protected]"
]
| |
412a35fa93dfe9d068b7747c2da603a1d3d4d7ec | 0ab40b3dede709e1b7d4163fa04a2af6a2bc55bc | /imgui-core/src/main/java/com/github/xpenatan/imgui/ImGuiFloat.java | 67217cb2ac0b006398e3c5501fd8e9d9bc1195d6 | [
"Apache-2.0"
]
| permissive | gamethapcam/jDear-imgui | 3bb1b0d0d586d533b16eb9c1cfd04fc47e276b7a | a093767ea8682fb2133ac129420a11544531d794 | refs/heads/master | 2023-06-06T02:20:31.691700 | 2021-06-27T15:42:10 | 2021-06-27T15:42:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | package com.github.xpenatan.imgui;
public class ImGuiFloat {
public static ImGuiFloat TMP = new ImGuiFloat();
float [] data = new float[] { 0.0f };
public ImGuiFloat() {}
public ImGuiFloat(float value) {
setValue(value);
}
public void setValue(float value) {
this.data[0] = value;
}
public float getValue() {
return this.data[0];
}
@Override
public String toString() {
return String.valueOf(getValue());
}
}
| [
"[email protected]"
]
| |
805b4b0c638d4820230561ffe3ab53acb762d5df | 1e4f7f1816cf0c234a00e77f033a7dfd62bd5336 | /src/com/tcs/threads/Worker.java | b1c1475236e02fe251ac1b09ca41c974160286fc | []
| no_license | ruthvikvachhani/java-learning | 7875e3aa36cd654fd7c6037a3a226d4e70485544 | 311ef75de79ac94b5a5bbfd376d5ec03399e9cf7 | refs/heads/main | 2023-07-15T21:48:35.929288 | 2021-08-18T12:04:40 | 2021-08-18T12:04:40 | 394,278,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.tcs.threads;
public class Worker implements Runnable{
@Override
public void run() {
System.out.println(Thread.currentThread());
try {
Thread.sleep(9999);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
e0359af1d2132a98336ef812991f4328fb73d9c8 | 10d8ec167cd20804d9fc13964b9c664a812283d8 | /app/src/main/java/com/example/nlushop/view/dangNhap_dangKy/fragment/FragmentDangKy.java | bb037399d3dfa93d63f49113a4e68fb16e2f036b | []
| no_license | vanluanp/appBanHang | 7904e0fa0d2c646a4c07d549f5d08e0d7b4fb131 | c7634445622f7135c650e6238f6121844a16603d | refs/heads/master | 2023-08-16T15:31:37.767078 | 2021-10-13T00:35:54 | 2021-10-13T00:35:54 | 416,539,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,257 | java | package com.example.nlushop.view.dangNhap_dangKy.fragment;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
import androidx.fragment.app.Fragment;
import com.example.nlushop.R;
import com.example.nlushop.customView.PasswordEditText;
import com.example.nlushop.model.dangNhap_dangKy.ModelDangNhap;
import com.example.nlushop.model.objectClass.NhanVien;
import com.example.nlushop.presenter.dangKy.PresenterLogicDangKy;
import com.example.nlushop.view.dangNhap_dangKy.ViewDangKy;
import com.example.nlushop.view.trangChu.TrangChuActivity;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.material.textfield.TextInputLayout;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class FragmentDangKy extends Fragment implements ViewDangKy, View.OnClickListener, View.OnFocusChangeListener, GoogleApiClient.OnConnectionFailedListener {
PresenterLogicDangKy presenterLogicDangKy;
Button btnDangKy;
EditText edHoTen, edDiaChiEmail, edMatKhau, edNhapLaiMatKhau;
SwitchCompat switchEmailDocQuyen;
TextInputLayout input_edHoTen, input_edMatKhau, input_edDiaChiEmail, input_edNhapLaiMatKhau;
String MATCHER_PATTERN = "((?=.*\\d)(?=.*[A-Z])(?=.*[a-z]).{6,20})";
Pattern pattern;
Matcher matcher;
Boolean kiemtrathongtin = false;
Button btnDangNhapFBDK, btnDangNhapGGDK;
CallbackManager callbackManager;
GoogleApiClient mGoogleApiClient;
public static int SIGN_IN_GOOGLE_PLUS = 8888;
ProgressDialog progressDialog;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.layout_fragment_dangky, container, false);
//Tạo đăng nhập GG
ModelDangNhap modelDangNhap = new ModelDangNhap();
//Đặt id 1 cho fragment dang ky
mGoogleApiClient = modelDangNhap.LayGoogleApiClient(getContext(), 1, this);
//Tạo đăng nhập FB
FacebookSdk.sdkInitialize(getContext().getApplicationContext());
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Log.d("kiemtra","Dang nhap FB thanh cong!");
progressDialog.cancel();//Tắt vòng xoay chờ
Intent iTrangChu = new Intent(getActivity(), TrangChuActivity.class);
startActivity(iTrangChu);
}
@Override
public void onCancel() {
Log.d("kiemtra","Dang nhap FB thoat!");
}
@Override
public void onError(FacebookException error) {
Log.d("kiemtra","Dang nhap FB error!");
}
});
btnDangNhapFBDK = view.findViewById(R.id.btnDangNhapFBDK);
btnDangNhapGGDK = view.findViewById(R.id.btnDangNhapGGDK);
btnDangNhapFBDK.setOnClickListener(this);
btnDangNhapGGDK.setOnClickListener(this);
presenterLogicDangKy = new PresenterLogicDangKy(this);
btnDangKy = view.findViewById(R.id.btnDangKy);
edHoTen = view.findViewById(R.id.edHoTenDangKy);
edDiaChiEmail = view.findViewById(R.id.edDiaChiEmailDangKy);
edMatKhau = view.findViewById(R.id.edMatKhauDangKy);
edNhapLaiMatKhau = view.findViewById(R.id.edNhapLaiMatKhauDangKy);
switchEmailDocQuyen = view.findViewById(R.id.switchEmailDocQuyen);
input_edHoTen = view.findViewById(R.id.input_edHoTenDangKy);
input_edDiaChiEmail = view.findViewById(R.id.input_edDiaChiEmailDangKy);
input_edMatKhau = view.findViewById(R.id.input_edMatKhauDangKy);
input_edNhapLaiMatKhau = view.findViewById(R.id.input_edNhapLaiMatKhauDangKy);
// textInputLayout = view.findViewById(R.id.input_edMatKhauDangKy);
// textInputLayout.setMinimumWidth(300);
// passwordEditText = view.findViewById(R.id.edMatKhauDangKy);
btnDangKy.setOnClickListener(this);
edHoTen.setOnFocusChangeListener(this);
edDiaChiEmail.setOnFocusChangeListener(this);
edMatKhau.setOnFocusChangeListener(this);
edNhapLaiMatKhau.setOnFocusChangeListener(this);
// confirmInput(view);
return view;
}
// private boolean validatePassword(){
// String pass = input_edMatKhau.getEditText().getText().toString().trim();
//
// if(pass.isEmpty()){
// input_edMatKhau.setErrorEnabled(true);
// input_edMatKhau.setError("Không thể bỏ trống!");
// return false;
// }else{
// input_edMatKhau.setErrorEnabled(false);
// input_edMatKhau.setError(null);
// return true;
// }
// }
// private void confirmInput(View view){
//// if(!validatePassword()){
//// return;
//// }
// this.pattern = Pattern.compile(MATCHER_PATTERN);
//
// input_edMatKhau = view.findViewById(R.id.input_edMatKhauDangKy);
// edMatKhau = view.findViewById(R.id.edMatKhauDangKy);
//
// edMatKhau.setOnFocusChangeListener(new View.OnFocusChangeListener() {
// @Override
// public void onFocusChange(View v, boolean hasFocus) {
// if(!hasFocus){
// String chuoi = edMatKhau.getText().toString();
// matcher = pattern.matcher(chuoi);
//
// if(matcher.matches()){
// input_edMatKhau.setError(null);
// input_edMatKhau.setErrorEnabled(false);
// }else{
// input_edMatKhau.setErrorEnabled(true);
// input_edMatKhau.setError("Mật khẩu phải bao gồm 6 kí tự, 1 chữ hoa và 1 chữ số");
// }
// }
// }
// });
//
// }
@Override
public void DangKyThanhCong() {
Toast.makeText(getActivity(), "Đăng ký thành công!", Toast.LENGTH_SHORT).show();
}
@Override
public void DangKyThatBai() {
// Toast.makeText(getActivity(), "Đăng ký thất bại!", Toast.LENGTH_SHORT).show();
//Có như không, vì không chạy hàm presenterLogicDangKy.ThucHienDangKy(nhanVien) nếu kiemtrathongtin = false
}
@Override
public void onClick(View v) {
int id = v.getId();
switch (id) {
case R.id.btnDangKy:
btnDangKy();
break;
case R.id.btnDangNhapFBDK:
//Hiển thị vòng xoay chờ
showProgressDialog();
LoginManager.getInstance().logInWithReadPermissions(FragmentDangKy.this, Arrays.asList("public_profile")) ;
break;
case R.id.btnDangNhapGGDK:
//Hiển thị vòng xoay chờ
showProgressDialog();
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
//Lưu ý: start sẽ chạy vào onActivityForResult
startActivityForResult(signInIntent, SIGN_IN_GOOGLE_PLUS);
break;
}
}
//Hiển thị vòng xoay chờ
private void showProgressDialog(){
if(progressDialog == null){
progressDialog = new ProgressDialog(getContext());
progressDialog.setMessage("Vui lòng đợi");
progressDialog.setIndeterminate(true);
}
progressDialog.show();
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//gọi login with FB
callbackManager.onActivityResult(requestCode, resultCode, data);
//nếu requestcode nhận được == SIGN_IN_GOOGLE_PLUS
if(requestCode == SIGN_IN_GOOGLE_PLUS){
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
// Log.d("googlemail", result.getSignInAccount().getEmail());
if(result.isSuccess()){
progressDialog.cancel();//Tắt vòng xoay chờ
Intent iTrangChu = new Intent(getActivity(), TrangChuActivity.class);
startActivity(iTrangChu);
}
}
}
//Mặc định là true vì switch mặc định là true
String emailDocQuyen = "true";
private void btnDangKy() {
String hoten = edHoTen.getText().toString();
String email = edDiaChiEmail.getText().toString();
String matKhau = edMatKhau.getText().toString();
// String nhapLaiMatKhau = edNhapLaiMatKhau.getText().toString();
switchEmailDocQuyen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
emailDocQuyen = isChecked + "";
}
});
if (kiemtrathongtin) {
NhanVien nhanVien = new NhanVien();
nhanVien.setTenNV(hoten);
nhanVien.setTenDangNhap(email);
nhanVien.setMatKhau(matKhau);
nhanVien.setEmailDocQuyen(emailDocQuyen);
nhanVien.setMaLoaiNV(2);
presenterLogicDangKy.ThucHienDangKy(nhanVien);
} else {
Toast.makeText(getActivity(), "Đăng ký thất bại!", Toast.LENGTH_SHORT).show();
Log.d("kiemtradk", "Dang ky that bai!");
}
}
@Override
public void onFocusChange(View v, boolean hasFocus) {
int id = v.getId();
switch (id) {
case R.id.edHoTenDangKy:
if (!hasFocus) {
String chuoi = ((EditText) v).getText().toString();
if (chuoi.trim().equals("") || chuoi.trim().equals(null)) {
kiemtrathongtin = false;
input_edHoTen.setError("Vui không để trống mục này!");
input_edHoTen.setErrorEnabled(true);
} else {
kiemtrathongtin = true;
input_edHoTen.setError("");
input_edHoTen.setErrorEnabled(false);
}
}
break;
case R.id.edDiaChiEmailDangKy:
if (!hasFocus) {
String chuoi = ((EditText) v).getText().toString();
if (chuoi.trim().equals("") || chuoi.trim().equals(null)) {
kiemtrathongtin = false;
input_edDiaChiEmail.setError("Vui không để trống mục này!");
input_edDiaChiEmail.setErrorEnabled(true);
} else {
Boolean kiemTraEmail = Patterns.EMAIL_ADDRESS.matcher(chuoi).matches();
if (!kiemTraEmail) {
kiemtrathongtin = false;
input_edDiaChiEmail.setError("Đây không phải địa chỉ email!");
input_edDiaChiEmail.setErrorEnabled(true);
} else {
kiemtrathongtin = true;
input_edDiaChiEmail.setError("");
input_edDiaChiEmail.setErrorEnabled(false);
}
}
}
break;
case R.id.edMatKhauDangKy:
this.pattern = Pattern.compile(MATCHER_PATTERN);
if (!hasFocus) {
String chuoi = ((EditText) v).getText().toString();
matcher = pattern.matcher(chuoi);
if (matcher.matches()) {
kiemtrathongtin = true;
input_edMatKhau.setError("");
input_edMatKhau.setErrorEnabled(false);
} else {
kiemtrathongtin = false;
input_edMatKhau.setErrorEnabled(true);
input_edMatKhau.setError("Mật khẩu phải bao gồm 6 kí tự, 1 chữ hoa và 1 chữ số");
}
}
break;
case R.id.edNhapLaiMatKhauDangKy:
if (!hasFocus) {
String chuoi = ((EditText) v).getText().toString();
String matkhau = edMatKhau.getText().toString();
if (!chuoi.equals(matkhau)) {
kiemtrathongtin = false;
input_edNhapLaiMatKhau.setErrorEnabled(true);
input_edNhapLaiMatKhau.setError("Vui lòng nhập trùng mật khẩu!");
} else {
kiemtrathongtin = true;
input_edNhapLaiMatKhau.setError("");
input_edNhapLaiMatKhau.setErrorEnabled(false);
}
}
break;
}
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
progressDialog.cancel();//khi đăng nhập lỗi tắt vòng xoay chờ
}
}
| [
"[email protected]"
]
| |
3cd4e44876d1a0641f84ec0ec089dd244f269546 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.browser-base/sources/org/chromium/components/embedder_support/delegate/WebContentsDelegateAndroid.java | 0ea67600c63e3bb0fead668df484f06ba91a617e | []
| no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 2,203 | java | package org.chromium.components.embedder_support.delegate;
import android.view.KeyEvent;
import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.common.ResourceRequestBody;
import org.chromium.url.GURL;
/* compiled from: chromium-OculusBrowser.apk-stable-281887347 */
public class WebContentsDelegateAndroid {
public int a() {
return 0;
}
public void activateContents() {
}
public boolean addMessageToConsole(int i, String str, int i2, String str2) {
return false;
}
public void closeContents() {
}
public void enterFullscreenModeForTab(boolean z) {
}
public void exitFullscreenModeForTab() {
}
public void fullscreenStateChangedForTab(boolean z) {
}
public int getBottomControlsHeight() {
return 0;
}
public int getBottomControlsMinHeight() {
return 0;
}
public final int getDisplayModeChecked() {
return a();
}
public int getTopControlsHeight() {
return 0;
}
public int getTopControlsMinHeight() {
return 0;
}
public void handleKeyboardEvent(KeyEvent keyEvent) {
}
public boolean isFullscreenForTabOrPending() {
return false;
}
public void loadingStateChanged(boolean z) {
}
public void navigationStateChanged(int i) {
}
public void onUpdateUrl(GURL gurl) {
}
public void openNewTab(GURL gurl, String str, ResourceRequestBody resourceRequestBody, int i, boolean z) {
}
public void rendererResponsive() {
}
public void rendererUnresponsive() {
}
public boolean shouldAnimateBrowserControlsHeightChanges() {
return false;
}
public boolean shouldBlockMediaRequest(GURL gurl) {
return false;
}
public boolean shouldCreateWebContents(GURL gurl) {
return true;
}
public void showRepostFormWarningDialog() {
}
public boolean takeFocus(boolean z) {
return false;
}
public void visibleSSLStateChanged() {
}
public void webContentsCreated(WebContents webContents, long j, long j2, String str, GURL gurl, WebContents webContents2) {
}
}
| [
"[email protected]"
]
| |
644a7c4a4bbc3faa7c17cfb5457955452de688d2 | 7005153fb48f3267203c0cc32ba38fbb340ec635 | /src/searching.java | 5cd4058bbed725bed04ee6479eb0a7156bd88cfb | []
| no_license | tajinders360/myproject | 7cb83cb26da7b238845be6ef97e131d5d7b70dd8 | a9e276b068833e7e7bdab43c8ce3810096dd7731 | refs/heads/master | 2021-01-01T04:41:28.666597 | 2017-07-14T11:07:13 | 2017-07-14T11:07:13 | 97,224,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,398 | java |
public class searching {
/*//linear search or sequential search
public static int linearsearch(int[] arr, int key)
{
for(int i =0;i<arr.length;i++)
{
if(arr[i]==key)
{
return i;
}
}
return 0;
}
public static void main(String[] args) {
int [] arr1={10,5,15,20};
int index= 15;
System.out.println("index of key: " + linearsearch(arr1, index));
}
*/
//bubble sort
/*
public static void bubblesort(int[] arr)
{
int temp =0;
for (int i=0;i<arr.length;i++)
{
for (int j=1;j<arr.length;j++)
{
if(arr[j-1]>arr[j])
{
temp=arr[j-1];
arr[j-1]=arr[j];
arr[j]=temp;
}
}
}
}
public static void main(String[] args) {
int[] arr={10, 5, 15, 7, 20};
bubblesort(arr);
for (int i=0;i<arr.length;i++)
{
System.out.println(arr[i]);
}
}
*/
//recursion finite/factorial
/*
static int count=0;
static void p(){
count++;
if(count<=5)
System.out.println("hello " +count);
p();
}
public static void main(String[] args) {
//p();
System.out.println(fac(10));
}
static int fac(int n)
{
if(n==1)
return 1;
else
return(n * fac(n-1));
}
*/
//selection sort
/*public static void selectionsort(int[] arr)
{
for (int i=0;i<arr.length;i++)
{
int index =i;
for (int j=i+1;j<arr.length;j++)
{
if(arr[j]<arr[index])
{
index =j;
}
}
int s= arr[index];
arr[index]=arr[i];
arr[i]=s;
}
}
public static void main(String[] args) {
int[] arr={10, 5, 15, 7, 20};
selectionsort(arr);
for (int i=0;i<arr.length;i++)
{
System.out.println(arr[i]);
}
}
*/
//reverse a string
public static void main(String[] args) {
String test="I am Tajinder";
String test1="";
for(int i=test.length()-1;i>=0;i--)
{
test1= test1 + test.charAt(i);
}
System.out.println("Print the string: " + test1);
//Using stringbuilder class
StringBuilder sb= new StringBuilder(test);
System.out.println("Print the reverse string: " + sb.reverse());
}
}
| [
"[email protected]"
]
| |
2527338d60afa58741e2eeecb164c3f84ff9f3a1 | 99f387300e91da399391d216a1d578ac955f8336 | /app/src/main/java/com/detroitlabs/kyleofori/asynctaskexample/MyActivity.java | 59aeb4ff3423d95e49cf2bc328b790e9d9dd5526 | []
| no_license | kyleofori/AsyncTaskExample | bd53e7b3858d642987f0b0968e6eaf0c67104de0 | 83d23c353e783f9bdc7478d980920fbed88e4579 | refs/heads/master | 2021-01-20T12:45:11.735179 | 2014-11-17T16:50:57 | 2014-11-17T16:50:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,594 | java | package com.detroitlabs.kyleofori.asynctaskexample;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.view.View.OnClickListener;
public class MyActivity extends Activity {
private static final String LOG_TAG = MyActivity.class.getSimpleName();
private ProgressBar progressBar;
private TextView txt;
private TextView txt_detail;
private Button btn_polite;
private Button btn_rude;
private boolean mayInterruptIfRunning;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
Button btn = (Button) findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
new LongOperation().execute(7, 6, 5);
}
});
btn_polite = (Button) findViewById(R.id.button_polite);
btn_rude = (Button) findViewById(R.id.button_rude);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
txt = (TextView) findViewById(R.id.output);
txt_detail = (TextView) findViewById(R.id.output_detail);
}
private class LongOperation extends AsyncTask<Integer, Integer, String> {
@Override
protected void onPreExecute() {
txt.setText("Nothing has been done yet");
txt_detail.setText("");
progressBar.setProgress(0);
btn_polite.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
LongOperation.this.cancel(false);
mayInterruptIfRunning = false;
}
});
btn_rude.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
LongOperation.this.cancel(true);
mayInterruptIfRunning = true;
}
});
}
@Override
protected String doInBackground(Integer... params) {
for (int x : params) {
for (int i = 0; i < x; i++) {
if(isCancelled()) {
return "Task interrupted";
}
try {
Thread.sleep(1000);
publishProgress(i+1, x);
} catch (InterruptedException e) {
Thread.interrupted();
}
}
}
return "Executed all";
}
@Override
protected void onPostExecute(String result) {
txt.setText(result);
}
@Override
protected void onProgressUpdate(Integer... values) {
try {
progressBar.setMax(values[1]);
progressBar.setProgress(values[0]);
txt.setText("Executing a task...");
} catch (IllegalArgumentException e) {
Log.e(LOG_TAG, e.getMessage());
}
}
@Override
protected void onCancelled(String result) {
txt.setText(result);
if(mayInterruptIfRunning) {
txt_detail.setText("RUDELY");
} else {
txt_detail.setText("...politely.");
}
}
}
}
| [
"[email protected]"
]
| |
e2631b9027e01157b0afec592e6e34d4bf2f540b | db87a9b9eb27dea2128ccfb1e8b4e77499281b09 | /src/main/java/com/springmvc/entity/Conference.java | 95dfda28b663bd5fdcb1b5602dccc70150930e81 | []
| no_license | JackChinaY/hyglxt | a5f6e5a8293db272bcf78b6e335c46a0c2317a84 | 098a5dd8e38a67d35c235fc6ac188d2a0bc53fe1 | refs/heads/master | 2020-04-13T18:38:05.444505 | 2019-03-11T14:33:12 | 2019-03-11T14:33:12 | 163,380,452 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,128 | java | package com.springmvc.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 会议实体类
*/
public class Conference {
//会议ID 32位UUID
private String id;
//会议名称
private String hymc;
//与会人员
private String yhry;
//开始时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date kssj;
//结束时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date jssj;
//会议地点
private String hydd;
//承办单位
private String cbdw;
//会议级别
private String hyjb;
//会议分类
private String hyfl;
//会议属性
private String hysx;
//会议正文
private String yhzw;
//图片路径
private String tplj;
//文档路径
private String wdlj;
//音频路径
private String yplj;
//视频路径
private String splj;
//会议状态
private String hyzt;
//记录状态
private String jlzt;
//记录员id
private String jlyid;
//记录员姓名
private String jlyxm;
//审核员id
private String shyid;
//审核员姓名
private String shyxm;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getHymc() {
return hymc;
}
public void setHymc(String hymc) {
this.hymc = hymc;
}
public String getYhry() {
return yhry;
}
public void setYhry(String yhry) {
this.yhry = yhry;
}
public Date getKssj() {
return kssj;
}
public void setKssj(Date kssj) {
this.kssj = kssj;
}
public Date getJssj() {
return jssj;
}
public void setJssj(Date jssj) {
this.jssj = jssj;
}
public String getHydd() {
return hydd;
}
public void setHydd(String hydd) {
this.hydd = hydd;
}
public String getCbdw() {
return cbdw;
}
public void setCbdw(String cbdw) {
this.cbdw = cbdw;
}
public String getHyjb() {
return hyjb;
}
public void setHyjb(String hyjb) {
this.hyjb = hyjb;
}
public String getHyfl() {
return hyfl;
}
public void setHyfl(String hyfl) {
this.hyfl = hyfl;
}
public String getHysx() {
return hysx;
}
public void setHysx(String hysx) {
this.hysx = hysx;
}
public String getYhzw() {
return yhzw;
}
public void setYhzw(String yhzw) {
this.yhzw = yhzw;
}
public String getTplj() {
return tplj;
}
public void setTplj(String tplj) {
this.tplj = tplj;
}
public String getWdlj() {
return wdlj;
}
public void setWdlj(String wdlj) {
this.wdlj = wdlj;
}
public String getYplj() {
return yplj;
}
public void setYplj(String yplj) {
this.yplj = yplj;
}
public String getSplj() {
return splj;
}
public void setSplj(String splj) {
this.splj = splj;
}
public String getHyzt() {
return hyzt;
}
public void setHyzt(String hyzt) {
this.hyzt = hyzt;
}
public String getJlzt() {
return jlzt;
}
public void setJlzt(String jlzt) {
this.jlzt = jlzt;
}
public String getJlyid() {
return jlyid;
}
public void setJlyid(String jlyid) {
this.jlyid = jlyid;
}
public String getJlyxm() {
return jlyxm;
}
public void setJlyxm(String jlyxm) {
this.jlyxm = jlyxm;
}
public String getShyid() {
return shyid;
}
public void setShyid(String shyid) {
this.shyid = shyid;
}
public String getShyxm() {
return shyxm;
}
public void setShyxm(String shyxm) {
this.shyxm = shyxm;
}
@Override
public String toString() {
return "Conference{" +
"id='" + id + '\'' +
", hymc='" + hymc + '\'' +
", yhry='" + yhry + '\'' +
", kssj=" + kssj +
", jssj=" + jssj +
", hydd='" + hydd + '\'' +
", cbdw='" + cbdw + '\'' +
", hyjb='" + hyjb + '\'' +
", hyfl='" + hyfl + '\'' +
", hysx='" + hysx + '\'' +
", yhzw='" + yhzw + '\'' +
", tplj='" + tplj + '\'' +
", wdlj='" + wdlj + '\'' +
", yplj='" + yplj + '\'' +
", splj='" + splj + '\'' +
", hyzt='" + hyzt + '\'' +
", jlzt='" + jlzt + '\'' +
", jlyid='" + jlyid + '\'' +
", jlyxm='" + jlyxm + '\'' +
", shyid='" + shyid + '\'' +
", shyxm='" + shyxm + '\'' +
'}';
}
}
| [
"[email protected]"
]
| |
e550fda03cebcc121e1604686534805b7ef5d25a | 91c3b81d96cdeb187a4d7a4bfe9fc10add39d4c5 | /app/src/main/java/com/example/shubh/bluet/chatwall.java | f1e4f636768323892568a9f1be57696b4b6fee17 | []
| no_license | shubhamdamani/Bluetooth-chat-and-connectivity- | 3c57ece9ca56c24be0ab901c55f7a220596dabf3 | bcbd666811ad9b13a7a04c146ad06eec6ab446d9 | refs/heads/master | 2021-07-01T21:47:40.579478 | 2019-01-08T14:09:24 | 2019-01-08T14:09:24 | 164,662,401 | 2 | 3 | null | 2019-10-25T16:57:08 | 2019-01-08T14:08:58 | Java | UTF-8 | Java | false | false | 336 | java | package com.example.shubh.bluet;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class chatwall extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chatwall);
}
}
| [
"[email protected]"
]
| |
3d1753307e16776051b931456b0280641c18667e | 93d4fa9b0250d8ee4fff46fcf7c896de759a357b | /src/main/java/thai/learn/singleton/example/EagerInitialization.java | 2ac346b813d2d3118ea8f4b9ba816f01b188120c | []
| no_license | thaittrinh/Learn_DesignPattern | d61742464be04b13dd935944123e7ae25dd4a342 | da0c9f3c9699830eb7327769d21f9796e442f84f | refs/heads/master | 2022-12-09T03:01:02.194139 | 2020-08-29T03:25:58 | 2020-08-29T03:25:58 | 291,191,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | package thai.learn.singleton.example;
/*
* Với cách này thì nếu class này chưa được hoặc không sử dụng
* thì object cũng đã được khởi tạo nên có thể gây lãng phí memory.
*/
public class EagerInitialization {
private static EagerInitialization instance = new EagerInitialization();
private EagerInitialization() {
}
public static EagerInitialization getEagerInitalization() {
return instance ;
}
}
| [
"[email protected]"
]
| |
d5c36264ddc44b53ca5e9b072dbbfa1e3888728c | 6e156bc13ac8493516609b1ff122f41f53906d68 | /flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/FullyFinishedOperatorState.java | be2b1967711c228d216859f015357261a52f2e1d | [
"Apache-2.0",
"MIT",
"ISC",
"OFL-1.1",
"BSD-3-Clause"
]
| permissive | tillrohrmann/flink | e4a07edfce2d80b3a3b90aa9c7070b7367193fa7 | b8ff60d9ea3ce22546b50d23dc0ad6c96b034191 | refs/heads/master | 2022-12-22T10:18:52.784714 | 2021-07-07T16:10:45 | 2021-07-09T07:46:19 | 20,681,108 | 6 | 5 | Apache-2.0 | 2021-04-21T21:14:41 | 2014-06-10T10:19:35 | Java | UTF-8 | Java | false | false | 2,567 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.runtime.checkpoint;
import org.apache.flink.runtime.jobgraph.OperatorID;
import org.apache.flink.runtime.state.memory.ByteStreamStateHandle;
import javax.annotation.Nullable;
/**
* A special operator state implementation representing the operators whose instances are all
* finished.
*/
public class FullyFinishedOperatorState extends OperatorState {
private static final long serialVersionUID = 1L;
public FullyFinishedOperatorState(OperatorID operatorID, int parallelism, int maxParallelism) {
super(operatorID, parallelism, maxParallelism);
}
@Override
public boolean isFullyFinished() {
return true;
}
@Override
public void putState(int subtaskIndex, OperatorSubtaskState subtaskState) {
throw new UnsupportedOperationException(
"Could not put state to a fully finished operator state.");
}
@Override
public void setCoordinatorState(@Nullable ByteStreamStateHandle coordinatorState) {
throw new UnsupportedOperationException(
"Could not set coordinator state to a fully finished operator state.");
}
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj instanceof FullyFinishedOperatorState) {
return super.equals(obj);
}
return false;
}
@Override
public String toString() {
return "FullyFinishedOperatorState("
+ "operatorID: "
+ getOperatorID()
+ ", parallelism: "
+ getParallelism()
+ ", maxParallelism: "
+ getMaxParallelism()
+ ')';
}
}
| [
"[email protected]"
]
| |
59a5715156f87bc326633cac4a9d1053d41ae9d2 | 210f7298250bc6097d6236fefbb5815d6be071c6 | /capstoneProject/TravelDroid/app/src/main/java/com/ma/traveldroid/widget/CountryAppWidget.java | db0f7296d3adc818c32b2fa232c4bea766c9a7f9 | [
"Apache-2.0"
]
| permissive | AbbasBayramzade/udacity-android-nanodegree | 32de3eb101d9d858a3f5ebc2eebe493714484cc2 | 4aef9ca2919584d3b0691b1344a19bf0b0471c35 | refs/heads/master | 2023-03-18T02:32:39.109917 | 2018-06-22T21:10:03 | 2018-06-22T21:10:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,336 | java | package com.ma.traveldroid.widget;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.RemoteViews;
import com.ma.traveldroid.R;
/**
* Implementation of App Widget functionality.
*/
public class CountryAppWidget extends AppWidgetProvider {
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// There may be multiple widgets active, so update all of them
for (int appWidgetId : appWidgetIds) {
Intent svcIntent = new Intent(context, ListWidgetService.class);
svcIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
svcIntent.setData(Uri.parse(svcIntent.toUri(Intent.URI_INTENT_SCHEME)));
RemoteViews widget = new RemoteViews(context.getPackageName(),
R.layout.country_app_widget);
widget.setTextViewText(R.id.widget_tv, context.getString(R.string.widget_title));
widget.setRemoteAdapter(appWidgetId, R.id.words,
svcIntent);
appWidgetManager.updateAppWidget(appWidgetId, widget);
}
super.onUpdate(context, appWidgetManager, appWidgetIds);
}
}
| [
"[email protected]"
]
| |
f5424edf97bf6a6bbcfb610cc56e78aefcccec6f | e75be673baeeddee986ece49ef6e1c718a8e7a5d | /submissions/blizzard/Corpus/eclipse.jdt.core/2352.java | 59da99b9d039661e42b3c461c1f7c50c7f1d6eb9 | [
"MIT"
]
| permissive | zhendong2050/fse18 | edbea132be9122b57e272a20c20fae2bb949e63e | f0f016140489961c9e3c2e837577f698c2d4cf44 | refs/heads/master | 2020-12-21T11:31:53.800358 | 2018-07-23T10:10:57 | 2018-07-23T10:10:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,798 | java | /*******************************************************************************
* Copyright (c) 2008, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.compiler;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class ReadManager implements Runnable {
ICompilationUnit[] units;
int nextFileToRead;
ICompilationUnit[] filesRead;
char[][] contentsRead;
int readyToReadPosition;
int nextAvailablePosition;
Thread[] readingThreads;
char[] readInProcessMarker = new char[0];
int sleepingThreadCount;
private Throwable caughtException;
static final int START_CUSHION = 5;
public static final int THRESHOLD = 10;
// do not waste memory by keeping too many files in memory
static final int CACHE_SIZE = 15;
public ReadManager(ICompilationUnit[] files, int length) {
// start the background threads to read the file's contents
int threadCount = 0;
try {
//$NON-NLS-1$
Class runtime = Class.forName("java.lang.Runtime");
//$NON-NLS-1$
java.lang.reflect.Method m = runtime.getDeclaredMethod("availableProcessors", new Class[0]);
if (m != null) {
Integer result = (Integer) m.invoke(Runtime.getRuntime(), (Object[]) null);
threadCount = result.intValue() + 1;
if (threadCount < 2)
threadCount = 0;
else if (threadCount > CACHE_SIZE)
threadCount = CACHE_SIZE;
}
} catch (IllegalAccessException // ignored
ignored) {
} catch (ClassNotFoundException // ignored
e) {
} catch (SecurityException // ignored
e) {
} catch (NoSuchMethodException // ignored
e) {
} catch (IllegalArgumentException // ignored
e) {
} catch (InvocationTargetException // ignored
e) {
}
if (threadCount > 0) {
synchronized (this) {
this.units = new ICompilationUnit[length];
System.arraycopy(files, 0, this.units, 0, length);
// skip some files to reduce the number of times we have to wait
this.nextFileToRead = START_CUSHION;
this.filesRead = new ICompilationUnit[CACHE_SIZE];
this.contentsRead = new char[CACHE_SIZE][];
this.readyToReadPosition = 0;
this.nextAvailablePosition = 0;
this.sleepingThreadCount = 0;
this.readingThreads = new Thread[threadCount];
for (int i = threadCount; --i >= 0; ) {
this.readingThreads[i] = new //$NON-NLS-1$
Thread(//$NON-NLS-1$
this, //$NON-NLS-1$
"Compiler Source File Reader");
this.readingThreads[i].setDaemon(true);
this.readingThreads[i].start();
}
}
}
}
public char[] getContents(ICompilationUnit unit) throws Error {
if (this.readingThreads == null || this.units.length == 0) {
if (this.caughtException != null) {
// rethrow the caught exception from the readingThreads in the main compiler thread
if (this.caughtException instanceof Error)
throw (Error) this.caughtException;
throw (RuntimeException) this.caughtException;
}
return unit.getContents();
}
boolean yield = false;
char[] result = null;
synchronized (this) {
if (unit == this.filesRead[this.readyToReadPosition]) {
result = this.contentsRead[this.readyToReadPosition];
while (result == this.readInProcessMarker || result == null) {
// let the readingThread know we're waiting
//System.out.print('|');
this.contentsRead[this.readyToReadPosition] = null;
try {
wait(250);
} catch (InterruptedException // ignore
ignore) {
}
if (this.caughtException != null) {
// rethrow the caught exception from the readingThreads in the main compiler thread
if (this.caughtException instanceof Error)
throw (Error) this.caughtException;
throw (RuntimeException) this.caughtException;
}
result = this.contentsRead[this.readyToReadPosition];
}
// free spot for next file
this.filesRead[this.readyToReadPosition] = null;
this.contentsRead[this.readyToReadPosition] = null;
if (++this.readyToReadPosition >= this.contentsRead.length)
this.readyToReadPosition = 0;
if (this.sleepingThreadCount > 0) {
//System.out.print('+');
//System.out.print(this.nextFileToRead);
notify();
yield = this.sleepingThreadCount == this.readingThreads.length;
}
} else {
// must make sure we're reading ahead of the unit
int unitIndex = 0;
for (int l = this.units.length; unitIndex < l; unitIndex++) if (this.units[unitIndex] == unit)
break;
if (unitIndex == this.units.length) {
// attempting to read a unit that was not included in the initial files - should not happen
// stop looking for more
this.units = new ICompilationUnit[0];
} else if (unitIndex >= this.nextFileToRead) {
// start over
//System.out.println(unitIndex + " vs " + this.nextFileToRead);
this.nextFileToRead = unitIndex + START_CUSHION;
this.readyToReadPosition = 0;
this.nextAvailablePosition = 0;
this.filesRead = new ICompilationUnit[CACHE_SIZE];
this.contentsRead = new char[CACHE_SIZE][];
notifyAll();
}
}
}
if (yield)
// ensure other threads get a chance
Thread.yield();
if (result != null)
return result;
//System.out.print('-');
return unit.getContents();
}
public void run() {
try {
while (this.readingThreads != null && this.nextFileToRead < this.units.length) {
ICompilationUnit unit = null;
int position = -1;
synchronized (this) {
if (this.readingThreads == null)
return;
while (this.filesRead[this.nextAvailablePosition] != null) {
this.sleepingThreadCount++;
try {
// wait until a spot in contents is available
wait(250);
} catch (InterruptedException // ignore
e) {
}
this.sleepingThreadCount--;
if (this.readingThreads == null)
return;
}
if (this.nextFileToRead >= this.units.length)
return;
unit = this.units[this.nextFileToRead++];
position = this.nextAvailablePosition;
if (++this.nextAvailablePosition >= this.contentsRead.length)
this.nextAvailablePosition = 0;
this.filesRead[position] = unit;
// mark the spot so we know its being read
this.contentsRead[position] = this.readInProcessMarker;
}
char[] result = unit.getContents();
synchronized (this) {
if (this.filesRead[position] == unit) {
if (// wake up main thread which is waiting for this file
this.contentsRead[position] == null)
notifyAll();
this.contentsRead[position] = result;
}
}
}
} catch (Error e) {
synchronized (this) {
this.caughtException = e;
shutdown();
}
return;
} catch (RuntimeException e) {
synchronized (this) {
this.caughtException = e;
shutdown();
}
return;
}
}
public synchronized void shutdown() {
// mark the read manager as shutting down so that the reading threads stop
this.readingThreads = null;
notifyAll();
}
}
| [
"[email protected]"
]
| |
1e67e8a0527625ddc0c2ecadab1ef536e8eae27e | 15b260ccada93e20bb696ae19b14ec62e78ed023 | /v2/src/main/java/com/alipay/api/request/AlipayOpenSpOperationAuthAddRequest.java | cd35ec4237c6bddc96512930267fd2b6be923990 | [
"Apache-2.0"
]
| permissive | alipay/alipay-sdk-java-all | df461d00ead2be06d834c37ab1befa110736b5ab | 8cd1750da98ce62dbc931ed437f6101684fbb66a | refs/heads/master | 2023-08-27T03:59:06.566567 | 2023-08-22T14:54:57 | 2023-08-22T14:54:57 | 132,569,986 | 470 | 207 | Apache-2.0 | 2022-12-25T07:37:40 | 2018-05-08T07:19:22 | Java | UTF-8 | Java | false | false | 2,998 | java | package com.alipay.api.request;
import com.alipay.api.domain.AlipayOpenSpOperationAuthAddModel;
import java.util.Map;
import com.alipay.api.AlipayRequest;
import com.alipay.api.internal.util.AlipayHashMap;
import com.alipay.api.response.AlipayOpenSpOperationAuthAddResponse;
import com.alipay.api.AlipayObject;
/**
* ALIPAY API: alipay.open.sp.operation.auth.add request
*
* @author auto create
* @since 1.0, 2023-05-31 04:24:05
*/
public class AlipayOpenSpOperationAuthAddRequest implements AlipayRequest<AlipayOpenSpOperationAuthAddResponse> {
private AlipayHashMap udfParams; // add user-defined text parameters
private String apiVersion="1.0";
/**
* 添加服务商代运营记录
*/
private String bizContent;
public void setBizContent(String bizContent) {
this.bizContent = bizContent;
}
public String getBizContent() {
return this.bizContent;
}
private String terminalType;
private String terminalInfo;
private String prodCode;
private String notifyUrl;
private String returnUrl;
private boolean needEncrypt=false;
private AlipayObject bizModel=null;
public String getNotifyUrl() {
return this.notifyUrl;
}
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}
public String getReturnUrl() {
return this.returnUrl;
}
public void setReturnUrl(String returnUrl) {
this.returnUrl = returnUrl;
}
public String getApiVersion() {
return this.apiVersion;
}
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}
public void setTerminalType(String terminalType){
this.terminalType=terminalType;
}
public String getTerminalType(){
return this.terminalType;
}
public void setTerminalInfo(String terminalInfo){
this.terminalInfo=terminalInfo;
}
public String getTerminalInfo(){
return this.terminalInfo;
}
public void setProdCode(String prodCode) {
this.prodCode=prodCode;
}
public String getProdCode() {
return this.prodCode;
}
public String getApiMethodName() {
return "alipay.open.sp.operation.auth.add";
}
public Map<String, String> getTextParams() {
AlipayHashMap txtParams = new AlipayHashMap();
txtParams.put("biz_content", this.bizContent);
if(udfParams != null) {
txtParams.putAll(this.udfParams);
}
return txtParams;
}
public void putOtherTextParam(String key, String value) {
if(this.udfParams == null) {
this.udfParams = new AlipayHashMap();
}
this.udfParams.put(key, value);
}
public Class<AlipayOpenSpOperationAuthAddResponse> getResponseClass() {
return AlipayOpenSpOperationAuthAddResponse.class;
}
public boolean isNeedEncrypt() {
return this.needEncrypt;
}
public void setNeedEncrypt(boolean needEncrypt) {
this.needEncrypt=needEncrypt;
}
public AlipayObject getBizModel() {
return this.bizModel;
}
public void setBizModel(AlipayObject bizModel) {
this.bizModel=bizModel;
}
}
| [
"auto-publish"
]
| auto-publish |
3b1b422175c84d949832c2eb8cae37e59d0f5ed5 | 6f1ce13ee2cf8149388573f52a28718c47b474f5 | /app/src/main/java/sn/com/welcomedomel/TransforView.java | 5c1fdfcd38d27a306d90945026ed8c5e6eb3bd0b | []
| no_license | 1357297270/WelComeDomel | 1cec7d4d09a8be1932faf28d6fe82c30c753791a | efbe7ade61863e1416c2e57955a9c29f90d34d7b | refs/heads/master | 2020-04-03T01:34:00.738913 | 2018-10-27T06:45:31 | 2018-10-27T06:45:31 | 154,934,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44,525 | java | package sn.com.welcomedomel;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
/**
* Created by hasee on 2018/9/21.
*/
public class TransforView extends View {
// /////////////////////////////////////////////////////////////////////////
// 页面切换时的,白色矩形背景的变化参数
// /////////////////////////////////////////////////////////////////////////
/**
* 第1页->第2页
*/
public static final float FIRST_HEIGHT = 0.4f;// 第1个页面高度缩放比例,正:放大,负:缩小
public final int FIRST_TOP1 = -dp2px(30);// 第1个页面top移动距离,正:下移,负:上移
public final int FIRST_TOP2 = dp2px(60);// 第1个页面top移动距离,正:下移,负:上移
public static final float FIRST_RATE = 0.5f;// 在偏移50%处,进行下一页的显示
/**
* 第2页->第3页
*/
public static final float SECOND_WIDTH = -0.15f;// 第2个页面宽度缩放比例,正:放大,负:缩小
public final int SECOND_TOP = -dp2px(20);// 第2个页面top移动距离比例,正:下移,负:上移
public static final float SECOND_RATE = 0.5f;// 在偏移50%处,进行下一页的显示
/**
* 第3页->第4页
*/
public static final float THIRD_WIDTH = -0.1f;// 第3个页面宽度缩放比例,正:放大,负:缩小
public static final float THIRD_HEIGHT = -0.1f;// 第3个页面高度缩放比例,正:放大,负:缩小
public static final int THIRD_DEGREE = -10;// 第3个页面角度调整,正:顺时针,负:逆时针
public static final float THIRD_RATE = 0.5f;// 在偏移50%处,进行下一页的显示
// /////////////////////////////////////////////////////////////////////////
// 白色圆角矩形背景
// /////////////////////////////////////////////////////////////////////////
private Paint mRectBgPaint;
private int mRectBgDefaultCorner = dp2px(5);// 初始圆角5dp
private float mRectBgCurrentDegree = 0;// 默认不旋转
/**
* 第1页初始化
* default=默认初始宽高,left,top,如果是2,3,4页,则表示变化后的值
* current=当前宽高,left,top,会根据偏移量变化
*/
private float mPage1RectBgDefaultWidth = dp2px(260);
private float mPage1RectBgDefaultHeight = dp2px(230);
private float mPage1RectBgDefaultLeft = getScreenWidth() / 2 - mPage1RectBgDefaultWidth / 2;
private float mPage1RectBgDefaultTop = dp2px(80);
private float mRectBgCurrentWidth = mPage1RectBgDefaultWidth;
private float mRectBgCurrentHeight = mPage1RectBgDefaultHeight;
private float mRectBgCurrentLeft = mPage1RectBgDefaultLeft;
private float mRectBgCurrentTop = mPage1RectBgDefaultTop;
/**
* 第1页->第2页
* 在第1页的基础上进行变化
* 1.height放大
* 2.top先上移n,在下移n*2
*/
private float mPage2RectBgDefaultWidth = mPage1RectBgDefaultWidth;
private float mPage2RectBgDefaultHeight = mPage1RectBgDefaultHeight * (1 + FIRST_HEIGHT);
private float mPage2RectBgDefaultLeft = mPage1RectBgDefaultLeft;
private float mPage2RectBgDefaultTop = mPage1RectBgDefaultTop + FIRST_TOP1 + FIRST_TOP2;
/**
* 第2页->第3页
* 在第2页的基础上进行变化
* 1.宽度缩小
* 2.top上移
*/
private float mPage3RectBgDefaultWidth = mPage2RectBgDefaultWidth * (1 + SECOND_WIDTH);
private float mPage3RectBgDefaultHeight = mPage2RectBgDefaultHeight;
private float mPage3RectBgDefaultLeft = getScreenWidth() / 2 - mPage3RectBgDefaultWidth / 2;
private float mPage3RectBgDefaultTop = mPage2RectBgDefaultTop + SECOND_TOP;
/**
* 第3页->第4页
* 在第3页的基础上进行变化
* 1.宽度缩小
* 2.高度缩小
* 2.逆时针旋转
*/
private float mPage4RectBgDefaultWidth = mPage3RectBgDefaultWidth * (1 + THIRD_WIDTH);
private float mPage4RectBgDefaultHeight = mPage3RectBgDefaultHeight * (1 + THIRD_HEIGHT);
private float mPage4RectBgDefaultLeft = getScreenWidth() / 2 - mPage4RectBgDefaultWidth / 2;
private float mPage4RectBgDefaultTop = mPage3RectBgDefaultTop;
private float mPage4ModelDefaultWidth = (mPage4RectBgDefaultWidth - padding() * 4) / 3;
// /////////////////////////////////////////////////////////////////////////
// 第1页,view元素
// /////////////////////////////////////////////////////////////////////////
private ViewModel mPage1Top;// 顶部模特图
private ViewModel mPage1Bottom;// 底部文案图
private ViewModel mPage1BottomBg;// 底部背景图
// /////////////////////////////////////////////////////////////////////////
// 第2页,view元素
// /////////////////////////////////////////////////////////////////////////
private int[] mPage2ModelResources = new int[] {R.drawable.two_1, R.drawable.two_2, R.drawable.two_3};
private ViewModel mPage2Top;// 顶部文案图
private ViewModel[] mPage2Center = new ViewModel[mPage2ModelResources.length];// 中间3张模特图
private ViewModel mPage2Bottom;// 底部文案图
private ViewModel[] mPage2Split = new ViewModel[2];// 2张裂变背景图
// /////////////////////////////////////////////////////////////////////////
// 第3页,view元素
// /////////////////////////////////////////////////////////////////////////
private int[] mPage3ModelResources = new int[] {R.drawable.three_1, R.drawable.three_2, R.drawable.three_3,
R.drawable.three_4, R.drawable.three_5, R.drawable.three_6};
private ViewModel[] mPage3Model = new ViewModel[mPage3ModelResources.length];// 6张模特图
private float mPage3ModelDefaultWidth = (mPage3RectBgDefaultWidth - padding() * 4) / 3;// 每张模特图的默认宽度
private float mPage3ModelDefaultHeight = (mPage3RectBgDefaultHeight - padding() * 3) / 2;// 每张模特图的默认高度
// /////////////////////////////////////////////////////////////////////////
// 第4页,view元素
// /////////////////////////////////////////////////////////////////////////
private int[] mPage4ModelResources = new int[] {R.drawable.four_bottom_1, R.drawable.four_bottom_2,
R.drawable.four_bottom_3};
private ViewModel mPage4Top;// 顶部模特图
private ViewModel[] mPage4Model = new ViewModel[mPage4ModelResources.length];// 底部3张模特图
private ViewModel[] mPage4Split = new ViewModel[2];// 2张裂变背景图
// private float mPage4SplitTargeOffset =
/**
* 当前页数索引
*/
private int mCurrentPageIndex;
public TransforView(Context context) {
super(context);
init();
}
public TransforView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public TransforView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public void transfor(int position, float positionOffset, int positionOffsetPixels) {
Log.e("ls_debug_log", "p=" + position + ",p_offset=" + positionOffset + ",p_px=" + positionOffsetPixels);
mCurrentPageIndex = position;
calculateOffset(position, positionOffset, positionOffsetPixels);
}
private void init() {
{
/** 第1页,初始化矩形背景 */
mRectBgPaint = new Paint();
mRectBgPaint.setAntiAlias(true); // 设置画笔为无锯齿
mRectBgPaint.setColor(Color.BLACK); // 设置画笔颜色
mRectBgPaint.setStyle(Paint.Style.FILL); // 空心效果
}
{
/** 第1页,顶部模特图 */
mPage1Top = new ViewModel(getContext(), R.drawable.one_top).alpha(255)
// 宽度为矩形背景宽度,减去左,右,各5dp边距
.width(mPage1RectBgDefaultWidth - padding() * 2)
// 高度为矩形背景的高度,减去上,中,下各5边距后剩余的高度的2/3
.height((mPage1RectBgDefaultHeight - padding() * 3) / 3 * 2)
.left(mPage1RectBgDefaultLeft + padding())
.top(mPage1RectBgDefaultTop + padding())
.create();
/** 第1页,底部文案图 */
mPage1Bottom = new ViewModel(getContext(), R.drawable.one_bottom).alpha(255)
// 宽度为矩形背景宽度,减去左,右,各5dp边距
.width(mPage1RectBgDefaultWidth - padding() * 2)
// 高度为矩形背景的高度,减去上,中,下各5dp边距后剩余的高度的1/3
.height((mPage1RectBgDefaultHeight - padding() * 3) / 3)
.left(mPage1RectBgDefaultLeft + padding())
// top距离=顶部模特图top+height+5dp边距
.top(mPage1Top.defaultTop + mPage1Top.defaultHeight + padding())
.create();
/** 第1页,底部背景图 */
mPage1BottomBg =
new ViewModel(getContext(), R.drawable.one_bottom_bg).alpha(255)
.width(mPage1RectBgDefaultWidth - padding() * 2)
// .height()// 不传则按宽度比例缩放
.left(mPage1RectBgDefaultLeft + padding())
// top距离=矩形背景top+height+5dp边距
.top(mPage1RectBgDefaultTop + mPage1RectBgDefaultHeight + padding())
.create();
}
{
/** 第2页,顶部文案图 */
mPage2Top = new ViewModel(getContext(), R.drawable.two_top).width(mPage2RectBgDefaultWidth - padding() * 2)
// .height()// 不传则按宽度比例缩放
.left(mPage2RectBgDefaultLeft + padding())
.top(mPage2RectBgDefaultTop + padding())
.create();
/** 第2页,中间3张模特图 */
for (int i = 0; i < mPage2ModelResources.length; i++) {
mPage2Center[i] = new ViewModel(getContext(), mPage2ModelResources[i]);
if (i == 0) {
/** 第1张模特图 */
mPage2Center[i].width((mPage2RectBgDefaultWidth - dp2px(15)) / 3 * 2)
.height(mPage2Center[i].defaultWidth + dp2px(5))
.left(mPage2RectBgDefaultLeft + padding())
.top(mPage2Top.defaultTop + mPage2Top.defaultHeight + padding())
.create();
} else if (i == 1) {
/** 第2张模特图 */
mPage2Center[i].width((mPage2RectBgDefaultWidth - dp2px(15)) / 3)
.height(mPage2Center[i].defaultWidth)
.left(mPage2Center[0].defaultLeft + mPage2Center[0].defaultWidth + padding())
.top(mPage2Top.defaultTop + mPage2Top.defaultHeight + padding())
.create();
} else if (i == 2) {
/** 第3张模特图 */
mPage2Center[i].width((mPage2RectBgDefaultWidth - dp2px(15)) / 3)
.height(mPage2Center[i].defaultWidth)
.left(mPage2Center[0].defaultLeft + mPage2Center[0].defaultWidth + padding())
.top(mPage2Center[1].defaultTop + mPage2Center[1].defaultHeight + padding())
.create();
}
}
/** 第2页,底部文案图 */
mPage2Bottom =
new ViewModel(getContext(), R.drawable.two_bottom).width(mPage2RectBgDefaultWidth - padding() * 2)
.height(
mPage2RectBgDefaultHeight - mPage2Top.defaultHeight - mPage2Center[0].defaultHeight - padding()
* 4)
.left(mPage2RectBgDefaultLeft + padding())
.top(mPage2Center[0].defaultTop + mPage2Center[0].defaultHeight + padding())
.create();
/** 第2页,裂变背景图 */
for (int i = 0; i < 2; i++) {
mPage2Split[i] =
new ViewModel(getContext(), R.drawable.two_bg).width(mPage2RectBgDefaultWidth)
.height(mPage2RectBgDefaultHeight)
.left(mPage2RectBgDefaultLeft)
.top(mPage2RectBgDefaultTop)
.create();
}
}
{
/** 第3页,6张模特图 */
for (int i = 0; i < mPage3Model.length; i++) {
if (i < mPage3Model.length / 2) {
/** 第3页,第1排3张模特图 */
mPage3Model[i] =
new ViewModel(getContext(), mPage3ModelResources[i]).width(mPage3ModelDefaultWidth)
.height(mPage3ModelDefaultHeight)
.left(mPage3RectBgDefaultLeft + mPage3ModelDefaultWidth * i + padding() * (i + 1))
.top(mPage3RectBgDefaultTop + padding())
.create();
} else {
/** 第3页,第2排3张模特图 */
mPage3Model[i] =
new ViewModel(getContext(), mPage3ModelResources[i]).width(mPage3ModelDefaultWidth)
.height(mPage3ModelDefaultHeight)
.left(
mPage3RectBgDefaultLeft + mPage3ModelDefaultWidth * (i - mPage3Model.length / 2)
+ padding() * ((i - mPage3Model.length / 2) + 1))
// 与第1排第区别在于top需要加上第1排的height
.top(mPage3RectBgDefaultTop + mPage3Model[i - 1].defaultHeight + padding() * 2)
.create();
}
mPage3Model[i].paint.setAntiAlias(true);
}
}
{
/** 第4页,顶部模特图 */
mPage4Top =
new ViewModel(getContext(), R.drawable.four_top).width(mPage4RectBgDefaultWidth - padding() * 2)
.left(mPage4RectBgDefaultLeft + padding())
.top(mPage4RectBgDefaultTop + padding())
.create();
mPage4Top.paint.setAntiAlias(true);
/** 第4页,底部3张模特图 */
for (int i = 0; i < mPage4ModelResources.length; i++) {
mPage4Model[i] =
new ViewModel(getContext(), mPage4ModelResources[i]).width(mPage4ModelDefaultWidth)
.height(mPage4RectBgDefaultHeight - padding() * 3 - mPage4Top.defaultHeight)
.left(mPage4RectBgDefaultLeft + mPage4ModelDefaultWidth * i + padding() * (i + 1))
.top(mPage4Top.defaultTop + mPage4Top.defaultHeight + padding());
mPage4Model[i].paint.setAntiAlias(true);
}
/** 第4页,2张裂变背景图 */
for (int i = 0; i < mPage4Split.length; i++) {
mPage4Split[i] = new ViewModel(getContext(), R.drawable.four_bg)
.width(mPage4RectBgDefaultWidth)
.height(mPage4RectBgDefaultHeight)
.left(mPage4RectBgDefaultLeft)
.top(mPage4RectBgDefaultTop);
}
}
}
/**
* @desc 根据viewPager偏移,修改view的宽,高,left,top
* @author listen
*/
private void calculateOffset(int position, float positionOffset, int positionOffsetPixels) {
if (positionOffset <= 0) {
return;
}
if (fromPage1ToPage2(position)) {
/** 第1页,底部背景图,根据页面向左偏移 */
mPage1BottomBg.currentLeft = mPage1BottomBg.defaultLeft - positionOffsetPixels;
if (positionOffset < FIRST_RATE) {
/** 快速滑动的时候,可能丢失最后一次绘制,所以需要在这里重新设置一次,保证第2页的view不可见 */
hidePage2Views();
/** 第1页,在0->50%区间偏移 */
/** 矩形背景,高度放大40%,向上移动30dp */
transformRectBgFrom1To2Before(positionOffset);
/** 第1页,渐渐隐顶部图,底部图;透明度渐变消失,偏移到50%时完全消失 */
stepByHidePage1Views(positionOffset);
} else {
/** 快速滑动的时候,可能丢失最后一次绘制,所以需要在这里调重新设置一次。保证第1页的view不可见 */
hidePage1Views();
/** 第1页,在50%->100%区间偏移 */
/** 矩形背景,上移30dp后,向下偏移60dp */
transformRectBgFrom1To2After(positionOffset);
/** 第2页,渐渐显示顶部,3张模特图,底部图 */
stepByShowPage2Views(positionOffset);
}
} else if (fromPage2ToPage3(position)) {
/** 矩形背景,宽度缩小15%,上移20dp */
transformRectBgFrom2To3(positionOffset);
if (positionOffset < SECOND_RATE) {
/** 快速滑动的时候,可能丢失最后一次绘制,所以需要在这里调重新设置一次。保证第3页滑回到第2页时,第3页的view不可见 */
hidePage3Views();
/** 第2页,在0->50%区间偏移,渐渐隐藏顶部,中间,底部,裂变背景图 */
stepByHidePage2Views(positionOffset, positionOffsetPixels);
} else {
/** 快速滑动的时候,可能丢失最后一次绘制,所以需要在这里调重新设置一次,保证第2页的view不可见 */
hidePage2Views();
/** 第2页,在50->100%区间偏移,渐渐显示第3页,6张模特图 */
stepByShowPage3Views(positionOffset);
}
} else if (fromPage3ToPage4(position)) {
/** 背景矩形的宽度,高度减少10%,逆时针旋转10度 */
transformRectBgFrom3To4(positionOffset);
if (positionOffset < THIRD_RATE) {
/** 快速滑动的时候,可能丢失最后一次绘制,所以需要在这里调重新设置一次,保证第4页的view不可见 */
hidePage4Views();
/** 渐渐缩放,隐藏第3页,6张模特图 */
stepByHidePage3Views(positionOffset);
} else {
/** 快速滑动的时候,可能丢失最后一次绘制,所以需要在这里调重新设置一次,保证第3页的view缩放完成 */
scaleHidePage3Views();
/** 渐渐显示第4页,顶部图,底部3张模特图,分裂背景图 */
stepByShowPage4Views(positionOffset);
}
}
postInvalidate();
}
private void stepByShowPage4Views(float positionOffset) {
/** 显示第4页,裂变背景图,并向左右平移 */
float offset = (mPage4RectBgDefaultWidth + dp2px(40)) * ((positionOffset - THIRD_RATE) * (1 / (1 - THIRD_RATE)));
for (int i = 0; i < mPage4Split.length; i++) {
mPage4Split[i].matrix.reset();
mPage4Split[i].matrix.postScale(mPage4RectBgDefaultWidth / mPage4Split[i].bitmap.getWidth(), mPage4RectBgDefaultHeight / mPage4Split[i].bitmap.getHeight());
float currentLeft = 0;
if (i == 0) {
// 左移
currentLeft = mPage4RectBgDefaultLeft - offset;
} else if (i == 1) {
// 右移
currentLeft = mPage4RectBgDefaultLeft + offset;
}
// 平移
mPage4Split[i].matrix.postTranslate(currentLeft, mPage4RectBgDefaultTop);
// 旋转角度
mPage4Split[i].matrix.postRotate(THIRD_DEGREE, currentLeft + mPage4RectBgDefaultWidth/2,
mPage4RectBgDefaultTop + mPage4RectBgDefaultHeight/2);
mPage4Split[i].alpha((int) (255 * ((positionOffset - THIRD_RATE) * (1 / (1 - THIRD_RATE)))));
}
/** 显示第4页,顶部模特图 */
mPage4Top.alpha((int) (255 * ((positionOffset - THIRD_RATE) * (1 / (1 - THIRD_RATE)))));
/** 显示第4页,底部3张模特图 */
for (int i = 0; i < mPage4Model.length; i++) {
if (i == 0) {
mPage4Model[i].currentWidth =
mPage4Model[i].defaultWidth * ((positionOffset - THIRD_RATE) * (1 / (1 - THIRD_RATE)));
mPage4Model[i].currentHeight =
mPage4Model[i].defaultHeight * ((positionOffset - THIRD_RATE) * (1 / (1 - THIRD_RATE)));
mPage4Model[i].alpha((int) (255 * (positionOffset - THIRD_RATE) * (1 / (1 - THIRD_RATE))));
} else {
if (mPage4Model[i - 1].currentWidth >= mPage4ModelDefaultWidth / 2) {
mPage4Model[i].currentWidth =
mPage4Model[i].defaultWidth * ((mPage4Model[i - 1].widthRate() - 0.5f) * 2);
mPage4Model[i].currentHeight =
mPage4Model[i].defaultHeight * ((mPage4Model[i - 1].widthRate() - 0.5f) * 2);
mPage4Model[i].currentLeft =
mPage4Model[i - 1].currentLeft + mPage4Model[i - 1].currentWidth + padding();
mPage4Model[i].alpha((int) (255 * (mPage4Model[i - 1].widthRate() - 0.5f) * 2));
}
}
}
}
private void transformRectBgFrom3To4(float positionOffset) {
/** 快速滑动的时候,可能丢失最后一次绘制,所以需要在这里调重新设置一次,保证变化完成 */
mRectBgCurrentWidth = mPage3RectBgDefaultWidth;
mRectBgCurrentTop = mPage3RectBgDefaultTop;
/** 调整第4页,背景矩形的宽高和角度 */
/** 背景矩形的宽度,在第3页调整宽度的基础上进行缩小 */
mRectBgCurrentWidth = mPage3RectBgDefaultWidth * (1 + THIRD_WIDTH * positionOffset);
mRectBgCurrentLeft = getScreenWidth() / 2 - mRectBgCurrentWidth / 2;
/** 背景矩形的高度,在第2页调整高度的基础上进行缩小 */
mRectBgCurrentHeight = mPage3RectBgDefaultHeight * (1 + THIRD_HEIGHT * positionOffset);
/** 背景矩形逆时针旋转 */
mRectBgCurrentDegree = THIRD_DEGREE * positionOffset;
}
private void stepByHidePage3Views(float positionOffset) {
/** 隐藏第3页6张模特图 */
/** 从第1排,第3-1张开始,依次缩放 */
for (int i = mPage3ModelResources.length / 2 - 1; i >= 0; i--) {
if (i == mPage3ModelResources.length / 2 - 1) {
/** 如果是第1排,第3张,则开始缩放 */
mPage3Model[i].currentHeight =
mPage3Model[i].defaultHeight * (1 - positionOffset * (1 / (1 - THIRD_RATE)));
mPage3Model[i].currentWidth =
mPage3Model[i].defaultWidth * (1 - positionOffset * (1 / (1 - THIRD_RATE)));
} else {
/** 如果是第1排,第1/2张,则判断后1张缩放到一半的时候开始自己的缩放 */
if (mPage3Model[i + 1].currentHeight <= mPage3Model[i + 1].defaultHeight / 2) {
mPage3Model[i].currentHeight = mPage3Model[i].defaultHeight * mPage3Model[i + 1].heightRate() * 2;
mPage3Model[i].currentWidth = mPage3Model[i].defaultWidth * mPage3Model[i + 1].heightRate() * 2;
} else {
mPage3Model[i].currentHeight = mPage3Model[i].defaultHeight;
mPage3Model[i].currentWidth = mPage3Model[i].defaultWidth;
}
}
/** 跳转left,top,实现居中缩放 */
mPage3Model[i].currentLeft =
mPage3Model[i].defaultLeft + mPage3Model[i].defaultWidth / 2 - mPage3Model[i].currentWidth / 2;
mPage3Model[i].currentTop =
mPage3Model[i].defaultTop + mPage3Model[i].defaultHeight / 2 - mPage3Model[i].currentHeight / 2;
}
/** 从第1排,第4-6张开始,依次缩放 */
for (int i = mPage3ModelResources.length / 2; i < mPage3ModelResources.length; i++) {
if (i == mPage3ModelResources.length / 2) {
/** 如果是第2排,第1张,则开始缩放 */
mPage3Model[i].currentHeight =
mPage3Model[i].defaultHeight * (1 - positionOffset * (1 / (1 - THIRD_RATE)));
mPage3Model[i].currentWidth =
mPage3Model[i].defaultWidth * (1 - positionOffset * (1 / (1 - THIRD_RATE)));
} else {
/** 如果是第2排,第5/6张,则判断前1张缩放到一半的时候开始自己的缩放 */
if (mPage3Model[i - 1].currentHeight <= mPage3Model[i - 1].defaultHeight / 2) {
mPage3Model[i].currentHeight = mPage3Model[i].defaultHeight * mPage3Model[i - 1].heightRate() * 2;
mPage3Model[i].currentWidth = mPage3Model[i].defaultWidth * mPage3Model[i - 1].heightRate() * 2;
} else {
mPage3Model[i].currentHeight = mPage3Model[i].defaultHeight;
mPage3Model[i].currentWidth = mPage3Model[i].defaultWidth;
}
}
/** 跳转left,top,实现居中缩放 */
mPage3Model[i].currentLeft =
mPage3Model[i].defaultLeft + mPage3Model[i].defaultWidth / 2 - mPage3Model[i].currentWidth / 2;
mPage3Model[i].currentTop =
mPage3Model[i].defaultTop + mPage3Model[i].defaultHeight / 2 - mPage3Model[i].currentHeight / 2;
}
}
private void transformRectBgFrom1To2Before(float positionOffset) {
/** 矩形背景,高度放大40% */
/**
* 偏移到50%的时候height需要放大40%,defaultHeight=400,targetHeight=400*1.4=560
*
* offset=0
* 400 * (1 + 0.4 * 0 * (1 / 0.5)) = 400
*
* offset=0.25
* 400 * (1 + 0.4 * 0.25 * (1 / 0.5)) = 400 * 1.2 = 480
*
* offset=0.5
* 400 * (1 + 0.4 * 0.5 * (1 / 0.5)) = 400 * 1.4 = 560
*
*/
mRectBgCurrentHeight =
(int) (mPage1RectBgDefaultHeight * (1 + FIRST_HEIGHT * positionOffset * (1 / FIRST_RATE)));
/** 矩形背景,向上移动30dp */
mRectBgCurrentTop = (int) (mPage1RectBgDefaultTop + (FIRST_TOP1 * positionOffset * (1 / FIRST_RATE)));
}
private void stepByHidePage1Views(float positionOffset) {
/**
* 偏移到50%的时候alpha需要为0,view不可见
*
* offset=0
* 255-(255*0.0*(1/0.5)) = 0
*
* offset=0.25
* 255-(255*0.25*(1/0.5)) = 127
*
* offset=0.5
* 255-(255*0.5*(1/0.5)) = 255
*/
mPage1Top.alpha((int) (255 - (255 * positionOffset * (1 / FIRST_RATE))));
mPage1Bottom.alpha((int) (255 - (255 * positionOffset * (1 / FIRST_RATE))));
/** 第1页,顶部图向下移动 */
mPage1Top.currentTop = mPage1Top.defaultTop + (FIRST_TOP2 + FIRST_TOP1) * positionOffset * (1 / FIRST_RATE);
/** 第1页,底部图跟随顶部图向下移动 */
mPage1Bottom.currentTop = mPage1Top.currentTop + mPage1Top.defaultHeight + padding();
}
private void transformRectBgFrom1To2After(float positionOffset) {
/** 快速滑动的时候,可能丢失最后一次绘制,所以需要在这里调重新设置一次,保证变化完成 */
mRectBgCurrentHeight = mPage2RectBgDefaultHeight;
mRectBgCurrentTop = mPage1RectBgDefaultTop + FIRST_TOP1;
/** 第1页,在50%->100%区间偏移 */
/** 矩形背景,在上上偏移30dp后,向下偏移60dp */
mRectBgCurrentTop =
(int) (mPage1RectBgDefaultTop + FIRST_TOP1 + (FIRST_TOP2 * (positionOffset - FIRST_RATE) * 1.0 / (1 - FIRST_RATE)));
}
private void stepByShowPage2Views(float positionOffset) {
/** 第2页,顶部图,跟随矩形背景下移 */
mPage2Top.currentTop = mRectBgCurrentTop + padding();
/** 第2页,底部图,跟随矩形背景下移 */
mPage2Bottom.currentTop = mPage2Center[0].currentTop + mPage2Center[0].defaultHeight + padding();
/** 第2页,计算裂变背景图的偏移px,并修改透明度渐变显示 */
float offset =
(mPage1RectBgDefaultWidth + dp2px(15)) * ((positionOffset - FIRST_RATE) * (1 / (1 - FIRST_RATE)));
mPage2Split[0].currentLeft = mPage2Split[0].defaultLeft - offset;
mPage2Split[1].currentLeft = mPage2Split[0].defaultLeft + offset;
/**
* 偏移到50%的时候alpha需要为0,偏移到100%,alpha需要为255,不过此时positionOffset的取值=0.5~1
*
* offset=0.5
* 255 * (0.5 - 0.5) * (1 / (1 - 0.5)))=255 * 0 = 0
*
* offset=0.75
* 255 * (0.75 - 0.5) * (1 / (1 - 0.5)))=255 * 0.5 = 127.5
*
* offset=1
* 255 * (1 - 0.5) * (1 / (1 - 0.5)))=255 * 1 = 255
*/
mPage2Split[0].alpha((int) (255 * (positionOffset - FIRST_RATE) * (1 / (1 - FIRST_RATE))));
mPage2Split[1].alpha((int) (255 * (positionOffset - FIRST_RATE) * (1 / (1 - FIRST_RATE))));
/** 第2页,顶部,底部图,透明度渐变显示,偏移量达到100%,完成显示 */
mPage2Top.alpha((int) (255 * (positionOffset - FIRST_RATE) * (1 / (1 - FIRST_RATE))));
mPage2Bottom.alpha((int) (255 * (positionOffset - FIRST_RATE) * (1 / (1 - FIRST_RATE))));
/** 第2页,显示中间3张模特图 */
for (int i = 0; i < mPage2Center.length; i++) {
if (i == 0) {
/** 第2页,显示第1张模特图 */
mPage2Center[i].currentWidth =
mPage2Center[i].defaultWidth * (positionOffset - FIRST_RATE) * 1 / (1 - FIRST_RATE);
mPage2Center[i].currentHeight =
mPage2Center[i].defaultHeight * (positionOffset - FIRST_RATE) * 1 / (1 - FIRST_RATE);
mPage2Center[i].alpha((int) (255 * (positionOffset - FIRST_RATE) * (1 / (1 - FIRST_RATE))));
mPage2Center[i].currentTop = mPage2Top.currentTop + mPage2Top.currentHeight + padding();
} else {
/** 第2,3张模特图,在前1张显示到一半时才显示 */
if (mPage2Center[i - 1].currentWidth >= mPage2Center[i - 1].defaultWidth / 2) {
float rate = mPage2Center[i - 1].widthRate() - 0.5f;
mPage2Center[i].currentWidth = mPage2Center[i].defaultWidth * (rate * 2);
mPage2Center[i].currentHeight = mPage2Center[i].defaultHeight * (rate * 2);
/** 第2,3张模特图,需要根据第1张图计算left */
mPage2Center[i].currentLeft =
mPage2Center[0].currentLeft + mPage2Center[0].currentWidth + padding();
mPage2Center[i].currentTop = mPage2Top.currentTop + mPage2Top.currentHeight + padding();
if (i == 2) {
/** 第3张模特图,根据第2张图计算top */
mPage2Center[i].currentTop =
mPage2Center[1].currentTop + mPage2Center[1].currentHeight + padding();
}
mPage2Center[i].alpha((int) (255 * (positionOffset * rate * 2)));
} else {
mPage2Center[i].alpha(0);
}
}
}
}
private void transformRectBgFrom2To3(float positionOffset) {
/** 快速滑动的时候,可能丢失最后一次绘制,所以需要在这里调重新设置一次,保证变化完成 */
mRectBgCurrentHeight = mPage2RectBgDefaultHeight;
mRectBgCurrentTop = mPage2RectBgDefaultTop;
/** 矩形背景,宽度缩小15% */
mRectBgCurrentWidth = (int) (mPage2RectBgDefaultWidth * (1 + SECOND_WIDTH * positionOffset));
mRectBgCurrentLeft = getScreenWidth() / 2 - mRectBgCurrentWidth / 2;
/** 矩形背景,上移20dp */
mRectBgCurrentTop = (int) (mPage2RectBgDefaultTop + (SECOND_TOP * positionOffset));
}
private void stepByHidePage2Views(float positionOffset, int positionOffsetPixels) {
/** 裂变背景图,跟随滑动,向左偏移至消失 */
mPage2Split[0].currentLeft =
(mPage2Split[0].defaultLeft - mPage1RectBgDefaultWidth - dp2px(15)) - positionOffsetPixels
* (1 / SECOND_RATE);
mPage2Split[1].currentLeft =
(mPage2Split[1].defaultLeft + mPage1RectBgDefaultWidth + dp2px(15)) - positionOffsetPixels
* (1 / SECOND_RATE);
mPage2Split[0].alpha((int) (255 - (255 * positionOffset * (1 / SECOND_RATE))));
mPage2Split[1].alpha((int) (255 - (255 * positionOffset * (1 / SECOND_RATE))));
/** 顶部图,3张模特图,底部图,跟随矩形背景上移 */
mPage2Top.currentTop = mRectBgCurrentTop + padding();
mPage2Center[0].currentTop = mPage2Top.currentTop + mPage2Top.currentHeight + padding();
mPage2Center[1].currentTop = mPage2Center[0].currentTop;
mPage2Center[2].currentTop = mPage2Center[1].currentTop + mPage2Center[1].currentHeight;
mPage2Bottom.currentTop = mPage2Center[0].currentTop + mPage2Center[0].currentHeight + padding();
/** 渐渐减少透明度,隐藏第2页的顶部图,3张模特图,底部图 */
mPage2Top.alpha((int) (255 - (255 * positionOffset * (1 / SECOND_RATE))));
mPage2Bottom.alpha((int) (255 - (255 * positionOffset * (1 / SECOND_RATE))));
for (ViewModel viewModel : mPage2Center) {
viewModel.alpha((int) (255 - (255 * positionOffset * (1 / SECOND_RATE))));
}
/** 因为矩形背景变窄了,所以渐渐减少第2页顶部图,底部图的宽度,实现跟随矩形背景宽度变化 */
mPage2Top.currentWidth = mRectBgCurrentWidth - padding() * 2;
mPage2Top.currentLeft = mRectBgCurrentLeft + padding();
mPage2Bottom.currentWidth = mRectBgCurrentWidth - padding() * 2;
mPage2Bottom.currentLeft = mRectBgCurrentLeft + padding();
mPage2Bottom.currentLeft = mRectBgCurrentLeft + padding();
/** 因为矩形背景变窄了,所以渐渐减少第2,3张模特图的宽高,left和top,实现跟随矩形背景宽度变化 */
mPage2Center[0].currentLeft = mRectBgCurrentLeft + padding();
mPage2Center[1].currentWidth = mRectBgCurrentWidth - padding() * 3 - mPage2Center[0].defaultWidth;
mPage2Center[1].currentHeight = mPage2Center[1].currentWidth;
mPage2Center[1].currentLeft = mPage2Center[0].currentLeft + mPage2Center[0].defaultWidth + padding();
mPage2Center[2].currentWidth = mRectBgCurrentWidth - padding() * 3 - mPage2Center[0].defaultWidth;
mPage2Center[2].currentHeight = mPage2Center[2].currentWidth;
mPage2Center[2].currentLeft = mPage2Center[0].currentLeft + mPage2Center[0].defaultWidth + padding();
mPage2Center[2].currentTop = mPage2Center[1].currentTop + mPage2Center[1].currentHeight + padding();
}
private void stepByShowPage3Views(float positionOffset) {
/** 第2页,在50->100%区间偏移,显示第3页,6张模特图 */
for (int i = 0; i < mPage3Model.length; i++) {
if (i == 0) {
/** 第1张模特图先显示 */
if (mPage3Model[i].paint.getAlpha() < 255) {
mPage3Model[i].alpha((int) (255 * (positionOffset - SECOND_RATE) * (1 / (1 - SECOND_RATE))));
}
} else {
/** 其他模特图在前1张显示50%透明度的时候再依次展示 */
if (mPage3Model[i - 1].paint.getAlpha() >= 255 / 2) {
float rate = mPage3Model[i - 1].paint.getAlpha() / 255.0f - 0.5f;
mPage3Model[i].alpha((int) (255 * (rate * 2)));
} else {
mPage3Model[i].alpha(0);
}
}
/** 6张模特图,跟随矩形背景上移 */
if (i < mPage3ModelResources.length / 2) {
/** 第1排,3张模特图的top计算 */
mPage3Model[i].currentTop = mRectBgCurrentTop + padding();
} else {
/** 第1排,3张模特图的top,需要加上第一排的height */
mPage3Model[i].currentTop = mRectBgCurrentTop + mPage3ModelDefaultHeight + padding() * 2;
}
}
}
private boolean isPage4(int currentPageIndex) {
return currentPageIndex == 3;
}
private boolean fromPage3ToPage4(int position) {
return position == 2;
}
private boolean fromPage2ToPage3(int position) {
return position == 1;
}
private boolean fromPage1ToPage2(int position) {
return position == 0;
}
private void hidePage4Views() {
mPage4Top.alpha(0);
for (ViewModel viewModel : mPage4Model) {
viewModel.currentWidth = 0;
viewModel.currentHeight = 0;
viewModel.alpha(0);
}
for (ViewModel viewModel : mPage4Split) {
viewModel.alpha(0);
}
}
private void hidePage3Views() {
for (int i = 0; i < mPage3Model.length; i++) {
mPage3Model[i].alpha(0);
}
}
private void scaleHidePage3Views() {
for (int i = 0; i < mPage3Model.length; i++) {
mPage3Model[i].currentWidth = 0;
mPage3Model[i].currentHeight = 0;
}
}
private void hidePage1Views() {
mPage1Top.alpha(0);
mPage1Bottom.alpha(0);
}
private void hidePage2Views() {
mPage2Top.alpha(0);
mPage2Bottom.alpha(0);
for (ViewModel viewModel : mPage2Center) {
viewModel.alpha(0);
}
for (ViewModel viewModel : mPage2Split) {
viewModel.alpha(0);
}
}
public void drawBitmap(Canvas canvas, ViewModel viewModel) {
canvas.drawBitmap(viewModel.bitmap, viewModel.currentLeft, viewModel.currentTop, viewModel.paint);
}
public void drawBitmapMatrix(Canvas canvas, ViewModel viewModel) {
canvas.drawBitmap(viewModel.bitmap, viewModel.matrix, viewModel.paint);
}
public void drawBitmapRect(Canvas canvas, ViewModel viewModel) {
RectF rect = new RectF();
rect.left = viewModel.currentLeft;
rect.top = viewModel.currentTop;
rect.right = rect.left + viewModel.currentWidth;
rect.bottom = rect.top + viewModel.currentHeight;
canvas.drawBitmap(viewModel.bitmap, null, rect, viewModel.paint);
}
/**
* @desc 根据当前页面,绘制不同的view
* @author listen
*/
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
/** 按重叠顺序绘制 */
if (fromPage1ToPage2(mCurrentPageIndex)) {
/** 绘制第1页,底部背景图 */
drawBitmap(canvas, mPage1BottomBg);
/** 绘制第2页,裂变背景图 */
drawBitmap(canvas, mPage2Split[0]);
drawBitmap(canvas, mPage2Split[1]);
/** 绘制白色矩形背景 */
drawWhiteRectBackgroud(canvas);
drawPage1InCanvas(canvas);
drawPage2InCanvas(canvas);
} else if (fromPage2ToPage3(mCurrentPageIndex)) {
/** 绘制第2页,裂变背景图 */
drawBitmap(canvas, mPage2Split[0]);
drawBitmap(canvas, mPage2Split[1]);
/** 绘制矩形背景 */
drawWhiteRectBackgroud(canvas);
drawPage2InCanvas(canvas);
drawPage3InCanvas(canvas);
} else if (fromPage3ToPage4(mCurrentPageIndex)) {
/** 绘制第4页,裂变背景图 */
drawBitmapMatrix(canvas, mPage4Split[0]);
drawBitmapMatrix(canvas, mPage4Split[1]);
/** 绘制矩形背景 */
drawWhiteRectBackgroud(canvas);
drawPage3InCanvas(canvas);
drawPage4InCanvas(canvas);
} else if (isPage4(mCurrentPageIndex)) {
/** 绘制第4页,裂变背景图 */
drawBitmapMatrix(canvas, mPage4Split[0]);
drawBitmapMatrix(canvas, mPage4Split[1]);
/** 绘制矩形背景 */
drawWhiteRectBackgroud(canvas);
drawPage4InCanvas(canvas);
}
}
private void drawPage1InCanvas(Canvas canvas) {
/** 绘制第1页,顶部模特图 */
drawBitmap(canvas, mPage1Top);
/** 绘制第1页,底部文案图 */
drawBitmap(canvas, mPage1Bottom);
}
private void drawPage4InCanvas(Canvas canvas) {
/** 绘制第4页,顶部模特图 */
drawBitmap(canvas, mPage4Top);
/** 绘制第4页,底部3张模特图 */
for (int i = 0; i < mPage4Model.length; i++) {
drawBitmapRect(canvas, mPage4Model[i]);
}
}
private void drawPage3InCanvas(Canvas canvas) {
/** 绘制第3页,6张模特图 */
for (int i = 0; i < mPage3Model.length; i++) {
drawBitmapRect(canvas, mPage3Model[i]);
}
}
private void drawPage2InCanvas(Canvas canvas) {
/** 绘制第2页,顶部图 */
drawBitmapRect(canvas, mPage2Top);
/** 绘制第2页,第1张模特图 */
drawBitmapRect(canvas, mPage2Center[0]);
/** 在第1张模特图绘制到50%时,绘制第2张模特图 */
if (mPage2Center[0].currentWidth >= mPage2Center[0].defaultWidth / 2) {
drawBitmapRect(canvas, mPage2Center[1]);
/** 在第2张模特图绘制到50%时,绘制第3张模特图 */
if (mPage2Center[1].currentWidth >= mPage2Center[1].defaultWidth / 2) {
drawBitmapRect(canvas, mPage2Center[2]);
}
}
/** 绘制第2页,底部图 */
drawBitmapRect(canvas, mPage2Bottom);
}
@NonNull
private RectF drawWhiteRectBackgroud(Canvas canvas) {
RectF rect = new RectF();
rect.left = mRectBgCurrentLeft;
rect.top = mRectBgCurrentTop;
rect.right = rect.left + mRectBgCurrentWidth;
rect.bottom = rect.top + mRectBgCurrentHeight;
canvas.rotate(mRectBgCurrentDegree, rect.left + mRectBgCurrentWidth / 2, rect.top + mRectBgCurrentHeight / 2);
canvas.drawRoundRect(rect, mRectBgDefaultCorner, mRectBgDefaultCorner, mRectBgPaint);
return rect;
}
private int padding() {
return dp2px(5);
}
public int getScreenWidth() {
if (null != getResources() && null != getResources().getDisplayMetrics()) {
return getResources().getDisplayMetrics().widthPixels;
}
return 0;
}
public int getScreenHeight() {
if (null != getResources() && null != getResources().getDisplayMetrics()) {
return getResources().getDisplayMetrics().heightPixels;
}
return 0;
}
public int dp2px(float dpValue) {
final float scale = getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
} | [
"[email protected]"
]
| |
469ac61f49fd288fbf223675881cd300ec7d0b40 | c9475cd3f125709e89639877025e55cd04a6309a | /src/test/java/step_definitions/BaseTest.java | beab5cc4ed88fdf84d9f4baa36c95c652296286b | []
| no_license | gunasekarhp/MyFirstProject | e539d52122cee35a8f21b61668fd275370d02e28 | f00c0769ae954d3f1bbec3c08101c960bc3ca40b | refs/heads/master | 2020-12-02T07:51:47.414278 | 2017-07-10T05:00:19 | 2017-07-10T05:00:19 | 96,737,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package step_definitions;
import java.net.MalformedURLException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.chrome.ChromeDriver;
import cucumber.api.Scenario;
import cucumber.api.java.After;
import cucumber.api.java.Before;
public class BaseTest {
public static WebDriver driver;
@Before
/**
* Delete all cookies at the start of each scenario to avoid
* shared state between tests
*/
public void openBrowser() throws MalformedURLException {
System.out.println("Called openBrowser");
driver = new ChromeDriver();
driver.manage().deleteAllCookies();
driver.manage().window().maximize();
}
@After
/**
* Embed a screenshot in test report if test is marked as failed
*/
public void embedScreenshot(Scenario scenario) {
// if(scenario.isFailed()) {
try {
scenario.write("Current Page URL is " + driver.getCurrentUrl());
// byte[] screenshot = getScreenshotAs(OutputType.BYTES);
byte[] screenshot = ((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES);
scenario.embed(screenshot, "image/png");
} catch (WebDriverException somePlatformsDontSupportScreenshots) {
System.err.println(somePlatformsDontSupportScreenshots.getMessage());
}
// }
driver.quit();
}
} | [
"[email protected]"
]
| |
0890ab45d7d46f460b06610baf9175e383bdefdf | d19f951901ce84c30969b35006b595bc18ea3325 | /lcb-common/src/main/java/com/lcb/common/utils/poi/ExcelUtil.java | f5cb86196462614743f607da98bfa6b97d438d08 | [
"Apache-2.0"
]
| permissive | GitHub-lcb/lcb-code | 951019f960a251eccb3ba0c9af85e57c4d7d6d6d | 7cc09faf9ca02662f8dbeea738c82241ea237b96 | refs/heads/main | 2023-02-13T13:12:57.414589 | 2021-01-08T07:27:53 | 2021-01-08T07:27:53 | 321,273,320 | 0 | 0 | NOASSERTION | 2021-01-08T07:27:54 | 2020-12-14T07:55:29 | Java | UTF-8 | Java | false | false | 27,817 | java | package com.lcb.common.utils.poi;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DataValidation;
import org.apache.poi.ss.usermodel.DataValidationConstraint;
import org.apache.poi.ss.usermodel.DataValidationHelper;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.lcb.common.annotation.Excel;
import com.lcb.common.annotation.Excel.ColumnType;
import com.lcb.common.annotation.Excel.Type;
import com.lcb.common.annotation.Excels;
import com.lcb.common.config.LcbConfig;
import com.lcb.common.core.domain.AjaxResult;
import com.lcb.common.core.text.Convert;
import com.lcb.common.exception.CustomException;
import com.lcb.common.utils.DateUtils;
import com.lcb.common.utils.DictUtils;
import com.lcb.common.utils.StringUtils;
import com.lcb.common.utils.reflect.ReflectUtils;
/**
* Excel相关处理
*
* @author lcb
*/
public class ExcelUtil<T> {
private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class);
/**
* Excel sheet最大行数,默认65536
*/
public static final int sheetSize = 65536;
/**
* 工作表名称
*/
private String sheetName;
/**
* 导出类型(EXPORT:导出数据;IMPORT:导入模板)
*/
private Type type;
/**
* 工作薄对象
*/
private Workbook wb;
/**
* 工作表对象
*/
private Sheet sheet;
/**
* 样式列表
*/
private Map<String, CellStyle> styles;
/**
* 导入导出数据列表
*/
private List<T> list;
/**
* 注解列表
*/
private List<Object[]> fields;
/**
* 统计列表
*/
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
/**
* 数字格式
*/
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
/**
* 实体对象
*/
public Class<T> clazz;
public ExcelUtil(Class<T> clazz) {
this.clazz = clazz;
}
public void init(List<T> list, String sheetName, Type type) {
if (list == null) {
list = new ArrayList<T>();
}
this.list = list;
this.sheetName = sheetName;
this.type = type;
createExcelField();
createWorkbook();
}
/**
* 对excel表单默认第一个索引名转换成list
*
* @param is
* 输入流
* @return 转换后集合
*/
public List<T> importExcel(InputStream is) throws Exception {
return importExcel(StringUtils.EMPTY, is);
}
/**
* 对excel表单指定表格索引名转换成list
*
* @param sheetName
* 表格索引名
* @param is
* 输入流
* @return 转换后集合
*/
public List<T> importExcel(String sheetName, InputStream is) throws Exception {
this.type = Type.IMPORT;
this.wb = WorkbookFactory.create(is);
List<T> list = new ArrayList<T>();
Sheet sheet = null;
if (StringUtils.isNotEmpty(sheetName)) {
// 如果指定sheet名,则取指定sheet中的内容.
sheet = wb.getSheet(sheetName);
} else {
// 如果传入的sheet名不存在则默认指向第1个sheet.
sheet = wb.getSheetAt(0);
}
if (sheet == null) {
throw new IOException("文件sheet不存在");
}
int rows = sheet.getPhysicalNumberOfRows();
if (rows > 0) {
// 定义一个map用于存放excel列的序号和field.
Map<String, Integer> cellMap = new HashMap<String, Integer>();
// 获取表头
Row heard = sheet.getRow(0);
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) {
Cell cell = heard.getCell(i);
if (StringUtils.isNotNull(cell)) {
String value = this.getCellValue(heard, i).toString();
cellMap.put(value, i);
} else {
cellMap.put(null, i);
}
}
// 有数据时才处理 得到类的所有field.
Field[] allFields = clazz.getDeclaredFields();
// 定义一个map用于存放列的序号和field.
Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>();
for (int col = 0; col < allFields.length; col++) {
Field field = allFields[col];
Excel attr = field.getAnnotation(Excel.class);
if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) {
// 设置类的私有字段属性可访问.
field.setAccessible(true);
Integer column = cellMap.get(attr.name());
if (column != null) {
fieldsMap.put(column, field);
}
}
}
for (int i = 1; i < rows; i++) {
// 从第2行开始取数据,默认第一行是表头.
Row row = sheet.getRow(i);
T entity = null;
for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet()) {
Object val = this.getCellValue(row, entry.getKey());
// 如果不存在实例则新建.
entity = (entity == null ? clazz.newInstance() : entity);
// 从map中得到对应列的field.
Field field = fieldsMap.get(entry.getKey());
// 取得类型,并根据对象类型设置值.
Class<?> fieldType = field.getType();
if (String.class == fieldType) {
String s = Convert.toStr(val);
if (StringUtils.endsWith(s, ".0")) {
val = StringUtils.substringBefore(s, ".0");
} else {
val = Convert.toStr(val);
}
} else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(
Convert.toStr(val))) {
val = Convert.toInt(val);
} else if (Long.TYPE == fieldType || Long.class == fieldType) {
val = Convert.toLong(val);
} else if (Double.TYPE == fieldType || Double.class == fieldType) {
val = Convert.toDouble(val);
} else if (Float.TYPE == fieldType || Float.class == fieldType) {
val = Convert.toFloat(val);
} else if (BigDecimal.class == fieldType) {
val = Convert.toBigDecimal(val);
} else if (Date.class == fieldType) {
if (val instanceof String) {
val = DateUtils.parseDate(val);
} else if (val instanceof Double) {
val = DateUtil.getJavaDate((Double) val);
}
} else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) {
val = Convert.toBool(val, false);
}
if (StringUtils.isNotNull(fieldType)) {
Excel attr = field.getAnnotation(Excel.class);
String propertyName = field.getName();
if (StringUtils.isNotEmpty(attr.targetAttr())) {
propertyName = field.getName() + "." + attr.targetAttr();
} else if (StringUtils.isNotEmpty(attr.readConverterExp())) {
val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
} else if (StringUtils.isNotEmpty(attr.dictType())) {
val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator());
}
ReflectUtils.invokeSetter(entity, propertyName, val);
}
}
list.add(entity);
}
}
return list;
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @param list
* 导出数据集合
* @param sheetName
* 工作表的名称
* @return 结果
*/
public AjaxResult exportExcel(List<T> list, String sheetName) {
this.init(list, sheetName, Type.EXPORT);
return exportExcel();
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @param sheetName
* 工作表的名称
* @return 结果
*/
public AjaxResult importTemplateExcel(String sheetName) {
this.init(null, sheetName, Type.IMPORT);
return exportExcel();
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @return 结果
*/
public AjaxResult exportExcel() {
OutputStream out = null;
try {
// 取出一共有多少个sheet.
double sheetNo = Math.ceil(list.size() / sheetSize);
for (int index = 0; index <= sheetNo; index++) {
createSheet(sheetNo, index);
// 产生一行
Row row = sheet.createRow(0);
int column = 0;
// 写入各个字段的列头名称
for (Object[] os : fields) {
Excel excel = (Excel) os[1];
this.createCell(excel, row, column++);
}
if (Type.EXPORT.equals(type)) {
fillExcelData(index, row);
addStatisticsRow();
}
}
String filename = encodingFilename(sheetName);
out = new FileOutputStream(getAbsoluteFile(filename));
wb.write(out);
return AjaxResult.success(filename);
} catch (Exception e) {
log.error("导出Excel异常{}", e.getMessage());
throw new CustomException("导出Excel失败,请联系网站管理员!");
} finally {
if (wb != null) {
try {
wb.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (out != null) {
try {
out.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
/**
* 填充excel数据
*
* @param index
* 序号
* @param row
* 单元格行
*/
public void fillExcelData(int index, Row row) {
int startNo = index * sheetSize;
int endNo = Math.min(startNo + sheetSize, list.size());
for (int i = startNo; i < endNo; i++) {
row = sheet.createRow(i + 1 - startNo);
// 得到导出对象.
T vo = (T) list.get(i);
int column = 0;
for (Object[] os : fields) {
Field field = (Field) os[0];
Excel excel = (Excel) os[1];
// 设置实体类私有属性可访问
field.setAccessible(true);
this.addCell(excel, row, vo, field, column++);
}
}
}
/**
* 创建表格样式
*
* @param wb
* 工作薄对象
* @return 样式列表
*/
private Map<String, CellStyle> createStyles(Workbook wb) {
// 写入各条记录,每条记录对应excel表中的一行
Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
CellStyle style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setBorderRight(BorderStyle.THIN);
style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderLeft(BorderStyle.THIN);
style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderTop(BorderStyle.THIN);
style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setBorderBottom(BorderStyle.THIN);
style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
Font dataFont = wb.createFont();
dataFont.setFontName("Arial");
dataFont.setFontHeightInPoints((short) 10);
style.setFont(dataFont);
styles.put("data", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
Font headerFont = wb.createFont();
headerFont.setFontName("Arial");
headerFont.setFontHeightInPoints((short) 10);
headerFont.setBold(true);
headerFont.setColor(IndexedColors.WHITE.getIndex());
style.setFont(headerFont);
styles.put("header", style);
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
Font totalFont = wb.createFont();
totalFont.setFontName("Arial");
totalFont.setFontHeightInPoints((short) 10);
style.setFont(totalFont);
styles.put("total", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.LEFT);
styles.put("data1", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.CENTER);
styles.put("data2", style);
style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.RIGHT);
styles.put("data3", style);
return styles;
}
/**
* 创建单元格
*/
public Cell createCell(Excel attr, Row row, int column) {
// 创建列
Cell cell = row.createCell(column);
// 写入列信息
cell.setCellValue(attr.name());
setDataValidation(attr, row, column);
cell.setCellStyle(styles.get("header"));
return cell;
}
/**
* 设置单元格信息
*
* @param value
* 单元格值
* @param attr
* 注解相关
* @param cell
* 单元格信息
*/
public void setCellVo(Object value, Excel attr, Cell cell) {
if (ColumnType.STRING == attr.cellType()) {
cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix());
} else if (ColumnType.NUMERIC == attr.cellType()) {
cell.setCellValue(
StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
}
}
/**
* 创建表格样式
*/
public void setDataValidation(Excel attr, Row row, int column) {
if (attr.name().indexOf("注:") >= 0) {
sheet.setColumnWidth(column, 6000);
} else {
// 设置列宽
sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256));
row.setHeight((short) (attr.height() * 20));
}
// 如果设置了提示信息则鼠标放上去提示.
if (StringUtils.isNotEmpty(attr.prompt())) {
// 这里默认设了2-101列提示.
setXSSFPrompt(sheet, "", attr.prompt(), 1, 100, column, column);
}
// 如果设置了combo属性则本列只能选择不能输入
if (attr.combo().length > 0) {
// 这里默认设了2-101列只能选择不能输入.
setXSSFValidation(sheet, attr.combo(), 1, 100, column, column);
}
}
/**
* 添加单元格
*/
public Cell addCell(Excel attr, Row row, T vo, Field field, int column) {
Cell cell = null;
try {
// 设置行高
row.setHeight((short) (attr.height() * 20));
// 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
if (attr.isExport()) {
// 创建cell
cell = row.createCell(column);
int align = attr.align().value();
cell.setCellStyle(styles.get("data" + (align >= 1 && align <= 3 ? align : "")));
// 用于读取对象中的属性
Object value = getTargetValue(vo, field, attr);
String dateFormat = attr.dateFormat();
String readConverterExp = attr.readConverterExp();
String separator = attr.separator();
String dictType = attr.dictType();
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) {
cell.setCellValue(DateUtils.parseDateToStr(dateFormat, (Date) value));
} else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) {
cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator));
} else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value)) {
cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator));
} else if (value instanceof BigDecimal && -1 != attr.scale()) {
cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString());
} else {
// 设置列类型
setCellVo(value, attr, cell);
}
addStatisticsData(column, Convert.toStr(value), attr);
}
} catch (Exception e) {
log.error("导出Excel失败{}", e);
}
return cell;
}
/**
* 设置 POI XSSFSheet 单元格提示
*
* @param sheet
* 表单
* @param promptTitle
* 提示标题
* @param promptContent
* 提示内容
* @param firstRow
* 开始行
* @param endRow
* 结束行
* @param firstCol
* 开始列
* @param endCol
* 结束列
*/
public void setXSSFPrompt(Sheet sheet, String promptTitle, String promptContent, int firstRow, int endRow,
int firstCol, int endCol) {
DataValidationHelper helper = sheet.getDataValidationHelper();
DataValidationConstraint constraint = helper.createCustomConstraint("DD1");
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
DataValidation dataValidation = helper.createValidation(constraint, regions);
dataValidation.createPromptBox(promptTitle, promptContent);
dataValidation.setShowPromptBox(true);
sheet.addValidationData(dataValidation);
}
/**
* 设置某些列的值只能输入预制的数据,显示下拉框.
*
* @param sheet
* 要设置的sheet.
* @param textlist
* 下拉框显示的内容
* @param firstRow
* 开始行
* @param endRow
* 结束行
* @param firstCol
* 开始列
* @param endCol
* 结束列
* @return 设置好的sheet.
*/
public void setXSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) {
DataValidationHelper helper = sheet.getDataValidationHelper();
// 加载下拉列表内容
DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist);
// 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
// 数据有效性对象
DataValidation dataValidation = helper.createValidation(constraint, regions);
// 处理Excel兼容性问题
if (dataValidation instanceof XSSFDataValidation) {
dataValidation.setSuppressDropDownArrow(true);
dataValidation.setShowErrorBox(true);
} else {
dataValidation.setSuppressDropDownArrow(false);
}
sheet.addValidationData(dataValidation);
}
/**
* 解析导出值 0=男,1=女,2=未知
*
* @param propertyValue
* 参数值
* @param converterExp
* 翻译注解
* @param separator
* 分隔符
* @return 解析后值
*/
public static String convertByExp(String propertyValue, String converterExp, String separator) {
StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(",");
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (StringUtils.containsAny(separator, propertyValue)) {
for (String value : propertyValue.split(separator)) {
if (itemArray[0].equals(value)) {
propertyString.append(itemArray[1] + separator);
break;
}
}
} else {
if (itemArray[0].equals(propertyValue)) {
return itemArray[1];
}
}
}
return StringUtils.stripEnd(propertyString.toString(), separator);
}
/**
* 反向解析值 男=0,女=1,未知=2
*
* @param propertyValue
* 参数值
* @param converterExp
* 翻译注解
* @param separator
* 分隔符
* @return 解析后值
*/
public static String reverseByExp(String propertyValue, String converterExp, String separator) {
StringBuilder propertyString = new StringBuilder();
String[] convertSource = converterExp.split(",");
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (StringUtils.containsAny(separator, propertyValue)) {
for (String value : propertyValue.split(separator)) {
if (itemArray[1].equals(value)) {
propertyString.append(itemArray[0] + separator);
break;
}
}
} else {
if (itemArray[1].equals(propertyValue)) {
return itemArray[0];
}
}
}
return StringUtils.stripEnd(propertyString.toString(), separator);
}
/**
* 解析字典值
*
* @param dictValue
* 字典值
* @param dictType
* 字典类型
* @param separator
* 分隔符
* @return 字典标签
*/
public static String convertDictByExp(String dictValue, String dictType, String separator) {
return DictUtils.getDictLabel(dictType, dictValue, separator);
}
/**
* 反向解析值字典值
*
* @param dictLabel
* 字典标签
* @param dictType
* 字典类型
* @param separator
* 分隔符
* @return 字典值
*/
public static String reverseDictByExp(String dictLabel, String dictType, String separator) {
return DictUtils.getDictValue(dictType, dictLabel, separator);
}
/**
* 合计统计信息
*/
private void addStatisticsData(Integer index, String text, Excel entity) {
if (entity != null && entity.isStatistics()) {
Double temp = 0D;
if (!statistics.containsKey(index)) {
statistics.put(index, temp);
}
try {
temp = Double.valueOf(text);
} catch (NumberFormatException e) {
}
statistics.put(index, statistics.get(index) + temp);
}
}
/**
* 创建统计行
*/
public void addStatisticsRow() {
if (statistics.size() > 0) {
Cell cell = null;
Row row = sheet.createRow(sheet.getLastRowNum() + 1);
Set<Integer> keys = statistics.keySet();
cell = row.createCell(0);
cell.setCellStyle(styles.get("total"));
cell.setCellValue("合计");
for (Integer key : keys) {
cell = row.createCell(key);
cell.setCellStyle(styles.get("total"));
cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key)));
}
statistics.clear();
}
}
/**
* 编码文件名
*/
public String encodingFilename(String filename) {
filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx";
return filename;
}
/**
* 获取下载路径
*
* @param filename
* 文件名称
*/
public String getAbsoluteFile(String filename) {
String downloadPath = LcbConfig.getDownloadPath() + filename;
File desc = new File(downloadPath);
if (!desc.getParentFile().exists()) {
desc.getParentFile().mkdirs();
}
return downloadPath;
}
/**
* 获取bean中的属性值
*
* @param vo
* 实体对象
* @param field
* 字段
* @param excel
* 注解
* @return 最终的属性值
* @throws Exception
*/
private Object getTargetValue(T vo, Field field, Excel excel) throws Exception {
Object o = field.get(vo);
if (StringUtils.isNotEmpty(excel.targetAttr())) {
String target = excel.targetAttr();
if (target.indexOf(".") > -1) {
String[] targets = target.split("[.]");
for (String name : targets) {
o = getValue(o, name);
}
} else {
o = getValue(o, target);
}
}
return o;
}
/**
* 以类的属性的get方法方法形式获取值
*
* @param o
* @param name
* @return value
* @throws Exception
*/
private Object getValue(Object o, String name) throws Exception {
if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name)) {
Class<?> clazz = o.getClass();
Field field = clazz.getDeclaredField(name);
field.setAccessible(true);
o = field.get(o);
}
return o;
}
/**
* 得到所有定义字段
*/
private void createExcelField() {
this.fields = new ArrayList<Object[]>();
List<Field> tempFields = new ArrayList<>();
tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
for (Field field : tempFields) {
// 单注解
if (field.isAnnotationPresent(Excel.class)) {
putToField(field, field.getAnnotation(Excel.class));
}
// 多注解
if (field.isAnnotationPresent(Excels.class)) {
Excels attrs = field.getAnnotation(Excels.class);
Excel[] excels = attrs.value();
for (Excel excel : excels) {
putToField(field, excel);
}
}
}
this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(
Collectors.toList());
}
/**
* 放到字段集合中
*/
private void putToField(Field field, Excel attr) {
if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) {
this.fields.add(new Object[] { field, attr });
}
}
/**
* 创建一个工作簿
*/
public void createWorkbook() {
this.wb = new SXSSFWorkbook(500);
}
/**
* 创建工作表
*
* @param sheetNo
* sheet数量
* @param index
* 序号
*/
public void createSheet(double sheetNo, int index) {
this.sheet = wb.createSheet();
this.styles = createStyles(wb);
// 设置工作表的名称.
if (sheetNo == 0) {
wb.setSheetName(index, sheetName);
} else {
wb.setSheetName(index, sheetName + index);
}
}
/**
* 获取单元格值
*
* @param row
* 获取的行
* @param column
* 获取单元格列号
* @return 单元格值
*/
public Object getCellValue(Row row, int column) {
if (row == null) {
return row;
}
Object val = "";
try {
Cell cell = row.getCell(column);
if (StringUtils.isNotNull(cell)) {
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) {
val = cell.getNumericCellValue();
if (DateUtil.isCellDateFormatted(cell)) {
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
} else {
if ((Double) val % 1 > 0) {
val = new BigDecimal(val.toString());
} else {
val = new DecimalFormat("0").format(val);
}
}
} else if (cell.getCellType() == CellType.STRING) {
val = cell.getStringCellValue();
} else if (cell.getCellType() == CellType.BOOLEAN) {
val = cell.getBooleanCellValue();
} else if (cell.getCellType() == CellType.ERROR) {
val = cell.getErrorCellValue();
}
}
} catch (Exception e) {
return val;
}
return val;
}
} | [
"[email protected]"
]
| |
31aa97783d81044cb1e8f70d4664ffd99ed32927 | a698a845146e3dd5ced564be08cca3bcb36ae837 | /src/main/java/com/service/DAO/BranchCounterService.java | 557eb933fb4939de947e5676dd15106b9e26833c | []
| no_license | freelancerforever92/indents | 10c0bf57acda8178f171285900810688e26f3281 | 57b76a175155f9a54c2617e5c622e5b114e61658 | refs/heads/master | 2021-05-05T14:33:06.402416 | 2018-01-23T10:46:33 | 2018-01-23T10:46:33 | 116,013,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package com.service.DAO;
import java.util.List;
import com.models.Counters;
public interface BranchCounterService {
public List<Counters> getCounters();
public String addCounterToSession(String counterLegacyNo);
}
| [
"[email protected]"
]
| |
4b17c2f603aff55b54480e0afe44a4fe17c65e3c | 9eac35494f77603bd6c0064e1cf0360bbeb146f5 | /VESIT/src/com/ratan/vesit/adapter/GridViewAdapter.java | f1f6b03c1ff240e38e774bc375f9ebe1dd4ed00f | []
| no_license | varun1712/xbmxcc | c647fe566ce4da330a3f5a5a924640a12e58aacd | bfa09f417b1cc8d78edad7c64e2206bd9d79f547 | refs/heads/master | 2016-09-08T01:46:15.309008 | 2015-01-11T11:17:50 | 2015-01-11T11:17:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,083 | java | package com.ratan.vesit.adapter;
import java.util.ArrayList;
import java.util.List;
import com.ratan.vesit.R;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.ratan.vesit.model.Wallpaper;
import com.ratan.vesit.util.AppController;
public class GridViewAdapter extends BaseAdapter {
private Activity _activity;
private LayoutInflater inflater;
private List<Wallpaper> wallpapersList = new ArrayList<Wallpaper>();
private int imageWidth;
ImageLoader imageLoader = AppController.getInstance().getImageLoader();
public GridViewAdapter(Activity activity, List<Wallpaper> wallpapersList,
int imageWidth) {
this._activity = activity;
this.wallpapersList = wallpapersList;
this.imageWidth = imageWidth;
}
@Override
public int getCount() {
return this.wallpapersList.size();
}
@Override
public Object getItem(int position) {
return this.wallpapersList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (inflater == null)
inflater = (LayoutInflater) _activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null)
convertView = inflater.inflate(R.layout.grid_item_photo, null);
if (imageLoader == null)
imageLoader = AppController.getInstance().getImageLoader();
// Grid thumbnail image view
NetworkImageView thumbNail = (NetworkImageView) convertView
.findViewById(R.id.thumbnail);
Wallpaper p = wallpapersList.get(position);
thumbNail.setScaleType(ImageView.ScaleType.CENTER_CROP);
thumbNail.setLayoutParams(new RelativeLayout.LayoutParams(imageWidth,
imageWidth));
thumbNail.setImageUrl(p.getUrl(), imageLoader);
return convertView;
}
} | [
"[email protected]"
]
| |
d7a6f0a12b65de30ea90a3775f72e829caa4d299 | fc8f4be911ebb73e12aa22b8a76d9d8ce6dc5a2a | /coco/src/java_core/clone/TestClone.java | 4c93b4b31a90c45a00dd66b611fa5446df550e66 | []
| no_license | RSDS/learn_concurrent | c5d4aacb9b3eae088cda3a14c7487321bab28818 | 8949059e6fe143fea38e754d5b8bcbf5e2e4e6a3 | refs/heads/master | 2020-03-21T17:33:11.964471 | 2018-07-30T06:28:03 | 2018-07-30T06:28:03 | 138,838,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | package java_core.clone;
/**
* Description:
* Author: 徐少斌
* CreateTime: 2018/7/17 13:34
* ModifiedBy:
* ModifiedTime:
*/
public class TestClone {
public static void main(String[] args) {
Fresh fresh = new Fresh(3);
Orange orange1 = new Orange("green", 3, fresh);
try {
Orange orange2 = orange1.Clone();
orange2.setColor("red");
System.out.println(orange1.getColor());
orange2.setPrice(50);
System.out.println(orange1.getPrice());
fresh.setTime(50);
//orange2.setFresh();
System.out.println(orange1.getFresh().getTime());
}catch (Exception e){
System.out.println("error::::::::::::::");
e.printStackTrace();
e.getStackTrace();
}
}
}
| [
"[email protected]"
]
| |
0fde56d8334acb5b359059694b0d272d40c8144b | dd4c33fbe87b551efd5ef35b47844c2b6316df4a | /src/ApprovalAssignmentTemplate.java | 78de0447441d6b35432aacf5c13117a8e814c787 | []
| no_license | FlorianIAM/IIQ_TemplateRules | f9800d0a06bab7c5be068d613566b4240dfb86e1 | d74c16318557f3640d12916faa00dbffdde95815 | refs/heads/main | 2023-06-14T01:16:15.645820 | 2021-07-18T20:21:31 | 2021-07-18T20:21:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 918 | java | import java.util.List;
import sailpoint.object.ApprovalSet;
import sailpoint.api.SailPointContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class ApprovalAssignmentTemplate extends GlobalRuleLibrary {
private static sailpoint.api.SailPointContext context=null;
private static org.apache.commons.logging.Log log=null;
private static java.util.List approvals = null;
private static sailpoint.object.ApprovalSet approvalSet = null;
public static void main(String[] args) {
//Log mylogger = LogFactory.getLog("rule.ApprovalAssignment");
//mylogger.debug("Start ApprovalAssignment");
//add the following lines to IIQ Log4j properties file to use this logger
//logger.ApprovalAssignment.name=rule.ApprovalAssignment
//logger.ApprovalAssignment.level=debug
//mylogger.debug("End ApprovalAssignment");
//this rule does not return anything
}
}
| [
"[email protected]"
]
| |
119d219310c33ba16ec51dbe9fd8308347b1e780 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project424/src/main/java/org/gradle/test/performance/largejavamultiproject/project424/p2120/Production42404.java | f5d3a90d4a4b54fc03884cf79714ea081de42f3d | []
| no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,890 | java | package org.gradle.test.performance.largejavamultiproject.project424.p2120;
public class Production42404 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"[email protected]"
]
| |
a831dfe8c4c16b8eea0075ccd53f20fd6ab62899 | bab974f96e9f5829185aaa6928693df7c0c149bf | /configx-client/src/main/java/com/configx/client/beans/VersionBeans.java | 53b4560c97baf1c458175ac8dec7b51af246ffb2 | [
"Apache-2.0"
]
| permissive | hnpyhyz/configx | ce2bb1fb5bc8ddc6d3936a6b577dfd4aa5d0cb84 | 5766ab97174908bad3e0536bab82eece11496a56 | refs/heads/master | 2021-05-05T12:40:42.807070 | 2017-09-17T03:47:41 | 2017-09-17T03:47:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,233 | java | /**
* $Id$
* Copyright(C) 2012-2016 configx.com. All rights reserved.
*/
package com.configx.client.beans;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
/**
* 管理某个版本的Beans
*
* @author Zhirong Zou
*/
public class VersionBeans {
/**
* 版本号
*/
private long version;
/**
* bean信息,BeanName -> Bean
*/
private ConcurrentHashMap<String, VersionBean> beansMap = new ConcurrentHashMap<>();
public VersionBeans(long version) {
this.version = version;
}
/**
* 返回版本号
*
* @return
*/
public long getVersion() {
return version;
}
/**
* 返回Bean名称列表
*
* @return
*/
public Collection<String> getBeanNames() {
return beansMap.keySet();
}
/**
* 返回Bean列表
*
* @return
*/
public Collection<Object> getBeans() {
List<Object> values = new ArrayList<>();
for (VersionBean versionBean : beansMap.values()) {
values.add(versionBean.getBean());
}
return values;
}
/**
* 添加bean信息
*
* @param beanName bean名称
* @param bean bean对象
* @param inherited 是否继承自以前的版本
*/
public Object add(String beanName, Object bean, boolean inherited) {
VersionBean value = new VersionBean(bean, inherited);
VersionBean result = beansMap.putIfAbsent(beanName, new VersionBean(bean, inherited));
if (result != null) {
return result.getBean();
}
return value.getBean();
}
/**
* 移除bean信息
*
* @param beanName
*/
public Object remove(String beanName) {
VersionBean versionBean = beansMap.remove(beanName);
return versionBean == null ? null : versionBean.getBean();
}
/**
* 获取指定bean名称的bean
*
* @param beanName
* @return
*/
public Object get(String beanName) {
VersionBean versionBean = beansMap.get(beanName);
return versionBean == null ? null : versionBean.getBean();
}
}
| [
"[email protected]"
]
| |
2e070f06962f15a8e4bc7d6153893407628e926d | 3286a794edd92b7b5d91e2cabcc3e3f91821209c | /app/src/main/java/com/samridhi/arsdf/Economics.java | 44e9d2e8ba45690399848933ed0a83aaba4667a4 | []
| no_license | ARSD-A/ARSD_APP | dd86ed18623c3e2a122efce83b44130b9065f913 | 63a8a1d9f918e95f17e195564b7a321fee27b173 | refs/heads/master | 2021-01-02T09:18:33.960405 | 2017-08-03T04:24:34 | 2017-08-03T04:24:34 | 99,190,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,196 | java | package com.samridhi.arsdf;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.TableRow.LayoutParams;
public class Economics extends Activity {
String na[] = {"Ms. Shweta Nanda",
"Dr. Jai Parkash",
"Ms. Pragya Atri",
"Mr. Bal Krishan",
"Dr. Rakesh",
"Mr. Ravish",
"Dr. Saraswati",
"Dr. Manzoor Alam",
"Mr. Rakesh Kumar",
"Ms. Kumari Deepa Rani",
"Mr. Dipak Prakash","Mrs. Savitri Sidana",
"Mrs. Manju Pande",
"Mr. Ranjan Swarnakar",
"Ms. Richa Suri"};
String ma[]= {"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]","[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"};
TableLayout tl;
TableRow tr;
TextView s,n,m;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.table);
tl = (TableLayout) findViewById(R.id.maintable);
addHeaders();
addData();
}
/** This function add the headers to the table **/
public void addHeaders(){
/** Create a TableRow dynamically **/
tr = new TableRow(this);
tr.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
/** Creating a TextView to add to the row **/
s = new TextView(this);
s.setText("S.No. ");
s.setTextColor(Color.BLUE);
s.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
s.setPadding(5, 5, 10, 0);
tr.addView(s); // Adding textView to tablerow.
n = new TextView(this);
n.setText("Name");
n.setTextColor(Color.BLUE);
n.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
n.setPadding(15, 5, 10, 0);
tr.addView(n); // Adding textView to tablerow.
/** Creating another textview **/
m = new TextView(this);
m.setText("E-Mail");
m.setTextColor(Color.BLUE);
m.setPadding(15, 5, 0, 0);
m.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
tr.addView(m); // Adding textView to tablerow.
// Add the TableRow to the TableLayout
tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
}
/** This function add the data to the table **/
public void addData(){
for (int i = 0; i < na.length; i++)
{
/** Create a TableRow dynamically **/
tr = new TableRow(this);
tr.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
/** Creating a TextView to add to the row **/
s = new TextView(this);
s.setText(String.valueOf(i+1));
s.setTextColor(Color.BLACK);
s.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
s.setPadding(5, 5, 10, 5);
tr.addView(s); // Adding textView to tablerow.
n = new TextView(this);
n.setText(na[i]);
n.setTextColor(Color.BLACK);
n.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
n.setPadding(15, 5, 10, 5);
tr.addView(n); // Adding textView to tablerow.
/** Creating another textview **/
m = new TextView(this);
m.setText(ma[i]);
m.setTextColor(Color.BLACK);
m.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
m.setPadding(15, 5, 0, 5);
tr.addView(m); // Adding textView to tablerow.
// Add the TableRow to the TableLayout
tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
}
}
}
| [
"[email protected]"
]
| |
d26d193d410f412be4c1fe1e8427bc9e30018f00 | 1c53d5257ea7be9450919e6b9e0491944a93ba80 | /merge-scenarios/kotlin/d3041d410e1-compiler-frontend-src-org-jetbrains-jet-lang-diagnostics-rendering-DefaultErrorMessages/left.java | 2a3a01c2fe5c9f0fc089efec7299a67a2d740972 | []
| no_license | anonyFVer/mastery-material | 89062928807a1f859e9e8b9a113b2d2d123dc3f1 | db76ee571b84be5db2d245f3b593b29ebfaaf458 | refs/heads/master | 2023-03-16T13:13:49.798374 | 2021-02-26T04:19:19 | 2021-02-26T04:19:19 | 342,556,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,632 | java | /*
* Copyright 2010-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.lang.diagnostics.rendering;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.diagnostics.AbstractDiagnosticFactory;
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
import org.jetbrains.jet.lang.diagnostics.Errors;
import org.jetbrains.jet.lang.psi.JetExpression;
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
import org.jetbrains.jet.lang.psi.JetTypeConstraint;
import org.jetbrains.jet.lang.types.ErrorUtils;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lexer.JetKeywordToken;
import org.jetbrains.jet.resolve.DescriptorRenderer;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.Iterator;
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
import static org.jetbrains.jet.lang.diagnostics.rendering.Renderers.*;
import static org.jetbrains.jet.lang.diagnostics.rendering.Renderers.RENDER_TYPE;
import static org.jetbrains.jet.lang.diagnostics.rendering.Renderers.TO_STRING;
/**
* @author Evgeny Gerashchenko
* @since 4/13/12
*/
public class DefaultErrorMessages {
public static final DiagnosticFactoryToRendererMap MAP = new DiagnosticFactoryToRendererMap();
public static final DiagnosticRenderer<Diagnostic> RENDERER = new DispatchingDiagnosticRenderer(MAP);
static {
MAP.put(EXCEPTION_WHILE_ANALYZING, "{0}", new Renderer<Throwable>() {
@NotNull
@Override
public String render(@NotNull Throwable e) {
return e.getClass().getSimpleName() + ": " + e.getMessage();
}
});
MAP.put(UNRESOLVED_REFERENCE, "Unresolved reference: {0}", TO_STRING);
MAP.put(INVISIBLE_REFERENCE, "Cannot access ''{0}'' in ''{1}''", NAME, NAME);
MAP.put(INVISIBLE_MEMBER, "Cannot access ''{0}'' in ''{1}''", NAME, NAME);
MAP.put(REDECLARATION, "Redeclaration: {0}", NAME);
MAP.put(NAME_SHADOWING, "Name shadowed: {0}", NAME);
MAP.put(TYPE_MISMATCH, "Type mismatch: inferred type is {1} but {0} was expected", RENDER_TYPE, RENDER_TYPE);
MAP.put(INCOMPATIBLE_MODIFIERS, "Incompatible modifiers: ''{0}''", new Renderer<Collection<JetKeywordToken>>() {
@NotNull
@Override
public String render(@NotNull Collection<JetKeywordToken> tokens) {
StringBuilder sb = new StringBuilder();
for (JetKeywordToken token : tokens) {
if (sb.length() != 0) {
sb.append(" ");
}
sb.append(token.getValue());
}
return sb.toString();
}
});
MAP.put(ILLEGAL_MODIFIER, "Illegal modifier ''{0}''", TO_STRING);
MAP.put(REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present", TO_STRING, TO_STRING);
MAP.put(ABSTRACT_MODIFIER_IN_TRAIT, "Modifier ''abstract'' is redundant in trait");
MAP.put(OPEN_MODIFIER_IN_TRAIT, "Modifier ''open'' is redundant in trait");
MAP.put(REDUNDANT_MODIFIER_IN_GETTER, "Visibility modifiers are redundant in getter");
MAP.put(TRAIT_CAN_NOT_BE_FINAL, "Trait cannot be final");
MAP.put(TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM,
"Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly"); // TODO: message
MAP.put(RETURN_NOT_ALLOWED, "'return' is not allowed here");
MAP.put(PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE, "Projections are not allowed for immediate arguments of a supertype");
MAP.put(LABEL_NAME_CLASH, "There is more than one label with such a name in this scope");
MAP.put(EXPRESSION_EXPECTED_NAMESPACE_FOUND, "Expression expected, but a namespace name found");
MAP.put(CANNOT_IMPORT_FROM_ELEMENT, "Cannot import from ''{0}''", NAME);
MAP.put(CANNOT_BE_IMPORTED, "Cannot import ''{0}'', functions and properties can be imported only from packages", NAME);
MAP.put(USELESS_HIDDEN_IMPORT, "Useless import, it is hidden further");
MAP.put(USELESS_SIMPLE_IMPORT, "Useless import, does nothing");
MAP.put(CANNOT_INFER_PARAMETER_TYPE,
"Cannot infer a type for this parameter. To specify it explicitly use the {(p : Type) => ...} notation");
MAP.put(NO_BACKING_FIELD_ABSTRACT_PROPERTY, "This property doesn't have a backing field, because it's abstract");
MAP.put(NO_BACKING_FIELD_CUSTOM_ACCESSORS,
"This property doesn't have a backing field, because it has custom accessors without reference to the backing field");
MAP.put(INACCESSIBLE_BACKING_FIELD, "The backing field is not accessible here");
MAP.put(NOT_PROPERTY_BACKING_FIELD, "The referenced variable is not a property and doesn't have backing field");
MAP.put(MIXING_NAMED_AND_POSITIONED_ARGUMENTS, "Mixing named and positioned arguments in not allowed");
MAP.put(ARGUMENT_PASSED_TWICE, "An argument is already passed for this parameter");
MAP.put(NAMED_PARAMETER_NOT_FOUND, "Cannot find a parameter with this name: {0}", TO_STRING);
MAP.put(VARARG_OUTSIDE_PARENTHESES, "Passing value as a vararg is only allowed inside a parenthesized argument list");
MAP.put(NON_VARARG_SPREAD, "The spread operator (*foo) may only be applied in a vararg position");
MAP.put(MANY_FUNCTION_LITERAL_ARGUMENTS, "Only one function literal is allowed outside a parenthesized argument list");
MAP.put(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER, "This property must either have a type annotation or be initialized");
MAP.put(ABSTRACT_PROPERTY_IN_PRIMARY_CONSTRUCTOR_PARAMETERS, "This property cannot be declared abstract");
MAP.put(ABSTRACT_PROPERTY_NOT_IN_CLASS, "A property may be abstract only when defined in a class or trait");
MAP.put(ABSTRACT_PROPERTY_WITH_INITIALIZER, "Property with initializer cannot be abstract");
MAP.put(ABSTRACT_PROPERTY_WITH_GETTER, "Property with getter implementation cannot be abstract");
MAP.put(ABSTRACT_PROPERTY_WITH_SETTER, "Property with setter implementation cannot be abstract");
MAP.put(PACKAGE_MEMBER_CANNOT_BE_PROTECTED, "Package member cannot be protected");
MAP.put(GETTER_VISIBILITY_DIFFERS_FROM_PROPERTY_VISIBILITY, "Getter visibility must be the same as property visibility");
MAP.put(BACKING_FIELD_IN_TRAIT, "Property in a trait cannot have a backing field");
MAP.put(MUST_BE_INITIALIZED, "Property must be initialized");
MAP.put(MUST_BE_INITIALIZED_OR_BE_ABSTRACT, "Property must be initialized or be abstract");
MAP.put(PROPERTY_INITIALIZER_IN_TRAIT, "Property initializers are not allowed in traits");
MAP.put(PROPERTY_INITIALIZER_NO_BACKING_FIELD, "Initializer is not allowed here because this property has no backing field");
MAP.put(ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS, "Abstract property ''{0}'' in non-abstract class ''{1}''", NAME, NAME);
MAP.put(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS, "Abstract function ''{0}'' in non-abstract class ''{1}''", NAME, NAME);
MAP.put(ABSTRACT_FUNCTION_WITH_BODY, "A function ''{0}'' with body cannot be abstract", NAME);
MAP.put(NON_ABSTRACT_FUNCTION_WITH_NO_BODY, "Function ''{0}'' without a body must be abstract", NAME);
MAP.put(NON_MEMBER_ABSTRACT_FUNCTION, "Function ''{0}'' is not a class or trait member and cannot be abstract", NAME);
MAP.put(NON_MEMBER_FUNCTION_NO_BODY, "Function ''{0}'' must have a body", NAME);
MAP.put(NON_FINAL_MEMBER_IN_FINAL_CLASS, "Non-final member in a final class");
MAP.put(PUBLIC_MEMBER_SHOULD_SPECIFY_TYPE, "Public or protected member should have specified type");
MAP.put(PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT, "Projections are not allowed on type arguments of functions and properties");
MAP.put(SUPERTYPE_NOT_INITIALIZED, "This type has a constructor, and thus must be initialized here");
MAP.put(SUPERTYPE_NOT_INITIALIZED_DEFAULT, "Constructor invocation should be explicitly specified");
MAP.put(SECONDARY_CONSTRUCTOR_BUT_NO_PRIMARY, "A secondary constructor may appear only in a class that has a primary constructor");
MAP.put(SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST, "Secondary constructors must have an initializer list");
MAP.put(BY_IN_SECONDARY_CONSTRUCTOR, "'by'-clause is only supported for primary constructors");
MAP.put(INITIALIZER_WITH_NO_ARGUMENTS, "Constructor arguments required");
MAP.put(MANY_CALLS_TO_THIS, "Only one call to 'this(...)' is allowed");
MAP.put(NOTHING_TO_OVERRIDE, "''{0}'' overrides nothing", NAME);
MAP.put(VIRTUAL_MEMBER_HIDDEN, "''{0}'' hides member of supertype ''{2}'' and needs ''override'' modifier", NAME, NAME, NAME);
MAP.put(CANNOT_OVERRIDE_INVISIBLE_MEMBER, "''{0}'' cannot has no access to ''{1}'' in class {2}, so it cannot override it",
DescriptorRenderer.TEXT, DescriptorRenderer.TEXT, DescriptorRenderer.TEXT);
MAP.put(CANNOT_INFER_VISIBILITY, "Cannot infer visibility. Please specify it explicitly");
MAP.put(ENUM_ENTRY_SHOULD_BE_INITIALIZED, "Missing delegation specifier ''{0}''", NAME);
MAP.put(ENUM_ENTRY_ILLEGAL_TYPE, "The type constructor of enum entry should be ''{0}''", NAME);
MAP.put(UNINITIALIZED_VARIABLE, "Variable ''{0}'' must be initialized", NAME);
MAP.put(UNINITIALIZED_PARAMETER, "Parameter ''{0}'' is uninitialized here", NAME);
MAP.put(UNUSED_VARIABLE, "Variable ''{0}'' is never used", NAME);
MAP.put(UNUSED_PARAMETER, "Parameter ''{0}'' is never used", NAME);
MAP.put(ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE, "Variable ''{0}'' is assigned but never accessed", NAME);
MAP.put(VARIABLE_WITH_REDUNDANT_INITIALIZER, "Variable ''{0}'' initializer is redundant", NAME);
MAP.put(UNUSED_VALUE, "The value ''{0}'' assigned to ''{1}'' is never used", ELEMENT_TEXT, TO_STRING);
MAP.put(UNUSED_CHANGED_VALUE, "The value changed at ''{0}'' is never used", ELEMENT_TEXT);
MAP.put(UNUSED_EXPRESSION, "The expression is unused");
MAP.put(UNUSED_FUNCTION_LITERAL, "The function literal is unused. If you mean block, you can use 'run { ... }'");
MAP.put(VAL_REASSIGNMENT, "Val cannot be reassigned", NAME);
MAP.put(INITIALIZATION_BEFORE_DECLARATION, "Variable cannot be initialized before declaration", NAME);
MAP.put(VARIABLE_EXPECTED, "Variable expected");
MAP.put(INITIALIZATION_USING_BACKING_FIELD_CUSTOM_SETTER,
"This property has a custom setter, so initialization using backing field required", NAME);
MAP.put(INITIALIZATION_USING_BACKING_FIELD_OPEN_SETTER,
"Setter of this property can be overridden, so initialization using backing field required", NAME);
MAP.put(FUNCTION_PARAMETERS_OF_INLINE_FUNCTION, "Function parameters of inline function can only be invoked", NAME);
MAP.put(UNREACHABLE_CODE, "Unreachable code");
MAP.put(MANY_CLASS_OBJECTS, "Only one class object is allowed per class");
MAP.put(CLASS_OBJECT_NOT_ALLOWED, "A class object is not allowed here");
MAP.put(DELEGATION_IN_TRAIT, "Traits cannot use delegation");
MAP.put(DELEGATION_NOT_TO_TRAIT, "Only traits can be delegated to");
MAP.put(NO_CONSTRUCTOR, "This class does not have a constructor");
MAP.put(NOT_A_CLASS, "Not a class");
MAP.put(ILLEGAL_ESCAPE_SEQUENCE, "Illegal escape sequence");
MAP.put(LOCAL_EXTENSION_PROPERTY, "Local extension properties are not allowed");
MAP.put(LOCAL_VARIABLE_WITH_GETTER, "Local variables are not allowed to have getters");
MAP.put(LOCAL_VARIABLE_WITH_SETTER, "Local variables are not allowed to have setters");
MAP.put(VAL_WITH_SETTER, "A 'val'-property cannot have a setter");
MAP.put(NO_GET_METHOD, "No get method providing array access");
MAP.put(NO_SET_METHOD, "No set method providing array access");
MAP.put(INC_DEC_SHOULD_NOT_RETURN_UNIT, "Functions inc(), dec() shouldn't return Unit to be used by operators ++, --");
MAP.put(ASSIGNMENT_OPERATOR_SHOULD_RETURN_UNIT, "Function ''{0}'' should return Unit to be used by corresponding operator ''{1}''",
NAME, ELEMENT_TEXT);
MAP.put(ASSIGN_OPERATOR_AMBIGUITY, "Assignment operators ambiguity: {0}", AMBIGUOUS_CALLS);
MAP.put(EQUALS_MISSING, "No method 'equals(jet.Any?) : jet.Boolean' available");
MAP.put(ASSIGNMENT_IN_EXPRESSION_CONTEXT, "Assignments are not expressions, and only expressions are allowed in this context");
MAP.put(NAMESPACE_IS_NOT_AN_EXPRESSION, "'namespace' is not an expression, it can only be used on the left-hand side of a dot ('.')");
MAP.put(SUPER_IS_NOT_AN_EXPRESSION, "''{0}'' is not an expression, it can only be used on the left-hand side of a dot ('.')", TO_STRING);
MAP.put(DECLARATION_IN_ILLEGAL_CONTEXT, "Declarations are not allowed in this position");
MAP.put(SETTER_PARAMETER_WITH_DEFAULT_VALUE, "Setter parameters cannot have default values");
MAP.put(NO_THIS, "'this' is not defined in this context");
MAP.put(SUPER_NOT_AVAILABLE, "No supertypes are accessible in this context");
MAP.put(AMBIGUOUS_SUPER, "Many supertypes available, please specify the one you mean in angle brackets, e.g. 'super<Foo>'");
MAP.put(ABSTRACT_SUPER_CALL, "Abstract member cannot be accessed directly");
MAP.put(NOT_A_SUPERTYPE, "Not a supertype");
MAP.put(TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER, "Type arguments do not need to be specified in a 'super' qualifier");
MAP.put(USELESS_CAST_STATIC_ASSERT_IS_FINE, "No cast needed, use ':' instead");
MAP.put(USELESS_CAST, "No cast needed");
MAP.put(CAST_NEVER_SUCCEEDS, "This cast can never succeed");
MAP.put(WRONG_SETTER_PARAMETER_TYPE, "Setter parameter type must be equal to the type of the property, i.e. ''{0}''", RENDER_TYPE, RENDER_TYPE);
MAP.put(WRONG_GETTER_RETURN_TYPE, "Getter return type must be equal to the type of the property, i.e. ''{0}''", RENDER_TYPE, RENDER_TYPE);
MAP.put(NO_CLASS_OBJECT, "Please specify constructor invocation; classifier ''{0}'' does not have a class object", NAME);
MAP.put(NO_GENERICS_IN_SUPERTYPE_SPECIFIER, "Generic arguments of the base type must be specified");
MAP.put(HAS_NEXT_PROPERTY_AND_FUNCTION_AMBIGUITY,
"An ambiguity between 'iterator().hasNext()' function and 'iterator().hasNext' property");
MAP.put(HAS_NEXT_MISSING, "Loop range must have an 'iterator().hasNext()' function or an 'iterator().hasNext' property");
MAP.put(HAS_NEXT_FUNCTION_AMBIGUITY, "Function 'iterator().hasNext()' is ambiguous for this expression");
MAP.put(HAS_NEXT_MUST_BE_READABLE, "The 'iterator().hasNext' property of the loop range must be readable");
MAP.put(HAS_NEXT_PROPERTY_TYPE_MISMATCH, "The type of ''iterator().hasNext'' property of the loop range must be jet.Boolean, but is {0}",
RENDER_TYPE);
MAP.put(HAS_NEXT_FUNCTION_TYPE_MISMATCH, "The ''iterator().hasNext()'' function of the loop range must return jet.Boolean, but returns {0}",
RENDER_TYPE);
MAP.put(NEXT_AMBIGUITY, "Function 'iterator().next()' is ambiguous for this expression");
MAP.put(NEXT_MISSING, "Loop range must have an 'iterator().next()' function");
MAP.put(ITERATOR_MISSING, "For-loop range must have an iterator() method");
MAP.put(ITERATOR_AMBIGUITY, "Method ''iterator()'' is ambiguous for this expression: {0}", AMBIGUOUS_CALLS);
MAP.put(COMPARE_TO_TYPE_MISMATCH, "''compareTo()'' must return jet.Int, but returns {0}", RENDER_TYPE);
MAP.put(CALLEE_NOT_A_FUNCTION, "Expecting a function type, but found {0}", RENDER_TYPE);
MAP.put(RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY,
"Returns are not allowed for functions with expression body. Use block body in '{...}'");
MAP.put(NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY, "A 'return' expression required in a function with a block body ('{...}')");
MAP.put(RETURN_TYPE_MISMATCH, "This function must return a value of type {0}", RENDER_TYPE);
MAP.put(EXPECTED_TYPE_MISMATCH, "Expected a value of type {0}", RENDER_TYPE);
MAP.put(ASSIGNMENT_TYPE_MISMATCH,
"Expected a value of type {0}. Assignment operation is not an expression, so it does not return any value", RENDER_TYPE);
MAP.put(IMPLICIT_CAST_TO_UNIT_OR_ANY, "Type was casted to ''{0}''. Please specify ''{0}'' as expected type, if you mean such cast",
RENDER_TYPE);
MAP.put(EXPRESSION_EXPECTED, "{0} is not an expression, and only expression are allowed here", new Renderer<JetExpression>() {
@NotNull
@Override
public String render(@NotNull JetExpression expression) {
String expressionType = expression.toString();
return expressionType.substring(0, 1) +
expressionType.substring(1).toLowerCase();
}
});
MAP.put(UPPER_BOUND_VIOLATED, "Type argument is not within its bounds: should be subtype of ''{0}''", RENDER_TYPE, RENDER_TYPE);
MAP.put(FINAL_CLASS_OBJECT_UPPER_BOUND, "''{0}'' is a final type, and thus a class object cannot extend it", RENDER_TYPE);
MAP.put(FINAL_UPPER_BOUND, "''{0}'' is a final type, and thus a value of the type parameter is predetermined", RENDER_TYPE);
MAP.put(USELESS_ELVIS, "Elvis operator (?:) always returns the left operand of non-nullable type {0}", RENDER_TYPE);
MAP.put(CONFLICTING_UPPER_BOUNDS, "Upper bounds of {0} have empty intersection", NAME);
MAP.put(CONFLICTING_CLASS_OBJECT_UPPER_BOUNDS, "Class object upper bounds of {0} have empty intersection", NAME);
MAP.put(TOO_MANY_ARGUMENTS, "Too many arguments for {0}", DescriptorRenderer.TEXT);
MAP.put(ERROR_COMPILE_TIME_VALUE, "{0}", TO_STRING);
MAP.put(ELSE_MISPLACED_IN_WHEN, "'else' entry must be the last one in a when-expression");
MAP.put(NO_ELSE_IN_WHEN, "'when' expression must contain 'else' branch");
MAP.put(TYPE_MISMATCH_IN_RANGE, "Type mismatch: incompatible types of range and element checked in it");
MAP.put(CYCLIC_INHERITANCE_HIERARCHY, "There's a cycle in the inheritance hierarchy for this type");
MAP.put(MANY_CLASSES_IN_SUPERTYPE_LIST, "Only one class may appear in a supertype list");
MAP.put(SUPERTYPE_NOT_A_CLASS_OR_TRAIT, "Only classes and traits may serve as supertypes");
MAP.put(SUPERTYPE_INITIALIZED_IN_TRAIT, "Traits cannot initialize supertypes");
MAP.put(CONSTRUCTOR_IN_TRAIT, "A trait may not have a constructor");
MAP.put(SECONDARY_CONSTRUCTORS_ARE_NOT_SUPPORTED, "Secondary constructors are not supported");
MAP.put(SUPERTYPE_APPEARS_TWICE, "A supertype appears twice");
MAP.put(FINAL_SUPERTYPE, "This type is final, so it cannot be inherited from");
MAP.put(ILLEGAL_SELECTOR, "Expression ''{0}'' cannot be a selector (occur after a dot)", TO_STRING);
MAP.put(VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION, "A type annotation is required on a value parameter");
MAP.put(BREAK_OR_CONTINUE_OUTSIDE_A_LOOP, "'break' and 'continue' are only allowed inside a loop");
MAP.put(NOT_A_LOOP_LABEL, "The label ''{0}'' does not denote a loop", TO_STRING);
MAP.put(NOT_A_RETURN_LABEL, "The label ''{0}'' does not reference to a context from which we can return", TO_STRING);
MAP.put(ANONYMOUS_INITIALIZER_WITHOUT_CONSTRUCTOR, "Anonymous initializers are only allowed in the presence of a primary constructor");
MAP.put(NULLABLE_SUPERTYPE, "A supertype cannot be nullable");
MAP.put(UNSAFE_CALL, "Only safe calls (?.) are allowed on a nullable receiver of type {0}", RENDER_TYPE);
MAP.put(AMBIGUOUS_LABEL, "Ambiguous label");
MAP.put(UNSUPPORTED, "Unsupported [{0}]", TO_STRING);
MAP.put(UNNECESSARY_SAFE_CALL, "Unnecessary safe call on a non-null receiver of type {0}", RENDER_TYPE);
MAP.put(UNNECESSARY_NOT_NULL_ASSERTION, "Unnecessary non-null assertion (!!) on a non-null receiver of type {0}", RENDER_TYPE);
MAP.put(NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER, "{0} does not refer to a type parameter of {1}", new Renderer<JetTypeConstraint>() {
@NotNull
@Override
public String render(@NotNull JetTypeConstraint typeConstraint) {
//noinspection ConstantConditions
return typeConstraint.getSubjectTypeParameterName().getReferencedName();
}
}, NAME);
MAP.put(AUTOCAST_IMPOSSIBLE, "Automatic cast to ''{0}'' is impossible, because ''{1}'' could have changed since the is-check", RENDER_TYPE,
NAME);
MAP.put(TYPE_MISMATCH_IN_FOR_LOOP, "The loop iterates over values of type {0} but the parameter is declared to be {1}", RENDER_TYPE,
RENDER_TYPE);
MAP.put(TYPE_MISMATCH_IN_CONDITION, "Condition must be of type jet.Boolean, but is of type {0}", RENDER_TYPE);
MAP.put(TYPE_MISMATCH_IN_TUPLE_PATTERN, "Type mismatch: subject is of type {0} but the pattern is a {1}-tuple", RENDER_TYPE, TO_STRING);
MAP.put(TYPE_MISMATCH_IN_BINDING_PATTERN, "{0} is not a supertype of {1}. Use ''is'' to match against {0}", RENDER_TYPE, RENDER_TYPE);
MAP.put(INCOMPATIBLE_TYPES, "Incompatible types: {0} and {1}", RENDER_TYPE, RENDER_TYPE);
MAP.put(EXPECTED_CONDITION, "Expected condition of jet.Boolean type");
MAP.put(CANNOT_CHECK_FOR_ERASED, "Cannot check for instance of erased type: {0}", RENDER_TYPE);
MAP.put(UNCHECKED_CAST, "Unchecked cast: {0} to {1}", RENDER_TYPE, RENDER_TYPE);
MAP.put(INCONSISTENT_TYPE_PARAMETER_VALUES, "Type parameter {0} of ''{1}'' has inconsistent values: {2}", NAME, NAME,
new Renderer<Collection<JetType>>() {
@NotNull
@Override
public String render(@NotNull Collection<JetType> types) {
StringBuilder builder = new StringBuilder();
for (Iterator<JetType> iterator = types.iterator(); iterator.hasNext(); ) {
JetType jetType = iterator.next();
builder.append(jetType);
if (iterator.hasNext()) {
builder.append(", ");
}
}
return builder.toString();
}
});
MAP.put(EQUALITY_NOT_APPLICABLE, "Operator ''{0}'' cannot be applied to ''{1}'' and ''{2}''", new Renderer<JetSimpleNameExpression>() {
@NotNull
@Override
public String render(@NotNull JetSimpleNameExpression nameExpression) {
//noinspection ConstantConditions
return nameExpression.getReferencedName();
}
}, RENDER_TYPE, RENDER_TYPE);
MAP.put(SENSELESS_COMPARISON, "Condition ''{0}'' is always ''{1}''", ELEMENT_TEXT, TO_STRING);
MAP.put(OVERRIDING_FINAL_MEMBER, "''{0}'' in ''{1}'' is final and cannot be overridden", NAME, NAME);
MAP.put(CANNOT_WEAKEN_ACCESS_PRIVILEGE, "Cannot weaken access privilege ''{0}'' for ''{1}'' in ''{2}''", TO_STRING, NAME, NAME);
MAP.put(CANNOT_CHANGE_ACCESS_PRIVILEGE, "Cannot change access privilege ''{0}'' for ''{1}'' in ''{2}''", TO_STRING, NAME, NAME);
MAP.put(RETURN_TYPE_MISMATCH_ON_OVERRIDE, "Return type of ''{0}'' is not a subtype of the return type of overridden member {1}",
NAME, DescriptorRenderer.TEXT);
MAP.put(VAR_OVERRIDDEN_BY_VAL, "Var-property {0} cannot be overridden by val-property {1}", DescriptorRenderer.TEXT,
DescriptorRenderer.TEXT);
MAP.put(ABSTRACT_MEMBER_NOT_IMPLEMENTED, "{0} must be declared abstract or implement abstract member {1}", RENDER_CLASS_OR_OBJECT,
DescriptorRenderer.TEXT);
MAP.put(MANY_IMPL_MEMBER_NOT_IMPLEMENTED, "{0} must override {1} because it inherits many implementations of it",
RENDER_CLASS_OR_OBJECT, DescriptorRenderer.TEXT);
MAP.put(CONFLICTING_OVERLOADS, "{1} is already defined in ''{0}''", DescriptorRenderer.TEXT, TO_STRING);
MAP.put(FUNCTION_EXPECTED, "Expression ''{0}''{1} cannot be invoked as a function", ELEMENT_TEXT, new Renderer<JetType>() {
@NotNull
@Override
public String render(@NotNull JetType type) {
if (ErrorUtils.isErrorType(type)) return "";
return " of type '" + type.toString() + "'";
}
});
MAP.put(FUNCTION_CALL_EXPECTED, "Function invocation ''{0}({1})'' expected", ELEMENT_TEXT,new Renderer<Boolean>() {
@NotNull
@Override
public String render(@NotNull Boolean hasValueParameters) {
return hasValueParameters ? "..." : "";
}
});
MAP.put(RESULT_TYPE_MISMATCH, "{0} must return {1} but returns {2}", TO_STRING, RENDER_TYPE, RENDER_TYPE);
MAP.put(UNSAFE_INFIX_CALL,
"Infix call corresponds to a dot-qualified call ''{0}.{1}({2})'' which is not allowed on a nullable receiver ''{0}''. " +
"Use '?.'-qualified call instead",
TO_STRING, TO_STRING, TO_STRING);
MAP.put(OVERLOAD_RESOLUTION_AMBIGUITY, "Overload resolution ambiguity: {0}", AMBIGUOUS_CALLS);
MAP.put(NONE_APPLICABLE, "None of the following functions can be called with the arguments supplied: {0}", AMBIGUOUS_CALLS);
MAP.put(NO_VALUE_FOR_PARAMETER, "No value passed for parameter {0}", NAME);
MAP.put(MISSING_RECEIVER, "A receiver of type {0} is required", RENDER_TYPE);
MAP.put(NO_RECEIVER_ADMITTED, "No receiver can be passed to this function or property");
MAP.put(CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS, "Cannot create an instance of an abstract class");
MAP.put(TYPE_INFERENCE_FAILED, "Type inference failed: {0}", TO_STRING);
MAP.put(WRONG_NUMBER_OF_TYPE_ARGUMENTS, "{0,choice,0#No type arguments|1#Type argument|1<{0,number,integer} type argument} expected", null);
MAP.put(DANGLING_FUNCTION_LITERAL_ARGUMENT_SUSPECTED,
"This expression is treated as an argument to the function call on the previous line. " +
"Separate it with a semicolon (;) if it is not intended to be an argument.");
MAP.put(NOT_AN_ANNOTATION_CLASS, "''{0}'' is not an annotation class", TO_STRING);
MAP.put(DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE, "An overriding function is not allowed to specify default values for its parameters");
String multipleDefaultsMessage = "More than one overridden descriptor declares a default value for ''{0}''. " +
"As the compiler can not make sure these values agree, this is not allowed.";
MAP.put(MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES, multipleDefaultsMessage, TO_STRING);
MAP.put(MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE, multipleDefaultsMessage, TO_STRING);
MAP.put(PARAMETER_NAME_CHANGED_ON_OVERRIDE, "The corresponding parameter in the supertype ''{0}'' is named ''{1}''. " +
"This may cause problems when calling this function with named arguments.", NAME, NAME);
MAP.put(DIFFERENT_NAMES_FOR_THE_SAME_PARAMETER_IN_SUPERTYPES,
"Names of the parameter #{1} conflict in the following members of supertypes: ''{0}''" +
"This may cause problems when calling this function with named arguments.", commaSeparated(TO_STRING), TO_STRING);
MAP.setImmutable();
for (Field field : Errors.class.getFields()) {
if (Modifier.isStatic(field.getModifiers())) {
try {
Object fieldValue = field.get(null);
if (fieldValue instanceof AbstractDiagnosticFactory) {
if (MAP.get((AbstractDiagnosticFactory) fieldValue) == null) {
throw new IllegalStateException("No default diagnostic renderer is provided for " + ((AbstractDiagnosticFactory)fieldValue).getName());
}
}
}
catch (IllegalAccessException e) {
throw new IllegalStateException(e);
}
}
}
}
private DefaultErrorMessages() {
}
} | [
"[email protected]"
]
| |
6805ef2dc7800e5d97e28d1c11eae6578bc522fd | 6217dac1b684fb03c1b65aafd777eabdb53d8c3e | /ProjetoP1/src/projetop1/DireitaCMD.java | fc19d08be8641aeb3bb88b0c7dcbe1c51c9ed495 | []
| no_license | DerekAlves/ProjetoRefatoradoPadroes | 426da46704ef9356b3ec93f429a207577710912e | 7e9af1b0e0c7d0e4957ecdff3171c7a8c525e511 | refs/heads/master | 2023-06-26T04:11:11.282210 | 2019-04-01T16:45:16 | 2019-04-01T16:45:16 | 178,905,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package projetop1;
public class DireitaCMD implements Command
{
public void move(Veiculos vehic)
{
vehic.setY( vehic.getY() == 58 ? vehic.getX() - 57 : vehic.getX() + 1 );//INLINE METHOD PARA SUBSTITUIR O SMELL ABAIXO
/*if (y == 58){//SMELL
y -= 57;
} else {
y += 1;
}*/
}
}
| [
"[email protected]"
]
| |
c97f065269b1d4126f8c4bfdd092d6687029a975 | e334f5ecc5d3469c71b0539486e3c17fa0cdbd52 | /JAVA/tema3/t3Ej1.java | e2f5f0ade64ce4458ec1a6d01867aea446de84d2 | []
| no_license | estherhitos/MiRepositorio | 1de70c4566a0e3832c15df0ee4cdc8a5d6652011 | 1bed9bf9830551d67b985080bc3b02ee391c4824 | refs/heads/master | 2023-02-22T12:49:17.590117 | 2021-01-25T08:34:07 | 2021-01-25T08:34:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | /**
* t3Ej1.java
* Ejercicio 1 | Tema 3
* Recibe dos números y los multiplica
* @author Esther Hitos 1ºDAW
*/
public class t3Ej1 { // Clase principal
public static void main(String[] args) {
String linea;
/* Recoge el primer número*/
System.out.print("Por favor, introduce un número: ");
linea = System.console().readLine();
int primerNumero = Integer.parseInt(linea);
/* Recoge el segundo número*/
System.out.print("Introduce otro, por favor: ");
linea = System.console().readLine();
int segundoNumero = Integer.parseInt(linea);
/* Realiza la operación y la muestra en pantalla */
int total = primerNumero*segundoNumero;
System.out.printf("%d * %d = %d", primerNumero, segundoNumero, total);
}
}
| [
"[email protected]"
]
| |
b0919522aa4f2389b29991d7d31afccd80d75a13 | c3e3031a66fba10c9369b757ab8a0681254026d7 | /medcenter.app/src/main/java/com/medcenter/medcenter/app/SampleViewAccessControl.java | 92dace4f901d6a7a61d1031b4fe89c0a086a16c2 | []
| no_license | isaacluiz/medcenter | da012f7de8a0507cf3ff15c12c3bf8361f3105bf | 1545577e5e767e7089bc398ccc0d20596aeb7a62 | refs/heads/master | 2021-01-22T11:16:25.222268 | 2017-05-28T18:29:04 | 2017-05-28T18:29:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package com.medcenter.medcenter.app;
import org.springframework.stereotype.Component;
import com.vaadin.spring.access.ViewAccessControl;
import com.vaadin.ui.UI;
import medcenter.utils.SecurityUtils;
/**
* This demonstrates how you can control access to views.
*/
@Component
public class SampleViewAccessControl implements ViewAccessControl {
@Override
public boolean isAccessGranted(UI ui, String beanName) {
if (beanName.equals("adminView")) {
return SecurityUtils.hasRole("ROLE_ADMIN");
} else {
return SecurityUtils.hasRole("ROLE_USER");
}
}
}
| [
"pedropacheco@[email protected]"
]
| pedropacheco@[email protected] |
a3e3e72ab922217c5a32d7c3910bd53a6b122fef | e42afd54dcc0add3d2b8823ee98a18c50023a396 | /java-compute/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonNodeGroupsCallableFactory.java | b3f102f98789dae715b5e97bfd0f1a1b30cba706 | [
"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 | 4,579 | 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.compute.v1.stub;
import com.google.api.core.BetaApi;
import com.google.api.gax.httpjson.HttpJsonCallSettings;
import com.google.api.gax.httpjson.HttpJsonCallableFactory;
import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
import com.google.api.gax.rpc.BatchingCallSettings;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.ServerStreamingCallSettings;
import com.google.api.gax.rpc.ServerStreamingCallable;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.compute.v1.Operation;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* REST callable factory implementation for the NodeGroups service API.
*
* <p>This class is for advanced usage.
*/
@Generated("by gapic-generator-java")
@BetaApi
public class HttpJsonNodeGroupsCallableFactory
implements HttpJsonStubCallableFactory<Operation, ZoneOperationsStub> {
@Override
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
UnaryCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createUnaryCallable(
httpJsonCallSettings, callSettings, clientContext);
}
@Override
public <RequestT, ResponseT, PagedListResponseT>
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createPagedCallable(
httpJsonCallSettings, callSettings, clientContext);
}
@Override
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
BatchingCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createBatchingCallable(
httpJsonCallSettings, callSettings, clientContext);
}
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
@Override
public <RequestT, ResponseT, MetadataT>
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
HttpJsonCallSettings<RequestT, Operation> httpJsonCallSettings,
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
ClientContext clientContext,
ZoneOperationsStub operationsStub) {
UnaryCallable<RequestT, Operation> innerCallable =
HttpJsonCallableFactory.createBaseUnaryCallable(
httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
HttpJsonOperationSnapshotCallable<RequestT, Operation> initialCallable =
new HttpJsonOperationSnapshotCallable<RequestT, Operation>(
innerCallable,
httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
return HttpJsonCallableFactory.createOperationCallable(
callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
}
@Override
public <RequestT, ResponseT>
ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
ServerStreamingCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createServerStreamingCallable(
httpJsonCallSettings, callSettings, clientContext);
}
}
| [
"[email protected]"
]
| |
092995da191509fcefe8baa1f892a751393d4a97 | 771aa6c0509b7196e2bbab2aa30770cf6d48b4fc | /org.rtext.lang.tests/src/org/rtext/lang/specs/util/MockInjector.java | 632084acaca4ea679d057afaad15c97443827c73 | []
| no_license | mthiede/rtext_eclipse_plugin | f8b3224bce4804a5b49c15078c4952e719b47e7b | ea68e5871b1f69ff671dfeef4d659b95cfb21dd1 | refs/heads/master | 2021-05-04T14:03:53.026753 | 2016-09-30T09:17:18 | 2016-09-30T09:17:18 | 2,850,516 | 1 | 0 | null | 2016-09-15T11:43:24 | 2011-11-25T15:37:40 | Java | UTF-8 | Java | false | false | 319 | java | package org.rtext.lang.specs.util;
import org.jnario.runner.SimpleSpecCreator;
import org.mockito.MockitoAnnotations;
public class MockInjector extends SimpleSpecCreator {
@Override
protected <T> T create(Class<T> klass) {
T spec = super.create(klass);
MockitoAnnotations.initMocks(spec);
return spec;
}
}
| [
"[email protected]"
]
| |
370d9841b315d0b5d9eb15f4d9d0850bd12e7f1e | cbb3fbe97c826a59eb8aade8cc62dd5ef999a9da | /day06/TriAngleTest.java | ef7e429d993bbcbab496606912ed396ac05d6c26 | []
| no_license | cshcsh/MyJava | 9ee24c0bf50fa6f8a0f7fd70ef541a50fe609f28 | 790ffa1fe560afbb9b6c8309f3ad2f84cfba614c | refs/heads/master | 2020-03-27T15:49:27.564461 | 2018-08-30T12:26:57 | 2018-08-30T12:26:57 | 146,741,834 | 1 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 276 | java | package com.java5200.date0524;
public class TriAngleTest {
public static void main(String[] args){
TriAngle triAngle=new TriAngle();
triAngle.setBase(5);
triAngle.setHeight(6);
float a=triAngle.getArea();
System.out.println("Èý½ÇÐÎÃæ»ý£º"+a);
}
}
| [
"[email protected]"
]
| |
d50da172f27922379cfefc735385b1274b8e67e7 | 1897c16405db4feadbb75a97776f406328a34bce | /HeadphonesProject/src/Car/App3.java | 372e8943be0446333527ebc07a74ded6d9907db8 | []
| no_license | kristenspirka12/Headphone | 99606b42d750e3219ae4805197a935a1d90a9295 | 6334edc8c4e8e2d2473327349366b9c1c7dd8652 | refs/heads/master | 2020-04-26T18:04:05.124720 | 2019-03-04T11:51:20 | 2019-03-04T11:51:20 | 173,733,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | package Car;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class App3 {
public static void main(String[] args) {
Auto car1 = new Auto(Automark.BMW, new Mudel("M4", LocalDate.parse("2017-03-10"), Mudeliliik.KUPEE), "555 BMW", LocalDate.parse("2017-04-10"));
Omanik felix = new Omanik("Felix", "Kasepuu", new Isikukood("36102038888",Riigikood.EE), LocalDate.parse("2014-10-22"));
car1.addOmanikud(felix);
System.out.println(car1);
System.out.println(felix.annaAutojuhiStaaz());
}
}
| [
"[email protected]"
]
| |
bd872c89c15a5823a59b544712f760f242a1a712 | 9fb9d9a6821fc812409fd6e685e877538e0db79a | /src/main/java/md/onemap/harta/loader/AbstractLoader.java | 4f9d650d205c57c3f8bec9761ebcabba34df5bdc | []
| no_license | sergpank/onemap | 94a5083f7834584aa1f81ac4524e485ed53262a6 | 53fcbf6c740d5dcbcb811df21b59bce27ef34e30 | refs/heads/master | 2022-06-18T09:33:01.174004 | 2021-05-23T13:10:24 | 2021-05-23T13:10:24 | 31,709,652 | 0 | 0 | null | 2022-02-16T00:46:32 | 2015-03-05T10:53:42 | Java | UTF-8 | Java | false | false | 970 | java | package md.onemap.harta.loader;
import md.onemap.harta.db.gis.entity.Node;
import md.onemap.harta.geometry.BoundsLatLon;
import java.util.Map;
/**
* Created by sergpank on 15.05.15.
*/
public abstract class AbstractLoader
{
protected double minLon;
protected double minLat;
protected double maxLon;
protected double maxLat;
public abstract Map<Long, Node> getNodes();
public abstract void load(String dataSource);
public abstract BoundsLatLon getBounds();
public double getMinLon()
{
return minLon;
}
public double getMinLat()
{
return minLat;
}
public double getMaxLon()
{
return maxLon;
}
public double getMaxLat()
{
return maxLat;
}
protected void registerMinMax(Double lat, Double lon)
{
if (lat < minLat) {
minLat = lat;
}
if (lat > maxLat) {
maxLat = lat;
}
if (lon < minLon) {
minLon = lon;
}
if (lon > maxLon) {
maxLon = lon;
}
}
}
| [
"[email protected]"
]
| |
ec2f3e8a78b78bae6783cce6f7cf81bc2bc75ea5 | c3e558b2642fce6d9ea0e360cb8cf444511736ea | /app/src/main/java/net/margaritov/preference/colorpicker/AlphaPatternDrawable.java | 8e0d841c7bfd3951a93a1b845403e713a98c7b16 | [
"Apache-2.0"
]
| permissive | wasdennnoch/AndroidN-ify | 8466c4043ef6312c1c3c846d30c9551007eefa53 | 7fd4fe402e935ad6d421d0b1ad1a0619d0f327c4 | refs/heads/master | 2020-04-04T03:57:02.569862 | 2017-09-08T04:40:35 | 2017-09-08T04:40:35 | 54,745,042 | 435 | 290 | null | 2017-09-08T04:40:36 | 2016-03-25T20:12:34 | Java | UTF-8 | Java | false | false | 3,801 | java | /*
* Copyright (C) 2010 Daniel Nilsson
*
* 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 net.margaritov.preference.colorpicker;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
/**
* This drawable that draws a simple white and gray chessboard pattern.
* It's pattern you will often see as a background behind a
* partly transparent image in many applications.
*
* @author Daniel Nilsson
*/
public class AlphaPatternDrawable extends Drawable {
private int mRectangleSize = 10;
private final Paint mPaint = new Paint();
private final Paint mPaintWhite = new Paint();
private final Paint mPaintGray = new Paint();
private int numRectanglesHorizontal;
private int numRectanglesVertical;
/**
* Bitmap in which the pattern will be cahched.
*/
private Bitmap mBitmap;
public AlphaPatternDrawable(int rectangleSize) {
mRectangleSize = rectangleSize;
mPaintWhite.setColor(0xffffffff);
mPaintGray.setColor(0xffcbcbcb);
}
@Override
public void draw(Canvas canvas) {
canvas.drawBitmap(mBitmap, null, getBounds(), mPaint);
}
@Override
public int getOpacity() {
return 0;
}
@Override
public void setAlpha(int alpha) {
throw new UnsupportedOperationException("Alpha is not supported by this drawwable.");
}
@Override
public void setColorFilter(ColorFilter cf) {
throw new UnsupportedOperationException("ColorFilter is not supported by this drawwable.");
}
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
int height = bounds.height();
int width = bounds.width();
numRectanglesHorizontal = (int) Math.ceil((width / mRectangleSize));
numRectanglesVertical = (int) Math.ceil(height / mRectangleSize);
generatePatternBitmap();
}
/**
* This will generate a bitmap with the pattern
* as big as the rectangle we were allow to draw on.
* We do this to chache the bitmap so we don't need to
* recreate it each time draw() is called since it
* takes a few milliseconds.
*/
private void generatePatternBitmap() {
if (getBounds().width() <= 0 || getBounds().height() <= 0) {
return;
}
mBitmap = Bitmap.createBitmap(getBounds().width(), getBounds().height(), Config.ARGB_8888);
Canvas canvas = new Canvas(mBitmap);
Rect r = new Rect();
boolean verticalStartWhite = true;
for (int i = 0; i <= numRectanglesVertical; i++) {
boolean isWhite = verticalStartWhite;
for (int j = 0; j <= numRectanglesHorizontal; j++) {
r.top = i * mRectangleSize;
r.left = j * mRectangleSize;
r.bottom = r.top + mRectangleSize;
r.right = r.left + mRectangleSize;
canvas.drawRect(r, isWhite ? mPaintWhite : mPaintGray);
isWhite = !isWhite;
}
verticalStartWhite = !verticalStartWhite;
}
}
} | [
"[email protected]"
]
| |
7f9c7982f96250b61f2b75f2824669d1df787269 | 1a4a5739b659ab80ff394acc25e70be3baee53e1 | /src/main/java/esd/controller/manage/WhiteListManageController.java | fd178b182af369c900833cdd8cc6a1441a1986a7 | []
| no_license | wageyo/jobservice | 44cf98237577e64f647caeb7e624b891ef1201f3 | 84d349374a7c726564501de6972cc4b18f7c6172 | refs/heads/master | 2016-09-06T16:27:18.402834 | 2015-03-10T03:12:53 | 2015-03-10T03:12:53 | 23,613,348 | 3 | 3 | null | 2015-06-16T01:14:58 | 2014-09-03T08:54:34 | Java | UTF-8 | Java | false | false | 6,166 | java | package esd.controller.manage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import esd.bean.Parameter;
import esd.bean.WhiteList;
import esd.controller.Constants;
import esd.service.KitService;
import esd.service.ParameterService;
import esd.service.WhiteListService;
/**
* 白名单管理 后台管理控制器
*
* @author yufu
* @email [email protected] 2015-1-23
*/
@Controller
@RequestMapping("/manage/white")
public class WhiteListManageController {
private static Logger log = Logger
.getLogger(WhiteListManageController.class);
@Autowired
private WhiteListService whiteListService;
@Autowired
private ParameterService parameterService;
/*
* 转到 白名单列表 页面
*/
@RequestMapping(value = "/white_list", method = RequestMethod.GET)
public ModelAndView white_list(HttpServletRequest request) {
log.debug("goto:白名单管理");
Map<String, Object> entity = new HashMap<>();
String pageStr = request.getParameter("page");
Integer page = KitService.getInt(pageStr) > 0 ? KitService
.getInt(pageStr) : 1;
Integer rows = Constants.SIZE;
// 未审核职位状态信息
WhiteList paramEntity = new WhiteList();
// 名称模糊查询
String targetName = request.getParameter("targetName");
paramEntity.setTitle(targetName);
List<WhiteList> resultList = whiteListService.getByPage(paramEntity,
page, rows);
Integer total = whiteListService.getTotalCount(paramEntity); // 数据总条数
try {
List<Map<String, Object>> list = new ArrayList<>();
for (WhiteList tmp : resultList) {
Map<String, Object> tempMap = new HashMap<>();
tempMap.put("id", tmp.getId());// id
tempMap.put("title", tmp.getTitle());// 域名名称
tempMap.put("domainName", tmp.getDomainName());// 域名
tempMap.put("createDate", tmp.getCreateDate());// 加入时间
list.add(tempMap);
}
entity.put("total", total);
entity.put("entityList", list);
log.debug("获取白名单信息,size():" + total);
} catch (Exception e) {
log.error("获取 白名单信息时发生错误。");
}
// 放入当前页数, 总页数, 职位名, 审核状态
entity.put("currentPage", page);
entity.put("totalPage", KitService.getTotalPage(total));
entity.put("targetName", targetName);
//白名单功能是否打开开关
Parameter parameter = parameterService.getById(Constants.WHITE_LIST_SWITCH);
entity.put("whiteListSwitch", parameter);
log.debug("转到 白名单列表 页面");
return new ModelAndView("manage/white-list", entity);
}
// 转到 增加白名单 页面
@RequestMapping(value = "/add", method = RequestMethod.GET)
public ModelAndView white_add_get(HttpServletRequest request) {
log.debug("goto:增加白名单");
return new ModelAndView("manage/white-add");
}
// 提交 增加白名单
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> white_add_post(WhiteList params,
HttpServletRequest request) {
log.debug(" 增加白名单" + params);
Map<String, Object> result = new HashMap<String, Object>();
boolean bl = whiteListService.save(params);
if (bl) {
result.put(Constants.NOTICE, Constants.Notice.SUCCESS.getValue());
} else {
result.put(Constants.NOTICE, Constants.Notice.FAILURE.getValue());
}
return result;
}
// 删除白名单
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> delete_white(
@PathVariable(value = "id") String id, HttpServletRequest request) {
Map<String, Object> entity = new HashMap<String, Object>();
boolean bl = whiteListService.delete(id);
if (bl) {
entity.put(Constants.NOTICE, Constants.Notice.SUCCESS.getValue());
} else {
entity.put(Constants.NOTICE, "删除白名单出错, 请联系白名单.");
}
return entity;
}
// 转到 白名单编辑 页面
@RequestMapping(value = "/edit/{id}", method = RequestMethod.GET)
public ModelAndView white_edit_get(@PathVariable(value = "id") String id,
HttpServletRequest request) {
log.debug("goto:编辑白名单 ");
Map<String, Object> entity = new HashMap<String, Object>();
// 根据id查询对应的数据
WhiteList obj = whiteListService.getById(id);
entity.put("obj", obj);
return new ModelAndView("manage/white-edit", entity);
}
// 提交白名单编辑
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> white_edit_post(WhiteList params,
HttpServletRequest request) {
log.debug(" 更新白名单" + params);
Map<String, Object> entity = new HashMap<String, Object>();
boolean bl = whiteListService.update(params);
if (bl) {
entity.put(Constants.NOTICE, Constants.Notice.SUCCESS.getValue());
} else {
entity.put(Constants.NOTICE, "更新白名单出错, 请联系白名单.");
}
return entity;
}
public static void main(String[] args) {
String uuid = UUID.randomUUID().toString();
log.info(uuid);
}
// 更新白名单开关值
@RequestMapping(value="/update_switch")
@ResponseBody
public Map<String,Object> updateWhiteListSwitch(HttpServletRequest request){
Map<String,Object> map = new HashMap<String,Object>();
String value = request.getParameter("value");
Parameter parameter = new Parameter();
parameter.setId(Constants.WHITE_LIST_SWITCH);
parameter.setValue(value);
Boolean bl = parameterService.update(parameter);
if(bl){
map.put(Constants.NOTICE, Constants.Notice.SUCCESS.getValue());
}else{
map.put(Constants.NOTICE, Constants.Notice.FAILURE.getValue());
}
return map;
}
}
| [
"[email protected]"
]
| |
fd30af5d7099e761469dff23628fa93785169736 | 36073e09d6a12a275cc85901317159e7fffa909e | /querydsl_querydsl/modifiedFiles/14/tests/ExtendedNamingStrategyTest.java | f4f36038ed7955fbb9493ced320fdd9debd408a3 | []
| no_license | monperrus/bug-fixes-saner16 | a867810451ddf45e2aaea7734d6d0c25db12904f | 9ce6e057763db3ed048561e954f7aedec43d4f1a | refs/heads/master | 2020-03-28T16:00:18.017068 | 2018-11-14T13:48:57 | 2018-11-14T13:48:57 | 148,648,848 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,621 | java | /*
* Copyright 2011, Mysema Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mysema.query.sql;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import com.mysema.codegen.model.Types;
import com.mysema.query.codegen.EntityType;
public class ExtendedNamingStrategyTest {
private NamingStrategy namingStrategy = new ExtendedNamingStrategy();
private EntityType entityModel;
@Before
public void setUp(){
entityModel = new EntityType(Types.OBJECT);
//entityModel.addAnnotation(new TableImpl("OBJECT"));
entityModel.getData().put("table", "OBJECT");
}
@Test
public void GetClassName() {
assertEquals("UserData", namingStrategy.getClassName("user_data"));
assertEquals("U", namingStrategy.getClassName("u"));
assertEquals("Us",namingStrategy.getClassName("us"));
assertEquals("U", namingStrategy.getClassName("u_"));
assertEquals("Us",namingStrategy.getClassName("us_"));
}
@Test
public void GetPropertyName() {
assertEquals("whileCol", namingStrategy.getPropertyName("while", entityModel));
assertEquals("name", namingStrategy.getPropertyName("name", entityModel));
assertEquals("userId", namingStrategy.getPropertyName("user_id", entityModel));
assertEquals("accountEventId", namingStrategy.getPropertyName("accountEvent_id", entityModel));
}
@Test
public void GetPropertyName_For_Column_With_Spaces() {
assertEquals("userId", namingStrategy.getPropertyName("user id", entityModel));
}
@Test
public void GetPropertyNameForInverseForeignKey(){
assertEquals("_superiorFk", namingStrategy.getPropertyNameForInverseForeignKey("fk_superior", entityModel));
// fk_order_rows
assertEquals("rows", namingStrategy.getPropertyNameForInverseForeignKey("fk_order_rows", entityModel));
// fk_category_events
assertEquals("events", namingStrategy.getPropertyNameForInverseForeignKey("fk_category_events", entityModel));
}
@Test
public void GetPropertyNameForForeignKey(){
assertEquals("superiorFk", namingStrategy.getPropertyNameForForeignKey("fk_superior", entityModel));
assertEquals("superiorFk", namingStrategy.getPropertyNameForForeignKey("FK_SUPERIOR", entityModel));
// fk_order_rows
assertEquals("order", namingStrategy.getPropertyNameForForeignKey("fk_order_rows", entityModel));
// fk_category_events
assertEquals("category", namingStrategy.getPropertyNameForForeignKey("fk_category_events", entityModel));
}
@Test
public void GetPropertyNameForPrimaryKey(){
assertEquals("superiorPk", namingStrategy.getPropertyNameForPrimaryKey("pk_superior", entityModel));
assertEquals("superiorPk", namingStrategy.getPropertyNameForPrimaryKey("PK_SUPERIOR", entityModel));
}
@Test
public void GetDefaultVariableName(){
assertEquals("object", namingStrategy.getDefaultVariableName(entityModel));
}
}
| [
"[email protected]"
]
| |
e734228995b97eda5ab6ef638e7e4eb49f503c27 | 6fcfe84659f9916a4370199a9bf814b057de24bd | /src/main/java/io/shiel/codility/CodilitySolutionDriver.java | aaa570e0e4341dfa94ae08a13f17932c0fa08298 | []
| no_license | patrickshiel/codility | dc9c58181d930c7b3362aeacf1154d3292baf3eb | 4b74e612c7f91d43b656d37c36a47624005ea26d | refs/heads/master | 2021-01-07T16:50:10.263911 | 2020-02-20T00:44:20 | 2020-02-20T00:44:20 | 241,759,654 | 0 | 0 | null | 2020-10-13T19:40:58 | 2020-02-20T00:42:44 | Java | UTF-8 | Java | false | false | 404 | java | package io.shiel.codility;
import io.shiel.codility.lesson1.BinaryGap;
import java.util.Arrays;
public class CodilitySolutionDriver {
public static void main(String[] args) {
System.out.println("Starting Codility Solution: " + Arrays.toString(args));
Integer x = 328;
int[] input = {1, 5, 2, 1, 4, 0};
System.out.println(new BinaryGap().solution(x));
}
}
| [
"[email protected]"
]
| |
a898e26f23f8508756241c44fdaff7b9cb11c003 | 317707f9566dc586a23aa0d6ce47174f50ca524e | /src/main/java/com/yunionyun/mcp/mcclient/utils/pricespec/RdsCpuMemSpec.java | 76d98ef9a53ce00f4e4fd544e87b7e199f20cc48 | [
"Apache-2.0"
]
| permissive | yunionio/mcclient_java | f990e79d82d116f0bdd67ca60b0d747f93ec2f37 | 0aabf2b3c2b4aca9395a2612ef6b7f4badfd480e | refs/heads/master | 2022-10-06T00:51:58.190950 | 2022-09-28T00:47:05 | 2022-09-28T00:47:05 | 154,431,814 | 5 | 8 | Apache-2.0 | 2022-09-28T00:47:06 | 2018-10-24T03:15:39 | Java | UTF-8 | Java | false | false | 251 | java | package com.yunionyun.mcp.mcclient.utils.pricespec;
public class RdsCpuMemSpec extends BaseResourceSpec {
public RdsCpuMemSpec(String brand, String region, String zone, String rdsType) {
super(brand, region, zone, "rds", rdsType, null);
}
} | [
"[email protected]"
]
| |
e99661a5bc6851a48eb5e413f32803980540a538 | a749b8c996dfc97e6ee41c88807a1a847d1bd97b | /android/app/src/main/java/com/rnnstarter/MainApplication.java | 5a52e97a175f81a9b6cb0140b183e3398b9b2af5 | [
"MIT"
]
| permissive | ehuergo/rnn-starter-tv | 9483532128cf8eba3c28aa149e9fce5ccf9ee732 | dbb0985777896ed622ef1f3333c1887385f26e13 | refs/heads/master | 2023-07-30T15:06:03.423231 | 2021-09-17T18:49:52 | 2021-09-17T18:49:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,703 | java | package com.rnnstarter;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.reactnativenavigation.NavigationApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.reactnativenavigation.react.NavigationReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Collections;
import com.facebook.react.bridge.JSIModulePackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
import com.facebook.react.bridge.JSIModuleSpec;
import com.facebook.react.bridge.JavaScriptContextHolder;
import com.facebook.react.bridge.ReactApplicationContext;
import com.reactnativemmkv.MmkvModule;
public class MainApplication extends NavigationApplication {
private final ReactNativeHost mReactNativeHost =
new NavigationReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
protected JSIModulePackage getJSIModulePackage() {
return new RNNStarterJSIPackage();
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
// initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.rnnstarter.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
// TODO: Remove all of this when MMKV and Reanimated can be autoinstalled (maybe RN 0.65)
// RNNStarterJSIPackage is not in a separate file bc it was causing problem when renaming project
class RNNStarterJSIPackage extends ReanimatedJSIModulePackage {
@Override
public List<JSIModuleSpec> getJSIModules(ReactApplicationContext reactApplicationContext, JavaScriptContextHolder jsContext) {
super.getJSIModules(reactApplicationContext, jsContext);
MmkvModule.install(jsContext, reactApplicationContext.getFilesDir().getAbsolutePath() + "/mmkv");
return Collections.emptyList();
}
}
| [
"[email protected]"
]
| |
0a7e60490ce0847acb2271c29faf04d2d5fb6cde | 24b7e9a293b5ecc1a56487c1afbf22bd857fcb61 | /wonderzoo/MainController.java | 0c5de5be1ae103da58df02ba3113437bf320e166 | []
| no_license | Jonny-Code/wonderzoo | feb96879f6c51305a6a7cadbfb8bdec3bddc5a3e | ec6d98b6bf803c09d8093d28cfdbe35385ff565c | refs/heads/master | 2022-11-16T03:39:15.874425 | 2020-07-07T18:15:08 | 2020-07-07T18:15:08 | 277,890,302 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,356 | java | // Jon Sledge
// COP 2552
// Final Project
package wonderzoo;
import javafx.scene.control.*;
import javafx.scene.control.cell.TextFieldTableCell;
import org.json.*;
import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.Pane;
import java.io.File;
import java.io.FileWriter;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.ResourceBundle;
public class MainController implements Initializable {
@FXML
Pane homePane, addPane;
@FXML
Button homeBtn, addBtn, submitBtn, deleteBtn;
@FXML
ComboBox terrainBox;
@FXML
TextField animalNameInput;
@FXML
TableView<Animal> animalTable;
@FXML
TableView<Food> foodTable;
@FXML
CheckBox genderCheckBox;
@FXML
TableColumn animalCol, terrainCol, foodCol1, foodCol2, foodCol3, foodCol4, foodCol5;
private ObservableList<Animal> list = FXCollections.observableArrayList();
private ObservableList<Food> ob = FXCollections.observableArrayList();
@FXML
private void handleNavBtnClick(ActionEvent e) {
if (e.getSource().equals(homeBtn)) {
navigateHome();
} else if (e.getSource().equals(addBtn)) {
navigateAdd();
}
}
@FXML
private void handleEditCommit(TableColumn.CellEditEvent<Object, String> objectStringCellEditEvent) throws Exception {
// read json file contents and update it
ArrayList<JSONObject> arr = new ArrayList<>();
readFileContents(arr);
for (int i = 0; i < arr.size(); i++) {
if (objectStringCellEditEvent.getOldValue().equals(arr.get(i).get("name"))) {
System.out.println("found it, replacing value");
arr.get(i).put("name", objectStringCellEditEvent.getNewValue());
} else if (objectStringCellEditEvent.getOldValue().equals(arr.get(i).get("terrain"))) {
System.out.println("found it, replacing value");
arr.get(i).put("terrain", objectStringCellEditEvent.getNewValue());
}
}
JSONObject o = new JSONObject();
o.put("animals", arr);
writeFileContents(o);
System.out.println("new array is " + arr.toString());
}
@FXML
private void handleFoodEditCommit(TableColumn.CellEditEvent<Object, String> objectStringCellEditEvent) throws Exception {
ArrayList<JSONObject> arr = new ArrayList<>();
readFileContents(arr);
for (int i = 0; i < arr.size(); i++) {
arr.get(i).getJSONArray("foods").put(objectStringCellEditEvent.getNewValue());
}
JSONObject o = new JSONObject();
o.put("animals", arr);
writeFileContents(o);
}
@FXML
private void handleDeleteBtnClick(ActionEvent e) throws Exception {
// read json file contents and remove selected item
System.out.println(list.get(animalTable.getSelectionModel().getSelectedIndex()).getName());
Object item = animalTable.getSelectionModel().getSelectedItem();
ArrayList<JSONObject> arr = new ArrayList<>();
readFileContents(arr);
for (int i = 0; i < arr.size(); i++) {
if (arr.get(i).get("name").equals(list.get(animalTable.getSelectionModel().getSelectedIndex()).getName())) {
System.out.println("found it, removing...");
arr.remove(i);
}
}
JSONObject o = new JSONObject();
o.put("animals", arr);
writeFileContents(o);
animalTable.getItems().remove(item);
}
@FXML
private void handleSubmitBtnClick(ActionEvent e) throws Exception {
JSONObject animalJson = new JSONObject();
JSONObject animalJson2 = new JSONObject();
ArrayList<JSONObject> arr = new ArrayList<>();
String name = animalNameInput.getText();
if (!name.matches("[A-Za-z\\s]+")) {
System.out.println("incorrect input");
return;
} else {
System.out.println("adding animal...");
String terrain = terrainBox.getSelectionModel().getSelectedItem().toString();
list.add(new Animal(name, terrain));
animalJson.put("name", list.get(list.size() - 1).getName());
animalJson.put("terrain", list.get(list.size() - 1).getTerrain());
ob.addAll(new Food(""), new Food(""), new Food(""), new Food(""), new Food(""));
animalJson.put("foods", new ArrayList());
foodTable.setItems(ob);
animalTable.setItems(list);
readFileContents(arr);
arr.add(animalJson);
animalJson2.put("animals", arr);
writeFileContents(animalJson2);
navigateHome();
}
}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
initBtnStyles();
initPaneStyles();
initColStyles();
animalCol.setCellValueFactory(new PropertyValueFactory<Animal, String>("name"));
terrainCol.setCellValueFactory(new PropertyValueFactory<Animal, String>("terrain"));
foodCol1.setCellValueFactory(new PropertyValueFactory<Food, String>("name"));
foodCol2.setCellValueFactory(new PropertyValueFactory<Food, String>("name"));
terrainBox.getItems().addAll("Mountain", "Desert", "SnowMountain");
initFileContents();
revealBtns();
animalTable.setEditable(true);
foodTable.setEditable(true);
animalCol.setCellFactory(TextFieldTableCell.forTableColumn());
foodCol1.setCellFactory(TextFieldTableCell.forTableColumn());
foodCol2.setCellFactory(TextFieldTableCell.forTableColumn());
foodCol3.setCellFactory(TextFieldTableCell.forTableColumn());
foodCol4.setCellFactory(TextFieldTableCell.forTableColumn());
foodCol5.setCellFactory(TextFieldTableCell.forTableColumn());
}
public void initFileContents() {
File temp = new File("Animals.json");
if (temp.exists()) {
try {
String contents = new String((Files.readAllBytes(Paths.get("Animals.json"))));
JSONObject o = new JSONObject(contents);
for (int i = 0; i < o.getJSONArray("animals").length(); i++) {
String name = o.getJSONArray("animals").getJSONObject(i).get("name").toString();
String terrain = o.getJSONArray("animals").getJSONObject(i).get("terrain").toString();
list.add(new Animal(name, terrain));
animalTable.setEditable(true);
animalTable.setItems(list);
}
for (int i = 0; i < o.getJSONArray("animals").length(); i++) {
if (o.getJSONArray("animals").getJSONObject(i).getJSONArray("foods").length() != 0) {
String food = o.getJSONArray("animals").getJSONObject(i).getJSONArray("foods").get(i).toString();
ob.add(new Food(food));
System.out.println(ob);
foodTable.setEditable(true);
foodTable.setItems(ob);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void readFileContents(ArrayList<JSONObject> arr) throws Exception {
File temp = new File("Animals.json");
if (temp.exists()) {
String contents = new String((Files.readAllBytes(Paths.get("Animals.json"))));
JSONObject o = new JSONObject(contents);
for (int i = 0; i < o.getJSONArray("animals").length(); i++) {
arr.add(o.getJSONArray("animals").getJSONObject(i));
}
}
}
public void writeFileContents(JSONObject obj) {
try (FileWriter file = new FileWriter("Animals.json")) {
file.write(obj.toString());
file.flush();
} catch (Exception e2) {
e2.printStackTrace();
}
}
public void navigateHome() {
homePane.setStyle("-fx-opacity: 1");
homePane.toFront();
addPane.toBack();
addPane.setStyle("-fx-opacity: 0");
revealBtns();
}
public void navigateAdd() {
homePane.setStyle("-fx-opacity: 0");
homePane.toBack();
addPane.setStyle("-fx-opacity: 1");
addPane.toFront();
}
public void initBtnStyles() {
homeBtn.styleProperty().bind(Bindings.when(homeBtn.hoverProperty())
.then("-fx-scale-x: 1.1;-fx-scale-y: 1.1;-fx-scale-z: 1.1;")
.otherwise(""));
addBtn.styleProperty().bind(Bindings.when(addBtn.hoverProperty())
.then("-fx-scale-x: 1.1;-fx-scale-y: 1.1;-fx-scale-z: 1.1;")
.otherwise(""));
submitBtn.styleProperty().bind(Bindings.when(submitBtn.hoverProperty())
.then("-fx-scale-x: 1.1;-fx-scale-y: 1.1;-fx-scale-z: 1.1;")
.otherwise(""));
deleteBtn.styleProperty().bind(Bindings.when(deleteBtn.hoverProperty())
.then("-fx-scale-x: 1.1;-fx-scale-y: 1.1;-fx-scale-z: 1.1;-fx-opacity: 0;")
.otherwise("-fx-opacity: 0;"));
}
public void initPaneStyles() {
homePane.setStyle("-fx-opacity: 0");
addPane.setStyle("-fx-opacity: 0");
}
public void initColStyles() {
animalCol.setStyle("-fx-alignment: CENTER;");
terrainCol.setStyle("-fx-alignment: CENTER;");
foodCol1.setStyle("-fx-alignment: CENTER;");
foodCol2.setStyle("-fx-alignment: CENTER;");
foodCol3.setStyle("-fx-alignment: CENTER;");
foodCol4.setStyle("-fx-alignment: CENTER;");
foodCol5.setStyle("-fx-alignment: CENTER;");
}
public void revealBtns() {
File temp = new File("Animals.json");
if (temp.exists()) {
deleteBtn.styleProperty().bind(Bindings.when(deleteBtn.hoverProperty())
.then("-fx-scale-x: 1.1;-fx-scale-y: 1.1;-fx-scale-z: 1.1;-fx-opacity: 1;")
.otherwise("-fx-opacity: 1;"));
}
}
} | [
"[email protected]"
]
| |
78a1cfd8d70e4a78be46814598a30a6776e93f07 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/31/31_8e37c75753bebb713a7a39dbc1e5bf7010a78037/PosixJNAAffinity/31_8e37c75753bebb713a7a39dbc1e5bf7010a78037_PosixJNAAffinity_s.java | 01af619ce02d73d1d08485be7736463ba430fef2 | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 4,172 | java | /*
* Copyright 2013 Peter Lawrey
*
* 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 net.openhft.affinity.impl;
import com.sun.jna.*;
import com.sun.jna.ptr.LongByReference;
import net.openhft.affinity.IAffinity;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Implementation of {@link IAffinity} based on JNA call of
* sched_setaffinity(3)/sched_getaffinity(3) from 'c' library. Applicable for most
* linux/unix platforms
* <p/>
* TODO Support assignment to core 64 and above
*
* @author peter.lawrey
* @author BegemoT
*/
public enum PosixJNAAffinity implements IAffinity {
INSTANCE;
public static final boolean LOADED;
private static final Logger LOGGER = Logger.getLogger(PosixJNAAffinity.class.getName());
private static final String LIBRARY_NAME = Platform.isWindows() ? "msvcrt" : "c";
@Override
public long getAffinity() {
final CLibrary lib = CLibrary.INSTANCE;
// TODO where are systems with 64+ cores...
final LongByReference cpuset = new LongByReference(0L);
try {
final int ret = lib.sched_getaffinity(0, Long.SIZE / 8, cpuset);
if (ret < 0)
throw new IllegalStateException("sched_getaffinity((" + Long.SIZE / 8 + ") , &(" + cpuset + ") ) return " + ret);
return cpuset.getValue();
} catch (LastErrorException e) {
throw new IllegalStateException("sched_getaffinity((" + Long.SIZE / 8 + ") , &(" + cpuset + ") ) errorNo=" + e.getErrorCode(), e);
}
}
@Override
public void setAffinity(final long affinity) {
final CLibrary lib = CLibrary.INSTANCE;
try {
//fixme: where are systems with more then 64 cores...
final int ret = lib.sched_setaffinity(0, Long.SIZE / 8, new LongByReference(affinity));
if (ret < 0) {
throw new IllegalStateException("sched_setaffinity((" + Long.SIZE / 8 + ") , &(" + affinity + ") ) return " + ret);
}
} catch (LastErrorException e) {
throw new IllegalStateException("sched_getaffinity((" + Long.SIZE / 8 + ") , &(" + affinity + ") ) errorNo=" + e.getErrorCode(), e);
}
}
@Override
public int getCpu() {
final CLibrary lib = CLibrary.INSTANCE;
try {
final int ret = lib.sched_getcpu();
if (ret < 0)
throw new IllegalStateException("sched_getcpu( ) return " + ret);
return ret;
} catch (LastErrorException e) {
throw new IllegalStateException("sched_getcpu( ) errorNo=" + e.getErrorCode(), e);
}
}
/**
* @author BegemoT
*/
interface CLibrary extends Library {
CLibrary INSTANCE = (CLibrary)
Native.loadLibrary(LIBRARY_NAME, CLibrary.class);
int sched_setaffinity(final int pid,
final int cpusetsize,
final PointerType cpuset) throws LastErrorException;
int sched_getaffinity(final int pid,
final int cpusetsize,
final PointerType cpuset) throws LastErrorException;
int sched_getcpu() throws LastErrorException;
}
static {
boolean loaded = false;
try {
INSTANCE.getAffinity();
loaded = true;
} catch (UnsatisfiedLinkError e) {
LOGGER.log(Level.WARNING, "Unable to load jna library " + e);
}
LOADED = loaded;
}
}
| [
"[email protected]"
]
| |
c359a378dbfd2b04b1d3559f6046c905cea2783c | f0081b7e130128828f19f464f17cd83d44174f07 | /src/main/java/db/services/FheaderServiceImpl.java | 5729de8a7ff1c5e7c7779375c6026d8f3dc2b9dd | []
| no_license | returncode13/Boxes-using-JavafxDrawers | 163a0e0004c1992d6124f76f76120ea52a7ed321 | 07a751cf5b5a846aed1aad297dfcbbe9111e6c64 | refs/heads/master | 2021-07-12T20:09:23.484458 | 2018-10-29T19:12:58 | 2018-10-29T19:12:58 | 112,998,516 | 0 | 0 | null | 2018-10-29T19:12:59 | 2017-12-04T05:25:58 | Java | UTF-8 | Java | false | false | 1,940 | 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 db.services;
import db.dao.FheaderDAO;
import db.dao.FheaderDAOImpl;
import db.model.Fheader;
import db.model.Job;
import db.model.Volume;
import java.util.List;
/**
*
* @author sharath nair <[email protected]>
*/
public class FheaderServiceImpl implements FheaderService {
FheaderDAO fhDAO=new FheaderDAOImpl();
@Override
public void createHeader(Fheader h) {
fhDAO.createHeader(h);
}
@Override
public void createBulkHeaders(List<Fheader> headers) {
fhDAO.createBulkHeaders(headers);
}
@Override
public Fheader getHeader(Long hid) {
return fhDAO.getHeader(hid);
}
@Override
public void updateHeader(Long hid, Fheader newH) {
fhDAO.updateHeader(hid, newH);
}
@Override
public void deleteHeader(Long hid) {
fhDAO.deleteHeader(hid);
}
@Override
public List<Fheader> getHeadersFor(Job job) {
return fhDAO.getHeadersFor(job);
}
@Override
public List<Fheader> getHeadersFor(Volume v) {
return fhDAO.getHeadersFor(v);
}
@Override
public void deleteHeadersFor(Volume v) {
fhDAO.deleteHeadersFor(v);
}
@Override
public void deleteHeadersFor(Job job) {
fhDAO.deleteHeadersFor(job);
}
@Override
public void updateDeleteFlagsFor(Volume dbvol, List<String> subsurfacesOnDisk) {
fhDAO.updateDeleteFlagsFor(dbvol, subsurfacesOnDisk);
}
@Override
public void checkForMultipleSubsurfacesInHeadersForJob(Job dbjob) {
fhDAO.checkForMultipleSubsurfacesInHeadersForJob(dbjob);
}
@Override
public String getLatestTimeStampFor(Volume dbvol) {
return fhDAO.getLatestTimeStampFor(dbvol);
}
}
| [
"[email protected]"
]
| |
36638d266b2a9d91cca03a17ec554360334c4519 | 17c7cc174a4212674a83206b08d43893b0c5c822 | /src/main/java/gutenberg/itext/pegdown/TableInfos.java | 611854b974a97bb31820eb86e480217e8529a003 | [
"MIT"
]
| permissive | Arnauld/gutenberg | b321bb34dedd371820f359b0ca8c052d72c09767 | 18d761ddba378ee58a3f3dc6316f66742df8d985 | refs/heads/master | 2021-05-15T01:47:02.146235 | 2019-02-12T21:50:43 | 2019-02-12T21:50:43 | 22,622,311 | 3 | 3 | MIT | 2019-02-12T21:44:20 | 2014-08-04T22:36:02 | Java | UTF-8 | Java | false | false | 1,040 | java | package gutenberg.itext.pegdown;
import com.itextpdf.text.Element;
import com.itextpdf.text.pdf.PdfPTable;
import org.pegdown.ast.TableColumnNode;
import java.util.List;
/**
* @author <a href="http://twitter.com/aloyer">@aloyer</a>
*/
public class TableInfos {
private final PdfPTable table;
private final List<TableColumnNode> tableNodeColumns;
public TableInfos(PdfPTable table, List<TableColumnNode> tableNodeColumns) {
this.table = table;
this.tableNodeColumns = tableNodeColumns;
}
public PdfPTable getTable() {
return table;
}
public int columnAlignment(int col) {
TableColumnNode tcn = tableNodeColumns.get(col);
switch (tcn.getAlignment()) {
case Left:
return Element.ALIGN_LEFT;
case Right:
return Element.ALIGN_RIGHT;
case None:
return Element.ALIGN_UNDEFINED;
case Center:
default:
return Element.ALIGN_CENTER;
}
}
}
| [
"[email protected]"
]
| |
41522e5a163943997b3a6aec03f0567c4c92f1ca | 2dc55280583e54cd3745fad4145eb7a0712eb503 | /stardust-engine-core/src/main/java/org/eclipse/stardust/engine/extensions/jaxws/addressing/AttributedURIType.java | 530edcd7adaebd9d2c92ce95b067d4db87380ac2 | []
| no_license | markus512/stardust.engine | 9d5f4fd7016a38c5b3a1fe09cc7a445c00a31b57 | 76e0b326446e440468b4ab54cfb8e26a6403f7d8 | refs/heads/master | 2022-02-06T23:03:21.305045 | 2016-03-09T14:56:01 | 2016-03-09T14:56:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,484 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-558
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2008.06.05 at 11:30:07 AM CEST
//
package org.eclipse.stardust.engine.extensions.jaxws.addressing;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.namespace.QName;
/**
* <p>
* Java class for AttributedURIType complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within this
* class.
*
* <pre>
* <complexType name="AttributedURIType">
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AttributedURIType", propOrder = {"value"})
public class AttributedURIType
{
@XmlValue
@XmlSchemaType(name = "anyURI")
protected String value;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the value property.
*
* @return possible object is {@link String }
*
*/
public String getValue()
{
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is {@link String }
*
*/
public void setValue(String value)
{
this.value = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this
* class.
*
* <p>
* the map is keyed by the name of the attribute and the value is the string value of
* the attribute.
*
* the map returned by this method is live, and you can add new attribute by updating
* the map directly. Because of this design, there's no setter.
*
*
* @return always non-null
*/
public Map<QName, String> getOtherAttributes()
{
return otherAttributes;
}
}
| [
"[email protected]"
]
| |
d08418ac9d9917e5cbed11ae294c3bfd0ff6ba5d | 65881101f4b7e24f5c5b765cd93b9645adbe4e71 | /src/main/java/com/mycompany/g_logistica/modelo/Rota.java | 30b3b8cdbf328e316c0cef75141870fab4127d72 | []
| no_license | GilmarCarlos/G_Logistica | 232e6a9ad173cfdc662e0ebe98dc60c1650d5590 | 6c9b984d009b5bdad41a9ef2a6d6babf5a972de9 | refs/heads/master | 2021-01-18T06:29:08.199206 | 2016-10-02T23:34:52 | 2016-10-02T23:34:52 | 68,773,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,102 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.g_logistica.modelo;
import java.io.Serializable;
import java.sql.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author hexp_
*/
@Entity
@Table(name = "rota")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Rota.findAll", query = "SELECT r FROM Rota r"),
@NamedQuery(name = "Rota.findByIdRota", query = "SELECT r FROM Rota r WHERE r.idRota = :idRota"),
@NamedQuery(name = "Rota.findByDanfe", query = "SELECT r FROM Rota r WHERE r.danfe = :danfe"),
@NamedQuery(name = "Rota.findByPedido", query = "SELECT r FROM Rota r WHERE r.pedido = :pedido"),
@NamedQuery(name = "Rota.findByCliente", query = "SELECT r FROM Rota r WHERE r.cliente = :cliente"),
@NamedQuery(name = "Rota.findByDtEmi", query = "SELECT r FROM Rota r WHERE r.dtEmi = :dtEmi"),
@NamedQuery(name = "Rota.findByConferente", query = "SELECT r FROM Rota r WHERE r.conferente = :conferente"),
@NamedQuery(name = "Rota.findByValor", query = "SELECT r FROM Rota r WHERE r.valor = :valor"),
@NamedQuery(name = "Rota.findByCidadeUf", query = "SELECT r FROM Rota r WHERE r.cidadeUf = :cidadeUf"),
@NamedQuery(name = "Rota.findByQtdVol", query = "SELECT r FROM Rota r WHERE r.qtdVol = :qtdVol")})
public class Rota implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id_rota")
private Integer idRota;
@Column(name = "danfe")
private Integer danfe;
@Column(name = "pedido")
private Integer pedido;
@Size(max = 255)
@Column(name = "cliente")
private String cliente;
@Column(name = "dt_emi")
private Date dtEmi;
@Size(max = 255)
@Column(name = "conferente")
private String conferente;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "valor")
private Float valor;
@Size(max = 255)
@Column(name = "cidade_uf")
private String cidadeUf;
@Column(name = "qtd_vol")
private Integer qtdVol;
@Column(name = "id_transportador")
private Integer idTransportador;
public Rota() {
}
public Rota(Integer idRota) {
this.idRota = idRota;
}
public Integer getIdRota() {
return idRota;
}
public void setIdRota(Integer idRota) {
this.idRota = idRota;
}
public Integer getDanfe() {
return danfe;
}
public void setDanfe(Integer danfe) {
this.danfe = danfe;
}
public Integer getPedido() {
return pedido;
}
public void setPedido(Integer pedido) {
this.pedido = pedido;
}
public String getCliente() {
return cliente;
}
public void setCliente(String cliente) {
this.cliente = cliente;
}
public Date getDtEmi() {
return dtEmi;
}
public void setDtEmi(Date dtEmi) {
this.dtEmi = dtEmi;
}
public String getConferente() {
return conferente;
}
public void setConferente(String conferente) {
this.conferente = conferente;
}
public Float getValor() {
return valor;
}
public void setValor(Float valor) {
this.valor = valor;
}
public String getCidadeUf() {
return cidadeUf;
}
public void setCidadeUf(String cidadeUf) {
this.cidadeUf = cidadeUf;
}
public Integer getQtdVol() {
return qtdVol;
}
public void setQtdVol(Integer qtdVol) {
this.qtdVol = qtdVol;
}
public Integer getIdTransportador() {
return idTransportador;
}
public void setIdTransportador(Integer idTransportador) {
this.idTransportador = idTransportador;
}
@Override
public int hashCode() {
int hash = 0;
hash += (idRota != null ? idRota.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Rota)) {
return false;
}
Rota other = (Rota) object;
if ((this.idRota == null && other.idRota != null) || (this.idRota != null && !this.idRota.equals(other.idRota))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.mycompany.g_logistica.modelo.Rota[ idRota=" + idRota + " ]";
}
}
| [
"[email protected]"
]
| |
65f95e980cfb738a18409c555bc014d9b0c19c35 | 55359c1c80430b58c22fd2471f20afc94e7cdc3a | /src/main/java/com/sudoplay/math/TrigLUT.java | 5875ac6c6a203c73422c483b0f600450f9fd2330 | [
"Apache-2.0",
"CC-BY-3.0",
"BSD-3-Clause"
]
| permissive | SudoPlayGames/SudoMath | e27405152528626b569fae9b0b6de81f1dfe73df | dfa2b98c509a94c0f3e5563f4fcb6ea9d7001e38 | refs/heads/master | 2020-12-24T17:35:34.429788 | 2017-08-14T21:08:51 | 2017-08-14T21:08:51 | 20,983,597 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,141 | java | /*
* Copyright (C) 2014 Jason Taylor.
* Released as open-source under the Apache License, Version 2.0.
*
* =\/==========================================================================
*
* Copyright (C) 2014 Jason Taylor
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*
* This class contains code from http://riven8192.blogspot.com, copyright Riven
* and licensed under CC BY 3.0.
*
* =\/==========================================================================
*
* Copyright (c) 2009, 2012 + any other year Riven
* All rights reserved.
*
* http://creativecommons.org/licenses/by/3.0/
*
*/
package com.sudoplay.math;
/**
* Thanks to Riven:
* <p>
* http://riven8192.blogspot.com/2009/08/fastmath-sincos-lookup-tables.html
* http://riven8192.blogspot.com/2009/08/fastmath-atan2-lookup-table.html
*
* @author Riven
*/
public class TrigLUT {
public static final float sin(float rad) {
return sin[(int) (rad * radToIndex) & SIN_MASK];
}
public static final float cos(float rad) {
return cos[(int) (rad * radToIndex) & SIN_MASK];
}
public static final float sinDeg(float deg) {
return sin[(int) (deg * degToIndex) & SIN_MASK];
}
public static final float cosDeg(float deg) {
return cos[(int) (deg * degToIndex) & SIN_MASK];
}
// private static final float RAD, DEG;
private static final int SIN_BITS, SIN_MASK, SIN_COUNT;
private static final float radFull, radToIndex;
private static final float degFull, degToIndex;
private static final float[] sin, cos;
static {
// RAD = (float) Math.PI / 180.0f;
// DEG = 180.0f / (float) Math.PI;
SIN_BITS = 12;
SIN_MASK = ~(-1 << SIN_BITS);
SIN_COUNT = SIN_MASK + 1;
radFull = (float) (Math.PI * 2.0);
degFull = (float) (360.0);
radToIndex = SIN_COUNT / radFull;
degToIndex = SIN_COUNT / degFull;
sin = new float[SIN_COUNT];
cos = new float[SIN_COUNT];
for (int i = 0; i < SIN_COUNT; i++) {
sin[i] = (float) Math.sin((i + 0.5f) / SIN_COUNT * radFull);
cos[i] = (float) Math.cos((i + 0.5f) / SIN_COUNT * radFull);
}
}
public static final float atan2(float y, float x) {
float add, mul;
if (x < 0.0f) {
if (y < 0.0f) {
x = -x;
y = -y;
mul = 1.0f;
} else {
x = -x;
mul = -1.0f;
}
add = -3.141592653f;
} else {
if (y < 0.0f) {
y = -y;
mul = -1.0f;
} else {
mul = 1.0f;
}
add = 0.0f;
}
float invDiv = ATAN2_DIM_MINUS_1 / ((x < y) ? y : x);
// int xi = (int) (x * invDiv);
// int yi = (int) (y * invDiv);
// potential solution for index out of bounds
int xi = Math.min((int) (x * invDiv), ATAN2_DIM);
int yi = Math.min((int) (y * invDiv), ATAN2_DIM);
return (atan2[yi * ATAN2_DIM + xi] + add) * mul;
}
private static final int ATAN2_BITS = 7;
private static final int ATAN2_BITS2 = ATAN2_BITS << 1;
private static final int ATAN2_MASK = ~(-1 << ATAN2_BITS2);
private static final int ATAN2_COUNT = ATAN2_MASK + 1;
private static final int ATAN2_DIM = (int) Math.sqrt(ATAN2_COUNT);
private static final float ATAN2_DIM_MINUS_1 = (ATAN2_DIM - 1);
private static final float[] atan2 = new float[ATAN2_COUNT];
static {
for (int i = 0; i < ATAN2_DIM; i++) {
for (int j = 0; j < ATAN2_DIM; j++) {
float x0 = (float) i / ATAN2_DIM;
float y0 = (float) j / ATAN2_DIM;
atan2[j * ATAN2_DIM + i] = (float) Math.atan2(y0, x0);
}
}
}
}
| [
"[email protected]"
]
| |
e4e2f2cd6f931d4cd0f682ff5beb9ff0c8d3dd2c | 9d72a9310420e9e5a52e2e0ce78f4a403ba53a3b | /src/com/javarush/test/level10/lesson11/home06/Solution.java | 2ce66aa03a936a3a74292a6ee5802f908878285d | []
| no_license | VladimirPen/rush | 9ef4808480cbf8c576bb86e8da18a8371a4f9930 | f5151f1ef498c078063c199c555046ab561ca499 | refs/heads/master | 2021-01-17T06:53:39.798974 | 2016-08-10T17:44:31 | 2016-08-10T17:44:31 | 45,965,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,770 | java | package com.javarush.test.level10.lesson11.home06;
/* Конструкторы класса Human
Напиши класс Human с 6 полями. Придумай и реализуй 10 различных конструкторов для него. Каждый конструктор должен иметь смысл.
*/
public class Solution
{
public static void main(String[] args)
{
}
public static class Human
{
String firstName;
String middleName;
String lastName;
Integer age;
Integer weight;
Integer height;
public Human(String firstName)
{
this.firstName = firstName;
}
public Human(String firstName, String middleName)
{
this.firstName = firstName;
this.middleName = middleName;
}
public Human(String firstName, String middleName, String lastName)
{
this.firstName = firstName;
this.middleName = middleName;
this.lastName = lastName;
}
public Human(String firstName, String middleName, String lastName, Integer age)
{
this.firstName = firstName;
this.middleName = middleName;
this.lastName = lastName;
this.age = age;
}
public Human(String firstName, String lastName, Integer age)
{
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
public Human(String firstName, Integer age)
{
this.firstName = firstName;
this.age = age;
}
public Human(String firstName, Integer age, Integer height)
{
this.firstName = firstName;
this.age = age;
this.height = height;
}
public Human(String firstName, String lastName, Integer weight, Integer height)
{
this.firstName = firstName;
this.lastName = lastName;
this.weight = weight;
this.height = height;
}
public Human(String firstName, String lastName, Integer age, Integer weight, Integer height)
{
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.weight = weight;
this.height = height;
}
public Human(String firstName, String middleName, String lastName, Integer age, Integer weight, Integer height)
{
this.firstName = firstName;
this.lastName = lastName;
this.middleName = middleName;
this.age = age;
this.weight = weight;
this.height = height;
}
}
}
| [
"[email protected]"
]
| |
8373f091c05696c90e0d63de9c28c860b5bc402a | 9387612be076ce2395f3df4012d64e7cc8f9c7a4 | /src/main/java/com/michalszalkowski/module/book/mapper/BooksTagsMapper.java | afd56c848f051b3c271f4749ea5ab5cf994b84d7 | []
| no_license | MateuszBernacki/posejdon_30 | 6d86038b20014857a244caa99fdc3c1a6d8287e3 | 767a3f413d342b2775464047be343a7c13a858d7 | refs/heads/master | 2023-06-26T16:51:14.350499 | 2021-07-31T18:33:33 | 2021-07-31T18:33:33 | 391,589,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 620 | java | package com.michalszalkowski.module.book.mapper;
import com.michalszalkowski.module.book.entity.BookTagEntity;
import java.util.Set;
import java.util.stream.Collectors;
public class BooksTagsMapper {
public static String map(BookTagEntity tag) {
return tag.getValue();
}
public static Set<String> map(Set<BookTagEntity> tags) {
if (tags == null) {
return Set.of();
}
return tags
.stream()
.map(BooksTagsMapper::map)
.collect(Collectors.toSet());
}
public static String mapAsString(Set<BookTagEntity> tags) {
return map(tags)
.stream()
.collect(Collectors.joining(","));
}
}
| [
"[email protected]"
]
| |
46f7135ee6735737b6eb2ad7c6b6f4c810c99a18 | 64e6edfa4d33d0232bed08278b24290e56cf6461 | /HappyHouse/src/com/ssafy/dao/CoronaClinicDao.java | c12c809ebef1282f9bbb7fa2ca99b3959e96561e | []
| no_license | leeky1535/Projects | b18d6c95326ee6f0e646831a5937c25c129130ba | 2b6a4a300e1b965a0dd1e345e4b80a4f5bf47efe | refs/heads/master | 2022-12-15T01:53:26.789513 | 2021-10-19T05:27:01 | 2021-10-19T05:27:01 | 171,206,150 | 0 | 0 | null | 2022-12-07T21:33:02 | 2019-02-18T03:10:41 | JavaScript | UTF-8 | Java | false | false | 213 | java | package com.ssafy.dao;
import java.util.List;
import com.ssafy.dto.CoronaClinicDto;
public interface CoronaClinicDao {
List<CoronaClinicDto> searchByGugun(String gugun);
List<CoronaClinicDto> searchAll();
}
| [
"[email protected]"
]
| |
c70a28ba948c7877c672a682d0eb200e3d40f382 | 27875ea91d4e5890f341900e1200f6c83812352a | /src/com/neusoft/planewar/client/PlaneWarClient.java | c2673d3e3bd9d01ee3d90cfb33a0992c61c6e14a | []
| no_license | liujianxin123/Mypro | f7f80b7deb64d15317a882a8671a4d29f9acd868 | 8e23c7c633e3f42dfc0debbf55c6e80c9d710736 | refs/heads/master | 2020-09-13T20:24:52.231544 | 2020-05-21T03:01:14 | 2020-05-21T03:01:14 | 222,893,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,767 | java | package com.neusoft.planewar.client;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CopyOnWriteArrayList;
import com.neusoft.planewar.constant.Constant;
import com.neusoft.planewar.core.Background;
import com.neusoft.planewar.core.EnemyPlane;
import com.neusoft.planewar.core.Explode;
import com.neusoft.planewar.core.Item;
import com.neusoft.planewar.core.Missile;
import com.neusoft.planewar.core.MyFrame;
import com.neusoft.planewar.core.Plane;
import com.neusoft.planewar.util.ImageUtil;
import com.neusoft.planewar.util.MusicUtil;
public class PlaneWarClient extends MyFrame {
Point center = new Point((Constant.GAME_WIDTH) / 2, (Constant.GAME_HEIGHT) / 2);
public Plane myPlane = new Plane(this, true);
public List<EnemyPlane> enemyPlanes = new CopyOnWriteArrayList<>();
public Background background = new Background(0, 4, "background_08");
public List<Explode> explodes = new CopyOnWriteArrayList<>();
public List<Missile> missiles = new CopyOnWriteArrayList<>();
public List<Item> items = new CopyOnWriteArrayList<>();
public List<MusicUtil> musics = new CopyOnWriteArrayList<>();
public Random random = new Random();
@Override
public void launchFrame() {
super.launchFrame();
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
myPlane.keyPressed(e);
}
@Override
public void keyReleased(KeyEvent e) {
myPlane.keyReleased(e);
}
});
final PlaneWarClient pwc = this;
new Thread() {
@Override
public void run() {
while (true) {
int r = random.nextInt(7);
EnemyPlane enemyPlane = null;
switch (r) {
case 0://boss
enemyPlane = new EnemyPlane(pwc, 1, 100, 100, false);
enemyPlanes.add(enemyPlane);
try {
Thread.sleep(30000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
break;
case 1:
enemyPlane = new EnemyPlane(pwc, (int) (-400 + 100 * Math.random() * 6), 300, 1, false);
enemyPlanes.add(enemyPlane);
break;
case 2:
enemyPlane = new EnemyPlane(pwc, (int) (50 + 80 * Math.random() * 6), -100, 2, false);
enemyPlanes.add(enemyPlane);
break;
default:
enemyPlane = new EnemyPlane(pwc, 0, 0, r, false);
enemyPlanes.add(enemyPlane);
break;
}
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
new Thread(){
@Override
public void run() {
while(true){
int r = random.nextInt(7)+1;
System.out.println(r);
background=new Background(0, 4, "background_0"+r);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
}.start();
new MusicUtil("bgm").start();
}
final long start = System.currentTimeMillis();
@Override
public void paint(Graphics g) {
background.draw(g);
myPlane.draw(g);
if (!myPlane.live) {
Image img1 = ImageUtil.images.get("fail");
g.drawImage(img1, (Constant.GAME_WIDTH - img1.getWidth(null)) / 2,
(Constant.GAME_HEIGHT - img1.getHeight(null)) / 2, null);
}
for (EnemyPlane enemyPlane : enemyPlanes) {
enemyPlane.draw(g);
}
for (Missile missile : missiles) {
missile.hitPlanes(enemyPlanes);
missile.hitPlane(myPlane);
missile.draw(g);
}
for (Explode explode : explodes) {
explode.draw(g);
}
for (Item item : items) {
item.draw(g);
item.hitMyPlane(myPlane);
}
}
public static void main(String[] args) {
PlaneWarClient c = new PlaneWarClient();
c.launchFrame();
}
}
| [
"[email protected]"
]
| |
9d92a3f142aaafc68775830ba99addfd8f3a57fe | bb7f5dea2da42a9e55443b96f120771c495ac5b2 | /app/src/main/java/ru/smirnov/volleyexample/MyActivity.java | f569108e2fb66466dca24c875d51ea16ec7125c2 | []
| no_license | avsmirnov/VolleyExample | 0d6e03d6fb6fdf5681de6b2ac59e1d4b31672965 | c216e8d46084005c92d7f03787893825eb7e5509 | refs/heads/master | 2016-09-06T02:24:15.495538 | 2014-10-27T19:35:28 | 2014-10-27T19:35:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,373 | java | package ru.smirnov.volleyexample;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import org.json.JSONObject;
public class MyActivity extends Activity {
private static final String TAG = "TAG";
private static String REQUEST_TAG = "LOAD_JSON";
private static final String LOG = "VOLLEY-SAMPLE";
private MenuItem mRefreshMenu;
private TextView mTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_my);
mTextView = (TextView) findViewById(R.id.text1);
JsonObjectRequest request = new JsonObjectRequest(
"http://cblunt.github.io/blog-android-volley/response.json", null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
mTextView.setText(response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mTextView.setText(error.toString());
}
});
request.setTag(REQUEST_TAG);
VolleyApplication.getInstance().getRequestQueue().add(request);
startLoadingAnim();
}
@Override
protected void onStop() {
super.onStop();
if (VolleyApplication.getInstance().getRequestQueue() != null) {
VolleyApplication.getInstance().getRequestQueue().cancelAll(REQUEST_TAG);
}
}
private void startLoadingAnim() {
if (mRefreshMenu != null) {
Log.i(LOG, "===== start loading");
ImageView iv = (ImageView) mRefreshMenu.getActionView();
if (iv != null) {
Animation rotation = AnimationUtils.loadAnimation(this, R.anim.refresh_rotate);
rotation.setRepeatCount(Animation.INFINITE);
iv.startAnimation(rotation);
}
}
}
private void stopLoadingAnim() {
if (mRefreshMenu != null) {
Log.i(LOG, "===== stop loading");
ImageView iv = (ImageView) mRefreshMenu.getActionView();
iv.setImageResource(R.drawable.ic_action_refresh);
iv.clearAnimation();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.my, menu);
mRefreshMenu = menu.findItem(R.id.action_refresh);
ImageView iv = (ImageView) mRefreshMenu.getActionView();
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
iv = (ImageView) inflater.inflate(R.layout.actionbar_refresh, null);
iv.setId(R.id.action_refresh);
iv.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
VolleyApplication.getInstance().getRequestQueue().cancelAll(TAG);
stopLoadingAnim();
startLoadingAnim();
// refreshDatas();
}
});
mRefreshMenu.setActionView(iv);
startLoadingAnim();
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();
return id == R.id.action_refresh || super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
]
| |
041a86a4a3921837aaed20c9d0c99025f957b083 | 7d3c78e020e87ddf828f7cc8c8c50304e84a5888 | /src/main/java/udp/protocol/Message.java | 0c251256b35c46f56ec5dd61c8b37b89199e31e3 | []
| no_license | sscerbatiuc/RaspberryUDPServer | 0a98a80bc5e609dcb673a68bd6c031f4ebc7f54a | 2781561d3b6b361a35a22c819ad4b8083fff0c00 | refs/heads/master | 2021-01-10T03:42:18.557340 | 2016-02-09T09:10:16 | 2016-02-09T09:10:16 | 51,299,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,175 | java | package udp.protocol;
/**
* Encapsulates the information that is being transmitted between client
* and server side.
* @author sscerbatiuc
*/
public class Message {
private boolean isHeartbeat;
private String timeReceived;
private int lightSensorVal;
private int pirSensorVal;
// ---------------- GETTERS & SETTERS --------------------
public void setPirSensorVal(int pirSensorVal) { this.pirSensorVal = pirSensorVal; }
public void setLightSensorVal(int lightSensorVal) { this.lightSensorVal = lightSensorVal; }
public void setTimeReceived(String timeReceived) { this.timeReceived = timeReceived; }
public void setHeartbeat(boolean heartbeat) { isHeartbeat = heartbeat; }
public int getPirSensorVal() { return pirSensorVal; }
public int getLightSensorVal() { return lightSensorVal; }
public String getTimeReceived() { return timeReceived; }
public boolean isHeartbeat() { return isHeartbeat; }
// -------------------------------------------------------
/**
* Default CONSTRUCTOR
*/
public Message(){
}
/**
* CONSTRUCTOR
* @param isHeartbeat boolean - Specifies if it is a control message from Arduino
* @param pirSensorVal boolean - Value indicated by the PIR Sensor can be either 1 (movement present) or 0 (no movement)
* @param lightSensorVal
* @param timeReceived
*/
public Message(boolean isHeartbeat, int pirSensorVal, int lightSensorVal, String timeReceived) {
this.timeReceived = timeReceived;
this.isHeartbeat = isHeartbeat;
this.pirSensorVal = pirSensorVal;
this.lightSensorVal = lightSensorVal;
}
/**
* Returns the textual representation of a message
* @Override
* @return String
*/
public String toString() {
return "Message{" +
"isHeartbeat=" + isHeartbeat +
", timeReceived='" + timeReceived + '\'' +
", lightSensorVal=" + lightSensorVal +
", pirSensorVal=" + pirSensorVal +
'}';
}
/**
* Parses the textual representation of a message received from
* Arduino board into a <code>Message</code> object
* @param data <code>String</code>
* @return <code>Message</code>
*/
public static Message parse(String data){
String[] splitMessage = data.split("[|]");
Message message = new Message();
message.setHeartbeat(false);
for (String info:splitMessage) {
String[] tmp = info.split(" ");
if(tmp[0].toUpperCase().startsWith("P")){
int pirSensorValue = Integer.parseInt(tmp[1]);
message.setPirSensorVal(pirSensorValue);
}
if (tmp[0].toUpperCase().startsWith("L")) {
int lightSensorValue = Integer.parseInt(tmp[1]);
message.setLightSensorVal(lightSensorValue);
}
if (tmp[0].toUpperCase().startsWith("H")) {
int isHeartbeatMessage = Integer.parseInt(tmp[1]);
message.setHeartbeat(true);
}
}
return message;
}
}
| [
"[email protected]"
]
| |
92fa398e17d07951011c8ae092c50ada07ebec5c | 1f87b8c636d9aed1ed25aeb6163e17f42ba39852 | /src/manager/ask/model/service/M_askService.java | 8879c9a5ff2d771c5541b3daf8af1537b3129e18 | []
| no_license | HardCodingMan/FullLife1 | 0176e562e7becdfeb4bfa291778641af9cead01e | 4a469e46fe993a684885bf5670d9e6885cfa1b79 | refs/heads/master | 2023-08-18T06:59:52.668144 | 2021-10-04T00:17:53 | 2021-10-04T00:17:53 | 411,541,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,165 | java | package manager.ask.model.service;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import common.JDBCTemplate;
import manager.ask.model.dao.M_askDAO;
import manager.ask.model.vo.M_ask;
import manager.ask.model.vo.M_askPage;
public class M_askService {
private JDBCTemplate jdbcTemplate;
public M_askService() {
jdbcTemplate = JDBCTemplate.getConnection();
}
public M_askPage printAllAsk(int currentPage) {
Connection conn = null;
M_askPage pd = new M_askPage();
M_askDAO aDao = new M_askDAO();
try {
conn = jdbcTemplate.createConnection();
pd.setaPdList(aDao.selectAllAsk(conn, currentPage));
pd.setPageNavi(aDao.getPageNavi(conn, currentPage));
} catch (SQLException e) {
e.printStackTrace();
}finally {
JDBCTemplate.close(conn);
}
return pd;
}
public M_ask printOneByAsk(int aNo) {
M_ask aOne = null;
Connection conn = null;
try {
conn = jdbcTemplate.createConnection();
aOne = M_askDAO.selectOneByAsk(conn, aNo);
} catch (SQLException e) {
e.printStackTrace();
}finally {
JDBCTemplate.close(conn);
}
return aOne;
}
public int modifyAnswer(M_ask ask) {
int result = 0;
Connection conn = null;
try {
conn = jdbcTemplate.createConnection();
result = new M_askDAO().updateAnswer(conn, ask);
if(result > 0) {
JDBCTemplate.commit(conn);
}else {
JDBCTemplate.rollback(conn);
}
} catch (SQLException e) {
e.printStackTrace();
}finally {
JDBCTemplate.close(conn);
}
return result;
}
public M_askPage printSearchAsk(String searchId, int currentPage) {
Connection conn = null;
List<M_ask> aList = null;
String searchPageNavi = null;
M_askPage pd = new M_askPage();
M_askDAO aDao = new M_askDAO();
try {
conn = jdbcTemplate.createConnection();
aList = aDao.getSearchAsk(conn, searchId, currentPage);
searchPageNavi = aDao.getSearchPageNavi(conn, searchId, currentPage);
pd.setaPdList(aList);
pd.setPageNavi(searchPageNavi);
} catch (SQLException e) {
e.printStackTrace();
}finally {
JDBCTemplate.close(conn);
}
return pd;
}
}
| [
"[email protected]"
]
| |
01bd89c8b74bdd14feeaf8bfb7ae5a169748a07f | 55efec1c96c8d1eaf8bbd70ab84621017c535c72 | /src/main/java/kz/gelleson/findep/domain/JobHistory.java | eddfcbc912b8f15bcf623a88e3d0f15af5f7ae6f | []
| no_license | ghistory/finance | 388fa4a27ea0c7d9d274f72367e9e95c3e7a0636 | c652c5dd4b760f67ee1b86065d8fa7bf0a27cbda | refs/heads/main | 2023-01-14T20:19:01.274980 | 2020-11-23T19:05:09 | 2020-11-23T19:05:09 | 315,405,542 | 0 | 0 | null | 2022-04-13T07:44:25 | 2020-11-23T18:29:40 | Java | UTF-8 | Java | false | false | 3,463 | java | package kz.gelleson.findep.domain;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import kz.gelleson.findep.domain.enumeration.Language;
/**
* A JobHistory.
*/
@Entity
@Table(name = "job_history")
public class JobHistory implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@Column(name = "start_date")
private Instant startDate;
@Column(name = "end_date")
private Instant endDate;
@Enumerated(EnumType.STRING)
@Column(name = "language")
private Language language;
@OneToOne
@JoinColumn(unique = true)
private Job job;
@OneToOne
@JoinColumn(unique = true)
private Department department;
@OneToOne
@JoinColumn(unique = true)
private Employee employee;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Instant getStartDate() {
return startDate;
}
public JobHistory startDate(Instant startDate) {
this.startDate = startDate;
return this;
}
public void setStartDate(Instant startDate) {
this.startDate = startDate;
}
public Instant getEndDate() {
return endDate;
}
public JobHistory endDate(Instant endDate) {
this.endDate = endDate;
return this;
}
public void setEndDate(Instant endDate) {
this.endDate = endDate;
}
public Language getLanguage() {
return language;
}
public JobHistory language(Language language) {
this.language = language;
return this;
}
public void setLanguage(Language language) {
this.language = language;
}
public Job getJob() {
return job;
}
public JobHistory job(Job job) {
this.job = job;
return this;
}
public void setJob(Job job) {
this.job = job;
}
public Department getDepartment() {
return department;
}
public JobHistory department(Department department) {
this.department = department;
return this;
}
public void setDepartment(Department department) {
this.department = department;
}
public Employee getEmployee() {
return employee;
}
public JobHistory employee(Employee employee) {
this.employee = employee;
return this;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof JobHistory)) {
return false;
}
return id != null && id.equals(((JobHistory) o).id);
}
@Override
public int hashCode() {
return 31;
}
// prettier-ignore
@Override
public String toString() {
return "JobHistory{" +
"id=" + getId() +
", startDate='" + getStartDate() + "'" +
", endDate='" + getEndDate() + "'" +
", language='" + getLanguage() + "'" +
"}";
}
}
| [
"[email protected]"
]
| |
729447866aeb83cb3e56241f52ba934000b047b2 | 962ce628a6171a53d654af0ba65abb02ed960dc3 | /src/main/java/com/fadli/demo/base/enums/YesNo.java | f1a98e94076ebff90e74f702f759c49f73c626fd | []
| no_license | fadlimz/demo | c5563191de2bd4e49ce173fd2fd10a33596907e3 | 75cac6536d1b24cb01d8b7dcc94db3911f1f6d58 | refs/heads/master | 2022-07-28T01:48:07.386198 | 2019-12-21T08:09:42 | 2019-12-21T08:09:42 | 226,498,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 71 | java | package com.fadli.demo.base.enums;
public enum YesNo {
Yes, No;
}
| [
"[email protected]"
]
| |
8f7d98d7aef2a7f88819070a4a102c99d8e83d5c | 2e5f79b26374570477e613ffa92dde28e4ec53f8 | /Hospital_Management_system/src/hospital_management_system/appointment.java | 296eabcc8e450c052fded9737e5886c4f7dbca89 | []
| no_license | Baig-Amin/java-Varsity-Projects | 24af9a554961a0f67adbd4855c68ee8f76eb5024 | c144ce808519020110cabe198108692df7a5214a | refs/heads/master | 2023-08-22T22:26:56.061302 | 2021-10-12T15:22:17 | 2021-10-12T15:22:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,567 | 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 hospital_management_system;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.IOException;
import java.io.RandomAccessFile;
import javax.swing.JOptionPane;
/**
*
* @author JOHN
*/
public class appointment extends javax.swing.JFrame {
/**
* Creates new form appointment
*/
public appointment() {
initComponents();
Toolkit toolkit = getToolkit();
Dimension size = toolkit.getScreenSize();
setLocation(size.width / 2 - getWidth() / 2, size.height / 2 - getHeight() / 2);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
jComboBox2 = new javax.swing.JComboBox<>();
jCheckBox1 = new javax.swing.JCheckBox();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jCheckBox2 = new javax.swing.JCheckBox();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel2 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("Request an Appointment");
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel3.setText("Your name:");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel4.setText("Phone number:");
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel5.setText("Age:");
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel6.setText("Gender:");
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel7.setText("Date:");
jLabel8.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel8.setText("Doctor:");
jLabel9.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel9.setText("Visitor:");
jTextField1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
jTextField2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField2ActionPerformed(evt);
}
});
jTextField3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3ActionPerformed(evt);
}
});
jTextField5.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jTextField5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField5ActionPerformed(evt);
}
});
jRadioButton1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jRadioButton1.setText("Male");
jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton1ActionPerformed(evt);
}
});
jRadioButton2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jRadioButton2.setText("Female");
jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jRadioButton2ActionPerformed(evt);
}
});
jComboBox2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "List", "Dr. A", "Dr. B", "Dr. C", "Dr. D", "Dr. E" }));
jComboBox2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox2ActionPerformed(evt);
}
});
jCheckBox1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jCheckBox1.setText("New");
jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt);
}
});
jButton1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jButton1.setText("Clear");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jButton2.setText("Back");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jButton3.setText("Logout");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jButton4.setText("Confirm");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jCheckBox2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jCheckBox2.setText("Old");
jCheckBox2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox2ActionPerformed(evt);
}
});
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE)
);
jTabbedPane1.addTab("Slip", jPanel2);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 700, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jRadioButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButton2))
.addComponent(jTextField3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCheckBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(15, 15, 15)))))
.addGap(51, 51, 51)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(15, 15, 15)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jRadioButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jRadioButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(85, 85, 85)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCheckBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
jTextField1.getText();
}//GEN-LAST:event_jTextField1ActionPerformed
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed
jTextField2.getText();
}//GEN-LAST:event_jTextField2ActionPerformed
private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed
jTextField3.getText();
}//GEN-LAST:event_jTextField3ActionPerformed
private void jTextField5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField5ActionPerformed
jTextField5.getText();
}//GEN-LAST:event_jTextField5ActionPerformed
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
if(jRadioButton1.isSelected())
{
jRadioButton2.setSelected(false);
}
}//GEN-LAST:event_jRadioButton1ActionPerformed
private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed
if(jRadioButton2.isSelected())
{
jRadioButton1.setSelected(false);
}
}//GEN-LAST:event_jRadioButton2ActionPerformed
private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed
String d = (String) jComboBox2.getSelectedItem();
JOptionPane.showMessageDialog(null,"You have selected: " + d);
}//GEN-LAST:event_jComboBox2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
login a = new login();
a.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
mainpage a = new mainpage();
a.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
jTextField1.setText(null);
jTextField2.setText(null);
jTextField3.setText(null);
jTextField5.setText(null);
jRadioButton1.setSelected(false);
jRadioButton2.setSelected(false);
jCheckBox1.setSelected(false);
jCheckBox1.setSelected(false);
jCheckBox2.setSelected(false);
jTextArea1.setText(null);
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
String doctor = "Appoint info: "+ " "+"Name: " +jTextField1.getText()+" "+"Phone: "+jTextField2.getText()+" "+"Age: "+jTextField3.getText()+" "+"Date: "+jTextField5.getText();
byte [] dr = doctor.getBytes();
if(jComboBox2.getSelectedItem().equals("Dr. A")){
try{
RandomAccessFile raf = new RandomAccessFile("Dr. A.txt","rw");
raf.write(dr);
}catch(IOException ex){
ex.printStackTrace();
}
}
if(jComboBox2.getSelectedItem().equals("Dr. B")){
try{
RandomAccessFile raf = new RandomAccessFile("Dr. B.txt","rw");
raf.write(dr);
}catch(IOException ex){
ex.printStackTrace();
}
}
if(jComboBox2.getSelectedItem().equals("Dr. C")){
try{
RandomAccessFile raf = new RandomAccessFile("Dr. C.txt","rw");
raf.write(dr);
}catch(IOException ex){
ex.printStackTrace();
}
}
if(jComboBox2.getSelectedItem().equals("Dr. D")){
try{
RandomAccessFile raf = new RandomAccessFile("Dr. D.txt","rw");
raf.write(dr);
}catch(IOException ex){
ex.printStackTrace();
}
}
if(jComboBox2.getSelectedItem().equals("Dr. E")){
try{
RandomAccessFile raf = new RandomAccessFile("Dr. E.txt","rw");
raf.write(dr);
}catch(IOException ex){
ex.printStackTrace();
}
}
}//GEN-LAST:event_jButton4ActionPerformed
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
if (jCheckBox1.isSelected())
{
jCheckBox2.setSelected(false);
if(jRadioButton1.isSelected()){
String a= jTextField1.getText();
String b= jTextField2.getText();
String c= jTextField3.getText();
String d= jTextField5.getText();
String e= "Male";
String f= "Patient is new.";
jTextArea1.append("\tGeneral info:\n\n" + "Patient name:\t"
+a+" "+ "\nPhone number:\t" +
b+" "+"\nAge:\t" +
c+ " "+"\nGender:\t"+
e+" "+"\nAppointment Date:"+
d+" "+"\nVisitor:\t" +
f+ " "+ "\n\n\tThank You\n");
}
}
}//GEN-LAST:event_jCheckBox1ActionPerformed
private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox2ActionPerformed
if (jCheckBox2.isSelected())
{
jCheckBox1.setSelected(false);
if(jRadioButton1.isSelected()){
String a= jTextField1.getText();
String b= jTextField2.getText();
String c= jTextField3.getText();
String d= jTextField5.getText();
String e= "Male";
String f= "Patient is new.";
jTextArea1.append("\tGeneral info:\n\n" + "Patent name:\t"
+a+" "+ "\nPhone number:\t" +
b+" "+"\nAge:\t\t" +
c+ " "+"\nGender:\t\t"+
e+" "+"\nAppointment Date:\t"+
d+" "+"\nVisitor:" +
f+ " "+ "\n\n\tThank You\n");
}
}
}//GEN-LAST:event_jCheckBox2ActionPerformed
/**
* @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(appointment.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(appointment.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(appointment.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(appointment.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new appointment().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JComboBox<String> jComboBox2;
private javax.swing.JLabel jLabel1;
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 jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField5;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
c625f00420a18e6565eb2b351e6b10ccc1260604 | 8eac2be3fa4b6290a46718a7caec0eade93a0c6c | /src/main/java/model/items/weapons/Sword.java | 15a4c67bdd04c8f982a73b92da19052ce6a9360c | []
| no_license | Menober/karak | 7c1d0183d679c13eebd838b7c701897d6dedf670 | 40e3c56a1d093561904a4a00e8e407849c409c67 | refs/heads/master | 2021-02-08T15:28:54.778946 | 2020-03-10T01:53:19 | 2020-03-10T01:53:19 | 244,166,706 | 0 | 0 | null | 2020-10-13T20:07:58 | 2020-03-01T14:45:23 | Java | UTF-8 | Java | false | false | 121 | java | package model.items.weapons;
public class Sword extends Weapon {
public Sword(int damage) {
super(damage);
}
}
| [
"[email protected]"
]
| |
39f31470713f6b3e4bb31e73c61a58183d58c620 | 31d3ca458faba740e5dc560ab106cc814aebdd24 | /statistics-server-application/src/test/java/uk/co/bssd/statistics/server/application/timingpoint/InMemoryStatisticsServerFacadeTest.java | 08fa321708eca7fd80d654ea75991ee5c3c50ade | []
| no_license | bssd/statistics-server | e3097e61feb05e738e1849c8ce695a3737b636dc | 96a3e4c10f665d477ddb122277ac6c6293c0462e | refs/heads/master | 2021-01-13T02:14:22.754170 | 2012-05-14T19:39:28 | 2012-05-14T19:39:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,732 | java | package uk.co.bssd.statistics.server.application.timingpoint;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import uk.co.bssd.statistics.server.api.dto.StartTimingPointMessage;
import uk.co.bssd.statistics.server.api.dto.StopTimingPointMessage;
import uk.co.bssd.statistics.server.application.service.InMemoryStatisticsServerFacade;
import uk.co.bssd.statistics.server.application.service.StatisticsServerFacade;
@RunWith(MockitoJUnitRunner.class)
public class InMemoryStatisticsServerFacadeTest {
private static final UUID ID = UUID.randomUUID();
private static final String NAME = "timing_point";
private static final long START_TIME = 34;
private static final long END_TIME = 67;
private static final StartTimingPointMessage START_REQUEST = new StartTimingPointMessage(ID, NAME, START_TIME);
private static final StopTimingPointMessage STOP_REQUEST = new StopTimingPointMessage(ID, NAME, END_TIME);
private static final StopTimingPointMessage STOP_REQUEST_WITH_DIFFERENT_ID = new StopTimingPointMessage(UUID.randomUUID(), NAME, END_TIME);
private StatisticsServerFacade facade;
@Mock
private TimingPointsCollector mockTimingPointsCollector;
@Before
public void before() {
this.facade = new InMemoryStatisticsServerFacade(
this.mockTimingPointsCollector);
}
@Test
public void testStartingTimingPointDoesNotResultInTimingPointBeingCollected() {
this.facade.startTimingPoint(START_REQUEST);
assertNoTimingPointCollected();
}
@Test
public void testStoppingTimingPointThatWasNotStartedDoesNotResultInTimingPointBeingCollected() {
this.facade.stopTimingPoint(STOP_REQUEST);
assertNoTimingPointCollected();
}
@Test
public void testStoppingTimingPointThatWasStartedResultsInTimingPointBeingCollected() {
this.facade.startTimingPoint(START_REQUEST);
this.facade.stopTimingPoint(STOP_REQUEST);
assertTimingPointCollected();
}
@Test
public void testStoppingTimingPointWithSameNameButDifferentIdToThatStartedDoesNotResultInTimingPointBeingCollected() {
this.facade.startTimingPoint(START_REQUEST);
this.facade.stopTimingPoint(STOP_REQUEST_WITH_DIFFERENT_ID);
assertNoTimingPointCollected();
}
private void assertTimingPointCollected() {
verify(this.mockTimingPointsCollector, times(1)).addTimingPoint(any(TimingPoint.class));
}
private void assertNoTimingPointCollected() {
verify(this.mockTimingPointsCollector, never()).addTimingPoint(any(TimingPoint.class));
}
} | [
"[email protected]"
]
| |
fcb34a479b757cc57cd5f590f72ce54f58366842 | 48c0119e3e7cb8b655e6f418280ddb022e4e9595 | /13SpringProxyBased-PointcutAndAdvisor/src/main/java/DemoBean.java | 0903f064c2bcb49fdf9b60955da6170720c7a5d8 | []
| no_license | SadaLearningHub1/Spring-Projects | a2c237047f88ea115bf14a25772467e92a090597 | aa5749ad6c349542f2bad9efc838d8d687458b8f | refs/heads/master | 2023-03-09T16:09:30.345666 | 2022-07-25T15:19:33 | 2022-07-25T15:19:33 | 149,118,251 | 0 | 0 | null | 2023-03-01T05:34:36 | 2018-09-17T11:58:09 | Java | UTF-8 | Java | false | false | 411 | java |
public class DemoBean implements Demo{
@Override
public void sayHello() {
System.out.println("I am from say Hello");
}
@Override
public void sayBye() {
System.out.println("I am from Say Bye");
}
@Override
public String getMesssage() {
System.out.println("I am from get message");
return null;
}
@Override
public void welcome() {
System.out.println("I am from welcome");
}
}
| [
"[email protected]"
]
| |
f3eecd43fb7a487347b2e5853ddd00ba1f0da3ce | 2448d6c8338ea5328aa44da6ca27cb54d37a2196 | /broadleaf-profile/src/main/java/org/broadleafcommerce/profile/core/domain/PhoneImpl.java | 201017e8bc12ebe3e07eb9d0f2422b0d261493fb | []
| no_license | RDeztroyer/StartUP-master | 8077240074816a3535eac309a009d9d0d5e36df6 | 5262bbd0a5225529a38e5a68eb651177b029050c | refs/heads/master | 2023-03-05T20:08:52.418953 | 2013-07-06T17:44:38 | 2013-07-06T17:44:38 | 338,304,002 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,934 | java | /*
* Copyright 2008-2012 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.broadleafcommerce.profile.core.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import org.broadleafcommerce.common.presentation.AdminPresentation;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "BLC_PHONE")
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region="blOrderElements")
public class PhoneImpl implements Phone {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "PhoneId", strategy = GenerationType.TABLE)
@TableGenerator(name = "PhoneId", table = "SEQUENCE_GENERATOR", pkColumnName = "ID_NAME", valueColumnName = "ID_VAL", pkColumnValue = "PhoneImpl", allocationSize = 50)
@Column(name = "PHONE_ID")
protected Long id;
@Column(name = "PHONE_NUMBER", nullable=false)
@AdminPresentation(friendlyName = "PhoneImpl_Phone_Number", order=1, group = "PhoneImpl_Phone")
protected String phoneNumber;
@Column(name = "IS_DEFAULT")
@AdminPresentation(friendlyName = "PhoneImpl_Default_Phone", order=2, group = "PhoneImpl_Phone")
protected boolean isDefault = false;
@Column(name = "IS_ACTIVE")
@AdminPresentation(friendlyName = "PhoneImpl_Active_Phone", order=3, group = "PhoneImpl_Phone")
protected boolean isActive = true;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public boolean isDefault() {
return isDefault;
}
public void setDefault(boolean isDefault) {
this.isDefault = isDefault;
}
public boolean isActive() {
return isActive;
}
public void setActive(boolean isActive) {
this.isActive = isActive;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (isActive ? 1231 : 1237);
result = prime * result + (isDefault ? 1231 : 1237);
result = prime * result + ((phoneNumber == null) ? 0 : phoneNumber.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PhoneImpl other = (PhoneImpl) obj;
if (id != null && other.id != null) {
return id.equals(other.id);
}
if (isActive != other.isActive)
return false;
if (isDefault != other.isDefault)
return false;
if (phoneNumber == null) {
if (other.phoneNumber != null)
return false;
} else if (!phoneNumber.equals(other.phoneNumber))
return false;
return true;
}
}
| [
"[email protected]"
]
| |
3b57c57bc81f31dc8c643a062c19c8dfbdc83b19 | 85a48a7cf2e9837ca044cf543a3bd9ce54a04149 | /siga-auth/src/main/java/ee.openeid.siga.auth/service/SigaUserDetailsService.java | 10bd150dd572c39b2a19378a13a8adbc56ae5349 | []
| no_license | mohbadar/SiGa | 6518f25f4cd5be029e7e6e1e29f437d1dec981ab | b72ec463261d35682f89578d46acee6606994a3a | refs/heads/master | 2022-02-15T11:20:16.208297 | 2019-06-18T13:52:32 | 2019-06-18T13:52:32 | 198,023,859 | 2 | 0 | null | 2019-07-21T07:00:31 | 2019-07-21T07:00:31 | null | UTF-8 | Java | false | false | 1,491 | java | package ee.openeid.siga.auth.service;
import ee.openeid.siga.auth.model.SigaService;
import ee.openeid.siga.auth.repository.ServiceRepository;
import ee.openeid.siga.common.auth.SigaUserDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Service
@CacheConfig
public class SigaUserDetailsService implements UserDetailsService {
@Autowired
private ServiceRepository serviceRepository;
@Cacheable(cacheNames = {"SIGA-AUTH-SERVICES"})
@Override
public SigaUserDetails loadUserByUsername(String serviceUuid) throws UsernameNotFoundException {
SigaService service = serviceRepository.findByUuid(serviceUuid)
.orElseThrow(() -> new UsernameNotFoundException("SigaService UUID not found"));
return SigaUserDetails.builder()
.clientName(service.getClient().getName())
.serviceName(service.getName())
.serviceUuid(service.getUuid())
.signingSecret(service.getSigningSecret())
.skRelyingPartyName(service.getSkRelyingPartyName())
.skRelyingPartyUuid(service.getSkRelyingPartyUuid())
.build();
}
}
| [
"[email protected]"
]
| |
99c815bcef2996b2630231856260ffc6e0263c80 | 6efbc71f95e7b7ccb71e6872e33fc5482ae53844 | /backend/src/main/java/com/devsuperior/dscatalog/resources/UserResource.java | e8e65f177b74e261fc46f615f666ad16bd1e1bab | []
| no_license | analudias/dscatalog-bootcamp-devsuperior | ae75aa9e97957451e0eb56f7ed00aab9f51b6515 | c476ed6d1c5af88f2b34083594ceab0bda236af0 | refs/heads/main | 2023-05-13T12:50:22.913941 | 2021-06-08T02:01:34 | 2021-06-08T02:01:34 | 299,414,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,957 | java | package com.devsuperior.dscatalog.resources;
import java.net.URI;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import com.devsuperior.dscatalog.dto.UserDTO;
import com.devsuperior.dscatalog.dto.UserInsertDTO;
import com.devsuperior.dscatalog.dto.UserUpdateDTO;
import com.devsuperior.dscatalog.services.UserService;
@RestController
@RequestMapping(value = "/users")
public class UserResource {
@Autowired
private UserService service;
@GetMapping //para indicar que é um endpoint do recurso category
public ResponseEntity<Page<UserDTO>> findAll(
@RequestParam(value = "page", defaultValue = "0") Integer page,
@RequestParam(value = "linesPerPage", defaultValue = "12") Integer linesPerPage,
@RequestParam(value = "direction", defaultValue = "ASC") String direction,
@RequestParam(value = "orderBy", defaultValue = "firstName") String orderBy
) {
PageRequest pageRequest = PageRequest.of(page, linesPerPage, Direction.valueOf(direction), orderBy);
Page<UserDTO> list = service.findAllPaged(pageRequest);
return ResponseEntity.ok().body(list);
}
@GetMapping(value = "/{id}")
public ResponseEntity<UserDTO> findById(@PathVariable Long id) {
UserDTO dto = service.findById(id);
return ResponseEntity.ok().body(dto);
}
@PostMapping
public ResponseEntity<UserDTO> insert(@Valid @RequestBody UserInsertDTO dto) {
UserDTO newDto = service.insert(dto); // o retorno do service é do tipo UserDTO, por isso precisamos instanciar um UserDTO
URI uri = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}")
.buildAndExpand(newDto.getId()).toUri();
return ResponseEntity.created(uri).body(newDto);
}
//não idempotente
@PutMapping(value = "/{id}")
public ResponseEntity<UserDTO> update(@PathVariable Long id, @Valid @RequestBody UserUpdateDTO dto) {
UserDTO newDto = service.update(id, dto);
return ResponseEntity.ok().body(newDto);
}
@DeleteMapping(value = "/{id}")
public ResponseEntity<UserDTO> delete(@PathVariable Long id) {
service.delete(id);
return ResponseEntity.noContent().build();
}
}
| [
"[email protected]"
]
| |
67827df3bb74e5707835c52d5c4ceda3642b00eb | 206a0d99b9ec198a5be332db60c5f56732b086ce | /client-java-contrib/prometheus-operator/src/main/java/com/coreos/monitoring/models/V1ServiceMonitorSpecSelectorMatchExpressions.java | cbf9529b997a64e47e6926b607a4f79f4b0be325 | [
"Apache-2.0"
]
| permissive | kubernetes-client/java | 53224cebd84a6d9affa4ee8c85044fc7022ce027 | 3315948d8f25f4b59ee8bcbefed2aca17c3e5c3c | refs/heads/master | 2023-08-31T06:57:47.952345 | 2023-08-30T16:40:47 | 2023-08-30T16:40:47 | 90,675,730 | 3,326 | 2,000 | Apache-2.0 | 2023-09-14T18:43:13 | 2017-05-08T21:52:58 | Java | UTF-8 | Java | false | false | 5,283 | java | /*
Copyright 2020 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.coreos.monitoring.models;
import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* A label selector requirement is a selector that contains values, a key, and an operator that
* relates the key and values.
*/
@ApiModel(
description =
"A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.")
@javax.annotation.Generated(
value = "org.openapitools.codegen.languages.JavaClientCodegen",
date = "2020-08-31T19:41:55.826Z[Etc/UTC]")
public class V1ServiceMonitorSpecSelectorMatchExpressions {
public static final String SERIALIZED_NAME_KEY = "key";
@SerializedName(SERIALIZED_NAME_KEY)
private String key;
public static final String SERIALIZED_NAME_OPERATOR = "operator";
@SerializedName(SERIALIZED_NAME_OPERATOR)
private String operator;
public static final String SERIALIZED_NAME_VALUES = "values";
@SerializedName(SERIALIZED_NAME_VALUES)
private List<String> values = null;
public V1ServiceMonitorSpecSelectorMatchExpressions key(String key) {
this.key = key;
return this;
}
/**
* key is the label key that the selector applies to.
*
* @return key
*/
@ApiModelProperty(required = true, value = "key is the label key that the selector applies to.")
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public V1ServiceMonitorSpecSelectorMatchExpressions operator(String operator) {
this.operator = operator;
return this;
}
/**
* operator represents a key's relationship to a set of values. Valid operators are In, NotIn,
* Exists and DoesNotExist.
*
* @return operator
*/
@ApiModelProperty(
required = true,
value =
"operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.")
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public V1ServiceMonitorSpecSelectorMatchExpressions values(List<String> values) {
this.values = values;
return this;
}
public V1ServiceMonitorSpecSelectorMatchExpressions addValuesItem(String valuesItem) {
if (this.values == null) {
this.values = new ArrayList<String>();
}
this.values.add(valuesItem);
return this;
}
/**
* values is an array of string values. If the operator is In or NotIn, the values array must be
* non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This
* array is replaced during a strategic merge patch.
*
* @return values
*/
@javax.annotation.Nullable
@ApiModelProperty(
value =
"values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.")
public List<String> getValues() {
return values;
}
public void setValues(List<String> values) {
this.values = values;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V1ServiceMonitorSpecSelectorMatchExpressions v1ServiceMonitorSpecSelectorMatchExpressions =
(V1ServiceMonitorSpecSelectorMatchExpressions) o;
return Objects.equals(this.key, v1ServiceMonitorSpecSelectorMatchExpressions.key)
&& Objects.equals(this.operator, v1ServiceMonitorSpecSelectorMatchExpressions.operator)
&& Objects.equals(this.values, v1ServiceMonitorSpecSelectorMatchExpressions.values);
}
@Override
public int hashCode() {
return Objects.hash(key, operator, values);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class V1ServiceMonitorSpecSelectorMatchExpressions {\n");
sb.append(" key: ").append(toIndentedString(key)).append("\n");
sb.append(" operator: ").append(toIndentedString(operator)).append("\n");
sb.append(" values: ").append(toIndentedString(values)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
]
| |
b272ebb133d2766d213b85143fcf7516bfb73e49 | 8f92731c0121d4ef68ef10250f099e28c28975fa | /src/main/java/com/example/springkafka/dto/PlayersDTO.java | 40925ab3d637908bb7e0690573dc94e7f5f81539 | []
| no_license | seupedro/spring-kafka | 14b389a26f9304b47f61fdbfbc424c9869ae3985 | e2e43917d3e75678f928e5f4cb6e4cd1a9058793 | refs/heads/main | 2023-06-23T12:38:38.058842 | 2021-07-29T19:14:06 | 2021-07-29T19:14:06 | 390,824,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | package com.example.springkafka.dto;
import lombok.Data;
import java.util.List;
@Data
public class PlayersDTO {
List<PlayerDTO> players;
}
| [
"[email protected]"
]
| |
33a7320f8a819a991c8d3fe3750e607762a4fc55 | b81192dc36a269eafacc07022f502d6a33d8f389 | /MultiLanSupport/app/src/main/java/com/example/asif/multilansupport/MainActivity.java | 40a85d97d07e4724a97847e5b71750e2c7c7a286 | []
| no_license | asifkuet41/Udacity-Android | 1240dd3bad82ce5bc520d63e8d6fa72296abb890 | 9e3101c4cec06b21c19cca8fa234ced28d6f57c7 | refs/heads/master | 2020-03-19T01:33:17.872839 | 2018-10-13T08:30:48 | 2018-10-13T08:30:48 | 135,553,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,886 | java | package com.example.asif.multilansupport;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.views.MapView;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static com.example.asif.multilansupport.Helper.loadLocale;
public class MainActivity extends AppCompatActivity {
MapView map;
int value;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// map = (MapView) findViewById(R.id.map);
// map.setTileSource(TileSourceFactory.MAPNIK);
Button button = findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showChangeLanguageDialog();
}
});
}
private void showChangeLanguageDialog(){
final String[]items = {"Bangla","Hindi","English"};
List<Integer>mSelectedItems = new ArrayList<>();
AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this);
mBuilder.setTitle("Select your language");
mBuilder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
value = which;
}
}).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(MainActivity.this,"value"+value,Toast.LENGTH_SHORT).show();
recreate();
}
});
// mBuilder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// if(which == 0){
// Helper.setLocale("bn",MainActivity.this);
// recreate();
// }
//
// else if(which == 1){
// Helper.setLocale("hi",MainActivity.this);
// recreate();
// }
// else{
// Helper.setLocale("en",MainActivity.this);
// recreate();
// }
//
// dialog.dismiss();
// }
// });
AlertDialog dialog = mBuilder.create();
dialog.show();
}
}
| [
"[email protected]"
]
| |
6cbe271b4c2d53acb724b06a3bdff60e1230bf53 | 13e443a64c99bf0028db2eb27224eb6406f6c1c2 | /src/main/java/net/minecraft/client/renderer/entity/layers/IronGolenFlowerLayer.java | c97e93e5b227d0a5270a077eac8883e9ffc59846 | []
| no_license | NicholasBlackburn1/Robo_Hacker | 5a779679d643250676c1c075d6697b10e8a7a9c5 | 02506e742d30df6a255ba63b240773a08c40bd74 | refs/heads/main | 2023-06-19T14:37:19.499548 | 2021-05-10T15:08:28 | 2021-05-10T15:08:28 | 353,691,155 | 2 | 2 | null | 2021-04-02T14:16:50 | 2021-04-01T12:23:15 | Java | UTF-8 | Java | false | false | 1,927 | java | package net.minecraft.client.renderer.entity.layers;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.entity.IEntityRenderer;
import net.minecraft.client.renderer.entity.model.IronGolemModel;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.entity.passive.IronGolemEntity;
import net.minecraft.util.math.vector.Vector3f;
public class IronGolenFlowerLayer extends LayerRenderer<IronGolemEntity, IronGolemModel<IronGolemEntity>>
{
public IronGolenFlowerLayer(IEntityRenderer<IronGolemEntity, IronGolemModel<IronGolemEntity>> p_i50935_1_)
{
super(p_i50935_1_);
}
public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, IronGolemEntity entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch)
{
if (entitylivingbaseIn.getHoldRoseTick() != 0)
{
matrixStackIn.push();
ModelRenderer modelrenderer = this.getEntityModel().getArmHoldingRose();
modelrenderer.translateRotate(matrixStackIn);
matrixStackIn.translate(-1.1875D, 1.0625D, -0.9375D);
matrixStackIn.translate(0.5D, 0.5D, 0.5D);
float f = 0.5F;
matrixStackIn.scale(0.5F, 0.5F, 0.5F);
matrixStackIn.rotate(Vector3f.XP.rotationDegrees(-90.0F));
matrixStackIn.translate(-0.5D, -0.5D, -0.5D);
Minecraft.getInstance().getBlockRendererDispatcher().renderBlock(Blocks.POPPY.getDefaultState(), matrixStackIn, bufferIn, packedLightIn, OverlayTexture.NO_OVERLAY);
matrixStackIn.pop();
}
}
}
| [
"[email protected]"
]
| |
fa2804186593637e793dd2f15d41d79d61c84a5c | 7205e0a2cf43bfbece0e474fae2cd31568212e33 | /Bank/src/Person/Person.java | 881cb98130e2effc43deca19fb7812de3fd06588 | []
| no_license | AKokoshyan/JavaT | 89c242439ef597f6ceca3b391af4ef141e5cf319 | 4b7e27109bbbd81eaeaebe27896a89b5e4bc981a | refs/heads/master | 2021-06-22T20:56:35.076807 | 2017-08-17T21:04:13 | 2017-08-17T21:04:13 | 100,280,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 497 | java | package Person;
import java.util.ArrayList;
import BankProdukt.BankProduct;
import BankProdukt.Credit;
import BankProdukt.Deposit;
public abstract class Person {
protected String name;
protected String address;
protected double money;
protected ArrayList<BankProduct> products = new ArrayList<BankProduct>();
//Constructors
public Person(String name, String address, double money) {
this.name = name;
this.address = address;
this.money = money;
}
//Getters and setters
}
| [
"[email protected]"
]
| |
bf73881a3706be101f670dd35a7b680dc30230b0 | bdac41272bf511729e88be451e2e4c768c86bf82 | /src/main/java/eda/club/demo/DemoApplication.java | a7ec16f4fea49f180dfcd7efc8fa9e2543ef8f86 | []
| no_license | lok-pivotal/club-jms-sample | 3db59f6804811b6061ae517038db88d4d35af2e7 | f0812c17bdf6b3f84aa55e994f9ead121cf71f52 | refs/heads/master | 2022-12-30T04:57:47.177784 | 2020-10-20T06:13:27 | 2020-10-20T06:13:27 | 305,584,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package eda.club.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.config.JmsListenerContainerFactory;
import org.springframework.jms.support.destination.DynamicDestinationResolver;
import org.springframework.scheduling.annotation.EnableScheduling;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Session;
@EnableJms
@EnableScheduling
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"[email protected]"
]
| |
713c8cd83bf803ba95265664dae1ce1c8cacc8da | a175af8819a77d7865795fb05f91312628babe67 | /StatsAPI/src/de/sinixspielt/statsapi/database/AsyncHandler.java | 0cb168e8b5c30c93e3d526deb2fbc3d25a3dc0ad | [
"MIT"
]
| permissive | SinixSpielt/StatsAPI | f4ce0b5e2ae5bf82aef10fdf30f15e3dbdf5baca | d5a94f09dfc511405ba947559dd7dd6dcde32428 | refs/heads/master | 2020-04-28T19:36:44.699113 | 2019-03-14T00:05:21 | 2019-03-14T00:05:21 | 173,104,902 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,168 | java | package de.sinixspielt.statsapi.database;
/*
Class created on 28.02.2019 by SinixSpielt
* */
import java.sql.ResultSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.mysql.jdbc.PreparedStatement;
import de.sinixspielt.statsapi.StatsAPI;
public class AsyncHandler {
private ExecutorService executor;
public AsyncHandler() {
this.executor = Executors.newCachedThreadPool();
}
public ExecutorService getExecutor() {
return this.executor;
}
public void update(final String statement) {
this.executor.execute(new Runnable() {
public void run() {
StatsAPI.getSqlManager().executeUpdate(statement);
}
});
}
public void update(final PreparedStatement statement) {
this.executor.execute(new Runnable() {
public void run() {
StatsAPI.getSqlManager().executeUpdate(statement);
}
});
}
public void query(final PreparedStatement statement, final Callback<ResultSet> callback) {
this.executor.execute(new Runnable() {
public void run() {
callback.accept(StatsAPI.getSqlManager().executeQuery(statement));
}
});
}
} | [
"[email protected]"
]
| |
18fd66e252f85077c46bcceb70edb7aff0e9486d | c4fa27ba4504b4d14b006a3bc6cc16bf773bd1f2 | /serdao/src/main/java/com/sd/service/UserDetailsServiceInt.java | 77f5d5587428484e010bdea70b507fe499b30383 | []
| no_license | Ketana26/Handicrafts | b32754b4ba27f32a82e0a520fcc2a659dfa7f815 | 9d3f4a970ec787e9fd351f8d97101f842beaef48 | refs/heads/master | 2021-01-21T22:44:59.932970 | 2017-09-02T05:26:04 | 2017-09-02T05:26:04 | 102,172,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package com.sd.service;
import org.springframework.beans.factory.annotation.Autowired;
import com.sd.model.UserDetails;
public interface UserDetailsServiceInt {
@Autowired
String addUser(UserDetails ud);
}
| [
"katana@LAPTOP-RMDK2EEM"
]
| katana@LAPTOP-RMDK2EEM |
be8527c1ade6f1e1259e2dfa5159426b2271c3bf | 37a6b36ce058595939d2a20f052cd723e5018a94 | /TodoWatch/src/main/java/com/daxthompsontodoassignment2/watchapp/MainActivity.java | fc27fe6d9a1c580d9c3c57a7115dce4f7ac2486c | []
| no_license | daxinator22/cs3200-dax-thompson-hw2 | 115057d658022465798cc80d5944f24cfc2fcc9a | 005634b6623b66528cdecbc209b3e7bba1a4a56d | refs/heads/main | 2023-03-11T11:16:18.600371 | 2021-02-27T02:26:06 | 2021-02-27T02:26:06 | 341,777,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,227 | java | package com.daxthompsontodoassignment2.watchapp;
import android.os.Bundle;
import android.util.Log;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.lifecycle.ViewModelProvider;
import com.daxthompsontodoassignment2.api.CountViewModel;
import com.daxthompsontodoassignment2.api.TodoItem;
public class MainActivity extends AppCompatActivity {
private CountViewModel viewModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.viewModel = new ViewModelProvider(this).get(CountViewModel.class);
viewModel.getData().observe(this, (todoItems) -> {
Log.d("PHONEAPP", "Data was changed");
LinearLayout todoList = findViewById(R.id.todosList);
todoList.removeAllViews();
for (TodoItem item : todoItems) {
todoList.addView(viewModel.getContainerLayout(item, this));
}
});
}
} | [
"[email protected]"
]
| |
fd518e67070f23af67c06ba6d5bfb95910edfeac | 691606cf2e9b038eae4396b57bc9f8bfddd7ff98 | /src/user/entity/Product.java | 02379c4518e90a3005df53c6172c8cbab885f5c0 | []
| no_license | ThouMorum/happystore | 14e849792f188e049556232fc5766449572d9903 | ff3da0b6d65146d11b06ecf571f2be65deee966a | refs/heads/master | 2021-04-09T10:36:06.502859 | 2018-03-15T09:17:15 | 2018-03-15T09:17:15 | 125,340,438 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,085 | java | package user.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 商品实体
*/
public class Product implements Serializable {
private String pid;
private String pname;
private Double market_price;
private Integer pnumber;
private Double shop_price;
private String pimage;
private Date pdate;
private Integer is_hot = 0;// 是否热门 1:热门 0:否
private String pdesc; // 物品描述
// 属于那个分类
private Category category;
// 属于那种促销分类
private Promotion promotion;
// 属于那个商家
private Business business;
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getPname() {
return pname;
}
public Integer getPnumber() {
return pnumber;
}
public void setPnumber(Integer pnumber) {
this.pnumber = pnumber;
}
public void setPname(String pname) {
this.pname = pname;
}
public Double getMarket_price() {
return market_price;
}
public void setMarket_price(Double market_price) {
this.market_price = market_price;
}
public Double getShop_price() {
return shop_price;
}
public void setShop_price(Double shop_price) {
this.shop_price = shop_price;
}
public String getPimage() {
return pimage;
}
public void setPimage(String pimage) {
this.pimage = pimage;
}
public Date getPdate() {
return pdate;
}
public void setPdate(Date pdate) {
this.pdate = pdate;
}
public Integer getIs_hot() {
return is_hot;
}
public void setIs_hot(Integer is_hot) {
this.is_hot = is_hot;
}
public String getPdesc() {
return pdesc;
}
public void setPdesc(String pdesc) {
this.pdesc = pdesc;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public Promotion getPromotion() {
return promotion;
}
public void setPromotion(Promotion promotion) {
this.promotion = promotion;
}
public Business getBusiness() {
return business;
}
public void setBusiness(Business business) {
this.business = business;
}
} | [
"[email protected]"
]
| |
1f681a027ee13295cef10b974aa416a759a4970a | 5042557ebb9918defc8e8d9b63df7ce1216c2590 | /src/main/java/tw/gov/ndc/emsg/mydata/mapper/PortalBoxLogMapper.java | 2904695b0447aa34bc571ff83344154f97a292e5 | []
| no_license | jennyming622/mydata-master | 71f4b5dde8c64401d55672e6986fc70c844d16c8 | cfa5c6dbc4669ce7450058c3873d30b1b4cbb087 | refs/heads/main | 2023-07-10T03:35:19.493574 | 2021-08-09T07:50:24 | 2021-08-09T07:50:24 | 394,197,542 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 567 | java | package tw.gov.ndc.emsg.mydata.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import tw.gov.ndc.emsg.mydata.entity.PortalBoxLog;
import tw.gov.ndc.emsg.mydata.entity.PortalBoxLogExample;
public interface PortalBoxLogMapper {
int deleteByPrimaryKey(Integer id);
int insert(PortalBoxLog record);
int insertSelective(PortalBoxLog record);
PortalBoxLog selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PortalBoxLog record);
int updateByPrimaryKey(PortalBoxLog record);
} | [
"[email protected]"
]
| |
55f4944a3006573c22ab2c81fe917d942f5664d0 | 359d1adefe7baeb894749ebedc9a0807bbfdbb29 | /word-service/src/main/java/com/example/demo/WordServiceApplication.java | 5f81b0752d08d9aba8864bd06b91ba55ca4250fd | []
| no_license | sousabraga/spring-cloud | b9098f5704181929dde5e6e3f8bddf5ff495ed94 | 0f036b1bd816511e9266e47f3de29505765d7e4f | refs/heads/master | 2021-04-27T08:15:36.251222 | 2018-02-25T02:22:42 | 2018-02-25T02:22:42 | 121,047,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableEurekaClient
public class WordServiceApplication {
public static void main(String[] args) {
SpringApplication.run(WordServiceApplication.class, args);
}
}
| [
"[email protected]"
]
| |
64a390c7f11982ca829a2f92dac818380a8646cb | 053f93eabbf00a20b321f1d0cbbd1ffc3920e9ee | /conf-server/src/main/java/org/wxz/confserver/from/CreateConfDetailFrom.java | 1e691373ee42262db6315a888ecc7dc48fc4d9ef | []
| no_license | petitBean/nConfsys | 87b94fa53e3a2d8c2a1c492565086ab154a27613 | 9b94fe32f1860112d89d0af3e61f160551be442e | refs/heads/master | 2022-07-08T01:54:00.809756 | 2020-06-08T17:42:11 | 2020-06-08T17:42:11 | 242,451,954 | 0 | 0 | null | 2022-06-17T03:05:56 | 2020-02-23T03:47:36 | Java | UTF-8 | Java | false | false | 579 | java | package org.wxz.confserver.from;
import lombok.Data;
import java.util.Date;
/**
* @Author xingze Wang
* @create 2020/4/25 0:34
*/
@Data
public class CreateConfDetailFrom {
private String confSession;
private String confSubject;
private String bigPosterUrl;
private String contect;
private int peopleNum;
private Date[] paperCollectionDate;
private Date[] payDate;
private String groupIntroduce;
private String confId;
private String username;
private String confOrgnizeIntroduce;
private String confIntroduce;
}
| [
"[email protected]"
]
| |
9b5afc43013cb7e9900af0fd34cb4b54fcc1c551 | 65326e3c9b053738f2615f3b15b13e569101e408 | /src/main/java/cards/depreciated/ClockandLoad.java | ff036991f11e82b0c7c6eef0a76e7e613bfe9477 | []
| no_license | Tempus/The-Disciple | e2b42c8d39ac780d4afbd7fa0e8d1e2927cc36a5 | 9eea2602c3686e16e13bc92a6f7ce59f6b6d6486 | refs/heads/master | 2021-06-20T17:19:43.224331 | 2020-12-20T06:27:02 | 2020-12-20T06:27:02 | 146,139,851 | 12 | 7 | null | 2019-06-17T03:20:46 | 2018-08-26T00:40:48 | Java | UTF-8 | Java | false | false | 2,811 | java | package chronomuncher.cards;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.GameActionManager;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.actions.common.DamageAction;
import chronomuncher.cards.MetricsCard;
import chronomuncher.ChronoMod;
import chronomuncher.patches.Enum;
public class ClockandLoad extends MetricsCard {
public static final String ID = "ClockandLoad";
private static final CardStrings cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
public static final String NAME = cardStrings.NAME;
public static final String DESCRIPTION = cardStrings.DESCRIPTION;
public static final String UPGRADE_DESCRIPTION = cardStrings.UPGRADE_DESCRIPTION;
private static final int COST = 2;
private static final int ATTACK_DMG = 1;
public ClockandLoad() {
super(ID, NAME, "chrono_images/cards/ClockandLoad.png", COST, DESCRIPTION, AbstractCard.CardType.ATTACK,
Enum.CHRONO_GOLD, AbstractCard.CardRarity.UNCOMMON,
AbstractCard.CardTarget.ENEMY);
this.baseDamage = 0;
this.baseMagicNumber = ATTACK_DMG;
this.magicNumber = this.baseMagicNumber;
this.exhaust = true;
}
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
AbstractDungeon.actionManager.addToBottom(
new DamageAction(m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.SMASH));
}
@Override
public void atTurnStart() {
this.baseDamage = (AbstractDungeon.actionManager.energyGainedThisCombat * this.magicNumber);
initializeDescription();
}
@Override
public void triggerOnOtherCardPlayed(AbstractCard c) {
this.baseDamage = (AbstractDungeon.actionManager.energyGainedThisCombat * this.magicNumber);
initializeDescription();
}
@Override
public void applyPowers() {
this.baseDamage = (AbstractDungeon.actionManager.energyGainedThisCombat * this.magicNumber);
super.applyPowers();
initializeDescription();
}
@Override
public AbstractCard makeCopy() {
return new ClockandLoad();
}
@Override
public void upgrade() {
if (!this.upgraded) {
upgradeName();
this.exhaust = false;
this.rawDescription = UPGRADE_DESCRIPTION;
initializeDescription();
}
}
} | [
"[email protected]"
]
| |
d0f12fa160eb465832cbb0838562184002d8b38b | cc70f0eac152553f0744954a1c4da8af67faa5ab | /PPA/src/examples/AllCodeSnippets/class_924.java | 3a3c4af1afd7f0cec8e8471a498d0c776da2fb6b | []
| no_license | islamazhar/Detecting-Insecure-Implementation-code-snippets | b49b418e637a2098027e6ce70c0ddf93bc31643b | af62bef28783c922a8627c62c700ef54028b3253 | refs/heads/master | 2023-02-01T10:48:31.815921 | 2020-12-11T00:21:40 | 2020-12-11T00:21:40 | 307,543,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,131 | java | package examples.AllCodeSnippets;
public class class_924{
public static void main() {
private static String generateSasToken(String uri, String keyName, String key){
String ret = ";
// long tokenExpirationTime = (System.currentTimeMillis() / 1000) + (10 * 365 * 24 * 60 * 60);
Date now = new Date();
Date previousDate=new Date(1970);
long tokenExpirationTime = ((now.getTime() - previousDate.getTime()) / 1000 )+3600;
try {
String stringToSign = URLEncoder.encode(new URL(uri).toString(),java.nio.charset.StandardCharsets.UTF_8.toString()) + "\n" + tokenExpirationTime;
System.out.println(stringToSign);
SecretKey secretKey = null;
byte[] keyBytes = key.getBytes("UTF-8");
Mac mac = Mac.getInstance("HMACSHA256");
secretKey = new SecretKeySpec(keyBytes, mac.getAlgorithm());
mac.init(secretKey);
byte[] digest = mac.doFinal(stringToSign.getBytes());
//We then use the composite signing key to create an oauth_signature from the signature base string
String signature = Base64.encodeBase64String(digest);
System.out.println( URLEncoder.encode(signature, java.nio.charset.StandardCharsets.UTF_8.toString()));
// String signature = Base64.encodeBase64String(mac.doFinal(stringToSign.getBytes("UTF-8")));
ret = String.format("SharedAccessSignature sr=%s&sig=%s&se=%s&skn=%s",
URLEncoder.encode(uri, java.nio.charset.StandardCharsets.UTF_8.toString()),
URLEncoder.encode(signature, java.nio.charset.StandardCharsets.UTF_8.toString()),
String.valueOf(tokenExpirationTime),
keyName);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return ret;
}
}
}
| [
"[email protected]"
]
| |
59456bd60e8520a6091eb9cb2728be55bbfbae74 | a5c1c6983cc22513c3c76698e6bb7b4cc6af290d | /JavaProgramBibhas/src/bibhas/pract/program/Demo3.java | a7e2403f7b95574a304b76efa43cadbe27c1eafd | []
| no_license | Bibhasgiri/SpringToolWorkspace | 2584229ef3d0100b1bbc4f1d5e9d00b76b0d87ca | ee2fc457d030620c4f090046da86e46ca649b6da | refs/heads/master | 2023-06-29T09:58:36.547673 | 2021-07-29T16:47:28 | 2021-07-29T16:47:28 | 390,779,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package bibhas.pract.program;
import java.io.BufferedReader;
import java.io.FileReader;
public class Demo3 {
public static void main(String[] args)throws Exception {
BufferedReader r=new BufferedReader(new FileReader("F:\\c.txt"));
int line =0;
while(r.readLine()!=null)
line++;
System.out.println(line);
r.close();
}
}
| [
"hello@Bibhas"
]
| hello@Bibhas |
4525d6bc615ab67ef359ff146a2283682abecc24 | f171e67da1909b3aa6d094389b05d2be4bf66900 | /saturn-odata/src/main/java/com/github/saturn/odata/annotations/ODataReturnType.java | 9e82793330acb378677c4131b3c7aa9542a15db9 | [
"MIT"
]
| permissive | gnahZ-eH/saturn | 6cfe132f35855123d855f6e17412f78890751f35 | a3ef6d3247561369dc5e9b8c970e601308c3d5c3 | refs/heads/master | 2023-03-08T06:24:50.448822 | 2021-01-24T09:50:46 | 2021-01-24T09:50:46 | 266,967,414 | 0 | 0 | MIT | 2021-01-17T07:19:39 | 2020-05-26T06:55:05 | Java | UTF-8 | Java | false | false | 5,273 | java | /*
* MIT License
*
* Copyright (c) [2020] [He Zhang]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.saturn.odata.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* The attributes MaxLength, Precision, Scale, and SRID can be used to specify the facets of the return type,
* as appropriate. If the facet attributes are not specified, their values are considered unspecified.
*
* http://docs.oasis-open.org/odata/odata/v4.0/os/part3-csdl/odata-v4.0-os-part3-csdl.html#_Toc372793972
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ODataReturnType {
/**
* The Type attribute specifies the type of the result returned by the function or action.
*/
String type() default "";
/**
* A return type MAY specify a Boolean value for the Nullable attribute. If not specified, the Nullable
* attribute defaults to true.
*
* If the return type has a Type attribute that does not specify a collection, the value of true means
* that the action or function may return a single null value. A value of false means that the action
* or function will never return a null value and instead fail with an error response if it cannot
* compute a result.
*
* If the return type has a Type attribute that specifies a collection, the result will always exist,
* but the collection MAY be empty. In this case, the Nullable attribute applies to members of the
* collection and specifies whether the collection can contain null values.
*/
boolean nullable() default true;
/**
* A binary, stream or string property MAY define a positive integer value for the MaxLength facet
* attribute. The value of this attribute specifies the maximum length of the value of the property
* on a type instance. Instead of an integer value the constant max MAY be specified as a shorthand
* for the maximum length supported for the type by the service.
*
* If no value is specified, the property has unspecified length.
*
* @return max length of the Property.
*/
int maxLength() default Integer.MAX_VALUE;
/**
* A datetime-with-offset, decimal, duration, or time-of-day property MAY define a value for the
* Precision attribute.
*
* For a decimal property the value of this attribute specifies the maximum number of digits allowed
* in the property’s value; it MUST be a positive integer. If no value is specified, the decimal property
* has unspecified precision.
*
* For a temporal property the value of this attribute specifies the number of decimal places allowed
* in the seconds portion of the property’s value; it MUST be a non-negative integer between zero and
* twelve. If no value is specified, the temporal property has a precision of zero.
*
* @return precision of the Property.
*/
int precision() default Integer.MAX_VALUE;
/**
* A decimal property MAY define a non-negative integer value or variable for the Scale attribute.
* This attribute specifies the maximum number of digits allowed to the right of the decimal point.
* The value variable means that the number of digits to the right of the decimal point may vary from
* zero to the value of the Precision attribute.
*
* The value of the Scale attribute MUST be less than or equal to the value of the Precision attribute.
*
* If no value is specified, the Scale facet defaults to zero.
*
* @return scale of the Property.
*/
int scale() default Integer.MAX_VALUE;
/**
* A geometry or geography property MAY define a value for the SRID attribute. The value of this attribute
* identifies which spatial reference system is applied to values of the property on type instances.
*
* The value of the SRID attribute MUST be a non-negative integer or the special value variable.
* If no value is specified, the attribute defaults to 0 for Geometry types or 4326 for Geography types.
*/
int srid() default 0;
}
| [
"[email protected]"
]
| |
a9d164d36b54fa1887b84fb9efbeb62f32267109 | e224c364b7f7ae7a3ba4035dbdada9a0a735f666 | /app/src/main/java/com/yinduowang/installment/mvp/model/entity/AuthEmergencyBean.java | 356989e12f9acc2b92b351aaf1a103d174bec7f7 | []
| no_license | HLJJMS/YinDuo | aa0e0cfe7cfdfebf73c2d2e7eb14847bed38b7ce | 672b6d36900d06905ae5d0a190a34af77870379f | refs/heads/master | 2021-05-21T08:09:15.792766 | 2020-04-03T03:58:43 | 2020-04-03T03:58:43 | 252,613,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,723 | java | package com.yinduowang.installment.mvp.model.entity;
import java.util.List;
public class AuthEmergencyBean {
/**
* contacts : {"familyType":"1","familyName":"钉钉DING消息","familyMobile":"02131772129","otherType":"1","otherName":"刘","otherMobile":"15910860609"}
* dictionary : {"regions":null,"educationList":[{"id":0,"name":"博士"},{"id":1,"name":"硕士"},{"id":2,"name":"本科"},{"id":3,"name":"大专"},{"id":4,"name":"中专"},{"id":5,"name":"高中"},{"id":6,"name":"初中"},{"id":7,"name":"初中以下"},{"id":8,"name":"未知"}],"liveTimeList":[{"id":0,"name":"半年以内"},{"id":1,"name":"半年到一年"},{"id":2,"name":"一年以上"}],"maritalList":[{"id":0,"name":"未婚"},{"id":1,"name":"已婚未育"},{"id":2,"name":"已婚已育"},{"id":3,"name":"离异"},{"id":4,"name":"其它"}],"familyContactsList":[{"id":1,"name":"父亲"},{"id":2,"name":"母亲"},{"id":3,"name":"儿子"},{"id":4,"name":"女儿"},{"id":5,"name":"兄弟"},{"id":6,"name":"姐妹"},{"id":7,"name":"配偶"}],"otherContactsList":[{"id":8,"name":"同学"},{"id":9,"name":"亲戚"},{"id":10,"name":"同事"},{"id":11,"name":"朋友"},{"id":12,"name":"其他"}]}
*/
private ContactsBean contacts;
private DictionaryBean dictionary;
public ContactsBean getContacts() {
return contacts;
}
public void setContacts(ContactsBean contacts) {
this.contacts = contacts;
}
public DictionaryBean getDictionary() {
return dictionary;
}
public void setDictionary(DictionaryBean dictionary) {
this.dictionary = dictionary;
}
public static class ContactsBean {
/**
* familyType : 1
* familyName : 钉钉DING消息
* familyMobile : 02131772129
* otherType : 1
* otherName : 刘
* otherMobile : 15910860609
*/
private String familyType;
private String familyName;
private String familyMobile;
private String otherType;
private String otherName;
private String otherMobile;
public String getFamilyType() {
return familyType;
}
public void setFamilyType(String familyType) {
this.familyType = familyType;
}
public String getFamilyName() {
return familyName;
}
public void setFamilyName(String familyName) {
this.familyName = familyName;
}
public String getFamilyMobile() {
return familyMobile;
}
public void setFamilyMobile(String familyMobile) {
this.familyMobile = familyMobile;
}
public String getOtherType() {
return otherType;
}
public void setOtherType(String otherType) {
this.otherType = otherType;
}
public String getOtherName() {
return otherName;
}
public void setOtherName(String otherName) {
this.otherName = otherName;
}
public String getOtherMobile() {
return otherMobile;
}
public void setOtherMobile(String otherMobile) {
this.otherMobile = otherMobile;
}
}
public static class DictionaryBean {
/**
* regions : null
* educationList : [{"id":0,"name":"博士"},{"id":1,"name":"硕士"},{"id":2,"name":"本科"},{"id":3,"name":"大专"},{"id":4,"name":"中专"},{"id":5,"name":"高中"},{"id":6,"name":"初中"},{"id":7,"name":"初中以下"},{"id":8,"name":"未知"}]
* liveTimeList : [{"id":0,"name":"半年以内"},{"id":1,"name":"半年到一年"},{"id":2,"name":"一年以上"}]
* maritalList : [{"id":0,"name":"未婚"},{"id":1,"name":"已婚未育"},{"id":2,"name":"已婚已育"},{"id":3,"name":"离异"},{"id":4,"name":"其它"}]
* familyContactsList : [{"id":1,"name":"父亲"},{"id":2,"name":"母亲"},{"id":3,"name":"儿子"},{"id":4,"name":"女儿"},{"id":5,"name":"兄弟"},{"id":6,"name":"姐妹"},{"id":7,"name":"配偶"}]
* otherContactsList : [{"id":8,"name":"同学"},{"id":9,"name":"亲戚"},{"id":10,"name":"同事"},{"id":11,"name":"朋友"},{"id":12,"name":"其他"}]
*/
private Object regions;
private List<EducationListBean> educationList;
private List<LiveTimeListBean> liveTimeList;
private List<MaritalListBean> maritalList;
private List<FamilyContactsListBean> familyContactsList;
private List<OtherContactsListBean> otherContactsList;
public Object getRegions() {
return regions;
}
public void setRegions(Object regions) {
this.regions = regions;
}
public List<EducationListBean> getEducationList() {
return educationList;
}
public void setEducationList(List<EducationListBean> educationList) {
this.educationList = educationList;
}
public List<LiveTimeListBean> getLiveTimeList() {
return liveTimeList;
}
public void setLiveTimeList(List<LiveTimeListBean> liveTimeList) {
this.liveTimeList = liveTimeList;
}
public List<MaritalListBean> getMaritalList() {
return maritalList;
}
public void setMaritalList(List<MaritalListBean> maritalList) {
this.maritalList = maritalList;
}
public List<FamilyContactsListBean> getFamilyContactsList() {
return familyContactsList;
}
public void setFamilyContactsList(List<FamilyContactsListBean> familyContactsList) {
this.familyContactsList = familyContactsList;
}
public List<OtherContactsListBean> getOtherContactsList() {
return otherContactsList;
}
public void setOtherContactsList(List<OtherContactsListBean> otherContactsList) {
this.otherContactsList = otherContactsList;
}
public static class EducationListBean {
/**
* id : 0
* name : 博士
*/
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public static class LiveTimeListBean {
/**
* id : 0
* name : 半年以内
*/
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public static class MaritalListBean {
/**
* id : 0
* name : 未婚
*/
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public static class FamilyContactsListBean {
/**
* id : 1
* name : 父亲
*/
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public static class OtherContactsListBean {
/**
* id : 8
* name : 同学
*/
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
}
}
| [
"[email protected]"
]
| |
825ca604c58b9696f638ceba1d0d3474c9d558f9 | 2f672156a34c0ee21f68324feebb5d950430ea3a | /app/src/main/java/com/example/gigi/poraba/Activities/manualCalculate.java | 4cc8f8d10da620f35d812dc98f16c0de40890497 | []
| no_license | gregorkotnik/Poraba | f42275f5bd66fda032a2296a85477546d192d1e3 | 9ff2c9fe01eb70b88c8a629945ec18dcfd129744 | refs/heads/master | 2020-09-25T06:15:37.804436 | 2020-05-28T18:17:49 | 2020-05-28T18:17:49 | 225,936,081 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,550 | java | package com.example.gigi.poraba.Activities;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.example.gigi.poraba.R;
import java.text.DecimalFormat;
import java.util.regex.Pattern;
public class manualCalculate extends AppCompatActivity {
EditText etDistance,etFuel,etPrice;
TextView tvConsumation,tvFinalPrice;
Button btnCalculate;
private static final Pattern DOUBLE_PATTERN = Pattern.compile(
"[\\x00-\\x20]*[+-]?(NaN|Infinity|((((\\p{Digit}+)(\\.)?((\\p{Digit}+)?)" +
"([eE][+-]?(\\p{Digit}+))?)|(\\.((\\p{Digit}+))([eE][+-]?(\\p{Digit}+))?)|" +
"(((0[xX](\\p{XDigit}+)(\\.)?)|(0[xX](\\p{XDigit}+)?(\\.)(\\p{XDigit}+)))" +
"[pP][+-]?(\\p{Digit}+)))[fFdD]?))[\\x00-\\x20]*");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manual_calculate);
etDistance=(EditText)findViewById(R.id.etDistance);
etFuel=(EditText)findViewById(R.id.etFuel);
etPrice=(EditText)findViewById(R.id.etPrice);
tvConsumation=(TextView)findViewById(R.id.tvConsumation);
tvFinalPrice=(TextView)findViewById(R.id.tvFinalPrice);
btnCalculate=(Button)findViewById(R.id.btnCalculate);
}
public void Calculate(View v)
{
if(TextUtils.isEmpty(etDistance.getText()))
{
etDistance.setError("Polje ne sme biti prazno");
return;
}
else if(CheckDouble(etDistance.getText().toString())==false)
{
etDistance.setError("Vnesite število primer:700.3");
return;
}
if(TextUtils.isEmpty(etFuel.getText()))
{
etFuel.setError("Polje ne sme biti prazno");
return;
}
else if(CheckDouble(etFuel.getText().toString())==false)
{
etFuel.setError("Vnesite število pimer:50.5");
return;
}
if(TextUtils.isEmpty(etPrice.getText()))
{
etPrice.setError("Polje ne sme biti prazno");
return;
}
else if(CheckDouble(etPrice.getText().toString())==false)
{
etPrice.setError("Vnesite število primer 1.25");
return;
}
double Distance=Double.parseDouble(etDistance.getText().toString());
double Fuel=Double.parseDouble(etFuel.getText().toString());
double Price=Double.parseDouble(etPrice.getText().toString());
double finalConsumation=Fuel/Distance*100;
double finalPrice=Fuel*Price;
DecimalFormat df = new DecimalFormat("#.##");
finalConsumation = Double.valueOf(df.format(finalConsumation));
finalPrice=Double.valueOf(df.format(finalPrice));
tvConsumation.setText("Vaša poraba je: "+Double.toString(finalConsumation)+ " l/km");
tvFinalPrice.setText("Skupna cena natočena goriva je: " +Double.toString(finalPrice)+ " €");
}
public static boolean CheckDouble(String number)
{
return DOUBLE_PATTERN.matcher(number).matches();
}
@Override
public void onBackPressed() {
super.onBackPressed();
Intent i=new Intent(manualCalculate.this, MainActivity.class);
startActivity(i);
finish();
}
}
| [
"[email protected]"
]
| |
e7b86e31ae1a1ddc7f63a7428de97ed1eabfa5d9 | 201f0891874905a789374709a5a6b8d3b6c56180 | /src/main/java/gitp4/p4/P4PathMapInfo.java | 5b5fcbd344e730ea0a2c0eeb25ab0cda57817dc7 | []
| no_license | cybercharger/gitp4 | db7f0f8f2c02f689482b64d0e83dccffca96d9c4 | 755b489f4a6d93806179e8134da209a421e0ea27 | refs/heads/master | 2020-09-10T02:16:23.132123 | 2017-07-05T10:09:35 | 2017-07-05T10:09:35 | 66,330,351 | 1 | 0 | null | 2017-03-31T09:43:19 | 2016-08-23T03:35:09 | Java | UTF-8 | Java | false | false | 609 | java | package gitp4.p4;
/**
* Created by chriskang on 9/7/2016.
*/
public class P4PathMapInfo {
private final String depotPath;
private final String clientPath;
private final String localPath;
public P4PathMapInfo(String depotPath, String clientPath, String localPath) {
this.depotPath = depotPath;
this.clientPath = clientPath;
this.localPath = localPath;
}
public String getDepotPath() {
return depotPath;
}
public String getClientPath() {
return clientPath;
}
public String getLocalPath() {
return localPath;
}
}
| [
"[email protected]"
]
| |
df3653dab477d9ffeacfaa14a3a150cd3a3be165 | 71a93e5c68da38706df4d89f2062ad2fb852acb8 | /modules/web/src/com/company/teziscontrolwork/web/carbrand/CarBrandEdit.java | 35a2778aa6ffff844ab383154b1ceff4db51ba96 | []
| no_license | KormuhinIP/tezis_control_work | 87c6bcc65e13d02fd8a8f5c31683e09a7284931d | a7e92f50e4dab87674a67aee3713eaec248e8c80 | refs/heads/master | 2020-06-14T01:30:36.006831 | 2019-07-31T06:36:44 | 2019-07-31T06:36:44 | 194,851,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java |
package com.company.teziscontrolwork.web.carbrand;
import java.util.Map;
import com.haulmont.cuba.gui.components.AbstractEditor;
import com.company.teziscontrolwork.entity.CarBrand;
public class CarBrandEdit extends AbstractEditor<CarBrand> {
@Override
public void init(Map<String, Object> params) {
super.init(params);
}
} | [
"[email protected]"
]
| |
7a1680d772759506d6c3b20bf29ee442a28bebdf | 7e922c74a1b8cdea135257d47023294bab6e611c | /app/src/main/java/com/zaurkandokhov/stormy/ui/MainActivity.java | 9a718b570112ff79c740d10741f5c61ea0dada6d | []
| no_license | ZaurKK/Stormy | 20144b077dc10ffbaaeab1ccc3b33830b1731b84 | fc08c91a51facc1c5cf7e61fe8fe467c05c523fa | refs/heads/master | 2021-01-20T07:29:35.260453 | 2017-05-19T12:32:31 | 2017-05-19T12:32:31 | 90,006,908 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,783 | java | package com.zaurkandokhov.stormy.ui;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.LocaleList;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.zaurkandokhov.stormy.R;
import com.zaurkandokhov.stormy.weather.Current;
import com.zaurkandokhov.stormy.weather.Day;
import com.zaurkandokhov.stormy.weather.Forecast;
import com.zaurkandokhov.stormy.weather.Hour;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class MainActivity extends AppCompatActivity {
public static final String TAG = MainActivity.class.getSimpleName();
public static final String DAILY_FORECAST = "DAILY_FORECAST";
public static final String HOURLY_FORECAST = "HOURLY_FORECAST";
private Forecast mForecast;
@BindView(R.id.timeLabel) TextView mTimeLabel;
@BindView(R.id.temperatureLabel) TextView mTemperatureValue;
@BindView(R.id.humidityValue) TextView mHumidityValue;
@BindView(R.id.precipValue) TextView mPrecipValue;
@BindView(R.id.summaryLabel) TextView mSummaryLabel;
@BindView(R.id.iconImageView) ImageView mIconImageView;
@BindView(R.id.refreshImageView) ImageView mRefreshImageView;
@BindView(R.id.refreshProgressBar) ProgressBar mRefreshProgressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
mRefreshProgressBar.setVisibility(View.INVISIBLE);
final double latitude = 43.4544;
final double longitude = 43.7263;
mRefreshImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getForecast(latitude, longitude);
}
});
getForecast(latitude, longitude);
Log.e(TAG, "Main UI code is running!");
}
private void getForecast(double latitude, double longitude) {
String apiKey = "0597ebd06ba12c329014cd21a83bcc10";
String forecastUrl = "https://api.darksky.net/forecast/" + apiKey + "/" + latitude + "," + longitude;
if (isNetworkAvailable()) {
toggleRefresh();
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(forecastUrl).build();
Call call = client.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
toggleRefresh();
}
});
alertUserAboutError();
}
@Override
public void onResponse(Call call, Response response) throws IOException {
runOnUiThread(new Runnable() {
@Override
public void run() {
toggleRefresh();
}
});
try {
String jsonData = response.body().string();
Log.v(TAG, jsonData);
if (response.isSuccessful()) {
mForecast = parseForecastDetails(jsonData);
runOnUiThread(new Runnable() {
@Override
public void run() {
updateDisplay();
}
});
} else {
alertUserAboutError();
}
}
catch (IOException e) {
Log.e(TAG, "Exception caught: ", e);
}
catch (JSONException e) {
Log.e(TAG, "Exception caught: ", e);
}
}
});
}
else {
Toast.makeText(this, R.string.network_unavailable_message, Toast.LENGTH_LONG).show();
}
}
private void toggleRefresh() {
mRefreshProgressBar.setVisibility(mRefreshProgressBar.getVisibility() == View.INVISIBLE ? View.VISIBLE : View.INVISIBLE);
mRefreshImageView.setVisibility(mRefreshImageView.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE);
}
private void updateDisplay() {
Current current = mForecast.getCurrent();
mTemperatureValue.setText(current.getTemperature() + "");
mTimeLabel.setText("At " + current.getFormattedTime() + " it will be");
mHumidityValue.setText(current.getHumidity() + "");
mPrecipValue.setText(current.getPrecipChance() + "%");
mSummaryLabel.setText(current.getSummary());
Drawable drawable = ContextCompat.getDrawable(this, current.getIconId());
mIconImageView.setImageDrawable(drawable);
}
private Forecast parseForecastDetails(String jsonData) throws JSONException {
Forecast forecast = new Forecast();
forecast.setCurrent(getCurrentWeather(jsonData));
forecast.setHour(getHourlyWeather(jsonData));
forecast.setDay(getDailyWeather(jsonData));
return forecast;
}
private Current getCurrentWeather(String jsonData) throws JSONException {
JSONObject forecast = new JSONObject(jsonData);
String timezone = forecast.getString("timezone");
JSONObject currently = forecast.getJSONObject("currently");
Current current = new Current(
currently.getString("icon"),
currently.getLong("time"),
currently.getDouble("temperature"),
currently.getDouble("humidity"),
currently.getDouble("precipProbability"),
currently.getString("summary"),
timezone);
Log.d(TAG, current.getFormattedTime());
return current;
}
private Hour[] getHourlyWeather(String jsonData) throws JSONException {
JSONObject forecast = new JSONObject(jsonData);
String timezone = forecast.getString("timezone");
JSONObject hourly = forecast.getJSONObject("hourly");
JSONArray data = hourly.getJSONArray("data");
Hour[] hourlyWeather = new Hour[data.length()];
for(int i = 0; i < hourlyWeather.length; i++) {
JSONObject jsonHour = data.getJSONObject(i);
Hour hour = new Hour();
hour.setTime(jsonHour.getLong("time"));
hour.setSummary(jsonHour.getString("summary"));
hour.setTemperature(jsonHour.getDouble("temperature"));
hour.setIcon(jsonHour.getString("icon"));
hour.setTimezone(timezone);
hourlyWeather[i] = hour;
}
return hourlyWeather;
}
private Day[] getDailyWeather(String jsonData) throws JSONException {
JSONObject forecast = new JSONObject(jsonData);
String timezone = forecast.getString("timezone");
JSONObject daily = forecast.getJSONObject("daily");
JSONArray data = daily.getJSONArray("data");
Day[] dailyWeather = new Day[data.length()];
for(int i = 0; i < dailyWeather.length; i++) {
JSONObject jsonDay = data.getJSONObject(i);
Day day = new Day();
day.setTime(jsonDay.getLong("time"));
day.setSummary(jsonDay.getString("summary"));
day.setTemperatureMin(jsonDay.getDouble("temperatureMin"));
day.setTemperatureMax(jsonDay.getDouble("temperatureMax"));
day.setIcon(jsonDay.getString("icon"));
day.setTimezone(timezone);
dailyWeather[i] = day;
}
return dailyWeather;
}
private boolean isNetworkAvailable() {
ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = manager.getActiveNetworkInfo();
boolean isAvailable = false;
if (networkInfo != null && networkInfo.isConnected())
isAvailable = true;
return isAvailable;
}
private void alertUserAboutError() {
AlertDialogFragment dialog = new AlertDialogFragment();
dialog.show(getFragmentManager(), "error_dialog");
}
@OnClick (R.id.dailyButton)
public void startDailyActivity(View view) {
Intent intent = new Intent(this, DailyForecastActivity.class);
intent.putExtra(DAILY_FORECAST, mForecast.getDay());
startActivity(intent);
}
@OnClick (R.id.hourlyButton)
public void startHourlyActivity(View view) {
Intent intent = new Intent(this, HourlyForecastActivity.class);
intent.putExtra(HOURLY_FORECAST, mForecast.getHour());
startActivity(intent);
}
} | [
"[email protected]"
]
| |
f52da813ff900d53f12b0bb45f3f89881f53b608 | ff0c33ccd3bbb8a080041fbdbb79e29989691747 | /jdk.internal.vm.compiler/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/CompressionNode.java | ed96f97abb58231a3c88d4efd4273452d4972214 | []
| no_license | jiecai58/jdk15 | 7d0f2e518e3f6669eb9ebb804f3c89bbfb2b51f0 | b04691a72e51947df1b25c31175071f011cb9bbe | refs/heads/main | 2023-02-25T00:30:30.407901 | 2021-01-29T04:48:33 | 2021-01-29T04:48:33 | 330,704,930 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,168 | java | /*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.graalvm.compiler.nodes;
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_2;
import org.graalvm.compiler.core.common.CompressEncoding;
import org.graalvm.compiler.core.common.type.AbstractObjectStamp;
import org.graalvm.compiler.core.common.type.Stamp;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.graph.spi.CanonicalizerTool;
import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.calc.ConvertNode;
import org.graalvm.compiler.nodes.calc.UnaryNode;
import org.graalvm.compiler.nodes.spi.LIRLowerable;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
import org.graalvm.compiler.nodes.type.StampTool;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.meta.Value;
/**
* Compress or uncompress an oop or metaspace pointer.
*/
@NodeInfo(nameTemplate = "{p#op/s}", cycles = CYCLES_2, size = SIZE_2)
public abstract class CompressionNode extends UnaryNode implements ConvertNode, LIRLowerable {
public static final NodeClass<CompressionNode> TYPE = NodeClass.create(CompressionNode.class);
public enum CompressionOp {
Compress,
Uncompress
}
protected final CompressionOp op;
protected final CompressEncoding encoding;
public CompressionNode(NodeClass<? extends UnaryNode> c, CompressionOp op, ValueNode input, Stamp stamp, CompressEncoding encoding) {
super(c, stamp, input);
this.op = op;
this.encoding = encoding;
}
@Override
public Stamp foldStamp(Stamp newStamp) {
assert newStamp.isCompatible(getValue().stamp(NodeView.DEFAULT));
return mkStamp(newStamp);
}
protected abstract Constant compress(Constant c);
protected abstract Constant uncompress(Constant c);
public JavaConstant nullConstant() {
return JavaConstant.NULL_POINTER;
}
@Override
public Constant convert(Constant c, ConstantReflectionProvider constantReflection) {
switch (op) {
case Compress:
return compress(c);
case Uncompress:
return uncompress(c);
default:
throw GraalError.shouldNotReachHere();
}
}
@Override
public Constant reverse(Constant c, ConstantReflectionProvider constantReflection) {
switch (op) {
case Compress:
return uncompress(c);
case Uncompress:
return compress(c);
default:
throw GraalError.shouldNotReachHere();
}
}
@Override
public boolean isLossless() {
return true;
}
protected abstract Stamp mkStamp(Stamp input);
public CompressionOp getOp() {
return op;
}
public CompressEncoding getEncoding() {
return encoding;
}
@Override
public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
if (forValue.isConstant()) {
if (GeneratePIC.getValue(tool.getOptions())) {
// We always want uncompressed constants
return this;
}
ConstantNode constant = (ConstantNode) forValue;
return ConstantNode.forConstant(stamp(NodeView.DEFAULT), convert(constant.getValue(), tool.getConstantReflection()), constant.getStableDimension(), constant.isDefaultStable(),
tool.getMetaAccess());
} else if (forValue instanceof CompressionNode) {
CompressionNode other = (CompressionNode) forValue;
if (op != other.op && encoding.equals(other.encoding)) {
return other.getValue();
}
}
return this;
}
@Override
public void generate(NodeLIRBuilderTool gen) {
boolean nonNull;
if (value.stamp(NodeView.DEFAULT) instanceof AbstractObjectStamp) {
nonNull = StampTool.isPointerNonNull(value.stamp(NodeView.DEFAULT));
} else {
// metaspace pointers are never null
nonNull = true;
}
LIRGeneratorTool tool = gen.getLIRGeneratorTool();
Value result;
switch (op) {
case Compress:
result = tool.emitCompress(gen.operand(value), encoding, nonNull);
break;
case Uncompress:
result = tool.emitUncompress(gen.operand(value), encoding, nonNull);
break;
default:
throw GraalError.shouldNotReachHere();
}
gen.setResult(this, result);
}
@Override
public boolean mayNullCheckSkipConversion() {
return true;
}
}
| [
"[email protected]"
]
| |
48beee975eaa4ea0fff03d09c1ba0cfe45df3857 | 0f4d81f64f3bf6f9da5a5bcb5d267b7c66fb6eee | /src/main/java/fw/singleton/seriable/SeriableSingletonTest.java | 69193c4e8deea5f1e278149c564935c3f40b36ee | []
| no_license | qq460313011/gphomework-designmode-singleton | 04d1c95fc4ecffa51b02d613bfa32b0007a58f68 | b73a139e25f336670dec8d892a9b1c2a8472492f | refs/heads/master | 2020-05-03T22:08:57.218318 | 2019-04-03T06:47:26 | 2019-04-03T06:47:26 | 178,838,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 871 | java | package fw.singleton.seriable;
import fw.singleton.lazy.LazyDoubleCheckSingleton;
import java.io.*;
/**
* @Auther: Administrator
* @Date: 2019/4/1 17:37
* @Description:
*/
public class SeriableSingletonTest {
public static void main(String[] args) throws IOException, ClassNotFoundException {
//Write Obj to file
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("tempFile"));
oos.writeObject(LazyDoubleCheckSingleton.getInstance());
//Read Obj from file
File file = new File("tempFile");
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
LazyDoubleCheckSingleton newInstance = (LazyDoubleCheckSingleton) ois.readObject();
//判断是否是同一个对象
System.out.println(newInstance == LazyDoubleCheckSingleton.getInstance());
}
}
| [
"[email protected]"
]
| |
52e673103bde8284a5ed7660a9b24a23c1c428e2 | c893d7fb5b1b6a72eaed3a3bd590b70dbefb02b4 | /src/main/java/groovyrun/SCGIApplicationServer.java | 95b687c5983a0532bb4e6e44d610dbd8b513b5c2 | []
| no_license | drxaos/GroovyLamp | bc919e877720d7d1e10a1826cb012d5378e86b3a | 80d4a5946c8a90ef1eea4e18a895e049aefd56b5 | refs/heads/master | 2020-04-06T04:48:47.492042 | 2014-11-15T15:25:52 | 2014-11-15T15:25:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,298 | java | package groovyrun;
import groovyrun.logging.Log;
import java.net.ServerSocket;
import java.net.Socket;
public class SCGIApplicationServer implements Runnable {
private boolean running;
private ServerSocket server_socket;
private int port;
private Thread thread;
private boolean template_mode;
private Log log;
/**
* Creates a new instance of ApplicationServer
*/
public SCGIApplicationServer(int port, boolean template_mode) {
this.port = port;
this.template_mode = template_mode;
this.thread = new Thread(this);
this.log = new Log();
}
public void run() {
this.log.notice("Starting server");
try {
openServerSocket();
} catch (Exception e) {
this.log.error("Unable to open server socket.");
running = false;
//throw e;
return;
}
this.log.notice("SCGIApplicationServer running on port: " + server_socket.getLocalPort());
while (running) {
try {
Socket client_socket = server_socket.accept();
this.log.notice("Accepted new connection");
if (this.template_mode)
(new GroovyTemplateRequestWorker(this, client_socket.getInputStream(), client_socket.getOutputStream())).start();
else
(new GroovyScriptRequestWorker(this, client_socket.getInputStream(), client_socket.getOutputStream())).start();
this.log.notice("Dispatched");
} catch (Exception e) {
this.log.error("ERROR: in accept loop.");
}
}
try {
closeServerSocket();
} catch (Exception e) {
this.log.error("Unable to close server socket");
//throw e;
}
}
public void start() {
this.running = true;
this.thread.start();
}
public void stop() {
this.running = false;
}
public Log getLog() {
return this.log;
}
private void openServerSocket() throws Exception {
server_socket = new ServerSocket(port);
}
private void closeServerSocket() throws Exception {
server_socket.close();
}
}
| [
"[email protected]"
]
| |
5b76180c865d075cfd10e5717e0be8efbf15eda8 | e22d481eba66ee811f04fad2302d19e8f042d460 | /src/org/koroed/lepra/loader/LepraContentListLoader.java | fc099742cec993c85fc5b4e9b0bee034012f098c | []
| no_license | NevRA/lepra | 28ef88cefcea6990aa0d5a7826005d52f656c068 | 03a00beec27f38d689ed28782146bb43fc982c61 | refs/heads/master | 2021-01-15T15:57:35.525580 | 2014-05-28T08:45:57 | 2014-05-29T12:17:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,743 | java | package org.koroed.lepra.loader;
import org.koroed.lepra.LepraContext;
import org.koroed.lepra.LepraHttpClient;
import org.koroed.lepra.content.parser.LepraContentParser;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
/**
* Author: Nikita Koroed
* E-mail: [email protected]
* Date: 28.05.2014
* Time: 10:36
*/
public class LepraContentListLoader {
private LepraContentParser<Integer> parser;
private Integer offset = 0;
private Integer period;
private Integer unread;
private String sorting;
private URI uri;
private LepraContext ctx;
private LepraHttpClient httpClient;
public LepraContentListLoader(URI uri, LepraContentParser<Integer> parser, String sorting, LepraContext ctx, LepraHttpClient httpClient) {
this.parser = parser;
this.sorting = sorting;
this.uri = uri;
this.ctx = ctx;
this.httpClient = httpClient;
}
public void load() {
if(!hasNext()) {
return;
}
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("csrf_token", ctx.getCsrfToken());
parameters.put("offset", Integer.toString(offset));
parameters.put("sorting", sorting);
if(period != null) {
parameters.put("period", period.toString());
}
if(unread != null) {
parameters.put("unread", unread.toString());
}
offset = httpClient.loadContent(uri, parameters, parser);
}
public boolean hasNext() {
return offset != null;
}
public void setPeriod(Integer period) {
this.period = period;
}
public void setUnread(Integer unread) {
this.unread = unread;
}
}
| [
"[email protected]"
]
| |
ffdc5ab2afb38583e9d38d8ae754a1deb35d19e3 | 6c56882870ab37a05ca2dafab31b10de342f6f94 | /app/src/main/java/com/example/handsomefu/journalbook/activity/WriteJournalActivity.java | 5dcb637d05dbc43d08efc05491fa48948d751fa8 | []
| no_license | xidianfushuai/JournalBook | 3a2290a004245ad929ddd0e77291516ba64c6473 | 38f67c0476215120eb0a5991c705103798c1ec79 | refs/heads/master | 2020-06-18T23:09:10.776252 | 2016-11-28T04:10:50 | 2016-11-28T04:10:50 | 74,936,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,055 | java | package com.example.handsomefu.journalbook.activity;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import com.example.handsomefu.journalbook.utils.CommonUtils;
import com.example.handsomefu.journalbook.constants.Constants;
import com.example.handsomefu.journalbook.R;
/**
* Created by HandsomeFu on 2016/11/2.
*/
public class WriteJournalActivity extends BaseActivity implements View.OnClickListener{
private EditText etTitle;
private LinearLayout ll;
private EditText etContent;
private Button btSave;
private Intent intent;
private int from;
@Override
protected void initEvent() {
if (from == Constants.EDIT) {
etTitle.setText(intent.getStringExtra(Constants.TITLE));
etContent.setText(intent.getStringExtra(Constants.CONTENT));
}
ll.setOnClickListener(this);
CommonUtils.autoSoftKeyboard(etTitle);
btSave.setOnClickListener(this);
}
@Override
protected void initData() {
intent = getIntent();
from = intent.getIntExtra(Constants.FROM, 1);
}
@Override
protected void initView() {
etTitle = (EditText) findViewById(R.id.et_title);
ll = (LinearLayout) findViewById(R.id.ll);
etContent = (EditText) findViewById(R.id.et_content);
btSave = (Button) findViewById(R.id.bt_save);
}
@Override
public int getLayout() {
return R.layout.ac_write_journal;
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.ll:
CommonUtils.autoSoftKeyboard(etContent);
break;
case R.id.bt_save:
intent.putExtra(Constants.TITLE, etTitle.getText().toString());
intent.putExtra(Constants.CONTENT, etContent.getText().toString());
setResult(RESULT_OK, intent);
finish();
break;
}
}
}
| [
"[email protected]"
]
| |
60a51c260c61010fd7f245f3819b1f21d0dde49c | 48d3dc52af6a13ffb6f97eb4f12c2a0380fb6b17 | /app/src/main/java/polinema/ac/id/starterchapter05/fragments/HandstandFragment.java | 2bcc4ca01cbe2d9ea0818faedacef031151d7921 | []
| no_license | Mochamadwildan/2019-mobile05 | 3557f1a6369ede764ad5e95284e33e1c61ba6913 | 8070ff7e64b1cced563ad61d041ba0253f23d25d | refs/heads/master | 2020-07-31T23:04:00.755747 | 2019-10-01T16:17:46 | 2019-10-01T16:17:46 | 210,780,868 | 0 | 0 | null | 2019-09-25T07:19:22 | 2019-09-25T07:19:21 | null | UTF-8 | Java | false | false | 720 | java | package polinema.ac.id.starterchapter05.fragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import polinema.ac.id.starterchapter05.R;
/**
* A simple {@link Fragment} subclass.
*/
public class HandstandFragment extends Fragment {
public HandstandFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_handstand, container, false);
}
} | [
"[email protected]"
]
| |
8b31273893d8ddfaa9dbba9bdabfaa7ce2453c12 | f243daa0f6025e3e8721e0fbebdcf0518ea22d0a | /src/main/java/net/whg/match/Match.java | e005ac4a27bc4c9a74fbba9ac7785693e8277c81 | [
"MIT"
]
| permissive | TheDudeFromCI/Spigot-BotDown | b6b81b7a918450426e3fb9858ae5952c2f0573fb | c969611f1a6babe524e399335fb66e943bf1288d | refs/heads/main | 2023-02-19T19:20:09.039681 | 2021-01-21T04:14:58 | 2021-01-21T04:14:58 | 321,056,062 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,382 | java | package net.whg.match;
import java.util.List;
import java.util.UUID;
import org.bukkit.entity.Player;
import net.whg.util.PartialReadonlyList;
/**
* Represents an active match.
*/
public class Match {
private final PartialReadonlyList<Player> players = new PartialReadonlyList<>();
private final UUID uuid;
private final int x;
private final int z;
private final int size;
private boolean active = false;
/**
* Creates a new, empty match object.
*
* @param x - The x world position of this match.
* @param z - The z world position of this match.
* @param size - The size of the match in blocks.
*/
Match(int x, int z, int size) {
this.x = x;
this.z = z;
this.size = size;
uuid = UUID.randomUUID();
}
/**
* Adds a new player to this match.
*/
void addPlayer(Player player) {
players.add(player);
}
/**
* Removes a player from this match.
*/
void removePlayer(Player player) {
players.remove(player);
}
/**
* Gets a list of all players currently in this match.
*
* @return A read-only list of all players.
*/
public List<Player> getPlayers() {
return players.readonly();
}
/**
* Starts this match.
*/
void start() {
active = true;
}
/**
* Ends this match.
*/
void end() {
active = false;
players.clear();
}
/**
* Gets whether or not this match is currently active.
*
* @return True if this match is active, false if the match has not yet started,
* or has already ended.
*/
public boolean isActive() {
return active;
}
/**
* Gets the UUID of this match.
*
* @return The uuid.
*/
public UUID getUUID() {
return uuid;
}
/**
* Gets the world x position of this match arena.
*
* @return The world x position.
*/
public int x() {
return x;
}
/**
* Gets the world z position of this match arena.
*
* @return The world z position.
*/
public int z() {
return z;
}
/**
* Gets the size of this match arena in blocks.
*
* @return The match size.
*/
public int size() {
return size;
}
}
| [
"[email protected]"
]
| |
dae503491d3a3ce40befbc102308dbf99df8b7a8 | 8ec05660fa3f096271d3c5f6b0ea25f2c465a156 | /src/main/java/org/xm/judger/parser/CNEssayInstanceParser.java | 34f8c0f5a3f4319847af8a31c377ededd6e4f743 | [
"Apache-2.0"
]
| permissive | insiston/judger | 13ca1083e20d773413d7bfa6775c22ed6e4b0d15 | 9f32c20d8eca57cf50452dcc37d2f89a9596d579 | refs/heads/master | 2021-01-11T14:25:22.623797 | 2017-02-07T09:46:14 | 2017-02-07T09:46:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,784 | java | package org.xm.judger.parser;
import org.xm.judger.domain.CNEssayInstance;
import org.xm.xmnlp.dic.DicReader;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Parse the CN essay instance
*
* @author xuming
*/
public class CNEssayInstanceParser {
/**
* match CSV-escaped double quotes
*/
public static final Pattern escapedDoubleQuote = Pattern.compile("\"\"");
public ArrayList<CNEssayInstance> parse(String filename, boolean header) {
ArrayList<CNEssayInstance> essayInstances = new ArrayList<>();
BufferedReader br;
try {
br = DicReader.getReader(filename);
String line;
while ((line = br.readLine()) != null) {
if (header == true) {
header = false;
continue;
}
CNEssayInstance essay = parseFields(line);
essayInstances.add(essay);
}
br.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return essayInstances;
}
private CNEssayInstance parseFields(String line) {
String[] fields = line.split("\t");
CNEssayInstance essay = new CNEssayInstance();
essay.id = parseInt(fields[0]);
essay.set = parseInt(fields[1]);
essay.essay = csvUnescape(fields[2]);
essay.rater1_domain1 = parseInt(fields[3]);
essay.rater2_domain1 = parseInt(fields[4]);
essay.rater3_domain1 = parseInt(fields[5]);
essay.domain1_score = parseInt(fields[6]);
if (fields.length <= 7) return essay;
essay.rater1_domain2 = parseInt(fields[7]);
if (fields.length <= 8) return essay;
essay.rater2_domain2 = parseInt(fields[8]);
if (fields.length <= 9) return essay;
essay.domain2_score = parseInt(fields[9]);
return essay;
}
private int parseInt(String input) {
if (input.equals("")) return -1;
return Integer.parseInt(input);
}
/**
* escaping of the string
*
* @param field
* @return
*/
private static String csvUnescape(String field) {
StringBuilder sb = new StringBuilder(field);
if (sb.length() > 0 && sb.charAt(0) == '"') sb.deleteCharAt(0);
if (sb.length() > 0 && sb.charAt(sb.length() - 1) == '"') sb.deleteCharAt(sb.length() - 1);
Matcher m = escapedDoubleQuote.matcher(sb);
return m.replaceAll("\"");
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.