blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b0416e3ecf54e7a8899f8b91f320bf54f19b4aa9 | 07bb26f2cf6b83f94499f097bd8932286744bae1 | /src/Collections/PrettyName.java | 55de3ef44d0a3f083a5f81052c644cb8b9983fa9 | [] | no_license | yangsch/BasicAlgorithm | 7237c80f9c43b068125269ab76e19dd555eebc64 | 0c9c385f7a6249e9f24b2709863f4fb89f8ce349 | refs/heads/master | 2020-04-05T15:53:25.423810 | 2018-11-10T14:27:56 | 2018-11-10T14:27:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,685 | java | package Collections;
import java.util.*;
public class PrettyName {
private static int prettyname(String name){
char[] letters = name.toCharArray();
HashMap<Character,Integer> hm = new HashMap<>();
for(int i =0;i<letters.length;i++){
int value = 0;
if(!hm.containsKey(letters[i])){
hm.put(letters[i],1);
}else{
value = hm.get(letters[i])+1;
hm.put(letters[i],value);
}
}
List<Map.Entry<Character,Integer>> list = new ArrayList<>(hm.entrySet());
Collections.sort(list, new Comparator<Map.Entry<Character, Integer>>() {
@Override
public int compare(Map.Entry<Character, Integer> o1, Map.Entry<Character, Integer> o2) {
if(o1.getValue()>o2.getValue())
return 1;
else if(o1.getValue()==o2.getValue())
return 0;
else
return -1;
}
});
int sum = 0;
for (int i=list.size()-1;i>=0;i--){
int pretty = list.get(i).getValue();
sum = pretty*(26+i-list.size()+1)+sum;
}
return sum;
}
public static void main(String[] args){
Scanner s = new Scanner(System.in);
while(s.hasNext()){
int n = s.nextInt();
String[] strs = new String[n];
int[] pretty = new int[n];
for(int i =0;i<n;i++){
strs[i] = s.next();
pretty[i] = prettyname(strs[i]);
}
for(int ss:pretty)
System.out.println(ss);
}
}
}
| [
"yang_sichan@163.com"
] | yang_sichan@163.com |
14daee7899f8a0fa133c63dbb2663a5e599f59af | 72661191e9d2eeb2d5a5d35d361afaab7dc7aa8c | /src/main/java/com/fds/repositories/CustomerInfoRepo.java | e9292423401c95e21037c4b63bcb6022c76ecc60 | [] | no_license | vht1092/FraudDetectionSystems_v2_Rpt | a84cb71209082b977863b65fcd97c2248557a148 | dd29ca58caa6a4aa8cd5e93013e36098b874c2ce | refs/heads/master | 2023-04-21T07:28:28.803573 | 2021-05-10T06:27:38 | 2021-05-10T06:27:38 | 365,917,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,774 | java | package com.fds.repositories;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.fds.entities.CustomerInfo;
@Repository
public interface CustomerInfoRepo extends JpaRepository<CustomerInfo, String> {
@Query(value = "select trim(fx_ir056_name) as cust_name, case trim(fx_ir056_ttl) when 'MISS' then 'Bà' when 'MR' then 'Ông' when 'MRS' then 'Bà' else '' end cust_gendr, fx_ir056_hp as cust_hp, fx_ir056_off_tel_1 as cust_off_tel_1, fx_ir056_off_tel_2 as cust_off_tel_2, fx_ir056_email_addr as cust_email_addr, fx_ir056_cif_no as cust_cif from ir056@im.world join FDS_SYS_TASK s on trim(fx_ir056_cif_no) = s.objecttask where s.typetask =:typetask ", nativeQuery = true)
List<CustomerInfo> findAllTypetask(@Param("typetask") String typetask);
@Query(value = "select trim(fx_ir056_name) as cust_name, case trim(fx_ir056_ttl) when 'MISS' then 'Bà' when 'MR' then 'Ông' when 'MRS' then 'Bà' else '' end cust_gendr, fx_ir056_hp as cust_hp, fx_ir056_off_tel_1 as cust_off_tel_1, fx_ir056_off_tel_2 as cust_off_tel_2, fx_ir056_email_addr as cust_email_addr, fx_ir056_cif_no as cust_cif from ir056@im.world where rownum = 1 and fx_ir056_cif_no = :cifno ", nativeQuery = true)
CustomerInfo findAll(@Param("cifno") String cifno);
@Query(value = "select trim(fx_ir056_name) as cust_name, case trim(fx_ir056_ttl) when 'MISS' then 'Bà' when 'MR' then 'Ông' when 'MRS' then 'Bà' else '' end cust_gendr, fx_ir056_hp as cust_hp, fx_ir056_off_tel_1 as cust_off_tel_1, fx_ir056_off_tel_2 as cust_off_tel_2, fx_ir056_email_addr as cust_email_addr, fx_ir056_cif_no as cust_cif from ir056@im.world where rownum = 1 and trim(fx_ir056_cif_no) =?1", nativeQuery = true)
CustomerInfo findOneAll(String cifno);
/**
* Lay ten khach hang (chinh/phu) theo so the
*/
@Query(value = "select decode((select trim(fx_ir025_emb_lst_nm) || ' ' || trim(fx_ir025_emb_mid_nm) || ' ' || trim(fx_ir025_emb_name) from ir025@im.world where px_ir025_pan = :enccardno union select trim(fx_ir275_emb_lst_nm) || ' ' || trim(fx_ir275_emb_mid_nm) || ' ' || trim(fx_ir275_emb_name) from ir275@im.world where px_ir275_own_pan = :enccardno), null, (select trim(fx_ir025_emb_lst_nm) || ' ' || trim(fx_ir025_emb_mid_nm) || ' ' || trim(fx_ir025_emb_name) from ir025@im.world where FX_IR025_REF_PAN = :enccardno union select trim(fx_ir275_emb_lst_nm) || ' ' || trim(fx_ir275_emb_mid_nm) || ' ' || trim(fx_ir275_emb_name) from ir275@im.world where FX_IR275_REF_PAN = :enccardno ), (select trim(fx_ir025_emb_lst_nm) || ' ' || trim(fx_ir025_emb_mid_nm) || ' ' || trim(fx_ir025_emb_name) from ir025@im.world where px_ir025_pan = :enccardno union select trim(fx_ir275_emb_lst_nm) || ' ' || trim(fx_ir275_emb_mid_nm) || ' ' || trim(fx_ir275_emb_name) from ir275@im.world where px_ir275_own_pan = :enccardno)) custname from dual", nativeQuery = true)
String getCustNameByEncCrdNo(String enccardno);
/**
* Lay Loc (chinh/phu) theo so the
*/
@Query(value = "select decode((select f9_ir025_loc_acct from ir025@im.world where px_ir025_pan = :enccardno union select f9_ir275_loc_acct from ir275@im.world where px_ir275_own_pan = :enccardno), null, (select f9_ir025_loc_acct from ir025@im.world where fx_ir025_ref_pan = :enccardno union select f9_ir275_loc_acct from ir275@im.world where fx_ir275_ref_pan = :enccardno), (select f9_ir025_loc_acct from ir025@im.world where px_ir025_pan = :enccardno union select f9_ir275_loc_acct from ir275@im.world where px_ir275_own_pan = :enccardno)) loc from dual", nativeQuery = true)
String getLocByEncCrdNo(String enccardno);
/*
* select trim(fx_ir056_name) as cust_name,
* decode(fx_ir056_gendr, 'F', 'Bà', 'Ông') as cust_gendr,
* fx_ir056_hp as cust_hp,
* fx_ir056_hme_tel as cust_off_tel_1,
* fx_ir056_off_tel_1 as cust_off_tel_2,
* fx_ir056_email_addr as cust_email_addr,
* fx_ir056_cif_no as cust_cif
* from ir056@im.world
* where p9_ir056_crn = (select f9_ir275_crn
* from ir275@im.world
* where px_ir275_own_pan = :crdno)
* union
* select trim(fx_ir056_name) as cust_name,
* decode(fx_ir056_gendr, 'F', 'Bà', 'Ông') as cust_gendr,
* fx_ir056_hp as cust_hp,
* fx_ir056_hme_tel as cust_off_tel_1,
* fx_ir056_off_tel_1 as cust_off_tel_2,
* fx_ir056_email_addr as cust_email_addr,
* fx_ir056_cif_no as cust_cif
* from ir056@im.world
* where p9_ir056_crn =
* (select f9_ir025_crn from ir025@im.world where px_ir025_pan = :crdno)
*/
/*khoa khong check so dien thoai fcc
@Query(value = "select trim(fx_ir056_name) as cust_name, case trim(fx_ir056_ttl) when 'MISS' then 'Bà' when 'MR' then 'Ông' when 'MRS' then 'Bà' else '' end cust_gendr, fx_ir056_hp as cust_hp, '0' as cust_off_tel_1, fx_ir056_off_tel_1 as cust_off_tel_2, trim(fx_ir056_email_addr) as cust_email_addr, trim(fx_ir056_cif_no) as cust_cif from ir056@im.world where p9_ir056_crn = (select nvl((select f9_ir025_crn from ir025@im.world where px_ir025_pan = :crdno),(select f9_ir275_crn from ir275@im.world where px_ir275_own_pan = :crdno)) from dual)", nativeQuery = true)
CustomerInfo findByCrdNo(@Param("crdno") String crdno);
*/
/*huyennt add them ngay 14Oct2017*/
/*@Query(value = "select trim(fx_ir056_name) as cust_name, case trim(fx_ir056_ttl) when 'MISS' then 'Bà' when 'MR' then 'Ông' when 'MRS' then 'Bà' else '' end cust_gendr, fx_ir056_hp as cust_hp, '0' as cust_off_tel_1, fx_ir056_off_tel_1 as cust_off_tel_2, fx_ir056_email_addr as cust_email_addr, trim(fx_ir056_cif_no) as cust_cif from ir056@im.world where trim(fx_ir056_cif_no) = :cifno and rownum <= 1", nativeQuery = true)
CustomerInfo findByCif(@Param("cifno") String cifno);
*/
//tam khoa check so dt fcc
@Query(value = "select trim(fx_ir056_name) as cust_name, case trim(fx_ir056_ttl) when 'MISS' then 'Bà' when 'MR' then 'Ông' when 'MRS' then 'Bà' else '' end cust_gendr, fx_ir056_hp as cust_hp, nvl((SELECT trim(MOBILE_NUMBER) FROM fcusr01.STTM_CUST_PERSONAL@exadata where CUSTOMER_NO = trim(fx_ir056_cif_no)),' ') as cust_off_tel_1, nvl((SELECT trim(telephone) FROM fcusr01.STTM_CUST_PERSONAL@exadata where CUSTOMER_NO = trim(fx_ir056_cif_no)),' ') as cust_off_tel_2, trim(fx_ir056_email_addr) as cust_email_addr, trim(fx_ir056_cif_no) as cust_cif from ir056@im.world where p9_ir056_crn = (select nvl((select f9_ir025_crn from ir025@im.world where px_ir025_pan = :crdno),(select f9_ir275_crn from ir275@im.world where px_ir275_own_pan = :crdno)) from dual)", nativeQuery = true)
CustomerInfo findByCrdNo(@Param("crdno") String crdno);
//huyennt add them ngay 14Oct2017
//tanvh1
// @Query(value = "select trim(fx_ir056_name) as cust_name, case trim(fx_ir056_ttl) when 'MISS' then 'Bà' when 'MR' then 'Ông' when 'MRS' then 'Bà' else '' end cust_gendr, fx_ir056_hp as cust_hp, '0963137131' as cust_off_tel_1, '0935569842' as cust_off_tel_2, fx_ir056_email_addr as cust_email_addr, trim(fx_ir056_cif_no) as cust_cif from ir056@im.world where trim(fx_ir056_cif_no) = :cifno and rownum <= 1", nativeQuery = true)
@Query(value = "select trim(fx_ir056_name) as cust_name, case trim(fx_ir056_ttl) when 'MISS' then 'Bà' when 'MR' then 'Ông' when 'MRS' then 'Bà' else '' end cust_gendr, fx_ir056_hp as cust_hp, nvl((SELECT trim(MOBILE_NUMBER) FROM fcusr01.STTM_CUST_PERSONAL@exadata where CUSTOMER_NO = trim(fx_ir056_cif_no)),' ') as cust_off_tel_1, nvl((SELECT trim(telephone) FROM fcusr01.STTM_CUST_PERSONAL@exadata where CUSTOMER_NO = trim(fx_ir056_cif_no)),' ') as cust_off_tel_2, fx_ir056_email_addr as cust_email_addr, trim(fx_ir056_cif_no) as cust_cif from ir056@im.world where trim(fx_ir056_cif_no) = :cifno and rownum <= 1", nativeQuery = true)
CustomerInfo findByCif(@Param("cifno") String cifno);
}
/*
* select trim(fx_ir056_name) as cust_name,
* decode(fx_ir056_gendr, 'F', 'Bà', 'Ông') as cust_gendr,
* trim(fx_ir056_hp) as cust_hp,
* trim(fx_ir056_off_tel_1) as cust_off_tel_1,
* trim(fx_ir056_off_tel_2) as cust_off_tel_2,
* trim(fx_ir056_email_addr) as cust_email_addr,
* trim(fx_ir056_cif_no) as cust_cif
* from ir056@im.world
* where p9_ir056_crn =
* (select F9_IR275_CRN
* from ir275@im.world
* where PX_IR275_OWN_PAN = '48E219A099958F1CXXX')
* union
* select trim(fx_ir056_name) as cust_name,
* decode(fx_ir056_gendr, 'F', 'Bà', 'Ông') as cust_gendr,
* trim(fx_ir056_hp) as cust_hp,
* trim(fx_ir056_off_tel_1) as cust_off_tel_1,
* trim(fx_ir056_off_tel_2) as cust_off_tel_2,
* trim(fx_ir056_email_addr) as cust_email_addr,
* trim(fx_ir056_cif_no) as cust_cif
* from ir056@im.world
* where p9_ir056_crn =
* (select F9_IR025_CRN
* from ir025@im.world
* where PX_IR025_PAN = '48E219A099958F1CXXX');
*/
| [
"vht1092@gmail.com"
] | vht1092@gmail.com |
9c7e73c40d44ac213ef5715cc3e87399c0456e93 | e75e3a7f0d4a501acf8d43d12b7102d4e2315ba8 | /src/main/java/com/thc/code/services/UserService.java | aaddb884640210782950bdee3840b867f0060b85 | [] | no_license | facuc28/esportTournament | 74fa6125def54c2545cb31055ef7bd90cc1acef0 | 3e6c1b2a99ac5214c86c00eabd645a15de77266d | refs/heads/master | 2021-08-28T11:19:14.433750 | 2017-12-12T03:37:05 | 2017-12-12T03:37:05 | 113,933,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package com.thc.code.services;
import com.thc.code.domain.User;
import com.thc.code.repositories.UserRespository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserService {
@Autowired
UserRespository userRespository;
public User getUserbyUserName(String userName) {
return userRespository.getUserByUserName(userName);
}
public boolean createUser(User user) {
return userRespository.createUser(user);
}
}
| [
"facundocrusta@gmail.com"
] | facundocrusta@gmail.com |
90fe4a7602ba5707a1c330483e3df1c5c4e80638 | 7878907644870f3dc938c090702d3f976f8888ae | /gemini-spring-boot-interview-demo/src/main/java/com/gemini/core/LockSupportDemo.java | df4cf34bdef6655488ddd042ffa051f754ea5576 | [] | no_license | xiaocuizi/demo | defdad53954e3c88d9af82ade114ece2ccea3c7f | 697709e1b890bc9e9dcf66cca62e6c8924a923c0 | refs/heads/master | 2022-12-23T08:17:48.536774 | 2020-04-10T11:33:30 | 2020-04-10T11:33:30 | 194,759,727 | 0 | 0 | null | 2022-12-15T23:54:17 | 2019-07-02T00:22:58 | Java | UTF-8 | Java | false | false | 2,125 | java | package com.gemini.core;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.HashMap;
import java.util.Map;
/**
* @author xiaocuzi
* @version v1.0.0
* @Package com.gemini.test.core
* @classname: LockSupportDemo
* @Description: todo (用一句话描述该文件做什么)
* @date 2019/3/14 12:09
*/
public class LockSupportDemo {
static Object u = new Object();
@org.openjdk.jmh.annotations.Benchmark
public void measureName() {
// System.out.println("hello,world!");
Map<String, String> map = new HashMap<>();
map.put("a", "b");
}
/** main method */
public static void main(String[] args) {
Options opt = new OptionsBuilder()
////benchmark 所在的类的名字,注意这里是使用正则表达式对所有类进行匹配的
.include(LockSupportDemo.class.getSimpleName())
.forks(1)////进行 fork 的次数。如果 fork 数是2的话,则 JMH 会 fork 出两个进程来进行测试
.warmupIterations(5) //预热的迭代次数
.measurementIterations(5) //实际测量的迭代次数
.build();
try {
new Runner(opt).run();
} catch (RunnerException e) {
e.printStackTrace();
}
}
/*public static class ChangeObject extends Thread{
public ChangeObject(String name) {
super(name);
}
public void run(){
//synchronized (u){
System.out.println("in "+getName());
LockSupport.park();
//}
}
}
static ChangeObject t1 = new ChangeObject("T1");
static ChangeObject t2 = new ChangeObject("T2");
public static void main(String[] args) throws InterruptedException {
t1.start();
Thread.sleep(100);
t2.start();
LockSupport.unpark(t1);
*//* LockSupport.unpark(t2);
t1.join();
t2.join();*//*
}*/
}
| [
"cuishang4u@163.com"
] | cuishang4u@163.com |
6708795d65a36e6cc97708f20ba1166101cf23f5 | 18606c6b3f164a935e571932b3356260b493e543 | /benchmarks/xalan/src/org/apache/xpath/operations/Plus.java | 490e88c7b35d07f2fbae21a77eaf82fdf47dbdec | [
"Apache-2.0",
"BSD-2-Clause",
"Apache-1.1"
] | permissive | jackyhaoli/abc | d9a3bd2d4140dd92b9f9d0814eeafa16ea7163c4 | 42071b0dcb91db28d7b7fdcffd062f567a5a1e6c | refs/heads/master | 2020-04-03T09:34:47.612136 | 2019-01-11T07:16:04 | 2019-01-11T07:16:04 | 155,169,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,987 | java | /*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, Lotus
* Development Corporation., http://www.lotus.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.xpath.operations;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.XPathContext;
/**
* The '+' operation expression executer.
*/
public class Plus extends Operation
{
/**
* Apply the operation to two operands, and return the result.
*
*
* @param left non-null reference to the evaluated left operand.
* @param right non-null reference to the evaluated right operand.
*
* @return non-null reference to the XObject that represents the result of the operation.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject operate(XObject left, XObject right)
throws javax.xml.transform.TransformerException
{
return new XNumber(left.num() + right.num());
}
/**
* Evaluate this operation directly to a double.
*
* @param xctxt The runtime execution context.
*
* @return The result of the operation as a double.
*
* @throws javax.xml.transform.TransformerException
*/
public double num(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
return (m_right.num(xctxt) + m_left.num(xctxt));
}
}
| [
"xiemaisi@40514614-586c-40e6-bf05-bf7e477dc3e6"
] | xiemaisi@40514614-586c-40e6-bf05-bf7e477dc3e6 |
282c00ff180699d43a241406697047b9bf418dce | fbd488cc4e418229c3c8e3f2c26650c7cfb25870 | /src/instanceof_use/B.java | d1cffdf359d1766660f9d06461b774468fccea41 | [] | no_license | SvenPowerX-Java/J8_013_io_and_applet | 828e46a8bdeae06b70358848d853633a8a48424e | d70e1c731e9f7274fe5dae4d80829348a13a6275 | refs/heads/master | 2021-08-23T05:14:19.190103 | 2017-12-03T15:18:45 | 2017-12-03T15:18:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 55 | java | package instanceof_use;
public class B {
int i, j;
}
| [
"splaandrey@gmail.com"
] | splaandrey@gmail.com |
a87dce5bb1d97d953e3d1b7c9b0ce5fda91f6b4c | e70c84f9e528cde3b87a01a8517293456b6a160a | /app/src/main/java/com/example/bamproject/EditCardActivity.java | bee629370dc02b6760932750f620a4bf8b815710 | [] | no_license | zwrg/bam-project | 4752ce86bc826b7f56aa8255fdf5bb699cdf5554 | b9d3570085db54c75f069eaa477f4bfeee4c10d7 | refs/heads/master | 2023-05-30T19:34:51.904687 | 2021-05-22T11:56:54 | 2021-05-22T11:56:54 | 368,243,509 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,572 | java | package com.example.bamproject;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;
public class EditCardActivity extends AppCompatActivity {
final String TAG = "Edit Card Activity";
private Card currentCard;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE);
setContentView(R.layout.activity_edit_card);
int cardId = getIntent().getIntExtra("cardUid", 0);
if (cardId == 0) {
// Log.d(TAG, "card id = 0, sth wrong");
throw new Error(TAG + "card id = 0, sth wrong");
}
AppDatabase database = AppDatabase.getInstance(getApplicationContext());
CardDao cardDao = database.cardDao();
new Thread(() -> {
currentCard = cardDao.getCard(cardId);
// Log.d(TAG, currentCard.toString());
runOnUiThread(this::updateView);
}).start();
}
private void updateView() {
EditText cardNameView = findViewById(R.id.card_edit_text_name);
EditText cardNumberView = findViewById(R.id.card_edit_text_number);
EditText cardValidityView = findViewById(R.id.card_edit_text_validity);
EditText cardCvvView = findViewById(R.id.card_edit_text_cvv);
cardNameView.setText(currentCard.cardName);
cardNumberView.setText(currentCard.cardNumber);
cardValidityView.setText(currentCard.cardValidity);
cardCvvView.setText(currentCard.cvv);
}
@RequiresApi(api = Build.VERSION_CODES.M)
public void onSaveHandler(View view) {
clearErrorsView();
EditText cardNameView = findViewById(R.id.card_edit_text_name);
String cardName = cardNameView.getText().toString();
EditText cardNumberView = findViewById(R.id.card_edit_text_number);
String cardNumber = cardNumberView.getText().toString();
EditText cardValidityView = findViewById(R.id.card_edit_text_validity);
String cardValidity = cardValidityView.getText().toString();
EditText cardCvvView = findViewById(R.id.card_edit_text_cvv);
String cardCvv = cardCvvView.getText().toString();
CardValidityEnum addCardError = CardValidator.checkDataValidity(cardName, cardNumber, cardValidity, cardCvv);
if (addCardError == CardValidityEnum.GOOD) {
currentCard.cardName = cardName;
currentCard.cardNumber = cardNumber;
currentCard.cardValidity = cardValidity;
currentCard.cvv = cardCvv;
AppDatabase database = AppDatabase.getInstance(getApplicationContext());
CardDao cardDao = database.cardDao();
// todo add other user ID check
int currentUserId = Preferences.getUserId(getApplicationContext());
if (currentUserId == 0) {
throw new Error("User ID = 0");
}
new Thread(() -> {
cardDao.updateCard(currentCard);
leaveActivity();
}).start();
} else {
showErrorsView(addCardError);
}
}
private void clearErrorsView() {
TextView errorView = findViewById(R.id.card_edit_error);
errorView.setText("");
}
private void showErrorsView(CardValidityEnum registerError) {
String error = "";
switch (registerError) {
case EMPTY_FIELDS:
error = "There are some empty fields";
break;
case WRONG_NUMBER:
error = "Bad Card Number";
break;
case WRONG_VALIDITY:
error = "Bad Validity Format";
break;
case WRONG_CVV:
error = "Bad CVV Number";
break;
default:
error = "";
break;
}
TextView errorView = findViewById(R.id.card_edit_error);
errorView.setText(error);
}
private void leaveActivity() {
Intent intent = new Intent(EditCardActivity.this, HomeActivity.class);
startActivity(intent);
}
public void onCancelHandler(View view) {
finish();
}
} | [
"riper384@gmail.com"
] | riper384@gmail.com |
efac82d16f5eafd4e6c34049177ccb210c84166d | dac1cef4f7c86d3797138dc34953d5b7652dfcc8 | /app/src/main/java/com/chrisahn/popularmovies/FavoriteAdapter.java | 0488f039bd06674e2a55f07df0ab363946f8df0c | [] | no_license | AhnChris/PopularMovies_old | 13ad694c532c2cd2bf533f48e7810492e8d6e645 | 916c7cd2ac722a52ab492f7d92f3acb1544916fd | refs/heads/master | 2021-01-18T19:03:30.006335 | 2016-03-21T06:39:54 | 2016-03-21T06:39:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,415 | java | package com.chrisahn.popularmovies;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.ImageView;
import com.chrisahn.popularmovies.data.FavoriteColumns;
import com.squareup.picasso.Picasso;
public class FavoriteAdapter extends CursorAdapter {
private final String LOG_TAG = FavoriteAdapter.class.getSimpleName();
public FavoriteAdapter(Context context, Cursor c, int flags) {
super(context, c, flags);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
ImageView imageView = new ImageView(context);
imageView.setAdjustViewBounds(true);
imageView.setPadding(0, 0, 0, 0);
return imageView;
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
String BASE_IMG_URL = "http://image.tmdb.org/t/p/w185/";
Uri uri = Uri.parse(BASE_IMG_URL).buildUpon()
.appendEncodedPath(cursor.getString(cursor.getColumnIndex(FavoriteColumns.POSTER_PATH)))
.build();
String url = uri.toString();
Log.v(LOG_TAG, "Favorite URL with Picasso: " + url);
Picasso.with(context).load(url).error(R.drawable.error_image2).into((ImageView) view);
}
}
| [
"ahn.chris1@gmail.com"
] | ahn.chris1@gmail.com |
0819742d4fceeda497894758ff66cf1d59adc592 | 9c3562103721cb438fed5ba7696eeb372d027a3f | /src/fr/vincentteam/vtgl/fonts/VTGLFont.java | 6b3b9741841f2e64e9b825c34dcab24653d43d99 | [] | no_license | gaston147/VTGL | d5a9a8cd69273507601577f1682c4b0cf297641d | 46c2cad146d60ad6033062b3766a756a4d3fcee4 | refs/heads/master | 2021-01-25T05:28:10.557020 | 2014-07-06T18:09:29 | 2014-07-06T18:09:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package fr.vincentteam.vtgl.fonts;
import fr.vincentteam.vtgl.bitmaps.Bitmap;
public interface VTGLFont {
public Bitmap getCharacter(char c);
public int getLineHeight();
public int getWidth(String str);
public void drawString(Bitmap bitmap, int x, int y, String str);
}
| [
"mrgaston147@gmail.com"
] | mrgaston147@gmail.com |
d60a3acc25061be64343e4e1bd296fc4b4076787 | e5488dea88f1036ac9fbb61816bae69d70a9d763 | /core/cdi-injection-point/src/main/java/org/agoncal/fascicle/quarkus/core/cdi/injectionpoint/IsbnGenerator.java | be0455ccf051edc4167c08bff2068d8d5a7f6e34 | [
"MIT"
] | permissive | fg78nc/agoncal-fascicle-quarkus | 1572eb5aeaddda11708c3ea3d2f4fd1474295323 | 5a62b42d4e246a279eb188f6f1c09c02e0e85b8b | refs/heads/master | 2023-01-12T18:28:19.834971 | 2020-11-09T13:46:37 | 2020-11-09T13:46:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package org.agoncal.fascicle.quarkus.core.cdi.injectionpoint;
import javax.enterprise.context.ApplicationScoped;
import java.util.Random;
/**
* @author Antonio Goncalves
* http://www.antoniogoncalves.org
* --
*/
// tag::adocSnippet[]
@ApplicationScoped
public class IsbnGenerator implements NumberGenerator {
public String generateNumber() {
return "13-84356-" + Math.abs(new Random().nextInt());
}
}
// end::adocSnippet[]
| [
"antonio.goncalves@gmail.com"
] | antonio.goncalves@gmail.com |
8894fb5d794b2b03c06dbbaf614415eaca11db1e | b0449f253ddac1228a8e64f26ceded5347d6d1af | /1-algorithm/13-leetcode/java/src/buildingblock/table/alphabet/lc383_ransomnote/Solution.java | 597b861d4d49289186951b52f09efbb97c5a55c2 | [
"MIT"
] | permissive | cdai/interview | c03f64442b48cb8af0658642633d0118295a788d | d2dfffb707eb32ee83ed9caecce5a4dce976ccb7 | refs/heads/master | 2020-05-21T16:46:04.313493 | 2017-05-13T20:13:06 | 2017-05-13T20:13:06 | 60,381,799 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,288 | java | package buildingblock.table.alphabet.lc383_ransomnote;
/**
* Given
an
arbitrary
ransom
note
string
and
another
string
containing
letters from
all
the
magazines,
* write
a
function
that
will
return
true
if
the
ransom
note
can
be
constructed
from
the
magazines ;
* otherwise,
it
will
return
false.
Each
letter
in
the
magazine
string
can
only
be
used
once
in
your
ransom
note.
* Note: You may assume that both strings contain only lowercase letters.
* canConstruct("a", "b") -> false
* canConstruct("aa", "ab") -> false
* canConstruct("aa", "aab") -> true
*/
public class Solution {
// Test case: [],[] [a],[] [],[a] [abc],[a] [ab],[abc] [abb],[bacb]
public boolean canConstruct(String ransom, String magazine) {
if (ransom.isEmpty() || magazine.isEmpty()) return ransom.isEmpty();
if (ransom.length() > magazine.length()) return false;
int[] diff = new int[26];
for (int i = 0; i < magazine.length(); i++) {
diff[magazine.charAt(i) - 'a']++;
}
for (int i = 0; i < ransom.length(); i++) {
if (--diff[ransom.charAt(i) - 'a'] < 0) return false;
}
return true;
}
// Simplify: remove last one loop
public boolean canConstruct1(String ransomNote, String magazine) {
int[] letters = new int[26];
for (char c : magazine.toCharArray()) {
letters[c - 'a']++;
}
for (char c : ransomNote.toCharArray()) {
if (--letters[c - 'a'] < 0) {
return false;
}
}
return true;
}
// My 1AC
public boolean canConstruct12(String ransomNote, String magazine) {
if (ransomNote.length() > magazine.length()) {
return false;
}
int[] letters = new int[26];
for (char c : magazine.toCharArray()) {
letters[c - 'a']++;
}
for (char c : ransomNote.toCharArray()) {
letters[c - 'a']--;
}
for (int letter : letters) {
if (letter < 0) {
return false;
}
}
return true;
}
}
| [
"dc_726@163.com"
] | dc_726@163.com |
a83451bce0f1a3c50c8af0f25094f70f49b82d33 | 9c1466a41541cae6413c8d546407bab74b118f72 | /app/src/main/java/com/example/higooo/tarhil/WalkingFragment.java | 23a62d6fdfb268ba0352210f503f5d3832e60711 | [] | no_license | NazarAmin/Tarhil | 7c4396b340db1d4ada8cad129d22eb94b18c5814 | 26a3e31a793ef64551cd379315857b5cad994248 | refs/heads/master | 2020-05-05T02:12:24.183186 | 2019-04-05T06:19:29 | 2019-04-05T06:19:29 | 179,629,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,829 | java | package com.example.higooo.tarhil;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.zip.Inflater;
import static java.lang.Math.round;
public class WalkingFragment extends Fragment implements OnMapReadyCallback, LocationListener {
private static final String TAG = "WalkingFragment";
private GoogleMap mMap;
private static final String FINE_LOCATION = Manifest.permission.ACCESS_FINE_LOCATION;
private static final String COARSE_LOCATION = Manifest.permission.ACCESS_COARSE_LOCATION;
private static final int LOCATIONPERMISSIONCODE = 1234;
LatLng latLng;
private boolean track = false;
private boolean locationpermissionsgranted = false;
private FusedLocationProviderClient mFusedLocationClient;
Button btn;
public String dd;
Button start;
Button end;
boolean online = false;
TextView Average;
TextView Distance;
TextView Maximum;
TextView Blank, OnRide, paused;
TextView Dur;
TextView Durend;
Button History;
ArrayList<Float> arrayList = new ArrayList <Float>();
ArrayList <Location> distances = new ArrayList<Location>();
ArrayList <Float> meters = new ArrayList<>();
int index = 0;
Timer timer =new Timer();
Date currentTime;
FirebaseDatabase database;
private DatabaseReference reference;
static final int GPS_REQUEST = 100;
// ..
Bitmap bitmap;
@SuppressLint("MissingPermission")
@Nullable
// @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.walking,container,false);
getlocationpermission();
database = FirebaseDatabase.getInstance();
reference = database.getReference("Data_Work");
//Animation animfadein = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.blink);
//animfadein.start();
/** reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for Receiving Configuration
UserLocation user = new UserLocation();
double lo = dataSnapshot.child("Nazar").getValue(UserLocation.class).getLongi();
double la = dataSnapshot.child("Nazar").getValue(UserLocation.class).getLatti();
latLng = new LatLng(la,lo);
mMap.clear();
MarkerOptions marker = new MarkerOptions().position(latLng);
mMap.addMarker(new MarkerOptions().position(latLng).title("Member Location"));
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.dot));
mMap.addMarker(marker);
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
*/
History = (Button) view.findViewById(R.id.listH);
Average = (TextView) view.findViewById(R.id.avg);
Distance = (TextView) view.findViewById(R.id.dis);
Maximum = (TextView) view.findViewById(R.id.msp);
Dur = (TextView) view.findViewById(R.id.dur);
Durend = (TextView) view.findViewById(R.id.ende);
Blank = (TextView) view.findViewById(R.id.blank);
OnRide = (TextView) view.findViewById(R.id.onride);
paused = (TextView) view.findViewById(R.id.Paused);
btn = (Button) view.findViewById(R.id.full);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getContext(),Main2Activity.class);
startActivity(i);
}
});
LocationManager lm = (LocationManager) getContext().getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0, (LocationListener) this);
this.onLocationChanged(null);
// SupportMapFragment mapFragment = (SupportMapFragment) getFragmentManager()
// .findFragmentById(R.id.mapw);
// mapFragment.getMapAsync( this);
start = (Button) view.findViewById(R.id.trip);
start.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
track = true;
arrayList.clear();
distances.clear();
boolean online = true;
currentTime = Calendar.getInstance().getTime();
OnRide.setVisibility(View.VISIBLE);
Toast.makeText(getContext(),"Trip Started",Toast.LENGTH_LONG).show();
}
});
end = (Button) view.findViewById(R.id.reset);
end.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
online = false;
track = false;
OnRide.setVisibility(View.INVISIBLE);
paused.setVisibility(View.VISIBLE);
float num = 0;
// float de = 0;
float max = 0;
float tot;
for(float s: arrayList){
num = num + s;
if (max < s){
max = s;
}
}
tot = num/arrayList.size();
int ig = round(tot);
float totDis = 0;
for(int po = 0; po< distances.size()-1; po++){
meters.add(distances.get(po).distanceTo(distances.get(po+1)));
}
for (Float q: meters){
totDis = totDis + q;
}
Average.setText(String.valueOf(ig));
Maximum.setText(String.valueOf(round(max)));
Distance.setText(String.valueOf(round(totDis)));
Dur.setText((CharSequence) currentTime.toString());
Durend.setText((CharSequence) Calendar.getInstance().getTime().toString());
arrayList.clear();
distances.clear();
totDis = 0;
int id = 1;
int avg2 = Integer.parseInt(Average.getText().toString());
int max2 = Integer.parseInt(Maximum.getText().toString());
int dis2 = Integer.parseInt(Distance.getText().toString());
String Start = Dur.getText().toString();
String end = Durend.getText().toString();
Trip employee = new Trip(id,avg2,max2,dis2,Start,end);
SQLHelperClass db = new SQLHelperClass(getContext());
db.addEmployee(employee);
Toast.makeText(getContext(),"Trip added succesfully",Toast.LENGTH_LONG).show();
}
});
History.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent IR = new Intent(getContext(),All_Trips.class);
startActivity(IR);
}
});
return view;
}
private void getDeviceLocation() {
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(getContext());
try {
if (locationpermissionsgranted) {
final Task location = mFusedLocationClient.getLastLocation();
location.addOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(@NonNull Task task) {
if (task.isSuccessful()) {
Location currentLocation = (Location) task.getResult();
MoveCamera(new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()), 5f);
Toast.makeText(getContext(), "Location Found OK", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getContext(), "Location Not Found", Toast.LENGTH_LONG).show();
}
}
});
}
} catch (SecurityException e) {
}
}
private void MoveCamera(LatLng latLng, float zoom) {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom));
}
private void getlocationpermission() {
String[] permissions = {android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_COARSE_LOCATION};
if (ContextCompat.checkSelfPermission(this.getContext(), FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
if (ContextCompat.checkSelfPermission(this.getContext(), COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
locationpermissionsgranted = true;
} else {
ActivityCompat.requestPermissions((Activity) getContext(), permissions, LOCATIONPERMISSIONCODE);
}
} else {
ActivityCompat.requestPermissions((Activity) getContext(), permissions, LOCATIONPERMISSIONCODE);
}
;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
locationpermissionsgranted = false;
getlocationpermission();
switch (requestCode) {
case LOCATIONPERMISSIONCODE: {
if (grantResults.length > 0) {
for (int i = 0; i < grantResults.length; i++) {
if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
locationpermissionsgranted = false;
return;
}
locationpermissionsgranted = true;
// database = FirebaseDatabase.getInstance();
//reference = database.getReference("Locations");
initMap();
}
}
}
}
}
protected void createLocationRequest() {
LocationRequest mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(10000);
mLocationRequest.setFastestInterval(5000);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
private void initMap() {
SupportMapFragment mapFragment = (SupportMapFragment) getFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync((OnMapReadyCallback) getContext());
}
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
if (locationpermissionsgranted) {
getDeviceLocation();
if (ActivityCompat.checkSelfPermission(getContext(), android.Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission
(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
mMap.setMyLocationEnabled(true);
mMap.setTrafficEnabled(true);
mMap.getUiSettings().setCompassEnabled(true);
}
}
@Override
public void onLocationChanged(Location location) {
// String id = reference.push().getKey();
// UserLocation userLocation = new UserLocation(id,"Nazar", location.getLongitude(), location.getLatitude());
// UserLocation userLocation = new UserLocation(id,"Nazar", 10.6, 30.335);
//double lattiude = location.getLatitude();
//String rtu = "Nazar";
// UserLocation userLocation = new UserLocation(15.3, 30.55);
// reference.child(rtu);
// reference.setValue("try this");
// Toast.makeText(WalkingFragment.this,String.valueOf(longit),Toast.LENGTH_SHORT).show();
// TextView txt = (TextView) getView().findViewById(R.id.speed);
if(location == null)
{
// txt.setText("0");
// dis.setText("0 m");
}
else
{
Location locationA = new Location("PointA");
locationA.setLatitude(location.getLatitude());
locationA.setLongitude(location.getLongitude());
distances.add(locationA);
if (track) {
latLng = new LatLng(location.getLatitude(),location.getLongitude());
MarkerOptions marker = new MarkerOptions().position(latLng);
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.dot));
mMap.addMarker(marker);
UserLocation userlocation = new UserLocation(location.getLongitude(), location.getLatitude());
reference.child("Nazar").setValue(userlocation);
}
// index = index + 1;
float cs = location.getSpeed();
float csd = (float) (cs * 3.6);
int speed2 = Math.round(csd);
dd = String.valueOf(speed2);
// txt.setText(dd);
arrayList.add(csd);
String id = reference.push().getKey();
UserLocation userLocation = new UserLocation(id,"Nazar", locationA.getLongitude(), locationA.getLatitude());
reference.child(id).setValue(userLocation);
// dis.setText(String.valueOf(Math.round(location.getAltitude())) + " m");
}
}
@Override
public void onStatusChanged(String s, int i, Bundle bundle) {
}
@Override
public void onProviderEnabled(String s) {
}
@Override
public void onProviderDisabled(String s) {
}
}
| [
"nazaramin72@gmail.com"
] | nazaramin72@gmail.com |
d52ec1a138e6a2af0326104f37456e3fa3dcc91a | 017ceb8b046e7bf506ab99c2141a2dac320bbc03 | /packages/SettingsLib/tests/robotests/src/com/android/settingslib/notification/EnableZenModeDialogTest.java | ccd2f538c731632be1c0c679ecccd839598662dc | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | MoKee/android_frameworks_base | 76e5c49286c410592f61999022afffeb18350bf3 | e1938150d35b241ff1b14752a084be74415c06a9 | refs/heads/mkp | 2023-01-07T00:46:20.820046 | 2021-07-30T16:00:28 | 2021-07-30T16:00:28 | 9,896,797 | 38 | 88 | NOASSERTION | 2020-12-06T18:22:34 | 2013-05-06T20:59:57 | Java | UTF-8 | Java | false | false | 8,240 | java | /*
* Copyright (C) 2018 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.settingslib.notification;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import android.app.Fragment;
import android.app.NotificationManager;
import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import android.service.notification.Condition;
import android.view.LayoutInflater;
import com.android.settingslib.SettingsLibRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
@RunWith(SettingsLibRobolectricTestRunner.class)
public class EnableZenModeDialogTest {
private EnableZenModeDialog mController;
@Mock
private Context mContext;
@Mock
private Resources mResources;
@Mock
private Fragment mFragment;
@Mock
private NotificationManager mNotificationManager;
private Context mShadowContext;
private LayoutInflater mLayoutInflater;
private Condition mCountdownCondition;
private Condition mAlarmCondition;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mShadowContext = RuntimeEnvironment.application;
when(mContext.getApplicationContext()).thenReturn(mContext);
when(mContext.getResources()).thenReturn(mResources);
when(mFragment.getContext()).thenReturn(mShadowContext);
mLayoutInflater = LayoutInflater.from(mShadowContext);
mController = spy(new EnableZenModeDialog(mContext));
mController.mContext = mContext;
mController.mLayoutInflater = mLayoutInflater;
mController.mForeverId = Condition.newId(mContext).appendPath("forever").build();
when(mContext.getString(com.android.internal.R.string.zen_mode_forever))
.thenReturn("testSummary");
NotificationManager.Policy alarmsEnabledPolicy = new NotificationManager.Policy(
NotificationManager.Policy.PRIORITY_CATEGORY_ALARMS, 0, 0, 0);
doReturn(alarmsEnabledPolicy).when(mNotificationManager).getNotificationPolicy();
mController.mNotificationManager = mNotificationManager;
mController.getContentView();
// these methods use static calls to ZenModeConfig which would normally fail in robotests,
// so instead do nothing:
doNothing().when(mController).bindGenericCountdown();
doReturn(null).when(mController).getTimeUntilNextAlarmCondition();
doReturn(0L).when(mController).getNextAlarm();
doNothing().when(mController).bindNextAlarm(any());
// as a result of doing nothing above, must bind manually:
Uri alarm = Condition.newId(mContext).appendPath("alarm").build();
mAlarmCondition = new Condition(alarm, "alarm", "", "", 0, 0, 0);
Uri countdown = Condition.newId(mContext).appendPath("countdown").build();
mCountdownCondition = new Condition(countdown, "countdown", "", "", 0, 0, 0);
mController.bind(mCountdownCondition,
mController.mZenRadioGroupContent.getChildAt(
EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX),
EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX);
mController.bind(mAlarmCondition,
mController.mZenRadioGroupContent.getChildAt(
EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX),
EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX);
}
@Test
public void testForeverChecked() {
mController.bindConditions(mController.forever());
assertTrue(mController.getConditionTagAt(EnableZenModeDialog.FOREVER_CONDITION_INDEX).rb
.isChecked());
assertFalse(mController.getConditionTagAt(EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX).rb
.isChecked());
assertFalse(mController.getConditionTagAt(
EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX).rb.isChecked());
}
@Test
public void testNoneChecked() {
mController.bindConditions(null);
assertFalse(mController.getConditionTagAt(EnableZenModeDialog.FOREVER_CONDITION_INDEX).rb
.isChecked());
assertFalse(mController.getConditionTagAt(EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX).rb
.isChecked());
assertFalse(mController.getConditionTagAt(
EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX).rb.isChecked());
}
@Test
public void testAlarmChecked() {
doReturn(false).when(mController).isCountdown(mAlarmCondition);
doReturn(true).when(mController).isAlarm(mAlarmCondition);
mController.bindConditions(mAlarmCondition);
assertFalse(mController.getConditionTagAt(EnableZenModeDialog.FOREVER_CONDITION_INDEX).rb
.isChecked());
assertFalse(mController.getConditionTagAt(EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX).rb
.isChecked());
assertTrue(mController.getConditionTagAt(
EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX).rb.isChecked());
}
@Test
public void testCountdownChecked() {
doReturn(false).when(mController).isAlarm(mCountdownCondition);
doReturn(true).when(mController).isCountdown(mCountdownCondition);
mController.bindConditions(mCountdownCondition);
assertFalse(mController.getConditionTagAt(EnableZenModeDialog.FOREVER_CONDITION_INDEX).rb
.isChecked());
assertTrue(mController.getConditionTagAt(EnableZenModeDialog.COUNTDOWN_CONDITION_INDEX).rb
.isChecked());
assertFalse(mController.getConditionTagAt(
EnableZenModeDialog.COUNTDOWN_ALARM_CONDITION_INDEX).rb.isChecked());
}
@Test
public void testNoAlarmWarning() {
// setup alarm
long now = System.currentTimeMillis();
doReturn(now + 100000).when(mController).getNextAlarm();
doReturn("").when(mController).getTime(anyLong(), anyLong());
// allow alarms
when(mNotificationManager.getNotificationPolicy()).thenReturn(
new NotificationManager.Policy(
NotificationManager.Policy.PRIORITY_CATEGORY_ALARMS, 0, 0, 0));
// alarm warning should be null
assertNull(mController.computeAlarmWarningText(null));
}
@Test
public void testAlarmWarning() {
// setup alarm
long now = System.currentTimeMillis();
doReturn(now + 1000000).when(mController).getNextAlarm();
doReturn("").when(mController).getTime(anyLong(), anyLong());
// don't allow alarms to bypass dnd
when(mNotificationManager.getNotificationPolicy()).thenReturn(
new NotificationManager.Policy(0, 0, 0, 0));
// return a string if mResources is asked to retrieve a string
when(mResources.getString(anyInt(), anyString())).thenReturn("");
// alarm warning should NOT be null
assertNotNull(mController.computeAlarmWarningText(null));
}
} | [
"beverlyt@google.com"
] | beverlyt@google.com |
ba24fec0a1487b8a815cebaff526135b51e98dcd | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-14152-5-20-PESA_II-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/store/hibernate/query/HqlQueryExecutor_ESTest_scaffolding.java | 745afea904d5190b4f044c8635fe2f4366837a44 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,784 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Apr 02 13:28:31 UTC 2020
*/
package com.xpn.xwiki.store.hibernate.query;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import static org.evosuite.shaded.org.mockito.Mockito.*;
@EvoSuiteClassExclude
public class HqlQueryExecutor_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "com.xpn.xwiki.store.hibernate.query.HqlQueryExecutor";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {}
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(HqlQueryExecutor_ESTest_scaffolding.class.getClassLoader() ,
"com.xpn.xwiki.XWikiException",
"org.xwiki.security.authorization.Right",
"org.xwiki.component.phase.Initializable",
"org.xwiki.query.QueryException",
"org.xwiki.query.QueryFilter",
"org.xwiki.query.Query",
"org.xwiki.query.internal.CountDocumentFilter",
"org.xwiki.component.annotation.Component",
"org.xwiki.model.reference.EntityReference",
"org.hibernate.Session",
"com.xpn.xwiki.store.XWikiStoreInterface",
"org.xwiki.security.authorization.RightDescription",
"org.xwiki.component.phase.InitializationException",
"org.xwiki.security.authorization.ContextualAuthorizationManager",
"com.xpn.xwiki.store.hibernate.query.HqlQueryExecutor",
"org.xwiki.query.internal.AbstractQueryFilter",
"org.xwiki.component.annotation.Role",
"org.xwiki.query.internal.DefaultQuery",
"org.hibernate.Query",
"org.xwiki.query.SecureQuery",
"com.xpn.xwiki.store.XWikiHibernateBaseStore$HibernateCallback",
"org.xwiki.context.Execution",
"org.xwiki.query.QueryExecutor",
"com.xpn.xwiki.store.XWikiHibernateStore",
"org.xwiki.security.authorization.AuthorizationException",
"com.xpn.xwiki.store.hibernate.HibernateSessionFactory",
"org.xwiki.security.authorization.AccessDeniedException",
"com.xpn.xwiki.XWikiContext",
"com.xpn.xwiki.store.XWikiHibernateBaseStore",
"org.xwiki.job.event.status.JobProgressManager"
);
}
private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException {
mock(Class.forName("org.xwiki.security.authorization.ContextualAuthorizationManager", false, HqlQueryExecutor_ESTest_scaffolding.class.getClassLoader()));
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
9daae451ad74d0f5353600a058b536042c8bc8a0 | d8ad177ec206a562da10a6249e2a677c604a79b0 | /src/factory/method/e2/TVFactory.java | 675bc722c8dbedbe10533d1149d7ed00b9e3f6b1 | [] | no_license | xxxknight/DesignPattern | 503d28750f6f0c857fdf3fac7282311a84742bc5 | 25bac2b0729c85af53fa1d24bfb81e24b5642cce | refs/heads/master | 2021-06-02T18:10:53.583495 | 2017-10-14T08:32:10 | 2017-10-14T08:32:10 | 32,872,999 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 87 | java | package factory.method.e2;
public interface TVFactory {
abstract TV produce();
} | [
"shiyang.xsy@alibaba-inc.com"
] | shiyang.xsy@alibaba-inc.com |
159a2511a6e37760df1c93ef4fe383363c8152fe | de1699eb5da2a4966c92497d0e363b0ab3f586f3 | /mvc-console/src/main/java/com/mvc/console/mapper/RefundApplicationMapper.java | 98cb5cd5d45d82fc99506164cd20194a09299d72 | [] | no_license | ethands/lock-plat | c9d12d8ea1cad6d76629f5ff579c0feb801be9b6 | 1e5e1cee8b20192f22669fb5f5006d7216e79eda | refs/heads/master | 2021-05-02T14:04:20.181338 | 2018-01-19T14:29:36 | 2018-01-19T14:29:36 | 120,712,425 | 1 | 0 | null | 2018-02-08T04:50:01 | 2018-02-08T04:50:01 | null | UTF-8 | Java | false | false | 236 | java | package com.mvc.console.mapper;
import com.mvc.common.biz.BaseBiz;
import com.mvc.console.entity.RefundApplication;
import tk.mybatis.mapper.common.Mapper;
public interface RefundApplicationMapper extends Mapper<RefundApplication>{
} | [
"blockslimited@163.com"
] | blockslimited@163.com |
bc0c0b51db63c7a5c22b6b1d3310df83a5342387 | 4688d19282b2b3b46fc7911d5d67eac0e87bbe24 | /aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/transform/DescribePatchBaselinesResultJsonUnmarshaller.java | 25ce250e4cd7d2a1a4578586325cd211b91e84e7 | [
"Apache-2.0"
] | permissive | emilva/aws-sdk-java | c123009b816963a8dc86469405b7e687602579ba | 8fdbdbacdb289fdc0ede057015722b8f7a0d89dc | refs/heads/master | 2021-05-13T17:39:35.101322 | 2018-12-12T13:11:42 | 2018-12-12T13:11:42 | 116,821,450 | 1 | 0 | Apache-2.0 | 2018-09-19T04:17:41 | 2018-01-09T13:45:39 | Java | UTF-8 | Java | false | false | 3,309 | java | /*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.simplesystemsmanagement.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.simplesystemsmanagement.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* DescribePatchBaselinesResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribePatchBaselinesResultJsonUnmarshaller implements Unmarshaller<DescribePatchBaselinesResult, JsonUnmarshallerContext> {
public DescribePatchBaselinesResult unmarshall(JsonUnmarshallerContext context) throws Exception {
DescribePatchBaselinesResult describePatchBaselinesResult = new DescribePatchBaselinesResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return describePatchBaselinesResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("BaselineIdentities", targetDepth)) {
context.nextToken();
describePatchBaselinesResult.setBaselineIdentities(new ListUnmarshaller<PatchBaselineIdentity>(PatchBaselineIdentityJsonUnmarshaller
.getInstance()).unmarshall(context));
}
if (context.testExpression("NextToken", targetDepth)) {
context.nextToken();
describePatchBaselinesResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return describePatchBaselinesResult;
}
private static DescribePatchBaselinesResultJsonUnmarshaller instance;
public static DescribePatchBaselinesResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new DescribePatchBaselinesResultJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
d4e7b7aecd43cd1a8179d568f7c4469e0b66caaf | a6cc78e2c4be520291a31a0a8126c99972830074 | /Demo/src/main/java/sdk/moon/com/moonsdk/adapter/MLoopAdapter.java | 0f0afa413e4caca2886d35156e5e0a4f729ff43f | [] | no_license | jxxfzgy/MoonSDK | cc101aed252d445213fd8acfbc8e84255c117cec | 8ac926e1cd62dc0aecea9d9087c33e71867934f4 | refs/heads/master | 2021-01-23T18:10:40.393903 | 2015-01-11T11:30:18 | 2015-01-11T11:30:18 | 25,164,588 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | package sdk.moon.com.moonsdk.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import java.util.List;
import sdk.moon.com.moonsdk.R;
import sdk.moon.com.moonsdk.abst.MBaseViewAdapter;
import sdk.moon.com.moonsdk.entity.MLoopViewBean;
/**
* Created by Administrator on 2014/10/14 0014.
*/
public class MLoopAdapter extends MBaseViewAdapter<MLoopViewBean> {
public MLoopAdapter(Context context, List list) {
super(context, list);
}
@Override
public View createView(LayoutInflater inflater) {
View view = inflater.inflate(R.layout.viewpager_loop_item, null) ;
return view;
}
@Override
public void showData(View view ,int position) {
ImageView imageView = findView(view,R.id.item_loop_img) ;
imageView.setImageResource(getItem(position).drawableId);
}
}
| [
"guangyanzhong@163.com"
] | guangyanzhong@163.com |
a324be50e7273a4e1ef894bf15055b2b2c73af7f | a85d2dccd5eab048b22b2d66a0c9b8a3fba4d6c2 | /rebellion_h5_realm/java/l2r/gameserver/listener/actor/OnReviveListener.java | 513abc4e747bc70ec0186f84cb0bb7e577187ea9 | [] | no_license | netvirus/reb_h5_storm | 96d29bf16c9068f4d65311f3d93c8794737d4f4e | 861f7845e1851eb3c22d2a48135ee88f3dd36f5c | refs/heads/master | 2023-04-11T18:23:59.957180 | 2021-04-18T02:53:10 | 2021-04-18T02:53:10 | 252,070,605 | 0 | 0 | null | 2021-04-18T02:53:11 | 2020-04-01T04:19:39 | HTML | UTF-8 | Java | false | false | 261 | java | package l2r.gameserver.listener.actor;
import l2r.gameserver.listener.CharListener;
import l2r.gameserver.model.Creature;
/**
* @author VISTALL
*/
public interface OnReviveListener extends CharListener
{
public void onRevive(Creature actor);
}
| [
"l2agedev@gmail.com"
] | l2agedev@gmail.com |
06c6e33a42f410c456ce989035205d5438274d5f | 80c8a6af7f49ad6976336036934265bca52ee85a | /jeeweb-mybatis/src/main/java/cn/jeeweb/core/database/dynamic/dao/DynamicDBDao.java | 5c37f4d900478832b5ff9635ea3623c7b0cd5a4a | [
"MIT"
] | permissive | hanksxu2017/teach_go_web | 65c382aace1b6cc5d986c483dd528141c3799dbf | 986a4e272b19e44cd6bf3d1a04946f9925cfd8a2 | refs/heads/master | 2020-03-15T04:49:29.963473 | 2018-11-14T14:03:43 | 2018-11-14T14:03:43 | 131,974,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,589 | java | package cn.jeeweb.core.database.dynamic.dao;
import java.util.List;
import java.util.Map;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.jdbc.core.JdbcTemplate;
/**
*
* All rights Reserved, Designed By www.jeeweb.cn
*
* @title: DynamicDBDao.java
* @package cn.jeeweb.core.database.dynamic.dao
* @description: 多数据源到层
* @author: admin
* @date: 2017年5月10日 上午11:41:13
* @version V1.0
* @copyright: 2017 www.jeeweb.cn Inc. All rights reserved.
*
*/
public class DynamicDBDao {
private JdbcTemplate jdbcTemplate;
public DynamicDBDao() {
}
public DynamicDBDao(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
/**
*
* @title: getJdbcTemplate
* @description:不滿足方便获取操作
* @return
* @return: JdbcTemplate
*/
public JdbcTemplate getJdbcTemplate() {
return jdbcTemplate;
}
public void initJdbcTemplate(BasicDataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public List<Map<String, Object>> queryList(String sql, Object... param) {
List<Map<String, Object>> list;
if (ArrayUtils.isEmpty(param)) {
list = jdbcTemplate.queryForList(sql);
} else {
list = jdbcTemplate.queryForList(sql, param);
}
return list;
}
public <T> List<T> queryList(String sql, Class<T> clazz, Object... param) {
List<T> list;
if (ArrayUtils.isEmpty(param)) {
list = jdbcTemplate.queryForList(sql, clazz);
} else {
list = jdbcTemplate.queryForList(sql, clazz, param);
}
return list;
}
}
| [
"335334851@qq.com"
] | 335334851@qq.com |
8342caaf888e86e86ee4e0e5313621d3bf8c7c0c | f507f6bcf05ebf9ef6aad3f92efacc9044c80f7c | /src/main/java/com/expertzlab/yieldmanagement/fileutils/PriceRandomizer.java | abbd0a9a2e32626312c45b4513271c977356e5c9 | [] | no_license | genexpertz/yieldmanagement | 915ccd62764faf22e1e5e7d4b4fe1aec40745a31 | 5fd568246ddd103a7f58ed433fd7f64b9242537d | refs/heads/master | 2021-09-07T11:39:36.625578 | 2018-02-22T12:25:21 | 2018-02-22T12:25:21 | 103,485,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 688 | java | package com.expertzlab.yieldmanagement.fileutils;
import java.util.Random;
/**
* Created by gireeshbabu on 26/09/17.
*/
public class PriceRandomizer {
int maxOwnerPrice = 15000;
int threshodForCompProp = 2000;
Random random = new Random(15000);
public PriceRandomizer(){
}
public int getOwnerPrice(){
return random.nextInt(maxOwnerPrice);
}
public int getCompPropPrice(int owerPrice){
int posORneg = (Math.random() < .5) ? -1 : 1;
int newprice = owerPrice + posORneg * random.nextInt(threshodForCompProp);
if(newprice < 0){
newprice = newprice * -1 + 2000;
}
return newprice;
}
}
| [
"gireesh.babu@nibodha.com"
] | gireesh.babu@nibodha.com |
0309a9bac39711d79ccaa2f68e9f6ef5cb45e60e | 07d3d970419e7d78c072508c9dc8dafc05f7c1ac | /java/grasp/Player.java | 7b8cb9a47155949f4e057d98d2bad8812cda0381 | [] | no_license | arthurTemporim/design_patterns | 4a8308e85f00faa91ed36d58220ba7d4494acb31 | 63099a1827aaff44c790370a059468eccd7a6aa0 | refs/heads/master | 2020-11-29T15:07:00.829402 | 2017-04-07T18:13:40 | 2017-04-07T18:13:40 | 87,491,465 | 0 | 1 | null | 2019-04-14T21:12:31 | 2017-04-07T01:31:19 | Java | UTF-8 | Java | false | false | 202 | java | public class Player {
private String name;
public Player(String name) {
setName(name);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"arthurrtl@gmail.com"
] | arthurrtl@gmail.com |
6481f785615d33efaa0397c5f7ed4beeddffbdbb | 5f75fa1ea11752435ae023bf197a30aaef531385 | /demo-2/src/test/java/com/gaurav/Demo2ApplicationTests.java | 4d7be9082bbed7cd70fa2502ba67770afead88cf | [] | no_license | kesagaurav/spring-boot | 4d3acf7fbefaa1318f129b9fb23972c19c7306a4 | 2981e9353c7191958484a0328ad2ac9ff85eb2f9 | refs/heads/master | 2023-08-18T09:32:55.533272 | 2021-10-19T22:25:22 | 2021-10-19T22:25:22 | 418,873,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package com.gaurav;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class Demo2ApplicationTests {
@Test
void contextLoads() {
}
}
| [
"kesagaurav@gmail.com"
] | kesagaurav@gmail.com |
4b8da17c762badf40151d9ccfa82c4eb1dd99d2b | ec385ccc5b07248b9ae2c3841d49c6fe063889d6 | /src/main/java/com/freedy/principles/openClose/AbstractSkin.java | 06abca8fb3a86c27e0c28825806e905db8d34d45 | [] | no_license | Freedy001/design-pattern | 40b7c6d783396edb1c07b023d5a40d250ad97bc9 | a45c55ee1705857565e5039cb0e4387684335167 | refs/heads/master | 2023-05-31T15:08:09.122711 | 2021-07-13T02:48:20 | 2021-07-13T02:48:20 | 378,608,168 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 167 | java | package com.freedy.principles.openClose;
/**
* @author Freedy
* @date 2021/6/6 22:43
*/
public abstract class AbstractSkin {
public abstract void display();
}
| [
"985948228@qq.com"
] | 985948228@qq.com |
79999bc52d7b26b5aa57f678a3e145aed63d3e4f | d8d3f3982c522440a6de8ad475ff50b86c4840e7 | /src/main/java/io/vertx/guides/wiki/database/SqlQuery.java | 7892b02bced7fb1b78c6fc6857b992b8a2d63844 | [] | no_license | ryanthames/vertx-wiki-tutorial | 2ff68933e7cec1755e1d35e7870ba4fc4d118d1f | f2ff0707e851b648fd93312ff7ab3f2e671ed76c | refs/heads/master | 2021-07-08T11:30:48.846693 | 2017-10-05T01:16:38 | 2017-10-05T01:16:38 | 105,482,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 183 | java | package io.vertx.guides.wiki.database;
enum SqlQuery {
CREATE_PAGES_TABLE,
ALL_PAGES,
ALL_PAGES_DATA,
GET_PAGE,
GET_PAGE_BY_ID,
CREATE_PAGE,
SAVE_PAGE,
DELETE_PAGE
}
| [
"ryanthames@gmail.com"
] | ryanthames@gmail.com |
cefe7fde4fa1b3254b503eaa24b75257c42d9c35 | 5bd695321a6c6cecb21442562808a1eb3b8dca27 | /src/main/java/ru/innopolis/stc9/db/dao/UsersDAO.java | e0eb6196be21dd081109b432227c70150a14f405 | [] | no_license | apykac/StudentsSite | 2e0f1192dbe65adf5be8d74dc801dac09a48037b | eb5fb023f0db9d2b32fba81bb427ce4b2a53334c | refs/heads/master | 2020-03-17T06:53:01.338263 | 2018-05-23T16:25:08 | 2018-05-23T16:25:08 | 133,373,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | package ru.innopolis.stc9.db.dao;
import ru.innopolis.stc9.pojo.User;
import java.sql.SQLException;
/**
* Интерфейс DAO пользователя
*/
public interface UsersDAO {
/**
* получить пользователья по логину
* @param login логин пользователя
* @return возращает пользователя
* @throws SQLException
*/
User getUserByLogin(String login) throws SQLException;
}
| [
"s.semushev.stc@innopolis.ru"
] | s.semushev.stc@innopolis.ru |
646699f0ca259facedd2dab4b26ec973aec7f475 | ed60b60073048951fd12b2cd77b834f4d84213e4 | /app/src/main/java/com/xmyunyou/wcd/photoview/gestures/OnGestureListener.java | b000151967e1f9da7d482269a76e746ca26f36f5 | [] | no_license | jimohuishangyin/myproject | 3e46612bf1b855278d6f1d582ddb7c237aff3df3 | af46ef716b00bec02b6bd9a1fc56a7dd8d701960 | refs/heads/master | 2021-01-23T15:50:58.448991 | 2015-04-17T09:39:20 | 2015-04-17T09:39:20 | 34,107,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,069 | java | /*******************************************************************************
* Copyright 2011, 2012 Chris Banes.
*
* 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.xmyunyou.wcd.photoview.gestures;
public interface OnGestureListener {
public void onDrag(float dx, float dy);
public void onFling(float startX, float startY, float velocityX,
float velocityY);
public void onScale(float scaleFactor, float focusX, float focusY);
} | [
"492727008@qq.com"
] | 492727008@qq.com |
28c168aa7a511d3e34699ae84eeb602f60cc3c84 | cb2447fecb371fcc3b21be42187b0d43b103cdd3 | /milight/src/main/java/at/rseiler/homeauto/milight/config/MiLightConfigWrapper.java | 0471cd9fde79632aab4ab339baa36e591b821b4d | [
"Apache-2.0"
] | permissive | rseiler/homeauto | bf3900627b06dc8e99868e21929ed85d24073de9 | 89f01b7010b86232c009ffb793f5007e96160fb1 | refs/heads/master | 2021-01-11T15:13:25.030891 | 2018-03-04T21:34:36 | 2018-03-04T21:34:36 | 80,310,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 816 | java | package at.rseiler.homeauto.milight.config;
import at.rseiler.homeauto.common.watcher.config.DeviceWatcherConfig;
import at.rseiler.homeauto.milight.config.MiLightConfigWrapper.MiLightConfigWrapperBuilder;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import lombok.Builder;
import lombok.Value;
@Value
@Builder
@JsonDeserialize(builder = MiLightConfigWrapperBuilder.class)
public class MiLightConfigWrapper {
@JsonProperty(required = true)
private final DeviceWatcherConfig deviceWatcher;
@JsonProperty(required = true)
private final MiLightConfig miLight;
@JsonPOJOBuilder(withPrefix = "")
static final class MiLightConfigWrapperBuilder {
}
}
| [
"reinhard.seiler@gmail.com"
] | reinhard.seiler@gmail.com |
3437e604ca5b7eb77d54a5449642eb7473dd6e7d | 6e5c37409a53c882bf41ba5bbbf49975d6c1c9aa | /src/org/hl7/v3/XDocumentProcedureMood.java | a6e1fbaa2d9e0945f8754791d20e299cfe359520 | [] | no_license | hosflow/fwtopsysdatasus | 46fdf8f12ce1fd5628a04a2145757798b622ee9f | 2d9a835fcc7fd902bc7fb0b19527075c1260e043 | refs/heads/master | 2021-09-03T14:39:52.008357 | 2018-01-09T20:34:19 | 2018-01-09T20:34:19 | 116,867,672 | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 1,054 | java |
package org.hl7.v3;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Classe Java de x_DocumentProcedureMood.
*
* <p>O seguinte fragmento do esquema especifica o conte˙do esperado contido dentro desta classe.
* <p>
* <pre>
* <simpleType name="x_DocumentProcedureMood">
* <restriction base="{urn:hl7-org:v3}cs">
* <enumeration value="APT"/>
* <enumeration value="ARQ"/>
* <enumeration value="DEF"/>
* <enumeration value="EVN"/>
* <enumeration value="INT"/>
* <enumeration value="PRMS"/>
* <enumeration value="PRP"/>
* <enumeration value="RQO"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "x_DocumentProcedureMood")
@XmlEnum
public enum XDocumentProcedureMood {
APT,
ARQ,
DEF,
EVN,
INT,
PRMS,
PRP,
RQO;
public String value() {
return name();
}
public static XDocumentProcedureMood fromValue(String v) {
return valueOf(v);
}
}
| [
"andre.topazio@gmail.com"
] | andre.topazio@gmail.com |
134761d92dfad93aab537a8476a6b80074f83434 | 285c22631111bac77f2d29acaa4182cc8b9ff15f | /src/main/java/de/hhu/stups/bsynthesis/prob/GetViolatingVarsFromExamplesCommand.java | e590032324461c876e3e0fb623d8caf371e7331b | [] | no_license | Joshua27/BSynthesis | 45f1424ebf4054f4e1c5ebc886d8fe321b05b911 | b11dce906588fd772cd7e2482b5634ed0f88130b | refs/heads/master | 2021-01-22T10:46:12.217838 | 2018-10-26T16:00:24 | 2018-10-26T16:00:24 | 92,654,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,429 | java | package de.hhu.stups.bsynthesis.prob;
import static de.hhu.stups.bsynthesis.prob.ExamplesToProlog.getInputOutputExamples;
import static de.hhu.stups.bsynthesis.prob.ExamplesToProlog.printList;
import de.hhu.stups.bsynthesis.ui.components.nodes.BasicNode;
import de.prob.animator.command.AbstractCommand;
import de.prob.parser.ISimplifiedROMap;
import de.prob.prolog.output.IPrologTermOutput;
import de.prob.prolog.term.PrologTerm;
import javafx.beans.property.SetProperty;
import javafx.beans.property.SimpleSetProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableSet;
import java.util.List;
import java.util.Set;
import java.util.stream.IntStream;
public class GetViolatingVarsFromExamplesCommand extends AbstractCommand {
private static final String PROLOG_COMMAND_NAME = "get_invariant_violating_vars_from_examples_";
private static final String VIOLATING_VAR_NAMES = "ViolatingVarNames";
private final Set<InputOutputExample> validExamples;
private final Set<InputOutputExample> invalidExamples;
private final SetProperty<String> violatingVarNamesProperty;
/**
* Create {@link InputOutputExample}s from the given {@link BasicNode}s and initialize
* {@link #violatingVarNamesProperty}.
*/
public GetViolatingVarsFromExamplesCommand(final List<BasicNode> validExamples,
final List<BasicNode> invalidExamples,
final Set<String> machineVarNames) {
this.validExamples = getInputOutputExamples(validExamples, machineVarNames);
this.invalidExamples = getInputOutputExamples(invalidExamples, machineVarNames);
violatingVarNamesProperty = new SimpleSetProperty<>(FXCollections.observableSet());
}
@Override
public void writeCommand(final IPrologTermOutput pto) {
pto.openTerm(PROLOG_COMMAND_NAME);
printList(pto, validExamples);
printList(pto, invalidExamples);
pto.printVariable(VIOLATING_VAR_NAMES).closeTerm();
}
@Override
public void processResult(final ISimplifiedROMap<String, PrologTerm> bindings) {
final PrologTerm resultTerm = bindings.get(VIOLATING_VAR_NAMES);
IntStream.range(1, resultTerm.getArity() + 1).forEach(value ->
violatingVarNamesProperty.add(resultTerm.getArgument(value).getFunctor()));
}
public ObservableSet<String> getViolatingVarNames() {
return violatingVarNamesProperty.get();
}
}
| [
"joshua.schmidt@uni-duesseldorf.de"
] | joshua.schmidt@uni-duesseldorf.de |
aa922e20768ec25ae2f6867dcd5745d82e87f849 | 3e5055ad5d2980aa33afa495b9cf6f39ac90f991 | /src/com/mss/msp/location/LocationAction.java | 2a09d357c19e801b26bc4932330ec04b84832788 | [] | no_license | naveena007/AzureSample123 | 89a2b513ad37144433dca31e4cc16e1bdba9c999 | 630ade6f110c0711aaeda95cdddb9ec36a0b5cf4 | refs/heads/master | 2021-05-08T05:21:15.763365 | 2017-10-09T20:45:20 | 2017-10-09T20:45:20 | 106,333,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,470 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.mss.msp.location;
import com.mss.msp.util.ServiceLocator;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
/**
*
* @author Kyle Bissell
*/
public class LocationAction extends ActionSupport{
private String countryName="";
private int countryId;
private String stockSymbolString="";
private List<State> states;
/**
***********************************************************
*
* @getStatesForCountry() to get the states for country
*
*
***********************************************************
*/
public String getStatesForCountry()
{
System.out.println("********************LocationAction :: getStatesForCountry Action Start*********************");
states = new ArrayList<State>();
String resultType = SUCCESS;
states = ServiceLocator.getLocationService().getStatesByCountry(countryId);
System.out.println("********************LocationAction :: getStatesForCountry Action Start*********************");
return resultType;
}
/**
***********************************************************
*
* @getStockSymbol() to get the stock symbol
*
*
***********************************************************
*/
public String getStockSymbol(){
System.out.println("********************LocationAction :: getStockSymbol Action Start*********************");
String resultType=SUCCESS;
stockSymbolString=ServiceLocator.getLocationService().lookupCountryCurrency(countryId);
System.out.println("********************LocationAction :: getStockSymbol Action Start*********************");
return resultType;
}
public String getCountryName() {
return countryName;
}
public void setCountryName(String countryName) {
this.countryName = countryName;
}
public List<State> getStates() {
return states;
}
public void setStates(List<State> states) {
this.states = states;
}
public String getStockSymbolString() {
return stockSymbolString;
}
public void setStockSymbolString(String stockSymbolString) {
this.stockSymbolString = stockSymbolString;
}
public int getCountryId() {
return countryId;
}
public void setCountryId(int countryId) {
this.countryId = countryId;
}
}
| [
"krishnateja1438@gmail.com"
] | krishnateja1438@gmail.com |
5fbbdace380138a5c93312f0f88440fb53722292 | 4a015f5a9b655f027a4d4e04fdc926bb893d093d | /api-gateway/src/main/java/mk/ukim/finki/apigateway/domain/User.java | a7f8df432812cb0d357615592b23d898c6cb492b | [
"MIT"
] | permissive | kirkovg/university-microservices | cd1bfe8f92dba3b422c56903b972a2aa9f0b45c7 | 2c8db22c3337014e3a8aa5de3e6a1a32d35c9ba0 | refs/heads/master | 2021-12-26T13:05:05.598702 | 2018-09-11T18:53:35 | 2018-09-11T18:53:35 | 147,234,534 | 0 | 0 | MIT | 2021-08-12T22:16:40 | 2018-09-03T17:25:19 | Java | UTF-8 | Java | false | false | 5,433 | java | package mk.ukim.finki.apigateway.domain;
import mk.ukim.finki.apigateway.config.Constants;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.BatchSize;
import javax.validation.constraints.Email;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import java.time.Instant;
/**
* A user.
*/
@Entity
@Table(name = "jhi_user")
public class User extends AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Pattern(regexp = Constants.LOGIN_REGEX)
@Size(min = 1, max = 50)
@Column(length = 50, unique = true, nullable = false)
private String login;
@JsonIgnore
@NotNull
@Size(min = 60, max = 60)
@Column(name = "password_hash", length = 60, nullable = false)
private String password;
@Size(max = 50)
@Column(name = "first_name", length = 50)
private String firstName;
@Size(max = 50)
@Column(name = "last_name", length = 50)
private String lastName;
@Email
@Size(min = 5, max = 254)
@Column(length = 254, unique = true)
private String email;
@NotNull
@Column(nullable = false)
private boolean activated = false;
@Size(min = 2, max = 6)
@Column(name = "lang_key", length = 6)
private String langKey;
@Size(max = 256)
@Column(name = "image_url", length = 256)
private String imageUrl;
@Size(max = 20)
@Column(name = "activation_key", length = 20)
@JsonIgnore
private String activationKey;
@Size(max = 20)
@Column(name = "reset_key", length = 20)
@JsonIgnore
private String resetKey;
@Column(name = "reset_date")
private Instant resetDate = null;
@JsonIgnore
@ManyToMany
@JoinTable(
name = "jhi_user_authority",
joinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "id")},
inverseJoinColumns = {@JoinColumn(name = "authority_name", referencedColumnName = "name")})
@BatchSize(size = 20)
private Set<Authority> authorities = new HashSet<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLogin() {
return login;
}
// Lowercase the login before saving it in database
public void setLogin(String login) {
this.login = StringUtils.lowerCase(login, Locale.ENGLISH);
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
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 getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public boolean getActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public String getActivationKey() {
return activationKey;
}
public void setActivationKey(String activationKey) {
this.activationKey = activationKey;
}
public String getResetKey() {
return resetKey;
}
public void setResetKey(String resetKey) {
this.resetKey = resetKey;
}
public Instant getResetDate() {
return resetDate;
}
public void setResetDate(Instant resetDate) {
this.resetDate = resetDate;
}
public String getLangKey() {
return langKey;
}
public void setLangKey(String langKey) {
this.langKey = langKey;
}
public Set<Authority> getAuthorities() {
return authorities;
}
public void setAuthorities(Set<Authority> authorities) {
this.authorities = authorities;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
return !(user.getId() == null || getId() == null) && Objects.equals(getId(), user.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "User{" +
"login='" + login + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
", imageUrl='" + imageUrl + '\'' +
", activated='" + activated + '\'' +
", langKey='" + langKey + '\'' +
", activationKey='" + activationKey + '\'' +
"}";
}
}
| [
"gjorgjikirkov@gmail.com"
] | gjorgjikirkov@gmail.com |
5b9c023f389aa7f52979ac1df6ba51710941c7ba | fa1b7c2da195193fd88214d3254ce5badde61ed3 | /test-filters-multipleMDBs/src/org/hornetq/replicator/routing/MDB2.java | dd73837faf0b86ede2ad709f6183325a2da0a4a7 | [] | no_license | clebertsuconic/test-repo | ec692bc4c13184d2b9abbd0e55b0703f87878bb0 | 1f4833a4aab4cce942b2fbc91f8a42182ca3e7d4 | refs/heads/master | 2020-04-06T04:55:55.173388 | 2013-03-08T22:47:11 | 2013-03-08T22:47:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,809 | java | package org.hornetq.replicator.routing;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
@MessageDriven
(
activationConfig =
{
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue = "MDB2"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/testTopic"),
@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "15"),
@ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "receiver=2") })
@TransactionAttribute(value = TransactionAttributeType.REQUIRED)
public class MDB2 implements MessageListener {
private static final AtomicInteger counter = new AtomicInteger(0);
private @Resource(mappedName = "java:/JmsXA")
ConnectionFactory connectionFactory;
private @Resource(mappedName = "java:/topic/testTopic")
Topic topic;
private @Resource MessageDrivenContext sessionContext;
@Override
public void onMessage(Message msg) {
MDBUtil.msgReceived(msg, counter, connectionFactory, sessionContext, topic, getClass());
}
}
| [
"clebert.suconic@gmail.com"
] | clebert.suconic@gmail.com |
d3894627b2b0c75525b0f8d78230b9314e74d350 | e3780c806fdb6798abf4ad5c3a7cb49e3d05f67a | /src/main/java/com/hankcs/hanlp/dependency/nnparser/util/std.java | 5133fe32fa638f6d727e45b2804845be73ddb703 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | AnyListen/HanLP | 7e3cf2774f0980d24ecab0568ad59774232a56d6 | 58e5f6cda0b894cad156b06ac75bd397c9e26de3 | refs/heads/master | 2021-01-22T04:23:14.514117 | 2018-12-11T01:27:36 | 2018-12-11T01:27:36 | 125,140,795 | 1 | 1 | Apache-2.0 | 2018-04-16T16:49:47 | 2018-03-14T02:04:04 | Java | UTF-8 | Java | false | false | 1,178 | java | /*
* <summary></summary>
* <author>He Han</author>
* <email>me@hankcs.com</email>
* <create-date>2015/10/31 21:26</create-date>
*
* <copyright file="std.java" company="��ũ��">
* Copyright (c) 2008-2015, ��ũ��. All Right Reserved, http://www.hankcs.com/
* This source is subject to Hankcs. Please contact Hankcs to get more information.
* </copyright>
*/
package com.hankcs.hanlp.dependency.nnparser.util;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
/**
* @author hankcs
*/
public class std
{
public static <E> void fill(List<E> list, E value)
{
if (list == null) return;
ListIterator<E> listIterator = list.listIterator();
while (listIterator.hasNext()) listIterator.set(value);
}
public static <E> List<E> create(int size, E value)
{
List<E> list = new ArrayList<E>(size);
for (int i = 0; i < size; i++)
{
list.add(value);
}
return list;
}
public static <E> E pop_back(List<E> list)
{
E back = list.get(list.size() - 1);
list.remove(list.size() - 1);
return back;
}
}
| [
"jfservice@126.com"
] | jfservice@126.com |
645cf2af0256922655674c2ad91cd7f9d02fc94d | 93a82eebc89db6e905bb52505870be1cc689566d | /materialdesign/app/src/main/java/top/zcwfeng/materialdesign/drawer/ui/home/HomeFragment.java | 618af8f0f193109aea75d07327947e6c1868a916 | [] | no_license | zcwfeng/zcw_android_demo | 78cdc86633f01babfe99972b9fde52a633f65af9 | f990038fd3643478dbf4f65c03a70cd2f076f3a0 | refs/heads/master | 2022-07-27T05:32:09.421349 | 2022-03-14T02:56:41 | 2022-03-14T02:56:41 | 202,998,648 | 15 | 8 | null | null | null | null | UTF-8 | Java | false | false | 1,205 | java | package top.zcwfeng.materialdesign.drawer.ui.home;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import top.zcwfeng.materialdesign.R;
public class HomeFragment extends Fragment {
private HomeViewModel homeViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.fragment_home, container, false);
final TextView textView = root.findViewById(R.id.text_home);
homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"zcwfeng@126.com"
] | zcwfeng@126.com |
33708825eefeb1c441d4298b1b598cc088a910aa | 472b29c3f160dd08bc7e159281a286e29790298c | /src/model/SimulationSugar.java | 28a56466ae04bec87741eee6f9fee5f826f1e6cb | [
"MIT"
] | permissive | tjysdsg/cs308-cellsociety | 76734efcd704861f395109ed8f33aca1ab7e01a2 | 3a3f6c97cd9da16298333ff22504e0e43c5eeca7 | refs/heads/master | 2023-04-15T05:01:51.919860 | 2021-02-27T07:36:32 | 2021-02-27T07:36:32 | 352,004,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,791 | java | package model;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
* Simulation model of SugarScape.
* <p>
* See {@link Simulation#setConfig(String, Object)} for general simulation options
* <p>
* Configurable options:
* <ul>
* <li>
* TODO:
* </li>
* </ul>
* <p>
* See also https://www2.cs.duke.edu/courses/compsci308/spring21/assign/02_simulation/Sugarscape_Leicester.pdf
*
* @author jt304
*/
public class SimulationSugar extends Simulation {
private static final String N_AGENTS_KEY = "nAgents";
private int sugarGrowBackRate = 1;
private int sugarGrowBackInterval = 1;
private int maxSugarPerPatch = 30;
private int nAgents = 0;
public SimulationSugar(int nRows, int nCols) {
grid = new GridSq4(nRows, nCols, new StateSugar(StateEnumSugar.EMPTY, 0, null));
simType = "SugarScape";
}
@Override
public <T> void setConfig(String name, T value) {
super.setConfig(name, value);
switch (name) {
case "sugarGrowBackRate" -> sugarGrowBackRate = (int) value;
case "sugarGrowBackInterval" -> sugarGrowBackInterval = (int) value;
case "maxSugarPerPatch" -> maxSugarPerPatch = (int) value;
default -> {
}
}
}
@Override
public Map<String, Object> getStatsMap() {
HashMap<String, Object> ret = new HashMap<>();
ret.put(N_AGENTS_KEY, nAgents);
return ret;
}
@Override
public List<String> getStatsNames() {
ArrayList<String> ret = new ArrayList<>();
ret.add(N_AGENTS_KEY);
return ret;
}
@Override
protected void updateNextStates() {
for (int r = 0; r < grid.getNumRows(); ++r) {
for (int c = 0; c < grid.getNumCols(); ++c) {
StateSugar s = (StateSugar) grid.getState(r, c);
// grow back sugar
int growTime = s.getSugarGrowTime() + 1;
int sugar = s.getSugar();
if (growTime >= sugarGrowBackInterval) {
sugar += sugarGrowBackRate;
if (sugar > maxSugarPerPatch) {
sugar = maxSugarPerPatch;
}
s.setSugar(sugar);
s.setSugarGrowTime(0);
} else {
s.setSugarGrowTime(growTime);
}
// agent
if (s.getStateType() == StateEnumSugar.AGENT) {
SugarAgent agent = s.getAgent();
int maxSugar = 0;
Vec2D currCoord = new Vec2D(r, c);
Vec2D bestCoord = new Vec2D(r, c);
// FIXME: don't use hardcoded directions
Vec2D[] directions = new Vec2D[]{
new Vec2D(1, 0),
new Vec2D(-1, 0),
new Vec2D(0, 1),
new Vec2D(0, -1),
};
for (Vec2D dir : directions) { // check next several tiles in a direction
for (int i = 0; i < agent.getVision(); ++i) {
Vec2D dest = dir.mul(i + 1).add(currCoord);
// wrap coord if wrap is enabled
dest = grid.fixCoord(dest);
if (!grid.isInside(dest.getX(), dest.getY())) {
continue;
}
StateSugar destState = (StateSugar) grid.getState(dest.getX(), dest.getY());
if (
// make sure this is >, because we want to find the closest patch if
// there are patches with the same value
destState.getSugar() > maxSugar
&& destState.getStateType() != StateEnumSugar.AGENT
) {
maxSugar = destState.getSugar();
bestCoord = dest;
}
}
}
if (!bestCoord.equals(currCoord)) {
// remove agent in current patch
StateSugar newState = new StateSugar(s);
newState.removeAgent();
grid.setState(currCoord.getX(), currCoord.getY(), newState);
// move agent to destination
s = (StateSugar) grid.getState(bestCoord.getX(), bestCoord.getY());
newState = new StateSugar(s);
newState.setAgent(agent);
grid.setState(bestCoord.getX(), bestCoord.getY(), newState);
// take sugar
agent.setSugar(newState.getSugar());
newState.setSugar(0);
// metabolism
agent.setSugar(agent.getSugar() - agent.getMetabolism());
// starve to death
if (agent.getSugar() < 0) {
newState.removeAgent();
}
}
}
}
}
}
@Override
protected void updateStats() {
nAgents = 0;
for (int r = 0; r < grid.getNumRows(); ++r) {
for (int c = 0; c < grid.getNumCols(); ++c) {
if (grid.getState(r, c).getStateType() == StateEnumSugar.AGENT) {
++nAgents;
}
}
}
}
}
| [
"jt304@duke.edu"
] | jt304@duke.edu |
cec937cb2c61f403b8be8f71ebbb72f02221de70 | 56b2c0a62a137e770b4d0f22c294111c71d177a3 | /src/com/ugent/eventplanner/models/ConfirmationMessageContainer.java | a0ba6f12b5d3d994b5b0c0b936c7d172a70d030a | [] | no_license | jan-verm/Eventplanner | 92e345c9fbecedbc2e9250e772e5ab11298996a7 | 8201ad7f136ccda97fcfcb4eabd08a025e953e0d | refs/heads/master | 2021-06-30T17:59:35.945969 | 2017-09-20T15:51:41 | 2017-09-20T15:51:41 | 104,236,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | package com.ugent.eventplanner.models;
public class ConfirmationMessageContainer {
private Confirmation confirmation = null;
private Message message = null;
private int type; // confirmation if 0, message if 1
public ConfirmationMessageContainer(int type, Confirmation confirmation, Message message) throws Exception {
this.type = type;
if (type == 0 ) {
this.confirmation = confirmation;
} else if(type == 1){
this.message = message;
} else {
throw new Exception("Parameter type must be 0 or 1!");
}
}
public String getTitle() {
if (type == 0) {
return confirmation.getPerson().getName();
} else {
return message.getPerson().getName();
}
}
public String getSubtitle(){
if (type == 0) {
return confirmation.getStatus() ? "going" : "not going";
} else {
return message.getText()+"\nCreated at: "+message.getCreated_at();
}
}
public int getType() {
return type;
}
}
| [
"jan.verm84@gmail.com"
] | jan.verm84@gmail.com |
654741e3516a4716c50ccbb384c13219eb4c62ba | 9b75d8540ff2e55f9ff66918cc5676ae19c3bbe3 | /bazaar8.apk-decompiled/sources/b/B/f/d.java | d4737a285197cce0038ea9146968d5fb962c76e8 | [] | no_license | BaseMax/PopularAndroidSource | a395ccac5c0a7334d90c2594db8273aca39550ed | bcae15340907797a91d39f89b9d7266e0292a184 | refs/heads/master | 2020-08-05T08:19:34.146858 | 2019-10-06T20:06:31 | 2019-10-06T20:06:31 | 212,433,298 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,059 | java | package b.b.f;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.view.LayoutInflater;
import b.b.i;
/* compiled from: ContextThemeWrapper */
public class d extends ContextWrapper {
/* renamed from: a reason: collision with root package name */
public int f1948a;
/* renamed from: b reason: collision with root package name */
public Resources.Theme f1949b;
/* renamed from: c reason: collision with root package name */
public LayoutInflater f1950c;
/* renamed from: d reason: collision with root package name */
public Configuration f1951d;
/* renamed from: e reason: collision with root package name */
public Resources f1952e;
public d() {
super(null);
}
public final Resources a() {
if (this.f1952e == null) {
Configuration configuration = this.f1951d;
if (configuration == null) {
this.f1952e = super.getResources();
} else if (Build.VERSION.SDK_INT >= 17) {
this.f1952e = createConfigurationContext(configuration).getResources();
}
}
return this.f1952e;
}
public void attachBaseContext(Context context) {
super.attachBaseContext(context);
}
public int b() {
return this.f1948a;
}
public final void c() {
boolean z = this.f1949b == null;
if (z) {
this.f1949b = getResources().newTheme();
Resources.Theme theme = getBaseContext().getTheme();
if (theme != null) {
this.f1949b.setTo(theme);
}
}
a(this.f1949b, this.f1948a, z);
}
public AssetManager getAssets() {
return getResources().getAssets();
}
public Resources getResources() {
return a();
}
public Object getSystemService(String str) {
if (!"layout_inflater".equals(str)) {
return getBaseContext().getSystemService(str);
}
if (this.f1950c == null) {
this.f1950c = LayoutInflater.from(getBaseContext()).cloneInContext(this);
}
return this.f1950c;
}
public Resources.Theme getTheme() {
Resources.Theme theme = this.f1949b;
if (theme != null) {
return theme;
}
if (this.f1948a == 0) {
this.f1948a = i.Theme_AppCompat_Light;
}
c();
return this.f1949b;
}
public void setTheme(int i2) {
if (this.f1948a != i2) {
this.f1948a = i2;
c();
}
}
public d(Context context, int i2) {
super(context);
this.f1948a = i2;
}
public d(Context context, Resources.Theme theme) {
super(context);
this.f1949b = theme;
}
public void a(Resources.Theme theme, int i2, boolean z) {
theme.applyStyle(i2, true);
}
}
| [
"MaxBaseCode@gmail.com"
] | MaxBaseCode@gmail.com |
4fcbe4ff4b59caa4bb19cb2731a94782624e091a | f60471980e66e5b37be95b0db07b19c4de16fee5 | /dBrowser/src/org/reldb/relang/filtersorter/SearchAdvanced.java | 44ff4d0eac386f02ab2c49671947a76513c3fbb5 | [
"Apache-2.0"
] | permissive | kevinmiles/Relang | 0cd8ce3a2cf43c3e24ece6d674eaa3842c0970bb | 26e8a6b34b9ca4122902b9cfbc34f1fea31e51f8 | refs/heads/master | 2022-03-12T22:45:10.857261 | 2019-11-05T21:46:26 | 2019-11-05T21:46:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,342 | java | package org.reldb.relang.filtersorter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
public class SearchAdvanced extends Composite implements Searcher {
private static final String emptyFilterPrompt = "Click here to set filter criteria.";
private FilterSorter filterSorter;
private SearchAdvancedPanel filterer;
private Label filterSpec;
private PopupComposite popup;
public SearchAdvanced(FilterSorter filterSorter, Composite contentPanel) {
super(contentPanel, SWT.NONE);
this.filterSorter = filterSorter;
GridLayout layout = new GridLayout(2, false);
layout.horizontalSpacing = 0;
layout.verticalSpacing = 0;
layout.marginWidth = 0;
layout.marginHeight = 0;
setLayout(layout);
filterSpec = new Label(this, SWT.NONE);
filterSpec.setText(emptyFilterPrompt);
filterSpec.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
filterSpec.addListener(SWT.MouseUp, e -> popup());
ToolBar toolBar = new ToolBar(this, SWT.NONE);
ToolItem clear = new ToolItem(toolBar, SWT.PUSH);
clear.addListener(SWT.Selection, e -> {
filterSpec.setText(emptyFilterPrompt);
filterSorter.refresh();
});
clear.setText("Clear");
toolBar.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
this.addListener(SWT.Show, e -> {
if (filterSpec.getText().equals(emptyFilterPrompt))
popup();
});
constructPopup();
}
private void constructPopup() {
popup = new PopupComposite(getShell());
popup.setLayout(new GridLayout(1, false));
filterer = new SearchAdvancedPanel(filterSorter.getAttributeNames(), popup);
filterer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
Composite buttonPanel = new Composite(popup, SWT.NONE);
buttonPanel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
buttonPanel.setLayout(new GridLayout(3, false));
Button okButton = new Button(buttonPanel, SWT.PUSH);
okButton.setText("Ok");
okButton.addListener(SWT.Selection, e -> ok());
Button cancelButton = new Button(buttonPanel, SWT.PUSH);
cancelButton.setText("Cancel");
cancelButton.addListener(SWT.Selection, e -> {
filterer.cancel();
popup.hide();
});
Button clearButton = new Button(buttonPanel, SWT.PUSH);
clearButton.setText("Clear");
clearButton.addListener(SWT.Selection, e -> {
filterer.clear();
filterSpec.setText(emptyFilterPrompt);
filterSorter.refresh();
});
popup.pack();
}
public void ok() {
filterer.ok();
String spec = filterer.getWhereClause().trim();
if (spec.length() == 0)
filterSpec.setText(emptyFilterPrompt);
else
filterSpec.setText(spec);
popup.hide();
filterSorter.refresh();
}
private void popup() {
if (!popup.isDisplayed())
popup.show(toDisplay(0, 0));
}
public void clicked() {
if (getVisible() == false && !filterSpec.getText().equals(emptyFilterPrompt))
return;
popup();
}
public String getQuery() {
String spec = filterSpec.getText();
return !spec.equals(emptyFilterPrompt) ? " WHERE " + spec : "";
}
}
| [
"dave@armchair.mb.ca"
] | dave@armchair.mb.ca |
4390a1920d06650ebc6c509676816760dcb35cb7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/27/27_97d10d0d2582a6b7f1c32448ed254c6bf8f9d8b2/Folder/27_97d10d0d2582a6b7f1c32448ed254c6bf8f9d8b2_Folder_s.java | 524f76f0745ab0be55b91b861192d256bb912234 | [] | 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 | 3,508 | java | package com.fsck.k9.mail;
public abstract class Folder {
public enum OpenMode {
READ_WRITE, READ_ONLY,
}
public enum FolderType {
HOLDS_FOLDERS, HOLDS_MESSAGES,
}
/**
* Forces an open of the MailProvider. If the provider is already open this
* function returns without doing anything.
*
* @param mode READ_ONLY or READ_WRITE
*/
public abstract void open(OpenMode mode) throws MessagingException;
/**
* Forces a close of the MailProvider. Any further access will attempt to
* reopen the MailProvider.
*
* @param expunge If true all deleted messages will be expunged.
*/
public abstract void close(boolean expunge) throws MessagingException;
/**
* @return True if further commands are not expected to have to open the
* connection.
*/
public abstract boolean isOpen();
/**
* Get the mode the folder was opened with. This may be different than the mode the open
* was requested with.
* @return
*/
public abstract OpenMode getMode() throws MessagingException;
public abstract boolean create(FolderType type) throws MessagingException;
/**
* Create a new folder with a specified display limit. Not abstract to allow
* remote folders to not override or worry about this call if they don't care to.
*/
public boolean create(FolderType type, int displayLimit) throws MessagingException {
return create(type);
}
public abstract boolean exists() throws MessagingException;
/**
* @return A count of the messages in the selected folder.
*/
public abstract int getMessageCount() throws MessagingException;
public abstract int getUnreadMessageCount() throws MessagingException;
public abstract Message getMessage(String uid) throws MessagingException;
public abstract Message[] getMessages(int start, int end, MessageRetrievalListener listener)
throws MessagingException;
/**
* Fetches the given list of messages. The specified listener is notified as
* each fetch completes. Messages are downloaded as (as) lightweight (as
* possible) objects to be filled in with later requests. In most cases this
* means that only the UID is downloaded.
*
* @param uids
* @param listener
*/
public abstract Message[] getMessages(MessageRetrievalListener listener)
throws MessagingException;
public abstract Message[] getMessages(String[] uids, MessageRetrievalListener listener)
throws MessagingException;
public abstract void appendMessages(Message[] messages) throws MessagingException;
public abstract void copyMessages(Message[] msgs, Folder folder) throws MessagingException;
public abstract void setFlags(Message[] messages, Flag[] flags, boolean value)
throws MessagingException;
public abstract Message[] expunge() throws MessagingException;
public abstract void fetch(Message[] messages, FetchProfile fp,
MessageRetrievalListener listener) throws MessagingException;
public abstract void delete(boolean recurse) throws MessagingException;
public abstract String getName();
public abstract Flag[] getPermanentFlags() throws MessagingException;
@Override
public String toString() {
return getName();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
489c016ff27f387cd6d043acd635b9faed00b06d | c05ea0867a10e0b82c89b61e539f86bc23d827ff | /MMN14 - Generics && Dictionery with GUI/Targil2/AddButton.java | fc56b1a94e84957f8b11d9b6ab06d5e00291003b | [] | no_license | Yuna-Goncharov/-Advanced-Programming-with-Java | fb827cbde7c80981c2b098a45e9c16e719e5d967 | f27ad5d9634a966b21f6f8cc1edd48e85a3ffdc3 | refs/heads/master | 2020-04-15T18:51:09.600573 | 2019-01-09T19:57:53 | 2019-01-09T19:57:53 | 164,928,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,157 | java | import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class AddButton extends JButton {
// adding buttons to controller
public AddButton(Controller controller) {
setText("Add");
setVisible(true);
// action listeners for buttons
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String description = "";
String newVal = JOptionPane.showInputDialog(getParent(), "Please enter a value:", "New Value",
JOptionPane.QUESTION_MESSAGE);
if (newVal != null && !newVal.equals(""))
description = JOptionPane.showInputDialog(getParent(), "Please enter a Description:", "New Value",
JOptionPane.QUESTION_MESSAGE);
if (newVal != null && !description.equals("")) {
if (controller.addNewEntry(newVal, description)) {
JOptionPane.showMessageDialog(getParent(), "New value has been added successfully", "Success",
JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(getParent(), "Value is already exist", "Error",
JOptionPane.ERROR_MESSAGE);
}
}
}
});
}
}
| [
"yonkagon@gmail.com"
] | yonkagon@gmail.com |
f5f0152c7791589540db87bdedc27b93a446b416 | ed03478dc06eb8fea7c98c03392786cd04034b82 | /src/com/era/community/assignment/dao/generated/AssignmentsFinderBase.java | 9e86e5c2ed8c2a3df207a957577f16448a3b6045 | [] | no_license | sumit-kul/cera | 264351934be8f274be9ed95460ca01fa9fc23eed | 34343e2f5349bab8f5f78b9edf18f2e0319f62d5 | refs/heads/master | 2020-12-25T05:17:19.207603 | 2016-09-04T00:02:31 | 2016-09-04T00:02:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 271 | java | package com.era.community.assignment.dao.generated;
import com.era.community.assignment.dao.Assignments;
public interface AssignmentsFinderBase
{
public Assignments getAssignmentsForId(int id) throws Exception;
public Assignments newAssignments() throws Exception;
} | [
"sumitkul2005@gmail.com"
] | sumitkul2005@gmail.com |
9ea2967f39ac36f08d68bf43689eb9c5cadec3fa | 35618f1debd6b8ebfde45a1e015e88ead284d6b3 | /.svn/pristine/42/42d75a834efc3c4c9e7d1ba27c41b58e907fa85e.svn-base | b461bf7377edffa0271893250573a57bb1460595 | [] | no_license | Mudhasir/testser | 6baf50a93e5377ff9c2b2a9acadb47fae682c499 | c6d9ebf0524d52519cee957d7fe8b0a3775cc56b | refs/heads/main | 2023-04-23T03:49:46.780770 | 2021-05-05T05:34:43 | 2021-05-05T05:34:43 | 360,869,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | package com.agaram.eln.primary.repository.fileManipulation;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.agaram.eln.primary.model.fileManipulation.ProfilePicture;
public interface ProfilePictureRepository extends MongoRepository<ProfilePicture, String> {
public ProfilePicture findById(Integer Id);
public Long deleteById(Integer Id);
}
| [
"syedmudhasir.m@agaramtech.com"
] | syedmudhasir.m@agaramtech.com | |
b2654e198c954fee8a8b26db39a7951e5a9c8819 | f2d658bd36d0157fbb79d05113dbcd1cae7a152c | /zuul-proxy/src/main/java/com/edward1iao/springcloud/zuulproxy/ZuulProxyApplication.java | beac7b147db5d0ede2b3f7d68f57d7ee71bb915e | [] | no_license | edward1iao/springcloud-learning | 0f269ec0a9546bc31f8b8b149f1d3b9a945a4773 | 3c390ac285f9a73f90924e24d208ccc57b922d99 | refs/heads/master | 2023-01-04T20:14:48.536539 | 2020-10-26T08:27:32 | 2020-10-26T08:27:32 | 295,688,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | package com.edward1iao.springcloud.zuulproxy;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
@SpringBootApplication
@EnableDiscoveryClient
@EnableZuulProxy
public class ZuulProxyApplication {
public static void main(String[] args) {
SpringApplication.run(ZuulProxyApplication.class,args);
}
}
| [
"ming3ming4@126.com"
] | ming3ming4@126.com |
1ab0fca7c6148cd2bbdb4239fcb0ee8a7cc47a37 | 65e98c214f8512264f5f33ba0f2dec3c0a6b06e5 | /transfuse/src/main/java/org/androidtransfuse/adapter/element/ASTTypeBuilderVisitor.java | bacdac1486e4206031037f24430f5221bae09b71 | [
"Apache-2.0"
] | permissive | histone/transfuse | 46535168651de5fe60745b3557bba3a3b47fca20 | d7b642db063cf8d9d64d06a1ea402a7aecbbe994 | refs/heads/master | 2021-01-15T20:49:04.801629 | 2013-02-02T03:11:38 | 2013-02-02T03:11:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,602 | java | /**
* Copyright 2013 John Ericksen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.androidtransfuse.adapter.element;
import com.google.common.base.Function;
import org.androidtransfuse.adapter.*;
import org.androidtransfuse.analysis.TransfuseAnalysisException;
import org.androidtransfuse.processor.TransactionRuntimeException;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.*;
import javax.lang.model.util.SimpleTypeVisitor6;
/**
* Builder of an ASTType from a TypeMirror input
*
* @author John Ericksen
*/
public class ASTTypeBuilderVisitor extends SimpleTypeVisitor6<ASTType, Void> implements Function<TypeMirror, ASTType> {
private final Provider<ASTElementFactory> astElementFactoryProvider;
@Inject
public ASTTypeBuilderVisitor(Provider<ASTElementFactory> astElementFactoryProvider) {
this.astElementFactoryProvider = astElementFactoryProvider;
}
@Override
public ASTType visitPrimitive(PrimitiveType primitiveType, Void v) {
return ASTPrimitiveType.valueOf(primitiveType.getKind().name());
}
@Override
public ASTType visitNull(NullType nullType, Void v) {
throw new TransfuseAnalysisException("Encountered NullType, unable to recover");
}
@Override
public ASTType visitArray(ArrayType arrayType, Void v) {
return new ASTArrayType(arrayType.getComponentType().accept(this, null));
}
@Override
public ASTType visitDeclared(DeclaredType declaredType, Void v) {
return astElementFactoryProvider.get().buildASTElementType(declaredType);
}
@Override
public ASTType visitError(ErrorType errorType, Void v) {
throw new TransactionRuntimeException("Encountered ErrorType " + errorType.asElement().getSimpleName() + ", unable to recover");
}
@Override
public ASTType visitTypeVariable(TypeVariable typeVariable, Void v) {
return new ASTEmptyType(typeVariable.toString());
}
@Override
public ASTType visitWildcard(WildcardType wildcardType, Void v) {
throw new TransfuseAnalysisException("Encountered Wildcard Type, unable to represent in graph");
}
@Override
public ASTType visitExecutable(ExecutableType executableType, Void v) {
if (executableType instanceof TypeElement) {
return astElementFactoryProvider.get().getType((TypeElement) executableType);
} else {
throw new TransfuseAnalysisException("Encountered non-TypeElement");
}
}
@Override
public ASTType visitNoType(NoType noType, Void v) {
if (noType.getKind().equals(TypeKind.VOID)) {
return ASTVoidType.VOID;
}
return new ASTEmptyType("<NOTYPE>");
}
@Override
public ASTType visitUnknown(TypeMirror typeMirror, Void v) {
throw new TransfuseAnalysisException("Encountered unknown TypeMirror, unable to recover");
}
@Override
public ASTType apply(TypeMirror input) {
return input.accept(this, null);
}
}
| [
"johncarl81@gmail.com"
] | johncarl81@gmail.com |
363642e8d53aa0ac434a8c60138d264488a7e980 | 58a078d91896db199e12c6f614914fc31bc2fd9d | /src/main/java/com/example/MStore/dto/MessageAbstract.java | bc475422de4691fc99a752675c6f02014024a6e2 | [] | no_license | kasmugerle/store | 3be088a0e7101a4d25abc26e17424b567f05251d | f54f200647e2d1a1773a3f096f2c219c6d42809f | refs/heads/main | 2023-05-15T20:45:37.674707 | 2021-06-16T17:04:50 | 2021-06-16T17:04:50 | 330,151,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 271 | java | package com.example.MStore.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public abstract class MessageAbstract {
private String message;
}
| [
"kas.mugerle3579@gmail.com"
] | kas.mugerle3579@gmail.com |
78879db9a5432634e835ed24f2cb15c2978a837b | 393f245124f468d96b5c659cf63161711e259e42 | /src/main/java/com/homify/homify/HomifyApplication.java | 75d8fc1fb38e461a5d88ae1df0ff4bbd41b29d03 | [] | no_license | ashishsms/RESTApiService | 8596e4a872a702c419e3ae1627042abe3fcabc02 | 429a933f9b3383ae2ce164ed5414cb7735611137 | refs/heads/master | 2020-03-23T19:41:22.710555 | 2018-07-23T10:17:15 | 2018-07-23T10:17:15 | 141,996,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package com.homify.homify;
import com.homify.homify.business.Professional;
import com.homify.homify.server.reference.Professional.ProfessionalJDO;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class HomifyApplication {
public static void main(String[] args) {
SpringApplication.run(HomifyApplication.class, args);
}
@Bean
protected CommandLineRunner init(final ProfessionalJDO userRepository) {
return args -> {
Professional user = new Professional();
user.setUserName("admin");
user.setPassword("admin");
user.setFirstName("Administrator");
user.setEmail("admin@javahelps.com");
userRepository.createProfessional(user);
};
}
}
| [
"ashishsms@gmail.com"
] | ashishsms@gmail.com |
6a41d06f95b21a5dc775598a9fec6cac782b7ea0 | 9ad60c3ccad5dbb83e36c3c667316a63ceab60dd | /app/src/main/java/de/christianspecht/tasko/androidclient/Prefs.java | e82030b96fdf5a2a4266a4d4652f776b466658dd | [
"MIT"
] | permissive | msgpo/tasko-androidclient | eacecb0d14aea47750bc94a9e2957f337d50347b | f9ffb658c1c0f9609635050f7282152dc2a5e1be | refs/heads/master | 2022-04-01T17:32:51.670485 | 2019-12-20T21:59:17 | 2019-12-20T21:59:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 908 | java | package de.christianspecht.tasko.androidclient;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
/**
* Load and save preferences
*/
public class Prefs {
private SharedPreferences pref;
public Prefs(Context context) {
this.pref = PreferenceManager.getDefaultSharedPreferences(context);
}
/**
* Loads auth token from the preferences
* @return The token
*/
public String getAuthToken() {
return this.pref.getString("AuthToken", "");
}
/**
* Saves auth token in the preferences
* @param token The token
*/
public void setAuthToken(String token) {
this.pref.edit().putString("AuthToken", token).commit();
}
/**
* Loads server URL from the preferences
* @return The URL
*/
public String getServerUrl() {
return this.pref.getString("settings_url", "");
}
}
| [
"christi@nspecht.de"
] | christi@nspecht.de |
2fd195da921783926fb037b6ade50fa7e2608756 | c81963cab526c4dc24bee21840f2388caf7ff4cf | /com/google/common/collect/SortedLists.java | 1e3b9397204df8dce327236e22e75e5d0f0e030b | [] | no_license | ryank231231/jp.co.penet.gekidanprince | ba2f38e732828a4454402aa7ef93a501f8b7541e | d76db01eeadf228d31006e4e71700739edbf214f | refs/heads/main | 2023-02-19T01:38:54.459230 | 2021-01-16T10:04:22 | 2021-01-16T10:04:22 | 329,815,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,987 | java | package com.google.common.collect;
import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import java.util.Comparator;
import java.util.List;
import javax.annotation.Nullable;
@Beta
@GwtCompatible
final class SortedLists {
public static <E, K extends Comparable> int binarySearch(List<E> paramList, Function<? super E, K> paramFunction, @Nullable K paramK, KeyPresentBehavior paramKeyPresentBehavior, KeyAbsentBehavior paramKeyAbsentBehavior) {
return binarySearch(paramList, paramFunction, paramK, Ordering.natural(), paramKeyPresentBehavior, paramKeyAbsentBehavior);
}
public static <E, K> int binarySearch(List<E> paramList, Function<? super E, K> paramFunction, @Nullable K paramK, Comparator<? super K> paramComparator, KeyPresentBehavior paramKeyPresentBehavior, KeyAbsentBehavior paramKeyAbsentBehavior) {
return binarySearch(Lists.transform(paramList, paramFunction), paramK, paramComparator, paramKeyPresentBehavior, paramKeyAbsentBehavior);
}
public static <E extends Comparable> int binarySearch(List<? extends E> paramList, E paramE, KeyPresentBehavior paramKeyPresentBehavior, KeyAbsentBehavior paramKeyAbsentBehavior) {
Preconditions.checkNotNull(paramE);
return binarySearch(paramList, paramE, Ordering.natural(), paramKeyPresentBehavior, paramKeyAbsentBehavior);
}
public static <E> int binarySearch(List<? extends E> paramList, @Nullable E paramE, Comparator<? super E> paramComparator, KeyPresentBehavior paramKeyPresentBehavior, KeyAbsentBehavior paramKeyAbsentBehavior) {
Preconditions.checkNotNull(paramComparator);
Preconditions.checkNotNull(paramList);
Preconditions.checkNotNull(paramKeyPresentBehavior);
Preconditions.checkNotNull(paramKeyAbsentBehavior);
List<? extends E> list = paramList;
if (!(paramList instanceof java.util.RandomAccess))
list = Lists.newArrayList(paramList);
int i = 0;
int j = list.size() - 1;
while (i <= j) {
int k = i + j >>> 1;
int m = paramComparator.compare(paramE, list.get(k));
if (m < 0) {
j = k - 1;
continue;
}
if (m > 0) {
i = k + 1;
continue;
}
return i + paramKeyPresentBehavior.<E>resultIndex(paramComparator, paramE, list.subList(i, j + 1), k - i);
}
return paramKeyAbsentBehavior.resultIndex(i);
}
public enum KeyAbsentBehavior {
INVERTED_INSERTION_INDEX,
NEXT_HIGHER,
NEXT_LOWER {
int resultIndex(int param2Int) {
return param2Int - 1;
}
};
static {
INVERTED_INSERTION_INDEX = new null("INVERTED_INSERTION_INDEX", 2);
$VALUES = new KeyAbsentBehavior[] { NEXT_LOWER, NEXT_HIGHER, INVERTED_INSERTION_INDEX };
}
abstract int resultIndex(int param1Int);
}
enum null {
int resultIndex(int param1Int) {
return param1Int - 1;
}
}
enum null {
public int resultIndex(int param1Int) {
return param1Int;
}
}
enum null {
public int resultIndex(int param1Int) {
return param1Int ^ 0xFFFFFFFF;
}
}
public enum KeyPresentBehavior {
ANY_PRESENT {
<E> int resultIndex(Comparator<? super E> param2Comparator, E param2E, List<? extends E> param2List, int param2Int) {
return param2Int;
}
},
FIRST_AFTER,
FIRST_PRESENT,
LAST_BEFORE,
LAST_PRESENT {
<E> int resultIndex(Comparator<? super E> param2Comparator, E param2E, List<? extends E> param2List, int param2Int) {
int i = param2List.size() - 1;
while (param2Int < i) {
int j = param2Int + i + 1 >>> 1;
if (param2Comparator.compare(param2List.get(j), param2E) > 0) {
i = j - 1;
continue;
}
param2Int = j;
}
return param2Int;
}
};
static {
FIRST_AFTER = new null("FIRST_AFTER", 3);
LAST_BEFORE = new null("LAST_BEFORE", 4);
$VALUES = new KeyPresentBehavior[] { ANY_PRESENT, LAST_PRESENT, FIRST_PRESENT, FIRST_AFTER, LAST_BEFORE };
}
abstract <E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int);
}
enum null {
<E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) {
return param1Int;
}
}
enum null {
<E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) {
int i = param1List.size() - 1;
while (param1Int < i) {
int j = param1Int + i + 1 >>> 1;
if (param1Comparator.compare(param1List.get(j), param1E) > 0) {
i = j - 1;
continue;
}
param1Int = j;
}
return param1Int;
}
}
enum null {
<E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) {
int i = 0;
while (i < param1Int) {
int j = i + param1Int >>> 1;
if (param1Comparator.compare(param1List.get(j), param1E) < 0) {
i = j + 1;
continue;
}
param1Int = j;
}
return i;
}
}
enum null {
public <E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) {
return LAST_PRESENT.<E>resultIndex(param1Comparator, param1E, param1List, param1Int) + 1;
}
}
enum null {
public <E> int resultIndex(Comparator<? super E> param1Comparator, E param1E, List<? extends E> param1List, int param1Int) {
return FIRST_PRESENT.<E>resultIndex(param1Comparator, param1E, param1List, param1Int) - 1;
}
}
}
/* Location: Y:\classes-dex2jar.jar!\com\google\common\collect\SortedLists.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/ | [
"ryank231231@gmail.com"
] | ryank231231@gmail.com |
ee3785b5217155bb39f3445615f4357155911176 | 1430ac50c1ae1edcae5fe224940fb45454609873 | /test/java/TestArticleDAO.java | 60cfe4cedfb418d988c056e1ac8e33a91f721c81 | [] | no_license | TishukBogdana/Spring-App-Courseproject | 0e792d2a819d72ea728202ceb4d20fa913395a41 | 03096b39a9a049de8fadcfe4f21f38fef4483f16 | refs/heads/master | 2021-09-16T07:14:00.317611 | 2018-06-18T11:08:59 | 2018-06-18T11:08:59 | 110,644,036 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,427 | java | import ru.ifmo.cs.domain.Article;
import ru.ifmo.cs.servimplementations.ArticleServiceImpl;
import ru.ifmo.cs.domain.Human;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import java.sql.Timestamp;
import java.util.List;
/**
* Created by Богдана on 13.11.2017.
*/
public class TestArticleDAO extends Assert {
ArticleServiceImpl serv;
@Before
public void init(ApplicationContext context){
serv = context.getBean(ArticleServiceImpl.class);
}
@Test
public void testFindByName(String name, int exp){
List<Article> list = serv.findByName(name);
assertNotNull(list);
assertEquals(exp,list.size());
}
@Test
public void testFindByAuthor(Human human, int exp){
List<Article> list = serv.findByAuthor(human);
assertNotNull(list);
assertEquals(exp, list.size());
}
@Test
public void testFindByDateIsAfter(Timestamp stamp, int nexp){
List<Article> list = serv.findByDateAddIsAfter(stamp);
assertNotEquals(nexp, list.size());
}
@Test
public void testFindByDateIsBefore(Timestamp stamp, int nexp){
List<Article> list = serv.findByDateAddIsBefore(stamp);
assertNotEquals(nexp, list.size());
}
@Test
public void testFindByNameAndAuthor(String name, Human human, int exp){
List<Article> list = serv.findByNameAndAuthor(name,human);
assertEquals(exp,list.size());
}
@Test
public void testSave(Article article){
serv.save(article);
article = serv.findOne(article.getIdArticle());
assertNotNull(article);
}
@Test
public void restRemoveByName(String name){
serv.removeByName(name);
List<Article> list = serv.findByName(name);
assertEquals(0,list.size());
}
@Test
public void restRemoveByAuthor(Human author){
serv.removeByAuthor(author);
List<Article> list = serv.findByAuthor(author);
assertEquals(0,list.size());
}
@Test
public void testUpdateByNameAndBody(String prev, Human author, String name, String body, Timestamp stamp){
List<Article> before = serv.findByNameAndAuthor(prev,author);
serv.updateByNameAndBody(prev,author, name, body,stamp);
List<Article>after = serv.findByNameAndAuthor(name,author);
assertNotEquals(before,after);
}
}
| [
"tishuk52@gmail.com"
] | tishuk52@gmail.com |
2d102e6c0b3bd51a1fd8cbba137f1714e297b187 | 3d4349c88a96505992277c56311e73243130c290 | /Preparation/processed-dataset/data-class_3_344/24.java | 4c69891eab17c320b1f8fb15fac21884eac6023e | [] | no_license | D-a-r-e-k/Code-Smells-Detection | 5270233badf3fb8c2d6034ac4d780e9ce7a8276e | 079a02e5037d909114613aedceba1d5dea81c65d | refs/heads/master | 2020-05-20T00:03:08.191102 | 2019-05-15T11:51:51 | 2019-05-15T11:51:51 | 185,272,690 | 7 | 4 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | /**
* To support EXSLT extensions, convert names with dash to allowable Java names:
* e.g., convert abc-xyz to abcXyz.
* Note: dashes only appear in middle of an EXSLT function or element name.
*/
protected static String replaceDash(String name) {
char dash = '-';
StringBuffer buff = new StringBuffer("");
for (int i = 0; i < name.length(); i++) {
if (i > 0 && name.charAt(i - 1) == dash)
buff.append(Character.toUpperCase(name.charAt(i)));
else if (name.charAt(i) != dash)
buff.append(name.charAt(i));
}
return buff.toString();
}
| [
"dariusb@unifysquare.com"
] | dariusb@unifysquare.com |
e91859504a48865717cff5d4ae8d6ed04e742bb7 | b93b6d3ae39398cb9044b6c76dd5e580344e4848 | /src/main/java/com/dessy/penjualan/dao/HdrSuratJalanDaoImpl.java | f299d06fa628f3b35c14ce55ae7c9a9f9e90e251 | [] | no_license | saifiahmada/penjualan | d5c0fe582ae1a8a21b751622af264cac8757385f | 7d7fefba281a0fb0c37c35059810f922d7be8437 | refs/heads/master | 2021-01-01T19:51:42.788881 | 2015-01-17T02:43:02 | 2015-01-17T02:43:02 | 29,377,314 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,212 | java | package com.dessy.penjualan.dao;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.dessy.penjualan.bean.DtlPicklist;
import com.dessy.penjualan.bean.DtlSuratJalan;
import com.dessy.penjualan.bean.DtlSuratJalanPK;
import com.dessy.penjualan.bean.HdrPicklist;
import com.dessy.penjualan.bean.HdrSuratJalan;
import com.dessy.penjualan.bean.MstDealer;
import com.dessy.penjualan.common.GenericHibernateDao;
import com.dessy.penjualan.util.DateConv;
import com.dessy.penjualan.util.StringUtil;
import com.dessy.penjualan.viewmodel.SuratJalanVM;
@Repository
public class HdrSuratJalanDaoImpl extends GenericHibernateDao<HdrSuratJalan, String> implements HdrSuratJalanDao {
@Autowired
private HdrPicklistDao hdrPicklistDao;
@Autowired
private MstRunnumDao mstRunnumDao;
@Autowired
private MstDealerDao mstDealerDao;
public String generateSuratJalan(String noPicklist,String kdDlr) {
HdrPicklist pick = hdrPicklistDao.get(noPicklist);
MstDealer dealer = mstDealerDao.get(kdDlr);
String idDoc = "SJ";
String reseter = DateConv.format(new Date(), "yyyyMM");
int no = mstRunnumDao.getRunningNumber(idDoc, reseter);
String noSj = StringUtil.getFormattedRunno(idDoc, Integer.valueOf(no));
HdrSuratJalan sj = new HdrSuratJalan(noSj);
sj.setAlamatPenerima(dealer.getAlamat());
sj.setKdDlr(kdDlr);
sj.setNamaPenerima(dealer.getNamaDealer());
sj.setNoPicklist(noPicklist);
sj.setStatus("A");
sj.setTglSj(new Date());
Set<DtlSuratJalan> dtlSjs = new HashSet<DtlSuratJalan>();
for (DtlPicklist dtlPick : pick.getDtlpicklists()) {
String noMesin = dtlPick.getDtlPicklistPK().getNoMesin();
String kdItem = dtlPick.getKdItem();
String noRangka = dtlPick.getNoRangka();
DtlSuratJalan dtlSj = new DtlSuratJalan(new DtlSuratJalanPK(noMesin, noSj));
dtlSj.setKdItem(kdItem);
dtlSj.setNoRangka(noRangka);
dtlSj.setHdrSuratJalan(sj);
dtlSjs.add(dtlSj);
}
sj.setDtlSuratJalans(dtlSjs);
pick.setStatus("B");
hdrPicklistDao.update(pick);
super.saveOrUpdate(sj);
return noSj;
}
}
| [
"saifiahmada@gmail.com"
] | saifiahmada@gmail.com |
b7e4296922d4199fae1a2efdc778a594deeaba3e | c99a2248e2a312a706833cf81c3ae62bf9b1b3b6 | /server/moneyxchange-api/src/test/java/com/belatrixsf/ApplicationTests.java | 5aa1b0453ccbba8b8deece89d82dc363ba91c9fd | [] | no_license | jaraoscar/moneyxchange | 065cdc9948d885b9d340aa82b795083dc4adc3cc | 6dbb75cb41047a57fb02900db5eb55a909c22852 | refs/heads/master | 2021-04-15T04:59:03.047545 | 2018-03-26T15:37:19 | 2018-03-26T15:37:19 | 126,744,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,971 | java | package com.belatrixsf;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import com.belatrixsf.model.User;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Test cases.
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTests {
@Autowired
private ObjectMapper objectMapper;
@Autowired
private WebApplicationContext webApplicationContext;
private MockMvc mockMvc;
private User loginUser;
@Before
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
this.loginUser = new User();
}
/**
* Test user authentication and token generation.
* @throws Exception
*/
@Test
public void testAuthenticationAndTokenGeneration() throws Exception {
this.loginUser.setUsername("oscar.jara");
this.loginUser.setPassword("admin");
String json = objectMapper.writeValueAsString(this.loginUser);
this.mockMvc.perform(post("/token/auth")
.contentType(MediaType.APPLICATION_JSON)
.content(json))
.andExpect(status().isOk())
.andExpect(jsonPath("$.token", notNullValue()));
}
} | [
"oscar_e24@hotmail.com"
] | oscar_e24@hotmail.com |
7b3942d397cfdf771bf0d83de4e12ca87ff0ac40 | a1eb4a73fdd15c23c5505a6d0b8ce4d63647ae8d | /src/main/java/com/example/travelnote/imagehandle/BitmapCompress.java | 8a630d021470e460e304ef866b6605178a557c54 | [] | no_license | annio2/Travelnote | a305bf927e2f79f3f0151b5c0a58a1cb138f94df | 085e3589132b01c1cbaddc2f0a41daae5607eb51 | refs/heads/master | 2021-01-22T21:12:49.582180 | 2017-08-25T06:08:47 | 2017-08-25T06:08:47 | 100,679,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,192 | java | package com.example.travelnote.imagehandle;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.widget.ImageView;
import com.example.travelnote.bean.ImageViewSize;
import com.example.travelnote.utils.ImageViewSizeUtils;
import com.orhanobut.logger.Logger;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
/**
* Created by wuguanglin on 2017/8/9.
*/
public class BitmapCompress {
//bitmap占用内存 = bitmap宽 * bitmap高 * 单个像素点所占字节
private ImageViewSize imageViewSize;
//
public Bitmap getSmallBitmap(ImageView imageView, byte[] byteBitmap) {
imageViewSize = ImageViewSizeUtils.getImageViewSize(imageView);
Logger.e("imageview宽高", imageViewSize.getImageHeight());
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(byteBitmap, 0, byteBitmap.length, options);
options.inSampleSize = calculateInSampleSize(options, imageViewSize.getImageWidth(), imageViewSize.getImageHeight());
options.inJustDecodeBounds = false;
options.inPreferredConfig = Bitmap.Config.RGB_565;//一个像素点占用2个字节
Bitmap bitmap = BitmapFactory.decodeByteArray(byteBitmap, 0, byteBitmap.length, options);
if (bitmap != null) {
return bitmap;
}
return null;
}
public Bitmap getMartixScaleBitmap(ImageView imageView, byte[] byteBitmap){
imageViewSize = ImageViewSizeUtils.getImageViewSize(imageView);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(byteBitmap, 0, byteBitmap.length, options);
float zootSize = calculateFloatZoomSize(options, imageViewSize.getImageWidth(), imageViewSize.getImageHeight());
options.inJustDecodeBounds = false;
Matrix matrix = new Matrix();
matrix.setScale(zootSize, zootSize);
Bitmap bitmapSource = BitmapFactory.decodeByteArray(byteBitmap, 0, byteBitmap.length);
Bitmap bitmap = Bitmap.createBitmap(bitmapSource, 0, 0, bitmapSource.getWidth(), bitmapSource.getHeight(), matrix, true);
if (bitmap != null){
return bitmap;
}
return null;
}
//根据ImageView的宽和高,网络下载的图片的宽和高计算压缩比例
private int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
int inSampleSize = 1;
int w = options.outWidth;//图片宽
int h = options.outHeight;//图片高
if (reqWidth < w || reqHeight < h) {
int wratio = Math.round((w * 1.0f) / reqWidth);
int hratio = Math.round((h * 1.0f) / reqWidth);
inSampleSize = Math.max(wratio, hratio);
}
return inSampleSize;
}
//计算缩放比例,返回浮点数,设置Matrix的缩放
private float calculateFloatZoomSize(BitmapFactory.Options options, int reqWidth, int reqHeight){
float rootSize = 1.0f;
int w = options.outWidth;
int h = options.outHeight;//bitmap的宽和高
if (reqWidth < w || reqHeight < h){
float wratio = (float) w / reqWidth;
float hratio = (float) h / reqHeight;
rootSize = Math.max(wratio, hratio);
}
return rootSize;
}
//质量压缩,不改变内存占用大小,存到文件系统会变小
private Bitmap compressBitmap(Bitmap image) {
ByteArrayOutputStream bao = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, bao);
int options = 90;
while (bao.toByteArray().length / 1024 > 100) {
bao.reset();
image.compress(Bitmap.CompressFormat.JPEG, options, bao);
options -= 10;
if (options < 0){
options = 90;
}
}
ByteArrayInputStream is = new ByteArrayInputStream(bao.toByteArray());
return BitmapFactory.decodeStream(is);//返回bitmap相当于什么都没做
}
}
| [
"wuguanglin@xyz.cn"
] | wuguanglin@xyz.cn |
e9dc0f9fb65874cd5d475438f328b84668e38547 | 4fbedc43b1a6707f72bb21212fb0fe24d1a522a7 | /MeetingRooms.java | 05776f7d74f7cfe6eefa4f120d943c2ba0dcab0c | [] | no_license | kastergarta/java_training_leetcode | 12471ed4692e68d9f8ea2983939ffd8dea120cb1 | dfd9b0390da62244ad35b2ae30908d2dceb7b77d | refs/heads/master | 2023-02-12T03:42:36.453342 | 2021-01-08T03:39:14 | 2021-01-08T03:39:14 | 295,906,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | public class MeetingRooms {
public int minMeetingRooms(Interval[] intervals) {
int ans = 0, curr = 0;
List<TimePoint> timeline = new ArrayList<>();
for (Interval interval: intervals) {
timeline.add(new TimePoint(interval.start, 1));
timeline.add(new TimePoint(interval.end, -1));
}
timeline.sort(new Comparator<TimePoint>() {
public int compare(TimePoint a, TimePoint b) {
if (a.time != b.time) return a.time - b.time;
else return a.room - b.room;
}
});
for (TimePoint t: timeline) {
curr += t.room;
if (curr >= ans) ans = curr;
}
return ans;
}
private class TimePoint {
int time;
int room;
TimePoint(int time, int room) {
this.time = time;
this.room = room;
}
}
}
}
| [
"dennis.basyrov@gmail.com"
] | dennis.basyrov@gmail.com |
de1e217028ff70d135a430408d0c27af72741b04 | d7687daa6563ff35ebff5a52234ae247b1058a94 | /FaceDetection/src/window.java | 3b05496523d295f1a3a554f39b1f75509aef1b8b | [] | no_license | sukanth/FaceDetection | 5c1c0c8c5717eaf30dc9d63601b5e267958a7f05 | 8d5f209444efdaa82235d66f32e67813557660cc | refs/heads/master | 2021-01-21T09:12:06.902904 | 2017-05-18T04:34:20 | 2017-05-18T04:34:20 | 91,648,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,717 | java |
import javax.swing.JFrame;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.videoio.VideoCapture;
public class window {
public static void main(String arg[]){
// Load the native library.
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
String window_name = "Capture - Face detection";
JFrame frame = new JFrame(window_name);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400,400);
processor my_processor=new processor();
My_Panel my_panel = new My_Panel();
frame.setContentPane(my_panel);
frame.setVisible(true);
//-- 2. Read the video stream
Mat webcam_image=new Mat();
VideoCapture capture =new VideoCapture(-1);
if( capture.isOpened())
{
while( true )
{
capture.read(webcam_image);
if( !webcam_image.empty() )
{
frame.setSize(2*webcam_image.width()+40,2*webcam_image.height()+60);
//-- 3. Apply the classifier to the captured image
webcam_image=my_processor.detect(webcam_image);
//-- 4. Display the image
my_panel.MatToBufferedImage(webcam_image); // We could look at the error...
my_panel.repaint();
}
else
{
System.out.println(" --(!) No captured frame -- Break!");
break;
}
}
}
return;
}
} | [
"sukanth_g@yahoo.co.in"
] | sukanth_g@yahoo.co.in |
7f57f3e58ef7cbe54b80351d74f6005e3654b10b | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/com/tencent/p177mm/p230g/p231a/C37726hi.java | 655c4507b93207192f2f0bc6c7badac29a051281 | [] | no_license | xsren/AndroidReverseNotes | 9631a5aabc031006e795a112b7ac756a8edd4385 | 9202c276fe9f04a978e4e08b08e42645d97ca94b | refs/heads/master | 2021-04-07T22:50:51.072197 | 2019-07-16T02:24:43 | 2019-07-16T02:24:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 641 | java | package com.tencent.p177mm.p230g.p231a;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.p177mm.sdk.p600b.C4883b;
/* renamed from: com.tencent.mm.g.a.hi */
public final class C37726hi extends C4883b {
public C26154a cCe;
/* renamed from: com.tencent.mm.g.a.hi$a */
public static final class C26154a {
public boolean cCf = false;
}
public C37726hi() {
this((byte) 0);
}
private C37726hi(byte b) {
AppMethodBeat.m2504i(114425);
this.cCe = new C26154a();
this.xxG = false;
this.callback = null;
AppMethodBeat.m2505o(114425);
}
}
| [
"alwangsisi@163.com"
] | alwangsisi@163.com |
4892651a7f40208742b8eeead39d8ed7bd5cc865 | b8bb6c94e4ba7d95687688fedd54ce33e2c2dd76 | /src/test/java/com/bigin/biginapi/controller/recommend/RecommendControllerTest.java | c834910c87b9af9690bbad8d3f4cdbc3fa35a391 | [] | no_license | goslim56/bigin-api | 06fe61201f0908cae99d75fb58c847c6df7d1a99 | 58c38a055a07a74a9d2290358ace620960182327 | refs/heads/master | 2023-07-15T01:32:17.045275 | 2021-08-10T10:11:34 | 2021-08-10T10:11:34 | 393,038,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,264 | java | package com.bigin.biginapi.controller.recommend;
import com.bigin.biginapi.request.BasicRequestBody;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@ExtendWith(SpringExtension.class)
@SpringBootTest
@AutoConfigureMockMvc
class RecommendControllerTest {
@Autowired
MockMvc mockMvc;
@Autowired
ObjectMapper objectMapper;
@Test
public void 메인페이지_상품_추천_키워드() throws Exception {
BasicRequestBody basicRequestBody = BasicRequestBody.builder()
.uuid("1234")
.productCodes(new String[]{"1","2","3","4"})
.keyword(new String[]{"청바지", "반바지", "pk티셔츠"})
.cartProductCodes(new String[]{"1"})
.purchasedProductCodes(new String[]{"1","2","3","4"})
.build();
mockMvc.perform(post("/recommend/main")
.contentType(MediaType.APPLICATION_JSON_UTF8)
.accept(MediaTypes.HAL_JSON)
.content(objectMapper.writeValueAsString(basicRequestBody)))
.andDo(print())
.andExpect(status().isOk());
}
@Test
public void 메인페이지_상품_추천_키워드_X() throws Exception {
BasicRequestBody basicRequestBody = BasicRequestBody.builder()
.uuid("1234")
.productCodes(new String[]{"1","2","3","4"})
.cartProductCodes(new String[]{"1"})
.purchasedProductCodes(new String[]{"1","2","3","4"})
.build();
mockMvc.perform(post("/recommend/main")
.contentType(MediaType.APPLICATION_JSON_UTF8)
.accept(MediaTypes.HAL_JSON)
.content(objectMapper.writeValueAsString(basicRequestBody)))
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().string(""))
;
}
@Test
public void 상품_상세_페이지_추천() throws Exception {
BasicRequestBody basicRequestBody = BasicRequestBody.builder()
.uuid("1234")
.productCodes(new String[]{"1","2","3","4"})
.keyword(new String[]{"청바지", "반바지", "pk티셔츠"})
.cartProductCodes(new String[]{"1"})
.purchasedProductCodes(new String[]{"1","2","3","4"})
.build();
mockMvc.perform(post("/recommend/product_detail")
.contentType(MediaType.APPLICATION_JSON_UTF8)
.accept(MediaTypes.HAL_JSON)
.content(objectMapper.writeValueAsString(basicRequestBody)))
.andDo(print())
.andExpect(status().isOk())
;
}
@Test
public void 장바구니_추천() throws Exception {
BasicRequestBody basicRequestBody = BasicRequestBody.builder()
.uuid("1234")
.productCodes(new String[]{"1","2","3","4"})
.keyword(new String[]{"청바지", "반바지", "pk티셔츠"})
.cartProductCodes(new String[]{"1"})
.purchasedProductCodes(new String[]{"1","2","3","4"})
.build();
mockMvc.perform(post("/recommend/cart")
.contentType(MediaType.APPLICATION_JSON_UTF8)
.accept(MediaTypes.HAL_JSON)
.content(objectMapper.writeValueAsString(basicRequestBody)))
.andDo(print())
.andExpect(status().isOk());
}
} | [
"goslim56@gmail.com"
] | goslim56@gmail.com |
b10b9562ffe57c9384e87ede00da6b1149d1ee84 | 2f4af1a8e668041c7260179e8f455857b0291855 | /app/src/main/java/com/myapplicationdev/android/demoimageview/MainActivity.java | 67131d9d1bdde4cfe9fe9eb06b26a4a616038f34 | [] | no_license | MINGLINXU/DemoImageView | 72d0a2bb705eccd1b7437940daed1c4771babf61 | a7937ad95cc79512eb1d1119d33e2669dbffd187 | refs/heads/master | 2022-06-01T23:35:11.667568 | 2020-05-04T02:59:42 | 2020-05-04T02:59:42 | 261,066,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.myapplicationdev.android.demoimageview;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
//Declare the ImageView object called ivDay2
ImageView ivDay2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Get the ImageView object and assign to ivDay2
ivDay2 = (ImageView)findViewById(R.id.imageView2);
ivDay2.setImageResource(R.drawable.day2);
}
}
| [
"18046506@myrp.edu.sg"
] | 18046506@myrp.edu.sg |
95bf966f6154ad73e5f35c04aa27e68844d0f40d | 7d41b9dd344a483e8d3c8a4577984d023a1178ac | /core/src/main/java/com/rbc/stockmarket/util/StockFileParser.java | fa562897383485d8edbe04242e906a92688a68e5 | [] | no_license | ZAsadi/stock-market-data | 7f0f9f46ed72bc6952fc8f72fa517f68c0f49237 | ff36045a66c56e90054d483cd26322c6ba2e602c | refs/heads/master | 2022-12-26T03:59:45.039139 | 2020-10-14T03:57:05 | 2020-10-14T03:57:05 | 303,887,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,143 | java | package com.rbc.stockmarket.util;
import com.rbc.stockmarket.dto.StockDto;
import com.rbc.stockmarket.exception.common.ValidatorException;
import com.rbc.stockmarket.exception.storage.FileIsEmptyException;
import com.rbc.stockmarket.exception.storage.FileNotSupportedException;
import com.rbc.stockmarket.model.Stock;
import com.rbc.stockmarket.util.validator.Validator;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
public class StockFileParser {
private static final String EXTENSION = "data";
public static List<Stock> parse(MultipartFile file) {
List<Stock> result = new ArrayList<>();
if (file.isEmpty()) {
throw new FileIsEmptyException("Empty files not allowed for uploading.");
}
if (file.getOriginalFilename() != null) {
String fileName = StringUtils.cleanPath(file.getOriginalFilename());
String extension = fileName.split("\\.")[1];
if (extension != null && !extension.isEmpty() && extension.equals(EXTENSION)) {
try {
InputStream inputStream = file.getInputStream();
new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)).lines().forEach(new Consumer<String>() {
@Override
public void accept(String line) {
String[] values = line.split(",");
try {
result.add(StockMapper.toStock(buildStockDto(values)));
} catch (ValidatorException ignore) {
//ignore corrupted lines
}
}
});
} catch (IOException e) {
throw new FileNotSupportedException(e.getMessage());
}
} else {
throw new FileNotSupportedException("File with extension: '" + extension + "' not supported for uploading");
}
} else {
throw new FileNotSupportedException("No file has been chosen for uploading.");
}
return result;
}
private static StockDto buildStockDto(String[] values) {
try {
StockDto stockDto = new StockDto();
stockDto.setQuarter(Integer.valueOf(values[0]))
.setStock(values[1])
.setDate(values[2])
.setOpen(values[3].isEmpty() ? null : values[3])
.setHigh(values[4].isEmpty() ? null : values[4])
.setLow(values[5].isEmpty() ? null : values[5])
.setClose(values[6].isEmpty() ? null : values[6])
.setVolume(values[7].isEmpty() ? null : Long.valueOf(values[7]))
.setPercentChangePrice(values[8].isEmpty() ? null : Float.valueOf(values[8]))
.setPercentChangeVolumeOverLastWeek(values[9].isEmpty() ? null : Float.valueOf(values[9]))
.setPreviousWeeksVolume(values[10].isEmpty() ? null : Long.valueOf(values[10]))
.setNextWeekOpen(values[11].isEmpty() ? null : values[11])
.setNextWeekClose(values[12].isEmpty() ? null : values[12])
.setPercentChangeNextWeeksPrice(values[13].isEmpty() ? null : Float.valueOf(values[13]))
.setDaysToNextDividend(values[14].isEmpty() ? null : Integer.valueOf(values[14]))
.setPercentReturnNextDividend(values[15].isEmpty() ? null : Float.valueOf(values[15]));
Validator.validateStockDto(stockDto);
return stockDto;
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
throw new ValidatorException("Some lines in files data is corrupted");
}
}
}
| [
"zaraa.asadi@gmail.com"
] | zaraa.asadi@gmail.com |
2fb87c8b59a4a0ec801b0cff2be63e00a5e68972 | 01a96561592375838183142a2cb9bfeba283f02b | /weallt-service/src/main/java/com/weallt/service/security/RegistrationService.java | 9c55f0d8893fab7eb0d358429b3996dc329ba882 | [] | no_license | Joncii/weallt | c79505b0eef119b0f3312d58137018bc137448a9 | bcc04b0f0b0095be1aa976f845d41acacba8c722 | refs/heads/master | 2020-12-30T14:33:36.170737 | 2017-05-17T22:06:00 | 2017-05-17T22:06:00 | 91,320,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package com.weallt.service.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.weallt.service.security.dao.DefaultUserDao;
import com.weallt.service.security.domain.RegistrationEntry;
import com.weallt.service.security.domain.User;
import com.weallt.service.security.exception.EmailAlreadyRegisteredException;
@Service
public class RegistrationService {
@Autowired
private DefaultUserDao userDao;
public void register(RegistrationEntry entry){
if(userDao.containsEmail(entry.getEmail())){
throw new EmailAlreadyRegisteredException();
}
userDao.register(entry);
}
public User findUserByEmail(String email){
return userDao.getByEmail(email);
}
}
| [
"Gergely_Jonas@epam.com"
] | Gergely_Jonas@epam.com |
5b0c513cc88ca4cbad7db34b9f2ae044726ee114 | 028e41b41e7117d8fff5a2f0375324e08e293231 | /src/main/java/pl/edu/agh/edgentandroidwrapper/task/EdgentTask.java | feb6f94048cfd3a637fb50f24a79b3b425fc1cf9 | [
"Apache-2.0"
] | permissive | pedrycz/edgent-android-wrapper | bb60ae48a75a532e05cf6cc02f81fc82832793a6 | 8d59abb71092ea41e608e840932e5aaf1e5a83fa | refs/heads/master | 2020-03-14T08:24:55.685214 | 2018-06-19T18:35:33 | 2018-06-19T18:35:33 | 131,524,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package pl.edu.agh.edgentandroidwrapper.task;
import android.hardware.SensorManager;
import lombok.Builder;
import lombok.Singular;
import pl.edu.agh.edgentandroidwrapper.collector.SensorDataCollector;
import java.util.ArrayList;
import java.util.List;
@Builder
public class EdgentTask {
@Singular
private List<SensorDataCollector> sensorDataCollectors = new ArrayList<>();
private SensorManager sensorManager;
public void start() {
sensorDataCollectors
.forEach(collector -> collector.startCollecting(sensorManager));
}
}
| [
"piotr.wachala@outlook.com"
] | piotr.wachala@outlook.com |
0e781c39e9c3b954841df6314860f0004a38317b | 06d5645966b1e8a24e36ffcc04d86d6992624549 | /src/main/java/ru/carabi/server/face/injectable/CurrentProduct.java | bff3cb7f81d3890666ec3d8c349af535dee9413e | [
"Apache-2.0"
] | permissive | Carabi/carabiserver | f31bf2d8ff8305c01b458e929c6c17d38b40999f | 57591fe3d65d31aef290c883f51aafd4997adbb0 | refs/heads/master | 2021-01-22T16:05:29.100756 | 2017-04-13T22:37:20 | 2017-04-13T22:39:42 | 45,135,867 | 0 | 0 | null | 2015-11-16T11:23:24 | 2015-10-28T19:10:18 | Java | UTF-8 | Java | false | false | 2,722 | java | package ru.carabi.server.face.injectable;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ru.carabi.server.CarabiException;
import ru.carabi.server.entities.ProductVersion;
import ru.carabi.server.entities.SoftwareProduct;
import ru.carabi.server.kernel.ProductionBean;
/**
* Данные о продукте, просматриваемые на портале
* @author sasha<kopilov.ad@gmail.com>
*/
@Named(value = "currentProduct")
@RequestScoped
public class CurrentProduct implements Serializable {
@Inject private CurrentClient currentClient;
@EJB private ProductionBean productionBean;
private SoftwareProduct product;
private ProductVersion lastVersion;
@PostConstruct
public void postConstruct() {
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
String productSysname = request.getParameter("product");
product = productionBean.findProduct(productSysname);
if (product == null) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
}
public boolean getExists() {
return product != null;
}
public String getMetatitle() {
if (getExists()) {
return getName();
} else {
return "Not found";
}
}
public String getName() {return product.getName();}
public String getSysname() {return product.getSysname();}
public String getDescription() {return product.getDescription();}
public String getHomeUrl() {return product.getHomeUrl();}
public ProductVersion getLastVersion() throws CarabiException {
if (lastVersion == null && product != null) {
lastVersion = productionBean.getLastVersion(currentClient.getUserLogon(), product.getSysname(), FormatTool.getDepartment(currentClient), false);
FormatTool.correctDownloadUrl(product, lastVersion);
}
return lastVersion;
}
public List<ProductVersion> getVersionsList() throws CarabiException {
List<ProductVersion> versionsList = productionBean.getVersionsList(currentClient.getUserLogon(), product.getSysname(), FormatTool.getDepartment(currentClient), false, false);
for (ProductVersion version: versionsList) {
FormatTool.correctDownloadUrl(product, version);
}
return versionsList;
}
}
| [
"kopilov.ad@gmail.com"
] | kopilov.ad@gmail.com |
33eef65bc1ee15366bc92ebb1afc18bbedcc637e | 341ccaa07a59857e9f05b2ba65ba04362cca3a3a | /app/src/main/java/app/pbl/hcc/pblapp/Report.java | 4fdbb158c392f74403508710776a5b02fd9e5adc | [] | no_license | lemfn64/FinalPBL | 5c0ddbb8457a58cf4e5a1e03688f67dd42aba713 | 44587d9445bedc06298b3b987827bba44ea0f6a8 | refs/heads/master | 2021-01-22T06:14:42.959376 | 2017-02-13T02:14:51 | 2017-02-13T02:14:51 | 81,750,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 945 | java | package app.pbl.hcc.pblapp;
/**
* object representation of a error report
*/
public class Report {
private int rate;
private String email;
private String error;
private String name;
public Report() {
}
public Report(int rate, String email, String error, String name) {
this.rate = rate;
this.email = email;
this.error = error;
this.name = name;
}
public int getRate() {
return rate;
}
public void setRate(int rate) {
this.rate = rate;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"lemfn64@gmail.com"
] | lemfn64@gmail.com |
39ecce34c54f9d6659cbfb93a7b2a542ccad4d5e | 5375bc0f58022c610872825450c3b694ffaaff98 | /src/main/java/com/tfg/bookmanagerrmh2/repository/AuthorRepository.java | 4aa9df946dbfeacc95d970d7f61c012c01b86980 | [] | no_license | PabloGitu/bookmanagerRMH2 | 76f00c5c1294a8908df70f77ad9d6c47ac904709 | 82ffd416e1f9860280682ce828a35ccbac939e5a | refs/heads/master | 2020-04-27T09:57:22.620993 | 2019-03-21T16:56:53 | 2019-03-21T16:56:53 | 174,235,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package com.tfg.bookmanagerrmh2.repository;
import com.tfg.bookmanagerrmh2.domain.Author;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the Author entity.
*/
@SuppressWarnings("unused")
@Repository
public interface AuthorRepository extends JpaRepository<Author, Long> {
}
| [
"pablo-96-bnk@hotmail.com"
] | pablo-96-bnk@hotmail.com |
88e79f880e347b5bcce10bd1b287de6e98b35de9 | d01d2f244dfe42b2c0568361273b2b9dedf0c6c2 | /src/main/java/org/noorganization/instalist/comm/message/ProductInfo.java | ced9f942599e5ac80a1328614df650baa948a197 | [
"Apache-2.0"
] | permissive | InstaList/instalist-comm | 59224063370f76028102be9c9fb6a76c6e68bcef | 4e68a3a52346de187aa4f4d612a2ca04783e3115 | refs/heads/master | 2021-01-10T17:50:38.053725 | 2016-10-12T19:45:29 | 2016-10-12T19:45:29 | 52,970,579 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,574 | java |
/*
* Copyright 2016 Tino Siegmund, Michael Wodniok
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.noorganization.instalist.comm.message;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.util.StdDateFormat;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({ "uuid", "name", "unituuid", "defaultamount", "stepamount", "lastchanged",
"deleted" })
public class ProductInfo extends EntityObject {
private String mUUID;
private String mName;
private String mUnitUUID;
private Float mDefaultAmount;
private Float mStepAmount;
private Date mLastChanged;
private Boolean mDeleted;
private Boolean mRemoveUnit;
@JsonProperty("uuid")
public String getUUID() {
return mUUID;
}
@JsonProperty("uuid")
public void setUUID(String id) {
this.mUUID = id;
}
public void setUUID(UUID _uuid) {
setUUID(_uuid != null ? _uuid.toString() : null);
}
public ProductInfo withUUID(String _uuid) {
setUUID(_uuid);
return this;
}
public ProductInfo withUUID(UUID _uuid) {
setUUID(_uuid);
return this;
}
@JsonProperty("name")
public String getName() {
return mName;
}
@JsonProperty("name")
public void setName(String _name) {
mName = _name;
}
public ProductInfo withName(String name) {
setName(name);
return this;
}
@JsonProperty("defaultamount")
public Float getDefaultAmount() {
return mDefaultAmount;
}
@JsonProperty("defaultamount")
public void setDefaultAmount(Float _defaultAmount) {
mDefaultAmount = _defaultAmount;
}
public ProductInfo withDefaultAmount(Float _defaultAmount) {
setDefaultAmount(_defaultAmount);
return this;
}
@JsonProperty("stepamount")
public Float getStepAmount() {
return mStepAmount;
}
@JsonProperty("stepamount")
public void setStepAmount(Float _stepAmount) {
mStepAmount = _stepAmount;
}
public ProductInfo withStepAmount(Float _stepAmount) {
setStepAmount(_stepAmount);
return this;
}
@JsonProperty("unituuid")
public String getUnitUUID() {
return mUnitUUID;
}
@JsonProperty("unituuid")
public void setUnitUUID(String _uuid) {
mUnitUUID = _uuid;
}
public void setUnitUUID(UUID _uuid) {
setUnitUUID(_uuid != null ? _uuid.toString() : null);
}
public ProductInfo withUnitUUID(String _uuid) {
setUnitUUID(_uuid);
return this;
}
public ProductInfo withUnitUUID(UUID _uuid) {
setUnitUUID(_uuid);
return this;
}
@JsonProperty("removeunit")
public Boolean getRemoveUnit() {
return mRemoveUnit;
}
@JsonProperty("removeunit")
public void setRemoveUnit(Boolean _removeUnit) {
mRemoveUnit = _removeUnit;
}
public ProductInfo withRemoveUnit(Boolean _removeUnit) {
setRemoveUnit(_removeUnit);
return this;
}
@JsonProperty("lastchanged")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = StdDateFormat.DATE_FORMAT_STR_ISO8601)
public Date getLastChanged() {
return mLastChanged;
}
@JsonProperty("lastchanged")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = StdDateFormat.DATE_FORMAT_STR_ISO8601)
public void setLastChanged(Date _lastChanged) {
mLastChanged = _lastChanged;
}
public ProductInfo withLastChanged(Date _lastChanged) {
setLastChanged(_lastChanged);
return this;
}
@JsonProperty("deleted")
public Boolean getDeleted() {
return mDeleted;
}
@JsonProperty("deleted")
public void setDeleted(Boolean _deleted) {
mDeleted = _deleted;
}
public ProductInfo withDeleted(Boolean _deleted) {
setDeleted(_deleted);
return this;
}
}
| [
"michi@noorganization.org"
] | michi@noorganization.org |
646984f6779dfda6b3877a90037cd304a0d829e9 | 14f40e5a7bf97a72a7491f253022f6958c52f5db | /Arquitetura e Design de Projetos Java/loja/src/br/com/alura/loja/desconto/DescontoParaOrcamentoComValorMaiorQueQuinhetos.java | e19c705ee64bc49d6d3e3b701ebc6b4b8340a234 | [] | no_license | jmarlonsf/alura | b3be179c231d44b6ec0faa2857d9854fac662d2f | d816c9a2e4b19f36143bef9218ff6b12fbeedc7e | refs/heads/main | 2023-06-10T15:35:23.848108 | 2021-07-04T03:49:55 | 2021-07-04T03:49:55 | 368,151,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package br.com.alura.loja.desconto;
import br.com.alura.loja.orcamento.Orcamento;
import java.math.BigDecimal;
public class DescontoParaOrcamentoComValorMaiorQueQuinhetos extends Desconto {
public DescontoParaOrcamentoComValorMaiorQueQuinhetos(Desconto proximo) {
super(proximo);
}
public BigDecimal efetuarCalculo(Orcamento orcamento){
return orcamento.getValor().multiply(new BigDecimal("0.1"));
}
@Override
public boolean deveAplicar(Orcamento orcamento) {
return orcamento.getValor().compareTo(new BigDecimal("500")) > 0;
}
}
| [
"marlonsouto@gmail.com"
] | marlonsouto@gmail.com |
ec9e63a17a28b7c0d174a43775c7cedfe0c61ad7 | eb118856796700c92d4ff0ea9f56a37caddb3db4 | /showcase/bookstore/src/main/java/org/ocpsoft/rewrite/showcase/bookstore/web/list/YearBean.java | ed91532f9301658b2566d92efa92531d4a5b9a44 | [
"Apache-2.0"
] | permissive | ocpsoft/rewrite | b657892cdee10b748435cf50772c4a5f89b4832b | 081871aa06d3dd366100b025bc62bfbabadf7457 | refs/heads/main | 2023-09-05T20:03:04.413656 | 2023-03-21T15:08:26 | 2023-03-21T15:10:16 | 1,946,637 | 130 | 86 | Apache-2.0 | 2023-07-25T13:52:28 | 2011-06-24T08:51:19 | Java | UTF-8 | Java | false | false | 1,362 | java | /*
* Copyright 2011 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ocpsoft.rewrite.showcase.bookstore.web.list;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import org.ocpsoft.rewrite.showcase.bookstore.dao.BookDao;
import org.ocpsoft.rewrite.showcase.bookstore.model.Book;
@Named
@RequestScoped
public class YearBean
{
private Integer year;
@EJB
private BookDao bookDao;
private List<Book> books;
public void preRenderView()
{
books = bookDao.findByYear(year);
}
public List<Book> getBooks()
{
return books;
}
public Integer getYear()
{
return year;
}
public void setYear(Integer year)
{
this.year = year;
}
}
| [
"christian@kaltepoth.de"
] | christian@kaltepoth.de |
84a1d41da5f9a04b94cbd2da759e246be39c39fa | 9c7451f2aef4870537fe8be6e8cee4d7239a0e32 | /app/src/main/java/com/example/viewpager/OnboardingAdapter.java | c7befaf30176a2b3ab4e2367e03c6c344cd61b89 | [] | no_license | samseen/android-viewpager | 37e111b26b3e2ca32808dba6b6ecc10367162156 | ed094e87dd70ce6d0163433cc74af961abf2f1f7 | refs/heads/master | 2023-04-11T23:17:13.390376 | 2021-05-15T20:27:01 | 2021-05-15T20:27:01 | 366,519,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,997 | java | package com.example.viewpager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
public class OnboardingAdapter extends RecyclerView.Adapter<OnboardingAdapter.OnboardingViewHolder> {
private List<OnboardingItem> onboardingItems;
public OnboardingAdapter(List<OnboardingItem> onboardingItems) {
this.onboardingItems = onboardingItems;
}
@NonNull
@Override
public OnboardingViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new OnboardingViewHolder(
LayoutInflater.from(parent.getContext()).inflate(
R.layout.item_container_onboarding, parent, false
)
);
}
@Override
public void onBindViewHolder(@NonNull OnboardingAdapter.OnboardingViewHolder holder, int position) {
holder.setImageOnboarding(onboardingItems.get(position));
}
@Override
public int getItemCount() {
return onboardingItems.size();
}
class OnboardingViewHolder extends RecyclerView.ViewHolder {
private TextView textTitle;
private TextView textDescription;
private ImageView imageOnboarding;
public OnboardingViewHolder(@NonNull View itemView) {
super(itemView);
textTitle = itemView.findViewById(R.id.textTitle);
textDescription = itemView.findViewById(R.id.textDescription);
imageOnboarding = itemView.findViewById(R.id.imageOnboarding);
}
public void setImageOnboarding(OnboardingItem onboardingItem) {
textTitle.setText(onboardingItem.getTitle());
textDescription.setText(onboardingItem.getDescription());
imageOnboarding.setImageResource(onboardingItem.getImage());;
}
}
}
| [
"samson.akanbi@outlook.com"
] | samson.akanbi@outlook.com |
d4f4bb1c0546f186131ef52d97514cbf1d388f35 | 11c08a5df4cebe41fe4b4665fa5dfd14c8c8eeb7 | /src/main/java/algo/MergeTwoLists.java | 9c46b87b290636f844ef73b4926401b2bb9e461a | [] | no_license | CloudsDocker/AlgoPA | 2530403185b44014bb429d3efafde60da2a56ee4 | fc168fcfa55f0c59829391b98b0bc1d7dbff5394 | refs/heads/master | 2022-12-03T22:31:02.704083 | 2022-11-05T10:37:19 | 2022-11-05T10:37:19 | 234,881,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,457 | java | package algo;
import java.util.List;
public class MergeTwoLists {
/*
21. Merge Two Sorted Lists
Easy
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
Example:
Input: 1->2->4, 1->3->4
Output: 1->1->2->3->4->4
*/
public static void main(String[] args) {
ListNode node=mergeTwoLists(ListNode.buildList1(),ListNode.buildList2());
node=mergeTwoListsIte(ListNode.buildList1(),ListNode.buildList2());
System.out.println("===:"+node);
}
public static ListNode mergeTwoLists(ListNode l1, ListNode l2) {
if(l1==null) return l2;
if(l2==null) return l1;
if(l1.val<l2.val){
l1.next=mergeTwoLists(l1.next,l2);
return l1;
}else{
l2.next=mergeTwoLists(l2.next,l1);
return l2;
}
}
public static ListNode mergeTwoListsIte(ListNode l1, ListNode l2){
if(l1==null) return l2;
else if(l2==null) return l1;
ListNode headDummy = new ListNode(0);
ListNode curr = headDummy;
while(l1 !=null && l2!=null){
if(l1.val<l2.val){
curr.next=l1;
l1=l1.next;
}else{
curr.next=l2;
l2=l2.next;
}
curr=curr.next;
}
curr.next=l1==null?l2:l1;
return headDummy.next;
}
}
| [
"phray.zhang@gmail.com"
] | phray.zhang@gmail.com |
67648078be965740c1ee7bb73285b6aa3b8d6de5 | d31d744f62c09cb298022f42bcaf9de03ad9791c | /java/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumsum.java | 6895cbed39f1eeb430580cfbc89edc94929d1708 | [] | no_license | yuhuofei/TensorFlow-1 | b2085cb5c061aefe97e2e8f324b01d7d8e3f04a0 | 36eb6994d36674604973a06159e73187087f51c6 | refs/heads/master | 2023-02-22T13:57:28.886086 | 2021-01-26T14:18:18 | 2021-01-26T14:18:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,797 | java | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=======================================================================*/
// This class has been generated, DO NOT EDIT!
package org.tensorflow.op.math;
import org.tensorflow.Operand;
import org.tensorflow.Operation;
import org.tensorflow.OperationBuilder;
import org.tensorflow.Output;
import org.tensorflow.op.RawOp;
import org.tensorflow.op.Scope;
import org.tensorflow.op.annotation.Endpoint;
import org.tensorflow.op.annotation.Operator;
import org.tensorflow.types.family.TNumber;
import org.tensorflow.types.family.TType;
/**
* Compute the cumulative sum of the tensor `x` along `axis`.
* <p>
* By default, this op performs an inclusive cumsum, which means that the first
* element of the input is identical to the first element of the output:
* <pre>{@code
* tf.cumsum([a, b, c]) # => [a, a + b, a + b + c]
* }</pre>
* By setting the `exclusive` kwarg to `True`, an exclusive cumsum is
* performed instead:
* <pre>{@code
* tf.cumsum([a, b, c], exclusive=True) # => [0, a, a + b]
* }</pre>
* By setting the `reverse` kwarg to `True`, the cumsum is performed in the
* opposite direction:
* <pre>{@code
* tf.cumsum([a, b, c], reverse=True) # => [a + b + c, b + c, c]
* }</pre>
* This is more efficient than using separate `tf.reverse` ops.
* <p>
* The `reverse` and `exclusive` kwargs can also be combined:
* <pre>{@code
* tf.cumsum([a, b, c], exclusive=True, reverse=True) # => [b + c, c, 0]
* }</pre>
*
*
* @param <T> data type for {@code out()} output
*/
@Operator(group = "math")
public final class Cumsum<T extends TType> extends RawOp implements Operand<T> {
/**
* Optional attributes for {@link org.tensorflow.op.math.Cumsum}
*/
public static class Options {
/**
* @param exclusive If `True`, perform exclusive cumsum.
*/
public Options exclusive(Boolean exclusive) {
this.exclusive = exclusive;
return this;
}
/**
* @param reverse A `bool` (default: False).
*/
public Options reverse(Boolean reverse) {
this.reverse = reverse;
return this;
}
private Boolean exclusive;
private Boolean reverse;
private Options() {
}
}
/**
* Factory method to create a class wrapping a new Cumsum operation.
*
* @param scope current scope
* @param x A `Tensor`. Must be one of the following types: `float32`, `float64`,
* `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, `complex64`,
* `complex128`, `qint8`, `quint8`, `qint32`, `half`.
* @param axis A `Tensor` of type `int32` (default: 0). Must be in the range
* `[-rank(x), rank(x))`.
* @param options carries optional attributes values
* @return a new instance of Cumsum
*/
@Endpoint(describeByClass = true)
public static <T extends TType, U extends TNumber> Cumsum<T> create(Scope scope, Operand<T> x, Operand<U> axis, Options... options) {
OperationBuilder opBuilder = scope.env().opBuilder("Cumsum", scope.makeOpName("Cumsum"));
opBuilder.addInput(x.asOutput());
opBuilder.addInput(axis.asOutput());
opBuilder = scope.applyControlDependencies(opBuilder);
if (options != null) {
for (Options opts : options) {
if (opts.exclusive != null) {
opBuilder.setAttr("exclusive", opts.exclusive);
}
if (opts.reverse != null) {
opBuilder.setAttr("reverse", opts.reverse);
}
}
}
return new Cumsum<T>(opBuilder.build());
}
/**
* @param exclusive If `True`, perform exclusive cumsum.
*/
public static Options exclusive(Boolean exclusive) {
return new Options().exclusive(exclusive);
}
/**
* @param reverse A `bool` (default: False).
*/
public static Options reverse(Boolean reverse) {
return new Options().reverse(reverse);
}
/**
*/
public Output<T> out() {
return out;
}
@Override
public Output<T> asOutput() {
return out;
}
/** The name of this op, as known by TensorFlow core engine */
public static final String OP_NAME = "Cumsum";
private Output<T> out;
private Cumsum(Operation operation) {
super(operation);
int outputIdx = 0;
out = operation.output(outputIdx++);
}
}
| [
"nateweiler84@gmail.com"
] | nateweiler84@gmail.com |
0d10c93bd6434144f7288023d65a0a919afdeadc | d676d04d522de2b7747e86147c4855c36f885cc3 | /sigaenterprise_backend/sigaenterprise_backend_purchase_client/src/main/java/sigaenterprise/backend/purchase/remote/PurchaseOrderFacadeRemote.java | 3f676a7a6fc7eddee577a77f61e37326308f011a | [] | no_license | emosquera/sigaenterprise | 949c896277032309745a12c9bcb2279317a5b979 | 91829e60e2e8f1ae72a48f728b134b6f89eae3b1 | refs/heads/master | 2021-04-15T05:14:58.345172 | 2017-07-08T14:41:41 | 2017-07-08T14:41:41 | 94,562,422 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 801 | 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 sigaenterprise.backend.purchase.remote;
import java.util.List;
import javax.ejb.Remote;
import sigaenterprise.backend.purchase.model.PurchaseOrder;
/**
*
* @author syslife01
*/
@Remote
public interface PurchaseOrderFacadeRemote {
public final String JNDI_REMOTE_NAME = "ejb/purchaseOrderFacadeRemote";
void create(PurchaseOrder purchaseOrder);
void edit(PurchaseOrder purchaseOrder);
void remove(PurchaseOrder purchaseOrder);
PurchaseOrder find(Object id);
List<PurchaseOrder> findAll();
List<PurchaseOrder> findRange(int[] range);
int count();
}
| [
"migmosquera@hotmail.com"
] | migmosquera@hotmail.com |
83572139ca1dcce9ba976f85b532fb82ac68f84e | 1af5de52e596f736c70a8d2b505fcbf406e0d1e4 | /adapter/src/main/java/com/adaptris/core/services/metadata/xpath/ConfiguredXpathQueryImpl.java | 843b2755568c247069824151c10b1d2c03ba3256 | [
"Apache-2.0"
] | permissive | williambl/interlok | 462970f97b626b6f05d69ae30a43e42d6770dd24 | 3371e63ede75a53878244d8e44ecc00f36545e74 | refs/heads/master | 2020-03-28T06:17:23.056266 | 2018-08-13T13:36:02 | 2018-08-13T13:36:02 | 147,825,107 | 0 | 0 | Apache-2.0 | 2018-09-07T13:10:38 | 2018-09-07T13:10:38 | null | UTF-8 | Java | false | false | 1,640 | java | /*
* Copyright 2015 Adaptris Ltd.
*
* 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.adaptris.core.services.metadata.xpath;
import static org.apache.commons.lang.StringUtils.isEmpty;
import org.hibernate.validator.constraints.NotBlank;
import com.adaptris.core.AdaptrisMessage;
import com.adaptris.core.CoreException;
import com.adaptris.core.util.Args;
/**
* Abstract base class for {@linkplain XpathQuery} implementations that are statically configured.
*
* @author lchan
*
*/
public abstract class ConfiguredXpathQueryImpl extends XpathQueryImpl {
@NotBlank
private String xpathQuery;
public ConfiguredXpathQueryImpl() {
}
public String getXpathQuery() {
return xpathQuery;
}
/**
* Set the xpath.
*
* @param expr
*/
public void setXpathQuery(String expr) {
xpathQuery = Args.notBlank(expr, "xpath-query");
}
@Override
public String createXpathQuery(AdaptrisMessage msg) {
return xpathQuery;
}
public void verify() throws CoreException {
if (isEmpty(getXpathQuery())) {
throw new CoreException("Configured Xpath is null.");
}
}
}
| [
"lewin.chan@adaptris.com"
] | lewin.chan@adaptris.com |
5d8168b6a4af55bbcc758647beb561acbd0a3ba2 | 96ef87f9624b72efd48682d314cc9c39a8489a56 | /src/main/java/com/bjajmd/mall/admin/common/MySysUser.java | 8a7c61d98c4657efa1566ccb99d6e83056c214be | [] | no_license | bjajmd/mall | ce0dbc09357f605963da2497d4b0b6ce2901a808 | 60c4d55a285c021c7b7189dbae8087ffa4cd2193 | refs/heads/master | 2022-09-26T13:21:59.486809 | 2020-04-05T12:06:39 | 2020-04-05T12:06:39 | 253,225,142 | 0 | 0 | null | 2022-09-01T23:23:13 | 2020-04-05T12:04:36 | JavaScript | UTF-8 | Java | false | false | 796 | java | package com.bjajmd.mall.admin.common;
import org.apache.shiro.SecurityUtils;
import com.bjajmd.mall.admin.common.realm.AuthRealm.ShiroUser;
/**
* Created by wangl on 2017/11/25.
* todo:
*/
public class MySysUser {
/**
* 取出Shiro中的当前用户LoginName.
*/
public static String icon() {
return ShiroUser().getIcon();
}
public static Long id() {
return ShiroUser().getId();
}
public static String loginName() {
return ShiroUser().getloginName();
}
public static String nickName(){
return ShiroUser().getNickName();
}
public static ShiroUser ShiroUser() {
ShiroUser user = (ShiroUser) SecurityUtils.getSubject().getPrincipal();
return user;
}
}
| [
"tmo89@126.com"
] | tmo89@126.com |
5eb0f9a09521b71dd1d530bac3aad4ebc0977d6f | 36ea7533f779d0daa8d4e0a032f713c2da9e412b | /microservice_order/src/main/java/cn/bd/microservice/properties/OrderProperties.java | 45639c92bdcbb926964d3fde4fdf0fa631ca43f3 | [] | no_license | iricpan/springcloud1 | 5c40e38ac15dbe6254835f70d94e8f4a9ed57ad8 | 699b37cd9ee935e88ca46a0dc09bad68a08743be | refs/heads/master | 2020-03-14T22:58:09.671360 | 2018-05-02T10:09:50 | 2018-05-02T10:09:50 | 131,833,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 454 | java | package cn.bd.microservice.properties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "cnn")
public class OrderProperties {
private ItemProperties item = new ItemProperties ();
public ItemProperties getItem() {
return item;
}
public void setItem(ItemProperties item) {
this.item = item;
}
}
| [
"pxian20@126.com"
] | pxian20@126.com |
84150db5cb72c0652467d01019485052ec917bd2 | d8cc40718b7af0193479a233a21ea2f03c792764 | /aws-java-sdk-config/src/main/java/com/amazonaws/services/config/model/transform/EvaluationMarshaller.java | ee6e33194b9492876a652879e1b744039fc631ac | [
"Apache-2.0"
] | permissive | chaoweimt/aws-sdk-java | 1de8c0aeb9aa52931681268cd250ca2af59a83d9 | f11d648b62f2615858e2f0c2e5dd69e77a91abd3 | refs/heads/master | 2021-01-22T03:18:33.038352 | 2017-05-24T22:40:24 | 2017-05-24T22:40:24 | 92,371,194 | 1 | 0 | null | 2017-05-25T06:13:36 | 2017-05-25T06:13:35 | null | UTF-8 | Java | false | false | 3,279 | java | /*
* Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.config.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.config.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* EvaluationMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class EvaluationMarshaller {
private static final MarshallingInfo<String> COMPLIANCERESOURCETYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ComplianceResourceType").build();
private static final MarshallingInfo<String> COMPLIANCERESOURCEID_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ComplianceResourceId").build();
private static final MarshallingInfo<String> COMPLIANCETYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ComplianceType").build();
private static final MarshallingInfo<String> ANNOTATION_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("Annotation").build();
private static final MarshallingInfo<java.util.Date> ORDERINGTIMESTAMP_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("OrderingTimestamp").build();
private static final EvaluationMarshaller instance = new EvaluationMarshaller();
public static EvaluationMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(Evaluation evaluation, ProtocolMarshaller protocolMarshaller) {
if (evaluation == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(evaluation.getComplianceResourceType(), COMPLIANCERESOURCETYPE_BINDING);
protocolMarshaller.marshall(evaluation.getComplianceResourceId(), COMPLIANCERESOURCEID_BINDING);
protocolMarshaller.marshall(evaluation.getComplianceType(), COMPLIANCETYPE_BINDING);
protocolMarshaller.marshall(evaluation.getAnnotation(), ANNOTATION_BINDING);
protocolMarshaller.marshall(evaluation.getOrderingTimestamp(), ORDERINGTIMESTAMP_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
282b9ecc20977f5232e8de5642adfb7c3b7f4cc7 | 2e45e2f0d8a2125c87894a94fbd6f2047bb92e9a | /src/main/java/com/hxqh/eam/dao/VEntGovTopOneDaoImpl.java | ce12bca3e57318f211c068c4fdc028552ab9aa5f | [] | no_license | zhangddandan/hxqh-app | 555d1e603e547cd1bf236c5617e3121d9ffaf9da | 1ec9e9188de13c32698a7a6ce7e51a5ea7dfb02b | refs/heads/master | 2020-12-02T22:13:02.972575 | 2017-07-03T02:25:16 | 2017-07-03T02:25:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java |
package com.hxqh.eam.dao;
import com.hxqh.eam.common.basedao.DaoSupport;
import com.hxqh.eam.model.view.VEntGovTopOne;
import org.springframework.stereotype.Repository;
/**
*
* @author lh
*
*/
@Repository("vEntGovTopOneDao")
public class VEntGovTopOneDaoImpl extends DaoSupport<VEntGovTopOne> implements VEntGovTopOneDao {
}
| [
"hkhai@outlook.com"
] | hkhai@outlook.com |
f5810444de0b4ddba5a7dbb2405c2a7834c3d8b8 | b647e8d18eb51b8f4f42062f9954970b35d1c09b | /Chapter9/src/main/java/com/ttt/MyHttpclient.java | a23ae80c5a8a2087d6dc42d0207e25c864e9adec | [] | no_license | TTT-824/AutoTest | c9563e9839bff67fccf1a841899ab5b052fd94a0 | d04024a12c96491d499da0d6c9eb257c6c66153b | refs/heads/master | 2023-01-05T16:27:19.652427 | 2020-10-27T16:15:30 | 2020-10-27T16:15:30 | 305,030,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,063 | java | package com.ttt;
import com.alibaba.fastjson.JSONObject;
import jdk.nashorn.internal.parser.JSONParser;
import jdk.nashorn.internal.runtime.JSONListAdapter;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.testng.annotations.Test;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class MyHttpclient {
@Test
public void Test1() throws IOException {
String result;
String uri = "http://192.168.2.168:8000/biz/app/user/login/login?phone=18398932805&password=a1111111&source=android&equipment=and-ffffffff-e978-d445-ffff-ffffef05ac4a";
// HttpGet get = new HttpGet("http://192.168.2.168:8000/biz/app/user/login/login?phone=18398932805&password=a1111111&source=android&equipment=and-ffffffff-e978-d445-ffff-ffffef05ac4a");
//这个是用来执行get方法的
HttpPost post = new HttpPost("http://192.168.2.168:8000/biz/app/user/login/login?phone=18398932805&password=a1111111&source=android&equipment=and-ffffffff-e978-d445-ffff-ffffef05ac4a");
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(post);
result = EntityUtils.toString(response.getEntity(),"utf-8");
System.out.println(result);
JSONObject object = JSONObject.parseObject(result);
String msg = object.getString("msg");
int code = object.getIntValue("code");
FileWriter fstream = new FileWriter("D:\\AutoTest\\AutoTest\\Chapter9\\result.csv",true);
BufferedWriter out =new BufferedWriter(fstream);
// out.write(vars.get("token")+","+ vars.get("userid")+","+ vars.get("phone"));
out.write(msg+","+code+","+result+","+uri);
out.write(System.getProperty("line.separator"));
out.close();
fstream.close();
}
}
| [
"2248437020@qq.com"
] | 2248437020@qq.com |
d00cb7f93bf039930487fbc0a3bfaa905809303b | c16ef4066a0013d2c701eb6e02cbc9ff18d7228c | /src/main/java/ru/company/onetwo33/homework5/Tunnel.java | f9d158b012c7b2521d150be49e172dcdfc7f3e4a | [] | no_license | OneTwo33/GB-JavaLevel3 | 921c660d9cfab60d711482727267072030583652 | 81bd0663b7a8cec60a9b8fd5ce96d2fe4ff6038c | refs/heads/master | 2023-04-06T13:00:53.478245 | 2021-03-29T16:35:14 | 2021-03-29T16:35:14 | 346,682,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | package ru.company.onetwo33.homework5;
import java.util.concurrent.Semaphore;
public class Tunnel extends Stage {
private final Semaphore semaphore;
public Tunnel(int members) {
this.length = 80;
this.description = "Тоннель " + length + " метров";
this.semaphore = new Semaphore(members / 2); // только половина участника могут въехать в тоннель
}
@Override
public void go(Car c) {
try {
try {
System.out.println(c.getName() + " готовится к этапу(ждет): " + description);
semaphore.acquire();
System.out.println(c.getName() + " начал этап: " + description);
Thread.sleep(length / c.getSpeed() * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
System.out.println(c.getName() + " закончил этап: " + description);
semaphore.release();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"alex_tsai@mail.ru"
] | alex_tsai@mail.ru |
301c582f5f831825e55017ab76db598267ccea7a | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /drjava_cluster/7830/src_0.java | 93185159bba0a3f478e87ec8a099decfb38dea27 | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,301 | java | /*BEGIN_COPYRIGHT_BLOCK
*
* This file is part of DrJava. Download the current version of this project:
* http://sourceforge.net/projects/drjava/ or http://www.drjava.org/
*
* DrJava Open Source License
*
* Copyright (C) 2001-2003 JavaPLT group at Rice University (javaplt@rice.edu)
* All rights reserved.
*
* Developed by: Java Programming Languages Team
* Rice University
* http://www.cs.rice.edu/~javaplt/
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal with the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, subject to the following
* conditions:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimers.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimers in the
* documentation and/or other materials provided with the distribution.
* - Neither the names of DrJava, the JavaPLT, Rice University, nor the
* names of its contributors may be used to endorse or promote products
* derived from this Software without specific prior written permission.
* - Products derived from this software may not be called "DrJava" nor
* use the term "DrJava" as part of their names without prior written
* permission from the JavaPLT group. For permission, write to
* javaplt@rice.edu.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS WITH THE SOFTWARE.
*
END_COPYRIGHT_BLOCK*/
package edu.rice.cs.drjava.model.repl;
import java.util.*;
import java.io.*;
import java.net.URL;
import java.net.URLClassLoader;
import koala.dynamicjava.interpreter.*;
import koala.dynamicjava.interpreter.context.*;
import koala.dynamicjava.interpreter.error.*;
import koala.dynamicjava.interpreter.throwable.*;
import koala.dynamicjava.parser.wrapper.*;
import koala.dynamicjava.tree.*;
import koala.dynamicjava.tree.visitor.*;
import koala.dynamicjava.util.*;
import edu.rice.cs.util.classloader.StickyClassLoader;
import edu.rice.cs.util.*;
import edu.rice.cs.drjava.DrJava;
// NOTE: Do NOT import/use the config framework in this class!
// (This class runs in a different JVM, and will not share the config object)
/**
* An implementation of the interpreter for the repl pane.
*
* This class is loaded in the Interpreter JVM, not the Main JVM.
* (Do not use DrJava's config framework here.)
*
* @version $Id$
*/
public class DynamicJavaAdapter implements JavaInterpreter {
private koala.dynamicjava.interpreter.Interpreter _djInterpreter;
/**
* Constructor.
*/
public DynamicJavaAdapter() {
_djInterpreter = new InterpreterExtension();
}
/**
* Interprets a string as Java source.
* @param s the string to interpret
* @return the Object generated by the running of s
*/
public Object interpret(String s) throws ExceptionReturnedException {
boolean print = false;
/**
* trims the whitespace from beginning and end of string
* checks the end to see if it is a semicolon
* adds a semicolon if necessary
*/
s = s.trim();
if (!s.endsWith(";")) {
s += ";";
print = true;
}
StringReader reader = new StringReader(s);
try {
Object result = _djInterpreter.interpret(reader, "DrJava");
if (print)
return result;
else
return JavaInterpreter.NO_RESULT;
}
catch (InterpreterException ie) {
Throwable cause = ie.getException();
if (cause instanceof ThrownException) {
cause = ((ThrownException) cause).getException();
}
else if (cause instanceof CatchedExceptionError) {
cause = ((CatchedExceptionError) cause).getException();
}
throw new ExceptionReturnedException(cause);
}
catch (CatchedExceptionError cee) {
throw new ExceptionReturnedException(cee.getException());
}
catch (InterpreterInterruptedException iie) {
return JavaInterpreter.NO_RESULT;
}
catch (ExitingNotAllowedException enae) {
return JavaInterpreter.NO_RESULT;
}
catch (Throwable ie) {
//System.err.print(new Date() + ": ");
//System.err.println(ie);
//ie.printStackTrace();
//System.err.println("\n");
//throw new RuntimeException(ie.toString());
throw new ExceptionReturnedException(ie);
}
}
/**
* Adds a path to the current classpath.
* @param path the path to add
*/
public void addClassPath(String path) {
//DrJava.consoleErr().println("Added class path: " + path);
// TODO: Once we move past 1.3, replace this with
// _djInterpreter.addClassPath(new File(path).toURI().getRawPath())
// in order to properly accept # and other special characters in paths.
_djInterpreter.addClassPath(path);
}
/**
* Set the scope for unqualified names to the given package.
* @param packageName Package to assume scope of.
*/
public void setPackageScope(String packageName) {
StringReader reader = new StringReader("package " + packageName + ";");
_djInterpreter.interpret(reader, "DrJava");
}
/**
* Returns the value of the variable with the given name in
* the interpreter.
* @param name Name of the variable
* @return Value of the variable
*/
public Object getVariable(String name) {
return _djInterpreter.getVariable(name);
}
/**
* Returns the class of the variable with the given name in
* the interpreter.
* @param name Name of the variable
* @return class of the variable
*/
public Class getVariableClass(String name) {
return _djInterpreter.getVariableClass(name);
}
/**
* Assigns the given value to the given name in the interpreter.
* If type == null, we assume that the type of this variable
* has not been loaded so we set it to Object.
* @param name Name of the variable
* @param value Value to assign
* @param type the type of the variable
*/
public void defineVariable(String name, Object value, Class type) {
if (type == null) {
type = java.lang.Object.class;
}
((TreeInterpreter)_djInterpreter).defineVariable(name, value, type);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value Value to assign
*/
public void defineVariable(String name, Object value) {
((TreeInterpreter)_djInterpreter).defineVariable(name, value);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value boolean to assign
*/
public void defineVariable(String name, boolean value) {
((TreeInterpreter)_djInterpreter).defineVariable(name, value);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value byte to assign
*/
public void defineVariable(String name, byte value) {
((TreeInterpreter)_djInterpreter).defineVariable(name, value);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value char to assign
*/
public void defineVariable(String name, char value) {
((TreeInterpreter)_djInterpreter).defineVariable(name, value);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value double to assign
*/
public void defineVariable(String name, double value) {
((TreeInterpreter)_djInterpreter).defineVariable(name, value);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value float to assign
*/
public void defineVariable(String name, float value) {
((TreeInterpreter)_djInterpreter).defineVariable(name, value);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value int to assign
*/
public void defineVariable(String name, int value) {
((TreeInterpreter)_djInterpreter).defineVariable(name, value);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value long to assign
*/
public void defineVariable(String name, long value) {
((TreeInterpreter)_djInterpreter).defineVariable(name, value);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value short to assign
*/
public void defineVariable(String name, short value) {
((TreeInterpreter)_djInterpreter).defineVariable(name, value);
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value Value to assign
*/
public void defineConstant(String name, Object value) {
((InterpreterExtension)_djInterpreter).defineConstant(name, value);
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value boolean to assign
*/
public void defineConstant(String name, boolean value) {
((InterpreterExtension)_djInterpreter).defineConstant(name, value);
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value byte to assign
*/
public void defineConstant(String name, byte value) {
((InterpreterExtension)_djInterpreter).defineConstant(name, value);
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value char to assign
*/
public void defineConstant(String name, char value) {
((InterpreterExtension)_djInterpreter).defineConstant(name, value);
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value double to assign
*/
public void defineConstant(String name, double value) {
((InterpreterExtension)_djInterpreter).defineConstant(name, value);
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value float to assign
*/
public void defineConstant(String name, float value) {
((InterpreterExtension)_djInterpreter).defineConstant(name, value);
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value int to assign
*/
public void defineConstant(String name, int value) {
((InterpreterExtension)_djInterpreter).defineConstant(name, value);
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value long to assign
*/
public void defineConstant(String name, long value) {
((InterpreterExtension)_djInterpreter).defineConstant(name, value);
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value short to assign
*/
public void defineConstant(String name, short value) {
((InterpreterExtension)_djInterpreter).defineConstant(name, value);
}
/**
* Sets whether protected and private variables should be accessible in
* the interpreter.
* @param accessible Whether protected and private variable are accessible
*/
public void setPrivateAccessible(boolean accessible) {
_djInterpreter.setAccessible(accessible);
}
/**
* Factory method to make a new NameVisitor.
* @param context the context
* @return visitor the visitor
*/
public NameVisitor makeNameVisitor(Context nameContext, Context typeContext) {
return new NameVisitorExtension(nameContext, typeContext);
}
/**
* Factory method to make a new TypeChecker.
* @param nameContext Context for the NameVisitor
* @param typeContext Context being used for the TypeChecker. This is
* necessary because we want to perform a partial type checking for the
* right hand side of a VariableDeclaration.
* @return visitor the visitor
*/
public TypeChecker makeTypeChecker(Context context) {
// TO DO: move this into its own class if more methods need to be added
return new TypeCheckerExtension(context);
}
/**
* Factory method to make a new EvaluationVisitor.
* @param context the context
* @return visitor the visitor
*/
public EvaluationVisitor makeEvaluationVisitor(Context context) {
return new EvaluationVisitorExtension(context);
}
/**
* Processes the tree before evaluating it, if necessary.
* @param node Tree to process
*/
public Node processTree(Node node) {
return node;
}
public GlobalContext makeGlobalContext(TreeInterpreter i) {
return new GlobalContext(i);
}
/**
* An extension of DynamicJava's interpreter that makes sure classes are
* not loaded by the system class loader (when possible) so that future
* interpreters will be able to reload the classes. This extension also
* ensures that classes on "extra.classpath" will be loaded if referenced
* by user defined classes. (Without this, classes on "extra.classpath"
* can only be referred to directly, and cannot be extended, etc.)
* <p>
*
* We also override the evaluation visitor to allow the interpreter to be
* interrupted and to return NO_RESULT if there was no result.
*/
public class InterpreterExtension extends TreeInterpreter {
/**
* Constructor.
*/
public InterpreterExtension() {
super(new JavaCCParserFactory());
classLoader = new ClassLoaderExtension(this);
// We have to reinitialize these variables because they automatically
// fetch pointers to classLoader in their constructors.
nameVisitorContext = makeGlobalContext(this);
ClassLoaderContainer clc = new ClassLoaderContainer() {
public ClassLoader getClassLoader() {
return classLoader;
}
};
nameVisitorContext.setAdditionalClassLoaderContainer(clc);
checkVisitorContext = makeGlobalContext(this);
checkVisitorContext.setAdditionalClassLoaderContainer(clc);
evalVisitorContext = makeGlobalContext(this);
evalVisitorContext.setAdditionalClassLoaderContainer(clc);
//System.err.println("set loader: " + classLoader);
}
/**
* Extends the interpret method to deal with possible interrupted
* exceptions.
* Unfortunately we have to copy all of this method to override it.
* @param is the reader from which the statements are read
* @param fname the name of the parsed stream
* @return the result of the evaluation of the last statement
*/
public Object interpret(Reader r, String fname) throws InterpreterException
{
try {
SourceCodeParser p = parserFactory.createParser(r, fname);
List statements = p.parseStream();
ListIterator it = statements.listIterator();
Object result = JavaInterpreter.NO_RESULT;
while (it.hasNext()) {
Node n = (Node)it.next();
// Process, if necessary
n = processTree(n);
Visitor v = makeNameVisitor(nameVisitorContext, checkVisitorContext);
Object o = n.acceptVisitor(v);
if (o != null) {
n = (Node)o;
}
v = makeTypeChecker(checkVisitorContext);
n.acceptVisitor(v);
evalVisitorContext.defineVariables
(checkVisitorContext.getCurrentScopeVariables());
v = makeEvaluationVisitor(evalVisitorContext);
result = n.acceptVisitor(v);
}
if (result instanceof String) {
result = "\"" + result + "\"";
}
else if (result instanceof Character) {
result = "'" + result + "'";
}
return result;
}
catch (ExecutionError e) {
throw new InterpreterException(e);
}
catch (ParseError e) {
throw new InteractionsException("There was a syntax error in the " +
"previous input.");
//throw new InterpreterException(e);
}
}
/**
* Assigns the given value to the given name in the interpreter.
* @param name Name of the variable
* @param value Value to assign
*/
public void defineConstant(String name, Object value) {
Class c = (value == null) ? null : value.getClass();
nameVisitorContext.defineConstant(name, c);
checkVisitorContext.defineConstant(name, c);
evalVisitorContext.defineConstant(name, value);
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value boolean to assign
*/
public void defineConstant(String name, boolean value) {
Class c = boolean.class;
nameVisitorContext.defineConstant(name, c);
checkVisitorContext.defineConstant(name, c);
evalVisitorContext.defineConstant(name, new Boolean(value));
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value byte to assign
*/
public void defineConstant(String name, byte value) {
Class c = byte.class;
nameVisitorContext.defineConstant(name, c);
checkVisitorContext.defineConstant(name, c);
evalVisitorContext.defineConstant(name, new Byte(value));
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value char to assign
*/
public void defineConstant(String name, char value) {
Class c = char.class;
nameVisitorContext.defineConstant(name, c);
checkVisitorContext.defineConstant(name, c);
evalVisitorContext.defineConstant(name, new Character(value));
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value double to assign
*/
public void defineConstant(String name, double value) {
Class c = double.class;
nameVisitorContext.defineConstant(name, c);
checkVisitorContext.defineConstant(name, c);
evalVisitorContext.defineConstant(name, new Double(value));
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value float to assign
*/
public void defineConstant(String name, float value) {
Class c = float.class;
nameVisitorContext.defineConstant(name, c);
checkVisitorContext.defineConstant(name, c);
evalVisitorContext.defineConstant(name, new Float(value));
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value int to assign
*/
public void defineConstant(String name, int value) {
Class c = int.class;
nameVisitorContext.defineConstant(name, c);
checkVisitorContext.defineConstant(name, c);
evalVisitorContext.defineConstant(name, new Integer(value));
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value long to assign
*/
public void defineConstant(String name, long value) {
Class c = long.class;
nameVisitorContext.defineConstant(name, c);
checkVisitorContext.defineConstant(name, c);
evalVisitorContext.defineConstant(name, new Long(value));
}
/**
* Assigns the given value to the given name as a constant in the interpreter.
* @param name Name of the variable
* @param value short to assign
*/
public void defineConstant(String name, short value) {
Class c = short.class;
nameVisitorContext.defineConstant(name, c);
checkVisitorContext.defineConstant(name, c);
evalVisitorContext.defineConstant(name, new Short(value));
}
}
/**
* A class loader for the interpreter.
*/
public static class ClassLoaderExtension extends TreeClassLoader {
private static boolean classLoaderCreated = false;
private static StickyClassLoader _stickyLoader;
/**
* Constructor.
* @param Interpreter i
*/
public ClassLoaderExtension(koala.dynamicjava.interpreter.Interpreter i) {
super(i);
// The protected variable classLoader contains the class loader to use
// to find classes. When a new class path is added to the loader,
// it adds on an auxilary classloader and chains the old classLoader
// onto the end.
// Here we initialize classLoader to be the system class loader.
classLoader = getClass().getClassLoader();
// don't load the dynamic java stuff using the sticky loader!
// without this, interpreter-defined classes don't work.
String[] excludes = {
"edu.rice.cs.drjava.model.repl.DynamicJavaAdapter$InterpreterExtension",
"edu.rice.cs.drjava.model.repl.DynamicJavaAdapter$ClassLoaderExtension"
};
if (!classLoaderCreated) {
_stickyLoader = new StickyClassLoader(this,
getClass().getClassLoader(),
excludes);
classLoaderCreated = true;
}
// we will use this to getResource classes
}
/**
* Adds an URL to the class path. DynamicJava's version of this creates a
* new URLClassLoader with the given URL, using the old loader as a parent.
* This seems to cause problems for us in certain cases, such as accessing
* static fields or methods in a class that extends a superclass which is
* loaded by "child" classloader...
*
* Instead, we'll replace the old URLClassLoader with a new one containing
* all the known URLs.
*
* (I don't know if this really works yet, so I'm not including it in
* the current release. CSR, 3-13-2003)
*
public void addURL(URL url) {
if (classLoader == null) {
classLoader = new URLClassLoader(new URL[] { url });
}
else if (classLoader instanceof URLClassLoader) {
URL[] oldURLs = ((URLClassLoader)classLoader).getURLs();
URL[] newURLs = new URL[oldURLs.length + 1];
System.arraycopy(oldURLs, 0, newURLs, 0, oldURLs.length);
newURLs[oldURLs.length] = url;
// Create a new class loader with all the URLs
classLoader = new URLClassLoader(newURLs);
}
else {
classLoader = new URLClassLoader(new URL[] { url }, classLoader);
}
}*/
/*
public Class defineClass(String name, byte[] code) {
File file = new File("debug-" + name + ".class");
try {
FileOutputStream out = new FileOutputStream(file);
out.write(code);
out.close();
DrJava.consoleErr().println("debug class " + name + " to " + file.getAbsolutePath());
}
catch (Throwable t) {}
Class c = super.defineClass(name, code);
return c;
}
*/
/**
* Delegates all resource requests to {@link #classLoader}.
* This method is called by the {@link StickyClassLoader}.
*/
public URL getResource(String name) {
return classLoader.getResource(name);
}
protected Class loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
Class clazz;
// check the cache
if (classes.containsKey(name)) {
clazz = (Class) classes.get(name);
}
else {
try {
clazz = _stickyLoader.loadClass(name);
}
catch (ClassNotFoundException e) {
// If it exceptions, just fall through to here to try the interpreter.
// If all else fails, try loading the class through the interpreter.
// That's used for classes defined in the interpreter.
clazz = interpreter.loadClass(name);
}
}
if (resolve) {
resolveClass(clazz);
}
return clazz;
}
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
1b3e9656cb8e9d4051d6d94221d022657a15b885 | 18ac4f06ffc9129367422a6fa9ed40d0a12f8b34 | /app/src/main/java/com/example/melody/represent/ZipcodeActivity.java | d3f5c63fa27a29a63e8d5429c7681d248478314a | [] | no_license | melodywei861016/Represent | 8af07ab04e3e7eb1f161c440cf9b550169880318 | f69b73fc40a9ec46cf4e1a09b14acd4385b57004 | refs/heads/master | 2020-03-31T15:00:13.286215 | 2018-10-09T21:27:11 | 2018-10-09T21:27:11 | 152,319,436 | 0 | 0 | null | 2018-10-09T21:03:37 | 2018-10-09T20:50:15 | Java | UTF-8 | Java | false | false | 15,811 | java | package com.example.melody.represent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.CardView;
import android.text.Html;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
public class ZipcodeActivity extends AppCompatActivity {
static final String GEOCODIO_API_KEY = "9602550464bcd46a42b50bb5cf2bb5dc8daba5f";
static final String GEOCODIO_API_URL = "https://api.geocod.io/v1.3/";
private String zipcode = "";
private int senator_num = 0;
private ArrayList<JSONObject> senators = new ArrayList<JSONObject>();
private ArrayList<JSONObject> reps = new ArrayList<JSONObject>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_legislators_listview);
new zipcodeToDistrict().execute();
}
class zipcodeToDistrict extends AsyncTask<Void, Void, String> {
private Exception exception;
private Context mContext = getApplicationContext();
protected String doInBackground(Void... urls) {
try {
URL url;
Bundle bundle = getIntent().getExtras();
if (bundle.getString("zipcode_string") != null) {
zipcode = bundle.getString("zipcode_string");
url = new URL(GEOCODIO_API_URL + "geocode?q=" + zipcode + "&fields=cd&api_key=" + GEOCODIO_API_KEY);
} else {
Log.e("ERROR", "Didn't input valid zipcode");
return null;
}
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line).append("\n");
}
bufferedReader.close();
return stringBuilder.toString();
} finally {
urlConnection.disconnect();
}
}
catch(Exception e) {
Log.e("ERROR", e.getMessage(), e);
return null;
}
}
protected void onPostExecute(String response) {
if(response == null) {
response = "ERROR IN POST EXECUTE";
}
Log.i("PostExecute", "Success");
try {
JSONObject obj = new JSONObject(response);
JSONArray results = obj.getJSONArray("results");
JSONObject fields = results.getJSONObject(0).getJSONObject("fields");
JSONArray congressional_district = fields.getJSONArray("congressional_districts");
for (int i = 0; i < congressional_district.length(); i++) {
JSONObject district_array = congressional_district.getJSONObject(i);
Log.i("district", district_array.getString("name"));
JSONArray legislators = district_array.getJSONArray("current_legislators");
Log.i("legislators", legislators.toString());
for (int j = 0; j < legislators.length(); j++) {
JSONObject legislator = legislators.getJSONObject(j);
Log.i("type string", legislator.getString("type"));
if (legislator.getString("type").equals("senator")) {
if (senator_num < 2 && !senators.contains(legislator)) {
senator_num++;
senators.add(legislator);
}
} else if (legislator.getString("type").equals("representative") && !reps.contains(legislator)) {
reps.add(legislator);
}
}
}
TextView search_results_text = findViewById(R.id.search_results_text);
search_results_text.setText("Search Results by Zipcode " + zipcode + ":");
LinearLayout linearlayout_senator = findViewById(R.id.linearlayout_senators);
//SENATORS
for (JSONObject senator: senators) {
//CardView
CardView legislator_view = new CardView(mContext);
linearlayout_senator.addView(legislator_view);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(1400, 500);
layoutParams.setMargins(0, 30, 0, 30);
legislator_view.setLayoutParams(layoutParams);
legislator_view.setRadius(50);
legislator_view.setCardBackgroundColor(Color.WHITE);
//Senator Name
LinearLayout.LayoutParams text_name_layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
text_name_layout.setMargins(450, 30, 0, 0);
TextView senator_name = new TextView(mContext);
senator_name.setLayoutParams(text_name_layout);
senator_name.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL));
senator_name.setTextColor(Color.BLACK);
senator_name.setTextSize(25);
JSONObject bio = senator.getJSONObject("bio");
final String nameString = bio.getString("first_name") + " " + bio.getString("last_name");
senator_name.setText(nameString);
//Senator Info
TextView senator_info = new TextView(mContext);
LinearLayout.LayoutParams text_info_layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
text_info_layout.setMargins(450, 150, 0, 0);
senator_info.setLayoutParams(text_info_layout);
JSONObject contact = senator.getJSONObject("contact");
String email_website = "";
String contact_form = contact.getString("contact_form");
String website = contact.getString("url");
if (!contact_form.equals("null")) {
email_website += ("<b>Contact Form: </b>" + contact_form + "<br/>");
}
if (!website.equals("null")) {
email_website += ("<b>Website: </b>" + website);
}
senator_info.setText(Html.fromHtml(email_website));
//Senator Image
LinearLayout.LayoutParams image_layout = new LinearLayout.LayoutParams(400, LinearLayout.LayoutParams.MATCH_PARENT);
ImageView image = new ImageView(mContext);
image.setLayoutParams(image_layout);
String bioguide_id = senator.getJSONObject("references").getString("bioguide_id");
final String imageUrl = "http://bioguide.congress.gov/bioguide/photo/"+ bioguide_id.substring(0, 1) +"/" + bioguide_id + ".jpg";
//Senator Party
TextView party = new TextView(mContext);
LinearLayout.LayoutParams senator_party_layout = new LinearLayout.LayoutParams(320, 80);
senator_party_layout.setMargins(1050, 400, 0, 0);
party.setLayoutParams(senator_party_layout);
party.setTextColor(Color.WHITE);
party.setGravity(Gravity.CENTER);
party.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD));
final String partyString = bio.getString("party");
if (partyString.equals("Democrat")) {
party.setBackgroundDrawable(getResources().getDrawable(R.drawable.democrat));
party.setText("Democrat");
} else if (partyString.equals("Republican")) {
party.setBackgroundDrawable(getResources().getDrawable(R.drawable.republican));
party.setText("Republican");
} else if (partyString.equals("Independent")) {
party.setBackgroundDrawable(getResources().getDrawable(R.drawable.independent));
party.setText("Independent");
}
//Adding Views to CardView
new ImageDownloaderTask(image).execute(imageUrl);
legislator_view.addView(senator_name);
legislator_view.addView(senator_info);
legislator_view.addView(image);
legislator_view.addView(party);
legislator_view.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(ZipcodeActivity.this, DetailActivity.class);
intent.putExtra("type", "Senator");
intent.putExtra("party", partyString);
intent.putExtra("name", nameString);
intent.putExtra("imageURL", imageUrl);
startActivity(intent);
}
});
}
//REPRESENTATIVE
LinearLayout linearlayout_rep = findViewById(R.id.linearlayout_rep);
for (JSONObject rep: reps) {
//CardView
CardView legislator_view = new CardView(mContext);
linearlayout_rep.addView(legislator_view);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(1400, 500);
layoutParams.setMargins(0, 30, 0, 30);
legislator_view.setLayoutParams(layoutParams);
legislator_view.setRadius(50);
legislator_view.setCardBackgroundColor(Color.WHITE);
//Rep Name
LinearLayout.LayoutParams text_name_layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
text_name_layout.setMargins(450, 30, 0, 0);
TextView rep_name = new TextView(mContext);
rep_name.setLayoutParams(text_name_layout);
rep_name.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL));
rep_name.setTextColor(Color.BLACK);
rep_name.setTextSize(25);
JSONObject bio = rep.getJSONObject("bio");
final String nameString = bio.getString("first_name") + " " + bio.getString("last_name");
rep_name.setText(nameString);
//Rep Info
TextView rep_info = new TextView(mContext);
LinearLayout.LayoutParams text_info_layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
text_info_layout.setMargins(450, 150, 0, 0);
rep_info.setLayoutParams(text_info_layout);
JSONObject contact = rep.getJSONObject("contact");
String email_website = "";
String contact_form = contact.getString("contact_form");
String website = contact.getString("url");
if (!contact_form.equals("null")) {
email_website += ("<b>Contact Form: </b>" + contact_form + "<br/>");
}
if (!website.equals("null")) {
email_website += ("<b>Website: </b>" + website);
}
rep_info.setText(Html.fromHtml(email_website));
//Rep Image
LinearLayout.LayoutParams image_layout = new LinearLayout.LayoutParams(400, LinearLayout.LayoutParams.MATCH_PARENT);
ImageView image = new ImageView(mContext);
image.setLayoutParams(image_layout);
String bioguide_id = rep.getJSONObject("references").getString("bioguide_id");
final String imageUrl = "http://bioguide.congress.gov/bioguide/photo/" + bioguide_id.substring(0, 1) + "/" + bioguide_id + ".jpg";
//Rep Party
TextView party = new TextView(mContext);
LinearLayout.LayoutParams rep_party_layout = new LinearLayout.LayoutParams(320, 80);
rep_party_layout.setMargins(1050, 400, 0, 0);
party.setLayoutParams(rep_party_layout);
party.setTextColor(Color.WHITE);
party.setGravity(Gravity.CENTER);
party.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD));
final String partyString = bio.getString("party");
if (partyString.equals("Democrat")) {
party.setBackgroundDrawable(getResources().getDrawable(R.drawable.democrat));
party.setText("Democrat");
} else if (partyString.equals("Republican")) {
party.setBackgroundDrawable(getResources().getDrawable(R.drawable.republican));
party.setText("Republican");
} else if (partyString.equals("Independent")) {
party.setBackgroundDrawable(getResources().getDrawable(R.drawable.independent));
party.setText("Independent");
}
//Adding Views to CardView
new ImageDownloaderTask(image).execute(imageUrl);
legislator_view.addView(rep_name);
legislator_view.addView(rep_info);
legislator_view.addView(image);
legislator_view.addView(party);
legislator_view.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(ZipcodeActivity.this, DetailActivity.class);
intent.putExtra("type", "Representative");
intent.putExtra("party", partyString);
intent.putExtra("name", nameString);
intent.putExtra("imageURL", imageUrl);
startActivity(intent);
}
});
}
} catch (JSONException e) {
Log.d("TEST", "exception");
e.printStackTrace();
}
}
}
}
| [
"melodywei861016@gmail.com"
] | melodywei861016@gmail.com |
1d906f31dbc7413e8c590f4a5424cbb3d0611ea8 | b7d2c2140033215d554fc5850dbb9ad291bed855 | /app/src/main/java/com/example/sqliteapp/BancoDeDados.java | 14ad1ac6f5624fc78fcdb7bab0bc30c85d8e7fbb | [] | no_license | alinefbrito/SqliteApp | c60a44f70f3a1102d9dc8a650c1f296d0fa33036 | e637c9b290b33c52e73bf9348882bf25bb514301 | refs/heads/master | 2020-09-05T06:42:13.605940 | 2019-11-06T14:21:26 | 2019-11-06T14:21:26 | 220,015,243 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package com.example.sqliteapp;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class BancoDeDados extends SQLiteOpenHelper {
public static final String NOME_BANCO = "banco.db";
public static final String TABELA = "livros";
public static final String ID = "_id";
public static final String TITULO = "titulo";
public static final String AUTOR = "autor";
public static final String EDITORA = "editora";
public static final int VERSAO = 1;
public BancoDeDados(Context context){
super(context, NOME_BANCO,null,VERSAO);
}
@Override
public void onCreate(SQLiteDatabase db) {
String sql = "CREATE TABLE"+TABELA+"("
+ ID + " integer primary key autoincrement,"
+ TITULO + " text,"
+ AUTOR + " text,"
+ EDITORA + " text"
+")";
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABELA);
onCreate(db);
}
} | [
"alinefbrito@gmail.com"
] | alinefbrito@gmail.com |
2b253ad383578bc5827a98290087515906b09f1f | d728aafaaedf485accc34250bb8175cbd6e8dd0f | /app/src/main/java/com/dingtai/jinriyongzhou/model/NewsADs.java | 1877b3bf277a76d995f4ecc9d5402cfc3b60e643 | [] | no_license | skskinsky/JinRiYongZhou | 22d0bc922f64c8eb7a32005dd555e849c38f5c84 | c3667e1c0443348be2296c8c859a722771e71396 | refs/heads/master | 2021-05-11T22:00:37.354853 | 2018-01-15T01:41:25 | 2018-01-15T01:41:25 | 117,482,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,640 | java | package com.dingtai.jinriyongzhou.model;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import java.io.Serializable;
@DatabaseTable(tableName = "NewsADs")
public class NewsADs implements Serializable{
@DatabaseField(id = true)
private String ID;
@DatabaseField
private String CreateTime;
@DatabaseField
private String ADName;
@DatabaseField
private String ImgUrl ;
@DatabaseField
private String LinkUrl;
@DatabaseField
private String StID ;
@DatabaseField
private String ChID ;
@DatabaseField
private String ADType ;
@DatabaseField
private String ADFor;
@DatabaseField
private String LinkTo ;
@DatabaseField
private String BeginDate;
@DatabaseField
private String EndDate;
@DatabaseField
private String ADPositionID;
@DatabaseField
private String RandomNum;
@DatabaseField
private String Status;
@DatabaseField
private String ReMark;
@DatabaseField
private String ADContent;
@DatabaseField
private String MediaID;
@DatabaseField
private String IsIndexAD;
@DatabaseField
private String GoodType;
@DatabaseField
private String CreateAdmin;
@DatabaseField
private String ShowOrder;
@DatabaseField
private String IsChannel;
@DatabaseField
private String NewsType;
@DatabaseField
private String ResType;
@DatabaseField
private String ResUrl;
public String getID() {
return ID;
}
public void setID(String iD) {
ID = iD;
}
public String getCreateTime() {
return CreateTime;
}
public void setCreateTime(String createTime) {
CreateTime = createTime;
}
public String getADName() {
return ADName;
}
public void setADName(String aDName) {
ADName = aDName;
}
public String getImgUrl() {
return ImgUrl;
}
public void setImgUrl(String imgUrl) {
ImgUrl = imgUrl;
}
public String getLinkUrl() {
return LinkUrl;
}
public void setLinkUrl(String linkUrl) {
LinkUrl = linkUrl;
}
public String getStID() {
return StID;
}
public void setStID(String stID) {
StID = stID;
}
public String getChID() {
return ChID;
}
public void setChID(String chID) {
ChID = chID;
}
public String getADType() {
return ADType;
}
public void setADType(String aDType) {
ADType = aDType;
}
public String getADFor() {
return ADFor;
}
public void setADFor(String aDFor) {
ADFor = aDFor;
}
public String getLinkTo() {
return LinkTo;
}
public void setLinkTo(String linkTo) {
LinkTo = linkTo;
}
public String getBeginDate() {
return BeginDate;
}
public void setBeginDate(String beginDate) {
BeginDate = beginDate;
}
public String getEndDate() {
return EndDate;
}
public void setEndDate(String endDate) {
EndDate = endDate;
}
public String getADPositionID() {
return ADPositionID;
}
public void setADPositionID(String aDPositionID) {
ADPositionID = aDPositionID;
}
public String getRandomNum() {
return RandomNum;
}
public void setRandomNum(String randomNum) {
RandomNum = randomNum;
}
public String getStatus() {
return Status;
}
public void setStatus(String status) {
Status = status;
}
public String getReMark() {
return ReMark;
}
public void setReMark(String reMark) {
ReMark = reMark;
}
public String getADContent() {
return ADContent;
}
public void setADContent(String aDContent) {
ADContent = aDContent;
}
public String getMediaID() {
return MediaID;
}
public void setMediaID(String mediaID) {
MediaID = mediaID;
}
public String getIsIndexAD() {
return IsIndexAD;
}
public void setIsIndexAD(String isIndexAD) {
IsIndexAD = isIndexAD;
}
public String getGoodType() {
return GoodType;
}
public void setGoodType(String goodType) {
GoodType = goodType;
}
public String getCreateAdmin() {
return CreateAdmin;
}
public void setCreateAdmin(String createAdmin) {
CreateAdmin = createAdmin;
}
public String getShowOrder() {
return ShowOrder;
}
public void setShowOrder(String showOrder) {
ShowOrder = showOrder;
}
public String getIsChannel() {
return IsChannel;
}
public void setIsChannel(String isChannel) {
IsChannel = isChannel;
}
public String getNewsType() {
return NewsType;
}
public void setNewsType(String newsType) {
NewsType = newsType;
}
public String getResType() {
return ResType;
}
public void setResType(String resType) {
ResType = resType;
}
public String getResUrl() {
return ResUrl;
}
public void setResUrl(String resUrl) {
ResUrl = resUrl;
}
}
| [
"769699256@qq.com"
] | 769699256@qq.com |
6320da9c7f62aa72ed9faa3558ad7850c8737be4 | 829898c1222a9140d158ecd8ba50405be2bcafcb | /app/src/test/java/test/com/animation/ExampleUnitTest.java | b33bf4acf7f1fc1c62f1b034cd9bd38e00c9842f | [] | no_license | tempest1/amin | 45ef5d0bf3b2d5318b3e398857c34aa4a84cda5b | 1ec9b0ca7d3f4079cda0851d17e5e77cf9b5d28b | refs/heads/master | 2020-03-26T21:13:31.114932 | 2018-08-20T06:27:03 | 2018-08-20T06:27:03 | 145,375,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package test.com.animation;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"zd@zddeMacBook-Air.local"
] | zd@zddeMacBook-Air.local |
db60a346dcefe2b121b8c51bfcc7e7e4eab7c9d7 | bfa473bf0b12c5adc830d89c4eece764981eca92 | /aws-java-sdk-inspector/src/main/java/com/amazonaws/services/inspector/model/GetAssessmentReportRequest.java | 7d894a5e7f2cc8dc1d744429ebcdcfdfb526073c | [
"Apache-2.0"
] | permissive | nksabertooth/aws-sdk-java | de515f2544cdcf0d16977f06281bd6488e19be96 | 4734de6fb0f80fe5768a6587aad3b9d0eaec388f | refs/heads/master | 2021-09-02T14:09:26.653186 | 2018-01-03T01:27:36 | 2018-01-03T01:27:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,351 | java | /*
* Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.inspector.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/GetAssessmentReport" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetAssessmentReportRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* The ARN that specifies the assessment run for which you want to generate a report.
* </p>
*/
private String assessmentRunArn;
/**
* <p>
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* </p>
*/
private String reportFileFormat;
/**
* <p>
* Specifies the type of the assessment report that you want to generate. There are two types of assessment reports:
* a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>.
* </p>
*/
private String reportType;
/**
* <p>
* The ARN that specifies the assessment run for which you want to generate a report.
* </p>
*
* @param assessmentRunArn
* The ARN that specifies the assessment run for which you want to generate a report.
*/
public void setAssessmentRunArn(String assessmentRunArn) {
this.assessmentRunArn = assessmentRunArn;
}
/**
* <p>
* The ARN that specifies the assessment run for which you want to generate a report.
* </p>
*
* @return The ARN that specifies the assessment run for which you want to generate a report.
*/
public String getAssessmentRunArn() {
return this.assessmentRunArn;
}
/**
* <p>
* The ARN that specifies the assessment run for which you want to generate a report.
* </p>
*
* @param assessmentRunArn
* The ARN that specifies the assessment run for which you want to generate a report.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetAssessmentReportRequest withAssessmentRunArn(String assessmentRunArn) {
setAssessmentRunArn(assessmentRunArn);
return this;
}
/**
* <p>
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* </p>
*
* @param reportFileFormat
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* @see ReportFileFormat
*/
public void setReportFileFormat(String reportFileFormat) {
this.reportFileFormat = reportFileFormat;
}
/**
* <p>
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* </p>
*
* @return Specifies the file format (html or pdf) of the assessment report that you want to generate.
* @see ReportFileFormat
*/
public String getReportFileFormat() {
return this.reportFileFormat;
}
/**
* <p>
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* </p>
*
* @param reportFileFormat
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReportFileFormat
*/
public GetAssessmentReportRequest withReportFileFormat(String reportFileFormat) {
setReportFileFormat(reportFileFormat);
return this;
}
/**
* <p>
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* </p>
*
* @param reportFileFormat
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* @see ReportFileFormat
*/
public void setReportFileFormat(ReportFileFormat reportFileFormat) {
withReportFileFormat(reportFileFormat);
}
/**
* <p>
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* </p>
*
* @param reportFileFormat
* Specifies the file format (html or pdf) of the assessment report that you want to generate.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReportFileFormat
*/
public GetAssessmentReportRequest withReportFileFormat(ReportFileFormat reportFileFormat) {
this.reportFileFormat = reportFileFormat.toString();
return this;
}
/**
* <p>
* Specifies the type of the assessment report that you want to generate. There are two types of assessment reports:
* a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>.
* </p>
*
* @param reportType
* Specifies the type of the assessment report that you want to generate. There are two types of assessment
* reports: a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment
* Reports</a>.
* @see ReportType
*/
public void setReportType(String reportType) {
this.reportType = reportType;
}
/**
* <p>
* Specifies the type of the assessment report that you want to generate. There are two types of assessment reports:
* a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>.
* </p>
*
* @return Specifies the type of the assessment report that you want to generate. There are two types of assessment
* reports: a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment
* Reports</a>.
* @see ReportType
*/
public String getReportType() {
return this.reportType;
}
/**
* <p>
* Specifies the type of the assessment report that you want to generate. There are two types of assessment reports:
* a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>.
* </p>
*
* @param reportType
* Specifies the type of the assessment report that you want to generate. There are two types of assessment
* reports: a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment
* Reports</a>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReportType
*/
public GetAssessmentReportRequest withReportType(String reportType) {
setReportType(reportType);
return this;
}
/**
* <p>
* Specifies the type of the assessment report that you want to generate. There are two types of assessment reports:
* a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>.
* </p>
*
* @param reportType
* Specifies the type of the assessment report that you want to generate. There are two types of assessment
* reports: a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment
* Reports</a>.
* @see ReportType
*/
public void setReportType(ReportType reportType) {
withReportType(reportType);
}
/**
* <p>
* Specifies the type of the assessment report that you want to generate. There are two types of assessment reports:
* a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment Reports</a>.
* </p>
*
* @param reportType
* Specifies the type of the assessment report that you want to generate. There are two types of assessment
* reports: a finding report and a full report. For more information, see <a
* href="http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html">Assessment
* Reports</a>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReportType
*/
public GetAssessmentReportRequest withReportType(ReportType reportType) {
this.reportType = reportType.toString();
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAssessmentRunArn() != null)
sb.append("AssessmentRunArn: ").append(getAssessmentRunArn()).append(",");
if (getReportFileFormat() != null)
sb.append("ReportFileFormat: ").append(getReportFileFormat()).append(",");
if (getReportType() != null)
sb.append("ReportType: ").append(getReportType());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GetAssessmentReportRequest == false)
return false;
GetAssessmentReportRequest other = (GetAssessmentReportRequest) obj;
if (other.getAssessmentRunArn() == null ^ this.getAssessmentRunArn() == null)
return false;
if (other.getAssessmentRunArn() != null && other.getAssessmentRunArn().equals(this.getAssessmentRunArn()) == false)
return false;
if (other.getReportFileFormat() == null ^ this.getReportFileFormat() == null)
return false;
if (other.getReportFileFormat() != null && other.getReportFileFormat().equals(this.getReportFileFormat()) == false)
return false;
if (other.getReportType() == null ^ this.getReportType() == null)
return false;
if (other.getReportType() != null && other.getReportType().equals(this.getReportType()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAssessmentRunArn() == null) ? 0 : getAssessmentRunArn().hashCode());
hashCode = prime * hashCode + ((getReportFileFormat() == null) ? 0 : getReportFileFormat().hashCode());
hashCode = prime * hashCode + ((getReportType() == null) ? 0 : getReportType().hashCode());
return hashCode;
}
@Override
public GetAssessmentReportRequest clone() {
return (GetAssessmentReportRequest) super.clone();
}
}
| [
""
] | |
3fc3e32a551ae1c781074c11f3f00c7f997e30ea | 6cc7288a8caf2ef90472b03107720eb006a2f344 | /Codigo/Renting/src/control/ControladorReservas.java | f6e43b91878c07441deae1a1ce9ee3d89ad62bb0 | [] | no_license | aizaguirreteb/renting-cars-renttu | 3db71dcf2184571da9b356174c410d39f40d59ca | 7aa59847964775635ae0378b8fe84302aa914236 | refs/heads/master | 2020-12-13T11:37:34.126049 | 2019-05-24T07:58:11 | 2019-05-24T07:58:11 | 234,405,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,022 | java | package control;
import java.util.List;
import dao.ReservaDAO;
import interfaces.InterfazReserva;
import interfaces.InterfazReserva.Controlador;
import modelos.Reserva;
import modelos.Vehiculos;
public class ControladorReservas implements Controlador {
private InterfazReserva.Vista panelReserva;
private ReservaDAO reservaDao;
//Constructor
public ControladorReservas(InterfazReserva.Vista panel) {
this.panelReserva = panel;
this.reservaDao = new ReservaDAO();
}
@Override
public void obtenerReservasAlta() {
List<Reserva> listaReservas = reservaDao.obtenerReservasActivas();
panelReserva.mostrarReservas(listaReservas);
}
@Override
public void obtenerReservasBaja() {
List<Reserva> listaReservas = reservaDao.obtenerReservasCanceladas();
panelReserva.mostrarReservasHistorial(listaReservas);
}
@Override
public void obtenerReservasTotal() {
List<Reserva> listaReservas = reservaDao.obtenerTodasLasReservas();
panelReserva.mostrarReservas(listaReservas);
}
@Override
public void registrarReserva(Reserva reservaARegistrar) {
if(reservaARegistrar != null ) {
if(!reservaDao.insertarNuevaReserva(reservaARegistrar)) {
panelReserva.errorEnRegistroDeReserva();
} else {
panelReserva.insercionCorrecta();
obtenerReservasAlta();
}
}
}
@Override
public void editarReserva(Reserva reservaAEditar, Reserva nuevaReserva) {
if(nuevaReserva != null) {
//Cuando se edita una reserva es para darla de baja, tanto si la han recogido como si no.
//despues hay que volver a rellenar la tabla del panel de reservas para ver los cambios
reservaDao.actualizarEstadoReservaPorDni(reservaAEditar, nuevaReserva);
obtenerReservasAlta();
}
}
@Override
public void buscarReserva(String dato) {
// TODO Auto-generated method stub
List<Reserva> listaEncontrados = reservaDao.buscarReservas(dato);
panelReserva.mostrarReservas(listaEncontrados);
}
}
| [
"aleizatebar@gmail.com"
] | aleizatebar@gmail.com |
b66924f632389921516c65d177743a51ed89d938 | d6eab77df59623d67c3ebd8ea61bd8367534db5f | /ch08_io_file/src/Ex05_FileOutputStreamEx.java | 84203b12e71ae26d91723ef3fab399284024a5d6 | [] | no_license | ricerich/java20210709 | b90fb2db3c7167a9bb6efc3fc4970c1ef052f4d4 | b9c3c22aea724e7e70592d654051c20c50514fe8 | refs/heads/master | 2023-07-07T01:07:33.148688 | 2021-08-11T03:09:13 | 2021-08-11T03:09:13 | 384,303,476 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 572 | java | import java.io.*;
public class Ex05_FileOutputStreamEx {
public static void main(String[] args) {
byte b[] = {7,51,3,4,-1,24};
try {
FileOutputStream fout = new FileOutputStream("./Temp1/test.out");
for(int i=0; i<b.length; i++)
fout.write(b[i]); // 배열 b의 바이너리를 그대로 기록
fout.close();
} catch(IOException e) {
System.out.println("./Temp/test.out에 저장할 수 없었습니다. 경로명을 확인해 주세요");
return;
}
System.out.println("./Temp/test.out을 저장하였습니다.");
}
} | [
"admin@DESKTOP-3PE3QU4"
] | admin@DESKTOP-3PE3QU4 |
cb972beeab9a937f99422bcfde3fa81cb0f44563 | 0cf5cd0de9562e6ab7f757b8f04e79118dbca7b8 | /app/src/main/java/com/trotri/android/rice/view/recycler/decoration/GridItemDecoration.java | bc73f84a4413f0f81db90c4d578a17dbe2d3573d | [] | no_license | trotri/thunder | 57cc1c8ae2f88bea67679c727d3506d92bb9b2b4 | 85adbd90fb4f4dba57e8672977f6993b1fba6e3c | refs/heads/master | 2021-04-26T21:54:17.680908 | 2018-05-09T08:01:10 | 2018-05-09T08:01:10 | 130,680,454 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,208 | java | /*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.trotri.android.rice.view.recycler.decoration;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
* GridItemDecoration class file
* RecyclerView GridLayout StaggeredGrid ItemDecoration 类
*
* @author 宋欢 <trotri@yeah.net>
* @version $Id: GridItemDecoration.java 1 2016-01-08 10:00:06Z huan.song $
* @since 1.0
*/
public class GridItemDecoration extends ItemDecoration {
/**
* 绘制垂直分隔线
*
* @param divider 分隔线
* @param c a Canvas Object
* @param parent a RecyclerView Object
*/
public void drawVerticalDivider(Drawable divider, Canvas c, RecyclerView parent) {
int top, bottom, left, right;
int count = parent.getChildCount();
for (int i = 0; i < count; i++) {
View v = parent.getChildAt(i);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) v.getLayoutParams();
top = v.getTop() - params.topMargin;
bottom = v.getBottom() + params.bottomMargin;
left = v.getRight() + params.rightMargin;
right = left + divider.getIntrinsicWidth();
divider.setBounds(left, top, right, bottom);
divider.draw(c);
}
}
/**
* 绘制水平分隔线
*
* @param divider 分隔线
* @param c a Canvas Object
* @param parent a RecyclerView Object
*/
public void drawHorizontalDivider(Drawable divider, Canvas c, RecyclerView parent) {
int top, bottom, left, right;
int count = parent.getChildCount();
for (int i = 0; i < count; i++) {
View v = parent.getChildAt(i);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) v.getLayoutParams();
left = v.getLeft() - params.leftMargin;
right = v.getRight() + params.rightMargin + divider.getIntrinsicWidth();
top = v.getBottom() + params.bottomMargin;
bottom = top + divider.getIntrinsicHeight();
divider.setBounds(left, top, right, bottom);
divider.draw(c);
}
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
}
@Override
public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) {
super.getItemOffsets(outRect, itemPosition, parent);
}
}
| [
"trotri@yeah.net"
] | trotri@yeah.net |
0d03f4582461d9bde38d492b448ce7951a2fb3e5 | a7daa660551ac31e195b72b0fe5a853b1c486a49 | /app/src/androidTest/java/edu_up_cs301/ludo/LudoStateTest.java | 0ecc1e8e7c8d55ec4a3b35ead9370bc022429f3f | [] | no_license | OnlyForObjectOrientednayyar19/Ludo_FinalRelease | 22c40705df0d766125ddb7b37aeb1c31ecb2b7e6 | 513f93e40d37780481c5a2e49a499a0f033ca17e | refs/heads/master | 2020-03-13T09:40:13.800015 | 2018-04-25T22:08:01 | 2018-04-25T22:08:01 | 131,068,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,540 | java | package edu_up_cs301.ludo;
import org.junit.Test;
import static org.junit.Assert.*;
public class LudoStateTest {
/**
* newRollTest
* Tests the functionality of a new roll be seeing if the dice value is greater than 1
* and less than or equal to 6
*/
@Test
public void newRollTest() {
LudoState state = new LudoState();
state.newRoll();
if(state.getDiceVal() <=6 && state.getDiceVal()>0){
assertEquals(1,1);
}
else{ assertEquals(-1,1);
}
}
/**
* incPlayerScoreTest
* Tests to see if the player's score is correctly increased
*/
@Test
public void incPlayerScoreTest() {
LudoState state = new LudoState();
state.incPlayerScore(0);
assertEquals(state.getPlayerScore(0),1);
state.incPlayerScore(0);
state.incPlayerScore(0);
state.incPlayerScore(0);
assertEquals(state.getPlayerScore(0),4);
}
/**
* changePlayerTurnTest
* This tests to see if the changePlayerTurn methods changes the players turn
* As an edge case, if it is player three's turn and the change player turn method
* is called, it should wrap around to player 0's turn.
*/
@Test
public void changePlayerTurnTest(){
LudoState state = new LudoState();
assertEquals(state.getWhoseMove(),0);
state.changePlayerTurn();
assertEquals(state.getWhoseMove(),1);
state.changePlayerTurn();
state.changePlayerTurn();
state.changePlayerTurn();
//It should wrap around back to player 0
assertEquals(state.getWhoseMove(),0);
}
/**
* advanceTokenTest
* This tests to see if the advanceToken method advances the specified token
*/
@Test
public void advanceTokenTest() {
LudoState state = new LudoState();
state.pieces[0].setIsMovable(true);
state.newRoll();
state.advanceToken(0,0);
assertEquals(state.pieces[0].getNumSpacesMoved()+state.getDiceVal(),state.getDiceVal());
}
/**
* getOrderTest
* This test to se if the getOrder does indeed return the order in which the player's
* pieces are. Whichever piece is in the array order's third index is the furthest player
*/
@Test
public void getOrderTest() {
assertEquals(0,0);
LudoState state = new LudoState();
state.newRoll();
state.advanceToken(0,0);
assertEquals(state.getOrder(0)[3],0);
}
} | [
"randomuser1190@gmail.com"
] | randomuser1190@gmail.com |
3ce0e85d15a19052d5c35111e1c6ed716a66f1d7 | 559fa0a403051b634f4d0c78a4e1f8b57a4f1733 | /src/main/java/bencode/impl/BEncodeListWriter.java | a9cdc8f78551c834898c9611bb7ef8f3a5177bb5 | [] | no_license | eshu/bencode-java | 00002f2f6d429c60592f0a7a70919abe39e53ee4 | efc317e26d384d0ab538bdfc1c4d1763849543a9 | refs/heads/master | 2016-09-05T11:34:40.221679 | 2015-03-18T20:45:39 | 2015-03-18T20:45:39 | 32,482,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,480 | java | package bencode.impl;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
import bencode.DictionaryWriter;
import bencode.ListWriter;
import bencode.exception.BEncodeException;
import bencode.util.Blob;
import bencode.util.ByteArray;
final class BEncodeListWriter extends ContainerChildWriter implements ListWriter {
BEncodeListWriter(final BEncodeOutputStream out) {
super(out);
}
@Override
public ListWriter list() throws IOException, BEncodeException {
assertChildClosed();
out.list();
final BEncodeListWriter list = new BEncodeListWriter(out);
child = list;
return list;
}
@Override
public DictionaryWriter dictionary() throws IOException {
assertChildClosed();
out.dictionary();
final BEncodeDictionaryWriter dictionary = new BEncodeDictionaryWriter(out);
child = dictionary;
return dictionary;
}
@Override
public OutputStream string(final BigInteger length) throws IOException {
assertChildClosed();
final ByteStringOutputStream stream = out.string(length);
child = stream;
return stream;
}
@Override
public ListWriter write(final BigInteger value) throws IOException {
assertChildClosed();
out.write(value);
return this;
}
@Override
public ListWriter write(final byte[] string) throws IOException {
assertChildClosed();
out.write(string);
return this;
}
@Override
public ListWriter write(final String string) throws IOException {
assertChildClosed();
out.write(string);
return this;
}
@Override
public ListWriter write(final BigInteger length, final InputStream in) throws IOException {
assertChildClosed();
out.write(length, in);
return this;
}
@Override
public ListWriter write(final Blob blob) throws IOException {
assertChildClosed();
out.write(blob);
return this;
}
@Override
public ListWriter write(final List<?> list) throws IOException {
assertChildClosed();
out.write(list);
return this;
}
@Override
public ListWriter write(final Map<ByteArray, ?> map) throws IOException {
assertChildClosed();
out.write(map);
return this;
}
}
| [
"tjano.xibalba@gmail.com"
] | tjano.xibalba@gmail.com |
3abce425d537a42ad9316b685bb0b772768a7c71 | 2c601ffcd2f89c99ac7acfafe393b3ea8847c463 | /src/main/java/org/sejda/commons/collection/CircularLinkedList.java | 765d29a7ed40007df376c52ced0034a121a346d8 | [
"Apache-2.0"
] | permissive | torakiki/sejda-commons | 7c05fcf54dea0e30c1b5a0e82b257b4eb7f0d9c4 | cfe02defbafbe6d1abccff454fda90520a1137fc | refs/heads/master | 2022-09-17T23:22:55.192766 | 2022-09-02T07:58:37 | 2022-09-02T07:58:37 | 150,710,749 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,704 | java | /*
* Copyright 2018 Sober Lemur S.a.s. di Vacondio Andrea and Sejda BV
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sejda.commons.collection;
import static org.sejda.commons.util.RequireUtils.requireArg;
import java.util.Collection;
import java.util.LinkedList;
/**
* A {@link LinkedList} with size constraints. When at maxCapacity and an element is added, the eldest element is removed.
*
* @author Andrea Vacondio
*
*/
public class CircularLinkedList<E> extends LinkedList<E> {
private int maxCapacity;
public CircularLinkedList(int maxCapacity) {
setMaxCapacity(maxCapacity);
}
public void setMaxCapacity(int maxCapacity) {
requireArg(maxCapacity > 0, "Max capacity must be a positive value");
this.maxCapacity = maxCapacity;
houseKeep();
}
public int getMaxCapacity() {
return maxCapacity;
}
public boolean isFull() {
return size() >= maxCapacity;
}
@Override
public void addFirst(E e) {
makeRoom();
super.addFirst(e);
}
@Override
public void addLast(E e) {
makeRoom();
super.addLast(e);
}
@Override
public boolean add(E e) {
makeRoom();
return super.add(e);
}
@Override
public boolean addAll(Collection<? extends E> c) {
boolean ret = super.addAll(c);
houseKeep();
return ret;
}
@Override
public boolean addAll(int index, Collection<? extends E> c) {
boolean ret = super.addAll(index, c);
houseKeep();
return ret;
}
@Override
public void add(int i, E e) {
super.add(i, e);
houseKeep();
}
/**
* Makes a space available if the list is already full. Calling this prior the insertion avoids that the list exceeds its limits.
*/
private void makeRoom() {
while (isFull()) {
pollFirst();
}
}
/**
* Makes the list fit its limits by removing last items in cases where the list might have exceeded its limits.
*/
private void houseKeep() {
while (size() > maxCapacity) {
pollFirst();
}
}
}
| [
"andrea.vacondio@gmail.com"
] | andrea.vacondio@gmail.com |
018e7b5c653fd5ef2bca50e0a1242c908693bca5 | 8ac0c0eb6f9fc52e6e1baed1cf57133ac48f5e33 | /src/main/java/com/kodilla/carrental/dto/CreateEquipmentDto.java | 6dc29afd929cef4c62156e588410cb8edd67068d | [] | no_license | pszczepcio/car-rental | 3cb4501387715631ef19731d4dd9f00a6a36106f | f398f759d2c5111cb2ad41ca50bfc6d58f9933d6 | refs/heads/master | 2020-06-16T20:31:20.813531 | 2019-11-04T12:08:57 | 2019-11-04T12:08:57 | 195,695,357 | 0 | 0 | null | 2019-07-07T23:36:58 | 2019-07-07T20:44:07 | Java | UTF-8 | Java | false | false | 553 | java | package com.kodilla.carrental.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class CreateEquipmentDto {
private Long id;
private String equipment;
private double prize;
private List<Long> carid = new ArrayList<>();
public CreateEquipmentDto(String equipment, double prize) {
this.equipment = equipment;
this.prize = prize;
}
}
| [
"spiotrek1985@gmail.com"
] | spiotrek1985@gmail.com |
08fa1189da7f4a01a34dd0b9b8e8033953cc9471 | 85720de1b78e09c53d0b113e08d91e30b2ce0f0f | /omall/src/com/paySystem/ic/bean/base/DeliveryOrders.java | 487f8e2b3e95306200354f592ba47fcdeb625dde | [] | no_license | supermanxkq/projects | 4f2696708f15d82d6b8aa8e6d6025163e52d0f76 | 19925f26935f66bd196abe4831d40a47b92b4e6d | refs/heads/master | 2020-06-18T23:48:07.576254 | 2016-11-28T08:44:15 | 2016-11-28T08:44:15 | 74,933,844 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,658 | java | package com.paySystem.ic.bean.base;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @ClassName:DeliveryOrders.java
* @Description:发货信息实体
* @date: 2014-10-10下午03:03:53
* @author: Jacky
* @version: V1.0
*/
@Entity
@Table(name = "O_DeliveryOrders")
public class DeliveryOrders implements Serializable {
private static final long serialVersionUID = 3970336097852824875L;
/**
* 自增id
*/
private long doId;
/**
* 发货状态
* 0:未发货;
1:发货中;
2:已发货
*/
private Integer status;
/**
* 商户merId
*/
private String merId;
/**
* 买家
*/
private String memId;
/**
* 收货人姓名
*/
private String memName;
/**
* 收货人电话
*/
private String memTele;
/**
* 收货地址
*/
private String address;
/**
* 发货地址
*/
private String merAddress;
/**
* 订单号
*/
private String orderId;
/**
* 商品名称
*/
private String goodsName;
/**
* 商品价格
*/
private BigDecimal price;
/**
* 商品数量
*/
private Integer qty;
/**
* 下单时间
*/
private Date createTime;
/** 备注**/
private String remarks;
@Column(length=150,nullable=true)
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY )
public long getDoId() {
return doId;
}
public void setDoId(long doId) {
this.doId = doId;
}
@Column(length=1,nullable=false)
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Column(length=15,nullable=false)
public String getMerId() {
return merId;
}
public void setMerId(String merId) {
this.merId = merId;
}
@Column(length=10,nullable=false)
public String getMemId() {
return memId;
}
public void setMemId(String memId) {
this.memId = memId;
}
@Column(length=15,nullable=false)
public String getMemName() {
return memName;
}
public void setMemName(String memName) {
this.memName = memName;
}
@Column(length=11,nullable=false)
public String getMemTele() {
return memTele;
}
public void setMemTele(String memTele) {
this.memTele = memTele;
}
@Column(length=255,nullable=false)
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Column(length=255,nullable=false)
public String getMerAddress() {
return merAddress;
}
public void setMerAddress(String merAddress) {
this.merAddress = merAddress;
}
@Column(length=16,nullable=false)
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
@Column(length=60,nullable=false)
public String getGoodsName() {
return goodsName;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
@Column(nullable=false,scale=4,precision=13)
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
@Column(length=5,nullable=false)
public Integer getQty() {
return qty;
}
public void setQty(Integer qty) {
this.qty = qty;
}
@Column(nullable=false)
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
| [
"994028591@qq.com"
] | 994028591@qq.com |
57f475bddcd2cebefe5d33aa38d19592d5107f87 | 98a21dba4f8e34f12570d44fa82ac4495f8c488e | /search/search-server/business-entities-module/src/main/java/com/fly/house/model/File.java | 2002c725b5b11e271b4afaf4424c0f5dd700fa4f | [] | no_license | rasheedamir/decentralized-search-system | 27db95c267b4406316c05f77960b725d13cf7a96 | c38b6b8b2dfb1b14d758118924c02d4c7f53c70a | refs/heads/master | 2020-02-26T15:48:23.460224 | 2014-05-05T14:00:00 | 2014-05-05T14:00:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,709 | java | package com.fly.house.model;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.validation.constraints.NotNull;
/**
* Created by dimon on 5/2/14.
*/
@Entity
public class File extends BasedEntity {
private String path;
@NotNull
@ManyToOne(cascade = CascadeType.PERSIST)
private Artifact artifact;
@NotNull
@OneToOne
private Account account;
public File(Account account, Artifact artifact, String path) {
this.path = path;
this.artifact = artifact;
this.account = account;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
public Artifact getArtifact() {
return artifact;
}
public void setArtifact(Artifact artifact) {
this.artifact = artifact;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
File file = (File) o;
if (!account.equals(file.account)) return false;
if (!path.equals(file.path)) return false;
return true;
}
@Override
public int hashCode() {
int result = path.hashCode();
result = 31 * result + account.hashCode();
return result;
}
@Override
public String toString() {
return "File{" +
"path='" + path + '\'' +
'}';
}
}
| [
"world.bin.info@gmail.com"
] | world.bin.info@gmail.com |
c423cc098fedc8c90e33bd00bb40529c214561a2 | 87ac0cdcd1700bf9b360914e8e18c7f8cccc9880 | /backend/src/main/java/com/knigopoisk/demo/DemoApplication.java | 65f873fe30cd663ad8b46021e9d44706d736431e | [] | no_license | qcezwx/knigopoisk | e936cda7aca9451ace9f8113d3ec3f4bf59122e6 | d295d3a1d0b3c29eb7627062ca9d82263777f8e1 | refs/heads/master | 2020-03-23T12:55:30.889519 | 2018-08-27T09:35:01 | 2018-08-27T09:35:01 | 141,590,600 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.knigopoisk.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@EnableJpaAuditing
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"golcov.alex@gmail.com"
] | golcov.alex@gmail.com |
bff28878dd1efc8490cff3f62b4631b98cdea080 | 94664db5daee6a14cbb88af53ad9f8dbf0937340 | /src/Model/Calculator.java | 9ab711f7d33d7f4d4f0273e0fb34d8fa319c30db | [] | no_license | sakshamahluwalia/Finance-Assistant | e35f3ee5c4c7d1632b0a05b9c0bfa87fbbea2fdf | b89e3d9456e20f89e3f7e13e07225e9c7406aca5 | refs/heads/master | 2020-03-22T15:25:25.281819 | 2018-09-05T02:18:51 | 2018-09-05T02:18:51 | 140,251,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 508 | java | package Model;
import java.util.ArrayList;
public class Calculator {
double creditLeft(double credit, double expense) {
return credit - expense;
}
/*
* This method will add the amount from all the transactions
*
*/
public double creditSpent(ArrayList<Transaction> transactions) {
double creditSpent = 0;
for (Transaction transaction : transactions) {
creditSpent += transaction.getAmount();
}
return creditSpent;
}
}
| [
"saksham.ahluwalia@mail.utoronto.ca"
] | saksham.ahluwalia@mail.utoronto.ca |
36c16e010c634af63cbf7f0d093abdd070e24316 | 366d660f213ed87a3809e142edc53f669a0b4d71 | /src/main/java/com/assessment/util/AppJWTTokenProvider.java | dad4948d3225b878c8fd52f634ed4b38123ebf33 | [] | no_license | MuraliSeelam2020/assessment-user-service | 7a139e31b709d599ac757c3765f3daa93b5a39ca | b6cca4820d74ce42fabf6a3fde4c43de6b5b43af | refs/heads/master | 2023-03-13T08:52:45.214665 | 2021-03-08T08:00:03 | 2021-03-08T08:00:03 | 345,533,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,957 | java | package com.assessment.util;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Component;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jws;
import io.jsonwebtoken.JwtParser;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
@Component
public class AppJWTTokenProvider implements Serializable {
@Value("${jwt.token.validity}")
public long tokenValidity;
@Value("${jwt.signing.key}")
public String signingKey;
@Value("${jwt.authorities.key}")
public String authoritiesKey;
public String getUsernameFromToken(String token) {
return getClaimFromToken(token, Claims::getSubject);
}
public Date getExpirationDateFromToken(String token) {
return getClaimFromToken(token, Claims::getExpiration);
}
public <T> T getClaimFromToken(String token, Function<Claims, T> claimsResolver) {
final Claims claims = getAllClaimsFromToken(token);
return claimsResolver.apply(claims);
}
private Claims getAllClaimsFromToken(String token) {
return Jwts.parser().setSigningKey(signingKey).parseClaimsJws(token).getBody();
}
private Boolean isTokenExpired(String token) {
final Date expiration = getExpirationDateFromToken(token);
return expiration.before(new Date());
}
public String generateToken(Authentication authentication) {
String authorities = authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority)
.collect(Collectors.joining(","));
return Jwts.builder().setSubject(authentication.getName()).claim(authoritiesKey, authorities)
.setIssuedAt(new Date(System.currentTimeMillis()))
.setExpiration(new Date(System.currentTimeMillis() + tokenValidity * 1000))
.signWith(SignatureAlgorithm.HS256, signingKey).compact();
}
public Boolean validateToken(String token) {
return !isTokenExpired(token);
}
public UsernamePasswordAuthenticationToken getAuthenticationToken(final String token, final UserDetails userDetails) {
final JwtParser jwtParser = Jwts.parser().setSigningKey(signingKey);
final Jws<Claims> claimsJws = jwtParser.parseClaimsJws(token);
final Claims claims = claimsJws.getBody();
final Collection<? extends GrantedAuthority> authorities = Arrays
.stream(claims.get(authoritiesKey).toString().split(",")).map(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
return new UsernamePasswordAuthenticationToken(userDetails, "", authorities);
}
} | [
"muralidhara.seelam@gmail.com"
] | muralidhara.seelam@gmail.com |
98930571fde03d221cf46610fb426e9e95d05b94 | f8e421f6014567e3fa2795c0594b0c1af1c9cd3a | /backend/src/main/java/com/devsuperior/dsvendas/dto/SaleSucessDTO.java | f0dfeb79ed6fcbf8a1b62912dab60e39039f312b | [] | no_license | georpin/projeto-sds3 | 474984ee440d31c4bff87170b60010edbbf46eb5 | b09e46938cea8755c9aeb36586e75f47d185ec6e | refs/heads/master | 2023-04-23T13:32:32.171430 | 2021-05-09T12:08:49 | 2021-05-09T12:08:49 | 364,574,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 874 | java | package com.devsuperior.dsvendas.dto;
import java.io.Serializable;
import com.devsuperior.dsvendas.entities.Seller;
public class SaleSucessDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String sellerName;
private Long visited;
private Long deals;
public SaleSucessDTO() {
}
public SaleSucessDTO(Seller seller, Long visited, Long deals ) {
super();
this.sellerName = seller.getName();
this.visited = visited;
this.deals = deals;
}
public String getSellerName() {
return sellerName;
}
public void setSellerName(String sellerName) {
this.sellerName = sellerName;
}
public Long getVisited() {
return visited;
}
public void setVisited(Long visited) {
this.visited = visited;
}
public Long getDeals() {
return deals;
}
public void setDeals(Long deals) {
this.deals = deals;
}
}
| [
"danilo.george@hotmail.com"
] | danilo.george@hotmail.com |
15d2623afbbe2a68ff7dd718fabdc7d99e010f90 | 9149435dcb42a3847ee51b34c279a37a6819bf57 | /src/main/java/com/anakrusis/multiplayertest/TestClient.java | 128c85ddf2476283a8c8d20897fa30906e9ba3d3 | [] | no_license | anakrusis/multiplayer-test | 48cfb803ff4046b09ddada001da8330b9bccdcee | 6cb0658dc94030dd6324a5601bdfaeddb0924a37 | refs/heads/master | 2021-03-27T22:59:19.112464 | 2020-03-17T01:04:16 | 2020-03-17T01:04:16 | 247,815,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,004 | java | package com.anakrusis.multiplayertest;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.serialization.ClassResolvers;
import io.netty.handler.codec.serialization.ObjectDecoder;
import io.netty.handler.codec.serialization.ObjectEncoder;
import org.lwjgl.glfw.*;
import org.lwjgl.opengl.GL;
import static org.lwjgl.glfw.Callbacks.glfwFreeCallbacks;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL11.glClearColor;
import static org.lwjgl.system.MemoryUtil.NULL;
public class TestClient {
private long window;
public static TestClient testClient = new TestClient();
public static World world;
public void run() {
init();
loop();
// Free the window callbacks and destroy the window
glfwFreeCallbacks(window);
glfwDestroyWindow(window);
// Terminate GLFW and free the error callback
glfwTerminate();
glfwSetErrorCallback(null).free();
}
private void init() {
// Setup an error callback. The default implementation
// will print the error message in System.err.
GLFWErrorCallback.createPrint(System.err).set();
// Initialize GLFW. Most GLFW functions will not work before doing this.
if ( !glfwInit() )
throw new IllegalStateException("Unable to initialize GLFW");
// Configure GLFW
glfwDefaultWindowHints(); // optional, the current window hints are already the default
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); // the window will stay hidden after creation
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); // the window will be resizable
// Create the window
window = glfwCreateWindow(600, 400, "Multiplayer Test Client", NULL, NULL);
if ( window == NULL )
throw new RuntimeException("Failed to create the GLFW window");
// Make the OpenGL context current
glfwMakeContextCurrent(window);
// Enable v-sync
glfwSwapInterval(1);
// Make the window visible
glfwShowWindow(window);
// This is up here now so it won't go up every tick
GL.createCapabilities();
glEnable(GL_TEXTURE_2D);
glClearColor(1f,0f,0f,0f);
}
private void loop() {
while ( !glfwWindowShouldClose(window) ) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// redner here
glfwSwapBuffers(window);
glfwPollEvents();
}
}
public static void main(String[] args) throws Exception {
String host = "localhost";
int port = 8080;
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
Bootstrap b = new Bootstrap(); // (1)
b.group(workerGroup); // (2)
b.channel(NioSocketChannel.class); // (3)
b.option(ChannelOption.SO_KEEPALIVE, true); // (4)
b.handler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(new ObjectEncoder());
ch.pipeline().addLast(new ObjectDecoder(ClassResolvers.cacheDisabled(null)));
ch.pipeline().addLast(new TestClientHandler());
}
});
// Start the client.
ChannelFuture f = b.connect(host, port).sync(); // (5)
testClient.run();
// Wait until the connection is closed.
//f.channel().closeFuture().sync();
} finally {
workerGroup.shutdownGracefully();
}
}
}
| [
"howtofamitracker@gmail.com"
] | howtofamitracker@gmail.com |
7cc60cafbf0e14ac5c703928bf7d77f061f34582 | ea629ab8f1c80a54c67904449b90a2d5ddc9d662 | /platform/src/main/java/gov/nasa/arc/mct/gui/actions/RemoveManifestationAction.java | 2cd59304361225a79b1487f06ece177b8477e0fa | [] | no_license | dtran320/mct | 3f4bb0725796d7cbf5514f8eab7556a3ecff2f27 | 25803eea2c1de80d17a34ce3944edb4ae996ac9a | refs/heads/master | 2021-01-21T01:16:08.891778 | 2012-05-16T21:17:13 | 2012-05-16T21:17:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,090 | java | /*******************************************************************************
* Mission Control Technologies, Copyright (c) 2009-2012, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* The MCT platform is 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.
*
* MCT includes source code licensed under additional open source licenses. See
* the MCT Open Source Licenses file included with this distribution or the About
* MCT Licenses dialog available at runtime from the MCT Help menu for additional
* information.
*******************************************************************************/
package gov.nasa.arc.mct.gui.actions;
import gov.nasa.arc.mct.components.AbstractComponent;
import gov.nasa.arc.mct.gui.ActionContext;
import gov.nasa.arc.mct.gui.ActionContextImpl;
import gov.nasa.arc.mct.gui.ContextAwareAction;
import gov.nasa.arc.mct.gui.MCTMutableTreeNode;
import gov.nasa.arc.mct.gui.View;
import gov.nasa.arc.mct.gui.dialogs.MCTDialogManager;
import gov.nasa.arc.mct.gui.housing.MCTDirectoryArea;
import gov.nasa.arc.mct.gui.housing.MCTHousing;
import gov.nasa.arc.mct.gui.util.GUIUtil;
import gov.nasa.arc.mct.policy.PolicyContext;
import gov.nasa.arc.mct.policy.PolicyInfo;
import gov.nasa.arc.mct.policymgr.PolicyManagerImpl;
import gov.nasa.arc.mct.services.component.ViewInfo;
import gov.nasa.arc.mct.services.component.ViewType;
import gov.nasa.arc.mct.util.logging.MCTLogger;
import java.awt.event.ActionEvent;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import javax.swing.JTree;
import javax.swing.tree.TreePath;
/**
* This action removes a manifestation in the directory area. Note that
* removing a manifestation under "created by me" is not allowed, but
* it not part of the composition policy category.
* @author nija.shi@nasa.gov
*/
@SuppressWarnings("serial")
public class RemoveManifestationAction extends ContextAwareAction {
private static String TEXT = "Remove Manifestation";
private TreePath[] selectedTreePaths;
private ActionContextImpl actionContext;
public RemoveManifestationAction() {
super(TEXT);
}
@Override
public boolean canHandle(ActionContext context) {
actionContext = (ActionContextImpl) context;
MCTHousing activeHousing = actionContext.getTargetHousing();
if (activeHousing == null)
return false;
Collection<View> selection =
activeHousing.getSelectionProvider().getSelectedManifestations();
if (selection.isEmpty())
return false;
ViewInfo vi = selection.iterator().next().getInfo();
if (selection.isEmpty() ||
!(vi != null && vi.getViewType() == ViewType.NODE)){
return false;
}
if (!(activeHousing.getDirectoryArea() instanceof MCTDirectoryArea)) {
MCTLogger.getLogger(RemoveManifestationAction.class).error("Action only works with MCTDirectoryArea");
return false;
}
MCTDirectoryArea directory = MCTDirectoryArea.class.cast(activeHousing.getDirectoryArea());
MCTMutableTreeNode firstSelectedNode = directory.getSelectedDirectoryNode();
if (firstSelectedNode == null)
return false;
JTree tree = firstSelectedNode.getParentTree();
selectedTreePaths = tree.getSelectionPaths();
return selectedTreePaths != null && selectedTreePaths.length > 0;
}
@Override
public boolean isEnabled() {
for (TreePath path : selectedTreePaths) {
if (!isRemovable(path))
return false;
}
return true;
}
@Override
public void actionPerformed(ActionEvent e) {
Map<String, Set<View>> lockedManifestations = GUIUtil.getLockedManifestations(selectedTreePaths);
if (!lockedManifestations.isEmpty()) {
MCTMutableTreeNode firstSelectedNode = (MCTMutableTreeNode) selectedTreePaths[0].getLastPathComponent();
if (!MCTDialogManager.showUnlockedConfirmationDialog((View) firstSelectedNode.getUserObject(), lockedManifestations, "Remove", "row and/or associated inspector"))
return;
}
for (TreePath path : selectedTreePaths) {
MCTMutableTreeNode selectedNode = (MCTMutableTreeNode) path.getLastPathComponent();
MCTMutableTreeNode parentNode = (MCTMutableTreeNode) selectedNode.getParent();
AbstractComponent parentComponent = ((View) parentNode.getUserObject()).getManifestedComponent();
AbstractComponent selectedComponent = ((View) selectedNode.getUserObject()).getManifestedComponent();
// Remove from component model
parentComponent.removeDelegateComponent(selectedComponent);
}
}
private boolean isRemovable(TreePath path) {
MCTMutableTreeNode lastPathComponent = (MCTMutableTreeNode) path.getLastPathComponent();
MCTMutableTreeNode parentNode = (MCTMutableTreeNode) lastPathComponent.getParent();
if (parentNode == null)
return false;
AbstractComponent parentComponent = ((View) parentNode.getUserObject()).getManifestedComponent();
AbstractComponent selectedComponent = View.class.cast(lastPathComponent.getUserObject()).getManifestedComponent();
PolicyContext context = new PolicyContext();
context.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), parentComponent);
context.setProperty(PolicyContext.PropertyName.ACTION.getName(), 'w');
context.setProperty(PolicyContext.PropertyName.SOURCE_COMPONENTS.getName(), Collections.singleton(selectedComponent));
context.setProperty(PolicyContext.PropertyName.VIEW_MANIFESTATION_PROVIDER.getName(), parentNode.getUserObject());
String canRemoveManifestationKey = PolicyInfo.CategoryType.CAN_REMOVE_MANIFESTATION_CATEGORY.getKey();
boolean canRemoveManifestation = PolicyManagerImpl.getInstance().execute(canRemoveManifestationKey, context).getStatus();
if (canRemoveManifestation) {
String compositionKey = PolicyInfo.CategoryType.COMPOSITION_POLICY_CATEGORY.getKey();
return PolicyManagerImpl.getInstance().execute(compositionKey, context).getStatus();
}
return canRemoveManifestation;
}
}
| [
"chris.webster@nasa.gov"
] | chris.webster@nasa.gov |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.