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
41d5a9d167f5012596838a494cadb8d808105d44
2970ed3dfabe375f6a1d0c4004f5fbdce91d62ad
/src/main/java/guava/eventbus/EventBusPostProcessor.java
d744774de01262e244a167c6ce8c7af510aa97c2
[]
no_license
yanghongwu/java_demo
b6cb625efa15fd4ee2aefd145dc81720190c602e
1277deed2f6ab748ef44da54c3dc25becbc3be71
refs/heads/master
2020-04-18T20:02:27.614978
2018-04-27T07:53:23
2018-04-27T07:53:23
66,642,131
0
0
null
null
null
null
UTF-8
Java
false
false
1,579
java
package guava.eventbus; import com.google.common.eventbus.Subscribe; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.stereotype.Service; import java.lang.annotation.Annotation; import java.lang.reflect.Method; /** * Created by yanghongwu on 2017/8/17. */ @Service public class EventBusPostProcessor implements BeanPostProcessor { @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { // for each method in the bean Method[] methods = bean.getClass().getMethods(); for (Method method : methods) { // check the annotations on that method Annotation[] annotations = method.getAnnotations(); for (Annotation annotation : annotations) { // if it contains the Subscribe annotation if (annotation.annotationType().equals(Subscribe.class)) { // 检查到bean声明了Guava EventBus Subscribe注解, 则自动注册到全局的EventBus上 EventBusFactory.getDefault().eventBus().register(bean); // LOGGER.info("Bean " + BeanßbeanName + " was subscribed to EventBus"); // we only need to register once return bean; } } } return bean; } }
[ "yanghongwu@meituan.com" ]
yanghongwu@meituan.com
d2d68adc5ac86f91940124dce8a4ad60ca0187c1
4f322c3d80cca3abcd1585a52bda9a87d40212b2
/library-web-vue/backend/src/main/java/ru/biderman/librarywebbackend/services/GenreService.java
8442d3bc2dc9fb3e1b29c4220801111945e32655
[]
no_license
AlaricLightin/2019-08-otus-spring-Biderman
5ad2fa3ee86781c7b511375f4d43d46ab047b832
4fe0071a5290d71ed9aeccb439cac8da2c554001
refs/heads/master
2020-07-17T22:07:52.917298
2020-02-27T20:58:57
2020-02-27T20:58:57
206,109,539
0
0
null
2020-02-27T20:58:58
2019-09-03T15:24:37
Java
UTF-8
Java
false
false
191
java
package ru.biderman.librarywebbackend.services; import ru.biderman.librarywebbackend.domain.Genre; import java.util.List; public interface GenreService { List<Genre> getAllGenres(); }
[ "a_lightin@mail.ru" ]
a_lightin@mail.ru
f79f69c137b3601c73cea8947c965d6d0f5c3020
c3dc08fe8319c9d71f10473d80b055ac8132530e
/challenge-121/abigail/java/ch-1.java
db7264601e77ec47a818b6d7949067cc0cdd8653
[]
no_license
southpawgeek/perlweeklychallenge-club
d4b70d9d8e4314c4dfc4cf7a60ddf457bcaa7a1e
63fb76188e132564e50feefd2d9d5b8491568948
refs/heads/master
2023-01-08T19:43:56.982828
2022-12-26T07:13:05
2022-12-26T07:13:05
241,471,631
1
0
null
2020-02-18T21:30:34
2020-02-18T21:30:33
null
UTF-8
Java
false
false
561
java
// // See ../README.md // // // Run as: ln ch-1.java ch1.java; javac ch1.java; java ch1 < input-file // import java.util.*; public class ch1 { public static void main (String [] args) { Scanner scanner = new Scanner (System . in); try { while (true) { int m = scanner . nextInt (); int n = scanner . nextInt (); System . out . println (m ^ (1 << (n - 1))); } } catch (Exception e) { // // EOF // } } }
[ "abigail@abigail.be" ]
abigail@abigail.be
8d0950d56a0ff219c1ab5d50e6accd57309c3209
da001188f0200b3cca730b069eaf975d2891a8be
/src/main/java/com/oriaxx77/javaplay/threads/utilities/executors/WordCounter.java
f4c99f1f286037c631a3df7222ee230bbf3da823
[]
no_license
oriaxx77/java8-examples
979c67928d5d44aa21e4e27ffc499e69649f93e3
df1ed3d519ce8f369e5318d5f8a848de2f752fd5
refs/heads/master
2020-12-25T11:05:40.205837
2019-01-25T10:29:11
2019-01-25T10:29:11
61,535,108
0
0
null
null
null
null
UTF-8
Java
false
false
2,635
java
/** * */ package com.oriaxx77.javaplay.threads.utilities.executors; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; /** * Example for asynchronously counting the words in a text. * It uses an {@link ExecutorService} to run the {@link WordCounterCallable} in a new thread. * It uses the {@link Future#get()} method to wait until the counting is done. * @author BagyuraI */ public class WordCounter { /** * A {@link Callable} implementation that is initialized with a {@link String}. * It's {@link #call()} method counts the words in the provided text. It trims the text, so leading and * trailing whitespaces are omitted. * @author BagyuraI */ static private class WordCounterCallable implements Callable<Integer> { /** * Text in which we count the words. */ private String text; /** * Constructor * @param word Text in which we count the words. It cannot be null. */ public WordCounterCallable(String text) { super(); if ( text == null ) throw new IllegalArgumentException( "The text cannot be null." ); this.text = text; } /** * Returns with the words in the {@link #text} field. * It calls the {@link String#trim()} method on the provided text then counts the words * with the <i>\\s+</i> regex. * * @see java.util.concurrent.Callable#call() */ @Override public Integer call() throws Exception { if ( text.trim().isEmpty() ) return 0 ; return text.trim().split( "\\s+" ).length; } }; /** * Runs this example. It counts the words in the sentence: * <i>Hello there! This is a java concurrency example for using callable and future objects.</i> * @param args command line arguments. They are not used at this moment. */ public static void main(String[] args) { String sentence = "Hello there! This is a java concurrency example for using callable and future objects."; WordCounterCallable wordCounter = new WordCounterCallable( sentence ); ExecutorService executor = Executors.newSingleThreadExecutor(); Future<Integer> future = executor.submit( wordCounter ); try { Integer wordCount = future.get(); // NOTE: this is blocking until the the result is available. System.out.println( "Word Count: " + wordCount ); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } executor.shutdown(); } }
[ "istvan.bagyura@p92.hu" ]
istvan.bagyura@p92.hu
73f769171cdaddc85d8f36ab2361b8bcb31a4d96
152b2c2cfb92a0d538f2161e41e9b638991ac8d8
/BoxMap-core/src/de/ranagazoo/boxmap/Config.java
f2d00fc16a008db544f12b7a87254d06199ce9f3
[]
no_license
BlueAndOrangeMorality/BoxMap
9778faa361513b65602edc08a0ce2a81069552c0
d1a2377d998c2cca8114a0815abd3c9398a1cb7e
refs/heads/master
2021-08-30T03:37:39.712442
2017-12-15T22:11:31
2017-12-15T22:11:31
111,728,690
0
0
null
null
null
null
UTF-8
Java
false
false
1,898
java
package de.ranagazoo.boxmap; public class Config { public static final String TEXTURE_LIBGDX = "data/libgdx.png"; public static final String TEXTURE_ENTITIES = "data/entities-big.png"; public static final String TEXTURE_MECHA = "data/mecha32.png"; public static final String MAP_MAP = "data/map.tmx"; public static final short CATEGORY_PLAYER = 0x0001; // 0000000000000001 in binary public static final short CATEGORY_MONSTER = 0x0002; // 0000000000000010 in binary public static final short CATEGORY_MSENSOR = 0x0008; // 0000000000001000 in binary public static final short CATEGORY_SCENERY = 0x0004; // 0000000000000100 in binary public static final short CATEGORY_NONE = 0x0032; // 0000000000100000 in binary ??? public static final short CATEGORY_WAYPOINT = 0x0064; // 0000000001000000 in binary ??? public static final short MASK_PLAYER = CATEGORY_MONSTER | CATEGORY_SCENERY | CATEGORY_MSENSOR; // or ~CATEGORY_PLAYER public static final short MASK_MONSTER = CATEGORY_PLAYER | CATEGORY_SCENERY | CATEGORY_WAYPOINT; // or ~CATEGORY_MONSTER //Monstersensor, reagiert nur auf player public static final short MASK_MSENSOR = CATEGORY_PLAYER; // or ~CATEGORY_MONSTER public static final short MASK_SCENERY = -1; public static final short MASK_NONE = CATEGORY_SCENERY; public static final short MASK_WAYPOINT = CATEGORY_MONSTER; public static final int TS = 32; public static final String TYPE_PLAYER1 = "player1"; public static final String TYPE_ENEMY1 = "enemy1"; public static final String TYPE_OBSTACLE = "obstacle"; public static final String TYPE_WAYPOINT = "waypoint"; public static final String TYPE_WAYPOINTGROUP = "waypointGroup"; public static final int STATUS_IDLE = 1; public static final int STATUS_ATTACK = 2; public static final int STATUS_NEW_TARGET = 3; }
[ "BlueAndOrangeMorality@users.noreply.github.com" ]
BlueAndOrangeMorality@users.noreply.github.com
3f4dcac975887ec773b47754a2f4599f3e25ff86
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/67/org/apache/commons/math/analysis/polynomials/PolynomialFunction_subtract_166.java
f2cd6c802ad1b768c49d71674cba86e0fbd79230
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
1,370
java
org apach common math analysi polynomi immut represent real polynomi function real coeffici href http mathworld wolfram horner method hornersmethod html horner' method evalu function version revis date polynomi function polynomialfunct differenti univari real function differentiableunivariaterealfunct serializ subtract polynomi instanc param polynomi subtract polynomi differ instanc minu polynomi function polynomialfunct subtract polynomi function polynomialfunct identifi lowest degre polynomi low length lowlength math min coeffici length coeffici length high length highlength math max coeffici length coeffici length build coeffici arrai coeffici newcoeffici high length highlength low length lowlength coeffici newcoeffici coeffici coeffici coeffici length coeffici length low length lowlength high length highlength coeffici newcoeffici coeffici system arraycopi coeffici low length lowlength coeffici newcoeffici low length lowlength high length highlength low length lowlength polynomi function polynomialfunct coeffici newcoeffici
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
a88042156ace4b70d6c095aab24f58a27d5875c3
3867501e77cbc48739df5f1034bc1184097ae543
/src/main/java/cn/cstube/wiki/service/DemoService.java
ba05c4015facad69db74363f1cdfd26f39c0cff6
[]
no_license
HelingCode/wiki
a3ae1c4ee0541758cc75a7fa188eb3bbfde2a1e3
9c1ee05ec3500bb57adb027119d01db73a7dff54
refs/heads/master
2023-08-23T05:28:57.599765
2021-09-06T11:00:15
2021-09-06T11:00:15
400,172,181
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package cn.cstube.wiki.service; import cn.cstube.wiki.domain.Demo; import cn.cstube.wiki.mapper.DemoMapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; /** * @auther heling * @date 2021/8/27 */ @Service public class DemoService { @Resource private DemoMapper demoMapper; public List<Demo> list(){ return demoMapper.selectByExample(null); } }
[ "929926540@qq.com" ]
929926540@qq.com
f443ac560e422c3f0da1a9147ff9621fdf256d79
bed8659729db79dabf563427bcb524bb1d74b4dd
/Opinnot/src/main/java/org/otharjoitus/opinnot/Main.java
9671334a61923d66fd3a79ba0435036c72e34096
[]
no_license
Jasminmo/ot-harjoitustyo
f0710a1693fdfcaf671e6e9e8a58937391b4e0d3
43837a3faa989c423765590c7b8bae48c2e33995
refs/heads/master
2023-05-01T11:41:44.231522
2021-05-16T21:29:35
2021-05-16T21:29:35
309,812,530
0
0
null
null
null
null
UTF-8
Java
false
false
425
java
package org.otharjoitus.opinnot; import org.otharjoitus.opinnot.ui.KurssiSuoritusGUI; import org.otharjoitus.opinnot.ui.KurssiSuoritusUI; import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { //KurssiSuoritusUI ui = new KurssiSuoritusUI(new Scanner(System.in)); //ui.start(); KurssiSuoritusGUI.main(args); } }
[ "jasmingiire1@gmail.com" ]
jasmingiire1@gmail.com
e14350d05603ffaacc1f9838fc6cc5e7f098a447
d1942c788bbd93d27f3940c265ebceb2a7017116
/app/src/main/java/com/copia/copiasalesmobile/LoginActivity.java
18f4bfd05f8d7b1d9dc18b4cd5a0de94434e6460
[]
no_license
kmbuco/androidOrdering
9229a2fe836c0fe18e5a70092645c67e17f27469
c9910e7a31785a87ac507fc99c6d6b406b9af8f6
refs/heads/master
2021-01-21T13:52:28.370285
2016-05-20T15:05:43
2016-05-20T15:05:43
53,048,820
0
0
null
null
null
null
UTF-8
Java
false
false
13,586
java
package com.copia.copiasalesmobile; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.annotation.TargetApi; import android.content.Intent; import android.content.pm.PackageManager; import android.support.annotation.NonNull; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.app.LoaderManager.LoaderCallbacks; import android.content.CursorLoader; import android.content.Loader; import android.database.Cursor; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.provider.ContactsContract; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.copia.copiasalesmobile.SQLite.DatabaseConnectorSqlite; import com.copia.copiasalesmobile.openErp.Functions; import java.io.IOException; import java.util.ArrayList; import java.util.List; import static android.Manifest.permission.READ_CONTACTS; /** * A login screen that offers login via email/password. */ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<Cursor> { /** * Id to identity READ_CONTACTS permission request. */ private static final int REQUEST_READ_CONTACTS = 0; DatabaseConnectorSqlite dbConnector; /** * A dummy authentication store containing known user names and passwords. * TODO: remove after connecting to a real authentication system. */ private static final String[] DUMMY_CREDENTIALS = new String[]{ "foo@example.com:hello", "bar@example.com:world", "test:test","ecattest:1234" }; /** * Keep track of the login task to ensure we can cancel it if requested. */ private UserLoginTask mAuthTask = null; // UI references. private AutoCompleteTextView mUserView; private EditText mPasswordView; private View mProgressView; private View mLoginFormView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); setContentView(R.layout.activity_login); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Set up the login form. mUserView = (AutoCompleteTextView) findViewById(R.id.username); populateAutoComplete(); dbConnector = new DatabaseConnectorSqlite(this); mPasswordView = (EditText) findViewById(R.id.password); mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { if (id == R.id.login || id == EditorInfo.IME_NULL) { attemptLogin(); return true; } return false; } }); Button mSignInButton = (Button) findViewById(R.id.sign_in_button); mSignInButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { attemptLogin(); } }); mLoginFormView = findViewById(R.id.login_form); mProgressView = findViewById(R.id.login_progress); } private void populateAutoComplete() { if (!mayRequestContacts()) { return; } getLoaderManager().initLoader(0, null, this); } private boolean mayRequestContacts() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { return true; } if (shouldShowRequestPermissionRationale(READ_CONTACTS)) { Snackbar.make(mUserView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE) .setAction(android.R.string.ok, new View.OnClickListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onClick(View v) { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } }); } else { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } return false; } /** * Callback received when a permissions request has been completed. */ @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == REQUEST_READ_CONTACTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { populateAutoComplete(); } } } /** * Attempts to sign in or register the account specified by the login form. * If there are form errors (invalid email, missing fields, etc.), the * errors are presented and no actual login attempt is made. */ private void attemptLogin() { if (mAuthTask != null) { return; } // Reset errors. mUserView.setError(null); mPasswordView.setError(null); // Store values at the time of the login attempt. String username = mUserView.getText().toString(); String password = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; // Check for a valid username. if (TextUtils.isEmpty(username)) { mUserView.setError(getString(R.string.error_field_required)); focusView = mUserView; cancel = true; } else if (!isUserNameValid(username)) { mUserView.setError(getString(R.string.error_invalid_user)); focusView = mUserView; cancel = true; } // Check for a valid password, if the user entered one. if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { mPasswordView.setError(getString(R.string.error_invalid_password)); focusView = mPasswordView; cancel = true; } if (cancel) { // There was an error; don't attempt login and focus the first // form field with an error. focusView.requestFocus(); } else { // Show a progress spinner, and kick off a background task to // perform the user login attempt. showProgress(true); mAuthTask = new UserLoginTask(username, password); mAuthTask.execute((Void) null); } } private boolean isUserNameValid(String username) { //TODO: Replace this with your own logic //return email.contains("@"); return true; } private boolean isPasswordValid(String password) { //TODO: Replace this with your own logic //return password.length() > 4; return true; } /** * Shows the progress UI and hides the login form. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) private void showProgress(final boolean show) { // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow // for very easy animations. If available, use these APIs to fade-in // the progress spinner. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); mLoginFormView.animate().setDuration(shortAnimTime).alpha( show ? 0 : 1).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } }); mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); mProgressView.animate().setDuration(shortAnimTime).alpha( show ? 1 : 0).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); } }); } else { // The ViewPropertyAnimator APIs are not available, so simply show // and hide the relevant UI components. mProgressView.setVisibility(show ? View.VISIBLE : View.GONE); mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } } @Override public Loader<Cursor> onCreateLoader(int i, Bundle bundle) { return new CursorLoader(this, // Retrieve data rows for the device user's 'profile' contact. Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI, ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION, // Select only email addresses. ContactsContract.Contacts.Data.MIMETYPE + " = ?", new String[]{ContactsContract.CommonDataKinds.Email .CONTENT_ITEM_TYPE}, // Show primary email addresses first. Note that there won't be // a primary email address if the user hasn't specified one. ContactsContract.Contacts.Data.IS_PRIMARY + " DESC"); } @Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { List<String> emails = new ArrayList<>(); cursor.moveToFirst(); while (!cursor.isAfterLast()) { emails.add(cursor.getString(ProfileQuery.ADDRESS)); cursor.moveToNext(); } addEmailsToAutoComplete(emails); } @Override public void onLoaderReset(Loader<Cursor> cursorLoader) { } private void addEmailsToAutoComplete(List<String> emailAddressCollection) { //Create adapter to tell the AutoCompleteTextView what to show in its dropdown list. ArrayAdapter<String> adapter = new ArrayAdapter<>(LoginActivity.this, android.R.layout.simple_dropdown_item_1line, emailAddressCollection); mUserView.setAdapter(adapter); } private interface ProfileQuery { String[] PROJECTION = { ContactsContract.CommonDataKinds.Email.ADDRESS, ContactsContract.CommonDataKinds.Email.IS_PRIMARY, }; int ADDRESS = 0; int IS_PRIMARY = 1; } /** * Represents an asynchronous login/registration task used to authenticate * the user. */ public class UserLoginTask extends AsyncTask<Void, Void, Integer> { private final String userName; private final String mPassword; UserLoginTask(String uName, String password) { userName = uName; mPassword = password; } @Override protected Integer doInBackground(Void... params) { // TODO: attempt authentication against a network service. /*try { // Simulate network access. Thread.sleep(2000); } catch (InterruptedException e) { return false; } */ //login remotely Functions func = new Functions(dbConnector); int login =func.Login(userName,mPassword); if (login == 0){ //incorrect username }else if(login == 2){ //incorrect password }else if(login == 1){ //correct login }else{ Log.e("Login Value: ", Integer.toString(login)); } /*for (String credential : DUMMY_CREDENTIALS) { String[] pieces = credential.split(":"); if (pieces[0].equals(userName)) { // Account exists, return true if the password matches. return pieces[1].equals(mPassword); } }*/ // TODO: register the new account here. return login; } @Override protected void onPostExecute(final Integer success) { mAuthTask = null; showProgress(false); if (success==1) { Intent i = new Intent(getApplicationContext(), HomeScreen.class); startActivity(i); } else if(success == 0){ mUserView.setError(getString(R.string.error_incorrect_username)); mUserView.requestFocus(); } else if (success == 2){ mPasswordView.setError(getString(R.string.error_incorrect_password)); mPasswordView.requestFocus(); } } @Override protected void onCancelled() { mAuthTask = null; showProgress(false); } } }
[ "kmbuco@gmail.com" ]
kmbuco@gmail.com
bc7a84c8d822b890c2c10800998103b54b4a1958
ecc13aaaa1db224f7bfc72e382059487bb87f9be
/src/main/java/com/jx/concurrency/threadPool/ThreadPoolExample3.java
0a9d411220fa9e172a32709e92fb2d88cf85b24d
[]
no_license
Andy-leoo/concurrency
a24742017140aa389008d1f6347de09ecacf0011
a2c05c1eda11eb8a168aa53d5113ced9df1c09f0
refs/heads/master
2020-04-22T03:35:23.221206
2019-02-13T08:34:00
2019-02-13T08:34:00
170,092,992
0
0
null
null
null
null
UTF-8
Java
false
false
646
java
package com.jx.concurrency.threadPool; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @Slf4j public class ThreadPoolExample3 { public static void main(String[] args) { //线程池 ExecutorService service = Executors.newSingleThreadExecutor(); for (int i = 0; i < 10; i++) { final int index = i; service.execute(new Runnable() { @Override public void run() { log.info("tesk : {}",index); } }); } service.shutdown(); } }
[ "865756596@qq.com" ]
865756596@qq.com
404c04aaff25dc57da48340b0f4d6faddafb1d33
853aa1f5e366bfbbfaa40c734c929df8d57b09b2
/src/main/java/com/patterns/builder/builders/ConstructorDocumentacionVehiculo.java
c6ad4417621106df99b3ecd3808f2452b6230538
[]
no_license
rediazz83/creational-buider
e2f9b6c768b5309fca175371df1d334a2ea00b5b
7151fd8dad0159a30ed17e7d7675094ea5da4b2a
refs/heads/master
2020-12-27T08:48:27.608143
2020-02-15T00:05:41
2020-02-15T00:05:41
237,839,264
0
0
null
null
null
null
UTF-8
Java
false
false
476
java
package com.patterns.builder.builders; import com.patterns.builder.domain.Documentacion; public abstract class ConstructorDocumentacionVehiculo { protected Documentacion documentacion; public abstract void construyeDocumentacionPedido(String nombreCliente) throws Exception; public abstract void construyeDocumentacionMatriculacion(String nombreSolicitante) throws Exception; public Documentacion resultado() { return this.documentacion; } }
[ "esteban.diaz@globant.com" ]
esteban.diaz@globant.com
252569fdaf4bc66ee5ba837d6fb169063fb7c64e
8d4a69e281915a8a68b0488db0e013b311942cf4
/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/flyway/FlywayEndpointAutoConfigurationTests.java
cc3671338a9cb9c3afd23182d1c6b8b1db8d8573
[ "Apache-2.0" ]
permissive
yuanmabiji/spring-boot-2.1.0.RELEASE
798b4c29d25fdcb22fa3a0baf24a08ddd0dfa27e
6fe0467c9bc95d3849eb2ad5bae04fd9bdee3a82
refs/heads/master
2023-03-10T05:20:52.846557
2022-03-25T15:53:13
2022-03-25T15:53:13
252,902,347
320
107
Apache-2.0
2023-02-22T07:44:16
2020-04-04T03:49:51
Java
UTF-8
Java
false
false
2,077
java
/* * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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.springframework.boot.actuate.autoconfigure.flyway; import org.flywaydb.core.Flyway; import org.junit.Test; import org.springframework.boot.actuate.flyway.FlywayEndpoint; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; /** * Tests for {@link FlywayEndpointAutoConfiguration}. * * @author Phillip Webb */ public class FlywayEndpointAutoConfigurationTests { private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration( AutoConfigurations.of(FlywayEndpointAutoConfiguration.class)) .withUserConfiguration(FlywayConfiguration.class); @Test public void runShouldHaveEndpointBean() { this.contextRunner.run( (context) -> assertThat(context).hasSingleBean(FlywayEndpoint.class)); } @Test public void runWhenEnabledPropertyIsFalseShouldNotHaveEndpointBean() { this.contextRunner.withPropertyValues("management.endpoint.flyway.enabled:false") .run((context) -> assertThat(context) .doesNotHaveBean(FlywayEndpoint.class)); } @Configuration static class FlywayConfiguration { @Bean public Flyway flyway() { return mock(Flyway.class); } } }
[ "983656956@qq.com" ]
983656956@qq.com
d51fa7e5878d020c119f40126e27a8b8aeee5a90
51f7b7b07caccc876a16271f93d05067283ba0d6
/src/main/java/com/ericsson/v1/model/MonthSubCdTypeDTO.java
f32f1dc34af1d410705db92c4f32f42cbc276664
[]
no_license
upasana1roy2/UtilizationAnalysisApp
b9da65ffb2749ed8edafbbbbd27d1cc2c6bcbcbd
fccbe824ac471f3e8c134b844fe0b76c5c47a056
refs/heads/master
2021-01-17T08:56:24.867268
2016-03-09T07:17:33
2016-03-09T07:17:33
53,649,554
1
0
null
2016-03-11T07:53:17
2016-03-11T07:53:17
null
UTF-8
Java
false
false
1,292
java
package com.ericsson.v1.model; public class MonthSubCdTypeDTO { private String month; private Double targetHours; private Double recordedHours; private String subCdType; private String subCd; public MonthSubCdTypeDTO(String month, Double targetHours, Double recordedHours) { super(); this.month = month; this.targetHours = targetHours; this.recordedHours = recordedHours; } public String getMonth() { return month; } public void setMonth(String month) { this.month = month; } public Double getTargetHours() { return targetHours; } public void setTargetHours(Double targetHours) { this.targetHours = targetHours; } public Double getRecordedHours() { return recordedHours; } public void setRecordedHours(Double recordedHours) { this.recordedHours = recordedHours; } public String getSubCdType() { return subCdType; } public void setSubCdType(String subCdType) { this.subCdType = subCdType; } public String getSubCd() { return subCd; } public void setSubCd(String subCd) { this.subCd = subCd; } @Override public String toString() { return "MonthSubCdTypeDTO [month=" + month + ", targetHours=" + targetHours + ", recordedHours=" + recordedHours + ", subCdType=" + subCdType + ", subCd=" + subCd + "]"; } }
[ "soumyadeb.chattopadhyay@ericsson.com" ]
soumyadeb.chattopadhyay@ericsson.com
acc678f7685d54b3765e3323ff2db7b694283b81
59f0d156ea93112c1a8fdecb3ae05edfe2d41a22
/app/src/main/java/com/example/chatsop/Fragments/ChatsFragment.java
ebb63b72331527f60b4d1b0bd6c02201d3725db6
[]
no_license
sanjeev08-dev/Chats_OP
ce250e4c340c4cf73b81ef9f0726661757d38621
0be285b148faf9502c82de4c1e3746ea66635d82
refs/heads/master
2022-12-18T04:43:23.698068
2020-08-29T05:31:56
2020-08-29T05:31:56
291,207,562
0
0
null
null
null
null
UTF-8
Java
false
false
6,057
java
package com.example.chatsop.Fragments; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.chatsop.Adaptor.UserAdaptor; import com.example.chatsop.Model.Chat; import com.example.chatsop.Model.Chatlist; import com.example.chatsop.Model.User; import com.example.chatsop.Notifications.Token; import com.example.chatsop.R; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; 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; import com.google.firebase.iid.FirebaseInstanceId; import java.util.ArrayList; import java.util.List; import static com.google.firebase.inappmessaging.internal.Logging.TAG; public class ChatsFragment extends Fragment { private RecyclerView recyclerView; private UserAdaptor userAdaptor; private List<User> mUsers; FirebaseUser fuser; DatabaseReference reference; private List<String> usersList; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_chats, container, false); recyclerView = view.findViewById(R.id.recycler_view); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setVisibility(View.VISIBLE); DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), new LinearLayoutManager(getContext()).getOrientation()); recyclerView.addItemDecoration(dividerItemDecoration); fuser = FirebaseAuth.getInstance().getCurrentUser(); usersList = new ArrayList<>(); reference = FirebaseDatabase.getInstance().getReference("Chats"); reference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { usersList.clear(); for (DataSnapshot snapshot : dataSnapshot.getChildren()) { Chat chat = snapshot.getValue(Chat.class); if (chat.getSender().equals(fuser.getUid())) { usersList.add(chat.getReceiver()); } if (chat.getReceiver().equals(fuser.getUid())) { usersList.add(chat.getSender()); } } //chatList(); readChats(); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); updateToken(FirebaseInstanceId.getInstance().getToken()); return view; } private void readChats() { mUsers = new ArrayList<>(); reference = FirebaseDatabase.getInstance().getReference("Users"); reference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { mUsers.clear(); for (DataSnapshot snapshot : dataSnapshot.getChildren()) { User user = snapshot.getValue(User.class); for (String id : usersList) { if (user.getId().equals(id)) { if (mUsers.size() != 0) { for (User user1 : mUsers) { if (!user.getId().equals(user1.getId())) { mUsers.add(user); } } } else { mUsers.add(user); } } } } userAdaptor = new UserAdaptor(getContext(), mUsers, true); recyclerView.setAdapter(userAdaptor); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } private void updateToken(String token) { DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Tokens"); Token token1 = new Token(token); reference.child(fuser.getUid()).setValue(token1); } /*private void chatList() { mUsers = new ArrayList<>(); reference = FirebaseDatabase.getInstance().getReference("Users"); reference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { mUsers.clear(); for (DataSnapshot snapshot : dataSnapshot.getChildren()){ User user = snapshot.getValue(User.class); for (Chatlist chatlist : usersList){ assert user != null; if (user.getId() != null && user.getId().equals(chatlist.getId())){ mUsers.add(user); } } } userAdaptor = new UserAdaptor(getContext(),mUsers,true); userAdaptor.notifyDataSetChanged(); recyclerView.setAdapter(userAdaptor); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); }*/ }
[ "sanjeev081097@gmail.com" ]
sanjeev081097@gmail.com
4208080e8459139ffd8e2c6790de4c1c8c1c608e
c1caa541cfcef4c1e1496479befce59dfe90d908
/src/main/java/uk/ac/ic/wlgitbridge/data/filestore/RawFile.java
8031208ec39a2e85d4bb539f74ad50d3c0c8f202
[ "MIT" ]
permissive
bmswgnp/writelatex-git-bridge
a75c2b67fe8af05f2e95bbf13deb80fe5121f0d6
39386c7c82fd3ca2653652eb3666b0e809f9d9bd
refs/heads/master
2020-12-25T12:28:48.025930
2016-04-18T10:03:55
2016-04-18T10:03:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,027
java
package uk.ac.ic.wlgitbridge.data.filestore; import uk.ac.ic.wlgitbridge.util.Log; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Arrays; /** * Created by Winston on 16/11/14. */ public abstract class RawFile { public abstract String getPath(); public abstract byte[] getContents(); public final void writeToDisk(File directory) throws IOException { File file = new File(directory, getPath()); file.getParentFile().mkdirs(); file.createNewFile(); OutputStream out = new FileOutputStream(file); out.write(getContents()); out.close(); Log.info("Wrote file: {}", file.getAbsolutePath()); } @Override public boolean equals(Object obj) { if (!(obj instanceof RawFile)) { return false; } RawFile that = (RawFile) obj; return getPath().equals(that.getPath()) && Arrays.equals(getContents(), that.getContents()); } }
[ "winston.li12@imperial.ac.uk" ]
winston.li12@imperial.ac.uk
6dc3205828e8a59456d8822ac8f10c1c82b9ae18
a8eeeadb52c36d37ddd3204c9fcb7ea1642c5ff3
/src/main/java/section9/Ex2.java
f211ac6ccf389688c5311086ed7f293b12a7e042
[]
no_license
os-tll/ThinkInJava
ff00d9ec28356ae99604ade12e95c417a9e0fa81
42115afc0d9078d96bd4e8cfaf55e257efb58207
refs/heads/master
2022-07-18T02:00:52.779623
2019-11-05T07:53:17
2019-11-05T07:53:17
136,112,710
0
0
null
2022-06-29T17:28:20
2018-06-05T03:08:59
Java
UTF-8
Java
false
false
274
java
package section9; /** * 抽象类无法实例化 * @author tanglonglong \(--)/ * @version 1.0 * @date 2019/7/2 10:16 */ public class Ex2 { public static void main(String[] args) { //! Ex2Aid ex2Aid = new Ex2Aid(); } } abstract class Ex2Aid{ }
[ "tanglonglong@ysstech.com" ]
tanglonglong@ysstech.com
302eb522205b0207224daa4aee0302f052a106ec
238b9bed6f9bad61dbdff64c344cffda052744cf
/wavemaker-commons-util/src/main/java/com/wavemaker/commons/ResourceNotDeletedException.java
2ddf30f99cfc8fba56f603ea9c46d4f74cbde22f
[]
no_license
wavemaker/wavemaker-commons
9f2682a3242321b86bd023ec7aeed2fe007756c6
a3a7153a41a54ea60a92aa15b81e2a0a552ba421
refs/heads/master
2023-08-15T07:54:50.398654
2023-02-03T10:27:58
2023-02-03T10:27:58
80,500,472
3
1
null
2020-09-01T14:03:17
2017-01-31T07:40:41
Java
UTF-8
Java
false
false
1,241
java
/******************************************************************************* * Copyright (C) 2022-2023 WaveMaker, 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.wavemaker.commons; /** * Created by gauravs on 18/2/14. */ public class ResourceNotDeletedException extends WMRuntimeException { private static final long serialVersionUID = -3920445885731314103L; public ResourceNotDeletedException(MessageResource resource, Object... args) { super(resource, args); } public ResourceNotDeletedException(Throwable cause, MessageResource resource, Object... args) { super(resource, cause, args); } }
[ "uday.adepu@wavemaker.com" ]
uday.adepu@wavemaker.com
6069f0f7e0b8042b19b0933381304912cfbb3ab0
12465a1b7f73f288501f4ea26813fa82fa46cab7
/src/edu/csci312/unca/Game.java
f5ea597b060bda485b902ed476d7312da6e3920f
[]
no_license
austinbwei/OthelloBot
4610d1e4979707fc1fc049c3b5d1a9c481ab0eab
87c115abd9896b4146bc26c0937041eabac73c4b
refs/heads/master
2020-11-25T01:33:36.223905
2019-12-16T16:46:56
2019-12-16T16:46:56
228,431,378
0
0
null
null
null
null
UTF-8
Java
false
false
2,259
java
package edu.csci312.unca; import java.util.Scanner; public class Game { // White = TRUE // Black = FALSE // Black goes first private Scanner scan; private String input; private Board myBoard; private boolean myColor; private Translator translator = new Translator(this); private AIPlayer ai; /** * Start program * Initialize program's color and setup game */ public void start() { System.out.println("C Initialize my color"); scan = new Scanner(System.in); input = scan.nextLine(); createBoard(translator.initialize(input)); playGame(); } /** * Create board for AI * @param color of AI */ public void createBoard(boolean color) { myColor = color; myBoard = new Board(color); ai = new AIPlayer(color, myBoard); // Tell referee program is ready if (color) { System.out.println("R W"); } else { System.out.println("R B"); } myBoard.printBoard(); } /** * Play Othello game */ private void playGame() { if (myColor) { while(!myBoard.isGameOver()) { oppMove(); if (myBoard.isGameOver()) { break; } myMove(); } if (myBoard.isGameOver()) { endGame(); } } else { while(!myBoard.isGameOver()) { myMove(); if (myBoard.isGameOver()) { break; } oppMove(); } if (myBoard.isGameOver()) { endGame(); } } } /** * AI make a move */ private void myMove() { ai.makeMove(); myBoard.printBoard(); } /** * Ask for opponent move */ private void oppMove() { System.out.println("\nC Input move"); input = scan.nextLine(); translator.decypherInput(input); myBoard.printBoard(); } /** * Make input move on board * @param m move to make */ public void makeMove(Move m) { myBoard.makeMove(m); } /** * Print pieces on board */ public void endGame() { myBoard.setGameOver(true); int whitePieces = myBoard.getWhitePieces(); int blackPieces = myBoard.getBlackPieces(); if (blackPieces < whitePieces) { System.out.println("\nC White Wins!"); } else if(blackPieces > whitePieces) { System.out.println("\nC Black Wins!"); } else { System.out.println("\nC Tie!"); } System.out.println(blackPieces); scan.close(); } }
[ "aweiler@unca.edu" ]
aweiler@unca.edu
23d0d0f1670555e4d82233ea31ae56364d2f5783
3cd5499a5c0d1178608cb76037e02eb44bc84e69
/app/src/androidTest/java/com/example/menteurmenteurapp/ExampleInstrumentedTest.java
d511b2c5d9a77c0940d03bf891c9244719485347
[]
no_license
Aladdine95/MenteurMenteurApp
5a1b822c9ff238f3d8ac4e80ec23bd1763a0bfbf
938482074edebded7cffedf5a7bfd410d3ff2e79
refs/heads/master
2023-03-30T22:04:20.348230
2021-04-10T02:14:21
2021-04-10T02:14:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package com.example.menteurmenteurapp; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext(); assertEquals("com.example.menteurmenteurapp", appContext.getPackageName()); } }
[ "aladdineben@outlook.com" ]
aladdineben@outlook.com
901eabafea189eff100cbed9c899346f73951695
7775816b54b18953aca935d1448349f1a2d9f0f0
/src/main/java/com/globallogic/users/domain/repository/UserRepository.java
1e5c97d2d81b8cfecd0345eef4e355b7bedeae53
[]
no_license
daner85/GLUser
cef25a8c7c928e81e4f3f1359411bd60f06b053b
9d5953407ebd5d73ac3842f1e6fe0fba0d1971e8
refs/heads/main
2022-12-27T23:07:45.636283
2020-10-08T03:02:32
2020-10-08T03:02:32
302,025,188
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.globallogic.users.domain.repository; import com.globallogic.users.domain.User; import com.globallogic.users.domain.UserResponse; import com.globallogic.users.infraestructure.UserEntity; public interface UserRepository { UserResponse createUser(User user); UserEntity findByEmail(String mail); }
[ "DanielCamejo.Everis@latam.com" ]
DanielCamejo.Everis@latam.com
af168b634ffe7fb8803b121ccb351a197f350158
a36595963cae45c72494aaf24a4c6ee387c74033
/tests/src/test/java/io/streamnative/pulsar/handlers/amqp/rabbitmq/functional/NoRequeueOnCancel.java
af68100aba68831a181de198e2cc830c3670a967
[ "Apache-2.0" ]
permissive
zhaijack/aop
a761d19a35c0256acee0781de02d0bbf4182e630
ee9ff48b7b852f7613b55db49a448d37d19befa9
refs/heads/master
2023-06-26T03:54:38.557727
2021-07-18T09:12:40
2021-07-18T09:12:40
387,957,575
0
0
Apache-2.0
2021-07-21T01:36:44
2021-07-21T01:28:13
null
UTF-8
Java
false
false
2,567
java
/** * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.streamnative.pulsar.handlers.amqp.rabbitmq.functional; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.Consumer; import com.rabbitmq.client.DefaultConsumer; import com.rabbitmq.client.Envelope; import com.rabbitmq.client.test.BrokerTestCase; import java.io.IOException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.junit.Test; /** * NoRequeueOnCancel. */ public class NoRequeueOnCancel extends BrokerTestCase { protected final String queue = "NoRequeueOnCancel"; protected void createResources() throws IOException { channel.queueDeclare(queue, false, false, false, null); } protected void releaseResources() throws IOException { channel.queueDelete(queue); } @Test public void noRequeueOnCancel() throws IOException, InterruptedException { String exchange = generateExchangeName(); String queue = generateQueueName(); String routingKey = "key-1"; declareExchangeAndQueueToBind(queue, exchange, routingKey); byte[] m1 = "1".getBytes(); basicPublishPersistent(m1, exchange, routingKey); final CountDownLatch latch = new CountDownLatch(1); Consumer c = new DefaultConsumer(channel) { @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { latch.countDown(); } }; String consumerTag = channel.basicConsume(queue, false, c); assertTrue(latch.await(5, TimeUnit.SECONDS)); //channel.basicCancel(consumerTag); assertNull(channel.basicGet(queue, true)); closeChannel(); openChannel(); assertNotNull(channel.basicGet(queue, true)); } }
[ "noreply@github.com" ]
noreply@github.com
2251d46b3fcfafd6e174c34d2cdf14830d06b41e
47a98b7efa44714123747fa5553df6b6f54537cb
/implementation/beenutsFW/src/net/sf/beenuts/apc/net/APCSocketWriter.java
2fda24e63c9b6f27979d657f1f7fefe2f07f5a7d
[ "Apache-2.0" ]
permissive
Institute-Web-Science-and-Technologies/mapc
dea9c34e0c91242c2a103418d18fbceabe4199d1
338e4083dc65d6692f7311681e4750ae6e65696d
refs/heads/master
2021-01-15T09:24:28.637336
2014-12-21T21:11:32
2014-12-21T21:11:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,041
java
package net.sf.beenuts.apc.net; import java.util.concurrent.*; import java.io.ObjectOutputStream; import java.io.Serializable; import java.net.*; /** * writer thread used by agentProcessCluster connections, allowing * non-blocking write of agentProcessCluster messages. * * @author Thomas Vengels * */ public class APCSocketWriter extends Thread { protected LinkedBlockingQueue<Serializable> writeQueue = null; protected Socket socket; public APCSocketWriter(Socket socket) { this.writeQueue = new LinkedBlockingQueue<Serializable>(); this.socket = socket; } public void run() { try { ObjectOutputStream objOut = new ObjectOutputStream(socket.getOutputStream()); while(true) { Serializable toSend = writeQueue.take(); objOut.writeObject(toSend); objOut.flush(); } } catch (Exception e) { System.err.println("agentProcessCluster-writer error:"); e.printStackTrace(); } } public void write(Serializable o) { this.writeQueue.offer(o); } }
[ "0nse@users.noreply.github.com" ]
0nse@users.noreply.github.com
9f5eb4fdbd3c919dfd66a7c6331aa67f5725b09f
b08feb85497e45fb9e513f044ba7562344b9334a
/src/trabalho/Airport.java
e9941a2aad1f521c6ac382feeb31fa0d3088766d
[]
no_license
nicoleorita/Java-Project-with-threads
84788a7993340783837068ed40f72af5080f5906
f42b79c6401e339a449aef3c7f2ccc7b2a45e744
refs/heads/master
2020-04-18T07:54:01.732805
2019-01-24T14:03:42
2019-01-24T14:03:42
167,376,514
0
0
null
null
null
null
UTF-8
Java
false
false
5,214
java
package trabalho; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import ServerPack.GUIServer; import ServerPack.Server; public class Airport { private String s_name; private GUIServer gui; private LinkedList<Plane> l_planes_queue; private LinkedList<Runway> l_runways; private Server server; public Airport(String name, Server server){ this.s_name = name; this.server = server; gui = new GUIServer(this); l_planes_queue = new LinkedList<>(); l_runways = new LinkedList<>(); for (int i = 0; i < 2 ; i++) l_runways.add(new Runway(true, i)); } public Runway random_runway(){ int random = (int)(Math.random()*50); if (random%2==0) return l_runways.getFirst(); return l_runways.getLast(); } public void addPlanesToAirport(LinkedList<Plane> planes){ for(Plane p : planes){ l_planes_queue.add(p); } addPlanesTextArea(); } public void addPlanesTextArea (){ LinkedList<Plane> l_planes_waiting = new LinkedList<>(); Collections.sort(l_planes_queue, new ComparatePlanes()); for(Plane p : l_planes_queue){ if(p.getPhase() == Phase.QUEUE || p.getPhase() == Phase.WAITING ) l_planes_waiting.add(p); } gui.refreshlist(l_planes_waiting); } public void manage_planes(){ for(Plane p : l_planes_queue) { //p.setRunway(random_runway()); p.setPhase(Phase.WAITING); p.start(); } organize(); } public synchronized void getPlaneLanding(int i_plane_number) { for(Iterator<Plane> itr = l_planes_queue.iterator(); itr.hasNext(); ) { Plane p = itr.next(); if(p.getPlaneNumber() == i_plane_number) { p.setPhase(Phase.LANDING); gui.refreshRunway(p.getRunway().get_nr(), p); break; } } addPlanesTextArea(); } public synchronized void planeArrived(int i_plane_number) { for(Plane p : l_planes_queue) { if(p.getPlaneNumber() == i_plane_number) { p.setPhase(Phase.ARRIVED); gui.clearRunway(p.getRunway().get_nr()); break; } } remove(); //System.out.println("QUEUE size: " + l_planes_queue.size()); if(l_planes_queue.size() == 0) { this.server.closeClientConnection(); System.out.println("Shut off Client"); } addPlanesTextArea(); organize(); } private boolean existsPriorities() { for(Plane p : l_planes_queue) { if(p.getFuel_moment() < p.getFuel_capacity()*0.1) return true; } return false; } private boolean existsMedic() { for(Plane p : l_planes_queue) { if(p instanceof Plane_Medic) return true; } return false; } private void organize() { if(existsPriorities()) { for(Plane p : l_planes_queue) { if(p.getFuel_moment() < p.getFuel_capacity()*0.1 && p.getPhase() == Phase.WAITING) { Runway r = random_runway(); if(r.isOpen()) { p.setPhase(Phase.QUEUE); p.setRunway(r); } else { p.setPhase(Phase.QUEUE); if(r.get_nr()==0) p.setRunway(l_runways.getLast()); else p.setRunway(l_runways.getFirst()); } } } } if(!existsPriorities() && existsMedic()) { for(Plane p : l_planes_queue) { if(p instanceof Plane_Medic && p.getPhase() == Phase.WAITING) { Runway r = random_runway(); if(r.isOpen()) { p.setPhase(Phase.QUEUE); p.setRunway(r); } else { p.setPhase(Phase.QUEUE); if(r.get_nr()==0) p.setRunway(l_runways.getLast()); else p.setRunway(l_runways.getFirst()); } } } } if(!existsPriorities() && !existsMedic()) { if(l_planes_queue.getFirst().getPhase() == Phase.WAITING) { Runway r = random_runway(); if(r.isOpen()) { l_planes_queue.getFirst().setPhase(Phase.QUEUE); l_planes_queue.getFirst().setRunway(r); } else { l_planes_queue.getFirst().setPhase(Phase.QUEUE); if(r.get_nr() == 0) l_planes_queue.getFirst().setRunway(l_runways.getLast()); else l_planes_queue.getFirst().setRunway(l_runways.getFirst()); } } } } public void remove() { for(Iterator<Plane> itr = l_planes_queue.iterator(); itr.hasNext();) { Plane p = itr.next(); if(p.getPhase() == Phase.ARRIVED) { itr.remove(); break; } notifyAll(); } } public void informRunway (boolean open, int r1){ if(open) { if(r1 == 0) { System.out.println("Abriu runway 1"); l_runways.getFirst().setOpen(true); organize(); } else { System.out.println("Abriu runway 2"); l_runways.getLast().setOpen(true); organize(); } } if(!open) { if(r1 == 0) { System.out.println("Fechou runway " + r1); l_runways.getFirst().setOpen(false); for(Iterator<Plane> itr = l_planes_queue.iterator(); itr.hasNext(); ) { Plane p = itr.next(); if(p.getPhase() == Phase.QUEUE && p.getRunway().get_nr() == r1) { p.setPhase(Phase.WAITING); } } organize(); } else{ System.out.println("Fechou runway " + r1); l_runways.getLast().setOpen(false); for(Iterator<Plane> itr = l_planes_queue.iterator(); itr.hasNext(); ) { Plane p = itr.next(); if(p.getPhase() == Phase.QUEUE && p.getRunway().get_nr() == r1) { p.setPhase(Phase.WAITING); } } organize(); } } } }
[ "noreply@github.com" ]
noreply@github.com
9a4d037479a2a7cb09ef2f2acbe507ac28a8bd2c
06cae5bb9578b9bffa43ae36b547a84a823938ea
/rms.rms/src/main/java/com/hefei/rms/company/service/impl/CompanyService.java
063a0da6e95efff944888d8bfd6e46b957999bc5
[]
no_license
yefanflexi/crm
43bf6ea725b00d7240a8a39abd8fe5fa6ffcc839
67b59d6a9eb6d5fba7b146a2e4f75e78423517a1
refs/heads/master
2020-07-16T20:19:26.770323
2017-12-25T09:21:48
2017-12-25T09:21:48
94,400,231
0
1
null
null
null
null
UTF-8
Java
false
false
2,572
java
package com.hefei.rms.company.service.impl; import java.util.List; import org.apache.log4j.Logger; import org.springframework.stereotype.Service; import com.hefei.api.rms.company.manager.ICompanyManager; import com.hefei.api.rms.company.manager.impl.CompanyManager; import com.hefei.api.rms.company.vo.CompanyIndustryDTO; import com.hefei.api.rms.company.vo.CompanyInfo; import com.hefei.common.exception.BusinessException; import com.hefei.common.exception.ClientException; import com.hefei.common.page.Pagination; import com.hefei.frontend.framework.http.request.RequestThreadLocal; import com.hefei.rms.company.service.ICompanyService; @Service public class CompanyService implements ICompanyService{ private static Logger logger = Logger.getLogger(CompanyService.class); private ICompanyManager companyManager = new CompanyManager(); public Pagination<CompanyInfo> findManagePagination(Long userId, String companyName, int pageIndex, int pageSize) throws BusinessException{ try { return companyManager.findManagePagination(userId, companyName, pageIndex, pageSize); } catch (ClientException e) { logger.error(RequestThreadLocal.getTimer() + " error", e); return null; } } public CompanyInfo getCompany(Long userId,Long companyId) throws BusinessException{ try { return companyManager.getCompany(userId, companyId); } catch (ClientException e) { logger.error(RequestThreadLocal.getTimer() + " error", e); return null; } } @Override public void editCompany(Long userId, String industryIds, CompanyInfo info) throws BusinessException { try { companyManager.updateCompany(userId, industryIds, info); } catch (ClientException e) { logger.error(RequestThreadLocal.getTimer() + " error", e); throw new BusinessException(e.getErrorCode()); } } @Override public CompanyInfo createCompany(Long userId, String industryIds, CompanyInfo info) throws BusinessException { try { info = companyManager.createCompany(userId,industryIds, info); return info; } catch (ClientException e) { logger.error(RequestThreadLocal.getTimer() + " error", e); throw new BusinessException(e.getErrorCode()); } } @Override public List<CompanyIndustryDTO> getCompanyIndustry(Long companyId) throws BusinessException { try { return companyManager.getCompanyIndustry(companyId); } catch (ClientException e) { logger.error(RequestThreadLocal.getTimer() + " error", e); throw new BusinessException(e.getErrorCode()); } } }
[ "vixtel@DESKTOP-F05R4O0" ]
vixtel@DESKTOP-F05R4O0
4d9b9f5ae67603515286006e49dc055efb6ec30b
28484c49ff39e3be9e26c3b2191d1f6b161bd8d4
/src/core/annotation/resource/ResourceDemo.java
a9bf181815738c41bfa9ba077317ee09b96f78bf
[]
no_license
meexplorer11/javargon-spring-samples
2564a67c1aa6e90631352133b51bb4eda9ad2dbf
0d9d83e90b070ccaed58cfef3957185674734328
refs/heads/master
2020-12-24T05:48:41.772986
2016-11-12T07:01:20
2016-11-12T07:01:20
73,450,012
0
0
null
null
null
null
UTF-8
Java
false
false
428
java
package core.annotation.resource; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * * @author Javargon * */ public class ResourceDemo { public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("core/annotation/resource/applicationContext.xml"); System.out.println("All done."); } }
[ "meexplorer11@gmail.com" ]
meexplorer11@gmail.com
e6b561d6e72568b010ab9e375be99e02bbb82265
3190c90729a593020dc9652c8674675df9503ecc
/src/com/claimvantage/model/Rule.java
58e0c96430fbd29e5e8a1caff4f15ee862801ec6
[]
no_license
dartvader/FYP-Version-1
8dcc34e5ca60b932c0858fb7da92e459b3c35485
1cc9b4456da7d60815d9667fda786c1a23a0d029
refs/heads/master
2021-03-12T19:22:47.225304
2015-07-14T02:44:51
2015-07-14T02:44:51
30,675,334
0
0
null
null
null
null
UTF-8
Java
false
false
2,424
java
package com.claimvantage.model; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.xml.bind.annotation.XmlRootElement; import org.codehaus.jackson.annotate.JsonIgnore; import com.claimvantage.drools.util.BuilderUtil; import com.claimvantage.rules.Setting; import com.claimvantage.model.RuleCorrelation; @XmlRootElement public class Rule { private String name; private String description; private UUID id; private StringBuilder script; private List<Condition> conditions; private Consequence consequence; private Boolean status; private String global; private Setting setting; private ArrayList<RuleCorrelation> relatedRules; private Rule(ArrayList<RuleCorrelation> relatedRules) { this.relatedRules = relatedRules; } private Rule() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public UUID getId() { return id; } public void setId(UUID id) { this.id = id; } public void setScript(StringBuilder script) { this.script = script; } public List<Condition> getConditions() { return conditions; } public void setConditions(List<Condition> conditions) { this.conditions = conditions; } public Consequence getConsequence() { return consequence; } public void setConsequence(Consequence consequence) { this.consequence = consequence; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public StringBuilder getScript() { return script; } public void buildScript() { this.script = BuilderUtil.buildRuleScript(this); } public Boolean getStatus() { return status; } public void setStatus(Boolean status) { this.status = status; } public String getGlobal() { return global; } public void setGlobal(String global) { this.global = global; } public Setting getSetting() { return setting; } public void setSetting(Setting setting) { this.setting = setting; } public ArrayList<RuleCorrelation> getRelatedRules() { return relatedRules; } public void setRelatedRules(ArrayList<RuleCorrelation> relatedRules) { this.relatedRules = relatedRules; } }
[ "leemcdonald@claimvantage.com" ]
leemcdonald@claimvantage.com
d4ea8798c3f74cf6c8fe3a894dab83a9e5b425e4
520846a7341186746bd1f7a7d5cf014b9cfe6a8b
/inner-intergration/api-commons/src/main/java/com/open/capacity/sysenum/SystemConfigEnum.java
b0f6ed00efe317bf85ce6eb17d4242cc7a3495e7
[ "Apache-2.0" ]
permissive
zhongwood/open-capacity-platform
ba1647e8f77c11b8680f439a78319cfb29356091
903751fe1e98dec1bb7cc49ea3ed39435aab9679
refs/heads/master
2023-01-10T11:23:21.284014
2020-02-09T07:24:17
2020-02-09T07:24:17
239,256,063
0
0
Apache-2.0
2022-12-27T14:43:46
2020-02-09T06:09:20
JavaScript
UTF-8
Java
false
false
888
java
package com.open.capacity.sysenum; public enum SystemConfigEnum { WECHAT_APPID("WECHAT", "mpAppId", "微信appid"), WECHAT_APPSECRET("WECHAT", "mpAppSecret", "微信secret"), ALIYUN_OSS_ACCESSKEY("VOD", "accessKey", "阿里accessKey"), ALIYUN_OSS_ACCESSKEYSECRET("VOD", "accessKeySecret", "阿里accessKeySecret"), ALIYUN_OSS_REGIONID("VOD", "regionId", "阿里regionId"), ALIYUN_OSS_DOMAIN("VOD", "domain", "阿里domain"); private String type; private String key; private SystemConfigEnum(String type, String key, String desc) { this.type = type; this.key = key; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } }
[ "39356408+zhongwood@users.noreply.github.com" ]
39356408+zhongwood@users.noreply.github.com
6ae2ab768c43bb7adcb4824fa59c3960281b3b88
c6d48e0928ad349536c213594739ebe2ad292a35
/src/main/java/com/henry/bookmanagement/exception/BadRequestException.java
ced904fc30572524e64d70ecbad14c6824c45d8c
[]
no_license
KGJava/book-management
a55985b47ae9bf36bf16360cf0ee26d8a241794f
b29f436ba4fd245344da609d48266474a2ee4b97
refs/heads/master
2020-04-23T08:18:37.364929
2019-02-25T04:23:24
2019-02-25T04:23:24
171,032,816
0
0
null
null
null
null
UTF-8
Java
false
false
397
java
package com.henry.bookmanagement.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.BAD_REQUEST) public class BadRequestException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; public BadRequestException(String message) { super(message); } }
[ "kotesh@192.168.0.12" ]
kotesh@192.168.0.12
d8d4185ec8ca4c2f0160c9f0525b582c8eaf52d8
9fb90a4bcc514fcdfc0003ed2060e88be831ac26
/src/com/mic/demo/typeinfo/pets/Mouse.java
036191a4c1cf214e3ed90eca3bbbeae8f7ba8867
[]
no_license
lpjhblpj/FimicsJava
84cf93030b7172b0986b75c6d3e44226edce2019
0f00b6457500db81d9eac3499de31cc980a46166
refs/heads/master
2020-04-24T23:32:16.893756
2019-02-24T14:45:43
2019-02-24T14:45:43
132,058,969
0
0
null
null
null
null
UTF-8
Java
false
false
227
java
//: com.mic.demo.typeinfo/pets/Mouse.java package com.mic.demo.typeinfo.pets; public class Mouse extends Rodent { public Mouse(String name) { super(name); } public Mouse() { super(); } } ///:~
[ "lpjhblpj@sina.com" ]
lpjhblpj@sina.com
50ffc3e19524a542a9a4042a0990e363f4082f95
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/8/8_f682b4719bf65f7b01ef76c3e1ff5e0cc49915eb/SwipeDismissListViewTouchListener/8_f682b4719bf65f7b01ef76c3e1ff5e0cc49915eb_SwipeDismissListViewTouchListener_s.java
e43201846ced08d215cfdfc9fb3c599e7160628f
[]
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
10,739
java
/* * Copyright 2013 Niek Haarman * * 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.haarman.listviewanimations.itemmanipulation; import static com.nineoldandroids.view.ViewHelper.setAlpha; import static com.nineoldandroids.view.ViewPropertyAnimator.animate; import java.util.ArrayList; import java.util.Collections; import java.util.List; import android.annotation.SuppressLint; import android.graphics.Rect; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.widget.ListView; import com.nineoldandroids.animation.Animator; import com.nineoldandroids.animation.AnimatorListenerAdapter; import com.nineoldandroids.animation.ValueAnimator; import com.nineoldandroids.view.ViewHelper; /** * A {@link android.view.View.OnTouchListener} that makes the list items in a * {@link ListView} dismissable. {@link ListView} is given special treatment * because by default it handles touches for its list items... i.e. it's in * charge of drawing the pressed state (the list selector), handling list item * clicks, etc. * * <p> * Example usage: * </p> * * <pre> * SwipeDismissListViewTouchListener touchListener = new SwipeDismissListViewTouchListener(listView, new SwipeDismissListViewTouchListener.OnDismissCallback() { * public void onDismiss(ListView listView, int[] reverseSortedPositions) { * for (int position : reverseSortedPositions) { * adapter.remove(adapter.getItem(position)); * } * adapter.notifyDataSetChanged(); * } * }); * listView.setOnTouchListener(touchListener); * </pre> */ @SuppressLint("Recycle") public class SwipeDismissListViewTouchListener implements View.OnTouchListener { // Cached ViewConfiguration and system-wide constant values private int mSlop; private int mMinFlingVelocity; private int mMaxFlingVelocity; private long mAnimationTime; // Fixed properties private ListView mListView; private OnDismissCallback mCallback; private int mViewWidth = 1; // 1 and not 0 to prevent dividing by zero // Transient properties private List<PendingDismissData> mPendingDismisses = new ArrayList<PendingDismissData>(); private int mDismissAnimationRefCount = 0; private float mDownX; private float mDownY; private boolean mSwiping; private VelocityTracker mVelocityTracker; private int mDownPosition; private View mDownView; private boolean mPaused; /** * Constructs a new swipe-to-dismiss touch listener for the given list view. * * @param listView * The list view whose items should be dismissable. * @param callback * The callback to trigger when the user has indicated that she * would like to dismiss one or more list items. */ public SwipeDismissListViewTouchListener(ListView listView, OnDismissCallback callback) { ViewConfiguration vc = ViewConfiguration.get(listView.getContext()); mSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity(); mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mAnimationTime = listView.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime); mListView = listView; mCallback = callback; } @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (mViewWidth < 2) { mViewWidth = mListView.getWidth(); } switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: { if (mPaused) { return false; } // TODO: ensure this is a finger, and set a flag // Find the child view that was touched (perform a hit test) Rect rect = new Rect(); int childCount = mListView.getChildCount(); int[] listViewCoords = new int[2]; mListView.getLocationOnScreen(listViewCoords); int x = (int) motionEvent.getRawX() - listViewCoords[0]; int y = (int) motionEvent.getRawY() - listViewCoords[1]; View child; for (int i = 0; i < childCount; i++) { child = mListView.getChildAt(i); child.getHitRect(rect); if (rect.contains(x, y)) { mDownView = child; break; } } if (mDownView != null) { mDownX = motionEvent.getRawX(); mDownY = motionEvent.getRawY(); mDownPosition = mListView.getPositionForView(mDownView); mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker.addMovement(motionEvent); } view.onTouchEvent(motionEvent); return true; } case MotionEvent.ACTION_UP: { if (mVelocityTracker == null) { break; } float deltaX = motionEvent.getRawX() - mDownX; mVelocityTracker.addMovement(motionEvent); mVelocityTracker.computeCurrentVelocity(1000); float velocityX = Math.abs(mVelocityTracker.getXVelocity()); float velocityY = Math.abs(mVelocityTracker.getYVelocity()); boolean dismiss = false; boolean dismissRight = false; if (Math.abs(deltaX) > mViewWidth / 2) { dismiss = true; dismissRight = deltaX > 0; } else if (mMinFlingVelocity <= velocityX && velocityX <= mMaxFlingVelocity && velocityY < velocityX) { dismiss = true; dismissRight = mVelocityTracker.getXVelocity() > 0; } if (dismiss) { // dismiss final View downView = mDownView; // mDownView gets // null'd // before animation // ends final int downPosition = mDownPosition; ++mDismissAnimationRefCount; animate(mDownView).translationX(dismissRight ? mViewWidth : -mViewWidth).alpha(0).setDuration(mAnimationTime).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { performDismiss(downView, downPosition); } }); } else { // cancel animate(mDownView).translationX(0).alpha(1).setDuration(mAnimationTime).setListener(null); } mVelocityTracker = null; mDownX = 0; mDownView = null; mDownPosition = ListView.INVALID_POSITION; mSwiping = false; break; } case MotionEvent.ACTION_MOVE: { if (mVelocityTracker == null || mPaused) { break; } mVelocityTracker.addMovement(motionEvent); float deltaX = motionEvent.getRawX() - mDownX; float deltaY = motionEvent.getRawY() - mDownY; if (Math.abs(deltaX) > mSlop && Math.abs(deltaX) > Math.abs(deltaY)) { mSwiping = true; mListView.requestDisallowInterceptTouchEvent(true); // Cancel ListView's touch (un-highlighting the item) MotionEvent cancelEvent = MotionEvent.obtain(motionEvent); cancelEvent.setAction(MotionEvent.ACTION_CANCEL | (motionEvent.getActionIndex() << MotionEvent.ACTION_POINTER_INDEX_SHIFT)); mListView.onTouchEvent(cancelEvent); } if (mSwiping) { ViewHelper.setTranslationX(mDownView, deltaX); setAlpha(mDownView, Math.max(0f, Math.min(1f, 1f - 2f * Math.abs(deltaX) / mViewWidth))); return true; } break; } } return false; } class PendingDismissData implements Comparable<PendingDismissData> { public int position; public View view; public PendingDismissData(int position, View view) { this.position = position; this.view = view; } @Override public int compareTo(PendingDismissData other) { // Sort by descending position return other.position - position; } } private void performDismiss(final View dismissView, final int dismissPosition) { // Animate the dismissed list item to zero-height and fire the // dismiss // callback when // all dismissed list item animations have completed. This triggers // layout on each animation // frame; in the future we may want to do something smarter and more // performant. final ViewGroup.LayoutParams lp = dismissView.getLayoutParams(); final int originalHeight = dismissView.getHeight(); ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(mAnimationTime); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { --mDismissAnimationRefCount; if (mDismissAnimationRefCount == 0) { // No active animations, process all pending dismisses. // Sort by descending position Collections.sort(mPendingDismisses); int[] dismissPositions = new int[mPendingDismisses.size()]; for (int i = mPendingDismisses.size() - 1; i >= 0; i--) { dismissPositions[i] = mPendingDismisses.get(i).position; } mCallback.onDismiss(mListView, dismissPositions); ViewGroup.LayoutParams lp; for (PendingDismissData pendingDismiss : mPendingDismisses) { // Reset view presentation ViewHelper.setAlpha(pendingDismiss.view, 1f); ViewHelper.setTranslationX(pendingDismiss.view, 0); lp = pendingDismiss.view.getLayoutParams(); lp.height = 0; pendingDismiss.view.setLayoutParams(lp); } mPendingDismisses.clear(); } } }); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { lp.height = (Integer) valueAnimator.getAnimatedValue(); dismissView.setLayoutParams(lp); } }); mPendingDismisses.add(new PendingDismissData(dismissPosition, dismissView)); animator.start(); } /** * The callback interface used by {@link SwipeDismissListViewTouchListener} * to inform its client about a successful dismissal of one or more list * item positions. */ public interface OnDismissCallback { /** * Called when the user has indicated they she would like to dismiss one * or more list item positions. * * @param listView * The originating {@link ListView}. * @param reverseSortedPositions * An array of positions to dismiss, sorted in descending * order for convenience. */ void onDismiss(ListView listView, int[] reverseSortedPositions); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
200277fd4746c8a27844bc0115c6c1334232ed19
866cf0ad78d8d0d5c645e25d56a7f84f770159f2
/src/project_3/ThreadTest4.java
5e1dba8c93a5aadac9c068af46c71ef4f1ec8747
[]
no_license
cccisi/JavaHomeworkProject
07311ceb9d1979b5ea203a52fea17764fce5a56e
4b6557bae6181e2c5af6d46e47fc554a383d5ba7
refs/heads/master
2020-03-13T14:55:34.993734
2018-05-18T08:00:01
2018-05-18T08:00:01
131,167,798
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package project_3; /** * @Auther: cccis * @Date: 5/4/2018 20:10 * @Description: */ public class ThreadTest4 implements Runnable { public static void main(String[] args) { Runnable r = new ThreadTest4(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); t1.start(); t2.start(); } public void run() { synchronized (this) { for (int i = 0; i < 10; i++) System.out.print(" " + i); } } }
[ "cccisi@live.com" ]
cccisi@live.com
09f90e4bfcff145e4911a7f9d3c891a934ffc1ec
34f8d4ba30242a7045c689768c3472b7af80909c
/JDK10-Java SE Development Kit 10/src/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ps.java
2041b9014040809bafe383867ad5267adc5f48e5
[ "Apache-2.0" ]
permissive
lovelycheng/JDK
5b4cc07546f0dbfad15c46d427cae06ef282ef79
19a6c71e52f3ecd74e4a66be5d0d552ce7175531
refs/heads/master
2023-04-08T11:36:22.073953
2022-09-04T01:53:09
2022-09-04T01:53:09
227,544,567
0
0
null
2019-12-12T07:18:30
2019-12-12T07:18:29
null
UTF-8
Java
false
false
10,215
java
/* * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * COPYRIGHT AND PERMISSION NOTICE * * Copyright (C) 1991-2016 Unicode, Inc. All rights reserved. * Distributed under the Terms of Use in * http://www.unicode.org/copyright.html. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of the Unicode data files and any associated documentation * (the "Data Files") or Unicode software and any associated documentation * (the "Software") to deal in the Data Files or Software * without restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, and/or sell copies of * the Data Files or Software, and to permit persons to whom the Data Files * or Software are furnished to do so, provided that * (a) this copyright and permission notice appear with all copies * of the Data Files or Software, * (b) this copyright and permission notice appear in associated * documentation, and * (c) there is clear notice in each modified Data File or in the Software * as well as in the documentation associated with the Data File(s) or * Software that the data or software has been modified. * * THE DATA FILES AND SOFTWARE ARE 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 OF THIRD PARTY RIGHTS. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS * NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL * DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THE DATA FILES OR SOFTWARE. * * Except as contained in this notice, the name of a copyright holder * shall not be used in advertising or otherwise to promote the sale, * use or other dealings in these Data Files or Software without prior * written authorization of the copyright holder. */ package sun.text.resources.cldr.ext; import java.util.ListResourceBundle; public class FormatData_ps extends ListResourceBundle { @Override protected final Object[][] getContents() { final String[] metaValue_MonthNames = new String[] { "\u062c\u0646\u0648\u0631\u064a", "\u0641\u0628\u0631\u0648\u0631\u064a", "\u0645\u0627\u0631\u0686", "\u0627\u067e\u0631\u06cc\u0644", "\u0645\u06cc", "\u062c\u0648\u0646", "\u062c\u0648\u0644\u0627\u06cc", "\u0627\u06ab\u0633\u062a", "\u0633\u067e\u062a\u0645\u0628\u0631", "\u0627\u06a9\u062a\u0648\u0628\u0631", "\u0646\u0648\u0645\u0628\u0631", "\u062f\u0633\u0645\u0628\u0631", "", }; final String[] metaValue_DayNames = new String[] { "\u06cc\u06a9\u0634\u0646\u0628\u0647", "\u062f\u0648\u0634\u0646\u0628\u0647", "\u0633\u0647\u200c\u0634\u0646\u0628\u0647", "\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647", "\u067e\u0646\u062c\u0634\u0646\u0628\u0647", "\u062c\u0645\u0639\u0647", "\u0634\u0646\u0628\u0647", }; final String[] metaValue_AmPmMarkers = new String[] { "\u063a.\u0645.", "\u063a.\u0648.", }; final String[] metaValue_long_Eras = new String[] { "\u0642.\u0645.", "\u0645.", }; final String[] metaValue_TimePatterns = new String[] { "H:mm:ss (zzzz)", "H:mm:ss (z)", "H:mm:ss", "H:mm", }; final String[] metaValue_java_time_buddhist_DatePatterns = new String[] { "EEEE \u062f G y \u062f MMMM d", "\u062f G y \u062f MMMM d", "d MMM y G", "GGGGG y/M/d", }; final String[] metaValue_buddhist_DatePatterns = new String[] { "EEEE \u062f GGGG y \u062f MMMM d", "\u062f GGGG y \u062f MMMM d", "d MMM y GGGG", "G y/M/d", }; final Object[][] data = new Object[][] { { "MonthNames", metaValue_MonthNames }, { "arabext.NumberElements", new String[] { "\u066b", "\u066c", "\u061b", "\u066a", "\u06f0", "#", "\u200e-\u200e", "\u00d7\u06f1\u06f0^", "\u0609", "\u221e", "NaN", } }, { "japanese.AmPmMarkers", metaValue_AmPmMarkers }, { "islamic.AmPmMarkers", metaValue_AmPmMarkers }, { "AmPmMarkers", metaValue_AmPmMarkers }, { "java.time.japanese.DatePatterns", metaValue_java_time_buddhist_DatePatterns }, { "TimePatterns", metaValue_TimePatterns }, { "japanese.TimePatterns", metaValue_TimePatterns }, { "narrow.Eras", metaValue_long_Eras }, { "abbreviated.AmPmMarkers", metaValue_AmPmMarkers }, { "DefaultNumberingSystem", "arabext" }, { "japanese.abbreviated.AmPmMarkers", metaValue_AmPmMarkers }, { "buddhist.narrow.AmPmMarkers", metaValue_AmPmMarkers }, { "buddhist.abbreviated.AmPmMarkers", metaValue_AmPmMarkers }, { "Eras", metaValue_long_Eras }, { "japanese.MonthNames", metaValue_MonthNames }, { "roc.DayNames", metaValue_DayNames }, { "standalone.DayAbbreviations", metaValue_DayNames }, { "roc.MonthAbbreviations", metaValue_MonthNames }, { "islamic.abbreviated.AmPmMarkers", metaValue_AmPmMarkers }, { "long.Eras", metaValue_long_Eras }, { "islamic.DayNames", metaValue_DayNames }, { "java.time.islamic.DatePatterns", metaValue_java_time_buddhist_DatePatterns }, { "buddhist.MonthAbbreviations", metaValue_MonthNames }, { "buddhist.MonthNames", metaValue_MonthNames }, { "narrow.AmPmMarkers", metaValue_AmPmMarkers }, { "latn.NumberElements", new String[] { ",", ".", ";", "%", "0", "#", "\u200e\u2212", "E", "\u2030", "\u221e", "NaN", } }, { "japanese.DatePatterns", metaValue_buddhist_DatePatterns }, { "japanese.MonthAbbreviations", metaValue_MonthNames }, { "buddhist.DayNames", metaValue_DayNames }, { "islamic.DayAbbreviations", metaValue_DayNames }, { "buddhist.AmPmMarkers", metaValue_AmPmMarkers }, { "islamic.DatePatterns", metaValue_buddhist_DatePatterns }, { "japanese.DayNames", metaValue_DayNames }, { "japanese.DayAbbreviations", metaValue_DayNames }, { "DayNames", metaValue_DayNames }, { "buddhist.DatePatterns", metaValue_buddhist_DatePatterns }, { "roc.MonthNames", metaValue_MonthNames }, { "DayAbbreviations", metaValue_DayNames }, { "NumberPatterns", new String[] { "#,##0.###", "#,##0.00\u00a0\u00a4", "#,##0%", } }, { "roc.DatePatterns", metaValue_buddhist_DatePatterns }, { "roc.AmPmMarkers", metaValue_AmPmMarkers }, { "java.time.roc.DatePatterns", metaValue_java_time_buddhist_DatePatterns }, { "java.time.buddhist.DatePatterns", metaValue_java_time_buddhist_DatePatterns }, { "DatePatterns", new String[] { "EEEE \u062f y \u062f MMMM d", "\u062f y \u062f MMMM d", "d MMM y", "y/M/d", } }, { "buddhist.DayAbbreviations", metaValue_DayNames }, { "islamic.TimePatterns", metaValue_TimePatterns }, { "MonthAbbreviations", metaValue_MonthNames }, { "standalone.DayNames", metaValue_DayNames }, { "buddhist.TimePatterns", metaValue_TimePatterns }, { "standalone.MonthNames", metaValue_MonthNames }, { "standalone.MonthAbbreviations", metaValue_MonthNames }, { "roc.narrow.AmPmMarkers", metaValue_AmPmMarkers }, { "roc.TimePatterns", metaValue_TimePatterns }, { "roc.abbreviated.AmPmMarkers", metaValue_AmPmMarkers }, }; return data; } }
[ "zeng-dream@live.com" ]
zeng-dream@live.com
1f7e0981a079ac0cbe83602bc9a979e8246285ec
8176ef7683bd30f7412eac5d3393518026fbb217
/app/src/main/java/com/bharatarmy/VideoTrimmer/utils/TrimVideoUtils.java
dfe1fafe6c1f4474963217c30a74d32579c37f64
[]
no_license
gitbharatarmy/BharatArmy
39265097ca24aa07d5dcd714dc6cf5bde7dc6e67
aac64f88c8a25b7da144f8222986994d9fc8e738
refs/heads/master
2021-07-23T00:22:28.924033
2020-05-29T14:27:20
2020-05-29T14:27:20
179,429,853
0
0
null
null
null
null
UTF-8
Java
false
false
7,979
java
/* * MIT License * * Copyright (c) 2016 Knowledge, education for life. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.bharatarmy.VideoTrimmer.utils; import android.net.Uri; import android.util.Log; import androidx.annotation.NonNull; import com.bharatarmy.VideoTrimmer.interfaces.OnTrimVideoListener; import com.coremedia.iso.boxes.Container; import com.googlecode.mp4parser.FileDataSourceViaHeapImpl; import com.googlecode.mp4parser.authoring.Movie; import com.googlecode.mp4parser.authoring.Track; import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder; import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator; import com.googlecode.mp4parser.authoring.tracks.AppendTrack; import com.googlecode.mp4parser.authoring.tracks.CroppedTrack; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import java.util.Formatter; import java.util.LinkedList; import java.util.List; import java.util.Locale; public class TrimVideoUtils { private static final String TAG = TrimVideoUtils.class.getSimpleName(); public static void startTrim(@NonNull File src, @NonNull String dst, long startMs, long endMs, @NonNull OnTrimVideoListener callback,int height,int width) throws IOException { final String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date()); final String fileName = "MP4_" + timeStamp + ".mp4"; final String filePath = dst + fileName; File file = new File(filePath); file.getParentFile().mkdirs(); Log.d(TAG, "Generated file path " + filePath); genVideoUsingMp4Parser(src, file, startMs, endMs, callback,height,width); } private static void genVideoUsingMp4Parser(@NonNull File src, @NonNull File dst, long startMs, long endMs, @NonNull OnTrimVideoListener callback,int height,int width) throws IOException { // NOTE: Switched to using FileDataSourceViaHeapImpl since it does not use memory mapping (VM). // Otherwise we get OOM with large movie files. Movie movie = MovieCreator.build(new FileDataSourceViaHeapImpl(src.getAbsolutePath())); List<Track> tracks = movie.getTracks(); movie.setTracks(new LinkedList<Track>()); // remove all tracks we will create new tracks from the old double startTime1 = startMs / 1000; double endTime1 = endMs / 1000; boolean timeCorrected = false; // Here we try to find a track that has sync samples. Since we can only start decoding // at such a sample we SHOULD make sure that the start of the new fragment is exactly // such a frame for (Track track : tracks) { if (track.getSyncSamples() != null && track.getSyncSamples().length > 0) { if (timeCorrected) { // This exception here could be a false positive in case we have multiple tracks // with sync samples at exactly the same positions. E.g. a single movie containing // multiple qualities of the same video (Microsoft Smooth Streaming file) throw new RuntimeException("The startTime has already been corrected by another track with SyncSample. Not Supported."); } startTime1 = correctTimeToSyncSample(track, startTime1, false); endTime1 = correctTimeToSyncSample(track, endTime1, true); timeCorrected = true; } } for (Track track : tracks) { long currentSample = 0; double currentTime = 0; double lastTime = -1; long startSample1 = -1; long endSample1 = -1; for (int i = 0; i < track.getSampleDurations().length; i++) { long delta = track.getSampleDurations()[i]; if (currentTime > lastTime && currentTime <= startTime1) { // current sample is still before the new starttime startSample1 = currentSample; } if (currentTime > lastTime && currentTime <= endTime1) { // current sample is after the new start time and still before the new endtime endSample1 = currentSample; } lastTime = currentTime; currentTime += (double) delta / (double) track.getTrackMetaData().getTimescale(); currentSample++; } movie.addTrack(new AppendTrack(new CroppedTrack(track, startSample1, endSample1))); } dst.getParentFile().mkdirs(); if (!dst.exists()) { dst.createNewFile(); } Container out = new DefaultMp4Builder().build(movie); FileOutputStream fos = new FileOutputStream(dst); FileChannel fc = fos.getChannel(); out.writeContainer(fc); fc.close(); fos.close(); if (callback != null) callback.getResult(Uri.parse(dst.toString()),height,width); } private static double correctTimeToSyncSample(@NonNull Track track, double cutHere, boolean next) { double[] timeOfSyncSamples = new double[track.getSyncSamples().length]; long currentSample = 0; double currentTime = 0; for (int i = 0; i < track.getSampleDurations().length; i++) { long delta = track.getSampleDurations()[i]; if (Arrays.binarySearch(track.getSyncSamples(), currentSample + 1) >= 0) { // samples always start with 1 but we start with zero therefore +1 timeOfSyncSamples[Arrays.binarySearch(track.getSyncSamples(), currentSample + 1)] = currentTime; } currentTime += (double) delta / (double) track.getTrackMetaData().getTimescale(); currentSample++; } double previous = 0; for (double timeOfSyncSample : timeOfSyncSamples) { if (timeOfSyncSample > cutHere) { if (next) { return timeOfSyncSample; } else { return previous; } } previous = timeOfSyncSample; } return timeOfSyncSamples[timeOfSyncSamples.length - 1]; } public static String stringForTime(int timeMs) { int totalSeconds = timeMs / 1000; int seconds = totalSeconds % 60; int minutes = (totalSeconds / 60) % 60; int hours = totalSeconds / 3600; Formatter mFormatter = new Formatter(); if (hours > 0) { return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString(); } else { return mFormatter.format("%02d:%02d", minutes, seconds).toString(); } } }
[ "developer@bharatarmy.com" ]
developer@bharatarmy.com
165a08d214023cd8a3abf8546bb58b534d30613b
f806b3e2afb3f6d4f87a0a0ccb3fd5ba884a99f3
/src/operating_system/Main.java
7837cc354e688873798011da5c752ad51ddbb837
[]
no_license
TimCatCai/VirtualComputer
051e1b6250c73b6350bc592b5484aa129f85ce4d
f5159b94164cb6f5f62ae351c92c964ea290dae9
refs/heads/master
2020-05-17T23:37:12.231901
2019-05-19T07:31:18
2019-05-19T07:31:18
184,037,058
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package operating_system; import memory.main.MemoryController; public class Main { public static void main(String [] args){ MemoryController memoryController = new MemoryController(); } }
[ "--replace" ]
--replace
cee25f65bff43a407f6737cb1c80bfca10c76049
f3cf5764158e51df3db098f71442dfa00d6ca973
/src/main/java/cn/ph/blog/core/interceptor/Interceptor1.java
bc705a403a7ddbc872407f7eeafbbfca54c97d90
[]
no_license
JasonPhui/blog
74b0848577e53a65292e23a337c4d0431d297d11
a007718a69e5982e8972be75b477a1629d229c0f
refs/heads/master
2020-03-19T05:58:59.794874
2018-06-27T05:42:16
2018-06-27T05:42:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,028
java
package cn.ph.blog.core.interceptor; import cn.ph.blog.core.ret.RetCode; import cn.ph.blog.core.ret.RetResult; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializerFeature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class Interceptor1 implements HandlerInterceptor { private final static String IZATION = "ph"; private static Logger logger = LoggerFactory.getLogger(Interceptor1.class); /** * 在请求处理之前进行调用(Controller方法调用之前) * @param request * @param response * @param handler * @return * @throws Exception */ @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String ization = request.getHeader("ph"); if(IZATION.equals(ization)){ return true; }else{ RetResult<Object> result = new RetResult<>(); result.setCode(RetCode.UNAUTHORIZED).setMsg("签名认证失败"); responseResult(response, result); return false; } // 只有返回true才会继续向下执行,返回false取消当前请求 } /** * 请求处理之后进行调用,但是在视图被渲染之前(Controller方法调用之后) * @param request * @param response * @param handler * @param modelAndView * @throws Exception */ @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { System.out.println(">>>MyInterceptor1>>>>>>> postHandle"); } /** * 在整个请求结束之后被调用,也就是在DispatcherServlet 渲染了对应的视图之后执行(主要是用于进行资源清理工作) * @param request * @param response * @param handler * @param ex * @throws Exception */ @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { System.out.println(">>>MyInterceptor1>>>>>>> afterCompletion"); } /** * 响应结果 */ private void responseResult(HttpServletResponse response, RetResult<Object> result){ response.setCharacterEncoding("utf-8"); response.setHeader("Content-Type", "application/json;charset=utf-8"); response.setStatus(200); try{ response.getWriter().write(JSON.toJSONString(result, SerializerFeature.WriteMapNullValue)); } catch (IOException e){ //将异常写入日志 logger.error(e.getMessage()); } } }
[ "1586376147@qq.com" ]
1586376147@qq.com
18bf5e69c2602a333e839545f5b42053240fd635
e3a37aaf17ec41ddc7051f04b36672db62a7863d
/business-service/smart-home-service-project/smart-home-service-interface/src/main/java/com/iot/shcs/device/queue/package-info.java
b8b520584b28c77ceb78098bedbe677c1cbbe2d6
[]
no_license
github4n/cloud
68477a7ecf81d1526b1b08876ca12cfe575f7788
7974042dca1ee25b433177e2fe6bda1de28d909a
refs/heads/master
2020-04-18T02:04:33.509889
2019-01-13T02:19:32
2019-01-13T02:19:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
118
java
/** * @Author: lucky * @Descrpiton: * @Date: 13:59 2018/10/13 * @Modify by: */ package com.iot.shcs.device.queue;
[ "qizhiyong@LDS-Z-C5497.LEEDARSON.LOCAL" ]
qizhiyong@LDS-Z-C5497.LEEDARSON.LOCAL
2eb1f64d665e8b0795559cfae49966fc26ec4a3e
b448ed828f7eb78a2cb3d33851ea6faa94bd96aa
/HacksonNews/QuickNews/src/com/tiger/quicknews/fragment/NewsFragment.java
4230e3d40bf47c78addd366ed94642f785c74d91
[]
no_license
zhangwei5095/knowledge_base
63b109fd16cfa89e798b5e4e89e4cdd0b480efc6
9d3c350f43b351d114a969f07e84d15c098c5fbe
refs/heads/master
2021-01-18T03:44:30.769226
2016-07-10T02:26:45
2016-07-10T02:26:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,209
java
package com.tiger.quicknews.fragment; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.ProgressBar; import com.baifendian.mobile.BfdAgent; import com.nhaarman.listviewanimations.swinginadapters.AnimationAdapter; import com.tiger.quicknews.R; import com.tiger.quicknews.activity.*; import com.tiger.quicknews.adapter.CardsAnimationAdapter; import com.tiger.quicknews.adapter.NewAdapter; import com.tiger.quicknews.bean.NewModle; import com.tiger.quicknews.constant.Constant; import com.tiger.quicknews.http.HttpUtil; import com.tiger.quicknews.http.Url; import com.tiger.quicknews.http.json.NewListJson; import com.tiger.quicknews.initview.InitView; import com.tiger.quicknews.utils.StringUtils; import com.tiger.quicknews.wedget.slideingactivity.IntentUtils; import com.tiger.quicknews.wedget.swiptlistview.SwipeListView; import com.tiger.quicknews.wedget.viewimage.Animations.DescriptionAnimation; import com.tiger.quicknews.wedget.viewimage.Animations.SliderLayout; import com.tiger.quicknews.wedget.viewimage.SliderTypes.BaseSliderView; import com.tiger.quicknews.wedget.viewimage.SliderTypes.BaseSliderView.OnSliderClickListener; import com.tiger.quicknews.wedget.viewimage.SliderTypes.TextSliderView; import org.androidannotations.annotations.AfterInject; import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Background; import org.androidannotations.annotations.Bean; import org.androidannotations.annotations.EFragment; import org.androidannotations.annotations.ItemClick; import org.androidannotations.annotations.UiThread; import org.androidannotations.annotations.ViewById; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; @EFragment(R.layout.activity_main) public class NewsFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener, OnSliderClickListener { protected SliderLayout mDemoSlider; @ViewById(R.id.swipe_container) protected SwipeRefreshLayout swipeLayout; @ViewById(R.id.listview) protected SwipeListView mListView; @ViewById(R.id.progressBar) protected ProgressBar mProgressBar; protected HashMap<String, String> url_maps; protected HashMap<String, NewModle> newHashMap; private Activity activity; @Bean protected NewAdapter newAdapter; protected List<NewModle> listsModles; private int index = 0; private boolean isRefresh = false; private String channelName; private String lastChannel = null; @Override public void onAttach(Activity activity) { super.onAttach(activity); this.activity = activity; } @Override public void onCreate(Bundle savedInstanceState) { Bundle args = getArguments(); if (args != null) { channelName = args.getString("channel"); } super.onCreate(savedInstanceState); } @AfterInject protected void init() { listsModles = new ArrayList<NewModle>(); url_maps = new HashMap<String, String>(); newHashMap = new HashMap<String, NewModle>(); } @AfterViews protected void initView() { swipeLayout.setOnRefreshListener(this); InitView.instance().initSwipeRefreshLayout(swipeLayout); InitView.instance().initListView(mListView, getActivity()); AnimationAdapter animationAdapter = new CardsAnimationAdapter( newAdapter); animationAdapter.setAbsListView(mListView); mListView.setAdapter(animationAdapter); loadData(getNewUrl("")); mListView.setOnBottomListener(new OnClickListener() { @Override public void onClick(View v) { currentPagte++; // index = index + 20; // loadData(getNewUrl("")); loadLocalData(); ; } }); } private void loadLocalData() { mListView.onBottomComplete(); mProgressBar.setVisibility(View.GONE); // getMyActivity().showShortToast(getString(R.string.not_network)); if (channelName != null && !channelName.equals(lastChannel)) { lastChannel = channelName; String result = getMyActivity().getCacheStr( channelName + currentPagte); if (!StringUtils.isEmpty(result)) { getResult(result); } } } private void loadData(String url) { if (getMyActivity().hasNetWork()) { loadNewList(url); } } @Override public void onRefresh() { new Handler().postDelayed(new Runnable() { @Override public void run() { currentPagte = 1; isRefresh = true; loadData(getNewUrl("0")); url_maps.clear(); // mDemoSlider.removeAllSliders(); } }, 2000); } @ItemClick(R.id.listview) protected void onItemClick(int position) { NewModle newModle = listsModles.get(position); enterDetailActivity(newModle); } public void enterDetailActivity(NewModle newModle) { Bundle bundle = new Bundle(); bundle.putSerializable("newModle", newModle); Class<?> class1; if (newModle.getImagesModle() != null && newModle.getImagesModle().getImgList().size() > 1) { class1 = ImageDetailActivity_.class; } else { class1 = DetailsActivity_.class; } ((BaseActivity) getActivity()).openActivity(class1, bundle, 0); } @Background void loadNewList(String url) { // String result; try { // result = HttpUtil.getByHttpClient(getActivity(), url); getRecData(url); /* * if (!StringUtils.isEmpty(result)) { getResult(result); } else { * swipeLayout.setRefreshing(false); } */ } catch (Exception e) { e.printStackTrace(); } } // 获取推荐 private String result = null; public String getRecData(String url) { // String result = null; Map<String, String> params = new HashMap<String, String>(); params.put( "fmt", "{\"iid\":\"$iid\",\"url\":\"$url\"," + "\"img\":\"$smallPic\"," + "\"ptime\":\"$posttime\"," + "\"title\":\"$title\"," + "\"digest\":\"$abs\"," + "\"topic\":\"$topic\"}"); params.put("num", "20"); if(!"推荐".equals(channelName)){ params.put("topic", channelName); } // params.put("iid","100020000"); BfdAgent.recommend(activity, "rec_C6613205_93B6_61A6_9FEC_180B70F91B94", params, new BfdAgent.Runnable() { @Override public void run(String arg0, JSONArray arg1) { try { //System.out.println(arg1.toString()); if (arg1 != null && arg1.length() > 0) { if (arg1.length() >= 10) { JSONArray js = new JSONArray(); for (int i = 10; i < arg1.length(); i++) { js.put(arg1.remove(i)); } getMyActivity().setCacheStr( channelName + 2, js.toString()); } result = arg1.toString(); if (!StringUtils.isEmpty(result)) { getResult(result); } else { swipeLayout.setRefreshing(false); } } } catch (Exception e) { e.printStackTrace(); } } }); return result; } @UiThread public void getResult(String result) { getMyActivity().setCacheStr(channelName + currentPagte, result); if (isRefresh) { isRefresh = false; newAdapter.clear(); listsModles.clear(); } mProgressBar.setVisibility(View.GONE); swipeLayout.setRefreshing(false); JSONArray results = null; if (result != null) { try { results = new JSONArray(result); } catch (Exception e) { e.printStackTrace(); } } // 添加 数据 List<NewModle> list = new ArrayList<NewModle>(); if (results != null && results.length() > 0) { for (int i = 0; i < results.length(); i++) { JSONObject js; try { js = results.getJSONObject(i); list.add(getNewModle(js)); } catch (JSONException e) { } } } newAdapter.appendList(list); listsModles.addAll(list); mListView.onBottomComplete(); } private NewModle getNewModle(JSONObject jsonObject) { // NewListJson nlj = NewListJson.instance(getActivity()); String docid = ""; String title = ""; String digest = ""; String imgsrc = ""; String source = ""; String ptime = ""; String tag = ""; try { docid = jsonObject.getString("iid"); } catch (JSONException e) { e.printStackTrace(); } try { title = jsonObject.getString("title"); } catch (JSONException e) { } // digest = ; try { imgsrc = jsonObject.getString("img"); } catch (JSONException e) { } try { source = jsonObject.getString("source"); } catch (JSONException e) { } try { ptime = jsonObject.getString("ptime"); } catch (JSONException e) { } try { tag = jsonObject.getString("topic"); } catch (JSONException e) { } try { digest = jsonObject.getString("digest"); } catch (JSONException e) { } NewModle newModle = new NewModle(); newModle.setDigest(digest); newModle.setDocid(docid); //imgsrc = "http://static.codeceo.com/images/2015/05/ac7ede9a6b711a6dea54881b5ef55e49-140x98.png"; if(!"null".equals(imgsrc)&&!"".equals(imgsrc) && imgsrc != null){ newModle.setItemType("IMG"); newModle.setImgsrc(imgsrc); }else{ newModle.setItemType("IMG"); String img = getImgStr(); newModle.setImgsrc(img); // newModle.setItemType("ITEM"); } newModle.setTitle(title); newModle.setPtime(ptime); newModle.setSource(source); newModle.setTag(tag); return newModle; } private String getImgStr(){ Random random = new Random(); int i = random.nextInt(4); if("JS".equals(channelName)){ return Constant.JSImgSrcArray[i]; }else if("IOS".equals(channelName)){ return Constant.IOSImgSrcArray[i]; }else if("Linux".equals(channelName)){ return Constant.LINUXImgSrcArray[i]; }else if("python".equals(channelName)){ return Constant.PYTHONImgSrcArray[i]; }else if("笑话".equals(channelName) || "美女".equals(channelName)){ return Constant.ImgSrcArray[i]; } return Constant.TYImgSrcArray[i]; } @Override public void onSliderClick(BaseSliderView slider) { NewModle newModle = newHashMap.get(slider.getUrl()); enterDetailActivity(newModle); } @Override public void onResume() { super.onResume(); } @Override public void onPause() { super.onPause(); } }
[ "yue.gao@baifendian.com" ]
yue.gao@baifendian.com
7d5921b09bce2a252833fc030ecc2b5ab3c47117
2c6494171023427fded3555ca6d13af7ea921843
/General/Timetable Project/XlsToDB/XlsToCmdReadVertically.java
101de00eac024f72d180a95c9398565b3c921169
[]
no_license
monish001/CPP-Programs
7d835cb4ec59c03d7b402d7be91062d68a7001a5
406d1949a52d03bfec15beef4378729a2c284eee
refs/heads/master
2021-01-23T19:12:22.356388
2016-03-12T13:06:18
2016-03-12T13:06:18
1,692,308
1
0
null
null
null
null
UTF-8
Java
false
false
21,318
java
//SQL suggestions: Do trim with space. //XlsToCmdReadVertically1.java: working but no merge cell detection implementation yet. //XlsToCmdReadVertically2.java: CellRangeAddress[] made and initializes //but still no merge cell detection implementation. //XlsToCmdReadVertically3.java: section-wise reading of classes is done. working. //fair implementation for lab detection. //but doesnt read course name if there is a class for 1+ sections //XlsToCmdReadVertically4.java: //now reads course name also. //No implementation of str[3] (course, room, teacher) yet. //XlsToCmdReadVertically5.java: //implementation of session[3] (course, room, teacher) done. //printing values only from session[3] array //XlsToCmdReadVertically6.java: //Split all the merge areas which done have any content //pending: detecting day and period //pending: implementation to read the sessions of all the sections //XlsToCmdReadVertically7.java: //structure ready for:(but not implemented yet) //1.extending array session[3] to session[6] to further accomodate section, day, period //2.day and period //XlsToCmdReadVertically8.java: //2 points mentioned above are implemented. //support for 2hr tuts needed in which eg. cells have:1.US001, 2.T, 3.-,-, 4.room,teacher //pending: support for labs having eg. cells: 1.EC001, 2.-, 3.LAB, 4.teacher //pending: 3 hr lab must contain 6 cells that are merged and 4th one must contain 'LAB' //XlsToCmdReadVertically9.java: //database implemented. import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.util.CellRangeAddress; import java.util.Iterator; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import java.io.FileInputStream; import java.io.InputStream; import java.sql.Connection; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; class XlsToCmdReadVertically { public static void main(String[] args) throws NullPointerException, java.io.FileNotFoundException, java.io.IOException { new insertIntoDB(); if(args.length < 4) { System.out.println("Give command line arguments: xlsFileName Degree Year RowContaingSectionsNames"); System.exit(0); } String degree = args[1]; short year = (short)Integer.parseInt(args[2]); short RowContaingSectionsNames = (short)Integer.parseInt(args[3]); InputStream inp = new FileInputStream(args[0]); HSSFWorkbook wb = new HSSFWorkbook(new POIFSFileSystem(inp)); HSSFSheet sheet = wb.getSheetAt(0); noOfMR = sheet.getNumMergedRegions(); //System.out.println("no of MR is "+ noOfMR); //initializes mergeRanges[] and split all the merge areas which dont have any content: for(int i=0; i<noOfMR; ++i) { CellRangeAddress MR = null; MR = sheet.getMergedRegion(i); if(MR == null) continue;//System.out.println("MR is null");// String str = null; int rowMR = MR.getFirstRow(); int colMR = MR.getFirstColumn(); for(Row r_ : sheet) {//read MR.getFirstColumn(), MR.getFirstRow() if(r_.getRowNum() != rowMR) continue; for(Cell c_ : r_) { if(c_.getColumnIndex() != colMR) continue; switch(c_.getCellType()) { case Cell.CELL_TYPE_STRING: if(!((c_.getRichStringCellValue().getString()).equals(""))) str = c_.getRichStringCellValue().getString();//System.out.println(cellRef.formatAsString()+" "+cell.getRichStringCellValue().getString());//"Row: "+row.getRowNum()+" Cell: "+cell.getColumnIndex()+" "+cellRef.formatAsString()+" - <In String> "+cell.getRichStringCellValue().getString()); break; case Cell.CELL_TYPE_NUMERIC: if(!((((Double)(c_.getNumericCellValue())).toString()).equals(""))) str = Double.toString(c_.getNumericCellValue()); break; default: str = null;//System.out.println(" ");//("<In Default>"); }//switch }//cell }//row if(str == null)//read MR.getFirstColumn(), MR.getFirstRow(), if contents == null, then remove merged region. sheet.removeMergedRegion(i); } noOfMR = sheet.getNumMergedRegions(); mergeRange = new CellRangeAddress[noOfMR]; //initializes mergeRanges[]: for(int i=0; i<noOfMR; ++i) mergeRange[i] = sheet.getMergedRegion(i); //count and initialize noOfSections breakHere: for(Row rr : sheet) { if(rr.getRowNum() <6) continue; int maxCellInd = -1; for(Cell cc : rr) maxCellInd = /*index*/cc.getColumnIndex(); noOfSections = (1 + maxCellInd) - 2/*day period*/; noOfSections /=2; //each section consumes 2 columns break breakHere; } //Read section names sectionsNames = new String[noOfSections]; breakOut: for(Row rr : sheet) { if(rr.getRowNum() <(6-1)) continue; for(Cell cc : rr) { if(cc.getColumnIndex()<2 || cc.getColumnIndex()%2 == 1) continue; sectionsNames[(cc.getColumnIndex() - 2)/2] = cc.getRichStringCellValue().getString(); } break breakOut; } /*output section names for(int countt=0; countt<noOfSections; countt++) System.out.println(sectionsNames[countt]);*/ //choose section: for(int sec=0; sec<noOfSections; sec++) { //Cells Traversal for the choosen section: for(Iterator<Row> rit = sheet.rowIterator(); rit.hasNext();) { //for each session (means class/tut/lab) int lastColIndexForRow1=-1; int startingColIndexForRow1=-1; CellRangeAddress currCellRange = null; boolean classForSingleSection = false;//initialized by row1 boolean cellsFromRow2AreInGroupOf2WithEachOther = false;//initialized by row2//true means its a lab //Row 1 if(!(rit.hasNext())) continue; Row row = rit.next(); System.out.println(1+row.getRowNum()+"------------------------------"); if(row.getRowNum() < RowContaingSectionsNames) continue;//rows before that one containing list of section names need not to be traversed. //System.out.println("myRorNo : "+row); for(int coun =0; coun<3; coun++) session[coun] = null; session[SECTION] = sectionsNames[sec]; switch(((row.getRowNum() - 6)/2)/10) { case 0: session[DAY] = "Mon"; break; case 1: session[DAY] = "Tue"; break; case 2: session[DAY] = "Wed"; break; case 3: session[DAY] = "Thu"; break; case 4: session[DAY] = "Fri"; break; //default: session[DAY] = "Sun"; } session[PERIOD] = Integer.toString(((row.getRowNum() - 6)/2)%10 + 1); for(Cell cell : row) { //Only allow if colNo satisfies that of the section chosen above: if(cell.getColumnIndex() < sec*2+2)//4)//sec*2+2 continue; //else if(cell.getColumnIndex() > sec*2+2)//5)) //break; //If it is 1st column, then do... //if(cell.getColumnIndex() % 2 ==0)// == 4) { lastColIndexForRow1=-1; startingColIndexForRow1 = -1; currCellRange = null; currCellRange = findMergedRange(row.getRowNum(), cell.getColumnIndex());//check the mergedCellArea to which this cell belongs. if(currCellRange != null) { if(currCellRange.getFirstColumn() == cell.getColumnIndex() && currCellRange.getLastColumn() == 1+cell.getColumnIndex())//check here if this class is for single section. If yes, set the variable to true classForSingleSection = true; startingColIndexForRow1 = currCellRange.getFirstColumn(); lastColIndexForRow1 = currCellRange.getLastColumn(); //System.out.println("classForSingleSection: "+classForSingleSection+"\nstartingColIndexForRow1: "+startingColIndexForRow1); } } //CellReference cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex()); switch(cell.getCellType()) { case Cell.CELL_TYPE_STRING://if this cell is first in merged area, then do this: if(!((cell.getRichStringCellValue().getString()).equals(""))) session[COURSE] = cell.getRichStringCellValue().getString();//System.out.println(cellRef.formatAsString()+" "+cell.getRichStringCellValue().getString());//"Row: "+row.getRowNum()+" Cell: "+cell.getColumnIndex()+" "+cellRef.formatAsString()+" - <In String> "+cell.getRichStringCellValue().getString()); break; default://check if this cell is merged? if yes, get course name if(currCellRange != null//makes sure that the current cell is in merged region and not single //&& currCellRange.getNumberOfCells()>2//not just for a single section && currCellRange.getFirstColumn() != cell.getColumnIndex())//it is not the starting cell of the merged area for(Row r_ : sheet){//read contents of cell(row.getRowNum(), currCellRange.getFirstColumn()) if(r_.getRowNum() != row.getRowNum()) continue; for(Cell c_ : r_) { if(c_.getColumnIndex() != currCellRange.getFirstColumn()) continue; if(!((c_.getRichStringCellValue().getString()).equals(""))) session[COURSE] = c_.getRichStringCellValue().getString();//System.out.println(cellRef.formatAsString()+" "+c_.getRichStringCellValue().getString()); else session[COURSE] = null;//System.out.println("<Free Period>");//("<In Default>"); } } else session[COURSE] = null;//System.out.println("<Free Period>");//("<In Default>"); }//switch break; }//for cell //Row 2: currCellRange = null; if(!(rit.hasNext())) continue; row = rit.next(); for(Cell cell : row) { //Only allow traversal of cells for 2 specific cols which corresponds to the chosen section. if(cell.getColumnIndex() < sec*2+2)//4)//sec*2+2 continue; else if(cell.getColumnIndex() > sec*2+3)//5)) break; //set variable cellsFromRow2AreInGroupOf2WithEachOther here.//=true means it's a lab or a two hour tut. if(cell.getColumnIndex()%2 == 0 /*== 4*/ && classForSingleSection == true)//only set if classForSingleSection is true { currCellRange = findMergedRange(row.getRowNum(), cell.getColumnIndex());//check the mergedCellArea to which this cell belongs. if(currCellRange != null && currCellRange.getFirstColumn() == cell.getColumnIndex() && currCellRange.getLastColumn() == 1+cell.getColumnIndex()) cellsFromRow2AreInGroupOf2WithEachOther = true;//check and initialize cellsFromRow2AreInGroupOf2WithEachOther } { if(cellsFromRow2AreInGroupOf2WithEachOther == true)//lab or two hr tut. 2 row merged of 2 cells { switch(cell.getCellType()) { case Cell.CELL_TYPE_STRING: session[ROOM] = cell.getRichStringCellValue().getString(); break; default: System.out.println("in default asdfy"); session[ROOM] = ""; } break; } else if(classForSingleSection == true)//tut for 1 section { if(cell.getColumnIndex()%2 == 0)//left { session[ROOM] = cell.getRichStringCellValue().getString(); } else//right { session[TEACHER] = cell.getRichStringCellValue().getString(); } } else//lec for multiple sections { if(cell.getColumnIndex()%2 == 0)//left { for(Row r_: sheet) { if(r_.getRowNum() != row.getRowNum()) continue; for(Cell c_ : r_) { if(c_.getColumnIndex() != startingColIndexForRow1) continue; //if(!((c_.getRichStringCellValue().getString()).equals(""))) session[ROOM] = c_.getRichStringCellValue().getString(); } } } else//right { for(Row r_: sheet) { if(r_.getRowNum() != row.getRowNum()) continue; for(Cell c_ : r_) { if(c_.getColumnIndex() != lastColIndexForRow1) continue; //System.out.println("I am here 277"); //if(!((c_.getRichStringCellValue().getString()).equals(""))) session[TEACHER] = c_.getRichStringCellValue().getString(); } } } } } }//for cell if(!classForSingleSection) { try { if(session[COURSE] != null)//if(!((session[COURSE]+session[ROOM]+session[TEACHER]).equals(""))) { insertIntoDB.insert(session); //System.out.println("Cour."+session[COURSE]+"\nRoom."+session[ROOM]+"\nTeac."+session[TEACHER]+ //"\nSect."+session[SECTION]+"\nDay ."+session[DAY]+"\nPeri."+session[PERIOD]); } } catch(SQLException e){System.out.println(e.toString());} continue; } if(!cellsFromRow2AreInGroupOf2WithEachOther){ try { if(session[COURSE] != null)//if(!((session[COURSE]+session[ROOM]+session[TEACHER]).equals(""))) { insertIntoDB.insert(session); //System.out.println("Cour."+session[COURSE]+"\nRoom."+session[ROOM]+"\nTeac."+session[TEACHER]+ //"\nSect."+session[SECTION]+"\nDay ."+session[DAY]+"\nPeri."+session[PERIOD]); } } catch(Exception e){System.out.println(e.toString());} continue;//if cells from row 2 are not in group of 2 with each other then continue //if the Row3 and Row4 code is run, it means there is a lab. } //Row3 if(!(rit.hasNext())) continue; row = rit.next(); for(Cell cell : row) { if(cell.getColumnIndex() < sec*2+2) continue; else if((cell.getColumnIndex() > sec*2+3)) break; CellReference cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex()); switch(cell.getCellType()) { case Cell.CELL_TYPE_STRING: if(!((cell.getRichStringCellValue().getString()).equals(""))) session[ROOM] = session[ROOM] + " " + cell.getRichStringCellValue().getString();//System.out.println(cellRef.formatAsString()+" "+cell.getRichStringCellValue().getString());//"Row: "+row.getRowNum()+" Cell: "+cell.getColumnIndex()+" "+cellRef.formatAsString()+" - <In String> "+cell.getRichStringCellValue().getString()); break; //default: //System.out.println(" ");//("<In Default>"); }//switch break; }//for cell //Row4 if(!(rit.hasNext())) continue; row = rit.next(); boolean flag3hrLab = false; for(Cell cell : row) { if(cell.getColumnIndex() < sec*2+2) continue; else if((cell.getColumnIndex() > sec*2+3)) break; //check if this(4th row is merged for two cells? if yes, then lab else 2 hr tut) CellRangeAddress abc = null; abc = findMergedRange(row.getRowNum(), cell.getColumnIndex()); if(cell.getColumnIndex()%2 == 0) {//left cell isItTut = false; if(abc != null && abc.getFirstColumn() == cell.getColumnIndex() && abc.getLastColumn() == 1+cell.getColumnIndex()) isItTut = false; else isItTut = true; } //System.out.println("tut?"+isItTut); if(isItTut == false)//if lab { switch(cell.getCellType()) { case Cell.CELL_TYPE_STRING: if(!((cell.getRichStringCellValue().getString()).equals(""))) session[TEACHER] = cell.getRichStringCellValue().getString();//System.out.println(cellRef.formatAsString()+" "+cell.getRichStringCellValue().getString());//"Row: "+row.getRowNum()+" Cell: "+cell.getColumnIndex()+" "+cellRef.formatAsString()+" - <In String> "+cell.getRichStringCellValue().getString()); break; }//switch break; } else//if tut { if(cell.getColumnIndex()%2 == 0) {//left switch(cell.getCellType()) { case Cell.CELL_TYPE_STRING: if(!((cell.getRichStringCellValue().getString()).equals(""))) session[TEACHER] = cell.getRichStringCellValue().getString();//System.out.println(cellRef.formatAsString()+" "+cell.getRichStringCellValue().getString());//"Row: "+row.getRowNum()+" Cell: "+cell.getColumnIndex()+" "+cellRef.formatAsString()+" - <In String> "+cell.getRichStringCellValue().getString()); break; }//switch } else//right { session[COURSE] = session[COURSE] + session[ROOM]; session[ROOM] = session[TEACHER]; switch(cell.getCellType()) { case Cell.CELL_TYPE_STRING: if(!((cell.getRichStringCellValue().getString()).equals(""))) session[TEACHER] = cell.getRichStringCellValue().getString();//System.out.println(cellRef.formatAsString()+" "+cell.getRichStringCellValue().getString());//"Row: "+row.getRowNum()+" Cell: "+cell.getColumnIndex()+" "+cellRef.formatAsString()+" - <In String> "+cell.getRichStringCellValue().getString()); break; }//switch } } if(session[TEACHER] != null && session[TEACHER].equals("LAB"))//3 hr lab { flag3hrLab = true; session[ROOM] = session[ROOM]+session[TEACHER]; if(!(rit.hasNext())) continue; row = rit.next(); if(!(rit.hasNext())) continue; row = rit.next(); //read r,c for seesion[TEACHER]; breakheres: for(Row r_: sheet) { if(r_.getRowNum() != row.getRowNum()) continue; for(Cell c_ : r_) { if(c_.getColumnIndex() != startingColIndexForRow1) continue; //System.out.println("I am here 277"); //if(!((c_.getRichStringCellValue().getString()).equals(""))) session[TEACHER] = c_.getRichStringCellValue().getString(); break breakheres; } } } }//for cell if(session[COURSE] != null && !(session[COURSE].equals("null")) && !(session[COURSE].equals(null)) && !(session[COURSE].equals("")))//if(!((session[COURSE]+session[ROOM]+session[TEACHER]).equals(""))) { System.out.println("Cour."+session[COURSE]+"\nRoom."+session[ROOM]+"\nTeac."+session[TEACHER] +"\nSect."+session[SECTION]+"\nDay ."+session[DAY]+"\nPeri."+session[PERIOD]); System.out.println((row.getRowNum()-((flag3hrLab)?(2):(0)))+"------------------------------"); System.out.println("Cour."+session[COURSE]+"\nRoom."+session[ROOM]+"\nTeac."+session[TEACHER] +"\nSect."+session[SECTION]+"\nDay ."+session[DAY]+"\nPeri."+(1+Integer.parseInt(session[PERIOD]))); if(flag3hrLab) { System.out.println(row.getRowNum()+"------------------------------"); System.out.println("Cour."+session[COURSE]+"\nRoom."+session[ROOM]+"\nTeac."+session[TEACHER] +"\nSect."+session[SECTION]+"\nDay ."+session[DAY]+"\nPeri."+(1+Integer.parseInt(session[PERIOD]))); } } }//for rows of chosen section }//for choosing 1 section }//main static CellRangeAddress findMergedRange(int rowInd, int colInd)//check if rowInd,colInd isinany mergeRange { CellRangeAddress cellRange = null; for(int i=0; i<noOfMR; ++i) if(mergeRange[i].isInRange(rowInd, colInd)) return mergeRange[i]; return null; } static boolean isItTut; static String[] sectionsNames; static int noOfSections = 0; static int COURSE=0, ROOM=1, TEACHER=2, SECTION=3, DAY=4, PERIOD=5; static String[] session = new String[6]; static int noOfMR; static CellRangeAddress[] mergeRange; }//class class insertIntoDB { insertIntoDB() { try { JdbcConnection c = new JdbcConnection(); Connection con = c.conn();//Get a Connection object stmt = con.createStatement(); } catch(SQLException e){System.out.println(e.toString());} } static void insert(String[] session) throws SQLException { //courses String[] coursesList = myFrame.initialOptions("course", "id"); boolean flag = false; if(coursesList.length != 0) for(String str : coursesList) if(str.equals(session[COURSE])) { flag = true; } stmt.executeUpdate("INSERT INTO course VALUES('"+ session[COURSE] +"')"); //batches or sections String[] sectionsList = myFrame.initialOptions("batch", "id"); flag = false; for(String str : sectionsList) if(str.equals(session[SECTION])) { flag = true; } stmt.executeUpdate("INSERT INTO batch VALUES('"+ session[SECTION] +"')"); //teacher String[] teachersList = myFrame.initialOptions("teacher", "id"); flag = false; for(String str : teachersList) if(str.equals(session[TEACHER])) { flag = true; } stmt.executeUpdate("INSERT INTO teacher VALUES('"+ session[TEACHER] +"')"); //rooms String[] roomsList = myFrame.initialOptions("room", "id"); flag = false; for(String str : roomsList) if(str.equals(session[ROOM])) { flag = true; } stmt.executeUpdate("INSERT INTO room VALUES('"+ session[ROOM] +"')"); //TIMETABLE (table tt) int day=0; if(session[DAY].equals("Mon")) day=1; else if(session[DAY].equals("Tue")) day=2; else if(session[DAY].equals("Wed")) day=3; else if(session[DAY].equals("Thu")) day=4; else if(session[DAY].equals("Fri")) day=5; stmt.executeUpdate("INSERT INTO tt(cid, rid, tid, sid, day, period) VALUES('"+session[COURSE]+"', '"+session[ROOM]+"', '"+session[TEACHER]+"', '"+session[SECTION]+"', "+day+", "+session[PERIOD]+")"); stmt.executeUpdate("commit"); //con.close(); } static Statement stmt; static int COURSE=0, ROOM=1, TEACHER=2, SECTION=3, DAY=4, PERIOD=5; }
[ "monish.gupta1@gmail.com" ]
monish.gupta1@gmail.com
2083e6c96270a56cb79c778f34bb70e8712ab0be
488e3eab0957649ce705022deee4a5cb39e23fed
/bundle_main/src/main/java/com/anightswip/bundlemain/adapter/AdapterMobileDataList.java
76cffa687ac21d4bccd707c962d97932c54612b7
[]
no_license
maker1024/-WIP
05a6976fe2cf5cb32b94f03033c63e8f7244dd7c
f18d440cda15dbf6f0e37c9c4fa9f69f7e23a9eb
refs/heads/master
2022-11-12T20:28:03.980338
2020-06-22T10:09:37
2020-06-22T10:09:37
272,970,130
0
0
null
null
null
null
UTF-8
Java
false
false
1,959
java
package com.anightswip.bundlemain.adapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.anightswip.bundlemain.databinding.BundleMainMobiledataItemBinding; import com.anightswip.bundlemain.viewmodel.BViewMobileDataList; import com.anightswip.bundleplatform.baselayer.toast.ToastView; import java.util.ArrayList; import java.util.List; public class AdapterMobileDataList extends RecyclerView.Adapter<AdapterMobileDataList.ViewHolder> implements View.OnClickListener { private List<BViewMobileDataList.BViewMobileData> itemDatas; @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { BundleMainMobiledataItemBinding binding = BundleMainMobiledataItemBinding.inflate( LayoutInflater.from(parent.getContext()), parent, false); return new ViewHolder(binding); } public void setData(ArrayList<BViewMobileDataList.BViewMobileData> data) { this.itemDatas = data; notifyDataSetChanged(); } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { holder.binding.setBv(itemDatas.get(position)); holder.binding.setClick(this); holder.binding.executePendingBindings(); } @Override public int getItemCount() { return itemDatas == null ? 0 : itemDatas.size(); } @Override public void onClick(View v) { ToastView.show("该年度有季度下滑"); } class ViewHolder extends RecyclerView.ViewHolder { public BundleMainMobiledataItemBinding binding; ViewHolder(BundleMainMobiledataItemBinding binding) { super(binding.getRoot()); this.binding = binding; } } }
[ "sang_1024@163.com" ]
sang_1024@163.com
5eea5e48bed22a8d4cf6f281ccca44aefc18a0c7
03b5ded3ddf747c6d92f97b2341bbca9396c6376
/src/main/java/pl/coderslab/DbBookService.java
ef843f6396b0447c999268d11a2ccd6138327589
[]
no_license
ChoczajArkadiusz/Books_REST_Server
d5e68dc99e3eeabde6f5b2b5f64adf3cdf0c07c2
bec78e7cc2d55659cbd87a824cbdbdbde7bd0439
refs/heads/master
2020-04-17T08:05:20.214696
2019-02-11T20:23:44
2019-02-11T20:23:44
166,397,355
0
0
null
null
null
null
UTF-8
Java
false
false
1,324
java
package pl.coderslab; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import java.sql.SQLException; import java.util.List; @Service @Qualifier("DbBookService") public class DbBookService implements BookService { @Override public List<Book> getList() { try { return BookDao.loadAll(); } catch (SQLException e) { e.printStackTrace(); } return null; } @Override public Book getById(Long id) { try { return BookDao.loadById(id); } catch (SQLException e) { e.printStackTrace(); } return null; } @Override public void add(Book book) { try { BookDao.saveToDb(book); } catch (SQLException e) { e.printStackTrace(); } } @Override public void update(Long id, Book newBook) { if (id == newBook.getId()) { try { BookDao.saveToDb(newBook); } catch (SQLException e) { e.printStackTrace(); } } } @Override public void delete(Long id) { try { BookDao.delete(id); } catch (SQLException e) { e.printStackTrace(); } } }
[ "choczaj.arkadiusz@gmail.com" ]
choczaj.arkadiusz@gmail.com
c600f49b0919075056d7fef6022d290825331888
78910f66ad73bf52315db829f36512007600dcae
/TWY-android/TWY/app/src/main/java/ru/twy/SettingsPage.java
e92327f789c790484daef809975c289a7a51d616
[]
no_license
irrahil/Twelve_Weeks_Year
1cc897708920fa18cd9aba49440940415dd6b91a
0b18d091fdb9b89e7123b61f9f63c127dddc0e0f
refs/heads/master
2021-09-05T06:08:36.767659
2018-01-24T16:41:18
2018-01-24T16:41:18
118,792,366
1
0
null
null
null
null
UTF-8
Java
false
false
1,266
java
package ru.twy; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.view.View.*; import android.widget.Button; import android.widget.TextView; import ru.twy.core.*; public class SettingsPage extends AppCompatActivity { Settings settings = Settings.getInstance(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); init(); } private void init() { ( (Button) findViewById(R.id.setSettingsButton) ).setOnClickListener(init_settingAndReturnButton_listener() ); ( (TextView) findViewById(R.id.tokenField) ).setText( settings.getUserToken() ); ( (TextView) findViewById(R.id.serverAddrField) ).setText( settings.getServerAddr() ); } private OnClickListener init_settingAndReturnButton_listener() { return new View.OnClickListener() { @Override public void onClick(View v) { settings.setServerAddr( ( (TextView) findViewById(R.id.serverAddrField) ).getText().toString() ); startActivity(Utilities.loadLoginPage(SettingsPage.this) ); } }; } }
[ "airsobol@gmail.com" ]
airsobol@gmail.com
5291c9efb22b0fb216ec3c0662e4388b9b582137
cb9a049356394c1394ac67736f04c1154c57b6b4
/src/main/java/br/edu/pucsp/avaliador/dao/UsuarioRepository.java
f862f20751aecfa142290e35541e72be4b3830c9
[]
no_license
guijac/AvaliadorAulas
027e8e5c83f7c1f6a29800dda6c2192625161f3a
a4bb3434eebda08d2fd366510619ea43c204065d
refs/heads/master
2020-05-14T11:32:41.652222
2019-05-25T15:39:07
2019-05-25T15:39:07
181,779,463
0
0
null
2019-05-23T21:23:31
2019-04-16T22:57:07
Java
UTF-8
Java
false
false
326
java
package br.edu.pucsp.avaliador.dao; import br.edu.pucsp.avaliador.entities.Usuario; import org.springframework.data.mongodb.repository.MongoRepository; import java.util.Optional; public interface UsuarioRepository extends MongoRepository<Usuario,String> { Optional<Usuario> findByNomeDeUsuario(String nomeDeUsuario); }
[ "filipenfst@hotmail.com" ]
filipenfst@hotmail.com
faf640b9ddf5054fec7e9fd09ecf1f1f3c9a179e
30374a09d7ee1d2c31dbac6d2f4806969491c849
/src/main/java/hexagonalgreetings/Application.java
25f2eb5b7a4181022e09ce2838a5c811fe037596
[]
no_license
oscarduignan/HexagonalGreetings
375c230173bfde8245d04155cc545c31c9a71417
0b26ef63386a5ce5e3f6f3c2e9350d8125887907
refs/heads/master
2021-01-03T06:47:53.671637
2020-02-12T21:07:21
2020-02-12T21:07:21
239,967,157
0
0
null
null
null
null
UTF-8
Java
false
false
302
java
package hexagonalgreetings; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
[ "oscarduignan@gmail.com" ]
oscarduignan@gmail.com
45ee5a33151a6bc84129f67396d03a40a258b5c4
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/neo4j/2016/4/CompositeCountsTest.java
5949eeff9ceb775432907b1c8608891fefca81a6
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
15,761
java
/* * Copyright (c) 2002-2016 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.kernel.counts; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import java.util.function.Supplier; import org.neo4j.graphdb.Label; import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Relationship; import org.neo4j.graphdb.RelationshipType; import org.neo4j.graphdb.Transaction; import org.neo4j.kernel.api.ReadOperations; import org.neo4j.kernel.api.Statement; import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge; import org.neo4j.test.DatabaseRule; import org.neo4j.test.ImpermanentDatabaseRule; import static org.junit.Assert.assertEquals; import static org.neo4j.graphdb.Label.label; import static org.neo4j.graphdb.RelationshipType.withName; public class CompositeCountsTest { public final @Rule DatabaseRule db = new ImpermanentDatabaseRule(); @Test public void shouldReportNumberOfRelationshipsFromNodesWithGivenLabel() throws Exception { // given try ( Transaction tx = db.beginTx() ) { Node foo = db.createNode( label( "Foo" ) ); Node fooBar = db.createNode( label( "Foo" ), label( "Bar" ) ); Node bar = db.createNode( label( "Bar" ) ); foo.createRelationshipTo( db.createNode(), withName( "ALPHA" ) ); foo.createRelationshipTo( fooBar, withName( "BETA" ) ); fooBar.createRelationshipTo( db.createNode( label( "Bar" ) ), withName( "BETA" ) ); fooBar.createRelationshipTo( db.createNode(), withName( "GAMMA" ) ); bar.createRelationshipTo( db.createNode( label( "Foo" ) ), withName( "GAMMA" ) ); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "ALPHA" ), null ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Foo" ), withName( "BETA" ), null ).shouldBe( 2 ); numberOfRelationshipsMatching( label( "Foo" ), withName( "GAMMA" ), null ).shouldBe( 1 ); numberOfRelationshipsMatching( null, withName( "ALPHA" ), label( "Foo" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "BETA" ), label( "Foo" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( null, withName( "GAMMA" ), label( "Foo" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "ALPHA" ), null ).shouldBe( 0 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "BETA" ), null ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "GAMMA" ), null ).shouldBe( 2 ); numberOfRelationshipsMatching( null, withName( "ALPHA" ), label( "Bar" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "BETA" ), label( "Bar" ) ).shouldBe( 2 ); numberOfRelationshipsMatching( null, withName( "GAMMA" ), label( "Bar" ) ).shouldBe( 0 ); } @Test public void shouldMaintainCountsOnRelationshipCreate() throws Exception { // given Node foo, bar; try ( Transaction tx = db.beginTx() ) { foo = db.createNode( label( "Foo" ) ); bar = db.createNode( label( "Bar" ) ); tx.success(); } // when try ( Transaction tx = db.beginTx() ) { foo.createRelationshipTo( bar, withName( "KNOWS" ) ); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "KNOWS" ), null ).shouldBe( 1 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Foo" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Bar" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "KNOWS" ), null ).shouldBe( 0 ); } @Test public void shouldMaintainCountsOnRelationshipDelete() throws Exception { // given Relationship relationship; try ( Transaction tx = db.beginTx() ) { relationship = db.createNode( label( "Foo" ) ).createRelationshipTo( db.createNode( label( "Bar" ) ), withName( "KNOWS" ) ); tx.success(); } // when try ( Transaction tx = db.beginTx() ) { relationship.delete(); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "KNOWS" ), null ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Foo" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Bar" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "KNOWS" ), null ).shouldBe( 0 ); } @Test public void shouldMaintainCountsOnLabelAdd() throws Exception { // given Node foo, bar; try ( Transaction tx = db.beginTx() ) { foo = db.createNode(); bar = db.createNode( label( "Bar" ) ); foo.createRelationshipTo( bar, withName( "KNOWS" ) ); tx.success(); } // when try ( Transaction tx = db.beginTx() ) { foo.addLabel( label( "Foo" ) ); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "KNOWS" ), null ).shouldBe( 1 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Foo" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Bar" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "KNOWS" ), null ).shouldBe( 0 ); } @Test public void shouldMaintainCountsOnLabelRemove() throws Exception { // given Node foo, bar; try ( Transaction tx = db.beginTx() ) { foo = db.createNode( label( "Foo" ) ); bar = db.createNode( label( "Bar" ) ); foo.createRelationshipTo( bar, withName( "KNOWS" ) ); tx.success(); } // when try ( Transaction tx = db.beginTx() ) { foo.removeLabel( label( "Foo" ) ); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "KNOWS" ), null ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Foo" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Bar" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "KNOWS" ), null ).shouldBe( 0 ); } @Test public void shouldMaintainCountsOnLabelAddAndRelationshipCreate() throws Exception { // given Node foo, bar; try ( Transaction tx = db.beginTx() ) { foo = db.createNode( label( "Foo" ) ); bar = db.createNode( label( "Bar" ) ); foo.createRelationshipTo( bar, withName( "KNOWS" ) ); tx.success(); } // when try ( Transaction tx = db.beginTx() ) { foo.addLabel( label( "Bar" ) ); foo.createRelationshipTo( db.createNode( label( "Foo" ) ), withName( "KNOWS" ) ); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "KNOWS" ), null ).shouldBe( 2 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Foo" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Bar" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "KNOWS" ), null ).shouldBe( 2 ); } @Test public void shouldMaintainCountsOnLabelRemoveAndRelationshipDelete() throws Exception { // given Node foo, bar; Relationship rel; try ( Transaction tx = db.beginTx() ) { foo = db.createNode( label( "Foo" ), label( "Bar" ) ); bar = db.createNode( label( "Bar" ) ); foo.createRelationshipTo( bar, withName( "KNOWS" ) ); rel = bar.createRelationshipTo( foo, withName( "KNOWS" ) ); tx.success(); } // when try ( Transaction tx = db.beginTx() ) { foo.removeLabel( label( "Bar" ) ); rel.delete(); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "KNOWS" ), null ).shouldBe( 1 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Foo" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Bar" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "KNOWS" ), null ).shouldBe( 0 ); } @Test public void shouldMaintainCountsOnLabelAddAndRelationshipDelete() throws Exception { // given Node foo, bar; Relationship rel; try ( Transaction tx = db.beginTx() ) { foo = db.createNode( label( "Foo" ) ); bar = db.createNode( label( "Bar" ) ); foo.createRelationshipTo( bar, withName( "KNOWS" ) ); rel = bar.createRelationshipTo( foo, withName( "KNOWS" ) ); tx.success(); } // when try ( Transaction tx = db.beginTx() ) { foo.addLabel( label( "Bar" ) ); rel.delete(); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "KNOWS" ), null ).shouldBe( 1 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Foo" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Bar" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "KNOWS" ), null ).shouldBe( 1 ); } @Test public void shouldMaintainCountsOnLabelRemoveAndRelationshipCreate() throws Exception { // given Node foo, bar; try ( Transaction tx = db.beginTx() ) { foo = db.createNode( label( "Foo" ), label( "Bar" ) ); bar = db.createNode( label( "Bar" ) ); foo.createRelationshipTo( bar, withName( "KNOWS" ) ); tx.success(); } // when try ( Transaction tx = db.beginTx() ) { foo.removeLabel( label( "Bar" ) ); foo.createRelationshipTo( db.createNode( label( "Foo" ) ), withName( "KNOWS" ) ); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "KNOWS" ), null ).shouldBe( 2 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Foo" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Bar" ) ).shouldBe( 1 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "KNOWS" ), null ).shouldBe( 0 ); } @Test public void shouldNotUpdateCountsIfCreatedRelationshipIsDeletedInSameTransaction() throws Exception { // given Node foo, bar; try ( Transaction tx = db.beginTx() ) { foo = db.createNode( label( "Foo" ) ); bar = db.createNode( label( "Bar" ) ); tx.success(); } // when try ( Transaction tx = db.beginTx() ) { foo.createRelationshipTo( bar, withName( "KNOWS" ) ).delete(); tx.success(); } // then numberOfRelationshipsMatching( label( "Foo" ), withName( "KNOWS" ), null ).shouldBe( 0 ); numberOfRelationshipsMatching( label( "Bar" ), withName( "KNOWS" ), null ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Foo" ) ).shouldBe( 0 ); numberOfRelationshipsMatching( null, withName( "KNOWS" ), label( "Bar" ) ).shouldBe( 0 ); } /** * Transactional version of {@link #countsForRelationship(Label, RelationshipType, Label)} */ private MatchingRelationships numberOfRelationshipsMatching( Label lhs, RelationshipType type, Label rhs ) { try ( Transaction tx = db.getGraphDatabaseAPI().beginTx() ) { long nodeCount = countsForRelationship( lhs, type, rhs ); tx.success(); return new MatchingRelationships( String.format( "(%s)-%s->(%s)", lhs == null ? "" : ":" + lhs.name(), type == null ? "" : "[:" + type.name() + "]", rhs == null ? "" : ":" + rhs.name() ), nodeCount ); } } private static class MatchingRelationships { private final String message; private final long count; public MatchingRelationships( String message, long count ) { this.message = message; this.count = count; } public void shouldBe( long expected ) { assertEquals( message, expected, count ); } } /** * @param start the label of the start node of relationships to get the number of, or {@code null} for "any". * @param type the type of the relationships to get the number of, or {@code null} for "any". * @param end the label of the end node of relationships to get the number of, or {@code null} for "any". */ private long countsForRelationship( Label start, RelationshipType type, Label end ) { ReadOperations read = statementSupplier.get().readOperations(); int startId, typeId, endId; // start if ( start == null ) { startId = ReadOperations.ANY_LABEL; } else { if ( ReadOperations.NO_SUCH_LABEL == (startId = read.labelGetForName( start.name() )) ) { return 0; } } // type if ( type == null ) { typeId = ReadOperations.ANY_RELATIONSHIP_TYPE; } else { if ( ReadOperations.NO_SUCH_LABEL == (typeId = read.relationshipTypeGetForName( type.name() )) ) { return 0; } } // end if ( end == null ) { endId = ReadOperations.ANY_LABEL; } else { if ( ReadOperations.NO_SUCH_LABEL == (endId = read.labelGetForName( end.name() )) ) { return 0; } } return read.countsForRelationship( startId, typeId, endId ); } private Supplier<Statement> statementSupplier; @Before public void exposeGuts() { statementSupplier = db.getGraphDatabaseAPI().getDependencyResolver() .resolveDependency( ThreadToStatementContextBridge.class ); } }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
df1e13438377f13887f282ce70243c1d4b451275
9267c49538379d3ec03aafe46c5ebfb53fc2c362
/WORKSPACE MURUGAN/selenium Training_JavaPRoject/src/Selenium/ThreadSleep.java
c2b83b4d1a90cb248e32525c90479626d3c14d8f
[]
no_license
murugan6688/GitHub
969b906bfaa91c0c720ccd3e64b53fb152c51edb
41e037ce7cbe10c65d437393fce56dad42245a4b
refs/heads/master
2020-04-02T12:37:16.094962
2018-11-27T13:15:28
2018-11-27T13:15:28
154,442,410
0
0
null
null
null
null
UTF-8
Java
false
false
1,309
java
package com.wipro.syncronization; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class ThreadSleep { public static void main(String[] args) throws InterruptedException { //01.Set System property - browser specific driver file System.setProperty("webdriver.chrome.driver", "c:/Users/mu307892/Desktop/Selenium/Tools software/chromedriver_win32/chromedriver.exe"); //02. Create webdriver instance WebDriver driver=new ChromeDriver(); driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS); //03. Open browser driver.get("http://spezicoe.wipro.com:81/opencart1/"); //maximize browser driver.manage().window().maximize(); //Click on my account driver.findElement(By.xpath("//span[contains(text(),'My Account')]")).click(); // click on login driver.findElement(By.xpath("//a[contains(text(),'Login')]")).click(); //enter email driver.findElement(By.cssSelector("input#input-email")).sendKeys("santosh.hawle@wipro.com"); //enter password driver.findElement(By.cssSelector("input#input-password")).sendKeys("wipro@123"); //Thread.sleep(4000); //click on login button driver.findElement(By.xpath("//input[@value='Login']")).click(); } }
[ "43441294+murugan6688@users.noreply.github.com" ]
43441294+murugan6688@users.noreply.github.com
1ec16c0df4783f1538449d0448faf4ec982934ca
a207d65628d616004c4eb41b2f134e7372a70c89
/appformer-kogito-bridge/src/main/java/org/appformer/kogito/bridge/client/i18n/I18nService.java
d7c9ae66f040d78d2d5faa2f8fa3c2fd3405ae2e
[ "Apache-2.0" ]
permissive
karreiro/kogito-editors-java
88526dd0dd8a96e70904ce7ae9e033e831a1df80
15d8433d4ec9d1865cd75cd8a525af4e27b9ff7f
refs/heads/main
2023-08-17T18:57:00.580872
2021-06-29T17:35:54
2021-06-29T17:35:54
362,736,613
1
0
Apache-2.0
2021-07-28T13:34:38
2021-04-29T07:59:27
Java
UTF-8
Java
false
false
1,101
java
/* * Copyright 2020 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.appformer.kogito.bridge.client.i18n; import elemental2.promise.Promise; /** * A {@link I18nApi} implementation used when envelope API is available */ public class I18nService implements I18nApi { @Override public void onLocaleChange(LocaleChangeCallback callback) { I18nApiInteropWrapper.get().onLocaleChange(callback); } @Override public Promise<String> getLocale() { return I18nApiInteropWrapper.get().getLocale(); } }
[ "noreply@github.com" ]
noreply@github.com
5acd646706324a01d0502ff7021ba5d1a648330d
2ba1c5bccf4b33caa349fd4b7250792b482de579
/WhereIsMyCheese/app/src/main/java/whereismytransport/whereismycheese/CheesyService.java
5b547565b24f3a44d12a6bf8f54dde7069a41547
[]
no_license
morristech/challenges
a9f08b4154b50a14d42de73d7007d9213fa3dc41
e1ffd76f25c6bda86010b53e6fe9eb6410c935b9
refs/heads/master
2020-09-01T12:18:01.734071
2019-02-27T14:15:18
2019-02-27T14:15:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
551
java
package whereismytransport.whereismycheese; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.support.annotation.Nullable; /** * In order to help the app determine if you are near a cheezy note, you will need to use Location somehow.. * The idea is that a service will run, constantly checking to see if you have indeed found a cheezy treasure.. */ public class CheesyService extends Service { @Nullable @Override public IBinder onBind(Intent intent) { return null; } }
[ "henk@whereismytransport.com" ]
henk@whereismytransport.com
42621d497ff2bdac960efe43861bdf31a8deea76
8ac099a3d7a30c88232ca04a490de0fbfbf9fcd9
/src/main/java/com/imooc/dao/mapper/ProductCategoryMapper.java
d20aae16900ce25f8e8250c0c45c0ce3fe4c70ac
[]
no_license
lyz8jj0/sell
18397e1597236b76ce07fac1031d00fe5d57f0aa
c921efa911a1c9ebb40056caab0f43f4452bbd89
refs/heads/master
2020-04-16T03:26:18.859466
2019-04-02T09:43:32
2019-04-02T09:43:32
165,232,054
0
0
null
null
null
null
UTF-8
Java
false
false
1,947
java
package com.imooc.dao.mapper; import com.imooc.entity.ProductCategory; import org.apache.ibatis.annotations.*; import java.util.List; import java.util.Map; /** * Created by 李新宇 * 2019-04-02 11:18 */ public interface ProductCategoryMapper { @Insert("insert into product_category(category_name,category_type) values (#{category_name, jdbcType=VARCHAR}, #{category_type, jdbcType=INTEGER})") int insertByMap(Map<String, Object> map); @Insert("insert into product_category(category_name,category_type) values (#{categoryName, jdbcType=VARCHAR}, #{categoryType, jdbcType=INTEGER})") int insertByObject(ProductCategory productCategory); @Select("select * from product_category where category_type = #{categoryType}") @Results({ @Result(column = "category_id", property = "categoryId"), @Result(column = "category_name", property = "categoryName"), @Result(column = "category_type", property = "categoryType") }) ProductCategory findByCategoryType(Integer categoryType); @Select("select * from product_category where category_name = #{categoryName}") @Results({ @Result(column = "category_id", property = "categoryId"), @Result(column = "category_name", property = "categoryName"), @Result(column = "category_type", property = "categoryType") }) List<ProductCategory> findByCategoryName(String categoryName); @Update("update product_category set category_name = #{categoryName} where category_type = #{categoryType}") int updateByCategoryType(@Param("categoryName") String categoryName, @Param("categoryType") Integer categoryType); @Update("update product_category set category_name = #{categoryName} where category_type = #{categoryType}") int updateByCategoryObject(ProductCategory productCategory); ProductCategory selectByCategoryType(Integer categoryType); }
[ "844216765@qq.com" ]
844216765@qq.com
0b111db9bcbf48bb8fa1dd5f272d710825bfe0f5
f89d8a84896f78e5bcf0d88fc4cca7d08fbb958e
/vitro-core/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/customlistview/PropertyListConfig.java
ae33c1f49bf15c5ba646a1f74524b94c5ef56e9c
[]
no_license
Data-to-Insight-Center/sead-vivo
c65ca49f663ec3770b8ad25e009d1a90c476ec56
c82ac568e5fc4691fa7d4981328b8049bfdc87f5
refs/heads/master
2020-04-15T06:15:38.963277
2020-02-01T16:17:13
2020-02-01T16:17:13
14,767,397
0
1
null
null
null
null
UTF-8
Java
false
false
10,554
java
/* Copyright (c) 2013, Cornell University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Cornell University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package edu.cornell.mannlib.vitro.webapp.web.templatemodels.customlistview; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.lang.reflect.Constructor; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.CollatedObjectPropertyTemplateModel; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.DefaultObjectPropertyDataPostProcessor; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ObjectPropertyDataPostProcessor; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ObjectPropertyTemplateModel; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ObjectPropertyTemplateModel.ConfigError; import freemarker.cache.TemplateLoader; import freemarker.template.Configuration; public class PropertyListConfig { private static final Log log = LogFactory.getLog(PropertyListConfig.class); private static final String CONFIG_FILE_PATH = "/config/"; private static final String DEFAULT_CONFIG_FILE_NAME = "listViewConfig-default.xml"; /* NB The default post-processor is not the same as the post-processor for the default view. The latter * actually defines its own post-processor, whereas the default post-processor is used for custom views * that don't define a post-processor, to ensure that the standard post-processing applies. * * edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.DefaultObjectPropertyDataPostProcessor */ // TODO Lump these together into the PropertyListConfigContext private final ObjectPropertyTemplateModel optm; private final VitroRequest vreq; private final TemplateLoader templateLoader; private boolean isDefaultConfig; private Set<String> constructQueries; private String selectQuery; private String templateName; private ObjectPropertyDataPostProcessor postprocessor; // never null public PropertyListConfig(ObjectPropertyTemplateModel optm, TemplateLoader templateLoader, VitroRequest vreq, ObjectProperty op, boolean editing) throws InvalidConfigurationException { this.optm = optm; this.vreq = vreq; WebappDaoFactory wadf = vreq.getWebappDaoFactory(); this.templateLoader = templateLoader; // Get the custom config filename String configFileName = wadf.getObjectPropertyDao().getCustomListViewConfigFileName(op); if (configFileName == null) { // no custom config; use default config configFileName = DEFAULT_CONFIG_FILE_NAME; } log.debug("Using list view config file " + configFileName + " for object property " + op.getURI()); String configFilePath = getConfigFilePath(configFileName); try { File config = new File(configFilePath); if ( ! isDefaultConfig(configFileName) && ! config.exists() ) { log.warn("Can't find config file " + configFilePath + " for object property " + op.getURI() + "\n" + ". Using default config file instead."); configFilePath = getConfigFilePath(DEFAULT_CONFIG_FILE_NAME); // Should we test for the existence of the default, and throw an error if it doesn't exist? } setValuesFromConfigFile(configFilePath, wadf, editing); } catch (Exception e) { log.error("Error processing config file " + configFilePath + " for object property " + op.getURI(), e); // What should we do here? } if ( ! isDefaultConfig(configFileName) ) { ConfigError configError = checkConfiguration(); if ( configError != null ) { // the configuration contains an error // If this is a collated property, throw an error: this results in creating an // UncollatedPropertyTemplateModel instead. if (optm instanceof CollatedObjectPropertyTemplateModel) { throw new InvalidConfigurationException(configError.getMessage()); } // Otherwise, switch to the default config log.warn("Invalid list view config for object property " + op.getURI() + " in " + configFilePath + ":\n" + configError + " Using default config instead."); configFilePath = getConfigFilePath(DEFAULT_CONFIG_FILE_NAME); setValuesFromConfigFile(configFilePath, wadf, editing); } } isDefaultConfig = isDefaultConfig(configFileName); } private boolean isDefaultConfig(String configFileName) { return configFileName.equals(DEFAULT_CONFIG_FILE_NAME); } private ConfigError checkConfiguration() { ConfigError error = optm.checkQuery(selectQuery); if (error != null) { return error; } if (StringUtils.isBlank(selectQuery)) { return ConfigError.NO_SELECT_QUERY; } if ( StringUtils.isBlank(templateName)) { return ConfigError.NO_TEMPLATE; } try { if ( templateLoader.findTemplateSource(templateName) == null ) { return ConfigError.TEMPLATE_NOT_FOUND; } } catch (IOException e) { log.error("Error finding template " + templateName, e); } return null; } private void setValuesFromConfigFile(String configFilePath, WebappDaoFactory wdf, boolean editing) { try { FileReader reader = new FileReader(configFilePath); CustomListViewConfigFile configFileContents = new CustomListViewConfigFile(reader); boolean collated = optm instanceof CollatedObjectPropertyTemplateModel; selectQuery = configFileContents.getSelectQuery(collated, editing); templateName = configFileContents.getTemplateName(); constructQueries = configFileContents.getConstructQueries(); String postprocessorName = configFileContents.getPostprocessorName(); postprocessor = getPostProcessor(postprocessorName, optm, wdf, configFilePath); } catch (Exception e) { log.error("Error processing config file " + configFilePath, e); } } private ObjectPropertyDataPostProcessor getPostProcessor( String className, ObjectPropertyTemplateModel optm, WebappDaoFactory wdf, String configFilePath) { try { if (StringUtils.isBlank(className)) { return new DefaultObjectPropertyDataPostProcessor(optm, wdf); } Class<?> clazz = Class.forName(className); Constructor<?> constructor = clazz.getConstructor(ObjectPropertyTemplateModel.class, WebappDaoFactory.class); return (ObjectPropertyDataPostProcessor) constructor.newInstance(optm, wdf); } catch (ClassNotFoundException e) { log.warn("Error processing config file '" + configFilePath + "': can't load postprocessor class '" + className + "'. " + "Using default postprocessor.", e); return new DefaultObjectPropertyDataPostProcessor(optm, wdf); } catch (NoSuchMethodException e) { log.warn("Error processing config file '" + configFilePath + "': postprocessor class '" + className + "' does not have a constructor that takes " + "ObjectPropertyTemplateModel and WebappDaoFactory. " + "Using default postprocessor.", e); return new DefaultObjectPropertyDataPostProcessor(optm, wdf); } catch (ClassCastException e) { log.warn("Error processing config file '" + configFilePath + "': postprocessor class '" + className + "' does " + "not implement ObjectPropertyDataPostProcessor. " + "Using default postprocessor.", e); return new DefaultObjectPropertyDataPostProcessor(optm, wdf); } catch (Exception e) { log.warn("Error processing config file '" + configFilePath + "': can't create postprocessor instance of class '" + className + "'. " + "Using default postprocessor.", e); return new DefaultObjectPropertyDataPostProcessor(optm, wdf); } } private String getConfigFilePath(String filename) { return vreq.getSession().getServletContext().getRealPath(CONFIG_FILE_PATH + filename); } public String getSelectQuery() { return this.selectQuery; } public Set<String> getConstructQueries() { return this.constructQueries; } public String getTemplateName() { return this.templateName; } public boolean isDefaultListView() { return this.isDefaultConfig; } public ObjectPropertyDataPostProcessor getPostprocessor() { return this.postprocessor; } }
[ "kavchand@indiana.edu" ]
kavchand@indiana.edu
5b31a58942a4c50dc32364027d80f9269df0263d
d69e5ea4a969d149812c0c84ae3fa7c8b8f16ae4
/src/by/pavka/clazz/aggregation_composition/car/Engine.java
0370d4fb3cf29822d567fc22bdf768b3e55a50df
[]
no_license
Pavel-JavaIntro/Module4.-Classes
ae9e7d3bbbc93d9e457f1c4004a6a392f6e2b397
f4b09fdfb8343c7c522147a5aeb4316d7b4d0df5
refs/heads/master
2022-04-20T00:57:28.009651
2020-04-17T13:43:14
2020-04-17T13:43:14
256,513,328
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package by.pavka.clazz.aggregation_composition.car; class Engine { private Car car; public Engine() { car = null; } public Engine(Car car) { this.car = car; } public void start() { System.out.println("dr..dr..drrrrrr"); } }
[ "noreply@github.com" ]
noreply@github.com
98082156bdd324b2c65bb2eecc4badf70e61b8da
c612fe9597af8f89a8852c1b1866d4a6460de84e
/casebook/src/main/java/org/atanasov/casebook/config/ApplicationBeanConfiguration.java
8455fd034123ad0ae888771adf253157ad25bcd4
[ "MIT" ]
permissive
VasAtanasov/SoftUni-Java-Web-Basics-September-2019
cf8f79190ba2b2b8d727b9b8c1e05dfc06726ae8
c5456fd987d559159a3ba3dc16da0875138defd1
refs/heads/master
2022-07-10T13:10:21.647063
2019-10-30T08:56:55
2019-10-30T08:56:55
211,797,820
0
0
MIT
2022-06-21T02:08:25
2019-09-30T07:09:39
Java
UTF-8
Java
false
false
353
java
package org.atanasov.casebook.config; import org.modelmapper.ModelMapper; import javax.enterprise.inject.Produces; import javax.faces.annotation.FacesConfig; @FacesConfig(version = FacesConfig.Version.JSF_2_3) public class ApplicationBeanConfiguration { @Produces public ModelMapper modelMapper() { return new ModelMapper(); } }
[ "vas.atanasov@gmail.com" ]
vas.atanasov@gmail.com
55a232e54b05ef516cfe997f8bbcd0d286d88500
36a6c6b4ba1a4b31ac860f954a5070a6c9b1d57a
/app/src/main/java/com/gold/kds517/citylightstv/activity/GuideActivity.java
41818d93655e194cbe1ee485d93d7dd080bb3163
[]
no_license
wubi517/CityLightCombo
6747fea115eafe645a9ef2b3cb187725538e699a
446c53fec175eed4709233e30f85ee6f652d9c6a
refs/heads/master
2022-04-02T00:10:11.985450
2020-02-13T20:38:07
2020-02-13T20:38:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
42,152
java
package com.gold.kds517.citylightstv.activity; import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.PixelFormat; import android.net.Uri; import android.os.Build; import android.os.Handler; import android.os.StrictMode; import android.os.SystemClock; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.text.Spannable; import android.text.SpannableString; import android.text.style.ForegroundColorSpan; import android.util.DisplayMetrics; import android.view.KeyEvent; import android.view.SurfaceView; import android.view.View; import android.view.WindowManager; import android.widget.AdapterView; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; import com.gold.kds517.citylightstv.adapter.DateListAdapter; import com.gold.kds517.citylightstv.adapter.EpgListAdapter; import com.gold.kds517.citylightstv.apps.Constants; import com.gold.kds517.citylightstv.apps.MyApp; import com.gold.kds517.citylightstv.listner.SimpleGestureFilter; import com.gold.kds517.citylightstv.listner.SimpleGestureFilter.SimpleGestureListener; import com.gold.kds517.citylightstv.R; import com.gold.kds517.citylightstv.models.EPGChannel; import com.gold.kds517.citylightstv.models.EPGEvent; import org.videolan.libvlc.IVLCVout; import org.videolan.libvlc.LibVLC; import org.videolan.libvlc.Media; import org.videolan.libvlc.MediaPlayer; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TimeZone; import java.util.TreeMap; import static com.gold.kds517.citylightstv.apps.Constants.catchupFormat; public class GuideActivity extends AppCompatActivity implements AdapterView.OnItemClickListener,View.OnClickListener,SimpleGestureListener, IVLCVout.Callback{ private MediaPlayer mMediaPlayer = null; private int mVideoWidth; private int mVideoHeight; int selected_item = 0; LibVLC libvlc; private SimpleGestureFilter detector; Context context = null; Button btn_rewind,btn_play,btn_forward; public static SurfaceView surfaceView; SurfaceView remote_subtitles_surface; SeekBar seekbar; LinearLayout def_lay,ly_bottom,ly_resolution,ly_audio,ly_subtitle; MediaPlayer.TrackDescription[] traks; MediaPlayer.TrackDescription[] subtraks; String[] resolutions = new String[]{"16:9", "4:3", "16:9"}; int current_resolution = 0; boolean first = true; List<EPGEvent> epgModelList; ListView date_list, epg_list; DateListAdapter dateListAdapter; EpgListAdapter epgListAdapter; List<String > date_datas,pkg_datas; String mStream_id,epg_date,contentUri,channel_name,start_time; TextView txt_epg_data,txt_channel,txt_time,txt_progress,txt_title,txt_dec,channel_title,txt_date,txt_time_passed,txt_remain_time,txt_last_time, txt_current_dec,txt_next_dec; ImageView btn_back; int page,selected_num,osd_time,date_pos,dates, duration = 0; boolean is_create = true,item_sel = false,is_start = false; Handler mHandler = new Handler(); Runnable mTicker; long current_time,startMill; private Map<String, List<EPGEvent>> map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_guide); StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .penaltyLog() .detectAll() .build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() .penaltyLog() .detectAll() .build()); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); osd_time = (int) MyApp.instance.getPreference().get(Constants.OSD_TIME); detector = new SimpleGestureFilter(GuideActivity.this, GuideActivity.this); context = this; pkg_datas = new ArrayList<>(); pkg_datas.addAll(Arrays.asList(getResources().getStringArray(R.array.package_list))); seekbar = findViewById(R.id.seekbar); seekbar.setMax(100); txt_title = findViewById(R.id.txt_title); txt_dec = findViewById(R.id.txt_dec); channel_title = findViewById(R.id.channel_title); txt_date = findViewById(R.id.txt_date); txt_time_passed = findViewById(R.id.txt_time_passed); txt_remain_time = findViewById(R.id.txt_remain_time); txt_last_time = findViewById(R.id.txt_last_time); txt_current_dec = findViewById(R.id.txt_current_dec); txt_next_dec = findViewById(R.id.txt_next_dec); surfaceView = findViewById(R.id.surface_view); remote_subtitles_surface = findViewById(R.id.remote_subtitles_surface); remote_subtitles_surface.setZOrderMediaOverlay(true); remote_subtitles_surface.getHolder().setFormat(PixelFormat.TRANSLUCENT); ly_audio = findViewById(R.id.ly_audio); ly_resolution = findViewById(R.id.ly_resolution); ly_subtitle = findViewById(R.id.ly_subtitle); ly_subtitle.setOnClickListener(this); ly_resolution.setOnClickListener(this); ly_audio.setOnClickListener(this); findViewById(R.id.ly_fav).setOnClickListener(this); findViewById(R.id.ly_back).setOnClickListener(this); btn_rewind = findViewById(R.id.btn_rewind); btn_forward = findViewById(R.id.btn_forward); btn_play = findViewById(R.id.btn_play); btn_rewind.setOnClickListener(this); btn_play.setOnClickListener(this); btn_forward.setOnClickListener(this); findViewById(R.id.channel_play).setOnClickListener(this); surfaceView.setOnClickListener(view -> { if(ly_bottom.getVisibility()==View.GONE){ ly_bottom.setVisibility(View.VISIBLE); }else { ly_bottom.setVisibility(View.GONE); } }); def_lay = findViewById(R.id.def_lay); ly_bottom = findViewById(R.id.ly_bottom); txt_channel = findViewById(R.id.txt_channel); EPGChannel epgChannel = MyApp.epgChannel; if (epgChannel.getEvents()==null || epgChannel.getEvents().size()==0){ Toast.makeText(this,"No Programs!",Toast.LENGTH_LONG).show(); finish(); return; } mStream_id = epgChannel.getStream_id(); txt_channel.setText(epgChannel.getName()); channel_name = epgChannel.getName(); txt_epg_data = findViewById(R.id.txt_epg_data); txt_time = findViewById(R.id.txt_time); txt_progress = findViewById(R.id.txt_progress); btn_back = findViewById(R.id.btn_back); btn_back.setOnClickListener(this); date_list = findViewById(R.id.date_list); date_list.setOnItemClickListener(this); epg_list = findViewById(R.id.epg_list); epg_list.setOnItemClickListener(this); date_list.setNextFocusRightId(R.id.epg_list); epg_list.setNextFocusLeftId(R.id.date_list); epg_date = Constants.year_dateFormat.format(new Date()); page = 0; // if(!getApplicationContext().getPackageName().equalsIgnoreCase(new String(Base64.decode(new String (Base64.decode("LmdvbGQua2RTG1kdmJHUXVhMlJZMjl0TG1kdmJHUXVhMlJ6TlRFM0xuTm9hWHA2WDI1bGR3PT0=".substring(11),Base64.DEFAULT)).substring(11),Base64.DEFAULT)))){ // return; // } // new Thread(this::getEpgData).start(); epgModelList = epgChannel.getEvents(); if(epgModelList.size()>0){ map = getFilteredModels(epgModelList); date_datas = new ArrayList<>(map.keySet()); // dates = (int) (System.currentTimeMillis()-epgModelList.get(0).getStartTime().getTime()*1000)/(24*3600*1000); // int divide = (int) (System.currentTimeMillis()-epgModelList.get(0).getEndTime().getTime()*1000)%(24*3600*1000); // if(divide>0){ // dates++; // } // date_datas = new ArrayList<>(); // for(int i = 0;i<dates;i++){ // long millisecond = epgModelList.get(0).getStartTime().getTime()*1000 + i*24*3600*1000; // date_datas.add(getFromDate(millisecond)); // } dateListAdapter = new DateListAdapter(this,date_datas); date_list.setAdapter(dateListAdapter); for(int i = 0;i<date_datas.size();i++){ if(getFromDate(System.currentTimeMillis()).equalsIgnoreCase(date_datas.get(i))){ date_pos = i; } } dateListAdapter.selectItem(date_pos); printEpgData(); } FullScreencall(); Thread myThread = null; Runnable runnable = new CountDownRunner(); myThread = new Thread(runnable); myThread.start(); } private Map<String, List<EPGEvent>> getFilteredModels(List<EPGEvent> epgModelList) { Map<String, List<EPGEvent>> map = new HashMap<>(); String date =""; List<EPGEvent> epgEvents = new ArrayList<>(); for (EPGEvent epgEvent:epgModelList){ String instDate = getStrFromDate(epgEvent.getStartTime()); if (instDate.equals(date)){ epgEvents.add(epgEvent); }else { if (!date.equals("")) { map.put(date,epgEvents); epgEvents = new ArrayList<>(); } date = instDate; } } map = new TreeMap<>(map); return map; } private String getStrFromDate(Date date){ Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.setTimeZone(TimeZone.getDefault()); return Constants.year_dateFormat.format(calendar.getTime()); } // private void getEpgData(){ // try { // String map = MyApp.instance.getIptvclient().getAllEPGOfStream(MyApp.user,MyApp.pass,mStream_id); // Log.e(getClass().getSimpleName(),map); // map=map.replaceAll("[^\\x00-\\x7F]", ""); // if (!map.contains("null_error_response")){ // try { // JSONObject jsonObject= new JSONObject(map); // JSONArray jsonArray=jsonObject.getJSONArray("epg_listings"); // epgModelList = new ArrayList<>(); // if(jsonArray.length() > 0){ // for(int i = 0;i<jsonArray.length();i++){ // try { // JSONObject e_p = (JSONObject) jsonArray.get(i); // EpgModel epgModel = new EpgModel(); // epgModel.setId((String )e_p.get("id")); // epgModel.setCh_id((String )e_p.get("channel_id")); // epgModel.setCategory((String )e_p.get("epg_id")); // epgModel.setT_time((String )e_p.get("start")); // epgModel.setT_time_to((String )e_p.get("end")); // byte[] desc_byte = Base64.decode((String )e_p.get("description"), Base64.DEFAULT); // String desc = new String(desc_byte); // epgModel.setDescr(desc); // byte[] title_byte = Base64.decode((String )e_p.get("title"), Base64.DEFAULT); // String title = new String(title_byte); // epgModel.setName(title); // epgModel.setStart_timestamp(e_p.get("start_timestamp").toString()); // epgModel.setStop_timestamp(e_p.get("stop_timestamp").toString()); // int duration = ((Integer.parseInt(e_p.get("stop_timestamp").toString())) - (Integer.parseInt(e_p.get("start_timestamp").toString()))); // epgModel.setDuration(duration); // if(e_p.has("has_archive")) { // Double d = Double.parseDouble(e_p.get("has_archive").toString()); // epgModel.setMark_archive(d.intValue()); // } // epgModelList.add(epgModel); // }catch (Exception e){ // Log.e("error","epg_parse_error"); // } // } // runOnUiThread(()->{ // if(epgModelList.size()>0){ // dates = (int) (System.currentTimeMillis()-Long.parseLong(epgModelList.get(0).getStart_timestamp())*1000)/(24*3600*1000); // int divide = (int) (System.currentTimeMillis()-Long.parseLong(epgModelList.get(0).getStart_timestamp())*1000)%(24*3600*1000); // if(divide>0){ // dates++; // } // date_datas = new ArrayList<>(); // for(int i = 0;i<dates;i++){ // long millisecond = Long.parseLong(epgModelList.get(0).getStart_timestamp())*1000 + i*24*3600*1000; // date_datas.add(getFromDate(millisecond)); // } // // dateListAdapter = new DateListAdapter(this,date_datas); // date_list.setAdapter(dateListAdapter); // // for(int i = 0;i<date_datas.size();i++){ // if(getFromDate(System.currentTimeMillis()).equalsIgnoreCase(date_datas.get(i))){ // date_pos = i; // } // } // dateListAdapter.selectItem(date_pos); // printEpgData(); // } // }); // } // }catch (Exception e){ // } // } // }catch (Exception e){ // // } // } @Override public void onClick(View v) { switch (v.getId()){ case R.id.ly_back: finish(); break; case R.id.btn_rewind: if(surfaceView.getVisibility()==View.VISIBLE){ mHandler.removeCallbacks(mTicker); Date date1 = new Date(); if (date1.getTime() > current_time + 60 * 1000) { current_time += 60 * 1000; if (libvlc != null) { releaseMediaPlayer(); surfaceView = null; } surfaceView = findViewById(R.id.surface_view); startMill = startMill-60*1000; start_time = getFromCatchDate(startMill); duration = duration+1; contentUri = MyApp.instance.getIptvclient().buildCatchupStreamURL(MyApp.user,MyApp.pass,mStream_id,start_time,duration); item_sel = true; playVideo(contentUri); ly_bottom.setVisibility(View.VISIBLE); updateProgressBar(); listTimer(); } } break; case R.id.btn_play: if (mMediaPlayer.isPlaying()) { mMediaPlayer.pause(); } else { mMediaPlayer.play(); } break; case R.id.btn_forward: is_start = true; if(surfaceView.getVisibility()==View.VISIBLE){ mHandler.removeCallbacks(mTicker); current_time -= 60*1000; if (libvlc != null) { releaseMediaPlayer(); surfaceView = null; } surfaceView = (SurfaceView) findViewById(R.id.surface_view); startMill = startMill+60*1000; start_time = getFromCatchDate(startMill); duration = duration-1; contentUri = MyApp.instance.getIptvclient().buildCatchupStreamURL(MyApp.user,MyApp.pass,mStream_id,start_time,duration); item_sel = true; playVideo(contentUri); surfaceView.setVisibility(View.VISIBLE); ly_bottom.setVisibility(View.VISIBLE); updateProgressBar(); listTimer(); } break; case R.id.channel_play: is_start = false; releaseMediaPlayer(); is_start = false; if(surfaceView!=null){ surfaceView = null; } surfaceView = findViewById(R.id.surface_view); startMill = map.get(date_datas.get(date_pos)).get(selected_num).getStartTime().getTime(); start_time = getFromCatchDate(startMill); duration = map.get(date_datas.get(date_pos)).get(selected_num).getDuration()/60; contentUri = MyApp.instance.getIptvclient().buildCatchupStreamURL(MyApp.user,MyApp.pass,mStream_id,start_time,duration); playVideo(contentUri); surfaceView.setVisibility(View.VISIBLE); remote_subtitles_surface.setVisibility(View.VISIBLE); ly_bottom.setVisibility(View.VISIBLE); date_list.setVisibility(View.GONE); epg_list.setVisibility(View.GONE); Date date = new Date(); current_time = date.getTime(); updateProgressBar(); listTimer(); break; case R.id.ly_audio: if (traks != null) { if (traks.length > 0) { showAudioTracksList(); } else { Toast.makeText(getApplicationContext(), "No audio tracks or not loading yet", Toast.LENGTH_LONG).show(); } } else { Toast.makeText(getApplicationContext(), "No audio tracks or not loading yet", Toast.LENGTH_LONG).show(); } break; case R.id.ly_subtitle: if (subtraks != null) { if (subtraks.length > 0) { showSubTracksList(); } else { Toast.makeText(getApplicationContext(), "No subtitle or not loading yet", Toast.LENGTH_LONG).show(); } } else { Toast.makeText(getApplicationContext(), "No subtitle or not loading yet", Toast.LENGTH_LONG).show(); } break; case R.id.ly_resolution: current_resolution++; if (current_resolution == resolutions.length) current_resolution = 0; mMediaPlayer.setAspectRatio(resolutions[current_resolution]); break; } } @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if(adapterView == date_list){ selected_num = 0; date_pos = i; printEpgData(); dateListAdapter.selectItem(date_pos); }else if(adapterView==epg_list){ epgListAdapter.selectItem(i); selected_num = i; printEpgDataInDetail(); } } private void printEpgData(){ txt_progress.setVisibility(View.GONE); epgListAdapter = new EpgListAdapter(this,map.get(date_datas.get(date_pos))); epg_list.setAdapter(epgListAdapter); epgListAdapter.selectItem(selected_num); printEpgDataInDetail(); } private void printEpgDataInDetail(){ String epgtime = Constants.Offset(true,map.get(date_datas.get(date_pos)).get(selected_num).getStartTime()) + "-" + Constants.Offset(true,map.get(date_datas.get(date_pos)).get(selected_num).getEndTime()); String epgData = map.get(date_datas.get(date_pos)).get(selected_num).getDec(); String epgText = epgtime + " - " + epgData; Spannable spannable = new SpannableString(epgText); spannable.setSpan(new ForegroundColorSpan(Color.YELLOW), 0, epgtime.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); txt_epg_data.setText(spannable, TextView.BufferType.SPANNABLE); } @Override public void onSwipe(int direction) { } @Override public void onDoubleTap() { } private String getFromDate(long millisecond){ Date date = new Date(); date.setTime(millisecond); String formattedDate=Constants.year_dateFormat.format(date); return formattedDate; } private String getFromCatchDate(long millisecond){ Date date = new Date(); date.setTime(millisecond); String formattedDate=catchupFormat.format(date); return formattedDate; } private String getFromDate1(long millisecond){ Date date = new Date(); date.setTime(millisecond); String formattedDate=Constants.time_format.format(date); return formattedDate; } @Override public void onSurfacesCreated(IVLCVout vlcVout) { } @Override public void onSurfacesDestroyed(IVLCVout vlcVout) { } class CountDownRunner implements Runnable { // @Override public void run() { while (!Thread.currentThread().isInterrupted()) { try { doWork(); Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Exception e) { } } } } public void doWork() { runOnUiThread(() -> { try { txt_time.setText(Constants.clockFormat.format(new Date())); } catch (Exception e) { } }); } public void FullScreencall() { if( Build.VERSION.SDK_INT < 19) { // lower api View v = this.getWindow().getDecorView(); v.setSystemUiVisibility(View.GONE); } else { //for new api versions. View decorView = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; decorView.setSystemUiVisibility(uiOptions); } } @Override public boolean dispatchKeyEvent(KeyEvent event) { View view = getCurrentFocus(); if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_BACK: if(ly_bottom.getVisibility()==View.VISIBLE){ ly_bottom.setVisibility(View.GONE); return true; } if(surfaceView.getVisibility() == View.VISIBLE){ releaseMediaPlayer(); def_lay.setVisibility(View.GONE); surfaceView.setVisibility(View.GONE); remote_subtitles_surface.setVisibility(View.GONE); epg_list.setVisibility(View.VISIBLE); date_list.setVisibility(View.VISIBLE); return true; } finish(); break; case KeyEvent.KEYCODE_DPAD_DOWN: if(view==epg_list){ if(selected_num<map.get(date_datas.get(date_pos)).size()-1){ selected_num++; } epgListAdapter.selectItem(selected_num); printEpgDataInDetail(); } break; case KeyEvent.KEYCODE_DPAD_UP: if(view==epg_list){ if(selected_num>0){ selected_num--; } epgListAdapter.selectItem(selected_num); printEpgDataInDetail(); } break; case KeyEvent.KEYCODE_DPAD_CENTER: if(view==epg_list){ is_start = false; releaseMediaPlayer(); is_start = false; if(surfaceView!=null){ surfaceView = null; } surfaceView = findViewById(R.id.surface_view); startMill = map.get(date_datas.get(date_pos)).get(selected_num).getStartTime().getTime(); start_time = getFromCatchDate(startMill); duration = map.get(date_datas.get(date_pos)).get(selected_num).getDuration()/60; contentUri = MyApp.instance.getIptvclient().buildCatchupStreamURL(MyApp.user,MyApp.pass,mStream_id,start_time,duration); playVideo(contentUri); surfaceView.setVisibility(View.VISIBLE); ly_bottom.setVisibility(View.VISIBLE); date_list.setVisibility(View.GONE); epg_list.setVisibility(View.GONE); Date date = new Date(); current_time = date.getTime(); updateProgressBar(); listTimer(); }else { if(surfaceView.getVisibility()==View.VISIBLE){ if (mMediaPlayer.isPlaying()) { mMediaPlayer.pause(); } else { mMediaPlayer.play(); } ly_bottom.setVisibility(View.VISIBLE); listTimer(); } } break; case KeyEvent.KEYCODE_DPAD_RIGHT: if(surfaceView.getVisibility()==View.VISIBLE){ current_time -= 60*1000; releaseMediaPlayer(); is_start = false; if (surfaceView != null) { surfaceView = null; } surfaceView = findViewById(R.id.surface_view); startMill = startMill+60*1000; start_time = getFromCatchDate(startMill); duration = duration+1; contentUri = MyApp.instance.getIptvclient().buildCatchupStreamURL(MyApp.user,MyApp.pass,mStream_id,start_time,duration); playVideo(contentUri); surfaceView.setVisibility(View.VISIBLE); ly_bottom.setVisibility(View.VISIBLE); date_list.setVisibility(View.GONE); epg_list.setVisibility(View.GONE); updateProgressBar(); listTimer(); } break; case KeyEvent.KEYCODE_DPAD_LEFT: if(surfaceView.getVisibility()==View.VISIBLE){ Date date1 = new Date(); if (date1.getTime() > current_time + 60 * 1000) { current_time += 60 * 1000; releaseMediaPlayer(); is_start = false; if (surfaceView != null) { surfaceView = null; } surfaceView = findViewById(R.id.surface_view); startMill = startMill-60*1000; start_time = getFromCatchDate(startMill); duration = duration-1; contentUri = MyApp.instance.getIptvclient().buildCatchupStreamURL(MyApp.user,MyApp.pass,mStream_id,start_time,duration); playVideo(contentUri); surfaceView.setVisibility(View.VISIBLE); ly_bottom.setVisibility(View.VISIBLE); date_list.setVisibility(View.GONE); epg_list.setVisibility(View.GONE); updateProgressBar(); listTimer(); } }else if(view==date_list){ finish(); } break; } } return super.dispatchKeyEvent(event); } int maxTime; private void listTimer() { maxTime = 10; mTicker = new Runnable() { public void run() { if (maxTime < 1) { if(ly_bottom.getVisibility()==View.VISIBLE){ ly_bottom.setVisibility(View.GONE); } return; } runNextTicker(); } }; mTicker.run(); } private void runNextTicker() { maxTime--; long next = SystemClock.uptimeMillis() + 1000; mHandler.postAtTime(mTicker, next); } @Override protected void onResume() { super.onResume(); if (!is_create) { if (libvlc != null) { releaseMediaPlayer(); surfaceView = null; } surfaceView = (SurfaceView) findViewById(R.id.surface_view); playVideo(contentUri); } else { is_create = false; } } private void playVideo(String path) { releaseMediaPlayer(); WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE); final DisplayMetrics displayMetrics = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(displayMetrics); mVideoHeight = displayMetrics.heightPixels; mVideoWidth = displayMetrics.widthPixels; toggleFullscreen(true); try { // Create LibVLC // TODO: make this more robust, and sync with audio demo ArrayList<String> options = new ArrayList<String>(); //options.add("--subsdec-encoding <encoding>"); options.add("--aout=opensles"); options.add("--audio-time-stretch"); // time stretching options.add("-vvv"); // verbosity options.add("0");//this option is used to show the first subtitle track options.add("--subsdec-encoding"); libvlc = new LibVLC(this, options); mMediaPlayer = new MediaPlayer(libvlc); mMediaPlayer.setEventListener(mPlayerListener); // Seting up video output final IVLCVout vout = mMediaPlayer.getVLCVout(); vout.setVideoView(surfaceView); if (remote_subtitles_surface != null) vout.setSubtitlesView(remote_subtitles_surface); //vout.setSubtitlesView(mSurfaceSubtitles); vout.setWindowSize(mVideoWidth, mVideoHeight); vout.addCallback(this); vout.attachViews(); // vout.setSubtitlesView(tv_subtitle); Media m = new Media(libvlc, Uri.parse(path)); mMediaPlayer.setMedia(m); mMediaPlayer.play(); } catch (Exception e) { Toast.makeText(this, "Error in creating player!", Toast .LENGTH_LONG).show(); } } @Override protected void onUserLeaveHint() { releaseMediaPlayer(); super.onUserLeaveHint(); } private void toggleFullscreen(boolean fullscreen) { WindowManager.LayoutParams attrs = getWindow().getAttributes(); if (fullscreen) { attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; } else { attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; } getWindow().setAttributes(attrs); } @Override public void onDestroy() { super.onDestroy(); SharedPreferences pref = getSharedPreferences("PREF_AUDIO_TRACK", MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); editor.putInt("AUDIO_TRACK", 0); editor.commit(); SharedPreferences pref2 = getSharedPreferences("PREF_SUB_TRACK", MODE_PRIVATE); SharedPreferences.Editor editor1 = pref2.edit(); editor1.putInt("SUB_TRACK", 0); releaseMediaPlayer(); } private void releaseMediaPlayer() { //라이브러리가 없다면 //바로 종료 if (libvlc == null) return; if (mMediaPlayer != null) { //플레이 중지 mMediaPlayer.stop(); final IVLCVout vout = mMediaPlayer.getVLCVout(); //콜백함수 제거 vout.removeCallback(this); //연결된 뷰 분리 vout.detachViews(); } libvlc.release(); libvlc = null; mVideoWidth = 0; mVideoHeight = 0; } private MediaPlayer.EventListener mPlayerListener = new MediaPlayerListener(this); private static class MediaPlayerListener implements MediaPlayer.EventListener { private WeakReference<GuideActivity> mOwner; public MediaPlayerListener(GuideActivity owner) { mOwner = new WeakReference<GuideActivity>(owner); } @Override public void onEvent(MediaPlayer.Event event) { GuideActivity player = mOwner.get(); switch (event.type) { case MediaPlayer.Event.EndReached: //동영상 끝까지 재생되었다면.. player.releaseMediaPlayer(); player.is_create = false; player.onResume(); break; case MediaPlayer.Event.Playing: // Toast.makeText(player, "Playing", Toast.LENGTH_SHORT).show(); break; case MediaPlayer.Event.Paused: case MediaPlayer.Event.Stopped: // Toast.makeText(player, "Stop", Toast.LENGTH_SHORT).show(); break; case MediaPlayer.Event.Buffering: // Toast.makeText(player, "Buffering", Toast.LENGTH_SHORT).show(); break; case MediaPlayer.Event.EncounteredError: player.releaseMediaPlayer(); // Toast.makeText(player, "Error", Toast.LENGTH_SHORT).show(); player.def_lay.setVisibility(View.VISIBLE); break; //아래 두 이벤트는 계속 발생됨 case MediaPlayer.Event.TimeChanged: //재생 시간 변화시 break; case MediaPlayer.Event.PositionChanged: //동영상 재생 구간 변화시 //Log.d(TAG, "PositionChanged"); break; default: break; } } } public void updateProgressBar() { mHandler.postDelayed(mUpdateTimeTask, 100); } private Runnable mUpdateTimeTask = new Runnable() { public void run() { if (mMediaPlayer != null) { if (traks == null && subtraks == null) { first = false; traks = mMediaPlayer.getAudioTracks(); subtraks = mMediaPlayer.getSpuTracks(); } long totalDuration = System.currentTimeMillis(); if(map.get(date_datas.get(date_pos))!=null && map.get(date_datas.get(date_pos)).size()>0){ txt_date.setText(Constants.epg_format.format(new Date())); int pass_min = (int) ((totalDuration - current_time)/(1000*60)); int remain_min = (int)((map.get(date_datas.get(date_pos)).get(selected_num).getEndTime().getTime()-map.get(date_datas.get(date_pos)).get(selected_num).getStartTime().getTime())/60/1000) - pass_min; int progress = pass_min * 100/(pass_min+remain_min); seekbar.setProgress(progress); txt_time_passed.setText("Started " + pass_min +" mins ago"); txt_remain_time.setText("+"+remain_min+"min"); txt_last_time.setText(getFromDate1(current_time + map.get(date_datas.get(date_pos)).get(selected_num).getDuration()*1000)); txt_dec.setText(map.get(date_datas.get(date_pos)).get(selected_num).getDec()); txt_title.setText(map.get(date_datas.get(date_pos)).get(selected_num).getTitle()); channel_title.setText(channel_name); txt_current_dec.setText(map.get(date_datas.get(date_pos)).get(selected_num).getTitle()); try { txt_next_dec.setText(map.get(date_datas.get(date_pos)).get(selected_num+1).getTitle()); }catch (Exception e){ txt_next_dec.setText("No Information"); } }else { txt_title.setText("No Information"); txt_dec.setText("No Information"); channel_title.setText(channel_name); txt_date.setText(Constants.epg_format.format(new Date())); txt_time_passed.setText(""); txt_remain_time.setText(""); txt_last_time.setText(""); seekbar.setProgress(0); txt_current_dec.setText("No Information"); txt_next_dec.setText("No Information"); } } mHandler.postDelayed(this, 500); } }; private void showAudioTracksList() { AlertDialog.Builder builder = new AlertDialog.Builder(GuideActivity.this); builder.setTitle("Audio track"); ArrayList<String> names = new ArrayList<>(); for (int i = 0; i < traks.length; i++) { names.add(traks[i].name); } String[] audioTracks = names.toArray(new String[0]); SharedPreferences pref = getSharedPreferences("PREF_AUDIO_TRACK", MODE_PRIVATE); int checkedItem = pref.getInt("AUDIO_TRACK", 0); builder.setSingleChoiceItems(audioTracks, checkedItem, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { selected_item = which; } }); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences pref = getSharedPreferences("PREF_AUDIO_TRACK", MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); editor.putInt("AUDIO_TRACK", selected_item); editor.commit(); mMediaPlayer.setAudioTrack(traks[selected_item].id); } }); builder.setNegativeButton("Cancel", null); AlertDialog dialog = builder.create(); dialog.show(); } private void showSubTracksList() { AlertDialog.Builder builder = new AlertDialog.Builder(GuideActivity.this); builder.setTitle("Subtitle"); ArrayList<String> names = new ArrayList<>(); for (int i = 0; i < subtraks.length; i++) { names.add(subtraks[i].name); } String[] audioTracks = names.toArray(new String[0]); SharedPreferences pref = getSharedPreferences("PREF_SUB_TRACK", MODE_PRIVATE); int checkedItem = pref.getInt("SUB_TRACK", 0); builder.setSingleChoiceItems(audioTracks, checkedItem, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { selected_item = which; } }); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences pref = getSharedPreferences("PREF_SUB_TRACK", MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); editor.putInt("SUB_TRACK", selected_item); editor.commit(); mMediaPlayer.setSpuTrack(subtraks[selected_item].id); } }); builder.setNegativeButton("Cancel", null); AlertDialog dialog = builder.create(); dialog.show(); } }
[ "yejong2013@gmail.com" ]
yejong2013@gmail.com
f41800c25850d956c0b110e5873da07af029a8ed
4ccbe571f5ce9e4f9e14eb96fd825352395e69d3
/mmadu-identity/src/main/java/com/mmadu/identity/models/token/TokenRequest.java
006023f9e04b6398496aa16721712e8f9c618d05
[ "MIT" ]
permissive
yudori/mmadu
cefdd4a48a5b04f0a87910c07ca5c29f563e3050
310703d1b21bf2f4a03e6573586fc2aac069572e
refs/heads/master
2022-11-10T16:16:54.678079
2020-06-29T19:44:10
2020-06-29T19:44:10
275,921,054
0
0
MIT
2020-06-29T20:38:59
2020-06-29T20:38:59
null
UTF-8
Java
false
false
364
java
package com.mmadu.identity.models.token; import lombok.Data; import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode public class TokenRequest { private String grant_type; private String code; private String redirect_uri; private String client_id; private String client_secret; private String refresh_token; private String scope; }
[ "noreply@github.com" ]
noreply@github.com
d8b260f494fe36627b29af4dadb7e022ef77b7a9
8a72aee66b4c4e680597c267942002c9db59ff59
/src/test/java/com/example/springreact/Service/Impl/UsuarioServicelTest.java
7a33445db8d3f36716d2ac96666b8c14471d3259
[]
no_license
Caro2019ar/spring-react-minhasFinancas
2269e4494b8f99239b9f1e2f03f68496b14697ae
198445057b7cc7c8e058f0bfc3ef0ef78109ed3f
refs/heads/master
2023-08-28T04:29:25.807812
2021-10-16T21:36:13
2021-10-16T21:36:13
417,612,677
0
0
null
null
null
null
UTF-8
Java
false
false
970
java
package com.example.springreact.Service.Impl; import com.example.springreact.Service.UsuarioService; import com.example.springreact.repository.UsuarioRepository; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; @SpringBootTest @ExtendWith(SpringExtension.class) //está no lugar do RunWith pq a versão do SpringBoot é nova e não uso JUnit4 @ActiveProfiles("test") public class UsuarioServicelTest { @Autowired UsuarioService service; @Autowired UsuarioRepository repository; @Test // isso não aceita: (expected=Test.None.class) public void deveValidarEmail(){ repository.deleteAll(); service.validarEmail("email@email.com"); } }
[ "argente2019@gmail.com" ]
argente2019@gmail.com
f2b01f8859fb538a8effea8d466767fe9f5c1281
c93d61cd6c4545a802f8f48e3cd37c8c1a5d2ba2
/src/main/java/com/example/projectdemo/service/RoleService.java
2f214f0679d155100e9c7c2f88490b3de33fcde1
[]
no_license
ztx-go/projectdemo
c0033259d4f57e37021d99a4e05fcb16bb9af01d
9b686cbf5881e9de881ede1a3377d910b0abd4d5
refs/heads/master
2022-11-28T07:48:34.145423
2020-08-06T16:12:07
2020-08-06T16:12:07
285,615,784
0
0
null
null
null
null
UTF-8
Java
false
false
3,872
java
package com.example.projectdemo.service; import com.example.projectdemo.common.enums.UseStatus; import com.example.projectdemo.entity.RoleEntity; import com.example.projectdemo.entity.UserEntity; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.query.Param; import java.util.List; import java.util.Set; public interface RoleService { /** * 查询指定的功能描述所绑定的角色信息(只包括角色基本信息) * * @param competenceId 功能描述信息 * @return */ List<RoleEntity> findByCompetenceId(String competenceId); /** * 查询指定的部门所绑定的角色信息(指定的用户)(未删除,正常的用户) * * @param userAccount 注意用户名必须完成包括域信息,例如yinwenjie@vanda.com、user@zkx.com * @return */ Set<RoleEntity> findByUserAccount(@Param("userAccount") String userAccount); /** * 查询指定的部门所绑定的角色信息(指定的部门信息) * * @param userAccount 注意部门信息必须完整,例如ou=jiaodao,ou=nianji1 * @return */ Set<RoleEntity> findByOrgs(@Param("orgs") String orgs); /** * 查询符合角色状态的信息 * * @param useStatus * @return */ List<RoleEntity> findByStatus(UseStatus useStatus); /** * 查询指定的角色信息,按照角色的数据层编号查询 * * @param roleId 角色编号 * @return */ RoleEntity findRoleById(String roleId); /** * 通过后台用户id和角色状态查询 角色 * @param id * @param statusNormal * @return */ List<RoleEntity> findByOperatorIdAndStatus(String id, UseStatus statusNormal); /** * 按条件分页搜索 * * @param params * @param pageable * @return */ public Page<RoleEntity> findByConditions(String roleName, UseStatus status, Pageable pageable); /** * 增加角色信息 * * @param role * @return */ RoleEntity addRole(RoleEntity role, UserEntity creatUser); /** * 修改指定角色信息 * * @param role * @return */ RoleEntity updateRole(RoleEntity role, UserEntity modifyUser); /** * 禁用指定角色 * * @param roleId */ RoleEntity disableRole(String roleId); /** * 启用指定角色 * * @param roleId */ RoleEntity enableRole(String roleId); /** * 通过ldap id查询他所拥有的角色信息 * * @param id * @return */ Set<RoleEntity> findLdapRolesById(String id); /** * 形成角色和功能url的绑定关系 * * @param roleId * @param competenceIds */ void bindRoleForCompetences(String roleId, String[] competenceIds); /** * 解除角色和功能url的绑定关系<br> * 该方法将指定的角色,一次解绑多个功能 */ public void unbindRoleForCompetences(String roleId, String[] competenceIds); /** * 形成角色和 ldap的绑定关系 * * @param roleIds * @param ldapNodeId */ void bindRolesForLdapNode(String[] roleIds, String ldapNodeId); /** * 解绑ldap和角色的绑定关系 * * @param roleIds * @param ldapNodeId */ void unbindRolesForLdapNode(String[] roleIds, String ldapNodeId); /** * 查询目前系统中所有的角色信息,无论这些角色信息是否可用(但是只包括角色的基本信息) * * @return */ List<RoleEntity> findAll(); /** * 条件分页查询 * * @param name * @param status * @param pageable * @return */ Page<RoleEntity> getByConditions(String name, UseStatus status, Pageable pageable); /** * 条件查询 * * @param name * @param status * @return */ List<RoleEntity> findByConditions(String name, UseStatus status); RoleEntity findByName(String name); }
[ "1582158644@qq.com" ]
1582158644@qq.com
5d3f97d67a0f2b0b356c62a4faf9cc976a3153f6
2254890a9e5b1956e53920f6eafb069c9ac8dd7b
/app/src/main/java/com/francis/mixedreader/utils/OkHttpUtils.java
063b8abfdbe0e3b473d471137369bf7dc951b717
[]
no_license
francistao/MixedReader
807e017c8fbc4d658109e9efd8f5c0bf7e97f448
95033bac442273bb4bc0cd392f6b1bf34b56748a
refs/heads/master
2021-06-08T00:19:04.802979
2016-10-02T13:26:40
2016-10-02T13:26:40
68,518,002
1
0
null
null
null
null
UTF-8
Java
false
false
5,680
java
package com.francis.mixedreader.utils; import android.os.Handler; import android.os.Looper; import com.google.gson.internal.$Gson$Types; import com.squareup.okhttp.Callback; import com.squareup.okhttp.FormEncodingBuilder; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.Request; import com.squareup.okhttp.RequestBody; import com.squareup.okhttp.Response; import java.io.IOException; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.net.CookieManager; import java.net.CookiePolicy; import java.util.List; import java.util.concurrent.TimeUnit; /** * Description : OkHttp网络连接封装工具类 */ public class OkHttpUtils { private static final String TAG = "OkHttpUtils"; private static OkHttpUtils mInstance; private OkHttpClient mOkHttpClient; private Handler mDelivery; private OkHttpUtils() { mOkHttpClient = new OkHttpClient(); mOkHttpClient.setConnectTimeout(10, TimeUnit.SECONDS); mOkHttpClient.setWriteTimeout(10, TimeUnit.SECONDS); mOkHttpClient.setReadTimeout(30, TimeUnit.SECONDS); //cookie enabled mOkHttpClient.setCookieHandler(new CookieManager(null, CookiePolicy.ACCEPT_ORIGINAL_SERVER)); mDelivery = new Handler(Looper.getMainLooper()); } private synchronized static OkHttpUtils getmInstance() { if (mInstance == null) { mInstance = new OkHttpUtils(); } return mInstance; } private void getRequest(String url, final ResultCallback callback) { final Request request = new Request.Builder().url(url).build(); deliveryResult(callback, request); } private void postRequest(String url, final ResultCallback callback, List<Param> params) { Request request = buildPostRequest(url, params); deliveryResult(callback, request); } private void deliveryResult(final ResultCallback callback, Request request) { mOkHttpClient.newCall(request).enqueue(new Callback() { @Override public void onFailure(Request request, final IOException e) { sendFailCallback(callback, e); } @Override public void onResponse(Response response) throws IOException { try { String str = response.body().string(); if (callback.mType == String.class) { sendSuccessCallBack(callback, str); } else { Object object = JsonUtils.deserialize(str, callback.mType); sendSuccessCallBack(callback, object); } } catch (final Exception e) { sendFailCallback(callback, e); } } }); } private void sendFailCallback(final ResultCallback callback, final Exception e) { mDelivery.post(new Runnable() { @Override public void run() { if (callback != null) { callback.onFailure(e); } } }); } private void sendSuccessCallBack(final ResultCallback callback, final Object obj) { mDelivery.post(new Runnable() { @Override public void run() { if (callback != null) { callback.onSuccess(obj); } } }); } private Request buildPostRequest(String url, List<Param> params) { FormEncodingBuilder builder = new FormEncodingBuilder(); for (Param param : params) { builder.add(param.key, param.value); } RequestBody requestBody = builder.build(); return new Request.Builder().url(url).post(requestBody).build(); } /**********************对外接口************************/ /** * get请求 * @param url 请求url * @param callback 请求回调 */ public static void get(String url, ResultCallback callback) { getmInstance().getRequest(url, callback); } /** * post请求 * @param url 请求url * @param callback 请求回调 * @param params 请求参数 */ public static void post(String url, final ResultCallback callback, List<Param> params) { getmInstance().postRequest(url, callback, params); } /** * http请求回调类,回调方法在UI线程中执行 * @param <T> */ public static abstract class ResultCallback<T> { Type mType; public ResultCallback(){ mType = getSuperclassTypeParameter(getClass()); } static Type getSuperclassTypeParameter(Class<?> subclass) { Type superclass = subclass.getGenericSuperclass(); if (superclass instanceof Class) { throw new RuntimeException("Missing type parameter."); } ParameterizedType parameterized = (ParameterizedType) superclass; return $Gson$Types.canonicalize(parameterized.getActualTypeArguments()[0]); } /** * 请求成功回调 * @param response */ public abstract void onSuccess(T response); /** * 请求失败回调 * @param e */ public abstract void onFailure(Exception e); } /** * post请求参数类 */ public static class Param { String key; String value; public Param() { } public Param(String key, String value) { this.key = key; this.value = value; } } }
[ "geniusvjr@gmail.com" ]
geniusvjr@gmail.com
5ed4a66643cc73221e8bcce90593778d9b11ca0c
f36203a8c00f4210f87f460b72a2fe2f91cfd5c0
/homework-10/src/main/java/com/otus/homework/controller/AuthorController.java
e73d76fd315c2bad2801d3a94867bb93c67e6127
[]
no_license
VasilyevSergey/2020-02-otus-spring-vasilyev
b1dc4ef9988e4746ba23bc1ee362a1a699be8a89
c4a7a0387e4344c91abc732f23a976726ff91a77
refs/heads/master
2022-01-24T07:02:33.374592
2020-08-11T21:30:12
2020-08-11T21:30:12
243,833,412
0
1
null
2022-01-21T23:41:33
2020-02-28T18:55:44
Java
UTF-8
Java
false
false
615
java
package com.otus.homework.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @Controller public class AuthorController { @GetMapping("/") public String listPage(Model model) { String newAuthorName = ""; model.addAttribute("newAuthorName", newAuthorName); return "author/list"; } @GetMapping("/author/edit/{id}") public String editPage(@PathVariable String id) { return "author/edit"; } }
[ "vasilyev.s@rambler.ru" ]
vasilyev.s@rambler.ru
7451317bcb49349d38c3806b7bc80a91d608cc19
42cc559ff869f128dbb238f0d0b080de9b66a1fe
/src/main/java/Word.java
0961dcbab43c7c0413738cc094bf1dcbea70bd59
[]
no_license
iwonmo/quickpca
7bbe4c8b6130d3829bcc08b58082e79c1d57242d
09cb5b7ea397e7d6496b1f08701033d0c3cad0be
refs/heads/master
2022-12-20T15:09:51.384536
2020-09-29T13:13:36
2020-09-29T13:13:36
298,791,191
0
1
null
null
null
null
UTF-8
Java
false
false
1,531
java
/** * 分词 */ import org.wltea.analyzer.core.IKSegmenter; import org.wltea.analyzer.core.Lexeme; import java.io.*; public class Word { public static void main(String[] args) throws IOException { FileReader fr=new FileReader("/Users/wonmo/Desktop/quickpca/支行列表.txt"); BufferedReader br=new BufferedReader(fr); String line=""; try { BufferedWriter out = new BufferedWriter(new FileWriter("/Users/wonmo/Desktop/quickpca/支行分词.txt")); while ((line=br.readLine())!=null) { StringReader input = new StringReader(line.trim()); IKSegmenter ikSeg = new IKSegmenter(input, true); // true 用智能分词 ,false细粒度 String t = ""; for (Lexeme lexeme = ikSeg.next(); lexeme != null; lexeme = ikSeg.next()) { String tmp= lexeme.getLexemeText(); if(tmp.indexOf("银行")>-1 || tmp.indexOf("中国")>-1 || tmp.indexOf("支行")>-1 || tmp.indexOf("公司")>-1 || tmp.indexOf("股份有限公司")>-1 || tmp.indexOf("农村")>-1 || tmp.indexOf("信用")>-1 || tmp.equals("路") || tmp.equals("区") || tmp.equals("县")) continue; t = t + tmp +"-"; } input.close(); out.write(t+"\r\n"); } br.close(); fr.close(); out.close(); System.out.println("文件创建成功!"); } catch (IOException e) { } } }
[ "310301286@qq.com" ]
310301286@qq.com
e0da92fa200cc365fe86ddcb41cb246e4e80d5d1
63a10e158010bc1558ebb2633c2c1c248538ede1
/src/com/occm/models/Rank.java
ded5872697478190949e9784fa79dfd670eb647f
[]
no_license
kanet4u/occm
82ea253a8aa40f3bbfe652a064c092c9c8d9525c
fc77e4a2af831dd08036d0a6e7c21cdd03d724e8
refs/heads/master
2021-01-22T01:04:33.052470
2014-01-30T06:47:13
2014-01-30T06:47:13
16,137,311
0
0
null
null
null
null
UTF-8
Java
false
false
2,188
java
package com.occm.models; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.NotNull; @Entity @Table(name = "ranks") public class Rank { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; @NotNull private String data; @NotNull private double total; @NotNull private int rank; @NotNull @ManyToOne(cascade=CascadeType.ALL) @JoinColumn(name="competition_id") private Competition competition; @NotNull @ManyToOne(cascade=CascadeType.ALL) @JoinColumn(name="user_id") private User user; @NotNull private Date updated; public Rank() { super(); } public Rank(Long id, String data, double total, int rank, Competition competition, User user, Date updated) { super(); this.id = id; this.data = data; this.total = total; this.rank = rank; this.competition = competition; this.user = user; this.updated = updated; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getData() { return data; } public void setData(String data) { this.data = data; } public double getTotal() { return total; } public void setTotal(double total) { this.total = total; } public int getRank() { return rank; } public void setRank(int rank) { this.rank = rank; } public Competition getCompetition() { return competition; } public void setCompetition(Competition competition) { this.competition = competition; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Date getUpdated() { return updated; } public void setUpdated(Date updated) { this.updated = updated; } @Override public String toString() { return "\nRank [id=" + id + ", data=" + data + ", total=" + total + ", rank=" + rank + ", competition=" + competition + ", user=" + user + ", updated=" + updated + "]"; } }
[ "vivekyadav.jit@gmail.com" ]
vivekyadav.jit@gmail.com
fad993e3556d4aabfd6d8d3e1ce1f822e4942410
df0043572a6eeaf350adffc962fa8ee1604d2941
/src/leetcode/problems/_476_NumberComplement.java
cdc15b8426e995ab3ad37e9b1675c4283211f4bd
[]
no_license
engnaruto/Problem-Solving-Practice
27fb7a594d80b71b07d7d7860e61817a91dcbe08
9d455f45d04726b2ba2d734ec9d4f400e4523371
refs/heads/master
2022-05-15T08:29:40.597583
2022-04-17T14:06:46
2022-04-17T14:06:46
118,734,838
0
0
null
null
null
null
UTF-8
Java
false
false
1,801
java
/* Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given integer is guaranteed to fit within the range of a 32-bit signed integer. You could assume no leading zero bit in the integer’s binary representation. Example 1: Input: 5 Output: 2 Explanation: The binary representation of 5 is 101 (no leading zero bits), and its complement is 010. So you need to output 2. Example 2: Input: 1 Output: 0 Explanation: The binary representation of 1 is 1 (no leading zero bits), and its complement is 0. So you need to output 0. */ public class _476_NumberComplement { /* Note: Nice trick in this solution: https://leetcode.com/problems/number-complement/discuss/95992/Java-1-line-bit-manipulation-solution Time: O(N) Memory: O(1) */ public static int findComplementInOneLine(int num) { return ~num & (Integer.highestOneBit(num) - 1); } /* Time: O(N) Memory: O(1) */ public static int findComplement(int num) { if (num == 0) { return 1; } int complement = 0; int numm = num; int i = 0; while (numm != 0) { i++; numm >>= 1; } while (i != 0) { i--; int bit = num & (1 << i); if (bit == 0) { complement |= (1 << i); } } return complement; } public static void main(String[] args) { int[] tests = {5, 7, 1, 10, 17}; for (int test : tests) { System.out.println(findComplement(test)); System.out.println(findComplementInOneLine(test)); } } }
[ "csedtarek@gmail.com" ]
csedtarek@gmail.com
f503de10b78ef690050778f75a9f4b49c6cd307b
525a5a51dbff5e62564cc373abd8577eebe1f36e
/Lab4/src/test/java/com/sd/security/Lab4/Lab4ApplicationTests.java
02b248c43825a7fe1371eea16a08a662f57cf8b0
[]
no_license
sahil-diwan/Spring-Security-Java-Brains
9b496d14210c81c7776f97881f5c163267112e2a
fc65aba8c3c006609bb9dd689b7a9119def2fdcd
refs/heads/master
2022-11-02T04:50:42.096451
2020-06-17T13:06:11
2020-06-17T13:06:11
272,113,639
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package com.sd.security.Lab4; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class Lab4ApplicationTests { @Test void contextLoads() { } }
[ "isahildiwan101@gmail.com" ]
isahildiwan101@gmail.com
829dfe9d060a7571d3deb85cd84d2774454dea0e
76f226ed6b7da285279e568f0fe21589cc87ed69
/MaximumAppearencInArray.java
e208b006345df6f4937cd970be373335e13068a6
[]
no_license
rohitmishrakvs/String_manipulation
33fe73c4d327787896ef0cc572a16e16c87e7432
4c6568b53fb1c132eaf01a487cbaa789d52c004b
refs/heads/main
2023-01-08T02:51:05.229086
2020-11-09T07:17:57
2020-11-09T07:17:57
311,252,700
0
0
null
null
null
null
UTF-8
Java
false
false
675
java
import java .util.*; class MaximumAppearencInArray{ public static int ElementAppereanceCount(int []arr, int n){ int count=0; for(int i =0;i<arr.length;i++){ if(n==arr[i]){ count++; } } return count; } public static void main(String []args){ Scanner sc = new Scanner(System.in); int size = sc.nextInt(); int max=Integer.MIN_VALUE,element=0; int []arr= new int[size]; for(int i =0;i<size;i++){ arr[i]=sc.nextInt(); } for(int i =0;i<arr.length;i++){ if(max<ElementAppereanceCount(arr,arr[i])){ max=ElementAppereanceCount(arr,arr[i]); element = arr[i]; } } System.out.println(element); } }
[ "noreply@github.com" ]
noreply@github.com
69a74a2e8884809bfbedec74ce73f514421fcef3
274ea1e7417c7f1c09514730f129753f4e144e69
/src/main/java/com/personal/jsonplaceholder/framework/pojo/object/User.java
ad4cdf6f7ea9427dd3d8dbf7884066205daf5257
[ "Apache-2.0" ]
permissive
sukantamaikap/jphrest
65f92622be08116dc7754ef4e7dfb57edc8971ed
ce12362f378158dea92c4b035efd660ab00b3b9b
refs/heads/master
2020-04-20T15:31:28.776094
2019-02-16T09:28:09
2019-02-16T09:28:09
168,932,729
0
0
Apache-2.0
2019-02-16T09:28:09
2019-02-03T10:18:24
Java
UTF-8
Java
false
false
6,172
java
package com.personal.jsonplaceholder.framework.pojo.object; import com.google.gson.annotations.SerializedName; import java.util.Objects; /** * POJO of User */ public final class User { @SerializedName("id") private int id; @SerializedName("name") private String name; @SerializedName("email") private String email; @SerializedName("address") private Address address; @SerializedName("phone") private String phone; @SerializedName("website") private String website; @SerializedName("company") private Company company; public User() { } public int getId() { return id; } public User setId(int id) { this.id = id; return this; } public String getName() { return name; } public User setName(String name) { this.name = name; return this; } public String getEmail() { return email; } public User setEmail(String email) { this.email = email; return this; } public Address getAddress() { return address; } public User setAddress(Address address) { this.address = address; return this; } public String getPhone() { return phone; } public User setPhone(String phone) { this.phone = phone; return this; } public String getWebsite() { return website; } public User setWebsite(String website) { this.website = website; return this; } public Company getCompany() { return company; } public User setCompany(Company company) { this.company = company; return this; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final User user = (User) o; return Objects.equals(getName(), user.getName()) && Objects.equals(getEmail(), user.getEmail()) && Objects.equals(getAddress(), user.getAddress()) && Objects.equals(getPhone(), user.getPhone()) && Objects.equals(getWebsite(), user.getWebsite()) && Objects.equals(getCompany(), user.getCompany()); } @Override public int hashCode() { return Objects .hash(getName(), getEmail(), getAddress(), getPhone(), getWebsite(), getCompany()); } /** * Represents the address of an user */ public static class Address { @SerializedName("street") private String street; @SerializedName("suite") private String suite; @SerializedName("city") private String city; @SerializedName("zipcode") private int zipcode; @SerializedName("geo") private Geo geo; public Address() { } public String getStreet() { return street; } public Address setStreet(String street) { this.street = street; return this; } public String getSuite() { return suite; } public Address setSuite(String suite) { this.suite = suite; return this; } public String getCity() { return city; } public Address setCity(String city) { this.city = city; return this; } public int getZipcode() { return zipcode; } public Address setZipcode(final int zipcode) { this.zipcode = zipcode; return this; } public Geo getGeo() { return geo; } public Address setGeo(Geo geo) { this.geo = geo; return this; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Address)) { return false; } Address address = (Address) o; return getZipcode() == address.getZipcode() && Objects.equals(getStreet(), address.getStreet()) && Objects.equals(getSuite(), address.getSuite()) && Objects.equals(getCity(), address.getCity()) && Objects.equals(getGeo(), address.getGeo()); } @Override public int hashCode() { return Objects.hash(getStreet(), getSuite(), getCity(), getZipcode(), getGeo()); } } /** * Represents the latitude and longitude of an user */ public static class Geo { @SerializedName("lng") private String lng; @SerializedName("lat") private String lat; public Geo() { } public String getLng() { return lng; } public Geo setLng(String lng) { this.lng = lng; return this; } public String getLat() { return lat; } public Geo setLat(String lat) { this.lat = lat; return this; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Geo)) { return false; } Geo geo = (Geo) o; return getLng().equals(geo.getLng()) && getLat().equals(geo.getLat()); } @Override public int hashCode() { return Objects.hash(getLng(), getLat()); } } /** * Represents a company */ public static class Company { @SerializedName("name") private String name; @SerializedName("catchPhrase") private String catchPhrase; @SerializedName("bs") private String bs; public Company() { } public String getName() { return name; } public Company setName(String name) { this.name = name; return this; } public String getCatchPhrase() { return catchPhrase; } public Company setCatchPhrase(String catchPhrase) { this.catchPhrase = catchPhrase; return this; } public String getBs() { return bs; } public Company setBs(String bs) { this.bs = bs; return this; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Company)) { return false; } Company company = (Company) o; return getName().equals(company.getName()) && getCatchPhrase().equals(company.getCatchPhrase()) && getBs().equals(company.getBs()); } @Override public int hashCode() { return Objects.hash(getName(), getCatchPhrase(), getBs()); } } }
[ "sukanta.maikap@gmail.com" ]
sukanta.maikap@gmail.com
5fae6549a693e137be643fc98506404625caca86
539b8e48167fc1dc3020335d60aceca8c5f4fbed
/src/art2.java
f875389049f55979d791d83af2271091068e6158
[]
no_license
Sruthik22/USACO
f515d432ed0471a024d56abf2ef3cf1f9ec8f67a
f0cd5e8560444660e704d43e066e86e084242f8e
refs/heads/master
2023-02-04T11:55:26.309803
2020-12-28T20:20:54
2020-12-28T20:20:54
267,200,730
0
0
null
null
null
null
UTF-8
Java
false
false
2,647
java
// This template code suggested by KT BYTE Computer Science Academy // for use in reading and writing files for USACO problems. // https://content.ktbyte.com/problem.java import java.util.*; import java.io.*; public class art2 { static StreamTokenizer in; static int nextInt() throws IOException { in.nextToken(); return (int) in.nval; } static String next() throws IOException { in.nextToken(); return in.sval; } public static void main(String[] args) throws Exception { in = new StreamTokenizer(new BufferedReader(new FileReader("art2.in"))); PrintWriter out = new PrintWriter(new File("art2.out")); int n = nextInt(); EndPoint[] endPoints = new EndPoint[2 * n]; for (int i = 0; i < 2 * n; i++) { endPoints[i] = new EndPoint(i, -1, false); } for (int i = 0; i < n; i++) { int color = nextInt() - 1; if (color == -1) continue; if (endPoints[color].color == -1) { endPoints[color].index = i; endPoints[color].color = color; endPoints[color].isStart = true; endPoints[color + n].index = i; endPoints[color + n].color = color; } else { endPoints[color + n].index = i; } } Arrays.sort(endPoints); Stack<EndPoint> stack = new Stack<>(); int result = 0; for (EndPoint i : endPoints) { if (i.color == -1) continue; if (i.isStart) { i.depth = stack.size() + 1; stack.push(i); } else { EndPoint top = stack.peek(); if (top.color == i.color) { result = Math.max(result, top.depth); stack.pop(); } else { System.out.println(-1); out.println(-1); out.close(); return; } } } System.out.println(result); out.println(result); out.close(); } static class EndPoint implements Comparable<EndPoint> { int color; int index; boolean isStart; int depth = 0; EndPoint(int index, int color, boolean isStart) { this.index = index; this.isStart = isStart; this.color = color; } @Override public int compareTo(EndPoint o) { return this.index - o.index; } } }
[ "sruthi.kurada1@gmail.com" ]
sruthi.kurada1@gmail.com
22f986aa184665ffcee3f61f1d8a7d34c428debe
f0481896faeafb2e3680259e1e23f323b6bcf534
/src/assign_2_/User.java
1a7916e178052af1bb39565e7f299fdf3cb25d85
[]
no_license
def98/hardwareStore
d1991a8f744874835fd1c2b5bce2637c7ec96748
539eda5ef14aca7dc443e032e19ad09c1c74fbde
refs/heads/master
2023-02-09T12:58:43.447538
2023-01-20T20:04:08
2023-01-20T20:04:08
188,469,558
0
0
null
null
null
null
UTF-8
Java
false
false
879
java
package assign_2_; /** * User class holds information for every type of User, but * is not a type of User in itself. * @author Danielle Fernandez */ import java.io.Serializable; public class User implements Serializable{ private static final long serialVersionUID = 1L; protected int id; protected String firstName; protected String lastName; public void setIdNumber(int i) { id = i; } public void setFirstName(String fn) { firstName = fn; } public void setLastName(String ln) { lastName = ln; } public int getIdNumber() { return id; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } /** * This method displays User info on one line in chart format */ public void display() { System.out.printf("|%6s ", id); System.out.printf("|%13s |", firstName); System.out.printf("%13s |", lastName); } }
[ "noreply@github.com" ]
noreply@github.com
952f20b070bc6f61e558a33e382b1b935d1e037e
38e1e624cd9aaa3a9bb40f48489f587a8e06ba5e
/src/main/java/fi/helsinki/cs/iotlab/sensorconsumer/service/placeholder/SensorConsumerService15.java
741862710c769671c9e1c7924cd8582912e9a81e
[ "Apache-2.0" ]
permissive
uh-cs-iotlab/android-sensor-consumer
028182ef985258ce23a7afbfe98b26c2d66b70aa
863fc9bf4fb923ef651183222c7ce83f380d6678
refs/heads/master
2021-01-13T03:47:18.757445
2016-12-23T13:48:46
2016-12-23T13:48:46
77,227,927
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package fi.helsinki.cs.iotlab.sensorconsumer.service.placeholder; import fi.helsinki.cs.iotlab.sensorconsumer.service.SensorConsumerBaseService; public class SensorConsumerService15 extends SensorConsumerBaseService {}
[ "julien.mineraud@gmail.com" ]
julien.mineraud@gmail.com
44919ee4b0ddc83853b6ebb1fe83c20dd23f5ce8
6616786e793a5e7c5d8189d5736907cf6221e3e0
/yitu-recognition/src/main/java/org/yitu/recognition/vo/FaceFeatureRequest.java
e9fb9f3d8300b2083f92070e09eefb36d2e48f01
[]
no_license
apo-soft/face-recognition
4b0e3410837baaf12719506e9c5a526fa61bc5af
cf243037264781ff0959dd17bf5c7a39889e5699
refs/heads/master
2020-05-21T13:30:31.936989
2018-12-04T09:29:36
2018-12-04T09:29:36
62,300,944
1
2
null
null
null
null
UTF-8
Java
false
false
4,928
java
package org.yitu.recognition.vo; /** * 私有云请求 - 人脸特征抽取请求bean * * @author yujinshui * @createTime 2016年6月30日 下午10:19:43 */ public class FaceFeatureRequest { /****** 必填字段 *******/ private String image_content; private int image_type; /****** 选填字段 *******/ private boolean auto_rotate; private boolean flip_image; private Integer max_faces_allowed; private boolean idcard_ocr; private Integer idcard_ocr_mode; /** * 【必填】入图像(JPG) BASE64编码。JPG编码,图片最大1MB * * @return * @Author yujinshui * @createTime 2016年7月1日 下午1:29:29 */ public String getImage_content() { return image_content; } /** * 【必填】入图像(JPG) BASE64编码。JPG编码,图片最大1MB * * @Author yujinshui * @createTime 2016年7月1日 下午1:35:42 */ public void setImage_content(String image_content) { this.image_content = image_content; } /** * 【必填】输入图像类型 * <p> * 登记照片类型<br> * 证件照= 1<br> * 证件照翻拍= 2<br> * 类证件照= 3<br> * 芯片照= 4<br> * 金融行业水印的证件照(不带横纹的老版网纹照)= 5<br> * 公安行业水印证件照(带横纹的老版网纹照) = 7<br> * 铁丝网水印的证件照(新版网纹照) = 9<br> * 自动类型水印照(能够自动区分金融,公安,铁丝网,正确率99.5%) = 101 * * @return * @Author yujinshui * @createTime 2016年7月1日 下午1:30:50 */ public int getImage_type() { return image_type; } /** * 【必填】输入图像类型 * <p> * 登记照片类型<br> * 证件照= 1<br> * 证件照翻拍= 2<br> * 类证件照= 3<br> * 芯片照= 4<br> * 金融行业水印的证件照(不带横纹的老版网纹照)= 5<br> * 公安行业水印证件照(带横纹的老版网纹照) = 7<br> * 铁丝网水印的证件照(新版网纹照) = 9<br> * 自动类型水印照(能够自动区分金融,公安,铁丝网,正确率99.5%) = 101 * * @Author yujinshui * @createTime 2016年7月1日 下午1:35:29 */ public void setImage_type(int image_type) { this.image_type = image_type; } /** * 是否开启自动动旋 (如果图片存在90,180,270度旋,则开启此选项) <br> * 仅针对非水印照有效 * * @return * @Author yujinshui * @createTime 2016年7月1日 下午5:14:13 */ public boolean isAuto_rotate() { return auto_rotate; } /** * 是否开启自动动旋 (如果图片存在90,180,270度旋,则开启此选项) <br> * 仅针对非水印照有效 * * @param auto_rotate * @Author yujinshui * @createTime 2016年7月1日 下午5:15:36 */ public void setAuto_rotate(boolean auto_rotate) { this.auto_rotate = auto_rotate; } /** * 是否开启镜像 * * @return * @Author yujinshui * @createTime 2016年7月1日 下午5:15:46 */ public boolean isFlip_image() { return flip_image; } /** * 是否开启镜像 * * @param flip_image * @Author yujinshui * @createTime 2016年7月1日 下午5:16:00 */ public void setFlip_image(boolean flip_image) { this.flip_image = flip_image; } /** * 最多抽取人脸特征数(只能1或者2) * * @return * @Author yujinshui * @createTime 2016年7月1日 下午5:16:08 */ public Integer getMax_faces_allowed() { return max_faces_allowed; } /** * 最多抽取人脸特征数(只能1或者2) * * @param max_faces_allowed * @Author yujinshui * @createTime 2016年7月1日 下午5:16:25 */ public void setMax_faces_allowed(Integer max_faces_allowed) { this.max_faces_allowed = max_faces_allowed; } /** * 开启身份证识别,将返回身份证信息(仅在上传翻拍身份证照时有意义【image_type=2】) * * @return * @Author yujinshui * @createTime 2016年7月1日 下午5:17:17 */ public boolean isIdcard_ocr() { return idcard_ocr; } /** * 开启身份证识别,将返回身份证信息(仅在上传翻拍身份证照时有意义【image_type=2 * * @param idcard_ocr * @Author yujinshui * @createTime 2016年7月1日 下午5:18:51 */ public void setIdcard_ocr(boolean idcard_ocr) { this.idcard_ocr = idcard_ocr; } /** * 身份证识别条件 value值如下:<br> * 1:身份证正面识别<br> * 2:身份证背面识别<br> * 3:auto自动区分正面背面 * * @return * @Author yujinshui * @createTime 2016年7月1日 下午5:18:59 */ public Integer getIdcard_ocr_mode() { return idcard_ocr_mode; } /** * 身份证识别条件 value值如下:<br> * 1:身份证正面识别<br> * 2:身份证背面识别<br> * 3:auto自动区分正面背面 * * @param idcard_ocr_mode * @Author yujinshui * @createTime 2016年7月1日 下午5:20:46 */ public void setIdcard_ocr_mode(Integer idcard_ocr_mode) { this.idcard_ocr_mode = idcard_ocr_mode; } }
[ "yujinshui@192.168.1.109" ]
yujinshui@192.168.1.109
82872972923e23d8b5f490095dd0e2fd29b8a7a1
a284a3bb849242963329e7444bbf3b6194f40aba
/app/src/main/java/kr/co/ezinfotech/parkingparking/DB/SearchHistoryDBCtrct.java
d24cf23baf94e1a525f372606081247989670c0d
[]
no_license
rtothecore/ParkingParking_Android
72ceb1eda85e87d0f903491d5824376000a84765
adf794dfc7a588185971697b4507014dbd1c0bae
refs/heads/master
2020-03-29T01:39:22.158719
2019-04-15T02:38:03
2019-04-15T02:38:03
149,399,917
0
0
null
null
null
null
UTF-8
Java
false
false
2,369
java
package kr.co.ezinfotech.parkingparking.DB; /** * Created by hkim on 2018-09-27. */ public class SearchHistoryDBCtrct { private SearchHistoryDBCtrct() {}; public static final String TBL_SEARCH_HISTORY = "SEARCH_HISTORY"; public static final String COL_NO = "NO"; public static final String COL_USER_ID = "USER_ID"; public static final String COL_PLACE_NAME = "PLACE_NAME"; public static final String COL_ADDRESS_NAME = "ADDRESS_NAME"; public static final String COL_ROAD_ADDRESS_NAME = "ROAD_ADDRESS_NAME"; public static final String COL_X = "X"; public static final String COL_Y = "Y"; public static final String SQL_CREATE_TBL = "CREATE TABLE IF NOT EXISTS " + TBL_SEARCH_HISTORY + " " + "(" + COL_NO + " INTEGER PRIMARY KEY AUTOINCREMENT" + ", " + COL_USER_ID + " TEXT NOT NULL" + ", " + COL_PLACE_NAME + " TEXT NOT NULL" + ", " + COL_ADDRESS_NAME + " TEXT NOT NULL" + ", " + COL_ROAD_ADDRESS_NAME + " TEXT NOT NULL" + ", " + COL_X + " TEXT NOT NULL" + ", " + COL_Y + " TEXT NOT NULL" + ")"; public static final String SQL_DROP_TBL = "DROP TABLE IF EXISTS " + TBL_SEARCH_HISTORY; public static final String SQL_SELECT = "SELECT * FROM " + TBL_SEARCH_HISTORY; public static final String SQL_SELECT_ALL_WITH_PLACE_NAME = "SELECT * FROM " + TBL_SEARCH_HISTORY + " WHERE " + COL_PLACE_NAME + "='"; public static final String SQL_SELECT_ALL_WITH_USER_ID = "SELECT * FROM " + TBL_SEARCH_HISTORY + " WHERE " + COL_USER_ID + "='"; public static final String SQL_SELECT_ALL_WITH_NO = "SELECT * FROM " + TBL_SEARCH_HISTORY + " WHERE " + COL_NO + "='"; public static final String SQL_INSERT = "INSERT OR REPLACE INTO " + TBL_SEARCH_HISTORY + " " + "(" + COL_USER_ID + ", " + COL_PLACE_NAME + ", " + COL_ADDRESS_NAME + ", " + COL_ROAD_ADDRESS_NAME + ", " + COL_X + ", " + COL_Y + ") VALUES "; public static final String SQL_DELETE = "DELETE FROM " + TBL_SEARCH_HISTORY; }
[ "chaosymphony@gmail.com" ]
chaosymphony@gmail.com
8d76e872b26f8314782aea4c009c220797f68507
20132ecfbe13bb76ff8587b963a1b218709239ca
/src/main/java/de/telekom/sea/javaChallenge/part5/PersonenSchlangeClass.java
64ea3c01ed45787d97ad8e8cd418b4e144e651ed
[]
no_license
pfranzel/JavaChallenge
10a7c4983115e3d6b38400c5bfc9f02dcaa57a1c
3bde5f0dd979b5755784dff45e77d040eb784f5e
refs/heads/main
2023-05-14T09:12:07.512269
2021-06-03T22:03:25
2021-06-03T22:03:25
373,066,054
0
0
null
2021-06-03T22:03:25
2021-06-02T06:40:14
Java
UTF-8
Java
false
false
3,640
java
package de.telekom.sea.javaChallenge.part5; import java.util.LinkedList; public class PersonenSchlangeClass extends BaseObject implements PersonenSchlange { private int maxParticipants = 8; private LinkedList<Person> personen = new LinkedList<Person>(); /** * Add an object of typ person to the Linked List. If the list is full it will * be noticed by a RuntimeExection * * @param person Object to be be added to the FIFO-List * @return No return value is provided. */ @Override public void add(Person person) { try { if (personen.size() != maxParticipants) { personen.add(person); } else { throw new IndexOutOfBoundsException("List is full!"); } } catch (IndexOutOfBoundsException e) { throw new IndexOutOfBoundsException(); } catch (Exception e) { e.printStackTrace(); } } /** * Head returns the first Element of the List. If the list is empty it will be * noticed by a RuntimeExection * * @param none * @return Object Person / null in case of empty list */ @Override public Person head() { try { if (!empty()) { return personen.getFirst(); } else { throw new IndexOutOfBoundsException("List is empty, no Object returned!"); } } catch (IndexOutOfBoundsException e) { throw new IndexOutOfBoundsException(); } catch (Exception e) { e.printStackTrace(); } return null; } /** * Removes the first Person Object from the list and return exact this element * * @param none * @return Object Person / null in case of empty list */ @Override public Person remove() { try { if (!empty()) { return personen.removeFirst(); } else { throw new IndexOutOfBoundsException("List is empty - cannot remove an item."); } } catch (IndexOutOfBoundsException e) { throw new IndexOutOfBoundsException(); } catch (Exception e) { e.printStackTrace(); } return null; } // Kommentar: // Ich bin mir zugegebenermaßen nicht sicher, worauf Thorsten hinaus möchte. // Als "Randverhalten" liefert die Methode in diesem Fall eine Exception + null. // Hierdurch ist es zumindest grundsätlich gegeben, eine fehlerhafte Ausführung // abzufangen. // Wie die genaue Behandlung des ganzen dann aussieht steht auf einem anderen // Blatt - in diesem Fall sollte es aber erst einmal reichen. /** * Removes all Objects from the list * * @param none * @return none */ @Override public void reset() { try { personen.clear(); } catch (Exception e) { e.printStackTrace(); } } /** * Checks if list is empty. * * @param none * @return true id list is empty / false if list is not empty */ @Override public boolean empty() { try { return personen.isEmpty(); } catch (Exception e) { e.printStackTrace(); } return false; } /** * Searches for the given Object Person in the list. Throws an exception if list * is empty * * @param Object Person * @return int-value of the current position in the list. "0" if list is empty * and "-1" if searched person Object does not exist */ @Override public int search(Person person) { try { if (!empty()) { int i = personen.indexOf(person); if (i == -1) { throw new RuntimeException("No such element/object in the list"); } else { return i + 1; } } else { throw new IndexOutOfBoundsException("List is empty - cannot search for the item."); } } catch (IndexOutOfBoundsException e) { throw new IndexOutOfBoundsException(); } catch (RuntimeException e) { throw new RuntimeException(); } catch (Exception e) { e.printStackTrace(); } return 0; } }
[ "80775775+pfranzel@users.noreply.github.com" ]
80775775+pfranzel@users.noreply.github.com
4627497b526dcc16c141ccb5736713f4df915e2c
44b4604c7ab6caaa40aa6f3bf37eb3d7a16df177
/src/main/java/nl/concipit/webstore/domain/repository/impl/InMemoryOrderRepository.java
120ad7984f736c835f860925c62660b8b3b5f450
[]
no_license
davidcoppens/spring-webstore
f1119159d580c7609d767e48a894204d5eae5a81
1d6d7dc604f5a03d4b46adeada2ed3fb3bcbbf61
refs/heads/master
2021-01-01T05:59:23.376278
2014-08-21T17:10:45
2014-08-21T17:10:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
757
java
package nl.concipit.webstore.domain.repository.impl; import java.util.HashMap; import java.util.Map; import nl.concipit.webstore.domain.Order; import nl.concipit.webstore.domain.repository.OrderRepository; public class InMemoryOrderRepository implements OrderRepository { private Map<Long, Order> listOfOrders; private long nextOrderId; public InMemoryOrderRepository() { listOfOrders = new HashMap<Long, Order>(); nextOrderId = 1000; } @Override public Long saveOrder(Order order) { order.setOrderId(getNextOrderId()); listOfOrders.put(order.getOrderId(), order); return order.getOrderId(); } private synchronized long getNextOrderId() { return nextOrderId++; } }
[ "david@davidcoppens.nl" ]
david@davidcoppens.nl
ce90c2a65fe9e0ffbcd60836d7a6223b9942b93b
b6f6c0e4813e5928bef70d3178f109cbe0996405
/src/main/java/com/datastax/field/examples/geo/service/LocationFinderService.java
f3623503a2c221e99573a922dc165d5ac33dffe5
[]
no_license
phact/geofinder-api
3a3488fdc1b35fac19f3dd1a38fdc226636930fa
55f4e8fd664a9c12bb06b94083da37f558cc152b
refs/heads/master
2021-09-05T16:49:04.616722
2018-01-29T19:01:39
2018-01-29T19:01:39
112,408,359
0
1
null
2017-12-05T16:24:55
2017-11-29T01:06:33
Java
UTF-8
Java
false
false
9,140
java
package com.datastax.field.examples.geo.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; import com.datastax.driver.dse.DseCluster; import com.datastax.driver.dse.DseSession; import com.datastax.driver.dse.geometry.Point; import com.datastax.field.examples.geo.util.CQLUtil; import com.google.common.base.Strings; import com.google.gson.JsonArray; import com.google.gson.JsonObject; @Service public class LocationFinderService { @Autowired private DseCluster dseCluster; @Autowired private DseSession dseSession; /** * the GEO_NAME_SUGGEST_QUERY is not faceting, so the UI takes that into consideration and only displays unique values. * * Another strategy is to use facets but facets can only sorted by count OR alpha-numerically, */ // %s order: name, lon, lat, radius private static String GEO_NAME_SUGGEST_QUERY = "SELECT name from simplegeo.locations where solr_query = '{ \"q\":\"*:*\", \"fq\":\"name_lowercase:*%s* AND geo:\\\"IsWithin(BUFFER(POINT(%s %s), %s))\\\"\"}' LIMIT 50"; /* * simplegeo.locations table schema: * * id text PRIMARY KEY, * address text, * category text, * city text, * geo 'org.apache.cassandra.db.marshal.PointType', * menulink text, * name text, * name_lowercase text, * phone text, * post_code text, * province text, * source text, * subcategory text, * tags list<text>, * type text, * website text */ private static String GEO_NAME_SEARCH_QUERY = "SELECT id, name, address, city, province, post_code, phone, category, subcategory,geo, website, menulink, tags from simplegeo.locations where solr_query = '{ \"q\":\"*:*\", \"fq\":\"name_lowercase:*%s* AND geo:\\\"IsWithin(BUFFER(POINT(%s %s), %s))\\\"\"}' LIMIT 50"; private static final String GEO_FILTER_PIVOT_ON_CATEGORY = "SELECT * FROM simplegeo.locations where solr_query = '{ \"q\":\"*:*\", \"fq\":\"geo:[%s,%s TO %s,%s]\", \"facet\":{ \"pivot\":\"category\",\"limit\":\"-1\",\"mincount\":1,\"sort\":\"count\"}}'"; private static final String GEO_FILTER_PIVOT_ON_CATEGORY_AND_SUBCATEGORY = "SELECT * FROM simplegeo.locations where solr_query = '{ \"q\":\"*:*\", \"fq\":\"geo:[%s,%s TO %s,%s]\", \"facet\":{ \"pivot\":\"category,subcategory\",\"limit\":\"-1\",\"mincount\":1}}'"; private static final String GEO_FILTER_LOCATIONS_ON_CATEGORY = "SELECT * FROM simplegeo.locations where solr_query = '{\"q\":\"*:*\", \"fq\":\"category:(\\\"%s\\\") AND geo:[%s,%s TO %s,%s]\"}' LIMIT %s"; private static final String GEO_FILTER_LOCATIONS_ON_CATEGORY_AND_SUBCATEGORY = "SELECT * FROM simplegeo.locations where solr_query = '{\"q\":\"*:*\", \"fq\":\"category:(\\\"%s\\\") AND subcategory:(\\\"%s\\\") AND geo:[%s,%s TO %s,%s]\"}' LIMIT %s"; /** * for display in the UI */ public String nameSuggestWithPointAndRadiusQuery( String name, double lat, double lng, double radiusInKm ){ double degrees = kilometersToDegrees(radiusInKm, lat); return String.format(GEO_NAME_SUGGEST_QUERY, CQLUtil.cleanseQueryStr(name).toLowerCase(), String.valueOf(lng), String.valueOf(lat), String.valueOf(degrees)); } public JsonArray nameSuggestWithPointAndRadius(String name, double lat, double lng, double radiusInKm){ JsonArray results = new JsonArray(); String query = nameSuggestWithPointAndRadiusQuery(name, lat, lng, radiusInKm); System.out.println(query); ResultSet resultSet = this.dseSession.execute(query); for( Row row: resultSet.all() ){ results.add( row.getString("name") ); } return results; } public String nameSearchWithPointAndRadiusQuery( String name, double lat, double lng, double radiusInKm ){ double degrees = kilometersToDegrees(radiusInKm, lat); return String.format(GEO_NAME_SEARCH_QUERY, CQLUtil.cleanseQueryStr(name).toLowerCase(), String.valueOf(lng), String.valueOf(lat), String.valueOf(degrees)); } public JsonArray nameSearchWithPointAndRadius(String name, double lat, double lng, double radiusInKm){ JsonArray results = new JsonArray(); String query = nameSearchWithPointAndRadiusQuery(name, lat, lng, radiusInKm); System.out.println(query); ResultSet resultSet = this.dseSession.execute(query); for( Row row: resultSet.all() ){ JsonObject locObj = locationRowToJsonObject(row); results.add(locObj); } return results; } public String geoFilterPivotOnCateogoryQuery(double lllat, double lllng, double urlat, double urlng){ return String.format(GEO_FILTER_PIVOT_ON_CATEGORY, lllat, lllng, urlat, urlng); } public String geoFilterPivotOnCateogory(double lllat, double lllng, double urlat, double urlng){ return executePivotQuery( geoFilterPivotOnCateogoryQuery(lllat, lllng, urlat, urlng) ); } public String geoFilterPivotOnCateogoryAndSubcategoryQuery( double lllat, double lllng, double urlat, double urlng ){ return String.format(GEO_FILTER_PIVOT_ON_CATEGORY_AND_SUBCATEGORY, lllat, lllng, urlat, urlng); } public String geoFilterPivotOnCateogoryAndSubCategory(double lllat, double lllng, double urlat, double urlng){ return executePivotQuery( geoFilterPivotOnCateogoryAndSubcategoryQuery(lllat, lllng, urlat, urlng) ); } /** * * @param query the query to execute * @return the JSON string of the pivot (Raw Solr Response) */ public String executePivotQuery( String query ) { ResultSet rs = this.dseSession.execute(query); return rs.all().get(0).getString(0); } private String geoFilterLocationsOnCateogoryQuery( String category, int numRows, double lllat, double lllng, double urlat, double urlng ){ String q = String.format(GEO_FILTER_LOCATIONS_ON_CATEGORY, category.trim(), lllat, lllng, urlat, urlng, numRows); System.out.println("returning query: " + q ); return String.format(GEO_FILTER_LOCATIONS_ON_CATEGORY, category.trim(), lllat, lllng, urlat, urlng, numRows); } private String geoFilterLocationsOnCateogoryAndSubcategoryQuery( String category, String subcategory, int numRows, double lllat, double lllng, double urlat, double urlng ){ return String.format(GEO_FILTER_LOCATIONS_ON_CATEGORY_AND_SUBCATEGORY, category.trim(), subcategory.trim(), lllat, lllng, urlat, urlng, numRows ); } /** * * @param category * @param subcategory * @param numRows Number of locations to return * @param lllat Lower Left Latitude * @param lllng Lower Left Longitude * @param urlat Upper Right Latitude * @param urlng Upper Right Longitude * @return query string */ public String geoFilterLocationsOnCateogoryAndOrSubcategoryQuery( String category, String subcategory, int numRows, double lllat, double lllng, double urlat, double urlng ){ // if subcategory is NOT null, return the category AND subcateogry query // else return only the category query. if( Strings.isNullOrEmpty(subcategory) ){ return geoFilterLocationsOnCateogoryQuery(category, numRows, lllat, lllng, urlat, urlng); } else { return geoFilterLocationsOnCateogoryAndSubcategoryQuery( category, subcategory, numRows, lllat, lllng, urlat, urlng); } } public JsonArray geoFilterLocationsOnCateogoryAndOrSubcategory( String category, String subcategory, int numRows, double lllat, double lllng, double urlat, double urlng ){ JsonArray results = new JsonArray(); String query = geoFilterLocationsOnCateogoryAndOrSubcategoryQuery(category, subcategory, numRows, lllat, lllng, urlat, urlng); System.out.println(query); ResultSet resultSet = this.dseSession.execute(query); for( Row row: resultSet.all() ){ JsonObject locObj = locationRowToJsonObject(row); results.add(locObj); } return results; } private JsonObject locationRowToJsonObject( Row row ){ JsonObject locObj = new JsonObject(); locObj.addProperty("id", row.getString("id")); locObj.addProperty("name", row.getString("name")); locObj.addProperty("address", row.getString("address")); locObj.addProperty("city", row.getString("city")); locObj.addProperty("province", row.getString("province")); locObj.addProperty("phone", row.getString("phone")); locObj.addProperty("post_code", row.getString("post_code")); locObj.addProperty("category", row.getString("category")); locObj.addProperty("subcategory", row.getString("subcategory")); locObj.addProperty("website", row.getString("website")); locObj.addProperty("menulink", row.getString("menulink")); Point geo = (Point)row.getObject("geo"); JsonObject geoObj = new JsonObject(); geoObj.addProperty("lng", geo.X()); geoObj.addProperty("lat", geo.Y()); locObj.add("geo", geoObj); return locObj; } private static double kilometersToDegrees( double radiusInKm, double lat ) { double oneDegreeInKilometers = 111.13295 - 0.55982 * Math.cos(2 * lat) + 0.00117 * Math.cos(4 * lat); return (1 / oneDegreeInKilometers) * radiusInKm; } }
[ "payampayandeh@gmail.com" ]
payampayandeh@gmail.com
128797455893f9527b04483c6fd5547225a3d300
e34ef9b62637927b82533c7100b8b8447aa38c68
/src/main/java/ItemFactory.java
e1ee56557ed13bbe43f7d15c20e4f635957f0f88
[]
no_license
darongmean/GildedRose
6e490d804c8992275bbd139ce09335a6de7c2f81
6281b717c46ee47bc72b81d80193b90a17f0976f
refs/heads/master
2021-01-20T13:43:00.315016
2017-05-15T11:24:52
2017-05-15T11:24:52
90,516,834
0
0
null
2017-05-07T07:44:12
2017-05-07T07:44:12
null
UTF-8
Java
false
false
1,392
java
/** * Created by darong on 5/14/17. */ public class ItemFactory { public static AbstractItem createItem(String name, int sellIn, int quality) { if ("Aged Brie".equals(name)) { return new AgedBrieItem("Aged Brie", sellIn, quality); } if ("Backstage passes to a TAFKAL80ETC concert".equals(name)) { return new BackstagePassesItem("Backstage passes to a TAFKAL80ETC concert", sellIn, quality); } if ("Sulfuras, Hand of Ragnaros".equals(name)) { return new SulfurasItem("Sulfuras, Hand of Ragnaros", sellIn, 80); } if("Conjured Mana Cake".equals(name)){ return new ConjuredItem("Conjured Mana Cake", sellIn, quality); } return new NormalItem(name, sellIn, quality); } public static AbstractItem createAgedBrie(int sellIn, int quality) { return createItem("Aged Brie", sellIn, quality); } public static AbstractItem createSulfuras(int sellIn) { return createItem("Sulfuras, Hand of Ragnaros", sellIn, 80); } public static AbstractItem createBackstagePasses(int sellIn, int quality) { return createItem("Backstage passes to a TAFKAL80ETC concert", sellIn, quality); } public static AbstractItem createConjured(int sellIn, int quality) { return createItem("Conjured Mana Cake", sellIn, quality); } }
[ "darong012@gmail.com" ]
darong012@gmail.com
1bcab8fdd9b061376a7dfb6f7e22088d96e135d9
af07e56e87842ba7c05881efeadddf3be4a84982
/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhasePipeFlowSolver.java
e96a9143ee4978d24078b4183c301f0afda66248
[ "Apache-2.0" ]
permissive
EvenSol/neqsim
2df72c763ed59e14278774a58092b2a74fcbb78e
d81df26b2937d4a6665e3c28626721aa55667a51
refs/heads/master
2023-05-10T21:30:36.989015
2020-05-14T11:38:28
2020-05-14T11:38:28
185,164,800
0
0
Apache-2.0
2020-03-17T17:26:47
2019-05-06T09:23:21
Java
UTF-8
Java
false
false
2,073
java
/* * OnePhasePipeFlowSolver.java * * Created on 17. januar 2001, 21:05 */ package neqsim.fluidMechanics.flowSolver.onePhaseFlowSolver.onePhasePipeFlowSolver; import Jama.*; import neqsim.fluidMechanics.flowSystem.onePhaseFlowSystem.pipeFlowSystem.PipeFlowSystem; /** * * @author Even Solbraa * @version */ public class OnePhasePipeFlowSolver extends neqsim.fluidMechanics.flowSolver.onePhaseFlowSolver.OnePhaseFlowSolver { private static final long serialVersionUID = 1000; protected double[] PbArray; // = new double[100]; protected Matrix solMatrix; protected Matrix sol2Matrix; protected Matrix sol3Matrix; protected Matrix[] sol4Matrix; protected double a[]; protected double b[]; protected double c[]; protected double r[]; protected double length; protected PipeFlowSystem pipe; /** Creates new OnePhasePipeFlowSolver */ public OnePhasePipeFlowSolver() { } public OnePhasePipeFlowSolver(PipeFlowSystem pipe, double length, int nodes) { this.pipe = pipe; this.length = length; this.numberOfNodes=nodes; PbArray = new double[nodes]; solMatrix = new Matrix(PbArray,1).transpose(); sol2Matrix = new Matrix(PbArray,1).transpose(); sol3Matrix = new Matrix(PbArray,1).transpose(); sol4Matrix = new Matrix[pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents()]; for(int k=0;k<pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents();k++){ sol4Matrix[k] = new Matrix(PbArray,1).transpose(); } a = new double[nodes]; b = new double[nodes]; c = new double[nodes]; r = new double[nodes]; } public Object clone(){ OnePhasePipeFlowSolver clonedSystem = null; try{ clonedSystem = (OnePhasePipeFlowSolver) super.clone(); } catch(Exception e) { e.printStackTrace(System.err); } return clonedSystem; } }
[ "mllu@equinor.com" ]
mllu@equinor.com
6167d7462e994d273575522772d3626e8a41f01f
c3a0cdfef0d506548d3cf04e718655638a4034e7
/SpringFundamentals/auth/src/main/java/com/Tamara/auth/models/Friendship.java
77586f6345ef6aa37c9a36c17b5281e0fd1ace1d
[]
no_license
Tamara-Adeeb/java_stack
333b475156689adadc3e4d78269051fe13085aa6
f6bd7d225c3b8ca9521142a140dcd97da6dd5fc2
refs/heads/master
2023-06-11T01:11:57.662302
2021-07-03T19:03:41
2021-07-03T19:03:41
376,281,195
0
0
null
null
null
null
UTF-8
Java
false
false
1,229
java
package com.Tamara.auth.models; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.validation.constraints.NotNull; import org.springframework.format.annotation.DateTimeFormat; @Entity @Table(name="friendships") public class Friendship { @Id @GeneratedValue private Long id; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="user_id") private User user; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="friend_id") private User friend; @NotNull private boolean request; @NotNull private boolean accept; @Column(updatable=false) @DateTimeFormat(pattern="yyyy-MM-dd") private Date createdAt; @DateTimeFormat(pattern="yyyy-MM-dd") private Date updatedAt; @PrePersist protected void onCreate(){ this.createdAt = new Date(); } @PreUpdate protected void onUpdate(){ this.updatedAt = new Date(); } }
[ "tamara.adeeb1@gmail.com" ]
tamara.adeeb1@gmail.com
7720be9cc6ffd7c71c43e69b03d06a18371a6aa3
4bbbe4fec69937c43e54c86ed3d6f610e78228e9
/server/src/test/java/org/cloudfoundry/autoscaler/rest/ScalingHistoryRestApiTest.java
592b67e05037fbde4a574a8e72d5c75300962464
[ "Apache-2.0" ]
permissive
cfibmers/open-Autoscaler
6ef0ca3cf4259a8ed51a8ad862b255955ef482a5
b135e7c47c852df45657b4cd9477c86634f1c471
refs/heads/master
2020-04-06T13:28:44.866510
2016-11-23T15:31:14
2016-11-23T15:31:14
52,853,557
20
8
null
2016-10-13T02:25:41
2016-03-01T06:24:27
Java
UTF-8
Java
false
false
2,336
java
package org.cloudfoundry.autoscaler.rest; import static org.cloudfoundry.autoscaler.test.constant.Constants.*; import static org.junit.Assert.assertEquals; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import org.cloudfoundry.autoscaler.rest.mock.couchdb.CouchDBDocumentManager; import org.json.JSONArray; import org.json.JSONObject; import org.junit.AfterClass; import org.junit.Test; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.core.util.MultivaluedMapImpl; import com.sun.jersey.test.framework.JerseyTest; public class ScalingHistoryRestApiTest extends JerseyTest{ public ScalingHistoryRestApiTest() throws Exception{ super("org.cloudfoundry.autoscaler.rest"); } @Override public void tearDown() throws Exception{ super.tearDown(); CouchDBDocumentManager.getInstance().initDocuments(); } @Test public void testGetHistoryList(){ WebResource webResource = resource(); MultivaluedMap<String, String> paramMap = new MultivaluedMapImpl(); paramMap.add("appId", TESTAPPID); paramMap.add("startTime", String.valueOf(0)); paramMap.add("endTime", String.valueOf(System.currentTimeMillis() * 2)); paramMap.add("status", "3"); paramMap.add("scaleType", "scaleIn"); ClientResponse response = webResource.path("/history").queryParams(paramMap).type(MediaType.APPLICATION_JSON).get(ClientResponse.class); String jsonStr = response.getEntity(String.class); JSONArray ja = new JSONArray(jsonStr); assertEquals(ja.length(), 1); assertEquals(response.getStatus(), STATUS200); } @Test public void testGetHistoryCount(){ WebResource webResource = resource(); MultivaluedMap<String, String> paramMap = new MultivaluedMapImpl(); paramMap.add("appId", TESTAPPID); paramMap.add("startTime", String.valueOf(0)); paramMap.add("endTime", String.valueOf(System.currentTimeMillis() * 2)); paramMap.add("status", "3"); paramMap.add("scaleType", "scaleIn"); ClientResponse response = webResource.path("/history/count").queryParams(paramMap).type(MediaType.APPLICATION_JSON).get(ClientResponse.class); String jsonStr = response.getEntity(String.class); JSONObject jo = new JSONObject(jsonStr); assertEquals(jo.get("count"),1); assertEquals(response.getStatus(), STATUS200); } }
[ "qiyangbj@cn.ibm.com" ]
qiyangbj@cn.ibm.com
f6022c20232c2298099e7473bacb7c82b1218064
4ac5d0919561369faeed24a6fc7a77272a6c00c7
/src/model/entities/Person.java
325bd7b87485032e7f0e3915fa55e046981fb418
[]
no_license
EversonBorges/JavaFX
e17e1b6fc46c79097d75f095a3838fc92d3eba4b
e563ebfca74ac19296bffc932e0bc7ff410343ff
refs/heads/master
2022-11-05T12:02:51.533849
2020-06-18T22:50:09
2020-06-18T22:50:09
272,287,459
0
0
null
null
null
null
UTF-8
Java
false
false
789
java
package model.entities; import java.io.Serializable; public class Person implements Serializable{ private static final long serialVersionUID = 1L; private Long id; private String name; private String email; public Person() { } public Person(Long id, String name, String email) { this.id = id; this.name = name; this.email = email; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public String toString() { return "Person [id=" + id + ", name=" + name + ", email=" + email + "]"; } }
[ "everson.cursos@gmail.com" ]
everson.cursos@gmail.com
bdc6aeccf5ddeb9cf1be1954edc27ce1da84a56d
5fac3c7edd4edd696a92988aaf66cdfccfe78051
/avaluosJpa/src/com/segurosbolivar/avaluos/entities/ComplementosExcel.java
8a98e9ba2d901c6eee0b5a5daac4f2b628e11be0
[]
no_license
weimar-avendano/Avaluos
2ff0c3b70f367a4f28902c7c1c18c1162a056b04
71ab74c0a0736e251e7a08423daaccf95577f5ab
refs/heads/master
2022-02-09T23:17:55.521659
2016-10-07T22:26:49
2016-10-07T22:26:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,854
java
package com.segurosbolivar.avaluos.entities; import java.io.Serializable; import javax.persistence.*; import java.math.BigDecimal; import java.util.Date; import static org.eclipse.persistence.annotations.CacheType.NONE; /** * The persistent class for the PGB_COMPLEMENTOS_EXCEL database table. * */ @Entity @Table(name="PGB_COMPLEMENTOS_EXCEL") @NamedQuery(name = "getComplementos", query = "select c from ComplementosExcel c") @org.eclipse.persistence.annotations.Cache(type = NONE, alwaysRefresh = true, refreshOnlyIfNewer = true) public class ComplementosExcel implements Serializable { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name="PGB_COMPLEMENTOS_EXCEL_IDCOMPLEMENTOEXCEL_GENERATOR", sequenceName="SEQ_PGB_COMPLEMENTOS_EXCEL" ,allocationSize= 1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="PGB_COMPLEMENTOS_EXCEL_IDCOMPLEMENTOEXCEL_GENERATOR") @Column(name="ID_COMPLEMENTO_EXCEL") private BigDecimal idComplementoExcel; @Temporal( TemporalType.TIMESTAMP) @Column(name="FECHA_CREACION") private Date fechaCreacion; @Temporal( TemporalType.TIMESTAMP) @Column(name="FECHA_TRANSACCION") private Date fechaTransaccion; @Column(name="USUARIO_CREACION") private String usuarioCreacion; @Column(name="USUARIO_TRANSACCION") private String usuarioTransaccion; @Column(name="DESCRIPCION_COMPLEMENTO") private String descripcionComplemento; //uni-directional many-to-one association to Archivo @ManyToOne @JoinColumn(name="ID_ARCHIVO") private Archivo archivo; public ComplementosExcel() { } public BigDecimal getIdComplementoExcel() { return this.idComplementoExcel; } public void setIdComplementoExcel(BigDecimal idComplementoExcel) { this.idComplementoExcel = idComplementoExcel; } public Date getFechaCreacion() { return this.fechaCreacion; } public void setFechaCreacion(Date fechaCreacion) { this.fechaCreacion = fechaCreacion; } public Date getFechaTransaccion() { return this.fechaTransaccion; } public void setFechaTransaccion(Date fechaTransaccion) { this.fechaTransaccion = fechaTransaccion; } public String getUsuarioCreacion() { return this.usuarioCreacion; } public void setUsuarioCreacion(String usuarioCreacion) { this.usuarioCreacion = usuarioCreacion; } public String getUsuarioTransaccion() { return this.usuarioTransaccion; } public void setUsuarioTransaccion(String usuarioTransaccion) { this.usuarioTransaccion = usuarioTransaccion; } public Archivo getArchivo() { return this.archivo; } public void setArchivo(Archivo archivo) { this.archivo = archivo; } public String getDescripcionComplemento() { return descripcionComplemento; } public void setDescripcionComplemento(String descripcionComplemento) { this.descripcionComplemento = descripcionComplemento; } }
[ "deivnino@gmail.com" ]
deivnino@gmail.com
fbf622920295b7706f3a97f8aa8f22d7bb2db3db
9240dc9b6fb9649fbb5cdaeb1240c7a33906489a
/src/ListasAux/Evaluar.java
2f2e5eb9882335292bd957a85197d2daf639089a
[]
no_license
leobar37/estructuras-trabajo
2b7d64ed5b04854459f779f8071a3aff539425b1
76be15f29ba416228aa7b571e265f72bf40afccc
refs/heads/master
2022-11-21T00:31:05.280274
2020-07-13T23:53:32
2020-07-13T23:53:32
277,130,975
0
0
null
2020-07-12T01:18:19
2020-07-04T14:58:22
Java
UTF-8
Java
false
false
295
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 ListasAux; public interface Evaluar { public abstract int evaluar(Object dato,Object dato2); }
[ "leonardito3458@gmail.com" ]
leonardito3458@gmail.com
a2bca410ece1dbbcfb87ed71ccf004f0c5dc773e
920560bb06cf782fae6616e5d74e20d823aa8949
/app/src/main/java/com/bp/workmanager/MainActivity.java
a6c68e0d9b737d7ee691f5e5ab9de60d6eab0efa
[]
no_license
pahlavan111/Work_Manager
4e4abc38c118b9679ae9fabc026288f9609cc294
c2deee2ab4a99f1b4a4cf2c682b0585a24cdaaba
refs/heads/master
2022-11-14T12:37:23.131769
2020-06-29T22:08:45
2020-06-29T22:08:45
275,514,565
0
0
null
null
null
null
UTF-8
Java
false
false
1,615
java
package com.bp.workmanager; import androidx.appcompat.app.AppCompatActivity; import androidx.lifecycle.Observer; import androidx.work.OneTimeWorkRequest; import androidx.work.WorkInfo; import androidx.work.WorkManager; import androidx.work.impl.WorkerWrapper; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final OneTimeWorkRequest request = new OneTimeWorkRequest.Builder(MyWorker.class).build(); findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { WorkManager.getInstance(getApplicationContext()).enqueue(request); } }); WorkManager.getInstance(getApplicationContext()).getWorkInfoByIdLiveData(request.getId()).observe(this, new Observer<WorkInfo>() { @Override public void onChanged(WorkInfo workInfo) { String data = workInfo.getState().name(); Toast.makeText(MainActivity.this, data, Toast.LENGTH_SHORT).show(); } }); findViewById(R.id.btn_pass_data).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this,ActivityPassData.class)); } }); } }
[ "pahlavan111@gmail.com" ]
pahlavan111@gmail.com
1be83f95ee7b698591186757901f85ebf7c526b6
6665f2aa33d8147e4525e3acbbd769063855228e
/lzccommon/src/main/java/com/njcool/lzccommon/view/photopick/demo/RecyclerItemClickListener.java
dcfbbf454562fbeab6f8c379af71c68469904285
[]
no_license
lizhichuan/LizcProject
8ccac70dcc9732e4477ded0537b77713198cd678
5b01c0e7a4fc55801df27139684bb41fed33a2eb
refs/heads/master
2020-04-30T21:52:00.519773
2019-03-22T08:51:44
2019-03-22T08:51:44
177,104,506
1
0
null
null
null
null
UTF-8
Java
false
false
1,438
java
package com.njcool.lzccommon.view.photopick.demo; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener { private OnItemClickListener mListener; public interface OnItemClickListener { void onItemClick(View view, int position); } GestureDetector mGestureDetector; public RecyclerItemClickListener(Context context, OnItemClickListener listener) { mListener = listener; mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { return true; } }); } @Override public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { View childView = view.findChildViewUnder(e.getX(), e.getY()); if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { mListener.onItemClick(childView, view.getChildLayoutPosition(childView)); return true; } return false; } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } }
[ "524003992@qq.com" ]
524003992@qq.com
de69301887f92d4fa1d7c0317395bdf2c6c7218c
3a921d7ed67a3b903786cd325cc3bb3a51c61dd6
/app/src/main/java/com/dsc/android/bootcamp1/RecyclerViewdata.java
c9df5ece60aeb64b16262f70aa0bb20647553e8c
[]
no_license
Shashank-sama/bootcamp-1
4c98836d08b3557ea103a71e76097da19108842f
20067d8c7ee40208ea165c1753178f49444553c5
refs/heads/master
2020-04-27T20:16:57.134064
2019-03-10T12:04:13
2019-03-10T12:04:13
174,652,129
0
0
null
null
null
null
UTF-8
Java
false
false
833
java
package com.dsc.android.bootcamp1; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class RecyclerViewdata implements Serializable { @SerializedName("name") @Expose private String name; @SerializedName("number") @Expose private String number; @SerializedName("image") @Expose private String image; public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } }
[ "mishra1999shashank@gmail.com" ]
mishra1999shashank@gmail.com
2fbc7502b8ab77f39e9bfc7a7380572c397a532e
17d734b053085b279ec4ee1c92498589fe529bef
/libs/src/main/java/com/google/gson1/internal/bind/JsonAdapterAnnotationTypeAdapterFactory.java
d73a6b898587a73f3462aa629fc1c672604aada7
[]
no_license
fyc/HWSDK2
f1b1ca0e007712433931484ee44778e22edddddd
a08463652534b12329f5dc5d48e43de05fc76c9f
refs/heads/master
2020-04-02T17:29:40.654071
2018-11-29T03:07:49
2018-11-29T03:07:49
154,659,600
0
0
null
null
null
null
UTF-8
Java
false
false
2,670
java
/* * Copyright (C) 2014 Google 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.google.gson1.internal.bind; import com.google.gson1.Gson; import com.google.gson1.TypeAdapter; import com.google.gson1.TypeAdapterFactory; import com.google.gson1.annotations.JsonAdapter; import com.google.gson1.internal.ConstructorConstructor; import com.google.gson1.reflect.TypeToken; /** * Given a type T, looks for the annotation {@link JsonAdapter} and uses an instance of the * specified class as the default type adapter. * * @since 2.3 */ public final class JsonAdapterAnnotationTypeAdapterFactory implements TypeAdapterFactory { private final ConstructorConstructor constructorConstructor; public JsonAdapterAnnotationTypeAdapterFactory(ConstructorConstructor constructorConstructor) { this.constructorConstructor = constructorConstructor; } @SuppressWarnings("unchecked") public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> targetType) { JsonAdapter annotation = targetType.getRawType().getAnnotation(JsonAdapter.class); if (annotation == null) { return null; } return (TypeAdapter<T>) getTypeAdapter(constructorConstructor, gson, targetType, annotation); } @SuppressWarnings("unchecked") // Casts guarded by conditionals. static TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor, Gson gson, TypeToken<?> fieldType, JsonAdapter annotation) { Class<?> value = annotation.value(); if (TypeAdapter.class.isAssignableFrom(value)) { Class<TypeAdapter<?>> typeAdapter = (Class<TypeAdapter<?>>) value; return constructorConstructor.get(TypeToken.get(typeAdapter)).construct(); } if (TypeAdapterFactory.class.isAssignableFrom(value)) { Class<TypeAdapterFactory> typeAdapterFactory = (Class<TypeAdapterFactory>) value; return constructorConstructor.get(TypeToken.get(typeAdapterFactory)) .construct() .create(gson, fieldType); } throw new IllegalArgumentException( "@JsonAdapter value must be TypeAdapter or TypeAdapterFactory reference."); } }
[ "925355740@qq.com" ]
925355740@qq.com
fd441aeaa7584c805012971617f7870172bc9188
e72b3caefcf2868a85d52698609ffe19074c4f47
/src/WordFind.java
0782d8cc16ddba3aee50abcb7e129a3e0c4baff4
[]
no_license
b18java0901/Ajay-Thakur-Repository
b869bb054b4695a7561f39a1083687323035e9f1
45b8778076fbcf9878225c6a8377edd9ab664788
refs/heads/master
2020-04-01T17:40:40.368766
2018-10-25T05:34:51
2018-10-25T05:34:51
153,440,833
0
0
null
null
null
null
UTF-8
Java
false
false
644
java
import java.util.Scanner; public class WordFind { public static void main(String[] args) { Scanner s=new Scanner(System.in); int count=0; System.out.println("Enter the sentence"); String s1=s.nextLine(); String s2[]=s1.split(" "); System.out.println("enter the word to find"); String find=s.nextLine(); for(int i=0;i<s2.length;i++) { if(s2[i].equals(find)) { count++; } } if(count==0) { System.out.println("your word is not available in the given sentence"); } System.out.println(" the frequencey of the number is "+count); System.out.println(s2.length); } }
[ "hp@DESKTOP-JI8OUC1" ]
hp@DESKTOP-JI8OUC1
ba2a303a1e9eec377312af07101ca7f2518926b0
ba2f2dd54868d029fe24aebc67a83dd7acb648fb
/app/src/main/java/Model/Offer_Model.java
f9ff4c761c1437b1a1eeed7830ad7463c31c8eeb
[]
no_license
NothingbutPro/khanamanahe
d38991831214d5f86bd8038433b73da6f4540a34
7d3aa426439d8092ccb1f72cd5b6ccdaa2cea29e
refs/heads/master
2020-12-21T14:38:34.476836
2020-01-27T10:07:59
2020-01-27T10:07:59
236,462,581
0
0
null
null
null
null
UTF-8
Java
false
false
1,004
java
package Model; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Offer_Model { @SerializedName("id") @Expose private String id; @SerializedName("location_offers") @Expose private String locationOffers; @SerializedName("type") @Expose private String type; @SerializedName("status") @Expose private String status; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getLocationOffers() { return locationOffers; } public void setLocationOffers(String locationOffers) { this.locationOffers = locationOffers; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } }
[ "paragsharma611@gmail.com" ]
paragsharma611@gmail.com
fdc85c61e594ab76cd0f12d59a56dca4ff5cafdd
6c41fa0bbcd8443c9d62e071e84760928be556da
/integration-tests/src/test/java/de/escidoc/core/test/aa/UserGroupInspectorIT.java
df0652c03082a7b95781265bf8980cc199ec738f
[]
no_license
crh/escidoc-core-1.4
c29dfd99793976cf9f123dc87f2ef9fd7f061fd6
6b2276a704ffeb14daf5071215d475b3d3737676
refs/heads/master
2021-01-22T13:36:53.210436
2012-02-22T10:10:02
2012-02-22T10:10:02
3,513,379
0
0
null
null
null
null
UTF-8
Java
false
false
9,122
java
/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at license/ESCIDOC.LICENSE * or http://www.escidoc.de/license. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at license/ESCIDOC.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2006-2008 Fachinformationszentrum Karlsruhe Gesellschaft * fuer wissenschaftlich-technische Information mbH and Max-Planck- * Gesellschaft zur Foerderung der Wissenschaft e.V. * All rights reserved. Use is subject to license terms. */ package de.escidoc.core.test.aa; import de.escidoc.core.common.exceptions.remote.application.security.AuthorizationException; import de.escidoc.core.test.EscidocAbstractTest; import de.escidoc.core.test.common.client.servlet.Constants; import de.escidoc.core.test.security.client.PWCallback; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.w3c.dom.Document; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; /** * Test suite for the role user-group-inspector. * * @author Michael Hoppe */ @RunWith(Parameterized.class) public class UserGroupInspectorIT extends GrantTestBase { /** * Initializes test-class with data. * * @return Collection with data. */ @Parameterized.Parameters public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { USER_ACCOUNT_HANDLER_CODE, PWCallback.ID_PREFIX + PWCallback.TEST_HANDLE }, { USER_GROUP_HANDLER_CODE, USER_GROUP_WITH_GROUP_LIST_ID }, { USER_GROUP_HANDLER_CODE, USER_GROUP_WITH_USER_LIST_ID }, { USER_GROUP_HANDLER_CODE, USER_GROUP_WITH_OU_LIST_ID }, { USER_GROUP_HANDLER_CODE, USER_GROUP_WITH_EXTERNAL_SELECTOR } }); } protected static final String HANDLE = PWCallback.TEST_HANDLE; protected static final String LOGINNAME = HANDLE; protected static final String PASSWORD = PWCallback.PASSWORD; protected static String grantCreationUserOrGroupId = null; private static UserGroupTestBase userGroupTestBase = null; private static int methodCounter = 0; private static String groupId = null; private static String groupId1 = null; /** * The constructor. * * @param handlerCode handlerCode of either UserAccountHandler or UserGroupHandler. * @param userOrGroupId userOrGroupId for grantCreation. * @throws Exception If anything fails. */ public UserGroupInspectorIT(final int handlerCode, final String userOrGroupId) throws Exception { super(handlerCode); grantCreationUserOrGroupId = userOrGroupId; userGroupTestBase = new UserGroupTestBase() { }; } /** * Set up servlet test. * * @throws Exception If anything fails. */ @Before public void initialize() throws Exception { if (methodCounter == 0) { //revoke all Grants revokeAllGrants(grantCreationUserOrGroupId); prepare(); } } /** * Clean up after servlet test. * * @throws Exception If anything fails. */ @After public void deinitialize() throws Exception { methodCounter++; if (methodCounter == getTestAnnotationsCount()) { revokeAllGrants(grantCreationUserOrGroupId); methodCounter = 0; } } /** * prepare tests (create group). * * @throws Exception If anything fails. */ public void prepare() throws Exception { String groupXml = prepareUserGroup(PWCallback.DEFAULT_HANDLE); Document groupDocument = EscidocAbstractTest.getDocument(groupXml); groupId = getObjidValue(groupDocument); String lastModificationDate = getLastModificationDateValue(groupDocument); groupXml = prepareUserGroup(PWCallback.DEFAULT_HANDLE); groupDocument = EscidocAbstractTest.getDocument(groupXml); groupId1 = getObjidValue(groupDocument); //add group1 to group ArrayList<String[]> selectors = new ArrayList<String[]>(); String[] selector = new String[3]; selector[0] = "user-group"; selector[1] = "internal"; selector[2] = groupId1; selectors.add(selector); String taskParam = userGroupTestBase.getAddSelectorsTaskParam(selectors, lastModificationDate); userGroupTestBase.doTestAddSelectors(null, groupId, taskParam, null); } /** * Tests successfully retrieving a user-group. * * @throws Exception If anything fails. */ @Test public void testRetrieveGroup() throws Exception { try { //grant role user-group-inspector to user with scope on group doTestCreateGrant(null, grantCreationUserOrGroupId, Constants.USER_GROUP_BASE_URI + "/" + groupId, ROLE_HREF_USER_GROUP_INSPECTOR, null); userGroupTestBase.doTestRetrieve(HANDLE, groupId, null); } finally { revokeAllGrants(grantCreationUserOrGroupId); } } /** * Tests declining retrieving a user-group. * * @throws Exception If anything fails. */ @Test public void testRetrieveGroupHierarchicalDecline() throws Exception { try { //grant role user-group-inspector to user with scope on group doTestCreateGrant(null, grantCreationUserOrGroupId, Constants.USER_GROUP_BASE_URI + "/" + groupId, ROLE_HREF_USER_GROUP_INSPECTOR, null); userGroupTestBase.doTestRetrieve(HANDLE, groupId1, AuthorizationException.class); } finally { revokeAllGrants(grantCreationUserOrGroupId); } } /** * Tests successfully retrieving a user-group. * * @throws Exception If anything fails. */ @Test public void testRetrieveGroup1() throws Exception { try { //grant role user-group-inspector to user with scope on group doTestCreateGrant(null, grantCreationUserOrGroupId, Constants.USER_GROUP_BASE_URI + "/" + groupId1, ROLE_HREF_USER_GROUP_INSPECTOR, null); userGroupTestBase.doTestRetrieve(HANDLE, groupId1, null); } finally { revokeAllGrants(grantCreationUserOrGroupId); } } /** * Tests declining retrieving a user-group. * * @throws Exception If anything fails. */ @Test public void testRetrieveGroupHierarchicalDecline1() throws Exception { try { //grant role user-group-inspector to user with scope on group doTestCreateGrant(null, grantCreationUserOrGroupId, Constants.USER_GROUP_BASE_URI + "/" + groupId1, ROLE_HREF_USER_GROUP_INSPECTOR, null); userGroupTestBase.doTestRetrieve(HANDLE, groupId, AuthorizationException.class); } finally { revokeAllGrants(grantCreationUserOrGroupId); } } /** * Tests declining retrieving a user-group. * * @throws Exception If anything fails. */ @Test public void testRetrieveGroupDecline() throws Exception { try { //grant role user-group-inspector to user with scope on group doTestCreateGrant(null, grantCreationUserOrGroupId, Constants.USER_GROUP_BASE_URI + "/" + groupId, ROLE_HREF_USER_GROUP_INSPECTOR, null); userGroupTestBase.doTestRetrieve(HANDLE, groupId1, AuthorizationException.class); } finally { revokeAllGrants(grantCreationUserOrGroupId); } } /** * Tests declining retrieving a user-group. * * @throws Exception If anything fails. */ @Test public void testRetrieveGroupDecline1() throws Exception { try { //grant role user-group-inspector to user with scope on group doTestCreateGrant(null, grantCreationUserOrGroupId, null, ROLE_HREF_USER_GROUP_INSPECTOR, null); userGroupTestBase.doTestRetrieve(HANDLE, groupId1, AuthorizationException.class); } finally { revokeAllGrants(grantCreationUserOrGroupId); } } }
[ "Steffen.Wagner@fiz-karlsruhe.de" ]
Steffen.Wagner@fiz-karlsruhe.de
fe2ee1add4aa665de5e03a956e19b6dc5e778abe
e3b972c15473626cf70cc4ec0740767abf0434e6
/src/main/java/com/example/demo/controllers/SettingsController.java
b4d7716a76773ce4b1ec40709ad1f9403b455446
[]
no_license
callanbr/SynChronosJava
308b73e6a31bf08c2f46aade449916750df455ed
6838533cc6b9eab8694507aba9dd83439baacb56
refs/heads/master
2020-03-22T06:26:37.917991
2018-08-07T16:44:29
2018-08-07T16:44:29
139,634,438
1
0
null
2018-08-03T04:55:01
2018-07-03T20:32:18
Java
UTF-8
Java
false
false
985
java
package com.example.demo.controllers; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.example.demo.models.Settings; import com.example.demo.models.SettingsRepository; @RestController @RequestMapping("/settings") @CrossOrigin(origins="http://localhost:4200") public class SettingsController { @Autowired SettingsRepository settingsRepository; @GetMapping public List<Settings> getSettings() { return settingsRepository.findAll(); } @PostMapping() public void createSettings(@RequestBody Settings settings) { settingsRepository.save(settings); } }
[ "31749742+Geek-Raven@users.noreply.github.com" ]
31749742+Geek-Raven@users.noreply.github.com
4a49457096c5d30ce6b96c99b4776158fe81aea3
0092e3b75f6745f029af056728bcc6f16915beae
/DCOS0.1/src/com/mvc/entity/AppNutch.java
81929950dfaabead237e2a9108c263d499d8042b
[]
no_license
scorpioxiatian/dcos
d61280c6e172433530112c12c7824931e5c08571
0e16a630495a63def6ce3c23084332aaead00756
refs/heads/master
2021-01-01T19:50:26.918940
2015-04-30T09:22:52
2015-04-30T09:22:52
31,884,997
0
0
null
null
null
null
UTF-8
Java
false
false
2,311
java
package com.mvc.entity; import java.math.BigInteger; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; import javax.persistence.Table; @Entity @org.hibernate.annotations.Proxy(lazy=false) @Table(name="app_nutch") public class AppNutch { @Column(name="id", nullable=false) @Id @GeneratedValue(generator="MODEL_SHOPPINGDETAIL_ID_GENERATOR") @org.hibernate.annotations.GenericGenerator(name="MODEL_SHOPPINGDETAIL_ID_GENERATOR", strategy="native") private Integer id; @ManyToOne(targetEntity=VM.class, fetch=FetchType.LAZY) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK}) @JoinColumns({ @JoinColumn(name="slave_name", referencedColumnName="vm_name", nullable=true) }) private VM slave; @ManyToOne(targetEntity=VM.class, fetch=FetchType.LAZY) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK}) @JoinColumns({ @JoinColumn(name="master_name", referencedColumnName="vm_name", nullable=true) }) private VM master; @Column(name="response_time", nullable=true) private Integer nutch_resp_time; @Column(name="timestamp", nullable=true) private BigInteger time_stamp; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public VM getSlave() { return slave; } public void setSlave(VM slave) { this.slave = slave; } public VM getMaster() { return master; } public void setMaster(VM master) { this.master = master; } public Integer getNutch_resp_time() { return nutch_resp_time; } public void setNutch_resp_time(Integer nutch_resp_time) { this.nutch_resp_time = nutch_resp_time; } public BigInteger getTime_stamp() { return time_stamp; } public void setTime_stamp(BigInteger time_stamp) { this.time_stamp = time_stamp; } @Override public String toString() { return "AppNutch [id=" + id + ", slave=" + slave + ", master=" + master + ", nutch_resp_time=" + nutch_resp_time + ", time_stamp=" + time_stamp + "]"; } }
[ "smith7alan@qq.com" ]
smith7alan@qq.com
1ebc5888d62b89e14cdff8ad382653645c671052
1b74577981e0babc0723697522cf72441f8f40eb
/src/main/java/com/elf/dao/ArticleTagMapDao.java
b71a22ab97445cd419f3cf511cb97046967d9430
[]
no_license
lcd/elf
910bed26446477a651d5cb90a192ec9cd5c3f470
d863405f219893c078b8cc22cb6041efee90996c
refs/heads/master
2021-01-10T19:26:04.506558
2011-05-20T03:02:06
2011-05-20T03:02:06
1,623,263
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
/** * elf. * Copyright (c) 2010-2011 All Rights Reserved. */ package com.elf.dao; import java.util.List; import com.elf.entities.ArticleTagMap; /** * * @author laichendong */ public interface ArticleTagMapDao { void insertBatch(List<ArticleTagMap> atmList); }
[ "laichendong@126.com" ]
laichendong@126.com
ec70f385e55543b2e0370cf9281d481df264a1ba
2d2bae73c97a75c45e143add1b34bceca297a44b
/android/viro_bridge/src/main/java/com/viromedia/bridge/component/VRTBaseSound.java
54e931e820d2565a6d2b90e84c2119508b15b3eb
[ "MIT" ]
permissive
TobyX-Corp/phantom-react
8cb3b40c00c54513f17e5f5838d850530236d3a9
ccb621999ab887aa2752503d79a8df4d11be8b0e
refs/heads/master
2023-03-23T20:50:55.450649
2021-01-09T04:10:49
2021-01-09T04:10:49
260,729,569
1
0
MIT
2021-03-15T21:52:18
2020-05-02T16:35:25
JavaScript
UTF-8
Java
false
false
6,454
java
// Copyright © 2017 Viro Media. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. package com.viromedia.bridge.component; import android.net.Uri; import android.util.Log; import com.facebook.react.bridge.JSApplicationCausedNativeException; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.uimanager.events.RCTEventEmitter; import com.viro.core.internal.BaseSound; import com.viro.core.ViroContext; import com.viro.core.SoundData; import com.viromedia.bridge.module.SoundModule; import com.viromedia.bridge.utility.Helper; import com.viromedia.bridge.utility.ViroEvents; import com.viromedia.bridge.utility.ViroLog; public abstract class VRTBaseSound extends VRTComponent { private static final String TAG = ViroLog.getTag(VRTBaseSound.class); protected static final String NAME = "name"; protected static final String URI = "uri"; protected BaseSound mNativeSound; protected ReadableMap mSource; protected boolean mPaused = false; protected float mVolume = 1.0f; protected boolean mMuted = false; protected boolean mLoop = false; protected boolean mShouldResetSound = false; protected boolean mReady = false; public VRTBaseSound(ReactContext reactContext) { super(reactContext.getBaseContext(), null, -1, -1, reactContext); } public void setSource(ReadableMap source) { mSource = source; mShouldResetSound = true; } public void setPaused(boolean paused) { mPaused = paused; if (mReady && mNativeSound != null) { if (mPaused || !shouldAppear()) { mNativeSound.pause(); } else { mNativeSound.play(); } } } public void setVolume(float volume) { mVolume = volume; } public void setMuted(boolean muted) { mMuted = muted; } public void setLoop(boolean loop) { mLoop = loop; } public void seekToTime(int seconds) { if (mNativeSound != null) { mNativeSound.seekToTime(seconds); if (!mPaused) { mNativeSound.play(); } } else { // We should *NEVER* get in this case, so let's log in case. ViroLog.warn(TAG, "seekToTime called before nativeSound was created!"); } } @Override public void onPropsSet() { if (mShouldResetSound) { resetSound(); } setNativeProps(); } protected void setNativeProps() { if (mNativeSound == null) { return; } // re-run the setPaused logic to start/stop playback. setPaused(mPaused); mNativeSound.setVolume(mVolume); mNativeSound.setMuted(mMuted); mNativeSound.setLoop(mLoop); } @Override protected void handleAppearanceChange() { // re-run the setPaused logic to start/stop playback. setPaused(mPaused); super.handleAppearanceChange(); } @Override public void setViroContext(ViroContext context) { super.setViroContext(context); resetSound(); } protected void resetSound() { if (mViroContext == null) { return; } if (mNativeSound != null) { mNativeSound.pause(); mNativeSound.dispose(); mNativeSound = null; } mShouldResetSound = false; // figure out what type of audio I have if (mSource.hasKey(NAME)) { SoundData data = getSoundDataForName(mSource.getString(NAME)); if (data == null) { onError("Unknown Sound source with name: [" + mSource.getString(NAME) + "]"); return; } mNativeSound = getNativeSound(data); } else if (mSource.hasKey(URI)) { Uri uri = Helper.parseUri(mSource.getString(URI), getContext()); mNativeSound = getNativeSound(uri.toString()); } else { throw new IllegalArgumentException("Unknown sound source."); } setNativeProps(); } private SoundData getSoundDataForName(String name) { SoundModule soundModule = mReactContext.getNativeModule(SoundModule.class); return soundModule.getSoundData(name); } @Override public void onTearDown() { super.onTearDown(); if (mNativeSound != null) { mNativeSound.dispose(); mNativeSound = null; } } @Override public void onHostPause(){ super.onHostPause(); if (mNativeSound != null && !mPaused) { mNativeSound.pause(); } } @Override public void sceneWillDisappear() { if (mNativeSound != null && !mPaused) { mNativeSound.pause(); } } @Override public void onHostResume(){ super.onHostResume(); onPropsSet(); } @Override public void sceneWillAppear() { onPropsSet(); } /** * Child classes should implement this method to return their own type of native Sound object * * @param path - path/url to the sound file * @return the native sound object */ protected abstract BaseSound getNativeSound(String path); protected abstract BaseSound getNativeSound(SoundData data); }
[ "453740573@qq.com" ]
453740573@qq.com
56a9bd99f07efd00f1f6abb8c72a42c03b98892b
fa08e1e16ffcc51fc360c404bd769ded5a838534
/ThamDinhGia_/src/main/java/mockup/valueobjects/BaoCaoDTO.java
80d2f42c33b1f84c16ebcea63a48c76482b25dae
[]
no_license
ThanDB/TDG
73c664fec549d6f99bec94d41cd373f138c1cfdb
ab68ee1247d981a57d1bbc2ccf353e31201fff8e
refs/heads/master
2021-01-10T15:15:59.326639
2016-05-12T13:07:19
2016-05-12T13:07:19
53,003,529
0
0
null
null
null
null
UTF-8
Java
false
false
1,777
java
package mockup.valueobjects; public class BaoCaoDTO { private String maBaoCao; private String maHopDong; private String nguoiThucHien; private String nguoiDuyet; private String giaTri; private String ngayThucHien; private String trangThai; public String getMaBaoCao() { return maBaoCao; } public void setMaBaoCao(String maBaoCao) { this.maBaoCao = maBaoCao; } public String getMaHopDong() { return maHopDong; } public void setMaHopDong(String maHopDong) { this.maHopDong = maHopDong; } public String getNguoiThucHien() { return nguoiThucHien; } public void setNguoiThucHien(String nguoiThucHien) { this.nguoiThucHien = nguoiThucHien; } public String getNguoiDuyet() { return nguoiDuyet; } public void setNguoiDuyet(String nguoiDuyet) { this.nguoiDuyet = nguoiDuyet; } public String getGiaTri() { return giaTri; } public void setGiaTri(String giaTri) { this.giaTri = giaTri; } public String getNgayThucHien() { return ngayThucHien; } public void setNgayThucHien(String ngayThucHien) { this.ngayThucHien = ngayThucHien; } public String getTrangThai() { return trangThai; } public void setTrangThai(String trangThai) { this.trangThai = trangThai; } public BaoCaoDTO() { super(); // TODO Auto-generated constructor stub } public BaoCaoDTO(String maBaoCao, String maHopDong, String nguoiThucHien, String nguoiDuyet, String giaTri, String ngayThucHien, String trangThai) { super(); this.maBaoCao = maBaoCao; this.maHopDong = maHopDong; this.nguoiThucHien = nguoiThucHien; this.nguoiDuyet = nguoiDuyet; this.giaTri = giaTri; this.ngayThucHien = ngayThucHien; this.trangThai = trangThai; } }
[ "ThanK53Hus@gmail.com" ]
ThanK53Hus@gmail.com
d1332eed1cbbc20b82e22c5abca84c446f1cb3ab
4d54cee594deb52f682432ea80e974edd49dd4f6
/corpus/java/training/stringtemplate4/org/stringtemplate/v4/misc/STModelAdaptor.java
b9ff1677d16a650561e05d038a56199213fe797e
[ "BSD-2-Clause" ]
permissive
bloriot97/codebuff
fb3949b9429a6ff446dcd92273d2f65a43506fbb
99ea273504811a32413bcd937ff6d989b36a7cda
refs/heads/master
2020-03-29T17:09:24.279320
2018-09-24T18:09:32
2018-09-24T18:09:32
150,146,675
0
0
BSD-2-Clause
2018-09-24T18:08:02
2018-09-24T18:08:01
null
UTF-8
Java
false
false
1,938
java
/* * [The "BSD license"] * Copyright (c) 2011 Terence Parr * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.stringtemplate.v4.misc; import org.stringtemplate.v4.Interpreter; import org.stringtemplate.v4.ModelAdaptor; import org.stringtemplate.v4.ST; public class STModelAdaptor implements ModelAdaptor { @Override public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException { ST st = (ST)o; return st.getAttribute(propertyName); } }
[ "parrt@cs.usfca.edu" ]
parrt@cs.usfca.edu
3ade1310b9e8a151b800888d4b3bf70f168e68d3
666e60aec34c668336f9b4f4e53cea7fe719fd8e
/src/staticSTATIC/StaticDemoChild.java
1d5d76333a8f3ac09763596d0b98dfee062100e1
[]
no_license
RenjithKI/miscCoreJava8JsonProject
497f78f52c8846769073b8c4669db1c612efbdc4
5166b0ab251429ad9a658f6546e7db4086e97c7b
refs/heads/master
2021-07-08T23:55:14.082440
2020-06-23T23:54:39
2020-06-23T23:54:39
130,696,697
1
0
null
null
null
null
UTF-8
Java
false
false
487
java
package staticSTATIC; /** * @author Renjith * */ public class StaticDemoChild extends StaticDemo { public StaticDemoChild() { /*By default super() is hidden here */ System.out.println("StaticDemoChild"); } public void display() { System.out.println("Just a method of child class"); } public static void main(String args[]) { StaticDemoChild obj = new StaticDemoChild(); obj.display(); } }
[ "renjith.kachappilly@gmail.com" ]
renjith.kachappilly@gmail.com
6d68e271a794cc010a4432b5cb19fd4290c44822
3cfe9533666d73f8bff4335cb363bd3f735bebc3
/src/main/java/mt/swift/model/Type.java
d67fd9fe7051ab29573d370d34256d70f58d533e
[]
no_license
martint/old-swift
8ae47dd5a08411807ae4b2e8026e322067471e2e
2051d20b501692504a15dedbcd6efcbb702b5354
refs/heads/master
2023-08-21T05:13:35.439211
2009-07-17T05:23:53
2009-07-17T05:23:53
73,034
2
1
null
null
null
null
UTF-8
Java
false
false
707
java
/** * Copyright 2008 Martin Traverso * * 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 mt.swift.model; public interface Type<T> { byte getTType(); String getSignature(); }
[ "mtraverso@acm.org" ]
mtraverso@acm.org
08831660d82863122bd2b0579fd45430aa9fae1b
3a4166338445db31f8aaa62520f38552276d17f5
/otel-extensions/src/main/java/org/hypertrace/agent/otel/extensions/CgroupsReader.java
afa20bcbd011fce04c46bd62062a512b36af9ebb
[ "Apache-2.0" ]
permissive
shashank11p/javaagent
b061fc04da2576f145db47b7f2cd2942c0419094
4a3cf6cffd25da79deb3b9d90b6b348b0b92c45f
refs/heads/main
2023-04-06T06:44:08.855564
2021-04-14T11:59:27
2021-04-14T11:59:27
335,222,537
0
0
Apache-2.0
2021-04-14T16:15:25
2021-02-02T08:42:03
Java
UTF-8
Java
false
false
2,355
java
/* * Copyright The Hypertrace Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.hypertrace.agent.otel.extensions; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class CgroupsReader { private static final Logger log = LoggerFactory.getLogger(HypertraceResourceProvider.class.getName()); private static final String DEFAULT_CGROUPS_PATH = "/proc/self/cgroup"; private static final int CONTAINER_ID_LENGTH = 64; private final String cgroupsPath; public CgroupsReader() { this.cgroupsPath = DEFAULT_CGROUPS_PATH; } public CgroupsReader(String cgroupsPath) { this.cgroupsPath = cgroupsPath; } /** * Read container ID from cgroups file. * * @return docker container ID or empty string if not defined. */ @SuppressWarnings("DefaultCharset") public String readContainerId() { try (BufferedReader br = new BufferedReader(new FileReader(cgroupsPath))) { String line; while ((line = br.readLine()) != null) { if (line.endsWith(".scope")) { line = line.substring(0, line.length() - ".scope".length()); } if (line.length() > CONTAINER_ID_LENGTH) { String id = line.substring(line.length() - CONTAINER_ID_LENGTH); if (!id.contains("/")) { return id; } } } } catch (FileNotFoundException ex) { // do not pass exception to logger because it prints stacktrace, we don't want that in non // container environments log.warn("Failed to read container id, cgroups file does not exist: {}", ex.getMessage()); } catch (IOException ex) { log.warn("Unable to read container id", ex); } return ""; } }
[ "noreply@github.com" ]
noreply@github.com
3a9caacf8c47e531491b9cdf96369e75cc766ee9
e00b31c85d42bf46bec1c3d1f30b709da33cb0da
/Generation/src/lista/exercicios/repeticao/Ex05.java
dcb5f1aa77cf9a9c0f5cb3a5c210ad80b7de57e3
[]
no_license
MOliv3ira/Exercicios-logica-java-
a95a7d02e9e5426df0ec673111b83bb81c268707
ea91f8ebc7667532b9295ad1afe0c6884dbdd777
refs/heads/master
2022-12-14T01:01:48.246997
2020-09-21T20:43:15
2020-09-21T20:43:15
278,222,948
0
0
null
null
null
null
ISO-8859-1
Java
false
false
707
java
package lista.exercicios.repeticao; import java.util.Scanner; public class Ex05 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num, soma = 0; double cont = 0; System.out.print("Digite um número: "); num = sc.nextInt(); do { if(num != 0) { soma = soma + num; cont++; } System.out.print("Digite um número: "); num = sc.nextInt(); }while(num != 0); System.out.printf("A soma dos números digitados é: %d", soma); } } /*5-Crie um programa que leia um número do teclado até que encontre um número igual a zero. * No final, mostre a soma dos números digitados.(DO...WHILE) */
[ "noreply@github.com" ]
noreply@github.com
ebe3cb33f0eaf6af8b0d004168b78f1b7e212742
51ac6c6b391b27c32ac4be7ba36baf6608109f44
/src/main/java/com/winters/jhipster/web/rest/ProfileInfoResource.java
8e7d9e87abd1e581fe1d3538e6d2002ddb1e89ba
[]
no_license
guobingrong/jhipster-ag
56566b98c2edbd4ad0bcac509b8e5a5be74594ef
88a72b8ea3979a4f666fab43e43586ac26e6ac05
refs/heads/master
2021-09-01T01:12:05.854736
2017-12-22T13:44:02
2017-12-22T13:44:02
115,199,518
0
0
null
null
null
null
UTF-8
Java
false
false
2,041
java
package com.winters.jhipster.web.rest; import com.winters.jhipster.config.DefaultProfileUtil; import io.github.jhipster.config.JHipsterProperties; import org.springframework.core.env.Environment; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Resource to return information about the currently running Spring profiles. */ @RestController @RequestMapping("/api") public class ProfileInfoResource { private final Environment env; private final JHipsterProperties jHipsterProperties; public ProfileInfoResource(Environment env, JHipsterProperties jHipsterProperties) { this.env = env; this.jHipsterProperties = jHipsterProperties; } @GetMapping("/profile-info") public ProfileInfoVM getActiveProfiles() { String[] activeProfiles = DefaultProfileUtil.getActiveProfiles(env); return new ProfileInfoVM(activeProfiles, getRibbonEnv(activeProfiles)); } private String getRibbonEnv(String[] activeProfiles) { String[] displayOnActiveProfiles = jHipsterProperties.getRibbon().getDisplayOnActiveProfiles(); if (displayOnActiveProfiles == null) { return null; } List<String> ribbonProfiles = new ArrayList<>(Arrays.asList(displayOnActiveProfiles)); List<String> springBootProfiles = Arrays.asList(activeProfiles); ribbonProfiles.retainAll(springBootProfiles); if (!ribbonProfiles.isEmpty()) { return ribbonProfiles.get(0); } return null; } class ProfileInfoVM { private String[] activeProfiles; private String ribbonEnv; ProfileInfoVM(String[] activeProfiles, String ribbonEnv) { this.activeProfiles = activeProfiles; this.ribbonEnv = ribbonEnv; } public String[] getActiveProfiles() { return activeProfiles; } public String getRibbonEnv() { return ribbonEnv; } } }
[ "guobingrong@guobingrongdeMacBook-Pro.local" ]
guobingrong@guobingrongdeMacBook-Pro.local
06a54a7b08abc0bfc2656eb6e077ad89ef90e323
9c58db753e826c5880f11b759ae83c0c511c2a91
/src/main/java/frc/robot/commands/ChassisPixyBallChase.java
86311b3adab37821b37b73109bd3ec84f90e16dc
[]
no_license
stormbots/DeepSpace
a312c18a618d8614c2212114b44abc7540dd3352
ec9d20368217f3153c5e6f717659b250523db5bd
refs/heads/master
2020-04-19T14:56:02.464011
2020-01-25T06:22:26
2020-01-25T06:22:26
168,258,987
0
0
null
2020-01-25T06:22:28
2019-01-30T01:34:23
Java
UTF-8
Java
false
false
4,738
java
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot.commands; import static com.stormbots.Clamp.clamp; import com.stormbots.Lerp; import edu.wpi.first.wpilibj.command.Command; import frc.robot.Robot; import frc.robot.subsystems.Chassis.Mode; /** * An example command. You can replace me with your own command. */ public class ChassisPixyBallChase extends Command { double imageBottom = 600; // need to get the real values double imageCenterX = 400; // need to get the real values double[] xValues={0,1,2}; double[] yValues={0,1,2}; double[] areas={0,1,2}; double[] distances={0,1,2}; int cyclesSinceLastLine = 100; double leftSidePower = 0; double rightSidePower = 0; Lerp pixelToAbsolute = new Lerp(0, imageCenterX, 0, 1); public ChassisPixyBallChase() { // Use requires() here to declare subsystem dependencies requires(Robot.chassis); } // Called just before this Command runs the first time @Override protected void initialize() { Robot.pixy.setLamp(true, false); Robot.chassis.setMode(Mode.TANKDRIVE); } public double getDistance(double x, double y) { return Math.sqrt((x-imageCenterX)*(x-imageCenterX) + (y-imageBottom)*(y-imageBottom)); } public int getBestBallIndex() { int bestXIndex = 0; double bestX = xValues[0]; // int bestDistanceIndex = 0; // double bestDistance = getDistance(xValues[0], yValues[0]); int secondBestXIndex = 0; double secondBestX = xValues[0]; // int secondBestDistanceIndex = 0; // double secondBestDistance = getDistance(xValues[0], yValues[0]); for(int i = 1; i < xValues.length; i++) { if(Math.abs(xValues[i]) < Math.abs(bestX)) { secondBestXIndex = bestXIndex; secondBestX = bestX; bestXIndex = i; bestX = xValues[i]; } // if(bestDistance < getDistance(xValues[i], yValues[i])) { // secondBestDistanceIndex = bestDistanceIndex; // secondBestDistance = bestDistance; // bestDistanceIndex = i; // bestDistance = getDistance(xValues[i], yValues[i]); // } } if(bestX + 30 > secondBestX) { if(getDistance(xValues[bestXIndex], yValues[bestXIndex]) > getDistance(xValues[secondBestXIndex], yValues[secondBestXIndex])) { return secondBestXIndex; } } return bestXIndex; } // save all our arrays // if none? // find best (as function) // track // Called repeatedly when this Command is scheduled to run @Override protected void execute() { //Line[] lines = SmartDashboard.getNumberArray("Grip/something, defaultValue); cyclesSinceLastLine++; // if(lines.length>0) { // cyclesSinceLastLine = 0; // line = lines[0]; // } if(cyclesSinceLastLine > 5){ //chassis speed = 0 //shortSidePower = 0.6*shortSidePower; //Robot.chassis.tankDrive(shortSidePower, shortSidePower); Robot.chassis.tankDrive(-0.3, -0.3); return ; } int bestBallIndex = getBestBallIndex(); double ballX = xValues[bestBallIndex]; double ballY = xValues[bestBallIndex]; double ballArea = areas[bestBallIndex]; double ballXNormalizedCenter = ballX - imageCenterX; double ballAbsoluteX = pixelToAbsolute.get(ballXNormalizedCenter); leftSidePower = 0.3 + clamp(0.7*ballAbsoluteX, -0.3, 0.7); rightSidePower = 0.3 + clamp(0.7*ballAbsoluteX, -0.3, 0.7); Robot.chassis.tankDrive(-leftSidePower, -rightSidePower); // SmartDashboard.putNumber("Chassis/LeftChasePower", -leftSidePower); // SmartDashboard.putNumber("Chassis/RightChasePower", -rightSidePower); // SmartDashboard.putNumber("Chassis/ChaseBiasToRight", -leftSidePower+rightSidePower); } // Make this return true when this Command no longer needs to run execute() @Override protected boolean isFinished() { return false; } // Called once after isFinished returns true @Override protected void end() { Robot.chassis.setMode(Mode.ARCADEDRIVE); Robot.pixy.setLamp(false, false); } // Called when another command which requires one or more of the same // subsystems is scheduled to run @Override protected void interrupted() { Robot.chassis.setMode(Mode.ARCADEDRIVE); Robot.pixy.setLamp(false, false); } }
[ "tekdemo+driverstation@gmail.com" ]
tekdemo+driverstation@gmail.com
b3b1029b07da2c0d3001e3cef46009369c742b61
57303a7ab6cca8a235151ef284ab968114825316
/Damas.java
6c7503a61e0705fda94e75a0c329f53805e0d51d
[]
no_license
smlpj/Damas
eafa7545bdaec33f885f1bef27c4a6a5877d7723
63bcf70b82e7f852dfb550f212b35b3350544d71
refs/heads/master
2020-09-03T01:30:00.216413
2019-11-03T19:08:58
2019-11-03T19:08:58
219,351,410
0
0
null
null
null
null
UTF-8
Java
false
false
19,533
java
package damas; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.io.*; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; public class Damas extends JPanel implements ActionListener, MouseListener { private static final long serialVersionUID = 1L; //Why? TODO GOOGLE public static int width = 720, height = width; //square parameters. Optimized for any square resolution TODO any resolution to be squared public static final int tileSize = width / 8; //8 Tiles for checkers board public static final int numTilesPerRow = width / tileSize; public static int[][] baseGameData = new int[numTilesPerRow][numTilesPerRow]; //Stores 8x8 board layout public static int[][] gameData = new int[numTilesPerRow][numTilesPerRow]; //Stores piece data in an 8x8 public static final int EMPTY = 0, RED = 1, RED_KING = 2, WHITE = 3, WHITE_KING = 4; //Values for gameData public static JFrame frame; public boolean gameInProgress = true; public int currentPlayer = RED; public boolean inPlay = false; //Is there a move function processing? public static int[][] availablePlays = new int[numTilesPerRow][numTilesPerRow]; //Stores available plays in an 8x8 public int storedRow, storedCol; public boolean isJump = false; static BufferedImage crownImage = null; public static void main(String[] args) { try { crownImage = ImageIO.read(new File("crown.png")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } new Damas(); } public Damas() { window(width, height, this); initializeBoard(); repaint(); // This is included in the JVM. Runs paint. } public boolean gameOver() { //Wrapper for gameOverInternal return gameOverInternal(0, 0, 0, 0); } public boolean gameOverInternal(int col, int row, int red, int white) { //recursive practice if (gameData[col][row] == RED || gameData[col][row] == RED_KING) { red += 1; } if (gameData[col][row] == WHITE || gameData[col][row] == WHITE_KING) { white += 1; } if (col == numTilesPerRow - 1 && row == numTilesPerRow - 1) { if (red == 0 || white == 0) { return true; } else { return false; } } if (col == numTilesPerRow - 1) { row += 1; col = -1; } return gameOverInternal(col + 1, row, red, white); } public void window(int width, int height, Damas game) { //draw the frame and add exit functionality JFrame frame = new JFrame(); frame.setSize(width, height); frame.setIconImage(crownImage); frame.setBackground(Color.cyan); frame.setLocationRelativeTo(null); frame.pack(); Insets insets = frame.getInsets(); int frameLeftBorder = insets.left; int frameRightBorder = insets.right; int frameTopBorder = insets.top; int frameBottomBorder = insets.bottom; frame.setPreferredSize(new Dimension(width + frameLeftBorder + frameRightBorder, height + frameBottomBorder + frameTopBorder)); frame.setMaximumSize(new Dimension(width + frameLeftBorder + frameRightBorder, height + frameBottomBorder + frameTopBorder)); frame.setMinimumSize(new Dimension(width + frameLeftBorder + frameRightBorder, height + frameBottomBorder + frameTopBorder)); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addMouseListener(this); frame.requestFocus(); frame.setVisible(true); frame.add(game); } public void initializeBoard() { //UPDATE THE STARTING POSITIONS for (int col = 0; col < (numTilesPerRow); col += 2) { gameData[col][5] = RED; gameData[col][7] = RED; } for (int col = 1; col < (numTilesPerRow); col += 2) { gameData[col][6] = RED; } for (int col = 1; col < (numTilesPerRow); col += 2) { gameData[col][0] = WHITE; gameData[col][2] = WHITE; } for (int col = 0; col < (numTilesPerRow); col += 2) { gameData[col][1] = WHITE; } } public static void drawPiece(int col, int row, Graphics g, Color color) { ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g.setColor(color); // These 2 and 4 values are arbitrary values that compensate for a smaller piece size than tileSize g.fillOval((col * tileSize) + 2, (row * tileSize) + 2, tileSize - 4, tileSize - 4); } public void paint(Graphics g) { // This method paints the board //PRINT THE BOARD & PIECES super.paintComponent(g); for (int row = 0; row < numTilesPerRow; row++) { for (int col = 0; col < numTilesPerRow; col++) { if ((row % 2 == 0 && col % 2 == 0) || (row % 2 != 0 && col % 2 != 0)) { // This assigns the checkerboard pattern baseGameData[col][row] = 0; g.setColor(Color.gray); g.fillRect(col * tileSize, row * tileSize, tileSize, tileSize); } else { baseGameData[col][row] = 1; g.setColor(Color.darkGray); g.fillRect(col * tileSize, row * tileSize, tileSize, tileSize); } if (checkTeamPiece(col, row) == true) { g.setColor(Color.darkGray.darker()); g.fillRect(col * tileSize, row * tileSize, tileSize, tileSize); } if (availablePlays[col][row] == 1) { g.setColor(Color.CYAN.darker()); g.fillRect(col * tileSize, row * tileSize, tileSize, tileSize); } if (gameData[col][row] == WHITE) { drawPiece(col, row, g, Color.white); } else if (gameData[col][row] == WHITE_KING) { drawPiece(col, row, g, Color.white); g.drawImage(crownImage, (col * tileSize) + 6, (row * tileSize) + 6, tileSize - 12, tileSize - 12, null); } else if (gameData[col][row] == RED) { drawPiece(col, row, g, Color.red); } else if (gameData[col][row] == RED_KING) { drawPiece(col, row, g, Color.red); g.drawImage(crownImage, (col * tileSize) + 6, (row * tileSize) + 6, tileSize - 12, tileSize - 12, null); } } } if (gameOver() == true) { gameOverDisplay(g); } } public void gameOverDisplay(Graphics g) { //Displays the game over message String msg = "Game Over"; Font small = new Font("Helvetica", Font.BOLD, 20); FontMetrics metr = getFontMetrics(small); g.setColor(Color.white); g.setFont(small); g.drawString(msg, (width - metr.stringWidth(msg)) / 2, width / 2); } public void resetPlay() { storedCol = 0; storedRow = 0; inPlay = false; isJump = false; for (int row = 0; row < numTilesPerRow; row++) { for (int col = 0; col < numTilesPerRow; col++) { availablePlays[col][row] = 0; } } repaint(); } public void mousePressed(java.awt.event.MouseEvent evt) { int col = (evt.getX() - 8) / tileSize; // 8 is left frame length int row = (evt.getY() - 30) / tileSize; // 30 is top frame length if (inPlay == false && gameData[col][row] != 0 || inPlay == true && checkTeamPiece(col, row) == true) { resetPlay(); storedCol = col; storedRow = row; // Sets the current click to instance variables to be used elsewhere getAvailablePlays(col, row); } else if (inPlay == true && availablePlays[col][row] == 1) { makeMove(col, row, storedCol, storedRow); } else if (inPlay == true && availablePlays[col][row] == 0) { resetPlay(); } } public void swapPlayer() { if (currentPlayer == RED) { currentPlayer = WHITE; } else { currentPlayer = RED; } } public void makeMove(int col, int row, int storedCol, int storedRow) { int x = gameData[storedCol][storedRow]; //change the piece to new tile gameData[col][row] = x; gameData[storedCol][storedRow] = EMPTY; //change old piece location to EMPTY checkKing(col, row); if (isJump == true) { removePiece(col, row, storedCol, storedRow); } resetPlay(); swapPlayer(); } public boolean isKing(int col, int row) { if (gameData[col][row] == RED_KING || gameData[col][row] == WHITE_KING) { return true; } else { return false; } } public int checkOpponent(int col, int row) { if (gameData[col][row] == RED || gameData[col][row] == RED_KING) { return WHITE; } else { return RED; } } public void checkExtraJumps(int col, int row) { int opponent = checkOpponent(col, row); int opponentKing = checkOpponent(col, row) + 1; if (gameData[col - 1][row - 1] == opponent || gameData[col - 1][row - 1] == opponentKing) { availablePlays[col - 1][row - 1] = 1; } else if (gameData[col + 1][row - 1] == opponent || gameData[col + 1][row - 1] == opponentKing) { availablePlays[col + 1][row - 1] = 1; } else if (gameData[col - 1][row + 1] == opponent || gameData[col - 1][row + 1] == opponentKing) { availablePlays[col - 1][row + 1] = 1; } else if (gameData[col + 1][row + 1] == opponent || gameData[col + 1][row + 1] == opponentKing) { availablePlays[col + 1][row + 1] = 1; } repaint(); } public void checkKing(int col, int row) { if (gameData[col][row] == RED && row == 0) { gameData[col][row] = RED_KING; } else if (gameData[col][row] == WHITE && row == numTilesPerRow - 1) { gameData[col][row] = WHITE_KING; } else { return; } } public void removePiece(int col, int row, int storedCol, int storedRow) { //might be a better way to do this, but detects position of opponent piece based on destination and original position int pieceRow = -1; int pieceCol = -1; if (col > storedCol && row > storedRow) { pieceRow = row - 1; pieceCol = col - 1; } if (col > storedCol && row < storedRow) { pieceRow = row + 1; pieceCol = col - 1; } if (col < storedCol && row > storedRow) { pieceRow = row - 1; pieceCol = col + 1; } if (col < storedCol && row < storedRow) { pieceRow = row + 1; pieceCol = col + 1; } gameData[pieceCol][pieceRow] = EMPTY; }//TODO REWRITE public void getAvailablePlays(int col, int row) { inPlay = true; if ((checkTeamPiece(col, row) == true)) { //checks if the piece is assigned to the current player if (gameData[col][row] == RED) { // only goes north, checks the row above it's own getUp(col, row); } if (gameData[col][row] == WHITE) { // only goes south, checks the row below it's own getDown(col, row); } if (gameData[col][row] == RED_KING || gameData[col][row] == WHITE_KING) { // Goes up OR down 1 row below it's own getUp(col, row); //getUp(col, row); getDown(col, row); // GET UP GET UP AND GET DOWN } repaint(); } } public void getUp(int col, int row) { // Get Up availability int rowUp = row - 1; if (col == 0 && row != 0) { //X=0, Y is not 0 for (int i = col; i < col + 2; i++) { //check to right if (gameData[col][row] != 0 && gameData[i][rowUp] != 0) { if (canJump(col, row, i, rowUp) == true) { int jumpCol = getJumpPos(col, row, i, rowUp)[0]; int jumpRow = getJumpPos(col, row, i, rowUp)[1]; availablePlays[jumpCol][jumpRow] = 1; } } else if (baseGameData[i][rowUp] == 1 && gameData[i][rowUp] == 0) { availablePlays[i][rowUp] = 1; } } } else if (col == (numTilesPerRow - 1) && row != 0) { //X=max, Y is not 0 if (gameData[col][row] != 0 && gameData[col - 1][rowUp] != 0) { if (canJump(col, row, col - 1, rowUp) == true) { int jumpCol = getJumpPos(col, row, col - 1, rowUp)[0]; int jumpRow = getJumpPos(col, row, col - 1, rowUp)[1]; availablePlays[jumpCol][jumpRow] = 1; } } else if (baseGameData[col - 1][rowUp] == 1 && gameData[col - 1][rowUp] == 0) { availablePlays[col - 1][rowUp] = 1; } } else if (col != numTilesPerRow - 1 && col != 0 && row != 0) { for (int i = col - 1; i <= col + 1; i++) { if (gameData[col][row] != 0 && gameData[i][rowUp] != 0) { if (canJump(col, row, i, rowUp) == true) { int jumpCol = getJumpPos(col, row, i, rowUp)[0]; int jumpRow = getJumpPos(col, row, i, rowUp)[1]; availablePlays[jumpCol][jumpRow] = 1; } } else if (baseGameData[i][rowUp] == 1 && gameData[i][rowUp] == 0) { availablePlays[i][rowUp] = 1; } } } } public void getDown(int col, int row) { int rowDown = row + 1; if (col == 0 && row != numTilesPerRow - 1) { if (gameData[col][row] != 0 && gameData[col + 1][rowDown] != 0) { if (canJump(col, row, col + 1, rowDown) == true) { int jumpCol = getJumpPos(col, row, col + 1, rowDown)[0]; int jumpRow = getJumpPos(col, row, col + 1, rowDown)[1]; availablePlays[jumpCol][jumpRow] = 1; } } else if (baseGameData[col + 1][rowDown] == 1 && gameData[col + 1][rowDown] == 0) { availablePlays[col + 1][rowDown] = 1; } } else if (col == numTilesPerRow - 1 && row != numTilesPerRow - 1) { if (gameData[col][row] != 0 && gameData[col - 1][rowDown] != 0) { if (canJump(col, row, col - 1, rowDown) == true) { int jumpCol = getJumpPos(col, row, col - 1, rowDown)[0]; int jumpRow = getJumpPos(col, row, col - 1, rowDown)[1]; availablePlays[jumpCol][jumpRow] = 1; } } else if (baseGameData[col - 1][rowDown] == 1 && gameData[col - 1][rowDown] == 0) { availablePlays[col - 1][rowDown] = 1; } } else if (col != numTilesPerRow - 1 && col != 0 && row != numTilesPerRow - 1) { for (int i = col - 1; i <= col + 1; i++) { if (gameData[col][row] != 0 && gameData[i][rowDown] != 0) { if (canJump(col, row, i, rowDown) == true) { int jumpCol = getJumpPos(col, row, i, rowDown)[0]; int jumpRow = getJumpPos(col, row, i, rowDown)[1]; availablePlays[jumpCol][jumpRow] = 1; } } else if (baseGameData[i][rowDown] == 1 && gameData[i][rowDown] == 0) { availablePlays[i][rowDown] = 1; } } } } public boolean checkTeamPiece(int col, int row) { if (currentPlayer == RED && (gameData[col][row] == RED || gameData[col][row] == RED_KING)) //bottom { return true; } if (currentPlayer == WHITE && (gameData[col][row] == WHITE || gameData[col][row] == WHITE_KING)) //top { return true; } else { return false; } } public boolean isLegalPos(int col, int row) { if (row < 0 || row >= numTilesPerRow || col < 0 || col >= numTilesPerRow) { return false; } else { return true; } } public boolean canJump(int col, int row, int opponentCol, int opponentRow) { //Steps for checking if canJump is true: determine piece within movement. Then check if its an opponent piece, then if the space behind it is empty //and in bounds // 4 conditions based on column and row relations to the other piece if (((gameData[col][row] == WHITE || gameData[col][row] == WHITE_KING) && (gameData[opponentCol][opponentRow] == RED || gameData[opponentCol][opponentRow] == RED_KING)) || (gameData[col][row] == RED || gameData[col][row] == RED_KING) && (gameData[opponentCol][opponentRow] == WHITE || gameData[opponentCol][opponentRow] == WHITE_KING)) { //If the piece is white/red and opponent piece is opposite TODO fix this if. It's so ugly if (opponentCol == 0 || opponentCol == numTilesPerRow - 1 || opponentRow == 0 || opponentRow == numTilesPerRow - 1) { return false; } int[] toData = getJumpPos(col, row, opponentCol, opponentRow); if (isLegalPos(toData[0], toData[1]) == false) //check board outofbounds { return false; } if (gameData[toData[0]][toData[1]] == 0) { isJump = true; return true; } } return false; } public int[] getJumpPos(int col, int row, int opponentCol, int opponentRow) { if (col > opponentCol && row > opponentRow && gameData[col - 2][row - 2] == 0) { return new int[]{col - 2, row - 2}; } else if (col > opponentCol && row < opponentRow && gameData[col - 2][row + 2] == 0) { return new int[]{col - 2, row + 2}; } else if (col < opponentCol && row > opponentRow && gameData[col + 2][row - 2] == 0) { return new int[]{col + 2, row - 2}; } else { return new int[]{col + 2, row + 2}; } } // Methods that must be included for some reason? WHY public void mouseClicked(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void actionPerformed(ActionEvent e) { } }
[ "noreply@github.com" ]
noreply@github.com
bf9734c39de5736d3e4971c0af9595992e5e8616
05a7a70a08229dd18ce6c7161e6e45c33981b500
/Project_JavaFx/src/Project_JavaFx/Controller/Main_Project.java
be0b1f63c16b586f1d29c4266c5365018dde0c03
[]
no_license
nghgr2208/duan
11663bea328505d77c13a8fc4741364c73d79ce1
c7c88f11b37f1d44d315e71dc9ef8e825d6a23c8
refs/heads/master
2022-11-26T17:07:07.051521
2020-07-24T02:33:49
2020-07-24T02:33:49
282,100,745
0
0
null
null
null
null
UTF-8
Java
false
false
912
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 Project_JavaFx.Controller; import java.io.IOException; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.stage.Stage; /** * * @author lehie */ public class Main_Project extends Application { @Override public void start(Stage primaryStage) throws IOException { Navigator.getInstance().setStage(primaryStage); Navigator.getInstance().getStage().setTitle("Quản Lý Bán Ô Tô"); Navigator.getInstance().goToLogin(); Navigator.getInstance().getStage().show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }
[ "you@example.com" ]
you@example.com
56c92c079e02dd29cb41dc5e0fb74223650f76e6
fa0798ca885db758d91f76aeb772e203fb7287f5
/src/main/java/me/deepak/interview/tree/binary/RightSideView.java
281c5b2a89a72f6fd12049bc567df5e6514e4126
[ "Apache-2.0" ]
permissive
deepaksingh100/interview-prep
60fa40d9143690168dd75a27a273f260d4d5cdda
68793ba33e9733a16f7b49bf8a4d17f9065e5ed6
refs/heads/master
2021-07-20T20:50:08.594034
2020-06-08T04:27:03
2020-06-08T04:27:03
181,392,559
2
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package me.deepak.interview.tree.binary; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.List; import java.util.Queue; import me.deepak.interview.tree.binary.beans.Node; /* * https://www.geeksforgeeks.org/print-right-view-binary-tree-2/ * https://leetcode.com/problems/binary-tree-right-side-view/ */ public class RightSideView { private int maxLevel = 0; public List<Integer> rightSideView(Node root) { List<Integer> view = new ArrayList<>(); rightSideView(root, 1, view); return view; } private void rightSideView(Node root, int level, List<Integer> view) { if (root == null) { return; } if (maxLevel < level) { view.add(root.getKey()); maxLevel = level; } rightSideView(root.getRight(), level + 1, view); rightSideView(root.getLeft(), level + 1, view); } public List<Integer> rightSideViewIterative(Node root) { List<Integer> rightView = new ArrayList<>(); if (root == null) { return rightView; } Queue<Node> queue = new ArrayDeque<>(); queue.add(root); while (!queue.isEmpty()) { int size = queue.size(); for (int i = 1; i <= size; i++) { root = queue.remove(); if (i == size) { rightView.add(root.getKey()); } if (root.getLeft() != null) { queue.add(root.getLeft()); } if (root.getRight() != null) { queue.add(root.getRight()); } } } return rightView; } }
[ "singhdpk100@gmail.com" ]
singhdpk100@gmail.com