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
e10f05aeba67227959dd034fe6b724075450d749
c55fb4ab84484b9eadcb852d26ed35236fc536d9
/AddresBook/src/com/quantum/addresbook/Productos.java
cf9cd63a1788cb1f941d250eff355cdefedacb67
[]
no_license
esvin/AddressBookAndroidApp
c5ddbad9797757acf5f00eeff6febf2ffd588632
92646eb91e453ec4eb87ce3e672a97fba2838813
refs/heads/master
2020-04-24T23:06:39.847900
2015-04-30T04:01:41
2015-04-30T04:01:41
34,833,157
0
0
null
null
null
null
UTF-8
Java
false
false
2,313
java
package com.quantum.addresbook; import java.util.ArrayList; import java.util.HashMap; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.AdapterView.OnItemClickListener; public class Productos extends ListActivity{ Intent intent; TextView productoId; DBTools dbtools = new DBTools(this); String personaId=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.productos_start); Intent theIntent = getIntent(); personaId = theIntent.getStringExtra("Cod_Persona"); ArrayList<HashMap<String,String>> contactList = dbtools.getAllProductos(); if(contactList.size()!=0){ ListView listView = getListView(); listView.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> arg0, View view, int arg2, long arg3) { productoId =(TextView) view.findViewById(R.id.productoid); String productoIdValue = productoId.getText().toString(); Intent theIntent = new Intent(getApplication(), NewCarrito.class); theIntent.putExtra("Cod_Producto", productoIdValue); theIntent.putExtra("Cod_Persona",personaId); startActivity(theIntent); }}); ListAdapter adapter = new SimpleAdapter(Productos.this,contactList,R.layout.product_entry, new String[]{"Cod_Producto","Nombre_Producto"}, new int[]{R.id.productoid,R.id.productdata}); setListAdapter(adapter); } } public void showCarrito(View view){ Intent theIntent = new Intent(getApplicationContext(), Carrito.class); theIntent.putExtra("Cod_Persona", personaId); startActivity( theIntent ); } public void showReporte(View view){ Intent theIntent = new Intent(getApplicationContext(), Reporte.class); theIntent.putExtra("Cod_Persona", personaId); startActivity( theIntent ); } }
a17ebfb0764a1a088006ca48907fed3daf8427a3
32e15465c5ae289a665c603e2780c85dafbafcc7
/P0841_HandlerRunnable/src/main/java/ru/startandroid/p0841_handlerrunnable/MainActivity.java
44f7fd980921f8e075a480ae50994a9da1b52af1
[]
no_license
ExploiD2005/AndriodLessons
5a6de7629a51fa4a59a00fc2595428875e4f6a33
a4574acc83bd40325b80a95579efb0086434f99b
refs/heads/master
2020-12-20T18:33:55.646535
2020-01-25T13:16:35
2020-01-25T13:16:35
236,171,211
1
0
null
null
null
null
UTF-8
Java
false
false
2,758
java
package ru.startandroid.p0841_handlerrunnable; import android.support.v7.app.AppCompatActivity; import java.util.concurrent.TimeUnit; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ProgressBar; import android.widget.TextView; public class MainActivity extends AppCompatActivity { ProgressBar pbCount; TextView tvInfo; CheckBox chbInfo; int cnt; final String LOG_TAG = "myLogs"; final int max = 100; Handler h; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); h = new Handler(); pbCount = (ProgressBar) findViewById(R.id.pbCount); pbCount.setMax(max); pbCount.setProgress(0); tvInfo = (TextView) findViewById(R.id.tvInfo); chbInfo = (CheckBox) findViewById(R.id.chbInfo); chbInfo.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { tvInfo.setVisibility(View.VISIBLE); // показываем информацию h.post(showInfo); } else { tvInfo.setVisibility(View.GONE); // отменяем показ информации h.removeCallbacks(showInfo); } } }); Thread t = new Thread(new Runnable() { public void run() { try { for (cnt = 1; cnt < max; cnt++) { TimeUnit.MILLISECONDS.sleep(100); // обновляем ProgressBar h.post(updateProgress); } } catch (InterruptedException e) { e.printStackTrace(); } } }); t.start(); } // обновление ProgressBar Runnable updateProgress = new Runnable() { public void run() { pbCount.setProgress(cnt); } }; // показ информации Runnable showInfo = new Runnable() { public void run() { Log.d(LOG_TAG, "showInfo"); tvInfo.setText("Count = " + cnt); // планирует сам себя через 1000 мсек h.postDelayed(showInfo, 1000); } }; }
ea88050310fc735b538a13ae2c4c36b880a26e1a
f38aca8b52123f39ccca67bc04e7a923b0e561b3
/imapstore/src/com/android/email/mail/Sender.java
4ec19c87b0684a934260ab16aa814112669b0ed0
[]
no_license
xulubo/babynotes
2049b9ec5726fb2a71d6e0b22e2a05b5d7f2440a
75e9e8750c0021ff68d7381bd22510add31457e7
refs/heads/master
2021-03-12T20:44:32.658387
2013-07-03T20:53:40
2013-07-03T20:53:40
11,161,135
2
0
null
null
null
null
UTF-8
Java
false
false
6,050
java
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.email.mail; import com.android.email.Email; import com.android.email.R; import org.xmlpull.v1.XmlPullParserException; import android.content.Context; import android.content.res.XmlResourceParser; import android.util.Log; import java.io.IOException; public abstract class Sender { protected static final int SOCKET_CONNECT_TIMEOUT = 10000; private static java.util.HashMap<String, Sender> mSenders = new java.util.HashMap<String, Sender>(); /** * Static named constructor. It should be overrode by extending class. * Because this method will be called through reflection, it can not be protected. */ public static Sender newInstance(String uri, Context context) throws MessagingException { throw new MessagingException("Sender.newInstance: Unknown scheme in " + uri); } private static Sender instantiateSender(String className, String uri, Context context) throws MessagingException { Object o = null; try { Class<?> c = Class.forName(className); // and invoke "newInstance" class method and instantiate sender object. java.lang.reflect.Method m = c.getMethod("newInstance", String.class, Context.class); o = m.invoke(null, uri, context); } catch (Exception e) { Log.d(Email.LOG_TAG, String.format( "exception %s invoking %s.newInstance.(String, Context) method for %s", e.toString(), className, uri)); throw new MessagingException("can not instantiate Sender object for " + uri); } if (!(o instanceof Sender)) { throw new MessagingException( uri + ": " + className + " create incompatible object"); } return (Sender) o; } /** * Find Sender implementation consulting with sender.xml file. */ private static Sender findSender(int resourceId, String uri, Context context) throws MessagingException { Sender sender = null; try { XmlResourceParser xml = context.getResources().getXml(resourceId); int xmlEventType; // walk through senders.xml file. while ((xmlEventType = xml.next()) != XmlResourceParser.END_DOCUMENT) { if (xmlEventType == XmlResourceParser.START_TAG && "sender".equals(xml.getName())) { String scheme = xml.getAttributeValue(null, "scheme"); if (uri.startsWith(scheme)) { // found sender entry whose scheme is matched with uri. // then load sender class. String className = xml.getAttributeValue(null, "class"); sender = instantiateSender(className, uri, context); } } } } catch (XmlPullParserException e) { // ignore } catch (IOException e) { // ignore } return sender; } public synchronized static Sender getInstance(String uri, Context context) throws MessagingException { Sender sender = mSenders.get(uri); if (sender == null) { //sender = findSender(R.xml.senders_product, uri, context); if (sender == null) { //sender = findSender(R.xml.senders, uri, context); } if (sender != null) { mSenders.put(uri, sender); } } if (sender == null) { throw new MessagingException("Unable to locate an applicable Transport for " + uri); } return sender; } /** * Get class of SettingActivity for this Sender class. * @return Activity class that has class method actionEditOutgoingSettings(). */ public Class<? extends android.app.Activity> getSettingActivityClass() { // default SettingActivity class //return com.android.email.activity.setup.AccountSetupOutgoing.class; return null; } public abstract void open() throws MessagingException; public String validateSenderLimit(Message message) { return null; } /** * Check message has any limitation of Sender or not. * * @param message the message that will be checked. * @throws LimitViolationException */ public void checkSenderLimitation(Message message) throws LimitViolationException, MessagingException { } public static class LimitViolationException extends MessagingException { public final int mMsgResourceId; public final long mActual; public final long mLimit; private LimitViolationException(int msgResourceId, long actual, long limit) { super(UNSPECIFIED_EXCEPTION); mMsgResourceId = msgResourceId; mActual = actual; mLimit = limit; } public static void check(int msgResourceId, long actual, long limit) throws LimitViolationException { if (actual > limit) { throw new LimitViolationException(msgResourceId, actual, limit); } } } public abstract void sendMessage(Message message) throws MessagingException; public abstract void close() throws MessagingException; }
f006b5cf4da4bb8bf8109886eb1ec2fad16b8614
09572e2cb6203a40ee2e49e66f78c0b16fc4043e
/app/src/main/java/com/myxh/leetcode/linkedlist/L234_PalindromeLinkedList.java
bd36cb39ed0f0656cc762fc0b976cdc0ce984d55
[ "MIT" ]
permissive
myxh/LeetCode-Practice
db4b5fa68f8320918a56c06158e7b2353db0010c
02a6744961e0bd0b60b01d2271f9eb3997933170
refs/heads/master
2020-05-17T23:17:53.949967
2019-09-05T07:11:26
2019-09-05T07:11:26
184,027,545
0
0
null
null
null
null
UTF-8
Java
false
false
2,785
java
package com.myxh.leetcode.linkedlist; /**l;. * Given a singly linked list, determine if it is a palindrome. * * Example 1: * * Input: 1->2 * Output: false * Example 2: * * Input: 1->2->2->1 * Output: true */ public class L234_PalindromeLinkedList { public static void main(String[] args) { int[] l1Array = {1, 2, 2, 1}; ListNode list1 = ListUtils.getList(l1Array); ListUtils.print(list1); System.out.println(isPalindrome(list1)); } /** * Runtime: 1 ms, faster than 99.08% of Java online submissions for Palindrome Linked List. * Memory Usage: 40 MB, less than 98.78% of Java online submissions for Palindrome Linked List. */ public static boolean isPalindrome(ListNode head) { if (head == null || head.next == null) { return true; } ListNode slow = head; ListNode fast = head.next.next; //翻转后的前半段链表 ListNode result = null; //将前半段链表翻转 while (true) { ListNode tmp = result; result = slow; slow = slow.next; result.next = tmp; if (fast != null && fast.next != null) { fast = fast.next.next; } else { break; } } //元素个数为单数,单独处理 slow 指针 if (fast != null && fast.next == null) { slow = slow.next; } //依次对比前半段和后半段链表元素 while (slow != null && result != null) { if (slow.val != result.val) { return false; } slow = slow.next; result = result.next; } //前半段和后半段链表完全一致,说明是回文链表 return true; } /** * 高赞答案 */ public static boolean isPalindrome1(ListNode head) { if(head == null) { return true; } ListNode p1 = head; ListNode p2 = head; ListNode p3 = p1.next; ListNode pre = p1; //find mid pointer, and reverse head half part while(p2.next != null && p2.next.next != null) { p2 = p2.next.next; pre = p1; p1 = p3; p3 = p3.next; p1.next = pre; } //odd number of elements, need left move p1 one step if(p2.next == null) { p1 = p1.next; } else { //even number of elements, do nothing } //compare from mid to head/tail while(p3 != null) { if(p1.val != p3.val) { return false; } p1 = p1.next; p3 = p3.next; } return true; } }
e6181f7cd97d2232d79b8be422c8dce8492e6092
0900859b53f69e8d9cd956ee3072219aa2ed9583
/src/test/java/project/interpreter/IncorrectnessTests/DefaultParameters.java
e3b9ccfd308560359b53ef5f9c62d993624cabe0
[]
no_license
MonikaBer/Imperative_Language_Interpreter
600b8d2024b8c2f6c3b0c1cd371d80620c42d682
ba4f1846cccaea5bf39413d1a74f44c64b5c58ab
refs/heads/main
2023-02-22T13:29:02.493090
2021-01-26T05:43:35
2021-01-26T05:43:35
317,967,839
0
0
null
null
null
null
UTF-8
Java
false
false
4,059
java
package project.interpreter.IncorrectnessTests; import org.junit.jupiter.api.Test; import project.exceptions.SemanticError; import project.interpreter.Interpreter; import project.lexer.Lexer; import project.parser.Parser; import project.program.Program; import project.source.FileSource; import project.source.Source; import java.io.*; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Paths; import java.util.Scanner; import static org.junit.jupiter.api.Assertions.assertEquals; public class DefaultParameters { private String path = "fileSources/errors/defaultParameters/"; @Test void shouldInterpretTooLittleParameters() throws IOException, URISyntaxException { String srcFile = "shouldInterpretTooLittleParameters"; URL res = getClass().getClassLoader().getResource(path + srcFile); Source source; assert res != null; source = new FileSource(Paths.get(res.toURI()).toString()); Lexer lexer = new Lexer(source); Parser parser = new Parser(lexer); Program program = parser.parseProgram(); StringWriter writer = new StringWriter(); Interpreter interpreter = new Interpreter(program, writer, new Scanner(new InputStreamReader(InputStream.nullInputStream())), new OutputStreamWriter(OutputStream.nullOutputStream())); try { interpreter.execute(); interpreter.start(); } catch (SemanticError semanticError) { assertEquals("Incorrect order, number or type of params in func call", semanticError.getDesc()); assertEquals(8, semanticError.getLineNr()); assertEquals(4, semanticError.getPositionAtLine()); } } @Test void shouldInterpretWrongTypesOfParameters() throws IOException, URISyntaxException { String srcFile = "shouldInterpretWrongTypesOfParameters"; URL res = getClass().getClassLoader().getResource(path + srcFile); Source source; assert res != null; source = new FileSource(Paths.get(res.toURI()).toString()); Lexer lexer = new Lexer(source); Parser parser = new Parser(lexer); Program program = parser.parseProgram(); StringWriter writer = new StringWriter(); Interpreter interpreter = new Interpreter(program, writer, new Scanner(new InputStreamReader(InputStream.nullInputStream())), new OutputStreamWriter(OutputStream.nullOutputStream())); try { interpreter.execute(); interpreter.start(); } catch (SemanticError semanticError) { assertEquals("Type required by param of func call is double, but value isn't double", semanticError.getDesc()); assertEquals(8, semanticError.getLineNr()); assertEquals(11, semanticError.getPositionAtLine()); } } @Test void shouldInterpretTooMuchParameters() throws IOException, URISyntaxException { String srcFile = "shouldInterpretTooMuchParameters"; URL res = getClass().getClassLoader().getResource(path + srcFile); Source source; assert res != null; source = new FileSource(Paths.get(res.toURI()).toString()); Lexer lexer = new Lexer(source); Parser parser = new Parser(lexer); Program program = parser.parseProgram(); StringWriter writer = new StringWriter(); Interpreter interpreter = new Interpreter(program, writer, new Scanner(new InputStreamReader(InputStream.nullInputStream())), new OutputStreamWriter(OutputStream.nullOutputStream())); try { interpreter.execute(); interpreter.start(); } catch (SemanticError semanticError) { assertEquals("Too much params in func call - 2 params are permitted", semanticError.getDesc()); assertEquals(8, semanticError.getLineNr()); assertEquals(13, semanticError.getPositionAtLine()); } } }
7ec161cf319556079fb391d0580804607bbe21a6
e686c34c4354206a761cb0d0e4496a06222a1f8e
/app/src/main/java/com/glp/pageload/http/HttpRepository.java
df23d3f72c96247baf897b3d385a12215a73d391
[]
no_license
DoublePengs/PageLoad
e4c51e06d675e0b815af1a1ae396964d938e9368
fab29ee212af153e3ccf6b08699bffa8cad39824
refs/heads/master
2020-03-09T10:15:06.279283
2018-04-10T09:45:04
2018-04-10T09:45:04
128,732,728
0
0
null
null
null
null
UTF-8
Java
false
false
3,989
java
package com.glp.pageload.http; import android.content.Context; import com.glp.pageload.BuildConfig; import com.glp.pageload.bean.ArticleBean; import com.glp.pageload.bean.HttpResult; import java.util.List; import java.util.concurrent.TimeUnit; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; import rx.Observable; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Func1; import rx.schedulers.Schedulers; /** * Created by Guolipeng on 2018/4/8. * 网络请求仓库类 */ public class HttpRepository implements DataSource { private volatile static HttpRepository INSTANCE; private Context mContext; private HttpMethod mHttpMethod; private HttpRepository(Context context) { initHttpMethod(context, BuildConfig.BASE_URL); } public static HttpRepository getInstance(Context context) { if (INSTANCE == null) { synchronized (HttpRepository.class) { if (INSTANCE == null) { INSTANCE = new HttpRepository(context); } } } return INSTANCE; } private void initHttpMethod(Context context, String baseUrl) { mContext = context.getApplicationContext(); HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); OkHttpClient httpClientBuilder = new OkHttpClient.Builder() .addInterceptor(interceptor) .connectTimeout(5, TimeUnit.SECONDS) // .retryOnConnectionFailure(true) // 设置出现错误进行重新连接。 .build(); Retrofit retrofit = new Retrofit.Builder() .client(httpClientBuilder) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .baseUrl(baseUrl) .build(); mHttpMethod = retrofit.create(HttpMethod.class); } @Override public void getArticleList(String category, int pageSize, int page, final RequestCallback callback) { Subscription subscription = mHttpMethod.getArticleList(category, pageSize, page) .compose(this.<HttpResult<List<ArticleBean>>>applySchedulers()) .map(new HttpResultFunc<List<ArticleBean>>()) .subscribe(new MySubscriber<List<ArticleBean>>() { @Override protected void onMyCompleted() { } @Override protected void onMyError(String msg) { callback.onDataError(msg); } @Override protected void onMyNext(List<ArticleBean> articleList) { callback.onDataLoaded(articleList); } }); callback.onSubscription(subscription); } // ######################################################### <T> Observable.Transformer<T, T> applySchedulers() { return (Observable.Transformer<T, T>) schedulersTransformer; } private final Observable.Transformer schedulersTransformer = new Observable.Transformer() { @Override public Object call(Object observable) { return ((Observable) observable).subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); } }; private class HttpResultFunc<T> implements Func1<HttpResult<T>, T> { @Override public T call(HttpResult<T> result) { if (!result.isError()) { return result.getResults(); } else { throw new DataErrorException(result); } } } }
6bddd641c9240c356ee9515e49c66d01e4ac2404
f6cbafe1f94276a98a43b937ff7178adab49193d
/spring-roo-angular/application/src/main/java/com/springsource/petclinic/application/web/api/OwnersCollectionJsonController.java
cca0d725c0a28c63b926d27772e6f96a46e2bf58
[]
no_license
zhouz1993/proofs
3f81b22f32f7894b204426fb43e2603d1516d9d4
6409903f826be9a991bf9d1907e54cb2cde1c46f
refs/heads/master
2020-04-05T12:46:57.272056
2018-05-10T14:51:49
2018-05-10T14:51:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,297
java
package com.springsource.petclinic.application.web.api; import com.springsource.petclinic.model.Owner; import io.springlets.data.domain.GlobalSearch; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.roo.addon.web.mvc.controller.annotations.ControllerType; import org.springframework.roo.addon.web.mvc.controller.annotations.RooController; import org.springframework.roo.addon.web.mvc.controller.annotations.responses.json.RooJSON; import org.springframework.web.bind.annotation.GetMapping; import java.util.List; /** * = OwnersCollectionJsonController * * TODO Auto-generated class documentation * */ @RooController(entity = Owner.class, pathPrefix = "/api", type = ControllerType.COLLECTION) @RooJSON public class OwnersCollectionJsonController { /** * Method that returns a page with all the registered owners * * @param globalSearch * @param pageable * @return ResponseEntity */ @GetMapping(name = "list") public ResponseEntity<Page<Owner>> list(GlobalSearch globalSearch, Pageable pageable) { Page<Owner> owners = getOwnerService().findAll(globalSearch, pageable); return ResponseEntity.ok(owners); } }
c07be152bf346f0c6358ea9c63acc43be05a3573
b3f577103b45cccc3846a0e47c46c87d214bca0d
/Week 6/WS5/src/EnterStudentInfo.java
bdf89026b8baa8383a21f8e4ef9f65e18aa403c4
[]
no_license
shersingh7/JAC444
4afd7d369ef846825b8a6c413b244483aacb33c8
822a1545462c5ab2099d2efede653fa6dfeaac52
refs/heads/master
2023-07-05T04:48:47.034381
2021-08-11T00:56:07
2021-08-11T00:56:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,145
java
/* Name: Davinder Verma Section: NBB Student Number: 121802201 Email: [email protected] Date: 30/06/2021 Workshop: 5 */ import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.util.ArrayList; public class EnterStudentInfo extends JFrame { private JPanel content; private JTextField idField; private JTextField firstNameField; private JTextField lastNameField; private JTextField courseField; private JLabel error; private JLabel error2; private JLabel errorMain; ArrayList<Student> arrayList = new ArrayList<>(); Integer sID; public EnterStudentInfo() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); content = new JPanel(); content.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(content); content.setLayout(null); JLabel idLabel = new JLabel("Student ID: "); idLabel.setBounds(50, 15, 90, 15); content.add(idLabel); idField = new JTextField(); idField.setBounds(140, 10, 130, 25); content.add(idField); idField.setColumns(10); error = new JLabel("Wrong Entry!!!"); error.setForeground(Color.RED); error.setBounds(290,15,90,15); content.add(error); error.setVisible(false); JLabel fNameLabel = new JLabel("First Name: "); fNameLabel.setBounds(50, 55, 90, 15); content.add(fNameLabel); firstNameField = new JTextField(); firstNameField.setBounds(140, 50, 130, 25); content.add(firstNameField); firstNameField.setColumns(10); JLabel lNameLabel = new JLabel("Last Name: "); lNameLabel.setBounds(50, 100, 90, 15); content.add(lNameLabel); lastNameField = new JTextField(); lastNameField.setBounds(140, 90, 130, 25); content.add(lastNameField); lastNameField.setColumns(10); JLabel courseLabel = new JLabel("Courses: "); courseLabel.setBounds(50, 140, 90, 15); content.add(courseLabel); courseField = new JTextField(); courseField.setBounds(140, 135, 130, 25); content.add(courseField); courseField.setColumns(10); error2 = new JLabel("Can't be empty!!!"); error2.setForeground(Color.RED); error2.setBounds(283,136,96,16); content.add(error2); error2.setVisible(false); errorMain = new JLabel("You have entered something wrong!!!"); errorMain.setForeground(Color.RED); errorMain.setBounds(60,150,89,16); content.add(errorMain); errorMain.setVisible(false); JButton save = new JButton("Save"); SaveHandler sHandler = new SaveHandler(); save.addActionListener(sHandler); save.setBounds(45, 225, 117, 29); content.add(save); JButton submit = new JButton("Submit"); SubmitHandler subHandler = new SubmitHandler(); submit.addActionListener(subHandler); submit.setBounds(290, 225, 117, 29); content.add(submit); } private class SaveHandler implements ActionListener { @Override public void actionPerformed(ActionEvent e) { Student student = new Student(); String id = idField.getText(); String courses = courseField.getText(); if(courses.isEmpty()) { error2.setVisible(true); } student.setCourses(courses); try { sID = Integer.parseInt(id); if (error.isVisible()) { error.setVisible(false); } if (error2.isVisible()){ error2.setVisible(false); } student.setStdID(sID); student.setFirstName(firstNameField.getText()); student.setLastName(lastNameField.getText()); arrayList.add(student); clearFields(); } catch (Throwable e2) { error.setVisible(true); e2.printStackTrace(); } } } private class SubmitHandler implements ActionListener { @Override public void actionPerformed(ActionEvent e) { try { boolean ok = writeInfo(); if (!ok) { System.out.println("Didn't worked"); errorMain.setVisible(true); } System.exit(0); } catch (Throwable e2) { e2.printStackTrace(); } } } public boolean writeInfo() { boolean ok = true; try (ObjectOutputStream objOut = new ObjectOutputStream(new FileOutputStream("Student.txt"))) { objOut.writeObject(arrayList); objOut.close(); objOut.flush(); } catch (IOException e) { System.out.println(e); ok = false; } return ok; } public void clearFields(){ idField.setText(""); firstNameField.setText(""); lastNameField.setText(""); courseField.setText(""); if(error.isVisible()) { error.setVisible(false); } if(error2.isVisible()) { error2.setVisible(false); } if(errorMain.isVisible()) { errorMain.setVisible(false); } } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { EnterStudentInfo main = new EnterStudentInfo(); main.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } }
d8bda939771e364315df0a0103bbba8e23205ecb
641a5420e858431f6f65855241f11ac32f2fd5f2
/Wordguess.java
34adcbba0dc90dd702f9112ba6b222ccdeb8e7d1
[]
no_license
LIFEHACK2K/CODETOBER
f587484b4966c5e70c1b67e975e42edd979da338
9d1f6bd6f07ca9c2715a03200bfe4fb25d7a26b0
refs/heads/main
2023-08-23T01:00:58.252105
2021-10-02T15:34:47
2021-10-02T15:34:47
412,566,450
0
0
null
null
null
null
UTF-8
Java
false
false
892
java
import java.util.*; public class Wordguess { public static void main(String[] args) { Scanner sc= new Scanner(System.in); String secretword="Apple"; String guessword=""; int attempt=0; int maxattempt=3; boolean win=false; while(!guessword.equals(secretword)&&!win) { if(attempt<maxattempt) { System.out.println("Enter A Guess"); guessword=sc.nextLine(); attempt++; } else { win=true; } } if(win) { System.out.println("You Lose!!"); } else { System.out.println("You Win and You Used "+attempt+"attempts"); } // TODO code application logic here } }
c8a0a71efee674fa6fe174a33b4c9a9232a3304d
c7843a400e8ef18ffe1804460f4fd7906bf85f5f
/platform/execution-impl/src/com/intellij/execution/ui/BeforeRunComponent.java
8b851620198a3f6996e61dcb604042bed476ab46
[ "Apache-2.0" ]
permissive
Starmel/intellij-community
727e8d042b649125f544ec92312ae04dabdbd605
adb89951109732e585d04f33e3fabbc9f9d3b256
refs/heads/master
2023-01-20T01:17:42.933548
2020-11-26T16:06:47
2020-11-26T16:21:19
316,296,645
0
0
Apache-2.0
2020-11-26T17:26:30
2020-11-26T17:26:25
null
UTF-8
Java
false
false
12,680
java
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.ui; import com.intellij.execution.BeforeRunTask; import com.intellij.execution.BeforeRunTaskProvider; import com.intellij.execution.ExecutionBundle; import com.intellij.execution.configurations.RunConfiguration; import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl; import com.intellij.execution.impl.UnknownBeforeRunTaskProvider; import com.intellij.icons.AllIcons; import com.intellij.ide.DataManager; import com.intellij.ide.dnd.*; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.PossiblyDumbAware; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.ListPopup; import com.intellij.openapi.util.Conditions; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Key; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.InplaceButton; import com.intellij.ui.components.labels.LinkLabel; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.JBEmptyBorder; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.WrapLayout; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; import java.util.stream.Collectors; public final class BeforeRunComponent extends JPanel implements DnDTarget, Disposable { private final List<TaskButton> myTags = new ArrayList<>(); private final InplaceButton myAddButton; private final JPanel myAddPanel; private final LinkLabel<Object> myAddLabel; private final JLabel myDropFirst = new JLabel(AllIcons.General.DropPlace); Runnable myChangeListener; private BiConsumer<Key<? extends BeforeRunTask<?>>, Boolean> myTagListener; private RunConfiguration myConfiguration; public BeforeRunComponent(@NotNull Disposable parentDisposable) { super(new WrapLayout(FlowLayout.LEADING, 0, FragmentedSettingsBuilder.TAG_VGAP)); Disposer.register(parentDisposable, this); add(Box.createVerticalStrut(30)); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); myDropFirst.setBorder(JBUI.Borders.empty()); panel.add(myDropFirst); panel.setPreferredSize(myDropFirst.getPreferredSize()); add(panel); myDropFirst.setVisible(false); JBEmptyBorder border = JBUI.Borders.emptyRight(5); myAddButton = new InplaceButton(ExecutionBundle.message("run.configuration.before.run.add.task"), AllIcons.General.Add, e -> showPopup()); myAddPanel = new JPanel(); myAddPanel.setBorder(border); myAddPanel.add(myAddButton); myAddLabel = new LinkLabel<>(ExecutionBundle.message("run.configuration.before.run.add.task"), null, (aSource, aLinkData) -> showPopup()); myAddLabel.setBorder(border); DnDManager.getInstance().registerTarget(this, this, this); } private List<BeforeRunTaskProvider<BeforeRunTask<?>>> getProviders() { return ContainerUtil.filter(BeforeRunTaskProvider.EP_NAME.getExtensions(myConfiguration.getProject()), provider -> provider.createTask(myConfiguration) != null); } private TaskButton createTag(BeforeRunTaskProvider<BeforeRunTask<?>> provider) { TaskButton button = new TaskButton(provider, () -> { myChangeListener.run(); updateAddLabel(); myTagListener.accept(provider.getId(), false); }); myTags.add(button); return button; } private void updateAddLabel() { myAddLabel.setVisible(getEnabledTasks().isEmpty()); } public void showPopup() { DefaultActionGroup group = new DefaultActionGroup(); for (BeforeRunTaskProvider<BeforeRunTask<?>> provider : getProviders()) { group.add(new TagAction(provider)); } ListPopup popup = JBPopupFactory .getInstance().createActionGroupPopup(ExecutionBundle.message("add.new.before.run.task.name"), group, DataManager.getInstance().getDataContext(myAddButton), false, false, false, null, -1, Conditions.alwaysTrue()); popup.showUnderneathOf(myAddButton); } public void addOrRemove(Key<? extends BeforeRunTask<?>> providerId, boolean add) { TaskButton taskButton = ContainerUtil.find(myTags, button -> button.myProvider.getId() == providerId); if (add) { if (taskButton == null) { createTask(null, ContainerUtil.find(getProviders(), provider -> providerId == provider.getId())); } } else if (taskButton != null) { myTags.remove(taskButton); } } private void createTask(@Nullable AnActionEvent e, BeforeRunTaskProvider<BeforeRunTask<?>> myProvider) { BeforeRunTask<?> task = myProvider.createTask(myConfiguration); if (task == null) return; TaskButton tag = createTag(myProvider); if (e == null) { addTask(tag, task); return; } myProvider.configureTask(e.getDataContext(), myConfiguration, task).onSuccess(changed -> { if (!myProvider.canExecuteTask(myConfiguration, task)) { return; } addTask(tag, task); }); } private void addTask(TaskButton tag, BeforeRunTask<?> task) { task.setEnabled(true); tag.setTask(task); myTags.remove(tag); myTags.add(tag); buildPanel(); myChangeListener.run(); myTagListener.accept(tag.myProvider.getId(), true); } public void reset(@NotNull RunnerAndConfigurationSettingsImpl s) { myConfiguration = s.getConfiguration(); for (TaskButton tag : myTags) { remove(tag); } myTags.clear(); List<BeforeRunTask<?>> tasks = s.getManager().getBeforeRunTasks(s.getConfiguration()); for (BeforeRunTask<?> task : tasks) { BeforeRunTaskProvider taskProvider = ContainerUtil.find(getProviders(), provider -> task.getProviderId() == provider.getId()); if (taskProvider == null) { taskProvider = new UnknownBeforeRunTaskProvider(task.getProviderId().toString()); } createTag(taskProvider).setTask(task); } buildPanel(); } private void buildPanel() { remove(myAddPanel); remove(myAddLabel); for (TaskButton tag : myTags) { add(tag); } add(myAddPanel); add(myAddLabel); updateAddLabel(); } public void apply(RunnerAndConfigurationSettingsImpl s) { s.getManager().setBeforeRunTasks(s.getConfiguration(), getEnabledTasks()); } @NotNull private List<BeforeRunTask<?>> getEnabledTasks() { return myTags.stream() .filter(button -> button.myTask != null && button.isVisible()) .map(button -> button.myTask) .collect(Collectors.toList()); } @Override public void drop(DnDEvent event) { TagButton replaceButton = getReplaceButton(event); if (replaceButton == null ) return; TaskButton button = (TaskButton)event.getAttachedObject(); int i = myTags.indexOf(replaceButton); myTags.remove(button); myTags.add(i, button); buildPanel(); myChangeListener.run(); IdeFocusManager.getInstance(myConfiguration.getProject()).requestFocus(button, false); } @Override public void cleanUpOnLeave() { if (myTags != null) { myTags.forEach(button -> button.showDropPlace(false)); } myDropFirst.setVisible(false); } private TagButton getReplaceButton(DnDEvent event) { Object object = event.getAttachedObject(); if (!(object instanceof TaskButton)) { return null; } Rectangle area = new Rectangle(event.getPoint().x - 5, event.getPoint().y - 5, 10, 10); TaskButton button = ContainerUtil.find(myTags, tag -> tag.isVisible() && tag.getBounds().intersects(area)); if (button == null || button == object) return null; boolean left = button.getBounds().getCenterX() > event.getPoint().x; int i = myTags.indexOf(button); if (i < myTags.indexOf(object)) { if (!left) { button = ContainerUtil.find(myTags, b -> b.isVisible() && myTags.indexOf(b) > i); } } else if (left) { button = ContainerUtil.findLast(myTags, b -> b.isVisible() && myTags.indexOf(b) < i); } return button == object ? null : button; } private TagButton getDropButton(TagButton replaceButton, DnDEvent event) { int i = myTags.indexOf(replaceButton); if (i > myTags.indexOf(event.getAttachedObject())) { return replaceButton; } return ContainerUtil.findLast(myTags, button -> button.isVisible() && myTags.indexOf(button) < i); } @Override public boolean update(DnDEvent event) { TagButton replace = getReplaceButton(event); if (replace != null) { TagButton dropButton = getDropButton(replace, event); myTags.forEach(button -> button.showDropPlace(button == dropButton)); myDropFirst.setVisible(dropButton == null); event.setDropPossible(true); return false; } myTags.forEach(button -> button.showDropPlace(false)); event.setDropPossible(false); return true; } public void setTagListener(BiConsumer<Key<? extends BeforeRunTask<?>>, Boolean> tagListener) { myTagListener = tagListener; } @Override public void dispose() {} private final class TaskButton extends TagButton implements DnDSource { private final BeforeRunTaskProvider<BeforeRunTask<?>> myProvider; private final JLabel myDropPlace = new JLabel(AllIcons.General.DropPlace); private BeforeRunTask<?> myTask; private TaskButton(@NotNull BeforeRunTaskProvider<BeforeRunTask<?>> provider, @NotNull Runnable action) { super(provider.getName(), action); Disposer.register(BeforeRunComponent.this, this); add(myDropPlace, JLayeredPane.DRAG_LAYER); myProvider = provider; myDropPlace.setVisible(false); myButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (!DumbService.isDumb(myConfiguration.getProject()) || DumbService.isDumbAware(myProvider)) { myProvider.configureTask(DataManager.getInstance().getDataContext(TaskButton.this), myConfiguration, myTask) .onSuccess(aBoolean -> setTask(myTask)); } } } }); DnDManager.getInstance().registerSource(this, myButton, this); myButton.setToolTipText(ExecutionBundle.message("run.configuration.before.run.tooltip")); layoutButtons(); } @Override protected void layoutButtons() { super.layoutButtons(); if (myDropPlace == null) return; Rectangle bounds = myButton.getBounds(); Dimension size = myDropPlace.getPreferredSize(); int gap = JBUI.scale(2); setPreferredSize(new Dimension(bounds.width + size.width + 2 * gap, bounds.height)); myDropPlace.setBounds((int)(bounds.getMaxX() + gap), bounds.y + (bounds.height - size.height) / 2, size.width, size.height); } private void setTask(@Nullable BeforeRunTask<?> task) { myTask = task; setVisible(task != null); if (task != null) { updateButton(myProvider.getDescription(task), myProvider.getTaskIcon(task), !DumbService.isDumb(myConfiguration.getProject()) || DumbService.isDumbAware(myProvider)); } } private void showDropPlace(boolean show) { myDropPlace.setVisible(show); } @Override public boolean canStartDragging(DnDAction action, Point dragOrigin) { return true; } @Override public DnDDragStartBean startDragging(DnDAction action, Point dragOrigin) { return new DnDDragStartBean(this); } @Override public String toString() { return myProvider.getName(); } } private class TagAction extends AnAction implements PossiblyDumbAware { private final BeforeRunTaskProvider<BeforeRunTask<?>> myProvider; private TagAction(BeforeRunTaskProvider<BeforeRunTask<?>> provider) { super(provider.getName(), null, provider.getIcon()); myProvider = provider; } @Override public void actionPerformed(@NotNull AnActionEvent e) { createTask(e, myProvider); } @Override public boolean isDumbAware() { return DumbService.isDumbAware(myProvider); } } }
77a6cea0e62d0edabb1d02b03e5359219b4af016
9d77cf0f1ae954bc62e3a43326c1e40e2857431f
/android/app/src/main/java/com/rocketuber/ActivityStarter.java
e365a58d08bf6c28bd0f9684cc910d7478bcdcc4
[]
no_license
rautram/practise-native-react-native
07ebf6c8e7104bb0c6562c2898d69125311d2075
64911bd9525a5373ecdeaf8fc57cdf4be81cdef7
refs/heads/master
2022-12-14T00:03:47.608724
2019-11-16T14:56:30
2019-11-16T14:56:30
221,899,528
0
0
null
2022-12-04T20:33:54
2019-11-15T10:21:19
Java
UTF-8
Java
false
false
781
java
package com.rocketuber; import android.content.Intent; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; public class ActivityStarter extends ReactContextBaseJavaModule { ActivityStarter(ReactApplicationContext reactApplicationContext) { super(reactApplicationContext); } @Override public String getName() { return "ActivityStarter"; } @ReactMethod void navigateTo() { ReactApplicationContext context = getReactApplicationContext(); Intent intent = new Intent(context, HomeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }
3776bff1bc430f08415ad964c0ffcf9699f7d1a2
b0507fb1ba9340bca1bda00da5cb216e0087354e
/serenity-screenplay-rest/src/main/java/net/serenitybdd/screenplay/rest/abiities/CallAnApi.java
967c57e707f9302090468380bfa24a8b22affa58
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
RoiEXLab/serenity-core
83981285fdc9a03753be5710ccf99b162c4ce2d1
0b761a51d438f9e896d27e2d8cec821179a27425
refs/heads/master
2020-04-01T20:50:52.464980
2018-10-18T13:13:47
2018-10-18T13:16:23
153,623,465
0
0
NOASSERTION
2018-10-18T12:53:36
2018-10-18T12:53:36
null
UTF-8
Java
false
false
1,366
java
package net.serenitybdd.screenplay.rest.abiities; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; import net.serenitybdd.rest.SerenityRest; import net.serenitybdd.screenplay.Ability; import net.serenitybdd.screenplay.Actor; import java.util.function.Function; /** * A Screenplay ability that allows an actor to perform REST queries against a specified API. * For example: * ``` * Actor sam = Actor.named("Sam the supervisor").whoCan(CallAnApi.at("https://reqres.in")); * ``` */ public class CallAnApi implements Ability { private final String baseURL; private CallAnApi(String baseURL) { this.baseURL = baseURL; } /** * Ability to Call and api at a specified baseUrl */ public static CallAnApi at(String baseURL) { return new CallAnApi(baseURL); } /** * Used to access the Actor's ability to CallAnApi from within the Interaction classes, such as GET or PUT */ public static CallAnApi as(Actor actor) { return actor.abilityTo(CallAnApi.class); } public String resolve(String resource) { return baseURL + resource; } public Response getLastResponse() { return SerenityRest.lastResponse(); } @Override public String toString() { return "call an API at " + baseURL; } }
a06c2e837baaa5ab9d0b953c483939eac5c99706
2e098464e0c1e7369023f7693d0ad0eb3856770f
/main/src/main/java/com/sedmelluq/discord/lavaplayer/container/mpeg/MpegSegmentEntry.java
be4f118b8a8f3b2c07ba23b37be5b90c1b2a4cb9
[ "Apache-2.0" ]
permissive
freyacodes/lavaplayer
aad33de74f796ba325a7c30bc5b25191d1283c6a
cfebd674f2076a5c5a40284d209bcb64ada6b924
refs/heads/master
2021-06-10T05:04:00.264652
2016-10-29T21:27:30
2016-10-29T21:27:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
638
java
package com.sedmelluq.discord.lavaplayer.container.mpeg; /** * Information about one MP4 segment aka fragment */ public class MpegSegmentEntry { /** * Type of the segment */ public final int type; /** * Size in bytes */ public final int size; /** * Duration using the timescale of the file */ public final int duration; /** * @param type Type of the segment * @param size Size in bytes * @param duration Duration using the timescale of the file */ public MpegSegmentEntry(int type, int size, int duration) { this.type = type; this.size = size; this.duration = duration; } }
5ec4ffe2b9163b125304a285b5620a03965924c6
3217b044831a59a34eb87468110dee5c168a9f2b
/prototypes-core/src/main/java/com/gemserk/prototypes/spriteatlas/SpriteAtlasBugPrototype.java
49cb8f6b4e3a6ef1a4f8b701ecc9f665cca57eb0
[]
no_license
sureshbora1989/prototypes
a8b2b684bf6ecb26f67579313058cc4e247d0edd
e07e4e674cd3d83b84a08daa9764e4e6f88688ab
refs/heads/master
2021-01-18T09:47:52.388047
2013-03-15T02:25:59
2013-03-15T02:25:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,156
java
package com.gemserk.prototypes.spriteatlas; import java.text.MessageFormat; import java.util.ArrayList; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.math.Rectangle; import com.gemserk.commons.gdx.GameStateImpl; import com.gemserk.commons.gdx.graphics.ImmediateModeRendererUtils; import com.gemserk.commons.gdx.graphics.SpriteUtils; public class SpriteAtlasBugPrototype extends GameStateImpl { /** Describes the region of a packed image and provides information about the original image before it was packed. */ static public class AtlasRegion extends TextureRegion { /** * The number at the end of the original image file name, or -1 if none.<br> * <br> * When sprites are packed, if the original file name ends with a number, it is stored as the index and is not considered as part of the sprite's name. This is useful for keeping animation frames in order. * * @see TextureAtlas#findRegions(String) */ public int index; /** * The name of the original image file, up to the first underscore. Underscores denote special instructions to the texture packer. */ public String name; /** The offset from the left of the original image to the left of the packed image, after whitespace was removed for packing. */ public float offsetX; /** * The offset from the bottom of the original image to the bottom of the packed image, after whitespace was removed for packing. */ public float offsetY; /** The width of the image, after whitespace was removed for packing. */ public int packedWidth; /** The height of the image, after whitespace was removed for packing. */ public int packedHeight; /** The width of the image, before whitespace was removed for packing. */ public int originalWidth; /** The height of the image, before whitespace was removed for packing. */ public int originalHeight; /** If true, the region has been rotated 90 degrees counter clockwise. */ public boolean rotate; public AtlasRegion(Texture texture, int x, int y, int width, int height) { super(texture, x, y, width, height); packedWidth = width; packedHeight = height; } public AtlasRegion(AtlasRegion region) { setRegion(region); index = region.index; name = region.name; offsetX = region.offsetX; offsetY = region.offsetY; packedWidth = region.packedWidth; packedHeight = region.packedHeight; originalWidth = region.originalWidth; originalHeight = region.originalHeight; rotate = region.rotate; } /** * Flips the region, adjusting the offset so the image appears to be flipped as if no whitespace has been removed for packing. */ public void flip(boolean x, boolean y) { super.flip(x, y); if (x) offsetX = originalWidth - offsetX - packedWidth; if (y) offsetY = originalHeight - offsetY - packedHeight; } } /** * A sprite that, if whitespace was stripped from the region when it was packed, is automatically positioned as if whitespace had not been stripped. */ static public class AtlasSprite extends Sprite { final AtlasRegion region; float originalOffsetX, originalOffsetY; public AtlasSprite(AtlasRegion region) { this.region = new AtlasRegion(region); originalOffsetX = region.offsetX; originalOffsetY = region.offsetY; setRegion(region); setOrigin(region.originalWidth / 2f, region.originalHeight / 2f); int width = Math.abs(region.getRegionWidth()); int height = Math.abs(region.getRegionHeight()); if (region.rotate) { super.rotate90(true); super.setBounds(region.offsetX, region.offsetY, height, width); } else super.setBounds(region.offsetX, region.offsetY, width, height); setColor(1, 1, 1, 1); } public void setPosition(float x, float y) { super.setPosition(x + region.offsetX, y + region.offsetY); } public void setBounds(float x, float y, float width, float height) { float widthRatio = width / region.originalWidth; float heightRatio = height / region.originalHeight; region.offsetX = originalOffsetX * widthRatio; region.offsetY = originalOffsetY * heightRatio; super.setBounds(x + region.offsetX, y + region.offsetY, region.packedWidth * widthRatio, region.packedHeight * heightRatio); } public void setSize(float width, float height) { super.setSize(width, height); setBounds(getX(), getY(), width, height); } public void setOrigin(float originX, float originY) { super.setOrigin(originX - region.offsetX, originY - region.offsetY); } public void flip(boolean x, boolean y) { // Flip texture. super.flip(x, y); float oldOriginX = getOriginX(); float oldOriginY = getOriginY(); float oldOffsetX = region.offsetX; float oldOffsetY = region.offsetY; // Updates x and y offsets. region.flip(x, y); // Update position and origin with new offsets. translate(region.offsetX - oldOffsetX, region.offsetY - oldOffsetY); setOrigin(oldOriginX, oldOriginY); } public float getX() { return super.getX() - region.offsetX; } public float getY() { return super.getY() - region.offsetY; } public float getOriginX() { return super.getOriginX() + region.offsetX; } public float getOriginY() { return super.getOriginY() + region.offsetY; } public float getWidth() { return super.getWidth() / region.packedWidth * region.originalWidth; } public float getHeight() { return super.getHeight() / region.packedHeight * region.originalHeight; } public AtlasRegion getAtlasRegion() { return region; } @Override public void rotate90(boolean clockwise) { super.rotate90(clockwise); // float originalOffsetX2 = originalOffsetX; // float originalOffsetY2 = originalOffsetY; // // originalOffsetX = originalOffsetY2; // originalOffsetY = originalOffsetX2; // // float offsetX = region.offsetX; // float offsetY = region.offsetY; // int originalWidth = region.originalWidth; // int originalHeight = region.originalHeight; // int packedWidth = region.packedWidth; // int packedHeight = region.packedHeight; // // region.offsetX = offsetY; // region.offsetY = offsetX; // region.originalWidth = originalHeight; // region.originalHeight = originalWidth; // region.packedWidth = packedHeight; // region.packedHeight = packedWidth; // region.rotate = !region.rotate; // // // super.setSize(super.getHeight(), super.getWidth()); // // // super.setBounds(region.offsetX, region.offsetY, region.packedHeight, region.packedWidth); } } private SpriteBatch spriteBatch; private Texture texture; private ArrayList<Sprite> sprites; @Override public void init() { spriteBatch = new SpriteBatch(); sprites = new ArrayList<Sprite>(); texture = new Texture(Gdx.files.internal("data/spriteatlastest/spriteatlastest1.png")); AtlasRegion atlasRegion = new AtlasRegion(texture, 2, 2, 97, 38); atlasRegion.originalWidth = 128; atlasRegion.originalHeight = 64; atlasRegion.offsetX = 0f; atlasRegion.offsetY = 0f; AtlasRegion atlasRegion2 = new AtlasRegion(texture, 2, 2, 97, 38); atlasRegion2.originalWidth = 128; atlasRegion2.originalHeight = 64; atlasRegion2.offsetX = 0f; atlasRegion2.offsetY = 64f; atlasRegion2.rotate = true; Sprite normal = new Sprite(atlasRegion2); System.out.println(MessageFormat.format("{0}x{1}", normal.getWidth(), normal.getHeight())); // normal.rotate90(true); // normal.setSize(normal.getHeight(), normal.getWidth()); Sprite rotated = new AtlasSprite(atlasRegion2); // rotated.rotate90(false); // System.out.println(MessageFormat.format("{0}x{1}", rotated.getWidth(), rotated.getHeight())); // rotated.setSize(rotated.getHeight(), rotated.getWidth()); // System.out.println(MessageFormat.format("{0}x{1}", rotated.getWidth(), rotated.getHeight())); Gdx.gl.glClearColor(0f, 0f, 1f, 1f); normal.setPosition(Gdx.graphics.getWidth() * 0.5f, Gdx.graphics.getHeight() * 0.5f); rotated.setPosition(Gdx.graphics.getWidth() * 0.8f, Gdx.graphics.getHeight() * 0.5f); Rectangle normalBounds = normal.getBoundingRectangle(); Rectangle rotatedBounds = rotated.getBoundingRectangle(); System.out.println(MessageFormat.format("normal.bounds: {0}", normalBounds)); System.out.println(MessageFormat.format("rotated.bounds: {0}", rotatedBounds)); sprites.add(normal); sprites.add(rotated); { Sprite sprite = new Sprite(atlasRegion); SpriteUtils.transformSprite(sprite, 2f, 0.5f, 0.5f, false, false, true, true); sprite.setPosition(Gdx.graphics.getWidth() * 0.15f, Gdx.graphics.getHeight() * 0.25f); sprites.add(sprite); } { Sprite sprite = new AtlasSprite(atlasRegion); SpriteUtils.transformSprite(sprite, 2f, 0.5f, 0.5f, false, false, false, false); sprite.setPosition(Gdx.graphics.getWidth() * 0.25f, Gdx.graphics.getHeight() * 0.25f); sprites.add(sprite); } { Sprite sprite = new AtlasSprite(atlasRegion); SpriteUtils.transformSprite(sprite, 2f, 0.5f, 0.5f, false, false, true, true); sprite.setPosition(Gdx.graphics.getWidth() * 0.65f, Gdx.graphics.getHeight() * 0.15f); sprites.add(sprite); } } @Override public void dispose() { super.dispose(); texture.dispose(); } @Override public void render() { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); spriteBatch.begin(); for (int i = 0; i < sprites.size(); i++) { sprites.get(i).draw(spriteBatch); ImmediateModeRendererUtils.drawRectangle(sprites.get(i).getBoundingRectangle(), Color.WHITE); } spriteBatch.end(); } }
0756041cea892e170042a3cf6abd71efb350db8b
0d018d044080cb8527866146c668dc966ff41654
/app/src/main/java/com/wei/news/games/fragments/GameTabFragment.java
d8c732d7967baf1e932f2a7a65fb67a0ad41b98d
[]
no_license
Sekei/WeMedia-master
8a749cdf29e297740c786a85707e4a35791e71f6
05529d560fdd808459444b7372d55ec285e15dc0
refs/heads/master
2020-04-25T09:22:54.204605
2019-02-26T10:32:15
2019-02-26T10:32:15
172,673,918
2
0
null
null
null
null
UTF-8
Java
false
false
6,304
java
package com.wei.news.games.fragments; import android.os.Bundle; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.OrientationHelper; import android.support.v7.widget.RecyclerView; import android.view.View; import com.wei.news.MainActivity; import com.wei.news.R; import com.wei.news.games.adapter.QueueRecyclerAdapter; import com.wei.news.games.entity.GameListEntity; import com.wei.news.games.presenter.GameTabPresenter; import com.wei.news.games.ui.GameDescActivity; import com.wei.news.games.view.IGameTabView; import com.wei.news.sdk.manager.CacheManager; import com.wei.news.sdk.manager.IntentManager; import com.wei.news.sdk.manager.TipManager; import com.wei.news.sdk.manager.okdownload.DownloadManager; import com.wei.news.sdk.mvp.MvpFragment; import com.wei.news.sdk.widget.FootView; import com.wei.news.sdk.widget.LoadStatusView; import com.wei.news.utils.Constant; import com.wei.news.utils.L; import java.util.ArrayList; import butterknife.BindView; import io.reactivex.disposables.Disposable; public class GameTabFragment extends MvpFragment<GameTabPresenter> implements IGameTabView, SwipeRefreshLayout.OnRefreshListener, QueueRecyclerAdapter.OnRecycleItemClickListener, QueueRecyclerAdapter.OnSlideToBottomListener, LoadStatusView.onReloadClickListener, QueueRecyclerAdapter.OnBottomErrorClickListener { @BindView(R.id.lv_tab) RecyclerView listView; @BindView(R.id.refresh_layout) SwipeRefreshLayout swipeRefreshLayout; private String title; private ArrayList<GameListEntity.Data> mData; QueueRecyclerAdapter queueRecyclerAdapter; private FootView footView; private CacheManager cacheManager; @Override public int getLayoutId() { return R.layout.fragment_tab_game; } @Override public void init() { swipeRefreshLayout.setColorScheme(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_red_light, android.R.color.holo_orange_light); cacheManager = new CacheManager<GameListEntity.Data>(); addLoadView(R.id.rootview); } @Override public void initData() { mData =cacheManager.getCache(getContext(),getCatid()); if(canLoadData()){ mvpPresenter.loadData(getCatid()); setCanLoadData(false); } DownloadManager downloadManager=DownloadManager.getInstance(); queueRecyclerAdapter=new QueueRecyclerAdapter(getActivity(), mData,downloadManager); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setOrientation(OrientationHelper. VERTICAL); listView.setLayoutManager(layoutManager); listView.setAdapter(queueRecyclerAdapter); } @Override public void lazyData() { mvpPresenter.loadData(getCatid()); setCanLoadData(false); } @Override public void setListener() { swipeRefreshLayout.setOnRefreshListener(this); queueRecyclerAdapter.setOnRecycleItemClickListener(this); queueRecyclerAdapter.setOnSlideToBottomListener(this); getLoadStatusView().setonReloadClickListener(this); queueRecyclerAdapter.setOnBottomErrorClickListener(this); } @Override public void onBottom(FootView footView) { this.footView=footView; if(!footView.isNoMore()){ mvpPresenter.addData(getCatid()); } } public void setTitle(String title) { this.title = title; } public String getTitle() { return title; } public String getCatid(){ return Constant.gameCatidMap.get(title); } @Override protected GameTabPresenter createPresenter() { return new GameTabPresenter(this); } @Override public void loadData(GameListEntity data) { getLoadStatusView().hideLoadStatus(); if(data!=null){ queueRecyclerAdapter.refreshData(data.getData()); cacheManager.putCache(getContext(),getCatid(),data.getData()); return; } } @Override public void addData(GameListEntity data) { queueRecyclerAdapter.addData(data.getData()); } @Override public void showLoadingView() { swipeRefreshLayout.setRefreshing(true); if(mData.size()<=0){ getLoadStatusView().showLoading(); } } @Override public void hideLoadingView() { swipeRefreshLayout.setRefreshing(false); } @Override public void showNoMore() { if(footView!=null){ footView.showNoMore(); } } @Override public void showReload() { if(mData.size()<=0){ getLoadStatusView().showReload(); } } @Override public void addDisposable(Disposable disposable) { ((MainActivity)getActivity()).addDisposable(disposable); } @Override public void showErrorMoreLoadView() { if(footView!=null){ footView.showError(); } } @Override public void showMoreLoadingView() { if(footView!=null){ footView.showLoading(); } } @Override public void showFootView() { if(footView!=null){ footView.show(); } } @Override public void onRefresh() { mvpPresenter.loadData(getCatid()); } @Override public void onResume() { super.onResume(); L.d("GameTabFragment onResume"); queueRecyclerAdapter.notifyDataSetChanged(); } @Override public void onItemClick(int position, boolean isEditMode) { GameListEntity.Data data=mData.get(position); Bundle bundle=new Bundle(); bundle.putSerializable("game_data",data); IntentManager.startActivity(getContext(),GameDescActivity.class,bundle); } @Override public void OnReloadClick() { swipeRefreshLayout.setRefreshing(true); mvpPresenter.loadData(getCatid()); setCanLoadData(false); } @Override public void onBottomErrorClcik() { mvpPresenter.addData(getCatid()); } }
[ "juanjuan19941019" ]
juanjuan19941019
e0b510aa07006fc299b97f24d27c31acff15afcc
e8c4f9f82cb77d90a3f99301461aab152c97a75e
/src/main/java/com/oopsw/member/dao/GradeDAO.java
62652d38f06695c9bacd193833590c979e4c9e28
[]
no_license
elien940318/metanetDT_intern_EnrollProject
04537ae5c7fc173b65165ce8dc29df8b7a010d9d
589407ef320db70c1350a64b2e4e1131eec5d770
refs/heads/master
2023-03-08T02:49:18.522911
2021-02-15T13:09:51
2021-02-15T13:09:51
337,948,897
0
1
null
null
null
null
UTF-8
Java
false
false
856
java
package com.oopsw.member.dao; import java.util.Collection; import org.apache.ibatis.annotations.Param; import com.oopsw.member.dto.EvaluationDTO; import com.oopsw.member.dto.GradeDTO; import com.oopsw.member.dto.RegisterDTO; public interface GradeDAO { public Collection<GradeDTO> getEvalList(@Param("studentId")String id, @Param("regYear")int regYear, @Param("regSemester")String regSemester); public int setEval(EvaluationDTO evaluationDTO); public Collection<GradeDTO> getSemGradeList(@Param("studentId")String studentId, @Param("regYear")int regYear, @Param("regSemester")String regSemester); public Collection<GradeDTO> getAllGradeList(@Param("studentId")String studentId); public Collection<RegisterDTO> getYearSemesterList(@Param("studentId")String studentId); public GradeDTO getRegisterInfo(@Param("registerNo")int registerNo); }
3cae639c1ebc4e97358e938e49a32c502cc319e0
8e46a234d1ea69f8fb50065689976419e71ece9b
/src/com/boncontact/service/Delivery_SampleTypeService.java
5148d135c8afb9679943846a98e2aa287340475d
[]
no_license
a200332/LIMS_V2
0b0dbf7394788b7707172faadcf1d1dceadb2e00
fb749256c91c3d014e9ce44dc99c66fe20b6e81a
refs/heads/master
2021-05-31T21:17:00.165164
2016-08-07T06:44:07
2016-08-07T06:44:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package com.boncontact.service; import java.util.List; import com.boncontact.domain.AnalysisProject; import com.boncontact.domain.AnalysisType; import com.boncontact.domain.Delivery_SampleType; import com.boncontact.domain.Project; public interface Delivery_SampleTypeService { /** * save():保存对象 * * @param entity * :实体对象 */ void save(Delivery_SampleType entity); /** * delete():删除对象 * * @param id * :对象id */ void delete(Long id); /** * update():更新对象 * * @param entity * :更新后的对象实体 */ void update(Delivery_SampleType entity); /** * getById():根据id查找 * * @param id * :需要查找的id值 * @return */ Delivery_SampleType getById(Long id); /** * getByIndetify():根据业务编号查找 * * @param indenity * @return */ Delivery_SampleType getByIndetify(String indenity); /** * getByids:根据id组查找 * * @param ids * :id组 * @return */ List<Delivery_SampleType> getByIds(Long[] ids); /** * findAll():查找全部对象 * * @param str * :Where查询子句 * @return */ List<Delivery_SampleType> findAll(String str); List<Delivery_SampleType> findByProject(Project project); Delivery_SampleType findByAnalysis(Project project, AnalysisProject analysisProject); }
b88bbeb5f8f4859b28ed705bae39420d284b7f2e
3706a9c36f131898cb7b45b4feb8d2a868792fc7
/src/main/java/com/study/financialreportbatch/job/datasource/DataSourceConfiguration.java
dab8373cd5b7d247deff49c5e20ed4812e025a6c
[]
no_license
joao-felipe-bn/financial-report-batch
ef588f2c5af868e31d686183007698568cf7aef2
fba27b797c498ae3380e33403043bb2994d90981
refs/heads/master
2023-07-08T07:19:41.217877
2021-08-15T04:40:14
2021-08-15T04:40:14
396,215,431
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package com.study.financialreportbatch.job.datasource; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import javax.sql.DataSource; @Configuration public class DataSourceConfiguration { @Primary @Bean @ConfigurationProperties(prefix = "spring.datasource") public DataSource springDataSource() { return DataSourceBuilder.create().build(); } }
bca903232716fc89a89dbc9d2d1710b23365508a
b4a65247bc5d993f132ec529aa6dcf1116d413c6
/excel-test/src/main/java/com/liujia/设计模式/原型模式/ShapeCache.java
1c5213356d171e120a59e94ab629c75feda9c1b2
[]
no_license
cunlizuiliangzai/springboot
dabdcc1a5a4cd529042ee550706d68b6c71d36e8
1a049ed696f2cc23070663c03566347e107e9587
refs/heads/master
2023-03-15T11:28:12.109844
2020-11-14T05:19:22
2020-11-14T05:19:22
295,294,806
0
0
null
null
null
null
UTF-8
Java
false
false
1,558
java
package com.liujia.设计模式.原型模式; import java.util.Hashtable; /** * @author ex_111806190 * @since 2020-10-21 16:38 * * * 原型模式(Prototype Pattern)是用于创建重复的对象,同时又能保证性能。这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式。 *这种模式是实现了一个原型接口,该接口用于创建当前对象的克隆。 * * * * 当直接创建对象的代价比较大时,则采用这种模式。 * 例如,一个对象需要在一个高代价的数据库操作之后被创建。我们可以缓存该对象,在下一个请求时返回它的克隆,在需要的时候更新数据库,以此来减少数据库调用 * * */ public class ShapeCache { private static Hashtable<String, Shape> shapeMap = new Hashtable<String, Shape>(); public static Shape getShape(String shapeId) { Shape cachedShape = shapeMap.get(shapeId); return (Shape) cachedShape.clone(); } // 对每种形状都运行数据库查询,并创建该形状 // shapeMap.put(shapeKey, shape); // 例如,我们要添加三种形状 public static void loadCache() { Circle circle = new Circle(); circle.setId("1"); shapeMap.put(circle.getId(),circle); Square square = new Square(); square.setId("2"); shapeMap.put(square.getId(),square); Rectangle rectangle = new Rectangle(); rectangle.setId("3"); shapeMap.put(rectangle.getId(),rectangle); } }
78ea52609257dfbe37f25ccbde503cdc0c0adfd5
4de1f7cd49bddb56d466af73c5896eedffa5ad9c
/app/src/main/java/com/ospino/coronavirus/models/Stats.java
c58493d1a77b206a05e0fe472c6d0b10585c07be
[ "MIT" ]
permissive
ospinooo/coronavirus-mobile-app
a608ba04ac1403891975c6916d30ef6b71a90c07
b1ff6da20884d66f2e548ca7f4d67d54bb447d0f
refs/heads/master
2021-05-18T03:30:28.309334
2020-04-06T06:05:07
2020-04-06T06:05:07
251,084,131
3
0
null
null
null
null
UTF-8
Java
false
false
2,678
java
package com.ospino.coronavirus.models; import java.io.Serializable; import java.util.List; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Stats implements Serializable { @SerializedName("totalConfirmedCases") @Expose private Integer totalConfirmedCases; @SerializedName("newlyConfirmedCases") @Expose private Integer newlyConfirmedCases; @SerializedName("totalDeaths") @Expose private Integer totalDeaths; @SerializedName("newDeaths") @Expose private Integer newDeaths; @SerializedName("totalRecoveredCases") @Expose private Integer totalRecoveredCases; @SerializedName("newlyRecoveredCases") @Expose private Integer newlyRecoveredCases; @SerializedName("history") @Expose private List<History> history = null; @SerializedName("breakdowns") @Expose private List<Breakdown> breakdowns = null; public Integer getTotalConfirmedCases() { return totalConfirmedCases; } public void setTotalConfirmedCases(Integer totalConfirmedCases) { this.totalConfirmedCases = totalConfirmedCases; } public Integer getNewlyConfirmedCases() { return newlyConfirmedCases; } public void setNewlyConfirmedCases(Integer newlyConfirmedCases) { this.newlyConfirmedCases = newlyConfirmedCases; } public Integer getTotalDeaths() { return totalDeaths; } public void setTotalDeaths(Integer totalDeaths) { this.totalDeaths = totalDeaths; } public Integer getNewDeaths() { return newDeaths; } public void setNewDeaths(Integer newDeaths) { this.newDeaths = newDeaths; } public Integer getTotalRecoveredCases() { return totalRecoveredCases; } public void setTotalRecoveredCases(Integer totalRecoveredCases) { this.totalRecoveredCases = totalRecoveredCases; } public Integer getNewlyRecoveredCases() { return newlyRecoveredCases; } public void setNewlyRecoveredCases(Integer newlyRecoveredCases) { this.newlyRecoveredCases = newlyRecoveredCases; } public List<History> getHistory() { return history; } public void setHistory(List<History> history) { this.history = history; } public List<Breakdown> getBreakdowns() { return breakdowns; } public void setBreakdowns(List<Breakdown> breakdowns) { this.breakdowns = breakdowns; } public Integer getTotalActiveCases() { return this.getTotalConfirmedCases() - (this.getTotalDeaths() + this.getTotalRecoveredCases()); } }
5f6ed2619e4d1b3722df3567de9ae9902ab6c185
50b6ceba20db6aafe81fd49c9636e01bceff3574
/versie14.1.2014/Toys4Toys/src/java/servlets/SpeelgoedDetail.java
406e42f0f4560065d7009f2deac76aa4b57f935f
[]
no_license
tombeton1/T4T
d3b2f3f26eaf6467c8d64d090ea2c069dc964a27
b1608d9a92fe5a59399736e26625eea8c47e8917
refs/heads/master
2020-06-06T18:59:17.547390
2015-01-26T11:16:57
2015-01-26T11:16:57
28,049,661
0
0
null
null
null
null
UTF-8
Java
false
false
2,757
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 servlets; import Services.SpeelgoedService; import dal.Speelgoed; import java.io.IOException; import java.util.List; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author Véronique */ public class SpeelgoedDetail extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); List<Speelgoed> speelgoed = SpeelgoedService.SelecteerSpeelgoed(Integer.parseInt(request.getParameter("id"))); request.getSession().setAttribute("vm", speelgoed); RequestDispatcher dispatcher = request.getRequestDispatcher("SpeelgoedDetails.jsp"); dispatcher.forward(request, response); } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
fa91c81024df28180607c4bad82e7bfa44ca7804
49f25054c7ecbc30d666d11c7e312fbe6bccb284
/http-request/src/main/java/ru/jewelline/request/http/UrlBuilder.java
4a2831bae02d7820d1c90b24dd92e83e6aca052d
[ "MIT" ]
permissive
asuslennikov/asana4j
a5e5b2d42b366359bcb33e8d5db0dbefed19f905
446ce454e65bd7fecd37f4c615039d0cd3c0ea33
refs/heads/master
2021-01-15T08:59:50.432170
2016-03-01T10:19:17
2016-03-01T10:19:17
39,267,818
0
0
null
null
null
null
UTF-8
Java
false
false
190
java
package ru.jewelline.request.http; public interface UrlBuilder { UrlBuilder path(String path); UrlBuilder setQueryParameter(String key, String... values); String build(); }
c5dfdd6436b493df22e5cc232c705cc76aafff50
23689f68fd932d43657e56c481c17fec323cb531
/src/main/java/com/mybatis/plus/config/exception/AppException.java
7e684b64005eb6d531c3975bfc9d2a218cc606f0
[]
no_license
CallEatChicken/mybatis-plus
8f4667390ed200502489517ceeb4ef070907d9ae
eb5c4bc3294c8c87efa64f33cd57cc1395f5bdf6
refs/heads/master
2022-10-28T04:11:56.512529
2020-05-25T15:58:53
2020-05-25T15:58:53
198,558,585
1
0
null
2022-10-12T20:29:37
2019-07-24T04:31:00
Java
UTF-8
Java
false
false
1,426
java
package com.mybatis.plus.config.exception; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 定义应用级别的异常处理,包括编译异常 * @author admin * @date 2019-7-5 * */ public class AppException extends AppCheckedException { private static final long serialVersionUID = 1L; private static Logger logger = LoggerFactory.getLogger(SysException.class); public String getErrId() { return this.errId; } public void setErrId(String errId) { this.errId = errId; } public String getErrMsg() { return this.errMsg; } public void setErrMsg(String errMsg) { this.errMsg = errMsg; } public AppException() { } /** * 错误号 */ String errId; /** * 错误信息,当前错误的信息。 */ String errMsg; public AppException(String errId, String errOwnMsg) { this.errId = errId; this.errMsg = errOwnMsg; this.writeAppException(); } private void writeAppException() { logger.error("应用错误号:" + this.errId); logger.error("应用错误信息:" + this.errMsg); ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream p = new PrintStream(os); this.printStackTrace(p); logger.error(os.toString()); } }
0d8ba85b9c7a3482ef7c259ab67230416b0c91c1
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/91/org/apache/commons/math/util/ResizableDoubleArray_start_785.java
546d6ddeffb7ce64a5b03b246ff44567c6cfa28a
[]
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
3,085
java
org apach common math util variabl length link doubl arrai doublearrai implement automat handl expand contract intern storag arrai element ad remov intern storag arrai start capac determin code initi capac initialcapac code properti set constructor initi capac ad element link add element addel append element end arrai open entri end intern storag arrai arrai expand size expand arrai depend code expans mode expansionmod code code expans factor expansionfactor code properti code expans mode expansionmod code determin size arrai multipli code expans factor expansionfactor code multipl mode expans addit addit mode code expans factor expansionfactor code storag locat ad code expans mode expansionmod code multipl mode code expans factor expansionfactor code link add element roll addelementrol method add element end intern storag arrai adjust usabl window intern arrai forward posit effect make element repeat activ method activ link discard front element discardfrontel effect orphan storag locat begin intern storag arrai reclaim storag time method activ size intern storag arrai compar number address element code num element numel code properti differ larg intern arrai contract size code num element numel code determin intern storag arrai larg depend code expans mode expansionmod code code contract factor contractionfactor code properti code expans mode expansionmod code code multipl mode code contract trigger ratio storag arrai length code num element numel code exce code contract factor contractionfactor code code expans mode expansionmod code code addit mode code number excess storag locat compar code contract factor contractionfactor code avoid cycl expans contract code expans factor expansionfactor code exce code contract factor contractionfactor code constructor mutat properti enforc requir throw illeg argument except illegalargumentexcept violat version revis date resiz doubl arrai resizabledoublearrai doubl arrai doublearrai serializ return start index intern arrai start index posit address element intern storag arrai address element arrai code intern arrai internalarrai start index startindex intern arrai internalarrai start index startindex num element numel code start index start start index startindex
ee088bfc7c50ce7bda2c23b33d3cda97f22a20df
c92c63dd131f8718f49668d110891b00e0fdb48f
/android/src/main/java/io/tradle/nfc/RNPassportReaderPackage.java
a151c47d36d0f6881245720263ff497fe258b098
[ "Apache-2.0" ]
permissive
EstebanFuentealba/react-native-passport-reader
03fb1e319b43f034e35249fff7fbefa21612acca
ff16aa3935a6c3a38765a7f96f5aff0e3ce35dbe
refs/heads/master
2021-04-07T05:43:16.411148
2020-03-24T00:05:27
2020-03-24T00:05:27
248,651,137
0
1
NOASSERTION
2020-03-20T02:32:10
2020-03-20T02:32:09
null
UTF-8
Java
false
false
1,592
java
/* * Copyright 2016 Anton Tananaev ([email protected]) * * 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.tradle.nfc; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.Arrays; import java.util.Collections; import java.util.List; public class RNPassportReaderPackage implements ReactPackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.<NativeModule>asList(new RNPassportReaderModule(reactContext)); } // No more method `createJSModules` in the Abstract Class `ReactPackage` // @Override public List<Class<? extends JavaScriptModule>> createJSModules() { return Collections.emptyList(); } @Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); } }
efbd74974a6844cb324d58b680fa166dd82c31ff
f7bd132d576357956547a3d1c48765177f51ba59
/app/src/main/java/ru/a799000/android/weightcalculator3/mvp/model/intities/Product.java
bd09b1e0809187920886bb3a4a43837459b81650
[]
no_license
zavbak/WeightCalculator3
4a42a7627e821b393adc541a0a2dd4ca97602522
584b951138c75e6a6214a99fe57904e05da6e7d8
refs/heads/master
2021-01-23T06:26:09.843071
2017-06-05T02:50:40
2017-06-05T02:50:40
93,024,272
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
java
package ru.a799000.android.weightcalculator3.mvp.model.intities; import io.realm.RealmList; import io.realm.RealmObject; import io.realm.annotations.PrimaryKey; public class Product extends RealmObject { @PrimaryKey long id; String code; String ed; String name; String initBarcode; int start; int finish; float coef; private RealmList<Barcode> barcodes; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getEd() { return ed; } public void setEd(String ed) { this.ed = ed; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getInitBarcode() { return initBarcode; } public void setInitBarcode(String initBarcode) { this.initBarcode = initBarcode; } public int getStart() { return start; } public void setStart(int start) { this.start = start; } public int getFinish() { return finish; } public void setFinish(int finish) { this.finish = finish; } public float getCoef() { return coef; } public void setCoef(float coef) { this.coef = coef; } public RealmList<Barcode> getBarcodes() { return barcodes; } public void setBarcodes(RealmList<Barcode> barcodes) { this.barcodes = barcodes; } }
6427d7f3c6c5fd44d9a5966892e8e4b1c2d9f6f8
27afc9a73b3ac23f7db2afb691ee31059cacd405
/day08/src/loop/Testreview.java
14554f906e1c8ee345ae33039d382038e6fbe0a8
[]
no_license
Seungwoon12/kh
c991382b45419b1b88b984207d3bb28e27e6f8bc
d4c18a794ce43b1e2f33776f81ad33ea80004fc0
refs/heads/master
2023-06-18T18:07:04.553917
2021-07-13T04:41:11
2021-07-13T04:41:11
301,329,999
0
0
null
null
null
null
UTF-8
Java
false
false
244
java
package loop; public class Testreview { public static void main(String[] args) { long total = 0L; long start = 1L; for(int day=1 ; day<=40 ; day++) { total += start; start *= 2; } System.out.println(total); } }
[ "Seungwoon@DESKTOP-M3QL7KG" ]
Seungwoon@DESKTOP-M3QL7KG
3b8afeb92ea3ceb3fdd28e3bbf2bbc84055caa14
25371120e1dc7aa879b4fcf4872409ca0e899f29
/main/src/cgeo/geocaching/connector/UserAction.java
d0c97bbb8e030b6e190bedd337e7bdf11bf7af6f
[ "Apache-2.0" ]
permissive
hakan42/cgeo
f7b68278fc28009e08e0c3d0a01c1dffbb9bced7
a3c0cbe929202375a9831cc3bf9e60a6a1329a53
refs/heads/master
2021-01-17T12:25:43.781577
2014-01-06T22:23:36
2014-01-06T22:23:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
848
java
package cgeo.geocaching.connector; import cgeo.geocaching.utils.RunnableWithArgument; import org.eclipse.jdt.annotation.NonNull; import android.app.Activity; public class UserAction { public static class Context { public final String userName; public final Activity activity; public Context(String userName, Activity activity) { this.userName = userName; this.activity = activity; } } public final int displayResourceId; private final @NonNull RunnableWithArgument<Context> runnable; public UserAction(int displayResourceId, final @NonNull RunnableWithArgument<UserAction.Context> runnable) { this.displayResourceId = displayResourceId; this.runnable = runnable; } public void run(Context context) { runnable.run(context); } }
46349316925609d2881db5abc0f58e4af90b82bf
fe86b8c42ded57faf92568f3a2dca45fc9a55bb6
/app/src/main/java/com/faceunity/fualgorithmdemo/utils/DecimalUtils.java
71a77d420aa0c5a0369c0aaffad1492a90796c68
[]
no_license
Faceunity/FUFaceAIDemoDroid
948c6fd89deaf0fb5bee07078b7d021eb0f551de
a9c13911e9a8246c9a9b674f0b78fcd73c61da6a
refs/heads/main
2022-12-27T10:49:20.906332
2020-10-16T06:48:30
2020-10-16T06:48:30
302,846,629
0
2
null
2020-10-13T02:34:25
2020-10-10T07:51:20
null
UTF-8
Java
false
false
1,490
java
package com.faceunity.fualgorithmdemo.utils; /** * 数值工具类 * * @author Richie on 2019.07.05 */ public class DecimalUtils { /** * 两个浮点数的差值小于 0.01 认为相等 */ private static final float THRESHOLD = 0.01F; private DecimalUtils() { } public static boolean floatEquals(float a, float b) { return Math.abs(a - b) < THRESHOLD; } public static boolean doubleEquals(double a, double b) { return Math.abs(a - b) < THRESHOLD; } public static boolean floatArrayEquals(float[] a, float[] b) { if (a == null && b == null) { return true; } else if (a == null || b == null) { return false; } else { if (a.length != b.length) { return false; } } for (int i = 0; i < a.length; i++) { if (!floatEquals(a[i], b[i])) { return false; } } return true; } public static boolean doubleArrayEquals(double[] a, double[] b) { if (a == null && b == null) { return true; } else if (a == null || b == null) { return false; } else { if (a.length != b.length) { return false; } } for (int i = 0; i < a.length; i++) { if (!doubleEquals(a[i], b[i])) { return false; } } return true; } }
d3268b28f55215d1e39c323e6812164de65a8fca
ee8e36e488a850a20bd5d7ba88a2fc712f6e3601
/zztestmvcspring/src/main/java/com/prakash/services/LoginService.java
06992e8b674d1a6246d6b17c69beb330b89ae09e
[]
no_license
hsakarp/SpringMVCbasics
8154b96d4f54171b709896c6f705cf91c47f5d30
abccbb526ff77e4afd009fff383991fce48a0677
refs/heads/master
2022-12-21T03:10:00.959561
2019-06-27T19:29:28
2019-06-27T19:29:28
194,151,891
0
0
null
2022-12-16T00:45:33
2019-06-27T19:27:48
Java
UTF-8
Java
false
false
308
java
package com.prakash.services; import org.springframework.stereotype.Service; @Service public class LoginService { public boolean isLoginValid(String username,String password){ if (username.equals("prakash")&& password.equals("prakash")){ return true; }else{ return false; } } }
d92721fb91e1a0668effac0ad818388bc34a146c
2f55b273887bb566daf90a35cc3c6568435f21bb
/app/src/main/java/org/pjsip/pjsua2/pjmedia_tone_digit.java
0daad8105a252d4a7bb9c4c2a047b5bd0da7ef8f
[]
no_license
279154451/PJSipSDK
79d723edb8e41f2038beb64d26cc733655d18f64
6374359e19dd2939ea7d4899c924c27d48195539
refs/heads/main
2023-01-11T15:31:17.467130
2020-11-06T10:01:49
2020-11-06T10:01:49
310,530,376
7
3
null
null
null
null
UTF-8
Java
false
false
1,934
java
/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 2.0.12 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ package org.pjsip.pjsua2; public class pjmedia_tone_digit { private long swigCPtr; protected boolean swigCMemOwn; protected pjmedia_tone_digit(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = cPtr; } protected static long getCPtr(pjmedia_tone_digit obj) { return (obj == null) ? 0 : obj.swigCPtr; } protected void finalize() { delete(); } public synchronized void delete() { if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; pjsua2JNI.delete_pjmedia_tone_digit(swigCPtr); } swigCPtr = 0; } } public void setDigit(char value) { pjsua2JNI.pjmedia_tone_digit_digit_set(swigCPtr, this, value); } public char getDigit() { return pjsua2JNI.pjmedia_tone_digit_digit_get(swigCPtr, this); } public void setOn_msec(short value) { pjsua2JNI.pjmedia_tone_digit_on_msec_set(swigCPtr, this, value); } public short getOn_msec() { return pjsua2JNI.pjmedia_tone_digit_on_msec_get(swigCPtr, this); } public void setOff_msec(short value) { pjsua2JNI.pjmedia_tone_digit_off_msec_set(swigCPtr, this, value); } public short getOff_msec() { return pjsua2JNI.pjmedia_tone_digit_off_msec_get(swigCPtr, this); } public void setVolume(short value) { pjsua2JNI.pjmedia_tone_digit_volume_set(swigCPtr, this, value); } public short getVolume() { return pjsua2JNI.pjmedia_tone_digit_volume_get(swigCPtr, this); } public pjmedia_tone_digit() { this(pjsua2JNI.new_pjmedia_tone_digit(), true); } }
b3c01a3598b9627ef1710cf9029e645a210b7df3
117f5c9435f8477bd0e7b30cea3929d06b039c72
/Java/ACS/WEB-INF/src/ru/lexx/acsystem/backend/task/TaskPartitionRowHandler.java
165412c1c1ace4eaa82a16a9590a8d3266f29c20
[]
no_license
atmoresume-test/school-stuff
0af650c1deb5bee247c85f20d5ea420d2ce7fc1e
7eacb6db2ef89bc1099d472c251614554323b4df
refs/heads/master
2016-09-06T17:56:55.682924
2012-09-04T17:04:34
2012-09-04T17:04:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
563
java
package ru.lexx.acsystem.backend.task; import ru.jdev.utils.db.rowhandlers.RowHandler; import java.sql.ResultSet; import java.sql.SQLException; /** * Created by IntelliJ IDEA. * User: jdev * Date: 24.02.2006 * Time: 12:03:08 */ public class TaskPartitionRowHandler implements RowHandler { public Object processRow(ResultSet rs) throws SQLException { return new TaskPartition(rs.getInt("id"), rs.getString("name"), rs.getInt("need_to_resolve"), rs.getFloat("need_avg_points"), rs.getInt("part_order")); } }
e14ce2398154d812c3bbaa5a732f7646d9539b2f
df134b422960de6fb179f36ca97ab574b0f1d69f
/it/unimi/dsi/fastutil/floats/Float2CharSortedMaps.java
e58c9558f546e26a098a91064db17123e482a104
[]
no_license
TheShermanTanker/NMS-1.16.3
bbbdb9417009be4987872717e761fb064468bbb2
d3e64b4493d3e45970ec5ec66e1b9714a71856cc
refs/heads/master
2022-12-29T15:32:24.411347
2020-10-08T11:56:16
2020-10-08T11:56:16
302,324,687
0
1
null
null
null
null
UTF-8
Java
false
false
19,763
java
/* */ package it.unimi.dsi.fastutil.floats; /* */ /* */ import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterable; /* */ import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; /* */ import it.unimi.dsi.fastutil.objects.ObjectSet; /* */ import it.unimi.dsi.fastutil.objects.ObjectSortedSet; /* */ import it.unimi.dsi.fastutil.objects.ObjectSortedSets; /* */ import java.io.Serializable; /* */ import java.util.Comparator; /* */ import java.util.Map; /* */ import java.util.NoSuchElementException; /* */ import java.util.Objects; /* */ import java.util.Set; /* */ import java.util.SortedMap; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public final class Float2CharSortedMaps /* */ { /* */ public static Comparator<? super Map.Entry<Float, ?>> entryComparator(FloatComparator comparator) { /* 43 */ return (x, y) -> comparator.compare(((Float)x.getKey()).floatValue(), ((Float)y.getKey()).floatValue()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static ObjectBidirectionalIterator<Float2CharMap.Entry> fastIterator(Float2CharSortedMap map) { /* 60 */ ObjectSortedSet<Float2CharMap.Entry> entries = map.float2CharEntrySet(); /* 61 */ return (entries instanceof Float2CharSortedMap.FastSortedEntrySet) ? ( /* 62 */ (Float2CharSortedMap.FastSortedEntrySet)entries).fastIterator() : /* 63 */ entries.iterator(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static ObjectBidirectionalIterable<Float2CharMap.Entry> fastIterable(Float2CharSortedMap map) { /* 79 */ ObjectSortedSet<Float2CharMap.Entry> entries = map.float2CharEntrySet(); /* */ /* 81 */ Objects.requireNonNull((Float2CharSortedMap.FastSortedEntrySet)entries); return (entries instanceof Float2CharSortedMap.FastSortedEntrySet) ? (Float2CharSortedMap.FastSortedEntrySet)entries::fastIterator : /* 82 */ (ObjectBidirectionalIterable<Float2CharMap.Entry>)entries; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static class EmptySortedMap /* */ extends Float2CharMaps.EmptyMap /* */ implements Float2CharSortedMap, Serializable, Cloneable /* */ { /* */ private static final long serialVersionUID = -7046029254386353129L; /* */ /* */ /* */ /* */ /* */ /* */ public FloatComparator comparator() { /* 101 */ return null; /* */ } /* */ /* */ /* */ public ObjectSortedSet<Float2CharMap.Entry> float2CharEntrySet() { /* 106 */ return (ObjectSortedSet<Float2CharMap.Entry>)ObjectSortedSets.EMPTY_SET; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public ObjectSortedSet<Map.Entry<Float, Character>> entrySet() { /* 117 */ return (ObjectSortedSet<Map.Entry<Float, Character>>)ObjectSortedSets.EMPTY_SET; /* */ } /* */ /* */ /* */ public FloatSortedSet keySet() { /* 122 */ return FloatSortedSets.EMPTY_SET; /* */ } /* */ /* */ /* */ public Float2CharSortedMap subMap(float from, float to) { /* 127 */ return Float2CharSortedMaps.EMPTY_MAP; /* */ } /* */ /* */ /* */ public Float2CharSortedMap headMap(float to) { /* 132 */ return Float2CharSortedMaps.EMPTY_MAP; /* */ } /* */ /* */ /* */ public Float2CharSortedMap tailMap(float from) { /* 137 */ return Float2CharSortedMaps.EMPTY_MAP; /* */ } /* */ /* */ public float firstFloatKey() { /* 141 */ throw new NoSuchElementException(); /* */ } /* */ /* */ public float lastFloatKey() { /* 145 */ throw new NoSuchElementException(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap headMap(Float oto) { /* 155 */ return headMap(oto.floatValue()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap tailMap(Float ofrom) { /* 165 */ return tailMap(ofrom.floatValue()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap subMap(Float ofrom, Float oto) { /* 175 */ return subMap(ofrom.floatValue(), oto.floatValue()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float firstKey() { /* 185 */ return Float.valueOf(firstFloatKey()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float lastKey() { /* 195 */ return Float.valueOf(lastFloatKey()); /* */ } /* */ } /* */ /* */ /* */ /* */ /* 202 */ public static final EmptySortedMap EMPTY_MAP = new EmptySortedMap(); /* */ /* */ /* */ /* */ public static class Singleton /* */ extends Float2CharMaps.Singleton /* */ implements Float2CharSortedMap, Serializable, Cloneable /* */ { /* */ private static final long serialVersionUID = -7046029254386353129L; /* */ /* */ /* */ protected final FloatComparator comparator; /* */ /* */ /* */ /* */ protected Singleton(float key, char value, FloatComparator comparator) { /* 218 */ super(key, value); /* 219 */ this.comparator = comparator; /* */ } /* */ protected Singleton(float key, char value) { /* 222 */ this(key, value, (FloatComparator)null); /* */ } /* */ /* */ final int compare(float k1, float k2) { /* 226 */ return (this.comparator == null) ? Float.compare(k1, k2) : this.comparator.compare(k1, k2); /* */ } /* */ /* */ public FloatComparator comparator() { /* 230 */ return this.comparator; /* */ } /* */ /* */ /* */ public ObjectSortedSet<Float2CharMap.Entry> float2CharEntrySet() { /* 235 */ if (this.entries == null) /* 236 */ this.entries = (ObjectSet<Float2CharMap.Entry>)ObjectSortedSets.singleton(new AbstractFloat2CharMap.BasicEntry(this.key, this.value), /* 237 */ Float2CharSortedMaps.entryComparator(this.comparator)); /* 238 */ return (ObjectSortedSet<Float2CharMap.Entry>)this.entries; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public ObjectSortedSet<Map.Entry<Float, Character>> entrySet() { /* 249 */ return (ObjectSortedSet)float2CharEntrySet(); /* */ } /* */ /* */ public FloatSortedSet keySet() { /* 253 */ if (this.keys == null) /* 254 */ this.keys = FloatSortedSets.singleton(this.key, this.comparator); /* 255 */ return (FloatSortedSet)this.keys; /* */ } /* */ /* */ /* */ public Float2CharSortedMap subMap(float from, float to) { /* 260 */ if (compare(from, this.key) <= 0 && compare(this.key, to) < 0) /* 261 */ return this; /* 262 */ return Float2CharSortedMaps.EMPTY_MAP; /* */ } /* */ /* */ /* */ public Float2CharSortedMap headMap(float to) { /* 267 */ if (compare(this.key, to) < 0) /* 268 */ return this; /* 269 */ return Float2CharSortedMaps.EMPTY_MAP; /* */ } /* */ /* */ /* */ public Float2CharSortedMap tailMap(float from) { /* 274 */ if (compare(from, this.key) <= 0) /* 275 */ return this; /* 276 */ return Float2CharSortedMaps.EMPTY_MAP; /* */ } /* */ /* */ public float firstFloatKey() { /* 280 */ return this.key; /* */ } /* */ /* */ public float lastFloatKey() { /* 284 */ return this.key; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap headMap(Float oto) { /* 294 */ return headMap(oto.floatValue()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap tailMap(Float ofrom) { /* 304 */ return tailMap(ofrom.floatValue()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap subMap(Float ofrom, Float oto) { /* 314 */ return subMap(ofrom.floatValue(), oto.floatValue()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float firstKey() { /* 324 */ return Float.valueOf(firstFloatKey()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float lastKey() { /* 334 */ return Float.valueOf(lastFloatKey()); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static Float2CharSortedMap singleton(Float key, Character value) { /* 353 */ return new Singleton(key.floatValue(), value.charValue()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static Float2CharSortedMap singleton(Float key, Character value, FloatComparator comparator) { /* 373 */ return new Singleton(key.floatValue(), value.charValue(), comparator); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static Float2CharSortedMap singleton(float key, char value) { /* 391 */ return new Singleton(key, value); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static Float2CharSortedMap singleton(float key, char value, FloatComparator comparator) { /* 411 */ return new Singleton(key, value, comparator); /* */ } /* */ /* */ public static class SynchronizedSortedMap /* */ extends Float2CharMaps.SynchronizedMap /* */ implements Float2CharSortedMap, Serializable { /* */ private static final long serialVersionUID = -7046029254386353129L; /* */ protected final Float2CharSortedMap sortedMap; /* */ /* */ protected SynchronizedSortedMap(Float2CharSortedMap m, Object sync) { /* 421 */ super(m, sync); /* 422 */ this.sortedMap = m; /* */ } /* */ protected SynchronizedSortedMap(Float2CharSortedMap m) { /* 425 */ super(m); /* 426 */ this.sortedMap = m; /* */ } /* */ /* */ public FloatComparator comparator() { /* 430 */ synchronized (this.sync) { /* 431 */ return this.sortedMap.comparator(); /* */ } /* */ } /* */ /* */ public ObjectSortedSet<Float2CharMap.Entry> float2CharEntrySet() { /* 436 */ if (this.entries == null) /* 437 */ this.entries = (ObjectSet<Float2CharMap.Entry>)ObjectSortedSets.synchronize(this.sortedMap.float2CharEntrySet(), this.sync); /* 438 */ return (ObjectSortedSet<Float2CharMap.Entry>)this.entries; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public ObjectSortedSet<Map.Entry<Float, Character>> entrySet() { /* 449 */ return (ObjectSortedSet)float2CharEntrySet(); /* */ } /* */ /* */ public FloatSortedSet keySet() { /* 453 */ if (this.keys == null) /* 454 */ this.keys = FloatSortedSets.synchronize(this.sortedMap.keySet(), this.sync); /* 455 */ return (FloatSortedSet)this.keys; /* */ } /* */ /* */ public Float2CharSortedMap subMap(float from, float to) { /* 459 */ return new SynchronizedSortedMap(this.sortedMap.subMap(from, to), this.sync); /* */ } /* */ /* */ public Float2CharSortedMap headMap(float to) { /* 463 */ return new SynchronizedSortedMap(this.sortedMap.headMap(to), this.sync); /* */ } /* */ /* */ public Float2CharSortedMap tailMap(float from) { /* 467 */ return new SynchronizedSortedMap(this.sortedMap.tailMap(from), this.sync); /* */ } /* */ /* */ public float firstFloatKey() { /* 471 */ synchronized (this.sync) { /* 472 */ return this.sortedMap.firstFloatKey(); /* */ } /* */ } /* */ /* */ public float lastFloatKey() { /* 477 */ synchronized (this.sync) { /* 478 */ return this.sortedMap.lastFloatKey(); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float firstKey() { /* 489 */ synchronized (this.sync) { /* 490 */ return this.sortedMap.firstKey(); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float lastKey() { /* 501 */ synchronized (this.sync) { /* 502 */ return this.sortedMap.lastKey(); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap subMap(Float from, Float to) { /* 513 */ return new SynchronizedSortedMap(this.sortedMap.subMap(from, to), this.sync); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap headMap(Float to) { /* 523 */ return new SynchronizedSortedMap(this.sortedMap.headMap(to), this.sync); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap tailMap(Float from) { /* 533 */ return new SynchronizedSortedMap(this.sortedMap.tailMap(from), this.sync); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static Float2CharSortedMap synchronize(Float2CharSortedMap m) { /* 546 */ return new SynchronizedSortedMap(m); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static Float2CharSortedMap synchronize(Float2CharSortedMap m, Object sync) { /* 561 */ return new SynchronizedSortedMap(m, sync); /* */ } /* */ /* */ public static class UnmodifiableSortedMap /* */ extends Float2CharMaps.UnmodifiableMap /* */ implements Float2CharSortedMap, Serializable { /* */ private static final long serialVersionUID = -7046029254386353129L; /* */ protected final Float2CharSortedMap sortedMap; /* */ /* */ protected UnmodifiableSortedMap(Float2CharSortedMap m) { /* 571 */ super(m); /* 572 */ this.sortedMap = m; /* */ } /* */ /* */ public FloatComparator comparator() { /* 576 */ return this.sortedMap.comparator(); /* */ } /* */ /* */ public ObjectSortedSet<Float2CharMap.Entry> float2CharEntrySet() { /* 580 */ if (this.entries == null) /* 581 */ this.entries = (ObjectSet<Float2CharMap.Entry>)ObjectSortedSets.unmodifiable(this.sortedMap.float2CharEntrySet()); /* 582 */ return (ObjectSortedSet<Float2CharMap.Entry>)this.entries; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public ObjectSortedSet<Map.Entry<Float, Character>> entrySet() { /* 593 */ return (ObjectSortedSet)float2CharEntrySet(); /* */ } /* */ /* */ public FloatSortedSet keySet() { /* 597 */ if (this.keys == null) /* 598 */ this.keys = FloatSortedSets.unmodifiable(this.sortedMap.keySet()); /* 599 */ return (FloatSortedSet)this.keys; /* */ } /* */ /* */ public Float2CharSortedMap subMap(float from, float to) { /* 603 */ return new UnmodifiableSortedMap(this.sortedMap.subMap(from, to)); /* */ } /* */ /* */ public Float2CharSortedMap headMap(float to) { /* 607 */ return new UnmodifiableSortedMap(this.sortedMap.headMap(to)); /* */ } /* */ /* */ public Float2CharSortedMap tailMap(float from) { /* 611 */ return new UnmodifiableSortedMap(this.sortedMap.tailMap(from)); /* */ } /* */ /* */ public float firstFloatKey() { /* 615 */ return this.sortedMap.firstFloatKey(); /* */ } /* */ /* */ public float lastFloatKey() { /* 619 */ return this.sortedMap.lastFloatKey(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float firstKey() { /* 629 */ return this.sortedMap.firstKey(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float lastKey() { /* 639 */ return this.sortedMap.lastKey(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap subMap(Float from, Float to) { /* 649 */ return new UnmodifiableSortedMap(this.sortedMap.subMap(from, to)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap headMap(Float to) { /* 659 */ return new UnmodifiableSortedMap(this.sortedMap.headMap(to)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public Float2CharSortedMap tailMap(Float from) { /* 669 */ return new UnmodifiableSortedMap(this.sortedMap.tailMap(from)); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static Float2CharSortedMap unmodifiable(Float2CharSortedMap m) { /* 682 */ return new UnmodifiableSortedMap(m); /* */ } /* */ } /* Location: C:\Users\Josep\Downloads\Decompile Minecraft\tuinity-1.16.3.jar!\i\\unimi\dsi\fastutil\floats\Float2CharSortedMaps.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
6bb03d102b9cbe308bc47e6767e1411a94a7b001
00eb6b7808844e50495ee8f14ff04a045c1bd08d
/security-utils/src/main/java/com/yahoo/security/tls/ReloadingTlsContext.java
5add13e067dc5e44c5f8004335335fabf5e51543
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
rafan/vespa
5c42373882367085d4b2e2f553677cce4408a811
a6ac6fa83b28372727b70d776652fd05240e74f5
refs/heads/master
2022-07-27T15:10:13.684176
2018-12-12T12:33:00
2018-12-12T12:33:00
161,590,863
0
0
Apache-2.0
2018-12-13T05:56:07
2018-12-13T05:56:07
null
UTF-8
Java
false
false
2,669
java
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.security.tls; import javax.net.ssl.SSLEngine; import java.nio.file.Path; import java.time.Duration; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.logging.Level; import java.util.logging.Logger; /** * A {@link TlsContext} that regularly reloads the credentials referred to from the transport security options file. * * @author bjorncs */ public class ReloadingTlsContext implements TlsContext { private static final Duration UPDATE_PERIOD = Duration.ofHours(1); private static final Logger log = Logger.getLogger(ReloadingTlsContext.class.getName()); private final Path tlsOptionsConfigFile; private final AuthorizationMode mode; private final AtomicReference<TlsContext> currentTlsContext; private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(runnable -> { Thread thread = new Thread(runnable, "tls-context-reloader"); thread.setDaemon(true); return thread; }); public ReloadingTlsContext(Path tlsOptionsConfigFile, AuthorizationMode mode) { this.tlsOptionsConfigFile = tlsOptionsConfigFile; this.mode = mode; this.currentTlsContext = new AtomicReference<>(new DefaultTlsContext(tlsOptionsConfigFile, mode)); this.scheduler.scheduleAtFixedRate(new SslContextReloader(), UPDATE_PERIOD.getSeconds()/*initial delay*/, UPDATE_PERIOD.getSeconds(), TimeUnit.SECONDS); } @Override public SSLEngine createSslEngine() { return currentTlsContext.get().createSslEngine(); } @Override public void close() { try { scheduler.shutdownNow(); scheduler.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } } private class SslContextReloader implements Runnable { @Override public void run() { try { currentTlsContext.set(new DefaultTlsContext(tlsOptionsConfigFile, mode)); } catch (Throwable t) { log.log(Level.SEVERE, String.format("Failed to load SSLContext (path='%s'): %s", tlsOptionsConfigFile, t.getMessage()), t); } } } }
04949a6d28aa6bf5057db08a7c83419879ec7892
b96758cc9386809abbd291e6780b2d9afa2e31b5
/GayCuddles/src/main/java/com/rubisoft/gaycuddles/activities/Activity_estrellas_gratis.java
288f0e21791bf8107d15715fa7e6d6764c94c8ca
[]
no_license
apache05/Rubisoft
9cbbf4efd437d3e1d95f83a3d51c84d467f268d2
ca929417f1b51a680aa7c0762854f8147ad26683
refs/heads/master
2021-07-11T06:50:23.929636
2020-06-27T07:38:09
2020-06-27T07:38:09
128,368,523
0
0
null
null
null
null
UTF-8
Java
false
false
21,287
java
package com.rubisoft.gaycuddles.activities; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.net.ConnectivityManager; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.util.TypedValue; import android.view.GestureDetector; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.appodeal.ads.Appodeal; import com.appodeal.ads.BannerCallbacks; import com.appodeal.ads.RewardedVideoCallbacks; import com.explorestack.consent.Consent; import com.explorestack.consent.ConsentManager; import com.google.firebase.firestore.DocumentSnapshot; import com.google.firebase.firestore.FirebaseFirestore; import com.mikepenz.google_material_typeface_library.GoogleMaterial; import com.mikepenz.iconics.IconicsDrawable; import com.rubisoft.gaycuddles.Adapters.Drawer_Adapter; import com.rubisoft.gaycuddles.Classes.Drawer_Item; import com.rubisoft.gaycuddles.Classes.Logro; import com.rubisoft.gaycuddles.Interfaces.Interface_ClickListener_Menu; import com.rubisoft.gaycuddles.R; import com.rubisoft.gaycuddles.databinding.LayoutEstrellasGratisBinding; import com.rubisoft.gaycuddles.tools.utils; import java.io.File; import java.util.ArrayList; import java.util.Calendar; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; public class Activity_estrellas_gratis extends AppCompatActivity { private SharedPreferences perfil_usuario; private FirebaseFirestore db; //navigation drawer private Toolbar toolbar; private ActionBarDrawerToggle drawerToggle; private RecyclerView recyclerViewDrawer; private ImageView mImageView_PictureMain; private LayoutEstrellasGratisBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { try { overridePendingTransition(R.anim.activity_in, R.anim.activity_out); super.onCreate(savedInstanceState); if (utils.isNetworkAvailable((ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE))) { perfil_usuario = getSharedPreferences(getResources().getString(R.string.SHAREDPREFERENCES_PERFIL_USUARIO), Context.MODE_PRIVATE); if (perfil_usuario.getString(getString(R.string.PERFIL_USUARIO_TOKEN_SOCIALAUTH), "").isEmpty()) { salir(); } else { binding = LayoutEstrellasGratisBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); setup_toolbar(); setupViews(); db = FirebaseFirestore.getInstance(); perfil_usuario = getSharedPreferences(getResources().getString(R.string.SHAREDPREFERENCES_PERFIL_USUARIO), Context.MODE_PRIVATE); inicializa_anuncios(); setup_banner(); } } else { Intent mIntent = new Intent(this, Activity_Sin_Conexion.class); mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(mIntent); finish(); } } catch (Exception e) { utils.registra_error(e.toString(), "onCreate de estrellas_gratis"); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. this.getMenuInflater().inflate(R.menu.menu_options, menu); return true; } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. utils.gestiona_menu(item.getItemId(), this); return true; } @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); if (drawerToggle != null) { drawerToggle.onConfigurationChanged(newConfig); } } @Override protected void onResume() { super.onResume(); try { Appodeal.onResume(this, Appodeal.BANNER_TOP); setupNavigationDrawer(); } catch (Exception e) { utils.registra_error(e.toString(), "onResume de Estrellas_gratis"); } } @Override public void onBackPressed() { // super.onBackPressed(); Intent mIntent = new Intent(this, Activity_Principal.class); mIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(mIntent); finish(); } private void inicializa_anuncios(){ try{ FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); if (!perfil_usuario.getBoolean(getString(R.string.PERFIL_USUARIO_ES_PREMIUM), false)) { Consent consent = ConsentManager.getInstance(this).getConsent(); Appodeal.setTesting(false); Appodeal.initialize(this, getResources().getString(R.string.APPODEAL_APP_KEY), Appodeal.BANNER, consent); setup_banner(); int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, getResources().getDisplayMetrics()); layoutParams.setMargins(0, px, 0, 0); }else { layoutParams.setMargins(0, 0, 0, 0); } if (binding.mDrawerLayout!=null){ binding.mDrawerLayout.setLayoutParams(layoutParams); }else{ binding.MainLinearLayout.setLayoutParams(layoutParams); } }catch (Exception e){ utils.registra_error(e.toString(), "inicializa_anuncios de Activity_Estrellas_gratis"); } } private void setup_banner() { try { Appodeal.setBannerCallbacks(new BannerCallbacks() { @Override public void onBannerLoaded(int height, boolean isPrecache) { } @Override public void onBannerFailedToLoad() { } @Override public void onBannerShown() { } @Override public void onBannerClicked() { } @Override public void onBannerExpired() { } @Override public void onBannerShowFailed() { } }); Appodeal.show(this, Appodeal.BANNER_TOP); } catch (Exception e) { utils.registra_error(e.toString(), "setup_banner de Activity_Ayuda"); } } private void lanza_rewarded(){ ProgressBar mProgressBar = findViewById(R.id.mProgressBar); Appodeal.setRewardedVideoCallbacks(new RewardedVideoCallbacks() { @Override public void onRewardedVideoLoaded(boolean isPrecache) { utils.setProgressBar_visibility(mProgressBar, View.INVISIBLE); } @Override public void onRewardedVideoFailedToLoad() { Toast.makeText(getApplicationContext(), "Failed", Toast.LENGTH_LONG).show(); utils.setProgressBar_visibility(mProgressBar, View.INVISIBLE); } @Override public void onRewardedVideoShown() { utils.setProgressBar_visibility(mProgressBar, View.INVISIBLE); } @Override public void onRewardedVideoFinished(double amount, String name) { utils.setProgressBar_visibility(mProgressBar, View.INVISIBLE); dar_recompensa(); } @Override public void onRewardedVideoClosed(boolean finished) { utils.setProgressBar_visibility(mProgressBar, View.INVISIBLE); } @Override public void onRewardedVideoExpired() { utils.setProgressBar_visibility(mProgressBar, View.INVISIBLE); } @Override public void onRewardedVideoClicked() { } @Override public void onRewardedVideoShowFailed() { } }); utils.setProgressBar_visibility(mProgressBar, View.VISIBLE); Appodeal.show(this, Appodeal.REWARDED_VIDEO); } private void setupViews(){ try { Typeface typeFace_roboto_light = Typeface.createFromAsset(this.getAssets(), "fonts/Roboto-Light.ttf"); binding.LayoutEstrellasPorAnuncio.setText(String.format(getResources().getString(R.string.ACTIVITY_ESTRELLAS_POR_ANUNCIO), getResources().getInteger(R.integer.LOGRO_ANUNCIO_BONIFICADO))); binding.LayoutEstrellasPorAnuncio.setTypeface(typeFace_roboto_light); binding.LayoutEstrellasPorAnuncio.setOnClickListener(v -> lanza_rewarded()); }catch (Exception e){ utils.registra_error(e.toString(), "setupViews de estrellas_gratis"); } } private void dar_recompensa(){ actualiza_estrellas_en_sharedpreferences(); setupNavigationDrawer(); Toast.makeText(getApplicationContext(), String.format(getResources().getString(R.string.estrellas), getResources().getInteger(R.integer.LOGRO_ANUNCIO_BONIFICADO)), Toast.LENGTH_SHORT).show(); actualiza_estrellas_en_Firestore(getResources().getInteger(R.integer.LOGRO_ANUNCIO_BONIFICADO)); //new AsyncTask_Actualizar_Estrellas().execute(getResources().getInteger(R.integer.LOGRO_ANUNCIO_BONIFICADO)); //new AsyncTask_actualizar_logro_anuncio_bonificado().execute(); get_num_estrellas_actual(perfil_usuario.getString(getResources().getString(R.string.PERFIL_USUARIO_TOKEN_SOCIALAUTH),"")); } private void setup_toolbar() { // Setup toolbar and statusBar (really FrameLayout) toolbar = findViewById(R.id.mToolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(getResources().getString(R.string.app_name)); getSupportActionBar().setDisplayHomeAsUpEnabled(!utils.isTablet(this)); getSupportActionBar().setHomeButtonEnabled(true); } private void setupNavigationDrawer() { try { if (binding.mDrawerLayout!=null) { // Setup Drawer Icon drawerToggle = new ActionBarDrawerToggle(this, binding.mDrawerLayout, toolbar, R.string.drawer_open, R.string.drawer_close); binding.mDrawerLayout.addDrawerListener(drawerToggle); drawerToggle.syncState(); TypedValue typedValue = new TypedValue(); int color = typedValue.data; binding.mDrawerLayout.setStatusBarBackgroundColor(color); } // Setup RecyclerViews inside drawer setupNavigationDrawerRecyclerViews(); mImageView_PictureMain = findViewById(R.id.mImageView_PictureMain); TextView mTextView_Name = findViewById(R.id.Drawer_TextView_Name); TextView mTextView_Numero_estrellas = findViewById(R.id.Drawer_TextView_Num_Estrellas); TextView mTextView_Premium_User = findViewById(R.id.Drawer_TextView_Premium_User); Typeface typeFace_roboto_Light = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"); mTextView_Name.setTypeface(typeFace_roboto_Light); mTextView_Numero_estrellas.setTypeface(typeFace_roboto_Light); new AsyncTask_Coloca_PictureMain().execute(); mTextView_Name.setText(perfil_usuario.getString(getResources().getString(R.string.PERFIL_USUARIO_NICK), "")); mTextView_Name.setTextColor(ContextCompat.getColor(this, R.color.white)); mTextView_Numero_estrellas.setText(String.format(getResources().getString(R.string.numero),perfil_usuario.getLong(getResources().getString(R.string.PERFIL_USUARIO_ESTRELLAS), 0))); mTextView_Numero_estrellas.setTextColor(ContextCompat.getColor(this, R.color.white)); if (perfil_usuario.getBoolean(getResources().getString(R.string.PERFIL_USUARIO_ES_PREMIUM), false)){ mTextView_Premium_User.setText(getResources().getString(R.string.premium_user)); } Drawable icono_estrella; icono_estrella = new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_star).color(ContextCompat.getColor(this, R.color.white)); ImageView mImageView_Estrella = findViewById(R.id.Drawer_ImageView_estrella); mImageView_Estrella.setImageDrawable(icono_estrella); } catch (Exception e) { utils.registra_error(e.toString(), "setupNavigationDrawer de estrellas_gratis"); } } private void crea_ItemTouchListener_menu() { //Aquí hacemos las acciones pertinentes según el gesto que haya hecho el Usuario_para_listar //y que lo ha detectado y codificado primero el RecyclerTouchListener recyclerViewDrawer.addOnItemTouchListener(new RecyclerTouchListener_menu(this, recyclerViewDrawer, (view, position) -> { utils.gestiona_onclick_menu_principal(Activity_estrellas_gratis.this, position); if (!utils.isTablet(getApplicationContext())) { binding.mDrawerLayout.closeDrawers(); } })); } private void setupNavigationDrawerRecyclerViews() { try { recyclerViewDrawer = findViewById(R.id.recyclerViewDrawer); recyclerViewDrawer.setLayoutManager(new LinearLayoutManager(this)); ArrayList<Drawer_Item> drawerItems = new ArrayList<>(); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_track_changes).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[0])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_tune).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[1])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_email).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[2])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_perm_identity).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[3])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_star_border).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[4])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_attach_money).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[5])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_forum).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[6])); //drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_whatshot).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[7])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_help_outline).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[7])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_settings).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[8])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_thumbs_up_down).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[9])); drawerItems.add(new Drawer_Item(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_power_settings_new).color(ContextCompat.getColor(this, R.color.white)), getResources().getStringArray(R.array.nav_drawer_items)[10])); RecyclerView.Adapter drawerAdapter = new Drawer_Adapter(drawerItems); recyclerViewDrawer.setAdapter(drawerAdapter); recyclerViewDrawer.setMinimumHeight(utils.Dp2Px(144, this)); recyclerViewDrawer.setHasFixedSize(true); crea_ItemTouchListener_menu(); Typeface typeFace_roboto_Light = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"); for (int i = 0; i < recyclerViewDrawer.getChildCount(); i++) { TextView Drawer_item_TextView_title = recyclerViewDrawer.getChildAt(i).findViewById(R.id.Drawer_item_TextView_title); Drawer_item_TextView_title.setTypeface(typeFace_roboto_Light); } } catch (Exception ignored) { } } private void actualiza_estrellas_en_sharedpreferences(){ SharedPreferences.Editor editor_perfil_usuario = perfil_usuario.edit(); editor_perfil_usuario.putLong(getResources().getString(R.string.PERFIL_USUARIO_ESTRELLAS), perfil_usuario.getLong(getString(R.string.PERFIL_USUARIO_ESTRELLAS), 0) + getResources().getInteger(R.integer.LOGRO_ANUNCIO_BONIFICADO)); editor_perfil_usuario.apply(); } private void actualiza_estrellas_en_Firestore(Integer nuevas_estrellas) { String token_socualauth=perfil_usuario.getString(getResources().getString(R.string.PERFIL_USUARIO_TOKEN_SOCIALAUTH),""); long nuevo_num_estrellas; long num_estrellas_actual=perfil_usuario.getLong(getResources().getString(R.string.PERFIL_USUARIO_ESTRELLAS),0); nuevo_num_estrellas = num_estrellas_actual + nuevas_estrellas >= 0 ? num_estrellas_actual + nuevas_estrellas : 0; db.collection(getResources().getString(R.string.USUARIOS)).document(token_socualauth).update(getResources().getString(R.string.PERFIL_USUARIO_ESTRELLAS), nuevo_num_estrellas); } private void get_num_estrellas_actual(String token_socialauth){ db.collection(getResources().getString(R.string.USUARIOS)).document(token_socialauth).get().addOnCompleteListener(task -> { if (task.isSuccessful()) { DocumentSnapshot document = task.getResult(); if (document.exists()) { Long num_estrellas_actuales= (Long)document.get(getResources().getString(R.string.USUARIO_ESTRELLAS)); registra_logro_en_Firestore(token_socialauth,num_estrellas_actuales); } } }); } private void registra_logro_en_Firestore(String token_socialauth, Long num_estrellas_actual){ Long estrellas_conseguidas= (long) getResources().getInteger(R.integer.LOGRO_ANUNCIO_BONIFICADO); Long total_estrellas=estrellas_conseguidas +num_estrellas_actual; int motivo= getResources().getInteger(R.integer.MOTIVO_AD_REWARDED); Logro un_logro=new Logro(Integer.valueOf(motivo).longValue(),estrellas_conseguidas,Calendar.getInstance().getTimeInMillis(),total_estrellas); db.collection(getResources().getString(R.string.USUARIOS)).document(token_socialauth).collection(getResources().getString(R.string.LOGROS)).add(un_logro); } private class AsyncTask_Coloca_PictureMain extends AsyncTask<Void, Void, Bitmap> { @Override protected void onPreExecute() { } @Nullable @Override protected Bitmap doInBackground(Void... params) { Bitmap mBitmap = null; try { String nombre_thumb = utils.get_nombre_thumb(perfil_usuario.getString(getResources().getString(R.string.PERFIL_USUARIO_TOKEN_SOCIALAUTH), ""), 0); File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); File file = new File(storageDir, nombre_thumb); mBitmap = file.exists() ? utils.decodeSampledBitmapFromFilePath(file.getPath(), getResources().getDimensionPixelSize(R.dimen.tamanyo_foto_perfiles), getResources().getDimensionPixelSize(R.dimen.tamanyo_foto_perfiles)) : null; } catch (Exception ignored) { } return mBitmap; } @Override protected void onPostExecute(Bitmap mBitmap) { try { AppCompatImageView mAppCompatImageView = new AppCompatImageView(getApplicationContext()); LinearLayout.LayoutParams mlayoutParams_perfil = new LinearLayout.LayoutParams(getResources().getDimensionPixelSize(R.dimen.tamanyo_foto_perfiles), getResources().getDimensionPixelSize(R.dimen.tamanyo_foto_perfiles)); mAppCompatImageView.setLayoutParams(mlayoutParams_perfil); if (mBitmap != null) { mAppCompatImageView.setImageBitmap(mBitmap); mAppCompatImageView.setScaleType(ImageView.ScaleType.CENTER_CROP); } else { mAppCompatImageView.setImageDrawable(utils.get_no_pic(getApplicationContext(), ContextCompat.getColor(getApplicationContext(), R.color.primary_light))); } mImageView_PictureMain.setImageDrawable(mAppCompatImageView.getDrawable()); }catch (Exception e) { utils.registra_error(e.toString(), "AsyncTask_Coloca_PictureMain"); } } } private class RecyclerTouchListener_menu implements RecyclerView.OnItemTouchListener { @Nullable private final GestureDetector mGestureDetector; private final Interface_ClickListener_Menu mInterfaceClickListener; RecyclerTouchListener_menu(Context context, @NonNull RecyclerView recyclerView, Interface_ClickListener_Menu un_Interface_ClickListener) { mInterfaceClickListener = un_Interface_ClickListener; mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapUp(@NonNull MotionEvent e) { View child = recyclerViewDrawer.findChildViewUnder(e.getX(), e.getY()); if ((child != null) && (mInterfaceClickListener != null)) { mInterfaceClickListener.My_onClick(child, recyclerView.getChildLayoutPosition(child)); } return true; } }); } @Override public boolean onInterceptTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { //mGestureDetector.onTouchEvent llamará al método mas adecuado mGestureDetector.onTouchEvent(e); return false; } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } @Override public void onTouchEvent(@NonNull RecyclerView rv, @NonNull MotionEvent e) { } } private void salir() { //Si hemos llegado de rebote aquí sin tener una sesión abierta, debemos salir finish(); } }
2c9ae5e4733cc6cbf8bbb2d0d929009340781218
45ef9c0ccfcd5c9efbe87bd146e82f79c614eb7f
/openapm/src/main/java/it/iks/openapm/jobs/baselines/MetricsCompositeProcessor.java
7fe049b813368f45b997382cc815c1879a868631
[]
no_license
tommasocarraro/ProgettoIngegneriaDelSoftware
b874471a655d6f28012b87c27e7c44fb4fd4a9e4
ce24acb61ef97d9ed9a9a80b7263e1d66a6a8534
refs/heads/master
2022-05-31T20:56:37.600452
2018-09-27T13:43:02
2018-09-27T13:43:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,057
java
package it.iks.openapm.jobs.baselines; import it.iks.openapm.jobs.GroupItemsFilter; import it.iks.openapm.models.BaselineConfig; import it.iks.openapm.operators.OperatorFactory; import it.iks.openapm.strategies.StrategyFactory; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.annotation.BeforeStep; import org.springframework.batch.item.support.CompositeItemProcessor; import java.util.Arrays; import java.util.Date; import java.util.Map; /** * Define a series of processors to generate a baseline from metrics. * * This wrapper class is needed to listen correctly to BeforeStep event. */ public class MetricsCompositeProcessor extends CompositeItemProcessor<Iterable<Iterable<Map<String, Object>>>, Iterable<Map<String, Object>>> { private final OperatorFactory operatorFactory; private final StrategyFactory strategyFactory; /** * Instantiate MetricsCompositeProcessor. * * @param operatorFactory Operator factory * @param strategyFactory Strategy factory */ public MetricsCompositeProcessor(OperatorFactory operatorFactory, StrategyFactory strategyFactory) { this.operatorFactory = operatorFactory; this.strategyFactory = strategyFactory; } /** * Load configurations from job parameters/context into local variables * before step starts and set delegates processors. * * @param stepExecution StepExecution context to extract data from */ @BeforeStep public void beforeStep(StepExecution stepExecution) { BaselineConfig config = (BaselineConfig) stepExecution.getJobExecution().getExecutionContext().get("config"); Date calculationTime = stepExecution.getJobParameters().getDate("calculation_time"); setDelegates(Arrays.asList( new GroupItemsFilter(config, operatorFactory), new MetricsGroupsAggregator(config, operatorFactory), new BaselinesCalculator(config, calculationTime, operatorFactory, strategyFactory) )); } }
c144689bf6482a54f124770ed8d538821f414084
e715b8b2a5be2545f023c46dfc1e9fec5b7e53c1
/Lab9/Bag.java
7f1f24bcc548a6cfecf8b17d71588c9c684e4648
[]
no_license
PhurpaThinley/Lab9
f5cf4feab3391ee2605e5ffcc12c24776f35608b
d43b9de15dce6fba29c15e18133d4e7533d71895
refs/heads/master
2023-05-14T03:57:55.888209
2020-12-11T15:22:22
2020-12-11T15:22:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,709
java
import java.util.Iterator; import java.util.NoSuchElementException; public class Bag<Item> implements Iterable<Item> { private Node<Item> first; // beginning of bag private int n; // number of elements in bag // helper linked list class private static class Node<Item> { private Item item; private Node<Item> next; } /** * Initializes an empty bag. */ public Bag() { first = null; n = 0; } /** * Returns true if this bag is empty. * * @return {@code true} if this bag is empty; * {@code false} otherwise */ public boolean isEmpty() { return first == null; } /** * Returns the number of items in this bag. * * @return the number of items in this bag */ public int size() { return n; } /** * Adds the item to this bag. * * @param item the item to add to this bag */ public void add(Item item) { Node<Item> oldfirst = first; first = new Node<Item>(); first.item = item; first.next = oldfirst; n++; } /** * Returns an iterator that iterates over the items in this bag in arbitrary order. * * @return an iterator that iterates over the items in this bag in arbitrary order */ public Iterator<Item> iterator() { return new LinkedIterator(first); } // an iterator, doesn't implement remove() since it's optional private class LinkedIterator implements Iterator<Item> { private Node<Item> current; public LinkedIterator(Node<Item> first) { current = first; } public boolean hasNext() { return current != null; } public void remove() { throw new UnsupportedOperationException(); } public Item next() { if (!hasNext()) throw new NoSuchElementException(); Item item = current.item; current = current.next; return item; } } /** * Unit tests the {@code Bag} data type. * * @param args the command-line arguments */ public static void main(String[] args) { Graph gp = new Graph(10); gp.addEdge(0,1); gp.addEdge(1,2); gp.addEdge(2,3); gp.addEdge(3,4); gp.addEdge(4,5); gp.addEdge(5,6); gp.addEdge(6,7); gp.addEdge(7,8); gp.addEdge(8,9); System.out.println(gp.degree(1)); System.out.print(gp.toString()); } }
d0861f896500eee59683fae36fc4a41c002aa5e1
48c56a115d3d9a7189f4a4ec87eb15c66eada546
/src/Server/newsServer.java
357211bd583aecdf976a07c82aa1a3bde7ce20d7
[]
no_license
fancydoll/Collega
3eec9849334ccfc17fec563ff5ca70082d23082a
07d561a9d49b45122590e4f6128686e613eafce9
refs/heads/master
2021-07-09T13:01:13.466268
2017-10-08T10:12:55
2017-10-08T10:12:55
105,380,933
0
0
null
null
null
null
UTF-8
Java
false
false
877
java
package Server; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.codehaus.jackson.map.ObjectMapper; import News.newsConnection; public class newsServer extends HttpServlet{ public void service(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ response.setCharacterEncoding("UTF-8"); String title = request.getParameter("title"); String type = request.getParameter("type"); newsConnection n1 = new newsConnection(); int flag = n1.setNews(type,title); ObjectMapper om = new ObjectMapper(); String json = om.writeValueAsString(flag); PrintWriter pw = response.getWriter(); pw.print(json); } }
b26429417d117dbc4a1a1d357ac22d0011164483
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project411/src/test/java/org/gradle/test/performance/largejavamultiproject/project411/p2056/Test41139.java
1ecda31a2bba168fb739765adeeb54590796d66b
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
2,616
java
package org.gradle.test.performance.largejavamultiproject.project411.p2056; import org.gradle.test.performance.largejavamultiproject.project411.p2055.Production41112; import org.gradle.test.performance.largejavamultiproject.project408.p2040.Production40812; import org.gradle.test.performance.largejavamultiproject.project408.p2041.Production40825; import org.gradle.test.performance.largejavamultiproject.project408.p2041.Production40838; import org.junit.Test; import static org.junit.Assert.*; public class Test41139 { Production41139 objectUnderTest = new Production41139(); @Test public void testProperty0() { Production41112 value = new Production41112(); objectUnderTest.setProperty0(value); assertEquals(value, objectUnderTest.getProperty0()); } @Test public void testProperty1() { Production41125 value = new Production41125(); objectUnderTest.setProperty1(value); assertEquals(value, objectUnderTest.getProperty1()); } @Test public void testProperty2() { Production41138 value = new Production41138(); objectUnderTest.setProperty2(value); assertEquals(value, objectUnderTest.getProperty2()); } @Test public void testProperty3() { Production40812 value = new Production40812(); objectUnderTest.setProperty3(value); assertEquals(value, objectUnderTest.getProperty3()); } @Test public void testProperty4() { Production40825 value = new Production40825(); objectUnderTest.setProperty4(value); assertEquals(value, objectUnderTest.getProperty4()); } @Test public void testProperty5() { Production40838 value = new Production40838(); objectUnderTest.setProperty5(value); assertEquals(value, objectUnderTest.getProperty5()); } @Test public void testProperty6() { String value = "value"; objectUnderTest.setProperty6(value); assertEquals(value, objectUnderTest.getProperty6()); } @Test public void testProperty7() { String value = "value"; objectUnderTest.setProperty7(value); assertEquals(value, objectUnderTest.getProperty7()); } @Test public void testProperty8() { String value = "value"; objectUnderTest.setProperty8(value); assertEquals(value, objectUnderTest.getProperty8()); } @Test public void testProperty9() { String value = "value"; objectUnderTest.setProperty9(value); assertEquals(value, objectUnderTest.getProperty9()); } }
f0f438988495f1e614c5a34726e5fdc9ab6db36b
2c2fd6c8cf63610d6426db5f3c9e0a46337d4c2e
/src/com/brian/AlgorithmTraining/offer/Q54KthBiggestNodeOfBST.java
0877dc919cd7de24863d44ab0b499b84bfdb0366
[]
no_license
briankwon/Exercises
8b7d10fe1de3492574d829118bbf9d7ba424533a
5f9c984319aee4f853a0476a9ab0f106f4fbdc7e
refs/heads/master
2021-05-08T15:32:14.354620
2021-01-19T16:46:32
2021-01-19T16:46:32
120,117,253
0
0
null
null
null
null
UTF-8
Java
false
false
1,276
java
package com.brian.AlgorithmTraining.offer; import java.util.ArrayList; import java.util.List; import java.util.Stack; public class Q54KthBiggestNodeOfBST { public static void main(String[] args) { TreeNode t1 = new TreeNode(8); t1.left = new TreeNode(4); t1.right = new TreeNode(12); t1.left.left = new TreeNode(2); t1.left.right = new TreeNode(6); t1.right.left = new TreeNode(10); t1.right.right = new TreeNode(14); t1.left.left.left = new TreeNode(1); t1.left.left.right = new TreeNode(3); System.out.println(search(t1, 3)); } public static int search(TreeNode root, int k) { List<TreeNode> list = new ArrayList<>(); inorder(root, list); return list.get(k - 1).val; } public static void inorder(TreeNode root, List<TreeNode> res) { if (root == null) { return; } Stack<TreeNode> stack = new Stack<>(); while (!stack.isEmpty() || root != null) { if (root != null) { stack.push(root); root = root.left; } else { root = stack.pop(); res.add(root); root = root.right; } } } }
aaffbe3b5e17ed1ad2e206761fde6aed76e55b00
747df99f4ed89328be3d072a5d1e01fd30218ea4
/app/src/main/java/com/example/muhammedraheezrahman/newslisting/Model/Articles.java
5dc453971519e92370f3b73dd68d6b8bc88009a4
[]
no_license
raheez/NewsApp
f8978738b28b573761a4e60cfb72411ca259f240
caf1a8c482850527d765ad79bf364b83bd0ff59d
refs/heads/master
2020-04-15T18:05:30.059324
2019-01-13T04:31:07
2019-01-13T04:31:07
164,900,557
0
0
null
null
null
null
UTF-8
Java
false
false
2,325
java
package com.example.muhammedraheezrahman.newslisting.Model; public class Articles { //region vaiables private String author; private String title; private String description; private String urlToImage; private String content; private int id; private String publishedAt; //endregion //region database_variable_declarations public static final String TABLE_NAME = "articles"; public static String COLUMN_ID = "id"; public static String COLUMN_AUTHOR = "author"; public static String COLUMN_TITLE = "title"; public static String COLUMN_DESCRIPTION = "description"; public static String COLUMN_IMAGE = "image"; public static String COLUMN_CONTENT = "content"; public static String COLUMN_DATE = "publishedAt"; public static final String CREATE_TABLE = "CREATE TABLE "+ TABLE_NAME + "(" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + COLUMN_AUTHOR + " TEXT," + COLUMN_TITLE + " TEXT," + COLUMN_DESCRIPTION + " TEXT," + COLUMN_IMAGE + " TEXT," + COLUMN_CONTENT + " TEXT," + COLUMN_DATE + " DATETIME DEFAULT CURRENT_TIMESTAMP" + ")"; //endregion //region getters_setters public int getId() { return id; } public void setId(int id) { this.id = id; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getUrlToImage() { return urlToImage; } public void setUrlToImage(String urlToImage) { this.urlToImage = urlToImage; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getPublishedAt() { return publishedAt; } public void setPublishedAt(String publishedAt) { this.publishedAt = publishedAt; } //endregion }
acae7710790a417820d22e49b59cc9ef044f8968
b6091db84f323d3bf7b02e387d7b25a824d000a4
/src/main/java/com/bolion/question/bean/Theme.java
437ad511e09d2c11c1ef4fef4cf3ad7f60c946e6
[]
no_license
konglj/question
0d4c9a65e4d8cb705fd6db8c01511cd80b8b909f
e42c2f63bdfe8d1bc4721a97e05bc6af47595e22
refs/heads/master
2020-06-26T19:12:01.567709
2016-09-07T08:21:48
2016-09-07T08:21:48
67,587,163
0
0
null
null
null
null
UTF-8
Java
false
false
2,847
java
package com.bolion.question.bean; import java.util.ArrayList; import java.util.List; public class Theme { private int id; private int questionid; private String title; private int issub; private int type; private int minscore; private int maxscore; private int required; private int textmaxlen; private int filemaxsize; private int parentid; private int orderby; private String typename; private int subcount; private String result; private int answerrole; private List<Theme> subThemes=new ArrayList<Theme>(); public int getId() { return id; } public void setId(int id) { this.id = id; } public int getQuestionid() { return questionid; } public void setQuestionid(int questionid) { this.questionid = questionid; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getIssub() { return issub; } public void setIssub(int issub) { this.issub = issub; } public int getType() { return type; } public void setType(int type) { this.type = type; } public int getMinscore() { return minscore; } public void setMinscore(int minscore) { this.minscore = minscore; } public int getMaxscore() { return maxscore; } public void setMaxscore(int maxscore) { this.maxscore = maxscore; } public int getRequired() { return required; } public void setRequired(int required) { this.required = required; } public int getTextmaxlen() { return textmaxlen; } public void setTextmaxlen(int textmaxlen) { this.textmaxlen = textmaxlen; } public int getFilemaxsize() { return filemaxsize; } public void setFilemaxsize(int filemaxsize) { this.filemaxsize = filemaxsize; } public int getParentid() { return parentid; } public void setParentid(int parentid) { this.parentid = parentid; } public int getOrderby() { return orderby; } public void setOrderby(int orderby) { this.orderby = orderby; } public String getTypename() { return typename; } public void setTypename(String typename) { this.typename = typename; } public int getSubcount() { return subcount; } public void setSubcount(int subcount) { this.subcount = subcount; } public List<Theme> getSubThemes() { return subThemes; } public void setSubThemes(List<Theme> subThemes) { this.subThemes = subThemes; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } public int getAnswerrole() { return answerrole; } public void setAnswerrole(int answerrole) { this.answerrole = answerrole; } }
614fab038b0a446bb3cf651ea6cae7abf07ee7fe
7c67fab44065ae56baa0b162e1a245f977d5b9a9
/Java, Postage, sql/src/main/java/com/revature/repository/UserRepository.java
15192dd1994a0dafb540a090c94df9e68b5323f5
[]
no_license
Allenma1988/Senior-Design-Boeing-Project
d24ec284910762bf27603478174d15927ae77305
f54d274aee3353dd1739822253a58c45d6f5f10b
refs/heads/master
2023-07-19T18:13:59.575155
2019-07-03T05:55:58
2019-07-03T05:55:58
151,492,614
0
0
null
2023-07-18T08:39:04
2018-10-03T23:14:34
Java
UTF-8
Java
false
false
295
java
package com.revature.repository; import java.util.List; import com.revature.model.User; public interface UserRepository { public List<User> getAllUsers(); public User getUserById(int id); public void insertUser(User u); public void updateUser(User u); public void deleteUser(User u); }
36d8fa78d57ce5c4e0e54b7cac88de6277e7d801
e9a7ac2df4d5fd1be6ce1fd643b6454a5c3793f0
/src/org/omg/DynamicAny/AnySeqHelper.java
ad1e5a81f1385b2ac7f45b58ac7b9feb57cae012
[]
no_license
zhousong/Java7
cf25074358a2c798124976c012b513989b1162c8
03c6b5f16d59f54f1336432261eccfd2d4cd04ca
refs/heads/master
2021-01-10T01:43:48.563907
2015-10-19T02:27:46
2015-10-19T02:27:46
44,504,410
0
0
null
null
null
null
UTF-8
Java
false
false
1,840
java
package org.omg.DynamicAny; /** * org/omg/DynamicAny/AnySeqHelper.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from ../../../../src/share/classes/org/omg/DynamicAny/DynamicAny.idl * Tuesday, October 8, 2013 5:48:40 AM PDT */ abstract public class AnySeqHelper { private static String _id = "IDL:omg.org/DynamicAny/AnySeq:1.0"; public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Any[] that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); a.type (type ()); write (out, that); a.read_value (out.create_input_stream (), type ()); } public static org.omg.CORBA.Any[] extract (org.omg.CORBA.Any a) { return read (a.create_input_stream ()); } private static org.omg.CORBA.TypeCode __typeCode = null; synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any); __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.DynamicAny.AnySeqHelper.id (), "AnySeq", __typeCode); } return __typeCode; } public static String id () { return _id; } public static org.omg.CORBA.Any[] read (org.omg.CORBA.portable.InputStream istream) { org.omg.CORBA.Any value[] = null; int _len0 = istream.read_long (); value = new org.omg.CORBA.Any[_len0]; for (int _o1 = 0;_o1 < value.length; ++_o1) value[_o1] = istream.read_any (); return value; } public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any[] value) { ostream.write_long (value.length); for (int _i0 = 0;_i0 < value.length; ++_i0) ostream.write_any (value[_i0]); } }
02f340cc065ef0a36d9d8937c7d9a036ed973e9c
cb2ef92ef829d77889ba086006fd6f54056c8ecf
/Code/Lab11_checkbox/src/java/CheckboxServlet.java
dbfdcaf4b6ab437b4db40449133b384e7136799b
[]
no_license
anxhuang/Java_Web_Practices
52174c42d50b262d2d23e75503557137a9a048c8
7a24c23f98975c3d85f172775a069e517b9a8ad4
refs/heads/master
2020-03-28T07:27:58.961339
2018-11-10T08:53:58
2018-11-10T08:53:58
141,272,251
0
0
null
null
null
null
UTF-8
Java
false
false
2,493
java
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(urlPatterns = {"/CheckboxServlet"}) public class CheckboxServlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { //checkbox表單勾選的水果值會以 字串陣列 型式提供→要用getParameterValues()才可回傳陣列 String[] fruit = request.getParameterValues("fruit"); if (fruit == null) { fruit = new String[]{"無"}; } request.setAttribute("fruit", fruit); RequestDispatcher rd = request.getRequestDispatcher("/checkboxView.jsp"); rd.forward(request, response); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
2ce0c683765bcae430fb60a066ce16ea508b0e69
eb69f189cf7916c33e5738a4a8961971244c9848
/ExpressionTree/CommandLine/test/expressiontree/tree/TreeOpsTest.java
27a99748f30e9cc9bc2e108235a6a577bbfca84c
[]
no_license
douglascraigschmidt/LiveLessons
59e06ade1d0786eac665d3fe369426cde36ff199
b685afc62b469b17e3e9323a814e220d5315df55
refs/heads/master
2023-08-18T01:21:04.022903
2023-08-02T00:52:16
2023-08-02T00:52:16
21,949,817
587
712
null
2023-02-18T04:18:02
2014-07-17T16:46:47
Java
UTF-8
Java
false
false
2,836
java
package expressiontree.tree; import static org.junit.Assert.*; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import org.junit.After; import org.junit.Before; import org.junit.Test; import expressiontree.platspecs.Platform; import expressiontree.platspecs.PlatformFactory; public class TreeOpsTest { private TreeOps ops; private final ByteArrayOutputStream out = new ByteArrayOutputStream(); @Before public void init() { ops = new TreeOps(); System.setOut(new PrintStream(out)); Platform.instance(new PlatformFactory(System.in, new PrintStream(out), null).makePlatform()); } @After public void cleanUpStreams() { System.setOut(null); } @Test public void test$interpreter() { assertNotNull(ops.interpreter()); } @Test(expected = NullPointerException.class) public void test$format() { ops.format(null); } @Test public void test$format$emptyString() { ops.format(""); assertTrue(ops.formatted()); } @Test(expected = IllegalStateException.class) public void test$makeTree() { ops.makeTree(null); } @Test(expected = IllegalStateException.class) public void test$makeTree$emptyString() { ops.makeTree(""); } @Test(expected = IllegalStateException.class) public void test$print() { ops.print(null); } @Test(expected = IllegalStateException.class) public void test$print$emptyString() { ops.print(""); } @Test(expected = IllegalStateException.class) public void test$evaluate() { ops.evaluate(null); } @Test(expected = IllegalStateException.class) public void test$evaluate$emptyString() { ops.evaluate(""); } @Test(expected = RuntimeException.class) public void test$set() { ops.set(null); } @Test(expected = RuntimeException.class) public void test$set$emptyString() { ops.set(""); } @Test(expected = RuntimeException.class) public void test$set$someString() { ops.set("a"); } @Test(expected = RuntimeException.class) public void test$set$notFullExpression() { ops.set("a="); ops.interpreter().symbolTable().print(); assertEquals("a = 1" + System.lineSeparator(), out.toString()); } @Test public void test$set$expressionWithSpaces() { ops.set(" a = 1 "); ops.interpreter().symbolTable().print(); assertEquals("a = 1" + System.lineSeparator(), out.toString()); } @Test public void test$set$expression() { ops.set("a=1"); ops.interpreter().symbolTable().print(); assertEquals("a = 1" + System.lineSeparator(), out.toString()); } @Test public void test$state() { assertNotNull(ops.state()); } @Test public void test$tree() { assertNotNull(ops.tree()); } @Test public void test$formatted() { assertFalse(ops.formatted()); } }
b6af44f5d404634ae289c5de4ea29e5277fe3a34
88bb279a6b02ee724bcd3adc3d0003a9326f29ce
/src/main/java/lk/ijse/easycarrental/dto/Admin_DTO.java
a2c1a2bf7202eabc8e7fae2e7148111ce5eb7054
[]
no_license
gayanga-4534/easy_car_rental
acd1b65fcd3fe58dbe6f6c18a4f9a40aa825ff87
0d704c44c40906715f43c2d0b235fe4f56f9b7e7
refs/heads/master
2023-02-07T06:49:38.242301
2021-01-04T12:05:32
2021-01-04T12:05:32
326,671,583
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package lk.ijse.easycarrental.dto; public class Admin_DTO { private String adminlog_ID; private String logindatetime; public Admin_DTO() { } public Admin_DTO(String adminlog_ID, String logindatetime) { this.adminlog_ID = adminlog_ID; this.logindatetime = logindatetime; } public String getAdminlog_ID() { return adminlog_ID; } public void setAdminlog_ID(String adminlog_ID) { this.adminlog_ID = adminlog_ID; } public String getLogindatetime() { return logindatetime; } public void setLogindatetime(String logindatetime) { this.logindatetime = logindatetime; } @Override public String toString() { return super.toString(); } }
5dec70f850f2f810a57445b5d48f9077ad14396b
c1e2cadb70be4a223a38ab8706628e6ccd7b9f2f
/commodity/src/main/java/com/taobao/CommodityApplication.java
8a811867bf12b1e1fb46673d49bc149a10c0a999
[]
no_license
lyz-4dou/miniversion
836f6a6dda0a98bae533f8ab47b7b868494360d4
9ae20205e50928fd71820aeadd236f96b49fe8ce
refs/heads/master
2021-01-05T14:49:51.267364
2020-02-17T13:10:22
2020-02-17T13:10:22
241,054,936
0
0
null
null
null
null
UTF-8
Java
false
false
319
java
package com.taobao; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class CommodityApplication { public static void main(String[] args) { SpringApplication.run(CommodityApplication.class,args); } }
1048c11d341995dcef6e40def4bb5a763651d7f1
2d8e64c9a6a3aed534737cc0e9bd885ca877cc6b
/src/eon/EON_Server.java
a5675b0dbca68e1160518107b13ab18477139b4c
[]
no_license
PrernaGandhi/Project-EON_SERVER
a43ca8099c19aa67479d75283b41e41b652080bc
6ca0c168be419b9318d4d96cecd0d749647e09d3
refs/heads/master
2020-03-26T01:37:35.601134
2017-05-12T01:48:12
2017-05-12T01:48:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
899
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 eon; import java.rmi.*; import java.rmi.registry.*; /** * * @author prince */ public class EON_Server { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("Server starting"); try{ LocateRegistry.createRegistry(1099); //System.setProperty("java.rmi.server.hostname", "192.168.1.1"); Eon_intf request_obj = new Server_Def(); Naming.rebind("rmi://localhost:1099/eon",request_obj); System.out.println("Running on localhost @ port 1099"); } catch(Exception e){ System.out.println(e); } new login().setVisible(true); } }
[ "prince@dragonite" ]
prince@dragonite
4d441ec797409cd3a28895b3867ebd02b320fa77
63931eeb36e57dc0b110feb6f2fc9195680583c5
/project/example-project/src/main/java/com/jjunpro/shop/config/SecurityConfig.java
749088e79cb14bd3be59e6ea5427cfc3007bda9c
[]
no_license
alalstjr/Java-spring-oauth
7951579466cf8eccb0b2296c08f745b9322ff7f6
f826d00c05a1071f9cde6d26cd297ef715d01e62
refs/heads/master
2022-05-24T04:17:23.973192
2020-04-25T16:37:49
2020-04-25T16:37:49
258,777,250
0
0
null
null
null
null
UTF-8
Java
false
false
1,594
java
package com.jjunpro.shop.config; import com.jjunpro.shop.service.AccountService; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.password.PasswordEncoder; @Configuration @EnableWebSecurity @RequiredArgsConstructor public class SecurityConfig extends WebSecurityConfigurerAdapter { private final AccountService accountService; private final PasswordEncoder passwordEncoder; /* Custom userDetailsService 등록 */ @Autowired public void configureGlobal(AuthenticationManagerBuilder managerBuilder) throws Exception { managerBuilder .userDetailsService(this.accountService) .passwordEncoder(passwordEncoder); } @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Override protected void configure(HttpSecurity http) throws Exception { } }
f090397145d1808cbfb579300e350acc5a88d683
548c82b3acfadf712b635e3533347a09198c1364
/src/testNG/parameterTest.java
25ca265498ba59fbbcc14ddc27ceed068908c90b
[]
no_license
samirsukla/JavaInterviewPrograms
34e54e6d97da15e9cee47d439ecd2fdec87e7cd9
2fb3685026b8c3fadb889926c2a3905a49b2b1ab
refs/heads/master
2023-02-28T20:56:38.236159
2021-02-05T06:07:51
2021-02-05T06:07:51
336,179,372
0
0
null
null
null
null
UTF-8
Java
false
false
1,297
java
package testNG; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Parameters; import org.testng.annotations.Test; public class parameterTest { public WebDriver driver; String url = "https://www.amazon.in/"; @Parameters({"browser"}) @BeforeTest public void openBrowser(String browser) { try { if(browser.equalsIgnoreCase("firefox")) { System.setProperty("webdriver.gecko.driver", "C:\\Users\\IBM_ADMIN\\Downloads\\Selenium_Setup\\geckodriver-v0.17.0-win64\\geckodriver.exe"); driver = new FirefoxDriver(); } else if(browser.equalsIgnoreCase("CHROME")){ System.setProperty("webdriver.chrome.driver", "C:\\Users\\IBM_ADMIN\\Downloads\\Selenium_Setup\\chromedriver_win32\\chromedriver.exe"); driver = new ChromeDriver(); } else if(browser.equalsIgnoreCase("Ie")) { System.setProperty("webdriver.ie.driver", "C:\\Users\\IBM_ADMIN\\Downloads\\Selenium_Setup\\IEDriverServer_Win32_3.7.0\\IEDriverServer.exe"); driver = new InternetExplorerDriver(); } } catch (Exception e) { e.printStackTrace(); } } @Test public void openURL() { driver.navigate().to(url); } @AfterTest public void closeBrowser() { driver.close(); } }
8be9871295c834b266ccab258f472b8fdb7fa06b
a05a70fab8b6d9b12fc6addf57cb2e6a6896b1c3
/src/main/java/com/bootcamp/StudentMark/components/Input.java
462b27ab0f2765e47af35205266c34ce05569bdc
[]
no_license
saurabh-code/StudentMark
6e34c38a63d4524e3399ab236fd9bf65fb9240ed
d1c94123d123d8a47fec5c8ec1c9746b92b29f2a
refs/heads/master
2020-03-25T09:45:49.277497
2018-08-06T05:35:10
2018-08-06T05:35:10
143,675,327
0
0
null
null
null
null
UTF-8
Java
false
false
69
java
package com.bootcamp.StudentMark.components; public class Input { }
bed55f9225c335a77a80f6cb0a12cd189e849ee8
673aff29614a5d12b78593cb9324aed82440d76f
/src/main/java/com/dksoft/formshiftserver/ScheduleUpdatingLeaderBoard.java
b593325ec37f768fb5262bf339016a520063a32f
[]
no_license
MaxiRGor/FormShiftServer
b9c5d0c2cc712f779c5a52b322dc8d10b5167d82
abe97b2a4a6209383c129a1936d91c64f53a0a1e
refs/heads/master
2021-03-07T19:48:11.559824
2020-03-20T07:49:48
2020-03-20T07:49:48
246,292,935
0
0
null
null
null
null
UTF-8
Java
false
false
2,614
java
package com.dksoft.formshiftserver; import com.dksoft.formshiftserver.Model.LeaderboardGeneral; import com.dksoft.formshiftserver.Model.User; import com.dksoft.formshiftserver.Repository.LeaderboardGeneralRepository; import com.dksoft.formshiftserver.Repository.LeaderboardGroupRepository; import com.dksoft.formshiftserver.Repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @Component public class ScheduleUpdatingLeaderBoard { private UserRepository userRepository; private LeaderboardGroupRepository leaderboardGroupRepository; private LeaderboardGeneralRepository leaderboardGeneralRepository; @Autowired ScheduleUpdatingLeaderBoard(UserRepository userRepository, LeaderboardGroupRepository leaderboardGroupRepository, LeaderboardGeneralRepository leaderboardGeneralRepository) { this.userRepository = userRepository; this.leaderboardGeneralRepository = leaderboardGeneralRepository; this.leaderboardGroupRepository = leaderboardGroupRepository; } @Scheduled(fixedRate = 10000) //3600000 = 60 min // 60000 = 1 min // 10000 = 10 sec public void updateLeaderBoard() { System.out.println("updatingLeaderBoard"); List<User> users = userRepository.findAll(); List<LeaderboardGeneral> leaderBoardUsers = leaderboardGeneralRepository.findAll(); users.sort(Comparator.comparing(User::getId)); leaderBoardUsers.sort(Comparator.comparing(LeaderboardGeneral::getUserId)); for (int i = 0; i < leaderBoardUsers.size(); i++) { if (users.get(i).getId() == leaderBoardUsers.get(i).getUserId()) { if(!users.get(i).getName().equals(leaderBoardUsers.get(i).getNickname())){ leaderBoardUsers.get(i).setNickname(users.get(i).getName()); } leaderBoardUsers.get(i).setHighScore(users.get(i).getHighScore()); } else System.out.println("shit happened in ScheduleUpdatingLeaderBoard"); } leaderBoardUsers.sort(Comparator.comparing(LeaderboardGeneral::getHighScore).reversed()); for (int i = 0; i < leaderBoardUsers.size(); i++) { leaderBoardUsers.get(i).setPlace(i + 1); } leaderboardGeneralRepository.saveAll(leaderBoardUsers); System.out.println("updated"); } }
987b618c6b21c888f93df7ad636741da510b33fb
e6fbb32b551972011c6e2b64213eb5d70ec5746d
/app/src/main/java/com/example/admin/teratail/MainActivity.java
4297569412d0c0de8d8356e475ac63de8cfeb9b1
[]
no_license
abantam/teratail
8192b43bfa035ab87e22ec5bd50d2ab3b74d6430
768161404619c156525300c77b5353651e58ce3b
refs/heads/master
2020-12-24T19:28:00.321364
2016-04-26T05:37:47
2016-04-26T05:37:47
57,098,304
0
0
null
null
null
null
UTF-8
Java
false
false
5,408
java
package com.example.admin.teratail; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class MainActivity extends AppCompatActivity { /** * The {@link android.support.v4.view.PagerAdapter} that will provide * fragments for each of the sections. We use a * {@link FragmentPagerAdapter} derivative, which will keep every * loaded fragment in memory. If this becomes too memory intensive, it * may be best to switch to a * {@link android.support.v4.app.FragmentStatePagerAdapter}. */ private SectionsPagerAdapter mSectionsPagerAdapter; /** * The {@link ViewPager} that will host the section contents. */ private ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { /** * The fragment argument representing the section number for this * fragment. */ private static final String ARG_SECTION_NUMBER = "section_number"; public PlaceholderFragment() { } /** * Returns a new instance of this fragment for the given section * number. */ public static PlaceholderFragment newInstance(int sectionNumber) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); TextView textView = (TextView) rootView.findViewById(R.id.section_label); textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER))); return rootView; } } /** * A {@link FragmentPagerAdapter} that returns a fragment corresponding to * one of the sections/tabs/pages. */ public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { // getItem is called to instantiate the fragment for the given page. // Return a PlaceholderFragment (defined as a static inner class below). return PlaceholderFragment.newInstance(position + 1); } @Override public int getCount() { // Show 3 total pages. return 3; } @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: return "SECTION 1"; case 1: return "SECTION 2"; case 2: return "SECTION 3"; } return null; } } }
2eefa05bbf8b0935a4df984639525471ee676c46
808f04feb751ad8b2b2bfc1c7b9ad151e5942cae
/src/main/java/com/travelport/refimpl/air/search/models/CatalogOfferings.java
965c08975e754f10c70543a5c97a39281b64a3cc
[ "MIT" ]
permissive
Treasureworth/uapi-search-microservice
32185074142f9db5d7f263ecc5d1d97490b0e708
9874c73ebffd9654f9bd4686adb9f46a214f5d16
refs/heads/master
2023-03-19T22:16:39.504201
2018-10-26T17:32:24
2018-10-26T17:32:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,174
java
package com.travelport.refimpl.air.search.models; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "id", "Identifier", "DefaultCurrency", "CatalogOffering", "transactionId", "traceId", "Result", "NextSteps", "ReferenceList" }) public class CatalogOfferings { @JsonProperty("id") private String id; @JsonProperty("Identifier") private Identifier identifier; @JsonProperty("DefaultCurrency") private DefaultCurrency defaultCurrency; @JsonProperty("CatalogOffering") private List<CatalogOffering> catalogOffering = null; /** * No args constructor for use in serialization * */ public CatalogOfferings() { } /** * * @param id * @param defaultCurrency * @param catalogOffering * @param identifier */ public CatalogOfferings(String id, Identifier identifier, DefaultCurrency defaultCurrency, List<CatalogOffering> catalogOffering) { super(); this.id = id; this.identifier = identifier; this.defaultCurrency = defaultCurrency; this.catalogOffering = catalogOffering; } @JsonProperty("id") public String getId() { return id; } @JsonProperty("id") public void setId(String id) { this.id = id; } @JsonProperty("Identifier") public Identifier getIdentifier() { return identifier; } @JsonProperty("Identifier") public void setIdentifier(Identifier identifier) { this.identifier = identifier; } @JsonProperty("DefaultCurrency") public DefaultCurrency getDefaultCurrency() { return defaultCurrency; } @JsonProperty("DefaultCurrency") public void setDefaultCurrency(DefaultCurrency defaultCurrency) { this.defaultCurrency = defaultCurrency; } @JsonProperty("CatalogOffering") public List<CatalogOffering> getCatalogOffering() { return catalogOffering; } @JsonProperty("CatalogOffering") public void setCatalogOffering(List<CatalogOffering> catalogOffering) { this.catalogOffering = catalogOffering; } }
6832946ced5031811c314eb5d70ba2c390ba87b8
4949ba7eaf4ab877a86adceca7688222fc1f2242
/app/src/main/java/com/example/lab8/MainActivity.java
c43376b33e5092c99ba2459f22ed94d8e895ba1b
[]
no_license
Anuuuka/Google_Map
c3d2c108699126cf361b52511c9ce3b0e3ba06b4
64b474399eb30134b4af699d8b17d351fbb430ef
refs/heads/master
2022-07-21T10:26:21.000957
2020-05-17T22:56:50
2020-05-17T22:56:50
264,772,154
0
0
null
null
null
null
UTF-8
Java
false
false
3,870
java
package com.example.lab8; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.viewpager.widget.ViewPager; import com.google.android.gms.location.LocationServices; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; public class MainActivity extends AppCompatActivity implements PageFragment.OnFragmentDataListener { private ViewPager pager; private Double lat1 = 0.0; private Double lng1 = 0.0; private Double lat2 = 0.0; private Double lng2 = 0.0; private Double myPositionLat; private Double myPositionLng; private boolean flag; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getLocationPermission(); pager = findViewById(R.id.pager); pager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager())); } @Override public void onFragmentDataListener(Double lat, Double lng) { lat1 = lat; lng1 = lng; } @Override public void onFragmentDataListenr(Double lat, Double lng) { lat2 = lat; lng2 = lng; } private void getLocationPermission() { if (ContextCompat.checkSelfPermission(this.getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { flag = true; } else { ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, 1); } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { flag = false; if (requestCode == 1) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { flag = true; setGpsLocation(); } } } private void setGpsLocation() { try { if (flag) { Task<Location> locationResult = LocationServices .getFusedLocationProviderClient(this) .getLastLocation(); locationResult.addOnCompleteListener(this, new OnCompleteListener<Location>() { @Override public void onComplete(@NonNull Task<Location> task) { if (task.isSuccessful()) { myPositionLat = task.getResult().getLatitude(); myPositionLng = task.getResult().getLongitude(); } } }); } } catch (SecurityException e) { Log.e("Exception: ", e.getMessage()); } } public void onShowPathClick(View view) { if (lat1 != 0.0 && lng1 != 0.0 && lat2 != 0.0 && lng2 != 0.0) { Intent intent = new Intent(this, PathActivity.class); intent.putExtra("LAT1", lat1); intent.putExtra("LNG1", lng1); intent.putExtra("LAT2", lat2); intent.putExtra("LNG2", lng2); intent.putExtra("MY_POSITION_LAT", myPositionLat); intent.putExtra("MY_POSITION_LNG", myPositionLng); startActivity(intent); } else Toast.makeText(getApplicationContext(),"Enter some point",Toast.LENGTH_LONG).show(); } }
3ad7933aff1a7992fe297fa87e1639815e5c83db
833ac3b99364bc24a060d06921e4aaa1955b87b8
/SDK/Game/src/main/java/com/kolibree/android/app/utils/dataRecorder/DataRecorder.java
6cb022890d8bfc6404b50a12ccf40af97dc8f101
[]
no_license
TimoPtr/circleCI
379660a8194a3908573a15721a48be420e51dd98
1e89b24cd87afcf7b92fe07b11daf2fd17c5f1c6
refs/heads/main
2023-01-04T22:46:39.520511
2020-10-22T12:19:26
2020-10-22T12:19:26
306,326,008
0
0
null
2021-05-24T07:24:43
2020-10-22T12:13:41
Kotlin
UTF-8
Java
false
false
6,950
java
package com.kolibree.android.app.utils.dataRecorder; import android.os.SystemClock; import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.kolibree.sdkws.data.model.BrushPass; import com.kolibree.sdkws.data.model.BrushProcessData; import com.kolibree.sdkws.data.model.BrushZonePasses; import java.util.ArrayList; import timber.log.Timber; /** Created by mdaniel on 30/11/2015. */ // TODO refactor data recording @Keep public abstract class DataRecorder { private static final String TAG = "DataRecorder"; private int targetBrushingTime; // Current objects @VisibleForTesting BrushPass currentPass; @VisibleForTesting BrushZonePasses currentZone; @VisibleForTesting final BrushProcessData processData; @VisibleForTesting long startTimestamp; @VisibleForTesting long startPassTimestamp; @VisibleForTesting long startPauseTimestamp; // Recorders states @VisibleForTesting boolean stopped; @VisibleForTesting boolean paused; @VisibleForTesting boolean wasInCorrectPosition = true; @VisibleForTesting long orientationGoodDurationMillis = 0; /** * ******************************************************************************************* * DATARECORDER - Constructor and abstract methods * ******************************************************************************************** */ DataRecorder(int targetBrushingTime) { this.targetBrushingTime = targetBrushingTime; processData = new BrushProcessData(); } public BrushProcessData getProcessData() { return processData; } abstract int expectedTimeForZone(int zoneId, long goal); @NonNull protected abstract String[] zoneNames(); @VisibleForTesting String safeZoneName(int zoneId) { if (zoneId < 0 || zoneId >= getZoneCount()) { return zoneNames()[0]; } return zoneNames()[zoneId]; } /* * ******************************************************************************************* * DATARECORDER - Events methods * ******************************************************************************************** */ /** * Start recording data. * * <p>At t0, it considers that the user is at the first zone */ public void start() { if (stopped) { return; } // Fix : server does not accept missing zone in json anymore createEmptyBrushingPassForEachZone(); setInitialState(); changeToInitialZone(); createPass(); } @VisibleForTesting void changeToInitialZone() { int initialPrescribedZone = 0; changeZone(initialPrescribedZone); } @VisibleForTesting void setInitialState() { startTimestamp = elapsedRealTimeMillis(); orientationGoodDurationMillis = 0; } @VisibleForTesting void createEmptyBrushingPassForEachZone() { for (int i = 0, size = getZoneCount() - 1; i <= size; i++) { processData.addZonePass( new BrushZonePasses( safeZoneName(i), new ArrayList<>(), expectedTimeForZone(i, targetBrushingTime))); } } public void resume() { incrementReferenceTimestampsAfterPause(); paused = false; } private void incrementReferenceTimestampsAfterPause() { long pauseDuration = elapsedRealTimeMillis() - startPauseTimestamp; startTimestamp += pauseDuration; startPassTimestamp += pauseDuration; } public void stop() { if (stopped) { return; } if (paused) { resume(); } stopped = true; closePass(); } public void pause() { startPauseTimestamp = elapsedRealTimeMillis(); paused = true; } public int getBrushTime() { return (int) ((elapsedRealTimeMillis() - startTimestamp) / 100); } public void toothbrushPositionDidChange(boolean correctPosition) { if (stopped) { return; } if (wasInCorrectPosition) { if (!correctPosition) { closePass(); } } else { // Was in wrong position if (correctPosition) { createPass(); } } wasInCorrectPosition = correctPosition; } /** * Notifies us that the prescribed zone has changed, as well as if the user is in the correct * position * * @param newPrescribedOneIndexedZoneId 1-indexed zoneId. Coach/Pirate zones start at index 1 * because index 0 is None * @param hasCorrectBrushingPosition is user currently in the correct position */ public void prescribedZoneDidChange( int newPrescribedOneIndexedZoneId, boolean hasCorrectBrushingPosition) { if (wasInCorrectPosition) { closePass(); } int zeroIndexZoneId = newPrescribedOneIndexedZoneId - 1; changeZone(zeroIndexZoneId); wasInCorrectPosition = hasCorrectBrushingPosition; if (hasCorrectBrushingPosition) { createPass(); } } @VisibleForTesting void changeZone(int newPrescribedZoneId) { if (processData.containsBrushZone(safeZoneName(newPrescribedZoneId))) { // get existing zone already in processData currentZone = processData.getZonePass(safeZoneName(newPrescribedZoneId)); } else { // create a new zone and add to processData createZone(newPrescribedZoneId); } } @VisibleForTesting void createZone(int newPrescribedZoneId) { BrushZonePasses newZone = new BrushZonePasses( safeZoneName(newPrescribedZoneId), new ArrayList<>(), expectedTimeForZone(newPrescribedZoneId, targetBrushingTime)); processData.addZonePass(newZone); currentZone = newZone; } @VisibleForTesting void createPass() { BrushPass newPass = new BrushPass(0, 0); newPass.setPass_datetime(getBrushTime()); currentPass = newPass; startPassTimestamp = elapsedRealTimeMillis(); } @VisibleForTesting void closePass() { if (currentPass != null) { currentPass.setPass_effective_time( (int) ((elapsedRealTimeMillis() - startPassTimestamp) / 100)); /* Fixing https://jira.kolibree.com/browse/KLTB002-1250 The cause of the problem is still unknown, this will prevent the bug from occurring, but doesn't fix the source of the issue: when pausing the game in the first level, it records passes with a negative effective time value. Can be reproduced 1 / 20 times, adds 'grey' zones to the checkup */ if (currentZone != null && currentPass.getPass_effective_time() > 0) { currentZone.addPass(currentPass); } currentPass = null; orientationGoodDurationMillis += elapsedRealTimeMillis() - startPassTimestamp; } else { Timber.e("Can't close Pass : current pass null"); } } @VisibleForTesting long elapsedRealTimeMillis() { return SystemClock.elapsedRealtime(); } public int getZoneCount() { return zoneNames().length; } public long getGoodOrientationTimeMillis() { return orientationGoodDurationMillis; } }
1538f9d742d0f055de9a8099ae84031dde3ad00e
c299f7ffc5e4cd4c962ed4924bca7ebfac823d02
/app/src/main/java/fr/wildcodeschool/activityresult/MainActivity.java
b551344b64bcb97dad774b836f3674c915f740d3
[]
no_license
Matharea/ParentActivity
b4ab5c1da4acfdfc4127ddef631230d08ae8e66d
fe799a667f0b2c880c1ed82989aafe9a87fc8bc6
refs/heads/master
2020-04-11T21:28:22.998469
2018-12-17T09:37:30
2018-12-17T09:37:30
162,106,750
0
0
null
null
null
null
UTF-8
Java
false
false
1,459
java
package fr.wildcodeschool.activityresult; import android.app.Activity; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import org.w3c.dom.Text; public class MainActivity extends AppCompatActivity { static final int PICK_CONTACT_REQUEST = 2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(MainActivity.this, TabActivity.class); startActivityForResult(i, PICK_CONTACT_REQUEST); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PICK_CONTACT_REQUEST) { if (resultCode == Activity.RESULT_OK){ TextView view = findViewById(R.id.textView); int result = data.getIntExtra("result", 0); view.setText(getString(R.string.result, result)); } if (resultCode == Activity.RESULT_CANCELED) { // Write your code if there's no result } } } }
883d9e0ff5106b02df9a6f61a9edd406da4a2429
b56a1be22a92195cabe8d6dae356da7941cbe4e2
/app/src/main/java/com/example/lotrcharacters/ui/MainActivity.java
16f5703d1bb31c1d4d95a717bfde1fbcec48666c
[ "MIT" ]
permissive
Michael-Mbaya/The-One-to-Rule-them-All
b180c98bccf9aed7ee5b3c6e527946d91a68783c
6c49ab94f80bb997f875469f955994b8786b5907
refs/heads/master
2023-01-03T14:50:12.558818
2020-11-01T22:05:20
2020-11-01T22:05:20
305,106,749
0
1
MIT
2020-10-29T19:54:54
2020-10-18T13:22:17
Java
UTF-8
Java
false
false
3,557
java
package com.example.lotrcharacters.ui; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.Button; import com.example.lotrcharacters.R; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import butterknife.BindView; import butterknife.ButterKnife; public class MainActivity extends AppCompatActivity implements View.OnClickListener { public static final String TAG = MainActivity.class.getSimpleName(); private FirebaseAuth mAuth; private FirebaseAuth.AuthStateListener mAuthListener; @BindView(R.id.nextActButton) Button mNextActivity; @BindView(R.id.savedButton) Button msaved; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); mAuth = FirebaseAuth.getInstance(); mAuthListener = new FirebaseAuth.AuthStateListener(){ @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth){ FirebaseUser user = firebaseAuth.getCurrentUser(); if(user != null){ getSupportActionBar().setTitle("Welcome, " + user.getDisplayName() + "!"); }else { } } }; mNextActivity.setOnClickListener(this); msaved.setOnClickListener(this); //data persistence next up // mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); // mEditor = mSharedPreferences.edit(); } @Override public void onClick (View v){ if (v == mNextActivity) { Intent intent = new Intent(MainActivity.this, CharactersListActivity.class); startActivity(intent); // Toast.makeText(MainActivity.this, "Welcome!!!", Toast.LENGTH_LONG).show(); } // if(v==msaved){ Intent savedIntent = new Intent(MainActivity.this, SavedListActivity.class); startActivity(savedIntent); } } //inflate menu @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_main, menu); return super.onCreateOptionsMenu(menu); } //on log-out option select @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_logout) { logout(); return true; } return super.onOptionsItemSelected(item); } //firebase logout private void logout() { FirebaseAuth.getInstance().signOut(); //return to login after log out of session Intent intent = new Intent(MainActivity.this, LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); finish(); } //AuthStateListener start @Override public void onStart(){ super.onStart(); mAuth.addAuthStateListener(mAuthListener); } //AuthStateListener end @Override public void onStop(){ super.onStop(); mAuth.removeAuthStateListener(mAuthListener); } }
42371f0db00c5c5f39f712b616b320e64eae3702
b0da8cff44651f742ceaf5ea8424a6f8dc286528
/src/main/java/ru/netology/domain/ViewsInfo.java
1a74985b7022b8e6f683865d3bbb6b6e4e053de5
[]
no_license
EvgeniyaSelivanova/9_JAVA_HomeWork_9.1
52f83a4188e91e0eeebcdf01d7c8589b8a87b6aa
79821d0fd5945ce01df9aaf5221ee189c0781437
refs/heads/master
2023-03-11T17:23:16.423915
2021-02-02T09:57:41
2021-02-02T09:57:41
334,619,294
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
package ru.netology.domain; public class ViewsInfo { private int count; /*число просмотров записи*/ }
5f2f52ce47d24abb3f40638330199a290b4ac508
305073cf8e8455bd4f251840c9449ccf678bfc02
/src/main/java/io/netty/buffer/api/memseg/NativeMemorySegmentManager.java
a240335c7679bb5a423cd9264682050a8b459517
[]
no_license
isabella232/netty-incubator-buffer-api
dc5d02b9dcef9880c26f3ca8ee9905264e034de2
0272b1cf84cc3aecf23fa1827b965666689acf40
refs/heads/main
2023-03-18T19:50:30.453473
2021-03-16T20:27:46
2021-03-16T20:27:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,576
java
/* * Copyright 2020 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.buffer.api.memseg; import jdk.incubator.foreign.MemorySegment; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.LongAdder; public class NativeMemorySegmentManager extends AbstractMemorySegmentManager { public static final LongAdder MEM_USAGE_NATIVE = new LongAdder(); private static final ConcurrentHashMap<Long, Runnable> CLEANUP_ACTIONS = new ConcurrentHashMap<>(); static Runnable getCleanupAction(long size) { return CLEANUP_ACTIONS.computeIfAbsent(size, s -> () -> MEM_USAGE_NATIVE.add(-s)); } @Override public boolean isNative() { return true; } @Override protected MemorySegment createSegment(long size) { var segment = MemorySegment.allocateNative(size); // .withCleanupAction(Statics.getCleanupAction(size)); MEM_USAGE_NATIVE.add(size); return segment; } }
754e0065a80eb317fd414ea3e9962b0ce039a9e2
d2827000640665196798d53ea033029ccd29af0b
/common/src/main/java/edu/njnu/opengms/common/domain/container/data/support/OgcService.java
b7e1030be9877d898add82fc21f73d46284e294a
[]
no_license
sunlingzhiliber/container_and_reproducibility
adac703505f44d67d7c40b7020c3fefe73f70cfd
10c40b3ac85315d2ef5606b11761104bb9a09158
refs/heads/master
2022-10-17T15:37:55.450169
2020-06-10T11:21:56
2020-06-10T11:21:56
263,563,804
0
0
null
null
null
null
UTF-8
Java
false
false
248
java
package edu.njnu.opengms.common.domain.container.data.support; /** * @InterfaceName OgcService * @Description ass we see * @Author sun_liber * @Date 2020/3/17 * @Version 1.0.0 */ public interface OgcService { String GetCapabilities(); }
1348b354af36d1d8036a69ea83b57331f043ad2c
537b3a622f307ff8f5d32c92e02c0ffca721b1be
/mytest/src/main/java/headfirst/designPatterns/proxy/gumball/WinnerState.java
d15ac2e5bfe3a4b88b2c2da5ee0014d2e55f067d
[]
no_license
hotinh/mygit
b01cb92efcd6e037acf897db6ed73bba01ad5a0a
54d6a8c5ed8f66afbb97baf482dcbc6982d91b9b
refs/heads/master
2021-07-12T03:05:57.519248
2019-01-26T13:41:43
2019-01-26T13:41:43
104,535,060
0
0
null
null
null
null
UTF-8
Java
false
false
1,262
java
package headfirst.designPatterns.proxy.gumball; public class WinnerState implements State { transient GumballMachine gumballMachine; public WinnerState(GumballMachine gumballMachine) { this.gumballMachine = gumballMachine; } public void insertQuarter() { System.out.println("Please wait, we're already giving you a Gumball"); } public void ejectQuarter() { System.out.println("Please wait, we're already giving you a Gumball"); } public void turnCrank() { System.out.println("Turning again doesn't get you another gumball!"); } public void dispense() { System.out.println("YOU'RE A WINNER! You get two gumballs for your quarter"); gumballMachine.releaseBall(); if (gumballMachine.getCount() == 0) { gumballMachine.setState(gumballMachine.getSoldOutState()); } else { gumballMachine.releaseBall(); if (gumballMachine.getCount() > 0) { gumballMachine.setState(gumballMachine.getNoQuarterState()); } else { System.out.println("Oops, out of gumballs!"); gumballMachine.setState(gumballMachine.getSoldOutState()); } } } public String toString() { return "despensing two gumballs for your quarter, because YOU'RE A WINNER!"; } }
074e41b4f3bb88e08d1a68bad14571c3932e499f
9977104575ff9fdd00f50059dbb6d40d71a86dfc
/final/final/app/src/main/java/com/example/afinal/loginActivity.java
a7b0654f40b2819464ba70bd8c0db39c015e43f5
[]
no_license
lhd-Sakura/AndroidProject
ae56cba8df5a8f35bd4d2615565419f571202f49
a39e3851e657e1b7a7d47caa235e7537728b4f84
refs/heads/master
2022-12-24T03:59:10.070567
2020-10-06T03:27:40
2020-10-06T03:27:40
301,602,781
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
package com.example.afinal; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.content.Intent; public class loginActivity extends AppCompatActivity { Button bt1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); bt1 = (Button) findViewById(R.id.button); bt1.setOnClickListener(listener); } Button.OnClickListener listener = new Button.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(loginActivity.this,tableActivity.class); startActivity(intent); } }; }
f7bc80704c4c53110f5f73d9023afbcba84fa826
3dfd8cab46104449ba3aaa80674663bc0ba4b78f
/pku/3257.java
61ea080236d1a29b08044cdba5992141021adf0d
[]
no_license
chronotable/procon
a449ed506be2d041c26a828e67ce47615c9152f1
8b4c79d91bfb05f6f57114e5e3fe53e2d7394a76
refs/heads/master
2021-01-17T10:05:36.360756
2019-03-17T02:45:55
2019-03-17T02:45:55
21,483,371
0
0
null
null
null
null
UTF-8
Java
false
false
1,743
java
import java.util.*; import static java.lang.Math.*; public class Main{ public static void main(String[] args){ new Main().run(); } void run(){ Scanner sc = new Scanner(System.in); int L = sc.nextInt(); int N = sc.nextInt(); int B = sc.nextInt(); int[][] dp = new int[L+1][B+1]; ArrayList<Dest>[] next = new ArrayList[L+1]; for(int i = 0; i <= L; i++)next[i] = new ArrayList<Dest>(); for(int i = 0; i < N; i++){ int x = sc.nextInt(); int w = sc.nextInt(); int f = sc.nextInt(); int c = sc.nextInt(); next[x].add(new Dest(x+w, f, c)); } Queue<V> q = new LinkedList<V>(); q.offer(new V(0, 0, 0)); while(!q.isEmpty()){ V v = q.poll(); if(dp[v.cur][v.cost] > v.fun)continue; for(int i = 0; i < next[v.cur].size(); i++){ Dest d = next[v.cur].get(i); if(d.c + v.cost <= B && dp[d.d][d.c + v.cost] < v.fun + d.f){ dp[d.d][d.c + v.cost] = v.fun + d.f; q.offer(new V(d.d, v.fun + d.f, d.c + v.cost)); } } } int ans = 0; for(int i = 0; i <= B; i++)ans = max(ans, dp[L][i]); System.out.println(ans == 0 ? -1 : ans); } class Dest{ int d, f, c; Dest(int _d, int _f, int _c){ d = _d; f = _f; c = _c; } } class V{ int cur, fun, cost; V(int a, int b, int c){ cur = a; fun = b; cost = c; } } }
[ "hoge@hoge" ]
hoge@hoge
7b90ffee19b1d55c62e7f39b7b96c384fb92fd5b
ed5159d056e98d6715357d0d14a9b3f20b764f89
/test/irvine/oeis/a302/A302650Test.java
dae9e7d328bdc8b0a53b42c25ae2fefbe45a1683
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package irvine.oeis.a302; import irvine.oeis.AbstractSequenceTest; /** * Tests the corresponding class. * @author Sean A. Irvine */ public class A302650Test extends AbstractSequenceTest { }
d061d0b20cb10f0e69e4cfff1ab2db7d7ada3a4d
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/test/java/org/gradle/test/performancenull_280/Testnull_27942.java
853be458402ee8641e4046f31eeccf8f11b858c8
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
308
java
package org.gradle.test.performancenull_280; import static org.junit.Assert.*; public class Testnull_27942 { private final Productionnull_27942 production = new Productionnull_27942("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
592872e96d88ac38d99efd08a0b0d5449bdf7fae
b56f5a7185db647c625b50187634a66b351d34a6
/src/main/java/com/zarddy/studyspringboot/config/FastJsonConfiguration.java
ac91b08be2b41ffb20618b4bfede727dbd13db11
[]
no_license
Zarddy/StudySpringboot
a17cc79584c062c0b40fd3d5c509235badef1ed7
842f66816933515c7434d919644923c3e96fc76b
refs/heads/master
2020-03-22T06:05:35.053022
2018-08-07T16:11:25
2018-08-07T16:11:25
139,611,214
0
0
null
null
null
null
UTF-8
Java
false
false
2,158
java
package com.zarddy.studyspringboot.config; import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.support.config.FastJsonConfig; import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.util.List; /** * SpringBoot将自动加载类内的配置 * SpringBoot2.0开始,WebMvcConfigurerAdapter已设为过期 * 关于过期,可参考https://blog.csdn.net/qq_35299712/article/details/80061532 * TODO 设想是当值为null时,输出为""(空字符串),为实现 */ @Configuration public class FastJsonConfiguration implements WebMvcConfigurer { /** * 修改自定义消息转换器 * @param converters 消息转换器列表 */ @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { // 创建fastjson消息转换器 FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter(); // 创建配置器 FastJsonConfig config = new FastJsonConfig(); // 修改配置返回内容的过滤 config.setSerializerFeatures( SerializerFeature.DisableCircularReferenceDetect, // 消除对同一对象循环引用的问题,默认为false,不配置有可能进入死循环 SerializerFeature.WriteMapNullValue, // 是否输出值为null的字段,默认为false SerializerFeature.WriteNullBooleanAsFalse, // Boolean字段如果为null时,输出为false,而非null SerializerFeature.WriteNullListAsEmpty, // List字段为null时,输出[],而非null SerializerFeature.WriteNullStringAsEmpty // 字符串类型字段如果为null,则输出为"",而非null ); fastJsonHttpMessageConverter.setFastJsonConfig(config); // 将fastjson添加到视图消息转换器列表内 converters.add(fastJsonHttpMessageConverter); } }
f65c2c008bc269c6e2c869b1a80c10bc6481e496
2004b2c51b8ccc4dc5c5740db756be00b6a725f4
/seage-problems/discrete/qap/src/main/java/org/seage/problem/qap/particles/QapParticleSwarmFactory.java
7199475b40e725a2cd20106571d52276add278a8
[]
no_license
zmatlja1/seage
5d3474c36aabef13e90fccfe8823f72c04146096
e531e30b0c22d0c9de1573ffda82a2432a98e527
refs/heads/master
2021-01-16T19:39:13.352762
2012-05-14T20:29:24
2012-05-14T20:29:24
3,441,953
1
0
null
null
null
null
UTF-8
Java
false
false
5,020
java
/******************************************************************************* * Copyright (c) 2009 Richard Malek and SEAGE contributors * This file is part of SEAGE. * SEAGE 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. * SEAGE 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 SEAGE. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * Karel Durkota * - Initial implementation * Richard Malek * - Added algorithm annotations */ package org.seage.problem.qap.particles; import org.seage.aal.Annotations; import org.seage.aal.algorithm.IAlgorithmAdapter; import org.seage.aal.algorithm.IAlgorithmFactory; import org.seage.aal.data.ProblemInstanceInfo; import org.seage.aal.algorithm.particles.ParticleSwarmAdapter; import org.seage.aal.data.ProblemConfig; import org.seage.data.DataNode; import org.seage.metaheuristic.particles.Particle; import org.seage.problem.qap.QapProblemInstance; /** * * @author Karel Durkota */ @Annotations.AlgorithmId("ParticleSwarm") @Annotations.AlgorithmName("Particle Swarm") public class QapParticleSwarmFactory implements IAlgorithmFactory { //private Double[][][] _facilityLocation; private int _numParticles; private QapObjectiveFunction _objectiveFunction; public Class getAlgorithmClass() { return ParticleSwarmAdapter.class; } public IAlgorithmAdapter createAlgorithm(ProblemInstanceInfo instance, ProblemConfig config) throws Exception { throw new UnsupportedOperationException(); } public IAlgorithmAdapter createAlgorithm2(ProblemInstanceInfo instance, DataNode config) throws Exception { IAlgorithmAdapter algorithm; final Double[][][] facilityLocation = ((QapProblemInstance)instance).getFacilityLocation(); _objectiveFunction = new QapObjectiveFunction(facilityLocation); algorithm = new ParticleSwarmAdapter( generateInitialSolutions(facilityLocation.length), _objectiveFunction, false, "") { public void solutionsFromPhenotype(Object[][] source) throws Exception { _numParticles = source.length; _initialParticles = generateInitialSolutions(facilityLocation.length); for(int i = 0; i < source.length; i++) { Integer[] tour = ((QapParticle)_initialParticles[i]).getAssign(); for(int j = 0; j < source[i].length; j++) { tour[j] = (Integer)source[i][j]; } } } public Object[][] solutionsToPhenotype() throws Exception { int numOfParticles = _particleSwarm.getParticles().length; Object[][] source = new Object[ numOfParticles ][ facilityLocation.length ]; for(int i = 0; i < source.length; i++) { source[i] = new Integer[ facilityLocation.length ]; Integer[] tour = ((QapParticle)_particleSwarm.getParticles()[i]).getAssign(); for(int j = 0; j < source[i].length; j++) { source[i][j] = tour[j]; } } // TODO: A - need to sort source by fitness function of each tour return source; } }; return algorithm; } private Particle[] generateInitialSolutions(int length) throws Exception { Particle[] particles = generateQapRandomParticles( _numParticles, length ); for(Particle particle : particles) { // Initial coords for(int i = 0; i < length; i++) particle.getCoords()[i] = Math.random(); // Initial velocity for(int i = 0; i < length; i++) particle.getVelocity()[i] = Math.random(); // Evaluate _objectiveFunction.setObjectiveValue( particle ); } return particles; } // void printArray(Integer[] array) // { // for(int i = 0; i< array.length; i++) // System.out.print(" " + array[i]); // } private Particle[] generateQapRandomParticles(int count, int length) { QapRandomParticle[] particles = new QapRandomParticle[count]; for(int i = 0; i < count; i++) particles[i] = new QapRandomParticle( length ); return particles; } }
b353c02fe5a7e8a7931fbf04bb950922c9314dca
d669a304a4a187679f92e77573d2013f9247f4ea
/src/com/eastarjet/crs/proxy/skyport/handler/OverrideConfirmHandler.java
660ff19a7f98dbe780c733d491b4d7d8cb295f2a
[]
no_license
choijeeho/ejproxy
69947a7626b739267a45bc4ad2621d20f5909dbd
bfe06e238c06a26a55e36e57a3ae8ffa5b8e8d38
refs/heads/master
2020-04-10T03:40:08.878749
2018-12-07T06:00:00
2018-12-07T06:00:00
160,774,660
0
0
null
null
null
null
UTF-8
Java
false
false
1,442
java
package com.eastarjet.crs.proxy.skyport.handler; import java.util.Iterator; import java.util.List; import com.eastarjet.crs.proxy.skyport.bean.WatchPerson; import com.eastarjet.net.service.terminal.view.Request; import com.eastarjet.net.service.terminal.view.Response; import com.eastarjet.net.service.terminal.view.Session; import com.eastarjet.net.service.terminal.view.handler.AbstractHandler; import com.eastarjet.net.service.terminal.view.handler.ReadLineHandler; import com.eastarjet.util.Toolkit; import com.eastarjet.util.log.Logger; public class OverrideConfirmHandler extends ReadLineHandler { static Logger log = Toolkit.getLogger(OverrideConfirmHandler.class); public OverrideConfirmHandler(){ setInputBuffring(true);} @Override public boolean handleReadLine(int target, Session session, Request request, Response response,String line) { if(log.isInfoEnabled()) log.info("OverrideConfirmHandler : "+line); // TODO Auto-generated method stub Response sresp=session.getResponse(Session.OUTPUT); if("y".equals(line)|| "Y".equals(line)) { String cmd=(String)session.getAttribute(SessionKey.LAST_CHECKIN_COMMAND); if(log.isInfoEnabled()) log.info("OverrideConfirmHandler : cmd="+cmd); if(cmd==null) return false; byte [] tbuf=cmd.getBytes(); sresp.write(tbuf,0,tbuf.length); //setNextView("checkIn"); } sresp.writeByte('\r'); sresp.writeByte('\n'); sresp.flush(); return false; } }
dd4647243cdc07c42690399e6b9e28cc52dcf412
d7973c00573c8d08c1ae46dd6419bdfff6beb2b6
/sample-ecsite/src/com/internousdev/sampleecsite/action/CreateDestinationCompleteAction.java
f9e326d1e9738b459a22c8894d2885d346f62516
[]
no_license
ohashi0904/sampleecsite
8d9378a93b2c9b2f39f07c7ecff7561641dd5b28
b769fe38b7dc69e7966fa7a6370f72d9bb72dc15
refs/heads/master
2020-03-24T20:38:05.085650
2018-07-31T09:02:54
2018-07-31T09:02:54
142,988,729
0
0
null
null
null
null
UTF-8
Java
false
false
2,571
java
package com.internousdev.sampleecsite.action; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.struts2.interceptor.SessionAware; import com.internousdev.sampleecsite.dao.DestinationInfoDAO; import com.opensymphony.xwork2.ActionSupport; public class CreateDestinationCompleteAction extends ActionSupport implements SessionAware{ private String familyName; private String firstName; private String familyNameKana; private String firstNameKana; private String sex; private List<String> sexList = new ArrayList<String>(); private String email; private String telNumber; private String userAddress; private String categoryId; private Map<String, Object> session; public String execute(){ String result = ERROR; DestinationInfoDAO destinationInfoDAO = new DestinationInfoDAO(); int count = destinationInfoDAO.insert(String.valueOf(session.get("loginId")), familyName, firstName, familyNameKana, firstNameKana, email, telNumber, userAddress); if(count > 0){ result = SUCCESS; } return result; } public String getSex(){ return sex; } public void setSex(String sex){ this.sex = sex; } public List<String> getSexList(){ return sexList; } public void setSexList(List<String> sexList){ this.sexList = sexList; } public String getCategoryId(){ return categoryId; } public void setCategoryId(String categoryId){ this.categoryId = categoryId; } public String getFamilyName(){ return familyName; } public void setFamilyName(String familyName){ this.familyName = familyName; } public String getFirstName(){ return firstName; } public void setFirstName(String firstName){ this.firstName = firstName; } public String getFamilyNameKana(){ return familyNameKana; } public void setFamilyNameKana(String familyNameKana){ this.familyNameKana = familyNameKana; } public String getFirstNameKana(){ return firstNameKana; } public void setFirstNameKana(String firstNameKana){ this.firstNameKana = firstNameKana; } public String getEmail(){ return email; } public void setEmail(String email){ this.email = email; } public String getTelNumber(){ return telNumber; } public void setTelNumber(String telNumber){ this.telNumber = telNumber; } public String getUserAddress(){ return userAddress; } public void setUserAddress(String userAddress){ this.userAddress = userAddress; } public Map<String, Object> getSession(){ return session; } public void setSession(Map<String, Object> session){ this.session = session; } }
708a5e204ce6b0762f10369c00e1d8b03cb3535a
e9f31c3f90dea60f678a57433dcf8c3e6512a9f4
/src/com/java/project/SmallGadget.java
f272ec3b38b161b07ab6f697912e0326f8124862
[]
no_license
dvobro18/Java-Final-Project
5d1bf33989b3fbb3a11ee1723c466ca5c7924852
34a4b799eeaa42ad3799d699f20dda16b36c9d01
refs/heads/master
2020-04-10T18:43:25.366954
2018-12-21T20:36:50
2018-12-21T20:36:50
161,210,496
0
0
null
null
null
null
UTF-8
Java
false
false
894
java
package com.java.project; import java.util.ArrayList; import java.util.Collection; import java.util.List; public class SmallGadget extends Gadget { public SmallGadget() { this(SurfaceColor.PAINTED); } public SmallGadget(SurfaceColor color) { super(color); this.serialNumber = SerialNumber.getInstance() .getNextSerial(SerialNumber.ProductType.SmallGadget); } public List<WidgetInterface> getWidgets(SurfaceColor color) { List<WidgetInterface> myList = new ArrayList<>(); myList.add(new MediumWidget(color)); myList.add(new SmallWidget(color)); return myList; } @Override public int getSwitches() { return 1; } @Override public int getButtons() { return 2; } @Override public int getLights() { return 0; } @Override public String getPowerSource() { return "Battery Power"; } @Override public float getPrice() { return 19.99F; } }
e2ada69813cbe676e4d1b7e71432b84fd39d0f2a
78bf6878d2474f8d3f1ff4899b57aabc26c9c746
/src/main/java/com/slaand/site/patterns/state/DeliveredOrder.java
5af2dd124197fd3b1c4ce54e39a4d1450d69d2e9
[]
no_license
Slaand/accn-java-site
4d277e8f51f7de020c3162b61b63d83218a91bde
80652bfb01d7e60d50ed158b7fecd16b2b28ad68
refs/heads/master
2023-03-29T01:48:06.315756
2020-09-29T07:19:39
2020-09-29T07:19:39
260,308,405
0
0
null
2021-03-31T22:18:52
2020-04-30T20:11:19
Java
UTF-8
Java
false
false
909
java
package com.slaand.site.patterns.state; import com.slaand.site.model.entity.OrderEntity; import com.slaand.site.model.enumerated.OrderStatus; import lombok.extern.slf4j.Slf4j; import javax.persistence.Embeddable; @Slf4j @Embeddable public class DeliveredOrder extends Status { public DeliveredOrder() { status = OrderStatus.DELIVERED.name(); } @Override public void onEnterState(final OrderEntity order) { log.info("===== ORDER =================" + "\nTitle: Order status change" + "\nHello, " + order.getUserId().getName() + "\nYour item's " + order.getId() + " status was changed to " + OrderStatus.DELIVERED + "\nWith best wishes, " + "Your mega ultra shop" ); } @Override public void observe() { log.info("Current status: " + OrderStatus.DELIVERED); } }
0311073b5cafef601965a9038ecbff17ee862a4b
719f02c895ac4afd1e79c0d5992f56d0c66108bf
/src/main/java/br/com/ll/ecommerce/model/BandeiraCartao.java
8d3182bf46564da06ce39d47147c49263f54f085
[]
no_license
luangrasser/e-commerce
8bc36c450db02a4aaae19dc0e08f3a2844f9b409
29a017a0b0d11be8cd2da76fb5fb7225d31491c6
refs/heads/master
2022-10-30T15:31:14.438343
2020-06-23T00:02:08
2020-06-23T00:02:08
269,219,086
1
0
null
null
null
null
UTF-8
Java
false
false
421
java
package br.com.ll.ecommerce.model; import lombok.Getter; @Getter public enum BandeiraCartao { VISA("Visa"), MASTERCARD("Mastercard"), ELO("Elo"), AMERICAN_EXPRESS("American Express"), HIPERCARD("Hipercard"), HIPER("Hiper"), DINNERS_CLUB("Dinners Club"), CABAL("Cabal"); private String descricao; BandeiraCartao(String descricao) { this.descricao = descricao; } }
821791b2d32d605dc4bd24ded68720f38cad2342
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/18/18_0ddfec66802629ffb83521a24afda23fdcf552f6/SimplePathEdge/18_0ddfec66802629ffb83521a24afda23fdcf552f6_SimplePathEdge_s.java
e67cbe98e6429daa227e7457696990e8989c187a
[]
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
16,999
java
package org.opentrackingtools.graph.paths.edges.impl; import gov.sandia.cognition.math.LogMath; import gov.sandia.cognition.math.matrix.Matrix; import gov.sandia.cognition.math.matrix.Vector; import gov.sandia.cognition.statistics.distribution.MultivariateGaussian; import gov.sandia.cognition.statistics.distribution.UnivariateGaussian; import org.opentrackingtools.GpsObservation; import org.opentrackingtools.graph.InferenceGraph; import org.opentrackingtools.graph.edges.InferredEdge; import org.opentrackingtools.graph.edges.impl.SimpleInferredEdge; import org.opentrackingtools.graph.paths.InferredPath; import org.opentrackingtools.graph.paths.edges.PathEdge; import org.opentrackingtools.graph.paths.states.PathStateBelief; import org.opentrackingtools.graph.paths.states.impl.SimplePathStateBelief; import org.opentrackingtools.impl.VehicleState; import org.opentrackingtools.statistics.filters.vehicles.road.impl.AbstractRoadTrackingFilter; import org.opentrackingtools.statistics.impl.StatisticsUtil; import com.google.common.base.Preconditions; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Iterables; import com.google.common.collect.Ordering; import com.vividsolutions.jts.geom.Geometry; public class SimplePathEdge implements PathEdge { private final InferredEdge edge; private final Double distToStartOfEdge; private final Boolean isBackward; private static SimplePathEdge emptyPathEdge = new SimplePathEdge( SimpleInferredEdge.getEmptyEdge()); private SimplePathEdge(InferredEdge edge) { this.edge = edge; this.distToStartOfEdge = null; this.isBackward = null; } private SimplePathEdge(InferredEdge edge, double distToStartOfEdge, Boolean isBackward) { Preconditions.checkArgument(!edge.isNullEdge()); Preconditions.checkState(!isBackward || distToStartOfEdge <= 0d); this.edge = edge; this.distToStartOfEdge = distToStartOfEdge; this.isBackward = isBackward; } @Override public int compareTo(PathEdge o) { return ComparisonChain .start() .compare(this.edge, o.getInferredEdge()) .compare(this.distToStartOfEdge, o.getDistToStartOfEdge(), Ordering.natural().nullsLast()).result(); } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#getPredictiveLikelihoodResults(org.opentrackingtools.graph.paths.impl.InferredPath, org.opentrackingtools.impl.VehicleState, org.opentrackingtools.graph.paths.states.impl.PathStateBelief, org.opentrackingtools.impl.Observation) */ @Override public EdgePredictiveResults getPredictiveLikelihoodResults(InferredPath path, VehicleState state, PathStateBelief beliefPrediction, GpsObservation obs) { final PathStateBelief locationPrediction; /* * Edge marginal predictive likelihoods. * Note: doesn't apply to free-movement, defaults to 0. */ final double edgePredMarginalLogLik; if (edge.isNullEdge()) { edgePredMarginalLogLik = 0d; locationPrediction = beliefPrediction; } else { MultivariateGaussian edgePrediction = this.getPriorPredictive(beliefPrediction, obs); edgePredMarginalLogLik = this.marginalPredictiveLogLikelihood( state, path, beliefPrediction.getRawStateBelief()); locationPrediction = SimplePathEdge.getPathStateBelief(path, edgePrediction); } final double measurementPredLik; final double edgePredTransLogLik; if (locationPrediction != null) { measurementPredLik = locationPrediction.priorPredictiveLogLikelihood( obs.getProjectedPoint(), state.getMovementFilter()); edgePredTransLogLik = state.getEdgeTransitionDist() .logEvaluate( state.getBelief().getEdge() .getInferredEdge(), locationPrediction.getEdge() .getInferredEdge()); } else { edgePredTransLogLik = Double.NaN; measurementPredLik = Double.NaN; } return new EdgePredictiveResults(beliefPrediction, locationPrediction, edgePredMarginalLogLik, edgePredTransLogLik, measurementPredLik); } private static PathStateBelief getPathStateBelief( InferredPath path, MultivariateGaussian edgePrediction) { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#marginalPredictiveLogLikelihood(org.opentrackingtools.impl.VehicleState, org.opentrackingtools.graph.paths.impl.InferredPath, gov.sandia.cognition.statistics.distribution.MultivariateGaussian) */ @Override public double marginalPredictiveLogLikelihood( VehicleState state, InferredPath path, MultivariateGaussian beliefPrediction) { Preconditions.checkArgument(!this.isNullEdge()); Preconditions.checkArgument(beliefPrediction .getInputDimensionality() == 2); return marginalPredictiveLogLikInternal(path, beliefPrediction); } /** * Truncated normal mixing component. * * @param beliefPrediction * @return */ private double marginalPredictiveLogLikInternal( InferredPath path, MultivariateGaussian beliefPrediction) { final double direction = this.isBackward() ? -1d : 1d; final double thisStartDistance = Math.abs(this.getDistToStartOfEdge()); final double thisEndDistance = edge.getLength() + thisStartDistance; final Matrix Or = AbstractRoadTrackingFilter.getOr(); final double var = Or.times(beliefPrediction.getCovariance()) .times(Or.transpose()).getElement(0, 0); final double mean = direction * Or.times(beliefPrediction.getMean()).getElement(0); final double t1 = UnivariateGaussian.CDF.evaluate(thisEndDistance, mean, var) - UnivariateGaussian.CDF.evaluate(thisStartDistance, mean, var); final double Z = UnivariateGaussian.CDF.evaluate( Math.abs(path.getTotalPathDistance()), mean, var) - UnivariateGaussian.CDF.evaluate(0, mean, var); return Math.log(t1) - Math.log(Z); } private double marginalPredictiveLogLikInternalOld1( MultivariateGaussian beliefPrediction) { final Matrix Or = AbstractRoadTrackingFilter.getOr(); final double var = Or.times(beliefPrediction.getCovariance()) .times(Or.transpose()).getElement(0, 0) + Math.pow(this.getInferredEdge().getLength(), 2d) / 12d; final double mean = Or.times(beliefPrediction.getMean()).getElement(0); final double direction = this.isBackward ? -1d : 1d; final double evalPoint = (this.getDistToStartOfEdge() + (this .getDistToStartOfEdge() + direction * this.getInferredEdge().getLength())) / 2d; final double result = UnivariateGaussian.PDF.logEvaluate(evalPoint, mean, var); return result; } private double marginalPredictiveLogLikInternalOld2( MultivariateGaussian beliefPrediction) { Preconditions.checkArgument(!this.isNullEdge()); Preconditions.checkArgument(beliefPrediction .getInputDimensionality() == 2); final Matrix Or = AbstractRoadTrackingFilter.getOr(); final double stdDev = Math.sqrt(Or .times(beliefPrediction.getCovariance()) .times(Or.transpose()).getElement(0, 0)); final double mean = Or.times(beliefPrediction.getMean()).getElement(0); final double direction = this.isBackward ? -1d : 1d; final double distToEndOfEdge = direction * this.getInferredEdge().getLength() + this.getDistToStartOfEdge(); final double startDistance = direction > 0d ? this.getDistToStartOfEdge() : distToEndOfEdge; final double endDistance = direction > 0d ? distToEndOfEdge :this .getDistToStartOfEdge(); // FIXME use actual log calculations final double result = LogMath.subtract(StatisticsUtil.normalCdf( endDistance, mean, stdDev, true), StatisticsUtil.normalCdf(startDistance, mean, stdDev, true)); return result; } private double getTruncatedNormalMean(final double origMean, double stdDev) { final double direction = this.isBackward() ? -1d : 1d; final double mean = (Math.signum(origMean) * direction) * Math.abs(origMean); final double startDistance = Math.abs(this.getDistToStartOfEdge()); final double endDistance = edge.getLength() + startDistance; final double tt1 = UnivariateGaussian.PDF.logEvaluate(startDistance, mean, stdDev * stdDev); final double tt2 = UnivariateGaussian.PDF.logEvaluate(endDistance, mean, stdDev * stdDev); final double t1 = LogMath.subtract(tt1 > tt2 ? tt1 : tt2, tt1 > tt2 ? tt2 : tt1); final double t2 = LogMath.subtract(StatisticsUtil.normalCdf( endDistance, mean, stdDev, true), StatisticsUtil.normalCdf(startDistance, mean, stdDev, true)); final double d2 = Math.log(stdDev) + t1 - t2; final double tmean = mean + (tt2 > tt1 ? -1d : 1d) * Math.exp(d2); return direction * tmean; } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#getPriorPredictive(org.opentrackingtools.graph.paths.states.impl.PathStateBelief, org.opentrackingtools.impl.Observation) */ @Override public MultivariateGaussian getPriorPredictive(PathStateBelief belief, GpsObservation obs) { Preconditions.checkArgument(belief.isOnRoad()); Preconditions.checkArgument(!this.isNullEdge()); /*- * TODO really, this should just be the truncated/conditional * mean and covariance for the given interval/edge */ final Matrix Or = AbstractRoadTrackingFilter.getOr(); final double S = Or.times(belief.getCovariance()) .times(Or.transpose()).getElement(0, 0) // + 1d; + Math.pow(this.getInferredEdge().getLength() / Math.sqrt(12), 2); final Matrix W = belief.getCovariance().times(Or.transpose()) .scale(1 / S); final Matrix R = belief.getCovariance().minus( W.times(W.transpose()).scale(S)); final double direction = this.isBackward() ? -1d : 1d; final double mean = (this.getDistToStartOfEdge() + (this .getDistToStartOfEdge() + direction * this.getInferredEdge().getLength())) / 2d; final Vector beliefMean = belief.getRawState(); final double e = mean - Or.times(beliefMean).getElement(0); final Vector a = beliefMean.plus(W.getColumn(0).scale(e)); assert StatisticsUtil .isPosSemiDefinite((gov.sandia.cognition.math.matrix.mtj.DenseMatrix) R); final MultivariateGaussian prediction = new MultivariateGaussian(a, R); return prediction; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SimplePathEdge other = (SimplePathEdge) obj; if (distToStartOfEdge == null) { if (other.distToStartOfEdge != null) { return false; } } else if (!distToStartOfEdge .equals(other.distToStartOfEdge)) { return false; } if (edge == null) { if (other.edge != null) { return false; } } else if (!edge.equals(other.edge)) { return false; } if (isBackward == null) { if (other.isBackward != null) { return false; } } else if (!isBackward.equals(other.isBackward)) { return false; } return true; } /** * Returns a state on the edge that's been truncated within the given * tolerance. The relative parameters set to true will return a state relative * to the edge (i.e. removing the distance to start). * * @param state * @param tolerance * @param relative * @return the state on the edge or null if it's */ public Vector getCheckedStateOnEdge(Vector state, double tolerance, boolean relative) { Preconditions.checkState(!isNullEdge()); Preconditions.checkArgument(tolerance >= 0d); Preconditions .checkArgument(state.getDimensionality() == 2); final Vector newState = state.clone(); final double distance = newState.getElement(0); final double direction = isBackward ? -1d : 1d; final double posDistAdj = direction * distance - Math.abs(distToStartOfEdge); final double overEndDist = posDistAdj - this.edge.getLength(); if (overEndDist > 0d) { if (overEndDist > tolerance) { return null; } else { newState.setElement(0, direction * this.edge.getLength() + (relative ? 0d : distToStartOfEdge)); } } else if (posDistAdj < 0d) { if (posDistAdj < -tolerance) { return null; } else { newState.setElement(0, (relative ? 0d : distToStartOfEdge)); } } if (relative) newState.setElement(0, direction * posDistAdj); return newState; } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#getDistToStartOfEdge() */ @Override public Double getDistToStartOfEdge() { return distToStartOfEdge; } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#getGeometry() */ @Override public Geometry getGeometry() { return this.edge.getGeometry(); } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#getInferredEdge() */ @Override public InferredEdge getInferredEdge() { return edge; } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#getLength() */ @Override public double getLength() { return this.getGeometry().getLength(); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((distToStartOfEdge == null) ? 0 : distToStartOfEdge.hashCode()); result = prime * result + ((edge == null) ? 0 : edge.hashCode()); result = prime * result + ((isBackward == null) ? 0 : isBackward .hashCode()); return result; } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#isBackward() */ @Override public Boolean isBackward() { return isBackward; } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#isEmptyEdge() */ @Override public boolean isNullEdge() { return this == emptyPathEdge; } /* (non-Javadoc) * @see org.opentrackingtools.graph.paths.edges.impl.PathEdge#isOnEdge(double) */ @Override public boolean isOnEdge(double distance) { final double direction = this.isBackward ? -1d : 1d; final double posDistToStart = Math.abs(distToStartOfEdge); final double posDistOffset = direction * distance - posDistToStart; if (posDistOffset - edge.getLength() > 1e-7d) { return false; } else if (posDistOffset < 0d) { return false; } return true; } @Override public String toString() { if (this.isNullEdge()) { return "PathEdge [empty edge]"; } else { final double distToStart = distToStartOfEdge == 0d && this.isBackward ? -0d : distToStartOfEdge.longValue(); return "PathEdge [edge=" + edge.getEdgeId() + " (" + edge.getLength().longValue() + ")" + ", distToStart=" + distToStart + "]"; } } public static SimplePathEdge getEdge(InferredEdge infEdge, double distToStart, Boolean isBackward) { Preconditions.checkArgument(isBackward != Boolean.TRUE || distToStart <= 0d); SimplePathEdge edge; if (infEdge.isNullEdge() || isBackward == null) { edge = SimplePathEdge.getNullPathEdge(); } else { edge = new SimplePathEdge(infEdge, distToStart, isBackward); } return edge; } public static SimplePathEdge getNullPathEdge() { return emptyPathEdge; } }
1b6fba9dc6c65556c49d279cc51e03cf08fe18b0
3fc1908017685b4a642d2ae1ff2cb3af4cb446f9
/java/workspace/final_examtest/src/main/java/entity/User.java
02cd2644c32e133847651f5476f3b1d6cbb717ce
[]
no_license
avganti1102/TEST
64f7d6246d1d1f48d06594345bedd57fce284637
68cdcc3d7636a818457c659f3ba9a998a4d24cca
refs/heads/master
2023-01-12T00:01:19.335802
2020-11-23T06:13:47
2020-11-23T06:13:47
289,693,486
0
0
null
null
null
null
UTF-8
Java
false
false
1,874
java
package entity; public class User { private String firstName; private String lastName; private String phone; private String email; private short expInYear; private String projectName; private String proSkill; public User() {} public User(String firstName, String lastName, String phone, String email, short expInYear) { this.firstName = firstName; this.lastName = lastName; this.phone = phone; this.email = email; this.expInYear = expInYear; } public short getExpInYear() { return expInYear; } public void setExpInYear(short expInYear) { this.expInYear = expInYear; } public String getProjectName() { return projectName; } public void setProjectName(String projectName) { this.projectName = projectName; } public String getProSkill() { return proSkill; } public void setProSkill(String proSkill) { this.proSkill = proSkill; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String showManager() { return "User{" + "FirstName = " + getFirstName() + ", LastName = " + getLastName() + ", Phone = " + getPhone() + ", Email = '" + getEmail() + ", expInYear = " + getExpInYear() + '\'' + '}'; } public String showEmployee() { return "User{" + "FirstName = " + getFirstName() + ", LastName = " + getLastName() + ", Phone = " + getPhone() + ", Email = '" + getEmail() + ", ProjectName = " + getProjectName() + ", ProSkill = "+ getProSkill() + '\'' + '}'; } }
7dd6c2dbe507b780eccb0097740d87f025e18f09
bab02be184c23fa1f752d5aad2279536c4dadba6
/src/main/java/com/example/transitapp/models/Bus.java
756106b6fd3c0abb2f6ffa530bf20a03754c1a13
[]
no_license
bransonperkins/transit-app
85fda18fbf64968c62b5349e84e268e70efd3d56
acf8cfa30e883fa8f5c4ffb348584a27c9e00d61
refs/heads/master
2022-11-30T00:24:44.138938
2020-08-04T14:37:17
2020-08-04T14:37:17
284,993,938
0
0
null
null
null
null
UTF-8
Java
false
false
421
java
package com.example.transitapp.models; public class Bus { public String ADHERENCE; public String BLOCKID; public String BLOCK_ABBR; public String DIRECTION; public String LATITUDE; public String LONGITUDE; public String MSGTIME; public String ROUTE; public String STOPID; public String TIMEPOINT; public String TRIPID; public String VEHICLE; public double distance; }
b577d5788c4c7ecdfaee5c94cdc983dd9ed695f6
e9d8007f8347abe4c7179d31443c8f0805426c79
/Uni/Java/Java10/Graph.java
7d642c4153bbfa37c0fc02155b947091e733d6cf
[]
no_license
Ultimus/Test2
51d7c185d728c1be5537b36ca4e25272a2ac2027
751968f518b3bb94d7048cf5b5b59e1fe5bf8226
refs/heads/master
2016-09-06T04:05:56.738231
2014-02-15T21:15:32
2014-02-15T21:15:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,953
java
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import org.junit.Test; public class Graph{ private int n; private int k; private String[] knoten; private static boolean[][] kanten; public Graph (Graph that){ } public Graph (String input){ String[] data = input.split(" "); n = Integer.parseInt(data[0]); k = Integer.parseInt(data[n+1]); knoten = new String[n]; kanten = new boolean[n][n]; for(int i = 0; i < n; i++) { knoten[i] = data[i+1]; } for(int i = 0; i < k*2; i+=2) { //BSP: Graph("2 nodeA nodeB 3 1 1 1 2 2 1") int arrayPosA = i+n+2; int arrayPosB = i+n+3; int x = Integer.parseInt(data[arrayPosA]); int y = Integer.parseInt(data[arrayPosB]); kanten[x][y] = true; } } public Graph removeEdge (int i, int j){ if (i < 0 || i > kanten.length) return this; if (j < 0 || j > kanten[0].length) return this; kanten[i][j] = false; return this; } public Graph removeNode (int i){ if (i < 0 || i > kanten.length) return this; for (int a = 0; a < kanten.length; a++){ kanten[a][i] = false; } for (int b = 0; b < kanten.length; b++){ kanten[i][b] = false; } knoten[i] = null; return this; } public int inDegree (int i){ int count = 0; for (int j = 0; j < kanten[0].length; j++){ if (kanten[0][j] == true){ count++; } } return count; } public int minInDegree (int i,boolean[][] kanten ){ int[] count = new int [kanten.length]; for (int j = 0; j < kanten.length; j++){ for (int k = 0; k < kanten[0].length; k++){ count[j]++; } } int min = 0; for (int seek = 0; seek<= count.length; seek++){ if (min < count[seek]){ min = count[seek]; } } return min; } @Test public void test_inDegree() { Graph gr = new Graph("4 first second third fourth 6 1 4 1 3 2 2 2 4 4 3 2 1"); assertEquals(1, gr.inDegree(1)); assertEquals(2, gr.inDegree(3)); } }
a38af952bc4857000815d08177cc4c9d39db8f15
81025548c35aed1fed58921824cfa9593351279e
/src/main/java/com/ytb/education_activities/service/IUsersService.java
85f0628d42a5eca8e96ceb7d14b49d6031b6eda3
[]
no_license
ytb2020/education-activities
9b5d76250818940c5d1170a9460a15d5e60f7983
548c7dc95ad935c235adccbe6e2bc66be9c78b38
refs/heads/master
2022-06-26T00:00:09.928038
2020-04-30T08:04:08
2020-04-30T08:04:08
258,926,286
0
0
null
null
null
null
UTF-8
Java
false
false
646
java
package com.ytb.education_activities.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ytb.education_activities.modal.Users; import com.ytb.education_activities.result.ObjectResult; import java.util.List; /** * education_activities Author ytb 2020/4/1 13:21 */ public interface IUsersService extends IService<Users> { public Users selectByUserName(String userName); public Users selectByUserCode(String userCode); public ObjectResult<Users> login(String userName, String userPassword); public ObjectResult<List<Users>> getById(String userCode); public ObjectResult<List<Users>> selectAll(); }
9e6a6b16c3a3e3040918095bd4ba78c1cffa9674
54e36483359c673be1c00f54ac3dac01260a2245
/luffy.executor.s.lua/src/main/java/org/noear/luffy/executor/s/lua/__JTEAPI_CLZ.java
7d2b60a55159d11c38ff2abd3de1ebaa16cafd03
[ "MIT" ]
permissive
fucora/luffy
92b9cb6bec3c5feb228efdbb665b7d88457c2d82
ad3fc34161c9639845ac99a02f936355efcfc773
refs/heads/main
2023-05-23T02:11:00.265922
2021-06-17T04:20:24
2021-06-17T04:20:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
package org.noear.luffy.executor.s.lua; import org.luaj.vm2.LuaTable; import org.noear.solon.core.handle.Context; import org.noear.luffy.executor.ExecutorFactory; import org.noear.luffy.model.AFileModel; import java.util.Map; public class __JTEAPI_CLZ { public String require(String path) throws Exception { String name = path.replace("/", "__"); String name2 = name.replace(".", "_") + "__lib"; AFileModel file = ExecutorFactory.fileGet(path); LuaJtExecutor.singleton().preLoad(name2, file); return name2; } public Object modelAndView(String path, LuaTable tb) throws Exception { String path2 = path;//AFileUtil.path2(path);//不用转为* String name = path2.replace("/", "__"); AFileModel file = ExecutorFactory.fileGet(path2); if (file.file_id > 0) { Map<String, Object> model = (Map<String, Object>) LuaUtil.tableToObj(tb); return ExecutorFactory.call(name, file, Context.current(), model, true); } else { return ""; } } }
195b5c11b6ffcc56283bfeede5e925e06b907726
3593b5281866c3c7c632aabff4bb90ba103b05ae
/src/com/example/socialchat/MyReceiver.java
318973c3f7c5cbcc346514110bd29ef186eed5b9
[]
no_license
raskin-aleksandr/SocialChat
1aa9950c02267050437bc1692ec89e8449563699
e0074a00bb4cc723f90c8c050ccc0691014878e4
HEAD
2016-09-05T10:59:00.653367
2015-01-11T11:46:17
2015-01-11T11:46:17
29,089,819
2
1
null
null
null
null
UTF-8
Java
false
false
1,381
java
package com.example.socialchat; import org.json.JSONException; import org.json.JSONObject; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.support.v4.app.NotificationCompat; public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { System.out.println("on receive"); try { String action = intent.getAction(); String channel = intent.getExtras().getString("com.parse.Channel"); JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data")); String name = json.getString("name"); Intent i = new Intent(context, Map.class); PendingIntent pIntent = PendingIntent.getActivity(context, 0, i, 0); Notification n = new NotificationCompat.Builder(context).setContentTitle("Received message").setContentText(name) .setContentIntent(pIntent).setSmallIcon(R.drawable.ic_launcher).build(); n.flags |= Notification.FLAG_AUTO_CANCEL; NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0, n); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
51e13b80885d3c88f2d6f576334d4f2f4c36892e
8d30dbfbf194a2047368d1dd6f1be53c62caa89b
/ProviderRegistration/src/main/java/com/nagarro/providerregistration/entity/ProviderInfo.java
3ccca3447e165a0f6c534518555170b0caa7f142
[]
no_license
vikramsinghbaghel/MicroservicesAssignment2
ef3bf1d01d6a992057623a947e2a34102a7897ba
87f216f8d3b6de06acfa31878a01149aa1ba5727
refs/heads/master
2023-05-26T03:04:55.781653
2021-06-12T10:09:55
2021-06-12T10:09:55
376,242,350
0
0
null
null
null
null
UTF-8
Java
false
false
1,023
java
package com.nagarro.providerregistration.entity; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class ProviderInfo { String name; @Id String email; Long contact; String address; String password; 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; } public Long getContact() { return contact; } public void setContact(Long contact) { this.contact = contact; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Override public String toString() { return "ProviderInfo [name=" + name + ", email=" + email + ", contact=" + contact + ", address=" + address + ", password=" + password + "]"; } }
e78f5fe9208a62895db57ca49ca8b289f3ef2640
53ad590cd70594d1b44f2e2a4542408fd8c17f91
/app/src/main/java/com/urbanutility/jerye/popfilms2/adapter/ReviewsAdapter.java
72f59b33d19ee48d29ba272e8ed0973459d032a9
[ "Apache-2.0" ]
permissive
hsukev/PopFilms2
83d90bbb31156a22de63772120f6393bd44fe081
e9fc8ce49f1880ac4475d784de4739e151cde5a8
refs/heads/master
2021-01-16T19:10:46.307641
2017-11-27T04:50:16
2017-11-27T04:50:16
100,148,333
1
2
null
null
null
null
UTF-8
Java
false
false
2,492
java
package com.urbanutility.jerye.popfilms2.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.urbanutility.jerye.popfilms2.R; import com.urbanutility.jerye.popfilms2.data.model.review.Result; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by jerye on 9/16/2017. */ public class ReviewsAdapter extends RecyclerView.Adapter<ReviewsAdapter.ReviewsViewHolder> { private Context mContext; private List<Result> reviewsList = new ArrayList<>(); private ReviewsAdapterListener reviewsAdapterListener; public static final String INTENT_FULL_REVIEW = "full_review"; public ReviewsAdapter(Context context, ReviewsAdapterListener reviewsAdapterListener) { mContext = context; this.reviewsAdapterListener = reviewsAdapterListener; } @Override public int getItemCount() { return reviewsList.size(); } @Override public ReviewsViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(mContext).inflate(R.layout.review_item, parent, false); return new ReviewsViewHolder(view); } @Override public void onBindViewHolder(ReviewsViewHolder holder, int position) { holder.reviewsAuthor.setText(reviewsList.get(position).getAuthor()); StringBuilder sb = new StringBuilder(); sb.append('"').append(reviewsList.get(position).getContent()).append('"'); holder.reviewsContent.setText(sb.toString()); } public void addReviews(Result result) { reviewsList.add(result); notifyDataSetChanged(); } public class ReviewsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { @BindView(R.id.reviews_author) TextView reviewsAuthor; @BindView(R.id.reviews_content) TextView reviewsContent; ReviewsViewHolder(View view) { super(view); view.setOnClickListener(this); ButterKnife.bind(this, view); } @Override public void onClick(View view) { reviewsAdapterListener.onClick(reviewsList.get(getAdapterPosition())); } } public interface ReviewsAdapterListener { void onClick(Result fullReview); } }
dba792e31cd94de468113ba010fec312f8cc5035
1c9423ff7a2f1d6e64512087ff02d58f6f1279c8
/src/main/java/org/saurav/assignment/gameofthrones/MyResource.java
34068d65c780da820fd07f2961b468b6aadebbb2
[]
no_license
itzsrv/gameofthrones-restful-jersey
2051005bcbb4247ae30065065bf213af02a607da
a1a976f5cfe0621c40d6ffae6463d508be54234f
refs/heads/master
2023-08-06T15:33:30.685232
2019-10-15T14:44:05
2019-10-15T14:44:05
215,321,903
0
0
null
2023-07-22T18:51:02
2019-10-15T14:37:59
Java
UTF-8
Java
false
false
635
java
package org.saurav.assignment.gameofthrones; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; /** * Root resource (exposed at "myresource" path) */ @Path("myresource") public class MyResource { /** * Method handling HTTP GET requests. The returned object will be sent * to the client as "text/plain" media type. * * @return String that will be returned as a text/plain response. */ @GET @Produces(MediaType.APPLICATION_JSON) public String getIt() { System.out.println("In MyResource"); return "Got it!"; } }
bfad837c51f5495c54fd2e86713463ee55c8e3bc
f50c696555fd607109bfb54b2d6dc692d69e0ca1
/codingninja/src/oops/DynamicArray.java
0516173d1faa57e016423c892b91e9edcdfd612f
[]
no_license
H-arshit/Java
0e1a1847a58da5eba2c8356f12848fc110e24a56
86f949e5c93e154158ecdc24e3d9aed1cac683e9
refs/heads/master
2021-05-16T17:54:22.292368
2017-09-11T09:53:45
2017-09-11T09:53:45
103,119,112
0
0
null
null
null
null
UTF-8
Java
false
false
1,103
java
package oops; public class DynamicArray { private int nextindex; private int arr[]; public DynamicArray() { arr=new int [5]; nextindex=0; } public boolean Isempty() { if(nextindex==0) { return true; } else { return false; } } public int removelast() { if(nextindex==0) { return -1; } else { int removed=arr[nextindex-1]; nextindex--; return removed; } } public void restructure() { int temp[]=arr; arr=new int [arr.length*2]; for(int i=0;i<temp.length;i++) { arr[i]=temp[i]; } } public void add(int element) { if(nextindex==arr.length) { restructure(); } arr[nextindex]=element; nextindex++; } public int size() { return nextindex; } public int get(int index) { if(index >= nextindex) { return -1; } return arr[index]; } public void set(int index,int element) { if(index>nextindex) { return; } else if(index<nextindex) { arr[index]=element; } else { add(element); } } }
0effef6ac56317d900ccfdb5e1aec045633fe327
44594494e17e8212c32a63845d670302418715ae
/cloud/caas/src/main/java/com/starcloud/docker/DockerHelper.java
ecffd1ca54760bab789ae8e2bd728ba273756916
[ "MIT" ]
permissive
zhou7069/star-edge-cloud
c1bb09dab95c536da156b639a768eec080fb7733
5ce76e866395ed250d4316b08eeb6cdb73856687
refs/heads/master
2021-01-13T19:22:33.250648
2019-03-28T07:34:14
2019-03-28T07:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,437
java
package com.starcloud.docker; import java.util.List; import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.command.CreateContainerResponse; import com.github.dockerjava.api.command.InspectVolumeResponse; import com.github.dockerjava.api.command.ListImagesCmd; import com.github.dockerjava.api.command.ListVolumesResponse; import com.github.dockerjava.api.model.Container; import com.github.dockerjava.api.model.ExposedPort; import com.github.dockerjava.api.model.Image; import com.github.dockerjava.api.model.Network; import com.github.dockerjava.api.model.Ports; import com.github.dockerjava.core.DockerClientBuilder; //https://github.com/docker-java/docker-java/wiki public class DockerHelper { static DockerClient dockerClient; private static String nodeAddress = "tcp://localhost:2375"; public static void Initialize() { // 使用DockerClientBuilder创建链接 dockerClient = DockerClientBuilder.getInstance(nodeAddress).build(); } public void CreateContainer(String config) { ExposedPort tcp8080 = ExposedPort.tcp(8080); // 设置映射到主机的端口 Ports portBindings = new Ports(); portBindings.bind(tcp8080, Ports.Binding.bindPort(8089)); // 创建一个新的Container并且与主机端口号绑定 CreateContainerResponse container = dockerClient.createContainerCmd("hadoop:latest") .withPortBindings(portBindings).exec(); // 运行一个Container dockerClient.startContainerCmd(container.getId()).exec(); } public void StartContainer(String cid) { dockerClient.startContainerCmd(cid).exec(); } public void StopContainer(String cid) { dockerClient.stopContainerCmd(cid).exec(); } public void removeContainer(String cid) { dockerClient.removeContainerCmd(cid).exec(); } public List<Image> GetAllImages() { try { ListImagesCmd cmd = dockerClient.listImagesCmd(); List<Image> images = cmd.exec(); return images; } catch (Exception ex) { throw ex; } } public List<Container> GetAllContainer() { try { List<Container> containers = dockerClient.listContainersCmd().exec(); return containers; } catch (Exception ex) { return null; } // dockerClient.listContainersCmd() // dockerClient.inspectContainerCmd(containerId) } public void CreateNetwork() { dockerClient.createNetworkCmd().withName("staredgecloud").withDriver("overlay").exec(); } public void RemoveNetwork(String nid) { dockerClient.removeNetworkCmd(nid).exec(); } public List<Network> GetNetwork() { try { List<Network> networks = dockerClient.listNetworksCmd().exec(); return networks; } catch (Exception ex) { return null; } } public void CreateVolumn() { dockerClient.createVolumeCmd().withName("myNamedVolume").exec(); } public void RemoveVolumn(String vid) { dockerClient.removeVolumeCmd(vid).exec(); } public List<InspectVolumeResponse> GetVolume() { try { ListVolumesResponse vg = dockerClient.listVolumesCmd().exec(); return vg.getVolumes(); } catch (Exception ex) { return null; } } }
95624e57b411a9c353de10e8436d843156ef9f03
a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb
/mpserverless-20190615/src/main/java/com/aliyun/mpserverless20190615/models/QuerySpaceUsageRequest.java
4ea0f4770a073c113b62642ecf4b49911314b380
[ "Apache-2.0" ]
permissive
aliyun/alibabacloud-java-sdk
83a6036a33c7278bca6f1bafccb0180940d58b0b
008923f156adf2e4f4785a0419f60640273854ec
refs/heads/master
2023-09-01T04:10:33.640756
2023-09-01T02:40:45
2023-09-01T02:40:45
288,968,318
40
45
null
2023-06-13T02:47:13
2020-08-20T09:51:08
Java
UTF-8
Java
false
false
1,407
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.mpserverless20190615.models; import com.aliyun.tea.*; public class QuerySpaceUsageRequest extends TeaModel { @NameInMap("EndTime") public String endTime; @NameInMap("Interval") public Integer interval; @NameInMap("SpaceId") public String spaceId; @NameInMap("StartTime") public String startTime; public static QuerySpaceUsageRequest build(java.util.Map<String, ?> map) throws Exception { QuerySpaceUsageRequest self = new QuerySpaceUsageRequest(); return TeaModel.build(map, self); } public QuerySpaceUsageRequest setEndTime(String endTime) { this.endTime = endTime; return this; } public String getEndTime() { return this.endTime; } public QuerySpaceUsageRequest setInterval(Integer interval) { this.interval = interval; return this; } public Integer getInterval() { return this.interval; } public QuerySpaceUsageRequest setSpaceId(String spaceId) { this.spaceId = spaceId; return this; } public String getSpaceId() { return this.spaceId; } public QuerySpaceUsageRequest setStartTime(String startTime) { this.startTime = startTime; return this; } public String getStartTime() { return this.startTime; } }
fbd41d951d7715d1f35e8cf60012e811b1bc5698
1f20fddaf454186d75ce4b636779bbf47a8273af
/WangYiXinWen/app/src/main/java/com/example/administrator/wangyixinwen/ParallaxListView.java
7813f0247d4335d6090a05b645b2d642f285e8d7
[]
no_license
ZeErdada/FangWangYiXinWen
2ef7d271570acf9dd708743a44474efa65f8e59e
fabcd7ec6c1bf4d5c4b61993749e7bcc48ae70f5
refs/heads/master
2021-01-19T18:21:24.381992
2017-08-23T12:30:19
2017-08-23T12:30:19
101,126,197
0
0
null
null
null
null
UTF-8
Java
false
false
4,364
java
package com.example.administrator.wangyixinwen; import android.animation.ValueAnimator; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.animation.OvershootInterpolator; import android.widget.ImageView; import android.widget.ListView; /** * Created by Administrator on 2017/8/16. * 1、继承ListView,复写构造方法 * 2、复写overScrollBy方法,重点关注deltay,isToucEvent方法 * 3、暴露一个方法,得到外界的ImageView,测量ImageView的高度 * 4、复写OnTouchEvent方法 */ public class ParallaxListView extends ListView{ private ImageView iv_header; private int drawableHeight; private int orignalHeight; public ParallaxListView(Context context) { this(context,null); } public ParallaxListView(Context context, AttributeSet attrs) { this(context,attrs,0); } public ParallaxListView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public void setIv_header(ImageView iv_header) { this.iv_header = iv_header; //获取图片原始高度 drawableHeight = iv_header.getDrawable().getIntrinsicHeight(); //获取ImageView控件的原始高度,以便回弹时,回弹到原始高度 orignalHeight = iv_header.getHeight(); } /** * 滑动到ListView两端才调用 * @param deltaY $$ * @param scrollY * @param scrollRangeY * @param maxOverScrollY * @param isTouchEvent $$ * @return */ @Override protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) { System.out.println("deltaY=="+deltaY+"========="+"scrollY=="+scrollY+"========="+"scrollRangeY=="+scrollRangeY+"isTouchEvent=="+isTouchEvent); //顶部下拉,用户触摸操作才执行视差效果 if (deltaY<0 && isTouchEvent){ //deltay是负值,我们要改为绝对值,累计给我们的iv_header高度 int newHeight = iv_header.getHeight()+ Math.abs(deltaY); //避免图片无限放大,使其最大不能超过本身的高度 if (newHeight <= drawableHeight) { //把新的高度值赋值给控件,改变控件的高度 iv_header.getLayoutParams().height = newHeight; iv_header.requestLayout(); } } return super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent); } @Override public boolean onTouchEvent(MotionEvent ev) { switch (ev.getAction()){ case MotionEvent.ACTION_UP: //把当前的头布局的高度恢复初始高度 int currentHeight = iv_header.getHeight(); //属性动画,改变高度的值,把我们当前的头布局的高度,改为原始的高度 final ValueAnimator animator = ValueAnimator.ofInt(currentHeight, orignalHeight); //动画更新的监听 animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { //获取动画执行中的分度值 float fraction = animator.getAnimatedFraction(); //获取中间值,并赋给控件的新高度,可以使控件有一个平稳回弹的效果 Integer animatedValue = (Integer) animator.getAnimatedValue(); //让新高度值生效 iv_header.getLayoutParams().height = animatedValue; iv_header.requestLayout(); } }); //动画回弹效果,值越大,回弹越厉害 animator.setInterpolator(new OvershootInterpolator(2)); //设置动画执行时间,单位毫秒 animator.setDuration(2000); //动画执行 animator.start(); break; } return super.onTouchEvent(ev); } }
c56aafc6af11fb5c931218d8631be7c47e8146d5
fd2c5be015d765d846aaa64a3f83801d1f0bc243
/src/main/java/com/baomidou/dynamic/datasource/spring/boot/autoconfigure/DynamicDataSourceProperties.java
9a6b727e7d3483c2b25b29eff2d97907c5db81b9
[ "Apache-2.0" ]
permissive
dong4j/dynamic-datasource-spring-boot-starter
a605260634cdf11a8361ef8591be8c9fbcd8090e
b9149c4ac20028deb92b8b5b7e3b2720af79b974
refs/heads/master
2020-03-26T04:44:00.720733
2018-08-10T05:46:03
2018-08-10T16:15:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,738
java
/** * Copyright © 2018 organization 苞米豆 * <pre> * 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. * <pre/> */ package com.baomidou.dynamic.datasource.spring.boot.autoconfigure; import com.baomidou.dynamic.datasource.DynamicDataSourceStrategy; import com.baomidou.dynamic.datasource.LoadBalanceDynamicDataSourceStrategy; import lombok.Getter; import lombok.Setter; import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.boot.context.properties.ConfigurationProperties; import java.util.LinkedHashMap; import java.util.Map; /** * DynamicDataSourceProperties * * @author TaoYu Kanyuxia * @see DataSourceProperties * @since 1.0.0 */ @Getter @Setter @ConfigurationProperties(prefix = "spring.datasource.dynamic") public class DynamicDataSourceProperties { /** * 必须设置默认的库,默认master */ private String primary = "master"; /** * 每一个数据源 */ private Map<String, DynamicDataSource> datasource = new LinkedHashMap<>(); /** * 多数据源选择算法clazz,默认负载均衡算法 */ private Class<? extends DynamicDataSourceStrategy> strategy = LoadBalanceDynamicDataSourceStrategy.class; }
34320db30866fa427a063eb1c3e6af6e08bc736c
15db1f8ca6c86fe90f57e490c3e037a2af9cecf7
/fast-portal/src/main/java/com/cctc/fast/portal/system/service/ISysUserService.java
43a8fe7cc6d4e27329748c5690595a78716d5b58
[]
no_license
panghaichao/springboot-fast
d6be6f5cb31cf77dd93e52c970cf396ccb00a624
1fe2bf9578ab9c955886ab0b2d324afd9ab9de36
refs/heads/master
2020-03-27T09:46:02.443031
2018-08-28T00:47:12
2018-08-28T00:47:12
146,368,389
0
0
null
null
null
null
UTF-8
Java
false
false
424
java
package com.cctc.fast.portal.system.service; import com.baomidou.mybatisplus.service.IService; import com.cctc.fast.portal.system.entity.SysUser; /** * 用户service接口层 * @author Hejeo * */ public interface ISysUserService extends IService<SysUser>{ /** * 根据账户获取用户信息 * @param userAccount 用户登陆账户 * @return */ public SysUser getSysUserByUserAccount(String userAccount); }
04d25454ace8ed6c318b8bd73fcafcc24e352953
1bc2ac60fa7205c56d0e6e1bcb758cbf7614090c
/android/app/src/main/java/com/rnchart/MainApplication.java
e67a21f87f12a894d34ea8a59bfa00d0f39e09c7
[]
no_license
jeffreyrajanofficial/React-Native-Chart
d00b69edcfff91f9c694f859cb0630a4aa9906e6
6adac2b96f7e1f549ef1f6fce7ab83a5b892289f
refs/heads/master
2020-03-25T20:30:19.944009
2018-08-09T09:57:24
2018-08-09T09:57:24
144,133,950
0
0
null
null
null
null
UTF-8
Java
false
false
1,350
java
package com.rnchart; import android.app.Application; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import com.github.wuxudong.rncharts.MPAndroidChartPackage; import com.facebook.react.bridge.ReadableNativeArray; import com.facebook.react.bridge.ReadableNativeMap; import java.util.Arrays; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new MPAndroidChartPackage() ); } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); ReadableNativeArray.setUseNativeAccessor(true); ReadableNativeMap.setUseNativeAccessor(true); } }
b553d7f360b1b86ae60bde48f0e3ed10d6d3b04b
40665051fadf3fb75e5a8f655362126c1a2a3af6
/ibinti-bugvm/b6428f98237d32ec9d9e706ffe652052ed608be5/2118/Name.java
b220c8e7abb42f00ead326ad71b310f0e54c5710
[]
no_license
fermadeiral/StyleErrors
6f44379207e8490ba618365c54bdfef554fc4fde
d1a6149d9526eb757cf053bc971dbd92b2bfcdf1
refs/heads/master
2020-07-15T12:55:10.564494
2019-10-24T02:30:45
2019-10-24T02:30:45
205,546,543
2
0
null
null
null
null
UTF-8
Java
false
false
1,126
java
package com.bugvm.javacpp.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import com.bugvm.javacpp.tools.Generator; /** * Names the identifier of a native C++ struct, class, union, function, variable, * operator, macro, etc. Without this annotation, {@link Generator} guesses the * native name based on the name of the Java peer. However, it may sometimes be * impossible to use the same name in Java, for example, in the case of overloaded * operators or to specify template arguments, while other times we may need to * access by name, for example, a callback pointer or function object, from C++. * For all those cases, we require this annotation. * * @see Generator * * @author Samuel Audet */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface Name { /** The second element gets used as a suffix to work around arrays of anonymous struct or union. */ String[] value(); }
e39eac77574d3883496892220245538201d96647
ce0113e660294dc2f56cf7fb7fc075b67ab457db
/code/anguo-core/src/main/java/com/anguo/mybatis/db/controller/BaseController.java
c225559a19677e3b0d69332ffef17ff96785e044
[ "Apache-2.0" ]
permissive
wenanguo/anguosoft
351aeb709fc07cf9b0acdc993172a1bdccebbd01
cf6c775c20ec8a25326b0e33c2098063b97e7698
refs/heads/master
2020-05-22T04:13:26.290078
2019-07-31T08:36:30
2019-07-31T08:36:30
23,356,043
0
1
null
null
null
null
UTF-8
Java
false
false
840
java
package com.anguo.mybatis.db.controller; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import com.anguo.mybatis.db.core.CodeComments; import com.anguo.web.db.domain.CommonSysUser; /** * 所有controller都继承自该父类 * @author AndrewWen * */ @Controller @CodeComments("基础框架") public class BaseController { /** * 从security中获取当前登录用户信息 * @return */ @CodeComments("获得当前用户") public CommonSysUser getSecuritySessionUser() { CommonSysUser currUser=null; //获得当前用户 Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof CommonSysUser) { currUser=(CommonSysUser)principal; } return currUser; } }
d0f9056b9a3657a97d13d4fa41d39a9deb24ae39
606b815682acff90e784473969eaa857ebcfac27
/9-Palindrome-Number/solution.java
9f7065994cc47e965d6484c7aea3f0ee3d72a8d6
[]
no_license
jellylidong/My-Leetcode-Track
39f73e6c396fdf53d22f7f164587d58a29400499
12d7160e9d3141f123d27dbfca84ebe42c15314c
refs/heads/master
2021-01-17T10:20:53.057037
2016-07-15T04:45:50
2016-07-15T04:45:50
58,507,424
0
0
null
null
null
null
UTF-8
Java
false
false
993
java
public class Solution { // public boolean isPalindrome(int x) { // if(x < 0) // return false; // if(x == 0) // return true; // int len = 0; // int tmp = x; // while(tmp != 0){ // len++; // tmp /= 10;;//use / instead of * to avoid overflow // } // while(len > 0 && x > 0){ // int lo = x%10; // int hi = x/((int)Math.pow(10, len-1)); // if(hi != lo){ // // System.out.print(x); // return false; // } // x -= lo; // x -= hi*(int)Math.pow(10, len-1); // x /= 10; // len -= 2; // } // return true; // } public boolean isPalindrome(int x) { int p = x; int q = 0; while(p > 0){ q = q*10; q += p%10; p /= 10; } return q == x; } }
ad120dfc80c4bdb92accaba70015b9dd27e1af38
067dda8e65cd26398c1f17415d9d3d187e73cf5f
/src/main/java/com/roy/webdemo/controller/UserController.java
66946f400d2d837a5b681e075fa98a878b173367
[]
no_license
User-tjp/webdemo
b73096b8dca4683af20897f5409e443a794d303d
b425d110748dc3bac39a7b4adab7899625e6f7be
refs/heads/master
2023-01-02T06:15:09.838114
2020-04-30T08:47:22
2020-04-30T08:47:22
260,156,560
0
0
null
2020-10-13T21:38:01
2020-04-30T08:34:40
Java
UTF-8
Java
false
false
849
java
package com.roy.webdemo.controller; import com.roy.webdemo.service.UserService; import com.roy.webdemo.service.impl.UserServiceImpl; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet("/api/user") public class UserController extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doPost(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { UserService us =new UserServiceImpl(); resp.getWriter().write(us.getString()); } }
a2b43c60f41cd5eeba79236e17902d5cc6aacede
3ded4c24cffc6a4fc0d14e15efb192f5629a9905
/src/android/support/v4/b/e.java
5a94bfcd03a7bdd53bdd81cc2371d1e5772b64f1
[]
no_license
cbedoy/FlappyBird
e9d20677881af3fe3104463315d608261be60dd8
c4873c03a4b1f757a1b4dc5ae486f5f41457af11
refs/heads/master
2020-06-02T06:56:30.324218
2014-02-18T06:49:12
2014-02-18T06:49:12
16,939,528
0
1
null
null
null
null
UTF-8
Java
false
false
998
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package android.support.v4.b; import android.util.Log; import java.io.Writer; public class e extends Writer { private final String a; private StringBuilder b; public e(String s) { b = new StringBuilder(128); a = s; } private void a() { if (b.length() > 0) { Log.d(a, b.toString()); b.delete(0, b.length()); } } public void close() { a(); } public void flush() { a(); } public void write(char ac[], int i, int j) { int k = 0; while (k < j) { char c = ac[i + k]; if (c == '\n') { a(); } else { b.append(c); } k++; } } }
f66a9363c730b4f7c931bff9027943bfd236aa2c
c9b829de269bf8eae8c12dcf64b82eb8ae2226d6
/fanchang/eoeLearnjava2013-12-30/src/com/eoe/se2/day10/ServletCinent2.java
a5671465abc89d48a3bfbb35bac09453605468ba
[]
no_license
ymns/eoeGeekCamp-201312
3a69db5a0a79ed02928f3a68d2c3a7200e6ea0f3
312b863599ec2606e82a264c0f88c4214b02d869
refs/heads/master
2021-01-17T05:24:00.304815
2014-02-20T12:45:57
2014-02-20T12:45:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,275
java
package com.eoe.se2.day10; import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class ServletCinent2 { /** * Post方式提交 * * @param args */ private static final String BASE_URL = "http://localhost:8080/se2_day10/Servlet1"; public static void main(String[] args) { HttpURLConnection conn = null; StringBuilder sb = new StringBuilder(); try { sb.append("name=").append("张飞").append("&age=").append(35); // 将字符串按utf-8序列化为字节数组 byte[] data = sb.toString().getBytes("utf-8"); URL url = new URL(BASE_URL); conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(5000); conn.setRequestMethod("POST"); conn.setDoOutput(true); conn.setRequestProperty("Content-length", data.length + ""); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.getOutputStream().write(data); if (conn.getResponseCode() == 200) { System.out.println(conn.getResponseMessage()); System.out.println("发送数据成功!"); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
58da86ce52f3e838a196340076a31bdb6a9c44c5
b905fbc16a3e4c1765ce4b4eb270d017e6b4b5d2
/HRMS/HRMS-Domain/src/main/java/com/csipl/hrms/model/payroll/Bonus.java
c6794ed8b7e5b5c9af6b12696f0ecec4028e8020
[]
no_license
ravindra2017bangalore/FabHR
76ed00741be81b6219b565bb38c4c4a68a364dc1
c77e5d4c99d5e9bdb042efea5e30fa25e7e0561e
refs/heads/master
2021-07-03T22:56:55.877324
2019-03-11T15:13:02
2019-03-11T15:13:02
175,022,830
1
0
null
null
null
null
UTF-8
Java
false
false
2,240
java
package com.csipl.hrms.model.payroll; import java.io.Serializable; import javax.persistence.*; import com.csipl.hrms.model.BaseModel; import com.csipl.hrms.model.organisation.Grade; import java.math.BigDecimal; import java.util.Date; /** * The persistent class for the Bonus database table. * */ @Entity @NamedQuery(name="Bonus.findAll", query="SELECT b FROM Bonus b") public class Bonus extends BaseModel implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long bonusId; private String activeStatus; private String allowModi; private BigDecimal bonusPer; @Temporal(TemporalType.TIMESTAMP) private Date dateUpdate; @Temporal(TemporalType.DATE) private Date effectiveDate; private String financialYear; //bi-directional many-to-one association to Grade @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="gradesId") private Grade grade; public Bonus() { } public Long getBonusId() { return this.bonusId; } public void setBonusId(Long bonusId) { this.bonusId = bonusId; } public String getActiveStatus() { return this.activeStatus; } public void setActiveStatus(String activeStatus) { this.activeStatus = activeStatus; } public String getAllowModi() { return this.allowModi; } public void setAllowModi(String allowModi) { this.allowModi = allowModi; } public BigDecimal getBonusPer() { return this.bonusPer; } public void setBonusPer(BigDecimal bonusPer) { this.bonusPer = bonusPer; } public Date getDateUpdate() { return this.dateUpdate; } public void setDateUpdate(Date dateUpdate) { this.dateUpdate = dateUpdate; } public Date getEffectiveDate() { return this.effectiveDate; } public void setEffectiveDate(Date effectiveDate) { this.effectiveDate = effectiveDate; } public String getFinancialYear() { return this.financialYear; } public void setFinancialYear(String financialYear) { this.financialYear = financialYear; } public Grade getGrade() { return grade; } public void setGrade(Grade grade) { this.grade = grade; } }
fdde8db3589014f4eae5c61cb79da7cc428fece1
b6c8c72593dbf96fba5136b965b45d36fb0f62b6
/medicineApp/src/com/example/medicineApp/objects/Workout.java
40c327dfce28eeaaae9e2189d4da02cf00587be6
[]
no_license
rampler/Food-Diary
0bec13cfb1f9c44381b3c3347f5c42455703e104
048291d63a8fd06c4ae5ee72e77cb3dc17f84d1e
refs/heads/master
2020-05-31T15:15:32.317809
2014-12-09T12:07:05
2014-12-09T12:07:05
27,236,729
0
0
null
null
null
null
UTF-8
Java
false
false
1,056
java
package com.example.medicineApp.objects; /** * Created by Sabina on 2014-12-06. */ public class Workout { private String id; private String exerciseId; private String repeats; private String quantity; private String workoutDate; private Exercise exercise = null; public Workout (String id, String exerciseId, String repeats, String quantity, String workoutDate) { this.id = id; this.exerciseId = exerciseId; this.repeats = repeats; this.quantity = quantity; this.workoutDate = workoutDate; } public String getId() { return id; } public String getExerciseId() { return exerciseId; } public String getRepeats() { return repeats; } public String getQuantity() { return quantity; } public String getWorkoutDate() { return workoutDate; } public Exercise getExercise() { return exercise; } public void setExercise(Exercise exercise) { this.exercise = exercise; } }
fd8872901b93c3633a3633abae9e4a06e4c664e3
07adc74294d8c9cee4954fd781bee21fd463b5fa
/src/test/java/advantageonlineshopping/metodos/CadastroPage.java
4482f96964163f92ecd38b16ade5a996dd8d019f
[]
no_license
tainapadalino/advantageonlineshopping
efe94f145f0e1e53103e2bb16df7982be5466d0e
1e66bbf599fc61e7556963c9f286f79176b2188e
refs/heads/main
2023-06-16T09:22:23.016327
2021-07-08T01:02:38
2021-07-08T01:02:38
383,958,776
0
0
null
null
null
null
UTF-8
Java
false
false
1,104
java
package advantageonlineshopping.metodos; import org.openqa.selenium.By; public class CadastroPage { Metodos metodos = new Metodos(); By usernameRegisterPage = By.name("usernameRegisterPage"); By emailRegisterPage = By.name("emailRegisterPage"); By passwordRegisterPage = By.name("passwordRegisterPage"); By confirmPasswordRegisterPage = By.name("confirm_passwordRegisterPage"); By i_agree = By.name("i_agree"); By register_btnundefined = By.id("register_btnundefined"); public void registrarNovoCliente(String nome, String email, String senha, String confirmaSenha) throws InterruptedException { metodos.escrever(usernameRegisterPage, nome, " preencher campo nome."); metodos.escrever(emailRegisterPage, email, " preencher campo e-mail."); metodos.escrever(passwordRegisterPage, senha, " preencher o campo senha."); metodos.escrever(confirmPasswordRegisterPage, confirmaSenha, " preencher o campo confirma senha."); Thread.sleep(3000); metodos.clicar(i_agree, " clicar agree."); metodos.clicar(register_btnundefined, " clicar register."); } }