blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
15b0e94c182accb0e597677bddd036224e32465a
66fa0ab7de46d9cf9cb32e654a8c35127a87943a
/src/main/java/com/wondertek/core/util/Algorithms/Huffman.java
f08557b332752f26326e2057bc7211cfc182aa6e
[]
no_license
zbcstudy/commons-util
b8f3c4730f865c0bdc3bbc78c8cdad0c65ef4ba7
afd0f6a3eb6ad5afb0ea6e5eebb3ffb19bc59a6a
refs/heads/master
2020-04-23T15:49:49.697195
2019-04-01T15:02:23
2019-04-01T15:02:23
171,277,858
0
0
null
null
null
null
UTF-8
Java
false
false
7,919
java
/****************************************************************************** * Compilation: javac Huffman.java * Execution: java Huffman - < input.txt (compress) * Execution: java Huffman + < input.txt (expand) * Dependencies: BinaryIn.java BinaryOut.java * Data files: https://algs4.cs.princeton.edu/55compression/abra.txt * https://algs4.cs.princeton.edu/55compression/tinytinyTale.txt * https://algs4.cs.princeton.edu/55compression/medTale.txt * https://algs4.cs.princeton.edu/55compression/tale.txt * * Compress or expand a binary input stream using the Huffman algorithm. * * % java Huffman - < abra.txt | java BinaryDump 60 * 010100000100101000100010010000110100001101010100101010000100 * 000000000000000000000000000110001111100101101000111110010100 * 120 bits * * % java Huffman - < abra.txt | java Huffman + * ABRACADABRA! * ******************************************************************************/ package com.wondertek.core.util.Algorithms; /** * The {@code Huffman} class provides static methods for compressing * and expanding a binary input using Huffman codes over the 8-bit extended * ASCII alphabet. * <p> * For additional documentation, * see <a href="https://algs4.cs.princeton.edu/55compression">Section 5.5</a> of * <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public class Huffman { // alphabet size of extended ASCII private static final int R = 256; // Do not instantiate. private Huffman() { } // Huffman trie node private static class Node implements Comparable<Node> { private final char ch; private final int freq; private final Node left, right; Node(char ch, int freq, Node left, Node right) { this.ch = ch; this.freq = freq; this.left = left; this.right = right; } // is the node a leaf node? private boolean isLeaf() { assert ((left == null) && (right == null)) || ((left != null) && (right != null)); return (left == null) && (right == null); } // compare, based on frequency public int compareTo(Node that) { return this.freq - that.freq; } } /** * Reads a sequence of 8-bit bytes from standard input; compresses them * using Huffman codes with an 8-bit alphabet; and writes the results * to standard output. */ public static void compress() { // read the input String s = BinaryStdIn.readString(); char[] input = s.toCharArray(); // tabulate frequency counts int[] freq = new int[R]; for (int i = 0; i < input.length; i++) freq[input[i]]++; // build Huffman trie Node root = buildTrie(freq); // build code table String[] st = new String[R]; buildCode(st, root, ""); // print trie for decoder writeTrie(root); // print number of bytes in original uncompressed message BinaryStdOut.write(input.length); // use Huffman code to encode input for (int i = 0; i < input.length; i++) { String code = st[input[i]]; for (int j = 0; j < code.length(); j++) { if (code.charAt(j) == '0') { BinaryStdOut.write(false); } else if (code.charAt(j) == '1') { BinaryStdOut.write(true); } else throw new IllegalStateException("Illegal state"); } } // close output stream BinaryStdOut.close(); } // build the Huffman trie given frequencies private static Node buildTrie(int[] freq) { // initialze priority queue with singleton trees MinPQ<Node> pq = new MinPQ<Node>(); for (char i = 0; i < R; i++) if (freq[i] > 0) pq.insert(new Node(i, freq[i], null, null)); // special case in case there is only one character with a nonzero frequency if (pq.size() == 1) { if (freq['\0'] == 0) pq.insert(new Node('\0', 0, null, null)); else pq.insert(new Node('\1', 0, null, null)); } // merge two smallest trees while (pq.size() > 1) { Node left = pq.delMin(); Node right = pq.delMin(); Node parent = new Node('\0', left.freq + right.freq, left, right); pq.insert(parent); } return pq.delMin(); } // write bitstring-encoded trie to standard output private static void writeTrie(Node x) { if (x.isLeaf()) { BinaryStdOut.write(true); BinaryStdOut.write(x.ch, 8); return; } BinaryStdOut.write(false); writeTrie(x.left); writeTrie(x.right); } // make a lookup table from symbols and their encodings private static void buildCode(String[] st, Node x, String s) { if (!x.isLeaf()) { buildCode(st, x.left, s + '0'); buildCode(st, x.right, s + '1'); } else { st[x.ch] = s; } } /** * Reads a sequence of bits that represents a Huffman-compressed message from * standard input; expands them; and writes the results to standard output. */ public static void expand() { // read in Huffman trie from input stream Node root = readTrie(); // number of bytes to write int length = BinaryStdIn.readInt(); // decode using the Huffman trie for (int i = 0; i < length; i++) { Node x = root; while (!x.isLeaf()) { boolean bit = BinaryStdIn.readBoolean(); if (bit) x = x.right; else x = x.left; } BinaryStdOut.write(x.ch, 8); } BinaryStdOut.close(); } private static Node readTrie() { boolean isLeaf = BinaryStdIn.readBoolean(); if (isLeaf) { return new Node(BinaryStdIn.readChar(), -1, null, null); } else { return new Node('\0', -1, readTrie(), readTrie()); } } /** * Sample client that calls {@code compress()} if the command-line * argument is "-" an {@code expand()} if it is "+". * * @param args the command-line arguments */ public static void main(String[] args) { if (args[0].equals("-")) compress(); else if (args[0].equals("+")) expand(); else throw new IllegalArgumentException("Illegal command line argument"); } } /****************************************************************************** * Copyright 2002-2018, Robert Sedgewick and Kevin Wayne. * * This file is part of algs4.jar, which accompanies the textbook * * Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne, * Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. * http://algs4.cs.princeton.edu * * * algs4.jar is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * algs4.jar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with algs4.jar. If not, see http://www.gnu.org/licenses. ******************************************************************************/
[ "1434756304@qq.com" ]
1434756304@qq.com
33898c35436804a7cdd0d7591e673f7bd1b2b9ad
cd1efc238e3001ca2b357a1a3d22ce5d106c3c8a
/onlineshop.tests/src/main/java/com/pragmatic/shop/onlineshop/tests/App.java
40b63bb8a21038cd10254f21eeec452a783ca205
[]
no_license
DimaIV/Automation-Testing
3485f97bb890fd3b77293f7f563f5971de6da7ce
56a20877961e6b2333ec4824e2e07d8f4b615573
refs/heads/master
2021-01-18T17:27:17.835547
2017-03-31T10:33:49
2017-03-31T10:33:49
86,803,404
0
0
null
null
null
null
UTF-8
Java
false
false
125
java
package com.pragmatic.shop.onlineshop.tests; public class App { public static void main( String[] args ) { } }
[ "dima.ivanova@yahoo.com" ]
dima.ivanova@yahoo.com
37fefce6aeb0886a8e4ebd00c09137a52254a665
084fc7f3ab0b45f5d9a32c28f1645508cc8dae49
/app/src/main/java/org/maktab/homework11_maktab37/controller/fragment/TimePickerFragment.java
79ffbee70b95d5af5a2c31c8a338907c68492e7d
[]
no_license
SanaNazariNezhad/HomeWork11_Maktab37
038154718b564f76085b863446b51d3d75c25c99
d72cd4265c893b06debcd6030880d9de645165d9
refs/heads/master
2023-03-04T19:30:01.995978
2021-02-08T22:35:22
2021-02-08T22:35:22
293,842,206
0
0
null
null
null
null
UTF-8
Java
false
false
3,843
java
package org.maktab.homework11_maktab37.controller.fragment; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.widget.TimePicker; import org.maktab.homework11_maktab37.R; import java.time.LocalDateTime; import java.util.Calendar; import java.util.Date; public class TimePickerFragment extends DialogFragment { public static final String ARGS_TASK_TIME = "crimeTime"; public static final String EXTRA_USER_SELECTED_TIME = "org.maktab.homework11_maktab37.userSelectedTime"; private Date mTaskDate; private int mSecond; private TimePicker mTimePicker; private Calendar mCalendar; public TimePickerFragment() { // Required empty public constructor } public static TimePickerFragment newInstance(Date crimeDate) { TimePickerFragment fragment = new TimePickerFragment(); Bundle args = new Bundle(); args.putSerializable(ARGS_TASK_TIME, crimeDate); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTaskDate = (Date) getArguments().getSerializable(ARGS_TASK_TIME); mCalendar = Calendar.getInstance(); } @NonNull @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { LayoutInflater inflater = LayoutInflater.from(getActivity()); View view = inflater.inflate(R.layout.fragment_time_picker, null); findViews(view); initViews(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) .setTitle(R.string.time_picker_title) .setIcon(R.drawable.ic_clock) .setView(view) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { extractTimeFromTimePicker(); sendResult(mCalendar); } }) .setNegativeButton(android.R.string.cancel, null); AlertDialog dialog = builder.create(); return dialog; } private void findViews(View view) { mTimePicker = view.findViewById(R.id.time_picker_crime); } private void initViews() { initTimePicker(); } private void initTimePicker() { // i have a date and i want to set it in date picker. mCalendar.setTime(mTaskDate); int hour = mCalendar.get(Calendar.HOUR); int minute = mCalendar.get(Calendar.MINUTE); mTimePicker.setHour(hour); mTimePicker.setMinute(minute); } private void extractTimeFromTimePicker() { LocalDateTime now = LocalDateTime.now(); int hour = mTimePicker.getHour(); int minute = mTimePicker.getMinute(); int second = now.getSecond(); mCalendar.set(Calendar.HOUR_OF_DAY,hour); mCalendar.set(Calendar.MINUTE,minute); mCalendar.set(Calendar.SECOND,second); } private void sendResult(Calendar userSelectedDate) { Fragment fragment = getTargetFragment(); int requestCode = getTargetRequestCode(); int resultCode = Activity.RESULT_OK; Intent intent = new Intent(); intent.putExtra(EXTRA_USER_SELECTED_TIME, userSelectedDate); fragment.onActivityResult(requestCode, resultCode, intent); } }
[ "sana.nazari1995@gmail.com" ]
sana.nazari1995@gmail.com
6777ac6a2bd842755f9582defdaa5b01c6743f3e
af0c4995d4bf5f76a6ca283fc55dfdca4e52ca3a
/common/src/main/java/com/whaley/biz/common/exception/StatusErrorThrowable.java
9160d1288c602bc2d5a9341c638eef7eddf3cc69
[]
no_license
portal-io/portal-android
da60c4a7d54fb56fbc983c635bb1d2c4d542f78e
623757fbb4d7979745b4c8ee34cebbf395cbd249
refs/heads/master
2020-03-20T07:58:08.196164
2019-03-16T02:30:48
2019-03-16T02:30:48
137,295,692
1
0
null
null
null
null
UTF-8
Java
false
false
954
java
package com.whaley.biz.common.exception; /** * Author: qxw * Date: 2017/7/14 */ public class StatusErrorThrowable extends Exception { private int status; private Object data; private String subCode; // public StatusErrorThrowable(int status, String message) { // super(message); // this.status = status; // } public StatusErrorThrowable(int status, String msg, Object data, String subCode) { super(msg); this.status = status; this.data = data; this.subCode = subCode; } public StatusErrorThrowable(int status, String msg, Object data) { this(status, msg, data, null); } public StatusErrorThrowable(int status, String msg) { this(status, msg, null, null); } public Object getData() { return data; } public int getStatus() { return status; } public String getSubCode() { return subCode; } }
[ "lizs@snailvr.com" ]
lizs@snailvr.com
0535e01971dc01729cb712e1f6b5931054c6c6bb
01b56a5840baddc1eba73940d5ee3e2b98c02006
/app/src/main/java/com/example/discussgo/firstscreen/viewmodel/LogInVM.java
0340e08e16a66cbd68e4bca33a432d1b268170fd
[]
no_license
Sernrbia/DiscussGo-final
a45608734e0449b25259918acabc6361f3c9c4af
77ad537541f6c84c6d4a7997b305168419d8341d
refs/heads/master
2020-06-28T17:31:53.620503
2019-08-10T00:50:01
2019-08-10T00:50:01
200,297,529
0
0
null
null
null
null
UTF-8
Java
false
false
2,453
java
package com.example.discussgo.firstscreen.viewmodel; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; import com.example.discussgo.addon.Validator; import com.example.discussgo.firstscreen.network.AccessToken; import com.example.discussgo.firstscreen.repository.UserRepository; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.observers.DisposableObserver; import io.reactivex.schedulers.Schedulers; public class LogInVM extends ViewModel { private CompositeDisposable compositeDisposable = new CompositeDisposable(); private UserRepository userRepository; private MutableLiveData<String> checkFieldsSuccessful; private MutableLiveData<String> signInSuccessful; public LogInVM(UserRepository userRepository) { this.userRepository = userRepository; checkFieldsSuccessful = new MutableLiveData<>(); signInSuccessful = new MutableLiveData<>(); } public LiveData<String> getSignInSuccessful() { return signInSuccessful; } public LiveData<String> getCheckFields() { return checkFieldsSuccessful; } public void checkFields(String username, String password) { try { Validator.isEmpty(username, "username"); Validator.isEmpty(password, "password"); compositeDisposable.add(userRepository.signIn(username, password).subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribeWith(new DisposableObserver<AccessToken>() { @Override public void onNext(AccessToken accessToken) { signInSuccessful.setValue(accessToken.getAccessToken()); } @Override public void onError(Throwable e) { signInSuccessful.setValue("fail"); } @Override public void onComplete() { } })); } catch (IllegalArgumentException e) { checkFieldsSuccessful.setValue(e.getMessage()); } } @Override protected void onCleared() { super.onCleared(); compositeDisposable.clear(); } }
[ "dejan.randjelovic.016@gmail.com" ]
dejan.randjelovic.016@gmail.com
177b7ba38b3b97f6806bfb123aa7d8bf32d4593f
143d9d30a0d484125e6f8c18f420b82b69ea54e4
/WordCountProject/DataCounter.java
e4e567f2e087b4d6376119f46d2368bbbea74cd0
[]
no_license
taylo2allen/WordCount
a8314c0c45d5910c121ecb55f22068dc7bd22853
d09021cf298a9c7cfae6f730de3e245fb7040d89
refs/heads/master
2020-04-01T22:57:39.767521
2018-11-27T02:34:26
2018-11-27T02:34:26
153,734,783
0
1
null
2018-11-16T19:30:57
2018-10-19T06:12:33
Java
UTF-8
Java
false
false
2,079
java
/** * Simple class to hold a piece of data and its count. The class has package * access so that the various implementations of DataCounter can access its * contents, but not client code. * * @param <E> type of data whose count we are recording. */ class DataCount<E> { /** * The data element whose count we are recording. */ E data; /** * The count for the data element. */ int count; /** * Create a new data count. * * @param data the data element whose count we are recording. * @param count the count for the data element. */ DataCount(E data, int count) { this.data = data; this.count = count; } } /** * Interface for a data structure that allows you to count the number of times * you see each piece of data. * * Although you will be using this interface only with Strings, we have tried to * "genericize" the code as much as possible. DataCounter counts elements of an * unconstrained generic type E, and BinarySearchTree restricts E to Comparable * types. HashTable is String-only, because you'll be implementing your own * hashcode and will need access to the actual String contents. * * @param <E> The type of data to be counted. */ public interface DataCounter<E> { /** * Increment the count for a particular data element. * * @param data data element whose count to increment. */ public void incCount(E data); /** * The number of unique data elements in the structure. * * @return the number of unique data elements in the structure. */ public int getSize(); /** * Get an array of all of the data counts in the DataCounter structure. The * array should contain exactly one DataCount instance for each unique * element inserted into the structure. The elements do not need to be in * any particular order. * * @return an array of the data counts. */ public DataCount<E>[] getCounts(); }
[ "taylo2allen@gmail.com" ]
taylo2allen@gmail.com
476723bc1aacf0db5bc6528d0a7d35c7fb5565d1
356e92c72349208c03029134e26251aea980861a
/Narutu/heart.java
574568399709d4e00e6efbadf7637a280a2f8bb6
[]
no_license
dhanyasit/Greenfoot
626f6d1887f7b6b2e14449a26fba212738584992
4104b535a97c5a0c0d53d1e68e1ffe903348e6be
refs/heads/master
2020-09-05T03:57:03.366416
2019-11-06T11:20:05
2019-11-06T11:20:05
219,975,467
0
0
null
null
null
null
UTF-8
Java
false
false
636
java
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Heart here. * * @author (your name) * @version (a version number or a date) */ public class heart extends Actor { /** * Act - do whatever the Heart wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { // Add your action code here. } public heart(){ GreenfootImage image = getImage(); image.scale(image.getWidth()*1/8,image.getHeight()*1/8); setImage(image); } }
[ "dhanyasit.46858@mail.kmutt.ac.th" ]
dhanyasit.46858@mail.kmutt.ac.th
4ef2c7020845bc506af4eb36264f5fa4d19c0af9
e80cb202a04b05324a97b9ab28e2eaac6cc5a5ad
/email.java
5e19b40afb161960fbe3bb2ef6c9fad4dbcff37d
[]
no_license
ruksanams/casestudies
aaddd34b73eb7004a722147986a322f2098bb77b
a37fb291103eb6e726527f31dd7cf1efdcfedcbc
refs/heads/master
2020-09-20T09:38:51.308447
2020-01-07T10:26:24
2020-01-07T10:26:24
224,439,401
0
0
null
null
null
null
UTF-8
Java
false
false
1,158
java
package ruksana; import java.util.Scanner; public class email { String name; String address; String no; String mail; String proof; String proofid; static int i=0; public email(String name,String address,String no,String mail,String proof,String proofid) { this.name=name; this.address=address; this.no=no; this.mail=mail; this.proof=proof; this.proofid=proofid; } public static void main(String[] args) { Scanner S=new Scanner(System.in); System.out.println("Enter your Name"); String name=S.nextLine(); System.out.println("Enter your Address"); String address=S.nextLine(); System.out.println("Contact number"); String no=S.nextLine(); System.out.println("E-Mail ID"); String mail=S.nextLine(); System.out.println("Enter proof type"); String proof=S.nextLine(); System.out.println("Enter proof id"); String proofid=S.nextLine(); email c=new email(name,address,no,mail,proof,proofid); c.register(); } public void register() { System.out.println("Thank you for registering your id is "+(++i)); } }
[ "noreply@github.com" ]
noreply@github.com
0e14953ed38bc88ad460b8f9668ba2bd91cacfad
4a8bcfa280c0aed245383150b66acf1a7550458d
/org.obeonetwork.dsl.spem.edit/src/org/obeonetwork/dsl/spem/provider/WorkProductDefinitionItemProvider.java
55f08713265c4466f099d3330607bc8cc0ad259c
[]
no_license
SebastienAndreo/SPEM-Designer
f4eedad7e0d68403a1a3bddfddcfb2182796a222
532e71548fde8d73a78b471a8fd8dd402e92f58e
refs/heads/master
2021-01-15T13:06:10.846652
2012-08-07T07:13:03
2012-08-07T07:13:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,172
java
/** * THALES (c) */ package org.obeonetwork.dsl.spem.provider; import java.util.Collection; import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import org.obeonetwork.dsl.spem.WorkProductDefinition; /** * This is the item provider adapter for a {@link org.obeonetwork.dsl.spem.WorkProductDefinition} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class WorkProductDefinitionItemProvider extends MethodContentElementItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public WorkProductDefinitionItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); } return itemPropertyDescriptors; } /** * This returns WorkProductDefinition.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/WorkProductDefinition")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((WorkProductDefinition)object).getName(); return label == null || label.length() == 0 ? getString("_UI_WorkProductDefinition_type") : getString("_UI_WorkProductDefinition_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } }
[ "Stephane.Drapeau@obeo.fr" ]
Stephane.Drapeau@obeo.fr
45d58543abf1146134144cfbf9830b9a3005c8c6
5b3f0f1b57b4017d2bd61552de33b091e555ea61
/dubbotest/dubbocustomer/main/java/com/fantasybaby/consumer/Consumer.java
763bfa35a7430010bb50dc1b56e7cb2cc3951292
[]
no_license
dividgui/javaSeWorkspace
620d394ae280907d0cf14035f3caa69a00517aeb
68970e068db2739bd9a11490b49f79d44159f503
refs/heads/master
2020-03-07T22:02:57.755690
2018-03-07T11:53:54
2018-03-07T11:53:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,139
java
package com.fantasybaby.consumer; import com.alibaba.dubbo.config.annotation.Reference; import com.fantasybaby.service.IDubboService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.stereotype.Component; @Component(value = "consumer") public class Consumer { @Reference(version = "1.0.0") private IDubboService dubboService; public String sayHello(){ return dubboService.getName(); } public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( new String[]{"customer.xml"}); context.start(); Consumer consumer = (Consumer) context.getBean("consumer"); System.out.println(consumer.sayHello()); /*IDubboService demoService = (IDubboService) context.getBean("demoService"); // obtain proxy object for remote invocation String hello = demoService.getName(); // execute remote invocation System.out.println("consumer" + hello+ "----"); // show the result*/ } }
[ "625353861@qq.com" ]
625353861@qq.com
c414c4a20ae4b8c4c200af17a440e9033437b694
ae817720fe0dae8fc2e9671edc2ebd2b8404726f
/PoolArea.java
a00bd7f594975659048a275fbe2a44348e2dfb73
[]
no_license
Buraknekci/OPP-Begins
e0c13a194254f94e64e58a9e088d62a8fded883b
d234e19ffcb2fee8a29858bc1084a0822fc1f221
refs/heads/main
2023-01-23T01:52:59.404840
2020-11-23T11:09:53
2020-11-23T11:09:53
315,288,133
1
0
null
null
null
null
UTF-8
Java
false
false
743
java
public class PoolArea { public static void main(String[] args) { Rectangle rectangle = new Rectangle(5, 10); System.out.println("rectangle.width= " + rectangle.getWidth()); System.out.println("rectangle.length= " + rectangle.getLength()); System.out.println("rectangle.area= " + rectangle.getArea()); Cuboid cuboid = new Cuboid(5, 10, 5); System.out.println("cuboid.width= " + cuboid.getWidth()); System.out.println("cuboid.lenght= " + cuboid.getLength()); System.out.println("cuboid.area= " + cuboid.getArea()); System.out.println("cuboid.heigth= " + cuboid.getHeight()); System.out.println("cuboid.volume= " + cuboid.getVolume()); } }
[ "noreply@github.com" ]
noreply@github.com
23e7cc9ca3dede6561141874071987b7d615154d
5ca3901b424539c2cf0d3dda52d8d7ba2ed91773
/src_cfr/com/google/common/collect/Multimaps$CustomSortedSetMultimap.java
5b537707be0f41e85066d54201020ea1d9db7208
[]
no_license
fjh658/bindiff
c98c9c24b0d904be852182ecbf4f81926ce67fb4
2a31859b4638404cdc915d7ed6be19937d762743
refs/heads/master
2021-01-20T06:43:12.134977
2016-06-29T17:09:03
2016-06-29T17:09:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,884
java
/* * Decompiled with CFR 0_115. */ package com.google.common.collect; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Preconditions; import com.google.common.base.Supplier; import com.google.common.collect.AbstractSortedSetMultimap; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Collection; import java.util.Comparator; import java.util.Map; import java.util.Set; import java.util.SortedSet; class Multimaps$CustomSortedSetMultimap extends AbstractSortedSetMultimap { transient Supplier factory; transient Comparator valueComparator; @GwtIncompatible(value="not needed in emulated source") private static final long serialVersionUID = 0; Multimaps$CustomSortedSetMultimap(Map map, Supplier supplier) { super(map); this.factory = (Supplier)Preconditions.checkNotNull(supplier); this.valueComparator = ((SortedSet)supplier.get()).comparator(); } @Override protected SortedSet createCollection() { return (SortedSet)this.factory.get(); } @Override public Comparator valueComparator() { return this.valueComparator; } @GwtIncompatible(value="java.io.ObjectOutputStream") private void writeObject(ObjectOutputStream objectOutputStream) { objectOutputStream.defaultWriteObject(); objectOutputStream.writeObject(this.factory); objectOutputStream.writeObject(this.backingMap()); } @GwtIncompatible(value="java.io.ObjectInputStream") private void readObject(ObjectInputStream objectInputStream) { objectInputStream.defaultReadObject(); this.factory = (Supplier)objectInputStream.readObject(); this.valueComparator = ((SortedSet)this.factory.get()).comparator(); Map map = (Map)objectInputStream.readObject(); this.setMap(map); } }
[ "manouchehri@riseup.net" ]
manouchehri@riseup.net
1d0e86443a0c2d8584597e8afd57e677b5795555
514c44df0ea7607e8b0cc4e57d80b5e47480575c
/app/src/main/java/com/rabbit/application/ui/MainActivity.java
688bd57fe5f61d76d5e5cdea5b403a4954e28809
[]
no_license
ppjuns/ITinformation
1e7bef5f5c6e8a7c9d335745df8a73770d3bc350
21ec76ab96fb88dacde27504002d827d7db02fc4
refs/heads/master
2021-06-08T14:24:56.282020
2016-05-25T12:19:25
2016-05-25T12:19:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,222
java
package com.rabbit.application.ui; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.widget.Toolbar; import android.util.Log; import android.util.TypedValue; import android.view.Display; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.astuetz.PagerSlidingTabStrip; import com.rabbit.application.R; import com.rabbit.application.adapter.MyFragmentAdapter; import com.rabbit.application.ui.fragment.InfoListviewFragment; import com.rabbit.application.util.Urls; import org.jsoup.nodes.Document; import java.util.ArrayList; import java.util.List; public class MainActivity extends BaseActivity { //声明相关变量 private SharedPreferences sharedpreferences; private SharedPreferences.Editor editor; private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle mDrawerToggle; private ListView lvLeftMenu; private ArrayAdapter arrayAdapter; private Context mConext; //声明viewpage tab String result; private PagerSlidingTabStrip tabs; private ViewPager pager; private MyFragmentAdapter mMyPagerAdapter; private ViewGroup viewGroup; Document doc; Handler handle = new Handler() { public void handleMessage(Message msg) { Log.d("titile", msg.obj.toString()); } }; private final int CURRENT_VERSION = Build.VERSION.SDK_INT; private final int VERSION_KITKAT = Build.VERSION_CODES.KITKAT; //exit private boolean isExit = false; private Handler mHandle = new Handler() { public void handleMessage(Message msg) { super.handleMessage(msg); isExit = false; } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getWindow().setBackgroundDrawable(null); mConext = this; findViews(); //获取控件 sharedpreferences = getSharedPreferences("textSize", Activity.MODE_PRIVATE); editor = sharedpreferences.edit(); editor.putInt("textSize", 14); editor.commit(); toolbar.setTitle("柚子");//设置Toolbar标题 toolbar.setTitleTextColor(Color.parseColor("#FFFFFF")); //设置标题颜色 setSupportActionBar(toolbar); getSupportActionBar().setHomeButtonEnabled(true); //设置返回键可用 getSupportActionBar().setDisplayHomeAsUpEnabled(true); //创建返回键,并实现打开关/闭监听 mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.hello_world, R.string.hello_world) { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); } } ; mDrawerToggle.syncState(); mDrawerLayout.setDrawerListener(mDrawerToggle); //设置菜单列表 initViewPager(); tabs.setViewPager(pager); tabs.setTextColor(Color.parseColor("#747474")); final int pagerMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pagerMargin); pager.setOffscreenPageLimit(5); pager.setCurrentItem(0); String[] data = {"字号大少", "夜间模式", "关于"}; lvLeftMenu.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, data)); lvLeftMenu.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { switch (position) { case 0: View dialogView = LayoutInflater.from(mConext).inflate(R.layout.textsize, null); final Dialog textSizeDiaog = new Dialog(mConext); textSizeDiaog.setContentView(dialogView); textSizeDiaog.setTitle("字体大小"); textSizeDiaog.setCancelable(true); textSizeDiaog.setCanceledOnTouchOutside(true); textSizeDiaog.show(); WindowManager mWM = (WindowManager) mConext.getSystemService(Context.WINDOW_SERVICE); Display display = mWM.getDefaultDisplay(); Window window = textSizeDiaog.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); lp.width = (int) (display.getWidth() * 0.8); lp.height = WindowManager.LayoutParams.WRAP_CONTENT; window.setAttributes(lp); textSizeDiaog.show(); TextView tv_small = (TextView) dialogView.findViewById(R.id.tv_smallsize); TextView tv_normal = (TextView) dialogView.findViewById(R.id.tv_normalsize); TextView tv_big = (TextView) dialogView.findViewById(R.id.tv_bigsize); TextView tv_superbig = (TextView) dialogView.findViewById(R.id.tv_superbigsize); TextView tv_cancel = (TextView) dialogView.findViewById(R.id.tv_cancel); sharedpreferences = getSharedPreferences("textSize", Activity.MODE_PRIVATE); editor = sharedpreferences.edit(); tv_small.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.putInt("textSize", 13); editor.commit(); textSizeDiaog.dismiss(); } }); tv_normal.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.putInt("textSize", 14); editor.commit(); textSizeDiaog.dismiss(); } }); tv_big.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.putInt("textSize", 16); editor.commit(); textSizeDiaog.dismiss(); } }); tv_superbig.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.putInt("textSize", 20); editor.commit(); textSizeDiaog.dismiss(); } }); tv_cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { textSizeDiaog.dismiss(); } }); break; } } }); } private void findViews() { viewGroup = (ViewGroup) findViewById(R.id.content); toolbar = (Toolbar) findViewById(R.id.tl_custom); mDrawerLayout = (DrawerLayout) findViewById(R.id.dl_left); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager = (ViewPager) findViewById(R.id.pager); lvLeftMenu = (ListView) findViewById(R.id.lv_menu); } public void initViewPager() { List<Fragment> list = new ArrayList<Fragment>(); InfoListviewFragment androidFragment = new InfoListviewFragment().getInstance(Urls.AndroidURL); InfoListviewFragment iphoneFragment = new InfoListviewFragment().getInstance(Urls.IPHONEURL); InfoListviewFragment wpFragment = new InfoListviewFragment().getInstance(Urls.WpURL); InfoListviewFragment digitalFragment = new InfoListviewFragment().getInstance(Urls.DIGIURL); InfoListviewFragment nextFragment = new InfoListviewFragment().getInstance(Urls.NEXTURL); InfoListviewFragment discoveryFragment = new InfoListviewFragment().getInstance(Urls.DISCOVERYURL); list.add(androidFragment); list.add(iphoneFragment); list.add(wpFragment); list.add(digitalFragment); list.add(nextFragment); list.add(discoveryFragment); mMyPagerAdapter = new MyFragmentAdapter(getSupportFragmentManager(), list); pager.setAdapter(mMyPagerAdapter); } /** * 实现点击两次退出程序 */ private void exit() { if (isExit) { finish(); System.exit(0); } else { isExit = true; Toast.makeText(getApplicationContext(), R.string.hello_world, Toast.LENGTH_SHORT).show(); //两秒内不点击back则重置mIsExit mHandle.sendEmptyMessageDelayed(0, 2000); } } }
[ "953386166@qq.com" ]
953386166@qq.com
1aa785762acd733b76d86f0bf0230c4763261576
ff9ed72bd1fe93a79e85aad08582cbd9105a8933
/src/main/java/com/newxton/nxtframework/entity/NxtOrderFormRefundPicture.java
602ce925098da46dd16f81436964e3e6d15eb051
[ "Apache-2.0" ]
permissive
bmy880/nxtframework
b49304b802967d9e3303b9e9ca8204a78d40e9b2
cbc4a22699ed426b2e3531c006893737f432055c
refs/heads/master
2023-07-13T16:11:22.088547
2021-04-18T02:34:17
2021-04-18T02:34:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
941
java
package com.newxton.nxtframework.entity; import java.io.Serializable; /** * (NxtOrderFormRefundPicture)实体类 * * @author makejava * @since 2020-11-14 21:41:56 */ public class NxtOrderFormRefundPicture implements Serializable { private static final long serialVersionUID = 400604962006206442L; /** * 退货申请附加图片 */ private Long id; private Long orderFormRefundId; private Long uploadfileId; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getOrderFormRefundId() { return orderFormRefundId; } public void setOrderFormRefundId(Long orderFormRefundId) { this.orderFormRefundId = orderFormRefundId; } public Long getUploadfileId() { return uploadfileId; } public void setUploadfileId(Long uploadfileId) { this.uploadfileId = uploadfileId; } }
[ "soyojo.earth@gmail.com" ]
soyojo.earth@gmail.com
95814af5cd8e9bf5c3365f2645aec386fbe49305
b6df21f60def95ceeccdbf8b447ce720d06fa737
/src/main/java/com/mapsynq/utility/utility.java
beea3101bda38c6af0c3f22deb3ba16f76028637
[]
no_license
asingh2019/QuantumInvention
9a1f8279f4e714f8ed560d924f74dce50b0142c6
9e61ae1a3661c6eb2dbf38134547b150af78cc21
refs/heads/master
2020-04-17T18:15:36.872704
2019-01-22T10:52:39
2019-01-22T10:52:39
166,776,136
0
1
null
null
null
null
UTF-8
Java
false
false
1,308
java
package com.mapsynq.utility; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.commons.io.FileUtils; import org.junit.Rule; import org.junit.rules.TestRule; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.openqa.selenium.*; import com.mapsynq.basest.baseclass; public class utility extends baseclass { @Rule public TestRule Listen= new TestWatcher() { @Override protected void failed(Throwable e, Description description) { super.failed(e, description); try { takeScreenshotAtEndOfTest (description.getClassName()+","+description.getMethodName()); } catch (IOException e1) { e1.printStackTrace(); } } }; public static void takeScreenshotAtEndOfTest(String name) throws IOException { String DateName=new SimpleDateFormat("yyyymmddhhmmss").format(new Date()); File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); String Destination=System.getProperty("G:\\Mapsynq\\Mapsynq\\src\\main\\java\\com\\mapsynq\\screenshot")+name+DateName+".png"; FileUtils.copyFile(scrFile, new File(Destination)); } }
[ "Asit.Singh@STELLAR.COM" ]
Asit.Singh@STELLAR.COM
2a13317c2fadadb4e08db01c2b3c378273718a00
18e26ff4178fee9e9b3e16f76ad19adf0e480af1
/bookstorestorefront/web/src/my/bookstore/storefront/controllers/pages/HomePageController.java
4a62f95ac1d6bcb3a52c0fd93d42e0da81eb3d45
[]
no_license
corsogitipsedocet/corso
7c1568ed7b25c1279465f84bd300727a0ce14b6b
91e048531603ed55ad53dea4958b941519079b91
refs/heads/master
2021-04-27T06:30:17.301932
2018-02-23T15:10:30
2018-02-23T15:10:30
122,615,706
0
0
null
null
null
null
UTF-8
Java
false
false
2,140
java
/* * [y] hybris Platform * * Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package my.bookstore.storefront.controllers.pages; import de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractPageController; import de.hybris.platform.cms2.exceptions.CMSItemNotFoundException; import de.hybris.platform.cms2.model.pages.AbstractPageModel; import de.hybris.platform.acceleratorstorefrontcommons.controllers.util.GlobalMessages; 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 org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** * Controller for home page */ @Controller @RequestMapping("/") public class HomePageController extends AbstractPageController { @RequestMapping(method = RequestMethod.GET) public String home(@RequestParam(value = "logout", defaultValue = "false") final boolean logout, final Model model, final RedirectAttributes redirectModel) throws CMSItemNotFoundException { if (logout) { GlobalMessages.addFlashMessage(redirectModel, GlobalMessages.INFO_MESSAGES_HOLDER, "account.confirmation.signout.title"); return REDIRECT_PREFIX + ROOT; } storeCmsPageInModel(model, getContentPageForLabelOrId(null)); setUpMetaDataForContentPage(model, getContentPageForLabelOrId(null)); updatePageTitle(model, getContentPageForLabelOrId(null)); return getViewForPage(model); } protected void updatePageTitle(final Model model, final AbstractPageModel cmsPage) { storeContentPageTitleInModel(model, getPageTitleResolver().resolveHomePageTitle(cmsPage.getTitle())); } }
[ "roberto.adami@ipsedocet.it" ]
roberto.adami@ipsedocet.it
0d7be003f2e9173ce90078635ec0e0e7a5edf68b
0dd6b0ae67ddaa69928e058848022848010dd582
/TechIndiana_School_Parent/MPChartLib/src/main/java/com/github/mikephil/charting/data/CombinedData.java
36bdf315f6b8f8827384c2207abeeb6d6add77da
[]
no_license
dganesh5121/demo-school1
f38d7de243488db24c0ec215b6976b905de4d747
01068916b6b23800a795c8fcd93e6786d973d48e
refs/heads/master
2020-03-23T23:51:08.804473
2018-07-25T06:35:45
2018-07-25T06:35:45
142,259,396
0
0
null
null
null
null
UTF-8
Java
false
false
6,064
java
package com.github.mikephil.charting.data; import android.util.Log; import com.github.mikephil.charting.highlight.Highlight; import com.github.mikephil.charting.interfaces.datasets.IBarLineScatterCandleBubbleDataSet; import java.util.ArrayList; import java.util.List; /** * Data object that allows the combination of Line-, Bar-, Scatter-, Bubble- and * CandleData. Used in the CombinedChart class. * * @author Philipp Jahoda */ public class CombinedData extends BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<? extends Entry>> { private BarData mBarData; private BubbleData mBubbleData; public CombinedData() { super(); } public void setData(BarData data) { mBarData = data; notifyDataChanged(); } public void setData(BubbleData data) { mBubbleData = data; notifyDataChanged(); } @Override public void calcMinMax() { if(mDataSets == null){ mDataSets = new ArrayList<>(); } mDataSets.clear(); mYMax = -Float.MAX_VALUE; mYMin = Float.MAX_VALUE; mXMax = -Float.MAX_VALUE; mXMin = Float.MAX_VALUE; mLeftAxisMax = -Float.MAX_VALUE; mLeftAxisMin = Float.MAX_VALUE; mRightAxisMax = -Float.MAX_VALUE; mRightAxisMin = Float.MAX_VALUE; List<BarLineScatterCandleBubbleData> allData = getAllData(); for (ChartData data : allData) { data.calcMinMax(); List<IBarLineScatterCandleBubbleDataSet<? extends Entry>> sets = data.getDataSets(); mDataSets.addAll(sets); if (data.getYMax() > mYMax) mYMax = data.getYMax(); if (data.getYMin() < mYMin) mYMin = data.getYMin(); if (data.getXMax() > mXMax) mXMax = data.getXMax(); if (data.getXMin() < mXMin) mXMin = data.getXMin(); if (data.mLeftAxisMax > mLeftAxisMax) mLeftAxisMax = data.mLeftAxisMax; if (data.mLeftAxisMin < mLeftAxisMin) mLeftAxisMin = data.mLeftAxisMin; if (data.mRightAxisMax > mRightAxisMax) mRightAxisMax = data.mRightAxisMax; if (data.mRightAxisMin < mRightAxisMin) mRightAxisMin = data.mRightAxisMin; } } public BubbleData getBubbleData() { return mBubbleData; } public BarData getBarData() { return mBarData; } /** * Returns all data objects in row: line-bar-scatter-candle-bubble if not null. * * @return */ public List<BarLineScatterCandleBubbleData> getAllData() { List<BarLineScatterCandleBubbleData> data = new ArrayList<BarLineScatterCandleBubbleData>(); if (mBarData != null) data.add(mBarData); if (mBubbleData != null) data.add(mBubbleData); return data; } public BarLineScatterCandleBubbleData getDataByIndex(int index) { return getAllData().get(index); } @Override public void notifyDataChanged() { if (mBarData != null) mBarData.notifyDataChanged(); if (mBubbleData != null) mBubbleData.notifyDataChanged(); calcMinMax(); // recalculate everything } /** * Get the Entry for a corresponding highlight object * * @param highlight * @return the entry that is highlighted */ @Override public Entry getEntryForHighlight(Highlight highlight) { if (highlight.getDataIndex() >= getAllData().size()) return null; ChartData data = getDataByIndex(highlight.getDataIndex()); if (highlight.getDataSetIndex() >= data.getDataSetCount()) return null; // The value of the highlighted entry could be NaN - // if we are not interested in highlighting a specific value. List<Entry> entries = data.getDataSetByIndex(highlight.getDataSetIndex()) .getEntriesForXValue(highlight.getX()); for (Entry entry : entries) if (entry.getY() == highlight.getY() || Float.isNaN(highlight.getY())) return entry; return null; } /** * Get dataset for highlight * * @param highlight current highlight * @return dataset related to highlight */ public IBarLineScatterCandleBubbleDataSet<? extends Entry> getDataSetByHighlight(Highlight highlight) { if (highlight.getDataIndex() >= getAllData().size()) return null; BarLineScatterCandleBubbleData data = getDataByIndex(highlight.getDataIndex()); if (highlight.getDataSetIndex() >= data.getDataSetCount()) return null; return (IBarLineScatterCandleBubbleDataSet<? extends Entry>) data.getDataSets().get(highlight.getDataSetIndex()); } public int getDataIndex(ChartData data) { return getAllData().indexOf(data); } @Override public boolean removeDataSet(IBarLineScatterCandleBubbleDataSet<? extends Entry> d) { List<BarLineScatterCandleBubbleData> datas = getAllData(); boolean success = false; for (ChartData data : datas) { success = data.removeDataSet(d); if (success) { break; } } return success; } @Deprecated @Override public boolean removeDataSet(int index) { Log.e("MPAndroidChart", "removeDataSet(int index) not supported for CombinedData"); return false; } @Deprecated @Override public boolean removeEntry(Entry e, int dataSetIndex) { Log.e("MPAndroidChart", "removeEntry(...) not supported for CombinedData"); return false; } @Deprecated @Override public boolean removeEntry(float xValue, int dataSetIndex) { Log.e("MPAndroidChart", "removeEntry(...) not supported for CombinedData"); return false; } }
[ "ganesh@techindiana.com" ]
ganesh@techindiana.com
53bedb18df14cfd730f8a44e869750baf6176283
582c7d69647fa73f4941ed6c56f9e4251aaa5a6d
/src/main/java/ru/samganji/rest/NotFoundException.java
b2fb33b80e5189fb1f6d8594fd315e03cc1ffa5d
[]
no_license
Samganji/GeoDataOSMru
ca9021cebf612c997d45740e7d4349c9cb69dfbf
a10b25539a5d70a7f72d5219210acb1beb2485d3
refs/heads/master
2020-07-22T22:29:59.747261
2019-09-09T16:13:27
2019-09-09T16:13:27
207,351,073
0
0
null
null
null
null
UTF-8
Java
false
false
226
java
package ru.samganji.rest; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) class NotFoundException extends RuntimeException { }
[ "samganji@list.ru" ]
samganji@list.ru
9775014cf9fef7d0f6fad54dba73f50779f856b2
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/26/26_f909970f9f0ef5d80e11dcac5ce1c47001a9ee3f/MappedSchemaBuilderTable/26_f909970f9f0ef5d80e11dcac5ce1c47001a9ee3f_MappedSchemaBuilderTable_s.java
139ce350395f07a6979c280c9f0efd2cc8393682
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
29,595
java
//$HeadURL$ /*---------------------------------------------------------------------------- This file is part of deegree, http://deegree.org/ Copyright (C) 2001-2011 by: - Department of Geography, University of Bonn - and - lat/lon GmbH - 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. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact information: lat/lon GmbH Aennchenstr. 19, 53177 Bonn Germany http://lat-lon.de/ Department of Geography, University of Bonn Prof. Dr. Klaus Greve Postfach 1147, 53001 Bonn Germany http://www.geographie.uni-bonn.de/deegree/ e-mail: info@deegree.org ----------------------------------------------------------------------------*/ package org.deegree.feature.persistence.sql.config; import static javax.xml.XMLConstants.DEFAULT_NS_PREFIX; import static javax.xml.XMLConstants.NULL_NS_URI; import static org.deegree.commons.tom.primitive.BaseType.valueOf; import static org.deegree.feature.types.property.GeometryPropertyType.CoordinateDimension.DIM_2; import static org.deegree.feature.types.property.GeometryPropertyType.CoordinateDimension.DIM_3; import static org.deegree.feature.types.property.ValueRepresentation.INLINE; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.bind.JAXBElement; import javax.xml.namespace.QName; import org.deegree.commons.jdbc.ConnectionManager; import org.deegree.commons.jdbc.SQLIdentifier; import org.deegree.commons.jdbc.TableName; import org.deegree.commons.tom.primitive.BaseType; import org.deegree.commons.tom.primitive.PrimitiveType; import org.deegree.commons.utils.JDBCUtils; import org.deegree.commons.utils.Pair; import org.deegree.cs.coordinatesystems.ICRS; import org.deegree.cs.persistence.CRSManager; import org.deegree.feature.persistence.FeatureStoreException; import org.deegree.feature.persistence.sql.FeatureTypeMapping; import org.deegree.feature.persistence.sql.GeometryStorageParams; import org.deegree.feature.persistence.sql.MappedAppSchema; import org.deegree.feature.persistence.sql.expressions.TableJoin; import org.deegree.feature.persistence.sql.id.AutoIDGenerator; import org.deegree.feature.persistence.sql.id.FIDMapping; import org.deegree.feature.persistence.sql.id.IDGenerator; import org.deegree.feature.persistence.sql.jaxb.AbstractParticleJAXB; import org.deegree.feature.persistence.sql.jaxb.FIDMappingJAXB; import org.deegree.feature.persistence.sql.jaxb.FIDMappingJAXB.ColumnJAXB; import org.deegree.feature.persistence.sql.jaxb.FeatureTypeMappingJAXB; import org.deegree.feature.persistence.sql.jaxb.GeometryParticleJAXB; import org.deegree.feature.persistence.sql.jaxb.Join; import org.deegree.feature.persistence.sql.jaxb.PrimitiveParticleJAXB; import org.deegree.feature.persistence.sql.rules.GeometryMapping; import org.deegree.feature.persistence.sql.rules.Mapping; import org.deegree.feature.persistence.sql.rules.PrimitiveMapping; import org.deegree.feature.types.FeatureType; import org.deegree.feature.types.GenericFeatureType; import org.deegree.feature.types.property.GeometryPropertyType; import org.deegree.feature.types.property.GeometryPropertyType.CoordinateDimension; import org.deegree.feature.types.property.GeometryPropertyType.GeometryType; import org.deegree.feature.types.property.PropertyType; import org.deegree.feature.types.property.SimplePropertyType; import org.deegree.filter.expression.ValueReference; import org.deegree.gml.schema.GMLSchemaInfoSet; import org.deegree.sqldialect.SQLDialect; import org.deegree.sqldialect.filter.DBField; import org.deegree.sqldialect.filter.MappingExpression; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Generates {@link MappedAppSchema} instances (table-driven mode). * * @author <a href="mailto:schneider@lat-lon.de">Markus Schneider</a> * @author last edited by: $Author$ * * @version $Revision$, $Date$ */ public class MappedSchemaBuilderTable extends AbstractMappedSchemaBuilder { private static final Logger LOG = LoggerFactory.getLogger( MappedSchemaBuilderTable.class ); private Map<QName, FeatureType> ftNameToFt = new HashMap<QName, FeatureType>(); private Map<QName, FeatureTypeMapping> ftNameToMapping = new HashMap<QName, FeatureTypeMapping>(); private final Connection conn; private DatabaseMetaData md; // caches the column information private Map<TableName, LinkedHashMap<SQLIdentifier, ColumnMetadata>> tableNameToColumns = new HashMap<TableName, LinkedHashMap<SQLIdentifier, ColumnMetadata>>(); private final SQLDialect dialect; private final boolean deleteCascadingByDB; /** * Creates a new {@link MappedSchemaBuilderTable} instance. * * @param jdbcConnId * identifier of JDBC connection, must not be <code>null</code> (used to determine columns / types) * @param ftDecls * JAXB feature type declarations, must not be <code>null</code> * @throws SQLException * @throws FeatureStoreException */ public MappedSchemaBuilderTable( String jdbcConnId, List<FeatureTypeMappingJAXB> ftDecls, SQLDialect dialect, boolean deleteCascadingByDB ) throws SQLException, FeatureStoreException { this.dialect = dialect; conn = ConnectionManager.getConnection( jdbcConnId ); try { for ( FeatureTypeMappingJAXB ftDecl : ftDecls ) { process( ftDecl ); } } finally { JDBCUtils.close( conn ); } this.deleteCascadingByDB = deleteCascadingByDB; } /** * Returns the {@link MappedAppSchema} derived from configuration / tables. * * @return mapped application schema, never <code>null</code> */ public MappedAppSchema getMappedSchema() { FeatureType[] fts = ftNameToFt.values().toArray( new FeatureType[ftNameToFt.size()] ); FeatureTypeMapping[] ftMappings = ftNameToMapping.values().toArray( new FeatureTypeMapping[ftNameToMapping.size()] ); Map<FeatureType, FeatureType> ftToSuperFt = null; Map<String, String> prefixToNs = null; GMLSchemaInfoSet xsModel = null; // TODO GeometryStorageParams geometryParams = new GeometryStorageParams( CRSManager.getCRSRef( "EPSG:4326" ), dialect.getUndefinedSrid(), CoordinateDimension.DIM_2 ); return new MappedAppSchema( fts, ftToSuperFt, prefixToNs, xsModel, ftMappings, null, null, geometryParams, deleteCascadingByDB ); } private void process( FeatureTypeMappingJAXB ftDecl ) throws SQLException, FeatureStoreException { if ( ftDecl.getTable() == null || ftDecl.getTable().isEmpty() ) { String msg = "Feature type element without or with empty table attribute."; throw new FeatureStoreException( msg ); } TableName table = new TableName( ftDecl.getTable() ); LOG.debug( "Processing feature type mapping for table '" + table + "'." ); if ( getColumns( table ).isEmpty() ) { throw new FeatureStoreException( "No table with name '" + table + "' exists (or no columns defined)." ); } QName ftName = ftDecl.getName(); if ( ftName == null ) { LOG.debug( "Using table name for feature type." ); ftName = new QName( table.getTable() ); } ftName = makeFullyQualified( ftName, "app", "http://www.deegree.org/app" ); LOG.debug( "Feature type name: '" + ftName + "'." ); FIDMapping fidMapping = buildFIDMapping( table, ftName, ftDecl.getFIDMapping() ); List<JAXBElement<? extends AbstractParticleJAXB>> propDecls = ftDecl.getAbstractParticle(); if ( propDecls != null && !propDecls.isEmpty() ) { process( table, ftName, fidMapping, propDecls ); } else { process( table, ftName, fidMapping ); } } private void process( TableName table, QName ftName, FIDMapping fidMapping ) throws SQLException { LOG.debug( "Deriving properties and mapping for feature type '" + ftName + "' from table '" + table + "'" ); List<PropertyType> pts = new ArrayList<PropertyType>(); List<Mapping> mappings = new ArrayList<Mapping>(); Set<SQLIdentifier> fidColumnNames = new HashSet<SQLIdentifier>(); for ( Pair<SQLIdentifier, BaseType> column : fidMapping.getColumns() ) { fidColumnNames.add( column.first ); } for ( ColumnMetadata md : getColumns( table ).values() ) { if ( fidColumnNames.contains( md.column.toLowerCase() ) ) { LOG.debug( "Omitting column '" + md.column + "' from properties. Used in FIDMapping." ); continue; } DBField dbField = new DBField( md.column ); QName ptName = makeFullyQualified( new QName( md.column.toLowerCase() ), ftName.getPrefix(), ftName.getNamespaceURI() ); if ( md.geomType == null ) { try { BaseType type = BaseType.valueOf( md.sqlType ); PropertyType pt = new SimplePropertyType( ptName, 0, 1, type, null, null ); pts.add( pt ); ValueReference path = new ValueReference( ptName ); PrimitiveType primType = new PrimitiveType( type ); PrimitiveMapping mapping = new PrimitiveMapping( path, true, dbField, primType, null, null ); mappings.add( mapping ); } catch ( IllegalArgumentException e ) { LOG.warn( "Skipping column with type code '" + md.sqlType + "' from list of properties:" + e.getMessage() ); } } else { PropertyType pt = new GeometryPropertyType( ptName, 0, 1, null, null, md.geomType, md.geometryParams.getDim(), INLINE ); pts.add( pt ); ValueReference path = new ValueReference( ptName ); GeometryMapping mapping = new GeometryMapping( path, true, dbField, md.geomType, md.geometryParams, null ); mappings.add( mapping ); } } FeatureType ft = new GenericFeatureType( ftName, pts, false ); ftNameToFt.put( ftName, ft ); FeatureTypeMapping ftMapping = new FeatureTypeMapping( ftName, table, fidMapping, mappings ); ftNameToMapping.put( ftName, ftMapping ); } private void process( TableName table, QName ftName, FIDMapping fidMapping, List<JAXBElement<? extends AbstractParticleJAXB>> propDecls ) throws FeatureStoreException, SQLException { List<PropertyType> pts = new ArrayList<PropertyType>(); List<Mapping> mappings = new ArrayList<Mapping>(); for ( JAXBElement<? extends AbstractParticleJAXB> propDeclEl : propDecls ) { AbstractParticleJAXB propDecl = propDeclEl.getValue(); Pair<PropertyType, Mapping> pt = process( table, propDecl, ftName.getPrefix(), ftName.getNamespaceURI() ); pts.add( pt.first ); mappings.add( pt.second ); } FeatureType ft = new GenericFeatureType( ftName, pts, false ); ftNameToFt.put( ftName, ft ); FeatureTypeMapping ftMapping = new FeatureTypeMapping( ftName, table, fidMapping, mappings ); ftNameToMapping.put( ftName, ftMapping ); } private Pair<PropertyType, Mapping> process( TableName table, AbstractParticleJAXB propDecl, String ftPrefix, String ftNs ) throws FeatureStoreException, SQLException { PropertyType pt = null; QName propName = new QName( propDecl.getPath() ); if ( propName != null ) { propName = makeFullyQualified( propName, ftPrefix, ftNs ); } String me = null; if ( propDecl instanceof PrimitiveParticleJAXB ) { me = ( (PrimitiveParticleJAXB) propDecl ).getMapping(); } else if ( propDecl instanceof GeometryParticleJAXB ) { me = ( (GeometryParticleJAXB) propDecl ).getMapping(); } else { throw new FeatureStoreException( "Table-driven configs currently only support Primitive/Geometry particles." ); } MappingExpression mapping = parseMappingExpression( me ); if ( !( mapping instanceof DBField ) ) { throw new FeatureStoreException( "Unhandled mapping type '" + mapping.getClass() + "'. Currently, only DBFields are supported in table-driven mode." ); } String columnName = ( (DBField) mapping ).getColumn(); if ( propName == null ) { LOG.debug( "Using column name for property name." ); propName = new QName( columnName ); propName = makeFullyQualified( propName, "app", "http://www.deegree.org/app" ); } Join joinConfig = propDecl.getJoin(); List<TableJoin> jc = null; TableName valueTable = table; if ( joinConfig != null ) { jc = buildJoinTable( table, joinConfig ); DBField dbField = new DBField( jc.get( 0 ).getToTable().toString(), jc.get( 0 ).getToColumns().get( 0 ).toString() ); valueTable = new TableName( dbField.getTable(), dbField.getSchema() ); } int maxOccurs = joinConfig != null ? -1 : 1; ValueReference path = new ValueReference( propName ); ColumnMetadata md = getColumn( valueTable, new SQLIdentifier( columnName ) ); int minOccurs = joinConfig != null ? 0 : md.isNullable ? 0 : 1; Mapping m = null; if ( propDecl instanceof PrimitiveParticleJAXB ) { PrimitiveParticleJAXB simpleDecl = (PrimitiveParticleJAXB) propDecl; BaseType primType = null; if ( simpleDecl.getType() != null ) { primType = getPrimitiveType( simpleDecl.getType() ); } else { primType = valueOf( md.sqlType ); } pt = new SimplePropertyType( propName, minOccurs, maxOccurs, primType, null, null ); m = new PrimitiveMapping( path, minOccurs == 0, mapping, ( (SimplePropertyType) pt ).getPrimitiveType(), jc, null ); } else if ( propDecl instanceof GeometryParticleJAXB ) { GeometryParticleJAXB geomDecl = (GeometryParticleJAXB) propDecl; GeometryType type = null; if ( geomDecl.getType() != null ) { type = GeometryType.fromGMLTypeName( geomDecl.getType().name() ); } else { type = md.geomType; } ICRS crs = null; if ( geomDecl.getStorageCRS() != null && geomDecl.getStorageCRS().getValue() != null ) { crs = CRSManager.getCRSRef( geomDecl.getStorageCRS().getValue() ); } else { crs = md.geometryParams.getCrs(); } String srid = null; if ( geomDecl.getStorageCRS() != null && geomDecl.getStorageCRS().getSrid() != null ) { srid = geomDecl.getStorageCRS().getSrid().toString(); } else { srid = md.geometryParams.getSrid(); } CoordinateDimension dim = crs.getDimension() == 3 ? DIM_2 : DIM_3; pt = new GeometryPropertyType( propName, minOccurs, maxOccurs, null, null, type, dim, INLINE ); m = new GeometryMapping( path, minOccurs == 0, mapping, type, new GeometryStorageParams( crs, srid, dim ), jc ); } else { LOG.warn( "Unhandled property declaration '" + propDecl.getClass() + "'. Skipping it." ); } return new Pair<PropertyType, Mapping>( pt, m ); } private FIDMapping buildFIDMapping( TableName table, QName ftName, FIDMappingJAXB config ) throws FeatureStoreException, SQLException { String prefix = config != null ? config.getPrefix() : null; if ( prefix == null ) { prefix = ftName.getPrefix().toUpperCase() + "_" + ftName.getLocalPart().toUpperCase() + "_"; } // build FID columns / types from configuration List<Pair<SQLIdentifier, BaseType>> columns = new ArrayList<Pair<SQLIdentifier, BaseType>>(); if ( config != null && config.getColumn() != null ) { for ( ColumnJAXB configColumn : config.getColumn() ) { SQLIdentifier columnName = new SQLIdentifier( configColumn.getName() ); BaseType columnType = configColumn.getType() != null ? getPrimitiveType( configColumn.getType() ) : null; if ( columnType == null ) { ColumnMetadata md = getColumn( table, columnName ); columnType = BaseType.valueOf( md.sqlType ); } columns.add( new Pair<SQLIdentifier, BaseType>( columnName, columnType ) ); } } IDGenerator generator = buildGenerator( config == null ? null : config.getAbstractIDGenerator() ); if ( generator instanceof AutoIDGenerator ) { if ( columns.isEmpty() ) { // determine autoincrement column automatically for ( ColumnMetadata md : getColumns( table ).values() ) { if ( md.isAutoincrement ) { BaseType columnType = BaseType.valueOf( md.sqlType ); columns.add( new Pair<SQLIdentifier, BaseType>( new SQLIdentifier( md.column ), columnType ) ); break; } } if ( columns.isEmpty() ) { throw new FeatureStoreException( "No autoincrement column in table '" + table + "' found. Please specify column in FIDMapping manually." ); } } } else { if ( columns.isEmpty() ) { throw new FeatureStoreException( "No FIDMapping columns for table '" + table + "' specified. This is only possible for AutoIDGenerator." ); } } return new FIDMapping( prefix, "_", columns, generator ); } private QName makeFullyQualified( QName qName, String defaultPrefix, String defaultNamespace ) { String prefix = qName.getPrefix(); String namespace = qName.getNamespaceURI(); String localPart = qName.getLocalPart(); if ( DEFAULT_NS_PREFIX.equals( prefix ) ) { prefix = defaultPrefix; namespace = defaultNamespace; } if ( NULL_NS_URI.equals( namespace ) ) { namespace = defaultNamespace; } return new QName( namespace, localPart, prefix ); } private DatabaseMetaData getDBMetadata() throws SQLException { if ( md == null ) { md = conn.getMetaData(); } return md; } private ColumnMetadata getColumn( TableName qTable, SQLIdentifier columnName ) throws SQLException, FeatureStoreException { ColumnMetadata md = getColumns( qTable ).get( columnName ); if ( md == null ) { throw new FeatureStoreException( "Table '" + qTable + "' does not have a column with name '" + columnName + "'" ); } return md; } private LinkedHashMap<SQLIdentifier, ColumnMetadata> getColumns( TableName qTable ) throws SQLException { LinkedHashMap<SQLIdentifier, ColumnMetadata> columnNameToMD = tableNameToColumns.get( qTable ); if ( columnNameToMD == null ) { DatabaseMetaData md = getDBMetadata(); columnNameToMD = new LinkedHashMap<SQLIdentifier, ColumnMetadata>(); ResultSet rs = null; try { LOG.info( "Analyzing metadata for table {}", qTable ); rs = dialect.getTableColumnMetadata( md, qTable ); while ( rs.next() ) { String column = rs.getString( 4 ); int sqlType = rs.getInt( 5 ); String sqlTypeName = rs.getString( 6 ); boolean isNullable = "YES".equals( rs.getString( 18 ) ); boolean isAutoincrement = false; try { isAutoincrement = "YES".equals( rs.getString( 23 ) ); } catch ( Throwable t ) { // thanks to Larry E. for this } LOG.debug( "Found column '" + column + "', typeName: '" + sqlTypeName + "', typeCode: '" + sqlType + "', isNullable: '" + isNullable + "', isAutoincrement:' " + isAutoincrement + "'" ); // type name works for PostGIS, MSSQL and Oracle if ( sqlTypeName.toLowerCase().contains( "geometry" ) ) { String srid = dialect.getUndefinedSrid(); ICRS crs = CRSManager.getCRSRef( "EPSG:4326", true ); CoordinateDimension dim = DIM_2; GeometryPropertyType.GeometryType geomType = GeometryType.GEOMETRY; Statement stmt = null; ResultSet rs2 = null; try { stmt = conn.createStatement(); String sql = dialect.geometryMetadata( qTable, column, false ); rs2 = stmt.executeQuery( sql ); if ( rs2.next() ) { if ( rs2.getInt( 2 ) != -1 ) { crs = CRSManager.lookup( "EPSG:" + rs2.getInt( 2 ), true ); srid = "" + rs2.getInt( 2 ); } else { srid = dialect.getUndefinedSrid(); } if ( rs2.getInt( 1 ) == 3 ) { dim = DIM_3; } geomType = getGeometryType( rs2.getString( 3 ) ); LOG.debug( "Derived geometry type: " + geomType + ", crs: " + crs + ", srid: " + srid + ", dim: " + dim + "" ); } else { LOG.warn( "No metadata for geometry column '" + column + "' available in DB. Using defaults." ); } } catch ( Exception e ) { LOG.warn( "Unable to determine geometry column details: " + e.getMessage() + ". Using defaults.", e ); } finally { JDBCUtils.close( rs2, stmt, null, LOG ); } ColumnMetadata columnMd = new ColumnMetadata( column, sqlType, sqlTypeName, isNullable, geomType, dim, crs, srid ); columnNameToMD.put( new SQLIdentifier( column ), columnMd ); } else if ( sqlTypeName.toLowerCase().contains( "geography" ) ) { LOG.warn( "Detected geography column. This is not fully supported yet. Expect bugs." ); String srid = dialect.getUndefinedSrid(); ICRS crs = CRSManager.getCRSRef( "EPSG:4326", true ); CoordinateDimension dim = DIM_2; GeometryPropertyType.GeometryType geomType = GeometryType.GEOMETRY; Statement stmt = null; ResultSet rs2 = null; try { stmt = conn.createStatement(); String sql = dialect.geometryMetadata( qTable, column, true ); rs2 = stmt.executeQuery( sql ); if ( rs2.next() ) { if ( rs2.getInt( 2 ) != -1 ) { crs = CRSManager.lookup( "EPSG:" + rs2.getInt( 2 ), true ); srid = "" + rs2.getInt( 2 ); } else { srid = dialect.getUndefinedSrid(); } if ( rs2.getInt( 1 ) == 3 ) { dim = DIM_3; } geomType = getGeometryType( rs2.getString( 3 ).toUpperCase() ); LOG.debug( "Derived geometry type (geography): " + geomType + ", crs: " + crs + ", srid: " + srid + ", dim: " + dim + "" ); } else { LOG.warn( "No metadata for geography column '" + column + "' available in DB. Using defaults." ); } } catch ( Exception e ) { LOG.warn( "Unable to determine geography column details: " + e.getMessage() + ". Using defaults.", e ); } finally { JDBCUtils.close( rs2, stmt, null, LOG ); } ColumnMetadata columnMd = new ColumnMetadata( column, sqlType, sqlTypeName, isNullable, geomType, dim, crs, srid ); columnNameToMD.put( new SQLIdentifier( column ), columnMd ); } else { ColumnMetadata columnMd = new ColumnMetadata( column, sqlType, sqlTypeName, isNullable, isAutoincrement ); columnNameToMD.put( new SQLIdentifier( column ), columnMd ); } } tableNameToColumns.put( new TableName( qTable.toString() ), columnNameToMD ); } finally { JDBCUtils.close( rs ); } } return columnNameToMD; } } class ColumnMetadata { String column; int sqlType; String sqlTypeName; boolean isNullable; boolean isAutoincrement; GeometryType geomType; GeometryStorageParams geometryParams; ColumnMetadata( String column, int sqlType, String sqlTypeName, boolean isNullable, boolean isAutoincrement ) { this.column = column; this.sqlType = sqlType; this.sqlTypeName = sqlTypeName; this.isNullable = isNullable; this.isAutoincrement = isAutoincrement; } public ColumnMetadata( String column, int sqlType, String sqlTypeName, boolean isNullable, GeometryType geomType, CoordinateDimension dim, ICRS crs, String srid ) { this.column = column; this.sqlType = sqlType; this.sqlTypeName = sqlTypeName; this.isNullable = isNullable; this.geomType = geomType; this.geometryParams = new GeometryStorageParams( crs, srid, dim ); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
54c807b18e10a84cdfe9944f05917eac3c3408e0
5586cdb05b4d59e15baf24159fe321b50908c412
/Geekr/src/com/gnod/geekr/tool/manager/ImageCache.java
15da9907ae43d603614a78ea272a35bb01914503
[]
no_license
Gnod/Geekr
461f3dce04dbc7b5c1212c35eb9702dbf4441a23
a1708f3098090bd6214830a94ffcd0ffad1d26f0
refs/heads/master
2021-01-17T05:22:00.332671
2014-05-22T02:59:04
2014-05-22T02:59:04
9,688,804
1
0
null
null
null
null
UTF-8
Java
false
false
14,188
java
package com.gnod.geekr.tool.manager; import java.io.File; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.ref.SoftReference; import java.security.MessageDigest; import java.security.MessageDigestSpi; import java.security.NoSuchAlgorithmException; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import com.gnod.geekr.BuildConfig; import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Bitmap.CompressFormat; import android.graphics.Bitmap.Config; import android.graphics.drawable.BitmapDrawable; import android.media.ImageReader; import android.os.Environment; import android.os.Build.VERSION_CODES; import android.os.StatFs; import android.support.v4.util.LruCache; import android.util.Log; public class ImageCache { private static final String TAG = ImageCache.class.getSimpleName(); // Default memory cache size in KB private static final int DEFAULT_MEM_CACHE_SIZE = 5 * 1024; // 5MB // Default disk cache size in bytes private static final int DEFAULT_DISK_CACHE_SIZE = 10 * 1024 * 1024; // 10MB private static final boolean DEFAULT_MEM_CACHE_ENABLED = true; private static final boolean DEFAULT_DISK_CACHE_ENABLED = true; private static final boolean DEFAULT_INIT_DISK_CACHE_ON_CREATE = false; public static final CompressFormat DEFAULT_COMPRESS_FORMAT = CompressFormat.PNG; public static final int DEFAULT_COMPRESS_QUALITY = 70; public static final int DISK_CACHE_INDEX = 0; private static ImageCache sImageCache; private Set<SoftReference<Bitmap>> mReusableBitmaps; private ImageCacheParams mCacheParams; private LruCache<String, BitmapDrawable> mMemCache; private final Object mDiskCacheLock = new Object(); private DiskLruCache mDiskLruCache; private boolean mDiskCacheStarting = true; public static ImageCache getInstance(ImageCache.ImageCacheParams params) { if(sImageCache == null ) { sImageCache = new ImageCache(params); } return sImageCache; } private ImageCache(ImageCacheParams params) { init(params); } private void init(ImageCacheParams params) { mCacheParams = params; if (mCacheParams.memCacheEnabled) { if (Utils.hasHoneycomb()) { mReusableBitmaps = Collections.synchronizedSet(new HashSet<SoftReference<Bitmap>>()); } mMemCache = new LruCache<String, BitmapDrawable>(mCacheParams.memCacheSize) { @Override protected void entryRemoved(boolean evicted, String key, BitmapDrawable oldValue, BitmapDrawable newValue) { if (RecyclingBitmapDrawable.class.isInstance(oldValue)) { ((RecyclingBitmapDrawable)oldValue).setIsCached(false); } else { if (Utils.hasHoneycomb()) { mReusableBitmaps.add(new SoftReference<Bitmap>(oldValue.getBitmap())); } } } /** * Measure item size in kilobytes rather than units which is more practical * for a bitmap cache */ @Override protected int sizeOf(String key, BitmapDrawable value) { final int size = getBitmapSize(value) / 1024; // KB return size == 0 ? 1 : size; } }; } if (params.initDiskCacheOnCreate) { initDiskCache(); } } public void initDiskCache() { synchronized (mDiskCacheLock) { if (mDiskLruCache == null || mDiskLruCache.isClosed()) { File diskCacheDir = mCacheParams.diskCacheDir; if (mCacheParams.diskCacheEnabled && diskCacheDir != null) { if (!diskCacheDir.exists()) { diskCacheDir.mkdirs(); } if (getUsableSpace(diskCacheDir) > mCacheParams.diskCacheSize) { try { mDiskLruCache = DiskLruCache.open(diskCacheDir, 1, 1, mCacheParams.diskCacheSize); } catch (IOException e) { mCacheParams.diskCacheDir = null; Log.e(TAG, "initDiskCache -- " + e); } } } } mDiskCacheStarting = false; mDiskCacheLock.notifyAll(); } } public void addBitmapToCache(String data, BitmapDrawable value) { if (data == null || value == null) { return; } addToMemCache(data, value); synchronized (mDiskCacheLock) { if (mDiskLruCache != null) { final String key = hashKeyForDisk(data); OutputStream out = null; try { DiskLruCache.Snapshot snapshot = mDiskLruCache.get(key); if (snapshot == null) { final DiskLruCache.Editor editor = mDiskLruCache.edit(key); if (editor != null) { out = editor.newOutputStream(DISK_CACHE_INDEX); value.getBitmap().compress(mCacheParams.compressFormat, mCacheParams.compressQuality, out); editor.commit(); out.close(); } } else { snapshot.getInputStream(DISK_CACHE_INDEX).close(); } } catch (IOException e) { Log.e(TAG, "addBitmapToCache -- " + e); } catch (Exception e) { Log.e(TAG, "addBitmapToCache -- " + e); } finally { try { if (out != null) { out.close(); } } catch (IOException e) { } } } } } public void addToMemCache(String data, BitmapDrawable value) { if (mMemCache != null) { if (RecyclingBitmapDrawable.class.isInstance(value)) { ((RecyclingBitmapDrawable)value).setIsCached(true); } mMemCache.put(data, value); } } public BitmapDrawable getBitmapFromMemCache(String data) { BitmapDrawable value = null; if (mMemCache != null) { value = mMemCache.get(data); } if (BuildConfig.DEBUG && value != null) { Log.d(TAG, "Memory cache hit"); } return value; } public Bitmap getBitmapFromDiskCache(String data) { final String key = hashKeyForDisk(data); Bitmap bitmap = null; synchronized (mDiskCacheLock) { while (mDiskCacheStarting) { try { mDiskCacheLock.wait(); } catch (InterruptedException e) { } } if (mDiskLruCache != null) { InputStream input = null; try { final DiskLruCache.Snapshot snapshot = mDiskLruCache.get(key); if (snapshot != null) { if (BuildConfig.DEBUG) { Log.d(TAG, "Disk cache hit"); } input = snapshot.getInputStream(DISK_CACHE_INDEX); if (input != null) { FileDescriptor fd = ((FileInputStream)input).getFD(); bitmap = ImageResizer.decodeSampledBitmapFromDescriptor( fd, Integer.MAX_VALUE, Integer.MAX_VALUE, this); } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return bitmap; } protected Bitmap getBitmapFromReusableSet(BitmapFactory.Options options) { Bitmap bitmap = null; if (mReusableBitmaps != null && !mReusableBitmaps.isEmpty()) { final Iterator<SoftReference<Bitmap>> it = mReusableBitmaps.iterator(); Bitmap item; while (it.hasNext()) { item = it.next().get(); if (item != null && item.isMutable()) { if (canUseForInBitmap(item, options)) { bitmap = item; it.remove(); break; } else { it.remove(); } } } } return bitmap; } /** * Clears both the memory and disk cache associated with this ImageCache object. Note that * this includes disk access so this should not be executed on the main/UI thread. */ public void clearCache() { if (mMemCache != null) { mMemCache.evictAll(); if (BuildConfig.DEBUG) { Log.d(TAG, "memory cache cleared"); } } synchronized (mDiskCacheLock) { mDiskCacheStarting = true; if (mDiskLruCache != null && !mDiskLruCache.isClosed()) { try { mDiskLruCache.delete(); if (BuildConfig.DEBUG) { Log.d(TAG, "disk cache cleared"); } } catch (IOException e) { Log.e(TAG, "clearCache -- " + e); } mDiskLruCache = null; initDiskCache(); } } } /** * Flushes the disk cache associated with this ImageCache object. Note that this includes * disk access so this should not be executed on the main/UI thread. */ public void flush() { synchronized (mDiskCacheLock) { if (mDiskLruCache != null) { try { mDiskLruCache.flush(); if (BuildConfig.DEBUG) { Log.d(TAG, "Disk cache flushed"); } } catch (IOException e) { Log.e(TAG, "flush -- " + e); } } } } /** * Closes the disk cache associated with this ImageCache object. Note that this includes * disk access so this should not be executed on the main/UI thread. */ public void close() { synchronized (mDiskCacheLock) { if (mDiskLruCache != null) { try { if (!mDiskLruCache.isClosed()) { mDiskLruCache.close(); mDiskLruCache = null; if (BuildConfig.DEBUG) { Log.d(TAG, "Disk cache closed"); } } } catch (IOException e) { Log.e(TAG, "close - " + e); } } } } @TargetApi(VERSION_CODES.KITKAT) private static boolean canUseForInBitmap(Bitmap candidate, BitmapFactory.Options targetOptions) { if (!Utils.hasKitKat()) { return candidate.getWidth() == targetOptions.outWidth && candidate.getHeight() == targetOptions.outHeight && targetOptions.inSampleSize == 1; } // From Android 4.4 (KitKat) onward we can re-use if the byte size of the new bitmap // is smaller than the reusable bitmap candidate allocation byte count. final int width = targetOptions.outWidth / targetOptions.inSampleSize; final int height = targetOptions.outHeight / targetOptions.inSampleSize; int byteCount = width * height * getBytesPerPixel(candidate.getConfig()); return byteCount <= candidate.getAllocationByteCount(); } private static int getBytesPerPixel(Config config) { if (config == Config.ARGB_8888) { return 4; } else if (config == Config.ARGB_4444) { return 2; } else if (config == Config.RGB_565) { return 2; } else if (config == Config.ALPHA_8) { return 1; } return 1; } @TargetApi(VERSION_CODES.GINGERBREAD) public static long getUsableSpace(File path) { if (Utils.hasGingerbread()) { return path.getUsableSpace(); } final StatFs stats = new StatFs(path.getPath()); return (long)stats.getBlockSize() * (long)stats.getAvailableBlocks(); } /** * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat) * onward this returns the allocated memory size of the bitmap which can be larger than the * actual bitmap data byte count (in the case it was re-used). * */ @TargetApi(VERSION_CODES.KITKAT) public static int getBitmapSize(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); if (Utils.hasKitKat()) { return bitmap.getAllocationByteCount(); } if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } return bitmap.getRowBytes() * bitmap.getHeight(); } public static String hashKeyForDisk(String key) { String cacheKey; try { final MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(key.getBytes()); cacheKey = bytesToHexString(digest.digest()); } catch (NoSuchAlgorithmException e) { cacheKey = String.valueOf(key.hashCode()); } return cacheKey; } public static String bytesToHexString(byte[] bytes) { StringBuilder sb = new StringBuilder(); for(int i = 0; i < bytes.length; i ++) { String hex = Integer.toHexString(0xFF & bytes[i]); if (hex.length() == 1) { sb.append('0'); } sb.append(hex); } return sb.toString(); } public static File getDiskCacheDir(Context context, String uniqueName) { final String cachePath = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !isExternalStorageRemovable() ? getExternalCacheDir(context).getPath() : context.getCacheDir().getPath(); return new File(cachePath + File.separator + uniqueName); } @TargetApi(VERSION_CODES.GINGERBREAD) public static boolean isExternalStorageRemovable() { if (Utils.hasGingerbread()) { return Environment.isExternalStorageRemovable(); } return true; } @TargetApi(VERSION_CODES.FROYO) public static File getExternalCacheDir(Context context) { if (Utils.hasFroyo()) { return context.getExternalCacheDir(); } // Before Froyo we need to construct the external cache dir final String cacheDir = "Android/data/" + context.getPackageName() + "/cache/"; return new File(Environment.getExternalStorageDirectory().getPath() + cacheDir); } public static class ImageCacheParams { public int memCacheSize = DEFAULT_MEM_CACHE_SIZE; public int diskCacheSize = DEFAULT_DISK_CACHE_SIZE; public boolean memCacheEnabled = DEFAULT_MEM_CACHE_ENABLED; public boolean diskCacheEnabled = DEFAULT_DISK_CACHE_ENABLED; public boolean initDiskCacheOnCreate = DEFAULT_INIT_DISK_CACHE_ON_CREATE; private File diskCacheDir; public CompressFormat compressFormat = DEFAULT_COMPRESS_FORMAT; public int compressQuality = DEFAULT_COMPRESS_QUALITY; public ImageCacheParams(Context context, String diskCacheDirName) { diskCacheDir = getDiskCacheDir(context, diskCacheDirName); } /** * Sets the memory cache size based on a percentage of the max available VM memory. * Eg. setting percent to 0.2 would set the memory cache to one fifth of the available * memory. Throws {@link IllegalArgumentException} if percent is < 0.01 or > .8. * memCacheSize is stored in kilobytes instead of bytes as this will eventually be passed * to construct a LruCache which takes an int in its constructor. * */ public void setMemCacheSizePercent(float percent) { if (percent < 0.01f || percent > 0.8f) { throw new IllegalArgumentException("setMemCacheSizePercent - percent must be between 0.01 and 0.8 (inclusive)"); } memCacheSize = Math.round(percent * Runtime.getRuntime().maxMemory() / 1024); } } }
[ "gnodsy@gmail.com" ]
gnodsy@gmail.com
318a901265b45460631ec1eb2d7f74baa66a952c
ff3a8892b4f36f4b0d3c222fd1963b55c11ef865
/src/main/java/com/jewelcse045/Job/Scheduler/repository/CompanyRepository.java
00cf65cb09455146a242877b30f7d256172ab721
[]
no_license
jewelcse/job-scheduler
8336dd7871166ec0686c9493f10df0fbb0937634
a472a3d1e4599c7e6a8e885322d44e2a17e162d1
refs/heads/main
2023-07-22T12:26:29.388759
2021-09-05T08:18:26
2021-09-05T08:18:26
403,252,668
0
0
null
null
null
null
UTF-8
Java
false
false
321
java
package com.jewelcse045.Job.Scheduler.repository; import com.jewelcse045.Job.Scheduler.entities.CompanyEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface CompanyRepository extends JpaRepository<CompanyEntity,Integer> { }
[ "jewelcse045@gmail.com" ]
jewelcse045@gmail.com
9a147735412f465c46149aee575cbae3106fca2d
7a7784a05e852c786ab738c9249b2e789a281830
/src/combit/ListLabel24/Dom/PropertyTickmarks.java
f3894e279d4798b4fd21d79b64fb90b73af33ad2
[]
no_license
Javonet-io-user/cb0faafa-c3bc-459d-875b-35b3a72f2c01
f0df08dd23549194ae97f73e649f7beaedb6291f
0e197d5e214fe7b1ab4198cd6d2d696df2d37f45
refs/heads/master
2020-05-30T23:15:41.108869
2019-06-03T13:39:02
2019-06-03T13:39:02
190,012,737
0
0
null
null
null
null
UTF-8
Java
false
false
2,557
java
package combit.ListLabel24.Dom; import Common.Activation; import static Common.JavonetHelper.Convert; import static Common.JavonetHelper.getGetObjectName; import static Common.JavonetHelper.getReturnObjectName; import static Common.JavonetHelper.ConvertToConcreteInterfaceImplementation; import Common.JavonetHelper; import Common.MethodTypeAnnotation; import com.javonet.Javonet; import com.javonet.JavonetException; import com.javonet.JavonetFramework; import com.javonet.api.NObject; import com.javonet.api.NEnum; import com.javonet.api.keywords.NRef; import com.javonet.api.keywords.NOut; import com.javonet.api.NControlContainer; import java.util.concurrent.atomic.AtomicReference; import java.util.Iterator; import java.lang.*; import combit.ListLabel24.Dom.*; public class PropertyTickmarks extends DomItem { protected NObject javonetHandle; /** SetProperty */ @MethodTypeAnnotation(type = "SetField") public void setAutomatic(java.lang.String value) { try { javonetHandle.set("Automatic", value); } catch (JavonetException _javonetException) { _javonetException.printStackTrace(); } } /** GetProperty */ @MethodTypeAnnotation(type = "GetField") public java.lang.String getAutomatic() { try { java.lang.String res = javonetHandle.get("Automatic"); if (res == null) return ""; return (java.lang.String) res; } catch (JavonetException _javonetException) { _javonetException.printStackTrace(); return ""; } } /** SetProperty */ @MethodTypeAnnotation(type = "SetField") public void setDistance(java.lang.String value) { try { javonetHandle.set("Distance", value); } catch (JavonetException _javonetException) { _javonetException.printStackTrace(); } } /** GetProperty */ @MethodTypeAnnotation(type = "GetField") public java.lang.String getDistance() { try { java.lang.String res = javonetHandle.get("Distance"); if (res == null) return ""; return (java.lang.String) res; } catch (JavonetException _javonetException) { _javonetException.printStackTrace(); return ""; } } public PropertyTickmarks(NObject handle) { super(handle); this.javonetHandle = handle; } public void setJavonetHandle(NObject handle) { this.javonetHandle = handle; } static { try { Activation.initializeJavonet(); } catch (java.lang.Exception e) { e.printStackTrace(); } } }
[ "support@javonet.com" ]
support@javonet.com
e008f3aadcceed8dacadce29b06d576b7a978160
45a9c6b516c4fde6314363fdf5b900623e484096
/fast/src/edu/purdue/cs/fast/helper/SpatialHelper.java
89fd12ed4584b689732e40d13b7f66e13a7646f5
[]
no_license
purduedb/fast
d1b1f6906a3feaf91a7cb6475716dc8d6354b0b7
96bbc2180d313c5c7333bd03ef32338a22fa5880
refs/heads/master
2020-04-10T16:00:15.547623
2018-05-20T17:32:29
2018-05-20T17:32:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,602
java
/** * Copyright Jul 5, 2015 * Author : Ahmed Mahmood * 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 edu.purdue.cs.fast.helper; import java.util.ArrayList; public class SpatialHelper { private final static double QUARTERPI = Math.PI / 4.0; /** * This function checks if a KNN query is fully satisfied internal to the * current evaluator bolt * * @param query * @return */ /** * Basic LInear Conversion * * @param lonlat * @return */ // public static Point convertFromLatLonToXYPoint(LatLong lonlat){ // // // // Point xy = new Point(); // xy.setX( (lonlat.getLatitude()+90)/180 *SpatioTextualConstants.xMaxRange); // xy.setY((lonlat.getLongitude()+180)/360*SpatioTextualConstants.yMaxRange); // // return xy; // } public static Point convertFromLatLonToXYPoint(LatLong lonlat) { Point xy = new Point(); xy.setY((lonlat.getLatitude() - SpatioTextualConstants.minLat) / (SpatioTextualConstants.maxLat - SpatioTextualConstants.minLat) * SpatioTextualConstants.yMaxRange); xy.setX((lonlat.getLongitude() - SpatioTextualConstants.minLong) / (SpatioTextualConstants.maxLong - SpatioTextualConstants.minLong) * SpatioTextualConstants.xMaxRange); return xy; } public static Point convertFromLatLonToXYPoint(LatLong lonlat, double minLat, double minLong, double maxLat, double maxLong) { Point xy = new Point(); xy.setY((lonlat.getLatitude() - minLat) / (maxLat - minLat) * SpatioTextualConstants.yMaxRange); xy.setX((lonlat.getLongitude() - minLong) / (maxLong - minLong) * SpatioTextualConstants.xMaxRange); return xy; } public static LatLong convertFromXYToLatLonTo(Point xy) { LatLong latlong = new LatLong(); latlong.setLatitude((xy.getY() / SpatioTextualConstants.yMaxRange * (SpatioTextualConstants.maxLat - SpatioTextualConstants.minLat)) + SpatioTextualConstants.minLat); latlong.setLongitude((xy.getX() / SpatioTextualConstants.xMaxRange * (SpatioTextualConstants.maxLong - SpatioTextualConstants.minLong)) + SpatioTextualConstants.minLong); return latlong; } /** * Basic Linear Conversion * * @param lonlat * @return */ // public static LatLong convertFromXYToLatLonTo(Point xy){ // // LatLong latlong = new LatLong(); // latlong.setLatitude((xy.getX()/SpatioTextualConstants.xMaxRange*180)-90); // latlong.setLongitude((xy.getY()/SpatioTextualConstants.yMaxRange*360)-180); // // return latlong; // } public static LatLong convertFromXYToLatLonTo(Point xy, double minLat, double minLong, double maxLat, double maxLong) { LatLong latlong = new LatLong(); latlong.setLatitude((xy.getY() / SpatioTextualConstants.yMaxRange * (maxLat - minLat)) + minLat); latlong.setLongitude((xy.getX() / SpatioTextualConstants.xMaxRange * (maxLong - minLong)) + minLong); return latlong; } public static Double getArea(Rectangle rect) { return (rect.getMax().X - rect.getMin().X) * (rect.getMax().Y - rect.getMin().Y); } public static Double getDistanceInBetween(Point p1, Point p2) { Double dist = 0.0; dist = Math.sqrt(Math.pow(p1.getX() - p2.getX(), 2) + Math.pow(p1.getY() - p2.getY(), 2)); return dist; } public static double getAreaInBetween(Point a, Point b, Point c) { return (b.X-a.X)*(c.Y-a.Y) - (b.Y-a.Y)*(c.X-a.X); } public static Double getMaxDistanceBetween(Point point, Rectangle recangle) { Point p1 = recangle.getMin(); Point p2 = recangle.getMax(); Point p3 = new Point(p1.getX(), p2.getY()); Point p4 = new Point(p1.getY(), p2.getX()); Double dist1 = getDistanceInBetween(point, p1); Double dist2 = getDistanceInBetween(point, p2); Double dist3 = getDistanceInBetween(point, p3); Double dist4 = getDistanceInBetween(point, p4); return Math.max(Math.max(dist1, dist2), Math.max(dist3, dist4)); } public static Double getMinDistanceBetween(Point point, Rectangle recangle) { Double dx = Math.max(0.0, Math.max(recangle.getMin().getX() - point.getX(), point.getX() - recangle.getMax().getX())); Double dy = Math.max(0.0, Math.max(recangle.getMin().getY() - point.getY(), point.getY() - recangle.getMax().getY())); return Math.sqrt(dx * dx + dy * dy); } // public static LatLong convertFromXYToLatLonTo(Point xy, Double latMin, Double lonMin, Double latMax, Double lonMax) { // // LatLong latlong = new LatLong(); // latlong.setLatitude((xy.getX() / SpatioTextualConstants.xMaxRange * (latMax - latMin)) + latMin); // latlong.setLongitude((xy.getY() / SpatioTextualConstants.yMaxRange * (lonMax - lonMin)) + lonMin); // // return latlong; // } public static Boolean insideSpatially(Rectangle bigRectangle, Rectangle smallRectangle) { if ((smallRectangle.getMin().getX() >= bigRectangle.getMin().getX() || Double.compare(smallRectangle.getMin().getX(), bigRectangle.getMax().getX()) == 0) && (smallRectangle.getMax().getX() <= bigRectangle.getMax().getX() || Double.compare(smallRectangle.getMax().getX(), bigRectangle.getMin().getX()) == 0) && (smallRectangle.getMin().getY() >= bigRectangle.getMin().getY() || Double.compare(smallRectangle.getMin().getY(), bigRectangle.getMax().getY()) == 0) && (smallRectangle.getMax().getY() <= bigRectangle.getMax().getY() || Double.compare(smallRectangle.getMax().getY(), bigRectangle.getMin().getY()) == 0)) return true; return false; } public static Point mapDataPointToIndexCellCoordinates(Point point, int xCellCount, int yCellCount, double xMaxRange, double yMaxRange) { Double xStep = xMaxRange / xCellCount; Double yStep = yMaxRange / yCellCount; Integer xCell = (int) (point.getX() / xStep); Integer yCell = (int) (point.getY() / yStep); if (xCell >= xCellCount) xCell = (int) ((xCellCount) - 1); if (yCell >= yCellCount) yCell = (int) ((yCellCount) - 1); if (xCell < 0) xCell = 0; if (yCell < 0) yCell = 0; return new Point((double) (xCell), (double) (yCell)); } public static ArrayList<Point> mapRectangleToIndexCellCoordinatesListAll(Rectangle rectangle, int xCellCount, int yCellCount, double xMaxRange, double yMaxRange) { Double localXstep = xMaxRange / xCellCount; Double localYstep = yMaxRange / yCellCount; Rectangle selfBounds = new Rectangle(new Point(0, 0), new Point(xMaxRange, yMaxRange)); ArrayList<Point> partitions = new ArrayList<Point>(); double xmin, ymin, xmax, ymax; if (rectangle == null || selfBounds == null) return partitions; if (rectangle.getMin().getX() < selfBounds.getMin().getX()) xmin = selfBounds.getMin().getX(); else xmin = rectangle.getMin().getX(); if (rectangle.getMin().getY() < selfBounds.getMin().getY()) ymin = selfBounds.getMin().getY(); else ymin = rectangle.getMin().getY(); if (rectangle.getMax().getX() > selfBounds.getMax().getX()) xmax = selfBounds.getMax().getX();//to prevent exceeding index range else xmax = rectangle.getMax().getX(); if (rectangle.getMax().getY() > selfBounds.getMax().getY()) ymax = selfBounds.getMax().getY();//to prevent exceeding index range else ymax = rectangle.getMax().getY(); if (xmax == selfBounds.getMax().getX()) xmax = selfBounds.getMax().getX() - 1; if (ymax == selfBounds.getMax().getY()) ymax = selfBounds.getMax().getY() - 1; xmin -= selfBounds.getMin().getX(); ymin -= selfBounds.getMin().getY(); xmax -= selfBounds.getMin().getX(); ymax -= selfBounds.getMin().getY(); int xMinCell = (int) (xmin / localXstep); int yMinCell = (int) (ymin / localYstep); int xMaxCell = (int) (xmax / localXstep); int yMaxCell = (int) (ymax / localYstep); for (Integer xCell = xMinCell; xCell <= xMaxCell; xCell++) for (Integer yCell = yMinCell; yCell <= yMaxCell; yCell++) { Point indexCell = new Point(xCell, yCell); partitions.add(indexCell); } return partitions; } public static ArrayList<Point> mapRectangleToIndexCellCoordinatesListMinMax(Rectangle rectangle, int xCellCount, int yCellCount, double xMaxRange, double yMaxRange) { Double localXstep = xMaxRange / xCellCount; Double localYstep = yMaxRange / yCellCount; Rectangle selfBounds = new Rectangle(new Point(0, 0), new Point(xMaxRange, yMaxRange)); ArrayList<Point> partitions = new ArrayList<Point>(); double xmin, ymin, xmax, ymax; if (rectangle == null || selfBounds == null) return partitions; if (rectangle.getMin().getX() < selfBounds.getMin().getX()) xmin = selfBounds.getMin().getX(); else xmin = rectangle.getMin().getX(); if (rectangle.getMin().getY() < selfBounds.getMin().getY()) ymin = selfBounds.getMin().getY(); else ymin = rectangle.getMin().getY(); if (rectangle.getMax().getX() > selfBounds.getMax().getX()) xmax = selfBounds.getMax().getX();//to prevent exceeding index range else xmax = rectangle.getMax().getX(); if (rectangle.getMax().getY() > selfBounds.getMax().getY()) ymax = selfBounds.getMax().getY();//to prevent exceeding index range else ymax = rectangle.getMax().getY(); if (xmax == selfBounds.getMax().getX()) xmax = selfBounds.getMax().getX() - 1; if (ymax == selfBounds.getMax().getY()) ymax = selfBounds.getMax().getY() - 1; xmin -= selfBounds.getMin().getX(); ymin -= selfBounds.getMin().getY(); xmax -= selfBounds.getMin().getX(); ymax -= selfBounds.getMin().getY(); int xMinCell = (int) (xmin / localXstep); int yMinCell = (int) (ymin / localYstep); int xMaxCell = (int) (xmax / localXstep); int yMaxCell = (int) (ymax / localYstep); Point indexCell = new Point(xMinCell, yMinCell); partitions.add(indexCell); indexCell = new Point(xMaxCell, yMaxCell); partitions.add(indexCell); return partitions; } // public static Boolean overlapsSpatially(Point point, Rectangle rectangle) { // if ( (point.getX() >= rectangle.getMin().getX()||Math.abs(point.getX() - rectangle.getMin().getX())<.000001) // && (point.getX() <= rectangle.getMax().getX()||Math.abs(point.getX() - rectangle.getMax().getX())<.000001 ) // && (point.getY() >= rectangle.getMin().getY()|| Math.abs(point.getY() -rectangle.getMin().getY())<.000001 ) // && (point.getY() <= rectangle.getMax().getY()|| Math.abs(point.getY() - rectangle.getMax().getY())<.000001) // ) // return true; // return false; // } public static Boolean overlapsSpatially(Point point, Rectangle rectangle) { if (Double.compare(point.getX(), rectangle.getMin().getX()) < 0 || Double.compare(point.getX(), rectangle.getMax().getX()) > 0 || Double.compare(point.getY(), rectangle.getMin().getY()) < 0 || Double.compare(point.getY(), rectangle.getMax().getY()) > 0) return false; return true; } public static Boolean overlapsSpatially(Rectangle rectangle1, Rectangle rectangle2) { if ((rectangle1.getMin().getX() <= rectangle2.getMax().getX() || Math.abs(rectangle1.getMin().getX() - rectangle2.getMax().getX()) < .000001) && (rectangle1.getMax().getX() >= rectangle2.getMin().getX() || Math.abs(rectangle1.getMax().getX() - rectangle2.getMin().getX()) < .000001) && (rectangle1.getMin().getY() <= rectangle2.getMax().getY() || Math.abs(rectangle1.getMin().getY() - rectangle2.getMax().getY()) < .000001) && (rectangle1.getMax().getY() >= rectangle2.getMin().getY() || Math.abs(rectangle1.getMax().getY() - rectangle2.getMin().getY()) < .000001)) return true; return false; } public static Rectangle spatialIntersect(Rectangle rect1, Rectangle rect2) { return new Rectangle( new Point( Math.max(rect1.getMin().getX(), rect2.getMin().getX()), Math.max(rect1.getMin().getY(), rect2.getMin().getY())), new Point( Math.min(rect1.getMax().getX(), rect2.getMax().getX()), Math.min(rect1.getMax().getY(), rect2.getMax().getY()))); } public static Rectangle union(Rectangle rect1, Rectangle rect2) { return new Rectangle(new Point(Math.min(rect1.getMin().getX(), rect2.getMin().getX()), Math.min(rect1.getMin().getY(), rect2.getMin().getY())), new Point(Math.max(rect1.getMax().getX(), rect2.getMax().getX()), Math.max(rect1.getMax().getY(), rect2.getMax().getY()))); } public static Rectangle expand(Rectangle rect1, Double area) { return new Rectangle(new Point(Math.max(rect1.getMin().getX() - area, 0), Math.max(rect1.getMin().getY() - area, 0)), new Point(Math.min(rect1.getMax().getX() + area, SpatioTextualConstants.xMaxRange), Math.min(rect1.getMax().getY() + area, SpatioTextualConstants.yMaxRange))); } /** * Splits a partition into two partitions. * * @param parent * The partition to be split. * @param splitPosition * The position at which the split is to be done. * @param isHorizontal * Whether the split is horizontal or vertical. * @param costEstimator * This parameter is used when estimating the size and cost of * the resulting partitions. * @return */ }
[ "ar8ahmed@gmail.com" ]
ar8ahmed@gmail.com
3970463f18ebf1efb2a632a7c1fe9b7d90d1c4bd
7082ee6380f14988de56874402f67f27959bbf2a
/app/src/main/java/net/ruinnel/pedometer/PedometerService.java
6f82605d4070d61846606c9f6ee5a75bf241baac
[]
no_license
ruinnel/pedometer-example
e6d55be7d1aab4f804b969437da0ee9d5c4be8a3
4cfede16a0ccfed702ac0daf9ccd25c51945a28f
refs/heads/master
2021-01-02T08:46:13.981254
2019-07-11T14:42:14
2019-07-11T14:42:14
78,595,834
0
0
null
null
null
null
UTF-8
Java
false
false
5,215
java
/* * Filename : PedometerService.java * Comment : * History : 2017/01/11, ruinnel, Create * * Version : 1.0 * Author : Copyright (c) 2017 by ruinnel. All Rights Reserved. */ package net.ruinnel.pedometer; import android.app.Service; import android.content.Intent; import android.hardware.Sensor; import android.hardware.SensorManager; import android.os.Binder; import android.os.Build; import android.os.IBinder; import android.support.v4.content.LocalBroadcastManager; import net.ruinnel.pedometer.db.DatabaseManager; import net.ruinnel.pedometer.db.bean.History; import net.ruinnel.pedometer.util.Log; import net.ruinnel.pedometer.util.StepDetector; import net.ruinnel.pedometer.util.StepListener; import net.ruinnel.pedometer.util.Utils; import javax.inject.Inject; /** * Created by ruinnel on 2017. 1. 11.. */ public class PedometerService extends Service implements StepListener { private static final String TAG = PedometerService.class.getSimpleName(); //private static final int STEP_COUNTER_LATENCY = 1 * 60 * 1000 * 1000; // 1 min // microsecond private static final int STEP_COUNTER_LATENCY = 10 * 1000 * 1000; // 10 sec // microsecond public class PedometerServiceBinder extends Binder { public PedometerService getService() { return PedometerService.this; } } private final IBinder mBinder = new PedometerServiceBinder(); private Pedometer mApp; @Inject Settings mSettings; @Inject SensorManager mSensorManager; @Inject DatabaseManager mDbManager; private StepDetector mStepDetector; private boolean mIsRegistered; @Override public void onCreate() { super.onCreate(); mIsRegistered = false; mApp = (Pedometer) getApplication(); mApp.component().inject(this); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.v(TAG, "onStartCommand called!"); mStepDetector = new StepDetector(); mStepDetector.addStepListener(this); // 종료 후 Log.v(TAG, "isStarted = " + mSettings.isStarted()); if (mSettings.isStarted()) { reRegisterSensorListener(); } return START_STICKY; } @Override public void onDestroy() { Log.v(TAG, "onDestroy called!"); super.onDestroy(); mSensorManager.unregisterListener(mStepDetector); } @Override public IBinder onBind(Intent intent) { return mBinder; } public void startPedometer() { mSettings.setStarted(true); reRegisterSensorListener(); } public void stopPedometer() { mSettings.setStarted(false); unregisterSensorListener(); } private void reRegisterSensorListener() { Log.d(TAG, "re-register sensor listener"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { // over KITKAT_WATCH(20) Sensor stepCounter = mSensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); if (stepCounter != null) { Log.i(TAG, "using TYPE_STEP_COUNTER"); unregisterSensorListener(); mSensorManager.registerListener(mStepDetector, stepCounter, SensorManager.SENSOR_DELAY_NORMAL, STEP_COUNTER_LATENCY); mIsRegistered = true; } } else { Sensor accelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); if (accelerometer != null && !mIsRegistered) { Log.i(TAG, "using ACCELEROMETER"); mSensorManager.registerListener(mStepDetector, accelerometer, SensorManager.SENSOR_DELAY_NORMAL); mIsRegistered = true; } } } private void unregisterSensorListener() { try { mIsRegistered = false; mSensorManager.unregisterListener(mStepDetector); Log.v(TAG, "unregisterSensorListener - " + mStepDetector); } catch (Exception e) { Log.w(TAG, "unregister sensor lister fail.", e); } } @Override public void onStep() { Intent broadcast = new Intent(Settings.ACTION_STEP); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); Log.d(TAG, "onStep - 1"); History history = mDbManager.todayHistory(); if (history == null) { history = new History(); history.day = Utils.getToday(); history.steps = 1; mDbManager.saveHistory(history); } else { history.steps = history.steps + 1; mDbManager.updateHistory(history); } } @Override public void onStepCount(int steps) { Log.d(TAG, "onStepCount = " + steps); int pauseSteps = mSettings.getPauseSteps(); if (pauseSteps == 0) { // init mSettings.setPauseSteps(steps); pauseSteps = steps; } int diff = steps - pauseSteps; if (diff > 0) { History history = mDbManager.todayHistory(); if (history == null) { history = new History(); history.day = Utils.getToday(); history.steps = diff; mDbManager.saveHistory(history); } else { history.steps = history.steps + diff; mDbManager.updateHistory(history); } Log.d(TAG, "paused = " + pauseSteps + ", today = " + history.steps + ", diff = " + diff); mSettings.setPauseSteps(steps); } Intent broadcast = new Intent(Settings.ACTION_STEP); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); } }
[ "ruinnel@gmail.com" ]
ruinnel@gmail.com
c8cc051b8028f68b32b05050db8046d62f8d20c1
a1d4e03cdee9abaa6bed791fac6a80589700e525
/Shadow Of The Empire Server/src/ShadowServer/Websocket.java
46022a32191725a3b8234f8835b3ae8784392cf5
[]
no_license
Maxfojtik/Shadow-of-The-Empire
da55e1c7b08ff7c7ceaebf936012d5c98aaa877c
e6394b585a5730f06bca7ea17c5fe4f0aba80aae
refs/heads/master
2023-01-02T18:32:53.190017
2020-10-23T01:05:11
2020-10-23T01:05:11
301,564,816
0
0
null
null
null
null
UTF-8
Java
false
false
17,262
java
package ShadowServer; import java.net.InetSocketAddress; import java.nio.file.Files; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import java.util.Set; import org.java_websocket.WebSocket; import org.java_websocket.handshake.ClientHandshake; import org.java_websocket.server.WebSocketServer; import org.json.JSONArray; import org.json.JSONObject; import ShadowServer.Problem.Solution; class Websockets extends WebSocketServer { public Websockets() { super(new InetSocketAddress(12398)); } static HashMap<WebSocket, Player> playerConnections = new HashMap<>(); static WebSocket getByValue(Player valuePlayer) { Set<Entry<WebSocket, Player>> entrySet = playerConnections.entrySet(); WebSocket targetKey = null; for(Entry<WebSocket, Player> entry : entrySet) { if(entry.getValue().equals(valuePlayer)) { targetKey = entry.getKey(); } } return targetKey; } static void send(WebSocket conn, String toSend) { String str = conn.getRemoteSocketAddress().getAddress().getHostAddress()+" <- "+toSend; System.out.println(str); FileSystem.log(str); conn.send(toSend); } static void sendSliders(WebSocket conn) { send(conn, "SliderValues|"+ShadowServer.theGame.theEmpire.wealth+"|"+ShadowServer.theGame.theEmpire.military+"|"+ShadowServer.theGame.theEmpire.consciousness+"|"+ShadowServer.theGame.theEmpire.culture+"|"+ShadowServer.theGame.theEmpire.piety); } static void sendAccept(WebSocket conn, Player p) { playerConnections.put(conn, p); send(conn, "AcceptSessionID|"+p.sessionId+"|"+p.isAdmin+"|"+ShadowServer.theGame.problemPhase); if(!p.isAdmin && ShadowServer.theGame.problemPhase) { sendProblems(conn, p); } if(!p.isAdmin && !ShadowServer.theGame.problemPhase) { sendPopulateUserVotingPhase(conn); } } public void broadcast(String toSend) { String str = "SYSTEM <- "+toSend; System.out.println(str); FileSystem.log(str); super.broadcast(toSend); } static void sendPopulateUserVotingPhase(WebSocket conn) { JSONArray json = new JSONArray(); for(int i = 0; i < ShadowServer.theGame.problems.size(); i++) { JSONObject problemJson = new JSONObject(); Problem problem = ShadowServer.theGame.problems.get(i); problemJson.put("text", problem.text); problemJson.put("title", problem.title); JSONArray solutionsJson = new JSONArray(); for(int k = 0; k < problem.solutions.size(); k++) { JSONObject solJson = new JSONObject(); Solution sol = problem.solutions.get(k); solJson.put("text", sol.text); solJson.put("title", sol.title); if(sol.playerSubmitted!=null) { solJson.put("who", sol.playerSubmitted.username); } JSONArray peopleJson = new JSONArray(); for(int l = 0; l < sol.whoVotedOnMe.size(); l++) { peopleJson.put(sol.whoVotedOnMe.get(l).username); } solJson.put("votes", peopleJson); solutionsJson.put(solJson); } problemJson.put("solutions",solutionsJson); json.put(problemJson); } send(conn, "PopulateUserVotingPhase|"+json.toString()); } static void sendProblems(WebSocket conn, Player p) { JSONObject json = new JSONObject(); JSONArray problems = new JSONArray(); json.put("hasTakenAction", p.hasSubmittedSolution || p.mySigniture!=null); for(int i = 0; i < ShadowServer.theGame.problems.size(); i++) { Problem problem = ShadowServer.theGame.problems.get(i); JSONObject problemJson = new JSONObject(); problemJson.put("problemText", problem.text); problemJson.put("problemTitle", problem.title); JSONArray proposedSolutions = new JSONArray(); JSONArray givenSolutions = new JSONArray(); for(int j = 0; j < problem.solutions.size(); j++) { Solution s = problem.solutions.get(j); if(s.playerSubmitted != null) { JSONObject solutionJson = new JSONObject(); solutionJson.put("text", s.text); solutionJson.put("title", s.title); solutionJson.put("who", s.playerSubmitted.username); JSONArray solutionSignatures = new JSONArray(); for(int k = 0; k < s.whoSignedOnMe.size(); k++) { solutionSignatures.put(s.whoSignedOnMe.get(k).username); } solutionJson.put("signatures", solutionSignatures); proposedSolutions.put(solutionJson); } else { JSONObject givenSolution = new JSONObject(); givenSolution.put("title", s.title); givenSolution.put("text", s.text); givenSolutions.put(givenSolution); } } problemJson.put("givenSolutions", givenSolutions); problemJson.put("proposedSolutions", proposedSolutions); problems.put(problemJson); } json.put("problems", problems); send(conn, "Problems|"+json.toString()); } @Override public void onOpen(WebSocket conn, ClientHandshake handshake) { sendSliders(conn); if(!ShadowServer.theGame.acceptNewSignups) { send(conn, "SignupsDisabled"); } send(conn, "UpdateState|InSliders"); //This method sends a message to the new client System.out.println(conn.getRemoteSocketAddress().getAddress().getHostAddress() + " connected"); } @Override public void onClose(WebSocket conn, int code, String reason, boolean remote) { boolean removed = playerConnections.remove(conn) != null; System.out.println(conn.getRemoteSocketAddress().getAddress().getHostAddress() + " disconnected; "+(removed ? "Removed successfully " : " NOT REMOVED, DESYNC IMMINENT")); } @Override public void onMessage(WebSocket conn, String message) { try { String messageStr = conn.getRemoteSocketAddress().getAddress().getHostAddress() + " -> " + message; System.out.println(messageStr); FileSystem.log(messageStr); String[] params = message.split("\\|"); if(params[0].equals("SetSessionId")) { if(ShadowServer.doesPlayerExist(params[1]+"|"+params[2])) { Player thePlayer = ShadowServer.theGame.players.get(params[1]+"|"+params[2]); sendAccept(conn, thePlayer); } else { try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } send(conn, "DenySessionID"); } } else if(params[0].equals("Signup")) { if(ShadowServer.doesPlayerExist(params[1]+"|"+params[2])) { send(conn, "DenySignup|The username has already been taken"); } else if(!License.isValid(params[3])) { send(conn, "DenySignup|The code you gave was WRONG!"); } else if(!ShadowServer.theGame.acceptNewSignups) { send(conn, "DenySignup|Sadly the signups have been locked because the game has started"); } else { Player p = new Player(params[1], params[2], License.isAdmin(params[3])); // p.myVotes = new int[ShadowServer.theGame.problems.size()]; // for(int i = 0; i < p.myVotes.length; i++) // { // p.myVotes[i] = -1; // } // System.out.println(params[1]+" created an account with "+params[2]+" as password and the code of "+params[3]); ShadowServer.theGame.players.put(p.sessionId, p); License.usedCode(params[3]); FileSystem.save(); send(conn, "AcceptSignup"); sendAccept(conn, p); } } else if(params[0].equals("Sliders")) { sendSliders(conn); } else if(params[0].equals("ChangeToProblemPhase")) { try { String session = params[1]+"|"+params[2]; Player p = ShadowServer.theGame.players.get(session); if(p!=null && p.isAdmin) { ThePast.save(); ShadowServer.theGame.problems.clear(); String jsonRaw = params[3]; JSONArray problemsJson = new JSONArray(jsonRaw); for(int i = 0; i < problemsJson.length(); i++) { JSONObject problemJson = problemsJson.getJSONObject(i); Problem problem = new Problem(problemJson.getString("problemTitle"), problemJson.getString("problemText")); JSONArray solutionsJson = problemJson.getJSONArray("solutions"); for(int k = 0; k < solutionsJson.length(); k++) { JSONObject solutionJson = solutionsJson.getJSONObject(k); Solution solution = new Solution(solutionJson.getString("title"), solutionJson.getString("text"), null); problem.solutions.add(solution); } ShadowServer.theGame.problems.add(problem); } } else { send(conn, "Error|You dont exist or you're not admin."); } Collection<WebSocket> sockets = getConnections(); for(WebSocket sock : sockets) { Player thePlayer = playerConnections.get(sock); if(thePlayer!=null) { if(!thePlayer.isAdmin) { sendProblems(sock, thePlayer); } } } ShadowServer.theGame.problemPhase = true; FileSystem.save(); } catch(Exception e) {e.printStackTrace();send(conn, "Error|Something went wrong in the JSON parse: "+e.getCause()+" "+e.getMessage());} } else if(params[0].equals("ChangeToVotingPhase")) { String session = params[1]+"|"+params[2]; Player p = ShadowServer.theGame.players.get(session); if(p!=null && p.isAdmin) { ThePast.save(); ShadowServer.theGame.problemPhase = false; for(Problem problem : ShadowServer.theGame.problems) { if(problem.solutions.size()>problem.numberOfPremades()) { Solution theBestSolution = problem.solutions.get(problem.numberOfPremades()); for(Solution solution : problem.solutions) { if(solution.whoSignedOnMe.size()>theBestSolution.whoSignedOnMe.size()) { theBestSolution = solution; } } ArrayList<Solution> badSolutions = new ArrayList<Solution>(); for(Solution solution : problem.solutions) { if(!solution.equals(theBestSolution) && solution.playerSubmitted!=null) { badSolutions.add(solution); } } problem.solutions.removeAll(badSolutions); } } Collection<Player> players = ShadowServer.theGame.players.values(); for(Player thePlayer : players) { thePlayer.myVotes = new int[ShadowServer.theGame.problems.size()]; thePlayer.hasSubmittedSolution = false; thePlayer.mySigniture = null; for(int i = 0; i < thePlayer.myVotes.length; i++) { thePlayer.myVotes[i] = -1; } } Collection<WebSocket> sockets = getConnections(); for(WebSocket sock : sockets) { Player thePlayer = playerConnections.get(sock); if(thePlayer!=null && !thePlayer.isAdmin) { sendPopulateUserVotingPhase(sock); } } FileSystem.save(); } else { send(conn, "Error|You dont exist or you're not admin."); } } else if(params[0].equals("Lock")) { String session = params[1]+"|"+params[2]; Player p = ShadowServer.theGame.players.get(session); if(p!=null && p.isAdmin) { ShadowServer.theGame.acceptNewSignups = false; broadcast("SignupsDisabled"); send(conn, "Message|Signups locked successfully. There are "+ShadowServer.theGame.players.size()+" players signed up. Let the game begin!"); } } else if(params[0].equals("SetSlider")) { try { String session = params[1]+"|"+params[2]; Player p = ShadowServer.theGame.players.get(session); if(p!=null && p.isAdmin) { int value = Integer.parseInt(params[4]); if(params[3].equals("Wealth")) { ShadowServer.theGame.theEmpire.wealth = value; } else if(params[3].equals("Military")) { ShadowServer.theGame.theEmpire.military = value; } else if(params[3].equals("Consciousness")) { ShadowServer.theGame.theEmpire.consciousness = value; } else if(params[3].equals("Culture")) { ShadowServer.theGame.theEmpire.culture = value; } else if(params[3].equals("Piety")) { ShadowServer.theGame.theEmpire.piety = value; } Collection<WebSocket> connections = getConnections(); for(WebSocket socket : connections) { sendSliders(socket); } FileSystem.save(); } else { send(conn, "Error|You dont exist or you're not admin."); } } catch(NumberFormatException e) { send(conn, "Error|Enter an integer please"); } catch(Exception e) { send(conn, "Error|"+e.toString()); } } // else if(params[0].equals("Problems")) // { // sendProblems(conn, p); // } else if(params[0].equals("ProposeSolution")) { if(params.length!=6) { send(conn, "Error|Please enter more information"); } else { String session = params[1]+"|"+params[2]; Player p = ShadowServer.theGame.players.get(session); int problem = Integer.parseInt(params[3]); String title = params[4]; String text = params[5]; if(!p.hasSubmittedSolution) { Problem theProblem = ShadowServer.theGame.problems.get(problem); Solution newSolution = new Solution(title, text, p); // newSolution.whoSigndOnMe.add(p); theProblem.solutions.add(newSolution); broadcast("SolutionProposed|"+problem+"|"+title+"|"+text+"|"+p.username); p.hasSubmittedSolution = true; } FileSystem.save(); } } else if(params[0].equals("Sign")) { String session = params[1]+"|"+params[2]; int problem = Integer.parseInt(params[3]); int solution = Integer.parseInt(params[4]); int theFakeSolution = solution; Player p = ShadowServer.theGame.players.get(session); if(!p.hasSubmittedSolution) { if(p.mySigniture==null) { Problem theProblem = ShadowServer.theGame.problems.get(problem); solution += theProblem.numberOfPremades(); Solution theSolution = theProblem.solutions.get(solution); theSolution.whoSignedOnMe.add(p); p.mySigniture = theSolution; FileSystem.save(); JSONArray people = new JSONArray(); for(Player signedPlayer : theSolution.whoSignedOnMe) { people.put(signedPlayer.username); } broadcast("SignedFor|"+problem+"|"+theFakeSolution+"|"+people.toString()); } else { send(conn, "Error|You have already cast a signature"); } } else { send(conn, "Error|You can't sign on a solution if you submitted one, also stop cheating."); } } else if(params[0].equals("Signnt")) { String session = params[1]+"|"+params[2]; int problem = Integer.parseInt(params[3]); int solution = Integer.parseInt(params[4]); int theFakeSolution = solution; Player p = ShadowServer.theGame.players.get(session); if(p.mySigniture!=null) { Problem theProblem = ShadowServer.theGame.problems.get(problem); solution += theProblem.numberOfPremades(); Solution theSolution = theProblem.solutions.get(solution); if(theSolution.whoSignedOnMe.remove(p)) { p.mySigniture = null; } else { send(conn, "Error|You can't Signnt on that solution because you signed on a different one."); } FileSystem.save(); JSONArray people = new JSONArray(); for(Player signedPlayer : theSolution.whoSignedOnMe) { people.put(signedPlayer.username); } broadcast("SignedFor|"+problem+"|"+theFakeSolution+"|"+people.toString()); } else { send(conn, "Error|You can't Signnt because you haven't signed"); } } else if(params[0].equals("ToggleVote")) { String session = params[1]+"|"+params[2]; int problem = Integer.parseInt(params[3]); int solution = Integer.parseInt(params[4]); Player p = ShadowServer.theGame.players.get(session); if(p!=null) { Problem theProblem = ShadowServer.theGame.problems.get(problem); if(p.myVotes[problem]!=-1) { Solution theSolution = theProblem.solutions.get(p.myVotes[problem]); if(!theSolution.whoVotedOnMe.remove(p)) { send(conn, "Error|There was a problem removing your old vote"); } else { JSONArray votedArray = new JSONArray(); for(Player thePlayer : theSolution.whoVotedOnMe) { votedArray.put(thePlayer.username); } broadcast("VotedFor|"+problem+"|"+p.myVotes[problem]+"|"+votedArray.toString()); } } if(p.myVotes[problem] == solution) { p.myVotes[problem] = -1; } else { Solution theSolution = theProblem.solutions.get(solution); theSolution.whoVotedOnMe.add(p); p.myVotes[problem] = solution; } Solution theSolution = theProblem.solutions.get(solution); JSONArray votedArray = new JSONArray(); for(Player thePlayer : theSolution.whoVotedOnMe) { votedArray.put(thePlayer.username); } broadcast("VotedFor|"+problem+"|"+solution+"|"+votedArray.toString()); } else { send(conn, "Error|You dont exist and this catch is here to push the game forward"); } } } catch(Exception e) {e.printStackTrace();send(conn, "Error|"+e.toString());} } @Override public void onError(WebSocket conn, Exception ex) { ex.printStackTrace(); } @Override public void onStart() { setConnectionLostTimeout(60); } }
[ "maxfojtik@bex.net" ]
maxfojtik@bex.net
7993c0aef7f66060e0b95ea3b03add232f70362e
5d7a2cd91d7a2d9b4088f9ea03519743bd35e121
/javajungsuk_basic_src/ch03/src/Ex3_1.java
b526b4fad58d5ff296b693b9ce4c7d312a167c92
[]
no_license
castello/javajungsuk_basic
d2e7424d6ace57b0eb98e8ab7480b68be1accae5
59300902f26cc3b1e6d0c8a39e763664983d2c68
refs/heads/master
2023-03-16T01:36:08.755528
2023-03-07T18:10:16
2023-03-07T18:10:16
204,616,795
588
290
null
null
null
null
UHC
Java
false
false
205
java
class Ex3_1 { public static void main(String[] args) { int x, y; x = y = 3; // y에 3이 저장된 후에, x에 3이 저장된다. System.out.println("x=" + x); System.out.println("y=" + y); } }
[ "castello@naver.com" ]
castello@naver.com
352b878a417eb87b5d48bcb82aafea1d3ee4d75a
5b9bcb911766da23e6f7829266c6cf5d9a2794ab
/Common/src/main/java/com/disignstudio/common/guice/DatabaseModule.java
1b494bc00ae67c14e16e591bdd985fdb5b2d2e1b
[]
no_license
sshrem/DisignStudioServices
77835a766b6e1ceef11afbdaee123253968684e5
0c3fc566d91eef17eb342ff000c43401b6be42f9
refs/heads/master
2020-06-13T16:35:20.144286
2017-06-01T13:36:02
2017-06-01T13:36:02
75,710,486
0
0
null
null
null
null
UTF-8
Java
false
false
2,745
java
package com.disignstudio.common.guice; import com.disignstudio.common.configuration.ConfigurationProvider; import com.google.inject.Binder; import com.google.inject.Module; import org.apache.commons.dbcp.BasicDataSource; import org.springframework.jdbc.core.JdbcTemplate; /** * Created by ohadbenporat on 1/10/16. */ public class DatabaseModule implements Module { private ConfigurationProvider configuration; public DatabaseModule(ConfigurationProvider configuration) { this.configuration = configuration; } @Override public void configure(Binder binder) { binder.bind(JdbcTemplate.class).toInstance(generateJdbcTemplate()); } private JdbcTemplate generateJdbcTemplate() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setUrl(configuration.provideProperty("mysql.rw.url")); dataSource.setUsername(configuration.provideProperty("mysql.rw.username")); dataSource.setPassword(configuration.provideProperty("mysql.rw.password")); dataSource.setDriverClassName(configuration.provideProperty("mysql.rw.driverClassName")); dataSource.setDefaultReadOnly(false); dataSource.setInitialSize(configuration.providePropertyAsInt("mysql.rw.initialSize")); dataSource.setMaxActive(configuration.providePropertyAsInt("mysql.rw.maxActive")); dataSource.setMaxWait(configuration.providePropertyAsInt("mysql.rw.maxWait")); dataSource.setMaxIdle(configuration.providePropertyAsInt("mysql.rw.maxIdle")); dataSource.setMinIdle(configuration.providePropertyAsInt("mysql.rw.minIdle")); dataSource.setValidationQuery(configuration.provideProperty("mysql.rw.validationQuery")); dataSource.setTestWhileIdle(configuration.providePropertyAsBoolean("mysql.rw.testWhileIdle")); dataSource.setTestOnBorrow(configuration.providePropertyAsBoolean("mysql.rw.testOnBorrow")); dataSource.setTestOnReturn(configuration.providePropertyAsBoolean("mysql.rw.testOnReturn")); dataSource.setMinEvictableIdleTimeMillis(configuration.providePropertyAsInt("mysql.rw.minEvitableIdleTimeMillis")); dataSource.setRemoveAbandoned(configuration.providePropertyAsBoolean("mysql.rw.removeAbandoned")); dataSource.setRemoveAbandonedTimeout(configuration.providePropertyAsInt("mysql.rw.removeAbandonedTimeout")); dataSource.setDefaultAutoCommit(configuration.providePropertyAsBoolean("mysql.rw.autoCommit")); dataSource.setNumTestsPerEvictionRun(configuration.providePropertyAsInt("mysql.rw.numTetsPerEvictionRun")); dataSource.setLogAbandoned(configuration.providePropertyAsBoolean("mysql.rw.logAbandoned")); return new JdbcTemplate(dataSource); } }
[ "qaz123wsx" ]
qaz123wsx
a5f9db401c4e814924ca89b1bad665682f5542f6
8a401d172201140be62fff90ead5379c14d71e78
/PrintOddEven.java
57be7d52d08f7c97aaf77b6fc0b7eb7729842192
[]
no_license
abhra-mica/Threads
31cc009525dcf70fddab563a21180eafb2a9576a
1c71acaebceaa22b14c19b291e191203214c08ba
refs/heads/master
2020-04-24T19:17:14.804439
2019-02-25T17:35:55
2019-02-25T17:35:55
172,207,243
0
0
null
null
null
null
UTF-8
Java
false
false
1,229
java
package THREAD; public class PrintOddEven { public static void main(String[] args) { Counter count = new Counter(); Thread odd = new Thread(new OddThread(count)); Thread even = new Thread(new EvenThread(count)); odd.start(); even.start(); } } class OddThread implements Runnable { Counter count = null; OddThread(Counter count) { this.count = count; } public void run() { synchronized (count) { for (int i = 0; i < 10; i++) { if (count.count % 2 != 0) { System.out.println("Odd Number:: " + count.count); count.count++; count.notify(); } else { try { count.wait(); } catch (InterruptedException e) { } } } } } } class EvenThread implements Runnable { Counter count = null; EvenThread(Counter count) { this.count = count; } public void run() { synchronized (count) { for (int i = 0; i < 10; i++) { if (count.count % 2 == 0) { System.out.println("Even Number:: " + count.count); count.count++; count.notify(); } else { try { count.wait(); } catch (InterruptedException e) { } } } } } } class Counter { int count; }
[ "noreply@github.com" ]
noreply@github.com
85b2e68a60a768fbf74beaad9ff480cfd10edd0a
dacf8ad60854c2beb910059496b09e186f0b9499
/library/src/main/java/com/zhy/http/okhttp/request/PostFileRequest.java
6726c34e1a75d0e7d6abef7b2e7d9f2c71ef9835
[]
no_license
Leeeast/WTNEWS
dab17b6bb3b8143b88f3fb9dc486bff5bd2d3e57
e865b988b1582b956566079f7f50593953b95e52
refs/heads/master
2021-05-11T22:03:28.214193
2018-01-16T02:01:40
2018-01-16T02:01:40
117,483,807
0
0
null
null
null
null
UTF-8
Java
false
false
2,033
java
package com.zhy.http.okhttp.request; import com.zhy.http.okhttp.OkHttpUtils; import com.zhy.http.okhttp.callback.Callback; import com.zhy.http.okhttp.utils.Exceptions; import java.io.File; import java.util.Map; import okhttp3.MediaType; import okhttp3.Request; import okhttp3.RequestBody; /** * Created by zhy on 15/12/14. */ public class PostFileRequest extends OkHttpRequest { private static MediaType MEDIA_TYPE_STREAM = MediaType.parse("application/octet-stream"); private File file; private MediaType mediaType; public PostFileRequest(String url, Object tag, Map<String, String> params, Map<String, String> headers, File file, MediaType mediaType, int id) { super(url, tag, params, headers, id); this.file = file; this.mediaType = mediaType; if (this.file == null) { Exceptions.illegalArgument("the file can not be null !"); } if (this.mediaType == null) { this.mediaType = MEDIA_TYPE_STREAM; } } @Override protected RequestBody buildRequestBody() { return RequestBody.create(mediaType, file); } @Override protected RequestBody wrapRequestBody(RequestBody requestBody, final Callback callback) { if (callback == null) return requestBody; CountingRequestBody countingRequestBody = new CountingRequestBody(requestBody, new CountingRequestBody.Listener() { @Override public void onRequestProgress(final long bytesWritten, final long contentLength) { OkHttpUtils.getInstance().getDelivery().execute(new Runnable() { @Override public void run() { callback.inProgress(bytesWritten * 1.0f / contentLength, contentLength, id); } }); } }); return countingRequestBody; } @Override protected Request buildRequest(RequestBody requestBody) { return builder.post(requestBody).build(); } }
[ "dongfang369" ]
dongfang369
063befac83f45a5dd5e0afab15a6598bf752d96d
21c8575f62c07cc9fab0f295d20f0421b39572a9
/jsefundamentals/src/test/java/strings/StringsTest.java
e98b69e46154bb843e87191c1374554d9d496522
[]
no_license
HelenaCastro/Rumos_Java
7a65a44fab8283e66956d6ee54a221b5557aea89
c4ff1fe546ee4d2d20dd9d4dd8d9caf3eccb70f2
refs/heads/master
2020-04-08T09:38:49.100882
2019-02-26T12:33:01
2019-02-26T12:33:01
159,233,059
0
0
null
null
null
null
UTF-8
Java
false
false
47
java
package strings; public class StringsTest { }
[ "helenacastro30@hotmail.com" ]
helenacastro30@hotmail.com
865e4d500691fa5f044aed634d29a7d27cf36866
d1c7f8b86483800236afae40571f587382186e38
/src/main/java/com/namvn/shopping/web/controller/HomeController.java
91d779bf99bc3acedff6d68fa71b814920733668
[]
no_license
5namtroinhuthe/hjy345afwjhkpoiyu
1ae5135c337a0511bff54bdc46187f419f8129e5
8e6302fcc30c8724d7bb7bdc92f94acd5d638bc7
refs/heads/master
2020-04-03T19:44:55.741829
2018-11-25T12:49:49
2018-11-25T12:49:49
155,534,160
0
0
null
null
null
null
UTF-8
Java
false
false
76
java
package com.namvn.shopping.web.controller; public class HomeController { }
[ "hahehiho95@gmail.com" ]
hahehiho95@gmail.com
083d39fd6da787b864906d5b4e531164fa74de85
7329206bf4ba983f14c6f9d954404dc15c29d170
/dist/game/data/scripts/handlers/effecthandlers/CubicMastery.java
5f7b40e4d4856188d75c14f07ad77df2be53e4d2
[]
no_license
polis77/polis_datapack_h5
4d5335a5ecf5f1f7aee6379256416cd4919cb6bb
d262c5c8baaf5748cbbcdb12857e38508a524ef0
refs/heads/master
2021-01-23T21:53:33.264509
2017-02-25T07:52:12
2017-02-25T07:52:12
83,112,906
0
0
null
null
null
null
UTF-8
Java
false
false
1,461
java
package handlers.effecthandlers; import com.polis.gameserver.model.StatsSet; import com.polis.gameserver.model.conditions.Condition; import com.polis.gameserver.model.effects.AbstractEffect; import com.polis.gameserver.model.skills.BuffInfo; /** * Cubic Mastery effect implementation. * @author Zoey76 */ public final class CubicMastery extends AbstractEffect { private final int _cubicCount; public CubicMastery(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); _cubicCount = params.getInt("cubicCount", 0); } @Override public boolean canStart(BuffInfo info) { return (info.getEffector() != null) && (info.getEffected() != null) && info.getEffected().isPlayer(); } @Override public void onStart(BuffInfo info) { final int cubicCount = info.getEffected().getActingPlayer().getStat().getMaxCubicCount() + _cubicCount; info.getEffected().getActingPlayer().getStat().setMaxCubicCount(cubicCount); } @Override public boolean onActionTime(BuffInfo info) { return info.getSkill().isPassive(); } @Override public void onExit(BuffInfo info) { final int cubicCount = info.getEffected().getActingPlayer().getStat().getMaxCubicCount() - _cubicCount; if (cubicCount <= 0) { info.getEffected().getActingPlayer().getStat().setMaxCubicCount(0); } else { info.getEffected().getActingPlayer().getStat().setMaxCubicCount(cubicCount); } } }
[ "policelazo@gmail.com" ]
policelazo@gmail.com
bd65c075269a3b9187683c7aa8e5977e5e781cb1
6045b067fc964c20d0c56a604ac510418232cf81
/src/com/extendedclip/papi/expansion/thirst/ThirstExpansion.java
3da25809b55eb3d342c445ce8500e8c4f7c8a133
[]
no_license
PlaceholderAPI/Thirst-Expansion
468cd7cefe95c34093456ca1998edcf281011aa1
1318c09b24ecc10fd5fd6db9202ef861d4032e14
refs/heads/master
2022-11-23T02:56:59.093698
2020-07-28T04:49:47
2020-07-28T04:49:47
283,097,182
0
0
null
null
null
null
UTF-8
Java
false
false
1,052
java
package com.extendedclip.papi.expansion.thirst; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import com.hmmcrunchy.thirst.Thirst; import me.clip.placeholderapi.expansion.PlaceholderExpansion; public class ThirstExpansion extends PlaceholderExpansion { private Thirst thirst; @Override public boolean canRegister() { return (thirst = (Thirst) Bukkit.getPluginManager().getPlugin(getRequiredPlugin())) != null; } @Override public String getAuthor() { return "clip"; } @Override public String getIdentifier() { return "thirst"; } @Override public String getRequiredPlugin() { return "Thirst"; } @Override public String getVersion() { return "1.2.1"; } @Override public String onRequest(OfflinePlayer offline, String s) { if (offline == null || !offline.isOnline()) { return ""; } if (this.thirst == null) { return "0"; } try { return String.valueOf(this.thirst.checkthirst((Player) offline)); } catch (Exception ex) { } return "0"; } }
[ "cj89898@gmail.com" ]
cj89898@gmail.com
7e7c79fe29197b122e5e8f862db250212783dee8
5515fe5ff06ebf054c87a650a6f1436ebf6212c9
/src/com/controller/Controller.java
8ba5bf7a6dec06223e76e49a89776717b902b0d0
[]
no_license
rafaramalho/Salario
57391211ecfa15ed0cb60eea5cc8d83ccd6cb7cf
abe9439397e9c46e2f748f39de9ce1bd816cf209
refs/heads/master
2020-05-30T13:23:34.700614
2019-06-02T02:57:45
2019-06-02T02:57:45
189,760,309
0
0
null
null
null
null
UTF-8
Java
false
false
1,093
java
package com.controller; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.beans.Desconto; import com.beans.Funcionario; import com.calculation.Calculadora; import com.model.DescontoDAO; import com.model.FuncionarioDAO; public class Controller { public static List<Funcionario> listaFuncionarios(){ FuncionarioDAO funcDao = new FuncionarioDAO(); DescontoDAO descontoDao = new DescontoDAO(); List<Funcionario> funcionarios = new ArrayList<Funcionario>(); try { for (Funcionario funcionario : funcDao.buscaTodos()) { // Busca descontos por funcionario List<Desconto> descontosFuncionario = descontoDao.buscaPorIdCliente(funcionario.getId()); // Calcula descontos Calculadora calculadora = new Calculadora(); calculadora.calcularDescontos(funcionario, descontosFuncionario); funcionarios.add(funcionario); } }catch (Exception e) { System.out.println("Erro:" + e.getCause()); e.printStackTrace(); } Collections.sort(funcionarios); return funcionarios; } }
[ "rafael.ramalho@ifactory.com.br" ]
rafael.ramalho@ifactory.com.br
ed102f6b5f56c691acd50749a7d5641c344e4b8f
783ad2715a6844571a23f263487d62f6ff9d74ba
/zuihou-authority/zuihou-authority-biz/src/main/java/com/github/zuihou/authority/strategy/DataScopeContext.java
dda2fcb9b035c2a2c57c3ca9480608abde93158d
[ "Apache-2.0" ]
permissive
kubesphere-sigs/lamp-cloud
a134906d1f09cc487e52e4c2035be5199ac709cb
98757989036b6b882ac1f05e1bad50f6f36ff440
refs/heads/v2.7.0-ks
2023-02-23T02:37:04.890276
2021-01-22T06:29:46
2021-01-22T06:29:46
328,581,468
1
0
Apache-2.0
2021-01-14T08:28:48
2021-01-11T07:25:05
null
UTF-8
Java
false
false
1,324
java
package com.github.zuihou.authority.strategy; import com.github.zuihou.database.mybatis.auth.DataScopeType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * 创建环境角色Context * * @author zuihou * @date 2019/07/22 */ @Service public class DataScopeContext { private final Map<String, AbstractDataScopeHandler> strategyMap = new ConcurrentHashMap<>(); /** * strategyMap 里边的key是指定其名字,这个会作为key放到strategyMap里 * * @param strategyMap */ @Autowired public DataScopeContext(Map<String, AbstractDataScopeHandler> strategyMap) { strategyMap.forEach(this.strategyMap::put); } /** * 通过数据权限类型,查询最全、最新的组织id * * @param orgList * @param dsType * @return */ public List<Long> getOrgIdsForDataScope(List<Long> orgList, DataScopeType dsType, Long userId) { AbstractDataScopeHandler handler = strategyMap.get(dsType.name()); if (handler == null) { return Collections.emptyList(); } return handler.getOrgIds(orgList, userId); } }
[ "244387066@qq.com" ]
244387066@qq.com
63f6fa8f894a809e8491f98145322dc1b943e688
32d0d42e534694ff493c1b995138a29b043499a4
/oms/web/src/main/java/com/ico/webapp/controller/BaseFormController.java
f9046fee69eab44e31efdd01e23e5eea5ea0b653
[]
no_license
thilanka02/OMS-trunk
f85be15b2b5131510590ba704c639284083254ae
96185feb493b6fccb97cbbde0f21c7d711a8185c
refs/heads/master
2021-01-17T09:24:01.781703
2017-03-05T16:35:07
2017-03-05T16:35:07
83,985,521
0
0
null
null
null
null
UTF-8
Java
false
false
8,167
java
package com.ico.webapp.controller; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.ico.Constants; import com.ico.model.User; import com.ico.service.MailEngine; import com.ico.service.UserManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.beans.propertyeditors.CustomNumberEditor; import org.springframework.context.MessageSource; import org.springframework.context.support.MessageSourceAccessor; import org.springframework.mail.SimpleMailMessage; import org.springframework.validation.Validator; import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.context.ServletContextAware; import org.springframework.web.multipart.support.ByteArrayMultipartFileEditor; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; /** * Implementation of <strong>SimpleFormController</strong> that contains * convenience methods for subclasses. For example, getting the current * user and saving messages/errors. This class is intended to * be a base class for all Form controllers. * * <p><a href="BaseFormController.java.html"><i>View Source</i></a></p> * * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a> */ public class BaseFormController implements ServletContextAware { public static final String MESSAGES_KEY = "successMessages"; public static final String ERRORS_MESSAGES_KEY = "errors"; protected final transient Log log = LogFactory.getLog(getClass()); private UserManager userManager = null; protected MailEngine mailEngine = null; protected SimpleMailMessage message = null; protected String templateName = "accountCreated.vm"; protected String cancelView; protected String successView; private MessageSourceAccessor messages; private ServletContext servletContext; @Autowired(required = false) Validator validator; @Autowired public void setMessages(MessageSource messageSource) { messages = new MessageSourceAccessor(messageSource); } @Autowired public void setUserManager(UserManager userManager) { this.userManager = userManager; } public UserManager getUserManager() { return this.userManager; } @SuppressWarnings("unchecked") public void saveError(HttpServletRequest request, String error) { List errors = (List) request.getSession().getAttribute(ERRORS_MESSAGES_KEY); if (errors == null) { errors = new ArrayList(); } errors.add(error); request.getSession().setAttribute(ERRORS_MESSAGES_KEY, errors); } @SuppressWarnings("unchecked") public void saveMessage(HttpServletRequest request, String msg) { List messages = (List) request.getSession().getAttribute(MESSAGES_KEY); if (messages == null) { messages = new ArrayList(); } messages.add(msg); request.getSession().setAttribute(MESSAGES_KEY, messages); } /** * Convenience method for getting a i18n key's value. Calling * getMessageSourceAccessor() is used because the RequestContext variable * is not set in unit tests b/c there's no DispatchServlet Request. * * @param msgKey * @param locale the current locale * @return */ public String getText(String msgKey, Locale locale) { return messages.getMessage(msgKey, locale); } /** * Convenient method for getting a i18n key's value with a single * string argument. * * @param msgKey * @param arg * @param locale the current locale * @return */ public String getText(String msgKey, String arg, Locale locale) { return getText(msgKey, new Object[] { arg }, locale); } /** * Convenience method for getting a i18n key's value with arguments. * * @param msgKey * @param args * @param locale the current locale * @return */ public String getText(String msgKey, Object[] args, Locale locale) { return messages.getMessage(msgKey, args, locale); } /** * Convenience method to get the Configuration HashMap * from the servlet context. * * @return the user's populated form from the session */ public Map getConfiguration() { Map config = (HashMap) servletContext.getAttribute(Constants.CONFIG); // so unit tests don't puke when nothing's been set if (config == null) { return new HashMap(); } return config; } /** * Set up a custom property editor for converting form inputs to real objects * @param request the current request * @param binder the data binder */ @InitBinder protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) { binder.registerCustomEditor(Integer.class, null, new CustomNumberEditor(Integer.class, null, true)); binder.registerCustomEditor(Long.class, null, new CustomNumberEditor(Long.class, null, true)); binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor()); SimpleDateFormat dateFormat = new SimpleDateFormat(getText("date.format", request.getLocale())); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, null, new CustomDateEditor(dateFormat, true)); } /** * Convenience message to send messages to users, includes app URL as footer. * @param user the user to send a message to. * @param msg the message to send. * @param url the URL of the application. */ protected void sendUserMessage(User user, String msg, String url) { if (log.isDebugEnabled()) { log.debug("sending e-mail to user [" + user.getEmail() + "]..."); } message.setTo(user.getFullName() + "<" + user.getEmail() + ">"); Map<String, Serializable> model = new HashMap<String, Serializable>(); model.put("user", user); // TODO: once you figure out how to get the global resource bundle in // WebWork, then figure it out here too. In the meantime, the Username // and Password labels are hard-coded into the template. // model.put("bundle", getTexts()); model.put("message", msg); model.put("applicationURL", url); mailEngine.sendMessage(message, templateName, model); } @Autowired public void setMailEngine(MailEngine mailEngine) { this.mailEngine = mailEngine; } @Autowired public void setMessage(SimpleMailMessage message) { this.message = message; } public void setTemplateName(String templateName) { this.templateName = templateName; } public final BaseFormController setCancelView(String cancelView) { this.cancelView = cancelView; return this; } public final String getCancelView() { // Default to successView if cancelView is invalid if (this.cancelView == null || this.cancelView.length()==0) { return getSuccessView(); } return this.cancelView; } public final String getSuccessView() { return this.successView; } public final BaseFormController setSuccessView(String successView) { this.successView = successView; return this; } public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; } protected ServletContext getServletContext() { return servletContext; } }
[ "thilanka.isurulakshan@gmail.com" ]
thilanka.isurulakshan@gmail.com
21c54b3747e393dbcd5c882e0f205e836d3f0182
7bc3f36f84a775097aad209c1a069f60f261f27f
/src/main/java/com/xcs/community/config/ThreadPoolConfig.java
791e7a1491d2d73592d843380aa0563be264925b
[]
no_license
xcs1130/xcs-community
0c5895f676e0c5dd85edd8af0e9ed2cd71c91b17
9be8bf839d1ed0da483d0f5fb4c2633d2a7a92d5
refs/heads/master
2022-07-04T20:38:48.440377
2020-05-12T01:14:20
2020-05-12T01:14:20
257,275,598
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.xcs.community.config; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; /** * @author xcs * @create 2020-05-08 9:31 */ @Configuration @EnableScheduling @EnableAsync public class ThreadPoolConfig { }
[ "1013826258@qq.com" ]
1013826258@qq.com
51b431f29f5368306ef7fb4c4995e5f86570d18d
313c8d1a07fda85439b5a7fc536ef886112adcaa
/src/main/java/com/adson/aplimc/services/exceptions/FileException.java
d9c6a0234a365a6a05bf24b340d394982b060d17
[]
no_license
Adson-C/aplic-modelagem-conceitual_spring-boot-ionic
6ac7465a7671c6ddf36df72793543c4dd27f687c
b269cfcdd44ab5266ccf198153871d12b6121485
refs/heads/main
2023-07-17T21:56:31.740802
2021-08-26T01:20:36
2021-08-26T01:20:36
394,068,371
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package com.adson.aplimc.services.exceptions; public class FileException extends RuntimeException { private static final long serialVersionUID = 1L; public FileException(String msg) { super(msg); } public FileException(String msg, Throwable cause) { super(msg, cause); } }
[ "adsonconcecao@yahoo.com.br" ]
adsonconcecao@yahoo.com.br
4b9193665943582a5bfe224ca609f586cb3089eb
bacebaccf6c2c1264803b53340e8b8cec9f90925
/src/xupt/se/ttms/dao/EmployeeDAO.java
49c8632a0297e1fe5fe1c0135d2b9fe7d8d1f689
[]
no_license
aini207080/TTMS-BS
ea30c3cbbd8c2723397fe6529ba1e1cdcd19783b
8f64d9ded1f8260df8f441dbba60b43f551f8820
refs/heads/master
2020-03-25T13:45:53.441621
2018-08-07T08:18:03
2018-08-07T08:18:03
143,841,811
1
0
null
null
null
null
UTF-8
Java
false
false
3,679
java
package xupt.se.ttms.dao; import java.util.LinkedList; import java.util.List; import java.sql.ResultSet; import xupt.se.ttms.idao.iEmployeeDAO; import xupt.se.ttms.model.Employee; import xupt.se.util.DBUtil; public class EmployeeDAO implements iEmployeeDAO { public int insert(Employee employee) { try { String sql = "insert into employee(emp_no,emp_name, emp_tel_num, emp_addr, emp_email)" + "values("+employee.getEmployee_workid() + ",'" +employee.getEmployee_name() + "','"+employee.getEmployee_tel() + "','"+employee.getEmployee_address() + "','"+ employee.getEmployee_email()+"')"; DBUtil db = new DBUtil(); db.openConnection(); ResultSet rst = db.getInsertObjectIDs(sql); if (rst!=null && rst.first()) { employee.setId(rst.getInt(1)); } db.close(rst); db.close(); return 1; } catch (Exception e) { e.printStackTrace(); } return 0; } public int update(Employee employee) { int rtn=0; try { String sql = "update employee set " + " emp_no =" + employee.getEmployee_workid() + ", " + " emp_name= '" + employee.getEmployee_name()+ "', " + " emp_tel_num = '" + employee.getEmployee_tel() + "', " + " emp_addr = '" + employee.getEmployee_address() + " ',"+"emp_email = '" + employee.getEmployee_email()+" ' "; sql += " where emp_id = " + employee.getId(); DBUtil db = new DBUtil(); db.openConnection(); rtn =db.execCommand(sql); db.close(); } catch (Exception e) { e.printStackTrace(); } return rtn; } public int delete(int ID) { int rtn=0; try{ String sql = "delete from employee "; sql += " where emp_id = " + ID; DBUtil db = new DBUtil(); db.openConnection(); rtn=db.execCommand(sql); db.close(); } catch (Exception e) { e.printStackTrace(); } return rtn; } public List<Employee> select(String condt) { List<Employee> empList = null; empList = new LinkedList<Employee>(); try { String sql = "select * from employee "; condt.trim(); if(!condt.isEmpty()) sql+= " where emp_name="+"'"+condt+"'"; DBUtil db = new DBUtil(); if(!db.openConnection()){ System.out.print("fail to connect database"); return null; } ResultSet rst = db.execQuery(sql); if (rst!=null) { while(rst.next()){ Employee employee=new Employee(); employee.setId(rst.getInt("emp_id")); employee.setEmployee_workid(rst.getInt("emp_no")); employee.setEmployee_name(rst.getString("emp_name")); employee.setEmployee_tel(rst.getString("emp_tel_num")); employee.setEmployee_address(rst.getString("emp_addr")); employee.setEmployee_email(rst.getString("emp_email")); empList.add(employee); } } db.close(rst); db.close(); } catch (Exception e) { e.printStackTrace(); } finally{ } return empList; } }
[ "997281047@qq.com" ]
997281047@qq.com
b3e0b76c2c0a1a931a7a6bc5146807ce4e0a1e09
852ae668be85e1bbbfb213ac030cd2bd9b13eb6e
/PUB/PubTermAdmin/build/generated-sources/jax-ws/de/fhdo/terminologie/ws/idp/userManagement/GetTermUserResponseType.java
eb676111b51422f30473be697e088d413c0c00ab
[]
no_license
TechnikumWienAcademy/Terminologieserver
e2a568ef04b8c378dfbe10b9add23d6253a708f9
bdb719233891efcc3c6761557898799a6eafcedd
refs/heads/master
2023-06-29T07:54:00.597735
2021-06-05T10:03:57
2021-06-05T10:03:57
176,249,973
0
0
null
2021-08-02T06:39:39
2019-03-18T09:44:26
Java
ISO-8859-1
Java
false
false
2,639
java
package de.fhdo.terminologie.ws.idp.userManagement; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java-Klasse für anonymous complex type. * * <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="returnInfos" type="{http://userManagement.idp.ws.terminologie.fhdo.de/}returnType" minOccurs="0"/> * &lt;element name="userList" type="{de.fhdo.termserver.idp.types}termUser" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "returnInfos", "userList" }) @XmlRootElement(name = "getTermUserResponseType") public class GetTermUserResponseType { protected ReturnType returnInfos; @XmlElement(nillable = true) protected List<TermUser> userList; /** * Ruft den Wert der returnInfos-Eigenschaft ab. * * @return * possible object is * {@link ReturnType } * */ public ReturnType getReturnInfos() { return returnInfos; } /** * Legt den Wert der returnInfos-Eigenschaft fest. * * @param value * allowed object is * {@link ReturnType } * */ public void setReturnInfos(ReturnType value) { this.returnInfos = value; } /** * Gets the value of the userList property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the userList property. * * <p> * For example, to add a new item, do as follows: * <pre> * getUserList().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link TermUser } * * */ public List<TermUser> getUserList() { if (userList == null) { userList = new ArrayList<TermUser>(); } return this.userList; } }
[ "bachinge@technikum-wien.at" ]
bachinge@technikum-wien.at
3ca712c380104ba6fd62f09a42b4aa0b147d7291
f479435c1bed31a283c825fda3602488882fbea3
/src/main/java/com/charge71/weather/service/OpenWeatherService.java
290cbc0b7def4a359ff3e8e850eba021aa4d8a54
[]
no_license
Charge71/weather-api
db447854aab810dd507325d5b2266576c7a4a5f2
d28a73d22535a2265b4fd22edf9e2170f4f006e2
refs/heads/master
2020-03-30T07:39:27.313095
2018-09-30T11:50:15
2018-09-30T11:50:15
150,956,335
0
0
null
null
null
null
UTF-8
Java
false
false
706
java
package com.charge71.weather.service; import com.fasterxml.jackson.databind.node.ObjectNode; /** * This class is a client of the OpenWeatherMap API. * * @author Diego Bardari * */ public interface OpenWeatherService { /** * Return the JSON object returned by the forecast OpenWeatherMap API for the * given city id or <code>null</code> if the id does not exist. * * @param cityId * the city id to look for * @return the JSON object returned by the forecast OpenWeatherMap API for the * given city id or <code>null</code> if the id does not exist * @throws Exception */ public ObjectNode getForecast(int cityId) throws Exception; }
[ "charge71@gmail.com" ]
charge71@gmail.com
34c3fee968b603e568dcb2ecad30d8d445a6fcbe
80ae216283696da5fa391bed81347d471c4a4500
/_1182.java
8d0740e21cb56f5812899366c13aed2282a32b7c
[]
no_license
sungwuk/BOJ
dfba7fb91577518ebc1b60b1cbb0e7d2f7fcd8bb
45bbac7a744f84eabd4db12dfd5925552bba512a
refs/heads/master
2020-03-10T08:18:03.700013
2018-10-29T11:36:56
2018-10-29T11:36:56
129,282,064
0
0
null
null
null
null
UTF-8
Java
false
false
673
java
import java.util.*; public class _1182 { static int n,s,dap=0,arr[]; static boolean[] check; static int ch() { int a=0,count=0;; for(int i=0;i<n;i++) { if(check[i]) { a+=arr[i]; count++; } } if(count==0) return Integer.MAX_VALUE; return a; } static void solve(int d) { if(ch()==s) { dap++; } for(int i=d;i<n;i++) { check[i]=true; solve(i+1); check[i]=false; } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); n=sc.nextInt(); s=sc.nextInt(); arr = new int[n]; check = new boolean[n]; for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); } solve(0); System.out.println(dap); } }
[ "psyy94@naver.com" ]
psyy94@naver.com
20bbe073327a35ab78f4cfee6d5d450a348ecdfc
9035619132f72941e97d2ddc337d60da31c7676c
/src/test/java/neobis/cms/Controller/Bishkek/UTMControllerTest.java
61e9183ba2d96c4fbedb5f13f6acc85d16436da5
[]
no_license
ZhazgulKadyrbekova/cms
8adf56db18fc9e1a938c2421bec40f2310e2db68
ebd83be5d724d7976f82d1280e43306700ba903b
refs/heads/master
2023-04-16T18:30:06.973113
2021-05-03T19:57:05
2021-05-03T19:57:05
336,848,863
0
0
null
null
null
null
UTF-8
Java
false
false
3,735
java
package neobis.cms.Controller.Bishkek; import com.fasterxml.jackson.databind.ObjectMapper; import neobis.cms.Dto.UtmDTO; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) @SpringBootTest @ContextConfiguration @WebAppConfiguration class UTMControllerTest { @Autowired private WebApplicationContext context; @Autowired private ObjectMapper mapper; private MockMvc mvc; String username = "admin@gmail.com"; @BeforeEach void setUp() { mvc = MockMvcBuilders .webAppContextSetup(context) .defaultRequest(get("/").with(user(username).roles("ADMIN"))) .defaultRequest(post("/").with(user(username).roles("ADMIN"))) .defaultRequest(put("/").with(user(username).roles("ADMIN"))) .defaultRequest(delete("/").with(user(username).roles("ADMIN"))) .apply(springSecurity()) .build(); } @Test void getUTMs() throws Exception { MvcResult result = mvc .perform(get("/utm") .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); assertEquals(200, result.getResponse().getStatus()); } @Test void getAllByName() throws Exception { MvcResult result = mvc .perform(get("/utm/name/{name}", "Instagram") .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); assertEquals(200, result.getResponse().getStatus()); } @Test void addUTM() throws Exception{ UtmDTO utmDTO = new UtmDTO("Blah-blah-blah..."); String jsonRequest = mapper.writeValueAsString(utmDTO); MvcResult result = mvc .perform(post("/utm") .content(jsonRequest) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); assertEquals(200, result.getResponse().getStatus()); } @Test void updateUTMName() throws Exception{ UtmDTO utmDTO = new UtmDTO("Blah-blah-blah..."); String jsonRequest = mapper.writeValueAsString(utmDTO); MvcResult result = mvc .perform(put("/utm/{id}", 4) .content(jsonRequest) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); assertEquals(200, result.getResponse().getStatus()); } }
[ "zhazgul004@gmail.com" ]
zhazgul004@gmail.com
13cc0648d38553a4b6ae799e5c444a1498bcf721
81fbf60304a2a16b7b6896cb2e23f322a0d8aab4
/google-compute/src/main/java/org/jclouds/googlecompute/compute/strategy/GoogleComputePopulateDefaultLoginCredentialsForImageStrategy.java
4f454e26484136a1607625701645cbe03fdf19a7
[ "Apache-2.0" ]
permissive
dralves/jclouds-labs
836a74b41570f61a8fa373ab088986a355148578
ef49fc662dbc82431659fe0c186cc59ba7b28196
refs/heads/master
2020-12-24T13:20:45.579327
2013-03-10T02:30:31
2013-03-10T02:30:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,101
java
/* * Licensed to jclouds, Inc. (jclouds) under one or more * contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. jclouds 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.jclouds.googlecompute.compute.strategy; import com.google.inject.Inject; import org.jclouds.compute.domain.TemplateBuilderSpec; import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy; import org.jclouds.domain.LoginCredentials; import org.jclouds.ssh.internal.RsaSshKeyPairGenerator; import javax.annotation.PostConstruct; import javax.inject.Named; import javax.inject.Singleton; import java.security.NoSuchAlgorithmException; import java.util.Map; import static com.google.common.base.Preconditions.checkNotNull; import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE; /** * @author David Alves */ @Singleton public class GoogleComputePopulateDefaultLoginCredentialsForImageStrategy implements PopulateDefaultLoginCredentialsForImageStrategy { private final TemplateBuilderSpec templateBuilder; private final RsaSshKeyPairGenerator keyPairGenerator; private String compoundKey; @Inject GoogleComputePopulateDefaultLoginCredentialsForImageStrategy(@Named(TEMPLATE) String templateSpec, RsaSshKeyPairGenerator keyPairGenerator) throws NoSuchAlgorithmException { this.templateBuilder = TemplateBuilderSpec.parse(checkNotNull(templateSpec, "template builder spec")); checkNotNull(templateBuilder.getLoginUser(), "template builder spec must provide a loginUser"); this.keyPairGenerator = checkNotNull(keyPairGenerator, "keypair generator"); } @PostConstruct private void generateKeys() { Map<String, String> keys = keyPairGenerator.get(); // as we need to store both the pubk and the pk, store them separated by : (base64 does not contain that char) compoundKey = String.format("%s:%s", checkNotNull(keys.get("public"), "public key cannot be null"), checkNotNull(keys.get("private"), "private key cannot be null")); } @Override public LoginCredentials apply(Object image) { return LoginCredentials.builder() .authenticateSudo(templateBuilder.getAuthenticateSudo() != null ? templateBuilder.getAuthenticateSudo() : false) .privateKey(compoundKey) .user(templateBuilder.getLoginUser()).build(); } }
[ "davidralves@gmail.com" ]
davidralves@gmail.com
5b5ca58e75d1d9c4b3ef6b39dba24a5833afa919
466dde89d7cadcc6d7fe5fbc55cabe7bb2258734
/src/homeWork2Bonus/Factorial.java
efffbf28d1f095f8dc79d128361c9e88c6177ec9
[]
no_license
VladimirValitski/HomeTask
135e324b45f8ca8566e217184749d4b09d48d287
f304bab6a15a2e4b3b515d3f2310eb270a0672c2
refs/heads/master
2020-12-25T08:28:41.452711
2018-07-03T21:44:55
2018-07-03T21:44:55
63,184,782
0
0
null
null
null
null
UTF-8
Java
false
false
600
java
package homeWork2Bonus; import java.io.BufferedReader; import java.io.InputStreamReader; /** * Created by Valodik on 06.07.2016. Calculates the Factorial */ public class Factorial { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Введите целое число: "); int num = Integer.parseInt(reader.readLine()); // We get the number from the console int fact = 1; for (int i = 1; i <= num; i++) { fact = fact * i; } System.out.println(fact); // Output result } }
[ "valodik.valitski@gmail.com" ]
valodik.valitski@gmail.com
d0c9d296d5e5bd17e8c36cd3c9b7c8a3d9db83b0
5ec1926fb8ca82cfc83c62a6a6b201c447eade4a
/app/src/androidTest/java/com/example/otonc/myapplication/ExampleInstrumentedTest.java
dea497336779046f2874e487027e4917479b4c2f
[]
no_license
OtonCastilloNavas/MyApplication
244d241bc2ad244805bd0553312af516504b5e64
6a6c98e2e6b8f734a1901e59ed31d5516f57881b
refs/heads/master
2020-05-04T13:42:09.212607
2019-04-02T22:50:24
2019-04-02T22:50:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
746
java
package com.example.otonc.myapplication; 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.example.otonc.myapplication", appContext.getPackageName()); } }
[ "omegasindrome" ]
omegasindrome
1b20bcf5ce399539dff11520063d980d728acd75
f8b636aa9e9c80d188065fb557ae077cff0ac34c
/app/src/main/java/com/example/chattingapp/RecyclerViewAdapter.java
db96b595d9df89493bc8d89eda6167b45afdfc8a
[]
no_license
anishchandak7/ChattingApp
0c8a37bcb9730a11956b0295c68375fbe162a1d8
97493b15206fbadde7d11fb2af20431e3eefb800
refs/heads/master
2020-04-20T07:30:30.325107
2019-02-01T15:03:05
2019-02-01T15:03:05
168,712,362
0
0
null
null
null
null
UTF-8
Java
false
false
1,711
java
package com.example.chattingapp; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import android.widget.TextView; import java.util.ArrayList; public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> { private static final String TAG = "RecyclerViewAdapter"; private String message; private Context context; public RecyclerViewAdapter(Context context,String message) { this.context = context; this.message = message; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.message_layout,viewGroup,false); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { Log.d(TAG, "onBindViewHolder: called"); viewHolder.message_textview.setText(message); } @Override public int getItemCount() { return 1; } public class ViewHolder extends RecyclerView.ViewHolder { TextView message_textview; RelativeLayout chat_layout; public ViewHolder(@NonNull View itemView) { super(itemView); message_textview = (TextView) itemView.findViewById(R.id.chat_textview); chat_layout = (RelativeLayout) itemView.findViewById(R.id.chat_layout); } } }
[ "chandakanish7@gmail.com" ]
chandakanish7@gmail.com
f43d6deda12dc5f3e74aae63d064a2c40607251e
a858d2fcd9e8281c7d97f1ad6e2405e95d29a710
/app/src/main/java/com/google/android/material/internal/CheckableImageButton.java
709f116815f8e7736ba48bcebe0cf1e5c1de5473
[]
no_license
mukesh-chandra/FullChargeAlarm
e51ae337bcf5706c5e145a931daf4fee60635ccf
61620bb56f80e213ec14d0159678ec4e273aaf43
refs/heads/master
2023-04-15T10:38:24.292371
2021-04-15T19:20:40
2021-04-15T19:20:40
358,355,871
0
0
null
null
null
null
UTF-8
Java
false
false
2,418
java
package com.google.android.material.internal; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.widget.Checkable; import androidx.appcompat.C0039R; import androidx.appcompat.widget.AppCompatImageButton; import androidx.core.view.AccessibilityDelegateCompat; import androidx.core.view.ViewCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; public class CheckableImageButton extends AppCompatImageButton implements Checkable { private static final int[] DRAWABLE_STATE_CHECKED = {16842912}; private boolean checked; public CheckableImageButton(Context context) { this(context, null); } public CheckableImageButton(Context context, AttributeSet attributeSet) { this(context, attributeSet, C0039R.attr.imageButtonStyle); } public CheckableImageButton(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegateCompat() { public void onInitializeAccessibilityEvent(View view, AccessibilityEvent accessibilityEvent) { super.onInitializeAccessibilityEvent(view, accessibilityEvent); accessibilityEvent.setChecked(CheckableImageButton.this.isChecked()); } public void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) { super.onInitializeAccessibilityNodeInfo(view, accessibilityNodeInfoCompat); accessibilityNodeInfoCompat.setCheckable(true); accessibilityNodeInfoCompat.setChecked(CheckableImageButton.this.isChecked()); } }); } public void setChecked(boolean z) { if (this.checked != z) { this.checked = z; refreshDrawableState(); sendAccessibilityEvent(2048); } } public boolean isChecked() { return this.checked; } public void toggle() { setChecked(!this.checked); } public int[] onCreateDrawableState(int i) { if (this.checked) { return mergeDrawableStates(super.onCreateDrawableState(i + DRAWABLE_STATE_CHECKED.length), DRAWABLE_STATE_CHECKED); } return super.onCreateDrawableState(i); } }
[ "mukeshchandra987t@gmail.com" ]
mukeshchandra987t@gmail.com
38dfc358fcbe259438a998deec4c81d51344ab36
6ac7943d69bab32e1e85f4d80f3b04e5a6cc847a
/src/backoffice-model/src/ru/mentorbank/backoffice/storage/moneytransfer/OperationsSet.java
6ba810e7f61751f3581cf2ea5812119a49e26b95
[]
no_license
kiritsev/Mentor-Bank
0b9b179b4244fab3b38551f1f95a5645d6181555
6a07de0f8df390d48acfcb6403375b4fc9672d02
refs/heads/master
2021-01-18T08:29:42.146544
2011-08-19T11:58:41
2011-08-19T11:58:41
2,221,008
0
0
null
null
null
null
UTF-8
Java
false
false
705
java
package ru.mentorbank.backoffice.storage.moneytransfer; import java.util.HashSet; import java.util.Set; import ru.mentorbank.backoffice.dao.OperationDao; import ru.mentorbank.backoffice.dao.exception.OperationDaoException; import ru.mentorbank.backoffice.model.Operation; public class OperationsSet implements OperationDao { private Set<Operation> operations; public OperationsSet() { operations = new HashSet<Operation>(1); } @Override public Set<Operation> getOperations() throws OperationDaoException { return this.operations; } @Override public void saveOperation(Operation operation) throws OperationDaoException { this.operations.add(operation); } }
[ "kiritsev@inv2986-pc.msk.i-teco.ru" ]
kiritsev@inv2986-pc.msk.i-teco.ru
956afadd7360da2c9a21b3f762c3b4a8daa4efe3
79b1e56fac21030d97227fbd52ef9a8a765d4ba9
/src/model/patterns/state/BookBackCover.java
2c955955da35c8b2bc1baa5da9cba813c53421b1
[]
no_license
cauth0n/State-Pattern-Evolution
5e5a89e844d2ffd108e3d978ab296155d0e5b291
4a662802237e010c0028901c1e44d5cdf934afac
refs/heads/master
2021-01-19T05:22:02.415506
2013-05-08T19:46:27
2013-05-08T19:46:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package model.patterns.state; public class BookBackCover implements Book { @Override public void turnPage(Page number) { System.out.println(this.toString()); } @Override public String toString(){ return "Back Cover"; } }
[ "derek.reimanis@gmail.com" ]
derek.reimanis@gmail.com
37cbfadcebe6326c1296cb4cdee912b2c3900ec4
1306755537b5a8ca3cc478276309fea990217783
/src/java/facility/connector/MySQLDAO.java
4f1db6fa08e77305ce9e2e10b2c540926881743a
[]
no_license
AlexeySilivonchik/Java-ee-facility
17217d5eea8b3ac872b755966e74af7a21c1e29a
0f2dd67d202cb4e59c7c50321422101cd590f598
refs/heads/master
2020-04-18T21:06:28.205294
2013-08-07T10:51:09
2013-08-07T10:51:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
60
java
package facility.connector; public interface MySQLDAO { }
[ "alexey.silivonchik@gmail.com" ]
alexey.silivonchik@gmail.com
224ca1d1eb0f7fdd5558c808da6be15edb50e222
d607a94c34f8291fc4e8c36ff2ba9887c65e1d3e
/src/three/test.java
2b95b6306a986a8bfb08c7b20556ec12fd323b64
[]
no_license
AnZhuJun/anzj
a0ee0a861cb6e930d6b5d436f703c8c9475c287f
74922f6e2daf2e5269d72cbc1eb4a24dd0f75ebe
refs/heads/master
2020-07-19T19:55:54.811711
2019-09-05T07:49:19
2019-09-05T07:49:19
206,504,990
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package three; public class test { public static void main(String[] args) { String a = "aaa"; change(a); System.out.println(a); } public static void change(String str){ str = "bbb"; } }
[ "a17809283667@163.com" ]
a17809283667@163.com
336833b15d3ea90cfed93d60c6e67d31781035fd
1f42738b947dd079a32a071b7cc2b396c92f6935
/src/programminghubgoogle/string/FormatAString.java
03f766f6664c6284352a4cabafd1f61d6105ba17
[]
no_license
kboukider/ExercicesJava
11131c4f13c65f2e75c444774f137693dbe20572
d8ba20635fe58f0df581e9713fd7594fc8a47a9d
refs/heads/master
2023-02-02T14:43:12.894549
2020-12-25T21:09:16
2020-12-25T21:09:16
323,686,959
0
0
null
null
null
null
UTF-8
Java
false
false
321
java
package programminghubgoogle.string; public class FormatAString { public static void main(String[] args) { String str = "This is formatted %s exemple"; System.out.println(String.format(str, "string")); String str1 = "We are addinig number %d to string"; System.out.println(String.format(str1, 10)); } }
[ "kboukider@hotmail.com" ]
kboukider@hotmail.com
4304698565bdbcd39838d92bacb848b99730379c
c7625335a70318c46bbf5d8ccded167bda8ed2cc
/src/main/java/com/dsavitski/apt/entity/ConfigOption.java
4fbdc4d70ee6b2a33f939e6917f04aab107a3a1d
[]
no_license
jesusmariabermudez/android-pentest-tool
a3b22e385e7f64d28ca0ca598b4f238e91aa0a89
baee4ac698eae4b069664150b31ca31b1009f1c8
refs/heads/master
2023-03-15T21:26:41.103134
2018-07-12T14:10:42
2018-07-12T14:10:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
816
java
package com.dsavitski.apt.entity; import javax.persistence.*; @Entity @Table(name = "Config") public class ConfigOption { @Id @GeneratedValue private Long id; @Column(unique = true, name = "key") private String key; @Column(name = "value") private String value; public ConfigOption() { } public ConfigOption(String key, String value) { this.key = key; this.value = value; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public Object getValue() { return value; } public void setValue(String value) { this.value = value; } }
[ "dmitry.savitski@gmail.com" ]
dmitry.savitski@gmail.com
874e6de7706061fdfc2559c72132fa08d7c61252
0c7380347d6dcbfeebe23eacf88489690ddf18c2
/src/org/solovyev/idea/critic/configuration/CriticConfigurable.java
4cba6c53059953626245c8d2836d80b5c5ad8b80
[]
no_license
serso/idea-critic
5bc126368e67d91b2bf52ac453d1f1bc9be3c80c
fdd7e8a289a23b27fcc8c0b33e0709e02dbacdb9
refs/heads/master
2021-01-10T21:36:56.531744
2014-04-13T19:17:15
2014-04-13T19:17:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,580
java
package org.solovyev.idea.critic.configuration; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.solovyev.idea.critic.connection.CriticTestConnectionTask; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class CriticConfigurable implements SearchableConfigurable { private JPanel myMainPanel; private JTextField myServerField; private JTextField myUsernameField; private JPasswordField myPasswordField; private JButton myTestButton; private final CriticSettings myCriticSettings; private static final String DEFAULT_PASSWORD_TEXT = "************"; private boolean myPasswordModified; public CriticConfigurable() { myCriticSettings = CriticSettings.getInstance(); myTestButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveSettings(); final Task.Modal testConnectionTask = new CriticTestConnectionTask(ProjectManager.getInstance().getDefaultProject()); ProgressManager.getInstance().run(testConnectionTask); } } ); myPasswordField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { myPasswordModified = true; } @Override public void removeUpdate(DocumentEvent e) { myPasswordModified = true; } @Override public void changedUpdate(DocumentEvent e) { myPasswordModified = true; } }); } private void saveSettings() { myCriticSettings.USERNAME = myUsernameField.getText(); myCriticSettings.SERVER_URL = myServerField.getText(); if (isPasswordModified()) myCriticSettings.savePassword(String.valueOf(myPasswordField.getPassword())); } @NotNull @Override public String getId() { return "CriticConfigurable"; } @Nullable @Override public Runnable enableSearch(String option) { return null; } @Nls @Override public String getDisplayName() { return "Code Review"; } @Nullable @Override public String getHelpTopic() { return null; } @Nullable @Override public JComponent createComponent() { return myMainPanel; } @Override public boolean isModified() { if (isPasswordModified()) { final String password = myCriticSettings.getPassword(); if (!StringUtil.equals(password, new String(myPasswordField.getPassword()))) { return true; } } return !StringUtil.equals(myCriticSettings.SERVER_URL, myServerField.getText()) || !StringUtil.equals(myCriticSettings.USERNAME, myUsernameField.getText()); } @Override public void apply() throws ConfigurationException { saveSettings(); } @Override public void reset() { myUsernameField.setText(myCriticSettings.USERNAME); myPasswordField.setText(StringUtil.isEmptyOrSpaces(myUsernameField.getText()) ? "" : DEFAULT_PASSWORD_TEXT); resetPasswordModification(); myServerField.setText(myCriticSettings.SERVER_URL); } public boolean isPasswordModified() { return myPasswordModified; } public void resetPasswordModification() { myPasswordModified = false; } @Override public void disposeUIResources() { } }
[ "se.solovyev@gmail.com" ]
se.solovyev@gmail.com
90391b4b0e18b40acf5f8ab9068ba967a6060411
513eff831b877b256fb07a637913476c16620488
/third_party/java/jopt-simple/src/test/java/joptsimple/Ctor.java
ad26a4de37c36e4609722f560ff145faf146e7ea
[ "Apache-2.0", "GPL-2.0-only", "LicenseRef-scancode-public-domain", "BSD-3-Clause", "EPL-2.0", "EPL-1.0", "MIT", "Classpath-exception-2.0" ]
permissive
kudddy/bazel
3a3c49fc8081c8306b1492cdbdf0cc338673a6e8
76555482873ffcf1d32fb40106f89231b37f850a
refs/heads/master
2020-07-03T05:48:16.907289
2017-06-04T23:54:37
2017-06-05T14:19:20
201,805,076
2
0
Apache-2.0
2019-08-11T19:15:28
2019-08-11T19:15:28
null
UTF-8
Java
false
false
1,435
java
/* The MIT License Copyright (c) 2004-2015 Paul R. Holser, Jr. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package joptsimple; /** * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a> */ public class Ctor { private String s; public Ctor( String s ) { this.s = s; } public String getS() { return s; } static Ctor valueOf( String s ) { return new Ctor( s ); } }
[ "lberki@google.com" ]
lberki@google.com
21c7f75f3b201d074728ea64809edee18ab8f8b7
44423dcca75bec90cbdb3e45ebb5f7266d264378
/smaple/src/androidTest/java/com/igo/mp3record/smaple/ExampleInstrumentedTest.java
92735165ca876542113619c1934dd08e7c63d78d
[]
no_license
xiexiang89/android-lame
17c5f5c6af35cfcc7e94d680241e1c5236fbc270
2fb0388dd9ab802f71eae422a2f44013a75a43a8
refs/heads/master
2020-03-20T18:32:18.126700
2018-06-22T12:00:41
2018-06-22T12:00:41
137,592,676
0
0
null
null
null
null
UTF-8
Java
false
false
749
java
package com.igo.mp3record.smaple; 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.igo.mp3record.smaple", appContext.getPackageName()); } }
[ "xiexiang89@126.com" ]
xiexiang89@126.com
1064cb3c496db5bc502edaee93e6fa98177fa97e
dca00133631ba2395de167e2d11a61ceebea6e31
/daily_experiment_core/src/main/java/com/guo/roy/research/leetcode/stage2/stage20/TestSolution718.java
8e62998a6c695330e8e0427271c3f1be22fa0c86
[]
no_license
roy2015/daily_experiment
05dba826424b64e6b51e78f67628f1ddf4fab751
ef618f23bd6ac5a2ef04cf7c0ef8255f62cdefbc
refs/heads/master
2023-09-01T19:25:10.756016
2023-08-14T10:24:06
2023-08-14T10:24:06
160,756,993
2
1
null
2022-12-14T20:35:02
2018-12-07T02:01:04
Java
UTF-8
Java
false
false
3,249
java
package com.guo.roy.research.leetcode.stage2.stage20; import org.slf4j.LoggerFactory; /** * * 718. 最长重复子数组 给两个整数数组 nums1 和 nums2 ,返回 两个数组中 公共的 、长度最长的子数组的长度 。 * * * * 示例 1: * * 输入:nums1 = [1,2,3,2,1], nums2 = [3,2,1,4,7] 输出:3 解释:长度最长的公共子数组是 [3,2,1] 。 示例 2: * * 输入:nums1 = [0,0,0,0,0], nums2 = [0,0,0,0,0] 输出:5 * * * 提示: * * 1 <= nums1.length, nums2.length <= 1000 0 <= nums1[i], nums2[i] <= 100 * * * @author guojun * @date 2021/1/21 10:40 */ public class TestSolution718 { private static final org.slf4j.Logger logger = LoggerFactory.getLogger(TestSolution718.class); static class Solution { /** * * 执行结果:通过 * 显示详情 * 添加备注 * * 执行用时:1956 ms, 在所有 Java 提交中击败了5.01%的用户 * 内存消耗:50.7 MB, 在所有 Java 提交中击败了5.20%的用户 * 通过测试用例: * 57 / 57 * * * @param nums1 * @param nums2 * @return */ public int findLength(int[] nums1, int[] nums2) { int col = nums1.length; int row = nums2.length; int[][] dp = new int[row + 1][col + 1]; for (int i = 0; i < row; i++) { int iPlus = i + 1; for (int j = 0; j < col; j++) { int jPlus = j + 1; if (nums2[i] == nums1[j]) { int sum = 1; for (int m = i - 1, n = j - 1; (m >= 0 && n >= 0); m--, n--) { if (nums2[m] != nums1[n]) { break; } sum++; } dp[iPlus][jPlus] = Math.max(sum, Math.max(dp[iPlus][j], dp[i][jPlus])); } else { dp[iPlus][jPlus] = Math.max(dp[iPlus][j], dp[i][jPlus]); } } } return dp[row][col]; } } public static void main(String[] args) { logger.info("{}", new Solution().findLength(new int[] { 57, 85, 85, 5, 28 }, new int[] { 82, 85, 85, 32, 50 }));// 2 logger.info("{}", new Solution().findLength(new int[] { 1, 0, 0, 0, 1 }, new int[] { 1, 0, 0, 1, 1 }));// 3 logger.info("{}", new Solution().findLength(new int[] { 0, 1, 1, 1, 1 }, new int[] { 1, 0, 1, 0, 1 }));// 2 logger.info("{}", new Solution().findLength(new int[] { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, new int[] { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }));// 9 logger.info("{}", new Solution().findLength(new int[] { 5, 14, 53, 80, 48 }, new int[] { 50, 47, 3, 80, 83 }));// 1 logger.info("{}", new Solution().findLength(new int[] { 1, 2, 3, 2, 1 }, new int[] { 1, 2, 2, 1 }));// 2 logger.info("{}", new Solution().findLength(new int[] { 0, 0, 0, 0, 0 }, new int[] { 0, 0, 0, 0, 0 }));// 5 logger.info("{}", new Solution().findLength(new int[] { 1, 2, 3, 2, 1 }, new int[] { 3, 2, 1, 4, 7 }));// 3 } }
[ "guojun@yunlizhihui.com" ]
guojun@yunlizhihui.com
58119e09c062b1d9271fbafe0bc803ca1f1627dc
015730d742bc2a8fd41e41c315a513f35f6cad13
/app/src/main/java/com/goalsr/homequarantineTracker/resposemodel/ResStaticMasterDistric.java
e693f41694447432fc0706dc9df4f28d9d6d0cb7
[]
no_license
RKM-Coder/HealthAdminWatch
8bb6c7e2f433135ee35aff241b9b8038991b0aec
f0b128acf99562990226a6fa1779d3cc8e6533f2
refs/heads/master
2022-04-25T14:31:16.599200
2020-04-28T15:05:40
2020-04-28T15:05:40
256,128,927
0
0
null
null
null
null
UTF-8
Java
false
false
2,556
java
package com.goalsr.homequarantineTracker.resposemodel; import com.google.gson.annotations.SerializedName; public class ResStaticMasterDistric{ @SerializedName("new_town_code") private String newTownCode; @SerializedName("ksrsac_town_code") private String ksrsacTownCode; @SerializedName("town_name") private String townName; @SerializedName("dist_name") private String distName; @SerializedName("ksrac_word_code") private String ksracWordCode; @SerializedName("ksrsac_dist_code") private String ksrsacDistCode; @SerializedName("new_word_code") private String newWordCode; @SerializedName("rdrp_dist_code") private String rdrpDistCode; @SerializedName("word_name") private String wordName; public void setNewTownCode(String newTownCode){ this.newTownCode = newTownCode; } public String getNewTownCode(){ return newTownCode; } public void setKsrsacTownCode(String ksrsacTownCode){ this.ksrsacTownCode = ksrsacTownCode; } public String getKsrsacTownCode(){ return ksrsacTownCode; } public void setTownName(String townName){ this.townName = townName; } public String getTownName(){ return townName; } public void setDistName(String distName){ this.distName = distName; } public String getDistName(){ return distName; } public void setKsracWordCode(String ksracWordCode){ this.ksracWordCode = ksracWordCode; } public String getKsracWordCode(){ return ksracWordCode; } public void setKsrsacDistCode(String ksrsacDistCode){ this.ksrsacDistCode = ksrsacDistCode; } public String getKsrsacDistCode(){ return ksrsacDistCode; } public void setNewWordCode(String newWordCode){ this.newWordCode = newWordCode; } public String getNewWordCode(){ return newWordCode; } public void setRdrpDistCode(String rdrpDistCode){ this.rdrpDistCode = rdrpDistCode; } public String getRdrpDistCode(){ return rdrpDistCode; } public void setWordName(String wordName){ this.wordName = wordName; } public String getWordName(){ return wordName; } @Override public String toString(){ return "ResStaticMasterDistric{" + "new_town_code = '" + newTownCode + '\'' + ",ksrsac_town_code = '" + ksrsacTownCode + '\'' + ",town_name = '" + townName + '\'' + ",dist_name = '" + distName + '\'' + ",ksrac_word_code = '" + ksracWordCode + '\'' + ",ksrsac_dist_code = '" + ksrsacDistCode + '\'' + ",new_word_code = '" + newWordCode + '\'' + ",rdrp_dist_code = '" + rdrpDistCode + '\'' + ",word_name = '" + wordName + '\'' + "}"; } }
[ "ramkrishna.manna@livsoft.co" ]
ramkrishna.manna@livsoft.co
aa7b4af82a7a955eab46a3fb43cada26ddb271ed
5e4100a6611443d0eaa8774a4436b890cfc79096
/src/main/java/com/alipay/api/response/AlipayZdataassetsMetadataResponse.java
3adbf8d4f134ee9adc5d5b5b84350191e4291720
[ "Apache-2.0" ]
permissive
coderJL/alipay-sdk-java-all
3b471c5824338e177df6bbe73ba11fde8bc51a01
4f4ed34aaf5a320a53a091221e1832f1fe3c3a87
refs/heads/master
2020-07-15T22:57:13.705730
2019-08-14T10:37:41
2019-08-14T10:37:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
824
java
package com.alipay.api.response; import java.util.List; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; import com.alipay.api.domain.CustomerEntity; import com.alipay.api.AlipayResponse; /** * ALIPAY API: alipay.zdataassets.metadata response. * * @author auto create * @since 1.0, 2019-03-08 15:29:11 */ public class AlipayZdataassetsMetadataResponse extends AlipayResponse { private static final long serialVersionUID = 6686691115429797162L; /** * 用户标签集合 */ @ApiListField("result") @ApiField("customer_entity") private List<CustomerEntity> result; public void setResult(List<CustomerEntity> result) { this.result = result; } public List<CustomerEntity> getResult( ) { return this.result; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
1baa3ef06436da1c649a97dcaeedc14257bc9886
e5fa38347dd988d657918573a67c57de47b1ef9a
/src/com/class24/Bank.java
19d6da541f4f083ec5d7fe961a954e424cc652c0
[]
no_license
shaq5035/myRealJavaClass
1c116d1847152ff94dc052d2cd32abaf1642960f
1e0e7e7170a4912f0282836517aca343d96d5e83
refs/heads/master
2020-05-03T00:26:57.343397
2019-05-28T19:40:54
2019-05-28T19:40:54
178,310,062
0
0
null
null
null
null
UTF-8
Java
false
false
299
java
package com.class24; public class Bank { public int getBalance() { return 0; } } class BankA extends Bank{ public int getBalance() { return 1000; } } class BankB extends Bank{ public int getBalance() { return 1500; } } class BankC extends Bank{ public int getBalance() { return 2000; } }
[ "shaq5035@gmail.com" ]
shaq5035@gmail.com
b9a2dcf72e50d4c89ebeb5617ccc7bc04523dadb
efb75b17648ae1a0aa2124a36d093d966cd19fa0
/src/main/java/com/mathtabolism/util/string/UsernameGenerator.java
8fee57c9c71c2df2ed82ffc8e0a9654eb319e00a
[ "Apache-2.0" ]
permissive
jiachenxu-hiretual/mathtabolism
919cbc3089ab58c3562fdd860596a4b67e2b2c81
238cd4cbd91faa7cfadd5b6fe4633548f8eca738
refs/heads/master
2020-09-12T08:07:27.459526
2015-02-23T22:57:36
2015-02-23T22:57:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
623
java
package com.mathtabolism.util.string; import java.util.Random; public class UsernameGenerator { private UsernameGenerator(){} private static final String[] USERNAMES = { "glutesForTheSlutes", "legday_baby", "nopain_nogain", "ev1lpeng1unofD00M", "f1tness_fella", "blob_M4rly", "light_weight", "biceps__only", "2sexy4u", "reps4jesus", "some_clever_Username344", "33repeating_ofcourse", "its_clobberin_thyme"}; /** * They aren't really good yet. * @return a "random" username */ public static String getRandomUsername() { return USERNAMES[new Random().nextInt(USERNAMES.length)]; } }
[ "mlaursen03@gmail.com" ]
mlaursen03@gmail.com
0e27cba5b495a4862a6781c8372c7bc2d7bb1618
d9798a1de5989b3ebd6e55dd08c87c9a4c6e4e4a
/src/com/javaex/oop/shape/v2/Shape.java
027d8d3850914c7b1110aef96be382605e1c1c99
[]
no_license
heejucherish/javaex
4ba53de6e260688d92ddc551065b613f69431781
ce6e6e2ed4d21dc05d03c3e3059f9b9b458efb91
refs/heads/master
2022-12-16T22:55:43.518654
2020-09-18T08:54:31
2020-09-18T08:54:31
295,352,647
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package com.javaex.oop.shape.v2; // 추상 클래스 : 인스턴스화 되지 않는 설계도 클래스 public abstract class Shape { // 필드 protected int x; protected int y; // 생성자 public Shape(int x, int y) { this.x = x; this.y = y; } // 추상 메서드 : 실체 클래스에서 반드시 구현 강제 public abstract double area(); // public abstract void draw(); // 인터페이스에 위임 }
[ "sul1952@korea.ac.kr" ]
sul1952@korea.ac.kr
de6a4b1440451b2351e9b2aac094b80545a476cb
e83881215bd002da769c8cf6df14d8994d9a6923
/server/src/main/java/com/blocklang/develop/dao/impl/package-info.java
e2da0c564693f3bd72f9acc598e2fe35542b920f
[ "MIT" ]
permissive
xintao222/blocklang.com
34627e613526b49000998e63a0a8b1016e862d68
939074c9df037c0780e01e9a73ee724b3dcc1dc0
refs/heads/master
2023-04-08T02:12:57.845570
2020-12-13T09:06:44
2020-12-13T09:06:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
78
java
/** * @author Zhengwei Jin * */ package com.blocklang.develop.dao.impl;
[ "idocument@qq.com" ]
idocument@qq.com
05819177dcf543bb40ca86b0c8b745599bbf8407
fcda48cbf3bc461ee3fc8eeb4761c6beb65fa89b
/Practice Midterm/cs18000-fa19-practice-midterm-exam-2/Q3/src/CapybaraTest.java
5de8412fe224316472eb2edd0c31ccbd5baddd4e
[]
no_license
vsarunhah/CS180
38f0c7a9269e1f6715cecd5c318ee3710dfeed8d
44761e1e12440056c9e5c218a4a51cdcdf302613
refs/heads/master
2022-04-22T04:27:46.726956
2020-04-29T10:21:31
2020-04-29T10:21:31
204,553,903
0
0
null
null
null
null
UTF-8
Java
false
false
9,234
java
import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.PrintStream; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import static org.junit.Assert.fail; public class CapybaraTest { private final InputStream originalInput = System.in; private final PrintStream originalOutput = System.out; @SuppressWarnings("FieldCanBeLocal") private ByteArrayInputStream testIn; private final String TA_ERROR_MESSAGE = "You bumped into an error! Please contact a TA immediately."; private ByteArrayOutputStream testOut; @Before public void outputStart() { testOut = new ByteArrayOutputStream(); System.setOut(new PrintStream(testOut)); } @Test(timeout = 1000) public void testCapybaraFields() { Field isColdBloodedField; Field isWarmBloodedField; try { isColdBloodedField = Capybara.class.getDeclaredField("isColdBlooded"); if (!isColdBloodedField.getType().equals(boolean.class)) { fail("Ensure that your isColdBlooded field in class Capybara is of type boolean!"); return; } } catch (NoSuchFieldException e) { fail("Ensure that you have a field isColdBlooded in class Capybara that is of type boolean and is private" + " and final!"); return; } if (isColdBloodedField.getModifiers() != Modifier.PRIVATE + Modifier.FINAL) { fail("Ensure that your isColdBlooded field in class Capybara is both private and final!"); } try { isWarmBloodedField = Capybara.class.getDeclaredField("isWarmBlooded"); if (!isWarmBloodedField.getType().equals(boolean.class)) { fail("Ensure that your isWarmBlooded field in class Capybara is of type boolean!"); return; } } catch (NoSuchFieldException e) { fail("Ensure that you have a field isWarmBlooded in class Capybara that is of type boolean and is private" + " and final!"); return; } if (isWarmBloodedField.getModifiers() != Modifier.PRIVATE + Modifier.FINAL) { fail("Ensure that your isWarmBlooded field in class Capybara is both private and final!"); } } @Test(timeout = 1000) public void checkCapybaraSuperClass() { Assert.assertEquals("Ensure that class Capybara extends class Mammmal!", Mammal.class, Capybara.class.getSuperclass()); } @Test(timeout = 1000) public void checkCapybaraConstructor() { Constructor<?> capybaraConstructor; try { capybaraConstructor = Capybara.class.getDeclaredConstructor(String.class, int.class, boolean.class); } catch (NoSuchMethodException e) { fail("Ensure that your constructor in class Capybara takes one String, one int, and one boolean!"); return; } if (capybaraConstructor.getModifiers() != Modifier.PUBLIC) { fail("Ensure that your constructor in class Capybara is public!"); } } @Test(timeout = 1000) public void testIsColdBloodedMethod() { Method isColdBlooded; try { isColdBlooded = Capybara.class.getDeclaredMethod("isColdBlooded"); if (!isColdBlooded.getReturnType().equals(boolean.class)) { fail("Ensure that the method isColdBlooded in class Capybara returns a boolean!"); return; } } catch (NoSuchMethodException e) { fail("Ensure that you have a method isColdBlooded in class Capybara that returns a boolean and is " + "public!"); return; } if (isColdBlooded.getModifiers() != Modifier.PUBLIC) { fail("Ensure that the method isColdBlooded in class Capybara is public!"); } } @Test(timeout = 1000) public void testIsWarmBloodedMethod() { Method isWarmBlooded; try { isWarmBlooded = Capybara.class.getDeclaredMethod("isWarmBlooded"); if (!isWarmBlooded.getReturnType().equals(boolean.class)) { fail("Ensure that the method isWarmBlooded in class Capybara returns a boolean!"); return; } } catch (NoSuchMethodException e) { fail("Ensure that you have a method isWarmBlooded in class Capybara that returns a boolean and is " + "public!"); return; } if (isWarmBlooded.getModifiers() != Modifier.PUBLIC) { fail("Ensure that the method isWarmBlooded in class Capybara is public!"); } } @Test(timeout = 1000) public void testConsumeFoodMethod() { Method consumeFoodMethod; try { consumeFoodMethod = Capybara.class.getDeclaredMethod("consumeFood", int.class); if (!consumeFoodMethod.getReturnType().equals(void.class)) { fail("Ensure that the method consumeFood in class Capybara returns nothing (void)!"); return; } } catch (NoSuchMethodException e) { fail("Ensure that you have a method consumeFood in class Capybara that returns nothing (void) and is " + "public!"); return; } if (consumeFoodMethod.getModifiers() != Modifier.PUBLIC) { fail("Ensure that the method consumeFood in class Capybara is public!"); } } @Test(timeout = 1000) public void testReproduceMethod() { Method reproduceMethod; try { reproduceMethod = Capybara.class.getDeclaredMethod("reproduce"); if (!reproduceMethod.getReturnType().equals(Mammal.class)) { fail("Ensure that the method reproduce in class Capybara returns a new Mammal object!"); return; } } catch (NoSuchMethodException e) { fail("Ensure that you have a method reproduce in class Capybara that returns a new Mammal object and is " + "public!"); return; } if (reproduceMethod.getModifiers() != Modifier.PUBLIC) { fail("Ensure that the method reproduce in class Capybara is public!"); } } @Test(timeout = 1000) public void testDieMethod() { Method dieMethod; try { dieMethod = Capybara.class.getDeclaredMethod("die"); if (!dieMethod.getReturnType().equals(void.class)) { fail("Ensure that the method die in class Capybara returns nothing (void)!"); return; } } catch (NoSuchMethodException e) { fail("Ensure that you have a method die in class Capybara that returns nothing (void) and is " + "public!"); return; } if (dieMethod.getModifiers() != Modifier.PUBLIC) { fail("Ensure that the method die in class Capybara is public!"); } } @Test(timeout = 1000) public void testEqualsMethod() { Method equalsMethod; try { equalsMethod = Capybara.class.getDeclaredMethod("equals", Object.class); if (!equalsMethod.getReturnType().equals(boolean.class)) { fail("Ensure that the method equals in class Capybara returns a boolean!"); return; } } catch (NoSuchMethodException e) { fail("Ensure that you have a method equals in class Capybara that returns a boolean and is " + "public!"); return; } if (equalsMethod.getModifiers() != Modifier.PUBLIC) { fail("Ensure that the method equals in class Capybara is public!"); } } @Test(timeout = 1000) public void testToStringMethod() { Method toStringMethod; try { toStringMethod = Capybara.class.getDeclaredMethod("toString"); if (!toStringMethod.getReturnType().equals(String.class)) { fail("Ensure that the method equals in class Capybara returns a String!"); return; } } catch (NoSuchMethodException e) { fail("Ensure that you have a method toString in class Capybara that returns a String and is " + "public!"); return; } if (toStringMethod.getModifiers() != Modifier.PUBLIC) { fail("Ensure that the method toString in class Capybara is public!"); } } @Test(timeout = 1000) public void testCapybaraOutputs() { Animal animal = new Capybara("Swamp", 4, true); Mammal mammal = new Capybara("Swamp", 4, true); Assert.assertEquals("Ensure that two Capybaras of the same properties but different instantiation classes " + "are considered the same animal! (equals method)", animal, mammal); Assert.assertTrue("Ensure that a Capybara can only have live births since it is a mammal!", mammal.isLiveBirth()); Assert.assertTrue("Ensure that a Capybara can only be warm blooded!", mammal.isWarmBlooded()); Assert.assertFalse("Ensure that no Capybaras can be cold blooded!", mammal.isColdBlooded()); Assert.assertEquals("Ensure that when an animal is born, it's energy is 0!", 0, mammal.energy); mammal.consumeFood(10); mammal.consumeFood(10); Capybara c = (Capybara) mammal.reproduce(); Assert.assertEquals("Ensure that a reproduction has the same properties as its parent!", c, mammal); Assert.assertEquals("Ensure that the animal's energy field is updated when they consume food!", 20, mammal.energy); mammal.die(); Assert.assertNull("Ensure that when an animal has died, they can no longer reproduce a new Animal, but " + "instead reproduce a null object!", mammal.reproduce()); Assert.assertEquals("Ensure that the toString method follows the Javadoc for Capybara!", "Capybara[false, " + "true, true, 4, Swamp]", mammal.toString()); } /** * UTILITY METHODS BELOW */ @SuppressWarnings("SameParameterValue") private void receiveInput(String str) { testIn = new ByteArrayInputStream(str.getBytes()); System.setIn(testIn); } private String getOutput() { return testOut.toString(); } @After public void restoreInputAndOutput() { System.setIn(originalInput); System.setOut(originalOutput); } }
[ "varunshah660@gmail.com" ]
varunshah660@gmail.com
919a817e855d06ac6879b5a8ebe151049aa80c5e
6677dc6d4b949d53b2d80bd7f69ba2391d0c4652
/src/main/java/com/example/taller3/PersonaRepositorio.java
4cc3d1798199218174b4b4f7530cbef845c0f953
[]
no_license
juxnmxG/spring
1ff60e8f14f84306afd83c09ef122c127ccccc61
a8f0175d2ec4ee9bd7341f32fde00e88e5195f65
refs/heads/master
2022-10-17T11:56:21.666424
2020-06-16T02:38:42
2020-06-16T02:38:42
272,592,536
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package com.example.taller3; import java.util.List; import org.springframework.data.repository.Repository; public interface PersonaRepositorio extends Repository<persona, Integer> { List<persona>findAll(); persona findOne(int id); persona save(persona p); void delete(persona p); }
[ "juxnmxgxmbox@gmail.com" ]
juxnmxgxmbox@gmail.com
ce4928e7b0630f157368a0c557d148d8072eaa54
a2c8abb2d8c950b4cf3a588d6977e5d94c649ed6
/mymavenJob/src/main/java/com/ssm/service/CompanyServiceImpl.java
1365e25094ac7416276024a824a274a49a868053
[]
no_license
RunningGooo/magicyan
c5c25f1dd84d7a1a4487be7d0017a35c766f0772
97156e8eae3c05eefc16e9acf0c21299bea4f3b8
refs/heads/master
2021-06-20T16:41:42.305074
2017-06-21T07:19:49
2017-06-21T07:19:49
94,878,698
1
0
null
null
null
null
UTF-8
Java
false
false
369
java
package com.ssm.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.RequestMapping; import com.ssm.mapper.CompanyMapper; @Service public class CompanyServiceImpl implements CompanyService{ @Autowired private CompanyMapper companyMapper; }
[ "Administrator@MS-20170221SNLZ" ]
Administrator@MS-20170221SNLZ
a4876f4ef71833286f26260d1436df5686dd175f
1e1a7d5ab5e135cf028b42957d3ffafaf0b77a37
/src/com/company/Exercise5.java
4bc87f9205037e6a1262750a94f061a48e69eefb
[]
no_license
alla2297/chapter6
41d8f1bb3b68e630274153ea997596c795699a18
100319306fbfabee00b2f05037918e9a245231d8
refs/heads/master
2023-08-11T08:05:54.139551
2021-09-15T17:01:33
2021-09-15T17:01:33
406,856,648
0
0
null
null
null
null
UTF-8
Java
false
false
1,382
java
package com.company; import java.util.Scanner; public class Exercise5 { public static void main(String[] args) { // write your code here Scanner scan =new Scanner(System.in); System.out.println("Enter word"); String input = scan.nextLine(); scan.close(); boolean result = isDoubloon(input); //System.out.println(result); if (result) { System.out.println(input + " is doubloon"); } else { System.out.println(input + " is not doubloon"); } } public static boolean isDoubloon(String s) { String testString = s.toLowerCase(); for (int index = 0; index < testString.length(); index++) { int appearance = 0; for (int index2 = 0; index2 < testString.length(); index2++) { char currentChar = testString.charAt(index); if(testString.charAt(index2) == currentChar){ appearance++; } } if(appearance!=2){ return false; } } return true; } } /*Abba, Anna, appall, appearer, appeases, arraigning, beriberi, bilabial, boob, Caucasus, coco, Dada, deed, Emmett, Hannah, horseshoer, intestines, Isis, mama, Mimi, murmur, noon, Otto, papa, peep, reappear, redder, sees, Shanghaiings, Toto */
[ "alla2297@edu.easj.dk" ]
alla2297@edu.easj.dk
26056f04dd7cd154d23392d85fd7ce623e5c6ee0
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/MOCKITO-3b-4-16-MOEAD-WeightedSum:TestLen:CallDiversity/org/mockito/internal/verification/checkers/NumberOfInvocationsChecker_ESTest_scaffolding.java
d2712d7fa6d2c9f1c9a0087c0c9a653bab763af4
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
473
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Apr 07 14:41:31 UTC 2020 */ package org.mockito.internal.verification.checkers; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class NumberOfInvocationsChecker_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
017523d4dfc638d435a5c76606fc88ca04327499
4c6a4500878ef8ee0b8b9203a579074a00b0042e
/src/main/java/be/ipl/pae/business/dto/user/UserImpl.java
260f4999c32e4e32af0878977e8993e87863aee2
[]
no_license
jozefsako/PAE
7cca1dd173d7a86a7bee2231ca801b6900bfe872
be78c41c5e1f38bcf41dbf45daaaa713a761abac
refs/heads/master
2020-06-05T20:41:32.866740
2019-06-18T13:04:21
2019-06-18T13:04:21
192,540,669
0
0
null
null
null
null
UTF-8
Java
false
false
4,533
java
package be.ipl.pae.business.dto.user; import be.ipl.pae.business.dto.GenericDtoImpl; import org.mindrot.bcrypt.BCrypt; import java.time.LocalDate; public class UserImpl extends GenericDtoImpl implements UserDto, User { private Integer succeededYears; private Integer versionNumber; private String lastname; private String firstname; private String email; private String password; private String username; private String type; private String nationality; private String title; private String address; private String postcode; private String town; private String telephone; private String sex; private String iban; private String bankHolder; private String bankName; private String bicCode; private LocalDate birthdate; private LocalDate registration; @Override public boolean checkPassword(String password) { return BCrypt.checkpw(password, this.password); } @Override public void setIdUser(Integer idUser) { id = idUser; } @Override public void setLastName(String lastname) { this.lastname = lastname; } @Override public void setFirstName(String firstname) { this.firstname = firstname; } @Override public void setEmail(String email) { this.email = email; } @Override public void setPasswordUser(String passwordUser) { this.password = passwordUser; } @Override public void setUsername(String username) { this.username = username; } @Override public void setTypeUser(String typeUser) { this.type = typeUser; } @Override public void setRegistrationDate(LocalDate registrationDate) { this.registration = registrationDate; } @Override public void setNationality(String nationality) { this.nationality = nationality; } @Override public void setTitle(String title) { this.title = title; } @Override public void setBirthdate(LocalDate birthdate) { this.birthdate = birthdate; } @Override public void setAddressUser(String addressUser) { this.address = addressUser; } @Override public void setPostcode(String postcode) { this.postcode = postcode; } @Override public void setTown(String town) { this.town = town; } @Override public void setTelephone(String telephone) { this.telephone = telephone; } @Override public void setSex(String sex) { this.sex = sex; } @Override public void setSucceededYears(Integer succeededYears) { this.succeededYears = succeededYears; } @Override public void setIban(String iban) { this.iban = iban; } @Override public void setBankHolder(String bankHolder) { this.bankHolder = bankHolder; } @Override public void setBicCode(String bicCode) { this.bicCode = bicCode; } @Override public void setBankName(String bankName) { this.bankName = bankName; } @Override public void setVersionNumber(Integer versionNumber) { this.versionNumber = versionNumber; } @Override public Integer getIdUser() { return id; } @Override public String getLastName() { return lastname; } @Override public String getFirstName() { return firstname; } @Override public String getEmail() { return email; } @Override public String getPasswordUser() { return password; } @Override public String getUsername() { return username; } @Override public String getTypeUser() { return type; } @Override public LocalDate getRegistrationDate() { return registration; } @Override public String getNationality() { return nationality; } @Override public String getTitle() { return title; } @Override public LocalDate getBirthdate() { return birthdate; } @Override public String getAddressUser() { return address; } @Override public String getPostcode() { return postcode; } @Override public String getTown() { return town; } @Override public String getTelephone() { return telephone; } @Override public String getSex() { return sex; } @Override public Integer getSucceededYears() { return succeededYears; } @Override public String getIban() { return iban; } @Override public String getBankHolder() { return bankHolder; } @Override public String getBicCode() { return bicCode; } @Override public String getBankName() { return bankName; } @Override public Integer getVersionNumber() { return this.versionNumber; } }
[ "jozef.sako@student.vinci.be" ]
jozef.sako@student.vinci.be
a60b83577a1de50695997e9f582c6aa98a1935c3
071ee385fb3938fcad71e9337c01c46b5492d511
/Lab.7/Restaurant/src/OrderList.java
551619ee9e16295a10e358f2b5408864c282216a
[]
no_license
AlirezaGhafartehrani/AP
aa0d97aef95511bce70366abc5b97aa9d70df240
cf3c7dbacfaa0eb44676ade6e674115871286e4c
refs/heads/master
2020-05-21T18:51:22.122598
2019-07-01T06:04:18
2019-07-01T06:04:18
186,141,223
1
0
null
null
null
null
UTF-8
Java
false
false
617
java
import java.util.ArrayList; public class OrderList { private ArrayList<Order> orders; private Table table; private Garson garson; private Time time; private float totalPrice; public OrderList(ArrayList<Order> orders) { this.orders = orders; } public OrderList(Table table) { this.table = table; } public OrderList(Garson garson) { this.garson = garson; } public OrderList(Time time) { this.time = time; } public OrderList(float totalPrice) { this.totalPrice = totalPrice; } }
[ "noreply@github.com" ]
noreply@github.com
4e38370f3a0db666cbea720db8088f3bdad42474
b54e912053de51d2e7b3cbb69fd11d6214ec47de
/app/src/main/java/com/jx/xztongcheng/ui/fragment/ExpressManageFragment.java
ae90f6862252e70cf9a35a528d36f51f56c1a0fc
[]
no_license
ltg263/XZTongcheng
83f0c75232d5d931c44b80d7bb3219a0953f7af8
9a62765417108de2ae177d604da10df8a764ebdf
refs/heads/master
2023-05-05T22:39:29.166625
2021-05-12T01:42:39
2021-05-12T01:42:39
347,259,645
0
0
null
null
null
null
UTF-8
Java
false
false
14,857
java
package com.jx.xztongcheng.ui.fragment; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.recyclerview.widget.RecyclerView; import android.view.View; import android.widget.TextView; import com.blankj.utilcode.util.ToastUtils; import com.chad.library.adapter.base.BaseQuickAdapter; import com.jx.xztongcheng.R; import com.jx.xztongcheng.app.App; import com.jx.xztongcheng.base.BaseFragment; import com.jx.xztongcheng.bean.event.ExpressEvent; import com.jx.xztongcheng.bean.event.LoginEvent; import com.jx.xztongcheng.bean.response.CoreOrderList; import com.jx.xztongcheng.bean.response.EmptyResponse; import com.jx.xztongcheng.bean.response.OrderListBean; import com.jx.xztongcheng.net.BaseObserver; import com.jx.xztongcheng.net.BaseResponse; import com.jx.xztongcheng.net.RetrofitManager; import com.jx.xztongcheng.net.RxScheduler; import com.jx.xztongcheng.net.service.OrderService; import com.jx.xztongcheng.ui.activity.ExpressDetailActivity; import com.jx.xztongcheng.ui.activity.MultiExpressActivity; import com.jx.xztongcheng.ui.adpter.ExpressManageAdapter; import com.jx.xztongcheng.utils.DialogUtils; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import butterknife.BindView; public class ExpressManageFragment extends BaseFragment { private ExpressManageAdapter expressAdapter; private int orderStatus; private List<OrderListBean> beanList = new ArrayList<>(); @BindView(R.id.expressRv) RecyclerView orderRv; Intent intent; Map<String, Object> map = new HashMap<>(); int page = 1, pageSize = 20; @BindView(R.id.refresh) SwipeRefreshLayout refresh; private int type; //1最新 2我的 private int expressType;//1快递,2跑腿 private int fastStatus; public static ExpressManageFragment newInstance(int orderStatus, int type, int expressType, int fastStatus) { ExpressManageFragment fragment = new ExpressManageFragment(); Bundle args = new Bundle(); args.putInt("orderStatus", orderStatus); args.putInt("type", type); args.putInt("expressType", expressType); args.putInt("fastStatus", fastStatus); fragment.setArguments(args); return fragment; } @Override protected int setLayoutResourceID() { return R.layout.fragment_express_manage; } @Override protected void initView() { orderStatus = getArguments().getInt("orderStatus"); expressType = getArguments().getInt("expressType"); fastStatus = getArguments().getInt("fastStatus", 0); type = getArguments().getInt("type"); if (orderStatus != 0) map.put("orderStatus", orderStatus); if (fastStatus != 0) { map.put("fastStatus", fastStatus); } map.put("page", page); map.put("pageSize", pageSize); map.put("lat", App.lat); map.put("lng", App.lon); expressAdapter = new ExpressManageAdapter(type); orderRv.setAdapter(expressAdapter); expressAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { if (expressAdapter.getData().get(position).getExpressOrderDTOS().size() > 1) { Intent intent = new Intent(getActivity(), MultiExpressActivity.class); intent.putExtra("data", (Serializable) expressAdapter.getData().get(position).getExpressOrderDTOS()); intent.putExtra("expressGeneralOrderId", expressAdapter.getData().get(position).getExpressGeneralOrderId()); intent.putExtra("price", expressAdapter.getData().get(position).getTotalAmount() + expressAdapter.getData().get(position).getTotalBonus()); startActivity(intent); } else { Intent intent = new Intent(getActivity(), ExpressDetailActivity.class); intent.putExtra("orderId", expressAdapter.getData().get(position).getExpressOrderDTOS().get(0).getExpressOrderId()); startActivity(intent); } } }); expressAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() { @Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { final int id = beanList.get(position).getExpressGeneralOrderId(); switch (view.getId()) { case R.id.tv_status: if (((TextView)(view)).getText().toString().equals("接单")) { DialogUtils.cancelDialog(getActivity(), "接受订单", "确认接受订单吗?" , new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { RetrofitManager.build().create(OrderService.class).receiveExpress(id) .compose(RxScheduler.<BaseResponse<EmptyResponse>>observeOnMainThread()) .as(RxScheduler.<BaseResponse<EmptyResponse>>bindLifecycle(getActivity())) .subscribe(new BaseObserver<EmptyResponse>() { @Override public void onSuccess(EmptyResponse coreOrderList) { ToastUtils.showShort("接单成功"); EventBus.getDefault().post(new ExpressEvent()); } @Override public void onFail(int code, String msg) { super.onFail(code, msg); } }); } }).show(); } else { if (expressAdapter.getData().get(position).getExpressOrderDTOS().size() > 1) { Intent intent = new Intent(getActivity(), MultiExpressActivity.class); intent.putExtra("data", (Serializable) expressAdapter.getData().get(position).getExpressOrderDTOS()); intent.putExtra("expressGeneralOrderId", expressAdapter.getData().get(position).getExpressGeneralOrderId()); intent.putExtra("price", expressAdapter.getData().get(position).getTotalAmount() + expressAdapter.getData().get(position).getTotalBonus()); startActivity(intent); } else { Intent intent = new Intent(getActivity(), ExpressDetailActivity.class); intent.putExtra("orderId", expressAdapter.getData().get(position).getExpressOrderDTOS().get(0).getExpressOrderId()); startActivity(intent); } } break; case R.id.tv_transfer: if (expressAdapter.getData().get(position).getTransferStatus() == 0 || expressAdapter.getData().get(position).getTransferStatus() > 3) { //申请转单 DialogUtils.cancelDialog(getActivity(), "转单", "确认转单吗?" , new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { RetrofitManager.build().create(OrderService.class).transfer(id) .compose(RxScheduler.<BaseResponse<EmptyResponse>>observeOnMainThread()) .as(RxScheduler.<BaseResponse<EmptyResponse>>bindLifecycle(getActivity())) .subscribe(new BaseObserver<EmptyResponse>() { @Override public void onSuccess(EmptyResponse coreOrderList) { ToastUtils.showShort("请求成功"); refreshData(); } @Override public void onFail(int code, String msg) { super.onFail(code, msg); } }); } }).show(); } break; } } }); refreshLoad(); } private void refreshData() { page = 1; loadData(); } private void refreshLoad() { refresh.setColorSchemeColors(getResources().getColor(R.color.theme_color)); refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { page = 1; loadData(); } }); expressAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() { @Override public void onLoadMoreRequested() { ++page; loadData(); } }, orderRv); expressAdapter.disableLoadMoreIfNotFullPage(); } @Override protected void initData() { loadData(); } public void loadData() { map.put("page", page); map.put("takeModel", expressType); if (type == 1) { RetrofitManager.build().create(OrderService.class).coreList(map) .compose(RxScheduler.<BaseResponse<CoreOrderList>>observeOnMainThread()) .as(RxScheduler.<BaseResponse<CoreOrderList>>bindLifecycle(this)) .subscribe(new BaseObserver<CoreOrderList>() { @Override public void onSuccess(CoreOrderList coreOrderList) { if (page == 1) { beanList = coreOrderList.getList(); expressAdapter.setNewData(beanList); if (refresh.isRefreshing()) { refresh.setRefreshing(false); } } else { if (coreOrderList.getList().size() == 0) { expressAdapter.loadMoreEnd(); } else { expressAdapter.loadMoreComplete(); beanList.addAll(coreOrderList.getList()); expressAdapter.addData(beanList); } } } @Override public void onFail(int code, String msg) { super.onFail(code, msg); expressAdapter.loadMoreFail(); if (refresh.isRefreshing()) { refresh.setRefreshing(false); } } }); } else { RetrofitManager.build().create(OrderService.class).myOrderList(map) .compose(RxScheduler.<BaseResponse<CoreOrderList>>observeOnMainThread()) .as(RxScheduler.<BaseResponse<CoreOrderList>>bindLifecycle(this)) .subscribe(new BaseObserver<CoreOrderList>() { @Override public void onSuccess(CoreOrderList coreOrderList) { if (page == 1) { beanList = coreOrderList.getList(); expressAdapter.setNewData(beanList); if (refresh.isRefreshing()) { refresh.setRefreshing(false); } } else { if (coreOrderList.getList().size() == 0) { expressAdapter.loadMoreEnd(); } else { expressAdapter.loadMoreComplete(); beanList.addAll(coreOrderList.getList()); expressAdapter.addData(beanList); } } } @Override public void onFail(int code, String msg) { super.onFail(code, msg); expressAdapter.loadMoreFail(); if (refresh.isRefreshing()) { refresh.setRefreshing(false); } } }); } } @Subscribe(threadMode = ThreadMode.MAIN) public void Event(ExpressEvent event) { refreshData(); } @Subscribe(threadMode = ThreadMode.MAIN) public void loginEvent(LoginEvent loginEvent) { refreshData(); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); EventBus.getDefault().register(this); } @Override public void onDestroy() { super.onDestroy(); EventBus.getDefault().unregister(this); } }
[ "qzj842179561@gmail.com" ]
qzj842179561@gmail.com
dc07bc189209a8c5d2fc3f8af1dc2ac85988783e
2feecea1eb8050009a58266d443068d2388fe087
/jxz/src/main/java/com/zdhx/androidbase/view/pagerslidingtab/ScrollTabHolder.java
ca761da9c06f4268fabc51b3d4679a96056abe16
[]
no_license
lizheng2527/jxz_project
68766416cbeba4e9753f9a36c73c6d209628b132
b5d697bfa8a22d4ac19b96b93314c6a80094151e
refs/heads/master
2021-05-01T12:59:26.246774
2017-06-28T08:02:32
2017-06-28T08:02:32
79,545,780
2
1
null
2017-03-07T07:20:51
2017-01-20T09:33:28
Java
UTF-8
Java
false
false
281
java
package com.zdhx.androidbase.view.pagerslidingtab; import android.widget.AbsListView; public interface ScrollTabHolder { void adjustScroll(int scrollHeight); void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount, int pagePosition); }
[ "lizheng2527@163.com" ]
lizheng2527@163.com
a5997615a4103e0fabbdb718235a52412fa1fc85
8037278735b7daade0b8f13ca1dc731aff629327
/src/main/java/cn/ximcloud/itsource/before/day19_thread/_07mythread/_01TicketRunnableDemo.java
0490cbb0c746eb40a0a0839abb14911d261ffd79
[]
no_license
usami-muzugi/itsource
1cc0cd07bc9b1a4e771a886df8ad04790970b318
2cd92335a8ed86d5831da72c431bbf9222edf424
refs/heads/master
2020-03-22T13:13:31.215302
2018-09-22T15:30:07
2018-09-22T15:30:07
140,092,256
0
1
null
null
null
null
UTF-8
Java
false
false
1,329
java
package cn.ximcloud.itsource.before.day19_thread._07mythread; /** * Created by IntelliJ IDEA. * Student: wzard * Date: 2018-07-04 * Time: 14:17 * ProjectName: ITSource * To change this template use File | Settings | Editor | File and Code Templates. * //////////////////////////////////////////////////////////////////// **/ public class _01TicketRunnableDemo { /* 解决线程安全的问题,涉及到同步监听对象 */ public static void main(String[] args) { TecketRunnable tecketRunnable = new TecketRunnable(); /* * t1,t2,t3都是独立的线程独享 * 但是线程对象访问的代码都是tecketRunnable中的同一个对象已经被共享到了 * * */ /* What will be run. private Runnable target; */ Thread thread1 = new Thread(tecketRunnable); Thread thread2 = new Thread(tecketRunnable); Thread thread3 = new Thread(tecketRunnable); thread1.start(); thread2.start(); thread3.start(); // TicketV1 ticketV11 = new TicketV1(); // TicketV1 ticketV12 = new TicketV1(); // TicketV1 ticketV13 = new TicketV1(); // ticketV11.start(); // ticketV12.start(); // ticketV13.start(); } }
[ "715759898@qq.com" ]
715759898@qq.com
019d7fbb65cb94fc9e376daea26712cf8670a146
88aca044c58c90ce1bb53f532e29a8a7aceff05e
/src/main/java/com/wisdom/common/model/ObjectTypes.java
cc2ab01adad362f75bbf6ecd59f179ef31a54b91
[]
no_license
qzbbz/bbzweb
4618b7ba2b2ccd608052401e8b64bda13f88e715
ba4bb57e1cfeaf3cc2f44eff853bef23d6630e76
refs/heads/master
2021-01-23T21:53:28.651940
2018-09-21T02:10:14
2018-09-21T02:10:14
34,449,049
1
5
null
2016-08-17T07:32:53
2015-04-23T10:14:11
JavaScript
UTF-8
Java
false
false
1,072
java
package com.wisdom.common.model; import java.sql.Timestamp; /** * ObjectTypes entity. @author MyEclipse Persistence Tools */ public class ObjectTypes implements java.io.Serializable { // Fields /** * */ private static final long serialVersionUID = 1L; private Long id; private String name; private Timestamp createTime; // Constructors /** default constructor */ public ObjectTypes() { } /** minimal constructor */ public ObjectTypes(Long id, String name) { this.id = id; this.name = name; } /** full constructor */ public ObjectTypes(Long id, String name, Timestamp createTime) { this.id = id; this.name = name; this.createTime = createTime; } // Property accessors public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public Timestamp getCreateTime() { return this.createTime; } public void setCreateTime(Timestamp createTime) { this.createTime = createTime; } }
[ "chaikuaizhang@aliyun.com" ]
chaikuaizhang@aliyun.com
245fdd3be77dbc1501c7677161e5032ce031ed01
5bdbb83db88f75c1df01b602f3807bd45a7ceb86
/src/main/java/com/couchbase/client/java/query/dsl/functions/NumberFunctions.java
4b4bd6b7d2fa12fc86a6bfba6b32b3c5a48c77a2
[ "Apache-2.0" ]
permissive
bcui6611/couchbase-java-client
598661701da4deb8725a98b7f6cd04acb8a08889
5965d24bc488ed1e83d002472a1de84602bb4243
refs/heads/master
2021-01-17T14:12:04.264364
2016-08-17T08:14:33
2016-08-17T10:54:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,401
java
/* * Copyright (c) 2016 Couchbase, 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.couchbase.client.java.query.dsl.functions; import static com.couchbase.client.java.query.dsl.Expression.x; import com.couchbase.client.core.annotations.InterfaceAudience; import com.couchbase.client.core.annotations.InterfaceStability; import com.couchbase.client.java.query.dsl.Expression; /** * DSL for N1QL functions in the Numbers category. * * Number functions are functions that are performed on a numeric field. * * @author Simon Baslé * @since 2.2 */ @InterfaceStability.Experimental @InterfaceAudience.Public public class NumberFunctions { /** * Returned expression results in the absolute value of the number. */ public static Expression abs(Expression expression) { return x("ABS(" + expression.toString() + ")"); } /** * Returned expression results in the absolute value of the number. */ public static Expression abs(Number value) { return abs(x(value)); } /** * Returned expression results in the arccosine in radians. */ public static Expression acos(Expression expression) { return x("ACOS(" + expression.toString() + ")"); } /** * Returned expression results in the arccosine in radians. */ public static Expression acos(Number value) { return acos(x(value)); } /** * Returned expression results in the arcsine in radians. */ public static Expression asin(Expression expression) { return x("ASIN(" + expression.toString() + ")"); } /** * Returned expression results in the arcsine in radians. */ public static Expression asin(Number value) { return asin(x(value)); } /** * Returned expression results in the arctangent in radians. */ public static Expression atan(Expression expression) { return x("ATAN(" + expression.toString() + ")"); } /** * Returned expression results in the arctangent in radians. */ public static Expression atan(Number value) { return atan(x(value)); } /** * Returned expression results in the arctangent of expression2/expression1. */ public static Expression atan(Expression expression1, Expression expression2) { return x("ATAN(" + expression1.toString() + ", " + expression2.toString() + ")"); } /** * Returned expression results in the arctangent of expression2/expression1. */ public static Expression atan(String expression1, String expression2) { return atan(x(expression1), x(expression2)); } /** * Returned expression results in the smallest integer not less than the number. */ public static Expression ceil(Expression expression) { return x("CEIL(" + expression.toString() + ")"); } /** * Returned expression results in the smallest integer not less than the number. */ public static Expression ceil(Number value) { return ceil(x(value)); } /** * Returned expression results in the cosine. */ public static Expression cos(Expression expression) { return x("COS(" + expression.toString() + ")"); } /** * Returned expression results in the cosine. */ public static Expression cos(Number value) { return cos(x(value)); } /** * Returned expression results in the conversion of radians to degrees. */ public static Expression degrees(Expression expression) { return x("DEGREES(" + expression.toString() + ")"); } /** * Returned expression results in the conversion of radians to degrees. */ public static Expression degrees(Number value) { return degrees(x(value)); } /** * Returned expression results in the base of natural logarithms. */ public static Expression e() { return x("E()"); } /** * Returned expression results in the exponential of expression. */ public static Expression exp(Expression expression) { return x("EXP(" + expression.toString() + ")"); } /** * Returned expression results in the exponential of expression. */ public static Expression exp(Number value) { return exp(x(value)); } /** * Returned expression results in the log base e. */ public static Expression ln(Expression expression) { return x("LN(" + expression.toString() + ")"); } /** * Returned expression results in the log base e. */ public static Expression ln(Number value) { return ln(x(value)); } /** * Returned expression results in the log base 10. */ public static Expression log(Expression expression) { return x("LOG(" + expression.toString() + ")"); } /** * Returned expression results in the log base 10. */ public static Expression log(Number value) { return log(x(value)); } /** * Returned expression results in the largest integer not greater than the number. */ public static Expression floor(Expression expression) { return x("FLOOR(" + expression.toString() + ")"); } /** * Returned expression results in the largest integer not greater than the number. */ public static Expression floor(Number value) { return floor(x(value)); } /** * Returned expression results in Pi. */ public static Expression pi() { return x("PI()"); } /** * Returned expression results in expression1 to the power of expression2. */ public static Expression power(Expression expression1, Expression expression2) { return x("POWER(" + expression1.toString() + ", " + expression2.toString() + ")"); } /** * Returned expression results in value1 to the power of value2. */ public static Expression power(Number value1, Number value2) { return power(x(value1), x(value2)); } /** * Returned expression results in the conversion of degrees to radians. */ public static Expression radians(Expression expression) { return x("RADIANS(" + expression.toString() + ")"); } /** * Returned expression results in the conversion of degrees to radians. */ public static Expression radians(Number value) { return radians(x(value)); } /** * Returned expression results in a pseudo-random number with optional seed. */ public static Expression random(Expression seed) { return x("RANDOM(" + seed.toString() + ")"); } /** * Returned expression results in a pseudo-random number with optional seed. */ public static Expression random(Number seed) { return random(x(seed)); } /** * Returned expression results in a pseudo-random number with default seed. */ public static Expression random() { return x("RANDOM()"); } /** * Returned expression results in the value rounded to 0 digits to the right of the decimal point. */ public static Expression round(Expression expression) { return x("ROUND(" + expression.toString() + ")"); } /** * Returned expression results in the value rounded to the given number of integer digits to the right * of the decimal point (left if digits is negative). */ public static Expression round(Expression expression, int digits) { return x("ROUND(" + expression.toString() + ", " + digits + ")"); } /** * Returned expression results in the value rounded to 0 digits to the right of the decimal point. */ public static Expression round(Number expression) { return round(x(expression)); } /** * Returned expression results in the value rounded to the given number of integer digits to the right * of the decimal point (left if digits is negative). */ public static Expression round(Number expression, int digits) { return round(x(expression), digits); } /** * Returned expression results in the sign of the numerical expression, * represented as -1, 0, or 1 for negative, zero, or positive numbers respectively. */ public static Expression sign(Expression expression) { return x("SIGN(" + expression.toString() + ")"); } /** * Returned expression results in the sign of the numerical expression, * represented as -1, 0, or 1 for negative, zero, or positive numbers respectively. */ public static Expression sign(Number value) { return sign(x(value)); } /** * Returned expression results in the sine. */ public static Expression sin(Expression expression) { return x("SIN(" + expression.toString() + ")"); } /** * Returned expression results in the sine. */ public static Expression sin(Number value) { return sin(x(value)); } /** * Returned expression results in the square root. */ public static Expression squareRoot(Expression expression) { return x("SQRT(" + expression.toString() + ")"); } /** * Returned expression results in the square root. */ public static Expression squareRoot(Number value) { return squareRoot(x(value)); } /** * Returned expression results in the tangent. */ public static Expression tan(Expression expression) { return x("TAN(" + expression.toString() + ")"); } /** * Returned expression results in the tangent. */ public static Expression tan(Number value) { return tan(x(value)); } /** * Returned expression results in a truncation of the number to the given number of integer digits * to the right of the decimal point (left if digits is negative). */ public static Expression trunc(Expression expression, int digits) { return x("TRUNC(" + expression.toString() + ", " + digits + ")"); } /** * Returned expression results in a truncation of the number to the given number of integer digits * to the right of the decimal point (left if digits is negative). */ public static Expression trunc(Number value, int digits) { return trunc(x(value), digits); } /** * Returned expression results in a truncation of the number to 0 digits to the right of the decimal point. */ public static Expression trunc(Expression expression) { return x("TRUNC(" + expression.toString() + ")"); } /** * Returned expression results in a truncation of the number to 0 digits to the right of the decimal point. */ public static Expression trunc(Number value) { return trunc(x(value)); } }
[ "simon@couchbase.com" ]
simon@couchbase.com
edae60123982fbc42172f6dee85620ccff06d183
91d415b8aa70ad09c0a3f5f279df5cfca998f2b1
/src/test/java/address/unittests/sync/RemoteManagerTest.java
6ddf8bda2c25cb718628974f730063844f0c0b3c
[]
no_license
damithc/addressbook-1
5f9a39d0353fdaffd9d945d86709b73ef8bd6a2c
78f53ae8d02459c1cf50af8b6cce77d6c3d71d52
refs/heads/master
2020-12-01T01:06:00.401391
2016-06-28T06:24:10
2016-06-28T06:24:53
62,119,283
0
0
null
2016-06-28T07:22:31
2016-06-28T07:22:31
null
UTF-8
Java
false
false
5,185
java
package address.unittests.sync; import address.model.datatypes.person.Person; import address.model.datatypes.tag.Tag; import address.sync.ExtractedRemoteResponse; import address.sync.RemoteManager; import address.sync.RemoteService; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.net.HttpURLConnection; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.List; import java.util.Optional; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class RemoteManagerTest { private static final int RESOURCES_PER_PAGE = 100; private RemoteService remoteService; private RemoteManager remoteManager; @Before public void setup() { remoteService = mock(RemoteService.class); remoteManager = new RemoteManager(remoteService); } private ZoneOffset getSystemTimezone() { LocalDateTime localDateTime = LocalDateTime.now(); ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneOffset.systemDefault()); return zonedDateTime.getOffset(); } private long getResetTime() { return LocalDateTime.now().toEpochSecond(getSystemTimezone()) + 30000; } @Test public void getUpdatedPersons_noPreviousQueryAndMultiplePages_successfulQuery() throws IOException { int quotaLimit = 10; int quotaRemaining = 0; int noOfPersons = 1000; List<Person> personsToReturn = new ArrayList<>(); for (int i = 0; i < noOfPersons; i++) { personsToReturn.add(new Person("firstName" + i, "lastName" + i, i)); } when(remoteService.getPersons(anyString(), anyInt())).thenAnswer((invocation) -> { Object[] args = invocation.getArguments(); String addressBookName = (String) args[0]; assertEquals("Test", addressBookName); int pageNumber = (int) args[1]; int resourcesPerPage = RESOURCES_PER_PAGE; int startIndex = (pageNumber - 1) * resourcesPerPage; int endIndex = pageNumber * resourcesPerPage; ExtractedRemoteResponse<List<Person>> remoteResponse = new ExtractedRemoteResponse<>(HttpURLConnection.HTTP_OK, "eTag", quotaLimit, quotaRemaining, getResetTime(), personsToReturn.subList(startIndex, endIndex)); pageNumber = pageNumber < 1 ? 1 : pageNumber; int lastPage = (int) Math.ceil(noOfPersons/RESOURCES_PER_PAGE); if (pageNumber < lastPage) { remoteResponse.setLastPage(lastPage); remoteResponse.setNextPage(pageNumber + 1); } if (pageNumber > 1) { remoteResponse.setFirstPage(1); remoteResponse.setPrevPage(pageNumber - 1); } return remoteResponse; }); Optional<List<Person>> result = remoteManager.getUpdatedPersons("Test"); // should return the full list of persons assertTrue(result.isPresent()); assertEquals(noOfPersons, result.get().size()); for (int i = 0; i < noOfPersons; i++) { assertEquals(i, result.get().get(i).getId()); assertEquals("firstName" + i, result.get().get(i).getFirstName()); assertEquals("lastName" + i, result.get().get(i).getLastName()); } } @Test public void getTags_multiplePages_successfulGet() throws IOException { int quotaLimit = 10; int quotaRemaining = 8; // response 1 List<Tag> remoteTags = new ArrayList<>(); for (int i = 0; i < 100; i++) { remoteTags.add(new Tag("tag" + i)); } ExtractedRemoteResponse<List<Tag>> remoteResponseOne = new ExtractedRemoteResponse<>(HttpURLConnection.HTTP_OK, "eTag", quotaLimit, quotaRemaining, getResetTime(), remoteTags); remoteResponseOne.setFirstPage(1); remoteResponseOne.setNextPage(2); remoteResponseOne.setLastPage(2); // response 2 List<Tag> remoteTags2 = new ArrayList<>(); for (int i = 0; i < 50; i++) { remoteTags2.add(new Tag("tag" + (i + 100))); } ExtractedRemoteResponse<List<Tag>> remoteResponseTwo = new ExtractedRemoteResponse<>(HttpURLConnection.HTTP_OK, "eTag", quotaLimit, quotaRemaining, getResetTime(), remoteTags2); remoteResponseTwo.setFirstPage(1); remoteResponseTwo.setPrevPage(1); remoteResponseTwo.setLastPage(2); when(remoteService.getTags(anyString(), anyInt(), anyString())).thenReturn(remoteResponseOne).thenReturn(remoteResponseTwo); Optional<List<Tag>> result = remoteManager.getUpdatedTagList("Test"); // should return the full list of tags assertTrue(result.isPresent()); assertEquals(150, result.get().size()); for (int i = 0; i < 150; i++) { assertEquals("tag" + i, result.get().get(i).getName()); } } }
[ "noreply@github.com" ]
noreply@github.com
883f58312da11f4f9dc99e6577976bf68ee32dfd
2ff76fadf4d65ec39080be49e0e977fddd5bc4ca
/src/main/java/com/laughingcrying/mongoDao/ArticalDao.java
555611b335181520f34c2ef6bb90d97ecd3e0ce8
[]
no_license
GHfansw/MyBlog
90b50e91686060c4228f50da8d81feb20d7bbc6f
4f0c23e07bfa6ae29fa5f0a6dffd5a259f2c71c5
refs/heads/master
2021-09-04T20:16:40.853540
2018-01-22T04:00:32
2018-01-22T04:00:32
112,176,221
0
0
null
null
null
null
UTF-8
Java
false
false
477
java
package com.laughingcrying.mongoDao; import com.laughingcrying.model.Artical; import com.laughingcrying.model.Comment; import org.springframework.stereotype.Repository; import java.util.List; public interface ArticalDao { List<Artical> findAll(); boolean addArtical(Artical artical); boolean addLikeBytitle(String title); boolean loseLikeBytitle(String title); boolean addCommentBytitle(String title, Comment comment); boolean addLikeToComment(); }
[ "464411967@qq.com" ]
464411967@qq.com
33e82000f60efe05fbbe98c3b1e4811dda05ebb1
ab5ff6f75c630dadea51f9586e8ae3014459b6f8
/SolutionCatches.java
163cd0423614fbc5a7494cb3e9eb875367c10e77
[]
no_license
Damini2018/GeeksPractices
8aa3ff98aac00cc8ade1a3e44a96cbd4e82d708b
eade8c887d81104a516de0ef3647466314c173c7
refs/heads/master
2021-07-20T15:17:46.225025
2017-10-27T16:49:31
2017-10-27T16:49:31
108,568,664
0
0
null
null
null
null
UTF-8
Java
false
false
1,777
java
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class SolutionCatches { static void whoGetsTheCatch(int n, int x, int[] X, int[] V){ // Complete this function } public static void main(String[] args) { Scanner in = new Scanner(System.in); // Return the index of the catcher who gets the catch, or -1 if no one gets the catch. int n = in.nextInt(); int x = in.nextInt(); int min=Integer.MAX_VALUE; int index=-1; int[] X = new int[n]; //System.out.println(); //System.out.println("Succesfull till taken the inputs n x "+n+","+x); for(int X_i=0; X_i < n; X_i++){ int dis = in.nextInt(); X[X_i]=Math.abs(x-dis); //System.out.println("taking inputs all X[X_i]="+Math.abs(x-dis)); } int[] V = new int[n]; for(int V_i=0; V_i < n; V_i++){ int val=in.nextInt(); //System.out.println("taking input speeds as v = "+val+" and calculating the time"); V[V_i] =X[V_i]/val; //System.out.println("V[V_i] = "+V[V_i]); if(min> V[V_i]) {min= V[V_i]; index=V_i;} else if(min== V[V_i]) index=-1; } Arrays.sort(V); for(int k=0;k<n-2;k++){ int diff=V[k]-V[k+1]; if(diff==0){ // System.out.println("diffe is 0"); //System.out.println(V[k]+"-"+V[k+1]); index=-1; } } // int result = whoGetsTheCatch(n, x, X, V); System.out.print("result is " ); System.out.println(index); } }
[ "kanika.narang5694@gmail.com" ]
kanika.narang5694@gmail.com
86a31ad2e5f592938825550882bb954b4e7f1f6b
4508920deb11faaa805d78c86bcf5f0a2783c526
/src/main/java/uk/gov/hmcts/ccd/definition/BaseCaseView.java
12d237ec15ea08e5503a30acec858975d9c0bae1
[ "MIT" ]
permissive
sabahirfan/ccd-data-store-api
8fde562c1958f759e0fc5aa691900fe499180d30
ca6b131d131494a71e2fa8934a4347be3bb72b62
refs/heads/master
2020-03-28T00:36:46.270601
2018-06-05T12:00:45
2018-06-05T12:01:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
637
java
package uk.gov.hmcts.ccd.definition; import com.google.common.collect.Maps; import uk.gov.hmcts.ccd.ICase; import java.util.List; import java.util.Map; public abstract class BaseCaseView<T extends ICase> implements ICaseView<T> { private ICaseRenderer renderer; @Override public final void render(ICaseRenderer renderer, T theCase) { this.renderer = renderer; onRender(theCase); } protected abstract void onRender(T theCase); protected void render(Object o, String label) { renderer.render(o, label); } protected void render(Object o) { renderer.render(o); } }
[ "alex.mcausland@gmail.com" ]
alex.mcausland@gmail.com
d05dc2784747a9c421071425b006aef81d683ada
aea632e3ddbb13f728dcb137140dd1fec878f5bb
/java/344.ReverseString.java
b218aca36f6afaaecaa5b05fdbd135e05a6f252b
[]
no_license
lzhongzhang/Leetcode
b5f40e6e1f93b009de474c8ec7f31d51d704814b
570a8cb8b3c9935e83d78e778c25b68462e098b5
refs/heads/master
2022-01-05T16:34:35.887993
2019-07-19T22:42:32
2019-07-19T22:42:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
// Problem 344 Reverse String public class Solution { public String reverseString(String s) { char []res = s.toCharArray(); int i = 0, j = s.length() - 1; while(i < j) { char temp = res[i]; res[i] = res[s.length() - 1 - i]; res[s.length() - 1 - i] = temp; i++; j--; } return new String(res); } }
[ "xiaozhu930330@gmail.com" ]
xiaozhu930330@gmail.com
cbcf168a29da4db5f30d1b908c59da52db2e6667
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
/sources/com/avito/android/user_adverts_common/charity/CharityInteractorImpl_Factory.java
26e3086ddb2c2b6bacdac12a8953658ad895f9eb
[]
no_license
Auch-Auch/avito_source
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
76fdcc5b7e036c57ecc193e790b0582481768cdc
refs/heads/master
2023-05-06T01:32:43.014668
2021-05-25T10:19:22
2021-05-25T10:19:22
370,650,685
0
0
null
null
null
null
UTF-8
Java
false
false
1,748
java
package com.avito.android.user_adverts_common.charity; import com.avito.android.analytics.Analytics; import com.avito.android.analytics.provider.CurrentUserIdProvider; import com.avito.android.remote.UserAdvertsCommonApi; import com.avito.android.util.SchedulersFactory3; import dagger.internal.Factory; import javax.inject.Provider; public final class CharityInteractorImpl_Factory implements Factory<CharityInteractorImpl> { public final Provider<SchedulersFactory3> a; public final Provider<UserAdvertsCommonApi> b; public final Provider<CurrentUserIdProvider> c; public final Provider<Analytics> d; public CharityInteractorImpl_Factory(Provider<SchedulersFactory3> provider, Provider<UserAdvertsCommonApi> provider2, Provider<CurrentUserIdProvider> provider3, Provider<Analytics> provider4) { this.a = provider; this.b = provider2; this.c = provider3; this.d = provider4; } public static CharityInteractorImpl_Factory create(Provider<SchedulersFactory3> provider, Provider<UserAdvertsCommonApi> provider2, Provider<CurrentUserIdProvider> provider3, Provider<Analytics> provider4) { return new CharityInteractorImpl_Factory(provider, provider2, provider3, provider4); } public static CharityInteractorImpl newInstance(SchedulersFactory3 schedulersFactory3, UserAdvertsCommonApi userAdvertsCommonApi, CurrentUserIdProvider currentUserIdProvider, Analytics analytics) { return new CharityInteractorImpl(schedulersFactory3, userAdvertsCommonApi, currentUserIdProvider, analytics); } @Override // javax.inject.Provider public CharityInteractorImpl get() { return newInstance(this.a.get(), this.b.get(), this.c.get(), this.d.get()); } }
[ "auchhunter@gmail.com" ]
auchhunter@gmail.com
5f19cbc75d7c6c42bd8e8c7e2d9857d64768cd1e
fb94b8fd8e3f6a77ade3a7abb06c4efcc723904a
/szpt-service-highriskpersonalert/src/main/java/com/taiji/pubsec/szpt/highriskpersonalert/service/impl/GeographicalZoneServiceImpl.java
a204a7ac7de5d8a53886c5094204fc4adad084a3
[]
no_license
radtek/white_szpt
458cba92492751a6ff5f5836d602f61dfcd1bf7c
c76e1859b122024c720ff849b6305649fb51c570
refs/heads/master
2020-05-24T16:25:30.250204
2018-11-05T03:27:24
2018-11-05T03:27:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,635
java
package com.taiji.pubsec.szpt.highriskpersonalert.service.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.taiji.pubsec.persistence.dao.Dao; import com.taiji.pubsec.persistence.dao.Pager; import com.taiji.pubsec.szpt.highriskpersonalert.model.GeographicalZonePeopleInfo; import com.taiji.pubsec.szpt.highriskpersonalert.pojo.StatisticsInfo; import com.taiji.pubsec.szpt.highriskpersonalert.service.IGeographicalZoneService; import com.taiji.pubsec.szpt.util.ParamMapUtil; @Service("geographicalZoneService") public class GeographicalZoneServiceImpl implements IGeographicalZoneService { @SuppressWarnings("rawtypes") @Resource private Dao dao; @SuppressWarnings("unchecked") @Override public List<StatisticsInfo> findByGeographicalZone(Map<String, Object> paramMap) { StringBuilder xql = new StringBuilder("select new " + StatisticsInfo.class.getName() + "(g.geographicalZones, count(g.id)) from GeographicalZonePeopleInfo as g where 1 = 1"); Map<String, Object> xqlMap = new HashMap<String, Object>(); if (ParamMapUtil.isNotBlank(paramMap.get("timeStart"))) { xql.append(" and g.lastEntertime >= :timeStart"); xqlMap.put("timeStart", paramMap.get("timeStart")); } if (ParamMapUtil.isNotBlank(paramMap.get("timeEnd"))) { xql.append(" and g.lastEntertime <= :timeEnd"); xqlMap.put("timeEnd", paramMap.get("timeEnd")); } xql.append(" group by g.geographicalZones"); return this.dao.findAllByParams(GeographicalZonePeopleInfo.class, xql.toString(), xqlMap); } @SuppressWarnings("unchecked") @Override public Pager<GeographicalZonePeopleInfo> findGeographicalZonePeopleInfoByZone(Map<String, Object> paramMap, int pageNo, int pageSize) { StringBuilder xql = new StringBuilder("select g from GeographicalZonePeopleInfo as g where 1 = 1"); Map<String, Object> xqlMap = new HashMap<String, Object>(); if (ParamMapUtil.isNotBlank(paramMap.get("timeStart"))) { xql.append(" and g.lastEntertime >= :timeStart"); xqlMap.put("timeStart", paramMap.get("timeStart")); } if (ParamMapUtil.isNotBlank(paramMap.get("timeEnd"))) { xql.append(" and g.lastEntertime <= :timeEnd"); xqlMap.put("timeEnd", paramMap.get("timeEnd")); } if (ParamMapUtil.isNotBlank(paramMap.get("zoneName"))) { xql.append(" and g.geographicalZones = :zoneName"); xqlMap.put("zoneName", paramMap.get("zoneName")); } xql.append(" order by g.lastEntertime desc"); return this.dao.findByPage(GeographicalZonePeopleInfo.class, xql.toString(), xqlMap, pageNo, pageSize); } }
[ "choukanan@gmail.com" ]
choukanan@gmail.com
c65407e49dda279bbc20b7be69a3391f5dfcf8d6
6c95ed8707d352d7ed2750c7a6d80810e51409b1
/GameDevelopment-Demo-master/android/build/generated/source/buildConfig/androidTest/debug/com/betterclever/libgdx/demo/test/BuildConfig.java
fe5c862b4d0d37a75a74eac96d8e578aabb46c80
[]
no_license
nikki1016/2048
65082d8d247799b52c00422684a9466f7be19a9e
54ffa05d4092db965f091d7d4e2cd46e41ef96f2
refs/heads/master
2021-01-21T07:07:17.988031
2017-02-27T16:30:22
2017-02-27T16:30:22
83,317,713
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
/** * Automatically generated file. DO NOT MODIFY */ package com.betterclever.libgdx.demo.test; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.betterclever.libgdx.demo.test"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = -1; public static final String VERSION_NAME = ""; }
[ "noreply@github.com" ]
noreply@github.com
a55ca10f426fec0082255e5e4550fd0a266bce19
28597b19b169bef16ce385853783695d6e5083df
/src/main/java/com/socialchef/service/repositories/implementation/UserServiceRepository.java
bb0c8bf861f52941a69aabf6fcf1c63ed4d4c0f1
[]
no_license
sescobb27/SocialChefService
8de078a1ef6ac2f73a5195839f92c38ea0a9e95a
ef2df32b83bff53f5b950c4270b2ef85f64c56ad
refs/heads/master
2020-05-30T18:32:31.545555
2014-06-05T16:27:51
2014-06-05T16:27:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,607
java
package com.socialchef.service.repositories.implementation; import java.io.UnsupportedEncodingException; import java.util.List; import javax.annotation.Resource; import javax.transaction.Transactional; import org.springframework.stereotype.Service; import com.socialchef.service.exceptions.SocialChefException; import com.socialchef.service.helpers.Encryption; import com.socialchef.service.helpers.Validator; import com.socialchef.service.models.User; import com.socialchef.service.repositories.UserRepository; import com.socialchef.service.repositories.services.UserService; @Service public class UserServiceRepository implements UserService { @Resource private UserRepository userRepo; @Transactional @Override public User findOne(String query) { // TODO Auto-generated method stub return null; } @Transactional @Override public User findOneById(Long id) throws Exception { if (id == null) { throw new NullPointerException("Id is null"); } else if (id < 0) { throw new IllegalArgumentException("Id is less than 0"); } else if (id > Long.MAX_VALUE) { throw new Exception("Id is bigger than the max possible value"); } else { return userRepo.findOne(id); } } @Transactional @Override public List<User> findAll(String query) { // TODO Auto-generated method stub return null; } @Transactional @Override public boolean delete(Long id) throws Exception { if (id == null) { throw new NullPointerException("Id is null"); } else if (id < 0) { throw new IllegalArgumentException("Id is less than 0"); } else if (id > Long.MAX_VALUE) { throw new Exception("Id is bigger than the max possible value"); } else { userRepo.delete(id); return !userRepo.exists(id); } } @Transactional @Override public boolean create(User user) { if (user.validateUser()) { if (findByUsername(user.getUsername()) != null) { user.addError("El usuario ya existe"); return false; } else if (findByEmail(user.getEmail())!= null) { user.addError("Ya existe un usuario con ese correo"); return false; } userRepo.save(user); return true; } return false; } @Transactional @Override public User update(User user) { // TODO Auto-generated method stub return null; } @Transactional @Override public List<User> findAll(List<Long> ids) { // TODO Auto-generated method stub return null; } @Transactional public User findByUsername(String username) { String tmp_username = username.trim().toLowerCase(); if (tmp_username != null && Validator.validateUniqueNames(tmp_username)) { return userRepo.findByUsername(tmp_username); } throw new SocialChefException("Usuario Invalido"); } @Transactional public User findByEmail(String email) { String tmp_email = email.trim().toLowerCase(); if (tmp_email != null && Validator.validateEmail(email)) { return userRepo.findByEmail(tmp_email); } throw new SocialChefException("Correo Invalido"); } @Transactional public boolean validateLogin(String username, String password) { User u = findByUsername(username); if (u == null) { return false; } try { String []encrypt = {password,u.getCreatedAt().toString()}; String new_pass = Encryption.encryptSHA256(encrypt); return new_pass.equalsIgnoreCase(u.getPassword()); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return false; } /** * This setter method should be used only by unit tests. * @param personRepository */ public void setUserRepository(UserRepository userRepo) { this.userRepo = userRepo; } }
[ "s.escob.b.27@gmail.com" ]
s.escob.b.27@gmail.com
6e525c9b98e3a3baeda4bcbbcd7eee8251e4ecb1
1d1ac51b08316197f622ecf67edc6984a1861415
/src/com/zsm/foxconn/mypaperless/FragmentPerson.java
6ccaa2e2311782f13ffb73d54a295a9106152a8c
[]
no_license
peterMa1999/MyPaperless
c52e763605615c8daea6b14344171ff7753a8935
1519b6fe47074ffa6fa8507c1bd6a6a619838848
refs/heads/master
2020-03-26T19:39:31.311689
2018-08-19T05:55:14
2018-08-19T05:55:14
145,278,359
0
0
null
null
null
null
UTF-8
Java
false
false
11,539
java
package com.zsm.foxconn.mypaperless; import java.io.DataInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.provider.MediaStore; import android.support.v4.app.Fragment; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.zsm.foxconn.mypaperless.base.MyConstant; import com.zsm.foxconn.mypaperless.bean.UserBean; import com.zsm.foxconn.mypaperless.help.Bimp; import com.zsm.foxconn.mypaperless.help.CropImageActivity; import com.zsm.foxconn.mypaperless.help.GenerateQRCodeActivity; import com.zsm.foxconn.mypaperless.help.UploadFileTask; public class FragmentPerson extends Fragment implements OnClickListener { Context context; Intent intent; UserBean userBean; private View view; private TextView job_number, Full_name; private LinearLayout Person_stick, Personnel_information, Person_Feedback, Person_Setting_Center; private ImageButton exitImageButton; private TextView bartitle_txt; private ImageView Head_portrait; private Button photo_camera, photo_cancel, photo_gallery; private Dialog dialog; private static final int Shear_picture = 0; // 剪切圖片 private static final int Start_Photo_Gallery = 1; private static final int Start_CAMERA = 2; public static final File FILE_SDCARD = Environment .getExternalStorageDirectory(); // 检测SD卡 public static final String IMAGE_PATH = "Mypaperless-photo"; // 文件夾名稱 public static final File FILE_LOCAL = new File(FILE_SDCARD, IMAGE_PATH); public static final File FILE_PIC_SCREENSHOT = new File(FILE_LOCAL, "images/myself"); // 照片路徑 private static String localTempImageFileName = ""; private Handler pic_hdl; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.person, container, false); userBean = (UserBean) getActivity().getApplicationContext(); job_number = (TextView) view.findViewById(R.id.text_job_number); Full_name = (TextView) view.findViewById(R.id.text_Full_name); exitImageButton = (ImageButton) view.findViewById(R.id.bt_img_exit); exitImageButton.setVisibility(view.GONE); bartitle_txt = (TextView) view.findViewById(R.id.bartitle_txt); Head_portrait = (ImageView) view.findViewById(R.id.Head_portrait); bartitle_txt.setText("個人中心"); job_number.setText(userBean.getLogonName()); Full_name.setText(userBean.getChineseName()); Person_stick = (LinearLayout) view.findViewById(R.id.Person_stick); Personnel_information = (LinearLayout) view .findViewById(R.id.Personnel_information); Person_Feedback = (LinearLayout) view .findViewById(R.id.Person_Feedback); Person_Setting_Center = (LinearLayout) view .findViewById(R.id.Person_Setting_Center); try { Bitmap bit = null; bit = BitmapFactory.decodeFile(FILE_PIC_SCREENSHOT + "/" + userBean.getLogonName() + ".png"); if (bit.equals(null)) { pic_hdl = new PicHandler(); Thread t = new LoadPicThread(); t.start(); } Bitmap bitmap = Bimp.createFramedPhoto(480, 480, bit, (int) (20 * 1.6f)); Head_portrait.setImageBitmap(bitmap); } catch (Exception e) { // TODO: handle exception pic_hdl = new PicHandler(); Thread t = new LoadPicThread(); t.start(); } Head_portrait.setOnClickListener(this); Person_stick.setOnClickListener(this); Personnel_information.setOnClickListener(this); Person_Feedback.setOnClickListener(this); Person_Setting_Center.setOnClickListener(this); return view; } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.Head_portrait: View view = getActivity().getLayoutInflater().inflate( R.layout.photo_choose_dialog, null); dialog = new Dialog(getActivity(), R.style.transparentFrameWindowStyle); dialog.setContentView(view, new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); Window window = dialog.getWindow(); photo_camera = (Button) dialog.findViewById(R.id.photo_camera); photo_cancel = (Button) dialog.findViewById(R.id.photo_cancel); photo_gallery = (Button) dialog.findViewById(R.id.photo_gallery); photo_camera.setOnClickListener(this); photo_cancel.setOnClickListener(this); photo_gallery.setOnClickListener(this); // 设置显示动画 window.setWindowAnimations(R.style.main_menu_animstyle); WindowManager.LayoutParams wl = window.getAttributes(); wl.x = 0; wl.y = getActivity().getWindowManager().getDefaultDisplay() .getHeight(); // 以下这两句是为了保证按钮可以水平满屏 wl.width = ViewGroup.LayoutParams.MATCH_PARENT; wl.height = ViewGroup.LayoutParams.WRAP_CONTENT; // 设置显示位置 dialog.onWindowAttributesChanged(wl); // 设置点击外围解散 dialog.setCanceledOnTouchOutside(true); dialog.show(); break; case R.id.Person_stick: intent = new Intent(getActivity(), Person_My_message.class); startActivity(intent); break; case R.id.Personnel_information: intent = new Intent(getActivity(), Person_Information.class); startActivity(intent); break; case R.id.Person_Feedback: intent = new Intent(getActivity(), Person_Feedback.class); startActivity(intent); break; case R.id.Person_Setting_Center: intent = new Intent(getActivity(), Person_Setting_Center.class); startActivity(intent); break; case R.id.photo_camera: localTempImageFileName = userBean.getLogonName()+"原图" + ".png"; File filePath = FILE_PIC_SCREENSHOT; if (!filePath.exists()) { filePath.mkdirs(); // 如果文件夹不存在,则重新创建 } Intent intent1 = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); File f = new File(filePath, localTempImageFileName); Uri u = Uri.fromFile(f); intent1.putExtra(MediaStore.Images.Media.ORIENTATION, 0); intent1.putExtra(MediaStore.EXTRA_OUTPUT, u); startActivityForResult(intent1, Start_CAMERA); dialog.cancel(); break; case R.id.photo_cancel: dialog.cancel(); break; case R.id.photo_gallery: Intent intent = new Intent();// 调用图库 intent.setType("image/*"); intent.setAction(Intent.ACTION_PICK);// 调用系统图库 startActivityForResult(intent, Start_Photo_Gallery); dialog.cancel(); break; default: break; } } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case Start_Photo_Gallery: if (resultCode == getActivity().RESULT_OK && null != data) { if (data != null) { Uri uri = data.getData(); if (!TextUtils.isEmpty(uri.getAuthority())) { Cursor cursor = getActivity() .getContentResolver() .query(uri, new String[] { MediaStore.Images.Media.DATA }, null, null, null); if (null == cursor) { Toast.makeText(getActivity(), "照片不存在", Toast.LENGTH_SHORT).show(); return; } cursor.moveToFirst(); String path = cursor.getString(cursor .getColumnIndex(MediaStore.Images.Media.DATA)); cursor.close(); Intent intent = new Intent(getActivity(), CropImageActivity.class); intent.putExtra("path", path); startActivityForResult(intent, Shear_picture); } else { // Log.i(TAG,"path=" + uri.getPath()); Intent intent = new Intent(getActivity(), CropImageActivity.class); intent.putExtra("path", uri.getPath()); startActivityForResult(intent, Shear_picture); } } } break; case Start_CAMERA: File f = new File(FILE_PIC_SCREENSHOT, localTempImageFileName); Intent intent = new Intent(getActivity(), CropImageActivity.class); intent.putExtra("path", f.getAbsolutePath()); startActivityForResult(intent, Shear_picture); break; case Shear_picture: if (resultCode == getActivity().RESULT_OK && null != data) { final String path = data.getStringExtra("path"); Bitmap bitmap = BitmapFactory.decodeFile(path); bitmap = Bimp.createFramedPhoto(480, 480, bitmap, (int) (20 * 1.6f)); // GenerateQRCodeActivity.uploadFile(path); UploadFileTask uploadFileTask=new UploadFileTask(getActivity()); uploadFileTask.execute(path); Head_portrait.setImageBitmap(bitmap); }else { return; } break; } super.onActivityResult(requestCode, resultCode, data); } class LoadPicThread extends Thread { @Override public void run() { try { //訪問服務器獲取當前用戶的頭像 Bitmap img = getUrlImage(MyConstant.GET_WSDL_PICTURE + "image/" + userBean.getLogonName() + ".png"); if (img.equals(null)) { return; } Message msg = pic_hdl.obtainMessage(); msg.what = 0; msg.obj = img; pic_hdl.sendMessage(msg); } catch (Exception e) { // TODO: handle exception onResume(); return; } } } class PicHandler extends Handler { @Override public void handleMessage(Message msg) { // TODO Auto-generated method stub // String s = (String)msg.obj; // ptv.setText(s); Bitmap myimg = (Bitmap) msg.obj; localTempImageFileName = userBean.getLogonName() + ".png"; File filePath = FILE_PIC_SCREENSHOT; if (!filePath.exists()) { filePath.mkdirs(); } File f = new File(filePath, localTempImageFileName); //將圖片存到本地,方便下一次頭像獲取 FileOutputStream fOut = null; try { fOut = new FileOutputStream(f); } catch (Exception e) { // TODO: handle exception } myimg.compress(Bitmap.CompressFormat.PNG, 100, fOut); try { fOut.flush(); } catch (IOException e) { e.printStackTrace(); } try { fOut.close(); } catch (IOException e) { e.printStackTrace(); } Bitmap bitmap = Bimp.createFramedPhoto(480, 480, myimg, (int) (20 * 1.6f)); Head_portrait.setImageBitmap(bitmap); } } // 加载图片 public Bitmap getUrlImage(String url) { DataInputStream dis; Bitmap img = null; try { URL picurl = new URL(url); // 获得连接 HttpURLConnection conn = (HttpURLConnection) picurl .openConnection(); conn.setConnectTimeout(6000);// 设置超时 conn.setDoInput(true); conn.setUseCaches(true);// 缓存 conn.connect(); // 接收客户端文件 dis = new DataInputStream(conn.getInputStream()); //获得图片的数据流 img = BitmapFactory.decodeStream(dis); System.out.println("-" + img.getHeight()); dis.close(); } catch (Exception e) { e.printStackTrace(); } return img; } }
[ "13652308051@163.com" ]
13652308051@163.com
3faf8d147fec944260325eab91844d839d334599
1168432783e0066fa6f2f2e4d281e724205eada2
/src/main/java/h8/chikey/model/Service.java
39ea3131e449228556b6e5422a9238b857513b60
[]
no_license
Chikey5057/AutoService2
5a4569b3619f9e3d5a309e2f52060ef476ba223f
6489fdcb21cae002ef1fbd40251262cf2a4c2587
refs/heads/master
2023-03-12T05:06:25.737292
2021-03-02T03:35:46
2021-03-02T03:35:46
343,635,080
0
0
null
null
null
null
UTF-8
Java
false
false
1,284
java
package h8.chikey.model; import lombok.*; import javax.persistence.*; import java.util.Set; @Table(name = "service") @Getter @Setter @NoArgsConstructor @RequiredArgsConstructor @Entity public class Service { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private int serviceID; @NonNull @Column(name = "Title") private String title; @NonNull @Column(name = "Cost") private double cost; @NonNull @Column(name = "DurationInSeconds") private int durationInSecond; @Column(name = "Description") private String description; @Column(name = "Discount") private double discount; @Column(name = "MainImagePath") private String mainImagePath; @OneToMany(mappedBy = "service",fetch = FetchType.EAGER) Set<ClientService>setService; @Override public String toString() { return "Service{" + "serviceID=" + serviceID + ", title='" + title + '\'' + ", cost=" + cost + ", durationInSecond=" + durationInSecond + ", description='" + description + '\'' + ", discount=" + discount + ", mainImagePath='" + mainImagePath + '\'' + '}'; } }
[ "saintsbesezen@gmail.com" ]
saintsbesezen@gmail.com
b63113fab866c4c041c35d373e1eadfc0909ee64
d05f20a98348b05e397759500e1d82cc96329ab1
/src/java/fundacion/modelo/dao/TipoUsuarioFacade.java
77e7c0bfdcb96b789414d286aa643942d2463637
[]
no_license
AndresF-B-S/Fundacion
393c400e5c1a803226196b76e6e75d7ef771ada8
78142dc7fc5f7f288493a78474f830b73b28d659
refs/heads/master
2020-08-03T02:22:35.332492
2019-10-15T06:35:43
2019-10-15T06:35:43
211,595,695
1
0
null
2019-10-11T02:49:55
2019-09-29T03:13:16
CSS
UTF-8
Java
false
false
738
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 fundacion.modelo.dao; import fundacion.modelo.entidades.TipoUsuario; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @Stateless public class TipoUsuarioFacade extends AbstractFacade<TipoUsuario> { @PersistenceContext(unitName = "FundacionPU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public TipoUsuarioFacade() { super(TipoUsuario.class); } }
[ "andres.gamer1998@gmail.com" ]
andres.gamer1998@gmail.com
4e4ad088913412a126d93b474a46e02f7a38408a
dac930784bb147e72c185722c60f47704d503244
/src/day63_collections/IteratorExample.java
054b7aab490be4557cc0c0566fee4ee9951098c9
[]
no_license
DannyOtgon/java-programming
191b85d120ad23a5011c3362360d46fccb3a1133
88021c9c6854c463bc31cbd385d92f7379f97348
refs/heads/master
2023-07-18T17:23:38.382091
2021-09-15T14:04:42
2021-09-15T14:04:42
368,566,691
0
0
null
2021-06-11T02:59:40
2021-05-18T14:46:38
Java
UTF-8
Java
false
false
1,357
java
package day63_collections; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.Set; public class IteratorExample { public static void main(String[] args) { ArrayList<String> list = new ArrayList<>(); list.add(("john")); list.add(("jamie")); list.add(("jorege")); System.out.println("list = " + list); Iterator<String> it = list.iterator(); it.next(); it.remove(); System.out.println("list = " + list); System.out.println("it.next() = " + it.next()); Set<String> names = new HashSet<>(); names.add("lebron"); names.add("james"); names.add("mj"); names.add("kobe"); names.add("tim"); names.add("wade"); names.add("messi"); System.out.println("=================================="); System.out.println(names); names.remove("lebron"); System.out.println(names + " lebron remove"); Iterator<String> iterator = names.iterator(); while(iterator.hasNext()){ String currentName = iterator.next(); System.out.println(currentName); if(currentName.length()<3){ iterator.remove(); } } System.out.println("After Remove: " + names); } }
[ "dannyotgon@gmail.com" ]
dannyotgon@gmail.com
6521afd44033dd9698d91d0b3eafaf2372bf7ccb
89050d714d31b72232cdaeed588dc70ebe20f098
/SPSEJBService/ejbModule/job/service/PctrxdmtEjb.java
cb17089ed007c965596c3f2be53737f1ad36d97b
[]
no_license
se3mis/SPS_VERSION
8c185823b2e7ded17a8bd1a84a4bd5eaf7874b8d
50f25979a095e94125c57ca2604d41969f873de9
refs/heads/master
2016-09-14T01:55:23.537357
2016-05-06T05:56:38
2016-05-06T05:56:38
58,184,917
0
0
null
null
null
null
UTF-8
Java
false
false
2,069
java
package job.service; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import job.ejb.PctrxdmtDao; import job.ejb.PctrxdmtDaoRemote; import job.model.Pctrxdmt; import job.model.PctrxdmtPK; public class PctrxdmtEjb implements PctrxdmtDaoRemote{ private Context context; private PctrxdmtDaoRemote dao; public PctrxdmtEjb() { super(); this.dao=lookupDao(); } private PctrxdmtDaoRemote lookupDao() { try { context = new InitialContext(); PctrxdmtDaoRemote dao = (PctrxdmtDaoRemote) context.lookup("PctrxdmtDao/remote"); // System.out.println("got dao "+dao.getM); //System.out.println(dao.findGldeptm("")); return dao; } catch (NamingException e){ e.printStackTrace(); throw new RuntimeException(e); } } @Override public void createPctrxdmt(Pctrxdmt pctrxdmt, String webAppName) { // TODO Auto-generated method stub } @Override public void updatePctrxdmt(Pctrxdmt pctrxdmt, String webAppName) { // TODO Auto-generated method stub } @Override public void removePctrxdmt(Pctrxdmt pctrxdmt, String webAppName) { // TODO Auto-generated method stub } @Override public void removeAll(String webAppName) { // TODO Auto-generated method stub } @Override public Pctrxdmt findById(PctrxdmtPK id, String webAppName) { // TODO Auto-generated method stub return null; } @Override public Pctrxdmt findBy3PK(String deptId, String docNo, String docPf, long seqNo, String webAppName) { return dao.findBy3PK(deptId, docNo, docPf, seqNo, webAppName); } public static void main(String[] args) { Pctrxdmt ss = null; try{ PctrxdmtEjb XXX = new PctrxdmtEjb(); ss = XXX.findBy3PK( "514.20" , "MIS2000" , "JV_MIS", 1 ,"Testing"); System.out.println("HIIIIYYY" + ss); }catch(Exception e){ System.out.println("HIIII : " + e.getStackTrace()); e.printStackTrace(); System.out.println("HIIIIYYY" + ss); } } }
[ "se3mis@ceb.lk" ]
se3mis@ceb.lk
e7a970503f67fd5542165045ac9f4b887ea7562a
112bbaa75a44c145ec955a35e55e2500da27cdc7
/src/main/java/com/zupedu/proposta/propostas/PropostaRequest.java
2de8f968a7609faed21a78fd764afb5487af1f11
[ "Apache-2.0" ]
permissive
joaojf/orange-talents-06-template-proposta
007f3c5cfb38ef95e231ed675dca6b63114a1ec7
82c216d0c4d18ad86f018e89e729915386691afb
refs/heads/master
2023-07-12T21:49:53.320108
2021-08-26T17:15:13
2021-08-26T17:15:13
399,203,693
0
0
Apache-2.0
2021-08-23T18:06:54
2021-08-23T18:06:54
null
UTF-8
Java
false
false
1,950
java
package com.zupedu.proposta.propostas; import com.zupedu.proposta.validacoes.ExceptionPersonalizada; import com.zupedu.proposta.validacoes.DocumentoValido; import org.springframework.http.HttpStatus; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.PositiveOrZero; import java.math.BigDecimal; import java.util.Objects; public class PropostaRequest { @DocumentoValido @NotBlank private String cpfOuCnpj; @NotBlank @NotNull @Email private String email; @NotBlank private String nome; @NotBlank private String endereco; @NotNull @PositiveOrZero private BigDecimal salario; public Proposta converte(PropostaRepository propostaRepository) { if (propostaRepository.existsByCpfOuCnpj(this.cpfOuCnpj)) { throw new ExceptionPersonalizada("Já existe uma proposta cadastrada para esse CPF/CNPJ", HttpStatus.UNPROCESSABLE_ENTITY); } return new Proposta(this.cpfOuCnpj, this.email, this.nome, this.endereco, this.salario); } public String getCpfOuCnpj() { return cpfOuCnpj; } public String getEmail() { return email; } public String getNome() { return nome; } public String getEndereco() { return endereco; } public BigDecimal getSalario() { return salario; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PropostaRequest that = (PropostaRequest) o; return cpfOuCnpj.equals(that.cpfOuCnpj) && email.equals(that.email) && nome.equals(that.nome) && endereco.equals(that.endereco) && salario.equals(that.salario); } @Override public int hashCode() { return Objects.hash(cpfOuCnpj, email, nome, endereco, salario); } }
[ "joaovitor13cv@hotmail.com" ]
joaovitor13cv@hotmail.com
2a76e8ffe9dd2e7cb7ded533b3ca496ca00185fa
d3d0e0e4e7f8a1eb6b85c777893d60a499d8c79c
/src/main/java/virtualpetsamok/RoboticCat.java
06fa42d925730d69b6804306d96edc11c66a1f83
[]
no_license
DavidByrd/VIrtualPetAmok
f84340317a0180fc63890623c71e2cca2c9559eb
0cd0ced4274553aa7af253a0a0c42e0cb6392d17
refs/heads/master
2020-03-19T05:10:15.890407
2018-06-11T03:10:16
2018-06-11T03:10:16
135,906,035
0
0
null
null
null
null
UTF-8
Java
false
false
604
java
package virtualpetsamok; public class RoboticCat extends VirtualPets { public RoboticCat(String name, String description, int health, int happiness) { super(name, description, health, happiness); // TODO Auto-generated constructor stub } private int rustLevel = 10; // TODO Auto-generated constructor stub public int getRustLevel() { return rustLevel ; } public void oilRoboticPet(int amount) { rustLevel -= amount; } public void RoboticTick( ) { rustLevel += 1; System.out.println("Tick tock, tick tock,"); System.out.println("RustLevel: " + rustLevel); } }
[ "Foolish_Otaku@yahoo.com" ]
Foolish_Otaku@yahoo.com
a003d300ea887cf01277ffaa0412a08170aad98c
c39e01952ba32ad2aa4af9c23f11d5162eec7c14
/app/src/androidTest/java/com/example/reem/timestables/ExampleInstrumentedTest.java
fa83783aff342b3c111075da748fce78f964e430
[]
no_license
ReemHazzaa/TimesTables
909a6759c4bf9db1e89259a39165b0d83167f9dc
18d71c6756b2efe21c74b4cf04f65678fef31cae
refs/heads/master
2020-04-02T15:36:32.878206
2018-10-24T22:06:06
2018-10-24T22:06:06
154,575,115
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package com.example.reem.timestables; 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.example.reem.timestables", appContext.getPackageName()); } }
[ "reemhazzaa4@gmail.com" ]
reemhazzaa4@gmail.com
15a5e1da364dc2dfe701ba1bfd134fa63800ce86
699b69a19f65c81898b377162355b96d8ec5a765
/app/src/test/java/com/aroejg/listadomascotas/ExampleUnitTest.java
1e884e42a6999cc600fefbb1c8c2305333a77a67
[]
no_license
ariel48/Petagram
27d92daa90caf64c1946c968c8dadc7c9735ecff
77e7f03aad7b3ea44004f71697dbf96a9b913ac6
refs/heads/master
2023-01-02T19:44:31.419689
2020-10-28T00:05:00
2020-10-28T00:05:00
306,198,600
0
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.aroejg.listadomascotas; 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); } }
[ "71481361+ariel48@users.noreply.github.com" ]
71481361+ariel48@users.noreply.github.com
bf053e30d55dfe232c3c737020de89ff744be833
a8db1b646329708301942ff60f0b4c31afd075e5
/app/src/main/java/com/lootlo/lootlo/earn_money.java
541bde9c0726720457d8d4882f45774eeb41019b
[]
no_license
Dipankershah/Lootlo
d482a0ec49a15094e1c09b05684db305a4c81102
6b4db94b89af74ae863a344e0ca128bf10bbc9b7
refs/heads/master
2021-08-23T04:41:00.925702
2017-12-03T10:12:06
2017-12-03T10:12:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,856
java
package com.lootlo.lootlo; import android.app.ProgressDialog; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.ebanx.swipebtn.OnStateChangeListener; import com.ebanx.swipebtn.SwipeButton; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.MobileAds; import com.google.android.gms.ads.reward.RewardItem; import com.google.android.gms.ads.reward.RewardedVideoAd; import com.google.android.gms.ads.reward.RewardedVideoAdListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class earn_money extends AppCompatActivity implements RewardedVideoAdListener { DatabaseReference databaseReference; FirebaseAuth auth; FirebaseUser user; TextView bal; int balnce; int adcount; int indigator=0; int indigator2=0; private RewardedVideoAd mAd; FirebaseAuth.AuthStateListener mAuthListner; RelativeLayout referLay; Button referGet; EditText referCode; ProgressDialog progressDialog; SwipeButton swipeButton; @Override protected void onStart() { super.onStart(); auth.addAuthStateListener(mAuthListner); } @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_earn_money); swipeButton=(SwipeButton) findViewById(R.id.swipe_btn); swipeButton.setOnStateChangeListener(new OnStateChangeListener() { @Override public void onStateChange(boolean active) { show(); } }); progressDialog=new ProgressDialog(this); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setMessage("Loading..."); progressDialog.show(); referLay= (RelativeLayout) findViewById(R.id.refer); referGet= (Button) findViewById(R.id.getRefer); referCode= (EditText) findViewById(R.id.refercode); MobileAds.initialize(getApplicationContext(),"ca-app-pub-3940256099942544~3347511713"); mAd = MobileAds.getRewardedVideoAdInstance(this); mAd.setRewardedVideoAdListener(this); loadRewardedVideoAd(); user=FirebaseAuth.getInstance().getCurrentUser(); auth = FirebaseAuth.getInstance(); mAuthListner=new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { if (firebaseAuth.getCurrentUser()==null){ startActivity(new Intent(getApplicationContext(),MainActivity.class)); } } }; databaseReference= FirebaseDatabase.getInstance().getReferenceFromUrl("https://lootlo-2a2d2.firebaseio.com"); databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot.hasChild(user.getUid())){ } else { Toast.makeText(getApplicationContext(),"Welcome To Loot Lo App",Toast.LENGTH_LONG).show(); databaseReference.child(user.getUid()).child("bal").setValue(5); databaseReference.child(user.getUid()).child("count").setValue(0); progressDialog.dismiss(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot.hasChild(user.getUid())) { balnce = dataSnapshot.child(user.getUid()).child("bal").getValue(Integer.class); } if (dataSnapshot.child(user.getUid()).hasChild("count")){ adcount=dataSnapshot.child(user.getUid()).child("count").getValue(Integer.class); } else { adcount=10; } } @Override public void onCancelled(DatabaseError databaseError) { } }); bal(); } public void bal(){ bal=(TextView) findViewById(R.id.bal); databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { bal.setText(dataSnapshot.child(user.getUid()).child("bal").getValue()+" Rs"); progressDialog.dismiss(); if (dataSnapshot.child(user.getUid()).hasChild("earn")){ referLay.setVisibility(RelativeLayout.GONE); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } private void loadRewardedVideoAd() { mAd.loadAd("ca-app-pub-3940256099942544/5224354917", new AdRequest.Builder().build()); } @Override public void onRewardedVideoAdLoaded() { } @Override public void onRewardedVideoAdOpened() { } @Override public void onRewardedVideoStarted() { } @Override public void onRewardedVideoAdClosed() { loadRewardedVideoAd(); } @Override public void onRewarded(RewardItem rewardItem) { databaseReference.child(user.getUid()).child("bal").setValue(balnce+1); if (adcount<5){ databaseReference.child(user.getUid()).child("count").setValue(adcount+1); } if (adcount==5){ databaseReference.child(user.getUid()).child("count").removeValue(); databaseReference.child("ref").addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { final String s=dataSnapshot.child(user.getUid()).getValue(String.class); databaseReference.child(s).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (indigator==0) { int bal2 = dataSnapshot.child("bal").getValue(Integer.class); credit(bal2, s); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } @Override public void onCancelled(DatabaseError databaseError) { } }); databaseReference.child(user.getUid()).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (indigator2==0) { int bal2 = dataSnapshot.child("bal").getValue(Integer.class); credit2(bal2, user.getUid()); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } } @Override public void onRewardedVideoAdLeftApplication() { } @Override public void onRewardedVideoAdFailedToLoad(int i) { } @Override protected void onPause() { mAd.pause(this); super.onPause(); } @Override protected void onResume() { mAd.resume(this); super.onResume(); } @Override protected void onDestroy() { mAd.destroy(this); super.onDestroy(); } public void show(){ if (mAd.isLoaded()) { mAd.show(); } else { Toast.makeText(getApplicationContext(),"Please Wait Until Ad is Loaded",Toast.LENGTH_LONG).show(); loadRewardedVideoAd(); } } public void getRef(View view){ final String ref=referCode.getText().toString(); databaseReference.child("refer").addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot.hasChild(ref)){ String s=dataSnapshot.child(ref).getValue(String.class); databaseReference.child("ref").child(user.getUid()).setValue(s); databaseReference.child(user.getUid()).child("earn").setValue(ref); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } public void gotoRef(View view){ startActivity(new Intent(getApplicationContext(),myRef.class)); } public void credit(Integer integer,String s){ databaseReference.child(s).child("bal").setValue(integer+5); indigator++; } public void credit2(Integer integer,String s){ databaseReference.child(s).child("bal").setValue(integer+5); indigator2++; } }
[ "dipankarshah143@gmail.com" ]
dipankarshah143@gmail.com
5138fce9f37b61271949b49c8689b28be53aca43
f32ccce441bc99a5330eeba193a019365cab3b36
/meet-management/meet-cloud/meet-plan-agenda-api/src/main/java/com/fh/dao/MeetingAgendaDao.java
fb3fc869820ff7a2cdebbd91f7d9241576eb8cd3
[]
no_license
yq1871151886/meet
47215e1d55ac85bf055108fc74b27d76b5ce2d9d
9381061b70222841564e45b3ef377a0c436ac4c8
refs/heads/master
2022-07-04T07:13:36.453073
2020-01-13T06:08:37
2020-01-13T06:08:37
232,337,445
0
0
null
2022-06-21T02:35:42
2020-01-07T14:05:23
JavaScript
UTF-8
Java
false
false
851
java
package com.fh.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.fh.bean.MeetingAgendaBean; import com.fh.bean.MeetingNameBean; import com.fh.bean.MeetingUnitBean; import com.fh.utils.PageBean; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository @Mapper public interface MeetingAgendaDao extends BaseMapper<MeetingAgendaBean> { List<MeetingUnitBean> initMeetingUnit(); List<MeetingNameBean> initMeetingName(); void addMeeting(MeetingAgendaBean meetingAgenda); Long meetingPageCount(@Param("meeting") MeetingAgendaBean meetingAgendaBean); List<MeetingAgendaBean> meetingPage(@Param("page") PageBean<MeetingAgendaBean> page,@Param("meeting") MeetingAgendaBean meetingAgendaBean); }
[ "379192173@qq.com" ]
379192173@qq.com
d582e6ebf9d60530f9ad77c85b2ed67644a99940
e9746857961ab18f139096f9368f00d56666a2c4
/src/test/java/org/quantum/quantumtest/web/rest/UserJWTControllerIT.java
4bcb92de5aa1a1b62de7202faf5699f7f053edb3
[ "MIT" ]
permissive
Quantum-P3/quantum-test
a80d28e481d8d7a05ac62518fff71cf1de6d66df
6dd84c83e71701ad087310c8fa883735fd1a5d51
refs/heads/main
2023-05-24T10:45:59.080175
2021-06-19T05:15:33
2021-06-19T05:15:33
372,646,737
0
0
null
null
null
null
UTF-8
Java
false
false
4,001
java
package org.quantum.quantumtest.web.rest; import static org.hamcrest.Matchers.emptyString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.nullValue; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.junit.jupiter.api.Test; import org.quantum.quantumtest.IntegrationTest; import org.quantum.quantumtest.domain.User; import org.quantum.quantumtest.repository.UserRepository; import org.quantum.quantumtest.web.rest.vm.LoginVM; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.http.MediaType; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.test.web.servlet.MockMvc; import org.springframework.transaction.annotation.Transactional; /** * Integration tests for the {@link UserJWTController} REST controller. */ @AutoConfigureMockMvc @IntegrationTest class UserJWTControllerIT { @Autowired private UserRepository userRepository; @Autowired private PasswordEncoder passwordEncoder; @Autowired private MockMvc mockMvc; @Test @Transactional void testAuthorize() throws Exception { User user = new User(); user.setLogin("user-jwt-controller"); user.setEmail("user-jwt-controller@example.com"); user.setActivated(true); user.setPassword(passwordEncoder.encode("test")); userRepository.saveAndFlush(user); LoginVM login = new LoginVM(); login.setUsername("user-jwt-controller"); login.setPassword("test"); mockMvc .perform(post("/api/authenticate").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(login))) .andExpect(status().isOk()) .andExpect(jsonPath("$.id_token").isString()) .andExpect(jsonPath("$.id_token").isNotEmpty()) .andExpect(header().string("Authorization", not(nullValue()))) .andExpect(header().string("Authorization", not(is(emptyString())))); } @Test @Transactional void testAuthorizeWithRememberMe() throws Exception { User user = new User(); user.setLogin("user-jwt-controller-remember-me"); user.setEmail("user-jwt-controller-remember-me@example.com"); user.setActivated(true); user.setPassword(passwordEncoder.encode("test")); userRepository.saveAndFlush(user); LoginVM login = new LoginVM(); login.setUsername("user-jwt-controller-remember-me"); login.setPassword("test"); login.setRememberMe(true); mockMvc .perform(post("/api/authenticate").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(login))) .andExpect(status().isOk()) .andExpect(jsonPath("$.id_token").isString()) .andExpect(jsonPath("$.id_token").isNotEmpty()) .andExpect(header().string("Authorization", not(nullValue()))) .andExpect(header().string("Authorization", not(is(emptyString())))); } @Test void testAuthorizeFails() throws Exception { LoginVM login = new LoginVM(); login.setUsername("wrong-user"); login.setPassword("wrong password"); mockMvc .perform(post("/api/authenticate").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(login))) .andExpect(status().isUnauthorized()) .andExpect(jsonPath("$.id_token").doesNotExist()) .andExpect(header().doesNotExist("Authorization")); } }
[ "pbonilla29@hotmail.com" ]
pbonilla29@hotmail.com
92c824c3a7fbf785776df747e7b2897973e3ed23
71f2f4b4fdf2696332a1f76961739f05d91fac75
/DebuggingExercises/FixDebugOne2.java
f2d44a221cb7f7fe6bfaaa5a2c2741637fd07fd4
[]
no_license
jaredcooke/cp2406_farrell8_ch01
7502be6ef3047fa4d433ac2453bac21fcfccfbab
ce6ddc4e21cddcc35ec4a516d9e68694cafd403e
refs/heads/master
2021-01-01T20:50:17.165912
2017-08-01T01:42:26
2017-08-01T01:42:26
98,944,024
0
0
null
2017-08-01T01:07:54
2017-08-01T01:07:53
null
UTF-8
Java
false
false
399
java
public class FixDebugOne2 { /* This program displays some output */ public static void main(String[] args) { System.out.println("Java programming is fun."); System.out.println("Getting a program to work"); System.out.println("can be a challenge,"); System.out.println("but when everything works correctly,"); System.out.println("it's very satisfying"); } }
[ "jared.cooke@my.jcu.edu.au" ]
jared.cooke@my.jcu.edu.au
cfaabc6b96f77a1a8bcd79e8da041f78d9bf4807
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/Compress-41/org.apache.commons.compress.archivers.zip.ZipArchiveInputStream/BBC-F0-opt-40/26/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream_ESTest.java
683b2663e06f9c1c7902a512f4aefb4be3e788a1
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
29,936
java
/* * This file was automatically generated by EvoSuite * Fri Oct 22 21:20:53 GMT 2021 */ package org.apache.commons.compress.archivers.zip; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.FileDescriptor; import java.io.IOException; import java.io.InputStream; import java.io.PipedInputStream; import java.io.PushbackInputStream; import java.io.SequenceInputStream; import java.nio.charset.IllegalCharsetNameException; import java.util.Enumeration; import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.jar.JarArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.evosuite.runtime.mock.java.io.MockFileInputStream; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class ZipArchiveInputStream_ESTest extends ZipArchiveInputStream_ESTest_scaffolding { @Test(timeout = 4000) public void test00() throws Throwable { byte[] byteArray0 = new byte[8]; byteArray0[0] = (byte)83; boolean boolean0 = ZipArchiveInputStream.matches(byteArray0, (byte)83); assertEquals(8, byteArray0.length); assertFalse(boolean0); assertArrayEquals(new byte[] {(byte)83, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0}, byteArray0); } @Test(timeout = 4000) public void test01() throws Throwable { byte[] byteArray0 = new byte[2]; boolean boolean0 = ZipArchiveInputStream.matches(byteArray0, 4); assertEquals(2, byteArray0.length); assertFalse(boolean0); assertArrayEquals(new byte[] {(byte)0, (byte)0}, byteArray0); } @Test(timeout = 4000) public void test02() throws Throwable { PipedInputStream pipedInputStream0 = new PipedInputStream(1024); assertNotNull(pipedInputStream0); assertEquals(0, pipedInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(pipedInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, pipedInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); long long0 = zipArchiveInputStream0.skip(1024); assertEquals(0, pipedInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0L, long0); } @Test(timeout = 4000) public void test03() throws Throwable { Enumeration<PushbackInputStream> enumeration0 = (Enumeration<PushbackInputStream>) mock(Enumeration.class, new ViolatedAssumptionAnswer()); doReturn(false).when(enumeration0).hasMoreElements(); SequenceInputStream sequenceInputStream0 = new SequenceInputStream(enumeration0); assertNotNull(sequenceInputStream0); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(sequenceInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); ArchiveEntry archiveEntry0 = zipArchiveInputStream0.getNextEntry(); assertNull(archiveEntry0); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); } @Test(timeout = 4000) public void test04() throws Throwable { ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream((InputStream) null, (String) null, true, true); assertNotNull(zipArchiveInputStream0); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); zipArchiveInputStream0.close(); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); // try { zipArchiveInputStream0.skip(5293L); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // The stream is closed // // // verifyException("org.apache.commons.compress.archivers.zip.ZipArchiveInputStream", e); // } } @Test(timeout = 4000) public void test05() throws Throwable { // Undeclared exception! // try { ZipArchiveInputStream.matches((byte[]) null, 1009); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.compress.archivers.zip.ZipArchiveInputStream", e); // } } @Test(timeout = 4000) public void test06() throws Throwable { byte[] byteArray0 = new byte[0]; // Undeclared exception! // try { ZipArchiveInputStream.matches(byteArray0, (byte)83); // fail("Expecting exception: ArrayIndexOutOfBoundsException"); // } catch(ArrayIndexOutOfBoundsException e) { // // // // 0 // // // verifyException("org.apache.commons.compress.archivers.zip.ZipArchiveInputStream", e); // } } @Test(timeout = 4000) public void test07() throws Throwable { DataInputStream dataInputStream0 = new DataInputStream((InputStream) null); assertNotNull(dataInputStream0); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(dataInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); // Undeclared exception! // try { zipArchiveInputStream0.getNextZipEntry(); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("java.io.DataInputStream", e); // } } @Test(timeout = 4000) public void test08() throws Throwable { byte[] byteArray0 = new byte[4]; ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0, (-175), 3); assertEquals(4, byteArray0.length); assertNotNull(byteArrayInputStream0); assertEquals(3, byteArrayInputStream0.available()); assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0}, byteArray0); DataInputStream dataInputStream0 = new DataInputStream(byteArrayInputStream0); assertEquals(4, byteArray0.length); assertNotNull(dataInputStream0); assertEquals(3, byteArrayInputStream0.available()); assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0}, byteArray0); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(dataInputStream0, (String) null); assertEquals(4, byteArray0.length); assertNotNull(zipArchiveInputStream0); assertEquals(3, byteArrayInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0}, byteArray0); // Undeclared exception! // try { zipArchiveInputStream0.getNextZipEntry(); // fail("Expecting exception: ArrayIndexOutOfBoundsException"); // } catch(ArrayIndexOutOfBoundsException e) { // } } @Test(timeout = 4000) public void test09() throws Throwable { ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream((InputStream) null, (String) null, true, true); assertNotNull(zipArchiveInputStream0); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); // try { zipArchiveInputStream0.getNextZipEntry(); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // Stream closed // // // verifyException("java.io.PushbackInputStream", e); // } } @Test(timeout = 4000) public void test10() throws Throwable { FileDescriptor fileDescriptor0 = new FileDescriptor(); assertNotNull(fileDescriptor0); assertFalse(fileDescriptor0.valid()); MockFileInputStream mockFileInputStream0 = new MockFileInputStream(fileDescriptor0); assertNotNull(mockFileInputStream0); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(mockFileInputStream0, "WHpQb", true, true); assertNotNull(zipArchiveInputStream0); assertFalse(fileDescriptor0.valid()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); // try { zipArchiveInputStream0.getNextEntry(); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.evosuite.runtime.mock.java.io.NativeMockedIO", e); // } } @Test(timeout = 4000) public void test11() throws Throwable { Enumeration<PushbackInputStream> enumeration0 = (Enumeration<PushbackInputStream>) mock(Enumeration.class, new ViolatedAssumptionAnswer()); doReturn(false, true).when(enumeration0).hasMoreElements(); doReturn((Object) null).when(enumeration0).nextElement(); SequenceInputStream sequenceInputStream0 = new SequenceInputStream(enumeration0); assertNotNull(sequenceInputStream0); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(sequenceInputStream0, "GMT+0", false); assertNotNull(zipArchiveInputStream0); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); // Undeclared exception! // try { zipArchiveInputStream0.close(); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("java.io.SequenceInputStream", e); // } } @Test(timeout = 4000) public void test12() throws Throwable { PipedInputStream pipedInputStream0 = new PipedInputStream(66); assertNotNull(pipedInputStream0); assertEquals(0, pipedInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(pipedInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, pipedInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); ZipArchiveInputStream zipArchiveInputStream1 = null; // try { zipArchiveInputStream1 = new ZipArchiveInputStream(zipArchiveInputStream0, "", false, false); // fail("Expecting exception: IllegalCharsetNameException"); // } catch(IllegalCharsetNameException e) { // // // // // // // verifyException("java.nio.charset.Charset", e); // } } @Test(timeout = 4000) public void test13() throws Throwable { PipedInputStream pipedInputStream0 = new PipedInputStream(66); assertNotNull(pipedInputStream0); assertEquals(0, pipedInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(pipedInputStream0, "UTF8", true, true); assertNotNull(zipArchiveInputStream0); assertEquals(0, pipedInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); ZipArchiveInputStream zipArchiveInputStream1 = null; // try { zipArchiveInputStream1 = new ZipArchiveInputStream(zipArchiveInputStream0, "", true); // fail("Expecting exception: IllegalCharsetNameException"); // } catch(IllegalCharsetNameException e) { // // // // // // // verifyException("java.nio.charset.Charset", e); // } } @Test(timeout = 4000) public void test14() throws Throwable { FileDescriptor fileDescriptor0 = new FileDescriptor(); assertNotNull(fileDescriptor0); assertFalse(fileDescriptor0.valid()); MockFileInputStream mockFileInputStream0 = new MockFileInputStream(fileDescriptor0); assertNotNull(mockFileInputStream0); SequenceInputStream sequenceInputStream0 = new SequenceInputStream(mockFileInputStream0, mockFileInputStream0); assertNotNull(sequenceInputStream0); assertFalse(fileDescriptor0.valid()); ZipArchiveInputStream zipArchiveInputStream0 = null; // try { zipArchiveInputStream0 = new ZipArchiveInputStream(sequenceInputStream0, ""); // fail("Expecting exception: IllegalCharsetNameException"); // } catch(IllegalCharsetNameException e) { // // // // // // // verifyException("java.nio.charset.Charset", e); // } } @Test(timeout = 4000) public void test15() throws Throwable { FileDescriptor fileDescriptor0 = new FileDescriptor(); assertNotNull(fileDescriptor0); assertFalse(fileDescriptor0.valid()); MockFileInputStream mockFileInputStream0 = new MockFileInputStream(fileDescriptor0); assertNotNull(mockFileInputStream0); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(mockFileInputStream0, "WHpQb", true, true); assertNotNull(zipArchiveInputStream0); assertFalse(fileDescriptor0.valid()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); ZipArchiveInputStream zipArchiveInputStream1 = new ZipArchiveInputStream(zipArchiveInputStream0, "UTF8", false, false); assertNotNull(zipArchiveInputStream1); assertFalse(fileDescriptor0.valid()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream1.getCount()); assertEquals(0L, zipArchiveInputStream1.getBytesRead()); assertFalse(zipArchiveInputStream1.equals((Object)zipArchiveInputStream0)); ZipArchiveEntry zipArchiveEntry0 = zipArchiveInputStream1.getNextZipEntry(); assertNull(zipArchiveEntry0); assertFalse(fileDescriptor0.valid()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream1.getCount()); assertEquals(0L, zipArchiveInputStream1.getBytesRead()); assertNotSame(zipArchiveInputStream0, zipArchiveInputStream1); assertNotSame(zipArchiveInputStream1, zipArchiveInputStream0); assertFalse(zipArchiveInputStream0.equals((Object)zipArchiveInputStream1)); assertFalse(zipArchiveInputStream1.equals((Object)zipArchiveInputStream0)); } @Test(timeout = 4000) public void test16() throws Throwable { byte[] byteArray0 = new byte[6]; byteArray0[0] = (byte)80; boolean boolean0 = ZipArchiveInputStream.matches(byteArray0, 3179); assertEquals(6, byteArray0.length); assertFalse(boolean0); assertArrayEquals(new byte[] {(byte)80, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0}, byteArray0); } @Test(timeout = 4000) public void test17() throws Throwable { byte[] byteArray0 = new byte[1]; boolean boolean0 = ZipArchiveInputStream.matches(byteArray0, (-1)); assertEquals(1, byteArray0.length); assertFalse(boolean0); assertArrayEquals(new byte[] {(byte)0}, byteArray0); } @Test(timeout = 4000) public void test18() throws Throwable { PipedInputStream pipedInputStream0 = new PipedInputStream(66); assertNotNull(pipedInputStream0); assertEquals(0, pipedInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(pipedInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, pipedInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); long long0 = zipArchiveInputStream0.skip(66); assertEquals(0, pipedInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, long0); } @Test(timeout = 4000) public void test19() throws Throwable { PipedInputStream pipedInputStream0 = new PipedInputStream(649); assertNotNull(pipedInputStream0); assertEquals(0, pipedInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(pipedInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, pipedInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); long long0 = zipArchiveInputStream0.skip(0L); assertEquals(0, pipedInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, long0); } @Test(timeout = 4000) public void test20() throws Throwable { PipedInputStream pipedInputStream0 = new PipedInputStream(649); assertNotNull(pipedInputStream0); assertEquals(0, pipedInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(pipedInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, pipedInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); // Undeclared exception! // try { zipArchiveInputStream0.skip((-1190L)); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.apache.commons.compress.archivers.zip.ZipArchiveInputStream", e); // } } @Test(timeout = 4000) public void test21() throws Throwable { PipedInputStream pipedInputStream0 = new PipedInputStream(649); assertNotNull(pipedInputStream0); assertEquals(0, pipedInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(pipedInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, pipedInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); zipArchiveInputStream0.close(); assertEquals(0, pipedInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); zipArchiveInputStream0.close(); assertEquals(0, pipedInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); } @Test(timeout = 4000) public void test22() throws Throwable { PipedInputStream pipedInputStream0 = new PipedInputStream(); assertNotNull(pipedInputStream0); assertEquals(0, pipedInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(pipedInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, pipedInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); zipArchiveInputStream0.close(); assertEquals(0, pipedInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); byte[] byteArray0 = new byte[5]; // try { zipArchiveInputStream0.read(byteArray0, 512, (int) (byte)4); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // The stream is closed // // // verifyException("org.apache.commons.compress.archivers.zip.ZipArchiveInputStream", e); // } } @Test(timeout = 4000) public void test23() throws Throwable { byte[] byteArray0 = new byte[39]; ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0); assertEquals(39, byteArray0.length); assertNotNull(byteArrayInputStream0); assertEquals(39, byteArrayInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(byteArrayInputStream0); assertEquals(39, byteArray0.length); assertNotNull(zipArchiveInputStream0); assertEquals(39, byteArrayInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); int int0 = zipArchiveInputStream0.read(byteArray0, 3, (-1)); assertEquals(39, byteArray0.length); assertEquals(39, byteArrayInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals((-1), int0); } @Test(timeout = 4000) public void test24() throws Throwable { Enumeration<PushbackInputStream> enumeration0 = (Enumeration<PushbackInputStream>) mock(Enumeration.class, new ViolatedAssumptionAnswer()); doReturn(false).when(enumeration0).hasMoreElements(); SequenceInputStream sequenceInputStream0 = new SequenceInputStream(enumeration0); assertNotNull(sequenceInputStream0); JarArchiveEntry jarArchiveEntry0 = new JarArchiveEntry("UP%+a=a`2l%"); assertNotNull(jarArchiveEntry0); assertEquals((-1), ZipArchiveEntry.CRC_UNKNOWN); assertEquals(3, ZipArchiveEntry.PLATFORM_UNIX); assertEquals(0, ZipArchiveEntry.PLATFORM_FAT); assertEquals((-1L), jarArchiveEntry0.getCrc()); assertEquals(0, jarArchiveEntry0.getRawFlag()); assertEquals(0, jarArchiveEntry0.getVersionRequired()); assertFalse(jarArchiveEntry0.isDirectory()); assertEquals(0L, jarArchiveEntry0.getExternalAttributes()); assertEquals((-1L), jarArchiveEntry0.getSize()); assertEquals((-1L), jarArchiveEntry0.getCompressedSize()); assertNull(jarArchiveEntry0.getComment()); assertEquals(0, jarArchiveEntry0.getPlatform()); assertEquals((-1), jarArchiveEntry0.getMethod()); assertEquals("UP%+a=a`2l%", jarArchiveEntry0.toString()); assertEquals("UP%+a=a`2l%", jarArchiveEntry0.getName()); assertFalse(jarArchiveEntry0.isUnixSymlink()); assertEquals(0, jarArchiveEntry0.getVersionMadeBy()); assertEquals(0, jarArchiveEntry0.getUnixMode()); assertEquals(0, jarArchiveEntry0.getInternalAttributes()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(sequenceInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); boolean boolean0 = zipArchiveInputStream0.canReadEntryData(jarArchiveEntry0); assertEquals((-1), ZipArchiveEntry.CRC_UNKNOWN); assertEquals(3, ZipArchiveEntry.PLATFORM_UNIX); assertEquals(0, ZipArchiveEntry.PLATFORM_FAT); assertEquals((-1L), jarArchiveEntry0.getCrc()); assertEquals(0, jarArchiveEntry0.getRawFlag()); assertEquals(0, jarArchiveEntry0.getVersionRequired()); assertFalse(jarArchiveEntry0.isDirectory()); assertEquals(0L, jarArchiveEntry0.getExternalAttributes()); assertEquals((-1L), jarArchiveEntry0.getSize()); assertEquals((-1L), jarArchiveEntry0.getCompressedSize()); assertNull(jarArchiveEntry0.getComment()); assertEquals(0, jarArchiveEntry0.getPlatform()); assertEquals((-1), jarArchiveEntry0.getMethod()); assertEquals("UP%+a=a`2l%", jarArchiveEntry0.toString()); assertEquals("UP%+a=a`2l%", jarArchiveEntry0.getName()); assertFalse(jarArchiveEntry0.isUnixSymlink()); assertEquals(0, jarArchiveEntry0.getVersionMadeBy()); assertEquals(0, jarArchiveEntry0.getUnixMode()); assertEquals(0, jarArchiveEntry0.getInternalAttributes()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertFalse(boolean0); } @Test(timeout = 4000) public void test25() throws Throwable { byte[] byteArray0 = new byte[39]; ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0); assertEquals(39, byteArray0.length); assertNotNull(byteArrayInputStream0); assertEquals(39, byteArrayInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(byteArrayInputStream0); assertEquals(39, byteArray0.length); assertNotNull(zipArchiveInputStream0); assertEquals(39, byteArrayInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); boolean boolean0 = zipArchiveInputStream0.canReadEntryData((ArchiveEntry) null); assertEquals(39, byteArray0.length); assertEquals(39, byteArrayInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); assertFalse(boolean0); } @Test(timeout = 4000) public void test26() throws Throwable { PipedInputStream pipedInputStream0 = new PipedInputStream(1024); assertNotNull(pipedInputStream0); assertEquals(0, pipedInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(pipedInputStream0); assertNotNull(zipArchiveInputStream0); assertEquals(0, pipedInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); zipArchiveInputStream0.close(); assertEquals(0, pipedInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); ZipArchiveEntry zipArchiveEntry0 = zipArchiveInputStream0.getNextZipEntry(); assertNull(zipArchiveEntry0); assertEquals(0, pipedInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); } @Test(timeout = 4000) public void test27() throws Throwable { byte[] byteArray0 = new byte[0]; ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0, (-1194), 16); assertEquals(0, byteArray0.length); assertNotNull(byteArrayInputStream0); assertEquals(16, byteArrayInputStream0.available()); assertArrayEquals(new byte[] {}, byteArray0); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(byteArrayInputStream0); assertEquals(0, byteArray0.length); assertNotNull(zipArchiveInputStream0); assertEquals(16, byteArrayInputStream0.available()); assertEquals(0, zipArchiveInputStream0.getCount()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertArrayEquals(new byte[] {}, byteArray0); // Undeclared exception! // try { zipArchiveInputStream0.getNextEntry(); // fail("Expecting exception: ArrayIndexOutOfBoundsException"); // } catch(ArrayIndexOutOfBoundsException e) { // } } @Test(timeout = 4000) public void test28() throws Throwable { byte[] byteArray0 = new byte[39]; ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0); assertEquals(39, byteArray0.length); assertNotNull(byteArrayInputStream0); assertEquals(39, byteArrayInputStream0.available()); ZipArchiveInputStream zipArchiveInputStream0 = new ZipArchiveInputStream(byteArrayInputStream0); assertEquals(39, byteArray0.length); assertNotNull(zipArchiveInputStream0); assertEquals(39, byteArrayInputStream0.available()); assertEquals(0L, zipArchiveInputStream0.getBytesRead()); assertEquals(0, zipArchiveInputStream0.getCount()); ZipArchiveEntry zipArchiveEntry0 = zipArchiveInputStream0.getNextZipEntry(); assertEquals(39, byteArray0.length); assertNull(zipArchiveEntry0); assertEquals(9, byteArrayInputStream0.available()); assertEquals(30L, zipArchiveInputStream0.getBytesRead()); assertEquals(30, zipArchiveInputStream0.getCount()); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
3e6f1c41617c3b7b7b3ea83b4d8a2e18700647cb
384b21898a63e6ed22b73268912e8b57b7529306
/app/src/main/java/com/example/patient/loginandreg/DcLogin.java
50bf1b4311e88c6f1caeb0b466acfa445557d45a
[]
no_license
96omar/DoctorAndPatient
63c3762404d8c3d2cad65bd5790355097c552155
4d0f4b6e63dec66a95cf382c2d54f4855df2ca1e
refs/heads/master
2022-07-06T08:31:44.973107
2020-05-09T16:18:19
2020-05-09T16:18:19
262,608,112
0
0
null
null
null
null
UTF-8
Java
false
false
9,021
java
package com.example.patient.loginandreg; import androidx.appcompat.app.AppCompatActivity; import android.app.ProgressDialog; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.provider.Settings; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.example.patient.DcMainActivity; import com.example.patient.R; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class DcLogin extends AppCompatActivity { //declaring variables Button reg,sign_in; EditText dc_id,dc_name,dc_pass; String dc_id_code,dc_id_ret,dc_pass_ret; ProgressDialog progress; //defining SharedPreferences and database object private static final String TAG = DcLogin.class.getSimpleName(); public static final String PREFS_NAME = "LoginPrefsDcLogin"; DatabaseReference databaseReference, rootRef; private String deviceID, userName, PasswordUser; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dc_login); //assign ids with xml sign_in = (Button) findViewById(R.id.dc_btn_signin); reg = (Button) findViewById(R.id.dc_reg_btn_signin); dc_id = (EditText) findViewById(R.id.dc_id_text_signin); //dc_name = (EditText) findViewById(R.id.dc_name_text_signin); dc_pass = (EditText) findViewById(R.id.dc_pass_text_signin); /** session open */ SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); if (settings.getString("logged", "").toString().equals("logged")) { Intent intent = new Intent(getApplicationContext(), DcMainActivity.class); startActivity(intent); finish(); } reg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent n = new Intent(getApplicationContext(), DcRegsitration.class); startActivity(n); finish(); } }); sign_in.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { progress = new ProgressDialog(DcLogin.this); progress.setTitle("Loading"); progress.setMessage("Wait while loading..."); progress.setCancelable(false); // disable dismiss by tapping outside of the dialog progress.show(); // to get id for dc dc_id_code = dc_id.getText().toString(); /**firebase retrive code**/ /** Database Connection */ databaseReference = FirebaseDatabase.getInstance().getReference(); rootRef = databaseReference.child("Doc" + dc_id_code); /** get name and make a validation */ databaseReference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if (dataSnapshot.child("Doc" + dc_id_code).exists()) { /** retrieve user from database */ rootRef.child("Dc_ID").addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { /** Get map of users in datasnapshot */ String id = dataSnapshot.getValue(String.class); dc_id_ret = id.toString().trim(); System.out.println(dc_id_ret); } @Override public void onCancelled(DatabaseError databaseError) { /** Failed to read value */ Log.e(TAG, "Failed to read user", databaseError.toException()); } }); /** Retrieve user password from database */ rootRef.child("Dc_Password").addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { /** Get map of users in datasnapshot */ String pass = dataSnapshot.getValue(String.class); dc_pass_ret = pass.toString().trim(); System.out.println(dc_pass_ret); } @Override public void onCancelled(DatabaseError databaseError) { /** Failed to read value */ Log.e(TAG, "Failed to read user", databaseError.toException()); Toast.makeText(getApplicationContext(), "login Failed!Please Ensure from your data To Login Doctor", Toast.LENGTH_SHORT).show(); } }); } else { System.out.println("Failed to read user ID"); Log.e(TAG, "Failed to read user ID"); Toast.makeText(getApplicationContext(), "login Failed!Please Ensure from your data To Login Doctor", Toast.LENGTH_SHORT).show(); } } @Override public void onCancelled(DatabaseError databaseError) { /** Failed to read value */ Log.e(TAG, "Failed to read user", databaseError.toException()); Toast.makeText(getApplicationContext(), "login Failed!Please Ensure from your data To Login Doctor", Toast.LENGTH_SHORT).show(); } }); new Handler().postDelayed(new Runnable() { @Override public void run() { progress.dismiss(); if (dc_id.getText().toString().equals(dc_id_ret) && dc_pass.getText().toString().equals(dc_pass_ret)) { /** Open Session */ SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString("logged", "logged"); editor.commit(); /** Open Home Screen */ Intent n = new Intent(getApplicationContext(), DcMainActivity.class); startActivity(n); finish(); /** Else IF email field value and Password field value are not match any value stored in database */ } else if (!dc_id.getText().toString().equals(dc_id_ret) || ! dc_pass.getText().toString().equals(dc_pass_ret)) { if ((dc_id.getText().toString()).isEmpty() && (dc_pass.getText().toString()).isEmpty()) { /** Error message */ Toast.makeText(getApplicationContext(), "login Failed ID and Password Field is Empty ", Toast.LENGTH_SHORT).show(); } else if ((dc_id.getText().toString()).isEmpty()) { /** Error message */ Toast.makeText(getApplicationContext(), "login Failed ID Field is Empty ", Toast.LENGTH_SHORT).show(); } else if ((dc_pass.getText().toString()).isEmpty()) { /** Error message */ Toast.makeText(getApplicationContext(), "login Failed Password Field is Empty ", Toast.LENGTH_SHORT).show(); } else { /** Error message */ Toast.makeText(getApplicationContext(), "login Failed!Please Ensure from your data To Login Doctor", Toast.LENGTH_SHORT).show(); } } } }, 8000); } }); } }
[ "43747171+7DigITs-Solutions@users.noreply.github.com" ]
43747171+7DigITs-Solutions@users.noreply.github.com