blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
438692206da6a04180c628a2d30758b94bd410d0 | 5780e16c4f7ad4266cf1c015bd257e082c8d2b08 | /Practice2017_June/src/IndiaHackPre_3.java | f22e798e5e16623ae37e87fc63baf1a76f3b35cf | [] | no_license | Gaurav88/Java_Practice | 19d650e2ea215858ba0f1f9b79007e3bc0ac7a81 | 2221e8b053097776433cbd0f38f8dcac29cfbed9 | refs/heads/master | 2021-01-01T19:41:50.567089 | 2017-07-28T14:07:13 | 2017-07-28T14:07:13 | 98,655,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,842 | java | import java.util.*;
/**
* Created by Gaurav-PC on 18-06-2017.
*/
public class IndiaHackPre_3 {
public static void main(String args[]) throws Exception {
/*
* Read input from stdin and provide input before running
* Use either of these methods for input
//BufferedReader
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
int N = Integer.parseInt(line);*/
//Scanner
Scanner s = new Scanner(System.in);
int N = s.nextInt();
int M = s.nextInt();
long arr[] = new long[N];
long temp[] = new long[N];
long cal = 0;
for (int i = 0; i < N; i++) {
arr[i] = s.nextInt();
cal += arr[i];
temp[i] = cal;
}
for (int i = 0; i < M; i++) {
int type = s.nextInt();
int l = s.nextInt();
int r = s.nextInt();
if (type == 1) {
int k = s.nextInt();
long sum = 0;
// NEW_2
for (int j = l; j <= r; j++) {
if (j - k - 2 >= 0) {
sum += temp[j - 1] - temp[j - k - 2];
} else {
sum += temp[j - 1];
}
}
System.out.println(sum);
}
if (type == 2) {
long diff = arr[l - 1] - r;
arr[l - 1] = r;
temp = reBuild(temp, l, diff);
}
}
}
private static long[] reBuild(long[] temp, int l, long diff) {
for (int i = l - 1; i < temp.length; i++) {
temp[i] = temp[i] - diff;
}
return temp;
}
} | [
"noreply@github.com"
] | Gaurav88.noreply@github.com |
3b644f3b172e37ec201e068472a5ed9205f7601c | d71e879b3517cf4fccde29f7bf82cff69856cfcd | /ExtractedJars/Shopkick_com.shopkick.app/javafiles/com/bumptech/glide/load/model/AssetUriLoader.java | 9ed3bcd972812975d99798788474c4dc3931adfe | [
"MIT"
] | permissive | Andreas237/AndroidPolicyAutomation | b8e949e072d08cf6c6166c3f15c9c63379b8f6ce | c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a | refs/heads/master | 2020-04-10T02:14:08.789751 | 2019-05-16T19:29:11 | 2019-05-16T19:29:11 | 160,739,088 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,525 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.bumptech.glide.load.model;
import android.content.res.AssetManager;
import android.net.Uri;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.data.*;
import com.bumptech.glide.signature.ObjectKey;
import java.util.List;
// Referenced classes of package com.bumptech.glide.load.model:
// ModelLoader, ModelLoaderFactory, MultiModelLoaderFactory
public class AssetUriLoader
implements ModelLoader
{
public static interface AssetFetcherFactory
{
public abstract DataFetcher buildFetcher(AssetManager assetmanager, String s);
}
public static class FileDescriptorFactory
implements ModelLoaderFactory, AssetFetcherFactory
{
public ModelLoader build(MultiModelLoaderFactory multimodelloaderfactory)
{
return ((ModelLoader) (new AssetUriLoader(assetManager, ((AssetFetcherFactory) (this)))));
// 0 0:new #11 <Class AssetUriLoader>
// 1 3:dup
// 2 4:aload_0
// 3 5:getfield #21 <Field AssetManager assetManager>
// 4 8:aload_0
// 5 9:invokespecial #28 <Method void AssetUriLoader(AssetManager, AssetUriLoader$AssetFetcherFactory)>
// 6 12:areturn
}
public DataFetcher buildFetcher(AssetManager assetmanager, String s)
{
return ((DataFetcher) (new FileDescriptorAssetPathFetcher(assetmanager, s)));
// 0 0:new #35 <Class FileDescriptorAssetPathFetcher>
// 1 3:dup
// 2 4:aload_1
// 3 5:aload_2
// 4 6:invokespecial #38 <Method void FileDescriptorAssetPathFetcher(AssetManager, String)>
// 5 9:areturn
}
public void teardown()
{
// 0 0:return
}
private final AssetManager assetManager;
public FileDescriptorFactory(AssetManager assetmanager)
{
// 0 0:aload_0
// 1 1:invokespecial #19 <Method void Object()>
assetManager = assetmanager;
// 2 4:aload_0
// 3 5:aload_1
// 4 6:putfield #21 <Field AssetManager assetManager>
// 5 9:return
}
}
public static class StreamFactory
implements ModelLoaderFactory, AssetFetcherFactory
{
public ModelLoader build(MultiModelLoaderFactory multimodelloaderfactory)
{
return ((ModelLoader) (new AssetUriLoader(assetManager, ((AssetFetcherFactory) (this)))));
// 0 0:new #11 <Class AssetUriLoader>
// 1 3:dup
// 2 4:aload_0
// 3 5:getfield #21 <Field AssetManager assetManager>
// 4 8:aload_0
// 5 9:invokespecial #28 <Method void AssetUriLoader(AssetManager, AssetUriLoader$AssetFetcherFactory)>
// 6 12:areturn
}
public DataFetcher buildFetcher(AssetManager assetmanager, String s)
{
return ((DataFetcher) (new StreamAssetPathFetcher(assetmanager, s)));
// 0 0:new #35 <Class StreamAssetPathFetcher>
// 1 3:dup
// 2 4:aload_1
// 3 5:aload_2
// 4 6:invokespecial #38 <Method void StreamAssetPathFetcher(AssetManager, String)>
// 5 9:areturn
}
public void teardown()
{
// 0 0:return
}
private final AssetManager assetManager;
public StreamFactory(AssetManager assetmanager)
{
// 0 0:aload_0
// 1 1:invokespecial #19 <Method void Object()>
assetManager = assetmanager;
// 2 4:aload_0
// 3 5:aload_1
// 4 6:putfield #21 <Field AssetManager assetManager>
// 5 9:return
}
}
public AssetUriLoader(AssetManager assetmanager, AssetFetcherFactory assetfetcherfactory)
{
// 0 0:aload_0
// 1 1:invokespecial #38 <Method void Object()>
assetManager = assetmanager;
// 2 4:aload_0
// 3 5:aload_1
// 4 6:putfield #40 <Field AssetManager assetManager>
factory = assetfetcherfactory;
// 5 9:aload_0
// 6 10:aload_2
// 7 11:putfield #42 <Field AssetUriLoader$AssetFetcherFactory factory>
// 8 14:return
}
public ModelLoader.LoadData buildLoadData(Uri uri, int i, int j, Options options)
{
options = ((Options) (uri.toString().substring(ASSET_PREFIX_LENGTH)));
// 0 0:aload_1
// 1 1:invokevirtual #53 <Method String Uri.toString()>
// 2 4:getstatic #55 <Field int ASSET_PREFIX_LENGTH>
// 3 7:invokevirtual #61 <Method String String.substring(int)>
// 4 10:astore 4
return new ModelLoader.LoadData(((com.bumptech.glide.load.Key) (new ObjectKey(((Object) (uri))))), factory.buildFetcher(assetManager, ((String) (options))));
// 5 12:new #63 <Class ModelLoader$LoadData>
// 6 15:dup
// 7 16:new #65 <Class ObjectKey>
// 8 19:dup
// 9 20:aload_1
// 10 21:invokespecial #68 <Method void ObjectKey(Object)>
// 11 24:aload_0
// 12 25:getfield #42 <Field AssetUriLoader$AssetFetcherFactory factory>
// 13 28:aload_0
// 14 29:getfield #40 <Field AssetManager assetManager>
// 15 32:aload 4
// 16 34:invokeinterface #72 <Method DataFetcher AssetUriLoader$AssetFetcherFactory.buildFetcher(AssetManager, String)>
// 17 39:invokespecial #75 <Method void ModelLoader$LoadData(com.bumptech.glide.load.Key, DataFetcher)>
// 18 42:areturn
}
public volatile ModelLoader.LoadData buildLoadData(Object obj, int i, int j, Options options)
{
return buildLoadData((Uri)obj, i, j, options);
// 0 0:aload_0
// 1 1:aload_1
// 2 2:checkcast #49 <Class Uri>
// 3 5:iload_2
// 4 6:iload_3
// 5 7:aload 4
// 6 9:invokevirtual #80 <Method ModelLoader$LoadData buildLoadData(Uri, int, int, Options)>
// 7 12:areturn
}
public boolean handles(Uri uri)
{
boolean flag2 = "file".equals(((Object) (uri.getScheme())));
// 0 0:ldc1 #84 <String "file">
// 1 2:aload_1
// 2 3:invokevirtual #87 <Method String Uri.getScheme()>
// 3 6:invokevirtual #91 <Method boolean String.equals(Object)>
// 4 9:istore 4
boolean flag1 = false;
// 5 11:iconst_0
// 6 12:istore_3
boolean flag = flag1;
// 7 13:iload_3
// 8 14:istore_2
if(flag2)
//* 9 15:iload 4
//* 10 17:ifeq 56
{
flag = flag1;
// 11 20:iload_3
// 12 21:istore_2
if(!uri.getPathSegments().isEmpty())
//* 13 22:aload_1
//* 14 23:invokevirtual #95 <Method List Uri.getPathSegments()>
//* 15 26:invokeinterface #101 <Method boolean List.isEmpty()>
//* 16 31:ifne 56
{
flag = flag1;
// 17 34:iload_3
// 18 35:istore_2
if("android_asset".equals(uri.getPathSegments().get(0)))
//* 19 36:ldc1 #20 <String "android_asset">
//* 20 38:aload_1
//* 21 39:invokevirtual #95 <Method List Uri.getPathSegments()>
//* 22 42:iconst_0
//* 23 43:invokeinterface #105 <Method Object List.get(int)>
//* 24 48:invokevirtual #91 <Method boolean String.equals(Object)>
//* 25 51:ifeq 56
flag = true;
// 26 54:iconst_1
// 27 55:istore_2
}
}
return flag;
// 28 56:iload_2
// 29 57:ireturn
}
public volatile boolean handles(Object obj)
{
return handles((Uri)obj);
// 0 0:aload_0
// 1 1:aload_1
// 2 2:checkcast #49 <Class Uri>
// 3 5:invokevirtual #107 <Method boolean handles(Uri)>
// 4 8:ireturn
}
private static final String ASSET_PATH_SEGMENT = "android_asset";
private static final String ASSET_PREFIX = "file:///android_asset/";
private static final int ASSET_PREFIX_LENGTH = 22;
private final AssetManager assetManager;
private final AssetFetcherFactory factory;
static
{
// 0 0:return
}
}
| [
"silenta237@gmail.com"
] | silenta237@gmail.com |
f295965d1953ceaca38a27f1ee7a9443409faab1 | 6ae02b0b93b3b3ff687bed4026528b39f447cdc3 | /src/FactoryAndMediator/Main.java | 9a7dc38e1287ffc81bf87a9e08a5027c20c9bdbf | [] | no_license | RoxF/design-patterns | 0bf60ad43c9c0585ae6e63a27de99749768ed614 | c088ab601689bf7cbeef91cecefdd2973ec908fa | refs/heads/master | 2021-05-24T09:27:32.518593 | 2020-06-21T17:20:26 | 2020-06-21T17:20:26 | 253,495,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,467 | java | package FactoryAndMediator;
public class Main {
public static void main(String[] args) {
MyFactory myFactory = new MainForFactory();
Person person1 = myFactory.newPerson("Ivo");
Person person2 = myFactory.newPerson("Petq");
Person person3 = myFactory.newPerson("Lili");
Person person4 = myFactory.newPerson("Moni");
Chat.NewPersonInChat(person1);
Chat.NewPersonInChat(person2);
Chat.NewPersonInChat(person3);
Chat.NewPersonInChat(person4);
///////////////////////////////////////////////
person1.newMessage("Hello, friends.");
person2.newMessage("Hello, Iliq!");
person3.newMessage("Hello, Iliq!");
person4.newMessage("Hello, Iliq!");
person1.newMessage("addBot");
person2.newMessage("Friends, I want to tell you that my cat is not at my home... Would you tell me if you see her..!");
person3.newMessage("Yes, we would tell you if we are seeing her");
person4.newMessage("Yes, of cours");
//////////////////////////////////////////////
/*person1.sendMessage("My name is Gosho!");
secondUser.sendMessage("Hi Gosho!");
thirdUser.sendMessage("Hi Gosho!");
anotherUser.sendMessage("Hi!");
//No bot is added so users can use the cat word
firstUser.sendMessage("Do u guys love cats?");
secondUser.sendMessage("addBot");
//No more cats says Bot!
thirdUser.sendMessage("Yeah cats are great, I have a cat at home!");
//Pesho not in chat anymore
thirdUser.sendMessage("another message!");
*/
}
}
| [
"roksanafilipova89@gmail.com"
] | roksanafilipova89@gmail.com |
b856d50079d2df287c243a6e8800f29bf5493454 | b630112aec0ef87e09aa62ae357ddf9a0799dcf2 | /UDPReceiver.java | 520d464c00262aee17a248b03a043d0a2981908f | [] | no_license | 215shanram/SYSC3010-Lab2 | beca9c61eaeba7d7f234b478630d7ccdedd77ffd | fdbe32b4f269f911daf38069d0179932353737bd | refs/heads/master | 2020-07-29T18:25:29.774906 | 2019-09-21T03:25:58 | 2019-09-21T03:25:58 | 209,916,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,554 | java |
package lab2.pkg3010;
import java.net.*;
import java.net.*;
import java.util.Scanner;
public class UDPReceiver {
private final static int PACKETSIZE = 100 ;
public static void main( String args[] )
{
// Check the arguments
DatagramSocket socket2 = null ;
if( args.length != 1 )
{
System.out.println( "usage: UDPReceiver port" ) ;
return ;
}
try
{
socket2 = new DatagramSocket() ;
// Convert the argument to ensure that is it valid
int port = Integer.parseInt( args[0] ) ;
// Construct the socket
DatagramSocket socket = new DatagramSocket( port ) ;
for( ;; )
{
System.out.println( "Receiving on port " + port ) ;
DatagramPacket packet = new DatagramPacket( new byte[PACKETSIZE], PACKETSIZE ) ;
socket.receive( packet ) ;
String MESSAGE = new String(packet.getData()).trim();
byte [] data = MESSAGE.getBytes();
System.out.println( packet.getAddress() + " " + packet.getPort() + ": " + MESSAGE) ;
//Acknowledging
String stringAck=new String("Ack:"+MESSAGE);
byte [] dataAck = stringAck.getBytes();
DatagramPacket packet2 = new DatagramPacket(dataAck, dataAck.length, packet.getAddress() , packet.getPort() ) ;
socket2.send( packet2 ) ;
}
}
catch( Exception e )
{
System.out.println( e ) ;
}
}
}
| [
"215shanram@users.noreply.github.com"
] | 215shanram@users.noreply.github.com |
d5e19e223dc52e573ae1a44e1023ce0ad4ba082f | 0db5d42af2ce8c4736b7b707c9f7aa6b034640c1 | /HW6/Q4.java | 914faef139022c6cf406723370caa608ea46080c | [] | no_license | byservet/JavaTraining | 339d1e9f6fd2b03302aba67e34ae6a7ae96068c0 | f282d697d7919b715ccb50ee86e6b60957594cc5 | refs/heads/master | 2022-08-22T22:58:41.823445 | 2020-05-22T18:40:31 | 2020-05-22T18:40:31 | 254,910,268 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package figures;
public class Dolls {
public void nested() { nested(2, true);}//g1
public int nested(int level, boolean height) {return nested(level);}
public int nested(int level) { return level + 1;} //g2
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(new Dolls().nested());
}
}
| [
"noreply@github.com"
] | byservet.noreply@github.com |
dced000219db78f3b92e88e450ff40f80c795177 | 1598d5ba30c61d1a418140afeb8c49458ba92807 | /src/com/designpatterns/state/abuse/RunningState.java | 8f1be9f0bc295e064c92dc077b22d9c326980f51 | [] | no_license | varatharuban/design-patterns | 8cdc212201014e2edb033433f65a76387daa4d44 | 877db5d79b99711935397656fd397ae73e393e36 | refs/heads/master | 2023-02-05T17:12:23.543926 | 2020-12-30T03:12:23 | 2020-12-30T03:12:23 | 325,410,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package com.designpatterns.state.abuse;
public class RunningState implements State {
private Stopwatch stopwatch;
public RunningState(Stopwatch stopwatch) {
this.stopwatch = stopwatch;
}
@Override
public void click() {
stopwatch.setCurrentState(new StoppedState(stopwatch));
System.out.println("Stopped");
}
}
| [
"developer-at-398378596368"
] | developer-at-398378596368 |
e961172b4a3310bba0af6bcc108a6010a1d7fe01 | 87444c34c35f7d721784d6ceb89ba71645296efb | /src/main/java/se/Test.java | 7e10f9769551b2ce556b7e74d9ae1c9d5e427059 | [] | no_license | MilkaVi/laba3Vitko | 9f2015f47910a0d35097fc7f137151c2b8582f92 | d4dcfd2777a318f9ba1e15b0a4c9f0ea484822d3 | refs/heads/main | 2023-03-26T06:31:43.998716 | 2021-03-30T17:48:26 | 2021-03-30T17:48:26 | 353,091,374 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | java | package se;
import static se.Form.roundAvoid;
public class Test {
public static void proofLine(double Xi[], double Yi[], double a, double b) {
double answer = 0;
for (int i = 0; i < Xi.length; i++) {
answer += Math.pow(a * Xi[i] + b - Yi[i],2);
}
System.out.println("погрешность перовой функции = " + roundAvoid(answer,1));
}
public static void proofParab(double Xi[], double Yi[], double a, double b, double c) {
double answer = 0;
for (int i = 0; i < Xi.length; i++) {
answer += Math.pow(a * Xi[i]* Xi[i] + b * Xi[i] + c - Yi[i],2);
}
System.out.println("погрешность второй функции = " + roundAvoid(answer,1));
}
public static void proofHiperb(double Xi[], double Yi[], double a, double b) {
double answer = 0;
for (int i = 0; i < Xi.length; i++) {
if(Xi[i] != 0)
answer += Math.pow(a / Xi[i] + b - Yi[i],2);
}
System.out.println("погрешность третьей функции = " + roundAvoid(answer,1));
}
}
| [
"nikolaycswow@mail.ru"
] | nikolaycswow@mail.ru |
8306ebfd2a3f2874fc9d816c0cff16232810b0ea | ee51af4691c34e4b13f312fa1a1507ecd95a8749 | /src/main/java/Controlador/ControladorVentanaUsuarioAdministrador.java | 2eadea9b954ea178ecdbf3fc08658c1d2f8f2bd4 | [] | no_license | alejandror96/maquina-dispensadora | 1bbd4064865ddaaf0e589cf284f852c3b2b8d8ac | 577fdd11ca6d626e1efc2fcf4aca81f71396976b | refs/heads/master | 2021-01-21T16:35:25.366017 | 2017-05-25T21:57:37 | 2017-05-25T21:57:37 | 91,896,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package Controlador;
import Vista.VentanaUsuarioAdministrador;
public class ControladorVentanaUsuarioAdministrador {
VentanaUsuarioAdministrador ventanaAdministrador = new VentanaUsuarioAdministrador();
public String recibirAccionAdministrador(){
return ventanaAdministrador.menuUsuarioAdministrador();
}
public int mostrarCantidad(){
return ventanaAdministrador.recibirCantidad();
}
} | [
"paolavargas0115@gmail.com"
] | paolavargas0115@gmail.com |
7bdd81db9d4487224c788a97ea94dd2a708982f4 | 4c561cb446ad1abac394e27fdfc84c690f8e6f4c | /edu/cmu/cs/stage3/alice/authoringtool/editors/responseeditor/CompositeComponentResponsePanel.java | dc01386c3e5e2e7c1c51d159eaf45bb13caad9fd | [] | no_license | gomson/alice_source_re | c46b2192cff35ad2c019e93814dbfffa3ea22b2c | 72ff8250deec06e09c79bb42e23a067469e3bccb | refs/heads/master | 2020-03-21T11:29:54.523869 | 2017-05-12T03:53:51 | 2017-05-12T03:53:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,904 | java | package edu.cmu.cs.stage3.alice.authoringtool.editors.responseeditor;
import edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool;
import edu.cmu.cs.stage3.alice.authoringtool.AuthoringToolResources;
import edu.cmu.cs.stage3.alice.authoringtool.datatransfer.CopyFactoryTransferable;
import edu.cmu.cs.stage3.alice.authoringtool.datatransfer.ElementReferenceTransferable;
import edu.cmu.cs.stage3.alice.authoringtool.datatransfer.PropertyReferenceTransferable;
import edu.cmu.cs.stage3.alice.authoringtool.datatransfer.ResponsePrototypeReferenceTransferable;
import edu.cmu.cs.stage3.alice.authoringtool.editors.compositeeditor.CompositeComponentElementPanel;
import edu.cmu.cs.stage3.alice.authoringtool.editors.compositeeditor.CompositeComponentOwner;
import edu.cmu.cs.stage3.alice.authoringtool.util.DnDManager;
import edu.cmu.cs.stage3.alice.authoringtool.util.ElementPrototype;
import edu.cmu.cs.stage3.alice.authoringtool.util.PopupItemFactory;
import edu.cmu.cs.stage3.alice.authoringtool.util.PopupMenuUtilities;
import edu.cmu.cs.stage3.alice.authoringtool.util.ResponsePrototype;
import edu.cmu.cs.stage3.alice.core.Behavior;
import edu.cmu.cs.stage3.alice.core.CopyFactory;
import edu.cmu.cs.stage3.alice.core.Element;
import edu.cmu.cs.stage3.alice.core.Property;
import edu.cmu.cs.stage3.alice.core.Response;
import edu.cmu.cs.stage3.alice.core.TextureMap;
import edu.cmu.cs.stage3.alice.core.property.ObjectArrayProperty;
import edu.cmu.cs.stage3.alice.core.response.CompositeResponse;
import edu.cmu.cs.stage3.alice.core.response.PoseAnimation;
import edu.cmu.cs.stage3.alice.core.response.SoundResponse;
import edu.cmu.cs.stage3.lang.Messages;
import edu.cmu.cs.stage3.util.StringObjectPair;
import java.awt.Point;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.DropTargetContext;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.io.IOException;
import java.util.Vector;
import javax.swing.JPopupMenu;
public class CompositeComponentResponsePanel extends CompositeComponentElementPanel
{
public CompositeComponentResponsePanel() {}
public void set(ObjectArrayProperty elements, CompositeResponsePanel owner, AuthoringTool authoringToolIn)
{
super.set(elements, owner, authoringToolIn);
}
protected java.awt.Component makeGUI(Element currentElement) {
javax.swing.JComponent toAdd = null;
if ((currentElement instanceof Response)) {
if ((currentElement instanceof CompositeResponse)) {
toAdd = edu.cmu.cs.stage3.alice.authoringtool.util.GUIFactory.getGUI(currentElement);
}
else if (currentElement != null) {
toAdd = new ComponentResponsePanel();
((ComponentResponsePanel)toAdd).set(currentElement);
}
else {
return null;
}
return toAdd;
}
return null;
}
public void dragOver(DropTargetDragEvent dtde)
{
java.awt.Component sourceComponent = DnDManager.getCurrentDragComponent();
int action = dtde.getDropAction();
boolean isCopy = (action & 0x1) > 0;
boolean isMove = (action & 0x2) > 0;
if ((!m_owner.isExpanded()) &&
((m_owner.getParent() instanceof CompositeComponentResponsePanel))) {
((CompositeComponentResponsePanel)m_owner.getParent()).dragOver(dtde);
return;
}
if (AuthoringToolResources.safeIsDataFlavorSupported(dtde, ElementReferenceTransferable.responseReferenceFlavor)) {
try {
Transferable transferable = DnDManager.getCurrentTransferable();
Response response = (Response)transferable.getTransferData(ElementReferenceTransferable.responseReferenceFlavor);
boolean isValid = checkLoop(response);
if (isValid) {
if (isMove) {
dtde.acceptDrag(2);
}
else if (isCopy) {
dtde.acceptDrag(1);
}
insertDropPanel(dtde);
}
else {
dtde.rejectDrag();
}
} catch (UnsupportedFlavorException e) {
dtde.rejectDrag();
} catch (IOException e) {
dtde.rejectDrag();
} catch (Throwable t) {
dtde.rejectDrag();
}
}
else if (AuthoringToolResources.safeIsDataFlavorSupported(dtde, CopyFactoryTransferable.copyFactoryFlavor)) {
try {
Transferable transferable = DnDManager.getCurrentTransferable();
CopyFactory copyFactory = (CopyFactory)transferable.getTransferData(CopyFactoryTransferable.copyFactoryFlavor);
Class valueClass = copyFactory.getValueClass();
if (Response.class.isAssignableFrom(valueClass)) {
dtde.acceptDrag(2);
insertDropPanel(dtde);
}
else {
dtde.rejectDrag();
}
} catch (UnsupportedFlavorException e) {
dtde.rejectDrag();
} catch (IOException e) {
dtde.rejectDrag();
} catch (Throwable t) {
dtde.rejectDrag();
}
} else if (AuthoringToolResources.safeIsDataFlavorSupported(dtde, ElementReferenceTransferable.questionReferenceFlavor)) {
dtde.rejectDrag();
}
else if (AuthoringToolResources.safeIsDataFlavorSupported(dtde, ElementReferenceTransferable.elementReferenceFlavor)) {
try {
Transferable transferable = DnDManager.getCurrentTransferable();
Element element = (Element)transferable.getTransferData(ElementReferenceTransferable.elementReferenceFlavor);
if ((!(element instanceof Behavior)) && (!(element instanceof edu.cmu.cs.stage3.alice.core.World)) && (!(element instanceof TextureMap)) && (!(element instanceof edu.cmu.cs.stage3.alice.core.Group))) {
if (checkLoop(element)) {
dtde.acceptDrag(2);
insertDropPanel(dtde);
}
else {
dtde.rejectDrag();
}
}
else {
dtde.rejectDrag();
}
} catch (UnsupportedFlavorException e) {
dtde.rejectDrag();
} catch (IOException e) {
dtde.rejectDrag();
} catch (Throwable t) {
dtde.rejectDrag();
}
} else if ((AuthoringToolResources.safeIsDataFlavorSupported(dtde, ResponsePrototypeReferenceTransferable.responsePrototypeReferenceFlavor)) ||
(AuthoringToolResources.safeIsDataFlavorSupported(dtde, PropertyReferenceTransferable.propertyReferenceFlavor)) ||
(AuthoringToolResources.safeIsDataFlavorSupported(dtde, ElementReferenceTransferable.variableReferenceFlavor))) {
if (isMove) {
dtde.acceptDrag(2);
insertDropPanel(dtde);
}
else if (isCopy) {
dtde.rejectDrag();
}
} else {
AuthoringToolResources.safeIsDataFlavorSupported(dtde, AuthoringToolResources.getReferenceFlavorForClass(edu.cmu.cs.stage3.alice.core.question.userdefined.CallToUserDefinedQuestion.class));
dtde.rejectDrag();
return;
}
}
public void drop(final DropTargetDropEvent dtde) {
HACK_started = false;
boolean successful = true;
int action = dtde.getDropAction();
boolean isCopy = (action & 0x1) > 0;
boolean isMove = (action & 0x2) > 0;
if ((!m_owner.isExpanded()) &&
((m_owner.getParent() instanceof CompositeComponentElementPanel))) {
((CompositeComponentElementPanel)m_owner.getParent()).drop(dtde);
return;
}
Transferable transferable = dtde.getTransferable();
if (AuthoringToolResources.safeIsDataFlavorSupported(transferable, CopyFactoryTransferable.copyFactoryFlavor)) {
try {
CopyFactory copyFactory = (CopyFactory)transferable.getTransferData(CopyFactoryTransferable.copyFactoryFlavor);
Class valueClass = copyFactory.getValueClass();
if (Response.class.isAssignableFrom(valueClass)) {
dtde.acceptDrop(1);
successful = true;
Response response = (Response)copyFactory.manufactureCopy(m_owner.getElement().getRoot(), null, null, m_owner.getElement());
if (response != null) {
performDrop(response, dtde);
}
}
else {
successful = false;
dtde.rejectDrop();
}
} catch (UnsupportedFlavorException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_a_bad_flavor_"), e);
successful = false;
} catch (IOException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_an_IO_error_"), e);
successful = false;
} catch (Throwable t) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed__Methods_with_parameters_cannot_be_copied_"), t);
successful = false;
}
}
else if (AuthoringToolResources.safeIsDataFlavorSupported(transferable, ElementReferenceTransferable.responseReferenceFlavor))
{
try {
Response response = (Response)transferable.getTransferData(ElementReferenceTransferable.responseReferenceFlavor);
if (((response instanceof CompositeResponse)) &&
(!isCopy) && (!isValidDrop(s_currentComponentPanel.getElement(), response))) {
successful = false;
}
if (!successful) break label1580;
if (isMove) {
dtde.acceptDrop(2);
}
else if (isCopy) {
dtde.acceptDrop(1);
}
performDrop(response, dtde);
successful = true;
}
catch (UnsupportedFlavorException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_a_bad_flavor_"), e);
successful = false;
} catch (IOException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_an_IO_error_"), e);
successful = false;
} catch (Throwable t) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed__Methods_with_parameters_cannot_be_copied_"), t);
successful = false;
}
}
else if (AuthoringToolResources.safeIsDataFlavorSupported(dtde, ResponsePrototypeReferenceTransferable.responsePrototypeReferenceFlavor)) {
if (isMove) {
dtde.acceptDrop(2);
successful = true;
}
else if (isCopy) {
dtde.rejectDrop();
successful = false;
}
if (successful) {
try {
ResponsePrototype responsePrototype = (ResponsePrototype)transferable.getTransferData(ResponsePrototypeReferenceTransferable.responsePrototypeReferenceFlavor);
if (((responsePrototype.getDesiredProperties() == null) || (responsePrototype.getDesiredProperties().length < 1)) &&
(!edu.cmu.cs.stage3.alice.core.response.Print.class.isAssignableFrom(responsePrototype.getResponseClass()))) {
performDrop(responsePrototype.createNewResponse(), dtde);
} else if (responsePrototype.getDesiredProperties().length > 3) {
performDrop(responsePrototype.createNewResponse(), dtde);
}
else {
PopupItemFactory factory = new PopupItemFactory() {
public Object createItem(final Object object) {
new Runnable() {
public void run() {
if ((object instanceof ResponsePrototype)) {
performDrop(((ResponsePrototype)object).createNewResponse(), val$dtde);
}
else if ((object instanceof ElementPrototype)) {
Element newResponse = ((ElementPrototype)object).createNewElement();
if ((newResponse instanceof Response)) {
performDrop(newResponse, val$dtde);
}
}
}
};
}
};
Vector structure = null;
if (edu.cmu.cs.stage3.alice.core.response.Print.class.isAssignableFrom(responsePrototype.getResponseClass())) {
structure = PopupMenuUtilities.makeResponsePrintStructure(factory, componentElements.getOwner());
}
else {
structure = PopupMenuUtilities.makePrototypeStructure(responsePrototype, factory, componentElements.getOwner());
}
JPopupMenu popup = PopupMenuUtilities.makePopupMenu(structure);
popup.addPopupMenuListener(this);
inserting = true;
popup.show(dtde.getDropTargetContext().getComponent(), (int)dtde.getLocation().getX(), (int)dtde.getLocation().getY());
PopupMenuUtilities.ensurePopupIsOnScreen(popup);
}
} catch (UnsupportedFlavorException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_a_bad_flavor_"), e);
successful = false;
} catch (IOException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_an_IO_error_"), e);
successful = false;
} catch (Throwable t) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_"), t);
successful = false;
}
}
} else if (AuthoringToolResources.safeIsDataFlavorSupported(dtde, PropertyReferenceTransferable.propertyReferenceFlavor)) {
if (isMove) {
dtde.acceptDrop(2);
successful = true;
}
else if (isCopy) {
dtde.rejectDrop();
successful = false;
}
if (successful)
{
try
{
Property property = (Property)transferable.getTransferData(PropertyReferenceTransferable.propertyReferenceFlavor);
Class animationClass; StringObjectPair[] known; Class animationClass; if ((property instanceof edu.cmu.cs.stage3.alice.core.property.VehicleProperty))
{
StringObjectPair[] newKnown = { new StringObjectPair("element", property.getOwner()), new StringObjectPair("propertyName", property.getName()), new StringObjectPair("duration", new Double(0.0D)) };
StringObjectPair[] known = newKnown;
animationClass = edu.cmu.cs.stage3.alice.core.response.VehiclePropertyAnimation.class;
}
else {
StringObjectPair[] newKnown = { new StringObjectPair("element", property.getOwner()), new StringObjectPair("propertyName", property.getName()) };
known = newKnown;
animationClass = edu.cmu.cs.stage3.alice.core.response.PropertyAnimation.class;
}
PopupItemFactory factory = new PopupItemFactory() {
public Object createItem(final Object object) {
new Runnable() {
public void run() {
if ((object instanceof ResponsePrototype)) {
performDrop(((ResponsePrototype)object).createNewResponse(), val$dtde);
}
else if ((object instanceof ElementPrototype)) {
Element newResponse = ((ElementPrototype)object).createNewElement();
if ((newResponse instanceof Response)) {
performDrop(newResponse, val$dtde);
}
}
}
};
}
};
String[] desired = { "value" };
ResponsePrototype rp = new ResponsePrototype(animationClass, known, desired);
Vector structure = PopupMenuUtilities.makePrototypeStructure(rp, factory, componentElements.getOwner());
JPopupMenu popup = PopupMenuUtilities.makePopupMenu(structure);
popup.addPopupMenuListener(this);
inserting = true;
popup.show(dtde.getDropTargetContext().getComponent(), (int)dtde.getLocation().getX(), (int)dtde.getLocation().getY());
PopupMenuUtilities.ensurePopupIsOnScreen(popup);
} catch (UnsupportedFlavorException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_a_bad_flavor_"), e);
successful = false;
} catch (IOException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_an_IO_error_"), e);
successful = false;
} catch (Throwable t) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_"), t);
successful = false;
}
}
} else if (AuthoringToolResources.safeIsDataFlavorSupported(dtde, ElementReferenceTransferable.variableReferenceFlavor)) {
if (isMove) {
dtde.acceptDrop(2);
successful = true;
}
else if (isCopy) {
dtde.rejectDrop();
successful = false;
}
if (successful) {
try {
edu.cmu.cs.stage3.alice.core.Variable variable = (edu.cmu.cs.stage3.alice.core.Variable)transferable.getTransferData(ElementReferenceTransferable.variableReferenceFlavor);
if (!checkLoop(variable)) {
dtde.rejectDrop();
successful = false;
}
else {
PopupItemFactory factory = new PopupItemFactory() {
public Object createItem(final Object object) {
new Runnable() {
public void run() {
if ((object instanceof ResponsePrototype)) {
performDrop(((ResponsePrototype)object).createNewResponse(), val$dtde);
}
else if ((object instanceof ElementPrototype)) {
Element newResponse = ((ElementPrototype)object).createNewElement();
if ((newResponse instanceof Response)) {
performDrop(newResponse, val$dtde);
}
}
}
};
}
};
Vector structure = PopupMenuUtilities.makeExpressionResponseStructure(variable, factory, componentElements.getOwner());
JPopupMenu popup = PopupMenuUtilities.makePopupMenu(structure);
popup.addPopupMenuListener(this);
inserting = true;
popup.show(dtde.getDropTargetContext().getComponent(), (int)dtde.getLocation().getX(), (int)dtde.getLocation().getY());
PopupMenuUtilities.ensurePopupIsOnScreen(popup);
}
} catch (UnsupportedFlavorException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_a_bad_flavor_"), e);
successful = false;
} catch (IOException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_an_IO_error_"), e);
successful = false;
} catch (Throwable t) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_"), t);
successful = false;
}
}
}
else if (AuthoringToolResources.safeIsDataFlavorSupported(dtde, ElementReferenceTransferable.expressionReferenceFlavor))
{
dtde.rejectDrop();
successful = false;
} else if (AuthoringToolResources.safeIsDataFlavorSupported(dtde, ElementReferenceTransferable.elementReferenceFlavor))
{
try {
Element element = (Element)transferable.getTransferData(ElementReferenceTransferable.elementReferenceFlavor);
if (((element instanceof Behavior)) || ((element instanceof edu.cmu.cs.stage3.alice.core.World)) || ((element instanceof TextureMap))) {
dtde.rejectDrop();
successful = false;
}
if (isMove) {
dtde.acceptDrop(2);
successful = true;
}
else if (isCopy) {
dtde.rejectDrop();
successful = false;
}
if (!successful) break label1580;
if ((element instanceof edu.cmu.cs.stage3.alice.core.Sound)) {
SoundResponse r = new SoundResponse();
sound.set(element);
subject.set(element.getParent());
performDrop(r, dtde);
}
else if ((element instanceof edu.cmu.cs.stage3.alice.core.Pose)) {
PoseAnimation r = new PoseAnimation();
pose.set(element);
subject.set(element.getParent());
performDrop(r, dtde);
}
else {
PopupItemFactory factory = new PopupItemFactory() {
public Object createItem(final Object object) {
new Runnable() {
public void run() {
if ((object instanceof ResponsePrototype)) {
performDrop(((ResponsePrototype)object).createNewResponse(), val$dtde);
}
else if ((object instanceof ElementPrototype)) {
Element newResponse = ((ElementPrototype)object).createNewElement();
if ((newResponse instanceof Response)) {
performDrop(newResponse, val$dtde);
}
}
}
};
}
};
Vector structure = PopupMenuUtilities.makeResponseStructure(element, factory, componentElements.getOwner());
JPopupMenu popup = PopupMenuUtilities.makePopupMenu(structure);
popup.addPopupMenuListener(this);
inserting = true;
popup.show(dtde.getDropTargetContext().getComponent(), (int)dtde.getLocation().getX(), (int)dtde.getLocation().getY());
PopupMenuUtilities.ensurePopupIsOnScreen(popup);
}
}
catch (UnsupportedFlavorException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_a_bad_flavor_"), e);
successful = false;
} catch (IOException e) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_because_of_an_IO_error_"), e);
successful = false;
} catch (Throwable t) {
AuthoringTool.showErrorDialog(Messages.getString("The_drop_failed_"), t);
successful = false;
}
} else {
dtde.rejectDrop();
successful = false; }
label1580:
dtde.dropComplete(successful);
}
}
| [
"nghiadtse05330@fpt.edu.vn"
] | nghiadtse05330@fpt.edu.vn |
6622e6726ff330ee6b88c9655f896b27454bc21f | b8a8aec5d911bf06749c7fc8b542d4c87627ff16 | /QTPayDemo/QTPayDemo/src/main/java/com/example/qianfangdemo/Utils/DBHelper.java | ced8f95e187cfb6c168195308e52fdf4d53c9333 | [] | no_license | PuppyStitch/QTPaySDK-Android | 023ec38b8c8f892111daaf30d48c9e9a85fe4d65 | 576dd38f1895859b7fdceeaae0799f1a6a2ed5e8 | refs/heads/master | 2023-03-15T11:56:24.451100 | 2015-12-03T06:29:59 | 2015-12-03T06:29:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,679 | java | package com.example.qianfangdemo.Utils;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.example.qianfangdemo.entity.Area;
import com.example.qianfangdemo.entity.City;
import com.example.qianfangdemo.entity.Province;
import java.util.ArrayList;
import java.util.List;
public class DBHelper {
private static SQLiteDatabase database;
/** 数据库名称 */
private static final String DB_NAME = "province_city_area";
/** 省名称表名 */
private static final String PROVINCE_TABLE_NAME = "province";
private static final String PROV_ID = "prov_id";
private static final String PROV_CODE = "prov_code";
private static final String PROV_NAME = "prov_name";
private static final String COUNTRY_CODE = "country_code";
private static final String CREATE_DATE = "create_date";
/** 市名称表名 */
private static final String CITY_TABLE_NAME = "city";
private static final String CITY_ID = "city_id";
private static final String CITY_CODE = "city_code";
private static final String CITY_NAME = "city_name";
/** 地区名称表名 */
private static final String AREA_TABLE_NAME = "area";
private static final String AREA_ID = "area_id";
private static final String AREA_CODE = "area_code";
private static final String AREA_NAME = "area_name";
public static SQLiteDatabase getDatabase() {
if (database == null) {
// AssetsDatabaseManager manager = AssetsDatabaseManager.getManager();
// database = manager.getDatabase(DB_NAME);
}
return database;
}
/**
* 获取省列表
*
* @param db
* @return
*/
public static List<Province> getProvinces(SQLiteDatabase db) {
AssetsDatabaseManager manager = AssetsDatabaseManager.getManager();
SQLiteDatabase database = manager.getDatabase(DB_NAME);
List<Province> provinces = new ArrayList<Province>();
Cursor cursor = database.query(PROVINCE_TABLE_NAME, null, null, null, null, null, null);
while (cursor.moveToNext()) {
Province province = new Province();
province.setProv_id(cursor.getInt(cursor.getColumnIndex(PROV_ID)));
province.setProv_code(cursor.getString(cursor.getColumnIndex(PROV_CODE)));
province.setProv_name(cursor.getString(cursor.getColumnIndex(PROV_NAME)));
province.setCountry_code(cursor.getString(cursor.getColumnIndex(COUNTRY_CODE)));
province.setCreate_date(cursor.getString(cursor.getColumnIndex(CREATE_DATE)));
provinces.add(province);
}
cursor.close();
return provinces;
}
/**
* 获取市列表
*
* @param db
* @return
*/
public static List<City> getCities(SQLiteDatabase db, String prov_code) {
AssetsDatabaseManager manager = AssetsDatabaseManager.getManager();
SQLiteDatabase database = manager.getDatabase(DB_NAME);
List<City> cities = new ArrayList<City>();
Cursor cursor = database.query(CITY_TABLE_NAME, null, PROV_CODE + "=?", new String[] { prov_code }, null, null, null);
while (cursor.moveToNext()) {
City city = new City();
city.setCity_id(cursor.getInt(cursor.getColumnIndex(CITY_ID)));
city.setCity_code(cursor.getString(cursor.getColumnIndex(CITY_CODE)));
city.setCity_name(cursor.getString(cursor.getColumnIndex(CITY_NAME)));
city.setProv_code(cursor.getString(cursor.getColumnIndex(PROV_CODE)));
city.setCreate_date(cursor.getString(cursor.getColumnIndex(CREATE_DATE)));
cities.add(city);
}
cursor.close();
return cities;
}
/**
* 获取市列表
*
* @param db
* @return
*/
public static List<Area> getAreas(SQLiteDatabase db, String city_code) {
AssetsDatabaseManager manager = AssetsDatabaseManager.getManager();
SQLiteDatabase database = manager.getDatabase(DB_NAME);
List<Area> areas = new ArrayList<Area>();
Cursor cursor = database.query(AREA_TABLE_NAME, null, CITY_CODE + "=?", new String[] { city_code }, null, null, null);
while (cursor.moveToNext()) {
Area area = new Area();
area.setArea_id(cursor.getInt(cursor.getColumnIndex(AREA_ID)));
area.setArea_code(cursor.getString(cursor.getColumnIndex(AREA_CODE)));
area.setArea_name(cursor.getString(cursor.getColumnIndex(AREA_NAME)));
area.setCity_code(cursor.getString(cursor.getColumnIndex(CITY_CODE)));
area.setCreate_date(cursor.getString(cursor.getColumnIndex(CREATE_DATE)));
areas.add(area);
}
cursor.close();
return areas;
}
public static void closeDatabase() {
try {
AssetsDatabaseManager manager = AssetsDatabaseManager.getManager();
manager.closeDatabase(DB_NAME);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"chenfeiyue@qfpay.com"
] | chenfeiyue@qfpay.com |
9ab437ce639418d12433cf22864209893434ee9b | 0a4aec0a99ab3c59e08cbe0b4603b0b94bacea30 | /First Assignment/UTXO.java | 81d94fa3b5c06255767b7d73a6afa613318d291f | [] | no_license | tersal/ScroogeCoin | 31762ce5cfecf1689bde9ca21464e08e7fb5f337 | cdd4f4999874adfe52d2eccb6b01218852673549 | refs/heads/master | 2020-03-18T22:49:14.168842 | 2018-07-13T15:36:44 | 2018-07-13T15:36:44 | 135,366,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,117 | java | import java.util.Arrays;
public class UTXO implements Comparable<UTXO> {
/** Hash of the transaction from which this UTXO originates */
private byte[] txHash;
/** Index of the corresponding output in said transaction */
private int index;
/**
* Creates a new UTXO corresponding to the output with index <index> in the transaction whose
* hash is {@code txHash}
*/
public UTXO(byte[] txHash, int index) {
this.txHash = Arrays.copyOf(txHash, txHash.length);
this.index = index;
}
/** @return the transaction hash of this UTXO */
public byte[] getTxHash() {
return txHash;
}
/** @return the index of this UTXO */
public int getIndex() {
return index;
}
/**
* Compares this UTXO to the one specified by {@code other}, considering them equal if they have
* {@code txHash} arrays with equal contents and equal {@code index} values
*/
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (GetClass() != other.getClass()) {
return false;
}
UTXO utxo = (UTXO) other;
byte[] hash = utxo.txHash;
int in = utxo.index;
if (hash.length != txHash.length || index != in)
return false;
for (int i = 0; i < hash.length; i++) {
if (hash[i] != txHash[i])
return false
}
return true;
}
/**
* Simple implementation of a UTXO hashCode that respects equality of UTXOs // (i.e.
* utxo1.equals(utxo2) => utxo1.hashCode() == utxo2.hashCode())
*/
public int hashCode() {
int hash = 1;
hash = hash * 17 + index;
hash = hash * 31 + Arrays.hashCode(txHash);
return hash;
}
/** Compares this UTXO to the one specified by {@code utxo} */
public int compareTo(UTXO utxo) {
byte[] hash = utxo.txHash;
int in = utxo.index;
if (in > index)
return -1;
else if (in < index)
return 1;
else {
int len1 = txHash.length;
int len2 = hash.length;
if (len2 > len1)
return -1;
else if (len2 < len1)
return 1;
else {
for (int i = 0; i < len1; i++) {
if (hash[i] > txHash[i])
return -1;
else if (hash[i] < txHash[i])
return 1;
}
return 0;
}
}
}
} | [
"moises.tersal@gmail.com"
] | moises.tersal@gmail.com |
169f01913c5e3b8540382399eeb148998419d313 | f1ab457a6cc5dcaf8c8f9a6ca335002e65979d62 | /app/src/main/java/su/keke/quiz/QuizSettings.java | d31cbac7a8fea937d05c17ceb2a424a94f09cca9 | [] | no_license | OxforDroid/Quiz | ad6d73c5f63ad264369565d6da09f6e5f5242527 | c917d0756a2af89d2df957933fc01dee27720328 | refs/heads/master | 2021-01-10T15:59:50.771356 | 2015-11-26T14:31:24 | 2015-11-26T14:31:24 | 46,931,332 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package su.keke.quiz;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class QuizSettings extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quiz_settings);
}
}
| [
"kaverzzcom@gmail.com"
] | kaverzzcom@gmail.com |
364915f76d0dfb856a645496dd139714d7465dff | bdb87a3d1f5270df91aed759cf7ab3fc95d5813c | /src/main/java/chap10/StopThreadGood.java | b93f32d3a8fa766e992f072fdc10f08f2d314d14 | [] | no_license | hjy628/effective-java-example | 9f9f2de1a399cc80cb36b7a92a2d424c72c2950b | a4234f0d998b29cef79b1ec22b156d28dbd28e2a | refs/heads/master | 2020-03-23T09:04:30.054690 | 2018-11-29T09:09:19 | 2018-11-29T09:09:19 | 141,365,530 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 793 | java | package chap10;
import java.util.concurrent.TimeUnit;
//Properly synchronized cooperative thread termination
public class StopThreadGood {
private static boolean stopRequested;
private static synchronized void requestStop(){
stopRequested = true;
}
private static synchronized boolean sopRequested(){
return stopRequested;
}
public static void main(String[] args) throws InterruptedException{
Thread backgroundThread = new Thread(new Runnable() {
@Override
public void run() {
int i = 0;
while (!sopRequested()){
i++;
}
}
});
backgroundThread.start();
TimeUnit.SECONDS.sleep(1);
requestStop();
}
}
| [
"hjy628@gmail.com"
] | hjy628@gmail.com |
5b270e63019dd9dfca411e1ed45e1186dddaa4b2 | 0800c206efb883e15322f063b5c6668b1b1215ac | /ref/newrelic_rewriter/com/newrelic/com/google/common/io/AppendableWriter.java | aa1928fbbd43f7a1288cf5a5c85fbceaef146c5a | [] | no_license | PioneerLab/OpenAPM-Android | b125af273b53c2996f2f0cc9261bff7cdc6c6013 | df42726ce7917ddd81135f27c0164a83e47b055c | refs/heads/master | 2021-04-24T22:44:42.934592 | 2017-04-15T09:38:14 | 2017-04-15T09:38:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,414 | java | //
// Decompiled by Procyon v0.5.30
//
package com.newrelic.com.google.common.io;
import javax.annotation.Nullable;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import com.newrelic.com.google.common.base.Preconditions;
import java.io.Writer;
class AppendableWriter extends Writer
{
private final Appendable target;
private boolean closed;
AppendableWriter(final Appendable target) {
this.target = Preconditions.checkNotNull(target);
}
@Override
public void write(final char[] cbuf, final int off, final int len) throws IOException {
this.checkNotClosed();
this.target.append(new String(cbuf, off, len));
}
@Override
public void flush() throws IOException {
this.checkNotClosed();
if (this.target instanceof Flushable) {
((Flushable)this.target).flush();
}
}
@Override
public void close() throws IOException {
this.closed = true;
if (this.target instanceof Closeable) {
((Closeable)this.target).close();
}
}
@Override
public void write(final int c) throws IOException {
this.checkNotClosed();
this.target.append((char)c);
}
@Override
public void write(@Nullable final String str) throws IOException {
this.checkNotClosed();
this.target.append(str);
}
@Override
public void write(@Nullable final String str, final int off, final int len) throws IOException {
this.checkNotClosed();
this.target.append(str, off, off + len);
}
@Override
public Writer append(final char c) throws IOException {
this.checkNotClosed();
this.target.append(c);
return this;
}
@Override
public Writer append(@Nullable final CharSequence charSeq) throws IOException {
this.checkNotClosed();
this.target.append(charSeq);
return this;
}
@Override
public Writer append(@Nullable final CharSequence charSeq, final int start, final int end) throws IOException {
this.checkNotClosed();
this.target.append(charSeq, start, end);
return this;
}
private void checkNotClosed() throws IOException {
if (this.closed) {
throw new IOException("Cannot write to a closed writer.");
}
}
}
| [
"maohongbin01@baidu.com"
] | maohongbin01@baidu.com |
a161df34321a9ed054853b9416892db31d5297e8 | 50787898a113f326641ff64823cd60583d3b3188 | /src/com/facebook/buck/core/starlark/rule/SkylarkRuleContext.java | 295a707cb861d1dee5f656dfd13a555bcd8684da | [
"Apache-2.0"
] | permissive | isfaaghyth/buck | 76469193910dd8b7d5d0f7aba01936e7fc0e594c | cad8f7ac2de2c9a4f08ce66180db677e44d61aee | refs/heads/master | 2022-12-10T16:24:52.753251 | 2019-07-02T23:45:03 | 2019-07-03T00:53:38 | 195,009,781 | 1 | 0 | Apache-2.0 | 2019-07-03T08:15:48 | 2019-07-03T08:15:47 | null | UTF-8 | Java | false | false | 1,175 | java | /*
* Copyright 2019-present Facebook, 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.facebook.buck.core.starlark.rule;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter;
/** The context passed to user defined rules' implementation functions */
public class SkylarkRuleContext implements SkylarkRuleContextApi {
private final Label label;
public SkylarkRuleContext(Label label) {
this.label = label;
}
@Override
public void repr(SkylarkPrinter printer) {
printer.append("<ctx>");
}
@Override
public Label getLabel() {
return label;
}
}
| [
"facebook-github-bot@users.noreply.github.com"
] | facebook-github-bot@users.noreply.github.com |
0c1ac7603ff58e09d2eb18b9702ba0a775cb511e | ef094729d0f930e7e0862616d8de1dcdb919fe87 | /src/main/java/com/example/common/common/validator/AssertUtils.java | b963c85e3d4bd990fb333b411393e9847e21a43e | [] | no_license | q1171874514/common | 7357fa2cbfdf8a545e05497347d7e3a4bfffee50 | 7acc43326e152d57b15cfc093cc69bd1b6dea00e | refs/heads/master | 2023-02-26T16:00:38.564935 | 2021-02-01T07:58:14 | 2021-02-01T07:58:14 | 319,872,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,660 | java | /**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.example.common.common.validator;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import com.example.common.common.exception.ErrorCode;
import com.example.common.common.exception.RenException;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Map;
/**
* 校验工具类
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
public class AssertUtils {
public static void isBlank(String str, String... params) {
isBlank(str, ErrorCode.NOT_NULL, params);
}
public static void isBlank(String str, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
}
if (StringUtils.isBlank(str)) {
throw new RenException(code, params);
}
}
public static void isNull(Object object, String... params) {
isNull(object, ErrorCode.NOT_NULL, params);
}
public static void isNull(Object object, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
}
if (object == null) {
throw new RenException(code, params);
}
}
public static void isArrayEmpty(Object[] array, String... params) {
isArrayEmpty(array, ErrorCode.NOT_NULL, params);
}
public static void isArrayEmpty(Object[] array, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
}
if(ArrayUtil.isEmpty(array)){
throw new RenException(code, params);
}
}
public static void isListEmpty(List<?> list, String... params) {
isListEmpty(list, ErrorCode.NOT_NULL, params);
}
public static void isListEmpty(List<?> list, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
}
if(CollUtil.isEmpty(list)){
throw new RenException(code, params);
}
}
public static void isMapEmpty(Map map, String... params) {
isMapEmpty(map, ErrorCode.NOT_NULL, params);
}
public static void isMapEmpty(Map map, Integer code, String... params) {
if(code == null){
throw new RenException(ErrorCode.NOT_NULL, "code");
}
if(MapUtil.isEmpty(map)){
throw new RenException(code, params);
}
}
} | [
"1171874514@qq.com"
] | 1171874514@qq.com |
5761547027fa7f001d4190fa5299d3c4519547dd | 13b8f28169cc55ca0abbd8b890834e86de28c745 | /baselayoutdemo/src/test/java/com/example/baselayoutdemo/ExampleUnitTest.java | 243804620ece929358376099dc788c7674437895 | [] | no_license | lanfairy/AndroidStudy | c98925d7214861a1bfcfc254f941e69b815a2260 | bbac287c4e08cea767ede14dfc633254b3ee1722 | refs/heads/master | 2020-04-16T02:04:00.102606 | 2019-01-24T09:12:55 | 2019-01-24T09:12:55 | 165,196,597 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.example.baselayoutdemo;
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);
}
} | [
"1264894052@qq.com"
] | 1264894052@qq.com |
d0fde9c5dc59bdb61aec4c7a29449f335bd38cec | f46af6affa72df21b34a3fc7cadcc9b736880ba3 | /Trees/HW10/TreePackage/BinaryNode.java | 6b08d412f90b10a56cd114431fb6de0fff9557ae | [] | no_license | JarrodLow/Java | a4ff29f909c9880f8ec33d02f2d0456573942401 | 7ae74c298bac7da4c4803d6368c8ce173e597842 | refs/heads/master | 2020-12-01T07:22:41.733512 | 2014-08-07T20:32:22 | 2014-08-07T20:32:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,714 | java | package TreePackage;
class BinaryNode<T> implements BinaryNodeInterface<T>,
java.io.Serializable
{
private T data;
private BinaryNode<T> left;
private BinaryNode<T> right;
public BinaryNode()
{
this(null); // call next constructor
} // end default constructor
public BinaryNode(T dataPortion)
{
this(dataPortion, null, null); // call next constructor
} // end constructor
public BinaryNode(T dataPortion, BinaryNode<T> leftChild,
BinaryNode<T> rightChild)
{
data = dataPortion;
left = leftChild;
right = rightChild;
} // end constructor
public T getData()
{
return data;
} // end getData
public void setData(T newData)
{
data = newData;
} // end setData
public BinaryNodeInterface<T> getLeftChild()
{
return left;
} // end getLeftChild
public void setLeftChild(BinaryNodeInterface<T> leftChild)
{
left = (BinaryNode<T>)leftChild;
} // end setLeftChild
public boolean hasLeftChild()
{
return left != null;
} // end hasLeftChild
public boolean isLeaf()
{
return (left == null) && (right == null);
} // end isLeaf
public BinaryNodeInterface<T> getRightChild()
{
return right;
}
public void setRightChild(BinaryNodeInterface<T> rightChild)
{
right = (BinaryNode<T>)rightChild;
}
public boolean hasRightChild()
{
return right != null;
}
public BinaryNodeInterface<T> copy()
{
BinaryNode<T> newRoot = new BinaryNode<T>(data);
if (left != null)
newRoot.left = (BinaryNode<T>)left.copy();
if (right != null)
newRoot.right = (BinaryNode<T>)right.copy();
return newRoot;
} // end copy
public int getHeight()
{
return getHeight(this); // call private getHeight
} // end getHeight
private int getHeight(BinaryNode<T> node)
{
int height = 0;
if (node != null)
height = 1 + Math.max(getHeight(node.left),
getHeight(node.right));
return height;
} // end getHeight
public int getNumberOfNodes()
{
int leftNumber = 0;
int rightNumber = 0;
if (left != null)
leftNumber = left.getNumberOfNodes();
if (right != null)
rightNumber = right.getNumberOfNodes();
return 1 + leftNumber + rightNumber;
} // end getNumberOfNodes
} // end BinaryNode
| [
"richardszeto74@gmail.com"
] | richardszeto74@gmail.com |
b62502ce710b0ed858ee75fa20ed2e50ed7c864b | 28928a025002d68f2341074fd11ef255ca422bb2 | /src/main/java/com/daily/code/dailycode/netty/protocol/Request.java | 90ad773d1326c4f8cd973f9013ca962faa43e18a | [] | no_license | HNHYWL/dailycode | 9d4e87959052b34ab442aafe9bd48d7e28cd1c77 | cd8c0b99972a7dcf7ea3774ec8c9fc7964dc329f | refs/heads/master | 2020-04-29T20:54:41.756445 | 2019-03-19T14:38:36 | 2019-03-19T14:38:36 | 176,396,981 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | true | 23,735 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: BaseRequestProto.proto
package com.daily.code.dailycode.netty.protocol;
public final class Request {
private Request() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface CIMReqProtocolOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// required int64 requestId = 2;
/**
* <code>required int64 requestId = 2;</code>
*/
boolean hasRequestId();
/**
* <code>required int64 requestId = 2;</code>
*/
long getRequestId();
// required string reqMsg = 1;
/**
* <code>required string reqMsg = 1;</code>
*/
boolean hasReqMsg();
/**
* <code>required string reqMsg = 1;</code>
*/
java.lang.String getReqMsg();
/**
* <code>required string reqMsg = 1;</code>
*/
com.google.protobuf.ByteString
getReqMsgBytes();
// required int32 type = 3;
/**
* <code>required int32 type = 3;</code>
*/
boolean hasType();
/**
* <code>required int32 type = 3;</code>
*/
int getType();
}
/**
* Protobuf type {@code CIMReqProtocol}
*/
public static final class CIMReqProtocol extends
com.google.protobuf.GeneratedMessage
implements CIMReqProtocolOrBuilder {
// Use CIMReqProtocol.newBuilder() to construct.
private CIMReqProtocol(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private CIMReqProtocol(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final CIMReqProtocol defaultInstance;
public static CIMReqProtocol getDefaultInstance() {
return defaultInstance;
}
public CIMReqProtocol getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private CIMReqProtocol(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
bitField0_ |= 0x00000002;
reqMsg_ = input.readBytes();
break;
}
case 16: {
bitField0_ |= 0x00000001;
requestId_ = input.readInt64();
break;
}
case 24: {
bitField0_ |= 0x00000004;
type_ = input.readInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.daily.code.dailycode.netty.protocol.Request.internal_static_CIMReqProtocol_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.daily.code.dailycode.netty.protocol.Request.internal_static_CIMReqProtocol_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol.class, com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol.Builder.class);
}
public static com.google.protobuf.Parser<CIMReqProtocol> PARSER =
new com.google.protobuf.AbstractParser<CIMReqProtocol>() {
public CIMReqProtocol parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new CIMReqProtocol(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<CIMReqProtocol> getParserForType() {
return PARSER;
}
private int bitField0_;
// required int64 requestId = 2;
public static final int REQUESTID_FIELD_NUMBER = 2;
private long requestId_;
/**
* <code>required int64 requestId = 2;</code>
*/
public boolean hasRequestId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int64 requestId = 2;</code>
*/
public long getRequestId() {
return requestId_;
}
// required string reqMsg = 1;
public static final int REQMSG_FIELD_NUMBER = 1;
private java.lang.Object reqMsg_;
/**
* <code>required string reqMsg = 1;</code>
*/
public boolean hasReqMsg() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string reqMsg = 1;</code>
*/
public java.lang.String getReqMsg() {
java.lang.Object ref = reqMsg_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
reqMsg_ = s;
}
return s;
}
}
/**
* <code>required string reqMsg = 1;</code>
*/
public com.google.protobuf.ByteString
getReqMsgBytes() {
java.lang.Object ref = reqMsg_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
reqMsg_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// required int32 type = 3;
public static final int TYPE_FIELD_NUMBER = 3;
private int type_;
/**
* <code>required int32 type = 3;</code>
*/
public boolean hasType() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required int32 type = 3;</code>
*/
public int getType() {
return type_;
}
private void initFields() {
requestId_ = 0L;
reqMsg_ = "";
type_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
if (!hasRequestId()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasReqMsg()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasType()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(1, getReqMsgBytes());
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeInt64(2, requestId_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeInt32(3, type_);
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getReqMsgBytes());
}
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(2, requestId_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(3, type_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code CIMReqProtocol}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocolOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.daily.code.dailycode.netty.protocol.Request.internal_static_CIMReqProtocol_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.daily.code.dailycode.netty.protocol.Request.internal_static_CIMReqProtocol_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol.class, com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol.Builder.class);
}
// Construct using com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
requestId_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
reqMsg_ = "";
bitField0_ = (bitField0_ & ~0x00000002);
type_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.daily.code.dailycode.netty.protocol.Request.internal_static_CIMReqProtocol_descriptor;
}
public com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol getDefaultInstanceForType() {
return com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol.getDefaultInstance();
}
public com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol build() {
com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol buildPartial() {
com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol result = new com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.requestId_ = requestId_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.reqMsg_ = reqMsg_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.type_ = type_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol) {
return mergeFrom((com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol other) {
if (other == com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol.getDefaultInstance()) return this;
if (other.hasRequestId()) {
setRequestId(other.getRequestId());
}
if (other.hasReqMsg()) {
bitField0_ |= 0x00000002;
reqMsg_ = other.reqMsg_;
onChanged();
}
if (other.hasType()) {
setType(other.getType());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasRequestId()) {
return false;
}
if (!hasReqMsg()) {
return false;
}
if (!hasType()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.daily.code.dailycode.netty.protocol.Request.CIMReqProtocol) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// required int64 requestId = 2;
private long requestId_ ;
/**
* <code>required int64 requestId = 2;</code>
*/
public boolean hasRequestId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required int64 requestId = 2;</code>
*/
public long getRequestId() {
return requestId_;
}
/**
* <code>required int64 requestId = 2;</code>
*/
public Builder setRequestId(long value) {
bitField0_ |= 0x00000001;
requestId_ = value;
onChanged();
return this;
}
/**
* <code>required int64 requestId = 2;</code>
*/
public Builder clearRequestId() {
bitField0_ = (bitField0_ & ~0x00000001);
requestId_ = 0L;
onChanged();
return this;
}
// required string reqMsg = 1;
private java.lang.Object reqMsg_ = "";
/**
* <code>required string reqMsg = 1;</code>
*/
public boolean hasReqMsg() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>required string reqMsg = 1;</code>
*/
public java.lang.String getReqMsg() {
java.lang.Object ref = reqMsg_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
.toStringUtf8();
reqMsg_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>required string reqMsg = 1;</code>
*/
public com.google.protobuf.ByteString
getReqMsgBytes() {
java.lang.Object ref = reqMsg_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
reqMsg_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>required string reqMsg = 1;</code>
*/
public Builder setReqMsg(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
reqMsg_ = value;
onChanged();
return this;
}
/**
* <code>required string reqMsg = 1;</code>
*/
public Builder clearReqMsg() {
bitField0_ = (bitField0_ & ~0x00000002);
reqMsg_ = getDefaultInstance().getReqMsg();
onChanged();
return this;
}
/**
* <code>required string reqMsg = 1;</code>
*/
public Builder setReqMsgBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
reqMsg_ = value;
onChanged();
return this;
}
// required int32 type = 3;
private int type_ ;
/**
* <code>required int32 type = 3;</code>
*/
public boolean hasType() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* <code>required int32 type = 3;</code>
*/
public int getType() {
return type_;
}
/**
* <code>required int32 type = 3;</code>
*/
public Builder setType(int value) {
bitField0_ |= 0x00000004;
type_ = value;
onChanged();
return this;
}
/**
* <code>required int32 type = 3;</code>
*/
public Builder clearType() {
bitField0_ = (bitField0_ & ~0x00000004);
type_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:CIMReqProtocol)
}
static {
defaultInstance = new CIMReqProtocol(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:CIMReqProtocol)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_CIMReqProtocol_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_CIMReqProtocol_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\026BaseRequestProto.proto\"A\n\016CIMReqProtoc" +
"ol\022\021\n\trequestId\030\002 \002(\003\022\016\n\006reqMsg\030\001 \002(\t\022\014\n" +
"\004type\030\003 \002(\005B,\n!com.daily.code.dailycode." +
"protocolB\007Request"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_CIMReqProtocol_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_CIMReqProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_CIMReqProtocol_descriptor,
new java.lang.String[] { "RequestId", "ReqMsg", "Type", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}
| [
"wqwl51@qq.com"
] | wqwl51@qq.com |
68221349583cb2838588fd81dc28fbdcee0f6eb6 | ca021ff2fb3d5abdaf7f65fbaab776e869ccd7a5 | /src/LeetCodeAnswer/no12_IntegerToRoman/Solution.java | a8e8b611109ad98fdce5834a72edc013191861f5 | [] | no_license | teddywang1992/leetcode | 56ab4c072c9f0f2db31a0721294b1619a12856cd | 7d676f2e67a1a2ba073a5c11fc5f17e8c6b77e69 | refs/heads/master | 2021-01-22T18:07:23.152614 | 2018-11-24T22:46:09 | 2018-11-24T22:46:09 | 100,737,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package LeetCodeAnswer.no12_IntegerToRoman;
public class Solution {
public String intToRoman(int num) {
String M[] = {"", "M", "MM", "MMM"};
String C[] = {"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"};
String X[] = {"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"};
String I[] = {"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"};
return M[num/1000] + C[(num%1000)/100] + X[(num%100)/10] + I[num%10];
}
}
| [
"443909723@qq.com"
] | 443909723@qq.com |
ef64cc4171e39c9b9e429f0347bcafbfaa3d287f | c9aa1e5711714de6a9c6288a2be626fff1f4be7a | /casaba-agent-service/src/main/java/com/casaba/agent/core/bean/AgentBalanceChangeDetailBean.java | 5a15038803c09685de70f020f788d922be95418d | [] | no_license | Suancaiyu0707/cs | c4733f0a974be8c8d975f1eb1eada9cb2f012ed3 | 198e9cefe1cc7d1355396f872bb95b26ee8f8be5 | refs/heads/master | 2020-03-30T03:41:44.300303 | 2018-10-04T01:51:23 | 2018-10-04T01:51:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,056 | java | package com.casaba.agent.core.bean;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Author: zhifang.xu
* Date: 下午4:02 2018/9/17
* Desc: 预存款信息变更明细
**/
@Data
@ToString
public class AgentBalanceChangeDetailBean implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
/**
* 代理商id
*/
private Integer agentId;
/**
* 变更时间
* yyyyMMddHHmmss
*/
private Date changeTime;
/**
* 交易单号
*/
private String transNo;
/**
* 变更项目名称
*/
private String project;
/**
* 变更金额
*/
private BigDecimal transAmount;
/**
* 变更后金额
*/
private BigDecimal amountAfterTrans;
/**
* 变更类型,充值R,扣减D,消耗C
*/
private String changeType;
/**
* 操作人员
*/
private String operator;
}
| [
"xuzhifang03334@hellobike.com"
] | xuzhifang03334@hellobike.com |
c27f03e92eb1977f9187eea4a09d3e9a898d7858 | c2a9f480b0af14ef6d1839d9e1c655bf4131133a | /6_stream_processing/services/order-service/src/main/java/com/architect/api/order/OrderController.java | f6a3a585657885ce023ec223f670274e37c82bfe | [] | no_license | allash/kubernetes-practise | 7d8c89153e17e75dea0314b076b6b65e52cd091f | b680de0f41fc1427eff331a433171546730a3490 | refs/heads/master | 2022-12-27T08:18:40.633179 | 2020-10-13T06:17:13 | 2020-10-13T06:17:13 | 280,820,569 | 0 | 0 | null | 2020-10-13T06:17:14 | 2020-07-19T08:06:47 | Java | UTF-8 | Java | false | false | 1,121 | java | package com.architect.api.order;
import com.architect.api.order.dto.CreateOrderRequest;
import com.architect.http.clients.UserClient;
import com.architect.persistence.repositories.OrderRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
@RestController
@RequestMapping("/orders")
public class OrderController {
private static final Logger LOGGER = LoggerFactory.getLogger(OrderController.class.getName());
private final OrderService orderService;
@Autowired
public OrderController(OrderService orderService) {
this.orderService = orderService;
}
@PostMapping
public void createOrder(@Valid @RequestBody CreateOrderRequest request) {
LOGGER.info("Create order");
orderService.createOrder(request);
}
}
| [
"1172129+allash@users.noreply.github.com"
] | 1172129+allash@users.noreply.github.com |
20065120677645e28a4373e1091c2c23d2c90202 | 6c271fbbe1860985c8ceb6fb4f122b5368d87a12 | /src/main/java/com/perforce/common/schema/JournalRecord.java | 6525cc89510649a15a092622e1d92e7453c841d4 | [
"BSD-2-Clause"
] | permissive | p4paul/p4convert | 5ad676f257188a769fa632cf55d2ee1b3b168279 | 40808e37ff6364e2a1aac5c49f51e71e49b1b9b7 | refs/heads/master | 2023-01-21T06:16:50.491312 | 2018-02-07T17:08:33 | 2018-02-07T17:08:33 | 315,887,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,388 | java | package com.perforce.common.schema;
import java.util.ArrayList;
import java.util.List;
import com.perforce.common.ConverterException;
public class JournalRecord {
static class Entry {
public Attribute attrib;
public Object value;
public Entry(Attribute attrib, Object value) {
this.attrib = attrib;
this.value = value;
}
}
private String action;
private String table;
private int version;
private TableVersion schema;
private List<Entry> fields = new ArrayList<Entry>();
public JournalRecord(String action, String table, int version) {
this.action = action;
this.table = table;
this.version = version;
schema = Schema.GetTableVersion(table, version);
// System.out.println(table);
// System.out.println(schema);
}
public void addField(String key, Object value) throws ConverterException {
int next = fields.size();
Attribute attrib = schema.getAttribute(next);
if (attrib.getName().equals(key)) {
fields.add(new Entry(attrib, value));
} else {
throw new ConverterException("Journal field error(" + key + ")");
}
}
public String toJournalString() {
StringBuffer sb = new StringBuffer();
sb.append("@" + action + "@ ");
sb.append(version + " ");
sb.append("@" + table + "@ ");
for (Entry e : fields) {
sb.append(e.attrib.getDomain().toJournalFormat(e.value));
sb.append(" ");
}
return sb.toString();
}
}
| [
"pallen@perforce.com"
] | pallen@perforce.com |
240ee7254de5f665da078c572188538fb55547e6 | 6727e28f259b42fd39f0bfe694cc0f9532c90f41 | /src/main/java/cn/kgc/controller/EmployeeController.java | 6f7d01cfafa2ae96e9b5a830ff47015527a6f74e | [] | no_license | qianzong11/dddddd | 4654b513e0f7fd1421c310ead729dd4392df2d4c | e8385943c5f01c245e3952ba8c7aa8b1b1a26130 | refs/heads/master | 2023-02-17T17:29:02.144780 | 2021-01-19T09:54:35 | 2021-01-19T09:54:35 | 330,862,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,372 | java | package cn.kgc.controller;
import cn.kgc.entity.Employee;
import cn.kgc.service.EmployeeService;
import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* (Employee)表控制层
*
* @author makejava
* @since 2021-01-13 09:55:22
*/
@Controller
@RequestMapping("employee")
public class EmployeeController {
/**
* 服务对象
*/
@Resource
private EmployeeService employeeService;
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectOne")
public Employee selectOne(Integer id) {
return this.employeeService.queryById(id);
}
/**
* 查询所有员工
* @param model
* @return
*/
@RequestMapping("queryAllEmp")
public String queryAllEmp(Model model){
List<Employee> employeeList=employeeService.findAllEmp();
model.addAttribute("emplist",employeeList);
return "emplist";
}
@RequestMapping("delEmp")
@ResponseBody
public JSON delEmp(Integer empId){
System.out.println("员工id:"+empId);
boolean b=employeeService.deleteById(empId);
Map<String,Boolean> resultMap=new HashMap<>();
resultMap.put("result",b);
return (JSON)JSON.toJSON(resultMap);
}
@RequestMapping("addEmp")
public String addEmp(Employee employee){
Employee emp = employeeService.insert(employee);
if (emp!=null){
return "redirect:/employee/queryAllEmp";
}else {
return "forward:addemp.jsp";
}
}
@RequestMapping("updt")
public String updt(Integer id,Model model){
Employee queryById = employeeService.queryById(id);
model.addAttribute("queryById",queryById);
return "updt";
}
@RequestMapping("updtEmp")
public String updtEmp(Employee employee ){
System.out.println(employee);
Employee emp = employeeService.update(employee);
if (emp!=null){
System.out.println("1");
}else {
System.out.println("0");
}
return "redirect:/employee/queryAllEmp";
}
} | [
"2795918481@qq.com"
] | 2795918481@qq.com |
94f9a1a34191b448dd73ee3a16ca54a3cccffd05 | e457376950380dd6e09e58fa7bee3d09e2a0f333 | /python-impl/src/main/java/com/jetbrains/python/impl/codeInsight/UnindentingInsertHandler.java | f2c8198753da7fed7ad9cb2ecb39fb537cdc9194 | [
"Apache-2.0"
] | permissive | consulo/consulo-python | b816b7b9a4b346bee5d431ef6c39fdffe40adf40 | e191cd28f043c1211eb98af42d3c0a40454b2d98 | refs/heads/master | 2023-08-09T02:27:03.585942 | 2023-07-09T08:33:47 | 2023-07-09T08:33:47 | 12,317,018 | 0 | 0 | Apache-2.0 | 2020-06-05T17:16:50 | 2013-08-23T07:16:43 | Java | UTF-8 | Java | false | false | 5,012 | java | /*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python.impl.codeInsight;
import consulo.codeEditor.action.EditorActionUtil;
import consulo.language.editor.completion.lookup.InsertHandler;
import consulo.language.editor.completion.lookup.InsertionContext;
import consulo.document.Document;
import consulo.codeEditor.Editor;
import consulo.project.Project;
import consulo.language.psi.PsiDocumentManager;
import consulo.language.psi.PsiElement;
import consulo.language.psi.PsiFile;
import consulo.language.psi.util.PsiTreeUtil;
import com.jetbrains.python.impl.codeInsight.completion.PythonLookupElement;
import com.jetbrains.python.psi.PyStatementWithElse;
import com.jetbrains.python.psi.PyTryExceptStatement;
/**
* Adjusts indentation after a final part keyword is inserted, e.g. an "else:".
* User: dcheryasov
* Date: Mar 2, 2010 6:48:40 PM
*/
public class UnindentingInsertHandler implements InsertHandler<PythonLookupElement> {
public final static UnindentingInsertHandler INSTANCE = new UnindentingInsertHandler();
private UnindentingInsertHandler() {
}
public void handleInsert(InsertionContext context, PythonLookupElement item) {
unindentAsNeeded(context.getProject(), context.getEditor(), context.getFile());
}
/**
* Unindent current line to be flush with a starting part, detecting the part if necessary.
* @param project
* @param editor
* @param file
* @return true if unindenting succeeded
*/
public static boolean unindentAsNeeded(Project project, Editor editor, PsiFile file) {
// TODO: handle things other than "else"
final Document document = editor.getDocument();
int offset = editor.getCaretModel().getOffset();
CharSequence text = document.getCharsSequence();
if (offset >= text.length()) offset = text.length() - 1;
int line_start_offset = document.getLineStartOffset(document.getLineNumber(offset));
int nonspace_offset = findBeginning(line_start_offset, text);
Class<? extends PsiElement> parentClass = null;
int last_offset = nonspace_offset + "finally".length(); // the longest of all
if (last_offset > offset) last_offset = offset;
int local_length = last_offset - nonspace_offset + 1;
if (local_length > 0) {
String piece = text.subSequence(nonspace_offset, last_offset+1).toString();
final int else_len = "else".length();
if (local_length >= else_len) {
if ((piece.startsWith("else") || piece.startsWith("elif")) && (else_len == piece.length() || piece.charAt(else_len) < 'a' || piece.charAt(else_len) > 'z')) {
parentClass = PyStatementWithElse.class;
}
}
final int except_len = "except".length();
if (local_length >= except_len) {
if (piece.startsWith("except") && (except_len == piece.length() || piece.charAt(except_len) < 'a' || piece.charAt(except_len) > 'z')) {
parentClass = PyTryExceptStatement.class;
}
}
final int finally_len = "finally".length();
if (local_length >= finally_len) {
if (piece.startsWith("finally") && (finally_len == piece.length() || piece.charAt(finally_len) < 'a' || piece.charAt(finally_len) > 'z')) {
parentClass = PyTryExceptStatement.class;
}
}
}
if (parentClass == null) return false; // failed
PsiDocumentManager.getInstance(project).commitDocument(document); // reparse
PsiElement token = file.findElementAt(offset-2); // -1 is our ':'; -2 is even safer.
PsiElement outer = PsiTreeUtil.getParentOfType(token, parentClass);
if (outer != null) {
int outer_offset = outer.getTextOffset();
int outer_indent = outer_offset - document.getLineStartOffset(document.getLineNumber(outer_offset));
assert outer_indent >= 0;
int current_indent = nonspace_offset - line_start_offset;
EditorActionUtil.indentLine(project, editor, document.getLineNumber(offset), outer_indent - current_indent);
return true;
}
return false;
}
// finds offset of first non-space in the line
private static int findBeginning(int start_offset, CharSequence text) {
int current_offset = start_offset;
int text_length = text.length();
while (current_offset < text_length) {
char current_char = text.charAt(current_offset);
if (current_char != ' ' && current_char != '\t' && current_char != '\n') break;
current_offset += 1;
}
return current_offset;
}
}
| [
"vistall.valeriy@gmail.com"
] | vistall.valeriy@gmail.com |
854a265c82c9cb9bffa81bc72fc7377dbf751d41 | fc599e54ff0a7f8ee0c4d9052d80f1f7648d0417 | /elasticsearch-client-scripting/src/main/java/org/elasticsearch/script/ContentParseElement.java | 518fa8c99311dcf48c88bbcb8f10262268d4450c | [
"Apache-2.0"
] | permissive | jshiying/elasticsearch-client | f1b149d76504c2c0641afd4935b455cfdca84313 | b60408a6854c3ae9bee5a0866a71d14096494991 | refs/heads/master | 2021-01-21T07:53:13.975489 | 2012-11-28T22:14:23 | 2012-11-28T22:14:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,655 | java | /*
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.script;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.script.ContentScript;
//import org.elasticsearch.search.fetch.script.ScriptFieldsContext;
import org.elasticsearch.common.xcontent.ContentContext;
/**
*
*/
public class ContentParseElement {
public void parse(XContentParser parser, ContentContext context) throws Exception {
XContentParser.Token token = parser.currentToken();
if (token == XContentParser.Token.START_ARRAY) {
boolean added = false;
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
String name = parser.text();
if (name.contains("_source.") || name.contains("doc[")) {
// script field to load from source
//SearchScript searchScript = context.scriptService().search(context.lookup(), "mvel", name, null);
//context.scriptFields().add(new ScriptFieldsContext.ScriptField(name, searchScript, true));
} else {
added = true;
//context.fieldNames().add(name);
}
}
if (!added) {
//context.emptyFieldNames();
}
} else if (token == XContentParser.Token.VALUE_STRING) {
String name = parser.text();
if (name.contains("_source.") || name.contains("doc[")) {
// script field to load from source
//SearchScript searchScript = context.scriptService().search(context.lookup(), "mvel", name, null);
//context.scriptFields().add(new ScriptFieldsContext.ScriptField(name, searchScript, true));
} else {
//context.fieldNames().add(name);
}
}
}
}
| [
"joergprante@gmail.com"
] | joergprante@gmail.com |
807a31f688979a5786ce6f25656047de04255ef6 | 85be25ae2ec24917ee88c2e0bef417901d1ffdf8 | /RestfulTest/test/HelpClasses/linkNormalize.java | de4b2c91d53c9ed03aabd017832867c7b4dfa56d | [] | no_license | dancoconetu/WebServicesProject16 | 47c04e542cc0eb1e387ae3eb10ddf848f40600b9 | 1273a0b8dfa1fca251f8f431ac43fd0d49a2f469 | refs/heads/master | 2021-01-11T07:10:41.231529 | 2016-11-25T12:16:25 | 2016-11-25T12:16:25 | 72,617,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,233 | 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 HelpClasses;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author justinas
*/
public class linkNormalize {
public List<Link> add(StatusInfo.Status status,int itineraryID){
List <Link> links = new ArrayList<Link>();
String mainPath = "http://localhost:9090/TravelGoodsREST/" ;
String itinPath = mainPath + "itinerary/" +itineraryID + "/";
//if status is confirmed of itinierary then add cancel link
if(status == StatusInfo.Status.CONFIRMED){
Link link = new Link();
link.setRel("http://itinerary/"+itineraryID +"/cancelItinerary");
link.setUri(itinPath + "cancelItinerary");
links.add(link);
}
if(status == StatusInfo.Status.UNCONFIRMED){
// Link link = new Link();
//
// link.setRel("http://itinerary/"+itineraryID +"/cancelItinerary");
// link.setUri(itinPath + "cancelItinerary");
// links.add(link);
}
return links;
}
}
| [
"justuasas@gmail.com"
] | justuasas@gmail.com |
0dbc88bb28552a278ce9022f3c85fc8856d5f9dc | 82dc5807c02a9c81d574f59c74f72cabce8595a2 | /Epos/src/com/yifeng/skzs/entity/User.java | 2fda66ec0af337156ba68b9818071c0b60bcada4 | [] | no_license | duslabo/android_work | 48d073e04cb58189c8cd363d4e1d8ada716474ea | adcaec07b3a7dd64b98763645522972387c67e73 | refs/heads/master | 2020-05-22T18:05:31.669708 | 2017-04-21T08:21:29 | 2017-04-21T08:21:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,752 | java | package com.yifeng.skzs.entity;
/**用户登录
* comment:存放用户信息
*
*/
public class User {
public String RespCode="";// "RespCode":"000" 应答码 定长3位 必须 000表示成功,其余表示失败 详细解释请见附录5.1
private String RespDesc; //"RespDesc":"成功" 应答码描述 变长 最大128位 必须
private static String SessionId; //"SessionId":"UKu5vp5ykRWAYHdviEHPoJhcaeJHRN3e" 会话id 最大30位 必须 后续使用其他需要验证session的接口时使用的会话id
/**
* 绑定
*/
private String BindStat;
// private static String MtId = "003010000029"; //移动终端设备号 固定12位 必须
private static String MtId = "001000000050"; //移动终端设备号 固定12位 必须
// private static String MtId = "003010000030"; //移动终端设备号 固定12位 必须
private static String custId; //"CustId":"6000060000007692" 用户客户号 最大16位 必须 登录号对应的用户客户号,后续接口都需要上送客户号
private static String UserName; //"UserName":"ceshu" 用户姓名 最大50位 必须
private static String name;
private static String pwd;
/**
* 账户查询
*/
private String TotalOrdCnt; //当日累计交易笔数 最大3位 必须
private String TotalOrdAmt; //当日累计交易金额 变长 最大14位 必须 小数点后保留2位
private String CashCardNo; //取现银行卡卡号 最大25位 必须 卡号形式前6后4,中间数字以*替代
private String BankId; //取现银行卡所属银行 定长2位 必须 详细解释请见附录5.2
private String BindedMtId; //绑定的设备号 定长12位 可选 绑定的设备号
private String AvailCashAmt;//可取现金额 变长 最大14位 必须 小数点后保留2位
private String NeedLiqAmt; //待结算余额 变长 最大14位 必须 小数点后保留2位,收款金额可以T+N日再进行结算
private int state;// 查询状态 -1服务器异常,0找不到,1加载成功,2数据解析异常
private String imsi;
private String key;
private boolean rememberPwd = false;// 是否记住密码
public static String getName() {
return name;
}
public static void setName(String value) {
name = value;
}
public static String getPwd() {
return pwd;
}
public static void setPwd(String value) {
pwd = value;
}
public String getRespCode() {
return RespCode;
}
public void setRespCode(String respCode) {
RespCode = respCode;
}
public String getRespDesc() {
return RespDesc;
}
public void setRespDesc(String respDesc) {
RespDesc = respDesc;
}
public static String getCustId() {
return custId;
}
public static void setCustId(String value) {
custId = value;
}
public static String getUserName() {
return UserName;
}
public static void setUserName(String userName) {
UserName = userName;
}
public static String getSessionId() {
return SessionId;
}
public static void setSessionId(String sessionId) {
SessionId = sessionId;
}
public String getBindStat() {
return BindStat;
}
public void setBindStat(String bindStat) {
BindStat = bindStat;
}
public static String getMtId() {
return MtId;
}
public static void setMtId(String mtId) {
MtId = mtId;
}
public String getTotalOrdCnt() {
return TotalOrdCnt;
}
public void setTotalOrdCnt(String totalOrdCnt) {
TotalOrdCnt = totalOrdCnt;
}
public String getTotalOrdAmt() {
return TotalOrdAmt;
}
public void setTotalOrdAmt(String totalOrdAmt) {
TotalOrdAmt = totalOrdAmt;
}
public String getCashCardNo() {
return CashCardNo;
}
public void setCashCardNo(String cashCardNo) {
CashCardNo = cashCardNo;
}
public String getBankId() {
return BankId;
}
public void setBankId(String bankId) {
BankId = bankId;
}
public String getBindedMtId() {
return BindedMtId;
}
public void setBindedMtId(String bindedMtId) {
BindedMtId = bindedMtId;
}
public String getAvailCashAmt() {
return AvailCashAmt;
}
public void setAvailCashAmt(String availCashAmt) {
AvailCashAmt = availCashAmt;
}
public String getNeedLiqAmt() {
return NeedLiqAmt;
}
public void setNeedLiqAmt(String needLiqAmt) {
NeedLiqAmt = needLiqAmt;
}
//
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public String getImsi() {
return imsi;
}
public void setImsi(String imsi) {
this.imsi = imsi;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
//
// public String getMobileNo() {
// return mobileNo;
// }
//
// public void setMobileNo(String mobileNo) {
// this.mobileNo = mobileNo;
// }
//
// public String getPublicKey() {
// return publicKey;
// }
//
// public void setPublicKey(String publicKey) {
// this.publicKey = publicKey;
// }
//
// public String getUserId() {
// return userId;
// }
//
// public void setUserId(String userId) {
// this.userId = userId;
// }
//
// public String getUserName() {
// return userName;
// }
//
// public void setUserName(String userName) {
// this.userName = userName;
// }
//
// public String getUserPwd() {
// return userPwd;
// }
//
// public void setUserPwd(String userPwd) {
// this.userPwd = userPwd;
// }
//
public boolean isRememberPwd() {
return rememberPwd;
}
public void setRememberPwd(boolean rememberPwd) {
this.rememberPwd = rememberPwd;
}
//
// public String getCompanyId() {
// return companyId;
// }
//
// public void setCompanyId(String companyId) {
// this.companyId = companyId;
// }
//
// public String getCompanyName() {
// return companyName;
// }
//
// public void setCompanyName(String companyName) {
// this.companyName = companyName;
// }
}
| [
"dongyongzhi@foxmail.com"
] | dongyongzhi@foxmail.com |
c152fb63599c1168800bebd8a0d5062cccf44085 | 924329e96e53bff6e47da520bd7f763e7d62e888 | /src/main/java/jb/util/NotificationMesageUtil.java | 68375c9a2854d3b5cb0cdf79c083ac2b6074e322 | [] | no_license | huanganrang/mylove | e86a4c9f010d97749d4e9fe1e62b0de4404c80e3 | 1ababc285989ccf958d0a8a20f2a69a5612654c5 | refs/heads/master | 2021-01-18T21:52:48.978970 | 2016-05-18T01:34:42 | 2016-05-18T01:34:42 | 38,518,289 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package jb.util;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import jb.android.push.NotificationManager;
import org.androidpn.server.xmpp.XmppServer;
import org.androidpn.server.xmpp.session.ClientSession;
import org.androidpn.server.xmpp.session.SessionManager;
public class NotificationMesageUtil {
public static boolean notifMessage(String openId,String message){
try{
NotificationManager notif = (NotificationManager) XmppServer
.getInstance().getBean("notificationManager");
Collection<ClientSession> sessions = SessionManager.getInstance()
.getSessions();
Set<ClientSession> usernames = new HashSet<ClientSession>();
for (ClientSession cs : sessions) {
if(cs.getUsername().equals(openId))
usernames.add(cs);
}
notif.sendNotifcationToSession("1234567890", "test", "title", message,
"uri",
usernames.toArray(new ClientSession[usernames.size()]));
}catch(Exception e){
e.printStackTrace();
return false;
}
return true;
}
}
| [
"huangzhi@huangzhi-PC"
] | huangzhi@huangzhi-PC |
8a6c1704dd8b459b0bb61438bfd54ecffee1fff2 | 6c1ecc38d091d761f7bb5bdf706e1aa330023a70 | /src/main/java/com/neunn/Drone.java | ce528225693e1e669798b3278a1ac824173a37d2 | [] | no_license | dujishuang11/webdemo | f1a9026943a81acb7da5b294b38a17ac8ef5f02a | fb02697c9889ac567d77894e22059dcb75098637 | refs/heads/master | 2020-03-19T06:08:34.423422 | 2018-06-04T08:24:55 | 2018-06-04T08:24:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | java | package com.neunn;/*
* Copyright 2016 Compass Team.
* 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.
*/
public class Drone {
public String getMessage(boolean bigger) {
if (bigger) {
return "Hello Universe!";
} else {
return "Hello World!";
}
}
public static void main(String args[]) {
System.out.println("This is Drone Java Maven Web Demo...");
System.out.println("The first commit...");
}
}
| [
"dujs@neunn.com"
] | dujs@neunn.com |
c3c409b438df2c6a6f29abce169930ea288946b3 | 305a17e73434e8a17e0f07fdf935d65a2f595dd6 | /src/test/java/com/springboot10/son13/Son13ApplicationTests.java | c44130d6091291d1fd784522d4861603a4beb9f0 | [] | no_license | stravisT2/son1-3 | 6216fe330ccd85eaafe2d70ed6750261d9593f7d | 6ecb9efeba464bbbae0a2172bf6c5f12e53e5af9 | refs/heads/master | 2020-03-25T12:54:54.205395 | 2018-08-07T01:07:34 | 2018-08-07T01:07:34 | 143,800,658 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package com.springboot10.son13;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class Son13ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"GBTC440005UR@MC.MONTGOMERYCOLLEGE.EDU"
] | GBTC440005UR@MC.MONTGOMERYCOLLEGE.EDU |
b3143b8f90985d9f050f4d2d9f2cc1044d776bce | 6efb8397571643beff182cb27ce637ba82fa8c61 | /app/src/main/java/com/example/sam/myapplication/WebViewActivity.java | 7cd5fbcbc8af3592380e7c637c06851cd0d99f82 | [] | no_license | DUTIANXU/JDdemo | 29c78f12314fd1242b0760e20a608c026b978f27 | 0df19c674aa7db0db095dc28b536172900f525fb | refs/heads/master | 2020-03-18T13:31:08.723143 | 2018-05-25T01:47:55 | 2018-05-25T01:47:55 | 134,788,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 868 | java | package com.example.sam.myapplication;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class WebViewActivity extends AppCompatActivity {
private WebView mWv;
private String detailUrl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_view);
//接收地址
Intent intent = getIntent();
detailUrl = intent.getStringExtra("detailUrl");
initView();
mWv.loadUrl(detailUrl);
}
private void initView() {
mWv = (WebView) findViewById(R.id.wv);
WebSettings settings = mWv.getSettings();
//支持js
settings.setJavaScriptEnabled(true);
}
}
| [
"3484366809@qq.com"
] | 3484366809@qq.com |
0c81b585b09f0824166d2e6d2149758fc9f92089 | adcb5da090a3042b8cb49f5e122444e227b6eb99 | /src/nl/inholland/endassignment/model/User.java | aaeac58b2711b5b9d557dc9c6635961abf059ff3 | [] | no_license | rigoGit93/Test | b6cb4b0d10b7c3c9e7df20be6cc7bf150cf825cf | 30cddb486f9437be853bf2f5522aeb06f5fa59d4 | refs/heads/main | 2023-02-26T14:09:09.560167 | 2021-01-11T13:45:08 | 2021-01-11T13:45:08 | 304,891,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,436 | java | package nl.inholland.endassignment.model;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
public class User {
public String userName;
public String password;
public String firstName;
public String lastName;
public LocalDate birtDate;
public Role enummer;
public HashMap<String, User> userHashMap = new HashMap<String, User>();
ArrayList<User> list = new ArrayList<User>();
public User(String userName, String password, String firstName, String lastName, LocalDate birtDate, Role enummer) {
this.userName = userName;
this.password = password;
this.firstName = firstName;
this.lastName = lastName;
this.birtDate = birtDate;
this.enummer = enummer;
// HashMap<String, String > userHashMap = new HashMap<String, String>();
// userHashMap.put("Admin", new User("Admin", "Pass",
// "Salman", "tester", LocalDate.now()));
// userHashMap.put("SalesAcc","Passwrd");
}
@Override
public String toString() {
return "User{" +
"userName='" + userName + '\'' +
", password='" + password + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", birtDate=" + birtDate +
// ", userHashMap=" + userHashMap +
'}';
}
}
| [
"544254@student.inholland.nl"
] | 544254@student.inholland.nl |
9a310e899d8058dc03860ff858d2873d341d41cf | a6f412887b4053b3d0b8236a81be1f53f2953353 | /src/main/java/com/evan/jc/finaldemo/FinalStaticData.java | 0741c878355b2844da53315e97f2f4a1d58bfae2 | [] | no_license | yataoXu/juc | c4d851ce5d2cf142c5be7d765b85608211e40012 | 2a36c72dcc3bd388b31b8dd70381b7f29a889f4a | refs/heads/master | 2022-07-19T01:27:51.221954 | 2020-07-05T07:38:32 | 2020-07-05T07:38:32 | 238,196,296 | 0 | 0 | null | 2022-06-21T03:36:25 | 2020-02-04T12:04:46 | Java | UTF-8 | Java | false | false | 1,180 | java | package com.evan.jc.finaldemo;
import java.util.Random;
import static java.lang.System.*;
/**
* @Description
* @ClassName FinalStaticData
* @Author Evan
* @date 2020.07.01 13:31
*/
public class FinalStaticData {
// 实例化一个Random类对象
private static Random rand = new Random();
// 随机产生0~10之间的随机数赋予定义为final的a1
private final int a1 = rand.nextInt(10);
// 随机产生0~10之间的随机数赋予定义为static final的a2
private static final int a2 = rand.nextInt(10);
public static void main(String[] args) {
// 实例化一个对象
FinalStaticData fdata = new FinalStaticData();
// 调用定义为final的a1
out.println("重新实例化对象调用a1的值:" + fdata.a1);
// 调用定义为static final的a2
out.println("重新实例化对象调用a1的值:" + FinalStaticData.a2);
// 实例化另外一个对象
FinalStaticData fdata2 = new FinalStaticData();
out.println("重新实例化对象调用a1的值:" + fdata2.a1);
out.println("重新实例化对象调用a2的值:" + FinalStaticData.a2);
}
}
| [
"xuyt1992@163.com"
] | xuyt1992@163.com |
3216f764b48d74ea1fee5921eb665a5c917cbfde | f74a43fb0f4acb7042180a1d8fece70a0299d837 | /DCRS_WebService/src/server/runServers.java | 5be7157badb1cb0de812cbf4fe4a1aa3ccdd2753 | [] | no_license | iknoor99/Distributed_Course_Registeration_System | 96549178001a6fac0a3116fe91c76d2034c60e97 | 784e888a926f2c1687d84f2bb7949f62887a532c | refs/heads/master | 2020-04-14T02:09:28.129065 | 2018-12-30T10:20:38 | 2018-12-30T10:20:38 | 163,577,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package server;
public class runServers {
public static void main(String args[]) {
ServerComp.startCompserver();
ServerSoen.startSoenserver();
ServerInse.startInseserver();
}
}
| [
"iknoor99@hotmail.com"
] | iknoor99@hotmail.com |
badd8601d7cfd7bd43ab53d5dd92aa91151dc4eb | 46c941adfb27e99778a45b4b230b034db913a765 | /src/main/java/com/tomtop/portal/ctl/MgrCtl.java | b0c058b255fc31242052cbacf232b89f651ad41c | [] | no_license | ouyangyaxiong/springmvc-sitemesh-mybatis | 0f774a1e97a62c1908d93791d21a4394b86d2baa | 6b85c39ec68140de5befcc26f144e9bf84c477f3 | refs/heads/master | 2021-01-10T06:00:53.374021 | 2015-11-13T08:53:58 | 2015-11-13T08:53:58 | 45,895,714 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,703 | java | package com.tomtop.portal.ctl;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.tomtop.portal.biz.IUserBiz;
import com.tomtop.portal.pojo.User;
@Controller
@RequestMapping("/mgr")
public class MgrCtl {
@Resource
private IUserBiz userBiz;
@RequestMapping(method = RequestMethod.GET, value = "/index")
public String mgrIdx(HttpServletRequest req, Model model) {
Integer userId=(Integer)req.getSession().getAttribute("userId");
System.out.println("--------session- userId ---"+userId);
if(null !=userId && userId != 0){
User u=userBiz.getUserById(userId);
model.addAttribute("user", u);
System.out.println("登录了--------------");
return "mgr/index";
}
else{
return "redirect:login";
}
}
@RequestMapping(method = RequestMethod.POST, value = "/login")
public String login(HttpServletRequest req ,HttpSession session,Model model) {
String userName = null;
String db_userName=null;
userName=req.getParameter("userName");
User u=userBiz.getUserByName(userName);
if( u!= null){
db_userName=u.getUserName();
session.setAttribute("userId", u.getId());
}
System.out.println("用户名--------------session---" + db_userName +"------"+session.getAttribute("isLogin"));
return "redirect:index";
}
@RequestMapping(method = RequestMethod.GET, value = "/login")
public String login() {
System.out.println("登录界面");
return "mgr/login/login";
}
}
| [
"ouyangyaxiong@qq.com"
] | ouyangyaxiong@qq.com |
fb13bee223b4e21ed3df7d77f9c6562e608257e5 | 232f2b2569482084395b2320b92e298db9ef7bdf | /src/main/java/org/vertx/java/deploy/impl/VerticleType.java | 6b8bc9eb8278412afa7ab483991d89a1635f9268 | [
"Apache-2.0"
] | permissive | gspandy/vert.x | 9a43f5094a0ee23fba351e88cb5570bdb467fdad | a087329d3fcd6832d7a627f89bb32dd891d467e8 | refs/heads/master | 2023-08-10T03:36:23.313962 | 2012-05-04T17:37:33 | 2012-05-04T17:37:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 823 | java | /*
* Copyright 2011-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.vertx.java.deploy.impl;
import java.io.Serializable;
/**
* @author <a href="http://tfox.org">Tim Fox</a>
*/
public enum VerticleType implements Serializable {
JAVA, RUBY, GROOVY, JS
}
| [
"timvolpe@gmail.com"
] | timvolpe@gmail.com |
7ddc0aeeacb33b8fb22f7688b787fa528e7cd09b | 7a4a29b6caeb04e40350793a5f0a9a17de5b6e40 | /libraries/AndroidTimesSquareLib/library/src/com/squareup/timessquare/CalendarPickerView.java | 99be3dd18181037b4c98057d4ee0cce2ea4292fa | [
"Apache-2.0"
] | permissive | snooplsm/happyschedule | c674ca7594b51b70b353e17fdd51060d2f79f92e | 8d30d6a092af37c456e88c331c8763db8895780e | refs/heads/master | 2021-06-19T14:28:12.912622 | 2017-05-08T13:55:24 | 2017-05-08T13:55:24 | 10,613,789 | 3 | 4 | null | 2014-12-31T18:31:50 | 2013-06-11T02:52:28 | Java | UTF-8 | Java | false | false | 23,971 | java | // Copyright 2012 Square, Inc.
package com.squareup.timessquare;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.squareup.timessquare.MonthCellDescriptor.RangeState;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import static java.util.Calendar.DATE;
import static java.util.Calendar.DAY_OF_MONTH;
import static java.util.Calendar.DAY_OF_WEEK;
import static java.util.Calendar.HOUR_OF_DAY;
import static java.util.Calendar.MILLISECOND;
import static java.util.Calendar.MINUTE;
import static java.util.Calendar.MONTH;
import static java.util.Calendar.SECOND;
import static java.util.Calendar.YEAR;
/**
* Android component to allow picking a date from a calendar view (a list of months). Must be
* initialized after inflation with {@link #init(Date, Date)} and can be customized with any of the
* {@link FluentInitializer} methods returned. The currently selected date can be retrieved with
* {@link #getSelectedDate()}.
*/
public class CalendarPickerView extends ListView {
public enum SelectionMode {
/**
* Only one date will be selectable. If there is already a selected date and you select a new
* one, the old date will be unselected.
*/
SINGLE,
/** Multiple dates will be selectable. Selecting an already-selected date will un-select it. */
MULTIPLE,
/**
* Allows you to select a date range. Previous selections are cleared when you either:
* <ul>
* <li>Have a range selected and select another date (even if it's in the current range).</li>
* <li>Have one date selected and then select an earlier date.</li>
* </ul>
*/
RANGE
}
private final CalendarPickerView.MonthAdapter adapter;
private DateFormat monthNameFormat;
private DateFormat weekdayNameFormat;
private DateFormat fullDateFormat;
SelectionMode selectionMode;
final List<MonthDescriptor> months = new ArrayList<MonthDescriptor>();
final List<MonthCellDescriptor> selectedCells = new ArrayList<MonthCellDescriptor>();
final Calendar today = Calendar.getInstance();
private final List<List<List<MonthCellDescriptor>>> cells =
new ArrayList<List<List<MonthCellDescriptor>>>();
final List<Calendar> selectedCals = new ArrayList<Calendar>();
private final Calendar minCal = Calendar.getInstance();
private final Calendar maxCal = Calendar.getInstance();
private final Calendar monthCounter = Calendar.getInstance();
private final MonthView.Listener listener = new CellClickedListener();
private OnDateSelectedListener dateListener;
private DateSelectableFilter dateConfiguredListener;
private OnInvalidDateSelectedListener invalidDateListener =
new DefaultOnInvalidDateSelectedListener();
public CalendarPickerView(Context context, AttributeSet attrs) {
super(context, attrs);
adapter = new MonthAdapter();
setDivider(null);
setDividerHeight(0);
final int bg = getResources().getColor(R.color.calendar_bg);
setBackgroundColor(bg);
setCacheColorHint(bg);
monthNameFormat = new SimpleDateFormat(context.getString(R.string.month_name_format));
weekdayNameFormat = new SimpleDateFormat(context.getString(R.string.day_name_format));
fullDateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
if (isInEditMode()) {
Calendar nextYear = Calendar.getInstance();
nextYear.add(Calendar.YEAR, 1);
init(new Date(), nextYear.getTime()) //
.withSelectedDate(new Date());
}
}
/**
* Both date parameters must be non-null and their {@link Date#getTime()} must not return 0. Time
* of day will be ignored. For instance, if you pass in {@code minDate} as 11/16/2012 5:15pm and
* {@code maxDate} as 11/16/2013 4:30am, 11/16/2012 will be the first selectable date and
* 11/15/2013 will be the last selectable date ({@code maxDate} is exclusive).
* <p>
* This will implicitly set the {@link SelectionMode} to {@link SelectionMode#SINGLE}. If you
* want a different selection mode, use {@link FluentInitializer#inMode(SelectionMode)} on the
* {@link FluentInitializer} this method returns.
*
* @param minDate Earliest selectable date, inclusive. Must be earlier than {@code maxDate}.
* @param maxDate Latest selectable date, exclusive. Must be later than {@code minDate}.
*/
public FluentInitializer init(Date minDate, Date maxDate) {
if (minDate == null || maxDate == null) {
throw new IllegalArgumentException(
"minDate and maxDate must be non-null. " + dbg(minDate, maxDate));
}
if (minDate.after(maxDate)) {
throw new IllegalArgumentException(
"minDate must be before maxDate. " + dbg(minDate, maxDate));
}
if (minDate.getTime() == 0 || maxDate.getTime() == 0) {
throw new IllegalArgumentException(
"minDate and maxDate must be non-zero. " + dbg(minDate, maxDate));
}
this.selectionMode = SelectionMode.SINGLE;
// Clear out any previously-selected dates/cells.
selectedCals.clear();
selectedCells.clear();
// Clear previous state.
cells.clear();
months.clear();
minCal.setTime(minDate);
maxCal.setTime(maxDate);
setMidnight(minCal);
setMidnight(maxCal);
// maxDate is exclusive: bump back to the previous day so if maxDate is the first of a month,
// we don't accidentally include that month in the view.
maxCal.add(MINUTE, -1);
// Now iterate between minCal and maxCal and build up our list of months to show.
monthCounter.setTime(minCal.getTime());
final int maxMonth = maxCal.get(MONTH);
final int maxYear = maxCal.get(YEAR);
while ((monthCounter.get(MONTH) <= maxMonth // Up to, including the month.
|| monthCounter.get(YEAR) < maxYear) // Up to the year.
&& monthCounter.get(YEAR) < maxYear + 1) { // But not > next yr.
Date date = monthCounter.getTime();
MonthDescriptor month =
new MonthDescriptor(monthCounter.get(MONTH), monthCounter.get(YEAR), date,
monthNameFormat.format(date));
cells.add(getMonthCells(month, monthCounter));
Logr.d("Adding month %s", month);
months.add(month);
monthCounter.add(MONTH, 1);
}
validateAndUpdate();
return new FluentInitializer();
}
public class FluentInitializer {
/** Override the {@link SelectionMode} from the default ({@link SelectionMode#SINGLE}). */
public FluentInitializer inMode(SelectionMode mode) {
selectionMode = mode;
validateAndUpdate();
return this;
}
/**
* Set an initially-selected date. The calendar will scroll to that date if it's not already
* visible.
*/
public FluentInitializer withSelectedDate(Date selectedDates) {
return withSelectedDates(Arrays.asList(selectedDates));
}
/**
* Set multiple selected dates. This will throw an {@link IllegalArgumentException} if you
* pass in multiple dates and haven't already called {@link #inMode(SelectionMode)}.
*/
public FluentInitializer withSelectedDates(Collection<Date> selectedDates) {
if (selectionMode == SelectionMode.SINGLE && selectedDates.size() > 1) {
throw new IllegalArgumentException("SINGLE mode can't be used with multiple selectedDates");
}
if (selectedDates != null) {
for (Date date : selectedDates) {
selectDate(date);
}
}
Integer selectedIndex = null;
Integer todayIndex = null;
Calendar today = Calendar.getInstance();
for (int c = 0; c < months.size(); c++) {
MonthDescriptor month = months.get(c);
if (selectedIndex == null) {
for (Calendar selectedCal : selectedCals) {
if (sameMonth(selectedCal, month)) {
selectedIndex = c;
break;
}
}
if (selectedIndex == null && todayIndex == null && sameMonth(today, month)) {
todayIndex = c;
}
}
}
if (selectedIndex != null) {
scrollToSelectedMonth(selectedIndex);
} else if (todayIndex != null) {
scrollToSelectedMonth(todayIndex);
}
validateAndUpdate();
return this;
}
/** Override default locale: specify a locale in which the calendar should be rendered. */
public FluentInitializer withLocale(Locale locale) {
monthNameFormat =
new SimpleDateFormat(getContext().getString(R.string.month_name_format), locale);
for (MonthDescriptor month : months) {
month.setLabel(monthNameFormat.format(month.getDate()));
}
weekdayNameFormat =
new SimpleDateFormat(getContext().getString(R.string.day_name_format), locale);
fullDateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
validateAndUpdate();
return this;
}
}
private void validateAndUpdate() {
if (getAdapter() == null) {
setAdapter(adapter);
}
adapter.notifyDataSetChanged();
}
private void scrollToSelectedMonth(final int selectedIndex) {
post(new Runnable() {
@Override
public void run() {
smoothScrollToPosition(selectedIndex);
}
});
}
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (months.isEmpty()) {
throw new IllegalStateException(
"Must have at least one month to display. Did you forget to call init()?");
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
public Date getSelectedDate() {
return (selectedCals.size() > 0 ? selectedCals.get(0).getTime() : null);
}
public List<Date> getSelectedDates() {
List<Date> selectedDates = new ArrayList<Date>();
for (MonthCellDescriptor cal : selectedCells) {
selectedDates.add(cal.getDate());
}
Collections.sort(selectedDates);
return selectedDates;
}
/** Returns a string summarizing what the client sent us for init() params. */
private static String dbg(Date minDate, Date maxDate) {
return "minDate: " + minDate + "\nmaxDate: " + maxDate;
}
/** Clears out the hours/minutes/seconds/millis of a Calendar. */
static void setMidnight(Calendar cal) {
cal.set(HOUR_OF_DAY, 0);
cal.set(MINUTE, 0);
cal.set(SECOND, 0);
cal.set(MILLISECOND, 0);
}
private class CellClickedListener implements MonthView.Listener {
@Override public void handleClick(MonthCellDescriptor cell) {
Date clickedDate = cell.getDate();
if (!betweenDates(clickedDate, minCal, maxCal) || !isDateSelectable(clickedDate)) {
if (invalidDateListener != null) {
invalidDateListener.onInvalidDateSelected(clickedDate);
}
} else {
boolean wasSelected = doSelectDate(clickedDate, cell);
if (wasSelected && dateListener != null) {
dateListener.onDateSelected(clickedDate);
}
}
}
}
/**
* Select a new date. Respects the {@link SelectionMode} this CalendarPickerView is configured
* with: if you are in {@link SelectionMode#SINGLE}, the previously selected date will be
* un-selected. In {@link SelectionMode#MULTIPLE}, the new date will be added to the list of
* selected dates.
* <p>
* If the selection was made (selectable date, in range), the view will scroll to the newly
* selected date if it's not already visible.
*
* @return - whether we were able to set the date
*/
public boolean selectDate(Date date) {
if (date == null) {
throw new IllegalArgumentException("Selected date must be non-null. " + date);
}
if (date.getTime() == 0) {
throw new IllegalArgumentException("Selected date must be non-zero. " + date);
}
if (date.before(minCal.getTime()) || date.after(maxCal.getTime())) {
throw new IllegalArgumentException(
"selectedDate must be between minDate and maxDate. " + date);
}
MonthCellWithMonthIndex monthCellWithMonthIndex = getMonthCellWithIndexByDate(date);
if (monthCellWithMonthIndex == null || !isDateSelectable(date)) {
return false;
}
boolean wasSelected = doSelectDate(date, monthCellWithMonthIndex.cell);
if (wasSelected) {
scrollToSelectedMonth(monthCellWithMonthIndex.monthIndex);
}
return wasSelected;
}
private boolean doSelectDate(Date date, MonthCellDescriptor cell) {
Calendar newlySelectedCal = Calendar.getInstance();
newlySelectedCal.setTime(date);
// Sanitize input: clear out the hours/minutes/seconds/millis.
setMidnight(newlySelectedCal);
// Clear any remaining range state.
for (MonthCellDescriptor selectedCell : selectedCells) {
selectedCell.setRangeState(RangeState.NONE);
}
switch (selectionMode) {
case RANGE:
if (selectedCals.size() > 1) {
// We've already got a range selected: clear the old one.
clearOldSelections();
} else if (selectedCals.size() == 1 && newlySelectedCal.before(selectedCals.get(0))) {
// We're moving the start of the range back in time: clear the old start date.
clearOldSelections();
}
break;
case MULTIPLE:
date = applyMultiSelect(date, newlySelectedCal);
break;
case SINGLE:
clearOldSelections();
break;
default:
throw new IllegalStateException("Unknown selectionMode " + selectionMode);
}
if (date != null) {
// Select a new cell.
if (selectedCells.size() == 0 || !selectedCells.get(0).equals(cell)) {
selectedCells.add(cell);
cell.setSelected(true);
}
selectedCals.add(newlySelectedCal);
if (selectionMode == SelectionMode.RANGE && selectedCells.size() > 1) {
// Select all days in between start and end.
Date start = selectedCells.get(0).getDate();
Date end = selectedCells.get(1).getDate();
selectedCells.get(0).setRangeState(MonthCellDescriptor.RangeState.FIRST);
selectedCells.get(1).setRangeState(MonthCellDescriptor.RangeState.LAST);
for (List<List<MonthCellDescriptor>> month : cells) {
for (List<MonthCellDescriptor> week : month) {
for (MonthCellDescriptor singleCell : week) {
if (singleCell.getDate().after(start)
&& singleCell.getDate().before(end)
&& singleCell.isSelectable()) {
singleCell.setSelected(true);
singleCell.setRangeState(MonthCellDescriptor.RangeState.MIDDLE);
selectedCells.add(singleCell);
}
}
}
}
}
}
// Update the adapter.
validateAndUpdate();
return date != null;
}
private void clearOldSelections() {
for (MonthCellDescriptor selectedCell : selectedCells) {
// De-select the currently-selected cell.
selectedCell.setSelected(false);
}
selectedCells.clear();
selectedCals.clear();
}
private Date applyMultiSelect(Date date, Calendar selectedCal) {
for (MonthCellDescriptor selectedCell : selectedCells) {
if (selectedCell.getDate().equals(date)) {
// De-select the currently-selected cell.
selectedCell.setSelected(false);
selectedCells.remove(selectedCell);
date = null;
break;
}
}
for (Calendar cal : selectedCals) {
if (sameDate(cal, selectedCal)) {
selectedCals.remove(cal);
break;
}
}
return date;
}
/** Hold a cell with a month-index. */
private static class MonthCellWithMonthIndex {
public MonthCellDescriptor cell;
public int monthIndex;
public MonthCellWithMonthIndex(MonthCellDescriptor cell, int monthIndex) {
this.cell = cell;
this.monthIndex = monthIndex;
}
}
/** Return cell and month-index (for scrolling) for a given Date. */
private MonthCellWithMonthIndex getMonthCellWithIndexByDate(Date date) {
int index = 0;
Calendar searchCal = Calendar.getInstance();
searchCal.setTime(date);
Calendar actCal = Calendar.getInstance();
for (List<List<MonthCellDescriptor>> monthCells : cells) {
for (List<MonthCellDescriptor> weekCells : monthCells) {
for (MonthCellDescriptor actCell : weekCells) {
actCal.setTime(actCell.getDate());
if (sameDate(actCal, searchCal) && actCell.isSelectable()) {
return new MonthCellWithMonthIndex(actCell, index);
}
}
}
index++;
}
return null;
}
private class MonthAdapter extends BaseAdapter {
private final LayoutInflater inflater;
private MonthAdapter() {
inflater = LayoutInflater.from(getContext());
}
@Override public boolean isEnabled(int position) {
// Disable selectability: each cell will handle that itself.
return false;
}
@Override public int getCount() {
return months.size();
}
@Override public Object getItem(int position) {
return months.get(position);
}
@Override public long getItemId(int position) {
return position;
}
@Override public View getView(int position, View convertView, ViewGroup parent) {
MonthView monthView = (MonthView) convertView;
if (monthView == null) {
monthView = MonthView.create(parent, inflater, weekdayNameFormat, listener, today);
}
monthView.init(months.get(position), cells.get(position));
return monthView;
}
}
List<List<MonthCellDescriptor>> getMonthCells(MonthDescriptor month, Calendar startCal) {
Calendar cal = Calendar.getInstance();
cal.setTime(startCal.getTime());
List<List<MonthCellDescriptor>> cells = new ArrayList<List<MonthCellDescriptor>>();
cal.set(DAY_OF_MONTH, 1);
int firstDayOfWeek = cal.get(DAY_OF_WEEK);
int offset = cal.getFirstDayOfWeek() - firstDayOfWeek;
if (offset > 0) {
offset -= 7;
}
cal.add(Calendar.DATE, offset);
Calendar minSelectedCal = minDate(selectedCals);
Calendar maxSelectedCal = maxDate(selectedCals);
while ((cal.get(MONTH) < month.getMonth() + 1 || cal.get(YEAR) < month.getYear()) //
&& cal.get(YEAR) <= month.getYear()) {
Logr.d("Building week row starting at %s", cal.getTime());
List<MonthCellDescriptor> weekCells = new ArrayList<MonthCellDescriptor>();
cells.add(weekCells);
for (int c = 0; c < 7; c++) {
Date date = cal.getTime();
boolean isCurrentMonth = cal.get(MONTH) == month.getMonth();
boolean isSelected = isCurrentMonth && containsDate(selectedCals, cal);
boolean isSelectable =
isCurrentMonth && betweenDates(cal, minCal, maxCal) && isDateSelectable(date);
boolean isToday = sameDate(cal, today);
int value = cal.get(DAY_OF_MONTH);
MonthCellDescriptor.RangeState rangeState = MonthCellDescriptor.RangeState.NONE;
if (selectedCals != null && selectedCals.size() > 1) {
if (sameDate(minSelectedCal, cal)) {
rangeState = MonthCellDescriptor.RangeState.FIRST;
} else if (sameDate(maxDate(selectedCals), cal)) {
rangeState = MonthCellDescriptor.RangeState.LAST;
} else if (betweenDates(cal, minSelectedCal, maxSelectedCal)) {
rangeState = MonthCellDescriptor.RangeState.MIDDLE;
}
}
weekCells.add(
new MonthCellDescriptor(date, isCurrentMonth, isSelectable, isSelected, isToday, value,
rangeState));
cal.add(DATE, 1);
}
}
return cells;
}
private static boolean containsDate(List<Calendar> selectedCals, Calendar cal) {
for (Calendar selectedCal : selectedCals) {
if (sameDate(cal, selectedCal)) {
return true;
}
}
return false;
}
private static Calendar minDate(List<Calendar> selectedCals) {
if (selectedCals == null || selectedCals.size() == 0) {
return null;
}
Collections.sort(selectedCals);
return selectedCals.get(0);
}
private static Calendar maxDate(List<Calendar> selectedCals) {
if (selectedCals == null || selectedCals.size() == 0) {
return null;
}
Collections.sort(selectedCals);
return selectedCals.get(selectedCals.size() - 1);
}
private static boolean sameDate(Calendar cal, Calendar selectedDate) {
return cal.get(MONTH) == selectedDate.get(MONTH)
&& cal.get(YEAR) == selectedDate.get(YEAR)
&& cal.get(DAY_OF_MONTH) == selectedDate.get(DAY_OF_MONTH);
}
private static boolean betweenDates(Calendar cal, Calendar minCal, Calendar maxCal) {
final Date date = cal.getTime();
return betweenDates(date, minCal, maxCal);
}
static boolean betweenDates(Date date, Calendar minCal, Calendar maxCal) {
final Date min = minCal.getTime();
return (date.equals(min) || date.after(min)) // >= minCal
&& date.before(maxCal.getTime()); // && < maxCal
}
private static boolean sameMonth(Calendar cal, MonthDescriptor month) {
return (cal.get(MONTH) == month.getMonth() && cal.get(YEAR) == month.getYear());
}
private boolean isDateSelectable(Date date) {
if (dateConfiguredListener == null) {
return true;
}
return dateConfiguredListener.isDateSelectable(date);
}
public void setOnDateSelectedListener(OnDateSelectedListener listener) {
dateListener = listener;
}
/**
* Set a listener to react to user selection of a disabled date.
*
* @param listener the listener to set, or null for no reaction
*/
public void setOnInvalidDateSelectedListener(OnInvalidDateSelectedListener listener) {
invalidDateListener = listener;
}
/**
* Set a listener used to discriminate between selectable and unselectable dates. Set this to
* disable arbitrary dates as they are rendered.
* <p>
* Important: set this before you call {@link #init(Date, Date)} methods. If called afterwards,
* it will not be consistently applied.
*/
public void setDateSelectableFilter(DateSelectableFilter listener) {
dateConfiguredListener = listener;
}
/**
* Interface to be notified when a new date is selected. This will only be called when the user
* initiates the date selection. If you call {@link #selectDate(Date)} this listener will not be
* notified.
*
* @see #setOnDateSelectedListener(OnDateSelectedListener)
*/
public interface OnDateSelectedListener {
void onDateSelected(Date date);
}
/**
* Interface to be notified when an invalid date is selected by the user. This will only be
* called when the user initiates the date selection. If you call {@link #selectDate(Date)} this
* listener will not be notified.
*
* @see #setOnInvalidDateSelectedListener(OnInvalidDateSelectedListener)
*/
public interface OnInvalidDateSelectedListener {
void onInvalidDateSelected(Date date);
}
/**
* Interface used for determining the selectability of a date cell when it is configured for
* display on the calendar.
*
* @see #setDateSelectableFilter(DateSelectableFilter)
*/
public interface DateSelectableFilter {
boolean isDateSelectable(Date date);
}
private class DefaultOnInvalidDateSelectedListener implements OnInvalidDateSelectedListener {
@Override public void onInvalidDateSelected(Date date) {
String errMessage =
getResources().getString(R.string.invalid_date, fullDateFormat.format(minCal.getTime()),
fullDateFormat.format(maxCal.getTime()));
Toast.makeText(getContext(), errMessage, Toast.LENGTH_SHORT).show();
}
}
}
| [
"ryangravener@gmail.com"
] | ryangravener@gmail.com |
a4190697fb56cc11122871882272f5dfd1029dfc | 3d7e654b49d1f67074b0fb784b7a141c4da33b55 | /app/src/main/java/com/vigorchip/lerunning/Image_Advertising.java | a9ebceafe8cf6e75f5d63b476509234e2d0de659 | [] | no_license | isKotLin/LeRunning_Pay | 4b01b79dfe6225df4833e3663ffcb22f5fd823d3 | a0098b64a38cc213a3bed2256edaca740ba5bf25 | refs/heads/master | 2020-03-23T23:33:48.896350 | 2018-07-25T03:23:53 | 2018-07-25T03:23:53 | 142,241,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,617 | java | package com.vigorchip.lerunning;
import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.ImageView;
/**
* Created by wr-app1 on 2017/12/19.
*/
public class Image_Advertising extends ImageView {
private int[] images;
private int index;
private MyTask task;
private boolean isCircle;
private static final long AUTO_SWITCH_TIME = 1500;
public Image_Advertising(Context context) {
super(context, null);
}
public Image_Advertising(Context context, AttributeSet attrs) {
super(context, attrs, 0);
}
public Image_Advertising(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public class MyTask implements Runnable {
@Override
public void run() {
if (index == images.length - 1 && !isCircle) {
removeCallbacks(this);
return;
}
switchWithAnim(this);
}
public void start() {
postDelayed(this, AUTO_SWITCH_TIME);
}
}
/**
* 执行动画实现图片的切换
* @param task
*/
private void switchWithAnim(final MyTask task) {
AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
alphaAnimation.setFillAfter(true);
alphaAnimation.setDuration(830);
startAnimation(alphaAnimation);
alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (index == images.length - 1 && isCircle) {
index = -1;
}
setImageResource(images[++index]);
AlphaAnimation anim = new AlphaAnimation(0, 1);
anim.setDuration(830);
anim.setFillAfter(true);
startAnimation(anim);
anim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
postDelayed(task, AUTO_SWITCH_TIME);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
/**
* 设置图片数据
* @param images
* @return
*/
public Image_Advertising setImages(int[] images) {
this.images = images;
if (images != null && images.length > 0) {
setImageResource(images[index]);
}
return this;
}
/**
* 启动线程,执行任务
*/
public void startTask() {
if (images == null || images.length == 0) {
return;
}
if (task != null) {
removeCallbacks(task);
task = null;
}
task = new MyTask();
task.start();
}
/**
* 设置是否循环切换图片
* @param isCircle
* @return
*/
public Image_Advertising setIsCircle(boolean isCircle) {
this.isCircle = isCircle;
return this;
}
} | [
"kot.lin@outlook.com"
] | kot.lin@outlook.com |
9ef7a25cf81f91dbeffd758117f414b9eb6c9571 | 1612e1a6a716637160e4ee038b9120f02b1b6e45 | /src/it/swb/bean/LogBean.java | ab0471f04d326b57fa5ad4dd9379b98fe0f71a55 | [] | no_license | woakes070048/zeus | 5fb78400c575b65959f01b93e13bdd3e1ea6da0b | 99b120bb8c23a08c069461ccb9bf1f09606f7d48 | refs/heads/master | 2021-01-22T00:54:49.794559 | 2016-04-09T14:43:51 | 2016-04-09T14:43:51 | 56,200,544 | 1 | 1 | null | 2016-04-14T02:17:41 | 2016-04-14T02:17:41 | null | UTF-8 | Java | false | false | 1,335 | java | package it.swb.bean;
import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import it.swb.business.LogBusiness;
import it.swb.model.LogArticolo;
@ManagedBean(name = "logBean")
@ViewScoped
public class LogBean implements Serializable {
private static final long serialVersionUID = 1L;
private List<LogArticolo> logArticoli;
private List<LogArticolo> logArticoliFiltrati;
private LogArticolo logArticoloSelezionato;
public List<LogArticolo> getLogArticoli() {
if (logArticoli==null)
logArticoli = LogBusiness.getInstance().getLogArticoli();
return logArticoli;
}
public void reloadLogArticoli() {
logArticoli = LogBusiness.getInstance().reloadLogArticoli();
}
public void setLogArticoli(List<LogArticolo> logArticoli) {
this.logArticoli = logArticoli;
}
public List<LogArticolo> getLogArticoliFiltrati() {
return logArticoliFiltrati;
}
public void setLogArticoliFiltrati(List<LogArticolo> logArticoliFiltrati) {
this.logArticoliFiltrati = logArticoliFiltrati;
}
public LogArticolo getLogArticoloSelezionato() {
return logArticoloSelezionato;
}
public void setLogArticoloSelezionato(LogArticolo logArticoloSelezionato) {
this.logArticoloSelezionato = logArticoloSelezionato;
}
}
| [
"ilponderato@gmail.com"
] | ilponderato@gmail.com |
c1858475c3156c56c42a34ed9170451734b77627 | bdaf286c523dc4593c922b2a6d7e709c07da0ab3 | /JavaProgramming/src/hw/MemberServiceExample.java | 18ede6f4a264b18b1132b09916f02129e4f9c315 | [] | no_license | cisnice/MyRepository | 5ed109cf576826c32db2ff658dc691eb5f440122 | 31d5a7b1c2956ff9efa4f98f5f8b31d1c3fcbc52 | refs/heads/master | 2020-09-09T15:19:29.541791 | 2016-11-18T07:37:42 | 2016-11-18T07:37:42 | 66,318,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package hw;
public class MemberServiceExample {
public static void main(String[] args) {
MemberService memberService = new MemberService();
boolean result = memberService.login("hong", "12345");
if (result) {
System.out.println("로그인 되었습니다.");
memberService.logout("hong");
} else {
System.out.println("id 또는 password가 올바르지 않습니다.");
}
}
}
| [
"Administrator@COM-PC"
] | Administrator@COM-PC |
fe660efc00c457ea7e5e0db8d436102953099e99 | b4867b96fd7a4d03693099f6610d35cb12b07db0 | /Engine/src/engine/MagitObject.java | 74fce08498dabfbbce6163dd034733610308834c | [] | no_license | shirayadshalom/MagitDesktop | b6375d3b41cc42a0b86698f3c16929a67aa2e6e0 | 2f777e6ac9cbebec8afa4491cd613fc6a5c5aad3 | refs/heads/master | 2020-09-11T16:09:26.555721 | 2019-11-16T15:44:43 | 2019-11-16T15:44:43 | 222,120,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,970 | java | package engine;
import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils;
import javafx.scene.control.TreeItem;
import org.apache.commons.io.FileUtils;
import java.io.*;
import java.util.List;
import java.util.Map;
import static engine.Utils.*;
//itamar made public
public abstract class MagitObject implements Serializable{
protected String name;
protected String SHA1;
private String modifiedBy;
private String modifiedDate;
private Class type;
protected String path;
MagitObject(String modifiedBy, String name,Class type, String path){
this.modifiedBy = modifiedBy;
this.name = name;
this.type = type;
SHA1 = null;
this.path = path.toLowerCase();
}
public Class getType(){return this.type;}
public void setModifiedDate(String date) {modifiedDate = date;}
public void setModifiedBy(String username){modifiedBy = username;}
public String toStringStatus(){
return "• Type (Folder or Blob): "+type.getSimpleName()+"\n"+"• Name: "+name+"\n"+"• Who made the last change: "+modifiedBy+
"\n"+"• When was the last update: "+modifiedDate+"\n"+"-----------------------------"+"\n";
}
public String toString(){
return name;
}
public String toStringSpecified(){
return "• Name (full path): "+path+ "\n"+"• Type (Folder or Blob): "+type.getSimpleName()+ "\n"+"• SHA-1: "
+SHA1+"\n"+"• Who made the last change: "+modifiedBy+"\n"+"• When was the last update: "+modifiedDate+"\n"
+"-----------------------------"+"\n";
}
abstract public Boolean isExists(MagitObject obj);
abstract public Boolean containsKey(String sha1);
abstract public void addList(List<String> lst);
abstract public void deploy(String repoPath) throws IOException;
abstract public void delete() throws IOException;
abstract public void buildTree (TreeItem<MagitObject> parent);
abstract public void updatePath (String srcRepoPath, String destRepoPath);
abstract public void merge (Map<Integer, List<String>> headLists, Map<Integer, List<String>> mergeLists, Map<String,Map<Integer,Blob>> conflicts, int flag) throws IOException;
public int state (Map<Integer, List<String>> headLists, Map<Integer, List<String>> mergeLists) {
int res = 0;
int x = 1;
if (mergeLists.get(DELETED).contains(path))
res = res | x;
x = x*2;
if (mergeLists.get(CREATED).contains(path))
res = res | x;
x = x*2;
if (mergeLists.get(CHANGED).contains(path))
res = res | x;
x = x*2;
if (headLists.get(DELETED).contains(path))
res = res | x;
x = x*2;
if (headLists.get(CREATED).contains(path))
res = res | x;
x = x*2;
if (headLists.get(CHANGED).contains(path))
res = res | x;
return res;
}
}
| [
"55780023+shirayadshalom@users.noreply.github.com"
] | 55780023+shirayadshalom@users.noreply.github.com |
f7859e97d413cbb4ead199ebfd13f42fd362b040 | ae4d22500632101f7ffba00bd13b16953a71a0a2 | /src/main/java/factory/ServiceFactory.java | b1e0ba43c0ad0dae36c565a47e0cd81ab5080b4a | [] | no_license | Shalukhin/Task01 | 79945feecb4bc29a6f0d67e6b42c2dd99076047c | ecad475a345cd7fba5f77f49bfc2881c434d7548 | refs/heads/master | 2021-12-29T19:35:19.336505 | 2020-02-07T20:07:29 | 2020-02-07T20:07:29 | 238,261,074 | 0 | 0 | null | 2021-12-14T21:40:17 | 2020-02-04T17:12:38 | Java | UTF-8 | Java | false | false | 547 | java | package factory;
import service.TravelAgencyService;
import service.TravelAgencyServiceImpl;
public class ServiceFactory {
private static ServiceFactory instance = new ServiceFactory();
private ServiceFactory() {};
public static ServiceFactory getInstance() {
return instance;
}
private TravelAgencyService travelAgencyService;
public TravelAgencyService getTravelAgencyService() {
if (travelAgencyService == null) {
travelAgencyService =TravelAgencyServiceImpl.getInstance();
}
return travelAgencyService;
}
}
| [
"mobil5662016@gmail.com"
] | mobil5662016@gmail.com |
d2bc2dfebead7abfd30d19147bd16237ea245a41 | 3ad9f400552aa43e6909619585a8a6c6e4f7312d | /src/main/java/com/brenoricco/cursomc/DemoApplication.java | 11485f633fd6670f3a599ba21bdebea8da5366dd | [] | no_license | brenoricco/curso-modelagem-conceitual | b394270765712f007c3e354f4ac3cb3755ece11d | b31035a816d32a1d8f7f40a218900f85857439c1 | refs/heads/master | 2022-11-07T02:08:41.184446 | 2020-06-24T16:42:32 | 2020-06-24T16:42:32 | 272,266,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,504 | java | package com.brenoricco.cursomc;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import com.brenoricco.cursomc.domains.Categoria;
import com.brenoricco.cursomc.domains.Cidade;
import com.brenoricco.cursomc.domains.Cliente;
import com.brenoricco.cursomc.domains.Endereco;
import com.brenoricco.cursomc.domains.Estado;
import com.brenoricco.cursomc.domains.ItemPedido;
import com.brenoricco.cursomc.domains.Pagamento;
import com.brenoricco.cursomc.domains.PagamentoComBoleto;
import com.brenoricco.cursomc.domains.PagamentoComCartao;
import com.brenoricco.cursomc.domains.Pedido;
import com.brenoricco.cursomc.domains.Produto;
import com.brenoricco.cursomc.domains.enums.EstadoPagamento;
import com.brenoricco.cursomc.domains.enums.TipoCliente;
import com.brenoricco.cursomc.repositories.CategoriaRepository;
import com.brenoricco.cursomc.repositories.CidadeRepository;
import com.brenoricco.cursomc.repositories.ClienteRepository;
import com.brenoricco.cursomc.repositories.EnderecoRepository;
import com.brenoricco.cursomc.repositories.EstadoRepository;
import com.brenoricco.cursomc.repositories.ItemPedidoRepository;
import com.brenoricco.cursomc.repositories.PagamentoRepository;
import com.brenoricco.cursomc.repositories.PedidoRepository;
import com.brenoricco.cursomc.repositories.ProdutoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication implements CommandLineRunner {
@Autowired
private CategoriaRepository categoriaRepository;
@Autowired
private ProdutoRepository produtoRepository;
@Autowired
private EstadoRepository estadoRepository;
@Autowired
private CidadeRepository cidadeRepository;
@Autowired
private ClienteRepository clienteRepository;
@Autowired
private EnderecoRepository enderecoRepository;
@Autowired
private PedidoRepository pedidoRepository;
@Autowired
private PagamentoRepository pagamentoRepository;
@Autowired
private ItemPedidoRepository itemPedidoRepository;
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
Categoria cat1 = new Categoria(null, "Informática");
Categoria cat2 = new Categoria(null, "Escritório");
Produto p1 = new Produto(null, "Computador", 2000.00);
Produto p2 = new Produto(null, "Impressora", 800.00);
Produto p3 = new Produto(null, "Mouse", 80.00);
cat1.getProdutos().addAll(Arrays.asList(p1, p2, p3));
cat2.getProdutos().addAll(Arrays.asList(p2));
p1.getCategorias().addAll(Arrays.asList(cat1));
p2.getCategorias().addAll(Arrays.asList(cat1, cat2));
p3.getCategorias().addAll(Arrays.asList(cat1));
categoriaRepository.saveAll(Arrays.asList(cat1, cat2));
produtoRepository.saveAll(Arrays.asList(p1, p2, p3));
Estado est1 = new Estado(null, "Minas Gerais");
Estado est2 = new Estado(null, "São Paulo");
Cidade c1 = new Cidade(null, "Uberlândia", est1);
Cidade c2 = new Cidade(null, "São Paulo", est2);
Cidade c3 = new Cidade(null, "Campinas", est2);
est1.getCidades().add(c1);
est2.getCidades().addAll(Arrays.asList(c2, c3));
estadoRepository.saveAll(Arrays.asList(est1, est2));
cidadeRepository.saveAll(Arrays.asList(c1, c2, c3));
Cliente cli1 = new Cliente(null, "Maria Silva", "maria@gmail.com", "36378912377", TipoCliente.PESSOAFISICA);
cli1.getTelefones().addAll(Arrays.asList("27363323", "93838393"));
Endereco e1 = new Endereco(null, "Rua flores", "300", "Apto 203", "Jardim", "38220834", cli1, c1);
Endereco e2 = new Endereco(null, "Av Mattos", "105", "Sala 800", "Centro", "38777012", cli1, c2);
cli1.getEnderecos().addAll(Arrays.asList(e1, e2));
clienteRepository.saveAll(Arrays.asList(cli1));
enderecoRepository.saveAll(Arrays.asList(e1, e2));
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
Pedido ped1 = new Pedido(null, sdf.parse("30/09/2019 10:32"), cli1, e1);
Pedido ped2 = new Pedido(null, sdf.parse("10/10/2019 19:35"), cli1, e2);
Pagamento pagto1 = new PagamentoComCartao(null, EstadoPagamento.QUITADO, ped1, 6);
ped1.setPagamento(pagto1);
Pagamento pagto2 = new PagamentoComBoleto(null, EstadoPagamento.PENDENTE, ped2, sdf.parse("20/10/2019 00:00"),
null);
ped2.setPagamento(pagto2);
cli1.getPedidos().addAll(Arrays.asList(ped1, ped2));
pedidoRepository.saveAll(Arrays.asList(ped1, ped2));
pagamentoRepository.saveAll(Arrays.asList(pagto1, pagto2));
ItemPedido ip1 = new ItemPedido(ped1, p1, 0.00, 1, 2000.00);
ItemPedido ip2 = new ItemPedido(ped1, p3, 0.00, 2, 80.00);
ItemPedido ip3 = new ItemPedido(ped2, p2, 100.00, 1, 800.00);
ped1.getItens().addAll(Arrays.asList(ip1, ip2));
ped2.getItens().addAll(Arrays.asList(ip3));
p1.getItens().addAll(Arrays.asList(ip1));
p2.getItens().addAll(Arrays.asList(ip3));
p3.getItens().addAll(Arrays.asList(ip2));
itemPedidoRepository.saveAll(Arrays.asList(ip1, ip2, ip3));
}
}
| [
"brenoriccodev@gmail.com"
] | brenoriccodev@gmail.com |
4ebb5351f7e021e38a114a0247ff1efb7d10ae15 | 5af111df89b635896cfce2d40d325dfd759689a4 | /MaxProfitSolution.java | ef97e143767807cd99db011145f73ef7ba1d7bfb | [
"Apache-2.0"
] | permissive | jerryxcxiong/algorithmics | a56ecc07333c784007f58c74ac6cc37c66d76ef5 | cde47f0796eaa550cae9ebdfedf7cbe0a471da24 | refs/heads/master | 2021-04-05T23:58:58.856952 | 2016-07-07T09:53:12 | 2016-07-07T09:53:12 | 62,794,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,816 | 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 solution;
import java.io.*;
import java.util.*;
public class MaxProfitSolution {
public static void main(String[] args) {
MaxProfitSolution solution = new MaxProfitSolution();
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner scanner = new Scanner(System.in);
int patronNumber = scanner.nextInt();
if (patronNumber<1 || patronNumber>5000) {
System.out.println("Constraints broken: input for passengers is not valid!");
System.exit(1);
}
int gramAmount = scanner.nextInt();
if (gramAmount<1 || patronNumber>1000000) {
System.out.println("Constraints broken: input for amount of gold is not valid!");
System.exit(1);
}
//to create array for containing potential transaction
int[][] pTransacts = new int[patronNumber][2];
for (int i=0; i<patronNumber; i++){
pTransacts[i][0] = scanner.nextInt();
pTransacts[i][1] = scanner.nextInt();
}
scanner.close();
if (solution.subTotal(pTransacts, 1) < gramAmount) {
System.out.println("Got caught!");
} else {
int maxprofit = solution.figureMaxValue(pTransacts, 0, 1, gramAmount);
if (maxprofit>0) {
System.out.println(maxprofit);
} else {
System.out.println("Got caught!");
}
}
}
private int subTotal(int[][] pTransacts, int index) {
int subTotal=0;
for (int i=0; i<pTransacts.length; i++){
subTotal = subTotal + pTransacts[i][index];
}
return subTotal;
}
/**
* to sort
* @param data
*/
private void sort(int[][] data){
for (int i=0; i<data.length-1; i++) {
for (int j=i+1; j<data.length; j++) {
if (data[i][1]<data[j][1]) {
int tempDate = data[i][1];
data[i][1]=data[j][1];
data[j][1]=tempDate;
tempDate = data[i][0];
data[i][0]=data[j][0];
data[j][0]=tempDate;
}
if (data[i][1]==data[j][1] && data[i][0]<data[j][0]) {
int tempDate = data[i][0];
data[i][0]=data[j][0];
data[j][0]=tempDate;
}
}
}
}
Set<List<Integer>> premuteSet = new HashSet<>();
public void permute(List<Integer> dataList, int k) {
for (int i = k; i < dataList.size(); i++) {
Collections.swap(dataList, i, k);
permute(dataList, k + 1);
Collections.swap(dataList, k, i);
}
if (k == dataList.size() - 1) {
List<Integer> newObject = new ArrayList<>();
newObject.addAll(dataList);
premuteSet.add(newObject);
}
}
public List<Integer> extractDataList(int[][] data, int index){
List<Integer> dataList = new ArrayList<>();
for (int i=0; i<data.length; i++) {
dataList.add(data[i][index]);
}
return dataList;
}
public void permuteArray(int[][] data, int permuteNumber, int baseIndex) {
List<Integer> dataList = extractDataList(data, baseIndex);
permute( dataList, permuteNumber);
}
public int figureMaxValue(int[][] data, int permuteNumber, int baseIndex, int maxNumber) {
int maxAmount = 0;
long t1 = System.nanoTime();
permuteArray(data, permuteNumber, baseIndex);
long t2 = System.nanoTime();
System.out.println((t2-t1)/1000 + "; " + premuteSet.size());
for (List<Integer> dataList : premuteSet) {
int sumNumber = 0;
for (int i=0; i<dataList.size(); i++) {
Integer member = dataList.get(i);
sumNumber=sumNumber+member;
if (sumNumber>maxNumber){
break;
} else if (sumNumber==maxNumber){
HashMap<Integer, Integer> patronMap = new HashMap<>();
int subTotal = 0;
for (int j=0; j<=i; j++) {
int targetInt = dataList.get(j);
int repeatTime = 0;
if (patronMap.containsKey(targetInt)) {
repeatTime = patronMap.get(targetInt) + 1;
patronMap.put(targetInt, repeatTime);
} else {
patronMap.put(targetInt, repeatTime);
}
for (int k=0; k<data.length; k++) {
if (data[k][1] == targetInt) {
subTotal = subTotal + data[k+repeatTime][0];
break;
}
}
}
if (subTotal>maxAmount) {
maxAmount=subTotal;
}
break;
} else {
}
}
}
return maxAmount;
}
}
| [
"noreply@github.com"
] | jerryxcxiong.noreply@github.com |
23fd4faaa012a6e3c044a920fa492385a640b3f4 | 21ce385cbfe56581581ceb99aa4033ddbd220553 | /BUBBLEBEE/src/main/java/com/kh/bubblebee/host/model/vo/Aclist.java | 1acd222dc6c3e5f2c1eb40c6d810cb6c18e32924 | [] | no_license | SoulJ-K/KH-FINAL-PROJECT | 08250a821cdbc8315efb5253f59b34c6ed9802e9 | 4620fed11d1876622543462ae9dd3056627500f8 | refs/heads/master | 2022-11-14T04:21:43.651772 | 2020-07-05T06:42:14 | 2020-07-05T06:42:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,130 | java | package com.kh.bubblebee.host.model.vo;
import java.sql.Date;
public class Aclist {
private String hostId; // 호스트 아이디
private int fno;// 글 번호
private String bdate; //구매 날짜
private String ftitle; // 버블 제목
private int amount; // 수량
private String total; // 총액
private String fees; // 수수료
private String cprice; // 실수령액
private String buy_status; // 정산 상태
public Aclist() {}
public Aclist(String hostId, int fno, String bdate, String ftitle, int amount, String total, String fees,
String cprice, String buy_status) {
super();
this.hostId = hostId;
this.fno = fno;
this.bdate = bdate;
this.ftitle = ftitle;
this.amount = amount;
this.total = total;
this.fees = fees;
this.cprice = cprice;
this.buy_status = buy_status;
}
public String getHostId() {
return hostId;
}
public void setHostId(String hostId) {
this.hostId = hostId;
}
public int getFno() {
return fno;
}
public void setFno(int fno) {
this.fno = fno;
}
public String getBdate() {
return bdate;
}
public void setBdate(String bdate) {
this.bdate = bdate;
}
public String getFtitle() {
return ftitle;
}
public void setFtitle(String ftitle) {
this.ftitle = ftitle;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public String getTotal() {
return total;
}
public void setTotal(String total) {
this.total = total;
}
public String getFees() {
return fees;
}
public void setFees(String fees) {
this.fees = fees;
}
public String getCprice() {
return cprice;
}
public void setCprice(String cprice) {
this.cprice = cprice;
}
public String getBuy_status() {
return buy_status;
}
public void setBuy_status(String buy_status) {
this.buy_status = buy_status;
}
@Override
public String toString() {
return "Aclist [hostId=" + hostId + ", fno=" + fno + ", bdate=" + bdate + ", ftitle=" + ftitle + ", amount="
+ amount + ", total=" + total + ", fees=" + fees + ", cprice=" + cprice + ", buy_status=" + buy_status
+ "]";
}
}
| [
"jhag047@gmail.com"
] | jhag047@gmail.com |
0e00d7cf4be574d3472fce9d4b33fd74a523c0ea | b7156db96b3dbd7b989758eb5ee7c13dfd54c316 | /pattern/src/main/java/com/martin/pattern/builder/singleton/lazy/ImproveLazySingleton.java | 6af7adc80441f58c2d0c0da189a742977d0987bb | [] | no_license | guanxianchun/learn | 4b009e841996317d7541f419f9bbf072e8a46611 | 742cf8deff1900f5642952bbd5f382362af2b775 | refs/heads/master | 2020-04-18T16:49:51.636577 | 2019-03-06T15:40:44 | 2019-03-06T15:40:44 | 167,641,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,031 | java | package com.martin.pattern.builder.singleton.lazy;
/**
* 单例模式:懒汉式
* 外部类被调用的时候内部类才被实例化
* 它整合了饿汉模式和懒汉模式的优点:空间和性能
*
* @author 管贤春
* @时间 2018年12月23日 下午2:42:41
* @Email psyche19830113@163.com
* @Description
*/
public class ImproveLazySingleton {
private static boolean initialized = false;
private ImproveLazySingleton() {
synchronized (ImproveLazySingleton.class) {
if (initialized == false) {
initialized = !initialized;
} else {
throw new RuntimeException("单例被侵犯");
}
}
}
public static final ImproveLazySingleton getInstance() {
return LazySingletonHolder.lazy;
}
//内部类在外部类被调用时才会实例化,默认不会实例化
private static class LazySingletonHolder {
private static final ImproveLazySingleton lazy = new ImproveLazySingleton();
}
}
| [
"psyche19830113@163.com"
] | psyche19830113@163.com |
4169c92ec5597d0f34103e65fe0f85b5d3f0d1a5 | ce8c67e4a7c45df001038b460e9868fbd236b579 | /cloud_services/maintenance-organisation-service/src/main/java/com/appl_maint_mngt/organisation/models/MaintenanceOrganisation.java | 97631bb904dd12a14151a81b0dce0d9a4e62d841 | [] | no_license | Cit-WKyle/appliance_maintenance_management | 03835d5acb4dc172acea57332de53f77e221c60c | bf6a7369044ad8a0c19ae896bcfc83190e126e39 | refs/heads/master | 2021-01-20T00:13:56.364039 | 2017-05-05T05:04:04 | 2017-05-05T05:04:04 | 85,218,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,294 | java | package com.appl_maint_mngt.organisation.models;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name="maintenance_organisations")
public class MaintenanceOrganisation {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name="name")
private String name;
@Column(name="description")
private String description;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "address_id")
private Address address;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
}
| [
"kyle_williamson@Kyles-MacBook-Pro.local"
] | kyle_williamson@Kyles-MacBook-Pro.local |
69bb438d545e4d9e7011fd89e4944ad94452bbf2 | 12fcdfa41e36a3ea64e20bc3e98f6aaa8b3e66a4 | /app/src/androidTest/java/com/africa/crm/businessmanagement/ExampleInstrumentedTest.java | 6d181a0dad27b61be7dcafc3633e9001051bd685 | [] | no_license | guojin2092/BusinessManagementProject | 8265351a4b8f0860bc137b661463f63c3d35c0b9 | 9f51ed63dba83c755d258a47046e65efef23e955 | refs/heads/master | 2020-04-05T20:36:32.031207 | 2019-02-13T05:33:48 | 2019-02-13T05:33:48 | 157,188,062 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package com.africa.crm.businessmanagement;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.africa.crm.businessmanagementproject", appContext.getPackageName());
}
}
| [
"317280902@qq.com"
] | 317280902@qq.com |
62e838e4b5ffae01be98cbe253fbca49c8c8ff89 | c3c0a3116e2a0dee2610a057063d9638a66f3b70 | /src/main/java/com/guchaolong/algorithm/zuoshensuanfa/public_class/class03/Code01_LongestNoRepeatSubstring.java | f25177755c94cc8af0f4326763079599b9178f30 | [] | no_license | guchaolong/java-learn | 8523ecad5bb1ed4b61e563e0507cafb12b3ea95d | ac3b744551a185c7fc1601aa5633c9192c2b8aca | refs/heads/master | 2023-08-19T07:49:15.351765 | 2023-08-17T14:25:47 | 2023-08-17T14:25:47 | 159,709,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,856 | java | package com.guchaolong.algorithm.zuoshensuanfa.public_class.class03;
public class Code01_LongestNoRepeatSubstring {
/*
* 给定一个只由小写字母(a~z)组成的字符串str, 返回其中最长无重复字符的子串长度
*
*/
public static int lnrs1(String s) {
if (s == null || s.length() == 0) {
return 0;
}
char[] str = s.toCharArray();
int N = str.length;
int max = 0;
for (int i = 0; i < N; i++) {
boolean[] set = new boolean[26];
for (int j = i; j < N; j++) {
if (set[str[j] - 'a']) {
break;
}
set[str[j] - 'a'] = true;
max = Math.max(max, j - i + 1);
}
}
return max;
}
public static int lnrs2(String s) {
if (s == null || s.length() == 0) {
return 0;
}
char[] str = s.toCharArray();
int N = str.length;
int[] last = new int[26];
for (int i = 0; i < 26; i++) {
last[i] = -1;
}
last[str[0] - 'a'] = 0;
int max = 1;
int preMaxLen = 1;
for (int i = 1; i < N; i++) {
preMaxLen = Math.min(i - last[str[i] - 'a'], preMaxLen + 1);
max = Math.max(max, preMaxLen);
last[str[i] - 'a'] = i;
}
return max;
}
// for test
public static String getRandomString(int possibilities, int maxSize) {
char[] ans = new char[(int) (Math.random() * maxSize) + 1];
for (int i = 0; i < ans.length; i++) {
ans[i] = (char) ((int) (Math.random() * possibilities) + 'a');
}
return String.valueOf(ans);
}
public static void main(String[] args) {
int possibilities = 26;
int strMaxSize = 100;
int testTimes = 1000000;
System.out.println("test begin, test time : " + testTimes);
for (int i = 0; i < testTimes; i++) {
String str = getRandomString(possibilities, strMaxSize);
int ans1 = lnrs1(str);
int ans2 = lnrs2(str);
if (ans1 != ans2) {
System.out.println("Oops!");
}
}
System.out.println("test finish");
}
}
| [
"guclno1@qq.com"
] | guclno1@qq.com |
31e6b3274f9fd491af6b02f7ed4970501869bfc8 | 9b45ff5d545aa9eda394ed4255b0962d55931827 | /Selenium/src/Package/JavaTutorial/AbstractClasExampleOne.java | b1a763da6cc88797d7aa33b9d444434de34ecd5d | [] | no_license | anand16/Download_Classes_V1 | b5987d4a8aaa51901db2323473d167913bf1eb3f | 706c611731edc3db8cf736d5ad321af56cab1637 | refs/heads/master | 2020-12-25T14:38:58.468057 | 2016-07-30T13:12:53 | 2016-07-30T13:12:53 | 64,544,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package Package.JavaTutorial;
abstract class exampleone
{
abstract void getName();
}
class AbstractImpl extends exampleone
{
void getName()
{
System.out.println("Name of the class is AbstractClass session");
}
}
public class AbstractClasExampleOne {
public static void main(String[] args) {
// TODO Auto-generated method stub
AbstractImpl ail=new AbstractImpl();
ail.getName();
}
}
| [
"you@example.com"
] | you@example.com |
70d279196047b177c3a57e0cab4e1e47a98b01f8 | 301f188e8a8069184f842020bce67b770f58d983 | /app/src/main/java/md/themes/themeserver/d.java | 0e6f9bb0ed0b4afea48e5c4349aa0ad128e358c2 | [] | no_license | richar1993/ThemeServer | 859dd7301655c95594192dbf658ac757777869aa | 2ef7376bbeedda0924ebb4e4777f0beb406f9a91 | refs/heads/main | 2023-08-29T19:44:47.724842 | 2021-11-11T07:44:26 | 2021-11-11T07:44:26 | 426,912,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,935 | java | package md.themes.themeserver;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.widget.Toast;
import java.io.File;
import md.themes.R;
import md.themes.themeserver.Base.Themes;
import md.themes.themeserver.Resources.yo;
final class d {
private String a;
private Context b;
private c c;
d(Context var1) {
super();
this.a = Themes.yomods_folder;
this.b = var1;
}
private void a(DialogInterface var1, int var2) {
String var10 = this.c.a();
File var3 = new File(this.a);
if (!var3.exists()) {
try {
var3.mkdir();
} catch (SecurityException var9) {
Toast.makeText(this.b, R.string.permission_storage_need_write_access_request, Toast.LENGTH_SHORT).show();
}
}
try {
StringBuilder var11 = new StringBuilder();
var11.append(OnThemesActivity.a);
var11.append(var10);
var11.append(".xml");
String var12 = var11.toString();
StringBuilder var4 = new StringBuilder();
var4.append(OnThemesActivity.b);
var4.append(var10);
var4.append("_w.jpg");
String var13 = var4.toString();
StringBuilder var5 = new StringBuilder();
var5.append(OnThemesActivity.b);
var5.append(var10);
var5.append("_homeW.jpg");
String var15 = var5.toString();
ThemeDownloadAsync var6 = new ThemeDownloadAsync(var10, var12, var13, var15);
var6.executeOnExecutor(ThemeDownloadAsync.THREAD_POOL_EXECUTOR, new Void[0]);
Context var14 = this.b;
var11 = new StringBuilder();
var11.append(R.string.gdpr_report_downloading);
var11.append(var10);
Toast.makeText(var14, var11.toString(), Toast.LENGTH_LONG).show();
} catch (SecurityException var7) {
Toast.makeText(this.b, R.string.permission_storage_need_write_access_request, Toast.LENGTH_LONG).show();
return;
} catch (Exception var8) {
}
}
private static void b(DialogInterface var0, int var1) {
var0.dismiss();
}
public static void lambda$_UCEly48umqTn5OZGFyCsejVMr8(d var0, DialogInterface var1, int var2) {
var0.a(var1, var2);
}
public static void lambda$nMohA1Jk6IMjVKfppRACiDT3FTg(DialogInterface var0, int var1) {
b(var0, var1);
}
final void a(c var1) {
this.c = var1;
(new Builder(this.b, R.style.Theme_AppCompat_Light_Dialog_Alert)).setTitle(this.c.a()).setMessage(R.string.themes_alert_lightdarkInfo).setNegativeButton(R.string.cancel, _$$Lambda$d$nMohA1Jk6IMjVKfppRACiDT3FTg.INSTANCE).setPositiveButton(R.string.ok, new _$$Lambda$d$_UCEly48umqTn5OZGFyCsejVMr8(this)).create().show();
}
}
| [
"43129851+richar1993@users.noreply.github.com"
] | 43129851+richar1993@users.noreply.github.com |
d597f4d3bc69edc890466a120d5cba231904434a | 8f296fe5a530d438202007030a4fd02555347fce | /sys-cms/src/test/java/com/tyj/cms/CmsApplicationTests.java | c14ef851e86ad357e75ee33aba8b355372449792 | [] | no_license | jonytian/sys | e79c1b8ba1f992914e38fbd3e762cab6bdc99c3b | 893b93f04c776a1f8e770fa2bfba4382adf0d438 | refs/heads/master | 2021-10-20T19:17:45.497647 | 2019-03-01T10:13:47 | 2019-03-01T10:13:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.tyj.cms;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class CmsApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"yaojiang.tian@langlangit.com"
] | yaojiang.tian@langlangit.com |
292d1fad04a253234a2acbb1f275e4179ad87806 | 144044f9282c50253a75bd8d5c23f619ad38fdf8 | /biao-boss/src/main/java/com/thinkgem/jeesite/modules/market/service/MkRelayAutoRecordService.java | 9b4fb0c8997f98730e89164bcfc51044061b2e60 | [] | no_license | clickear/biao | ba645de06b4e92b0539b05404c061194669f4570 | af71fd055c4ff3aa0b767a0a8b4eb74328e00f6f | refs/heads/master | 2020-05-16T15:47:33.675136 | 2019-09-25T08:20:28 | 2019-09-25T08:20:28 | 183,143,104 | 0 | 0 | null | 2019-04-24T03:46:28 | 2019-04-24T03:46:28 | null | UTF-8 | Java | false | false | 1,409 | java | /**
* Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.market.service;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.market.entity.MkRelayAutoRecord;
import com.thinkgem.jeesite.modules.market.dao.MkRelayAutoRecordDao;
/**
* 接力自动撞奖配置Service
* @author zzj
* @version 2018-09-26
*/
@Service
@Transactional(readOnly = true)
public class MkRelayAutoRecordService extends CrudService<MkRelayAutoRecordDao, MkRelayAutoRecord> {
public MkRelayAutoRecord get(String id) {
return super.get(id);
}
public List<MkRelayAutoRecord> findList(MkRelayAutoRecord mkRelayAutoRecord) {
return super.findList(mkRelayAutoRecord);
}
public Page<MkRelayAutoRecord> findPage(Page<MkRelayAutoRecord> page, MkRelayAutoRecord mkRelayAutoRecord) {
return super.findPage(page, mkRelayAutoRecord);
}
@Transactional(readOnly = false)
public void save(MkRelayAutoRecord mkRelayAutoRecord) {
super.save(mkRelayAutoRecord);
}
@Transactional(readOnly = false)
public void delete(MkRelayAutoRecord mkRelayAutoRecord) {
super.delete(mkRelayAutoRecord);
}
} | [
"1072163919@qq.com"
] | 1072163919@qq.com |
a766d980907482581012f14afb7cc858caccb8e8 | 6b01f50fee1225529a69f0cbc9f64e53490aa5e9 | /app/src/main/java/com/testing/contactpicker/multipickercontacts/ContactPickerActivity.java | ce30656757e6693b330ab72d552b18942814b9c8 | [] | no_license | GlenWinWin/EARTH | 78e1431f389d94f17acc0840e9234f05ab2998b8 | 71d888da1cc00a6fc85b756270fdb7b443298d50 | refs/heads/master | 2021-01-17T15:53:54.360779 | 2016-09-17T08:37:57 | 2016-09-17T08:37:57 | 63,920,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,495 | java | package com.testing.contactpicker.multipickercontacts;
import android.content.Intent;
import android.graphics.Color;
import android.support.design.widget.NavigationView;
import android.support.v4.app.FragmentManager;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import com.testing.contactpicker.R;
import com.testing.contactpicker.navigation_drawer_fragments.AboutFragment;
import com.testing.contactpicker.navigation_drawer_fragments.AddEvacuationAreasFragment;
import com.testing.contactpicker.navigation_drawer_fragments.EarthquakesFragment;
import com.testing.contactpicker.navigation_drawer_fragments.FragmentDrawer;
import com.testing.contactpicker.navigation_drawer_fragments.HelpFragment;
import com.testing.contactpicker.navigation_drawer_fragments.HowToResponseFragment;
import com.testing.contactpicker.navigation_drawer_fragments.SettingsFragment;
import java.util.ArrayList;
public class ContactPickerActivity extends AppCompatActivity{
private GoogleMap mMap;
public static final String PICKER_TYPE = "type";
public static final String PICKER_TYPE_PHONE = "phone";
public static final String CONTACT_PICKER_RESULT = "contacts";
public static final int RESULT_ERROR = RESULT_FIRST_USER;
private Toolbar mToolbar;
private FragmentDrawer drawerFragment;
SupportMapFragment supportMapFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getIntent().getAction() != null && !Intent.ACTION_PICK.equals(getIntent().getAction())) {
Intent ret = new Intent();
ret.putExtra("error", "Unsupported action type");
setResult(RESULT_ERROR, ret);
return;
}
if (getIntent().getExtras() == null || PICKER_TYPE_PHONE.equals(getIntent().getExtras().getString(PICKER_TYPE))) {
setContentView(R.layout.contact_list);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle("Contacts");
} else {
Intent ret = new Intent();
ret.putExtra("error", "Unsupported picker type");
setResult(RESULT_ERROR, ret);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.contact_picker_options, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.contacts_done) {
returnResults();
return true;
} else if (item.getItemId() == R.id.contacts_cancel) {
cancel();
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
private void returnResults() {
ContactListFragment fragment = (ContactListFragment) getSupportFragmentManager().getFragments().get(0);
ArrayList<ContactResult> resultList = new ArrayList<ContactResult>( fragment.getResults().values() );
Intent retIntent = new Intent();
retIntent.putExtra(CONTACT_PICKER_RESULT, resultList);
if(resultList.size() == 1){
setResult(RESULT_OK, retIntent);
finish();
}
else{
Toast.makeText(getApplicationContext(),"Choose only one contact!",Toast.LENGTH_LONG).show();
}
}
private void cancel() {
setResult(RESULT_CANCELED);
finish();
}
@Override
public void onBackPressed() {
cancel();
super.onBackPressed();
}
} | [
"glenwinbernabe@gmail.com"
] | glenwinbernabe@gmail.com |
66e47e1ff512cb5548de36da1410a5f1b00525e6 | 0a1b2a9dce325b5926cde04bd2e5c8bccb4682c5 | /src/main/java/com/jashepherd/studies/java/ocajavase8/ch05_class_design/s03_interfaces/e05_abstract_methods_multiple_inheritance/E1Omnivore.java | 941de17c07323349cec6756984d6881da5777934 | [] | no_license | Mijaco/oca-java-standar-edition-8-v1 | 4d9b8fb826091926db7fc130661dc6b068e2164d | 428601bc38eef1ab07344f65244ae7d66ace3e36 | refs/heads/master | 2020-04-01T18:53:07.229361 | 2019-05-08T03:48:47 | 2019-05-08T03:48:47 | 153,521,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.jashepherd.studies.java.ocajavase8.ch05_class_design.s03_interfaces.e05_abstract_methods_multiple_inheritance;
/**
* Chapter 5: Class Design<br>
* Implementing Interfaces<br>
* Abstract Methods and Multiple Inheritance - page 271
*/
public interface E1Omnivore {
public void eatPlants();
public void eatMeat();
}
| [
"jeremy.shepherd@outlook.com"
] | jeremy.shepherd@outlook.com |
059326ab5426d7f373bb26d548c0503f9eca1495 | 5f6d406f30353e6ea4ca3a8def00522cf9e9e4dd | /Seleniumjuly/src/com/ScreenShortselfies/SS_4.java | b9773f340de6fa779bce0a011285fd539cc317cb | [] | no_license | vani83/Selenium | 1de73eaeb89794d27ab436535fcc91bac6b0f963 | fc8a12ef4621766f0b3c15ac6b87e8e6d564a123 | refs/heads/main | 2023-07-17T03:42:02.455371 | 2021-08-21T08:20:06 | 2021-08-21T08:20:06 | 396,755,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.ScreenShortselfies;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class SS_4 {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.google.com");
driver.findElements(By.tagName("a"));
}
}
| [
"vaniyalamanchi@gmail.com"
] | vaniyalamanchi@gmail.com |
51dcac9c890d865d5892b2802b266c0366cd6f9b | 16ce5b2ff970e1c9179e5e13d687ea67b86c15d9 | /src/main/java/frc/robot/commands/automate/MoveToPoint.java | 1a63991d11f60f3dfcb8f57a39d650e4a087dd2e | [] | no_license | 2374/Season2019 | c2f4ee35036aa4e026afb5cf4d058866915a39df | 67c40c793718f37826a22a5808971c370a06db84 | refs/heads/master | 2020-05-03T04:42:33.764773 | 2019-04-02T23:11:36 | 2019-04-02T23:11:36 | 166,462,748 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package frc.robot.commands.automate;
import edu.wpi.first.wpilibj.command.Command;
import frc.robot.Robot;
import frc.robot.RobotMap;
public class MoveToPoint extends Command {
private int stopDistance;
private int direction;
public MoveToPoint(int stopDistance, int direction) {
requires (Robot.getDrivetrain());
this.stopDistance = stopDistance;
this.direction = direction;
}
@Override
protected void initialize() {
System.out.println("[Debug] Moving robot to ideal position.");
}
@Override
protected void execute() {
if (direction > 0) {
System.out.println("Distance read: " + Robot.getLidar().getDistanceCm());
while (Robot.getLidar().getDistanceCm() > stopDistance) {
Robot.getDrivetrain().tankDrive(-RobotMap.SPEED_DRIVE, -RobotMap.SPEED_DRIVE);
}
Robot.getDrivetrain().tankDrive(0.0, 0.0);
} else {
while (Robot.getLidar().getDistanceCm() < stopDistance) {
Robot.getDrivetrain().tankDrive(RobotMap.SPEED_DRIVE, RobotMap.SPEED_DRIVE);
}
Robot.getDrivetrain().tankDrive(0.0, 0.0);
}
}
@Override
protected boolean isFinished() {
return true;
}
@Override
protected void interrupted() {
}
@Override
protected void end() {
Robot.getDrivetrain().tankDrive(0.0, 0.0);
}
} | [
"crusaderbots@gmail.com"
] | crusaderbots@gmail.com |
3212928e92646c4719eb27b1b0adf1201d1178a3 | 82ea748df882d2299b9efe76ff4eea45feb01675 | /src/com/main/tank/main.java | 3f327cc20ce3caac1a70861d3aa94a4413609894 | [] | no_license | giraffecat/TANK2019 | 17a0f876a470381a8af8ca6c19037988d4f2d141 | d74c0a8b781015cd54b32c58e70111e2d10a8d69 | refs/heads/master | 2022-11-13T12:41:59.103788 | 2020-06-29T10:32:24 | 2020-06-29T10:32:24 | 272,199,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.main.tank;
import java.awt.Frame;
import java.util.concurrent.TimeUnit;
public class main {
public static void main(String[] args) {
TankFrame f = TankFrame.Instance;
f.setVisible(true);
for(;;) {
try {
Thread.sleep(25);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
f.repaint();
}
}
}
| [
"1018997102@qq.com"
] | 1018997102@qq.com |
971c2a7dfde7f275913ba6f3f417667ec4eecc23 | e93edad8260aae7225b2860fb3117118229c5e36 | /src/designpattern/factorypattern/abstracts/pizzaingredient/factory/NYPizzaIngredientFactory.java | d793c1871a4e0c3176ad7b8b227924dba2a3b322 | [] | no_license | alexnguyen1606/JavaCore-Training | 291396183a5040f057fb1f2ee14e1bf0e8505c56 | 7598f7401942c65785d16b91453ada792cc6fe4f | refs/heads/master | 2023-06-12T17:20:33.148046 | 2023-05-31T14:27:28 | 2023-05-31T14:27:28 | 231,238,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | package designpattern.factorypattern.abstracts.pizzaingredient.factory;
import designpattern.factorypattern.abstracts.pizzaingredient.*;
import designpattern.factorypattern.abstracts.pizzaingredient.ingredients.clams.Clams;
import designpattern.factorypattern.abstracts.pizzaingredient.ingredients.clams.FreshClams;
import designpattern.factorypattern.abstracts.pizzaingredient.ingredients.dough.Dough;
import designpattern.factorypattern.abstracts.pizzaingredient.ingredients.dough.ThinCrustDough;
import designpattern.factorypattern.abstracts.pizzaingredient.ingredients.cheese.Cheese;
import designpattern.factorypattern.abstracts.pizzaingredient.ingredients.cheese.ReggianoCheese;
import designpattern.factorypattern.abstracts.pizzaingredient.ingredients.sauce.MarinaraSauce;
import designpattern.factorypattern.abstracts.pizzaingredient.ingredients.veggies.*;
/**
* @author:Nguyen Anh Tuan
* <p>
* 11:01 PM ,January 17,2021
*/
public class NYPizzaIngredientFactory implements PizzaIngradientFactory {
@Override
public Dough createDough() {
return new ThinCrustDough();
}
@Override
public Cheese createCheese() {
return new ReggianoCheese();
}
@Override
public Sauce createSauce() {
return new MarinaraSauce();
}
@Override
public Veggies[] createVeggies() {
return new Veggies[]{new Onion(), new Garlic(), new RedPepper(), new Mushroom()};
}
@Override
public Clams createClams() {
return new FreshClams();
}
}
| [
"natuan1606@gmail.com"
] | natuan1606@gmail.com |
a12ec10a2416e95f5a08653dc9e6872924a19a01 | a246719e05e2b9040d6dc28ed3787c5c68606060 | /src/collection/object/ObjectCollection.java | 87cf2cced5ba48ed901564993524757407f64c39 | [] | no_license | najung1992/javaPrj | fae779a51e8b27ad3f6d0d798792be964749c264 | cfb707010c49e63e26406804dfb683f15c69ee4b | refs/heads/master | 2021-01-01T03:53:55.389536 | 2016-05-17T05:19:24 | 2016-05-17T05:19:24 | 58,992,201 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,110 | java | package collection.object;
public class ObjectCollection {
private Object[] data;
private int current;
// 캡슐이 깨지지않도록! private해쥼
private int capacity; //전체 용량!
private int amount; //추가 증가량
public ObjectCollection() {
current = -1;
capacity = 3;
amount = 5;
data = new Object[capacity];
}
public int size() {
return current+1;
}
public Object get(int i) {
return this.data[i];
}
public void add(Object exam) {
current++;
//만약 공간이 모자라면 늘려주게끔!
if(capacity <= current){
//공간을 늘려준다!
//1. 새로운크기의 배열만든다!
Object[] temp = new Object[capacity+amount];
//2. exams배열을 temp로 옮겨야함!
for(int i =0 ; i < capacity ; i++)
temp[i]=data[i];
//3.기존배열은 버리고, 새로운배열이 현재 참조되는 배열이되어야함!
data= temp;
//4. 늘어난 만큼 용량이 새로운 값으로 바뀌어야겠찌여?
capacity += amount;
}
data[current]=exam ;
}
}
| [
"dclass@d_class"
] | dclass@d_class |
a0c26af6f8044aa6d586de7bcf032e4c6dd1ccd6 | 6f14772fc8bb9bf2f3890b90ebed43e98386a048 | /src/main/java/com/xyz/cbt/FileOperationDescriptor.java | 67084602e1fc87e72823352140a598f426ccb863 | [] | no_license | varun-vikas/Jenkins_plugin | 8fb7ab28292a9626cf2babfad93bbb0021e80d50 | b134d091908e123e0da68de758a0caddfc414962 | refs/heads/main | 2023-01-03T06:22:25.438326 | 2020-10-21T17:13:41 | 2020-10-21T17:13:41 | 306,093,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java | package com.xyz.cbt;
import hudson.model.Descriptor;
public abstract class FileOperationDescriptor extends Descriptor<FileOperation> {
} | [
"vvikas@adobe.com"
] | vvikas@adobe.com |
43b1d227cd85c5e5899686cda5fe23a061ea460d | b9caaa8e8b3171301c409d1a3e74d642ce8c2489 | /src/test/java/com/hans/reactiveapp/ReactiveStarterAppApplicationTests.java | 499d4f2844144369f20dac5a5b24cbc9c730f119 | [] | no_license | gurramharish/reactive-starter-app | 0d16943d06f2f8dfc78025e214340c995971b6fd | 03d2db25a136ad121a08556a504ab27aec50e669 | refs/heads/master | 2022-12-05T03:48:53.010033 | 2020-08-24T09:53:32 | 2020-08-24T09:53:32 | 289,889,614 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package com.hans.reactiveapp;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ReactiveStarterAppApplicationTests {
@Test
void contextLoads() {
}
}
| [
"gurramharish12@gmail.com"
] | gurramharish12@gmail.com |
f4777f0c7add0baa41b0fdffb38392791030bb42 | 207f3e6651670a5e58b936f8207bb12ae3243be0 | /src/main/java/com/theanswerli/proxy/TimeHandler.java | 3faa7e3758e6189567ccedbc649d1b3939cd3234 | [] | no_license | theanswerli/practice-demo | 1285d4888706bd23b3a7a0f054e7034d80dbaf2a | 780bba2138a93bca034563219fff655135f30c4a | refs/heads/master | 2021-01-02T08:56:52.037727 | 2019-02-20T15:30:45 | 2019-02-20T15:30:45 | 28,328,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package com.theanswerli.proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
/**
* Author: Liming
* Date: 2018/1/9
* Company: Lenovo
*/
public class TimeHandler implements InvocationHandler {
private Object target;
public TimeHandler(Object target) {
super();
this.target = target;
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
System.out.println("proxy:"+proxy.getClass().getName());
System.out.println("method:"+method.getName());
//System.out.println("args:"+args[0].getClass().getName());
long start = System.currentTimeMillis();
System.out.println("Method start at : " + start);
method.invoke(target);
long end = System.currentTimeMillis();
System.out.println("Method end at : " + end);
System.out.println("Method spend time : " + (end - start));
return null;
}
}
| [
"theanswerli@foxmail.com"
] | theanswerli@foxmail.com |
823114d487b9911d7e56cbc7d427ddf4f1196ab9 | 93cb7fc73a59e6f034a35d57444732e49f98a045 | /Unit 3/src/Main.java | 37359fa79a99d7a198d2ee8bad17149a82ea205f | [] | no_license | nt314p/ICS4U | 128787aa9305f2edaa42a3848b06b51c02c63534 | 8e71cdc9c258b5ed620a3a97ce38e8f985d36245 | refs/heads/master | 2022-12-16T09:01:28.888195 | 2022-07-04T14:36:21 | 2022-07-04T14:36:21 | 205,896,471 | 4 | 0 | null | 2022-12-11T22:14:51 | 2019-09-02T16:31:44 | Java | UTF-8 | Java | false | false | 262 | java | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner reader = new Scanner(System.in);
String s = reader.next();
}
}
| [
"32203145+nt314p@users.noreply.github.com"
] | 32203145+nt314p@users.noreply.github.com |
f4c8f8724f75d917c271ad2e1f444209c0b9dfff | 93d19f47772468fcbc994c76073afad0bdc40b9f | /src/main/java/com/augusto/MailchimpMandrillApplication.java | 8c6475902cb575de6723fc575d02d2aefcb90624 | [] | no_license | augustoadsis/mailchimp-mandrill | 5c145d310185159463ca7291c1523cb008a03441 | 4f89271770d3817897ff4c8274de2dd0de2e68fb | refs/heads/main | 2022-12-28T23:44:53.833408 | 2020-10-16T20:38:29 | 2020-10-16T20:38:29 | 304,722,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 596 | java | package com.augusto;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
public class MailchimpMandrillApplication {
public static void main(String[] args) {
SpringApplication.run(MailchimpMandrillApplication.class, args);
}
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
return builder.build();
}
}
| [
"augustoadsis@gmail.com"
] | augustoadsis@gmail.com |
994dc84837fc1fd394a4e41587f7bce9009cadb2 | f3aec68bc48dc52e76f276fd3b47c3260c01b2a4 | /core/drugstore-tier/src/main/java/org/hl7/v3/RoleClassTerritoryOfAuthority.java | c5460a304d780e05b25ac6061161a1ab3d7cdd3e | [] | no_license | MarsStirner/core | c9a383799a92e485e2395d81a0bc95d51ada5fa5 | 6fbf37af989aa48fabb9c4c2566195aafd2b16ab | refs/heads/master | 2020-12-03T00:39:51.407573 | 2016-04-29T12:28:32 | 2016-04-29T12:28:32 | 96,041,573 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 761 | java |
package org.hl7.v3;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for RoleClassTerritoryOfAuthority.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="RoleClassTerritoryOfAuthority">
* <restriction base="{urn:hl7-org:v3}cs">
* <enumeration value="TERR"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "RoleClassTerritoryOfAuthority")
@XmlEnum
public enum RoleClassTerritoryOfAuthority {
TERR;
public String value() {
return name();
}
public static RoleClassTerritoryOfAuthority fromValue(String v) {
return valueOf(v);
}
}
| [
"NosovDE@gmail.com"
] | NosovDE@gmail.com |
b0185b1c3bf55aaf2615ac2dbb6a5973bf29a29a | 54592048883904ea0e372507f0bbca17940c2776 | /spring1_DI/src/main/java/com/naver/myhome1/sample4/HelloApp1.java | 42211c965f94ab003b513fd4c64ff7a89cb45f98 | [] | no_license | benz71788/Spring | 88537b012601aa95bf3a978d4d45b151ef366bb9 | 2e5b27a4fca039f056f105727b5e5ab69579ab52 | refs/heads/master | 2022-12-24T08:18:17.695276 | 2018-07-06T08:45:58 | 2018-07-06T08:45:58 | 137,863,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package com.naver.myhome1.sample4;
public class HelloApp1 {
public static void main(String[] args) {
MessageBeanImpl beanImpl = new MessageBeanImpl("스프링");
beanImpl.setGreeting("안녕~");
beanImpl.sayHello();
}
}
| [
"shanelee7178@gmail.com"
] | shanelee7178@gmail.com |
29252ec58509fb2681ee59838df02f841c7cca18 | 70edcbd9d6c1bb2e565f5d71d7dcdc71cab740f9 | /liferay-workspace/apps/service-builder/jndi/jndi-api/src/main/java/com/liferay/blade/samples/jndiservicebuilder/model/RegionSoap.java | d57b62f6b4f5ccffbe3ec23b582f0c66cd386e69 | [
"Apache-2.0"
] | permissive | inacionery/liferay-blade-samples | c163f0889f1ea0ac5ab8fdfb0eaf0cd61d1fb35c | 1e6ab401d3ad140ade140b1dfa3f20f0488ff466 | refs/heads/7.1 | 2022-02-05T17:39:22.438990 | 2019-04-22T15:38:29 | 2019-04-22T15:38:29 | 191,175,732 | 0 | 0 | Apache-2.0 | 2019-06-10T20:39:43 | 2019-06-10T13:42:23 | Java | UTF-8 | Java | false | false | 2,515 | java | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.blade.samples.jndiservicebuilder.model;
import aQute.bnd.annotation.ProviderType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* This class is used by SOAP remote services.
*
* @author Brian Wing Shun Chan
* @generated
*/
@ProviderType
public class RegionSoap implements Serializable {
public static RegionSoap toSoapModel(Region model) {
RegionSoap soapModel = new RegionSoap();
soapModel.setRegionId(model.getRegionId());
soapModel.setRegionName(model.getRegionName());
return soapModel;
}
public static RegionSoap[] toSoapModels(Region[] models) {
RegionSoap[] soapModels = new RegionSoap[models.length];
for (int i = 0; i < models.length; i++) {
soapModels[i] = toSoapModel(models[i]);
}
return soapModels;
}
public static RegionSoap[][] toSoapModels(Region[][] models) {
RegionSoap[][] soapModels = null;
if (models.length > 0) {
soapModels = new RegionSoap[models.length][models[0].length];
}
else {
soapModels = new RegionSoap[0][0];
}
for (int i = 0; i < models.length; i++) {
soapModels[i] = toSoapModels(models[i]);
}
return soapModels;
}
public static RegionSoap[] toSoapModels(List<Region> models) {
List<RegionSoap> soapModels = new ArrayList<RegionSoap>(models.size());
for (Region model : models) {
soapModels.add(toSoapModel(model));
}
return soapModels.toArray(new RegionSoap[soapModels.size()]);
}
public RegionSoap() {
}
public long getPrimaryKey() {
return _regionId;
}
public void setPrimaryKey(long pk) {
setRegionId(pk);
}
public long getRegionId() {
return _regionId;
}
public void setRegionId(long regionId) {
_regionId = regionId;
}
public String getRegionName() {
return _regionName;
}
public void setRegionName(String regionName) {
_regionName = regionName;
}
private long _regionId;
private String _regionName;
} | [
"gregory.amerson@liferay.com"
] | gregory.amerson@liferay.com |
543a778d0a3782b55e121bb907730b531097c784 | 172cc70041ce4927a485cf360add5653f8305ad4 | /School/Family.java | 94b00a28492e35687688450aeb5a9af6c6c69fec | [] | no_license | lelu2104/java_homework | c8c005c10e622e86fa8e71f7fcaf725e7d7a6578 | b75468d1f4cfc4aabb13f9110664db7666b93c46 | refs/heads/master | 2022-12-19T12:53:42.620955 | 2020-09-13T16:22:15 | 2020-09-13T16:22:15 | 277,914,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 727 | java | package School;
public class Family extends Parent {
int familyBudget;
int familyBudgetInDay;
public Family(String femaleName, String manName, String kidName) {
super(femaleName, manName, kidName);
this.familyBudget = familyBudget;
this.familyBudgetInDay = familyBudgetInDay;
}
public int getFamilyBudget() {
return familyBudget;
}
public void setFamilyBudget(int familyBudget) {
this.familyBudget = familyBudget;
}
public int getFamilyBudgetInDay() {
return familyBudgetInDay;
}
public void setFamilyBudgetInDay(int familyBudgetInDay) {
this.familyBudgetInDay = familyBudgetInDay;
}
}
| [
"noreply@github.com"
] | lelu2104.noreply@github.com |
cbff18c75d6eb36aa0d458a8e3a9365e211e8865 | e4ad64dfe214a2fa19faa7820821ad69895ddc14 | /InterfacesChallenge/src/Monsters.java | 41f2b71e3152f48669b66be9088aa9e10b47d099 | [] | no_license | hirolemo/Java-Python-Course-Practice | e4c88014a863b3e046aba1787f2a0ea22edf94f8 | 6ccdff1c5a19b1e60288e6cd615633795eb107e3 | refs/heads/master | 2020-03-23T20:38:53.658718 | 2018-08-20T23:55:11 | 2018-08-20T23:55:11 | 142,053,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 823 | java | import java.util.ArrayList;
public class Monsters implements ISaveable {
private String monsterName;
private String hitPoints;
private String monsterType;
private ArrayList<String> values;
public Monsters(ArrayList<String> values) {
this.values = values;
}
@Override
public String toString() {
return "Monsters{" +
"monsterName='" + monsterName + '\'' +
", hitPoints='" + hitPoints + '\'' +
", monsterType='" + monsterType + '\'' +
'}';
}
@Override
public ArrayList<String> sendList() {
return values;
}
@Override
public void populate() {
this.monsterName = values.get(0);
this.hitPoints = values.get(1);
this.monsterType = values.get(2);
}
}
| [
"hirole.mohamed@gmail.com"
] | hirole.mohamed@gmail.com |
5791efeac818c3afa1b967e736f4d8b86deeffa8 | b05e9a86adf4597e3488d6f63769a4ce5e32f18d | /app/src/main/java/com/saavor/user/Model/DeleteCardHit.java | 8f39e298399778b21fd3e5606f7ebe3bb04641f4 | [] | no_license | sanjeev-developer/Cooking | 2d83b438e6e8fb8269448147f653a7bd50e73155 | 98f63fe2d8b72ea9bb7edce87449c25f388ddb41 | refs/heads/master | 2020-12-10T15:31:35.404985 | 2020-01-13T15:48:41 | 2020-01-13T15:48:41 | 233,632,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | java | package com.saavor.user.Model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by a123456 on 15/09/17.
*/
public class DeleteCardHit {
@SerializedName("CardId")
@Expose
private String cardId;
@SerializedName("CustomerId")
@Expose
private String customerId;
@SerializedName("SessionToken")
@Expose
private String sessionToken;
@SerializedName("StripeCardId")
@Expose
private String stripeCardId;
@SerializedName("UserId")
@Expose
private String userId;
public String getCardId() {
return cardId;
}
public void setCardId(String cardId) {
this.cardId = cardId;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getSessionToken() {
return sessionToken;
}
public void setSessionToken(String sessionToken) {
this.sessionToken = sessionToken;
}
public String getStripeCardId() {
return stripeCardId;
}
public void setStripeCardId(String stripeCardId) {
this.stripeCardId = stripeCardId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
}
| [
"sanjeevgupta9223@gmail.com"
] | sanjeevgupta9223@gmail.com |
c03276c9e90e779ce94625285f01ebae08ca1f6d | 0e0d907c6826e7024893b47acb69a15e78e07871 | /binjr-core/src/main/java/eu/binjr/common/text/NoopPrefixFormatter.java | ca4d088571dd6338649f8cdab5e987f56da812c7 | [
"Apache-2.0",
"OFL-1.1",
"CC-BY-4.0",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | Arkanosis/binjr | 17f568b086b519d06d63a592de60ece6d9ec9dd5 | ce97305d2d354df36d36292a4cb621b0bfaf7b81 | refs/heads/master | 2021-11-04T23:01:04.822465 | 2021-08-10T17:38:16 | 2021-08-10T17:38:16 | 141,738,761 | 1 | 0 | Apache-2.0 | 2018-07-20T17:15:21 | 2018-07-20T17:15:21 | null | UTF-8 | Java | false | false | 1,413 | java | /*
* Copyright 2021 Frederic Thevenet
*
* 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 eu.binjr.common.text;
import java.util.NavigableMap;
import java.util.TreeMap;
/**
* An implementation of {@link PrefixFormatter} for metric prefixes
*
* @author Frederic Thevenet
*/
public class NoopPrefixFormatter extends PrefixFormatter {
private static final NavigableMap<Double, String> SUFFIX_MAP = new TreeMap<>() ;
/**
* Initializes a new instance of the {@link NoopPrefixFormatter} class
*/
public NoopPrefixFormatter() {
super(SUFFIX_MAP);
}
/**
* Initializes a new instance of the {@link NoopPrefixFormatter} class with the specified format pattern.
*
* @param pattern a non-localized pattern string
*/
public NoopPrefixFormatter(String pattern) {
super(SUFFIX_MAP, pattern);
}
} | [
"thevenet.fred@free.fr"
] | thevenet.fred@free.fr |
5679175c1a842a599e09ad133947b1632820f059 | cd4aaa743185dfcc11afb00afa6f8f918fe5de77 | /CourseCreation/Address.java | 04b0a017cb75bd66eed30befb2860740045c95eb | [] | no_license | nevets915/CourseCreation | 3682f4d1f4ddb8e156a96f68b7ea57c593998ca9 | 30fb7f5e9b12ca7be610504660dab25561510ecd | refs/heads/master | 2021-01-21T15:18:33.548210 | 2017-05-19T19:20:18 | 2017-05-19T19:20:18 | 91,838,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,688 | java | package q4;
import java.util.Scanner;
/**
* <p>The Address class is a base class which provides the blue print for
* constructing an Address object. It has a constructor method which
* intakes the street address, the city name, state name and ZIP code
* for constructing an Address object. The class also provides a method
* to return a description of the Address object in the form of a string.
* The class has empty constructor which can be used with the readAddress
* method to set the parameters of a new Address object to something a
* user may input, instead of hard-coding it.
* This class was taken in part from the Java Software Solutions textbook
* 8th edition. The original author of this code was Lewis/Loftus.</p>
*
* @author Steven Ma
* @version 1.0
*/
public class Address {
/**
* <p>String constant for street address.</p>
*/
private String streetAddress;
/**
* <p>String constant for city name.</p>
*/
private String city;
/**
* <p>String constant for state name.</p>
*/
private String state;
/**
* <p>Constant for zip code.</p>
*/
private long zipCode;
/**
* <p>Constructor for Address object.</p>
*
* @param street formal parameter for string street name.
* @param town formal parameter for string town name.
* @param st formal parameter for string state name.
* @param zip formal parameter for long zip code.
*/
public Address(String street, String town, String st, long zip) {
streetAddress = street;
city = town;
state = st;
zipCode = zip;
}
/**
* <p>Constructor for Address object. No parameters</p>
*
*/
public Address() {
}
/**
* <p>Method for returning a description of address object.</p>
* @return String
*/
public String toString() {
String result;
result = streetAddress + "\n";
result += city + ", " + state + " " + zipCode;
return result;
}
/**
* <p>Method for reading in address parameters for
* constructions of address object.</p>
*
*/
public void readAddress() {
Scanner scan = new Scanner(System.in);
System.out.print("Please enter the address name:");
streetAddress = scan.next();
System.out.print("Please enter the city name:");
city = scan.next();
System.out.print("Please enter the state name");
state = scan.next();
System.out.print("Please enter the ZIP code:");
zipCode = scan.nextInt();
}
} | [
"noreply@github.com"
] | nevets915.noreply@github.com |
8d6814ae1f4e5008a8182e72aeb31d19e5dc9f0b | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project319/src/test/java/org/gradle/test/performance/largejavamultiproject/project319/p1599/Test31982.java | 6fe6c180811ca20b660f61a1057fced60bb036c8 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | package org.gradle.test.performance.largejavamultiproject.project319.p1599;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test31982 {
Production31982 objectUnderTest = new Production31982();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
8a93e6cb17f1299c5e1371bec8390473c7966bd5 | e47af69700b56e5ca18339ec06ec63208ca82bc9 | /src/hackerearthchallenge/amazon/GoodRange.java | 04ed6b4b45a722091d9cc6b1931c84ac2e174227 | [] | no_license | Devang-25/DataStructureAlgorithm | d6b7c1cf19d152d47729b969a7a57e3bb2d08ebc | 19d40c74606d13dbf836aeb89a004f11ee82c5d6 | refs/heads/master | 2022-04-11T09:06:07.542963 | 2019-07-06T04:51:47 | 2019-07-06T04:51:47 | 275,335,515 | 1 | 1 | null | 2020-06-27T09:01:47 | 2020-06-27T09:01:46 | null | UTF-8 | Java | false | false | 656 | java | package hackerearthchallenge.amazon;
import java.util.Scanner;
public class GoodRange {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int q = scanner.nextInt();
int min = scanner.nextInt();
int max = -1;
StringBuffer out = new StringBuffer();
out.append((n+1) + "\n");
for (int i = 1; i < q; i++) {
int temp = scanner.nextInt();
if (temp > max){
max = temp;
} else if (temp < min){
} else if (temp > min && temp < max){
}
}
}
}
| [
"rakeshgupta.contact@gmail.com"
] | rakeshgupta.contact@gmail.com |
331b093cd52d20a698bb713d2b020d259a3d59d8 | 32de9e711bde2940156a9b972d715c9f5badf7be | /jdbc_prj/src/kr/co/sist/menu/vo/OrderAllVO.java | fc7dddac91cf9775e3fcfcd83fe8c6d6290dc86b | [] | no_license | bkb1116/class4_jdbc | b6aec8281dc37a31914010619af8d7cb040043a6 | 5e0ae47cf113b25d2635bc0ef4697159c3f7b6b3 | refs/heads/master | 2021-01-21T19:09:17.374239 | 2017-05-23T03:33:28 | 2017-05-23T03:33:28 | 92,124,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,557 | java | package kr.co.sist.menu.vo;
public class OrderAllVO {
private String item_code, menu, name, orderDate, ip;
private int orderNum, quan, totalPrice;
public OrderAllVO() {
}
public OrderAllVO(String item_code, String menu, String name, String orderDate, String ip, int orderNum, int quan,
int totalPrice) {
super();
this.item_code = item_code;
this.menu = menu;
this.name = name;
this.orderDate = orderDate;
this.ip = ip;
this.orderNum = orderNum;
this.quan = quan;
this.totalPrice = totalPrice;
}
public String getItem_code() {
return item_code;
}
public void setItem_code(String item_code) {
this.item_code = item_code;
}
public String getMenu() {
return menu;
}
public void setMenu(String menu) {
this.menu = menu;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOrderDate() {
return orderDate;
}
public void setOrderDate(String orderDate) {
this.orderDate = orderDate;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getOrderNum() {
return orderNum;
}
public void setOrderNum(int orderNum) {
this.orderNum = orderNum;
}
public int getQuan() {
return quan;
}
public void setQuan(int quan) {
this.quan = quan;
}
public int getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(int totalPrice) {
this.totalPrice = totalPrice;
}
}
| [
"bkb@bkb"
] | bkb@bkb |
de05f67f6f07f9247ee2816b38214cdcc55e0bd6 | db294ec8d99390225f13382f977b249b84a062fc | /src/classes/cz/alej/michalik/totp/client/App.java | 9a007d6d6490dc01bf69b2164fe349ff2195a99a | [
"Apache-2.0"
] | permissive | PetrM97/totp | 3d2a41b8fe25821602d430dd26965c70903d28e1 | 58e4ac28879b958198a0a3b65791312608bbf408 | refs/heads/master | 2021-04-29T01:24:58.211179 | 2017-04-11T18:20:14 | 2017-04-11T18:20:14 | 77,750,993 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,338 | java | /*
Copyright 2017 Petr Michalík
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 cz.alej.michalik.totp.client;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
/**
* Grafické prostředí pro generování TOTP kódů
*
* @author Petr Michalík
*
*/
public class App {
private final static String FILENAME = "client.properties";
public final static float FONT_SIZE = 48f;
public static final Color COLOR = new Color(255, 255, 255);
// Záznamy
private static Properties p = new Properties();
// Okno
private static JFrame window = new JFrame("TOTP");
// Panel pro posun v hlavním panelu se záznamy
private static JScrollPane scrollFrame = new JScrollPane();
// Tlačítko pro přidání nových záznamů
private static JPanel ap = new AddPanel(p);
/**
* Spustí grafické prostředí
*
* @param args
*/
public static void main(String[] args) {
/* Parametry okna */
// Ukončení programu při zavření
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setMinimumSize(new Dimension(320, 240));
// Rozvržení obsahu podle osy Y
window.setLayout(new BoxLayout(window.getContentPane(), BoxLayout.Y_AXIS));
// Umístění okna určí OS
window.setLocationByPlatform(true);
// Nastavím ikonu
try {
String path = "/material-design-icons/action/drawable-xhdpi/ic_lock_black_48dp.png";
window.setIconImage(Toolkit.getDefaultToolkit().getImage(App.class.getResource(path)));
} catch (NullPointerException e) {
System.out.println("Icon not found");
}
// Testovací záznam
// p.setProperty("-1", "Test;GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ");
// Načte uložené hodnoty
loadProperties();
saveProperties();
// Vykreslí okno
window.setVisible(true);
window.pack();
}
/**
* Načte nastavení a vykreslí změny do aplikace
*/
public static void loadProperties() {
System.out.println("Překresluji");
// Vytvoří soubor při prvním spuštění
try {
System.out.println("Read: " + App.class.getResource("/" + FILENAME).toString());
} catch (NullPointerException e) {
saveProperties();
}
// Načte nastavení ze souboru
try {
p.load(App.class.getResourceAsStream("/" + FILENAME));
} catch (FileNotFoundException e) {
// Soubor nenalezen
e.printStackTrace();
} catch (IOException e) {
// Chyba při načtení
e.printStackTrace();
}
// Odstraním současný obsah
window.remove(scrollFrame);
window.remove(ap);
// Aktualizuji obsah
ap = new AddPanel(p);
scrollFrame = new JScrollPane(new MainPanel(p));
// Nastavení hlavního panelu se záznamy
scrollFrame.setPreferredSize(new Dimension(640, 480));
// Nastavení pro plynulé scrollování
scrollFrame.getVerticalScrollBar().setUnitIncrement(16);
scrollFrame.getViewport().setScrollMode(JViewport.BACKINGSTORE_SCROLL_MODE);
// Do okna přidám panely s novým obsahem
window.add(scrollFrame);
window.add(ap);
window.repaint();
window.setVisible(true);
}
/**
* Uloží nastavení do souboru
*/
public static void saveProperties() {
System.out.println("Trying to save file");
try {
// Získám relativní cestu - složka ve které běží spuštěná aplikace
String dir = App.class.getResource("/").getFile();
OutputStream os = new FileOutputStream(dir + FILENAME);
// Ulozim
p.store(os, "TOTP save file");
System.out.println("Created file in " + dir);
} catch (IOException e) {
// Chyba při ukládání
e.printStackTrace();
}
}
}
| [
"PetrMichalik1@seznam.cz"
] | PetrMichalik1@seznam.cz |
440979a3ad8e99a414da8bbb885ceb70024ec066 | 9f42e5f91f755763d8080883fe2de0a4edc764fe | /java/RealRan.java | c2fd84080ba67aa475e2330738091a5b2f569b00 | [] | no_license | jssngg/JAVAA | 8d2af36ecae9e0b42cb5fbf08f3f87a7e6ec99e1 | 0cf49bc05fee0d87df6220ca9b85b7808e310ab1 | refs/heads/master | 2020-12-24T07:59:18.325367 | 2016-12-20T08:39:41 | 2016-12-20T08:39:41 | 73,349,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | package dd;
import java.util.Scanner;
import java.util.Random;
public class RealRan {
void run(){
Scanner s = new Scanner(System.in)
; boolean a = true;
while(a = true){
for(int x= 0; x<10; x++){
int n = (int)Math.random()*100 + 1;
System.out.println(n);
Random r= new Random();
int na = r.nextInt(44909);System.out.println(na);
a= false;
System.out.println("Keep go? y/n ");
String ak = s.next();
System.out.println(Math.exp(3));
if(ak.equals("y")){
continue;
}else{
a= true;
break;
}
}
}
}
public static void main(String [] args){
RealRan v = new RealRan();
v.run();
}
}
| [
"noreply@github.com"
] | jssngg.noreply@github.com |
fc31f10085ded6c14ccb6368277d2661743e7841 | 8009055de52ac53e3273c0eb7a1d2963b9e6c703 | /app/src/androidTest/java/com/example/newtoutiao/ExampleInstrumentedTest.java | 6f76a3f03f8f76c81f576a1333149ae3c1f40b92 | [] | no_license | S-Snail/NewTouTiao | 9396f2038126dd5191a54e3ff80004c6a3b07578 | 03380a1f07a10a5b751b13bc399c77b367bd5c2f | refs/heads/master | 2020-03-07T23:17:32.742618 | 2018-07-02T16:51:05 | 2018-07-02T16:51:05 | 127,777,259 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package com.example.newtoutiao;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.newtoutiao", appContext.getPackageName());
}
}
| [
"1114979847@qq.com"
] | 1114979847@qq.com |
a496a0e882ad64df9dfa38aee4cb798384331038 | ab484e1383448c716176ab29134ab3087d90223f | /src/main/java/com/example/validate/entity/Province.java | e0d68d47da21f28c35e1ecf24b95ac6b7a5e7fcb | [] | no_license | lyh1996/validate | d77dceb1bfc9fba060910a1bba96a4ed4e3a3e39 | 98d02cf1b81f8ad41c21878810b8a6e91baad6c3 | refs/heads/master | 2022-06-21T07:27:29.606702 | 2022-05-11T09:40:43 | 2022-05-11T09:40:43 | 228,965,510 | 1 | 0 | null | 2022-06-17T02:44:53 | 2019-12-19T03:14:23 | Java | UTF-8 | Java | false | false | 371 | java | /*
* Copyright (c) 2014 laidian. All Rights Reserved.
* @author LYH
* @date 2019-12-05 9:30
*/
package com.example.validate.entity;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @author LYH
* @date 2019/12/05 9:30
*/
@Data
public class Province {
@NotBlank(message = "省份名称不能为空")
private String provinceName;
} | [
"luoyh@imlaidian.com"
] | luoyh@imlaidian.com |
0433eecd1842a3c78cb3f052c4a2bd388a2c293a | 6cbc25202e50a51f1e0b527528c8ad6d75e22d2a | /src/Practice/RemoveSpecialCharacters.java | 30ce8196f7704e8ad1427f8b6f246b180210762b | [] | no_license | gagan1393/Java-Codes | 1a35d64c9bfae855e7f6139581913bbe0c1cb2db | 557b9613210b928aea904ba76051653669fc3283 | refs/heads/main | 2023-08-26T21:45:59.829020 | 2021-10-21T05:54:49 | 2021-10-21T05:54:49 | 419,598,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package Practice;
public class RemoveSpecialCharacters {
public static void main(String[] args) {
String str = "Today text is : Today \n , \n , \n High \n 22 \n Low \n 14 \n , \n Light rain and a gentle breeze";
System.out.println(str);
str = str.replaceAll("\\W", "");
System.out.println("------------");
System.out.println(str);
}
}
| [
"gagan1393dp@gmail.com"
] | gagan1393dp@gmail.com |
0e12f47656c7ad519d951c60f5f14759862b016e | b2ecdc938ce97ae417b61b7b64f1d88a429eab2d | /app/src/main/java/com/example/tommy/suiviapp2/Projet.java | df78d3e3e1f9919b40d3e3bc14b063545d277f57 | [] | no_license | Tominyo/SuiviApp2 | 4d2dfe674379d6412924fcbfae7dc715598f2bf0 | ec5e0889f79bc5206447a52dae89a58cde612987 | refs/heads/master | 2020-07-07T19:50:06.283376 | 2019-08-22T05:47:40 | 2019-08-22T05:47:40 | 203,460,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | package com.example.tommy.suiviapp2;
public class Projet {
private String name;
private String state;
public Projet(String name, String state){
this.name = name;
this.state = state;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
| [
"tommy.miredin@gmail.com"
] | tommy.miredin@gmail.com |
fefe81401213cf4ba7b9dcc30cb7211867b9782d | 7def524b19e83029757c5c634bd3586cd3586ec5 | /src/main/java/com/cloudera/hadoop/hdfs/nfs/nfs4/attrs/NumLinkHandler.java | 2b5c536f4b1a81da9fe581eac7e5e7e1f2772919 | [] | no_license | hanasaki/hdfs-nfs-proxy | 744162d69dd820cadad9738a3fe1a4779a52cd87 | 89cd88fd4ea3bbb4828a41f5020c47ece77b6e60 | refs/heads/master | 2020-12-24T11:17:00.398688 | 2012-01-21T18:13:48 | 2012-01-21T18:13:48 | 3,183,795 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,430 | java | /**
* Copyright 2011 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.cloudera.hadoop.hdfs.nfs.nfs4.attrs;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import com.cloudera.hadoop.hdfs.nfs.nfs4.NFS4Exception;
import com.cloudera.hadoop.hdfs.nfs.nfs4.NFS4Handler;
import com.cloudera.hadoop.hdfs.nfs.nfs4.Session;
public class NumLinkHandler extends AttributeHandler<NumLink> {
@Override
public NumLink get(NFS4Handler server, Session session,
FileSystem fs, FileStatus fileStatus) throws NFS4Exception {
NumLink max = new NumLink();
max.setValue(1);
return max;
}
}
| [
"brock@cloudera.com"
] | brock@cloudera.com |
c9733797d2081c4555ca163bf16e59abeda422f7 | aa4e5bcc2cd96c9100859aa937bd46c975f132a7 | /emp.java | 8a53641adadf8d23e1aed564c5cc36650eb786d9 | [] | no_license | gaya3rk/java | 05e4056121bffad3f93c00e00dcc08c51565162a | 801525c252ee16d3478d0b33acfccd94d115cbac | refs/heads/master | 2021-01-25T23:59:46.090231 | 2020-02-26T10:25:41 | 2020-02-26T10:25:41 | 243,233,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java |
public class emp {
int eno=101;
void display()
{
//eno=300
System.out.println(eno);
}
}
class manager extends emp
{
void display()
{
System.out.println("manager class");
}
}
class tst
{
public static void main(String args[])
{
manager e=new manager();
e.display();
}
} | [
"noreply@github.com"
] | gaya3rk.noreply@github.com |
3143f067dad9d41d065b3ae44deacc32d0ef8ab6 | 7d0945868b491ec90a2018c05ed7f934d797b581 | /auth/aaron-auth-zuul/src/main/java/com/aaron/zuul_demo/config/FilterConfig.java | 135f8359f4c4c57b5c4559b27ef2a5d9ab1757e8 | [] | no_license | agilego99/spring-cloud-aaron | 761dc937f5e6504d41b9b5e1e530b0954e6a375a | ba42d96bd40fedaf9bfca80a3777741b4cea0463 | refs/heads/master | 2022-12-20T11:22:58.250243 | 2021-02-01T06:05:14 | 2021-02-01T06:05:14 | 214,135,914 | 1 | 0 | null | 2022-12-10T03:56:24 | 2019-10-10T09:02:54 | Java | UTF-8 | Java | false | false | 339 | java | package com.aaron.zuul_demo.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.aaron.zuul_demo.filter.AuthHeaderFilter;
@Configuration
public class FilterConfig {
@Bean
public AuthHeaderFilter authHeaderFilter() {
return new AuthHeaderFilter();
}
}
| [
"agilego99@gmail.com"
] | agilego99@gmail.com |
c387cede4d55bfe06c7138d2d2420a2796f3063b | 9d9c0d9aba0c3102787a0215621b24dbe7f64b59 | /jeecms-component/src/main/java/com/jeecms/interact/service/impl/UserCommentServiceImpl.java | 51e52906b024ca0feff52e72f0642ead2ff56009 | [] | no_license | hd19901110/jeecms1.4.1test | b354019c57a06384524d53aa667614c1f4e5a743 | 4e3e0cb31513e53004aa20c108f79741203becb0 | refs/heads/master | 2022-12-08T06:10:06.868825 | 2020-08-31T09:59:19 | 2020-08-31T09:59:19 | 285,445,431 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 27,131 | java | /*
* @Copyright: 江西金磊科技发展有限公司 All rights reserved.Notice 仅限于授权后使用,禁止非授权传阅以及私自用于商业目的。
*/
package com.jeecms.interact.service.impl;
import com.jeecms.auth.domain.CoreUser;
import com.jeecms.auth.service.CoreUserService;
import com.jeecms.common.base.service.BaseServiceImpl;
import com.jeecms.common.exception.GlobalException;
import com.jeecms.common.exception.SystemExceptionInfo;
import com.jeecms.common.exception.error.ContentErrorCodeEnum;
import com.jeecms.common.exception.error.SettingErrorCodeEnum;
import com.jeecms.common.response.ResponseInfo;
import com.jeecms.common.util.MyDateUtils;
import com.jeecms.common.web.Location;
import com.jeecms.common.web.Location.LocationResult.AdInfo;
import com.jeecms.common.web.util.RequestUtils;
import com.jeecms.content.constants.ContentConstant;
import com.jeecms.content.domain.Content;
import com.jeecms.content.domain.vo.ContentFrontVo;
import com.jeecms.content.service.ContentFrontService;
import com.jeecms.content.service.ContentService;
import com.jeecms.interact.dao.UserCommentDao;
import com.jeecms.interact.domain.UserComment;
import com.jeecms.interact.domain.UserCommentReport;
import com.jeecms.interact.domain.dto.UserCommentDto;
import com.jeecms.interact.domain.dto.UserCommentTopDto;
import com.jeecms.interact.domain.vo.UserCommentCountVo;
import com.jeecms.interact.domain.vo.UserInteractionMoblieVo;
import com.jeecms.interact.domain.vo.UserInteractionVo;
import com.jeecms.interact.service.UserCommentReportService;
import com.jeecms.interact.service.UserCommentService;
import com.jeecms.member.domain.MemberScoreDetails;
import com.jeecms.member.service.MemberScoreDetailsService;
import com.jeecms.system.domain.CmsSite;
import com.jeecms.system.domain.SysBlackList;
import com.jeecms.system.service.AddressService;
import com.jeecms.system.service.SysBlackListService;
import com.jeecms.util.SystemContextUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 用户评论service实现类
*
* @author: chenming
* @date: 2019年5月6日 上午9:04:52
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class UserCommentServiceImpl extends BaseServiceImpl<UserComment, UserCommentDao, Integer>
implements UserCommentService {
static Logger logger = LoggerFactory.getLogger(UserCommentServiceImpl.class);
@Override
public Page<UserComment> findByList(Integer siteId, Short status, Boolean isTop, Boolean isReply, Integer channelId,
Date startTime, Date endTime, Date replyStartTime, Date replyEndTime, String fuzzySearch,
String userName,String ip, String commentText, String replytText, String title,
Pageable pageable) throws GlobalException {
Page<UserComment> uPage = dao.findByList(siteId, status, isTop, isReply, channelId, startTime, endTime,
replyStartTime, replyEndTime, fuzzySearch, userName, ip, commentText, replytText,
title, pageable);
List<SysBlackList> sLists = sListService.findBySiteId(siteId,SysBlackList.USER_COMMENT_TYPE);
List<Integer> userIdList = sLists.stream().filter(s -> s.getUserId() != null)
.map(SysBlackList::getUserId)
.collect(Collectors.toList());
List<String> ipList = sLists.stream().filter(s -> s.getIp() != null).map(SysBlackList::getIp)
.collect(Collectors.toList());
List<UserComment> userCommentAll = super.findAll(true);
boolean siteIsNot = false;
if (userCommentAll != null) {
userCommentAll = userCommentAll.stream().filter(comment -> comment.getSiteId().equals(siteId)).collect(Collectors.toList());
siteIsNot = true;
}
List<Integer> reportIds = commentReportService.findByDeleted();
reportIds = reportIds == null ? new ArrayList<Integer>() : reportIds;
for (UserComment userComment : uPage) {
if (userComment.getReplyAdminComment() != null) {
if (StringUtils.isNotBlank(replytText)) {
String replyCommentText = userComment.getReplyAdminComment().getCommentText();
if (replyCommentText.indexOf(replytText) == -1) {
userComment.setReplyAdminComment(null);
}
}
}
if (userIdList.contains(userComment.getUserId())) {
userComment.setIsUserDisable(true);
}
if (ipList.contains(userComment.getIp())) {
userComment.setIsIpDisable(true);
}
if (reportIds.contains(userComment.getId())) {
userComment.setIsReport(true);
}
UserCommentCountVo vo = this.getCount(userComment.getContentId(), userCommentAll, siteIsNot ? null:siteId);
userComment.setAllNum(vo.getAllNum());
userComment.setPendingReview(vo.getPendingReviewNum());
userComment.setSuccessReview(vo.getSuccessReviewNum());
userComment.setErrorReview(vo.getErrorReviewNum());
}
return uPage;
}
@Override
public Page<UserComment> findByList(Integer siteId, Short status, Boolean isTop, Boolean isReply, Integer channelId,
Date startTime, Date endTime, Date replyStartTime, Date replyEndTime, String fuzzySearch,
String userName, String ip, String commentText, String replytText, String title,
Integer contentId, Integer userId, String precisionIp, Pageable pageable)
throws GlobalException {
Page<UserComment> uPage = dao.findTermByList(siteId, status, isTop, isReply, channelId, startTime, endTime,
replyStartTime, replyEndTime, fuzzySearch, userName, ip, commentText, replytText, title,
contentId, userId, precisionIp, pageable);
List<SysBlackList> sLists = sListService.findBySiteId(siteId,SysBlackList.USER_COMMENT_TYPE);
List<Integer> userIdList = sLists.stream().filter(s -> s.getUserId() != null)
.map(SysBlackList::getUserId)
.collect(Collectors.toList());
List<String> ipList = sLists.stream().filter(s -> s.getIp() != null).map(SysBlackList::getIp)
.collect(Collectors.toList());
for (UserComment userComment : uPage) {
if (userComment.getReplyAdminComment() != null) {
if (StringUtils.isNotBlank(fuzzySearch)) {
String replyCommentText = userComment.getReplyAdminComment().getCommentText();
if (replyCommentText.indexOf(fuzzySearch) == -1) {
userComment.setReplyAdminComment(null);
}
}
}
if (userIdList.contains(userComment.getUserId())) {
userComment.setIsUserDisable(true);
}
if (ipList.contains(userComment.getIp())) {
userComment.setIsIpDisable(true);
}
// List<UserCommentReport> userCommentReports = userComment.getUserCommentReports();
// if (userCommentReports != null && userCommentReports.size() > 0) {
// userCommentReports = userCommentReports.stream()
// .sorted(Comparator.comparing(UserCommentReport::getCreateTime).reversed())
// .collect(Collectors.toList());
// userComment.setUserCommentReports(userCommentReports);
// }
}
return uPage;
}
@Override
public Page<UserComment> findByList(Integer siteId,Pageable pageable) throws GlobalException {
Page<UserComment> uPage = dao.findReportByList(siteId, pageable);
List<SysBlackList> sLists = sListService.findBySiteId(siteId,SysBlackList.USER_COMMENT_TYPE);
List<Integer> userIdList = sLists.stream().filter(s -> s.getUserId() != null)
.map(SysBlackList::getUserId)
.collect(Collectors.toList());
List<String> ipList = sLists.stream().filter(s -> s.getIp() != null).map(SysBlackList::getIp)
.collect(Collectors.toList());
for (UserComment userComment : uPage) {
if (userIdList.contains(userComment.getUserId())) {
userComment.setIsUserDisable(true);
}
if (ipList.contains(userComment.getIp())) {
userComment.setIsIpDisable(true);
}
List<UserCommentReport> userCommentReports = userComment.getUserCommentReports();
if (userCommentReports != null && userCommentReports.size() > 0) {
userCommentReports = userCommentReports.stream()
.sorted(Comparator.comparing(UserCommentReport::getCreateTime).reversed())
.collect(Collectors.toList());
userComment.setUserCommentReports(userCommentReports);
}
}
return uPage;
}
@Override
public void saveOrUpdateReply(UserComment userComment, UserCommentDto dto,HttpServletRequest request,
CmsSite site) throws GlobalException {
if (dto.getIsUpdate()) {
if (userComment.getReplyAdminCommentId() == null) {
return;
}
UserComment reply = super.findById(userComment.getReplyAdminCommentId());
reply.setCommentText(dto.getReplytText());
userComment.setReplyTime(new Date());
super.updateAll(reply);
} else {
if (userComment.getReplyAdminCommentId() != null) {
return;
}
CoreUser user = SystemContextUtils.getCoreUser();
Integer contentId = userComment.getContentId();
// 新增一个回复数据
UserComment newComment = new UserComment();
newComment.setSiteId(userComment.getSiteId());
newComment.setUserId(user.getId());
newComment.setContentId(contentId);
newComment.setCommentText(dto.getReplytText());
String ip = RequestUtils.getRemoteAddr(request);
newComment.setIp(ip);
newComment.setVisitorArea(this.getVersionArea(ip));
newComment.setStatus(UserComment.CHECK_BY);
newComment.setDownCount(0);
newComment.setUpCount(0);
newComment.setReplyTime(null);
newComment.setParentId(userComment.getId());
newComment.setReplyCommentId(userComment.getId());
newComment.setReplyComment(userComment);
newComment.setIsReport(false);
newComment.setIsTop(false);
newComment.setIsReply(true);
newComment.setSortNum(10);
newComment.setUser(user);
newComment.setParent(userComment);
newComment.setSite(site);
newComment.setContent(contentService.findById(contentId));
UserComment bean = super.save(newComment);
super.flush();
//修改被回复的那个数据
userComment.setReplyTime(new Date());
userComment.setReplyAdminCommentId(bean.getId());
userComment.setReplyAdminComment(bean);
userComment.getChildren().add(bean);
/**
* 新增评论回复后更新content的数量缓存
*/
contentFrontService.saveOrUpdateNum(contentId, null, ContentConstant.CONTENT_NUM_TYPE_COMMENTS, false);
}
super.update(userComment);
}
@Override
public void deleted(List<UserComment> userComments, Integer[] ids) throws GlobalException {
List<Integer> idList = new ArrayList<Integer>();
Collections.addAll(idList, ids);
List<UserComment> parentIds = dao.findByParentIdInAndHasDeleted(idList, false);
if (parentIds != null && parentIds.size() > 0) {
userComments.addAll(parentIds);
}
List<UserComment> replys = dao.findByReplyCommentIdInAndHasDeleted(idList, false);
for (UserComment userComment : replys) {
if (!userComments.contains(userComment)) {
userComments.add(userComment);
}
}
super.delete(userComments);
Map<Integer,Integer> contentMap = userComments.stream().collect(Collectors.groupingBy(UserComment::getContentId, Collectors.summingInt(v->1)));
for (Integer contentId : contentMap.keySet()) {
contentFrontService.saveOrUpdateNum(contentId, contentMap.get(contentId), ContentConstant.CONTENT_NUM_TYPE_COMMENTS, true);
}
}
@Override
public void updateCheck(UserCommentDto dto, Integer siteId) throws GlobalException {
Short status = dto.getStatus();
List<UserComment> uList = super.findAllById(Arrays.asList(dto.getIds()));
Short checkStatus = null;
for (UserComment userComment : uList) {
// 校验如果传入的评论的站点Id与controller层获取到的不一致,则说明有问题,则直接抛出异常
if (!siteId.equals(userComment.getSiteId())) {
throw new GlobalException(
new SystemExceptionInfo(
SettingErrorCodeEnum.COMMENT_IS_NOT_SITE_DATA.getDefaultMessage(),
SettingErrorCodeEnum.COMMENT_IS_NOT_SITE_DATA.getCode()));
}
// 获取到该评论的状态
checkStatus = userComment.getStatus();
switch (status) {
// 审核通过
case 1:
// 审核通过的前提必须是待审核或者是审核不通过,否则不进行修改
if (UserComment.CHECK_WAIT.equals(checkStatus)
||
UserComment.CHECK_FAIL.equals(checkStatus)) {
userComment.setStatus(UserComment.CHECK_BY);
contentFrontService.saveOrUpdateNum(userComment.getContentId(), 1, ContentConstant.CONTENT_NUM_TYPE_COMMENTS, false);
if (userComment.getUserId() != null) {
memberScoreDetailsService.addMemberScore(MemberScoreDetails.COMMENT_SCORE_TYPE,
userComment.getUserId(), userComment.getSiteId(),userComment.getId());
}
}
break;
// 审核不通过
case 2:
// 审核不通过的前提必须是待审核
if (UserComment.CHECK_WAIT.equals(checkStatus)) {
userComment.setStatus(UserComment.CHECK_FAIL);
}
break;
// 审核撤回
case 3:
// 审核撤回的前提必须是审核通过
if (UserComment.CHECK_BY.equals(checkStatus)) {
userComment.setStatus(UserComment.CHECK_WAIT);
contentFrontService.saveOrUpdateNum(userComment.getContentId(), 1, ContentConstant.CONTENT_NUM_TYPE_COMMENTS, true);
}
break;
default:
break;
}
}
super.batchUpdate(uList);
}
@Override
public void saveStop(UserCommentDto dto, CmsSite site) throws GlobalException {
SysBlackList sBlackList = new SysBlackList();
UserComment userComment = super.findById(dto.getId());
Integer siteId = site.getId();
if (dto.getIsIp()) {
if (!sListService.checkUserComment(siteId, null, userComment.getIp())) {
throw new GlobalException(
new SystemExceptionInfo(
SettingErrorCodeEnum.USER_OR_IP_HAS_BEEN_BANNED.getDefaultMessage(),
SettingErrorCodeEnum.USER_OR_IP_HAS_BEEN_BANNED.getCode()));
}
sBlackList.setIp(userComment.getIp());
} else {
if (userComment.getUserId() == null) {
throw new GlobalException(
new SystemExceptionInfo(
SettingErrorCodeEnum.USER_IS_NOT_LOGIN_UNABLE_TO_PROHIBIT.getDefaultMessage(),
SettingErrorCodeEnum.USER_IS_NOT_LOGIN_UNABLE_TO_PROHIBIT.getCode()));
}
if (userComment != null
&&
!sListService.checkUserComment(siteId, userComment.getUserId(), null)) {
throw new GlobalException(
new SystemExceptionInfo(
SettingErrorCodeEnum.USER_OR_IP_HAS_BEEN_BANNED.getDefaultMessage(),
SettingErrorCodeEnum.USER_OR_IP_HAS_BEEN_BANNED.getCode()));
}
sBlackList.setUserId(userComment.getUserId());
sBlackList.setUserName(userComment.getUser().getUsername());
}
sBlackList.setSiteId(siteId);
sBlackList.setSite(site);
sBlackList.setType(SysBlackList.USER_COMMENT_TYPE);
sListService.save(sBlackList);
}
@Override
public void deleteStop(UserCommentDto dto, Integer siteId) throws GlobalException {
UserComment userComment = super.findById(dto.getId());
SysBlackList sysBlackList = null;
if (dto.getIsIp()) {
sysBlackList = sListService.findByUserIdByIp(siteId, SysBlackList.USER_COMMENT_TYPE,
null, userComment.getIp());
} else {
sysBlackList = sListService.findByUserIdByIp(siteId, SysBlackList.USER_COMMENT_TYPE,
userComment.getUserId(), null);
}
if (sysBlackList != null) {
sListService.physicalDelete(sysBlackList);
}
}
@Override
public List<UserComment> findByUserId(Integer userId) {
return dao.findByUserIdAndHasDeleted(userId,false);
}
@Override
public List<UserComment> findByIp(String ip) {
return dao.findByIpAndHasDeleted(ip,false);
}
@Override
public long getCount(Date beginTime, Date endTime, Integer siteId, Short status) {
return dao.getCount(beginTime, endTime, siteId, status);
}
@Override
public UserCommentCountVo getCount(Integer contentId,List<UserComment> userComments,Integer siteId) throws GlobalException {
if (userComments == null) {
userComments = super.findAll(true);
}
UserCommentCountVo vo = new UserCommentCountVo(0, 0, 0, 0, 0);
if (userComments != null && userComments.size() > 0) {
if (siteId != null) {
userComments = userComments.stream().filter(comment -> siteId.equals(comment.getSiteId())).collect(Collectors.toList());
}
if (contentId != null) {
Content content = contentService.findById(contentId);
if (content == null) {
throw new GlobalException(ContentErrorCodeEnum.CONTENT_ID_PASSED_ERROR);
}
vo.setContentName(content.getTitle());
vo.setChannelName(content.getChannelName());
userComments = userComments.stream().filter(comment -> contentId.equals(comment.getContentId())).collect(Collectors.toList());
vo.setAllNum(userComments.size());
Integer pendingReviewNum = userComments.stream().filter(comment -> UserComment.CHECK_WAIT.equals(comment.getStatus())).collect(Collectors.toList()).size();
vo.setPendingReviewNum(pendingReviewNum);
Integer successReviewNum = userComments.stream().filter(comment -> UserComment.CHECK_BY.equals(comment.getStatus())).collect(Collectors.toList()).size();
vo.setSuccessReviewNum(successReviewNum);
Integer errorReviewNum = userComments.stream().filter(comment -> UserComment.CHECK_FAIL.equals(comment.getStatus())).collect(Collectors.toList()).size();
vo.setErrorReviewNum(errorReviewNum);
} else {
userComments = userComments.stream().filter(comment -> comment.getReplyAdminCommentId() != null).collect(Collectors.toList());
vo.setReportNum(userComments.size());
}
}
return vo;
}
@Override
public void top(UserCommentTopDto dto) throws GlobalException {
UserComment userComment = super.findById(dto.getId());
if (userComment == null) {
return;
}
userComment.setIsTop(dto.getTop());
super.update(userComment);
}
@Override
public Page<UserInteractionVo> interactPage(Date startTime, Date endTime, Integer userId,
Pageable pageable) throws GlobalException {
List<Integer> integers = new ArrayList<Integer>(10);
//查询我评论和回复的列表
List<UserComment> list = dao.getInteractions(startTime, endTime, userId, null);
List<UserInteractionVo> vos = new ArrayList<UserInteractionVo>(10);
//分析出互动类型,得到我的评论和我的回复
for (UserComment userComment : list) {
UserInteractionVo vo = new UserInteractionVo();
//回复ID不为空则为我的回复
if (userComment.getReplyCommentId() != null) {
vo.setUsername(userComment.getUser() != null
? userComment.getUser().getUsername()
: "");
vo.setType(UserInteractionVo.TYPE_2);
} else {
vo.setUsername(userComment.getUser() != null
? userComment.getUser().getUsername()
: "");
vo.setType(UserInteractionVo.TYPE_1);
}
vo.setCommentTime(MyDateUtils.formatDate(userComment.getCreateTime(),
MyDateUtils.COM_Y_M_D_H_M_PATTERN));
vo.setContentId(userComment.getContentId());
vo.setContentUrl(userComment.getContent().getUrlWhole());
vo.setId(userComment.getId());
vo.setText(userComment.getCommentText());
vo.setTitle(userComment.getContent().getTitle());
vo.setUpCount(userComment.getUpCount());
vo.setParentId(userComment.getParentId());
vos.add(vo);
integers.add(userComment.getId());
}
if (!integers.isEmpty()) {
//得到回复我的
List<UserComment> reply = dao.getInteractions(null, null, null, integers);
for (UserComment userComment : reply) {
UserInteractionVo vo = new UserInteractionVo();
vo.setCommentTime(MyDateUtils.formatDate(userComment.getCreateTime(),
MyDateUtils.COM_Y_M_D_H_M_PATTERN));
vo.setContentId(userComment.getContentId());
vo.setContentUrl(userComment.getContent().getUrlWhole());
vo.setId(userComment.getId());
vo.setText(userComment.getCommentText());
vo.setTitle(userComment.getContent().getTitle());
vo.setType(UserInteractionVo.TYPE_3);
vo.setUsername(userComment.getUser() != null
? userComment.getUser().getUsername()
: "");
vo.setUpCount(userComment.getUpCount());
vo.setParentId(userComment.getParentId());
vos.add(vo);
}
}
PageImpl<UserInteractionVo> page;
if (!vos.isEmpty()) {
Integer sum = vos.size();
vos = vos.stream()
.skip(pageable.getPageSize() * (pageable.getPageNumber()))
.limit(pageable.getPageSize()).collect(Collectors.toList());
page = new PageImpl<>(vos, pageable, sum);
} else {
page = new PageImpl<>(vos, pageable, vos.size());
}
return page;
}
@Override
public Page<UserInteractionMoblieVo> mobilePage(Integer userId, Pageable pageable) throws GlobalException {
List<Integer> likes = new ArrayList<Integer>(10);
List<Integer> integers = new ArrayList<Integer>(10);
CoreUser user = coreUserService.findById(SystemContextUtils.getCoreUser().getId());
//得到我点赞的评论
if (user.getLikeComments() != null && !user.getLikeComments().isEmpty()) {
likes = user.getLikeComments().stream().map(UserComment::getId).collect(Collectors.toList());
}
//查询我评论和回复的列表
List<UserComment> list = dao.getInteractions(null, null, userId, null);
List<UserInteractionMoblieVo> vos = new ArrayList<UserInteractionMoblieVo>(10);
//分析出互动类型,得到我的评论和我的回复
for (UserComment userComment : list) {
if (userComment == null) {
break;
}
UserInteractionMoblieVo vo = new UserInteractionMoblieVo();
//回复ID不为空则为我的回复
if (userComment.getReplyCommentId() != null) {
if (userComment.getReplyComment() != null) {
vo.setReplyUsername(userComment.getReplyComment().getUser() != null
? userComment.getReplyComment().getUser().getUsername()
: "");
} else {
vo.setReplyUsername("");
}
vo.setType(UserInteractionVo.TYPE_2);
} else {
vo.setType(UserInteractionVo.TYPE_1);
}
vo.setUsername(user.getUsername());
vo.setCommentTime(userComment.getDistanceTime());
vo.setCommentTimes(userComment.getCreateTime());
vo.setId(userComment.getId());
vo.setText(userComment.getCommentText());
vo.setUpCount(userComment.getUpCount());
vo.setParentId(userComment.getParentId());
ContentFrontVo moblie = contentFrontService.initMobileVo(new ContentFrontVo(),
userComment.getContent());
vo.setMobileContent(moblie);
vo.setHeadImage(user.getHeadImage());
if (likes.contains(userComment.getId())) {
vo.setLike(true);
} else {
vo.setLike(false);
}
vos.add(vo);
integers.add(userComment.getId());
}
if (!integers.isEmpty()) {
//得到回复我的
List<UserComment> reply = dao.getInteractions(null, null, null, integers);
for (UserComment userComment : reply) {
UserInteractionMoblieVo vo = new UserInteractionMoblieVo();
vo.setCommentTime(userComment.getDistanceTime());
vo.setCommentTimes(userComment.getCreateTime());
vo.setId(userComment.getId());
vo.setText(userComment.getCommentText());
vo.setType(UserInteractionVo.TYPE_3);
vo.setUsername(userComment.getUser() != null
? userComment.getUser().getUsername()
: "");
vo.setUpCount(userComment.getUpCount());
vo.setParentId(userComment.getParentId());
ContentFrontVo moblie = contentFrontService.initMobileVo(new ContentFrontVo(),
userComment.getContent());
vo.setMobileContent(moblie);
vo.setReplyUsername(user.getUsername());
vo.setHeadImage(userComment.getUser() != null
? userComment.getUser().getHeadImage()
: "");
if (likes.contains(userComment.getId())) {
vo.setLike(true);
} else {
vo.setLike(false);
}
vos.add(vo);
}
}
PageImpl<UserInteractionMoblieVo> page = null;
if (!vos.isEmpty()) {
vos = vos.stream().sorted(Comparator.comparing(UserInteractionMoblieVo::getCommentTimes)
.reversed())
.collect(Collectors.toList());
Integer sum = vos.size();
vos = vos.stream()
.skip(pageable.getPageSize() * (pageable.getPageNumber()))
.limit(pageable.getPageSize()).collect(Collectors.toList());
page = new PageImpl<UserInteractionMoblieVo>(vos,pageable, sum);
} else {
page = new PageImpl<UserInteractionMoblieVo>(vos,pageable,vos.size());
}
return page;
}
@Override
public List<UserComment> getListByReplyCommentId(List<Integer> ids) {
return dao.findByReplyCommentIdInAndHasDeleted(ids, false);
}
@Override
public ResponseInfo clear(Integer userId) throws GlobalException {
List<Integer> integers = new ArrayList<Integer>(10);
List<UserComment> sum = new ArrayList<UserComment>(10);
//查询我评论和回复的列表
List<UserComment> list = dao.getInteractions(null, null, userId, null);
if (!list.isEmpty()) {
integers = list.stream().map(UserComment::getId).collect(Collectors.toList());
sum.addAll(list);
}
if (!integers.isEmpty()) {
//得到回复我的
List<UserComment> reply = dao.getInteractions(null, null, null, integers);
sum.addAll(reply);
}
super.delete(sum);
return new ResponseInfo();
}
@Override
public String getVersionArea(String ip) {
StringBuffer buffer = new StringBuffer();
// 省份
String province = null;
// 市区
String city = null;
Location location = null;
AdInfo adInfo = null;
try {
location = addressService.getAddressByIP(ip);
} catch (Exception e) {
e.printStackTrace();
}
if (location != null && location.getResult() != null) {
adInfo = location.getResult().getAdInfo();
province = adInfo.getProvince();
if (StringUtils.isNotBlank(province)) {
buffer.append(province);
city = adInfo.getCity();
if (StringUtils.isNotBlank(city)) {
buffer.append("-").append(city);
}
} else {
buffer.append("其它");
}
} else {
buffer.append("其它");
}
return buffer.toString();
}
@Autowired
private SysBlackListService sListService;
@Autowired
private ContentService contentService;
@Autowired
private ContentFrontService contentFrontService;
@Autowired
private UserCommentReportService commentReportService;
@Autowired
private MemberScoreDetailsService memberScoreDetailsService;
@Autowired
private CoreUserService coreUserService;
@Autowired
private AddressService addressService;
} | [
"2638177992@qq.com"
] | 2638177992@qq.com |
913d614698aa435c7f3d19880d363a3558951bc6 | 1c7c8ad55f66ed20e31e514d1b6ad6ec4cf8b7e5 | /Amazing Numbers/task/src/numbers/Application.java | 8500a4a0d63fb6335147e434a5a1aff8667d5603 | [] | no_license | huberto-88/Amazing_Numbers | 25302e1cfa7e31b0a00409f6aea45ed21567828c | 2ef0d6b00a7431658bb52984820da6dc56785ef0 | refs/heads/master | 2023-08-26T17:55:42.950789 | 2021-10-22T21:57:17 | 2021-10-22T21:57:17 | 419,361,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,460 | java | package numbers;
import java.util.*;
import java.util.function.LongPredicate;
public class Application {
private final Scanner scanner = new Scanner(System.in);
public void runApplication() {
displayInfo();
while (true) {
System.out.println("Enter a request:");
try {
String[] input = scanner.nextLine().split("\\s+");
int howMany = 0;
long number = Long.parseLong(input[0]);
List<String> requestsWanted = new ArrayList<>();
List<String> requestsUnwanted = new ArrayList<>();
if (input.length > 1) {
howMany = Integer.parseInt(input[1]);
}
Validator.isNumberCorrect(number, howMany);
if (number == 0) {
System.out.println("Goodbye!");
break;
}
if (input.length > 2) {
for (int i = 2; i < input.length; i++) {
if (input[i].contains("-")) {
requestsUnwanted.add(input[i].replaceFirst("-", "").toLowerCase());
} else {
requestsWanted.add(input[i].toLowerCase());
}
}
Validator.validateRequests(requestsWanted, requestsUnwanted);
}
displayInfoNumbers(number, howMany, requestsWanted, requestsUnwanted);
} catch (InputMismatchException | WrongRequestException | MutualRequestException | NotNaturalNumberException e) {
System.out.println(e.getMessage());
}
System.out.println();
}
}
private void displayInfoNumbers(long number, int howMany, List<String> requestsWanted, List<String> requestsUnwanted) {
if (!requestsWanted.isEmpty() || !requestsUnwanted.isEmpty()) {
List<LongPredicate> predicatesWanted = new ArrayList<>();
List<LongPredicate> predicatesUnwanted = new ArrayList<>();
requestsWanted.forEach(request -> predicatesWanted.add(getPredicate(request)));
requestsUnwanted.forEach(request -> predicatesUnwanted.add(getPredicate(request)));
NumbersProperties.displayByRequest(number, howMany, predicatesWanted, predicatesUnwanted);
} else if (howMany > 0){
NumbersProperties.displayInfoAboutListOfNumbers(number, howMany);
} else if (howMany == 0) {
NumbersProperties.displayInfoAboutOneNumber(number);
}
}
private LongPredicate getPredicate(String request) {
switch (request) {
case "even":
return NumbersProperties.checkIsEven;
case "odd":
return NumbersProperties.checkIsOdd;
case "buzz":
return NumbersProperties.checkIsBuzz;
case "duck":
return NumbersProperties.checkIsDuck;
case "palindromic":
return NumbersProperties.checkIsPalindromic;
case "gapful":
return NumbersProperties.checkIsGapful;
case "spy":
return NumbersProperties.checkIsSpy;
case "square":
return NumbersProperties.checkIsSquare;
case "sunny":
return NumbersProperties.checkIsSunny;
case "jumping":
return NumbersProperties.checkIsJumping;
case "happy":
return NumbersProperties.checkIsHappy;
case "sad":
return NumbersProperties.checkIsSad;
}
return null;
}
public void displayInfo() {
System.out.println("Welcome to Amazing Numbers!");
System.out.println("Supported requests:\n" +
"- enter a natural number to know its properties;\n" +
"- enter two natural numbers to obtain the properties of the list:\n" +
" * the first parameter represents a starting number;\n" +
" * the second parameter shows how many consecutive numbers are to be processed;\n" +
"- two natural numbers and properties to search for;\n" +
"- a property preceded by minus must not be present in numbers;\n" +
"- separate the parameters with one space;\n" +
"- enter 0 to exit.");
}
} | [
"87725943+huberto-88@users.noreply.github.com"
] | 87725943+huberto-88@users.noreply.github.com |
de0b8505da7810d412d1d11ef64b0e8f934e5ceb | 68d452c0fce36f1441f8066ade495821001b2d2f | /edgeService/src/main/java/org/sbgroup/petproject/edgeService/CurrencyExchangeServiceProxy.java | 4a8643be75776ec93de6459ec76731da1edab0c5 | [] | no_license | sergiyblazhievsky/microservicePetProject | ce77c5ea61d5e0cc16da6b28cb98cdff796ee500 | ce9665f86b4fd034b344970458f3e478ad50c719 | refs/heads/master | 2020-06-27T20:47:43.985072 | 2019-10-09T08:32:00 | 2019-10-09T08:32:00 | 200,045,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | package org.sbgroup.petproject.edgeService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@FeignClient(name="rates-service", url="localhost:8000")
public interface CurrencyExchangeServiceProxy
{
@GetMapping("/currency-exchange/from/{from}/to/{to}")
public CurrencyConversionBean retrieveExchangeValue
(@PathVariable("from") String from, @PathVariable("to") String to);
} | [
"cnews.sb@gmail.com"
] | cnews.sb@gmail.com |
2acbfad398dc66335ca80348c2c0d15c79b09dca | 97285584b19bb63ced550a540621a2fbc388b08f | /Test/src/testProxy/inter/Service.java | b2f82ce1a4cc5ed54cc5d0137986633e556134f7 | [] | no_license | 969489829/ocean | 379b5e81ede5ebd943cac822ac8edfa4ce46e1cb | 18af2c64eb4876d300fe8ef155de6bb9ed5fddb9 | refs/heads/master | 2020-04-05T17:31:11.580572 | 2019-01-10T08:43:13 | 2019-01-10T08:43:13 | 157,064,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | package testProxy.inter;
public class Service implements Iservice{
@Override
public void test(String str) {
System.out.println("呵呵"+str);
test1();
}
@Override
public void test1() {
System.out.println("啧啧");
}
}
| [
"969489829@qq.com"
] | 969489829@qq.com |
865767da96ac233096a7233d713cf0c2f948e4c0 | 277fbc5a986e0830a8c5a1164b70f37897350a2b | /Game with shapes/Main.java | 1e4323375f8e76c0523cc49d2fba31c2320989e8 | [] | no_license | Kowsha/Playground | b47623d41adb983e532404b3e5f6cc7128068713 | 780f976a6be7b226e3a20144cf7974726fb10f12 | refs/heads/master | 2022-11-23T22:26:16.393372 | 2020-07-30T07:56:29 | 2020-07-30T07:56:29 | 269,032,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | #include<iostream>
using namespace std;
int main()
{
int r,s;
cin>>r;
cin>>s;
if(s>=(r+r))
cout<<"Circle can be inside a square";
else
cout<<"Circle cannot be inside a square";
} | [
"66357381+Kowsha@users.noreply.github.com"
] | 66357381+Kowsha@users.noreply.github.com |
375ba4b0a095cef6983aa3f721140aeeeae3c374 | 2ad5d4e56ebbfef4bf23952d3d22fc4c60e24ac7 | /app/src/test/java/com/blogspot/riteshcodejava/savethenote/ExampleUnitTest.java | 0f3d778a1381aa0b984354e56bfb17c51fd1ae90 | [] | no_license | riteshreg/saveTheNote | 68e8a4b5506a84c7adf59735761f7634877eb829 | 06a2706d5c67f65cdab0e1c1ea9de361c7a27f16 | refs/heads/main | 2023-02-11T09:57:11.987120 | 2021-01-15T03:39:16 | 2021-01-15T03:39:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package com.blogspot.riteshcodejava.savethenote;
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);
}
} | [
"riteshregmi85@gmail.com"
] | riteshregmi85@gmail.com |
0446e0bc323e84405be8c31717067264dfbe27d2 | 9a3c3b319df8337399ffb7be095eee7054cd3a04 | /src/main/java/com/aeione/ops/pageobjects/ProfilePageObjects.java | 0417d6fd57f30825c3f22107513a82b43733031a | [] | no_license | gandharva-aeione/onepagespotlight | 7f81f456ba9b831b602b299ba201729889f65fff | 159a1bb7ec37c82814c2655442a994e6eb7d1dad | refs/heads/master | 2023-06-02T16:59:47.549029 | 2021-06-07T06:19:44 | 2021-06-07T06:19:44 | 291,016,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,109 | java | package com.aeione.ops.pageobjects;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class ProfilePageObjects {
@FindBy(id = "topbar-dropdown-view-Profile")
public WebElement viewProfile_Link;
@FindBy(id = "sidebar-avatar-name")
public WebElement fullName_sidebar;
@FindBy(xpath="//div[contains(@class,'text-lg f500')]")
public WebElement fullName_ProfileDropdown;
@FindBy(id = "sidebar-portfolio")
public WebElement portfolio_Button;
@FindBy( xpath = "//*[@class='o-portfolio-profile__details']//h4")
public WebElement portfolioPage_Header;
@FindBy(id = "avatar-image-edit")
public WebElement editProfilePicture_Icon;
@FindBy(id = "image-croper-apply-button")
public WebElement editPicture_ApplyButton;
@FindBy(id = "image-croper-title")
public WebElement editProfilePicture_Header;
@FindBy(id = "sidebar-about-user")
public WebElement aboutSection_Header;
@FindBy(id = "sidebar-user-description")
public WebElement aboutDescription_ProfileCard;
@FindBy(id="sidebar-icon-edit-profile")
public WebElement editIcon_AboutSection;
@FindBy(id = "sidebar-location")
public WebElement location_ProfileCard;
@FindBy(id = "sidebar-email")
public WebElement email_ProfileCard;
@FindBy(id = "sidebar-phone-number")
public WebElement phoneNumber_ProfileCard;
@FindBy(id = "sidebar-website")
public WebElement website_ProfileCard;
@FindBy(id = "sidebar-user-height")
public WebElement height_ProfileCard;
@FindBy(id = "sidebar-user-weight")
public WebElement weight_ProfileCard;
@FindBy(id = "sidebar-languages-known")
public WebElement languagesKnown_ProfileCard;
@FindBy(id = "post-menu-dropdown")
public WebElement hashtag_Dropdown;
@FindBy(id = "channel-event-showtimez-tab")
public WebElement eventTab_ProfilePage;
@FindBy(id = "activity-opportunity-title")
public WebElement opportunityTitle_OpportunityTab;
}
| [
"gandharva.kr@aeione.com"
] | gandharva.kr@aeione.com |
fb1acb3dfe6a035886ce004bc20f713cdfaeca3c | 7c4c2011d97d6f2ad81a2a74fc50e34b409b9779 | /JavaAndroid/AutoBoxingandUnboxing/src/com/juhuyoon/Main.java | a79209f042207700e1c8974a4df64e2540866f70 | [
"MIT"
] | permissive | juhuyoon/codeLibrary | f001982baa94bc12bae8f40d2411ae97c1966337 | 4a964a2d326772659715f9fdd807a91f480642f8 | refs/heads/master | 2023-01-11T07:25:24.651877 | 2020-07-23T03:23:38 | 2020-07-23T03:23:38 | 121,058,856 | 14 | 18 | null | 2023-01-03T15:39:12 | 2018-02-10T22:12:00 | Java | UTF-8 | Java | false | false | 1,319 | java | package com.juhuyoon;
import java.lang.reflect.Array;
import java.util.ArrayList;
class IntClass {
private int myValue;
public IntClass(int myValue) {
this.myValue = myValue;
}
public int getMyValue() {
return myValue;
}
public void setMyValue(int myValue) {
this.myValue = myValue;
}
}
public class Main {
public static void main(String[] args) {
String[] strArray = new String[10];
int[] intArray = new int[10];
ArrayList<String> strArrayList = new ArrayList<String>();
strArrayList.add("Tim");
//ArrayList<int> intArrayList = new ArrayList<int>(); Runs into issues here as int is a primitive type.
ArrayList<IntClass> intClassArrayList = new ArrayList<IntClass>();
intClassArrayList.add(new IntClass(54));
Integer integer = new Integer(54);
Double doubleValue = new Double(12.25);
ArrayList<Integer> intArrayList = new ArrayList<Integer>();
for(int i = 0; i <= 10; i++) {
intArrayList.add(Integer.valueOf(i)); //taking the value of i as a primitive type
//and then converting it to Integer class.
}
for(int i = 0; i <= 10; i++) {
System.out.println(i + " ->" + intArray.get(i).intValue());
}
}
}
| [
"juhuyoon@yahoo.com"
] | juhuyoon@yahoo.com |
5ec65e0716255df087dd226bdefd71964f7c9a50 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/org/apache/hadoop/hdfs/TestFileConcurrentReader.java | e56738a10910b3ea5c9511b54b9be3936d6f64e9 | [] | 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 | 7,847 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hdfs;
import DFSConfigKeys.DFS_BLOCK_SIZE_KEY;
import LeaseManager.LOG;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.StringUtils;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.event.Level;
/**
* This class tests the cases of a concurrent reads/writes to a file;
* ie, one writer and one or more readers can see unfinsihed blocks
*/
public class TestFileConcurrentReader {
private enum SyncType {
SYNC,
APPEND;}
private static final Logger LOG = Logger.getLogger(TestFileConcurrentReader.class);
{
GenericTestUtils.setLogLevel(LeaseManager.LOG, Level.TRACE);
GenericTestUtils.setLogLevel(FSNamesystem.LOG, Level.TRACE);
GenericTestUtils.setLogLevel(DFSClient.LOG, Level.TRACE);
}
static final long seed = 3735928559L;
static final int blockSize = 8192;
private static final int DEFAULT_WRITE_SIZE = 1024 + 1;
private static final int SMALL_WRITE_SIZE = 61;
private Configuration conf;
private MiniDFSCluster cluster;
private FileSystem fileSystem;
/**
* Test that that writes to an incomplete block are available to a reader
*/
@Test(timeout = 30000)
public void testUnfinishedBlockRead() throws IOException {
// create a new file in the root, write data, do no close
Path file1 = new Path("/unfinished-block");
FSDataOutputStream stm = TestFileCreation.createFile(fileSystem, file1, 1);
// write partial block and sync
int partialBlockSize = (TestFileConcurrentReader.blockSize) / 2;
writeFileAndSync(stm, partialBlockSize);
// Make sure a client can read it before it is closed
checkCanRead(fileSystem, file1, partialBlockSize);
stm.close();
}
/**
* test case: if the BlockSender decides there is only one packet to send,
* the previous computation of the pktSize based on transferToAllowed
* would result in too small a buffer to do the buffer-copy needed
* for partial chunks.
*/
@Test(timeout = 30000)
public void testUnfinishedBlockPacketBufferOverrun() throws IOException {
// check that / exists
Path path = new Path("/");
System.out.println((("Path : \"" + (path.toString())) + "\""));
// create a new file in the root, write data, do no close
Path file1 = new Path("/unfinished-block");
final FSDataOutputStream stm = TestFileCreation.createFile(fileSystem, file1, 1);
// write partial block and sync
final int bytesPerChecksum = conf.getInt("io.bytes.per.checksum", 512);
final int partialBlockSize = bytesPerChecksum - 1;
writeFileAndSync(stm, partialBlockSize);
// Make sure a client can read it before it is closed
checkCanRead(fileSystem, file1, partialBlockSize);
stm.close();
}
// use a small block size and a large write so that DN is busy creating
// new blocks. This makes it almost 100% sure we can reproduce
// case of client getting a DN that hasn't yet created the blocks
@Test(timeout = 30000)
public void testImmediateReadOfNewFile() throws IOException {
final int blockSize = 64 * 1024;
final int writeSize = 10 * blockSize;
Configuration conf = new Configuration();
conf.setLong(DFS_BLOCK_SIZE_KEY, blockSize);
init(conf);
final int requiredSuccessfulOpens = 100;
final Path file = new Path("/file1");
final AtomicBoolean openerDone = new AtomicBoolean(false);
final AtomicReference<String> errorMessage = new AtomicReference<String>();
final FSDataOutputStream out = fileSystem.create(file);
final Thread writer = new Thread(new Runnable() {
@Override
public void run() {
try {
while (!(openerDone.get())) {
out.write(DFSTestUtil.generateSequentialBytes(0, writeSize));
out.hflush();
}
} catch (IOException e) {
TestFileConcurrentReader.LOG.warn("error in writer", e);
} finally {
try {
out.close();
} catch (IOException e) {
TestFileConcurrentReader.LOG.error("unable to close file");
}
}
}
});
Thread opener = new Thread(new Runnable() {
@Override
public void run() {
try {
for (int i = 0; i < requiredSuccessfulOpens; i++) {
fileSystem.open(file).close();
}
openerDone.set(true);
} catch (IOException e) {
openerDone.set(true);
errorMessage.set(String.format("got exception : %s", StringUtils.stringifyException(e)));
} catch (Exception e) {
openerDone.set(true);
errorMessage.set(String.format("got exception : %s", StringUtils.stringifyException(e)));
writer.interrupt();
Assert.fail("here");
}
}
});
writer.start();
opener.start();
try {
writer.join();
opener.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
Assert.assertNull(errorMessage.get(), errorMessage.get());
}
// for some reason, using tranferTo evokes the race condition more often
// so test separately
@Test(timeout = 30000)
public void testUnfinishedBlockCRCErrorTransferTo() throws IOException {
runTestUnfinishedBlockCRCError(true, TestFileConcurrentReader.SyncType.SYNC, TestFileConcurrentReader.DEFAULT_WRITE_SIZE);
}
@Test(timeout = 30000)
public void testUnfinishedBlockCRCErrorTransferToVerySmallWrite() throws IOException {
runTestUnfinishedBlockCRCError(true, TestFileConcurrentReader.SyncType.SYNC, TestFileConcurrentReader.SMALL_WRITE_SIZE);
}
@Test(timeout = 30000)
public void testUnfinishedBlockCRCErrorNormalTransfer() throws IOException {
runTestUnfinishedBlockCRCError(false, TestFileConcurrentReader.SyncType.SYNC, TestFileConcurrentReader.DEFAULT_WRITE_SIZE);
}
@Test(timeout = 30000)
public void testUnfinishedBlockCRCErrorNormalTransferVerySmallWrite() throws IOException {
runTestUnfinishedBlockCRCError(false, TestFileConcurrentReader.SyncType.SYNC, TestFileConcurrentReader.SMALL_WRITE_SIZE);
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
44b78db15f83bf1c6d07d17f151a3d9feec8b1db | 659ebefc3d687f4c4450d034afee046013ad8081 | /app/src/main/java/com/lrs/livepushapplication/base/BaseAdapter.java | ba0c8b1c8ef3cfef30c2df237dd15af866182a6d | [] | no_license | lurongshuang/LivePushApplication | efcf79c4d854378836dec58da506393159d6c896 | 7d0d8db665e0f4a55d20d1f3e37629cd5f80e32d | refs/heads/master | 2022-04-20T07:52:01.910610 | 2020-04-21T07:12:52 | 2020-04-21T07:12:52 | 257,507,061 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,074 | java | package com.lrs.livepushapplication.base;
import android.content.Context;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lrs.livepushapplication.base.interfaceOnclick.OnAdapterOnclick;
/**
* create by lrs 2019/10/12
*/
public abstract class BaseAdapter<T> extends BaseQuickAdapter<T, BaseViewHolder> {
private BaseViewHolder helper;
public Context Mcontext;
public BaseAdapter(int layoutResId, Context context) {
super(layoutResId);
this.Mcontext = context;
}
@Override
protected void convert(BaseViewHolder helper, T item) {
itemInit(helper, item);
}
/**
* 初始化item
* @param helper 1
* @param item 2
*/
protected abstract void itemInit(BaseViewHolder helper, T item);
//点击事件
public OnAdapterOnclick iadapterOnclick;
public void setAdapterItemOnclick(OnAdapterOnclick adapterItemOnclick) {
iadapterOnclick = adapterItemOnclick;
}
}
| [
"13269779672@163.com"
] | 13269779672@163.com |
911f46612fe2b0717db83bbbe01cf755da665960 | 7792449b077a0e114074547d12583c758fbeda0d | /src/com/imooc/dacheche/net/proccesors/DriverProccesor.java | 59f6d5fb8f1b4b0173dfdca00dc92ffc68d06339 | [] | no_license | anhui3713/dacheche_server | f56173e2d3067e77e900ed58258ba04a64c6a98e | ffdd5f1b006821abcc1d638c95777e9f2030f1fc | refs/heads/master | 2021-01-10T18:46:14.810668 | 2015-03-13T23:22:55 | 2015-03-13T23:22:55 | 32,056,843 | 5 | 3 | null | null | null | null | GB18030 | Java | false | false | 3,383 | java | package com.imooc.dacheche.net.proccesors;
import java.sql.SQLException;
import java.util.List;
import com.imooc.dacheche.bean.ClientMessage;
import com.imooc.dacheche.bean.Log;
import com.imooc.dacheche.bean.RequestMessage;
import com.imooc.dacheche.bean.ServerMessage;
import com.imooc.dacheche.bean.User;
import com.imooc.dacheche.common.OutUtils;
import com.imooc.dacheche.common.Utils;
import com.imooc.dacheche.dao.LogDao;
import com.imooc.dacheche.net.MessagePoccesor;
import com.imooc.dacheche.net.MessageTransfer;
import com.imooc.dacheche.net.Server;
public class DriverProccesor implements MessagePoccesor {
private MessageTransfer mt;
private LogDao logDao = new LogDao();
public DriverProccesor(MessageTransfer mt) {
super();
this.mt = mt;
}
@Override
public void proccess(ClientMessage msg) {
switch(msg.getCommand()) {
// 司机请求载客
case ClientMessage.GET_ORDER: getOrder(msg); break;
// 司机获取历史消息
case ClientMessage.GET_HISTORY: requestHistory(msg); break;
// 司机请求搭载指定乘客
case ClientMessage.REQUEST_ORDER: requestPassenger(msg); break;
// 司机请求确认是否到达终点
case ClientMessage.REQUEST_DONE: confirmDone(msg); break;
}
}
/**
* 司机请求查看载客历史记录
* @param msg
*/
private void requestHistory(ClientMessage msg) {
ServerMessage sm = new ServerMessage();
sm.setState(ServerMessage.HISTORY);
try {
List<Log> logs = logDao.listLogs(mt.getUser().getName());
sm.setObjMsg(logs);
} catch (SQLException e) {
sm.setState(ServerMessage.HISTORY_EXCEPTION);
OutUtils.outMsg("查询失败:" + e.getMessage());
}
mt.sendMessage(sm);
}
/**
* 司机确认已经到达终点
* @param msg
*/
private void confirmDone(ClientMessage msg) {
User passenger = msg.getReceiver();
MessageTransfer tmt = Server.getServer().getMt(passenger.getId());
ServerMessage sm = new ServerMessage();
sm.setState(ServerMessage.REQUEST_DONE);
sm.setDriver(mt.getUser());
tmt.sendMessage(sm);
}
/**
* 司机请求搭乘指定乘客
* @param msg
*/
private void requestPassenger(ClientMessage msg) {
// 根据消息id找到对应的用户和消息处理对象
String id = msg.getMessage();
RequestMessage rm = Server.getServer().getReqMsg(id);
if(rm != null) {
// 如果正在等待乘客回应其他司机,则等100毫秒之后在做请求
if(!rm.isProccesing()) {
MessageTransfer mp = Server.getServer().getMt(rm.getUser().getId());
// 构造消息通过消息处理对象发送到对应的乘客
ServerMessage sm = new ServerMessage();
sm.setDriver(mt.getUser());
sm.setState(ServerMessage.DRIVER_REQUEST);
rm.setProccesing(true);
mp.sendMessage(sm);
} else {
Utils.sleep(100);
requestPassenger(msg);
}
} else {
// 返回没找到当前消息
ServerMessage sm = new ServerMessage();
sm.setDriver(mt.getUser());
sm.setState(ServerMessage.ORDER_NOT_FOUND);
mt.sendMessage(sm);
}
}
/**
* 司机请求载客
* @param msg
*/
private void getOrder(ClientMessage msg) {
//RequestMessage[] rms = Server.getServer().listReqMsgs();
RequestMessage rm = Server.getServer().getReqMsg();
ServerMessage sm = new ServerMessage();
sm.setObjMsg(rm);
sm.setState(ServerMessage.ORDER_LIST);
mt.sendMessage(sm);
}
}
| [
"90683@163.com"
] | 90683@163.com |
8eb7dd4278eaae333ff8a887ca69c9c812579535 | 8520019a70f69ad08e0aff8c679db669fa925b73 | /src/test/java/dev/sangco/book/springboot/domain/posts/PostsRepositoryTest.java | 2994450ce43f95b90c30197d4b2e3dad3cf1f0d1 | [] | no_license | SANGCO/freelec-springboot2-webservice-sangco | 0e077388dec907f6a4ce6953253f02e118e3960d | 7e2424886c1062ab37569e742aca48a4e3702cc2 | refs/heads/master | 2023-01-15T12:31:10.005846 | 2020-11-25T14:34:00 | 2020-11-25T14:34:00 | 315,801,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,089 | java | package dev.sangco.book.springboot.domain.posts;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.time.LocalDateTime;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest
public class PostsRepositoryTest {
@Autowired
private PostsRepository postsRepository;
@After
public void cleanUp() {
postsRepository.deleteAll();
}
@Test
public void 게시글저장_불러오기() throws Exception {
// Given
String title = "테스트 게시글";
String content = "테스트 본문";
postsRepository.save(Posts.builder()
.title(title)
.content(content)
.author("sangco@gmail.com")
.build());
// When
List<Posts> postsList = postsRepository.findAll();
// Then
Posts posts = postsList.get(0);
assertThat(posts.getTitle()).isEqualTo(title);
assertThat(posts.getContent()).isEqualTo(content);
}
@Test
public void BaseTimeEntity_등록() throws Exception {
// Given
LocalDateTime now = LocalDateTime.of(2019, 6, 4, 0, 0, 0);
postsRepository.save(Posts.builder()
.title("title")
.content("content")
.author("author")
.build());
// When
List<Posts> postsList = postsRepository.findAll();
// Then
Posts posts = postsList.get(0);
System.out.println(">>>>>>>>> createDate=" + posts.getCreatedDate() +
", modifiedDate=" + posts.getModifiedDate());
assertThat(posts.getCreatedDate()).isAfter(now);
assertThat(posts.getModifiedDate()).isAfter(now);
}
} | [
"nsg1213@gmail.com"
] | nsg1213@gmail.com |
2d6addf96872700b08917ce6ad95fc75726b2514 | b27807c661de0ecee2cee0867bf9357efcc2dae9 | /15. Sort Colors/Sort Colors.java | 938dc049bd33bf223f2f32796ce67c17cd71e0db | [] | no_license | baisha1990/Algorithms | 0c14299f5a5de2d8318e510d9adbc281804692d7 | d52c8039f619109b5d3fd9b65f3df1033f55a7bb | refs/heads/master | 2023-07-31T14:56:15.359950 | 2021-09-23T06:56:42 | 2021-09-23T06:56:42 | 379,152,925 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | /* Given an array containing 0s, 1s and 2s, sort the array in-place. You
should treat numbers of the array as objects, hence, we can’t count 0s, 1s, and 2s to
recreate the array. */
class Solution {
public void sortColors(int[] nums) {
int l = 0, high = nums.length - 1;
for(int i = 0; i <= high;) {
if(nums[i] == 0) {
swap(nums, i, l);
i++;
l++;
} else if(nums[i] == 1) {
i++;
} else {
swap(nums, i, high);
high--;
}
}
}
public void swap(int[] nums, int i, int j) {
int temp;
temp = nums[i];
nums[i] = nums[j];
nums[j] = temp;
}
} | [
"baisha1990@gmail.com"
] | baisha1990@gmail.com |
56ff7169e6e0dbc09abee6c85adb89def52eb549 | 5441097fe497cd17f866d1a4b457bc61026217fc | /app/src/main/java/com/example/messangergame/Server.java | ee46cd94bfa3ae09d297703a79a8b94203f5697f | [] | no_license | ThePlayCraftProject/MessangerGame | 5eefbb4e0197be19a14846a9c28b7a3c0c009900 | 97f941845ea46c2206f401775acc183032c301bb | refs/heads/master | 2020-05-05T09:48:03.063471 | 2019-05-18T00:32:10 | 2019-05-18T00:32:10 | 179,917,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,423 | java | package com.example.messangergame;
public class Server {
public static final int ONLINE = 1;
public static final int OFFLINE = -1;
public static final int UNDEFINED = 0;
private String name;
private String ip;
private int port;
private int querryPort = 25566;
private Checker checker;
private long id;
public int online = UNDEFINED;
public int players = 0;
public int max = 0;
public Server(String name, String ip, int port) {
this.name = name;
this.ip = ip;
this.port = port;
}
public Server(long id, String name, String ip, int port) {
this(name, ip, port);
this.id = id;
}
public boolean isHavingChecker() {
return checker != null;
}
public void setChecker(Checker checker) {
if (this.checker != null) {
this.checker.askToStop();
this.checker.interrupt();
this.checker = null;
}
this.checker = checker;
}
public void setId(long id) {
this.id = id;
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public String getIp() {
return ip;
}
public int getPort() {
return port;
}
public void stop() {
if (checker != null) {
checker.askToStop();
checker = null;
}
}
}
| [
"seregakkkk999@yandex.ru"
] | seregakkkk999@yandex.ru |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.