blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8ab176666750e25183f9ec1de80e6d5c81cb040f | 559de4fc1ea72f3775f36c8ff457a4895946c3b0 | /src/main/java/am/tech42/spring/repository/JobTypeRepository.java | 8c9ce1723361650a544773977d63603e1f02f7e2 | [] | no_license | Tigran-Mkrtchyan/Work_serch_place_restful | a3842eb533f8c8f9b154a9543d9429dcf957cd30 | 869d245f88ceadfe5885888536e539d2a5dd6630 | refs/heads/master | 2022-12-17T04:42:31.712725 | 2020-09-14T10:42:56 | 2020-09-14T10:42:56 | 295,390,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package am.tech42.spring.repository;
import am.tech42.spring.model.JobType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JobTypeRepository extends JpaRepository<JobType,Integer> {
}
| [
"[email protected]"
] | |
b9f6f5308538c07f602e17a9dd7e03a0946544a0 | 2b12a81c0fd17c31528ffc5c214ea4a541cc6a99 | /src/view/Main.java | 453d74ac153005a14ffadf5818534fba073048b9 | [] | no_license | GPerego/LSystemViewer | 9ff9b16438ff1c3bf609590ff40cdd04d66708fd | 76bb0d64cf36fd50db6853055480934e455a16ff | refs/heads/master | 2021-01-13T05:19:55.742687 | 2017-02-08T14:07:15 | 2017-02-08T14:07:15 | 81,331,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package view;
import java.awt.EventQueue;
import controller.MainWindowController;
public class Main {
/**
* launches the application
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainWindowController.setMainFrame(new MainWindowController());
MainWindowController.getMainFrame().setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
| [
"[email protected]"
] | |
d42168a96de88104e12ea1887a2a4fe95a488748 | 90c92e4016cb68f3a6a39473a7d39ef618eff21e | /cloud-cipher-virtual/src/main/java/com/changhr/cloud/grpc/cipher/virtual/pack/communication/data/LicReq.java | 231c82f4fcae1f2ea0e4f72c1bb280b54b7f900c | [] | no_license | changhr2013/cloud-grpc | e9e20b7f9a8eb42e191e1fca77af834a556564a9 | 8e74626b400186e6a28b62a4596e47fa3e0e1a9f | refs/heads/master | 2023-07-19T21:26:36.308550 | 2019-11-11T10:25:00 | 2019-11-11T10:25:00 | 182,125,717 | 1 | 0 | null | 2023-07-05T20:45:24 | 2019-04-18T16:56:55 | Java | UTF-8 | Java | false | false | 1,611 | java | package com.changhr.cloud.grpc.cipher.virtual.pack.communication.data;
import com.changhr.cloud.grpc.cipher.virtual.pack.AbstractPack;
import com.changhr.cloud.grpc.cipher.virtual.pack.annotation.ColumnProperty;
import com.changhr.cloud.grpc.cipher.virtual.pack.annotation.ColumnType;
import com.changhr.cloud.grpc.cipher.virtual.pack.annotation.FieldOrder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* 6. 许可请求
*
* @author changhr
* @create 2019-06-26 16:59
*/
@ColumnProperty(type = ColumnType.OBJECT, clazz = LicReq.class)
@Getter
@Setter
@ToString
public class LicReq extends AbstractPack {
@FieldOrder(1)
@ColumnProperty(type = ColumnType.INT)
private int version;
@FieldOrder(2)
@ColumnProperty(type = ColumnType.BYTE_ARRAYS, length = 16)
private byte[] fatherLicId;
@FieldOrder(3)
@ColumnProperty(type = ColumnType.BYTE_ARRAYS, length = 16)
private byte[] ownerUserId;
@FieldOrder(4)
@ColumnProperty(type = ColumnType.BYTE_ARRAYS, length = 32)
private byte[] ownerKeyLabel;
@FieldOrder(5)
@ColumnProperty(type = ColumnType.BYTE_ARRAYS, length = 16)
private byte[] keyId;
@FieldOrder(6)
@ColumnProperty(type = ColumnType.INT)
private int reserved;
@FieldOrder(7)
@ColumnProperty(type = ColumnType.LONG)
private long timeStamp;
@FieldOrder(8)
@ColumnProperty(type = ColumnType.OBJECT, clazz = LicLimited.class)
private LicLimited licLimited;
@FieldOrder(9)
@ColumnProperty(type = ColumnType.BYTE_ARRAYS, length = 256)
private byte[] signature;
}
| [
"[email protected]"
] | |
b18bdb8f84b5fb76238f4b4c5257dbeb69ed90d1 | 750cba64679ee1bf210c514a3cc3c8a1e97129be | /app/src/test/java/com/specknet/orientandroid/ExampleUnitTest.java | 34ad59a4fd765ca698ded9f49b8f7c5a7cdce3a7 | [] | no_license | freddiejbawden/stepz | 0a04bf9969e8ab3eff1a0b01254485d87822939f | 2bb20e8142d511b6b8ab07c978f285894c5add63 | refs/heads/master | 2022-11-12T04:31:06.971577 | 2020-07-03T12:26:29 | 2020-07-03T12:26:29 | 211,893,050 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.specknet.orientandroid;
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);
}
} | [
"rat@speckled"
] | rat@speckled |
8dd18491d0866c8e65a51335d0fa0dd913051c41 | d965d9781e08857c72054bfd94d6086106da6a91 | /app/src/test/java/com/jinree/pj1/ExampleUnitTest.java | 1d91eb89047dd6fbc56c6a137e20645076c8e8b5 | [] | no_license | JinleeJeong/HyeUym_code | ec71ba0fbce521759e871727bbe2afc427f08d24 | d632da5a9db7e64719bdd1a5462791bbdfd69811 | refs/heads/master | 2020-04-07T08:07:40.881826 | 2018-11-19T10:17:57 | 2018-11-19T10:17:57 | 158,201,441 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package com.jinree.pj1;
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]"
] | |
d5faba718c416a2289fd11f7eeb2cfeca205ee3d | 7e977af5bb20217611259088747a5f60655e4138 | /06-spring-mvc-recipe/src/main/java/com/mkejeiri/recipe/domain/UnitOfMeasure.java | 2c43518404036bfa9dc3933f23b28d33bb3727e4 | [] | no_license | mkejeiri/spring-boot-sample | 19ab302caf0e4f94b531b0a6443bf84cf9266045 | 9925c37e97e69c104e9e51a023987795f36a43f1 | refs/heads/master | 2022-12-27T13:20:46.612415 | 2020-09-20T01:16:18 | 2020-09-20T01:17:51 | 287,903,745 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 683 | java | package com.mkejeiri.recipe.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class UnitOfMeasure {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "UnitOfMeasure [id=" + id + ", description=" + description + "]";
}
}
| [
"[email protected]"
] | |
957796cbc29ae16655131209900bd7e3f531dac3 | 6e10dc75f1fb1c08c5c69355b9335abd21e93662 | /refrences/dex2jar.src/com/miui/tsmclientsdk/OperationCanceledException.java | 9b433ea12fffca5ddde1379458dcd60813b18b5e | [] | no_license | heiliuer/XiaomiCard | d61e35a17c8e80e4dfaa8dfeeecb6d58906a2614 | 012a496a306469fec31dcd18cecef7bdb8dc9cc9 | refs/heads/master | 2020-05-30T19:10:49.072231 | 2017-05-10T04:14:47 | 2017-05-10T04:14:47 | 69,148,258 | 9 | 1 | null | null | null | null | UTF-8 | Java | false | false | 636 | java | package com.miui.tsmclientsdk;
public class OperationCanceledException extends Exception
{
public OperationCanceledException()
{
}
public OperationCanceledException(String paramString)
{
super(paramString);
}
public OperationCanceledException(String paramString, Throwable paramThrowable)
{
super(paramString, paramThrowable);
}
public OperationCanceledException(Throwable paramThrowable)
{
super(paramThrowable);
}
}
/* Location: d:\Users\Administrator\Desktop\111111_dex2jar.jar
* Qualified Name: com.miui.tsmclientsdk.OperationCanceledException
* JD-Core Version: 0.6.0
*/ | [
"eee"
] | eee |
1d1d9426d56ef5e7e40affda0cfa18a0b46a91f4 | 29e669f49844271e526b4509f7e7bd4525b670e7 | /src/inheritance/Gfg.java | 815cf448aa9afa97bbf4420a9138bbdad01575f2 | [] | no_license | jackapp/LearningJava | 9608534d779ca1e2c1d6badcae0b14d761c9c081 | f3fd7e054e26d99a1904c9ea21e327de348c9f9c | refs/heads/master | 2021-06-26T10:26:29.087368 | 2017-09-12T04:12:58 | 2017-09-12T04:12:58 | 103,221,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | java | package inheritance;
/**
* Created by ankur on 8/8/17.
*/
public class Gfg
{
// a final variable
// direct initialize
final int THRESHOLD = 5;
// a blank final variable
final int CAPACITY;
// another blank final variable
final int MINIMUM;
// a final static variable PI
// direct initialize
static final double PI = 3.141592653589793;
// a blank final static variable
static final double EULERCONSTANT;
// instance initializer block for
// initializing CAPACITY
{
CAPACITY = 25;
}
// static initializer block for
// initializing EULERCONSTANT
static{
EULERCONSTANT = 2.3;
}
// constructor for initializing MINIMUM
// Note that if there are more than one
// constructor, you must initialize MINIMUM
// in them also
public Gfg()
{
MINIMUM = -1;
}
public static void main(String[] args)
{
// a final reference variable sb
final StringBuilder sb = new StringBuilder("Geeks");
System.out.println(sb);
// changing internal state of object
// reference by final reference variable sb
sb.append("ForGeeks");
System.out.println(sb);
}
} | [
"[email protected]"
] | |
df807cd4321b65bdd92763e8c19f169d69ef0d55 | 5e799d221a9f26d942052f420d1aeb80dcb4b4dc | /src/main/java/org/postgresql/core/v3/BatchedQuery.java | 79d7faedd8fe9001ccbcf5a7bc3473822969d064 | [
"PostgreSQL",
"BSD-2-Clause"
] | permissive | PauloAmora/pg_jdbc_mod | e6274c2f36b5f54f42e6e71e314ce2074ffc6d76 | f947c816561c0fb75d237089350fe0dcba94e886 | refs/heads/master | 2023-07-15T14:58:15.472906 | 2021-09-01T16:41:56 | 2021-09-01T16:41:56 | 402,131,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,563 | java | /*
* Copyright (c) 2003, PostgreSQL Global Development Group
* See the LICENSE file in the project root for more information.
*/
package org.postgresql.core.v3;
import org.postgresql.core.NativeQuery;
import org.postgresql.core.ParameterList;
// import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Purpose of this object is to support batched query re write behaviour. Responsibility for
* tracking the batch size and implement the clean up of the query fragments after the batch execute
* is complete. Intended to be used to wrap a Query that is present in the batchStatements
* collection.
*
* @author Jeremy Whiting [email protected]
* @author Christopher Deckers ([email protected])
*
*/
public class BatchedQuery extends SimpleQuery {
private /* @Nullable */ String sql;
private final int valuesBraceOpenPosition;
private final int valuesBraceClosePosition;
private final int batchSize;
private BatchedQuery /* @Nullable */ [] blocks;
public BatchedQuery(NativeQuery query, TypeTransferModeRegistry transferModeRegistry,
int valuesBraceOpenPosition,
int valuesBraceClosePosition, boolean sanitiserDisabled) {
super(query, transferModeRegistry, sanitiserDisabled);
this.valuesBraceOpenPosition = valuesBraceOpenPosition;
this.valuesBraceClosePosition = valuesBraceClosePosition;
this.batchSize = 1;
}
private BatchedQuery(BatchedQuery src, int batchSize) {
super(src);
this.valuesBraceOpenPosition = src.valuesBraceOpenPosition;
this.valuesBraceClosePosition = src.valuesBraceClosePosition;
this.batchSize = batchSize;
}
public BatchedQuery deriveForMultiBatch(int valueBlock) {
if (getBatchSize() != 1) {
throw new IllegalStateException("Only the original decorator can be derived.");
}
if (valueBlock == 1) {
return this;
}
int index = Integer.numberOfTrailingZeros(valueBlock) - 1;
if (valueBlock > 128 || valueBlock != (1 << (index + 1))) {
throw new IllegalArgumentException(
"Expected value block should be a power of 2 smaller or equal to 128. Actual block is "
+ valueBlock);
}
if (blocks == null) {
blocks = new BatchedQuery[7];
}
BatchedQuery bq = blocks[index];
if (bq == null) {
bq = new BatchedQuery(this, valueBlock);
blocks[index] = bq;
}
return bq;
}
@Override
public int getBatchSize() {
return batchSize;
}
/**
* Method to return the sql based on number of batches. Skipping the initial
* batch.
*/
@Override
public String getNativeSql() {
if (sql != null) {
return sql;
}
sql = buildNativeSql(null);
return sql;
}
private String buildNativeSql(/* @Nullable */ ParameterList params) {
String sql = null;
// dynamically build sql with parameters for batches
String nativeSql = super.getNativeSql();
int batchSize = getBatchSize();
if (batchSize < 2) {
sql = nativeSql;
return sql;
}
if (nativeSql == null) {
sql = "";
return sql;
}
int valuesBlockCharCount = 0;
// Split the values section around every dynamic parameter.
int[] bindPositions = getNativeQuery().bindPositions;
int[] chunkStart = new int[1 + bindPositions.length];
int[] chunkEnd = new int[1 + bindPositions.length];
chunkStart[0] = valuesBraceOpenPosition;
if (bindPositions.length == 0) {
valuesBlockCharCount = valuesBraceClosePosition - valuesBraceOpenPosition + 1;
chunkEnd[0] = valuesBraceClosePosition + 1;
} else {
chunkEnd[0] = bindPositions[0];
// valuesBlockCharCount += chunks[0].length;
valuesBlockCharCount += chunkEnd[0] - chunkStart[0];
for (int i = 0; i < bindPositions.length; i++) {
int startIndex = bindPositions[i] + 2;
int endIndex =
i < bindPositions.length - 1 ? bindPositions[i + 1] : valuesBraceClosePosition + 1;
for (; startIndex < endIndex; startIndex++) {
if (!Character.isDigit(nativeSql.charAt(startIndex))) {
break;
}
}
chunkStart[i + 1] = startIndex;
chunkEnd[i + 1] = endIndex;
// valuesBlockCharCount += chunks[i + 1].length;
valuesBlockCharCount += chunkEnd[i + 1] - chunkStart[i + 1];
}
}
int length = nativeSql.length();
//valuesBraceOpenPosition + valuesBlockCharCount;
length += NativeQuery.calculateBindLength(bindPositions.length * batchSize);
length -= NativeQuery.calculateBindLength(bindPositions.length);
length += (valuesBlockCharCount + 1 /*comma*/) * (batchSize - 1 /* initial sql */);
StringBuilder s = new StringBuilder(length);
// Add query until end of values parameter block.
int pos;
if (bindPositions.length > 0 && params == null) {
// Add the first values (...) clause, it would be values($1,..., $n), and it matches with
// the values clause of a simple non-rewritten SQL
s.append(nativeSql, 0, valuesBraceClosePosition + 1);
pos = bindPositions.length + 1;
} else {
pos = 1;
batchSize++; // do not use super.toString(params) as it does not work if query ends with --
// We need to carefully add (...),(...), and we do not want to get (...) --, (...)
// s.append(super.toString(params));
s.append(nativeSql, 0, valuesBraceOpenPosition);
}
for (int i = 2; i <= batchSize; i++) {
if (i > 2 || pos != 1) {
// For "has binds" the first valuds
s.append(',');
}
s.append(nativeSql, chunkStart[0], chunkEnd[0]);
for (int j = 1; j < chunkStart.length; j++) {
if (params == null) {
NativeQuery.appendBindName(s, pos++);
} else {
s.append(params.toString(pos++, true));
}
s.append(nativeSql, chunkStart[j], chunkEnd[j]);
}
}
// Add trailing content: final query is like original with multi values.
// This could contain "--" comments, so it is important to add them at end.
s.append(nativeSql, valuesBraceClosePosition + 1, nativeSql.length());
sql = s.toString();
// Predict length only when building sql with $1, $2, ... (that is no specific params given)
assert params != null || s.length() == length
: "Predicted length != actual: " + length + " !=" + s.length();
return sql;
}
@Override
public String toString(/* @Nullable */ ParameterList params) {
if (getBatchSize() < 2) {
return super.toString(params);
}
return buildNativeSql(params);
}
}
| [
"[email protected]"
] | |
6358afa15b643fad621a27ce90bf89a0f82ff22f | 24d01541c1b349597810e663c127c4eb788c6e76 | /GOI31 Desktop/src/network/MulticastServer.java | 8afbfc85cf28f3d914f63f2d934d290467b9f9c4 | [] | no_license | Neasu/GOI31Desktop | 22ca32152ca07e719478bd40b65843929f17d389 | b0df7156a15acff82d6b8dc1a5b131dc76a98b30 | refs/heads/master | 2021-01-15T13:11:25.697656 | 2014-04-29T17:01:28 | 2014-04-29T17:01:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,259 | java | package network;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import core.LogLevel;
import file.LogFile;
public class MulticastServer {
// Vars
private String addresse;
private int port;
private InetAddress group;
private byte[] buffer;
private DatagramPacket packet;
private DatagramSocket socket;
// Constructors
public MulticastServer (String addr, int prt) {
addresse = addr;
port = prt;
buffer = new byte[256];
try {
group = InetAddress.getByName(addresse);
socket = new DatagramSocket(port);
} catch (Exception e) {
LogFile.getRef().textout("Couldn't make MulticastServer due to: " + e.getMessage(), LogLevel.WARNING);
}
}
// Methods
public void send (String msg) {
buffer = msg.getBytes();
packet = new DatagramPacket(buffer, buffer.length, group, port);
try {
socket.send(packet);
} catch (Exception e) {
LogFile.getRef().textout("Couldn't send message due to: " + e.getMessage(), LogLevel.WARNING);
}
}
public void close () {
socket.close();
}
public static boolean isIPAddress (String addr) {
try {
Integer.getInteger(addr.split("\\.")[0]);
} catch (Exception e) {
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
5066f7f47ab7a2a5dcd26d7888eda8dc0e29c71d | cb65032de7695c2daeb3614b3790bde284e8f39e | /src/PointandMoveableClass/MovablePoint.java | d9e6d03ec9a6585f1ba1928bbc81620fc22efaeb | [] | no_license | hieutran2811/kethua | 15785f5d63851bbb47c2da2242c5bdd5e1a5feeb | 6b816b9141658dcad60cfcc5af845870beec1d16 | refs/heads/master | 2022-04-22T07:07:47.815018 | 2020-04-17T04:34:16 | 2020-04-17T04:34:16 | 256,362,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,422 | java | package PointandMoveableClass;
public class MovablePoint extends Point{
private float xSpeed = 0.0f;
private float ySpeed = 0.0f;
private float[] Speed = new float[2];
private float[] XY = new float[2];
public MovablePoint(){
}
public MovablePoint(float xSpeed, float ySpeed){
this.xSpeed = xSpeed;
this.ySpeed = ySpeed;
}
public MovablePoint(float x, float y, float xSpeed, float ySpeed){
super(x,y);
this.xSpeed = xSpeed;
this.ySpeed = ySpeed;
}
public float getxSpeed() {
return xSpeed;
}
public void setxSpeed(float xSpeed) {
this.xSpeed = xSpeed;
}
public float getySpeed() {
return ySpeed;
}
public void setySpeed(float ySpeed) {
this.ySpeed = ySpeed;
}
public float[] getSpeed(){
this.Speed[0] = this.xSpeed;
this.Speed[1] = this.ySpeed;
return Speed;
}
public void setSpeed(float xSpeed, float ySpeed){
this.xSpeed = xSpeed;
this.ySpeed = ySpeed;
}
public float[] move(){
this.x += this.xSpeed;
this.y += this.ySpeed;
this.XY[0] = this.x;
this.XY[1] = this.y;
return XY;
}
@Override
public String toString(){
return "(" + this.Speed[0] + ", " + this.Speed[1] + "), speed = ("
+ getxSpeed() + ", " + getySpeed() + ")";
}
}
| [
"[email protected]"
] | |
c7c51878d2e49f60470b05cd3dc178bd98fe4b32 | b317128b70c8fbd1d19217aeacf75a2f07d53005 | /src/main/java/com/niuza/android/ui/common/NZBaseFragment.java | c87776f98a2aeeb59ed7d40d915966a53104b544 | [] | no_license | BenJamesbabala/niuza_2.0.12 | 7872ebb0a464c07bef32c0d1aef043cd0c332771 | 2248e822a896ee7e9d1109f3fb318f551106c368 | refs/heads/master | 2020-05-09T23:45:20.781210 | 2019-04-14T12:38:07 | 2019-04-14T12:38:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,043 | java | package com.niuza.android.ui.common;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import com.android.volley.DefaultRetryPolicy;
import com.niuza.android.R;
import com.niuza.android.ui.view.EmptyView;
//import com.umeng.analytics.MobclickAgent;
import org.szuwest.lib.BaseFragment;
import org.szuwest.utils.ScreenUtils;
public class NZBaseFragment extends BaseFragment {
protected EmptyView mEmptyView;
private ImageButton mToTopButton;
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
public void onResume() {
super.onResume();
// MobclickAgent.onPageStart(getClass().getSimpleName());
}
public void onPause() {
super.onPause();
// MobclickAgent.onPageEnd(getClass().getSimpleName());
}
public void addEmptyView() {
if (getView() != null && this.mEmptyView == null) {
this.mEmptyView = EmptyView.addEmptyViewToParent((ViewGroup) getView().findViewById(R.id.fragmentRootLayout));
}
}
public void removeEmptyView() {
if (this.mEmptyView != null && getView() != null) {
((ViewGroup) getView().findViewById(R.id.fragmentRootLayout)).removeView(this.mEmptyView);
this.mEmptyView = null;
}
}
private void addToTopButton() {
RelativeLayout fragmentRootView = (RelativeLayout) getView().findViewById(R.id.fragmentRootLayout);
this.mToTopButton = new ImageButton(getActivity());
this.mToTopButton.setImageResource(R.drawable.to_top);
this.mToTopButton.setBackgroundDrawable(null);
this.mToTopButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
NZBaseFragment.this.scrollToTop();
NZBaseFragment.this.hideToTopBtn();
}
});
LayoutParams params = new LayoutParams(-2, -2);
params.addRule(11, -1);
params.addRule(12, -1);
params.rightMargin = ScreenUtils.dip2px(15.0f);
params.bottomMargin = ScreenUtils.dip2px(15.0f);
fragmentRootView.addView(this.mToTopButton, params);
}
public void showToTopBtn() {
if (this.mToTopButton == null) {
addToTopButton();
}
if (this.mToTopButton.getVisibility() != View.VISIBLE || this.mToTopButton.getAlpha() <= 0.98f) {
this.mToTopButton.setAlpha(0.0f);
this.mToTopButton.setVisibility(View.VISIBLE);
this.mToTopButton.animate().alpha(DefaultRetryPolicy.DEFAULT_BACKOFF_MULT).setDuration(300).setListener(new AnimatorListener() {
public void onAnimationStart(Animator animation) {
}
public void onAnimationEnd(Animator animation) {
}
public void onAnimationCancel(Animator animation) {
}
public void onAnimationRepeat(Animator animation) {
}
});
}
}
public void hideToTopBtn() {
if (this.mToTopButton != null && this.mToTopButton.getVisibility() == View.VISIBLE) {
this.mToTopButton.animate().alpha(0.0f).setDuration(300).setListener(new AnimatorListener() {
public void onAnimationStart(Animator animation) {
}
public void onAnimationEnd(Animator animation) {
NZBaseFragment.this.mToTopButton.setVisibility(View.INVISIBLE);
}
public void onAnimationCancel(Animator animation) {
}
public void onAnimationRepeat(Animator animation) {
}
});
}
}
public void scrollToTop() {
}
}
| [
"[email protected]"
] | |
cf1be45020959795e6976bca22cda9c7d867b163 | 2d2a04a565ce355a23de684efb8492a5ce86b657 | /untitled/src/Stuff.java | f13937e7c9b9ea76cf32727766b2719d3cd9df66 | [] | no_license | alexdoan3011/DST | a09c2c9d1d49de90e972dba9360334f069c0ca2d | 4fc8b769c90bcddf79cc203da2e6dde2ce2e6270 | refs/heads/master | 2020-12-09T11:34:27.197412 | 2020-01-11T20:25:43 | 2020-01-11T20:25:43 | 233,292,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | public class Stuff {
private static final double x = 0.8;
int n;
private String s = "Not Set";
public Stuff(int n) {
this.n = n / 5;
}
public void ChangeString(String s) {
s = "Revised";
System.out.println(s);
}
public void doSomething(double d) {
n = (int) d * 2;
System.out.println(this);
n = (int) doSomeMore();
}
private double doSomeMore() {
double d = n * x;
System.out.println(d);
return d;
}
public String toString() {
return "Stuff has " + n + " and " + s;
}
} | [
"[email protected]"
] | |
2c0927213ffc8a698c4c1c316575073724c3e208 | 1569253571f14852876ba14f6a48d36357912213 | /src/Def.java | 0186e12a3e065433ba68c1855220b40236bf03be | [] | no_license | asdqwe4665/pong | 9d93c94ef6a53b195650d5a26f5a378ae91656ab | b9d153fe2e181499a6e3f802daf698efa5c72d67 | refs/heads/master | 2023-05-12T03:35:04.434738 | 2021-06-01T17:03:27 | 2021-06-01T17:03:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | import java.awt.*;
public class Def {
static final int GAME_WIDTH = 1000;
static final int GAME_HEIGHT = (int)(GAME_WIDTH* (0.5555));
static final Dimension SCREEN_SIZE = new Dimension(GAME_WIDTH,GAME_HEIGHT);
static final int BALL_DIAMETER = 20;
static final int PADDLE_WIDTH = 25;
static final int PADDLE_HEIGHT = 100;
static final int SPEED_PADDLE = 10;
}
| [
"asdqwe4665"
] | asdqwe4665 |
fae37025c31916569209d31bc28684ea97496738 | e1843d10311ac334746f184999c8946d603a54a0 | /a4/solutions/FunctionalFun.java | 6fbebe5775a04a4f57cd9c18a2799aaf1ca4a22a | [] | no_license | mdesco18/226csc | e98334523ed6857c863bfc2779d76b68238a5978 | 444ea3a28f9efc64752751d361c2be4baca63cf8 | refs/heads/master | 2021-10-10T17:40:58.603400 | 2019-01-15T00:12:03 | 2019-01-15T00:12:03 | 119,773,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | // Kattis problem "Functional Fun" 2.3
// Type: Mathy, hashing.
// Comment: Use in CSC 226
import java.util.*;
class FunctionalFun {
public static void main ( String[] args ) {
Scanner in = new Scanner( System.in );
while (in.hasNext()) {
boolean injective=true, surjective=false, notfunction=false;
int Rhit=0; // number of values in f(D)
HashSet<String> Ds = new HashSet<String>(); // domain
HashSet<String> Rs = new HashSet<String>(); // range
String[] D = in.nextLine().split(" ");
String[] R = in.nextLine().split(" ");
int N = in.nextInt(); in.nextLine();
for (int n=0; n<N; ++n) {
String[] F = in.nextLine().split(" ");
if (Ds.contains(F[0])) notfunction = true;
else {
Ds.add(F[0]);
if (Rs.contains(F[2])) injective = false;
else { Rs.add(F[2]); ++Rhit; }
}
}
if (Rhit == R.length-1) surjective = true;
if (notfunction) System.out.println( "not a function" ); else
if (injective && surjective) System.out.println( "bijective" ); else
if (injective) System.out.println( "injective" ); else
if (surjective) System.out.println( "surjective" ); else
System.out.println( "neither injective nor surjective" );
}
}
}
| [
"[email protected]"
] | |
163be31ae822f7bf349c90d40fc5bfef475b9a19 | 4755c02f3a47d0164ed177583cd79becb487275d | /src/main/java/com/sagar/leetcode/array/LongestPeak.java | 683846851c5f8b0ea027bb071cbf193625171dd0 | [] | no_license | kelvinator07/DS_ALGO | 148a8b7289544f52cc5b11fba7ec3c15bdea0e20 | 7773e11f29b0475156e1673519a7fcb26fc296b4 | refs/heads/master | 2023-05-03T18:03:09.110869 | 2021-05-25T09:12:47 | 2021-05-25T09:12:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | package com.sagar.leetcode.array;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
public class LongestPeak {
public static void main(String[] args) {
// int[] a = { 5, 4, 3, 2, 1, 2, 1 };
// System.out.println(longestPeak(a));
}
public static int longestPeak(int[] array) {
int peak = 1;
int result = 0;
boolean isAscending = array[0] < array[1];
for (int i = 0; i < array.length - 1; i++) {
if (isAscending && array[i] < array[i + 1]) {
peak++;
} else if (array[i] >= array[i + 1]) {
isAscending = false;
peak++;
} else {
isAscending = true;
peak++;
if (result < peak) {
result = peak;
}
peak = 1;
}
}
return Math.max(result, peak) >= 3 ? Math.max(result, peak) : 0;
}
}
| [
"[email protected]"
] | |
69f5e8e51d47ed45d2430d29120a47f0a7b2c51b | e317bd44e48fb21f75c968bda048ab545fc024d8 | /src/cn/edu/scu/dke/idsp/util/SubBitSetList.java | f36a52d72445bfd817059fb579138df8c43769f9 | [] | no_license | wsgan001/tCSP-Miner | 3343f58b0bcd232334d44dad71442d2ae0021883 | 97e680bf6b36fa72792dc1f01db668cb9a470a17 | refs/heads/master | 2020-03-27T06:32:37.937578 | 2016-03-07T14:32:19 | 2016-03-07T14:32:19 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 750 | java | package cn.edu.scu.dke.idsp.util;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashSet;
/**
* author: Hao
* date:2015Äê3ÔÂ6ÈÕ
* time:ÏÂÎç3:29:59
* purpose: Get the all sub BitSet of a BitSet
*/
public enum SubBitSetList {
INSTANCE;
public ArrayList<BitSet> getSub(BitSet o) {
ArrayList<BitSet> subList = new ArrayList<BitSet>();
subList.add(o);
for (int i = o.nextSetBit(0); i >= 0; i = o.nextSetBit(i + 1)) {
HashSet<BitSet> newBS = new HashSet<BitSet>();
for(BitSet copy:subList){
BitSet clone = (BitSet)copy.clone();
clone.set(i, false);
if(clone.cardinality() != 0)
newBS.add(clone);
}
subList.addAll(newBS);
}
return subList;
}
}
| [
"[email protected]"
] | |
75f31710d5ffe66209129e545a4571624c40457b | 7d9f84b9fb47fa5a88dad15fd26158214264fee7 | /ftc_app-master4.2/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/AutoBeginningsPart9ANNOTATED.java | a5b32a323049816d427aec1a83b4a98d5fb931a1 | [
"BSD-3-Clause"
] | permissive | CAOs-Robotics-14338/2018-19-Rover-Ruckus-Final-Code | 17379efb84beb639cc4f5ec4c4a668e69a955563 | c2124603dbf2d5d2071c91955c891a2e814d2def | refs/heads/master | 2020-08-03T00:11:14.678558 | 2019-09-28T21:31:55 | 2019-09-28T21:31:55 | 211,557,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,322 | java | /* Copyright (c) 2017 FIRST. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted (subject to the limitations in the disclaimer below) provided that
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of FIRST nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.firstinspires.ftc.teamcode;
import com.disnodeteam.dogecv.CameraViewDisplay;
import com.disnodeteam.dogecv.DogeCV;
import com.disnodeteam.dogecv.detectors.roverrukus.GoldAlignDetector;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DigitalChannel;
import com.qualcomm.robotcore.hardware.Servo;
//Goal is to decrease the time for sampling to be able to go to the crater
/**
* This file illustrates the concept of driving a path based on encoder counts.
* It uses the common Pushbot hardware class to define the drive on the robot.
* The code is structured as a LinearOpMode
*
* The code REQUIRES that you DO have encoders on the wheels,
* otherwise you would use: PushbotAutoDriveByTime;
*
* This code ALSO requires that the drive Motors have been configured such that a positive
* power command moves them forwards, and causes the encoders to count UP.
*
* The desired path in this example is:
* - Drive forward for 48 inches
* - Spin right for 12 Inches
* - Drive Backwards for 24 inches
* - Stop and close the claw.
*
* The code is written using a method called: encoderDrive(speed, leftInches, rightInches, timeoutS)
* that performs the actual movement.
* This methods assumes that each movement is relative to the last stopping place.
* There are other ways to perform encoder based moves, but this method is probably the simplest.
* This code uses the RUN_TO_POSITION mode to enable the Motor controllers to generate the run profile
*
* Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
* Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
*/
@Autonomous(name="Auto Beginnings Part 9 ANNOTATED", group="Pushbot")
@Disabled
public class AutoBeginningsPart9ANNOTATED extends LinearOpMode {
//Declaring objects to be able to control the different systems later
//limit switch object
DigitalChannel digitalTouch; // Hardware Device Object
//climb motor object
private DcMotor climbMotor = null;
//drive system motors
private DcMotor leftMotor = null;
private DcMotor rightMotor = null;
private DcMotor centerDrive = null;
double climbPower;
// creating an object from other classes to be able to use with easy method calling
MarkerDeployment deploy = new MarkerDeployment();
//declaring servo for marker deployment system
Servo marker;
//using encoder class for encoder math
Encoders encoders = new Encoders();
//creating object of the vision class
private GoldAlignDetector detector;
@Override
public void runOpMode() {
//SET UP VISION
detector = new GoldAlignDetector();
detector.init(hardwareMap.appContext, CameraViewDisplay.getInstance());//, 1, false);
detector.useDefaults();
// Optional Tuning
detector.alignSize = 100; // How wide (in pixels) is the range in which the gold object will be aligned. (Represented by green bars in the preview)
detector.alignPosOffset = 0; // How far from center frame to offset this alignment zone.
detector.downscale = 0.4; // How much to downscale the input frames
detector.areaScoringMethod = DogeCV.AreaScoringMethod.MAX_AREA; // Can also be PERFECT_AREA
//detector.perfectAreaScorer.perfectArea = 10000; // if using PERFECT_AREA scoring
detector.maxAreaScorer.weight = 0.005;
detector.ratioScorer.weight = 5;
detector.ratioScorer.perfectRatio = 1.0;
//enables detector
detector.enable();
//gets location of motors in expansion hub from the robot controller
leftMotor = hardwareMap.get(DcMotor.class, "left_drive");
rightMotor = hardwareMap.get(DcMotor.class, "right_drive");
centerDrive = hardwareMap.get(DcMotor.class, "center_drive");
//sets motor direction so the motors go the same direction when on the robot.
leftMotor.setDirection(DcMotor.Direction.FORWARD);
rightMotor.setDirection(DcMotor.Direction.REVERSE);
centerDrive.setDirection(DcMotor.Direction.REVERSE);
//Limit Switch
//gets sensor location
digitalTouch = hardwareMap.get(DigitalChannel.class, "sensor_digital");
//sets mode to receive input
digitalTouch.setMode(DigitalChannel.Mode.INPUT);
//gets the servo for marker deployment location
marker = hardwareMap.servo.get("deploy_marker");
//Climber
// gets the climb motor location and sets the climb power
climbMotor = hardwareMap.get(DcMotor.class, "climb_motor");
climbMotor.setDirection(DcMotor.Direction.REVERSE);
climbPower = -0.75;//-0.5
waitForStart();//waits for the start button to signal the start of autonomous
String pathTaken = "";//path taken variable is used to determine what path the robot took based on sampling during auto
// to help decide what the next steps should be for autonomous.
while (opModeIsActive()) {
/* AUTO STEPS:
--Start in collapsed state with climb collapsed
--Auto mode starts and robot descends and goes sideways to detach from lander.
--Samples Minerals
-- Goes to depot and deploys marker
-- Makes a beeline to the crater.
*/
boolean descend = true;
// descend from lander
while(descend) { //while the robot should still descend
telemetry.addData("Digital Touch", "Is Not Pressed");//print to drive station
climbMotor.setPower(climbPower);//set climb motor to climb power
telemetry.update();//update the telemetry so the message will show up
if (digitalTouch.getState()){//see if the limit switch is pressed
climbMotor.setPower(0);//if limit switch pressed stop climb motor
descend = false; //set descend to false to stop loop
}
}
sleep(250);
//slide sideways to get unattached
slideLeft(2.5);
sleep(500);//1000
//move the climber hook down to avoid the limit switch issue
/* We were experiencing issues that if the limit switch was pressed then expansion hub had trouble with power
* To fix this issue I coded autonomous to lower the climber hook so the limit switch wouldn't be press that way there
* would be no problems with it being pressed.
* Basically, I just coded it to do the opposite of what it did for descending
* */
boolean rescend = true;//rescend the climber hook. Bring climber hook down so the limit switch is not pressed.
while(rescend){//while rescending climber hook
telemetry.addData("Digital Touch", "Is Pressed");//add data to drive station
climbMotor.setPower(-climbPower); //set the motor to reversed power
telemetry.update(); //update telemetry to add data
if(digitalTouch.getState() == false){ //if the limit switch is not pressed
climbMotor.setPower(0);//stop the motor
rescend = false; //set rescending to false to exit the loop
}
}
//lower climber hook 2 inches
// gos forward to sample
driveForward(15);
sleep(1000);
//
//\\\SAMPLING ///\\\///////////////////////////////////////////////////////////////////////////////////////////////////
if (detector.isFound()) {//if the detector can see a gold mineral
//CAN SEE GOLD
telemetry.addData("Sees the mineral", " ");//add to drive station
telemetry.update();
sleep(250);
if (detector.getAligned()) {//is robot aligned with gold mineral?
telemetry.addData("Gold Mineral is in center --> move accordingly", detector.getXPosition());
telemetry.addData("Move forward", ' ');
pathTaken = "CENTER";//set path taken so it remembers what sampling path it took
driveForward(36);//drive forward to knock mineral off of mark
sleep(3000);
} else { //the robot is not aligned with gold mineral
while (!detector.getAligned()) { //while robot is not aligned with mineral
telemetry.addData("Not Aligned", " ");//print not aligned
telemetry.update();
align();//align with gold mineral
}
driveForward(36);//drive forward to knock mineral off of mark
sleep(3000);
pathTaken = "CENTER";//set path taken so it remembers what sampling path it took
}
} else { //Since the detector can not see a gold mineral, == See if gold is on the left
telemetry.addData("Not Found", " ");
telemetry.update();
slideLeft(12.5);//slide to the left to see if there is a gold mineral
sleep(2000);
if (detector.isFound()) { //if it sees a gold mineral
telemetry.addData("Found on Left", " ");
pathTaken = "LEFT"; //set path taken to left so it remembers what path it took
telemetry.update();//update telemetry
while (!detector.getAligned()){//while the robot is not aligned with gold
align(); //align with gold mineral
}
sleep(2000);
driveForward(25); //drive forward to knock mineral off of tape
sleep(2000);//3
} else { //The detector could not find gold mineral on left so it goes to the right
telemetry.addData("Not found on left", " going right");
telemetry.update();
slideRight(30);//slides right
sleep(4200);
pathTaken="RIGHT"; //set path taken to remember the path
if (detector.isFound()) { //if the gold mineral is seen
telemetry.addData("Found on Right", " ");
telemetry.update();
while (!detector.getAligned()){ //while robot not aligned with gold mineral
align(); //align with gold mineral
}
sleep(1000);
driveForward(25);//drive forward to knock mineral off of place
sleep(1850);
}
else{ //in the apocalyptic case that the mineral is not found
driveForward(25);//drive forward
sleep(1700);
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Sampling Over
//Get position taken and get to depot
//drive toward depot framework, deploy marker, and then head to crater
telemetry.addData("Path Taken: ", pathTaken); //add the pathTaken data to see what the value of pathTaken is
telemetry.update();
sleep(100);
//Frame work for second half of autonomous
//Based on what the pathTaken value is the program with run the corresponding
/* The methods like driveForward move the robot like stated for that number of inches
*/
if (pathTaken.equals("RIGHT")){
/*
driveForward(6);
sleep(500);*/
turnLeft(43);//40 //45
sleep(1000);
driveForward(15);//21
sleep(1000);
deploy.deployMarker(marker);//using deploy marker method from the MarkerDeployment Class to deploy marker
sleep(500);//1000
driveBackward(6);
sleep(500);
turnLeft(96);//94
sleep(2500);
driveForward(12);
sleep(500);//1000
turnLeft(15);
sleep(1000);
slideRight(7.5);//5.5//3.5
sleep(1000);//500
driveForward(68, .75);//62 distance
deploy.setMarkerPostitionToDeploy(marker); //sets the marker deployer arm out to cross plane of crater
sleep(7000);
driveForward(4,.30);
sleep(1000);
}
else if (pathTaken.equals("LEFT")) {
//run left tasks to get to depot and then crater
// driveForward(6);
turnRight(50);
sleep(1000);
driveForward(16);
sleep(1000);
deploy.deployMarker(marker);//using deploy marker method from the MarkerDeployment Class to deploy marker
sleep(500);
driveBackward(6);
sleep(500);
/* slideLeft(4);
sleep(500);//300*/
turnLeft(184);//94
sleep(2600);
//driveForward(12);
//sleep(500);//1000
slideRight(16.0);//6
sleep(1500);//500
driveForward(62, .75);
deploy.setMarkerPostitionToDeploy(marker); //sets the marker deployer arm out to cross plane of crater
sleep(6000);
driveForward(4,.30);
sleep(1000);
}
else{// == "CENTER"
//deploy marker
deploy.deployMarker(marker);//using deploy marker method from the MarkerDeployment Class to deploy marker
sleep(500);
driveBackward(6);
sleep(500);
turnLeft(85);//94
sleep(2500);
driveForward(12);
sleep(1000);//1000
turnLeft(90);//45
sleep(1000);
slideRight(6);
sleep(1000);//1000
driveForward(60, .75);
deploy.setMarkerPostitionToDeploy(marker);//sets the marker deployer arm out to cross plane of crater
sleep(6000);
driveForward(4,.30);
sleep(1000);
}
//deploy
sleep(500);
stop(); //stops the opmode so it ends the autonomous
}
}
public void align() {
if ((detector.getXPosition() > 0) && (detector.getXPosition() < detector.getAlignXMin())) { // if the gold mineral is on the left side of the alignment move left
telemetry.addData("Gold Mineral is on the left --> move accordingly", detector.getXPosition());
telemetry.addData("Move to the left", 300 - detector.getXPosition());
slideLeft(1.0);
sleep(250);//500
} else if (detector.getXPosition() > detector.getAlignXMax()) { //if the gold mineral is on the right side of the alignment move right
telemetry.addData("Gold Mineral is on the right --> move accordingly", detector.getXPosition());
//new addition
telemetry.addData("Move to the right", detector.getXPosition() - 300);
slideRight(1.0);//1.0
sleep(250);//500
}
}
///FUNCTIONS FOR DRIVING THE ROBOT AROUND WITH ENCODERS
/*
These methods use the encoder methods from the Encoder Class.
See Encoder class for more descriptions of encoder math
In order to get the encoders to work, you need to:
-- Stop and Reset the Encoders
-- Set them to run to a position
-- Give them the target number of ticks the encoder needs to make
-- Set the Power of the motor.
*/
public void turnRight(double degrees){
int inches_needed = encoders.encoderTicksTurn(degrees);
int ticks = encoders.encoderTicksDrive(inches_needed);
leftMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
///left forward, right backward
leftMotor.setTargetPosition(-ticks);
rightMotor.setTargetPosition(ticks);
leftMotor.setPower(0.5);
rightMotor.setPower(0.5);
}
public void turnLeft(double degrees){
int inches_needed = encoders.encoderTicksTurn(degrees);
int ticks = encoders.encoderTicksDrive(inches_needed);
leftMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
///left backward, right forward
leftMotor.setTargetPosition(ticks);
rightMotor.setTargetPosition(-ticks);
leftMotor.setPower(0.5);
rightMotor.setPower(0.5);
}
public void driveForward(double inches){//WORKS
int ticks = encoders.encoderTicksDrive(inches);
leftMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
leftMotor.setTargetPosition(-ticks);
rightMotor.setTargetPosition(-ticks);
leftMotor.setPower(0.6);//.5
rightMotor.setPower(0.6);//.5
}
public void driveForward(double inches, double power){//WORKS
int ticks = encoders.encoderTicksDrive(inches);
leftMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
leftMotor.setTargetPosition(-ticks);
rightMotor.setTargetPosition(-ticks);
leftMotor.setPower(power);
rightMotor.setPower(power);
}
public void driveBackward(double inches){
int ticks = encoders.encoderTicksDrive(inches);
leftMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
leftMotor.setTargetPosition(ticks);
rightMotor.setTargetPosition(ticks);
leftMotor.setPower(0.6);//.5
rightMotor.setPower(0.6);
}
public void slideLeft(double inches){
int ticks = encoders.encoderTicksCenter(inches);
centerDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
centerDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);
centerDrive.setTargetPosition(ticks);
centerDrive.setPower(0.2);//.3
}
public void slideRight(double inches){
int ticks = encoders.encoderTicksCenter(inches);
centerDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
centerDrive.setMode(DcMotor.RunMode.RUN_TO_POSITION);
centerDrive.setTargetPosition(-ticks);
centerDrive.setPower(0.2);//.3
}
public void rotateRight(double inches){//WORKS
int ticks = encoders.encoderTicksDrive(inches);
telemetry.addData("Rotate", ticks);
telemetry.update();
leftMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
leftMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
leftMotor.setTargetPosition(ticks);
leftMotor.setPower(0.5);
sleep(2000);
}
public void rotateLeft(double inches){//WORKS
int ticks = encoders.encoderTicksDrive(inches);
telemetry.addData("Rotate", ticks);
telemetry.update();
rightMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
rightMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);
rightMotor.setTargetPosition(ticks);
rightMotor.setPower(0.5);
sleep(2000);
}
} | [
"[email protected]"
] | |
15ce2ed2c66e7c6d572db6f7b4a5e2a8a8895ca2 | e20e9069597c1107348350922f8d8e83623209cf | /src/br/edu/ifsp/spo/lp1a3/simple_bank/SaldoZeroException.java | ee5c2d718dea0f0999213599c3fad3179981831f | [] | no_license | luis242/aaaa | fe51e78f1dffa9e7a78122936382800963a2594d | 8fa67bfeb1c49b4e6d23866135aff59cbed23c18 | refs/heads/master | 2020-05-05T05:19:02.363232 | 2019-04-05T20:44:50 | 2019-04-05T20:44:50 | 179,746,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | package br.edu.ifsp.spo.lp1a3.simple_bank;
public class SaldoZeroException extends RuntimeException{
public SaldoZeroException(String msg) {
super(msg);
}
} | [
"[email protected]"
] | |
82a0066f8a13591fd5c9070cd18d5ae0c79896ab | c5254a0b2d3ec92f32517f5fa3dc439c1a7a70ee | /old/command/Invoker.java | 292052de41d5b7786f87e5a3e49c8dfd8f0fb79a | [] | no_license | Tralo/PatternStudy | af86ec3fafbaa431fc9e14fb84766a72e39c39dc | 16d001620cbb40f136122e7c52d7fa68f9d9178f | refs/heads/master | 2020-12-07T20:24:45.770237 | 2017-02-01T07:52:01 | 2017-02-01T07:52:01 | 66,948,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 276 | java | package command;
public class Invoker {
private Command command;
public Command getCommand() {
return command;
}
public void setCommand(Command command) {
this.command = command;
}
// 执行客户的命令
public void action() {
this.command.execute();
}
}
| [
"[email protected]"
] | |
ddc85f76a4c0bce2e34efd056bfa4a0a4ca55afd | 941f7b0cf7fef51c467c32f596bd668b37834ce7 | /Tienda_Generica_Grupo_9/Tienda_Generica_Grupo_9/src/main/java/com/Tienda_Generica/DAO/Conexion.java | 7dad1b32f9e4baeb2c5052561f60fce8913ba47c | [] | no_license | gandalfblue/Grupo_9_Scrum_2_Ciclo_3 | 9132728b29325c2750d3e78b29c2ca79a82bee55 | a6c3c273852fdccce9d7101a91f2b0a1914e679d | refs/heads/main | 2023-08-26T04:58:11.005450 | 2021-11-11T02:55:10 | 2021-11-11T02:55:10 | 408,000,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,550 | java | package com.Tienda_Generica.DAO;
import java.sql.*;
import java.util.logging.Logger;
/**
* Clase que permite conectar con la base de datos
*/
public class Conexion {
Logger logger= Logger.getLogger("com.roca12.misiontic2022.tiendalostiburones.DAO.Conexion");
/** Parametros de conexion */
static String nombre_base_datos = "g9e2";
//root
static String usuariobd = "admin";
//mintic
static String clavebd = "minticroca";
//127.0.0.1 == localhost
static String url = "jdbc:mariadb://tiendasgenericasdr-g9-g38-53.czo3ixoe3xoe.us-east-1.rds.amazonaws.com/" + nombre_base_datos;
//objeto sin inicializar de la conexión
Connection connection = null;
/** Constructor de DbConnection */
public Conexion() {
try {
// obtenemos el driver de para mysql
Class.forName("org.mariadb.jdbc.Driver");
// obtenemos la conexión
connection = DriverManager.getConnection(url, usuariobd, clavebd);
//si hay conexión correcta mostrar información en consola
if (connection != null) {
System.out.println("Conexión a base de datos "
+ nombre_base_datos + " OK\n");
}
} catch (SQLException e) {
//error de la base de datos
System.out.println(e);
} catch (ClassNotFoundException e) {
//error en carga de clases
System.out.println(e);
} catch (Exception e) {
//cualquier otro error
System.out.println(e);
}
}
/** Permite retornar la conexión */
public Connection getConnection() {
return connection;
}
//cerrando la conexión
public void desconectar() {
connection = null;
}
} | [
"[email protected]"
] | |
c2243e79db8256cd91522e609f2660b110676b32 | 5f9fd45ee0783599c95d0764cad0f55351a83f9a | /sdsai-itrex/src/test/java/com/github/basking2/sdsai/itrex/iterators/SplitMapJoinIteratorTest.java | 349fbc56645f1356747a1b5323dcd57eca78b8b1 | [
"MIT"
] | permissive | t-rasmud/sdsai | 012049b6fd6df610a86f25f631310766a6de04a4 | 04a1bea9340ec0f7a7da2802f3e4167e5eab8e08 | refs/heads/main | 2023-03-22T20:28:07.594733 | 2020-11-18T23:13:32 | 2020-11-18T23:13:32 | 349,528,629 | 0 | 0 | MIT | 2021-03-19T19:04:01 | 2021-03-19T19:04:00 | null | UTF-8 | Java | false | false | 2,654 | java | package com.github.basking2.sdsai.itrex.iterators;
import org.junit.Test;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.function.Function;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Test {@link Iterators#splitMapJoinIterator(ExecutorService, Iterator, Function, MappingIterator.Mapper)}.
*/
public class SplitMapJoinIteratorTest {
@Test
public void testSplitMapJoinSingleThread() throws ExecutionException, InterruptedException {
final ExecutorService es = Executors.newFixedThreadPool(1);
final Future<?> f = es.submit(() -> {
final List<Integer> actualList = Iterators.toList(Iterators.splitMapJoinIterator(
es,
new RangeIterator(0, 10, 1),
(i) -> i % 3,
(i) -> i
));
final Integer[] expectedList = Iterators.toList(
new RangeIterator(0,10, 1)).toArray(new Integer[0]);
assertThat(actualList, hasItems(expectedList));
return ;
});
f.get();
es.shutdown();
}
@Test
public void testSplitMapJoinTwoThreads() throws ExecutionException, InterruptedException {
final ExecutorService es = Executors.newFixedThreadPool(2);
final Future<?> f = es.submit(() -> {
final List<Integer> actualList = Iterators.toList(Iterators.splitMapJoinIterator(
es,
new RangeIterator(0, 10, 1),
(i) -> i % 3,
(i) -> i
));
final Integer[] expectedList = Iterators.toList(
new RangeIterator(0,10, 1)).toArray(new Integer[0]);
assertThat(actualList, hasItems(expectedList));
return;
});
f.get();
es.shutdown();
}
@Test
public void testSplitMapJoinTwoThreadsAndMain() {
final ExecutorService es = Executors.newFixedThreadPool(2);
final List<Integer> actualList = Iterators.toList(Iterators.splitMapJoinIterator(
es,
new RangeIterator(0, 10, 1),
(i) -> i % 3,
(i) -> i
));
final Integer[] expectedList = Iterators.toList(
new RangeIterator(0,10, 1)).toArray(new Integer[0]);
es.shutdown();
assertThat(actualList, hasItems(expectedList));
}
}
| [
"[email protected]"
] | |
cccb8502ac373d641b5b1cffb67828417c3bbd80 | b3340278e580c55f3f2158ed93147b2872bc013b | /app/src/test/java/com/example/davidsantos/materialdesign1/ExampleUnitTest.java | 1d9db133fad870e00cabf0a1faf76f9266ca2194 | [] | no_license | davidgomesdh/materialDesign | d01c4cf11f6082703ed0464310bdd34f494a62eb | a29ac76bbf1f70c447abb00ac137bf60c641d891 | refs/heads/master | 2021-04-27T02:17:09.505662 | 2018-02-24T02:06:06 | 2018-02-24T02:06:06 | 122,693,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.example.davidsantos.materialdesign1;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
e274fd1046a422b8083ba5b424556ed7bca00a7e | 5506e9307dada63c20d92c24feac70b9e5516d83 | /Java/9.PalindromeNumber/Solution.java | f9ed1d009b726960c38ce6d492df7e855139055f | [] | no_license | chris-zhang-procore/leetcode | c62b506dcd03bd33a92fa654ab2168c0fb8b05af | 821dd2ae538e51a9ba370dda6b7f0fd482f6fda3 | refs/heads/master | 2021-06-28T13:11:28.331998 | 2017-09-19T04:32:58 | 2017-09-19T04:32:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | public class Solution {
public boolean isPalindrome(int x) {
if(x < 0 || (x != 0 && x % 10 == 0)) return false;
int right = 0;
while(x > right) {
right = right * 10 + x % 10;
x /= 10;
}
return right == x && right / 10 == x;
}
// Reverse the number and compare it to the original one
// public boolean isPalindrome(int x) {
// if(x < 0) return false;
// int num = x;
// long sum = 0;
//
// while(x != 0) {
// sum = (sum * 10 + x % 10);
// x /= 10;
// }
//
// return sum == num;
// }
} | [
"[email protected]"
] | |
40782348fb75e81bf5c89138f284a7f06f9b33b7 | 62774e6de56acf8c4d4d014f1f5ee709feef6502 | /resident-evil/src/main/java/com/mkolongo/residentEvil/domain/entities/BaseEntity.java | 49afa1b6ac19f5ba3277bdbd8c2373657149b104 | [] | no_license | Chris-Mk/Hibernate | 35a9c42679ad6d20925c96d6d3929ad86649f700 | eb338734c0136d5292e06f7ab2688e4fda31d93c | refs/heads/master | 2023-07-24T00:20:36.222180 | 2023-07-19T19:29:16 | 2023-07-19T19:29:16 | 205,900,454 | 0 | 0 | null | 2023-07-19T19:29:18 | 2019-09-02T16:56:37 | Java | UTF-8 | Java | false | false | 400 | java | package com.mkolongo.residentEvil.domain.entities;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
@Getter
@Setter
@MappedSuperclass
public class BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
}
| [
"[email protected]"
] | |
555baafa35ec02a27a4bc3bc7e6fdfd38651e732 | 494a9b401cf163e268987149375224350cc5f201 | /app/src/main/java/com/zhy/autolayout/utils/AutoUtils.java | 02064eb3e64aa780c2ef687f88c5a435d9c73ff4 | [] | no_license | MakerYan/Fragment_Framework | d3b246228d4e00e83995516fa3145ae91573bc6c | c139a1ba695804b8568bfce6ee538cee3b9c50b8 | refs/heads/master | 2020-12-30T16:27:10.878996 | 2017-05-11T13:21:55 | 2017-05-11T13:21:55 | 90,980,148 | 16 | 7 | null | 2017-05-11T13:21:56 | 2017-05-11T13:06:08 | null | UTF-8 | Java | false | false | 4,034 | java | package com.zhy.autolayout.utils;
import android.view.View;
import com.makeryan.lib.R;
import com.zhy.autolayout.AutoLayoutInfo;
import com.zhy.autolayout.attr.Attrs;
import com.zhy.autolayout.attr.AutoAttr;
import com.zhy.autolayout.config.AutoLayoutConifg;
/**
* Created by zhy on 15/12/4.
*/
public class AutoUtils {
/**
* 会直接将view的LayoutParams上设置的width,height直接进行百分比处理
*
* @param view
*/
public static void auto(View view) {
autoSize(view);
autoPadding(view);
autoMargin(view);
autoTextSize(
view,
AutoAttr.BASE_DEFAULT
);
}
/**
* @param view
* @param attrs
* #Attrs.WIDTH|Attrs.HEIGHT
* @param base
* AutoAttr.BASE_WIDTH|AutoAttr.BASE_HEIGHT|AutoAttr.BASE_DEFAULT
*/
public static void auto(View view, int attrs, int base) {
AutoLayoutInfo autoLayoutInfo = AutoLayoutInfo.getAttrFromView(
view,
attrs,
base
);
if (autoLayoutInfo != null) {
autoLayoutInfo.fillAttrs(view);
}
}
public static void autoTextSize(View view) {
auto(
view,
Attrs.TEXTSIZE,
AutoAttr.BASE_DEFAULT
);
}
public static void autoTextSize(View view, int base) {
auto(
view,
Attrs.TEXTSIZE,
base
);
}
public static void autoMargin(View view) {
auto(
view,
Attrs.MARGIN,
AutoAttr.BASE_DEFAULT
);
}
public static void autoMargin(View view, int base) {
auto(
view,
Attrs.MARGIN,
base
);
}
public static void autoPadding(View view) {
auto(
view,
Attrs.PADDING,
AutoAttr.BASE_DEFAULT
);
}
public static void autoPadding(View view, int base) {
auto(
view,
Attrs.PADDING,
base
);
}
public static void autoSize(View view) {
auto(
view,
Attrs.WIDTH | Attrs.HEIGHT,
AutoAttr.BASE_DEFAULT
);
}
public static void autoSize(View view, int base) {
auto(
view,
Attrs.WIDTH | Attrs.HEIGHT,
base
);
}
public static boolean autoed(View view) {
Object tag = view.getTag(R.id.id_tag_autolayout_size);
if (tag != null) {
return true;
}
view.setTag(
R.id.id_tag_autolayout_size,
"Just Identify"
);
return false;
}
public static float getPercentWidth1px() {
int screenWidth = AutoLayoutConifg.getInstance()
.getScreenWidth();
int designWidth = AutoLayoutConifg.getInstance()
.getDesignWidth();
return 1.0f * screenWidth / designWidth;
}
public static float getPercentHeight1px() {
int screenHeight = AutoLayoutConifg.getInstance()
.getScreenHeight();
int designHeight = AutoLayoutConifg.getInstance()
.getDesignHeight();
return 1.0f * screenHeight / designHeight;
}
public static int getPercentWidthSize(int val) {
int screenWidth = AutoLayoutConifg.getInstance()
.getScreenWidth();
int designWidth = AutoLayoutConifg.getInstance()
.getDesignWidth();
return (int) (val * 1.0f / designWidth * screenWidth);
}
public static int getPercentWidthSizeBigger(int val) {
int screenWidth = AutoLayoutConifg.getInstance()
.getScreenWidth();
int designWidth = AutoLayoutConifg.getInstance()
.getDesignWidth();
int res = val * screenWidth;
if (res % designWidth == 0) {
return res / designWidth;
} else {
return res / designWidth + 1;
}
}
public static int getPercentHeightSizeBigger(int val) {
int screenHeight = AutoLayoutConifg.getInstance()
.getScreenHeight();
int designHeight = AutoLayoutConifg.getInstance()
.getDesignHeight();
int res = val * screenHeight;
if (res % designHeight == 0) {
return res / designHeight;
} else {
return res / designHeight + 1;
}
}
public static int getPercentHeightSize(int val) {
int screenHeight = AutoLayoutConifg.getInstance()
.getScreenHeight();
int designHeight = AutoLayoutConifg.getInstance()
.getDesignHeight();
return (int) (val * 1.0f / designHeight * screenHeight);
}
}
| [
"[email protected]"
] | |
29816ddd3e002af4965543f6148eea1dd317f6dc | 51e17aad2459da97ff66b3cd9941b6bdbe8a2fcb | /src/org/nama/Consool.java | 978f6e9a875403ebf0913c5d44bfe42560ade1c8 | [] | no_license | kalaiyazhagan/Project-1 | 0fb3e8d72bdf0cc7b190cc1fff229de476f336e8 | 16ba75944f186c1daf9b78e98900aa33a8b2feb8 | refs/heads/master | 2020-12-23T04:37:22.469218 | 2020-01-29T17:39:57 | 2020-01-29T17:39:57 | 237,036,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,436 | java | package org.nama;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Consool {
static WebElement driver;
@BeforeClass
public static void method() {
System.setProperty("webdriver.chrome.driver","D:\\eclipse\\nama\\s\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.facebook.com/");
Assert.assertTrue(driver.getCurrentUrl().contains("Facebook"));
}
@Before
public void method1() {
System.out.println("1");
}
@Test
public void method2() {
driver.findElement(By.id("email")).sendKeys("kalai");
driver.findElement(By.id("u_0_2")).click();
System.out.println("2");
}
@Test
public void method8() {
driver.findElement(By.id("email")).sendKeys("kalai");
driver.findElement(By.id("pass")).sendKeys("kls753854");
}
@Test
public void method7() {
driver.findElement(By.id("u_0_2")).click();
System.out.println("2");
}
@Ignore
@Test
public void method6() {
System.out.println("6");
}
@After
public void method3() {
System.out.println("3");
}
@AfterClass
public static void method4() {
System.out.println("finished");
}
}
| [
"[email protected]"
] | |
10c48686659c30da1c370bd15772342a43434682 | c6ddd36e7fbf9a4fa329d3c1f5c1628e1fd2da96 | /DEMO/ThinkofJava_annotation/src/functional/exersices/TestCurrying.java | 7c901a06336b100fbe0399dfd6fd03c3782b5e65 | [] | no_license | ryanquan10/Onjava_practice | 86bf9149336efd8857e8dfb23620e914f5f2904e | 6b827adc28928972dfa833caf42c3c00d2096a68 | refs/heads/master | 2022-12-27T12:20:14.231627 | 2020-04-27T07:36:02 | 2020-04-27T07:36:02 | 259,237,358 | 0 | 0 | null | 2020-10-13T21:32:27 | 2020-04-27T07:22:52 | Java | UTF-8 | Java | false | false | 343 | java | package functional.exersices;
import java.util.function.Function;
public class TestCurrying {
public static void main(String[] args) {
Function<Integer, Function<Integer, Function<Integer, Integer>>> currying = x -> y -> z -> (x+y)*z;
System.out.println(currying.apply(4).apply(5).apply(6)); //54
}
}
| [
"[email protected]"
] | |
ecb0a89a153a11305c8612153e7ff5809ebd2167 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/test/org/mapstruct/ap/test/nestedmethodcall/NestedMappingMethodInvocationTest.java | 6c457e3afd4b89df27403a05e0ba2b13f9655960 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 2,689 | java | /**
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.ap.test.nestedmethodcall;
import java.util.GregorianCalendar;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.namespace.QName;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.WithClasses;
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
/**
* Test for the nested invocation of mapping methods.
*
* @author Sjaak Derksen
*/
@IssueKey("134")
@RunWith(AnnotationProcessorTestRunner.class)
public class NestedMappingMethodInvocationTest {
public static final QName QNAME = new QName("dont-care");
@Test
@WithClasses({ OrderTypeToOrderDtoMapper.class, OrderDto.class, OrderDetailsDto.class, OrderDetailsType.class, OrderType.class })
public void shouldMapViaMethodAndMethod() throws DatatypeConfigurationException {
OrderTypeToOrderDtoMapper instance = OrderTypeToOrderDtoMapper.INSTANCE;
OrderDto target = instance.sourceToTarget(createOrderType());
assertThat(target).isNotNull();
assertThat(target.getOrderNumber()).isEqualTo(5L);
assertThat(target.getDates()).containsExactly("02.03.1999", "28.07.2004");
assertThat(target.getOrderDetails()).isNotNull();
assertThat(target.getOrderDetails().getName()).isEqualTo("test");
assertThat(target.getOrderDetails().getDescription()).containsExactly("elem1", "elem2");
}
@Test
@WithClasses({ SourceTypeTargetDtoMapper.class, SourceType.class, ObjectFactory.class, TargetDto.class })
public void shouldMapViaMethodAndConversion() throws DatatypeConfigurationException {
SourceTypeTargetDtoMapper instance = SourceTypeTargetDtoMapper.INSTANCE;
TargetDto target = instance.sourceToTarget(createSource());
assertThat(target).isNotNull();
assertThat(target.getDate()).isEqualTo(new GregorianCalendar(2013, 6, 6).getTime());
}
@Test
@WithClasses({ SourceTypeTargetDtoMapper.class, SourceType.class, ObjectFactory.class, TargetDto.class })
public void shouldMapViaConversionAndMethod() throws DatatypeConfigurationException {
SourceTypeTargetDtoMapper instance = SourceTypeTargetDtoMapper.INSTANCE;
SourceType source = instance.targetToSource(createTarget());
assertThat(source).isNotNull();
assertThat(source.getDate().getValue()).isEqualTo("06.07.2013");
assertThat(source.getDate().getName()).isEqualTo(NestedMappingMethodInvocationTest.QNAME);
}
}
| [
"[email protected]"
] | |
7bf41e818a989751b17167ec75f5fdaeb45f9ba9 | 878192921d807ef0bf4b3ba6b540cd4eb15c2312 | /src/SubWindows/CusFmPanel.java | 8e4bf9c54e44425b01a5e9b7ee2e60d63b7a662f | [] | no_license | SmaranDhg/Java-swing-programming-VehicleHireCompany | 0531380023eb84e91dbd7a6ddadb114f50d4844c | fd38c2e939421562028a822eb0c4ef5b562074ca | refs/heads/master | 2023-05-04T00:50:18.103030 | 2021-05-22T11:48:33 | 2021-05-22T11:48:33 | 369,794,147 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,628 | java | package SubWindows;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import DataModels.CusModel;
import DataModels.DataTableModel;
import DataModels.LDetailModel;
import Utilities.Serialization;
import WindowManagement.Customers;
import de.javasoft.plaf.synthetica.SyntheticaDefaultLookup;
import de.javasoft.synthetica.dark.SyntheticaDarkLookAndFeel;
import Utilities.RawDatas;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.LookAndFeel;
import javax.swing.JTextField;
import javax.swing.JButton;
public class CusFmPanel extends JPanel {
private JPanel contentPane;
public CusModel cusModel;
private DataTableModel tablemodel;
private ArrayList<String> tabledata;
private JTable table_1;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
private JTextField textField_3;
private JTextField textField_4;
private JFrame jframe;
private JButton cancel_btn,add_btn;
private Customers parent;
/**
* Launch the application.
*/
public static void main(String[] args) {
RawDatas.set_rawdatas();
try {
UIManager.setLookAndFeel("de.javasoft.synthetica.dark.SyntheticaDarkLookAndFeel");
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<CusModel> cusModels=Serialization.fetchItems(CusModel.class);
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
JFrame frame=new JFrame();
frame.getContentPane().add(new CusFmPanel(frame,new Customers()));
frame.setSize(RawDatas.WIN_SIZE, RawDatas.WIN_SIZE);
frame.setVisible(true);;
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public CusFmPanel(JFrame frame,Customers parent) {
this.cusModel=new CusModel();
this.jframe=frame;
this.parent=parent;
JLabel lblNewLabel = new JLabel(RawDatas.CDETAIL_1);
JLabel lblName = new JLabel(RawDatas.CDETAIL_2);
JLabel lblAddress = new JLabel(RawDatas.CDETAIL_3);
JLabel lblContact = new JLabel(RawDatas.CDETAIL_4);
JLabel lblPassword_1 = new JLabel(RawDatas.LOGIN_DETAIL_2);
add_btn = new JButton(RawDatas.CDETAIL_BTN_1);
cancel_btn = new JButton(RawDatas.CDETAIL_BTN_2);
textField = new JTextField();
textField.setColumns(10);
textField.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
cusModel.set_id(textField.getText());
}
});
textField_1 = new JTextField();
textField_1.setColumns(10);
textField.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
cusModel.set_password(textField_1.getText());
}
});
textField_2 = new JTextField();
textField_2.setColumns(10);
textField.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
cusModel.set_name(textField_2.getText());
}
});
textField_3 = new JTextField();
textField_3.setColumns(10);
textField.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
cusModel.set_address(textField_3.getText());
}
});
textField_4 = new JTextField();
textField_4.setColumns(10);
textField.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
cusModel.set_contact(textField_3.getText());
}
});
JLabel lblNewLabel_1 = new JLabel(RawDatas.CDETAIL_TTL);
lblNewLabel_1.setFont(RawDatas.FONT_TITLE);
add_btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
cusModel.set_password(textField_1.getText());
cusModel.set_id(textField.getText());
cusModel.set_name(textField_2.getText());
cusModel.set_address(textField_3.getText());
cusModel.set_contact(textField_3.getText());
if(cusModel.get_id().isBlank() || cusModel.get_password().isBlank())
{
JOptionPane.showMessageDialog(new JFrame(), "Username and Password shouldn't be empty","Error while saving",JOptionPane.ERROR_MESSAGE);
}
else
{
RawDatas.print(cusModel.get_address());
Serialization.save(CusModel.class,cusModel);
Serialization.save(LDetailModel.class,new LDetailModel(cusModel.get_id(),cusModel.get_password(),RawDatas.LOGIN_ID.CUSTOMER));
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
parent.updateTable();
JOptionPane.showMessageDialog(new JFrame(), "Customer Data Saved Sucessfully,Thank you!","Success",JOptionPane.INFORMATION_MESSAGE);
if(!RawDatas.windows.isEmpty()) {
RawDatas.windows.peek().setVisible(true);
RawDatas.windows.pop().setEnabled(true);
}
jframe.dispose();
}
});
}
}
});
frame.addWindowListener(new WindowListener() {
@Override
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent e) {
cancel_btn.doClick();
}
@Override
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent e) {
cancel_btn.doClick();
}
@Override
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}
});
cancel_btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(!RawDatas.windows.isEmpty()) {
RawDatas.windows.peek().setVisible(true);
RawDatas.windows.pop().setEnabled(true);
}
EventQueue.invokeLater(new Runnable() {
public void run() {
frame.dispose();
}
});
}
});
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(56)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
.addComponent(lblPassword_1, GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
.addComponent(lblName, GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
.addComponent(lblAddress, GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
.addComponent(lblContact, GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE))
.addGap(52)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(textField, GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.addComponent(textField_4, GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.addComponent(textField_3, GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.addComponent(textField_2, GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.addComponent(textField_1, GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)))
.addGroup(groupLayout.createSequentialGroup()
.addComponent(add_btn)
.addPreferredGap(ComponentPlacement.RELATED, 149, Short.MAX_VALUE)
.addComponent(cancel_btn)))
.addGap(96))
.addGroup(groupLayout.createSequentialGroup()
.addGap(48)
.addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, 487, Short.MAX_VALUE)))
.addGap(29))
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblPassword_1, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblName, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
.addGap(14)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblAddress, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblContact, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
.addComponent(textField_4, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
.addGap(27)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(add_btn)
.addComponent(cancel_btn))
.addContainerGap(94, Short.MAX_VALUE))
);
setLayout(groupLayout);
}
}
| [
"[email protected]"
] | |
fe2322b2b43bc6decefc79efdd6420a46345c064 | e68afb67412b86d838a268664129e1daa66d3ce4 | /ArenaPvP/src/main/java/gg/hound/arena/tasks/MatchTeleportTask.java | 4608afa0a37f50861fff22980717fa52c9ed4c15 | [] | no_license | edutf8/development-projects-2020 | a1481b10e8958a1041500e6ed3c567958da92849 | 2aead4b149b97f6f81f122341450f1bc49c4391c | refs/heads/master | 2022-11-20T19:02:34.513910 | 2020-07-16T19:19:14 | 2020-07-16T19:19:14 | 280,238,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,992 | java | package gg.hound.arena.tasks;
import gg.hound.arena.hologram.HologramManager;
import gg.hound.arena.scoreboard.ScoreboardManager;
import gg.hound.arena.util.InventoryUtil;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayDeque;
import java.util.Queue;
public class MatchTeleportTask extends BukkitRunnable {
private final InventoryUtil inventoryUtil;
private final ScoreboardManager scoreboardManager;
private final HologramManager hologramManager;
private final Queue<Player> backToSpawn = new ArrayDeque<>();
private final Location spawn = Bukkit.getWorld("training").getSpawnLocation();
public MatchTeleportTask(InventoryUtil inventoryUtil, ScoreboardManager scoreboardManager, HologramManager hologramManager) {
this.inventoryUtil = inventoryUtil;
this.scoreboardManager = scoreboardManager;
this.hologramManager = hologramManager;
}
@Override
public void run() {
if (backToSpawn.size() != 0) {
Player player;
for (int i = 0; i < 10; i++) {
player = backToSpawn.poll();
if (player == null)
return;
player.setFlying(false);
player.setAllowFlight(false);
player.getInventory().clear();
player.getInventory().setArmorContents(null);
for (PotionEffect potionEffect : player.getActivePotionEffects())
player.removePotionEffect(potionEffect.getType());
inventoryUtil.giveSpawnInventory(player);
scoreboardManager.setScoreboard(player);
player.teleport(spawn);
hologramManager.sendDefaultHolograms(player);
}
}
}
public void teleportToSpawn(Player player) {
backToSpawn.add(player);
}
}
| [
"[email protected]"
] | |
08024c8a5a80ffce61d4c01e3fb6a6f21ccd12b8 | 157d2ef1f40203d1e446f096e820185ae6e4f106 | /beige-uml-swing/src/main/java/org/beigesoft/uml/factory/awt/FactoryAsmInteractionUse.java | fc5430bbd6e1bb42577a01b5f883c5044dd892b9 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | permissive | demidenko05/beige-uml | e87b922140d207740ea8f01daf201a3410fcc18e | 48bfbe5b100853815032af639b32da30957305af | refs/heads/master | 2023-03-17T00:37:17.463163 | 2020-10-13T11:05:30 | 2020-10-13T11:05:30 | 47,434,951 | 1 | 1 | Apache-2.0 | 2020-10-13T07:23:41 | 2015-12-05T00:01:40 | Java | UTF-8 | Java | false | false | 3,946 | java | package org.beigesoft.uml.factory.awt;
import java.awt.Frame;
import java.awt.Graphics2D;
import java.awt.Image;
import org.beigesoft.graphic.pojo.SettingsDraw;
import org.beigesoft.graphic.pojo.Point2D;
import org.beigesoft.graphic.service.ISrvDraw;
import org.beigesoft.service.ISrvI18n;
import org.beigesoft.ui.service.ISrvDialog;
import org.beigesoft.uml.app.model.SettingsGraphicUml;
import org.beigesoft.uml.assembly.AsmElementUmlInteractive;
import org.beigesoft.uml.assembly.IAsmElementUmlInteractive;
import org.beigesoft.uml.factory.IFactoryAsmElementUml;
import org.beigesoft.uml.factory.swing.FactoryEditorInteractionUse;
import org.beigesoft.uml.pojo.InteractionUse;
import org.beigesoft.uml.service.graphic.SrvGraphicInteractionUse;
import org.beigesoft.uml.service.interactive.SrvInteractiveFragment;
import org.beigesoft.uml.service.persist.xmllight.FileAndWriter;
import org.beigesoft.uml.service.persist.xmllight.SrvPersistLightXmlInteractionUse;
public class FactoryAsmInteractionUse implements IFactoryAsmElementUml<IAsmElementUmlInteractive<InteractionUse, Graphics2D, SettingsDraw, FileAndWriter>, Graphics2D, SettingsDraw, FileAndWriter, InteractionUse> {
private final ISrvDraw<Graphics2D, SettingsDraw, Image> drawSrv;
private final SettingsGraphicUml graphicSettings;
private final FactoryEditorInteractionUse factoryEditorInteractionUse;
private SrvGraphicInteractionUse<InteractionUse, Graphics2D, SettingsDraw> graphicInteractionUseumlSrv;
private SrvPersistLightXmlInteractionUse<InteractionUse> persistXmlInteractionUseSrv;
private SrvInteractiveFragment<InteractionUse, Graphics2D, SettingsDraw, Frame> interactiveInteractionUseSrv;
public FactoryAsmInteractionUse(ISrvDraw<Graphics2D, SettingsDraw, Image> drawSrv,
ISrvI18n i18nSrv, ISrvDialog<Frame> dialogSrv, SettingsGraphicUml graphicSettings,
Frame frameMain) {
this.drawSrv = drawSrv;
this.graphicSettings = graphicSettings;
this.factoryEditorInteractionUse = new FactoryEditorInteractionUse(i18nSrv, dialogSrv, graphicSettings, frameMain);
}
@Override
public synchronized AsmElementUmlInteractive<InteractionUse, Graphics2D, SettingsDraw, FileAndWriter> createAsmElementUml() {
InteractionUse intUse = new InteractionUse();
intUse.setPointStart(new Point2D(1, 1));
SettingsDraw drawSettings = new SettingsDraw();
AsmElementUmlInteractive<InteractionUse, Graphics2D, SettingsDraw, FileAndWriter> asmInteractionUse =
new AsmElementUmlInteractive<InteractionUse, Graphics2D, SettingsDraw, FileAndWriter>(intUse, drawSettings, lazyGetGraphicInteractionUseSrv(), lazyGetPersistXmlInteractionUseSrv(),
lazyGetInteractiveInteractionUseSrv());
return asmInteractionUse;
}
public synchronized SrvInteractiveFragment<InteractionUse, Graphics2D, SettingsDraw, Frame> lazyGetInteractiveInteractionUseSrv() {
if(interactiveInteractionUseSrv == null) {
interactiveInteractionUseSrv = new SrvInteractiveFragment<InteractionUse, Graphics2D, SettingsDraw, Frame>
(lazyGetGraphicInteractionUseSrv(), factoryEditorInteractionUse);
}
return interactiveInteractionUseSrv;
}
public synchronized SrvPersistLightXmlInteractionUse<InteractionUse> lazyGetPersistXmlInteractionUseSrv() {
if(persistXmlInteractionUseSrv == null) {
persistXmlInteractionUseSrv = new SrvPersistLightXmlInteractionUse<InteractionUse>();
}
return persistXmlInteractionUseSrv;
}
public synchronized SrvGraphicInteractionUse<InteractionUse, Graphics2D, SettingsDraw> lazyGetGraphicInteractionUseSrv() {
if(graphicInteractionUseumlSrv == null) {
graphicInteractionUseumlSrv = new SrvGraphicInteractionUse<InteractionUse, Graphics2D, SettingsDraw>(drawSrv, graphicSettings);
}
return graphicInteractionUseumlSrv;
}
public FactoryEditorInteractionUse getFactoryEditorInteractionUse() {
return factoryEditorInteractionUse;
}
}
| [
"[email protected]"
] | |
6bff063ca68b8234f7c737d71cb4a82b07829cb0 | a2075d046250d6e8b27d69f1030142f0efdf3e2e | /hrms-backend/src/main/java/com/finalproject/hrmsbackend/core/utilities/results/ErrorDataResult.java | bea473114da64f4910088ecbfd389fdece97b4e2 | [] | no_license | CosmicDust19/kodlama.io-javareactcamp | c42921845f3a1da52198ca6c59d0747af0bae50f | 886bbae133dcf9739d8dda0471a20cfb9cb4952b | refs/heads/master | 2023-08-18T02:22:23.016255 | 2021-10-04T11:40:26 | 2021-10-04T11:40:26 | 365,454,905 | 20 | 4 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package com.finalproject.hrmsbackend.core.utilities.results;
public class ErrorDataResult<T> extends DataResult<T> {
public ErrorDataResult(String message, T data) {
super(false, message, data);
}
public ErrorDataResult(T data) {
super(false, data);
}
public ErrorDataResult(String message) {
super(false, message, null);
}
public ErrorDataResult() {
super(false, null);
}
}
| [
"[email protected]"
] | |
5f4800dc8f714d05d29cfd025f0e8a913e23285e | 3e22f5bd4deb2a5f7933db4dfa152dd1a9f56552 | /hellospring04/src/main/java/com/douzone/hellospring/controller/GuestbookController.java | 7aa17ded01dad63b71ffdde5e02c73fffaf1e996 | [] | no_license | insung93/spring-practices | 32aed2746bd69f9ae6ab017eeb32b9ecca3a56f4 | 7c28d59ad6956f927cfe2f893c4f1343de78344d | refs/heads/master | 2023-06-01T06:15:02.621763 | 2021-06-22T07:05:27 | 2021-06-22T07:05:27 | 373,020,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package com.douzone.hellospring.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/*
*
* RequestMapping
* 클래스(타입) 단독 매핑
*
*/
@Controller
@RequestMapping("/guestbook/*")
public class GuestbookController {
@ResponseBody
//@RequestMapping
public String list() {
return "GuestbookController:list";
}
//http://localhost:8080/hellospring03/guestbook/list
@ResponseBody
//@RequestMapping
public String delete() {
return "GuestbookController:delete";
}
//http://localhost:8080/hellospring03/guestbook/delete
}
| [
"[email protected]"
] | |
0d3d5f35aba1025872d8448077b468866c74b923 | e291eb6892fdb9b151d565d1137d23ae677d1a23 | /poi/src/main/java/com/axisdesktop/poi/repository/UserRepository.java | a2b21beef2a960fd3cda3b19e27c81054961fd7f | [] | no_license | fopcoder/com.axisdesktop.poi | 7a405e120090e132fb2402cec47e7703fe570f36 | a7d59697fc2b6450789bb15f35e5ad817152f781 | refs/heads/master | 2020-05-21T12:26:08.804797 | 2016-06-11T23:56:00 | 2016-06-11T23:56:00 | 53,752,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | package com.axisdesktop.poi.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.axisdesktop.poi.entity.User;
import com.axisdesktop.poi.entity.Role;
public interface UserRepository extends JpaRepository<User, Long> {
User findByEmail( String email );
User findByName( String name );
@Query( name = "User.findRole" )
List<Role> findRole();
}
| [
"[email protected]"
] | |
b007f0eb59725f392163b01d2b8a491a4e6a2aac | e01e8f9a54086fb4379a40671cc0434b9d830f4b | /src/main/java/com/facebook/presto/client/Column.java | 37e08dd633b4b55e5fd90dcb61dcfbf16c4f6842 | [] | no_license | zhaoshengbo/presto-jdbc | 7c9629bf3a03dd683a4ae2725512f68cdfc6df9b | 879c58930137b50c97e20a97ab600e8dbbd9d2c9 | refs/heads/master | 2020-06-14T16:18:40.486189 | 2016-12-12T12:04:59 | 2016-12-12T12:04:59 | 75,160,539 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,607 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.client;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.concurrent.Immutable;
import static com.facebook.presto.utils.Objects.requireNonNull;
@Immutable
public class Column {
private final String name;
private final String type;
private final ClientTypeSignature typeSignature;
@JsonCreator
public Column(
@JsonProperty("name") String name,
@JsonProperty("type") String type,
@JsonProperty("typeSignature") ClientTypeSignature typeSignature) {
this.name = requireNonNull(name, "name is null");
this.type = requireNonNull(type, "type is null");
this.typeSignature = typeSignature;
}
@JsonProperty
public String getName() {
return name;
}
@JsonProperty
public String getType() {
return type;
}
@JsonProperty
public ClientTypeSignature getTypeSignature() {
return typeSignature;
}
}
| [
"[email protected]"
] | |
a900c4795476ad9a09d80bcd6ccfdbc122a78b65 | 10be02b852c57f5d865c184dc75bd88e2397d067 | /src/main/java/com/sc/kanak/config/DatabaseConfiguration.java | 36c11033c3c02b2af6b064dcfb07d43480f39588 | [] | no_license | saumikonline/kanak | 3fa1f2614e1d5f1157e58c66c2c422eb3a6f0ec4 | e96bde6ed7582c27d980e2932d7d0e7142ed1243 | refs/heads/master | 2020-03-21T21:07:39.249383 | 2018-06-28T17:10:36 | 2018-06-28T17:10:36 | 139,047,458 | 0 | 0 | null | 2018-06-28T17:22:11 | 2018-06-28T17:10:30 | Java | UTF-8 | Java | false | false | 2,606 | java | package com.sc.kanak.config;
import io.github.jhipster.config.JHipsterConstants;
import io.github.jhipster.config.liquibase.AsyncSpringLiquibase;
import liquibase.integration.spring.SpringLiquibase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import org.springframework.core.task.TaskExecutor;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
@Configuration
@EnableJpaRepositories("com.sc.kanak.repository")
@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
@EnableTransactionManagement
@EnableElasticsearchRepositories("com.sc.kanak.repository.search")
public class DatabaseConfiguration {
private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class);
private final Environment env;
private final CacheManager cacheManager;
public DatabaseConfiguration(Environment env, CacheManager cacheManager) {
this.env = env;
this.cacheManager = cacheManager;
}
@Bean
public SpringLiquibase liquibase(@Qualifier("taskExecutor") TaskExecutor taskExecutor,
DataSource dataSource, LiquibaseProperties liquibaseProperties) {
// Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start asynchronously
SpringLiquibase liquibase = new AsyncSpringLiquibase(taskExecutor, env);
liquibase.setDataSource(dataSource);
liquibase.setChangeLog("classpath:config/liquibase/master.xml");
liquibase.setContexts(liquibaseProperties.getContexts());
liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema());
liquibase.setDropFirst(liquibaseProperties.isDropFirst());
if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE)) {
liquibase.setShouldRun(false);
} else {
liquibase.setShouldRun(liquibaseProperties.isEnabled());
log.debug("Configuring Liquibase");
}
return liquibase;
}
}
| [
"[email protected]"
] | |
06baa0e4995a1e9cc012175e16cbcf7c37dc521e | 37674ea897b3a7f5bdac8e2790c95449e0b07d63 | /src/main/java/com/github/kusumotolab/tc2p/utils/patternmining/itembag/Transaction.java | 4d9f121a872636e03901b4d66b0d7dd8de3c96e3 | [] | no_license | kusumotolab/TC2P | 49c218323098b7227503b154c8418d4f64ed31bc | dd0259834a093d53aee33c3cb054e37bb9d31875 | refs/heads/master | 2022-04-11T16:39:40.105022 | 2020-02-12T05:04:36 | 2020-02-12T05:04:36 | 232,695,891 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 247 | java | package com.github.kusumotolab.tc2p.utils.patternmining.itembag;
import java.util.List;
import lombok.Data;
@Data
public class Transaction<T> {
private final TransactionID id;
private final List<ItemAndOccurrence<T>> itemAndOccurrences;
}
| [
"[email protected]"
] | |
7aaf06fa74df580b90fd43d9b9f9fa878a34b535 | f78daf87fd31e9524aa8a1cbd24c0ad0bc8b6c79 | /src/main/java/com/dbsys/rs/client/entity/Pegawai.java | a4e805ad989755d41346e0c71da1b5d0ebbe9735 | [
"Apache-2.0"
] | permissive | uvsystem/rumkit-java-client | e64edc11f654a28c41e4d94e4494dda406c00674 | d3e709afd239bc6295d68238f9301260ce92adaf | refs/heads/master | 2021-01-20T10:47:41.283062 | 2016-04-01T03:13:29 | 2016-04-01T03:13:29 | 43,736,496 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,992 | java | package com.dbsys.rs.client.entity;
import com.dbsys.rs.client.entity.Penduduk.Kelamin;
import java.sql.Date;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "tipe"
)
@JsonSubTypes({
@JsonSubTypes.Type(value = Dokter.class, name = "DOKTER"),
@JsonSubTypes.Type(value = Perawat.class, name = "PERAWAT"),
@JsonSubTypes.Type(value = Apoteker.class, name = "APOTEKER"),
@JsonSubTypes.Type(value = Pekerja.class, name = "PEKERJA"),
@JsonSubTypes.Type(value = Pegawai.class, name = "PEGAWAI")
})
public class Pegawai {
protected Long id;
protected String nip;
protected Penduduk penduduk;
public Pegawai() {
super();
this.penduduk = new Penduduk();
}
public Pegawai(String name) {
this();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNip() {
return nip;
}
public void setNip(String nip) {
this.nip = nip;
}
public Penduduk getPenduduk() {
return penduduk;
}
public void setPenduduk(Penduduk penduduk) {
this.penduduk = penduduk;
}
public Long getIdPenduduk() {
return penduduk.getId();
}
public void setIdPenduduk(Long idPenduduk) {
penduduk.setId(idPenduduk);
}
public String getKode() {
return penduduk.getKode();
}
public void setKode(String kode) {
penduduk.setKode(kode);
}
public String getNik() {
return penduduk.getNik();
}
public void setNik(String nik) {
penduduk.setNik(nik);
}
public String getNama() {
return penduduk.getNama();
}
public void setNama(String nama) {
penduduk.setNama(nama);
}
public Kelamin getKelamin() {
return penduduk.getKelamin();
}
public void setKelamin(Kelamin kelamin) {
penduduk.setKelamin(kelamin);
}
public Date getTanggalLahir() {
return penduduk.getTanggalLahir();
}
public void setTanggalLahir(Date tanggalLahir) {
penduduk.setTanggalLahir(tanggalLahir);
}
public String getDarah() {
return penduduk.getDarah();
}
public void setDarah(String darah) {
penduduk.setDarah(darah);
}
public String getAgama() {
return penduduk.getAgama();
}
public void setAgama(String agama) {
penduduk.setAgama(agama);
}
public String getTelepon() {
return penduduk.getTelepon();
}
public void setTelepon(String telepon) {
penduduk.setTelepon(telepon);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((nip == null) ? 0 : nip.hashCode());
result = prime * result
+ ((penduduk == null) ? 0 : penduduk.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;
Pegawai other = (Pegawai) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (nip == null) {
if (other.nip != null)
return false;
} else if (!nip.equals(other.nip))
return false;
if (penduduk == null) {
if (other.penduduk != null)
return false;
} else if (!penduduk.equals(other.penduduk))
return false;
return true;
}
}
| [
"[email protected]"
] | |
9d584516f8b012d154f136fac6dfa92797414465 | 0ea9ec64f5d17eec346a66a8a0da7dafc5efd11a | /chapter_1/1.2/Dragon.java | 0c96444a5d82f8576b9c5fca9e76b123e730a6c1 | [
"MIT"
] | permissive | out-running-27/Java_Programming | 2216cf70f45b5d746160e84c31ba995e8f513646 | 7af217f157cf602d7980e7b48eb7da353756fdb3 | refs/heads/master | 2020-03-21T09:44:22.024049 | 2018-08-08T12:24:22 | 2018-08-08T12:24:22 | 138,415,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | public class Dragon
{
public static void main(String[] args) {
String dragon0 = "F";
String nogard0 = "F";
String dragon1 = dragon0 + "L" + nogard0;
String nogard1 = dragon0 + "R" + nogard0;
String dragon2 = dragon1 + "L" + nogard1;
String nogard2 = dragon1 + "R" + nogard1;
String dragon3 = dragon2 + "L" + nogard2;
String nogard3 = dragon2 + "R" + nogard2;
String dragon4 = dragon3 + "L" + nogard3;
String nogard4 = dragon3 + "R" + nogard3;
String dragon5 = dragon4 + "L" + nogard4;
System.out.println("order 0: " + dragon0);
System.out.println("order 1: " + dragon1);
System.out.println("order 2: " + dragon2);
System.out.println("order 3: " + dragon3);
System.out.println("order 4: " + dragon4);
System.out.println("order 5: " + dragon5);
}
} | [
"[email protected]"
] | |
e01a7f5f537589118e01d220aaaa7bdf13344660 | 214c2802c2e018222e1f3b88f4d7b470c68a1201 | /src/com/akpanda/behavioural/command/Account.java | 41f9ade47565c9cacb5264d1d0353ac1fb42d893 | [] | no_license | akpandads/DesignPatterns | 16b9068bb5f34788a96f9ddb896687e2dad74974 | 664aec5ee5bf95af703a947ea23d267d9d9ef041 | refs/heads/master | 2020-08-06T23:38:17.545423 | 2019-10-16T19:09:44 | 2019-10-16T19:09:44 | 213,202,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 449 | java | package com.akpanda.behavioural.command;
class Account
{
public int balance;
public void process(Command c)
{
switch (c.action)
{
case DEPOSIT:
balance += c.amount;
c.success = true;
break;
case WITHDRAW:
c.success = balance >= c.amount;
if (c.success) balance -= c.amount;
break;
}
}
}
| [
"[email protected]"
] | |
195d9b6ad309461b14e9b35109159a8ceae166f4 | 670e337dd7abb40af39e4dbe8ed0d0abb2b1f66d | /EvoGUI/src/main/java/genetic/HumanSelectionStrategy.java | a358ebd29f8b464d6935810e4244f5570e288fe4 | [] | no_license | josejl1987/UTInteractiveEvoBot | b510700f90ad7b4ac7bc76aaa6169f2a428b9da0 | e6e2944ed857de8476ce599665e91237b75811ea | refs/heads/master | 2016-09-05T18:34:08.204563 | 2014-05-19T10:13:35 | 2014-05-19T10:13:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package genetic;
import evolutionaryComputation.IndividualV1;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.uncommons.watchmaker.framework.EvaluatedCandidate;
import org.uncommons.watchmaker.framework.SelectionStrategy;
/**
*
* @author Jose
*/
public class HumanSelectionStrategy implements SelectionStrategy<IndividualV1>{
double pruneValue;
public <S extends IndividualV1> List<S> select(List<EvaluatedCandidate<S>> population, boolean naturalFitnessScores, int selectionSize, Random rng) {
List<S> selectedList=new ArrayList<S>();
for (EvaluatedCandidate<S> individual:population){
if(individual.getFitness()>pruneValue){
selectedList.add(individual.getCandidate());
}
}
return selectedList;
}
}
| [
"[email protected]"
] | |
6211764751470479f455ecff5ced193550d0ab09 | 4f80acbfb4c64f6e122667107f31268c29fa2e2e | /src/main/java/com/how2java/tmall/service/impl/PropertyValueServiceImpl.java | cd8fd0380aac02ceebfc5bdb950ede564f589106 | [] | no_license | Ryan-wangzy/Tmall_SSM | 8b4597413ed19f1acc40105d2efe3df77a01509d | af485c2f4ea1d327238ed531bf44b5fdbcd52276 | refs/heads/master | 2022-12-11T20:21:25.745076 | 2020-08-26T19:54:09 | 2020-08-26T19:54:09 | 285,723,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,012 | java | package com.how2java.tmall.service.impl;
import com.how2java.tmall.mapper.PropertyValueMapper;
import com.how2java.tmall.pojo.*;
import com.how2java.tmall.service.PropertyService;
import com.how2java.tmall.service.PropertyValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PropertyValueServiceImpl implements PropertyValueService {
@Autowired
PropertyService propertyService;
@Autowired
PropertyValueMapper propertyValueMapper;
@Override
public void init(Product p) {
List<Property> pts = propertyService.list(p.getId());
for(Property pt:pts){
PropertyValue pv = get(pt.getId(),p.getId());
if(null == pv){
pv = new PropertyValue();
pv.setPid(p.getId());
pv.setPtid(pt.getId());
propertyValueMapper.insert(pv);
}
}
}
@Override
public void update(PropertyValue pv) {
propertyValueMapper.updateByPrimaryKeySelective(pv);
}
@Override
public PropertyValue get(int pid, int ptid) {
PropertyValueExample propertyValueExample = new PropertyValueExample();
propertyValueExample.createCriteria()
.andPidEqualTo(pid)
.andPtidEqualTo(ptid);
List<PropertyValue> pvs = propertyValueMapper.selectByExample(propertyValueExample);
if(pvs.isEmpty())
return null;
return pvs.get(0);
}
@Override
public List<PropertyValue> list(int pid) {
PropertyValueExample example = new PropertyValueExample();
example.createCriteria().andPidEqualTo(pid);
List<PropertyValue> result = propertyValueMapper.selectByExample(example);
for (PropertyValue pv : result) {
Property property = propertyService.get(pv.getPtid());
pv.setProperty(property);
}
return result;
}
}
| [
"[email protected]"
] | |
2bba7bb7ce9606a666579cf9420ebb14576a6986 | c4a111a88bb3ae75db06c068a1c9f8b81bb55a8e | /src/main/java/com/mongodb/spark/sql/connector/connection/package-info.java | b1e6d478cdcde50ef80532da52fabbdea7fa417b | [
"Apache-2.0"
] | permissive | mongodb/mongo-spark | 853fdec339db903ab07fdf2832e5b78c78057582 | c46080dbede2a83a373de35c5581070ccfc539fd | refs/heads/main | 2023-09-05T12:44:52.444461 | 2023-07-12T09:41:35 | 2023-07-12T09:41:35 | 35,964,690 | 756 | 346 | Apache-2.0 | 2023-07-10T12:33:03 | 2015-05-20T17:59:42 | Java | UTF-8 | Java | false | false | 658 | java | /*
* Copyright 2008-present MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.mongodb.spark.sql.connector.connection;
| [
"[email protected]"
] | |
b4776c6fa08fca8682a5076f2c88705e38da01b0 | dbb6ff9ddb50f09731f96b1b892a39dd78e11c42 | /app/src/main/java/com/navigation/drawer/activity/Activity/Editer.java | ba6de3731e0e28288ea8db4e3d6f951f21efaf31 | [] | no_license | Meftahi12/AmineTazi | 8686f739ba1bc4c1660851684f389cc73579a5a3 | 55bccade688f23f3d1ab51624526f93ff8db4556 | refs/heads/master | 2021-01-20T01:36:12.880510 | 2017-04-25T02:12:01 | 2017-04-25T02:12:01 | 89,306,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,714 | java | package com.navigation.drawer.activity.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.navigation.drawer.activity.R;
import java.io.IOException;
public class Editer extends BaseActivity {
String nom,prenom,sexe,email,tel,num_permi,date_permi,password,confirm;
boolean isEdited = false ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getLayoutInflater().inflate(R.layout.activity_editer, frameLayout);
mDrawerList.setItemChecked(position, true);
setTitle(listArray[position]);
((EditText) findViewById(R.id.nome)).setText(Profil.currentUser.getNom());
((EditText) findViewById(R.id.prenome)).setText(Profil.currentUser.getPrenom());
((EditText) findViewById(R.id.sexee)).setText(Profil.currentUser.getSexe());
((EditText) findViewById(R.id.emaile)).setText(Profil.currentUser.getEmail());
((EditText) findViewById(R.id.tele)).setText(Profil.currentUser.getTel());
((EditText) findViewById(R.id.num_permie)).setText(Profil.currentUser.getNum_permi());
((EditText) findViewById(R.id.date_permie)).setText(Profil.currentUser.getDate_permi());
((EditText) findViewById(R.id.passworde)).setText(Profil.currentUser.getPassword());
((EditText) findViewById(R.id.confirme)).setText(Profil.currentUser.getPassword());
}
public void edit(View view) {
nom = ((EditText) findViewById(R.id.nome)).getText().toString();
prenom = ((EditText) findViewById(R.id.prenome)).getText().toString();
sexe = ((EditText) findViewById(R.id.sexee)).getText().toString();
email = ((EditText) findViewById(R.id.emaile)).getText().toString();
tel = ((EditText) findViewById(R.id.tele)).getText().toString();
num_permi = ((EditText) findViewById(R.id.num_permie)).getText().toString();
date_permi = ((EditText) findViewById(R.id.date_permie)).getText().toString();
password = ((EditText) findViewById(R.id.passworde)).getText().toString();
confirm = ((EditText) findViewById(R.id.confirme)).getText().toString();
new MyTask().execute();
}
public class MyTask extends AsyncTask<Void,String,Void> {
@Override
protected Void doInBackground(Void... params) {
if (!password.equals(confirm))
{
publishProgress("mot de passe incorect");
}
else{
String url = "http://"+Signin.ipAdresse+"/covoiturage/Editer.php?id="+Profil.id+"&password="+password+"&nom="+nom+"&prenom="+prenom+"&sexe="+sexe+"&email="+email+"&tel="+tel+"&num_permi="+num_permi+"&date_permi="+date_permi ;
try {
String reponse = HttpManager.getDatas(url) ;
if(reponse.equals("done"))
isEdited = true ;
publishProgress(reponse);
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
@Override
protected void onProgressUpdate(String... values) {
super.onProgressUpdate(values);
Toast.makeText(getApplicationContext(),values[0],Toast.LENGTH_LONG).show();
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
if(isEdited)
startActivity(new Intent(Editer.this,Profil.class));
}
}
}
| [
"[email protected]"
] | |
aae1152a4a414c1a0c1d7a003524093302695f77 | ca5ca399c1a14c381d8c4cff3d48be3ef4f4fc62 | /smartexServ/src/main/java/com/smartexsev/smartexserv/classes/GroupUser.java | be9d3a87a1a3cbf3c6a7f0d0bfa4bfe5b6812975 | [] | no_license | aleksey2101/SmartEx | 0f0c7c38399cd6855974f4791cf344e4ed70e78b | 23db9760bfad4ffb6a5f4d54bf8d28aff887ec79 | refs/heads/master | 2022-11-05T14:25:42.802442 | 2022-10-05T05:44:15 | 2022-10-05T05:44:15 | 159,865,604 | 0 | 0 | null | 2018-11-30T18:51:03 | 2018-11-30T18:51:03 | null | UTF-8 | Java | false | false | 104 | java | package com.smartexsev.smartexserv.classes;
public class GroupUser {
public GroupUser() {
}
}
| [
"[email protected]"
] | |
78c010e135f56ecb6cbb1d784c8617f1100522c8 | 00d747791eda39c3340a3f8dd2ed15c028f67af5 | /ore-boot/ore-boot-autoconfigure/src/main/java/org/oreframework/boot/autoconfigure/datasource/customize/mybatis/pagehelper/SecondaryPageHelperAutoConfiguration.java | 0b3e99848bcb0788a97a9328e69d80f0200f2dee | [] | no_license | levphon/ore | a7a260e93aef7f6377fcfcc69113d13a030a21d2 | f855d70c7d3e388e46f09791420b6da922d89bbb | refs/heads/master | 2020-03-23T00:14:46.760278 | 2018-07-13T13:53:19 | 2018-07-13T13:53:19 | 140,852,583 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,361 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2017 [email protected]
*
* 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 org.oreframework.boot.autoconfigure.datasource.customize.mybatis.pagehelper;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
import javax.annotation.PostConstruct;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.oreframework.boot.autoconfigure.datasource.BeanNameConstants;
import org.oreframework.boot.autoconfigure.datasource.customize.mybatis.mapper.SecondaryMybatisAutoConfiguration;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
import org.springframework.context.annotation.Configuration;
import com.github.pagehelper.PageInterceptor;
/**
* @author huangzz
* 2017年3月18日
*/
@Configuration
@ConditionalOnClass({SqlSessionFactory.class, SqlSessionFactoryBean.class})
@ConditionalOnBean(name = "secondaryDataSource", search = SearchStrategy.ALL)
@AutoConfigureAfter(SecondaryMybatisAutoConfiguration.class)
public class SecondaryPageHelperAutoConfiguration
{
private final SqlSessionFactory sqlSessionFactory;
private Map<String, String> pagehelper = new LinkedHashMap<String, String>();
public SecondaryPageHelperAutoConfiguration(
@Qualifier(BeanNameConstants.SECONDARY_SQLSESSIONFACTORY) SqlSessionFactory sqlSessionFactory)
{
this.sqlSessionFactory = sqlSessionFactory;
}
@PostConstruct
public void addPageInterceptor()
{
PageInterceptor interceptor = new PageInterceptor();
Properties properties = new Properties();
properties.putAll(pagehelper);
interceptor.setProperties(properties);
sqlSessionFactory.getConfiguration().addInterceptor(interceptor);
}
public Map<String, String> getPagehelper()
{
return pagehelper;
}
public void setPagehelper(Map<String, String> pagehelper)
{
this.pagehelper = pagehelper;
}
}
| [
"[email protected]"
] | |
2ca77003c0ceca16289ea227dd15d18a93062916 | 83e81c25b1f74f88ed0f723afc5d3f83e7d05da8 | /core/java/android/view/ViewStub.java | 193fb98841735d21c73a073d1f9f02237534e424 | [
"Apache-2.0",
"LicenseRef-scancode-unicode"
] | permissive | Ankits-lab/frameworks_base | 8a63f39a79965c87a84e80550926327dcafb40b7 | 150a9240e5a11cd5ebc9bb0832ce30e9c23f376a | refs/heads/main | 2023-02-06T03:57:44.893590 | 2020-11-14T09:13:40 | 2020-11-14T09:13:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,764 | java | /*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.view;
import android.annotation.IdRes;
import android.annotation.LayoutRes;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.RemoteViews.RemoteView;
import com.android.internal.R;
import java.lang.ref.WeakReference;
/**
* A ViewStub is an invisible, zero-sized View that can be used to lazily inflate
* layout resources at runtime.
*
* When a ViewStub is made visible, or when {@link #inflate()} is invoked, the layout resource
* is inflated. The ViewStub then replaces itself in its parent with the inflated View or Views.
* Therefore, the ViewStub exists in the view hierarchy until {@link #setVisibility(int)} or
* {@link #inflate()} is invoked.
*
* The inflated View is added to the ViewStub's parent with the ViewStub's layout
* parameters. Similarly, you can define/override the inflate View's id by using the
* ViewStub's inflatedId property. For instance:
*
* <pre>
* <ViewStub android:id="@+id/stub"
* android:inflatedId="@+id/subTree"
* android:layout="@layout/mySubTree"
* android:layout_width="120dip"
* android:layout_height="40dip" />
* </pre>
*
* The ViewStub thus defined can be found using the id "stub." After inflation of
* the layout resource "mySubTree," the ViewStub is removed from its parent. The
* View created by inflating the layout resource "mySubTree" can be found using the
* id "subTree," specified by the inflatedId property. The inflated View is finally
* assigned a width of 120dip and a height of 40dip.
*
* The preferred way to perform the inflation of the layout resource is the following:
*
* <pre>
* ViewStub stub = findViewById(R.id.stub);
* View inflated = stub.inflate();
* </pre>
*
* When {@link #inflate()} is invoked, the ViewStub is replaced by the inflated View
* and the inflated View is returned. This lets applications get a reference to the
* inflated View without executing an extra findViewById().
*
* @attr ref android.R.styleable#ViewStub_inflatedId
* @attr ref android.R.styleable#ViewStub_layout
*/
@RemoteView
public final class ViewStub extends View {
private int mInflatedId;
private int mLayoutResource;
private WeakReference<View> mInflatedViewRef;
private LayoutInflater mInflater;
private OnInflateListener mInflateListener;
public ViewStub(Context context) {
this(context, 0);
}
/**
* Creates a new ViewStub with the specified layout resource.
*
* @param context The application's environment.
* @param layoutResource The reference to a layout resource that will be inflated.
*/
public ViewStub(Context context, @LayoutRes int layoutResource) {
this(context, null);
mLayoutResource = layoutResource;
}
public ViewStub(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public ViewStub(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public ViewStub(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context);
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.ViewStub, defStyleAttr, defStyleRes);
saveAttributeDataForStyleable(context, R.styleable.ViewStub, attrs, a, defStyleAttr,
defStyleRes);
mInflatedId = a.getResourceId(R.styleable.ViewStub_inflatedId, NO_ID);
mLayoutResource = a.getResourceId(R.styleable.ViewStub_layout, 0);
mID = a.getResourceId(R.styleable.ViewStub_id, NO_ID);
a.recycle();
setVisibility(GONE);
setWillNotDraw(true);
}
/**
* Returns the id taken by the inflated view. If the inflated id is
* {@link View#NO_ID}, the inflated view keeps its original id.
*
* @return A positive integer used to identify the inflated view or
* {@link #NO_ID} if the inflated view should keep its id.
*
* @see #setInflatedId(int)
* @attr ref android.R.styleable#ViewStub_inflatedId
*/
@IdRes
public int getInflatedId() {
return mInflatedId;
}
/**
* Defines the id taken by the inflated view. If the inflated id is
* {@link View#NO_ID}, the inflated view keeps its original id.
*
* @param inflatedId A positive integer used to identify the inflated view or
* {@link #NO_ID} if the inflated view should keep its id.
*
* @see #getInflatedId()
* @attr ref android.R.styleable#ViewStub_inflatedId
*/
@android.view.RemotableViewMethod(asyncImpl = "setInflatedIdAsync")
public void setInflatedId(@IdRes int inflatedId) {
mInflatedId = inflatedId;
}
/** @hide **/
public Runnable setInflatedIdAsync(@IdRes int inflatedId) {
mInflatedId = inflatedId;
return null;
}
/**
* Returns the layout resource that will be used by {@link #setVisibility(int)} or
* {@link #inflate()} to replace this StubbedView
* in its parent by another view.
*
* @return The layout resource identifier used to inflate the new View.
*
* @see #setLayoutResource(int)
* @see #setVisibility(int)
* @see #inflate()
* @attr ref android.R.styleable#ViewStub_layout
*/
@LayoutRes
public int getLayoutResource() {
return mLayoutResource;
}
/**
* Specifies the layout resource to inflate when this StubbedView becomes visible or invisible
* or when {@link #inflate()} is invoked. The View created by inflating the layout resource is
* used to replace this StubbedView in its parent.
*
* @param layoutResource A valid layout resource identifier (different from 0.)
*
* @see #getLayoutResource()
* @see #setVisibility(int)
* @see #inflate()
* @attr ref android.R.styleable#ViewStub_layout
*/
@android.view.RemotableViewMethod(asyncImpl = "setLayoutResourceAsync")
public void setLayoutResource(@LayoutRes int layoutResource) {
mLayoutResource = layoutResource;
}
/** @hide **/
public Runnable setLayoutResourceAsync(@LayoutRes int layoutResource) {
mLayoutResource = layoutResource;
return null;
}
/**
* Set {@link LayoutInflater} to use in {@link #inflate()}, or {@code null}
* to use the default.
*/
public void setLayoutInflater(LayoutInflater inflater) {
mInflater = inflater;
}
/**
* Get current {@link LayoutInflater} used in {@link #inflate()}.
*/
public LayoutInflater getLayoutInflater() {
return mInflater;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(0, 0);
}
@Override
public void draw(Canvas canvas) {
}
@Override
protected void dispatchDraw(Canvas canvas) {
}
/**
* When visibility is set to {@link #VISIBLE} or {@link #INVISIBLE},
* {@link #inflate()} is invoked and this StubbedView is replaced in its parent
* by the inflated layout resource. After that calls to this function are passed
* through to the inflated view.
*
* @param visibility One of {@link #VISIBLE}, {@link #INVISIBLE}, or {@link #GONE}.
*
* @see #inflate()
*/
@Override
@android.view.RemotableViewMethod(asyncImpl = "setVisibilityAsync")
public void setVisibility(int visibility) {
if (mInflatedViewRef != null) {
View view = mInflatedViewRef.get();
if (view != null) {
view.setVisibility(visibility);
} else {
throw new IllegalStateException("setVisibility called on un-referenced view");
}
} else {
super.setVisibility(visibility);
if (visibility == VISIBLE || visibility == INVISIBLE) {
inflate();
}
}
}
/** @hide **/
public Runnable setVisibilityAsync(int visibility) {
if (visibility == VISIBLE || visibility == INVISIBLE) {
ViewGroup parent = (ViewGroup) getParent();
return new ViewReplaceRunnable(inflateViewNoAdd(parent));
} else {
return null;
}
}
private View inflateViewNoAdd(ViewGroup parent) {
final LayoutInflater factory;
if (mInflater != null) {
factory = mInflater;
} else {
factory = LayoutInflater.from(mContext);
}
final View view = factory.inflate(mLayoutResource, parent, false);
if (mInflatedId != NO_ID) {
view.setId(mInflatedId);
}
return view;
}
private void replaceSelfWithView(View view, ViewGroup parent) {
final int index = parent.indexOfChild(this);
parent.removeViewInLayout(this);
final ViewGroup.LayoutParams layoutParams = getLayoutParams();
if (layoutParams != null) {
parent.addView(view, index, layoutParams);
} else {
parent.addView(view, index);
}
}
/**
* Inflates the layout resource identified by {@link #getLayoutResource()}
* and replaces this StubbedView in its parent by the inflated layout resource.
*
* @return The inflated layout resource.
*
*/
public View inflate() {
final ViewParent viewParent = getParent();
if (viewParent != null && viewParent instanceof ViewGroup) {
if (mLayoutResource != 0) {
final ViewGroup parent = (ViewGroup) viewParent;
final View view = inflateViewNoAdd(parent);
replaceSelfWithView(view, parent);
mInflatedViewRef = new WeakReference<>(view);
if (mInflateListener != null) {
mInflateListener.onInflate(this, view);
}
return view;
} else {
throw new IllegalArgumentException("ViewStub must have a valid layoutResource");
}
} else {
throw new IllegalStateException("ViewStub must have a non-null ViewGroup viewParent");
}
}
/**
* Specifies the inflate listener to be notified after this ViewStub successfully
* inflated its layout resource.
*
* @param inflateListener The OnInflateListener to notify of successful inflation.
*
* @see android.view.ViewStub.OnInflateListener
*/
public void setOnInflateListener(OnInflateListener inflateListener) {
mInflateListener = inflateListener;
}
/**
* Listener used to receive a notification after a ViewStub has successfully
* inflated its layout resource.
*
* @see android.view.ViewStub#setOnInflateListener(android.view.ViewStub.OnInflateListener)
*/
public static interface OnInflateListener {
/**
* Invoked after a ViewStub successfully inflated its layout resource.
* This method is invoked after the inflated view was added to the
* hierarchy but before the layout pass.
*
* @param stub The ViewStub that initiated the inflation.
* @param inflated The inflated View.
*/
void onInflate(ViewStub stub, View inflated);
}
/** @hide **/
public class ViewReplaceRunnable implements Runnable {
public final View view;
ViewReplaceRunnable(View view) {
this.view = view;
}
@Override
public void run() {
replaceSelfWithView(view, (ViewGroup) getParent());
}
}
}
| [
"[email protected]"
] | |
c06cfc814a32d082b6d0955d41664da6d2000561 | f704fa2f8164f646b6eec606b3a89953be34e3da | /src/main/java/servlets/DeleteCategoria.java | fdda5ff91b4008f102106b26f9071f8ba4fef0df | [] | no_license | Fab91-r/HoneyMoney | ae2c86ad2d1875a68e45f148632b77812dff31c5 | c71ed2a59be1758c3694d8674775158c15147d45 | refs/heads/master | 2022-07-03T19:44:15.725201 | 2019-09-08T13:31:38 | 2019-09-08T13:31:38 | 205,343,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,918 | java | package servlets;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import connections.ConnessioneDb;
import models.Categoria;
import models.Transazione;
public class DeleteCategoria extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
HttpSession session = req.getSession();
String user = (String) session.getAttribute("user");
int idCategoria = Integer.parseInt(req.getParameter("categoria"));
List<Transazione> listaTransazioniPerCategoria = new ArrayList<>();
String categoria = null;
try {
categoria = ConnessioneDb.getCategoria(idCategoria);
} catch (ClassNotFoundException | SQLException e1) {
e1.printStackTrace();
}
Categoria cat = new Categoria(categoria);
try {
listaTransazioniPerCategoria.addAll(ConnessioneDb.getTransazioniPerCategoria(cat, user));
} catch (ClassNotFoundException | SQLException e1) {
e1.printStackTrace();
}
if(listaTransazioniPerCategoria.isEmpty())
{
try {
ConnessioneDb.deleteCategoria(idCategoria);
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
String messaggio = "CATEGORIA ELIMINATA CON SUCCESSO!";
req.setAttribute("messaggio", messaggio);
}
else
{
String messaggio = "IMPOSSIBILE ELIMINARE LA CATEGORIA POICHE' ESISTONO TRANSAZIONI CON QUELLA CATEGORIA! ELIMINARE PRIMA LE RELATIVE TRANSAZIONI!";
req.setAttribute("messaggio2", messaggio);
}
getServletContext().getRequestDispatcher("/benvenuto.jsp").forward(req, resp);
}
}
| [
"[email protected]"
] | |
c4a57ece8b14f12f32278552925dea8008aad0b7 | e223d0d504b0ba0bf7c66ea39cc3eab92c0d7d38 | /src/main/java/com/youthchina/domain/tianjian/StuCollect.java | 3ad94a359914a4946d8a5ad8e1205df4367fce7c | [] | no_license | TeamYouthChina/backend | be27e0c0860d3ff951de3aee1aecb1c617b9bae8 | 7fa4bdae18def1a02ef19a0eb1b9d809dd522f99 | refs/heads/master | 2021-06-19T06:35:17.790968 | 2019-06-29T04:02:59 | 2019-06-29T04:02:59 | 156,775,820 | 5 | 9 | null | 2021-06-15T15:59:46 | 2018-11-08T22:12:36 | Java | UTF-8 | Java | false | false | 1,069 | java | package com.youthchina.domain.tianjian;
public class StuCollect {
private String stu_id;
private String job_id;
public String getStu_id() {
return stu_id;
}
public void setStu_id(String stu_id) {
this.stu_id = stu_id;
}
public String getJob_id() {
return job_id;
}
public void setJob_id(String job_id) {
this.job_id = job_id;
}
public String getJob_coll_time() {
return job_coll_time;
}
public void setJob_coll_time(String job_coll_time) {
this.job_coll_time = job_coll_time;
}
public String getCompany_id() {
return company_id;
}
public void setCompany_id(String company_id) {
this.company_id = company_id;
}
public String getCompany_coll_time() {
return company_coll_time;
}
public void setCompany_coll_time(String company_coll_time) {
this.company_coll_time = company_coll_time;
}
private String job_coll_time;
private String company_id;
private String company_coll_time;
}
| [
"[email protected]"
] | |
c39cbec060d0abd51c499e3b6a1013bc7f02e48f | 1c7a129552ceea34cd8ac6f721eec515ebf317e3 | /Time_Conversion.java | 04043f8bcd6026f7d67cd6bd623fedf29589d98e | [] | no_license | RamyaChinnadurai/Hackerrank_solutions-Algorithm-warmup | 0b2989bcd15c3a7d171708e7713073f2e03b9078 | c500c01718c493af0acebadeb10580bbb49caa0b | refs/heads/master | 2021-01-18T19:53:56.372704 | 2017-04-01T16:57:51 | 2017-04-01T16:57:51 | 86,919,649 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String time = in.next();
String hour = time.substring(0,2);
String mins = time.substring(3,5);
String secs = time.substring(6,8);
String meri = time.substring(8,10);
if(meri.equals("AM")){
if(Integer.parseInt(hour) == 12){
System.out.println("00:"+mins+":"+secs);
}
else{
System.out.println(hour+":"+mins+":"+secs);
}
}else{
if(Integer.parseInt(hour) < 12 ){
System.out.println((12+Integer.parseInt(hour))+":"+mins+":"+secs);
}
else{
System.out.println(hour+":"+mins+":"+secs);
}
}
}
}
| [
"[email protected]"
] | |
d1981d01a4c829dfc3c1c8f7079716eaccfd3303 | c2fa04760594de051e51eb1b7102b827424951ae | /YiXin/src/com/yxst/epic/yixin/activity/ContactSearchActivity.java | a533b8f489f0f13eca29ff93f3ac217542592af4 | [
"Apache-2.0"
] | permissive | glustful/mika | c3d9c7b61f02ac94a7e750ebf84391464054e2a3 | 300c9e921fbefd00734882466819e5987cfc058b | refs/heads/master | 2021-01-10T10:50:44.125499 | 2016-04-06T01:45:26 | 2016-04-06T01:45:26 | 55,567,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,868 | java | package com.yxst.epic.yixin.activity;
import org.androidannotations.annotations.AfterInject;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ItemClick;
import org.androidannotations.annotations.UiThread;
import org.androidannotations.annotations.ViewById;
import org.androidannotations.api.rest.RestErrorHandler;
import org.springframework.web.client.RestClientException;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.Toast;
import com.miicaa.home.R;
import com.yxst.epic.yixin.adapter.ContactSearchAdapter;
import com.yxst.epic.yixin.data.dto.model.Member;
import com.yxst.epic.yixin.data.dto.request.BaseRequest;
import com.yxst.epic.yixin.data.dto.request.SearchRequest;
import com.yxst.epic.yixin.data.dto.response.BaseResponse;
import com.yxst.epic.yixin.data.dto.response.SearchResponse;
import com.yxst.epic.yixin.data.rest.IMInterface;
import com.yxst.epic.yixin.rest.IMInterfaceProxy;
import com.yxst.epic.yixin.utils.CacheUtils;
import com.yxst.epic.yixin.view.ContactItemFooterView;
import com.yxst.epic.yixin.view.ContactItemFooterView_;
@EActivity(R.layout.activity_contact_search)
public class ContactSearchActivity extends ActionBarActivity implements
OnScrollListener, RestErrorHandler {
private static final String TAG = "ContactSearchActivity";
@ViewById
EditText etSearch;
@ViewById
ImageButton btnSearch;
@ViewById(android.R.id.list)
ListView mListView;
@Bean
ContactSearchAdapter mAdapter;
private ContactItemFooterView mFooterView;
IMInterface mIMInterfaceProxy;
@AfterInject
void afterInject() {
mIMInterfaceProxy = IMInterfaceProxy.create();
mIMInterfaceProxy.setRestErrorHandler(this);
}
@AfterViews
void afterViews() {
final ActionBar bar = getSupportActionBar();
bar.setTitle("搜索联系人");
int flags = ActionBar.DISPLAY_HOME_AS_UP;
int change = bar.getDisplayOptions() ^ flags;
bar.setDisplayOptions(change, flags);
mListView.setOnScrollListener(this);
ContactItemFooterView footerView = ContactItemFooterView_.build(this);
mFooterView = footerView;
setAdapter();
mFooterView.hide();
}
@Override
public boolean onSupportNavigateUp() {
finish();
return true;
}
private void setAdapter() {
mListView.addFooterView(mFooterView);
mListView.setAdapter(mAdapter);
}
private String searchKey;
@Click(R.id.btnSearch)
void onClickBtnSearch(View v) {
searchKey = etSearch.getText().toString();
if (!TextUtils.isEmpty(searchKey)) {
mAdapter.clear();
setAdapter();
mFooterView.show();
doInBackground(searchKey, 0);
}
}
int lastVisibleItem = 0;
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
Log.d(TAG, "onScrollStateChanged()");
Log.d(TAG, "onScrollStateChanged() lastVisibleItem:" + lastVisibleItem);
Log.d(TAG,
"onScrollStateChanged() mAdapter.getCount():"
+ mAdapter.getCount());
if (scrollState == OnScrollListener.SCROLL_STATE_IDLE
&& lastVisibleItem == mAdapter.getCount()) {
doInBackground(searchKey, mAdapter.getCount());
}
}
private int Count;
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
Log.d(TAG, "onScroll()");
Log.d(TAG, "onScroll() totalItemCount:" + totalItemCount);
Log.d(TAG, "onScroll() Count:" + Count);
// 计算最后可见条目的索引
lastVisibleItem = firstVisibleItem + visibleItemCount - 1;
// 所有的条目已经和最大条数相等,则移除底部的View
// if (totalItemCount == Count + 1) {
// mListView.removeFooterView(mFooterView);
// }
}
@Background
void doInBackground(String searchKey, int offset) {
onPreExecute();
BaseRequest baseRequest = CacheUtils.getBaseRequest(this);
SearchRequest request = new SearchRequest();
request.BaseRequest = baseRequest;
// request.SearchKey = "";
request.SearchKey = searchKey;
request.Offset = offset;
request.Limit = 20;
request.SearchType = SearchRequest.SEARCH_TYPE_USER;
Log.d(TAG, "doInBackground() request:" + request);
SearchResponse response = mIMInterfaceProxy.search(request);
onPostExecute(response);
}
@UiThread
void onPreExecute() {
mFooterView.setVisibility(View.VISIBLE);
}
@UiThread
void onPostExecute(SearchResponse response) {
Log.d(TAG, "onPostExecute() response:" + response);
if (response == null) {
return;
}
if (response.BaseResponse.Ret != BaseResponse.RET_SUCCESS) {
Toast.makeText(this, response.BaseResponse.ErrMsg,
Toast.LENGTH_SHORT).show();
return;
}
Count = response.Count;
mAdapter.addMembers(response.MemberList);
if (mAdapter.getCount() == Count) {
mListView.removeFooterView(mFooterView);
}
if (Count > 0 && mAdapter.getCount() == Count) {
mListView.removeFooterView(mFooterView);
Toast.makeText(this, "数据全部加载完成,没有更多数据!", Toast.LENGTH_SHORT).show();
}
}
@UiThread
@Override
public void onRestClientExceptionThrown(RestClientException e) {
Toast.makeText(this, "访问失败", Toast.LENGTH_SHORT).show();
if (mAdapter.getCount() == 0) {
mListView.removeFooterView(mFooterView);
}
}
@ItemClick(android.R.id.list)
void onItemClick(Member member) {
ContactDetailActivity_.intent(this).member(member)
.userName(member.UserName).start();
}
}
| [
"[email protected]"
] | |
0fdd6f9dc682b763a47a8b1c912280952f86e473 | 053907fcba677f7ee29b01d48563c06968564aee | /mis/src/main/java/kr/co/reyonpharm/models/ApproInfo.java | b6a4ab90f45e3b1030c49f7b1fafea4f1bcf1dca | [] | no_license | insanezindol/ryweb | a9c9060da1b647aa92daacd553beae75567bdd44 | af7421a21ba89439e625a49b77cfece56e9f1d35 | refs/heads/master | 2022-03-02T03:03:40.945053 | 2019-11-07T07:34:49 | 2019-11-07T07:34:49 | 192,834,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | package kr.co.reyonpharm.models;
import lombok.Getter;
import lombok.Setter;
public class ApproInfo {
private @Getter @Setter String approKey;
private @Getter @Setter String userNum;
private @Getter @Setter String approState;
private @Getter @Setter String upDate;
private @Getter @Setter String iseditable;
private @Getter @Setter String endDate;
private @Getter @Setter String fcode;
private @Getter @Setter String subject;
private @Getter @Setter String contents;
private @Getter @Setter String approSerial;
private @Getter @Setter String saCode;
}
| [
"[email protected]"
] | |
db8b71019386cba44523977b45761db780bf65e1 | f067d20fe6f2a0dd2a4a62798b6e5530acb92ea6 | /jdbc_forgit_1/src/com/imook/model/Goddess.java | fe8275a1a5e6607b350a9f4f670947aca0cfe6c7 | [] | no_license | zhaoyonxin/JDBC_NEW | 9f4d4529a20d3b7a3645a5826ab16c890df384a3 | 51742e123a0a4e52c6b15ccc49f3355582e60828 | refs/heads/master | 2021-05-02T00:00:55.551643 | 2016-12-07T09:54:12 | 2016-12-07T09:54:12 | 78,197,530 | 1 | 0 | null | 2017-01-06T10:29:10 | 2017-01-06T10:29:10 | null | UTF-8 | Java | false | false | 2,344 | java | package com.imook.model;
import java.sql.Date;
import java.sql.Timestamp;
public class Goddess {
private Long ID;
private Timestamp creat_at;
private Timestamp update_at;
private String name;
private Integer qq;
private String xiuzhenstyle;
private String biyeschool;
private Integer xuehao;
private Date ruxuetime;
private String ribaolianjie;
private String zhiyuan;
private String tuijianren;
public Long getID() {
return ID;
}
public void setID(Long iD) {
ID = iD;
}
public Timestamp getCreat_at() {
return creat_at;
}
public void setCreat_at(Timestamp creat_at) {
this.creat_at = creat_at;
}
public Timestamp getUpdate_at() {
return update_at;
}
public void setUpdate_at(Timestamp update_at) {
this.update_at = update_at;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getQq() {
return qq;
}
public void setQq(Integer qq) {
this.qq = qq;
}
public String getXiuzhenstyle() {
return xiuzhenstyle;
}
public void setXiuzhenstyle(String xiuzhenstyle) {
this.xiuzhenstyle = xiuzhenstyle;
}
public String getBiyeschool() {
return biyeschool;
}
public void setBiyeschool(String biyeschool) {
this.biyeschool = biyeschool;
}
public Integer getXuehao() {
return xuehao;
}
public void setXuehao(Integer xuehao) {
this.xuehao = xuehao;
}
public Date getRuxuetime() {
return ruxuetime;
}
public void setRuxuetime(Date ruxuetime) {
this.ruxuetime = ruxuetime;
}
public String getRibaolianjie() {
return ribaolianjie;
}
public void setRibaolianjie(String ribaolianjie) {
this.ribaolianjie = ribaolianjie;
}
public String getZhiyuan() {
return zhiyuan;
}
public void setZhiyuan(String zhiyuan) {
this.zhiyuan = zhiyuan;
}
public String getTuijianren() {
return tuijianren;
}
public void setTuijianren(String tuijianren) {
this.tuijianren = tuijianren;
}
@Override
public String toString() {
return "Goddess [ID=" + ID + ", creat_at=" + creat_at + ", update_at="
+ update_at + ", name=" + name + ", qq=" + qq
+ ", xiuzhenstyle=" + xiuzhenstyle + ", biyeschool="
+ biyeschool + ", xuehao=" + xuehao + ", ruxuetime="
+ ruxuetime + ", ribaolianjie=" + ribaolianjie + ", zhiyuan="
+ zhiyuan + ", tuijianren=" + tuijianren + "]";
}
}
| [
"[email protected]"
] | |
e77d367d7a325557838c4549878c5c79fb5e6ff9 | cf8bcdfeb3e4f7c73ffe62c37eb1ca84cbecc0dc | /JavaExamples/src/com/org/example/TestClass.java | f2826dacf9479da58f678a52c99c7c2e83066e96 | [] | no_license | nilam-code/workspace | 9fd9c5b5d725c588f92ba3dd2fb93236b041c91c | 1096f83729aa895d8317a66fc957ddc1fc310f7c | refs/heads/main | 2023-04-09T06:43:36.200914 | 2021-04-28T04:49:45 | 2021-04-28T04:49:45 | 362,338,329 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package com.org.example;
public class TestClass {
String str1 = "Java";
String str2 = "Java";
String str3 = new String(str1);
String str4 = new String(str1);
@Test
public void test1()
{
Assert.assertEqual(str1, str2);
}
}
| [
"[email protected]"
] | |
d38886ebd48bc57680bd1fc16085269ea2608d31 | 71030943c40106ef167227ab8192f0eb8a59335d | /src/test/java/net/wendal/nutzbook/DyDataSorce.java | 64b6a99fe2f72656bf90f65c2bf4df7007f1497f | [
"Apache-2.0",
"MIT"
] | permissive | vincent109/nutz-book-project | be2e21384044253d88e58cf4a1cf2bc049895c5d | e6423e4682ae89f374c7ff012560117a4a943791 | refs/heads/master | 2023-04-15T18:35:30.125944 | 2021-04-28T04:01:01 | 2021-04-28T04:01:01 | 74,447,410 | 0 | 0 | Apache-2.0 | 2021-04-28T04:01:02 | 2016-11-22T07:44:30 | JavaScript | UTF-8 | Java | false | false | 1,362 | java | package net.wendal.nutzbook;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;
import javax.sql.DataSource;
import org.nutz.lang.Lang;
public class DyDataSorce implements DataSource{
public static ThreadLocal<DataSource> th = new ThreadLocal<>();
public Connection getConnection() throws SQLException {
return th.get().getConnection();
}
// ---------------------------------
// ---- 其他方法没用
// ---------------------------------
public PrintWriter getLogWriter() throws SQLException {
throw Lang.noImplement();
}
public void setLogWriter(PrintWriter out) throws SQLException {
throw Lang.noImplement();
}
public void setLoginTimeout(int seconds) throws SQLException {
throw Lang.noImplement();
}
public int getLoginTimeout() throws SQLException {
throw Lang.noImplement();
}
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
throw Lang.noImplement();
}
public <T> T unwrap(Class<T> iface) throws SQLException {
throw Lang.noImplement();
}
public boolean isWrapperFor(Class<?> iface) throws SQLException {
throw Lang.noImplement();
}
public Connection getConnection(String username, String password) throws SQLException {
throw Lang.noImplement();
}
}
| [
"[email protected]"
] | |
c205967148ddc05d6ccd93d7d3ed32a5560085f7 | 941cb164c35d531de510e4aa95872711d3405e39 | /app/src/main/java/sinia/com/baihangeducation/minecompany/presenter/CompanyUCenterEditTrainingPresenter.java | e000bfd8c244e0a0c2804618b156c13d4723e853 | [] | no_license | lenka123123/jy | f81220d6f80cca4fde5872b4e3cb992abb5171b8 | 2a2fc5d675ec01fd45a3950f1adeb9bcea081c7a | refs/heads/master | 2020-03-28T00:50:19.854060 | 2018-11-30T06:15:47 | 2018-11-30T06:15:47 | 147,453,961 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,608 | java | package sinia.com.baihangeducation.minecompany.presenter;
import android.app.Activity;
import android.util.Log;
import com.example.framwork.base.BasePresenter;
import com.example.framwork.noHttp.Bean.BaseResponseBean;
import com.example.framwork.noHttp.OnRequestListener;
import java.util.HashMap;
import com.mcxtzhang.swipemenulib.info.TraingDetailInfo;
import sinia.com.baihangeducation.home.view.TraingDetailView;
import sinia.com.baihangeducation.supplement.tool.BaseRequestInfo;
public class CompanyUCenterEditTrainingPresenter extends BasePresenter {
private Activity activity;
private TraingDetailView view;
public CompanyUCenterEditTrainingPresenter(Activity activity, TraingDetailView view) {
super(activity);
this.activity = activity;
this.view = view;
}
public void getMyReleaseTrainingDetailInfo(){
HashMap info = BaseRequestInfo.getInstance().getRequestInfo(activity,"getTrainInfo","home",true);
info.put("train_id",view.getTrainId());
view.showLoading();
post(info, new OnRequestListener() {
@Override
public void requestSuccess(BaseResponseBean bean) {
Log.i("培训详情",bean.toString());
TraingDetailInfo mTraingDetailInfo = bean.parseObject(TraingDetailInfo.class);
view.getMyReleaseTraingDetailInfoSuccess(mTraingDetailInfo);
}
@Override
public void requestFailed(String error) {
}
@Override
public void requestFinish() {
}
});
}
}
| [
"[email protected]"
] | |
d7ff7ba7baef05ee297e1d19f23f9eb29fabcec7 | 355567b3d85ae83caf33e469a7bcb662498239bb | /src/main/java/com/ahnu/app/common/EmailConstant.java | 43cee16005768f8641bb195c7712eb4d96c51470 | [] | no_license | Rocinantee/campushoy | 6180608333d431819eecfbce3be437a3ce3ee3bd | 35dc2c50e2bf14a6610cf64ab22b4dc59a1ef596 | refs/heads/master | 2023-02-05T17:14:29.267784 | 2020-12-28T14:07:05 | 2020-12-28T14:07:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package com.ahnu.app.common;
/**
* @author [email protected]
* @date 8/4/2020 4:43 PM
*/
public interface EmailConstant {
String SUCCESS = "疫情信息提交成功";
String FAIL = "疫情信息提交失败";
}
| [
"[email protected]"
] | |
1635c76b6db4e34c6bcf05d358ab12934fb911f1 | 922a00017570decd4fde5eda79c43bb4327a37b0 | /web-customer-tracker/src/spring/project/service/CustomerService.java | e640a7f8f5ecc2ba77fa4c4eb75c99f1696b6fd4 | [] | no_license | jameszrx/Spring-Hibernate-Application | 74acee847a1d564341127c621385f9a14f5127cb | 6b2ce8e45c95ab715ed54d84391a85caac513dfa | refs/heads/master | 2021-01-19T18:36:00.628232 | 2017-04-23T00:59:33 | 2017-04-23T00:59:33 | 88,367,369 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package spring.project.service;
import java.util.List;
import spring.project.entity.Customer;
public interface CustomerService {
public List<Customer> getCustomers();
public void saveCustomer(Customer theCustomer);
public Customer getCustomer(String theID);
public void deleteCustomer(String theID);
}
| [
"[email protected]"
] | |
313bb8cd681b6dbb3eb7c6780018918f0d2aa3dc | 3aac6f4af51a75093975c5ed88c69a604c253187 | /app/src/main/java/com/koolz/kietcookery/menu.java | 435af6e340412d3e1613322aabfd2972d95bcc93 | [] | no_license | kritikkoolz/Kiet_Cookery | 9e5b2206d8fce67cae2be340e525a9661a3ad48c | f4736ed6037d15752e6361c4d94b52449a0a3295 | refs/heads/master | 2023-01-01T16:00:50.996134 | 2020-10-26T08:48:16 | 2020-10-26T08:48:16 | 307,309,497 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package com.koolz.kietcookery;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class menu extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
}
} | [
"[email protected]"
] | |
09b6a9be974c7e7b1b930bc08fce74ee61891919 | e401f15e851d1d163dd2c4a621ac4f627daf5534 | /charts/tool/src/main/java/com/s2charts/tool/util/JsonFormatTool.java | 4d5d201e8cbb5e1ee737c40c08e5a5ad8fa3fcc8 | [] | no_license | lyh95/s2charts | d74631c0456d0effc2953dc48bc2a4da16889324 | f0678e7ee1ee5415d7356775c5c359792ed50642 | refs/heads/master | 2023-04-27T19:04:13.183413 | 2019-12-09T09:08:12 | 2019-12-09T09:08:12 | 185,192,712 | 0 | 1 | null | 2023-04-14T17:42:37 | 2019-05-06T12:31:09 | JavaScript | UTF-8 | Java | false | false | 5,960 | java | package com.s2charts.tool.util;
import java.util.ArrayList;
/**
* json 格式化
*
* @author Linhao
*
*/
public class JsonFormatTool {
/**
* 制表符
*/
public static String FILL_STRING_UNIT_TAB = " ";
/**
* json字符串的格式化
* @param json 需要格式的json串
* @param fillStringUnit每一层之前的占位符号比如空格 制表符
* @return
*/
public static String formatJson(String json) {
return formatJson(json,FILL_STRING_UNIT_TAB);
}
/**
* json字符串的格式化
* @param json 需要格式的json串
* @param fillStringUnit每一层之前的占位符号比如空格 制表符
* @return
*/
public static String formatJson(String json, String fillStringUnit) {
if (json == null || json.trim().length() == 0) {
return json;
}
if(fillStringUnit == null){
fillStringUnit = FILL_STRING_UNIT_TAB;
}
int fixedLenth = 0;
ArrayList<String> tokenList = new ArrayList<String>();
{
String jsonTemp = json;
//预读取
while (jsonTemp.length() > 0) {
String token = getToken(jsonTemp);
jsonTemp = jsonTemp.substring(token.length());
token = token.trim();
tokenList.add(token);
}
}
for (int i = 0; i < tokenList.size(); i++) {
String token = tokenList.get(i);
int length = token.getBytes().length;
if (length > fixedLenth && i < tokenList.size() - 1 && tokenList.get(i + 1).equals(":")) {
fixedLenth = length;
}
}
StringBuilder buf = new StringBuilder();
int count = 0;
for (int i = 0; i < tokenList.size(); i++) {
String token = tokenList.get(i);
if (token.equals(",")) {
buf.append(token);
doFill(buf, count, fillStringUnit);
continue;
}else if (token.equals(":")) {
buf.append(" ").append(token).append(" ");
continue;
}else if (token.equals("{")) {
String nextToken = tokenList.get(i + 1);
if (nextToken.equals("}")) {
i++;
buf.append("{ }");
} else {
count++;
buf.append(token);
doFill(buf, count, fillStringUnit);
}
continue;
}else if (token.equals("}")) {
count--;
doFill(buf, count, fillStringUnit);
buf.append(token);
continue;
}else if (token.equals("[")) {
String nextToken = tokenList.get(i + 1);
if (nextToken.equals("]")) {
i++;
buf.append("[ ]");
} else {
count++;
buf.append(token);
doFill(buf, count, fillStringUnit);
}
continue;
} else if (token.equals("]")) {
count--;
doFill(buf, count, fillStringUnit);
buf.append(token);
continue;
}
buf.append(token);
//左对齐
if (i < tokenList.size() - 1 && tokenList.get(i + 1).equals(":")) {
int fillLength = fixedLenth - token.getBytes().length;
if (fillLength > 0) {
for(int j = 0; j < fillLength; j++) {
buf.append(" ");
}
}
}
}
return buf.toString();
}
/**
*
* @param json
* @return
*/
private static String getToken(String json) {
StringBuilder buf = new StringBuilder();
boolean isInYinHao = false;
while (json.length() > 0) {
String token = json.substring(0, 1);
json = json.substring(1);
if (!isInYinHao &&
(token.equals(":") || token.equals("{") || token.equals("}")
|| token.equals("[") || token.equals("]")
|| token.equals(","))) {
if (buf.toString().trim().length() == 0) {
buf.append(token);
}
break;
}
if (token.equals("\\")) {
buf.append(token);
buf.append(json.substring(0, 1));
json = json.substring(1);
continue;
}
if (token.equals("\"")) {
buf.append(token);
if (isInYinHao) {
break;
} else {
isInYinHao = true;
continue;
}
}
buf.append(token);
}
return buf.toString();
}
/**
* 填充字符串
* @param buf
* @param count
* @param fillStringUnit
*/
private static void doFill(StringBuilder buf, int count, String fillStringUnit) {
buf.append("\n");
for (int i = 0; i < count; i++) {
buf.append(fillStringUnit);
}
}
public static void main(String[] args){
String j = "[{\"name\":\"法人单位\",\"value\":\"单位数(万个)\"},{\"name\":\"企业法人\",\"value\":59.2},{\"name\":\"机关、事业法人\",\"value\":1.4},{\"name\":\"社会团体和其他法人\",\"value\":2.5}]";
System.out.println(formatJson(j));
}
}
| [
"[email protected]"
] | |
e8df3cef6bc2315ade4f54870edb9699a4b9a087 | b9648eb0f0475e4a234e5d956925ff9aa8c34552 | /google-ads-stubs-v10/src/main/java/com/google/ads/googleads/v10/services/stub/GrpcFeedMappingServiceStub.java | 527e4cd8ff3ab919ac11adc7789674a548742fa1 | [
"Apache-2.0"
] | permissive | wfansh/google-ads-java | ce977abd611d1ee6d6a38b7b3032646d5ffb0b12 | 7dda56bed67a9e47391e199940bb8e1568844875 | refs/heads/main | 2022-05-22T23:45:55.238928 | 2022-03-03T14:23:07 | 2022-03-03T14:23:07 | 460,746,933 | 0 | 0 | Apache-2.0 | 2022-02-18T07:08:46 | 2022-02-18T07:08:45 | null | UTF-8 | Java | false | false | 6,447 | 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.ads.googleads.v10.services.stub;
import com.google.ads.googleads.v10.services.MutateFeedMappingsRequest;
import com.google.ads.googleads.v10.services.MutateFeedMappingsResponse;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.common.collect.ImmutableMap;
import com.google.longrunning.stub.GrpcOperationsStub;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* gRPC stub implementation for the FeedMappingService service API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
public class GrpcFeedMappingServiceStub extends FeedMappingServiceStub {
private static final MethodDescriptor<MutateFeedMappingsRequest, MutateFeedMappingsResponse>
mutateFeedMappingsMethodDescriptor =
MethodDescriptor.<MutateFeedMappingsRequest, MutateFeedMappingsResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.ads.googleads.v10.services.FeedMappingService/MutateFeedMappings")
.setRequestMarshaller(
ProtoUtils.marshaller(MutateFeedMappingsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(MutateFeedMappingsResponse.getDefaultInstance()))
.build();
private final UnaryCallable<MutateFeedMappingsRequest, MutateFeedMappingsResponse>
mutateFeedMappingsCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcFeedMappingServiceStub create(FeedMappingServiceStubSettings settings)
throws IOException {
return new GrpcFeedMappingServiceStub(settings, ClientContext.create(settings));
}
public static final GrpcFeedMappingServiceStub create(ClientContext clientContext)
throws IOException {
return new GrpcFeedMappingServiceStub(
FeedMappingServiceStubSettings.newBuilder().build(), clientContext);
}
public static final GrpcFeedMappingServiceStub create(
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
return new GrpcFeedMappingServiceStub(
FeedMappingServiceStubSettings.newBuilder().build(), clientContext, callableFactory);
}
/**
* Constructs an instance of GrpcFeedMappingServiceStub, using the given settings. This is
* protected so that it is easy to make a subclass, but otherwise, the static factory methods
* should be preferred.
*/
protected GrpcFeedMappingServiceStub(
FeedMappingServiceStubSettings settings, ClientContext clientContext) throws IOException {
this(settings, clientContext, new GrpcFeedMappingServiceCallableFactory());
}
/**
* Constructs an instance of GrpcFeedMappingServiceStub, using the given settings. This is
* protected so that it is easy to make a subclass, but otherwise, the static factory methods
* should be preferred.
*/
protected GrpcFeedMappingServiceStub(
FeedMappingServiceStubSettings settings,
ClientContext clientContext,
GrpcStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
GrpcCallSettings<MutateFeedMappingsRequest, MutateFeedMappingsResponse>
mutateFeedMappingsTransportSettings =
GrpcCallSettings.<MutateFeedMappingsRequest, MutateFeedMappingsResponse>newBuilder()
.setMethodDescriptor(mutateFeedMappingsMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("customer_id", String.valueOf(request.getCustomerId()));
return params.build();
})
.build();
this.mutateFeedMappingsCallable =
callableFactory.createUnaryCallable(
mutateFeedMappingsTransportSettings,
settings.mutateFeedMappingsSettings(),
clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
@Override
public UnaryCallable<MutateFeedMappingsRequest, MutateFeedMappingsResponse>
mutateFeedMappingsCallable() {
return mutateFeedMappingsCallable;
}
@Override
public final void close() {
try {
backgroundResources.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new IllegalStateException("Failed to close resource", e);
}
}
@Override
public void shutdown() {
backgroundResources.shutdown();
}
@Override
public boolean isShutdown() {
return backgroundResources.isShutdown();
}
@Override
public boolean isTerminated() {
return backgroundResources.isTerminated();
}
@Override
public void shutdownNow() {
backgroundResources.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return backgroundResources.awaitTermination(duration, unit);
}
}
| [
"[email protected]"
] | |
dafa4f5e99ed39513e93008587a79e204a6e8282 | c0bc537eb8fd9fbac221318a6af660d6da80e7ea | /src/main/java/com/zhang/service/UsersService.java | 4a27fe5d0b08ebc14be34b93f7685a04e1f9f5d7 | [] | no_license | gczhangv/gczhang | d0e087423826175c7d13b4267a3c45c1cfe61112 | 3c7857a6a3bcdaab589cba4b65442c54bc07d22f | refs/heads/master | 2023-07-04T23:13:04.905279 | 2021-08-30T08:42:37 | 2021-08-30T08:42:37 | 401,199,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 142 | java | package com.zhang.service;
import com.zhang.pojo.Users;
public interface UsersService {
//登录
public Users login(Users users);
}
| [
"[email protected]"
] | |
67867c104a35b73de965fc6b340ff4bf6f074f94 | 1e23cc44fbf032bdeee9ef19617f446b1c5e8ffe | /app/src/main/java/aziz/sohail/mvpsample/di/DatabaseModule.java | a81cc37fbf1143181b8bf097d51838bee87078c2 | [
"Apache-2.0"
] | permissive | sohail-aziz/DogBreeds | 50e8c6a414e978fb1bf8747ca3a7cf2bb730a967 | efa667759640ecbd6821e135aebeb90d829ffa5b | refs/heads/master | 2021-05-02T16:45:08.880892 | 2018-02-11T00:00:52 | 2018-02-11T00:00:52 | 120,683,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 970 | java | package aziz.sohail.mvpsample.di;
import android.arch.persistence.room.Room;
import android.content.Context;
import javax.inject.Singleton;
import aziz.sohail.mvpsample.data.local.AppDatabase;
import aziz.sohail.mvpsample.data.local.BreedDao;
import aziz.sohail.mvpsample.data.local.DogDao;
import dagger.Module;
import dagger.Provides;
/**
* Dagger Module provides Database dependencies
*/
@Module
public class DatabaseModule {
private static final String DATABASE_NAME = "breed_app_database";
@Provides
@Singleton
AppDatabase provideDatabase(Context context) {
return Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, DATABASE_NAME)
.build();
}
@Singleton
@Provides
BreedDao provideBreedDao(AppDatabase database) {
return database.breedDao();
}
@Singleton
@Provides
DogDao provideDogDao(AppDatabase database) {
return database.dogDao();
}
}
| [
"[email protected]"
] | |
5ef9293dc9a688ee3b6766df54f0363b462ed141 | 0df29e25937a4906242865e61a5fa4b11e857989 | /app/src/main/java/org/debuggers/anew/toura/AsiaExpress.java | c5972f82442f19cec0bab846472ef1c950c75770 | [] | no_license | ArianulIslam/Toura | a35db338181f3f0c94a94651c05197f0dad2a6e1 | 7feaa55fddb1cf36f15826ad68eaf06882a3e8de | refs/heads/master | 2020-04-06T20:11:31.043279 | 2018-11-15T19:59:57 | 2018-11-15T19:59:57 | 157,764,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 378 | java | package org.debuggers.anew.toura;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.example.anew.toura.R;
public class AsiaExpress extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_asia_express);
}
}
| [
"Arianul Islam"
] | Arianul Islam |
71b9ab9072ac3d05774dc392a0feab021dc33f0e | 7a9a2df499b1728342aa58e570375cb8acc554cf | /IDE_WorkSpace_Spring/DAOProj4-CallbackInterface_RowMapper/src/main/java/com/nt/bo/EmployeeBO.java | b5700689fde567e07fd1410bbf3e5b346a3d9af6 | [] | no_license | danishali2196/SpringWorkspace | 57981e2497273da4ebdf27dcce803ab2ee49cdf5 | c63daab4e5eb2f5f9adfefd0fba95545b6580ce4 | refs/heads/master | 2022-12-21T09:30:56.777147 | 2019-10-07T06:20:15 | 2019-10-07T06:20:15 | 213,306,380 | 0 | 0 | null | 2022-12-16T00:39:31 | 2019-10-07T06:00:03 | Java | UTF-8 | Java | false | false | 218 | java | package com.nt.bo;
import java.io.Serializable;
import lombok.Data;
@Data
public class EmployeeBO implements Serializable {
private int eno;
private String ename;
private String desg;
private int salary;
}
| [
"[email protected]"
] | |
a031db0b7ea4ac3c7e76984c6cab25047b2f869c | fa7e1dc7b491f4b8b5eaa0b19f5b6500bae6296f | /core/src/com/gempukku/libgdx/graph/ui/graph/property/PropertyBoxImpl.java | 56c7d114fe9fe21945de08add7267314d5fddc81 | [
"MIT"
] | permissive | gamethapcam/libgdx-graph | 6e2327caeda003d2246b23bc75d018631f0546dc | a4d4dda0397e3bf4cf2cceb65ef3c1be17167585 | refs/heads/master | 2023-03-01T01:25:01.734619 | 2021-02-05T11:05:17 | 2021-02-05T11:05:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,282 | java | package com.gempukku.libgdx.graph.ui.graph.property;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.utils.JsonValue;
import com.gempukku.libgdx.graph.config.PropertyNodeConfiguration;
import com.gempukku.libgdx.graph.data.FieldType;
import com.gempukku.libgdx.graph.ui.graph.GraphBox;
import com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl;
import com.gempukku.libgdx.graph.ui.graph.GraphChangedEvent;
import com.gempukku.libgdx.graph.ui.producer.ValueGraphNodeOutput;
public class PropertyBoxImpl<T extends FieldType> extends Table implements PropertyBox<T> {
private T propertyType;
private PropertyDefaultBox propertyDefaultBox;
private TextField textField;
public PropertyBoxImpl(Skin skin, String name, T propertyType,
PropertyDefaultBox propertyDefaultBox) {
super(skin);
this.propertyType = propertyType;
this.propertyDefaultBox = propertyDefaultBox;
textField = new TextField(name, skin);
Table headerTable = new Table(skin);
headerTable.add(new Label("Name: ", skin));
headerTable.add(textField).growX();
textField.addListener(
new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
fire(new GraphChangedEvent(true, true));
}
});
headerTable.row();
add(headerTable).growX().row();
if (propertyDefaultBox != null)
add(propertyDefaultBox.getActor()).growX().row();
}
@Override
public T getType() {
return propertyType;
}
@Override
public String getName() {
return textField.getText();
}
@Override
public JsonValue getData() {
if (propertyDefaultBox != null) {
JsonValue data = propertyDefaultBox.serializeData();
if (data == null)
return null;
return data;
} else {
return null;
}
}
@Override
public Actor getActor() {
return this;
}
@Override
public GraphBox<T> createPropertyBox(Skin skin, String id, float x, float y) {
final String name = getName();
GraphBoxImpl<T> result = new GraphBoxImpl<T>(id, new PropertyNodeConfiguration<T>(name, propertyType), skin) {
@Override
public JsonValue getData() {
JsonValue result = new JsonValue(JsonValue.ValueType.object);
result.addChild("name", new JsonValue(name));
result.addChild("type", new JsonValue(propertyType.getName()));
return result;
}
};
result.addOutputGraphPart(skin, new ValueGraphNodeOutput<T>(name, propertyType));
if (propertyType.isTexture()) {
result.addGraphBoxPart(new TextureSettingsGraphBoxPart<T>(skin));
}
return result;
}
@Override
public void dispose() {
}
}
| [
"marcin.sciesinski"
] | marcin.sciesinski |
ffbc97704aab8d1b7759c2e036c448e626c76e3f | 3817034dadbc65e6ab8993072bf0a88d0886f553 | /src/main/java/az/mycompany/TechnoMarket/db/ProductRepo.java | dbedd480020fa85a3d0e264e99441013f79ee49f | [] | no_license | BaxtiyarMammadyarov/TechnoMarket | 8403f70dc0ac6df8d9ec8557a7b371b666a9c77f | 0d656c3a04664c109056b38ee0fdda48a13ae9db | refs/heads/master | 2023-06-21T10:42:25.947902 | 2021-07-15T12:26:22 | 2021-07-15T12:26:22 | 381,838,574 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,073 | java | package az.mycompany.TechnoMarket.db;
import az.mycompany.TechnoMarket.model.Brand;
import az.mycompany.TechnoMarket.model.Model;
import az.mycompany.TechnoMarket.model.Product;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class ProductRepo {
public List<Product> get() {
ConnectionDb conn = new ConnectionDb();
List<Product> list = new ArrayList<>();
try {
Statement stmt = conn.getConnection().createStatement();
ResultSet set = stmt.executeQuery("select * from product p join model m " +
"on (p.model_id=m.id) " +
" join " +
" brand b on(m.brand_id=b.id)");
while (set.next()) {
list.add(convertResultSetToProduct(set));
}
conn.disConnection();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return list;
}
public Product add(Product product) {
ModelRepo repo = new ModelRepo();
ConnectionDb conn = new ConnectionDb();
Product product1 = getByNameAndColor(product.getName(), product.getColor());
Model model = new Model();
try {
if (product1 == null) {
if (repo.existByModel(product.getModel())) {
model = repo.getByName(product.getModel().getName());
} else {
model = repo.add(product.getModel());
}
PreparedStatement stmt = conn
.getConnection()
.prepareStatement(
"insert into product(" +
"name,color,photo,product_type,price,product_count,model_id,create_date) " +
"values(?,?,?,?,?,?,?,?) ");
stmt.setString(1, product.getName());
stmt.setString(2, product.getColor());
stmt.setString(3, product.getPhoto());
stmt.setString(4,product.getType());
stmt.setBigDecimal(5,product.getPrice());
stmt.setInt(6, product.getCountProduct());
stmt.setInt(7, model.getId());
LocalDateTime dateTime=LocalDateTime.now();
stmt.setString(8,dateTime.toString());
stmt.executeUpdate();
product.setModel(model);
conn.disConnection();
} else {
product = product1;
}
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return product;
}
public void delete(int id) {
ConnectionDb conn = new ConnectionDb();
try {
PreparedStatement stmt = conn
.getConnection()
.prepareStatement("update product set enabled=false where id=?");
stmt.setInt(1, id);
stmt.executeUpdate();
conn.disConnection();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
public void update(Product product) {
}
public Product getByNameAndColor(String name, String color) {
ConnectionDb connection = new ConnectionDb();
Product product = null;
try {
PreparedStatement statement = connection
.getConnection()
.prepareStatement("select * from product where name=? and color=?");
statement.setString(1, name);
statement.setString(2, color);
ResultSet set = statement.executeQuery();
while (set.next()) {
product = convertResultSetToProduct(set);
}
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return product;
}
private Product convertResultSetToProduct(ResultSet set) throws SQLException {
return new Product(set.getInt("product.id")
, LocalDateTime.parse(set.getString("product.create_date"))
, set.getBoolean("product.enabled")
, set.getString("product.name")
, set.getString("color")
, set.getString("photo")
,set.getString("type")
,set.getBigDecimal("price")
, set.getInt("count_product"),
new Model(set.getInt("model.id")
, LocalDateTime.parse(set.getString("model.create_date"))
, set.getBoolean("model.enabled")
, set.getString("model.name"),
new Brand(set.getInt("brand.id")
, LocalDateTime.parse(set.getDate("brand.create_date").toString())
, set.getBoolean("brand.enabled")
, set.getString("brand.name"))));
}
public List<String>getBrandNameByType(String type){
List<String>list=new ArrayList<>();
ConnectionDb conn = new ConnectionDb();
try {
PreparedStatement stmt = conn
.getConnection()
.prepareStatement("select distinct p.product_type from product p join model m " +
"on (p.model_id=m.id)" +
"join brand b on(m.brand_id=b.id)" +
"where p.product_type=?");
stmt.setString(1, type);
try (ResultSet resultSet = stmt.executeQuery()) {
while (resultSet.next()) {
list.add(resultSet.getString(type));
}
}
conn.disConnection();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return list;
}
}
| [
"[email protected]"
] | |
d98594cb61c2781f7fb92fbed2b053c80b4105d3 | 1c6d47856e1c6969ea5028b07ac23b967e42b69d | /Byte/code/learn-byte/src/main/java/lsieun/bit/c_use/C_Port.java | ebd201eb144658faca81ea8ce2eaab83900512f9 | [
"MIT"
] | permissive | Silentsoul04/learn-java | 439f82ff387ae1fc6fdd1e58a8066c313453d0c5 | 03bdac6fa970051de305db40300fae228810aaf3 | refs/heads/master | 2022-12-30T04:01:13.922338 | 2020-08-01T10:57:38 | 2020-08-01T10:57:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,023 | java | package lsieun.bit.c_use;
import java.nio.ByteBuffer;
import java.util.Random;
public class C_Port {
public static void main(String[] args) {
Random rand = new Random();
for (int i = 0; i < 1000; i++) {
byte b1 = (byte) rand.nextInt(256);
byte b2 = (byte) rand.nextInt(256);
int result1 = toInt1(b1, b2);
int result2 = toInt2(b1, b2);
if (result1 != result2) {
System.out.println(b1 + ", " + b2 + ": " + result1 + ", " + result2);
}
}
}
public static int toInt1(byte b1, byte b2) {
return (b1 & 0xFF) << 8 | (b2 & 0xFF);
}
public static int toInt2(byte b1, byte b2) {
byte[] bytes = new byte[Integer.BYTES];
bytes[0] = 0;
bytes[1] = 0;
bytes[2] = b1;
bytes[3] = b2;
ByteBuffer byteBuffer = ByteBuffer.allocate(Integer.BYTES);
byteBuffer.put(bytes);
byteBuffer.flip();
return byteBuffer.getInt();
}
}
| [
"[email protected]"
] | |
a3eefd3fe91d6e19facf4472b48a673019427a5a | 4a6cd138d75c2bbd59bdbd2842024cdef59f6830 | /src/com/haiyangsherry/TaxCalculator.java | 5490081a401e27812131252597ed002edd070d2c | [] | no_license | qqq99/Design_Pattern | 089cc61e509a474858eb6b1331b0f6bded0e2796 | eadb6a84fa20fd1746312ada7a6fff0025236935 | refs/heads/main | 2023-03-01T03:27:05.522161 | 2021-02-05T08:34:47 | 2021-02-05T08:34:47 | 336,132,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 89 | java | package com.haiyangsherry;
public interface TaxCalculator {
float calculateTax();
}
| [
"[email protected]"
] | |
bfc254ee6198b07d8470b4fc1993019bd8dcce01 | 3dba936ff974e75deab369091a462c24dcfac30e | /combates/Acoes.java | abfb21738cbe9a87f1b304c2065f05571a173c18 | [] | no_license | cristianodecastro/scape | cee9d85bf88bac0eef522c593ad88ac7b9dacef3 | dba217c24288d704be4cfc196c5905f2a5f8fc1a | refs/heads/main | 2023-06-25T14:58:20.881376 | 2021-08-02T14:04:50 | 2021-08-02T14:04:50 | 391,967,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,148 | java | package combates;
import aplicacao.Jogo;
import interfaces.telas.combate.Combate;
import interfaces.telas.combate.LogCombate;
import monstros.Monstro;
import java.util.Random;
public class Acoes{ // Classe com métodos estáticos para as ações de combate
public static void confronto(Monstro monstro){ // Método que controla os ataques entre um jogador e um monstro
int velJogador = Jogo.getJogador().getClasse().getAtributos().getVelocidade();
int velMonstro = monstro.getVelocidade();
if(velJogador >= velMonstro){ // Verificação das velocidades para ver quem ataca primeiro
ataqueJogador(monstro);
ataqueMonstro(monstro);
}else{
ataqueMonstro(monstro);
ataqueJogador(monstro);
}
}
private static void ataqueJogador(Monstro monstro){ // Método que controla o ataque do jogador
Random rand = new Random();
int forcaGolpe = Jogo.getJogador().getClasse().getAtributos().getForca();
int sorteJogador = Jogo.getJogador().getClasse().getAtributos().getSorte();
int aleat = rand.nextInt(100);
if(aleat+sorteJogador > 90){
forcaGolpe *= 2;
LogCombate.addLog(" - Você acertou um golpe crítico no monstro e ele perdeu "+forcaGolpe+" de vida.");
}else if(aleat+sorteJogador > 75){
forcaGolpe = (int) (forcaGolpe * 1.5);
LogCombate.addLog(" - Você acertou um golpe forte no monstro e ele perdeu "+forcaGolpe+" de vida.");
}else if(aleat <= 5){
forcaGolpe = 0;
LogCombate.addLog(" - Você errou o seu ataque.");
}else{
LogCombate.addLog(" - Você atacou o monstro e ele perdeu "+forcaGolpe+" de vida.");
}
Jogo.getJogador().atacar(monstro, forcaGolpe);
}
private static void ataqueMonstro(Monstro monstro){ // Método que controla o ataque do monstro
Random rand = new Random();
int velocidadeJogador = Jogo.getJogador().getClasse().getAtributos().getVelocidade();
int inteligenciaJogador = Jogo.getJogador().getClasse().getAtributos().getInteligencia();
int sorteJogador = Jogo.getJogador().getClasse().getAtributos().getSorte();
int poderGolpe = monstro.getPoder();
int aleat = rand.nextInt(100);
if(aleat-sorteJogador > 90){
poderGolpe *= 2;
LogCombate.addLog(" - O monstro te acertou um golpe crítico e você perdeu "+poderGolpe+" de vida.");
}else if(aleat-sorteJogador > 75){
poderGolpe = (int) (poderGolpe * 1.5);
LogCombate.addLog(" - O monstro te acertou um golpe forte e você perdeu "+poderGolpe+" de vida.");
}else if(aleat-sorteJogador < 30 && aleat-sorteJogador > 5){ // Uso da velocidade e inteligência para diminuir o dano sofrido
poderGolpe -= (int) ((velocidadeJogador * 0.20)+(inteligenciaJogador * 0.20));
LogCombate.addLog(" - O monstro não conseguiu te acertar em cheio e você perdeu "+poderGolpe+" de vida.");
}else if(aleat <= 5){
poderGolpe = 0;
LogCombate.addLog(" - O monstro errou o seu ataque.");
}else{
LogCombate.addLog(" - O monstro te atacou e você perdeu "+poderGolpe+" de vida.");
}
monstro.atacar(poderGolpe);
}
public static void retirada(Monstro monstro){ // Método que controla as chances e consequências de uma fuga
Random rand = new Random();
int velJogador = Jogo.getJogador().getClasse().getAtributos().getVelocidade();
int velMonstro = monstro.getVelocidade();
int randomico = rand.nextInt(velJogador+velMonstro) + 1;
System.out.println("Vel jog: "+velJogador);
System.out.println("Vel mon: "+velMonstro);
System.out.println("Número vencedor da velocidade: "+(randomico)); /////////
if(randomico <= velJogador){
Combate.terminarCombate(); // Se não for possível fugir, o monstro atacará
}else{
ataqueMonstro(monstro);
LogCombate.addLog(" - Você não conseguiu fugir!");
}
}
} | [
"[email protected]"
] | |
242859e08c0baca7bc30c20cd599d36a4f8b9836 | dd18d4e3b7464f6bd59c6111b1b4ecececfbd00b | /src/test/java/ec/sevolutivo/health/service/UserServiceIntTest.java | 4cac80b38df3ab05f9c1262606ef4e4e754e8158 | [] | no_license | ja1979/21points | 5fbc489b1d296dfb148303dda232a4c53dc0c900 | 9e95c9d2099e7d1857bb6f9dfb623d6d451999e0 | refs/heads/master | 2021-01-21T14:32:19.485691 | 2017-06-24T11:39:45 | 2017-06-24T11:39:45 | 95,293,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,347 | java | package ec.sevolutivo.health.service;
import ec.sevolutivo.health.Application;
import ec.sevolutivo.health.domain.User;
import ec.sevolutivo.health.repository.UserRepository;
import java.time.ZonedDateTime;
import ec.sevolutivo.health.service.util.RandomUtil;
import java.time.LocalDate;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.test.context.junit4.SpringRunner;
import javax.inject.Inject;
import java.util.Optional;
import java.util.List;
import static org.assertj.core.api.Assertions.*;
/**
* Test class for the UserResource REST controller.
*
* @see UserService
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@Transactional
public class UserServiceIntTest {
@Inject
private UserRepository userRepository;
@Inject
private UserService userService;
@Test
public void assertThatUserMustExistToResetPassword() {
Optional<User> maybeUser = userService.requestPasswordReset("john.doe@localhost");
assertThat(maybeUser.isPresent()).isFalse();
maybeUser = userService.requestPasswordReset("admin@localhost");
assertThat(maybeUser.isPresent()).isTrue();
assertThat(maybeUser.get().getEmail()).isEqualTo("admin@localhost");
assertThat(maybeUser.get().getResetDate()).isNotNull();
assertThat(maybeUser.get().getResetKey()).isNotNull();
}
@Test
public void assertThatOnlyActivatedUserCanRequestPasswordReset() {
User user = userService.createUser("johndoe", "johndoe", "John", "Doe", "john.doe@localhost", "en-US");
Optional<User> maybeUser = userService.requestPasswordReset("john.doe@localhost");
assertThat(maybeUser.isPresent()).isFalse();
userRepository.delete(user);
}
@Test
public void assertThatResetKeyMustNotBeOlderThan24Hours() {
User user = userService.createUser("johndoe", "johndoe", "John", "Doe", "john.doe@localhost", "en-US");
ZonedDateTime daysAgo = ZonedDateTime.now().minusHours(25);
String resetKey = RandomUtil.generateResetKey();
user.setActivated(true);
user.setResetDate(daysAgo);
user.setResetKey(resetKey);
userRepository.save(user);
Optional<User> maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey());
assertThat(maybeUser.isPresent()).isFalse();
userRepository.delete(user);
}
@Test
public void assertThatResetKeyMustBeValid() {
User user = userService.createUser("johndoe", "johndoe", "John", "Doe", "john.doe@localhost", "en-US");
ZonedDateTime daysAgo = ZonedDateTime.now().minusHours(25);
user.setActivated(true);
user.setResetDate(daysAgo);
user.setResetKey("1234");
userRepository.save(user);
Optional<User> maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey());
assertThat(maybeUser.isPresent()).isFalse();
userRepository.delete(user);
}
@Test
public void assertThatUserCanResetPassword() {
User user = userService.createUser("johndoe", "johndoe", "John", "Doe", "john.doe@localhost", "en-US");
String oldPassword = user.getPassword();
ZonedDateTime daysAgo = ZonedDateTime.now().minusHours(2);
String resetKey = RandomUtil.generateResetKey();
user.setActivated(true);
user.setResetDate(daysAgo);
user.setResetKey(resetKey);
userRepository.save(user);
Optional<User> maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey());
assertThat(maybeUser.isPresent()).isTrue();
assertThat(maybeUser.get().getResetDate()).isNull();
assertThat(maybeUser.get().getResetKey()).isNull();
assertThat(maybeUser.get().getPassword()).isNotEqualTo(oldPassword);
userRepository.delete(user);
}
@Test
public void testFindNotActivatedUsersByCreationDateBefore() {
userService.removeNotActivatedUsers();
ZonedDateTime now = ZonedDateTime.now();
List<User> users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minusDays(3));
assertThat(users).isEmpty();
}
}
| [
"[email protected]"
] | |
8af58dff8c6c88cb0122f00c576de77e652a2380 | 4aa1561a98b7357a4c793174d8b97ba31c8832f4 | /CAR/tp1/src/ftp/server/command/FTPPassCommand.java | e099116ccf96156dd638e4a1e7e9bc395dfe8c56 | [] | no_license | TahaS10/m1s2 | 70344e9bb887b974726440f35433266c01c4e69e | 117a9482cccef99d021efc6eb43ab21f9f03badb | refs/heads/master | 2021-01-16T22:37:52.779088 | 2015-05-20T15:13:15 | 2015-05-20T15:13:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,135 | java | package ftp.server.command;
import java.io.IOException;
import java.net.Socket;
import ftp.shared.FTPClientConfiguration;
import ftp.shared.FTPDatabase;
import ftp.shared.FTPRequest;
/**
* Class representing a PASS command
*/
public class FTPPassCommand extends FTPBasicCommand {
/**
* constructs a PASS command
* @param database the database
*/
public FTPPassCommand(FTPDatabase database) {
super(database, "PASS");
}
@Override
public boolean isValid(FTPRequest request) {
return request.getLength() == 2;
}
@Override
public void executeValidCommand(FTPRequest request,
FTPClientConfiguration clientConfiguration) throws IOException {
final String username = clientConfiguration.getUsername();
final Socket connection = clientConfiguration.getCommandSocket();
final FTPDatabase database = getDatabase();
if (clientConfiguration.getUsername() == null) {
sendCommand(connection, 530);
}
if (request.getArgument().equals(database.getAccounts().get(username))) {
sendCommand(connection, 230);
clientConfiguration.setConnected(true);
} else {
sendCommand(connection, 332);
}
}
}
| [
"[email protected]"
] | |
d28f3755c0ab3c6484458e1f70c6cf625aca617b | 623bdd9d8f348c95b743b3fa03389f470fe50f22 | /WebCrawler/src/main/java/org/scalable/web/htmlreader/HTMLReaderImpl.java | d7a95b2a95a78b18eb37b416c2946888de100ca9 | [] | no_license | code-by-code/samples | ab6357790f9c51633dd5b6bc2a0ffa508e926abe | fb30cff9e8e6e6f76625c4f3b010f0cd0abb3f72 | refs/heads/master | 2021-01-12T12:33:47.049266 | 2016-11-01T21:38:15 | 2016-11-01T21:38:15 | 72,562,890 | 0 | 0 | null | 2016-11-01T21:38:16 | 2016-11-01T18:08:28 | Java | UTF-8 | Java | false | false | 1,866 | java | package org.scalable.web.htmlreader;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.scalable.web.util.LoggerFactory;
/**
* {@link HTMLReader} implementation with core java for reading html contents
* from a web page.
*
* @author Jino George
*/
public class HTMLReaderImpl implements HTMLReader
{
private Logger logger = LoggerFactory.getLogger(HTMLReaderImpl.class);
/**
* Constructor.
*/
public HTMLReaderImpl()
{
super();
}
/*
* (non-Javadoc)
* @see org.scalable.web.htmlreader.HTMLReader#read(java.net.URL)
*/
@Override
public String read(URL url)
{
StringBuilder builder = new StringBuilder();
if(url != null)
{
try
{
// Opening connection.
URLConnection connection = url.openConnection();
connection.setRequestProperty("User-Agent", "CrawlerBot 1.0");
// Reading the HTML content.
logger.log(Level.INFO, "Reading HTML from " + url.toString());
Scanner scanIn = new Scanner(connection.getInputStream());
while(scanIn.hasNextLine())
{
builder.append(scanIn.nextLine());
}
scanIn.close();
}
catch(IOException e)
{
logger.log(Level.WARNING, "Could not read from " + url.toString() + " due to : "
+ e.getLocalizedMessage());
}
logger.log(Level.FINEST, "HTML content of " + url.toString() + " : " + builder);
}
return builder.toString();
}
}
| [
"[email protected]"
] | |
69b5479c1fe4c3e7fd55979f14efe31e6f3baece | e818448c95f96b49638079eb7565d922e932351a | /src/main/java/com/example/app/controler/TaskController.java | 705e323b5de14204d9ffe2978578a8ca5b808f83 | [] | no_license | Gavaharlal/PPO_Hw4 | 33c359ac7cd96f16f1e5cdfaa6aacf97bf6eec6e | 56773d22f9c7e5a078f1c9410479d496a8a373ee | refs/heads/master | 2023-01-22T17:24:18.499184 | 2020-11-24T06:33:11 | 2020-11-24T06:33:11 | 315,528,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,359 | java | package com.example.app.controler;
import com.example.app.model.Task;
import com.example.app.model.TaskList;
import com.example.app.repository.TaskListRepository;
import com.example.app.repository.TaskRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@Controller
public class TaskController {
private final TaskRepository taskRepository;
private final TaskListRepository taskListRepository;
@Autowired
public TaskController(TaskRepository taskRepository, TaskListRepository taskListRepository) {
this.taskRepository = taskRepository;
this.taskListRepository = taskListRepository;
}
@GetMapping("/task-lists")
public String getTaskLists() {
return "redirect:/";
}
@GetMapping("/")
public String getIndex(Model model) {
prepareModel(model, taskListRepository.findAll());
return "task_list";
}
@PostMapping("/create-task-list")
public String createTaskList(@ModelAttribute("taskList") TaskList taskList) {
taskListRepository.save(taskList);
return "redirect:/";
}
@PostMapping("/delete-task-list")
public String deleteTaskList(@RequestParam("deleteTaskId") long id) {
taskListRepository.deleteById(id);
return "redirect:/";
}
@PostMapping("/create-task")
public String createTask(@ModelAttribute("task") Task task) {
taskRepository.save(task);
return "redirect:/";
}
@PostMapping("/change-status")
public String completeTask(@RequestParam("taskId") long id, @RequestParam("status") boolean isComplete) {
taskRepository.updateTaskStatus(id, isComplete);
return "redirect:/";
}
private void prepareModel(Model model, List<TaskList> taskList) {
model.addAttribute("taskLists", taskList);
model.addAttribute("taskList", new TaskList());
Task task = new Task();
task.setTaskList(new TaskList());
model.addAttribute("task", task);
}
}
| [
"[email protected]"
] | |
622513442b162a0eb6262b64ffcbe4d269ce1e4d | 444e0e1a702526e0cb1e47384e40dd65713d7103 | /Tic-Tac-Toe/Problems/Initializing an array of integers/src/Matrix.java | f3b3b48b590c2d6e389a3ad922c0e062561ab51c | [] | no_license | emaphis/Hyperskill | 4aec16a43f1edeba7882714bbf3e61c4046002d5 | 6f22981a532d43756ea1da2238d059fb0c32f1da | refs/heads/master | 2022-12-06T18:00:29.457772 | 2020-08-30T01:51:49 | 2020-08-30T01:51:49 | 284,158,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 919 | java | import java.util.Arrays;
import java.util.Scanner;
public class Matrix {
public static void main(String[] args) {
// put your code here
System.out.println("Matrix a");
Scanner scan = new Scanner(System.in);
String line = scan.nextLine();
String[] pieces = line.split(" ");
int[] a = new int[pieces.length];
for (int i = 0; i < pieces.length; i++) {
a[i] = Integer.parseInt(pieces[i]);
}
int num = scan.nextInt();
// num %= pieces.length;
for (int k = 0; k < num; k++) {
int temp = a[a.length - 1];
for (int i = a.length - 1; i > 0; i--) {
a[i] = a[i - 1];
}
a[0] = temp;
System.out.print(Arrays.toString(a));
System.out.println();
}
for (int n: a) {
System.out.print(n + " ");
}
}
}
| [
"[email protected]"
] | |
03fc207a92c3ae52aaabbca110410ed47514a77c | 32d74d37bc3f44f356fdd9f6fb06b763c2d2cde6 | /SkolaSem/src/Entity/StudentInfo.java | f40ed0b1b3b1ca988a053b5117c0cd2db6b12109 | [] | no_license | saficheck/StudentClassesAndMarks | 634c4e2efe4e892f8af63cce50ab9d233fbbee7b | eedc8bad762a3b6dc5e994924ccfc15fd63008cf | refs/heads/master | 2022-11-22T00:32:47.152336 | 2020-07-29T14:34:50 | 2020-07-29T14:34:50 | 283,491,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,985 | 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 Entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
*
* @author Filip
*/
@Entity
public class StudentInfo implements Serializable {
private static final long serialVersionUID = 1L;
private String Nazev;
private String Zapocet;
public StudentInfo(String string, String string0) {
Nazev=string;
Zapocet = string0;
}
public String getNazev() {
return Nazev;
}
public void setNazev(String Nazev) {
this.Nazev = Nazev;
}
public String getZapocet() {
return Zapocet;
}
public void setZapocet(String Zapocet) {
this.Zapocet = Zapocet;
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.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 StudentInfo)) {
return false;
}
StudentInfo other = (StudentInfo) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "Entity.StudentInfo[ id=" + id + " ]";
}
}
| [
"[email protected]"
] | |
1899129d523f0136fbe4bdad9c5d652b7bba1fef | e91c3d55527b87a5aac32a5fcd8726d359a5ec77 | /TP3_Cote_Francis_StLaurent_Daren/src/tp3_cote_francis_stlaurent_daren/Identifier.java | 7671b9262267791a41a61d325fceb10decd5492e | [] | no_license | daren511/Tp3_BD | b732a0c03d9a093629eca1e7c86fbc050929146e | 6ca82ff01b2dd8d780eb9c20d34e3eaa6d91cd0c | refs/heads/master | 2020-02-26T14:33:05.746719 | 2014-04-22T16:10:47 | 2014-04-22T16:10:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,913 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tp3_cote_francis_stlaurent_daren;
import tp3_cote_francis_stlaurent_daren.JFrameGestion;
import tp3_cote_francis_stlaurent_daren.ConnectionOracle;
import javax.swing.*;
import java.awt.*;
import java.sql.*;
/**
*
* @author prof Saliha
*/
public class Identifier extends javax.swing.JFrame {
/**
* Creates new form Identifier
*/
public Identifier()
{
initComponents();
connBD = new ConnectionOracle();
}
/**
* 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() {
jBconnecter = new javax.swing.JButton();
jTextUser = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jBdeconnecter = new javax.swing.JButton();
TB_Password = new javax.swing.JPasswordField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Etablir une connexion");
jBconnecter.setText("Se connecter");
jBconnecter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBconnecterActionPerformed(evt);
}
});
jTextUser.setText("cotefran");
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel1.setText("Nom usager");
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel2.setText("Mot de Passe");
jBdeconnecter.setText("Se deconnecter");
jBdeconnecter.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBdeconnecterActionPerformed(evt);
}
});
TB_Password.setText("oracle1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(jBconnecter)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBdeconnecter)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(43, 43, 43)
.addComponent(TB_Password))
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jTextUser, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(121, 121, 121))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(81, 81, 81)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(TB_Password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBconnecter)
.addComponent(jBdeconnecter))
.addContainerGap(111, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jBconnecterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBconnecterActionPerformed
// TODO add your handling code here:
String n = jTextUser.getText();
String m = TB_Password.getText();
connBD.setConnection(n,m);
connBD.connecter();
// appel de la classe JFrameGestion (en utilisant un objet ConnectionOracle
JFrameGestion fenetre = new JFrameGestion(connBD);
fenetre.setVisible(true);
}//GEN-LAST:event_jBconnecterActionPerformed
private void jBdeconnecterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBdeconnecterActionPerformed
// TODO add your handling code here:
connBD.deconnecter();
System.exit(0);
}//GEN-LAST:event_jBdeconnecterActionPerformed
/**
* @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(Identifier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Identifier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Identifier.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Identifier.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 Identifier().setVisible(true);
}
});
}
// Declaration d'une variable connBD de type ConnectionOracle
private ConnectionOracle connBD;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPasswordField TB_Password;
private javax.swing.JButton jBconnecter;
private javax.swing.JButton jBdeconnecter;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField jTextUser;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
b4d5f90523450bebd291e004ec5897413facd8ec | 6f250e1a7ddc213aff4ff68558c95d01391365c5 | /BaseStudy_SE/java_Core/src/java_Core4/IO/Properties/FruitTest.java | cf6ecef96fdb048b2cf83e7c850756f94aa0587d | [] | no_license | yufeng218/java_code | 16b68b8783efd0fc7cf968750cacd4bb6f9eaf0a | ac96f7a07cbc163cd1e8222403a3919d165574b6 | refs/heads/master | 2021-01-01T05:27:20.737636 | 2017-03-03T18:20:52 | 2017-03-03T18:20:52 | 57,600,160 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package java_Core4.IO.Properties;
public class FruitTest {
public static void main(String[] args) {
/*
Fruit fruit = FruitFactory.getInstance("apple");
fruit.grow();
fruit.harvest();
Fruit fruit1 = FruitFactory.getInstance("grape");
fruit1.grow();
fruit1.harvest();
*/
Fruit fruit = FruitFactory.getClassName();
fruit.grow();
fruit.harvest();
}
}
| [
"[email protected]"
] | |
bf7784de95785cd4bc2b2065b6df8622d0ad75bb | 8fa42a21ca1bb6aa2051a5f0bb4a7f9948d6fe47 | /src/main/java/br/com/caelum/ingresso/model/Sessao.java | 5cf73aa2e9141c4143fb80439f757094bafa890a | [] | no_license | JeisielS/fj22-ingressos | 1461a4d93c19de004e0a30488da9ed0e6de6e22e | 42f7bb42fcb46c320da4e017d72fa4233a9e3637 | refs/heads/master | 2021-04-06T03:56:41.638977 | 2018-03-17T00:42:47 | 2018-03-17T00:42:47 | 124,969,396 | 0 | 0 | null | 2018-03-13T00:37:35 | 2018-03-13T00:37:34 | null | UTF-8 | Java | false | false | 2,029 | java | package br.com.caelum.ingresso.model;
import java.math.BigDecimal;
import java.time.LocalTime;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
@Entity
public class Sessao {
@Id
@GeneratedValue
private Integer id;
private LocalTime horario;
@ManyToOne
private Sala sala;
@ManyToOne
private Filme filme;
private BigDecimal preco;
@OneToMany(mappedBy = "sessao", fetch = FetchType.EAGER)
private Set<Ingresso> ingressos = new HashSet<>();
/*
* @deprected hibernate only
*/
public Sessao() {
}
public Sessao(LocalTime horario, Filme filme, Sala sala) {
this.horario = horario;
this.filme = filme;
this.sala = sala;
this.preco = sala.getPreco().add(filme.getPreco());
}
// public Sessao(LocalTime horario, Filme filme, Sala sala){
// this.horario = horario;
// this.filme = filme;
// this.sala = sala;
// }
public boolean isDisponivel(Lugar lugarSelecionado) {
return ingressos.stream().map(Ingresso::getLugar).noneMatch(lugar -> lugar.equals(lugarSelecionado));
}
public Map<String, List<Lugar>> getMapaDeLugares() {
return sala.getMapaDeLugares();
}
public LocalTime getHorarioTermino() {
return this.horario.plusMinutes(filme.getDuracao().toMinutes());
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public LocalTime getHorario() {
return horario;
}
public void setHorario(LocalTime horario) {
this.horario = horario;
}
public Sala getSala() {
return sala;
}
public void setSala(Sala sala) {
this.sala = sala;
}
public Filme getFilme() {
return filme;
}
public void setFilme(Filme filme) {
this.filme = filme;
}
public BigDecimal getPreco() {
return preco;
}
public void setPreco(BigDecimal preco) {
this.preco = preco;
}
}
| [
"[email protected]"
] | |
9c03cb9f1f3b0437d63d8d8e64d9391980c02cbb | 3ba2e29bc22a1becc00902bfac7138718cf600df | /app/src/main/java/com/leman/diyaobao/entity/RecordItem.java | 5c6c00026070510d8ea74875ff69c102cf4413de | [] | no_license | niugankeji/diyaobao_English | 9428737c48078c1cf1d2006c3d213bbac84cb463 | c3c1759de932a637986810fb9fabbe37bb08b6c0 | refs/heads/master | 2023-03-27T23:25:04.665725 | 2021-04-08T07:21:07 | 2021-04-08T07:21:07 | 355,387,766 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,359 | java | package com.leman.diyaobao.entity;
import android.support.annotation.NonNull;
import java.io.Serializable;
import java.util.List;
public class RecordItem {
/**
* desc :
* totalPage : 1
* count : 1
* fromIndex : 1
* toIndex : 1
* pageIndex : 1
* pageSize : 1
* minData :
* maxData :
* data : [{"userId":"用户id1","userName":"用户名称1","logo":"logo1","step":122,"calorie":155,"moveTime":112,"movedistance":121,"isFriend":1},{"userId":"用户id2","userName":"用户名称2","logo":"logo2","step":333,"calorie":155,"moveTime":112,"movedistance":121,"isFriend":0},{"userId":"用户id3","userName":"用户名称3","logo":"logo3","step":444,"calorie":155,"moveTime":112,"movedistance":121,"isFriend":1}]
*/
private int totalPage;
private int count;
private int fromIndex;
private int toIndex;
private int pageIndex;
private int pageSize;
private String totalIntegral;
private List<DataBean> data;
public String getTotalIntegral() {
return totalIntegral;
}
public void setTotalIntegral(String totalIntegral) {
this.totalIntegral = totalIntegral;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public int getFromIndex() {
return fromIndex;
}
public void setFromIndex(int fromIndex) {
this.fromIndex = fromIndex;
}
public int getToIndex() {
return toIndex;
}
public void setToIndex(int toIndex) {
this.toIndex = toIndex;
}
public int getPageIndex() {
return pageIndex;
}
public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean implements Serializable, Comparable<DataBean> {
private int integralRecordId;
private String createdTime;
private String integralValue;
private int integralWay;
public int getIntegralRecordId() {
return integralRecordId;
}
public void setIntegralRecordId(int integralRecordId) {
this.integralRecordId = integralRecordId;
}
public String getCreatedTime() {
return createdTime;
}
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
public String getIntegralValue() {
return integralValue;
}
public void setIntegralValue(String integralValue) {
this.integralValue = integralValue;
}
public int getIntegralWay() {
return integralWay;
}
public void setIntegralWay(int integralWay) {
this.integralWay = integralWay;
}
@Override
public int compareTo(@NonNull DataBean o) {
return 0;
}
}
}
| [
"[email protected]"
] | |
b704102d2193ae844caa57d4a2e681a2dd1e237b | 74252bcac14660e8a85406ee301065b80a5ddb28 | /app/src/main/java/br/edu/ifpb/appcivico/listeners/OnClickListarSinesComRaio.java | abe3defc7b37a8340b44809396819920b53d5ccf | [] | no_license | RebecaGaldino/AppCivico | 90f8b97d70e6e9ff242b1f259bf5ac82dff1555a | 9a1721ac3c950fbde6ccbacb8c390ce57344e120 | refs/heads/master | 2021-01-12T13:13:16.667016 | 2017-02-22T04:42:37 | 2017-02-22T04:42:37 | 72,153,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package br.edu.ifpb.appcivico.listeners;
import android.content.Intent;
import android.view.View;
import br.edu.ifpb.appcivico.activities.ListarSinesComRaioActivity;
import br.edu.ifpb.appcivico.activities.MainActivity;
/**
* Created by rebeca on 27/10/2016.
*/
public class OnClickListarSinesComRaio implements View.OnClickListener{
MainActivity mainActivity;
public OnClickListarSinesComRaio(MainActivity mainActivity){
this.mainActivity = mainActivity;
}
@Override
public void onClick(View v) {
Intent intent = new Intent(this.mainActivity, ListarSinesComRaioActivity.class);
this.mainActivity.startActivity(intent);
}
}
| [
"[email protected]"
] | |
a81b64eccf495f4aae9d7dcc449bf834cba70916 | fee07509619ca10be0b08059720886f9a1f2048d | /bdnav-provider/task-provider/src/main/java/com/bdxh/task/TaskProviderApplication.java | 195e00dffe665fc71df5c9ef6fcd671bc17252be | [
"Apache-2.0"
] | permissive | jiageh08/tea-springboot | 70a68c7518f2470268ad8fa03ea7dfa48dff948c | 91892209a70b93e90eaee0a01a4f71e188f4a61a | refs/heads/master | 2022-12-05T13:10:06.654077 | 2020-08-07T01:29:56 | 2020-08-07T01:29:56 | 285,574,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,238 | java | package com.bdxh.task;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* @Description: 定时任务启动类 (此处 basePackages用到哪个服务再去扫描某成服务 不可 com.bdxh)
* @Author: Kang
* @Date: 2019/4/29 14:13
*/
@SpringBootApplication
@EnableScheduling
@EnableApolloConfig
@ServletComponentScan
@ComponentScan(basePackages = {"com.bdxh.user","com.bdxh.school","com.bdxh.servicepermit","com.bdxh.task"})
@EnableFeignClients(basePackages = {"com.bdxh.user","com.bdxh.school","com.bdxh.servicepermit"})
public class TaskProviderApplication {
public static void main(String[] args) {
SpringApplication.run(TaskProviderApplication.class, args);
}
}
| [
"[email protected]"
] | |
ddabb95c499b370d25bc99020820726dfaa5c59c | 1bf97e24f68379fd0ead2eca5ce4a6be01861630 | /src/assignmenttwo_genealogy/InputView.java | 5c4ce770b852c83e73aa4a56a84a7c55db8fe460 | [
"MIT"
] | permissive | beckylum0216/AssignmentTwo_Genealogy | 0d08d4a3967b9b9a184365d12040c4ad9bee6efc | 0174e027eb3cb0a6542799fa905165fb36cad6f8 | refs/heads/master | 2020-05-18T00:28:05.748242 | 2019-06-02T22:56:40 | 2019-06-02T22:56:40 | 184,062,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,676 | 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 assignmenttwo_genealogy;
import java.util.ArrayList;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.text.TextAlignment;
import javafx.stage.Stage;
/**
*
* @author becky
*/
public class InputView implements EventHandler<ActionEvent>
{
private int numOfFields = 13;
private TextField[] inputFields = new TextField[numOfFields];
private StackPane parentPane;
/**
* <p>Default constructor for the input view</p>
*/
InputView(StackPane inputPane)
{
this.parentPane = inputPane;
}
/**
* <p>Function that creates the pane for nod entry </p>
* @return newPane the created pane with child elements
*/
public GridPane SetInputPane()
{
GridPane newPane = new GridPane();
newPane.setId("inputNewPane");
newPane.setHgap(10);
newPane.setGridLinesVisible(false);
int numberOfColumns = 2;
for(int ii = 0; ii < numberOfColumns; ii += 1)
{
ColumnConstraints newColumn = new ColumnConstraints();
newColumn.setPercentWidth(100.0/numberOfColumns);
newPane.getColumnConstraints().add(newColumn);
}
ArrayList <String> tempLabels = new ArrayList<>();
tempLabels.add("Node ID:");
tempLabels.add("First Name:");
tempLabels.add("Last Name:");
tempLabels.add("Married Last Name:");
tempLabels.add("Gender:");
tempLabels.add("Street Address:");
tempLabels.add("Country:");
tempLabels.add("State:");
tempLabels.add("Postcode:");
tempLabels.add("Blurb:");
tempLabels.add("Primary Parent:");
tempLabels.add("Other Parent:");
tempLabels.add("Spouse:");
for(int ii = 0; ii < numOfFields; ii += 1 )
{
Label myLabel = new Label(tempLabels.get(ii));
myLabel.setTextAlignment(TextAlignment.RIGHT);
//myLabel.setBackground(new Background(new BackgroundFill(Color.web("92E4F0"), CornerRadii.EMPTY, Insets.EMPTY)));
inputFields[ii] = new TextField();
inputFields[ii].setId(tempLabels.get(ii));
//inputFields[ii].prefWidthProperty().bind(newPane.widthProperty().multiply(0.8));
newPane.add(myLabel, 0, ii);
newPane.add(inputFields[ii], 1, ii);
}
Button submitButton = new Button("Submit");
submitButton.setId("inputSubmit");
submitButton.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
submitButton.setOnAction(click ->handle(click));
newPane.add(submitButton, 1, 14, 2, 1);
return newPane;
}
/**
* <p>Event handler for the submit button</p>
*/
@Override
public void handle(ActionEvent event)
{
if(inputFields[8].getText().matches("[0-9]+"))
{
Nodi tempNode = new Nodi();
tempNode.SetPersonID(inputFields[0].getText());
tempNode.SetFirstName(inputFields[1].getText());
tempNode.SetLastNameBirth(inputFields[2].getText());
tempNode.SetLastNameMarraige(inputFields[3].getText());
tempNode.SetPersonGender(inputFields[4].getText());
tempNode.GetPersonAddress().street = inputFields[5].getText();
tempNode.GetPersonAddress().country = inputFields[6].getText();
tempNode.GetPersonAddress().state = inputFields[7].getText();
tempNode.GetPersonAddress().postcode = Integer.parseInt(inputFields[8].getText());
tempNode.SetPersonBlurb(inputFields[9].getText());
tempNode.SetParentOne(inputFields[10].getText());
tempNode.SetParentTwo(inputFields[11].getText());
tempNode.SetPersonSpouse(inputFields[12].getText());
ApplicationController.GetNewInstance().GetTreeDB().AddNode(tempNode);
ApplicationController.GetNewInstance().GetTreeDB().FindNode(tempNode).PrintNode();
Alert inputAlert = new Alert(AlertType.INFORMATION);
inputAlert.setTitle("Input Confirmation");
inputAlert.setContentText("Your record has been saved. Press new to add new record");
inputAlert.show();
this.parentPane.getChildren().clear();
ApplicationView initView = new ApplicationView();
StackPane tempPane = initView.GetNewPane();
this.parentPane.getChildren().add(tempPane);
}
else
{
Alert inputAlert = new Alert(AlertType.INFORMATION);
inputAlert.setTitle("Number Validation");
inputAlert.setContentText("You have not entered an Australian postcode. Please enter a 4 digit postcode");
inputAlert.show();
}
}
}
| [
"[email protected]"
] | |
bafde3bcdc1c18ca3ab6016261be4640e63fa0f8 | 8b03806f33edcf5f425de71b193f99ab20844ab1 | /src/day20_WhileLoops/UntilNegative.java | f7bcaebf98c1609af756edb211b335e55e1f5f14 | [] | no_license | Igruss/javanizm | 7968d92f89027abc7863845e971379aabb054ec7 | e3d620e3eb6f017400eb7b94e4a6d7ec7db4fcaa | refs/heads/master | 2023-02-08T01:12:47.320038 | 2020-12-30T23:50:38 | 2020-12-30T23:50:38 | 284,542,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 629 | java | package day20_WhileLoops;
import java.util.Scanner;
/*
. Write a program that calculates the sum of numbers entered by the user until user enters a negative number.
hint: you need an infinite loop
*/
public class UntilNegative {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int sum = 0;
for(int i = 0 ;i == 0;){
System.out.println("Enter a number: ");
int num = scan.nextInt();
if(num <0 ) {
break;
}
sum += num;
}
System.out.println(sum);
}
}
| [
"[email protected]"
] | |
2a578bb98569f79e51e9889f8ba64099b554a3d7 | d6f46a9b77ae40c5fff5c475e86ff1215ba0b3ee | /app/src/main/java/com/geno/FingerprintUiHelper2.java | b153179c84b23f5984b7b6885019f79dd774e5c1 | [] | no_license | witleetaehun/payment | bbeff9b031cea22376d96725618f04905d4152b1 | 331341fb4447ca01417928cad3b8a357a59814a4 | refs/heads/master | 2021-01-23T03:48:20.577587 | 2017-06-28T04:21:22 | 2017-06-28T04:21:22 | 86,125,492 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,132 | java | /*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.geno;
import android.hardware.fingerprint.FingerprintManager;
import android.os.CancellationSignal;
import android.widget.ImageView;
import android.widget.TextView;
import com.geno.bill_folder.R;
/**
* Small helper class to manage text/icon around fingerprint authentication UI.
*/
public class FingerprintUiHelper2 extends FingerprintManager.AuthenticationCallback {
private static final long ERROR_TIMEOUT_MILLIS = 1600;
private static final long SUCCESS_DELAY_MILLIS = 1300;
private final FingerprintManager mFingerprintManager;
private final ImageView mIcon;
private final TextView mErrorTextView;
private final Callback mCallback;
private CancellationSignal mCancellationSignal;
private boolean mSelfCancelled;
/**
* Constructor for {@link FingerprintUiHelper2}.
*/
FingerprintUiHelper2(FingerprintManager fingerprintManager,
ImageView icon, TextView errorTextView, Callback callback) {
mFingerprintManager = fingerprintManager;
mIcon = icon;
mErrorTextView = errorTextView;
mCallback = callback;
}
public boolean isFingerprintAuthAvailable() {
// The line below prevents the false positive inspection from Android Studio
// noinspection ResourceType
return mFingerprintManager.isHardwareDetected()
&& mFingerprintManager.hasEnrolledFingerprints();
}
public void startListening(FingerprintManager.CryptoObject cryptoObject) {
if (!isFingerprintAuthAvailable()) {
return;
}
mCancellationSignal = new CancellationSignal();
mSelfCancelled = false;
// The line below prevents the false positive inspection from Android Studio
// noinspection ResourceType
mFingerprintManager
.authenticate(cryptoObject, mCancellationSignal, 0 /* flags */, this, null);
mIcon.setImageResource(R.drawable.ic_fp_40px);
}
public void stopListening() {
if (mCancellationSignal != null) {
mSelfCancelled = true;
mCancellationSignal.cancel();
mCancellationSignal = null;
}
}
@Override
public void onAuthenticationError(int errMsgId, CharSequence errString) {
if (!mSelfCancelled) {
showError(errString);
mIcon.postDelayed(new Runnable() {
@Override
public void run() {
mCallback.onError();
}
}, ERROR_TIMEOUT_MILLIS);
}
}
@Override
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
showError(helpString);
}
@Override
public void onAuthenticationFailed() {
showError(mIcon.getResources().getString(
R.string.fingerprint_not_recognized));
}
@Override
public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
mIcon.setImageResource(R.drawable.ic_fingerprint_success);
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.success_color, null));
mErrorTextView.setText(
mErrorTextView.getResources().getString(R.string.fingerprint_success));
mIcon.postDelayed(new Runnable() {
@Override
public void run() {
mCallback.onAuthenticated();
}
}, SUCCESS_DELAY_MILLIS);
}
private void showError(CharSequence error) {
mIcon.setImageResource(R.drawable.ic_fingerprint_error);
mErrorTextView.setText(error);
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.red, null));
mErrorTextView.removeCallbacks(mResetErrorTextRunnable);
mErrorTextView.postDelayed(mResetErrorTextRunnable, ERROR_TIMEOUT_MILLIS);
}
private Runnable mResetErrorTextRunnable = new Runnable() {
@Override
public void run() {
mErrorTextView.setTextColor(
mErrorTextView.getResources().getColor(R.color.hint_color, null));
mErrorTextView.setText(
mErrorTextView.getResources().getString(R.string.fingerprint_hint));
mIcon.setImageResource(R.drawable.ic_fp_40px);
}
};
public interface Callback {
void onAuthenticated();
void onError();
}
}
| [
"sytty"
] | sytty |
87a4de993cd97e9b80efd016023d8f1953ed9e2e | 2c1bd6718f37c3d0b0d63aa9ca0acf4a2f891326 | /java-eight-streams/src/com/training/model/Application.java | 52908e842d3511f2046140b19d888887d0635278 | [] | no_license | storm-zeus31/freshers_batch_july_2021 | c6b7110fd84be2a9e66f4fd64d6396ba4dac4274 | d32661b2946f35dc3adffcefa34c099f1590b92c | refs/heads/master | 2023-07-05T21:38:29.672273 | 2021-07-29T04:50:55 | 2021-07-29T04:50:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package com.training.model;
import java.util.stream.*;
import static java.util.stream.Collectors.*;
import java.util.*;
public class Application {
public static void print(List<?> list) {
list.forEach(System.out::println);
}
public static void main(String[] args) {
Book headFirst = new Book(101,"Head first java", 45.00);
Book spring = new Book(102,"Professional Spring", 145.00);
Book html = new Book(201,"HTML for dummies", 345.00);
List<Book> bookList = Arrays.asList(headFirst,spring,html);
bookList.stream().filter(e -> e.getRatePerUnit()>300).forEach(System.out::println);
}
}
// max
| [
"[email protected]"
] | |
e12d20cd7e5ea76b455d79a2720a4cd84de40e4f | 379657221529b3ba617d2ee824b100c4c04b2cbc | /ShoppingCart-master/src/main/java/com/skillmine/repository/ProductRepository.java | 7dbeaaae592e4521462280bc9eedcc337d6fdf6f | [] | no_license | shah1991/shoppingcart | 47c9e3eda1fc68ddfd94956c1642f6b90477e565 | 264f543539baab409d2311369f365e5305869852 | refs/heads/master | 2023-08-15T13:53:41.878894 | 2021-09-24T05:52:37 | 2021-09-24T05:52:37 | 409,196,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.skillmine.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.skillmine.domain.Product;
public interface ProductRepository extends JpaRepository<Product, Long> {
List<Product> findByCategory(String category);
@Query("SELECT DISTINCT p.category FROM Product p ")
List<String> findAllCategories();
}
| [
"shahroz.ahmed1991.com"
] | shahroz.ahmed1991.com |
0b10eca8d3d6d4518912c82785d0dac0568a9832 | 28d75e1335f089a97165509ab7a5cf7e87d3839c | /src/harry/tan/webservice/App.java | 9325ff60f1d90aa51e0584b4a816b086fa26e785 | [] | no_license | tanxiujiang/multi_thread | a8d90b2b44e7532f4c979e464a813c5e7bb59b8f | 763c642f3ed5d3cc48a83d560607c1bb029a0d06 | refs/heads/master | 2021-01-10T02:48:18.099646 | 2015-08-18T08:14:56 | 2015-08-18T08:14:56 | 36,604,990 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 101 | java | package harry.tan.webservice;
public class App {
public static void main(String[] args) {
}
}
| [
"[email protected]"
] | |
e40238657e38f4cd60d0df9113c17bf8a7ba7731 | db17ac4268bd643d813cbe7febc1567da029f43d | /src/main/java/com/xajiusuo/utils/FileUtils.java | e7c5ea05bc4ba659d7ea4e5f700957dd7dc7defc | [] | no_license | yyxx828/pro_modules | 61e0457b5f9c948a21f890a3abbc36e266443418 | 3f2e2328650c85346ccd8eb7b7b94906d1b90670 | refs/heads/master | 2022-10-05T16:09:24.889606 | 2019-11-08T06:30:50 | 2019-11-08T06:30:50 | 216,776,105 | 0 | 0 | null | 2022-09-08T01:03:01 | 2019-10-22T09:35:45 | Java | UTF-8 | Java | false | false | 1,296 | java | package com.xajiusuo.utils;
import javax.validation.constraints.NotNull;
public class FileUtils {
private static final String TXT = "^.+\\.(?i)(txt)$";
private static final String CSV = "^.+\\.(?i)(csv)$";
private static final String TSV = "^.+\\.(?i)(tsv)$";
public static boolean isTxt(@NotNull String fileName){
return fileName.matches(TXT);
}
public static boolean isNotTxt(@NotNull String fileName){
return !isTxt(fileName);
}
public static boolean isCsv(@NotNull String fileName){
return fileName.matches(CSV);
}
public static boolean isNotCsv(@NotNull String fileName){
return !isCsv(fileName);
}
public static boolean isTsv(@NotNull String fileName){return fileName.matches(TSV); }
public static boolean isNotTsv(@NotNull String fileName){
return !isTsv(fileName);
}
public static boolean validFile(String fileName){return fileName != null && (isTxt(fileName) || isCsv(fileName)|| isTsv(fileName));}
public static String validSeparator(String s){
if(s.lastIndexOf(",")>0){
return ",";
}else if(s.lastIndexOf(";")>0){
return ";";
}else if(s.lastIndexOf("\t")>0){
return "\t";
}
return null;
}
}
| [
"[email protected]"
] | |
8b1fe48068ffede74cfcf6cb4519cf3f00255d05 | 5270ebeadad99ada05ad0aac47b70452a6ed84a4 | /Practice file/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/Book/org/apache/jsp/directive_jsp.java | 8ee235d864cca63f64565579c4ba250895e23fdb | [] | no_license | heeya15/JSP-Daily_Study | 87739a199e430b15f719e5810f94de4a2c914029 | 5dc23f81a4cb2ab664040ab2511f0072dab20f65 | refs/heads/master | 2023-05-15T11:11:13.002320 | 2021-06-04T14:01:04 | 2021-06-04T14:01:04 | 318,168,770 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,155 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.5.60
* Generated at: 2020-12-04 09:26:42 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.Date;
public final class directive_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = new java.util.HashSet<>();
_jspx_imports_classes.add("java.util.Date");
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSP들은 오직 GET, POST 또는 HEAD 메소드만을 허용합니다. Jasper는 OPTIONS 메소드 또한 허용합니다.");
return;
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write(" <h1>");
out.print( new Date() );
out.write("</h1>\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"[email protected]"
] | |
a6a1df9a024844908e0503141d34b1963e03e0af | 0671b5ebc2448c849353370015c11216bec756c4 | /Java/EjerciciosHerencia/ejer1/Titular.java | b9768c2503e420cc8a65f60715df1b32dad5b86e | [] | no_license | egarsan176/GitLinkedIn | 739b610b8e5271136015fb7b081c864f79d545c9 | 1ddf888b7e882e1442605549790c740efef59ae8 | refs/heads/main | 2023-07-28T13:14:54.898873 | 2021-09-13T11:41:39 | 2021-09-13T11:41:39 | 383,934,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package ejeHERENCIA.ejer1;
public class Titular {
private String nombre;
protected int edad;
public Titular() {}
public Titular(String nombre, int edad) {
super();
this.nombre = nombre;
this.edad = edad;
}
@Override
public String toString() {
return "El titular es " + this.nombre + "y su edad es "+this.edad;
}
public int getEdad() {
return edad;
}
public void setEdad(int edad) {
this.edad = edad;
}
}
| [
"[email protected]"
] | |
8c093ade5dde6845af11310a83d7c10eda718533 | bcaef12c9b6fdc07aed582a27b8ceb2dad4e0298 | /src/test/java/com/aliyun/openservices/log/functiontest/EtlFunctionTest.java | 82f154c0e414e396f778b14bf28993780af1144a | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Janzee/aliyun-log-java-sdk | 46099cf0a0f50d9b3b3502eabcee97327174e650 | bbebf84c256ba0ce17005bb1f5c42fc0c116cc50 | refs/heads/master | 2020-03-19T16:02:59.050951 | 2018-06-05T14:37:31 | 2018-06-05T14:37:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,008 | java | package com.aliyun.openservices.log.functiontest;
import com.aliyun.openservices.log.Client;
import com.aliyun.openservices.log.common.*;
import com.aliyun.openservices.log.exception.LogException;
import com.aliyun.openservices.log.request.*;
import com.aliyun.openservices.log.response.*;
import net.sf.json.JSONObject;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.ArrayList;
public class EtlFunctionTest {
private static String accessKeyId = "";
private static String accessKeySecret = "";
private static String endpoint = "http://cn-hangzhou-staging-intranet.sls.aliyuncs.com";
private static String project = "ali-slstest-trigger";
private static String roleArn = "";
private static Client logClient = null;
private static String fcEndpoint = "http://fc.cn-shanghai.aliyuncs.com";
private static String fcRegion = "cn-shanghai";
private static String fcAccountId = "";
private static String fcService = "log_etl";
private static String fcFunction = "logstore-replication";
private static String etlJobName = "v2-test";
private static String logstore = "from";
private static String logLogstore = "etl-log";
@BeforeClass
public static void setup() {
logClient = new Client(endpoint, accessKeyId, accessKeySecret);
try {
DeleteEtlJobRequest req = new DeleteEtlJobRequest(project, etlJobName);
DeleteEtlJobResponse resp = logClient.deleteEtlJob(req);
} catch (LogException e) {
}
try {
DeleteEtlJobRequest req = new DeleteEtlJobRequest(project, etlJobName + "_1");
DeleteEtlJobResponse resp = logClient.deleteEtlJob(req);
} catch (LogException e) {
}
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@AfterClass
public static void cleanup() {
}
@Test
public void testCreateEtlJob() {
EtlSourceConfig sourceConfig = new EtlSourceConfig(logstore);
EtlTriggerConfig triggerConfig = new EtlTriggerConfig(roleArn, 300, 1);
EtlFunctionFcConfig fcConfig = new EtlFunctionFcConfig(Consts.FUNCTION_PROVIDER_FC, fcEndpoint, fcAccountId, fcRegion, fcService, fcFunction);
EtlLogConfig logConfig = new EtlLogConfig(this.endpoint, this.project, this.logLogstore);
String functionParameter = "{\"source\":{\"endpoint\":\"http://cn-shanghai-intranet.log.aliyuncs.com\"}, \"target\":{\"endpoint\":\"http://cn-shanghai-intranet.log.aliyuncs.com\", \"projectName\":\"etl-test\", \"logstoreName\":\"etl-1\"}}";
EtlJob job = new EtlJob(this.etlJobName, sourceConfig, triggerConfig, fcConfig, functionParameter, logConfig, true);
try {
sourceConfig.setLogstoreName("x");
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
sourceConfig.setLogstoreName(logstore);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
triggerConfig.setMaxRetryTime(1000);
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
triggerConfig.setMaxRetryTime(1);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
triggerConfig.setTriggerInterval(-1);
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
triggerConfig.setTriggerInterval(100);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
/*
try {
triggerConfig.setRoleArn(roleArn + "x");
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
triggerConfig.setRoleArn(roleArn);
Assert.assertEquals(e.GetErrorCode(), "Unauthorized");
Assert.assertTrue(true);
}
*/
try {
triggerConfig.setRoleArn(" ");
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
triggerConfig.setRoleArn(roleArn);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
fcConfig.setFunctionProvider("StreamCompute");
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
fcConfig.setFunctionProvider(Consts.FUNCTION_PROVIDER_FC);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
fcConfig.setAccountId("");
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
fcConfig.setAccountId(fcAccountId);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
logConfig.setLogstoreName("");
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
logConfig.setLogstoreName(logLogstore);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
logConfig.setLogstoreName(logstore);
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
logConfig.setLogstoreName(logLogstore);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
logConfig.setProjectName("");
logConfig.setLogstoreName(logstore);
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
logConfig.setLogstoreName(logLogstore);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
job.setFunctionParameter("xxxxx");
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
job.setFunctionParameter(functionParameter);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
job.setJobName("1");
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(false);
} catch (LogException e) {
System.out.println(e.GetErrorMessage());
job.setJobName(etlJobName);
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
try {
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(true);
} catch (LogException e) {
System.out.println(e.GetErrorCode());
System.out.println(e.GetErrorMessage());
Assert.assertTrue(false);
}
try {
job.setJobName(etlJobName + "_1");
job.setEnable(false);
CreateEtlJobRequest req = new CreateEtlJobRequest(project, job);
CreateEtlJobResponse resp = this.logClient.createEtlJob(req);
Assert.assertTrue(true);
} catch (LogException e) {
System.out.println(e.GetErrorCode());
System.out.println(e.GetErrorMessage());
Assert.assertTrue(false);
}
}
@Test
public void testGetEtlJob() {
GetEtlJobRequest req = new GetEtlJobRequest(project, etlJobName);
try {
GetEtlJobResponse resp = logClient.getEtlJob(req);
System.out.println(resp.getEtljob().toJsonString(true, true));
Assert.assertTrue(true);
} catch (LogException e) {
System.out.println(e.GetErrorCode());
System.out.println(e.GetErrorMessage());
Assert.assertTrue(false);
}
}
@Test
public void testUpdateEtlJob() {
EtlSourceConfig sourceConfig = new EtlSourceConfig(logstore);
EtlTriggerConfig triggerConfig = new EtlTriggerConfig(roleArn, 5, 1);
EtlFunctionFcConfig fcConfig = new EtlFunctionFcConfig(Consts.FUNCTION_PROVIDER_FC, fcEndpoint, fcAccountId, fcRegion, fcService, fcFunction);
EtlLogConfig logConfig = new EtlLogConfig(this.endpoint, this.project, this.logLogstore);
String functionParameter = "{\"source\":{\"endpoint\":\"http://cn-shanghai-intranet.log.aliyuncs.com\"}, " +
"\"target\":{\"endpoint\":\"http://cn-shanghai-intranet.log.aliyuncs.com\", \"projectName\":\"etl-test\", \"logstoreName\":\"stg-etl-log\"}}";
EtlJob job = new EtlJob(this.etlJobName, sourceConfig, triggerConfig, fcConfig, functionParameter, logConfig, true);
try {
UpdateEtlJobRequest req = new UpdateEtlJobRequest(this.project, job);
UpdateEtlJobResponse resp = this.logClient.updateEtlJob(req);
System.out.println(resp.GetAllHeaders());
Assert.assertTrue(true);
} catch (LogException e) {
System.out.print(e.GetErrorCode());
System.out.print(e.GetErrorMessage());
Assert.assertTrue(false);
}
/*
try {
triggerConfig.setRoleArn("xx");
UpdateEtlJobRequest req = new UpdateEtlJobRequest(this.project, job);
UpdateEtlJobResponse resp = this.logClient.updateEtlJob(req);
System.out.println(resp.GetAllHeaders());
Assert.assertTrue(false);
} catch (LogException e) {
System.out.print(e.GetErrorMessage());
Assert.assertEquals(e.GetErrorCode(), "Unauthorized");
Assert.assertTrue(true);
triggerConfig.setRoleArn(this.roleArn);
}
*/
try {
logConfig.setLogstoreName(this.logstore);
UpdateEtlJobRequest req = new UpdateEtlJobRequest(this.project, job);
UpdateEtlJobResponse resp = this.logClient.updateEtlJob(req);
System.out.println(resp.GetAllHeaders());
Assert.assertTrue(false);
} catch (LogException e) {
System.out.print(e.GetErrorMessage());
Assert.assertEquals(e.GetErrorCode(), "PostBodyInvalid");
Assert.assertTrue(true);
}
}
@Test
public void testListEtlJob() {
try {
ListEtlJobRequest req = new ListEtlJobRequest(this.project, 0, 1);
ListEtlJobResponse resp = this.logClient.listEtlJob(req);
Assert.assertEquals(resp.getCount(), 1);
Assert.assertEquals(resp.getTotal(), 2);
} catch (LogException e) {
System.out.print(e.GetErrorCode());
System.out.print(e.GetErrorMessage());
Assert.assertTrue(false);
}
try {
ListEtlJobRequest req = new ListEtlJobRequest(this.project, 0, 10);
ListEtlJobResponse resp = this.logClient.listEtlJob(req);
Assert.assertEquals(resp.getCount(), 2);
Assert.assertEquals(resp.getTotal(), 2);
int hit = 0;
for (String jobName : resp.getEtlJobNameList()) {
if (jobName.equalsIgnoreCase(etlJobName)) {
GetEtlJobResponse getresp = this.logClient.getEtlJob(new GetEtlJobRequest(project, etlJobName));
Assert.assertEquals(getresp.getEtljob().getJobName(), etlJobName);
Assert.assertTrue(getresp.getEtljob().getEnable());
++hit;
} else if (jobName.equalsIgnoreCase(etlJobName + "_1")) {
GetEtlJobResponse getresp = this.logClient.getEtlJob(new GetEtlJobRequest(project, etlJobName + "_1"));
Assert.assertEquals(getresp.getEtljob().getJobName(), etlJobName + "_1");
Assert.assertTrue(!getresp.getEtljob().getEnable());
++hit;
}
}
Assert.assertEquals(hit, 2);
} catch (LogException e) {
System.out.print(e.GetErrorCode());
System.out.print(e.GetErrorMessage());
Assert.assertTrue(false);
}
}
@Test
public void testDeleteEtlJob() {
try {
DeleteEtlJobRequest req = new DeleteEtlJobRequest(this.project, this.etlJobName);
DeleteEtlJobResponse resp = this.logClient.deleteEtlJob(req);
System.out.println(resp.GetAllHeaders());
Assert.assertTrue(true);
} catch (LogException e) {
System.out.print(e.GetErrorCode());
System.out.print(e.GetErrorMessage());
Assert.assertTrue(false);
}
try {
DeleteEtlJobRequest req = new DeleteEtlJobRequest(this.project, this.etlJobName + "_1");
DeleteEtlJobResponse resp = this.logClient.deleteEtlJob(req);
System.out.println(resp.GetAllHeaders());
Assert.assertTrue(true);
} catch (LogException e) {
System.out.print(e.GetErrorCode());
System.out.print(e.GetErrorMessage());
Assert.assertTrue(false);
}
try {
ListEtlJobRequest req = new ListEtlJobRequest(this.project, 0, 10);
ListEtlJobResponse resp = this.logClient.listEtlJob(req);
Assert.assertEquals(resp.getCount(), 0);
Assert.assertEquals(resp.getTotal(), 0);
} catch (LogException e) {
System.out.print(e.GetErrorCode());
System.out.print(e.GetErrorMessage());
Assert.assertTrue(false);
}
}
}
| [
"[email protected]"
] | |
f0b913910402ebce756c0451b5ded7c757b0bb0e | eac2da6738a80ab04330262fab9cf9c2321bb270 | /app/src/main/java/com/kxl/recyclerviewaddheadview/HeaderBottomAdapter.java | d766bda728254b647a0c311f13a53b20744c22c7 | [] | no_license | kongxianglei0403/RecyclerViewAddHeadView | 592eaa3a7226e56fda0f579d09d947e1e8c25468 | ef3a0e4694ea6e101c72a723fe80d7fc984bffa9 | refs/heads/master | 2020-04-09T23:39:20.496799 | 2016-09-13T03:58:32 | 2016-09-13T03:58:32 | 68,072,693 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,695 | java | package com.kxl.recyclerviewaddheadview;/**
* @author by atu
**/
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
/**
* Created by Administrator on 2016/9/12.
*/
public class HeaderBottomAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public static final int ITEM_TYPE_HEADER = 0;
public static final int ITEM_TYPE_CONTENT = 1;
public static final int ITEM_TYPE_BOTTOM = 2;
//数据源
public String[] texts = {"java", "python", "C++", "Php", ".NET", "js", "Ruby", "Swift", "OC"};
private int mHeaderCount = 1;//头部View个数
private int mBottomCount = 1;//底部View个数
private LayoutInflater mLayoutInflater;
private Context mContext;
public HeaderBottomAdapter(Context context) {
this.mContext = context;
mLayoutInflater = LayoutInflater.from(context);
}
//判断当前item是否是HeadView
public boolean isHeaderView(int position) {
return mHeaderCount != 0 && position < mHeaderCount;
}
//判断当前item是否是FooterView
public boolean isBottomView(int position) {
return mBottomCount != 0 && position >= (mHeaderCount + getContentItemCount());
}
private int getContentItemCount() {
return texts.length;
}
//判断当前item类型
@Override
public int getItemViewType(int position) {
int dataItemCount = getContentItemCount();
if (mHeaderCount != 0 && position < mHeaderCount) {
//头view
return ITEM_TYPE_HEADER;
} else if (mBottomCount != 0 && mBottomCount > (dataItemCount + mHeaderCount)) {
//脚view
return ITEM_TYPE_BOTTOM;
} else {
//内容view
return ITEM_TYPE_CONTENT;
}
}
//内容 ViewHolder
public static class ContentViewHolder extends RecyclerView.ViewHolder {
private TextView textView;
public ContentViewHolder(View itemView) {
super(itemView);
textView = (TextView) itemView.findViewById(R.id.tv_item_text);
}
}
//头部 ViewHolder
public static class HeaderViewHolder extends RecyclerView.ViewHolder {
public HeaderViewHolder(View itemView) {
super(itemView);
}
}
//底部 ViewHolder
public static class BottomViewHolder extends RecyclerView.ViewHolder {
public BottomViewHolder(View itemView) {
super(itemView);
}
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == ITEM_TYPE_HEADER) {
return new HeaderViewHolder(mLayoutInflater.inflate(R.layout.rv_header, parent, false));
} else if (viewType == mHeaderCount) {
return new ContentViewHolder(mLayoutInflater.inflate(R.layout.rv_item, parent, false));
} else if (viewType == ITEM_TYPE_BOTTOM) {
return new BottomViewHolder(mLayoutInflater.inflate(R.layout.rv_footer, parent, false));
}
return null;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof HeaderViewHolder) {
} else if (holder instanceof ContentViewHolder) {
((ContentViewHolder) holder).textView.setText(texts[position - mHeaderCount]);
} else if (holder instanceof BottomViewHolder) {
}
}
@Override
public int getItemCount() {
return mHeaderCount + getContentItemCount() + mBottomCount;
}
}
| [
"5877076hn"
] | 5877076hn |
fa27b84b4b73efdd43d94616bb09149d853d4ca9 | fa3893cd5593cb0475e5a2308931a356c9bcab26 | /src/org.xtuml.bp.ui.graphics/src/org/xtuml/bp/ui/graphics/layout/FixedTextLocator.java | 4ece2602c04f37278fcf75cf7e2ba0cdbbc3fd8c | [
"Apache-2.0",
"EPL-1.0"
] | permissive | leviathan747/bridgepoint | a2c13d615ff255eb64c8a4e21fcf1824f9eff3d5 | cf7deed47d20290d422d4b4636e7486784d17c34 | refs/heads/master | 2023-08-04T11:05:10.679674 | 2023-07-06T19:10:37 | 2023-07-06T19:10:37 | 28,143,415 | 0 | 1 | Apache-2.0 | 2023-05-08T13:26:39 | 2014-12-17T15:40:25 | HTML | UTF-8 | Java | false | false | 3,450 | java | //========================================================================
//
//File: $RCSfile: FixedTextLocator.java,v $
//Version: $Revision: 1.5 $
//Modified: $Date: 2013/01/10 23:06:00 $
//
//(c) Copyright 2005-2014 by Mentor Graphics Corp. All rights reserved.
//
//========================================================================
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
//========================================================================
//
package org.xtuml.bp.ui.graphics.layout;
import org.eclipse.draw2d.Connection;
import org.eclipse.draw2d.FigureUtilities;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.Locator;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.xtuml.bp.ui.canvas.Direction_c;
import org.xtuml.bp.ui.canvas.Gr_c;
public class FixedTextLocator implements Locator {
private boolean fIsEnd;
private Connection fConnection;
public FixedTextLocator(Connection connection, boolean isEnd) {
fConnection = connection;
fIsEnd = isEnd;
}
@Override
public void relocate(IFigure target) {
float angle = 0f;
int text_x = 0;
int text_y = 0;
if (fIsEnd) {
text_x = fConnection.getPoints().getLastPoint().x;
text_y = fConnection.getPoints().getLastPoint().y;
angle = Gr_c.Getangle(fConnection.getPoints().getLastPoint().x,
fConnection.getPoints().getPoint(
fConnection.getPoints().size() - 2).x, fConnection
.getPoints().getLastPoint().y, fConnection
.getPoints().getPoint(
fConnection.getPoints().size() - 2).y);
} else {
text_x = fConnection.getPoints().getFirstPoint().x;
text_y = fConnection.getPoints().getFirstPoint().y;
angle = Gr_c.Getangle(fConnection.getPoints().getFirstPoint().x,
fConnection.getPoints().getPoint(1).x, fConnection
.getPoints().getFirstPoint().y, fConnection
.getPoints().getPoint(1).y);
}
int direction = Gr_c.Getdirection(angle);
int spacing = Gr_c.Getgraphicspacing() + 3;
Label label = (Label) target;
Dimension stringExtents = FigureUtilities.getStringExtents(label
.getText(), label.getFont());
switch (direction) {
case Direction_c.East:
text_x = text_x + spacing;
text_y = text_y - spacing - stringExtents.height;
break;
case Direction_c.South:
text_x = text_x - spacing - stringExtents.width;
text_y = text_y + spacing;
break;
case Direction_c.North:
text_x = text_x - spacing - stringExtents.width;
text_y = text_y - spacing - stringExtents.height;
break;
case Direction_c.West:
text_x = text_x - spacing - stringExtents.width;
text_y = text_y - spacing - stringExtents.height;
break;
default:
break;
}
target.setSize(stringExtents);
target.setLocation(new Point(text_x, text_y));
}
}
| [
"[email protected]"
] | |
89a50994092d910c5c3732fe418273e5ea74a032 | 411fdcd1ddeb37b7a6e45ef40fd7b13b5e163d8e | /app/src/main/java/io/github/mobileteacher/wordsexchange/MainActivity.java | c71cbaad888628c743cfe144a364a31cc5821911 | [] | no_license | MobileTeacher/WordsExchange | 10a88a76ecbe4a9d7b018749b083ba6d2f0b3c54 | 2b6b9d48a3aec81789222e8a9e31402be48834a3 | refs/heads/master | 2020-03-28T22:17:22.960807 | 2018-09-18T03:08:37 | 2018-09-18T03:08:37 | 149,221,377 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 350 | java | package io.github.mobileteacher.wordsexchange;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
] | |
9d4a203f18b918ddbaee66b7190b6ff6d513a7ea | 0520bc6b3b7e7d3948ef35d2eebd934069b61b55 | /app/src/main/java/com/example/chin/tiktak/clock_list_item_adapter.java | 54cc4ba4db6bfbb8eb7ee1fca222e858d181942a | [] | no_license | TimeFur/TikTak | 58272ce23875bf12ba11d463e5804f4208fc93f7 | 7c572bd885b10626812e56bc0ca7e5e8a770b3c0 | refs/heads/master | 2020-04-17T14:42:43.705919 | 2019-11-07T15:11:54 | 2019-11-07T15:11:54 | 166,668,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,528 | java | package com.example.chin.tiktak;
import android.app.TimePickerDialog;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.ToggleButton;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class clock_list_item_adapter extends SimpleAdapter {
String TAG = "clock_list_item";
Context main_context;
static DB_machine db_machine;
int count = 0;
HashMap<String, Object> item_view_id = new HashMap<String, Object>() {
{ put(DB_machine.MON_COLUMN, R.id.Mon);
put(DB_machine.TUE_COLUMN, R.id.Tue);
put(DB_machine.WED_COLUMN, R.id.Wed);
put(DB_machine.THR_COLUMN, R.id.Thr);
put(DB_machine.FRI_COLUMN, R.id.Fri);
put(DB_machine.SAT_COLUMN, R.id.Sat);
put(DB_machine.SUN_COLUMN, R.id.Sun);}};
/**
* Constructor
*
* @param context The context where the View associated with this SimpleAdapter is running
* @param data A List of Maps. Each entry in the List corresponds to one row in the list. The
* Maps contain the data for each row, and should include all the entries specified in
* "from"
* @param resource Resource identifier of a view layout that defines the views for this list
* item. The layout file should include at least those named views defined in "to"
* @param from A list of column names that will be added to the Map associated with each
* item.
* @param to The views that should display column in the "from" parameter. These should all be
* TextViews. The first N views in this list are given the values of the first N columns
*/
public clock_list_item_adapter(Context context, List<? extends Map<String, Object>> data, int resource, String[] from, int[] to) {
super(context, data, resource, from, to);
main_context = context;
db_machine = new DB_machine(main_context);
Log.v(TAG, "My Adapter~");
}
@Override
public View getView(int position, View convertView, ViewGroup parent){
View view = super.getView(position, convertView, parent);
final Map<String, Object> Clock_data = (Map<String, Object>) getItem(position);
String flag = "TRUE";
Object id = (Object)Clock_data.get(DB_machine.KEY_ID);
final long sqlite_id = Long.parseLong(id.toString());
final Map<String, Object> getitem = db_machine.get_sqldata(sqlite_id);
final TextView clock_tv = (TextView) view.findViewById(R.id.item_clock_time);
final ToggleButton ring_btn = (ToggleButton) view.findViewById(R.id.Ring_switch_btn);
final ImageButton select_sound_btn = (ImageButton) view.findViewById(R.id.music_select_id);
for (final HashMap.Entry<String, Object> item : item_view_id.entrySet())
{
flag = getitem.get(item.getKey().toString()).toString();
final ToggleButton btn = (ToggleButton) view.findViewById(Integer.parseInt(item.getValue().toString()));
if (flag.equals("TRUE"))
btn.setChecked(true);
else
btn.setChecked(false);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (btn.isChecked())
{
Log.v(TAG, item.getKey().toString() + " Toggle btn On");
db_machine.update(sqlite_id, item.getKey().toString(), "TRUE");
}
else
{
Log.v(TAG, item.getKey().toString() + " Toggle btn Off");
db_machine.update(sqlite_id, item.getKey().toString(), "FALSE");
}
}
});
}
//checking data to switch status
flag = getitem.get(DB_machine.RING_COLUMN).toString();
Log.v(TAG, "RING = " + flag);
if (flag.equals("TRUE") == true)
ring_btn.setChecked(true);
else
ring_btn.setChecked(false);
ring_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Map<String, Object> item;
String time = getitem.get(DB_machine.TIME_COLUMN).toString();
String[] split_line = time.split(":");
int hour = Integer.parseInt(split_line[0]);
int min = Integer.parseInt(split_line[1]);
if (ring_btn.isChecked())
{
Log.v(TAG, "RING On");
db_machine.update(sqlite_id, DB_machine.RING_COLUMN, "TRUE");
Clock_timepicker.notification(main_context, hour, min, Integer.toString((int)sqlite_id));
}
else
{
Log.v(TAG, "RING Off");
db_machine.update(sqlite_id, DB_machine.RING_COLUMN, "FALSE");
Clock_timepicker.cancel_clock(main_context, (int)sqlite_id);
}
// item = db_machine.get_sqldata(sqlite_id);
// Log.v(TAG, item.toString());
}
});
clock_tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String clock_str = clock_tv.getText().toString();
Log.v(TAG, "Click clock" + clock_str);
boolean pending_flag = Clock_timepicker.check_clock_pending(main_context, (int)sqlite_id);
Log.v(TAG, "Pending = " + pending_flag);
Clock_timepicker.clock_setting(main_context,null, null, Clock_timepicker.REVISE_TIME, (long)sqlite_id, clock_tv);
// clock_tv.setText(count + "");
}
});
select_sound_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Clock_list_control.createSelectDialog(v.getContext());
}
});
return view;
}
} | [
"[email protected]"
] | |
25097e342de6bf6ae2961e54b872f858fd8a5417 | ece7481a099689d53144fd61274ad08f0358d436 | /Custom Heuristic/src/maze/ai/core/BestFirstObject.java | bbdc1c958b59013198e7689e04aa759d25a58b4c | [] | no_license | oot4/AI-Search-Heuristics | eb28bb4cfaacb9578fdb24fce6d3dfdb06476428 | b3de4421e6fda742234b8bf8be1d5f824a1bd0a3 | refs/heads/master | 2020-05-19T17:48:53.306285 | 2019-05-06T07:13:18 | 2019-05-06T07:13:18 | 185,142,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package maze.ai.core;
import java.util.ArrayList;
public interface BestFirstObject<T extends BestFirstObject<T>> {
// Pre: None
// Post: Returns all objects that can be generated from this with one move
public ArrayList<T> getSuccessors();
public int hashCode();
public boolean equals(Object other);
public boolean achieves(T goal);
}
| [
"[email protected]"
] | |
0cfae083d6f665cb6c8bf57b5f406e3f4045c560 | be11b479da93a8b293550240582a55b4d60dd9a8 | /src/main/java/com/pri/entity/Page.java | d0cd843ad283eb02e7c73b9c768224f3858dffc1 | [] | no_license | 1163646727/project | 6921eeb4939cb63676f8c7756378a4b1afd7dd2a | 3ffc2b1d57d9179ae7bf963870f2585c424c4f0f | refs/heads/master | 2022-07-03T20:01:27.039962 | 2021-10-18T09:49:11 | 2021-10-18T09:49:15 | 183,396,460 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,152 | java | package com.pri.entity;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName: Page
* @Description: 分页实体
* @author: ChenQi
* @CreateDate: 2019/5/6 11:43
*/
public class Page {
private int showCount; //每页显示记录数
private int totalPage; //总页数
private int totalResult; //总记录数
private int currentPage; //当前页
private int currentResult; //当前记录起始索引
private Map<String, Object> params = new HashMap<String, Object>();// 传入查询参数
public Map<String, Object> getParams() {
return params;
}
public void setParams(Map<String, Object> params) {
this.params = params;
}
public Page() {
try {
this.showCount = 10;
} catch (Exception e) {
this.showCount = 20;
}
}
public int getTotalPage() {
if (totalResult % showCount == 0)
totalPage = totalResult / showCount;
else
totalPage = totalResult / showCount + 1;
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getTotalResult() {
return totalResult;
}
public void setTotalResult(int totalResult) {
this.totalResult = totalResult;
}
public int getCurrentPage() {
if (currentPage <= 0)
currentPage = 1;
if (currentPage > getTotalPage())
currentPage = getTotalPage();
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getShowCount() {
return showCount;
}
public void setShowCount(int showCount) {
this.showCount = showCount;
}
public int getCurrentResult() {
currentResult = (getCurrentPage() - 1) * getShowCount();
if (currentResult < 0)
currentResult = 0;
return currentResult;
}
public void setCurrentResult(int currentResult) {
this.currentResult = currentResult;
}
} | [
"[email protected]"
] | |
a1373c270e31fad4918984c1cc428c05e5915a86 | b382c12025087b169bdc66158bdba6098af04bc1 | /src/main/java/my/project/log/analysis/service/filters/impl/LogFilterByTime.java | 113bf536b22f9658b28201424c0fef96bbab8e9d | [] | no_license | NikolayNN/LogAnalysis | d4a516e4e8b4a1cabbe6a618ffd15325bea85de9 | 7db4bf044dde50f7ed65f715f78f1e9a62f597c4 | refs/heads/master | 2021-07-03T05:12:36.884742 | 2017-09-19T22:21:29 | 2017-09-19T22:21:29 | 103,733,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package my.project.log.analysis.service.filters.impl;
import lombok.AllArgsConstructor;
import my.project.log.analysis.exception.LogFilterInterruptingException;
import my.project.log.analysis.model.LogMessage;
import my.project.log.analysis.service.filters.LogFilter;
import java.time.LocalDateTime;
/**
* @author Nikolay Horushko
*/
@AllArgsConstructor
public class LogFilterByTime implements LogFilter {
private LocalDateTime startDate;
private LocalDateTime finishDate;
@Override
public void doFilter(LogMessage logMessage) {
LocalDateTime date = logMessage.getDate();
if(date.isBefore(startDate) || date.isAfter(finishDate)){
throw new LogFilterInterruptingException();
}
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.