blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
919bbd16c00f94dca40baa5d4eff1e82fbe5b92c
25c579f92feb383f48742862171332df44bbb12f
/demo/src/main/java/com/thoughtworks/demo/utils/HttpUtil.java
c52ff191c5107606b11a64fbd246f790ee94b635
[ "Apache-2.0" ]
permissive
windcrystal0513/authorization-demo
668aa7330d953eaaaaf529e490ba218bece0cae5
c86c2f168b0c649981ec9901cc5ddc7d550f7127
refs/heads/master
2022-11-20T10:19:09.295986
2020-07-24T02:46:48
2020-07-24T02:46:48
270,924,395
0
0
null
null
null
null
UTF-8
Java
false
false
1,233
java
package com.thoughtworks.demo.utils; import javax.servlet.http.HttpServletRequest; import java.net.InetAddress; import java.net.UnknownHostException; /** * 关于HTTP传输的信息的解析 * */ public class HttpUtil { public static String getOrigin(HttpServletRequest request) { String origin = request.getHeader("Origin"); return origin; } public static String getUserAgent(HttpServletRequest request) { String userAgent = request.getHeader("User-Agent"); return userAgent; } public static String getReferer(HttpServletRequest request) { String referer = request.getHeader("Referer"); return referer; } public static String getHeaders(HttpServletRequest request) { String headers = "Referer: " + getReferer(request) + "; User-Agent: " + getUserAgent(request); return headers; } public static String getIp() { String ip = ""; try { InetAddress address = InetAddress.getLocalHost(); //获取本机ip ip = address.getHostAddress().toString(); } catch (UnknownHostException e) { e.printStackTrace(); } return ip; } }
[ "wuyunfeng1234123@163.com" ]
wuyunfeng1234123@163.com
618db6dcec0f4a2868c6d9b6ff69dbee0f1e89c4
6f1da292620bf14e3965ce5ea5d075139fa288ef
/src/main/java/net/praqma/clearcase/util/setup/ContentTask.java
8b0745235218aab185ce57ced9a769cb1098ea5b
[]
no_license
panqa100/cool
de2d1cbc4960404e43f6dfc9fbf793635c8a0b0e
f04b6b868bdba5f19e02134bacdc89cf13f0a354
refs/heads/master
2021-01-18T18:42:29.800375
2020-04-14T03:22:06
2020-04-14T03:22:06
86,871,648
0
0
null
2017-04-01T00:58:24
2017-04-01T00:58:24
null
UTF-8
Java
false
false
948
java
package net.praqma.clearcase.util.setup; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Logger; import net.praqma.clearcase.exceptions.ClearCaseException; import net.praqma.clearcase.util.setup.EnvironmentParser.Context; import org.w3c.dom.Element; public class ContentTask extends AbstractTask { private static Logger logger = Logger.getLogger( ContentTask.class.getName() ); @Override public void parse( Element e, Context context ) throws ClearCaseException { File file = new File( context.path, e.getAttribute( "file" ) ); String content = getValue( "content", e, context, "" ); FileWriter fw = null; try { fw = new FileWriter( file, true ); fw.write( content ); } catch( IOException e1 ) { throw new ClearCaseException( e1 ); } finally { try { fw.close(); } catch( Exception e1 ) { //throw new ClearCaseException( e1 ); } } } }
[ "wolfgarnet@gmail.com" ]
wolfgarnet@gmail.com
3d251d01cf470b8fa2f9bd7184a9fa9a6c799449
09fe280afc41c1354aa3e37d2cc8678c2f634138
/interviewjam-master/math/leetcode_Two_Sum.java
d4e36d9499b9bb58d361663a19042dc4af1db7dd
[]
no_license
subnr01/Programming_interviews
4c4a15bfac07cb90018e2a63bb25b05ae234b9d4
4f5fb0337a48456aa7b98eafd51db9346a5e2d64
refs/heads/master
2021-03-19T13:47:47.880251
2015-10-15T21:50:54
2015-10-15T21:50:54
44,342,710
0
1
null
null
null
null
UTF-8
Java
false
false
1,324
java
/*Two_Sum Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are not zero-based. You may assume that each input would have exactly one solution. Input: numbers={2, 7, 11, 15}, target=9 Output: index1=1, index2=2 */ import java.util.HashMap; public class leetcode_Two_Sum { public static void main(String[] args) { } public static int[] twoSum(int[] numbers, int target) { // Using hashmap to cache value/index pair. // Iterate through arr once. For each value check if target - value is cached. // If yes, return map.get(target - curValue) + 1, curIndex + 1. If no, cache // current value and index. HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); int i; int[] ret = new int[2]; for (i = 0; i < arr.length; ++i) { if (map.containsKey(target - arr[i])) { ret = new int[] {map.get(target - arr[i]) + 1, i + 1}; break; } else { map.put(arr[i], i); } } return ret; } }
[ "subnr01@gmail.com" ]
subnr01@gmail.com
9e7082a896c3971ff73695e6d35ad5603c5378d7
5181db5199be9dd3cebd3cec4edba932b63f345d
/app/src/main/java/com/naahac/tvaproject/utils/Logger.java
799afd97f3322fff385b12c0fbec86c31e3f0330
[]
no_license
naahac/RecipeManager
0a072beb1f96bf87075d98b31eec28b8c4059ca5
3d199e7614df19776b1f174b99a238dd1b1a65be
refs/heads/master
2021-07-13T14:07:01.852831
2017-10-14T15:05:04
2017-10-14T15:05:04
106,936,804
0
0
null
null
null
null
UTF-8
Java
false
false
2,036
java
package com.naahac.tvaproject.utils; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.Iterator; public class Logger { private static boolean PRINT_LOG = true;//BuildConfig.DEBUG; public static void print(String TAG, String... message){ if(!PRINT_LOG) return; for(String item : message) if(item != null) Log.v(TAG, item); } public static void printError(String TAG, String... message){ if(!PRINT_LOG) return; for(String item : message) if(item != null) Log.e(TAG, item); } public static void printJSON(String TAG, JSONObject json){ if(!PRINT_LOG) return; try { Log.v(TAG, json.toString(4)); } catch (JSONException e) { Log.v(TAG, "Error parsing JSON object"); } } public static void printJSON(String TAG, Object object){ if(!PRINT_LOG) return; try { Log.v(TAG, new JSONObject(GeneralUtils.getGson().toJson(object)).toString(4)); } catch (JSONException e) { Log.v(TAG, "Error parsing JSON object"); } } public static void printLongJSON(String TAG, JSONObject json){ if(!PRINT_LOG) return; Iterator<String> keys = json.keys(); while (keys.hasNext()){ try { String key = keys.next(); Object value = json.get(key); if(value instanceof JSONObject) Log.v(key, ((JSONObject)value).toString(4)); else if (value instanceof JSONArray){ Log.v(key, ((JSONArray)value).toString(4)); }else Log.v(key, String.valueOf(value)); } catch (JSONException e) { Log.v(TAG, "Error parsing JSON object"); } } } public static void setPrintLog(boolean printLog) { PRINT_LOG = printLog; } }
[ "natanael.ahac@gmail.com" ]
natanael.ahac@gmail.com
a21e49d8e069cdb70e102ae4fb047c54007e08af
2a6b3b75d0dfc50c9db5611a452a43fc370d3c7e
/src/kosta/mvc/model/dao/UserListDAOImpl.java
a1374d645702fb0a54dcb9a4822944a6e1c82fed
[]
no_license
8253jang/ccc
6dbc8e16c6ee751a9d047f09782c17e5c9dadedf
d9cc6116654bca1c373457f6dd6e07cdae42b3dc
refs/heads/master
2022-12-13T14:07:53.421106
2020-09-14T03:35:26
2020-09-14T03:35:26
292,493,400
0
0
null
null
null
null
UTF-8
Java
false
false
4,432
java
package kosta.mvc.model.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Vector; import kosta.mvc.model.dto.UserListDTO; import kosta.mvc.model.util.DbUtil; public class UserListDAOImpl implements UserListDAO { @Override public List<Vector<Object>> getSelectAll() throws SQLException { Connection con = null; PreparedStatement ps=null; ResultSet rs=null; List<Vector<Object>> list = new ArrayList<>(); try { con=DbUtil.getConnection(); ps=con.prepareStatement("SELECT ID,NAME,AGE,ADDR FROM USERLIST"); rs=ps.executeQuery(); while(rs.next()) { Vector<Object> v =new Vector<>(); v.add(rs.getString("ID")); v.add(rs.getString("name")); v.add(rs.getInt("age")); v.add(rs.getString("addr")); list.add(v); } }finally { DbUtil.dbClose(con, ps, rs); } return list; } @Override public boolean getCheckById(String id) throws SQLException { Connection con = null; PreparedStatement ps=null; ResultSet rs=null; boolean result = false; try { con=DbUtil.getConnection(); ps=con.prepareStatement("SELECT ID,NAME,AGE,ADDR " + "FROM USERLIST where lower(id) =lower(?)"); ps.setString(1, id); rs=ps.executeQuery(); if(rs.next()) { result = true; } }finally { DbUtil.dbClose(con, ps, rs); } return result; } @Override public int userListInsert(UserListDTO userListDTO) throws SQLException { Connection con=null; PreparedStatement ps=null; int result=0; try { con=DbUtil.getConnection(); ps=con.prepareStatement("INSERT INTO USERLIST" + "(ID,NAME,AGE,ADDR) VALUES(?,?,?,?)"); ps.setString(1, userListDTO.getId()); ps.setString(2, userListDTO.getName()); ps.setInt(3, userListDTO.getAge()); ps.setString(4, userListDTO.getAddr()); result = ps.executeUpdate(); }finally { DbUtil.dbClose(con, ps); } return result; } @Override public int userListUpdate(UserListDTO userListDTO) throws SQLException { Connection con=null; PreparedStatement ps= null; int result=0; try { con = DbUtil.getConnection(); ps= con.prepareStatement("UPDATE USERLIST " + "SET NAME=? , AGE=?, ADDR=? WHERE ID=?"); ps.setString(1, userListDTO.getName()); ps.setInt(2, userListDTO.getAge()); ps.setString(3, userListDTO.getAddr()); ps.setString(4, userListDTO.getId()); result = ps.executeUpdate(); }finally { DbUtil.dbClose(con, ps); } return result; } @Override public int userListDelete(String id) throws SQLException { // TODO Auto-generated method stub return 0; } @Override public int userListDelete(String[] ids) throws SQLException { Connection con=null; PreparedStatement ps=null; int result=0; String sql="DELETE FROM USERLIST WHERE ID IN ("; try { for(int i=0; i<ids.length ; i++) { if(i==(ids.length-1)) sql+="?)"; else sql+="?,"; } //System.out.println(sql); con = DbUtil.getConnection(); con.setAutoCommit(false); ps = con.prepareStatement(sql); for(int i=0; i< ids.length ; i++) { ps.setString((i+1), ids[i]); } result=ps.executeUpdate(); }finally { if(result==ids.length) con.commit(); else con.rollback(); DbUtil.dbClose(con, ps); } return result; } @Override public List<Vector<Object>> getSearchUser(String keyField, String keyWord) throws SQLException { Connection con = null; PreparedStatement ps=null; ResultSet rs=null; List<Vector<Object>> list = new ArrayList<>(); String sql= "SELECT ID,NAME,AGE,ADDR FROM USERLIST " + "WHERE lower("+keyField + ") like lower(?)"; try { con=DbUtil.getConnection(); ps=con.prepareStatement(sql); ps.setString(1, "%"+keyWord+"%"); rs=ps.executeQuery(); while(rs.next()) { Vector<Object> v =new Vector<>(); v.add(rs.getString("ID")); v.add(rs.getString("name")); v.add(rs.getInt("age")); v.add(rs.getString("addr")); list.add(v); } }finally { DbUtil.dbClose(con, ps, rs); } return list; } }
[ "LG@DESKTOP-HeeJung" ]
LG@DESKTOP-HeeJung
654c3d8c35cbe7c640d5eb0a1712c796118f80d3
b1bae4e06b0832e99919a21e4f803f8a888489e6
/20191021/src/com/banyuan/test03/Test.java
645fa635cd3f5e27af6ab03ceb3e4e41ab69aa17
[]
no_license
devilmancrybaby/JavaCoding
ad2f2ad815fcb1a16820c9a377ad5d285c0baaa0
cace35ca0ddf4956f1002e412b482c828320cdf7
refs/heads/master
2020-08-31T12:20:29.277188
2019-10-31T05:19:35
2019-10-31T05:19:35
218,689,441
0
0
null
null
null
null
UTF-8
Java
false
false
578
java
package com.banyuan.test03; public class Test { public static void main(String []args){ Person p1=new Person(); Person p2=new Person("嘿嘿嘿",12,"sex"); System.out.println("员工1的信息:"); System.out.println("name:"+p1.getName()); System.out.println("age:"+p1.getAge()); System.out.println("sex:"+p1.getSex()); System.out.println("员工2的信息:"); System.out.println("name:"+p2.getName()); System.out.println("age:"+p2.getAge()); System.out.println("sex:"+p2.getSex()); } }
[ "a9ydeai@163.com" ]
a9ydeai@163.com
8c5c50b67f4ac0604f4b546991f43318e0612aa9
38c9e1136559390cb47093393bf0e9acc05653a2
/src/org/geometerplus/android/fbreader/SelectionShowPanelAction.java
37e4302b7f7e3efefd2c82c0926270060a99e7e3
[]
no_license
gezhonglunta/FBReaderJ_2
7df7d0a604b68956eaea3a902af75b6889f2cc24
ceae178cb7c9c66f7e661681922d5b38096a74f0
refs/heads/master
2020-04-06T16:18:38.693924
2012-12-03T13:44:04
2012-12-03T13:44:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,295
java
/* * Copyright (C) 2007-2012 Geometer Plus <contact@geometerplus.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ package org.geometerplus.android.fbreader; import org.geometerplus.fbreader.fbreader.FBReaderApp; class SelectionShowPanelAction extends FBAndroidAction { SelectionShowPanelAction(FBReader baseActivity, FBReaderApp fbreader) { super(baseActivity, fbreader); } @Override public boolean isEnabled() { return !Reader.getTextView().isSelectionEmpty(); } @Override protected void run(Object ... params) { BaseActivity.showSelectionPanel(); } }
[ "leftright@live.com" ]
leftright@live.com
4bfccacf8a90c5f0f66fba969f72b2f5def3152c
e1231cff7aa756ccb4c083b79af0c315ff0345a1
/bitcoinwallet/src/main/java/org/cyberdash/Cbip70.java
99001583916677e8c830852e74aecacacd9a4245
[]
no_license
joshineveryday/bitcoinj-wallet-example
a52edd4201094469ab6d19b7cadc6f2fdc27e41f
23af6f1472b055bfb2e23f0e48c6bd3b56307d2e
refs/heads/master
2023-01-14T14:46:43.892696
2019-08-26T04:00:43
2019-08-26T04:00:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,018
java
package org.cyberdash; import java.io.File; import org.bitcoinj.core.NetworkParameters; import org.bitcoinj.kits.WalletAppKit; import org.bitcoinj.core.Coin; import org.bitcoinj.params.TestNet3Params; import org.bitcoinj.utils.BriefLogFormatter; import org.bitcoinj.core.Address; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.bitcoinj.protocols.payments.PaymentSession; import com.google.common.util.concurrent.ListenableFuture; import org.bitcoinj.protocols.payments.PaymentProtocol; import org.bitcoinj.wallet.SendRequest; import com.google.common.collect.ImmutableList; import org.bitcoinj.uri.BitcoinURI; public class Cbip70 { private static final Logger log = LoggerFactory.getLogger(Cbip70.class); final static NetworkParameters params = TestNet3Params.get(); private static org.bitcoin.protocols.payments.Protos.PaymentRequest paymentRequest; public static void main(String[] args) { BriefLogFormatter.init(); WalletAppKit kit = new WalletAppKit(params, new File("."), "walletappkit"); // Download the blockchain kit.startAsync(); kit.awaitRunning(); // use kit.connectToLocalhost for regtest Address CustomerAddress = kit.wallet().currentReceiveAddress(); System.out.println("Client's address : " + CustomerAddress); System.out.println("Client's Balance : " + kit.wallet().getBalance()); // I could also update my machine to use the bitcoin: handler String url = "bitcoin:n1s7DwSZ4nSh471iPhAGZZbXkiTvtQCi5B?amount=0.00088888&message=payment%20request&r=http://192.168.0.8:3000/request?amount=00088888"; // Check if wallet has sufficient bitcoins if (Float.parseFloat(String.valueOf(kit.wallet().getBalance())) == 0.0) { log.warn("Please send some testnet Bitcoins to your address " + kit.wallet().currentReceiveAddress()); } else { System.out.println("Sending payment request!"); sendPaymentRequest(url, kit); } // System.out.println("shutting down again"); // kit.stopAsync(); // kit.awaitTerminated(); } private static void sendPaymentRequest(String location, WalletAppKit k) { try { if (location.startsWith("http") || location.startsWith("bitcoin")) { BitcoinURI paymentRequestURI = new BitcoinURI(location); ListenableFuture<PaymentSession> future = PaymentSession.createFromBitcoinUri(paymentRequestURI, true); PaymentSession session = future.get(); if (session.isExpired()) { log.warn("request expired!"); // payment requests can expire fast? } else { send(session, k); // System.exit(1); } } else { // Try to open the payment request as a file. log.info("Try to open the payment request as a file"); } } catch (Exception e) { System.err.println(e.getMessage()); } } private static void send(PaymentSession session, WalletAppKit k) { try { log.info("Payment Request"); log.info("Amount to Pay: " + session.getValue().toFriendlyString()); log.info("Date: " + session.getDate()); log.info("Message from merchant: " + session.getMemo()); PaymentProtocol.PkiVerificationData identity = session.verifyPki(); if (identity != null) { // Merchant identity from the cert log.info("Payment Requester: " + identity.displayName); log.info("Certificate Authority: " + identity.rootAuthorityName); } final SendRequest request = session.getSendRequest(); k.wallet().completeTx(request); String customerMemo = "Nice Website"; Address refundAddress = new Address(params, "mo3LZFYxQgVSM4cDxAUkctNrCMXk5mHfiE"); ListenableFuture<PaymentProtocol.Ack> future = session.sendPayment(ImmutableList.of(request.tx), refundAddress, customerMemo); if (future != null) { PaymentProtocol.Ack ack = future.get(); System.out.println("Memo from merchant: " + ack.getMemo()); k.wallet().commitTx(request.tx); } // else { // // if bitcoin URI doesn't contain a payment url, we broadcast directly the // list // // of signed transactions. // Wallet.SendResult sendResult = new Wallet.SendResult(); // sendResult.tx = request.tx; // sendResult.broadcast = k.peerGroup().broadcastTransaction(request.tx); // sendResult.broadcastComplete = sendResult.broadcast.future(); // } } catch (Exception e) { System.err.println("Failed to send payment " + e.getMessage()); // System.exit(1); } } }
[ "sirlanceoflompoc@gmail.com" ]
sirlanceoflompoc@gmail.com
fa91e97f6bb5103818041b884785d98294a3a213
da70f02dec96c1d8bd7393cd3292590825080510
/src/test/java/com/hieutrantronghcm/beautifulbookshell/BeautifulBookshellApplicationTests.java
4fa8d3d26a9635bc1e6cf27ac09d0a25bb5ba385
[]
no_license
hieutrantronghcm/Beautiful-Book-Shell
0e8efa831282849c2b4b09c77f250bf389d218d8
26133816a31bdc74d28f5d816d90c9146e8cea63
refs/heads/master
2020-04-15T02:03:18.047408
2019-01-06T15:10:17
2019-01-06T15:10:17
164,301,491
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package com.hieutrantronghcm.beautifulbookshell; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class BeautifulBookshellApplicationTests { @Test public void contextLoads() { } }
[ "hieutrantronghcm@gmail.com" ]
hieutrantronghcm@gmail.com
c1dd23dc90bde68e7d78c5ee88dc0ee6b27a839e
6186b7726aba4af2cca76d89ce6edd62b036c6f3
/cnicg-code-persist/src/main/java/com/sciov/lh/mybatis/ServiceInterfaceGenerator.java
e53c2a11ba9be941e5d15d0e1f8b7fd0dbbd7f41
[]
no_license
karl-liang/person
ab2cf5f4706aa53564856d0cc8a17ca5469c0780
caea5df8d37420c57773d69e8e9b7d48c4ffb4e6
refs/heads/master
2020-03-25T22:58:43.174898
2018-08-10T07:44:04
2018-08-10T07:44:04
144,253,798
0
0
null
null
null
null
UTF-8
Java
false
false
6,816
java
package com.sciov.lh.mybatis; import java.util.ArrayList; import java.util.List; import java.util.Properties; import org.mybatis.generator.api.CommentGenerator; import org.mybatis.generator.api.FullyQualifiedTable; import org.mybatis.generator.api.IntrospectedTable; import org.mybatis.generator.api.dom.java.CompilationUnit; import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType; import org.mybatis.generator.api.dom.java.Interface; import org.mybatis.generator.api.dom.java.JavaVisibility; import org.mybatis.generator.api.dom.java.Method; import org.mybatis.generator.api.dom.java.Parameter; import org.mybatis.generator.codegen.AbstractJavaGenerator; import org.mybatis.generator.config.Context; public class ServiceInterfaceGenerator extends AbstractJavaGenerator { public static final String RESPONSE_DATA_CLASS_KEY = "reponseDataClass"; Properties properties; public ServiceInterfaceGenerator(Properties properties) { super(); this.properties = properties; } @Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(String.format("Generating Service Interface for table %s", table.getAlias())); CommentGenerator commentGenerator = context.getCommentGenerator(); String fullQualif = PluginUtil.getTargetPackage(properties) + ".I" + table.getDomainObjectName() + "Service"; FullyQualifiedJavaType type = new FullyQualifiedJavaType(fullQualif); Interface serviceInterface = new Interface(type); serviceInterface.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(serviceInterface); getMethodWithId(serviceInterface, context, introspectedTable); addMethod(serviceInterface, context, introspectedTable); deleteMethodWithId(serviceInterface, context, introspectedTable); updateMethod(serviceInterface, context, introspectedTable); addListQuery(serviceInterface, context, introspectedTable); List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); answer.add(serviceInterface); return answer; } private void getMethodWithId(Interface serviceInterface, Context context, IntrospectedTable introspectedTable) { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); String voParam = PluginUtil.getVofullQualif(properties, introspectedTable); FullyQualifiedJavaType voType = new FullyQualifiedJavaType(voParam); serviceInterface.addImportedType(voType); Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(voType); method.setName("get" + table.getDomainObjectName()); Parameter idParameter = new Parameter(FullyQualifiedJavaType.getIntInstance(), "id"); method.addParameter(idParameter); serviceInterface.addMethod(method); } private void addMethod(Interface serviceInterface, Context context, IntrospectedTable introspectedTable) { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); String voParam = PluginUtil.getVofullQualif(properties, introspectedTable); FullyQualifiedJavaType voType = new FullyQualifiedJavaType(voParam); serviceInterface.addImportedType(voType); Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(FullyQualifiedJavaType.getIntInstance()); method.setName("add" + table.getDomainObjectName()); Parameter idParameter = new Parameter(voType, "vo"); method.addParameter(idParameter); serviceInterface.addMethod(method); } private void deleteMethodWithId(Interface serviceInterface, Context context, IntrospectedTable introspectedTable) { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); String voParam = PluginUtil.getVofullQualif(properties, introspectedTable); FullyQualifiedJavaType voType = new FullyQualifiedJavaType(voParam); serviceInterface.addImportedType(voType); Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(FullyQualifiedJavaType.getIntInstance()); method.setName("delete" + table.getDomainObjectName()); Parameter idParameter = new Parameter(FullyQualifiedJavaType.getIntInstance(), "id"); method.addParameter(idParameter); serviceInterface.addMethod(method); } private void updateMethod(Interface serviceInterface, Context context, IntrospectedTable introspectedTable) { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); String voParam = PluginUtil.getVofullQualif(properties, introspectedTable); FullyQualifiedJavaType voType = new FullyQualifiedJavaType(voParam); serviceInterface.addImportedType(voType); Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(FullyQualifiedJavaType.getIntInstance()); method.setName("update" + table.getDomainObjectName()); Parameter idParameter = new Parameter(voType, "vo"); method.addParameter(idParameter); serviceInterface.addMethod(method); } private String getResponseDataClass() { return properties.getProperty(RESPONSE_DATA_CLASS_KEY); } private void addListQuery(Interface serviceInterface, Context context, IntrospectedTable introspectedTable) { String voParam = PluginUtil.getVofullQualif(properties, introspectedTable); FullyQualifiedJavaType voType = new FullyQualifiedJavaType(voParam); FullyQualifiedJavaType responseDataClassType = new FullyQualifiedJavaType(getResponseDataClass()); FullyQualifiedJavaType listType = FullyQualifiedJavaType.getNewListInstance(); listType.addTypeArgument(voType); responseDataClassType.addTypeArgument(listType); serviceInterface.addImportedType(responseDataClassType); FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); serviceInterface.addImportedType(voType); Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(responseDataClassType); method.setName("find" + table.getDomainObjectName() + "List"); Parameter exampleParameter = new Parameter(voType, "example"); FullyQualifiedJavaType dateType = new FullyQualifiedJavaType("java.util.Date"); serviceInterface.addImportedType(dateType); Parameter startDateParameter = new Parameter(dateType, "startDate"); Parameter endDateParameter = new Parameter(dateType, "endDate"); Parameter pageNumParameter = new Parameter(FullyQualifiedJavaType.getIntInstance(), "pageNum"); Parameter pageSizeParameter = new Parameter(FullyQualifiedJavaType.getIntInstance(), "pageSize"); method.addParameter(exampleParameter); method.addParameter(startDateParameter); method.addParameter(endDateParameter); method.addParameter(pageNumParameter); method.addParameter(pageSizeParameter); serviceInterface.addMethod(method); } }
[ "lianghong@cnicg.cn" ]
lianghong@cnicg.cn
a36d52a75803ac97e3fec86140ffb48351c36e8f
2cb929cadc03519544fc57fae1c48e7b553a1b57
/src/main/java/com/cg/iocdemo1/Employee.java
649056d39e2516ade35c71b1313f56c7baa84f4d
[]
no_license
Dilpreet68/hello
06257315f855c9e636386c9d61ef29185eac2ac6
6e9095d292599866129584c5265d76542eecd6b2
refs/heads/master
2020-06-25T19:42:35.652656
2019-07-29T07:53:32
2019-07-29T07:53:32
199,404,658
0
0
null
null
null
null
UTF-8
Java
false
false
1,377
java
package com.cg.iocdemo1; import java.util.List; public class Employee { private int employeeId; private String employeeName; private double salary; private String businessUnit; private int age; public Employee() { // TODO Auto-generated constructor stub } public Employee(int employeeId, String employeeName, double salary, String businessUnit, int age) { super(); this.employeeId = employeeId; this.employeeName = employeeName; this.salary = salary; this.businessUnit = businessUnit; this.age = age; } public int getEmployeeId() { return employeeId; } public void setEmployeeId(int employeeId) { this.employeeId = employeeId; } public String getEmployeeName() { return employeeName; } public void setEmployeeName(String employeeName) { this.employeeName = employeeName; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } public String getBusinessUnit() { return businessUnit; } public void setBusinessUnit(String businessUnit) { this.businessUnit = businessUnit; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "Employee [employeeId = " + employeeId + ", employeeName = " + employeeName + ", salary = " + salary + ", age = " + age +",\nsbu details = " + businessUnit.toString() +"]"; } }
[ "dilpreet.b.kaur@capgemini.com" ]
dilpreet.b.kaur@capgemini.com
ae8b971ca509315ff9b3a7f3a492217893151120
c68e19580c4a992fcad4d511dc0574b90a5739f4
/app/src/main/java/he_arc/balljump/CreditActivity.java
ad7cf1cc332a29b20c431baeeef349cbe68ac36c
[]
no_license
PedroEmanuelCosta2/BallJump
0c6ef3f2a5d448fed349911cdd2523a435f8868c
2f0ee109ed04144b6dcac2b52bd590620a629dee
refs/heads/master
2021-05-07T17:08:56.841442
2018-01-29T21:24:15
2018-01-29T21:24:15
108,657,613
0
1
null
null
null
null
UTF-8
Java
false
false
375
java
package he_arc.balljump; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; /** * Created by pedrocosta on 29.01.18. */ public class CreditActivity extends AppCompatActivity { @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_credit); } }
[ "jules007.cesar@hotmail.com" ]
jules007.cesar@hotmail.com
62ec61f243f0b2355f632679fa0d58c0a34c06de
4351b8063fe6704331a83e0f3f4ba2f38c1f699e
/src/battleship/TwoDArrays.java
1c3289c1bb3c457fb757a5ade385744780693f95
[]
no_license
cwcopte/Battleship
2b03f0b76ad73ac3f687acded94aea18125d6ec4
5d42d569755e43c9754971118b87f4257a4caf27
refs/heads/master
2021-01-19T14:56:30.085423
2015-04-17T05:36:02
2015-04-17T05:36:02
33,968,243
0
0
null
null
null
null
UTF-8
Java
false
false
1,456
java
package battleship; public class TwoDArrays { public static void print2DArray(int[][] array) { for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[i].length; j++) { System.out.print(array[i][j] + " "); } System.out.println(); } } public static void main(String[] args) { int[][] matrix1 = new int[3][3]; int[][] matrix2 = new int[3][3]; int[][] sumMatrix = new int[3][3]; //randomly populate matrix1 and matrix2 //ideally we should have made a method out of this //but this will serve the purposes of a demo of 2D arrays. for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { matrix1[i][j] = (int)(Math.random() * 10); } } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { matrix2[i][j] = (int)(Math.random() * 10); } } for (int i = 0; i < matrix1.length; i++) { for (int j = 0; j < matrix1[i].length; j++) { sumMatrix[i][j] = matrix1[i][j] + matrix2[i][j]; } } System.out.println("Matrix1"); print2DArray(matrix1); System.out.println("Matrix2"); print2DArray(matrix2); System.out.println("Sum"); print2DArray(sumMatrix); } }
[ "cwcopte@gmail.com" ]
cwcopte@gmail.com
d1a0ca84632976e2384946d21ec1819e8295dd53
8897f436cf892bc161d894f6e8a25e401b0a4129
/src/main/java/com/euroticket/app/domain/Sale.java
057c9c2afaf41820e8193838fd92af785a354bd7
[]
no_license
vitornobrega/EuroTicketDemo
2691356fe0358ab71630b8245a242524f556b649
b38ff53af78a850d0d62765bf813d52ef6915c72
refs/heads/master
2021-01-01T05:26:00.113997
2016-05-26T10:10:48
2016-05-26T10:10:48
59,033,479
0
0
null
null
null
null
UTF-8
Java
false
false
2,660
java
package com.euroticket.app.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.springframework.data.elasticsearch.annotations.Document; import javax.persistence.*; import java.io.Serializable; import java.time.ZonedDateTime; import java.util.HashSet; import java.util.Set; import java.util.Objects; /** * A Sale. */ @Entity @Table(name = "sale") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @Document(indexName = "sale") public class Sale implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "sale_date") private ZonedDateTime saleDate; @OneToMany(mappedBy = "sale") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Item> items = new HashSet<>(); @OneToOne @JoinColumn(unique = true) private SaleStatus saleStatus; @OneToOne @JoinColumn(unique = true) private Payment payment; @ManyToOne private User user; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public ZonedDateTime getSaleDate() { return saleDate; } public void setSaleDate(ZonedDateTime saleDate) { this.saleDate = saleDate; } public Set<Item> getItems() { return items; } public void setItems(Set<Item> items) { this.items = items; } public SaleStatus getSaleStatus() { return saleStatus; } public void setSaleStatus(SaleStatus saleStatus) { this.saleStatus = saleStatus; } public Payment getPayment() { return payment; } public void setPayment(Payment payment) { this.payment = payment; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Sale sale = (Sale) o; if(sale.id == null || id == null) { return false; } return Objects.equals(id, sale.id); } @Override public int hashCode() { return Objects.hashCode(id); } @Override public String toString() { return "Sale{" + "id=" + id + ", saleDate='" + saleDate + "'" + '}'; } }
[ "vitor.nobrega87@gmail.com" ]
vitor.nobrega87@gmail.com
e3ff6476d07688ab47a09f1ed60d12f4ee191d98
b4b6b435418dd14fb66401dbd8bff44c6091bd54
/app/src/main/java/com/dupreeincabolnuevo/dupree/mh_required_api/GlobalClass.java
79235080fd0763fec53966c6d778a172b79cb32c
[ "Apache-2.0" ]
permissive
dupreemovil/AzzortiBolivia
8768c352ae7ab930c084f3581fc74d7b90efa75b
96aad061096ec7c84b2967744df2b09e310c5509
refs/heads/master
2022-12-03T08:47:44.398314
2020-08-02T13:04:48
2020-08-02T13:04:48
278,187,892
0
0
null
null
null
null
UTF-8
Java
false
false
450
java
package com.dupreeincabolnuevo.dupree.mh_required_api; import android.app.Application; public class GlobalClass extends Application { private String name; private String email; public String getName() { return name; } public void setName(String aName) { name = aName; } public String getEmail() { return email; } public void setEmail(String aEmail) { email = aEmail; } }
[ "agustin.acebo@azzorti.bo" ]
agustin.acebo@azzorti.bo
b57b9618c7b344ffc65f658845c447ba028a6549
d7df3b9232b21124d835317e26f3783ddd37f45e
/src/main/java/com/works/vetrestapi/entities/BoxCustomer.java
e23ad4114e0cfaf2ff5f564e2bf4a14770bd4fef
[ "MIT" ]
permissive
Sahsanem/Java-RestApi-Mysql-Vet-Clinic-Service
fab6a97550f7f3fb63603f31fe24e434de5fdb5e
e05e5e26838da8a88591deed1690cb1226c1291e
refs/heads/main
2023-08-07T19:28:37.166510
2021-10-07T18:03:17
2021-10-07T18:03:17
414,695,492
2
0
null
null
null
null
UTF-8
Java
false
false
534
java
package com.works.vetrestapi.entities; import io.swagger.annotations.ApiModel; import lombok.Data; import javax.persistence.*; @Entity @Data @ApiModel(value = "BoxCustomer",description = "Satış ödemesi ekleme için kullanılır") public class BoxCustomer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "bc_id", nullable = false) private Integer bc_id; private int productName; private int customerName; private int box_customer_amount; private String customer_note; }
[ "sahsanem.demirel@gmail.com" ]
sahsanem.demirel@gmail.com
4124e5d43b04d82e64ee29b626a23561f3b8ada2
0002a3358ca24278f3f7dd9ce768545362631046
/src/main/java/ru/smartcoder/members/service/MembersService.java
5fc641d0113c13b126710ed6c5e111a57b4924dd
[]
no_license
levrun/members-service
5bee42390587a972f3d86188388ec2fd9a1e434b
f4cb85fb6b5d2286b0f9fabc8cd4162b7e127d7a
refs/heads/master
2021-01-22T05:38:39.233762
2017-02-11T23:23:11
2017-02-11T23:23:11
81,689,477
0
0
null
null
null
null
UTF-8
Java
false
false
828
java
package ru.smartcoder.members.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import ru.smartcoder.members.model.Member; import ru.smartcoder.members.repository.MembersRepository; import java.util.List; @Service public class MembersService { @Autowired private MembersRepository membersRepository; public List<Member> findAll() { return membersRepository.findAll(); } public Member create(Member member) { return membersRepository.save(member); } public Member update(Member member) { return membersRepository.save(member); } public Member get(Long id) { return membersRepository.findOne(id); } public void delete(Long id) { membersRepository.delete(id); } }
[ "levrun1@gmail.com" ]
levrun1@gmail.com
4c7d6a7c162a081a14e30e5564d2c4a9fe6a20f4
de45ac9f8bedc7cd1647dae2aedf0c71778da77d
/src/test/java/com/babyfs/LogTest.java
b14329dbf0772696e8c80289a84380d0fa2acb91
[]
no_license
zhuanxuhit/spring-boot-wechat-sell
eaf4d717b235c33b49c9d42af927572a6d89c1d1
5398780fe96761bd14c783919c09ecf9bf61c49b
refs/heads/master
2021-04-06T10:35:38.053953
2018-03-25T13:08:15
2018-03-25T13:08:15
125,215,771
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package com.babyfs; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @SpringBootTest @Slf4j @RunWith(SpringRunner.class) public class LogTest { @Test public void test1() { String name = "zhuanxu"; String password = "123456"; log.debug("debug"); log.info("info"); log.info("name: {}, password: {}",name,password); log.error("error log"); // ch.qos.logback.classic. // org.slf4j.LoggerFactory } }
[ "wangchao25@baidu.com" ]
wangchao25@baidu.com
48aa955a4545dd4a0568fa3eecf766f236cf7b0f
d71e879b3517cf4fccde29f7bf82cff69856cfcd
/ExtractedJars/LibriVox_app.librivox.android/javafiles/com/google/android/gms/internal/icing/zzp.java
53ff668083422f56c2cc306304d51d0535b2f673
[ "MIT" ]
permissive
Andreas237/AndroidPolicyAutomation
b8e949e072d08cf6c6166c3f15c9c63379b8f6ce
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
refs/heads/master
2020-04-10T02:14:08.789751
2019-05-16T19:29:11
2019-05-16T19:29:11
160,739,088
5
1
null
null
null
null
UTF-8
Java
false
false
3,497
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package com.google.android.gms.internal.icing; import android.os.Parcel; import com.google.android.gms.common.api.Status; import com.google.android.gms.common.api.ah; import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; import com.google.android.gms.common.internal.safeparcel.c; import java.util.List; // Referenced classes of package com.google.android.gms.internal.icing: // fk public final class zzp extends AbstractSafeParcelable implements ah { public zzp() { // 0 0:aload_0 // 1 1:invokespecial #26 <Method void AbstractSafeParcelable()> // 2 4:return } zzp(Status status, List list, String as[]) { // 0 0:aload_0 // 1 1:invokespecial #26 <Method void AbstractSafeParcelable()> a = status; // 2 4:aload_0 // 3 5:aload_1 // 4 6:putfield #29 <Field Status a> b = list; // 5 9:aload_0 // 6 10:aload_2 // 7 11:putfield #31 <Field List b> c = as; // 8 14:aload_0 // 9 15:aload_3 // 10 16:putfield #33 <Field String[] c> // 11 19:return } public final Status b() { return a; // 0 0:aload_0 // 1 1:getfield #29 <Field Status a> // 2 4:areturn } public final void writeToParcel(Parcel parcel, int i) { int j = com.google.android.gms.common.internal.safeparcel.c.a(parcel); // 0 0:aload_1 // 1 1:invokestatic #41 <Method int c.a(Parcel)> // 2 4:istore_3 com.google.android.gms.common.internal.safeparcel.c.a(parcel, 1, ((android.os.Parcelable) (a)), i, false); // 3 5:aload_1 // 4 6:iconst_1 // 5 7:aload_0 // 6 8:getfield #29 <Field Status a> // 7 11:iload_2 // 8 12:iconst_0 // 9 13:invokestatic #44 <Method void c.a(Parcel, int, android.os.Parcelable, int, boolean)> com.google.android.gms.common.internal.safeparcel.c.c(parcel, 2, b, false); // 10 16:aload_1 // 11 17:iconst_2 // 12 18:aload_0 // 13 19:getfield #31 <Field List b> // 14 22:iconst_0 // 15 23:invokestatic #47 <Method void c.c(Parcel, int, List, boolean)> com.google.android.gms.common.internal.safeparcel.c.a(parcel, 3, c, false); // 16 26:aload_1 // 17 27:iconst_3 // 18 28:aload_0 // 19 29:getfield #33 <Field String[] c> // 20 32:iconst_0 // 21 33:invokestatic #50 <Method void c.a(Parcel, int, String[], boolean)> com.google.android.gms.common.internal.safeparcel.c.a(parcel, j); // 22 36:aload_1 // 23 37:iload_3 // 24 38:invokestatic #52 <Method void c.a(Parcel, int)> // 25 41:return } public static final android.os.Parcelable.Creator CREATOR = new fk(); private Status a; private List b; private String c[]; static { // 0 0:new #19 <Class fk> // 1 3:dup // 2 4:invokespecial #22 <Method void fk()> // 3 7:putstatic #24 <Field android.os.Parcelable$Creator CREATOR> //* 4 10:return } }
[ "silenta237@gmail.com" ]
silenta237@gmail.com
e8ba9e098a3e61e7c1739e00e1dbb0c2ac9fbb3f
f83cf27cdec751ace5e4f72d151da4373b33268a
/src/main/java/com/cognizant/rabbitmqamqptutorials/two/TwoSender.java
a1ce02572d74f4ce8d2d706057e0df3e78eb1993
[]
no_license
Kapuradhika/rabbitmq-amqp-tutorials
8ded12de26ba44df2166dbb6d2f208d70fd4dceb
03274cc66e52465f65a05ea64191cab63358e3f4
refs/heads/master
2020-04-11T04:24:10.236327
2018-12-12T21:46:31
2018-12-12T21:46:31
161,510,373
0
0
null
null
null
null
UTF-8
Java
false
false
1,083
java
package com.cognizant.rabbitmqamqptutorials.two; import org.springframework.amqp.core.Queue; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import java.util.concurrent.atomic.AtomicInteger; final class TwoSender { @Autowired private RabbitTemplate template; @Autowired private Queue queue; final AtomicInteger dots = new AtomicInteger(0); final AtomicInteger count = new AtomicInteger(0); @Scheduled(fixedDelay = 1000, initialDelay = 500) public void send() { StringBuilder builder = new StringBuilder("Hello"); if (dots.incrementAndGet() == 3) { dots.set(1); } for (int i = 0; i < dots.get(); i++) { builder.append('.'); } builder.append(count.incrementAndGet()); String message = builder.toString(); template.convertAndSend(queue.getName(), message); System.out.println(" [x] Sent '" + message + "'"); } }
[ "Paul.Dimalante@gmail.com" ]
Paul.Dimalante@gmail.com
2f9ebdae7cd24968d35e1155f54eaf6068a21e20
5e0a30c7bad1529b0c8f108718ee3c6f563cda78
/src/_336PalindromePairs/Solution2.java
69d4256334033601fa0136852f4fd7ac140d3825
[]
no_license
fangzhou37/Solution
ff0da7b6ce83cf0d378b700d47487da6db224d05
c457dac879604e505a9d801e872a52e4144869ee
refs/heads/master
2020-09-26T09:02:07.643108
2016-12-24T00:43:11
2016-12-24T00:43:11
65,959,808
0
0
null
null
null
null
UTF-8
Java
false
false
2,444
java
package _336PalindromePairs; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; public class Solution2 { public List<List<Integer>> palindromePairs(String[] words) { List<List<Integer>> res = new LinkedList<>(); Map<String, Integer> m = new HashMap<>(); for (int i = 0; i < words.length; i++) { m.put(words[i], i); } for (int i = 0; i < words.length; i++) { String word = words[i]; // 'ab', 'ba' // => first: "", second: "ab" => (0,1) // => first: "ab", second: "" => none (remove dup from third case) // => first: "", second: "ba" => (1,0) // => first: "ba", second: "" => none (remove dup from first case) // 'aba', '' // => first: "", second: "aba" => (0,1) // => first: "aba", second: "" => (1,0) for (int j = 0; j <= word.length(); j++) { // 关键,j是小于等于,用来handle空串的情况 String firstPart = word.substring(0, j); String secondPart = word.substring(j); String firstReverse = new StringBuffer(firstPart).reverse().toString(); String secondReverse = new StringBuffer(secondPart).reverse().toString(); if (firstPart.equals(firstReverse) && m.containsKey(secondReverse)) { int other = m.get(secondReverse); if (i != other) { List<Integer> sol = new LinkedList<>(); sol.add(other); sol.add(i); res.add(sol); } } if (secondPart.equals(secondReverse) && m.containsKey(firstReverse) && !secondPart.isEmpty()) { int other = m.get(firstReverse); if (i != other) { List<Integer> sol = new LinkedList<>(); sol.add(i); sol.add(other); res.add(sol); } } } } return res; } public static void main(String[] args) { System.out.println(new Solution2().palindromePairs(new String[] {"aba", ""})); System.out.println(new Solution2().palindromePairs(new String[] {"ab", "ba"})); } }
[ "fangzhou.ark37@gmail.com" ]
fangzhou.ark37@gmail.com
72c507cfed52f8c1cb6cb611079ed12f8e9d99a7
51c0425c0ed3589cd84fe04721e3338c82c611ea
/src/SudokuFrame.java
4a751fb90ae2b6899e9c7c60ea7c731029546e1e
[]
no_license
theandrebass/Sudoku
2f10aefb473e8e499cdcd284d039e907bc285416
2bd5bb2edbe2c9788200321263ffa3f4f8bdc374
refs/heads/master
2021-10-28T13:04:18.352767
2019-04-23T21:33:01
2019-04-23T21:33:01
121,600,290
1
0
null
null
null
null
UTF-8
Java
false
false
3,316
java
/* SudokuFrame.java by Andre Bass */ package sudoku; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.SwingUtilities; @SuppressWarnings("serial") public class SudokuFrame extends JFrame { private JPanel buttonSelectionPanel; private SudokuPanel sPanel; public SudokuFrame() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setTitle("Sudoku"); this.setMinimumSize(new Dimension(800,600)); JMenuBar menuBar = new JMenuBar(); JMenu file = new JMenu("Game"); JMenu newGame = new JMenu("New Game"); JMenuItem sixBySixGame = new JMenuItem("6 By 6 Game"); sixBySixGame.addActionListener(new NewGameListener(SudokuPuzzleType.SIXBYSIX,30)); JMenuItem nineByNineGame = new JMenuItem("9 By 9 Game"); nineByNineGame.addActionListener(new NewGameListener(SudokuPuzzleType.NINEBYNINE,26)); JMenuItem twelveByTwelveGame = new JMenuItem("12 By 12 Game"); twelveByTwelveGame.addActionListener(new NewGameListener(SudokuPuzzleType.TWELVEBYTWELVE,20)); /* * need to include this when solving algorithm is improved JMenuItem sixteenBySizteenGame = new JMenuItem("16 By 16 Game"); sixteenBySizteenGame.addActionListener(new NewGameListener(SudokuPuzzleType.SIXTEENBYSIXTEEN,16)); */ newGame.add(sixBySixGame); newGame.add(nineByNineGame); newGame.add(twelveByTwelveGame); //newGame.add(sixteenBySizteenGame); file.add(newGame); menuBar.add(file); this.setJMenuBar(menuBar); JPanel windowPanel = new JPanel(); windowPanel.setLayout(new FlowLayout()); windowPanel.setPreferredSize(new Dimension(800,600)); buttonSelectionPanel = new JPanel(); buttonSelectionPanel.setPreferredSize(new Dimension(90,500)); sPanel = new SudokuPanel(); windowPanel.add(sPanel); windowPanel.add(buttonSelectionPanel); this.add(windowPanel); rebuildInterface(SudokuPuzzleType.NINEBYNINE, 26); } public void rebuildInterface(SudokuPuzzleType puzzleType,int fontSize) { SudokuPuzzle generatedPuzzle = new SudokuGenerator().generateRandomSudoku(puzzleType); sPanel.newSudokuPuzzle(generatedPuzzle); sPanel.setFontSize(fontSize); buttonSelectionPanel.removeAll(); for(String value : generatedPuzzle.getValidValues()) { JButton b = new JButton(value); b.setPreferredSize(new Dimension(40,40)); b.addActionListener(sPanel.new NumActionListener()); buttonSelectionPanel.add(b); } sPanel.repaint(); buttonSelectionPanel.revalidate(); buttonSelectionPanel.repaint(); } private class NewGameListener implements ActionListener { private SudokuPuzzleType puzzleType; private int fontSize; public NewGameListener(SudokuPuzzleType puzzleType,int fontSize) { this.puzzleType = puzzleType; this.fontSize = fontSize; } @Override public void actionPerformed(ActionEvent e) { rebuildInterface(puzzleType,fontSize); } } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { SudokuFrame frame = new SudokuFrame(); frame.setVisible(true); } }); } }
[ "noreply@github.com" ]
noreply@github.com
60309c01cfd8ef2da0a08ccf9d85d99de8cf2398
3df7f85ead83a60e95c173668a0efc8085f0fc3e
/src/main/java/uk/co/caprica/vlcj/test/streaming/StreamRtpDuplicate.java
23d5fa371213202d8479ab15a2c89ea4146a0afc
[]
no_license
supermoonie/vlcj-examples
a70f6ff793f38848db902b8e961756e05e83f21c
49cb52b76869002fcc4816fb418a8ab80c5e68ac
refs/heads/master
2022-12-26T21:52:34.517003
2020-10-10T10:06:53
2020-10-10T10:06:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,197
java
/* * This file is part of VLCJ. * * VLCJ is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * VLCJ is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with VLCJ. If not, see <http://www.gnu.org/licenses/>. * * Copyright 2009-2020 Caprica Software Limited. */ package uk.co.caprica.vlcj.test.streaming; import uk.co.caprica.vlcj.factory.MediaPlayerFactory; import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer; import uk.co.caprica.vlcj.player.embedded.videosurface.VideoSurface; import uk.co.caprica.vlcj.test.VlcjTest; import javax.swing.*; import java.awt.*; /** * An example of how to stream a media file using RTP and use the "duplicate" output to also display * the video locally in an embedded media player. * <p> * Note that the duplicated output does not play it's own <em>stream</em>, so video displayed by * client applications will lag the local duplicated output. * <p> * The client specifies an MRL of <code>rtp://@230.0.0.1:5555</code> */ public class StreamRtpDuplicate extends VlcjTest { public static void main(String[] args) throws Exception { if(args.length != 1) { System.out.println("Specify a single MRL to stream"); System.exit(1); } String media = args[0]; String options = formatRtpStream("230.0.0.1", 5555); System.out.println("Streaming '" + media + "' to '" + options + "'"); MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(args); EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.mediaPlayers().newEmbeddedMediaPlayer(); Canvas canvas = new Canvas(); canvas.setBackground(Color.black); VideoSurface videoSurface = mediaPlayerFactory.videoSurfaces().newVideoSurface(canvas); mediaPlayer.videoSurface().set(videoSurface); JFrame f = new JFrame("vlcj duplicate output test"); f.setIconImage(new ImageIcon(StreamRtpDuplicate.class.getResource("/icons/vlcj-logo.png")).getImage()); f.add(canvas); f.setSize(800, 600); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); mediaPlayer.media().play(media, options, ":no-sout-rtp-sap", ":no-sout-standard-sap", ":sout-all", ":sout-keep" ); // Don't exit Thread.currentThread().join(); } private static String formatRtpStream(String serverAddress, int serverPort) { StringBuilder sb = new StringBuilder(60); sb.append(":sout=#duplicate{dst=display,dst=rtp{dst="); sb.append(serverAddress); sb.append(",port="); sb.append(serverPort); sb.append(",mux=ts}}"); return sb.toString(); } }
[ "mark.lee@capricasoftware.co.uk" ]
mark.lee@capricasoftware.co.uk
46ef023abe39d8c9468737203502a2032f8fc1dd
29b72f6cc5730f990262cb24a336adf8d13a5a31
/sdk/src/test/java/com/finbourne/lusid/model/OperandTypeTest.java
bd733d3aee87b6bc771d2cf962414022dfdafe65
[ "MIT" ]
permissive
bogdanLicaFinbourne/lusid-sdk-java-preview
0c956b453f5dd37888f11e0128d8a2e32abda236
3e6d1ed20bf398fafed58364360895a1f2f0476f
refs/heads/master
2023-04-06T06:21:49.057202
2021-04-19T18:50:06
2021-04-19T18:50:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
29,927
java
/* * LUSID API * # Introduction This page documents the [LUSID APIs](https://www.lusid.com/api/swagger), which allows authorised clients to query and update their data within the LUSID platform. SDKs to interact with the LUSID APIs are available in the following languages and frameworks: * [C#](https://github.com/finbourne/lusid-sdk-csharp) * [Java](https://github.com/finbourne/lusid-sdk-java) * [JavaScript](https://github.com/finbourne/lusid-sdk-js) * [Python](https://github.com/finbourne/lusid-sdk-python) * [Angular](https://github.com/finbourne/lusid-sdk-angular) # Data Model The LUSID API has a relatively lightweight but extremely powerful data model. One of the goals of LUSID was not to enforce on clients a single rigid data model but rather to provide a flexible foundation onto which clients can map their own data models. The core entities in LUSID provide a minimal structure and set of relationships, and the data model can be extended using Properties. The LUSID data model is exposed through the LUSID APIs. The APIs provide access to both business objects and the meta data used to configure the systems behaviours. The key business entities are: - * **Portfolios** A portfolio is a container for transactions and holdings (a **Transaction Portfolio**) or constituents (a **Reference Portfolio**). * **Derived Portfolios**. Derived Portfolios allow Portfolios to be created based on other Portfolios, by overriding or adding specific items. * **Holdings** A Holding is a quantity of an Instrument or a balance of cash within a Portfolio. Holdings can only be adjusted via Transactions. * **Transactions** A Transaction is an economic event that occurs in a Portfolio, causing its holdings to change. * **Corporate Actions** A corporate action is a market event which occurs to an Instrument and thus applies to all portfolios which holding the instrument. Examples are stock splits or mergers. * **Constituents** A constituent is a record in a Reference Portfolio containing an Instrument and an associated weight. * **Instruments** An instrument represents a currency, tradable instrument or OTC contract that is attached to a transaction and a holding. * **Properties** All major entities allow additional user defined properties to be associated with them. For example, a Portfolio manager may be associated with a portfolio. Meta data includes: - * **Transaction Types** Transactions are booked with a specific transaction type. The types are client defined and are used to map the Transaction to a series of movements which update the portfolio holdings. * **Properties Types** Types of user defined properties used within the system. ## Scope All data in LUSID is segregated at the client level. Entities in LUSID are identifiable by a unique code. Every entity lives within a logical data partition known as a Scope. Scope is an identity namespace allowing two entities with the same unique code to co-exist within individual address spaces. For example, prices for equities from different vendors may be uploaded into different scopes such as `client/vendor1` and `client/vendor2`. A portfolio may then be valued using either of the price sources by referencing the appropriate scope. LUSID Clients cannot access scopes of other clients. ## Instruments LUSID has its own built-in instrument master which you can use to master your own instrument universe. Every instrument must be created with one or more unique market identifiers, such as [FIGI](https://openfigi.com/). For any non-listed instruments (eg OTCs), you can upload an instrument against a custom ID of your choosing. In addition, LUSID will allocate each instrument a unique 'LUSID instrument identifier'. The LUSID instrument identifier is what is used when uploading transactions, holdings, prices, etc. The API exposes an `instrument/lookup` endpoint which can be used to lookup these LUSID identifiers using their market identifiers. Cash can be referenced using the ISO currency code prefixed with \"`CCY_`\" e.g. `CCY_GBP` ## Instrument Data Instrument data can be uploaded to the system using the [Instrument Properties](#operation/UpsertInstrumentsProperties) endpoint. | Field|Type|Description | | ---|---|--- | | Key|propertykey|The key of the property. This takes the format {domain}/{scope}/{code} e.g. 'Instrument/system/Name' or 'Transaction/strategy/quantsignal'. | | Value|string|The value of the property. | | EffectiveFrom|datetimeoffset|The effective datetime from which the property is valid. | | EffectiveUntil|datetimeoffset|The effective datetime until which the property is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveFrom' datetime of the property. | ## Transaction Portfolios Portfolios are the top-level entity containers within LUSID, containing transactions, corporate actions and holdings. The transactions build up the portfolio holdings on which valuations, analytics profit & loss and risk can be calculated. Properties can be associated with Portfolios to add in additional data. Portfolio properties can be changed over time, for example to allow a Portfolio Manager to be linked with a Portfolio. Additionally, portfolios can be securitised and held by other portfolios, allowing LUSID to perform \"drill-through\" into underlying fund holdings ### Derived Portfolios LUSID also allows for a portfolio to be composed of another portfolio via derived portfolios. A derived portfolio can contain its own transactions and also inherits any transactions from its parent portfolio. Any changes made to the parent portfolio are automatically reflected in derived portfolio. Derived portfolios in conjunction with scopes are a powerful construct. For example, to do pre-trade what-if analysis, a derived portfolio could be created a new namespace linked to the underlying live (parent) portfolio. Analysis can then be undertaken on the derived portfolio without affecting the live portfolio. ### Transactions A transaction represents an economic activity against a Portfolio. Transactions are processed according to a configuration. This will tell the LUSID engine how to interpret the transaction and correctly update the holdings. LUSID comes with a set of transaction types you can use out of the box, or you can configure your own set(s) of transactions. For more details see the [LUSID Getting Started Guide for transaction configuration.](https://support.lusid.com/configuring-transaction-types) | Field|Type|Description | | ---|---|--- | | TransactionId|string|The unique identifier for the transaction. | | Type|string|The type of the transaction e.g. 'Buy', 'Sell'. The transaction type should have been pre-configured via the System Configuration API endpoint. If it hasn't been pre-configured the transaction will still be updated or inserted however you will be unable to generate the resultant holdings for the portfolio that contains this transaction as LUSID does not know how to process it. | | InstrumentIdentifiers|map|A set of instrument identifiers to use to resolve the transaction to a unique instrument. | | TransactionDate|dateorcutlabel|The date of the transaction. | | SettlementDate|dateorcutlabel|The settlement date of the transaction. | | Units|decimal|The number of units transacted in the associated instrument. | | TransactionPrice|transactionprice|The price for each unit of the transacted instrument in the transaction currency. | | TotalConsideration|currencyandamount|The total value of the transaction in the settlement currency. | | ExchangeRate|decimal|The exchange rate between the transaction and settlement currency (settlement currency being represented by the TotalConsideration.Currency). For example if the transaction currency is in USD and the settlement currency is in GBP this this the USD/GBP rate. | | TransactionCurrency|currency|The transaction currency. | | Properties|map|Set of unique transaction properties and associated values to store with the transaction. Each property must be from the 'Transaction' domain. | | CounterpartyId|string|The identifier for the counterparty of the transaction. | | Source|string|The source of the transaction. This is used to look up the appropriate transaction group set in the transaction type configuration. | From these fields, the following values can be calculated * **Transaction value in Transaction currency**: TotalConsideration / ExchangeRate * **Transaction value in Portfolio currency**: Transaction value in Transaction currency * TradeToPortfolioRate #### Example Transactions ##### A Common Purchase Example Three example transactions are shown in the table below. They represent a purchase of USD denominated IBM shares within a Sterling denominated portfolio. * The first two transactions are for separate buy and fx trades * Buying 500 IBM shares for $71,480.00 * A spot foreign exchange conversion to fund the IBM purchase. (Buy $71,480.00 for &#163;54,846.60) * The third transaction is an alternate version of the above trades. Buying 500 IBM shares and settling directly in Sterling. | Column | Buy Trade | Fx Trade | Buy Trade with foreign Settlement | | ----- | ----- | ----- | ----- | | TransactionId | FBN00001 | FBN00002 | FBN00003 | | Type | Buy | FxBuy | Buy | | InstrumentIdentifiers | { \"figi\", \"BBG000BLNNH6\" } | { \"CCY\", \"CCY_USD\" } | { \"figi\", \"BBG000BLNNH6\" } | | TransactionDate | 2018-08-02 | 2018-08-02 | 2018-08-02 | | SettlementDate | 2018-08-06 | 2018-08-06 | 2018-08-06 | | Units | 500 | 71480 | 500 | | TransactionPrice | 142.96 | 1 | 142.96 | | TradeCurrency | USD | USD | USD | | ExchangeRate | 1 | 0.7673 | 0.7673 | | TotalConsideration.Amount | 71480.00 | 54846.60 | 54846.60 | | TotalConsideration.Currency | USD | GBP | GBP | | Trade/default/TradeToPortfolioRate&ast; | 0.7673 | 0.7673 | 0.7673 | [&ast; This is a property field] ##### A Forward FX Example LUSID has a flexible transaction modelling system, meaning there are a number of different ways of modelling forward fx trades. The default LUSID transaction types are FwdFxBuy and FwdFxSell. Using these transaction types, LUSID will generate two holdings for each Forward FX trade, one for each currency in the trade. An example Forward Fx trade to sell GBP for USD in a JPY-denominated portfolio is shown below: | Column | Forward 'Sell' Trade | Notes | | ----- | ----- | ---- | | TransactionId | FBN00004 | | | Type | FwdFxSell | | | InstrumentIdentifiers | { \"Instrument/default/Currency\", \"GBP\" } | | | TransactionDate | 2018-08-02 | | | SettlementDate | 2019-02-06 | Six month forward | | Units | 10000.00 | Units of GBP | | TransactionPrice | 1 | | | TradeCurrency | GBP | Currency being sold | | ExchangeRate | 1.3142 | Agreed rate between GBP and USD | | TotalConsideration.Amount | 13142.00 | Amount in the settlement currency, USD | | TotalConsideration.Currency | USD | Settlement currency | | Trade/default/TradeToPortfolioRate | 142.88 | Rate between trade currency, GBP and portfolio base currency, JPY | Please note that exactly the same economic behaviour could be modelled using the FwdFxBuy Transaction Type with the amounts and rates reversed. ### Holdings A holding represents a position in an instrument or cash on a given date. | Field|Type|Description | | ---|---|--- | | InstrumentUid|string|The unqiue Lusid Instrument Id (LUID) of the instrument that the holding is in. | | SubHoldingKeys|map|The sub-holding properties which identify the holding. Each property will be from the 'Transaction' domain. These are configured when a transaction portfolio is created. | | Properties|map|The properties which have been requested to be decorated onto the holding. These will be from the 'Instrument' or 'Holding' domain. | | HoldingType|string|The type of the holding e.g. Position, Balance, CashCommitment, Receivable, ForwardFX etc. | | Units|decimal|The total number of units of the holding. | | SettledUnits|decimal|The total number of settled units of the holding. | | Cost|currencyandamount|The total cost of the holding in the transaction currency. | | CostPortfolioCcy|currencyandamount|The total cost of the holding in the portfolio currency. | | Transaction|transaction|The transaction associated with an unsettled holding. | | Currency|currency|The holding currency. | ## Corporate Actions Corporate actions are represented within LUSID in terms of a set of instrument-specific 'transitions'. These transitions are used to specify the participants of the corporate action, and the effect that the corporate action will have on holdings in those participants. ### Corporate Action | Field|Type|Description | | ---|---|--- | | CorporateActionCode|code|The unique identifier of this corporate action | | Description|string| | | AnnouncementDate|datetimeoffset|The announcement date of the corporate action | | ExDate|datetimeoffset|The ex date of the corporate action | | RecordDate|datetimeoffset|The record date of the corporate action | | PaymentDate|datetimeoffset|The payment date of the corporate action | | Transitions|corporateactiontransition[]|The transitions that result from this corporate action | ### Transition | Field|Type|Description | | ---|---|--- | | InputTransition|corporateactiontransitioncomponent|Indicating the basis of the corporate action - which security and how many units | | OutputTransitions|corporateactiontransitioncomponent[]|What will be generated relative to the input transition | ### Example Corporate Action Transitions #### A Dividend Action Transition In this example, for each share of IBM, 0.20 units (or 20 pence) of GBP are generated. | Column | Input Transition | Output Transition | | ----- | ----- | ----- | | Instrument Identifiers | { \"figi\" : \"BBG000BLNNH6\" } | { \"ccy\" : \"CCY_GBP\" } | | Units Factor | 1 | 0.20 | | Cost Factor | 1 | 0 | #### A Split Action Transition In this example, for each share of IBM, we end up with 2 units (2 shares) of IBM, with total value unchanged. | Column | Input Transition | Output Transition | | ----- | ----- | ----- | | Instrument Identifiers | { \"figi\" : \"BBG000BLNNH6\" } | { \"figi\" : \"BBG000BLNNH6\" } | | Units Factor | 1 | 2 | | Cost Factor | 1 | 1 | #### A Spinoff Action Transition In this example, for each share of IBM, we end up with 1 unit (1 share) of IBM and 3 units (3 shares) of Celestica, with 85% of the value remaining on the IBM share, and 5% in each Celestica share (15% total). | Column | Input Transition | Output Transition 1 | Output Transition 2 | | ----- | ----- | ----- | ----- | | Instrument Identifiers | { \"figi\" : \"BBG000BLNNH6\" } | { \"figi\" : \"BBG000BLNNH6\" } | { \"figi\" : \"BBG000HBGRF3\" } | | Units Factor | 1 | 1 | 3 | | Cost Factor | 1 | 0.85 | 0.15 | ## Reference Portfolios Reference portfolios are portfolios that contain constituents with weights. They are designed to represent entities such as indices and benchmarks. ### Constituents | Field|Type|Description | | ---|---|--- | | InstrumentIdentifiers|map|Unique instrument identifiers | | InstrumentUid|string|LUSID's internal unique instrument identifier, resolved from the instrument identifiers | | Currency|decimal| | | Weight|decimal| | | FloatingWeight|decimal| | ## Portfolio Groups Portfolio groups allow the construction of a hierarchy from portfolios and groups. Portfolio operations on the group are executed on an aggregated set of portfolios in the hierarchy. For example: * Global Portfolios _(group)_ * APAC _(group)_ * Hong Kong _(portfolio)_ * Japan _(portfolio)_ * Europe _(group)_ * France _(portfolio)_ * Germany _(portfolio)_ * UK _(portfolio)_ In this example **Global Portfolios** is a group that consists of an aggregate of **Hong Kong**, **Japan**, **France**, **Germany** and **UK** portfolios. ## Properties Properties are key-value pairs that can be applied to any entity within a domain (where a domain is `trade`, `portfolio`, `security` etc). Properties must be defined before use with a `PropertyDefinition` and can then subsequently be added to entities. ## Schema A detailed description of the entities used by the API and parameters for endpoints which take a JSON document can be retrieved via the `schema` endpoint. ## Meta data The following headers are returned on all responses from LUSID | Name | Purpose | | --- | --- | | lusid-meta-duration | Duration of the request | | lusid-meta-success | Whether or not LUSID considered the request to be successful | | lusid-meta-requestId | The unique identifier for the request | | lusid-schema-url | Url of the schema for the data being returned | | lusid-property-schema-url | Url of the schema for any properties | # Error Codes | Code|Name|Description | | ---|---|--- | | <a name=\"-10\">-10</a>|Server Configuration Error| | | <a name=\"-1\">-1</a>|Unknown error|An unexpected error was encountered on our side. | | <a name=\"102\">102</a>|Version Not Found| | | <a name=\"103\">103</a>|Api Rate Limit Violation| | | <a name=\"104\">104</a>|Instrument Not Found| | | <a name=\"105\">105</a>|Property Not Found| | | <a name=\"106\">106</a>|Portfolio Recursion Depth| | | <a name=\"108\">108</a>|Group Not Found| | | <a name=\"109\">109</a>|Portfolio Not Found| | | <a name=\"110\">110</a>|Property Schema Not Found| | | <a name=\"111\">111</a>|Portfolio Ancestry Not Found| | | <a name=\"112\">112</a>|Portfolio With Id Already Exists| | | <a name=\"113\">113</a>|Orphaned Portfolio| | | <a name=\"119\">119</a>|Missing Base Claims| | | <a name=\"121\">121</a>|Property Not Defined| | | <a name=\"122\">122</a>|Cannot Delete System Property| | | <a name=\"123\">123</a>|Cannot Modify Immutable Property Field| | | <a name=\"124\">124</a>|Property Already Exists| | | <a name=\"125\">125</a>|Invalid Property Life Time| | | <a name=\"126\">126</a>|Property Constraint Style Excludes Properties| | | <a name=\"127\">127</a>|Cannot Modify Default Data Type| | | <a name=\"128\">128</a>|Group Already Exists| | | <a name=\"129\">129</a>|No Such Data Type| | | <a name=\"130\">130</a>|Undefined Value For Data Type| | | <a name=\"131\">131</a>|Unsupported Value Type Defined On Data Type| | | <a name=\"132\">132</a>|Validation Error| | | <a name=\"133\">133</a>|Loop Detected In Group Hierarchy| | | <a name=\"134\">134</a>|Undefined Acceptable Values| | | <a name=\"135\">135</a>|Sub Group Already Exists| | | <a name=\"138\">138</a>|Price Source Not Found| | | <a name=\"139\">139</a>|Analytic Store Not Found| | | <a name=\"141\">141</a>|Analytic Store Already Exists| | | <a name=\"143\">143</a>|Client Instrument Already Exists| | | <a name=\"144\">144</a>|Duplicate In Parameter Set| | | <a name=\"147\">147</a>|Results Not Found| | | <a name=\"148\">148</a>|Order Field Not In Result Set| | | <a name=\"149\">149</a>|Operation Failed| | | <a name=\"150\">150</a>|Elastic Search Error| | | <a name=\"151\">151</a>|Invalid Parameter Value| | | <a name=\"153\">153</a>|Command Processing Failure| | | <a name=\"154\">154</a>|Entity State Construction Failure| | | <a name=\"155\">155</a>|Entity Timeline Does Not Exist| | | <a name=\"156\">156</a>|Concurrency Conflict Failure| | | <a name=\"157\">157</a>|Invalid Request| | | <a name=\"158\">158</a>|Event Publish Unknown| | | <a name=\"159\">159</a>|Event Query Failure| | | <a name=\"160\">160</a>|Blob Did Not Exist| | | <a name=\"162\">162</a>|Sub System Request Failure| | | <a name=\"163\">163</a>|Sub System Configuration Failure| | | <a name=\"165\">165</a>|Failed To Delete| | | <a name=\"166\">166</a>|Upsert Client Instrument Failure| | | <a name=\"167\">167</a>|Illegal As At Interval| | | <a name=\"168\">168</a>|Illegal Bitemporal Query| | | <a name=\"169\">169</a>|Invalid Alternate Id| | | <a name=\"170\">170</a>|Cannot Add Source Portfolio Property Explicitly| | | <a name=\"171\">171</a>|Entity Already Exists In Group| | | <a name=\"173\">173</a>|Entity With Id Already Exists| | | <a name=\"174\">174</a>|Derived Portfolio Details Do Not Exist| | | <a name=\"176\">176</a>|Portfolio With Name Already Exists| | | <a name=\"177\">177</a>|Invalid Transactions| | | <a name=\"178\">178</a>|Reference Portfolio Not Found| | | <a name=\"179\">179</a>|Duplicate Id| | | <a name=\"180\">180</a>|Command Retrieval Failure| | | <a name=\"181\">181</a>|Data Filter Application Failure| | | <a name=\"182\">182</a>|Search Failed| | | <a name=\"183\">183</a>|Movements Engine Configuration Key Failure| | | <a name=\"184\">184</a>|Fx Rate Source Not Found| | | <a name=\"185\">185</a>|Accrual Source Not Found| | | <a name=\"186\">186</a>|Access Denied| | | <a name=\"187\">187</a>|Invalid Identity Token| | | <a name=\"188\">188</a>|Invalid Request Headers| | | <a name=\"189\">189</a>|Price Not Found| | | <a name=\"190\">190</a>|Invalid Sub Holding Keys Provided| | | <a name=\"191\">191</a>|Duplicate Sub Holding Keys Provided| | | <a name=\"192\">192</a>|Cut Definition Not Found| | | <a name=\"193\">193</a>|Cut Definition Invalid| | | <a name=\"194\">194</a>|Time Variant Property Deletion Date Unspecified| | | <a name=\"195\">195</a>|Perpetual Property Deletion Date Specified| | | <a name=\"196\">196</a>|Time Variant Property Upsert Date Unspecified| | | <a name=\"197\">197</a>|Perpetual Property Upsert Date Specified| | | <a name=\"200\">200</a>|Invalid Unit For Data Type| | | <a name=\"201\">201</a>|Invalid Type For Data Type| | | <a name=\"202\">202</a>|Invalid Value For Data Type| | | <a name=\"203\">203</a>|Unit Not Defined For Data Type| | | <a name=\"204\">204</a>|Units Not Supported On Data Type| | | <a name=\"205\">205</a>|Cannot Specify Units On Data Type| | | <a name=\"206\">206</a>|Unit Schema Inconsistent With Data Type| | | <a name=\"207\">207</a>|Unit Definition Not Specified| | | <a name=\"208\">208</a>|Duplicate Unit Definitions Specified| | | <a name=\"209\">209</a>|Invalid Units Definition| | | <a name=\"210\">210</a>|Invalid Instrument Identifier Unit| | | <a name=\"211\">211</a>|Holdings Adjustment Does Not Exist| | | <a name=\"212\">212</a>|Could Not Build Excel Url| | | <a name=\"213\">213</a>|Could Not Get Excel Version| | | <a name=\"214\">214</a>|Instrument By Code Not Found| | | <a name=\"215\">215</a>|Entity Schema Does Not Exist| | | <a name=\"216\">216</a>|Feature Not Supported On Portfolio Type| | | <a name=\"217\">217</a>|Quote Not Found| | | <a name=\"218\">218</a>|Invalid Quote Identifier| | | <a name=\"219\">219</a>|Invalid Metric For Data Type| | | <a name=\"220\">220</a>|Invalid Instrument Definition| | | <a name=\"221\">221</a>|Instrument Upsert Failure| | | <a name=\"222\">222</a>|Reference Portfolio Request Not Supported| | | <a name=\"223\">223</a>|Transaction Portfolio Request Not Supported| | | <a name=\"224\">224</a>|Invalid Property Value Assignment| | | <a name=\"230\">230</a>|Transaction Type Not Found| | | <a name=\"231\">231</a>|Transaction Type Duplication| | | <a name=\"232\">232</a>|Portfolio Does Not Exist At Given Date| | | <a name=\"233\">233</a>|Query Parser Failure| | | <a name=\"234\">234</a>|Duplicate Constituent| | | <a name=\"235\">235</a>|Unresolved Instrument Constituent| | | <a name=\"236\">236</a>|Unresolved Instrument In Transition| | | <a name=\"237\">237</a>|Missing Side Definitions| | | <a name=\"299\">299</a>|Invalid Recipe| | | <a name=\"300\">300</a>|Missing Recipe| | | <a name=\"301\">301</a>|Dependencies| | | <a name=\"304\">304</a>|Portfolio Preprocess Failure| | | <a name=\"310\">310</a>|Valuation Engine Failure| | | <a name=\"311\">311</a>|Task Factory Failure| | | <a name=\"312\">312</a>|Task Evaluation Failure| | | <a name=\"313\">313</a>|Task Generation Failure| | | <a name=\"314\">314</a>|Engine Configuration Failure| | | <a name=\"315\">315</a>|Model Specification Failure| | | <a name=\"320\">320</a>|Market Data Key Failure| | | <a name=\"321\">321</a>|Market Resolver Failure| | | <a name=\"322\">322</a>|Market Data Failure| | | <a name=\"330\">330</a>|Curve Failure| | | <a name=\"331\">331</a>|Volatility Surface Failure| | | <a name=\"332\">332</a>|Volatility Cube Failure| | | <a name=\"350\">350</a>|Instrument Failure| | | <a name=\"351\">351</a>|Cash Flows Failure| | | <a name=\"352\">352</a>|Reference Data Failure| | | <a name=\"360\">360</a>|Aggregation Failure| | | <a name=\"361\">361</a>|Aggregation Measure Failure| | | <a name=\"370\">370</a>|Result Retrieval Failure| | | <a name=\"371\">371</a>|Result Processing Failure| | | <a name=\"372\">372</a>|Vendor Result Processing Failure| | | <a name=\"373\">373</a>|Vendor Result Mapping Failure| | | <a name=\"374\">374</a>|Vendor Library Unauthorised| | | <a name=\"375\">375</a>|Vendor Connectivity Error| | | <a name=\"376\">376</a>|Vendor Interface Error| | | <a name=\"377\">377</a>|Vendor Pricing Failure| | | <a name=\"378\">378</a>|Vendor Translation Failure| | | <a name=\"379\">379</a>|Vendor Key Mapping Failure| | | <a name=\"380\">380</a>|Vendor Reflection Failure| | | <a name=\"390\">390</a>|Attempt To Upsert Duplicate Quotes| | | <a name=\"391\">391</a>|Corporate Action Source Does Not Exist| | | <a name=\"392\">392</a>|Corporate Action Source Already Exists| | | <a name=\"393\">393</a>|Instrument Identifier Already In Use| | | <a name=\"394\">394</a>|Properties Not Found| | | <a name=\"395\">395</a>|Batch Operation Aborted| | | <a name=\"400\">400</a>|Invalid Iso4217 Currency Code| | | <a name=\"401\">401</a>|Cannot Assign Instrument Identifier To Currency| | | <a name=\"402\">402</a>|Cannot Assign Currency Identifier To Non Currency| | | <a name=\"403\">403</a>|Currency Instrument Cannot Be Deleted| | | <a name=\"404\">404</a>|Currency Instrument Cannot Have Economic Definition| | | <a name=\"405\">405</a>|Currency Instrument Cannot Have Lookthrough Portfolio| | | <a name=\"406\">406</a>|Cannot Create Currency Instrument With Multiple Identifiers| | | <a name=\"407\">407</a>|Specified Currency Is Undefined| | | <a name=\"410\">410</a>|Index Does Not Exist| | | <a name=\"411\">411</a>|Sort Field Does Not Exist| | | <a name=\"413\">413</a>|Negative Pagination Parameters| | | <a name=\"414\">414</a>|Invalid Search Syntax| | | <a name=\"415\">415</a>|Filter Execution Timeout| | | <a name=\"420\">420</a>|Side Definition Inconsistent| | | <a name=\"450\">450</a>|Invalid Quote Access Metadata Rule| | | <a name=\"451\">451</a>|Access Metadata Not Found| | | <a name=\"452\">452</a>|Invalid Access Metadata Identifier| | | <a name=\"460\">460</a>|Standard Resource Not Found| | | <a name=\"461\">461</a>|Standard Resource Conflict| | | <a name=\"462\">462</a>|Calendar Not Found| | | <a name=\"463\">463</a>|Date In A Calendar Not Found| | | <a name=\"464\">464</a>|Invalid Date Source Data| | | <a name=\"465\">465</a>|Invalid Timezone| | | <a name=\"601\">601</a>|Person Identifier Already In Use| | | <a name=\"602\">602</a>|Person Not Found| | | <a name=\"603\">603</a>|Cannot Set Identifier| | | <a name=\"617\">617</a>|Invalid Recipe Specification In Request| | | <a name=\"618\">618</a>|Inline Recipe Deserialisation Failure| | | <a name=\"619\">619</a>|Identifier Types Not Set For Entity| | | <a name=\"620\">620</a>|Cannot Delete All Client Defined Identifiers| | | <a name=\"650\">650</a>|The Order requested was not found.| | | <a name=\"654\">654</a>|The Allocation requested was not found.| | | <a name=\"655\">655</a>|Cannot build the fx forward target with the given holdings.| | | <a name=\"656\">656</a>|Group does not contain expected entities.| | | <a name=\"667\">667</a>|Relation definition already exists| | | <a name=\"673\">673</a>|Missing entitlements for entities in Group| | | <a name=\"674\">674</a>|Next Best Action not found| | | <a name=\"676\">676</a>|Relation definition not defined| | | <a name=\"677\">677</a>|Invalid entity identifier for relation| | | <a name=\"681\">681</a>|Sorting by specified field not supported|One or more of the provided fields to order by were either invalid or not supported. | | <a name=\"682\">682</a>|Too many fields to sort by|The number of fields to sort the data by exceeds the number allowed by the endpoint | | <a name=\"684\">684</a>|Sequence Not Found| | | <a name=\"685\">685</a>|Sequence Already Exists| | | <a name=\"686\">686</a>|Non-cycling sequence has been exhausted| | | <a name=\"687\">687</a>|Legal Entity Identifier Already In Use| | | <a name=\"688\">688</a>|Legal Entity Not Found| | | <a name=\"689\">689</a>|The supplied pagination token is invalid| | | <a name=\"690\">690</a>|Property Type Is Not Supported| | | <a name=\"691\">691</a>|Multiple Tax-lots For Currency Type Is Not Supported| | | <a name=\"692\">692</a>|This endpoint does not support impersonation| | | <a name=\"693\">693</a>|Entity type is not supported for Relationship| | | <a name=\"694\">694</a>|Relationship Validation Failure| | | <a name=\"695\">695</a>|Relationship Not Found| | | <a name=\"697\">697</a>|Derived Property Formula No Longer Valid| | | <a name=\"698\">698</a>|Story is not available| | | <a name=\"703\">703</a>|Corporate Action Does Not Exist| | * * The version of the OpenAPI document: 0.11.2863 * Contact: info@finbourne.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package com.finbourne.lusid.model; import com.google.gson.annotations.SerializedName; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** * Model tests for OperandType */ public class OperandTypeTest { /** * Model tests for OperandType */ @Test public void testOperandType() { // TODO: test OperandType } }
[ "concourse@finbourne.com" ]
concourse@finbourne.com
5dd983020fb84224105f5c4d69987606c8c7b8fa
2c911d9673b62c5e31309cb55d6d6f915805a120
/jajuk/jajuk/src/main/java/org/jajuk/ui/wizard/CustomPropertyWizard.java
28d6bf2c14c4c6be7a4adeb151564cf38cf851a4
[]
no_license
idrabenia/player-remote-control-prototype
0844431b48f99db56b588740d27935cff2a8a1ce
efb516400ecd92367427378f29d6f451330e50d8
refs/heads/master
2020-05-17T01:27:29.729363
2013-02-01T22:14:35
2013-02-01T22:14:35
7,967,632
2
0
null
null
null
null
UTF-8
Java
false
false
4,523
java
/* * Jajuk * Copyright (C) The Jajuk Team * http://jajuk.info * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.jajuk.ui.wizard; import java.awt.event.ActionListener; import java.awt.event.ItemListener; import javax.swing.BoxLayout; import javax.swing.JComboBox; import javax.swing.JLabel; import org.jajuk.base.AlbumManager; import org.jajuk.base.ArtistManager; import org.jajuk.base.DeviceManager; import org.jajuk.base.DirectoryManager; import org.jajuk.base.FileManager; import org.jajuk.base.GenreManager; import org.jajuk.base.ItemManager; import org.jajuk.base.PlaylistManager; import org.jajuk.base.TrackManager; import org.jajuk.base.YearManager; import org.jajuk.ui.perspectives.FilesPerspective; import org.jajuk.ui.perspectives.PerspectiveManager; import org.jajuk.ui.widgets.JajukJDialog; import org.jajuk.ui.widgets.OKCancelPanel; import org.jajuk.ui.windows.JajukMainWindow; import org.jajuk.util.Messages; import org.jajuk.util.UtilGUI; /** * . */ public abstract class CustomPropertyWizard extends JajukJDialog implements ActionListener, ItemListener { /** Generated serialVersionUID. */ private static final long serialVersionUID = -5148687837661745898L; JLabel jlItemChoice; JComboBox jcbItemChoice; OKCancelPanel okp; JLabel jlName; /** * Constuctor. * * @param sTitle */ CustomPropertyWizard(String sTitle) { super(JajukMainWindow.getInstance(), true); setTitle(sTitle); setModal(true); setLocationRelativeTo(JajukMainWindow.getInstance()); } /** * Create common UI for property wizards. */ void populate() { getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); UtilGUI.setShuffleLocation(this, 400, 400); jlItemChoice = new JLabel(Messages.getString("CustomPropertyWizard.0")); jlName = new JLabel(Messages.getString("CustomPropertyWizard.1")); jcbItemChoice = new JComboBox(); // Note : we don't provide the possibility to add custom properties to AlbumArtists // (we don't see the need for it) jcbItemChoice.addItem(Messages.getString("Item_Track")); jcbItemChoice.addItem(Messages.getString("Item_File")); jcbItemChoice.addItem(Messages.getString("Item_Genre")); jcbItemChoice.addItem(Messages.getString("Item_Artist")); jcbItemChoice.addItem(Messages.getString("Item_Album")); jcbItemChoice.addItem(Messages.getString("Item_Device")); jcbItemChoice.addItem(Messages.getString("Item_Directory")); jcbItemChoice.addItem(Messages.getString("Item_Playlist_File")); jcbItemChoice.addItem(Messages.getString("Item_Year")); okp = new OKCancelPanel(this); okp.getOKButton().setEnabled(false); // In physical perspective, default item is file, otherwise, it is track if (PerspectiveManager.getCurrentPerspective().getClass().equals(FilesPerspective.class)) { jcbItemChoice.setSelectedIndex(1); } else { jcbItemChoice.setSelectedIndex(0); } jcbItemChoice.addItemListener(this); } /** * Gets the item manager. * * @return ItemManager associated with selected element in combo box */ ItemManager getItemManager() { ItemManager im = null; switch (jcbItemChoice.getSelectedIndex()) { case 0: im = TrackManager.getInstance(); break; case 1: im = FileManager.getInstance(); break; case 2: im = GenreManager.getInstance(); break; case 3: im = ArtistManager.getInstance(); break; case 4: im = AlbumManager.getInstance(); break; case 5: im = DeviceManager.getInstance(); break; case 6: im = DirectoryManager.getInstance(); break; case 7: im = PlaylistManager.getInstance(); break; case 8: im = YearManager.getInstance(); break; } return im; } }
[ "drobenyai@tut.by" ]
drobenyai@tut.by
bb62862defca598abc865348470015dfa984b025
267f031579e282aef5ef607f01cec8b1c9b7ae07
/NegativeImages.java
7d4fc5cffe97eaec1effc1bceb5af2bf8ee37d12
[]
no_license
YASAR-DESAI/coursera
3597d5587ac254a5fdac74eb0ea1a2d39907d1c3
242a5325f4eeda3b4e6c3b02572407474e244476
refs/heads/master
2022-12-01T23:25:57.085632
2020-08-12T05:23:26
2020-08-12T05:23:26
256,214,211
0
0
null
null
null
null
UTF-8
Java
false
false
1,213
java
/** * Write a description of GrayScaleConverter here. * * @author (your name) * @version (a version number or a date) */ import edu.duke.*; import java.io.*; public class NegativeImages { public ImageResource makeNegative(ImageResource inImage) { ImageResource outImage = new ImageResource(inImage.getWidth(),inImage.getHeight()); for (Pixel pixel : outImage.pixels() ) { Pixel inPixel = inImage.getPixel(pixel.getX(),pixel.getY()); pixel.setRed(255-inPixel.getRed()); pixel.setGreen(255-inPixel.getGreen()); pixel.setBlue(255-inPixel.getBlue()); } return outImage; } public void convertandsave() { DirectoryResource dr= new DirectoryResource(); for( File f : dr.selectedFiles()) { ImageResource image = new ImageResource(f); String name = image.getFileName(); ImageResource negative = makeNegative(image); String newname = "Negative-"+name; negative.setFileName(newname); negative.draw(); negative.save(); } } }
[ "noreply@github.com" ]
noreply@github.com
68510dfdb2428516bf7982351897bbf176040cde
d3c3f5c649f8b2ae05b96d563d6019d83dfe1e1a
/TEDRadioHour/app/src/main/java/com/example/mahi/homework07/MainActivity.java
6b8c7cc43886586246fdede012bbc94a79e546cd
[]
no_license
ojasvinibali/Android-Application
1200f57ea16882f1a13595a745131c0852a60418
7bde4ec6f0735b0fea9fcdd647c894703056b032
refs/heads/master
2021-01-13T06:48:43.043687
2017-03-30T21:14:34
2017-03-30T21:14:34
81,138,607
0
0
null
null
null
null
UTF-8
Java
false
false
5,952
java
package com.example.mahi.homework07; import android.app.ProgressDialog; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.Toast; import java.util.ArrayList; public class MainActivity extends AppCompatActivity implements GetPodcastsTask.IGetPodCasts{ public static final String APP_KEY="app"; public static final String TITLE_KEY="title"; public static final String MEDIA_KEY="media"; public static final String DURATION_KEY="duration"; public static final String DESCRIPTION_KEY="desc"; public static final String PUBLICATIONDATE_KEY="pub"; public static boolean change=false; public static String image=null; ProgressDialog progressDialog; public static ProgressBar audioProgress; public static ImageView imageView; static RecyclerView recyclerView; static RecyclerAdapter mAdapter; ArrayList<Podcast> podcasts = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); actionBar.setLogo(R.drawable.ted_logo); actionBar.setDisplayShowHomeEnabled(true); actionBar.setDisplayUseLogoEnabled(true); progressDialog = new ProgressDialog(this); progressDialog.setCancelable(false); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setMessage("Loading Episodes"); progressDialog.setMax(100); progressDialog.show(); imageView= (ImageView) findViewById(R.id.imageView2); imageView.setImageResource(R.drawable.pause); imageView.setVisibility(ImageView.GONE); audioProgress = new ProgressBar(MainActivity.this,null,android.R.attr.progressBarStyleHorizontal); audioProgress.setMax(100); audioProgress = (ProgressBar) findViewById(R.id.progressBar2); audioProgress.setVisibility(ProgressBar.GONE); recyclerView = (RecyclerView) findViewById(R.id.my_recycler_view); mAdapter = new RecyclerAdapter(this, podcasts,change); recyclerView.setHasFixedSize(false); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mAdapter); ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = cm.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected()) { new GetPodcastsTask(MainActivity.this).execute("https://www.npr.org/rss/podcast.php?id=510298"); } else { Toast.makeText(this, "Not connected to internet!", Toast.LENGTH_SHORT).show(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.activity_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); if(item.getItemId()==R.id.action_refresh) { imageView.setVisibility(ImageView.GONE); audioProgress.setVisibility(ProgressBar.GONE); RecyclerAdapter.mediaPlayer.stop(); audioProgress.setProgress(0); change = !change; if(!change){ RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mAdapter); }else{ RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this,2); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mAdapter); } } return true; } @Override public void getpodcasts(ArrayList<Podcast> podcastList) { if (podcastList != null){ podcasts=podcastList; recyclerView = (RecyclerView) findViewById(R.id.my_recycler_view); if(change){ mAdapter = new RecyclerAdapter(this,R.layout.grid_item_layout, podcasts,change); RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this,2); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); } else { mAdapter = new RecyclerAdapter(this, R.layout.row_item_layout, podcasts,change); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); } } progressDialog.dismiss(); } }
[ "o1@uncc.edu" ]
o1@uncc.edu
1a98490723a250c5aae88b6de8a27cdc98986c7e
e010f83b9d383a958fc73654162758bda61f8290
/src/main/java/com/alipay/api/domain/AlipayEbppProdmodeSignQueryModel.java
50e5197ce468bd54544f1e2b20693dcd33419b6d
[ "Apache-2.0" ]
permissive
10088/alipay-sdk-java
3a7984dc591eaf196576e55e3ed657a88af525a6
e82aeac7d0239330ee173c7e393596e51e41c1cd
refs/heads/master
2022-01-03T15:52:58.509790
2018-04-03T15:50:35
2018-04-03T15:50:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 查询签约信息接口 * * @author auto create * @since 1.0, 2017-06-22 16:16:45 */ public class AlipayEbppProdmodeSignQueryModel extends AlipayObject { private static final long serialVersionUID = 2437427378857661188L; /** * 出账/销账机构支付宝账号 */ @ApiField("logon_id") private String logonId; /** * 产品编号 */ @ApiField("prod_code") private String prodCode; public String getLogonId() { return this.logonId; } public void setLogonId(String logonId) { this.logonId = logonId; } public String getProdCode() { return this.prodCode; } public void setProdCode(String prodCode) { this.prodCode = prodCode; } }
[ "liuqun.lq@alibaba-inc.com" ]
liuqun.lq@alibaba-inc.com
9480dc8e802336924afaeb005c1111c1cb806462
adbde02d9621a882dedd68f8b7ac8b597acedd84
/SICE/src/Vista/Pagos.java
4a09ce665db0a7826bebf60c9560b3a5e35532f7
[]
no_license
DivadRod/SICE
87e37ede37f5a2275cd51f98c248ed91e596722a
cf36396f133466748f179ee261969f9d87c116f7
refs/heads/master
2020-03-31T23:40:57.019656
2019-03-25T22:39:28
2019-03-25T22:39:28
152,665,473
0
0
null
2018-10-11T22:57:33
2018-10-11T22:57:33
null
UTF-8
Java
false
false
29,429
java
package Vista; import static java.awt.Frame.MAXIMIZED_BOTH; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JFrame; /** @author Grupo #30 Ingeniería 2018-2019 * David Rodríguez Zamora * Katherine Jiménez Soto * Melany Monge Montero * Stefanny Villalobos Uva * Proyecto de Ingeniería - Universidad Nacional de Costa Rica * Sistema Interno de Control de Estudiantes, SICE * Profesor: Rafael Alvarado Arley * Dueño del producto: Yensy Soto, Centro Cultural Corporación Costa Rica */ public class Pagos extends javax.swing.JFrame { Ventana_Principal ventanaPrincipal; Agregar_Estudiante agregarEstudiante; public Pagos( ) { initComponents(); this.setExtendedState(MAXIMIZED_BOTH); setTitle("SICE - Pagos"); Image icon = new ImageIcon(getClass().getResource("/Imagenes/sice_1.jpeg")).getImage(); setIconImage(icon); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); btnBuscar = new javax.swing.JButton(); btnAgregar = new javax.swing.JButton(); jLabel9 = new javax.swing.JLabel(); btnVolver = new javax.swing.JButton(); listaGenero1 = new javax.swing.JComboBox<>(); jLabel11 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jLabel12 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); listaGenero2 = new javax.swing.JComboBox<>(); jLabel8 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel13 = new javax.swing.JLabel(); desplegableCursos1 = new javax.swing.JComboBox<>(); jPanel3 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jLabel5 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); jPanel5.setBackground(new java.awt.Color(0, 133, 202)); jPanel5.setBorder(null); jPanel6.setBackground(new java.awt.Color(232, 17, 41)); jPanel6.setBorder(null); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 12, Short.MAX_VALUE) ); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel4.setText("Centro Cultural Corporación Costa Rica"); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel4) .addContainerGap(16, Short.MAX_VALUE)) ); jPanel8.setBackground(new java.awt.Color(255, 255, 255)); jPanel8.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(204, 204, 204), new java.awt.Color(204, 204, 204))); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Pagos"); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel8Layout.setVerticalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/sice.jpeg"))); // NOI18N jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel2.setText("Cédula del estudiante:"); jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel6.setText("Mes"); jTextField1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N btnBuscar.setBackground(new java.awt.Color(0, 133, 202)); btnBuscar.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N btnBuscar.setForeground(new java.awt.Color(255, 255, 255)); btnBuscar.setText("Buscar"); btnBuscar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnBuscar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarActionPerformed(evt); } }); btnAgregar.setBackground(new java.awt.Color(0, 133, 202)); btnAgregar.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N btnAgregar.setForeground(new java.awt.Color(255, 255, 255)); btnAgregar.setText("Agregar"); btnAgregar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnAgregar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAgregarActionPerformed(evt); } }); jLabel9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel9.setText("Listado de mes cancelado por estudiante"); btnVolver.setBackground(new java.awt.Color(0, 133, 202)); btnVolver.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N btnVolver.setForeground(new java.awt.Color(255, 255, 255)); btnVolver.setText("Volver"); btnVolver.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnVolver.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnVolverActionPerformed(evt); } }); listaGenero1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N listaGenero1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " ", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Setiembre", "Octubre", "Noviembre", "Diciembre" })); listaGenero1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); listaGenero1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { listaGenero1ActionPerformed(evt); } }); jLabel11.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel11.setText("Nombre del estudiante:"); jTextField2.setEditable(false); jTextField2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jTextField2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); jTextField3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel12.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel12.setText("Número de recibo:"); jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel7.setText("Año:"); listaGenero2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N listaGenero2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " ", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023" })); listaGenero2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); listaGenero2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { listaGenero2ActionPerformed(evt); } }); jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel8.setText("Cancela:"); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null} }, new String [] { "Cédula", "Nombre", "Apellido", "Curso", "Mes", "Año" } )); jScrollPane2.setViewportView(jTable1); jLabel13.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel13.setText("Curso:"); desplegableCursos1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N desplegableCursos1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " ", "Inglés módulo 4", "Portugués módulo 1" })); jPanel3.setBackground(new java.awt.Color(0, 133, 202)); jPanel3.setBorder(null); jPanel4.setBackground(new java.awt.Color(232, 17, 41)); jPanel4.setBorder(null); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 1291, Short.MAX_VALUE) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 12, Short.MAX_VALUE) ); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel5.setText("Sistema Interno de Control de Estudiantes, SICE"); jLabel10.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel10.setForeground(new java.awt.Color(255, 255, 255)); jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel10.setText("Usuario:"); jLabel14.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel14.setForeground(new java.awt.Color(255, 255, 255)); jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel14.setText("Nombre"); jLabel15.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel15.setForeground(new java.awt.Color(255, 255, 255)); jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel15.setText("Fecha"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 518, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(21, 21, 21)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel10) .addComponent(jLabel14) .addComponent(jLabel15) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnVolver, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(listaGenero1, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(listaGenero2, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel13) .addComponent(desplegableCursos1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(83, 83, 83) .addComponent(jLabel6) .addGap(115, 115, 115) .addComponent(jLabel7)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(136, 136, 136) .addComponent(jLabel8))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 88, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel9) .addGap(612, 612, 612)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 870, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(22, 22, 22)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()))) .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(12, 12, 12) .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jLabel9)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(31, 31, 31) .addComponent(jLabel11) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(31, 31, 31) .addComponent(jLabel13) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(desplegableCursos1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE) .addComponent(jLabel12) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jLabel7)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(listaGenero1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(listaGenero2, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnVolver, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(38, 38, 38)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed }//GEN-LAST:event_btnBuscarActionPerformed private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnAgregarActionPerformed private void btnVolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVolverActionPerformed ventanaPrincipal = new Ventana_Principal(); ventanaPrincipal.setVisible(true); this.dispose(); }//GEN-LAST:event_btnVolverActionPerformed private void listaGenero1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listaGenero1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_listaGenero1ActionPerformed private void listaGenero2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listaGenero2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_listaGenero2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Pagos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Pagos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Pagos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Pagos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { //new Matricula_Estudiante().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnAgregar; private javax.swing.JButton btnBuscar; private javax.swing.JButton btnVolver; private javax.swing.JComboBox<String> desplegableCursos1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel8; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTable jTable1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JComboBox<String> listaGenero1; private javax.swing.JComboBox<String> listaGenero2; // End of variables declaration//GEN-END:variables }
[ "44058300+DivadRod@users.noreply.github.com" ]
44058300+DivadRod@users.noreply.github.com
f6eacad3b093638127cf2ce3317a2de47e63a5da
76b2aad428e1cfeb3d02acee8894c01253b41815
/app/src/main/java/com/example/findthetime/Activities/DatesList.java
5b93c35c2cf9ac295cf1c43f6fed6acea562cc96
[ "MIT" ]
permissive
liberaljunior/FindTheTime
e6a3b0938cb10ecb40149e6a09ba34b5683dc608
e2774cbc78a37c4372a39511556c5283adbf6f47
refs/heads/master
2023-03-24T14:43:40.061651
2020-12-08T15:40:52
2020-12-08T15:40:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,355
java
package com.example.findthetime.Activities; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.findthetime.Adapters.DatesListAdapter; import com.example.findthetime.R; import java.util.ArrayList; import java.util.Date; import java.util.List; import Models.Database.Activity; import Models.Database.User; public class DatesList extends AppCompatActivity { RecyclerView recyclerView; ImageView home; TextView title; Activity activity; List<Date> dates; ArrayList<User> users = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_items); recyclerView = findViewById(R.id.recyclerView); home = (ImageView) findViewById(R.id.home_activityList); home.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { Intent intent = new Intent(DatesList.this, Homepage.class); startActivity(intent); } }); title = findViewById(R.id.listTitle); String name = "Available dates"; title.setText(name); getData(); DatesListAdapter datesListAdapter = new DatesListAdapter(this, dates, users, activity); recyclerView.setAdapter(datesListAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); } public void getData() { Intent intent = getIntent(); if (getIntent().hasExtra("dates") && getIntent().hasExtra("users") && getIntent().hasExtra("activity")) { dates = (List<Date>) intent.getSerializableExtra("dates"); users = (ArrayList<User>) intent.getSerializableExtra("users"); activity = (Activity) intent.getSerializableExtra("activity"); System.out.println("Users: " + users); System.out.println("Dates: " + dates); } else { Toast.makeText(this, "no data", Toast.LENGTH_SHORT).show(); } } }
[ "tejas_444@hotmail.co.uk" ]
tejas_444@hotmail.co.uk
3c9bb45506e0408e3152c8904a9f1803fac4536c
8c3e06f53f2bb5b1e7a2e15435e509c01825fbeb
/app/src/main/java/com/example/fandomoviesproject/data/RepositoryContract.java
bd09cc0e9d2ea71dbc20f166b6d62bdadbabce27
[]
no_license
pablo998/FandomoviesProject
f96d2b6ff79ccd97d5fbf7a41d450f4741ba91ed
137370ced8a1a44f660d9a870e3236609f3b47df
refs/heads/master
2023-04-28T11:34:15.935003
2021-05-26T17:51:30
2021-05-26T17:51:30
355,356,572
0
0
null
null
null
null
UTF-8
Java
false
false
6,150
java
package com.example.fandomoviesproject.data; import java.util.List; public interface RepositoryContract { interface FetchCatalogDataSerieCallback { void onCatalogDataSerieFetched(boolean error); } void getAllSeriesList(final GetSeriesListCallback callback); interface GetSeriesListCallback { void setSeriesList(List<SerieItemCatalog> series); } interface GetSerieCallback { void setSerie(SerieItemCatalog serie); } interface GetCategorySerieListCallback { void setCategorySerieList(List<CategorySerieItemCatalog> categories); } interface GetCategorySerieCallback { void setCategorySerie(CategorySerieItemCatalog category); } interface DeleteCategorySerieCallback { void onCategorySerieDeleted(); } interface UpdateCategorySerieCallback { void onCategorySerieUpdated(); } interface DeleteSerieCallback { void onSerieDeleted(); } interface UpdateSerieCallback { void onSerieUpdated(); } void loadCatalogSerie( boolean clearFirst, Repository.FetchCatalogDataSerieCallback callback); void getSeriesList( CategorySerieItemCatalog category, Repository.GetSeriesListCallback callback); void getSeriesList( int categoryId, Repository.GetSeriesListCallback callback); void getSerie(int id, Repository.GetSerieCallback callback); void getCategorySerie(int id, Repository.GetCategorySerieCallback callback); void getCategorySerieList(Repository.GetCategorySerieListCallback callback); void deleteSerie( SerieItemCatalog product, Repository.DeleteSerieCallback callback); void updateSerie( SerieItemCatalog product, Repository.UpdateSerieCallback callback); void deleteCategorySerie( CategorySerieItemCatalog category, Repository.DeleteCategorySerieCallback callback); void updateCategorySerie( CategorySerieItemCatalog category, Repository.UpdateCategorySerieCallback callback); /* ---------------------------- DE AQUÍ HACIA ARRIBA SERIES, HACIA ABAJO PELIS ----------------------------------------- */ interface FetchCatalogDataPeliCallback { void onCatalogDataPeliFetched(boolean error); } interface GetPelisListCallback { void setPelisList(List<PeliculaItemCatalog> pelis); } interface GetPeliCallback { void setPeli(PeliculaItemCatalog peli); } interface GetCategoryPeliListCallback { void setCategoryPeliList(List<CategoryItemCatalog> categories); } interface GetCategoryPeliCallback { void setCategoryPeli(CategoryItemCatalog category); } interface DeleteCategoryPeliCallback { void onCategoryPeliDeleted(); } interface UpdateCategoryPeliCallback { void onCategoryPeliUpdated(); } interface DeletePeliCallback { void onPeliDeleted(); } interface UpdatePeliCallback { void onPeliUpdated(); } void loadCatalogPeli( boolean clearFirst, Repository.FetchCatalogDataPeliCallback callback); void getAllPelisList(Repository.GetPelisListCallback callback); void getPelisList( CategoryItemCatalog category, Repository.GetPelisListCallback callback); void getPelisList( int categoryId, Repository.GetPelisListCallback callback); void getPeli(int id, Repository.GetPeliCallback callback); void getCategoryPeli(int id, Repository.GetCategoryPeliCallback callback); void getCategoryPeliList(Repository.GetCategoryPeliListCallback callback); void deletePeli( PeliculaItemCatalog product, Repository.DeletePeliCallback callback); void updatePeli( PeliculaItemCatalog product, Repository.UpdatePeliCallback callback); void deleteCategoryPeli( CategoryItemCatalog category, Repository.DeleteCategoryPeliCallback callback); void updateCategoryPeli( CategoryItemCatalog category, Repository.UpdateCategoryPeliCallback callback); /* ---------------------------- DE AQUÍ HACIA ARRIBA PELIS, HACIA ABAJO DOCUS ----------------------------------------- */ interface FetchCatalogDataDocuCallback { void onCatalogDataDocuFetched(boolean error); } interface GetDocusListCallback { void setDocusList(List<DocuItemCatalog> docus); } interface GetDocuCallback { void setDocu(DocuItemCatalog docu); } interface GetCategoryDocuListCallback { void setCategoryDocuList(List<CategoryDocuItemCatalog> categories); } interface GetCategoryDocuCallback { void setCategoryDocu(CategoryDocuItemCatalog category); } interface DeleteCategoryDocuCallback { void onCategoryDocuDeleted(); } interface UpdateCategoryDocuCallback { void onCategoryDocuUpdated(); } interface DeleteDocuCallback { void onDocuDeleted(); } interface UpdateDocuCallback { void onDocuUpdated(); } void getAllDocusList(final GetDocusListCallback callback); void loadCatalogDocu( boolean clearFirst, Repository.FetchCatalogDataDocuCallback callback); void getDocusList( CategoryDocuItemCatalog category, Repository.GetDocusListCallback callback); void getDocusList( int categoryId, Repository.GetDocusListCallback callback); void getDocu(int id, Repository.GetDocuCallback callback); void getCategoryDocu(int id, Repository.GetCategoryDocuCallback callback); void getCategoryDocuList(Repository.GetCategoryDocuListCallback callback); void deleteDocu( DocuItemCatalog product, Repository.DeleteDocuCallback callback); void updateDocu( DocuItemCatalog product, Repository.UpdateDocuCallback callback); void deleteCategoryDocu( CategoryDocuItemCatalog category, Repository.DeleteCategoryDocuCallback callback); void updateCategoryDocu( CategoryDocuItemCatalog category, Repository.UpdateCategoryDocuCallback callback); }
[ "Pablodlnm@hotmail.com" ]
Pablodlnm@hotmail.com
ce620fc5e22eeab5d84516a16edaf61b63f451e7
69952eae8f1d3450b0ba3c7b0cf1bde956359749
/addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/appmanager/NavigationHelper.java
22e5e1d28d9f54b284bd08973b9248f49fc98368
[ "Apache-2.0" ]
permissive
xisyn/java_course_for_tester
46c5975155b178bb64ff10b2222add3c65f7ac3c
7bbd947628e05fc106dfbe1f0a8d9246c932d7d2
refs/heads/master
2018-11-08T00:30:04.788633
2018-10-30T04:26:14
2018-10-30T04:26:14
116,814,079
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package ru.stqa.pft.addressbook.appmanager; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class NavigationHelper extends HelperBase { public NavigationHelper(WebDriver wd) { super(wd); } public void groupPage() { if (isElementPresent(By.tagName("h1")) && wd.findElement(By.tagName("h1")).getText().equals("Groups") && isElementPresent(By.name("new"))) { return; } click(By.linkText("groups")); } public void HomePage() { if (isElementPresent(By.id("maintable"))) { return; } click(By.linkText("home")); } }
[ "dkhitsunov@issart.com" ]
dkhitsunov@issart.com
34dc3ab59f5cf38ceb18b9d606c7bdcb7cda6ed4
30e5bf1db26f0c5e6bddfe6e8d3e44ff8e038657
/src/com/sc/dao/iface/EventDao.java
622b2323da9085e512ef58fc5c42f4ec3c9ba81e
[]
no_license
anilasj/FatButler
a7e5f80ac23d106bd54117991092379c48f985b5
41ece84bc9236a56e0979c53b290bf2606a32e1f
refs/heads/master
2016-09-05T17:26:21.946751
2012-08-04T23:24:54
2012-08-04T23:24:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
800
java
package com.sc.dao.iface; import java.util.List; import com.ibatis.dao.client.DaoException; import com.sc.dao.ConnectException; import com.sc.domain.Comment; import com.sc.domain.Notification; public interface EventDao extends AbstractDao { public abstract void insertNotification(Notification notify) throws DaoException, ConnectException; public abstract void updateNotification(Notification notify) throws DaoException, ConnectException; public abstract void deleteNotification(Notification notify) throws DaoException, ConnectException; public abstract void addComment(Integer taskId, Integer uid, String comment) throws DaoException, ConnectException; public abstract List<Comment> getComments(Integer taskId, Integer maxCnt, Integer pageCnt) throws DaoException, ConnectException; }
[ "anilasj@hotmail.com" ]
anilasj@hotmail.com
6ea18c3b8559633324eb8fcb5ef79214e63eef48
b55d3b2332871cad182ed82e01786780886d1dd0
/src/easy/MinCostClimbingStairs.java
6ce64ad78f78971d28694218f396d8da03841f7a
[]
no_license
acrush37/leetcode-dp
58c64735777c523a9627ef2950c8b865f0e33337
2fc10059c0151e8ef8dc948e8509be4bc3ad0796
refs/heads/master
2022-04-10T18:00:02.187481
2020-03-02T06:35:35
2020-03-02T06:35:35
215,553,677
0
0
null
null
null
null
UTF-8
Java
false
false
1,023
java
package easy; /* On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start from the step with index 0, or the step with index 1. */ public class MinCostClimbingStairs { public static void main(String... args) { int[] cost1 = {10, 15, 20}; int[] cost2 = {1, 100, 1, 1, 1, 100, 1, 1, 100, 1}; MinCostClimbingStairs minCostClimbingStairs = new MinCostClimbingStairs(); System.out.println(minCostClimbingStairs.minCostClimbingStairs(cost1)); System.out.println(minCostClimbingStairs.minCostClimbingStairs(cost2)); } public int minCostClimbingStairs(int[] cost) { int n = cost.length; int[] f = new int[n+1]; f[1] = cost[0]; for (int i = 2; i <= n; i++) f[i] = Math.min(f[i-1], f[i-2]) + cost[i-1]; return Math.min(f[n], f[n-1]); } }
[ "acrush37@gmail.com" ]
acrush37@gmail.com
d65a5c5dc84b05c2c96336a4d54ac4f06fea5027
efa960e65243555d8840545a8099bbd297fb3fa9
/src/main/java/en/comparing/ComparingPrimitives.java
1059f797e8a2c9a394c4c258688edb0b0e754a48
[]
no_license
ortolanph/JavaBasicConcepts
3a104a668a996fb562619252865085e2fc019f89
e921406bca232266363530e9b55fe539349abf1a
refs/heads/master
2020-03-06T20:19:56.162355
2018-05-22T15:18:28
2018-05-22T15:18:28
127,050,533
4
0
null
null
null
null
UTF-8
Java
false
false
287
java
package en.comparing; public class ComparingPrimitives { public static void main(String[] args) { int x = 10; int y = 10; if(x == y) { System.out.println("Equals"); } else { System.out.println("Different"); } } }
[ "paulo.ortolan@serpro.gov.br" ]
paulo.ortolan@serpro.gov.br
3562bd887039650120e2d018d5d59fcd0d5231e9
e6a1130df50b23eb832e025f38d46d1e9c48ccec
/src/main/java/com/wangxuegang/controller/admin/ArticleController.java
316d3ca92f0098c00e3f87800d03f4fcfac153bf
[]
no_license
wangxuegang/geren
297374e70de604126d7c6a3e9b06aff248cfa3ee
599a1312c8d0df210b2106ede9792c9522eb72f7
refs/heads/master
2020-05-05T13:58:41.320628
2019-04-08T09:48:52
2019-04-08T09:50:21
180,102,116
0
0
null
null
null
null
UTF-8
Java
false
false
8,880
java
package com.wangxuegang.controller.admin; import com.wangxuegang.constant.LogActions; import com.wangxuegang.constant.Types; import com.wangxuegang.controller.BaseController; import com.wangxuegang.dto.cond.ContentCond; import com.wangxuegang.dto.cond.MetaCond; import com.wangxuegang.exception.BusinessException; import com.wangxuegang.model.ContentDomain; import com.wangxuegang.model.MetaDomain; import com.wangxuegang.service.content.ContentService; import com.wangxuegang.service.log.LogService; import com.wangxuegang.service.meta.MetaService; import com.wangxuegang.utils.APIResponse; import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.util.List; @Api("文章管理") @Controller @RequestMapping("/admin/article") @Transactional(rollbackFor = BusinessException.class) public class ArticleController extends BaseController { private static final Logger LOGGER = LoggerFactory.getLogger(ArticleController.class); @Autowired private ContentService contentService; @Autowired private MetaService metaService; @Autowired private LogService logService; @ApiOperation("文章页") @GetMapping(value = "") public String index( HttpServletRequest request, @ApiParam(name = "page", value = "页数", required = false) @RequestParam(name = "page", required = false, defaultValue = "1") int page, @ApiParam(name = "limit", value = "每页数量", required = false) @RequestParam(name = "limit", required = false, defaultValue = "15") int limit ){ PageInfo<ContentDomain> articles = contentService.getArticlesByCond(new ContentCond(), page, limit); request.setAttribute("articles", articles); return "admin/article_list"; } @ApiOperation("发布文章页") @GetMapping(value = "/publish") public String newArticle(HttpServletRequest request){ MetaCond metaCond = new MetaCond(); metaCond.setType(Types.CATEGORY.getType()); List<MetaDomain> metas = metaService.getMetas(metaCond); request.setAttribute("categories", metas); return "admin/article_edit"; } @ApiOperation("发布新文章") @PostMapping(value = "/publish") @ResponseBody public APIResponse publishArticle( HttpServletRequest request, @ApiParam(name = "title", value = "标题", required = true) @RequestParam(name = "title", required = true) String title, @ApiParam(name = "titlePic", value = "标题图片", required = false) @RequestParam(name = "titlePic", required = false) String titlePic, @ApiParam(name = "slug", value = "内容缩略名", required = false) @RequestParam(name = "slug", required = false) String slug, @ApiParam(name = "content", value = "内容", required = true) @RequestParam(name = "content", required = true) String content, @ApiParam(name = "type", value = "文章类型", required = true) @RequestParam(name = "type", required = true) String type, @ApiParam(name = "status", value = "文章状态", required = true) @RequestParam(name = "status", required = true) String status, @ApiParam(name = "tags", value = "标签", required = false) @RequestParam(name = "tags", required = false) String tags, @ApiParam(name = "categories", value = "分类", required = false) @RequestParam(name = "categories", required = false, defaultValue = "默认分类") String categories, @ApiParam(name = "allowComment", value = "是否允许评论", required = true) @RequestParam(name = "allowComment", required = true) Boolean allowComment ){ ContentDomain contentDomain = new ContentDomain(); contentDomain.setTitle(title); contentDomain.setTitlePic(titlePic); contentDomain.setSlug(slug); contentDomain.setContent(content); contentDomain.setType(type); contentDomain.setStatus(status); contentDomain.setTags(type.equals(Types.ARTICLE.getType()) ? tags : null); //只允许博客文章有分类,防止作品被收入分类 contentDomain.setCategories(type.equals(Types.ARTICLE.getType()) ? categories : null); contentDomain.setAllowComment(allowComment ? 1 : 0); contentService.addArticle(contentDomain); return APIResponse.success(); } @ApiOperation("文章编辑页") @GetMapping(value = "/{cid}") public String editArticle( @ApiParam(name = "cid", value = "文章编号", required = true) @PathVariable Integer cid, HttpServletRequest request ){ ContentDomain content = contentService.getAtricleById(cid); request.setAttribute("contents", content); MetaCond metaCond = new MetaCond(); metaCond.setType(Types.CATEGORY.getType()); List<MetaDomain> categories = metaService.getMetas(metaCond); request.setAttribute("categories", categories); request.setAttribute("active", "article"); return "admin/article_edit"; } @ApiOperation("编辑保存文章") @PostMapping("/modify") @ResponseBody public APIResponse modifyArticle( HttpServletRequest request, @ApiParam(name = "cid", value = "文章主键", required = true) @RequestParam(name = "cid", required = true) Integer cid, @ApiParam(name = "title", value = "标题", required = true) @RequestParam(name = "title", required = true) String title, @ApiParam(name = "titlePic", value = "标题图片", required = false) @RequestParam(name = "titlePic", required = false) String titlePic, @ApiParam(name = "slug", value = "内容缩略名", required = false) @RequestParam(name = "slug", required = false) String slug, @ApiParam(name = "content", value = "内容", required = true) @RequestParam(name = "content", required = true) String content, @ApiParam(name = "type", value = "文章类型", required = true) @RequestParam(name = "type", required = true) String type, @ApiParam(name = "status", value = "文章状态", required = true) @RequestParam(name = "status", required = true) String status, @ApiParam(name = "tags", value = "标签", required = false) @RequestParam(name = "tags", required = false) String tags, @ApiParam(name = "categories", value = "分类", required = false) @RequestParam(name = "categories", required = false, defaultValue = "默认分类") String categories, @ApiParam(name = "allowComment", value = "是否允许评论", required = true) @RequestParam(name = "allowComment", required = true) Boolean allowComment ){ ContentDomain contentDomain = new ContentDomain(); contentDomain.setCid(cid); contentDomain.setTitle(title); contentDomain.setTitlePic(titlePic); contentDomain.setSlug(slug); contentDomain.setContent(content); contentDomain.setType(type); contentDomain.setStatus(status); contentDomain.setTags(tags); contentDomain.setCategories(categories); contentDomain.setAllowComment(allowComment ? 1 : 0); contentService.updateArticleById(contentDomain); return APIResponse.success(); } @ApiOperation("删除文章") @PostMapping(value = "/delete") @ResponseBody public APIResponse deleteArticle( @ApiParam(name = "cid", value = "文章主键", required = true) @RequestParam(name = "cid", required = true) Integer cid, HttpServletRequest request ){ contentService.deleteArticleById(cid); logService.addLog(LogActions.DEL_ARTICLE.getAction(), cid + "", request.getRemoteAddr(), this.getUid(request)); return APIResponse.success(); } }
[ "15510235102@163.com" ]
15510235102@163.com
68b062f2ce9ac5274c591a0ece46e42fefca7a0f
80bac4ff8e07c9e984001216d174d499a9a899c7
/BigDataPlatform2.0-server-master-84917178b43ad6068b2f5afd66b1bf102ce804dd/bd-modules/academic-service/src/main/java/com/ziyun/academic/enums/SexEnum.java
4fbda85b14122bd0c0f021a5e79f45fb8ee46538
[]
no_license
xianxingluo/git_out
ec3e85e4fa38e077106de5f655b8a27da75a1445
62623630d2fc2ed288acfddc14d32af03b39d348
refs/heads/master
2020-04-15T10:01:34.168755
2019-01-08T08:04:35
2019-01-08T08:04:35
164,576,945
0
0
null
null
null
null
UTF-8
Java
false
false
696
java
package com.ziyun.academic.enums; /** * Created by linxiaojun on 11/10/17 6:50 PM. */ public enum SexEnum { MALE("0", "男"), FEMALE("1", "女"); private String code; private String value; SexEnum(String code, String value) { this.code = code; this.value = value; } public String getCode() { return code; } public String getValue() { return value; } public static String getValue(String code) { String result = ""; for (SexEnum sex : SexEnum.values()) { if (sex.getCode().equals(code)) { result = sex.getValue(); } } return result; } }
[ "luoxx@huawangtech.com" ]
luoxx@huawangtech.com
b11ceb420bd513d706bb250ab6da9e0850ecf34c
34c8bb360950f217f0e47bd0bb8accd8d970b388
/src/main/java/com/wenthomas/mapreduce/partition/MyReducer.java
4d1294c7a5e88ca481221ca34d0300d1e99ce114
[]
no_license
wenthomas/my-hadoop-study
f6a0b1730d2a82863edd370c1e3dfafd7b59d231
f245894a2f9ebce8378451f565bb6fdb4f8ff7ca
refs/heads/master
2022-05-08T02:20:15.671428
2020-01-06T13:00:04
2020-01-06T13:00:04
230,082,059
0
0
null
2022-04-12T21:57:27
2019-12-25T09:58:08
Java
UTF-8
Java
false
false
997
java
package com.wenthomas.mapreduce.partition; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; import java.io.IOException; /** * @author Verno * @create 2019-12-28 17:32 */ public class MyReducer extends Reducer<Text, FlowBean, Text, FlowBean> { private FlowBean v = new FlowBean(); @Override protected void reduce(Text key, Iterable<FlowBean> values, Context context) throws IOException, InterruptedException { /* Iterator var4 = values.iterator(); while(var4.hasNext()) { VALUEIN value = var4.next(); context.write(key, value); }*/ long sumUpFlow = 0; long sumDownFlow = 0; for (FlowBean value : values) { sumUpFlow += value.getUpFlow(); sumDownFlow += value.getDownFlow(); } v.setUpFlow(sumUpFlow); v.setDownFlow(sumDownFlow); v.setSumFlow(sumUpFlow + sumDownFlow); context.write(key, v); } }
[ "wenthomas@163.com" ]
wenthomas@163.com
30e3ab200425e1b45432a70114a64e89c74cd404
ba0b7255586c6cfe0f5bdefc5a29589c5c28fe51
/gestion-donnees-complexes/Projet/src/hbase/database/Execute.java
d489e4275435d6cc4679cbcd857e338cacd9a488
[]
no_license
zayres/Master2-AIGLE
5a2196d0450c33819c09ba8ca3e1d73a24eb95cf
b9ec915efcf204fa8fadfebd8fe5de1c0c5736bf
refs/heads/master
2021-01-22T06:53:49.571849
2014-03-11T08:47:29
2014-03-11T08:47:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,554
java
package hbase.database; import java.util.ArrayList; import hbase.csv.ReadCSV_Communes; import hbase.csv.ReadCSV_Impots; public class Execute { /** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { // TODO Auto-generated method stub final String nameImpots = "Impots"; ArrayList<String[]> read = ReadCSV_Impots.run(); String[] colums = {"infosgenerales"}; /* CreateTable.creatTable(nameImpots,colums ); for(String[] tab : read){ CreateTable.addRecord(nameImpots, tab[1], "infosgenerales", "nbreRedevable", tab[2]); CreateTable.addRecord(nameImpots, tab[1], "infosgenerales", "PatrimoineM", tab[3]); CreateTable.addRecord(nameImpots, tab[1], "infosgenerales", "ImpotMoyen", tab[4]); CreateTable.addRecord(nameImpots, tab[1], "infosgenerales", "annee", tab[5]); } */ // CreateTable.getAllRecord(nameImpots); /* CreateTable.getOneRecord(nameImpots, "34172"); final String nameCommunes = "Communes"; ArrayList<String[]> readCommunes = ReadCSV_Communes.run(); String[] columCommune = {"infosCommunes"}; CreateTable.creatTable(nameCommunes,columCommune ); int ii = 0; for(String[] tabComm : readCommunes){ String insee = tabComm[3]+tabComm[4]; CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "CDC", tabComm[0]); CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "CHEFLIEU", tabComm[1]); CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "REG", tabComm[2]); CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "DEP", tabComm[3]); CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "COM", tabComm[4]); CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "AR", tabComm[5]); CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "CT", tabComm[6]); //CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "TNCC", tabComm[7]); //CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "ARTMAJ", tabComm[8]); CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "NCC", tabComm[9]); //CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "ARTMIN", tabComm[10]); //CreateTable.addRecord(nameCommunes, insee, "infosCommunes", "NCCENR", tabComm[11]); } System.out.println("end");*/ // CreateTable.getAllRecord(nameImpots); CreateTable.getOneRecord("Communes", "34172"); //CreateTable.getAllRecord("Communes"); // for(String s : CreateTable.getRecordsByDepartement("Communes","34")){ // System.out.println(s); // } } }
[ "gilles.entringer@gmail.com" ]
gilles.entringer@gmail.com
cafa5f37cc7b6b6df25d461a5fb72b87eb14f26b
8df656e8539253a19a80dc4b81103ff0f70b2651
/testManage/src/main/java/cn/pioneeruniverse/dev/vo/TestWorkInputVo.java
68ca48ee1579b15603559c3d8697d42c9e7874e2
[]
no_license
tanghaijian/itmp
8713960093a66a39723a975b65a20824a2011d83
758bed477ec9550a1fd1cb19435c3b543524a792
refs/heads/master
2023-04-16T00:55:56.140767
2021-04-26T05:42:47
2021-04-26T05:42:47
361,607,388
1
2
null
null
null
null
UTF-8
Java
false
false
3,648
java
package cn.pioneeruniverse.dev.vo; import java.util.List; import org.springframework.data.annotation.Transient; import cn.pioneeruniverse.common.entity.BaseEntity; public class TestWorkInputVo extends BaseEntity{ /** * 任务编号 **/ private String testTaskCodeSql; //任务编号 /** * 任务名称 **/ private String testTaskNameSql; //任务名称 /** * 状态 **/ private String workTaskStatus;//状态 /** * 系统id **/ private List<Long> systemIdList; //系统id /** * 需求id **/ private List<Long> reqIdList; //需求id /** * 测试任务编号 **/ private List<Long> featureCodeSql; //测试任务编号 /** * 测试人id **/ private String testUserIdName; //测试人id /** * 测试阶段 **/ private String testStageName;//测试阶段 /** * 投产窗口id **/ private List<Long> windowIdList; //投产窗口id /** * 任务分配人员 **/ private String taskAssignUserId;//任务分配人员 /** * 排序字段 **/ @Transient private String sidx; //排序字段 /** * 排序顺序 **/ @Transient private String sord; //排序顺序 /** * 当前用户id **/ private Long currentUserId; //当前用户id /** * 缺陷数 **/ private String defectNum;//缺陷数 /** * 任务id集合 **/ private List<Long> idList;//任务id集合 public String getTestTaskCodeSql() { return testTaskCodeSql; } public void setTestTaskCodeSql(String testTaskCodeSql) { this.testTaskCodeSql = testTaskCodeSql; } public String getTestTaskNameSql() { return testTaskNameSql; } public void setTestTaskNameSql(String testTaskNameSql) { this.testTaskNameSql = testTaskNameSql; } public String getWorkTaskStatus() { return workTaskStatus; } public void setWorkTaskStatus(String workTaskStatus) { this.workTaskStatus = workTaskStatus; } public List<Long> getSystemIdList() { return systemIdList; } public void setSystemIdList(List<Long> systemIdList) { this.systemIdList = systemIdList; } public List<Long> getReqIdList() { return reqIdList; } public void setReqIdList(List<Long> reqIdList) { this.reqIdList = reqIdList; } public List<Long> getFeatureCodeSql() { return featureCodeSql; } public void setFeatureCodeSql(List<Long> featureCodeSql) { this.featureCodeSql = featureCodeSql; } public String getTestUserIdName() { return testUserIdName; } public void setTestUserIdName(String testUserIdName) { this.testUserIdName = testUserIdName; } public String getTestStageName() { return testStageName; } public void setTestStageName(String testStageName) { this.testStageName = testStageName; } public List<Long> getWindowIdList() { return windowIdList; } public void setWindowIdList(List<Long> windowIdList) { this.windowIdList = windowIdList; } public String getTaskAssignUserId() { return taskAssignUserId; } public void setTaskAssignUserId(String taskAssignUserId) { this.taskAssignUserId = taskAssignUserId; } public String getSidx() { return sidx; } public void setSidx(String sidx) { this.sidx = sidx; } public String getSord() { return sord; } public void setSord(String sord) { this.sord = sord; } public Long getCurrentUserId() { return currentUserId; } public void setCurrentUserId(Long currentUserId) { this.currentUserId = currentUserId; } public String getDefectNum() { return defectNum; } public void setDefectNum(String defectNum) { this.defectNum = defectNum; } public List<Long> getIdList() { return idList; } public void setIdList(List<Long> idList) { this.idList = idList; } }
[ "1049604112@qq.com" ]
1049604112@qq.com
86bcd75fea9b133cedcc617112ba70e60be72d91
5598faaaaa6b3d1d8502cbdaca903f9037d99600
/code_changes/Apache_projects/HDFS-162/a1fc055489766876e8d3ee2bd75a5fef25f05b33/LayoutVersion.java
624a13e0a6f997a9a0516509b1a7f81ef334d7be
[]
no_license
SPEAR-SE/LogInBugReportsEmpirical_Data
94d1178346b4624ebe90cf515702fac86f8e2672
ab9603c66899b48b0b86bdf63ae7f7a604212b29
refs/heads/master
2022-12-18T02:07:18.084659
2020-09-09T16:49:34
2020-09-09T16:49:34
286,338,252
0
2
null
null
null
null
UTF-8
Java
false
false
8,337
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hdfs.protocol; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; import org.apache.hadoop.classification.InterfaceAudience; /** * This class tracks changes in the layout version of HDFS. * * Layout version is changed for following reasons: * <ol> * <li>The layout of how namenode or datanode stores information * on disk changes.</li> * <li>A new operation code is added to the editlog.</li> * <li>Modification such as format of a record, content of a record * in editlog or fsimage.</li> * </ol> * <br> * <b>How to update layout version:<br></b> * When a change requires new layout version, please add an entry into * {@link Feature} with a short enum name, new layout version and description * of the change. Please see {@link Feature} for further details. * <br> */ @InterfaceAudience.Private public class LayoutVersion { /** * Version in which HDFS-2991 was fixed. This bug caused OP_ADD to * sometimes be skipped for append() calls. If we see such a case when * loading the edits, but the version is known to have that bug, we * workaround the issue. Otherwise we should consider it a corruption * and bail. */ public static final int BUGFIX_HDFS_2991_VERSION = -40; /** * Enums for features that change the layout version. * <br><br> * To add a new layout version: * <ul> * <li>Define a new enum constant with a short enum name, the new layout version * and description of the added feature.</li> * <li>When adding a layout version with an ancestor that is not same as * its immediate predecessor, use the constructor where a spacific ancestor * can be passed. * </li> * </ul> */ public static enum Feature { NAMESPACE_QUOTA(-16, "Support for namespace quotas"), FILE_ACCESS_TIME(-17, "Support for access time on files"), DISKSPACE_QUOTA(-18, "Support for disk space quotas"), STICKY_BIT(-19, "Support for sticky bits"), APPEND_RBW_DIR(-20, "Datanode has \"rbw\" subdirectory for append"), ATOMIC_RENAME(-21, "Support for atomic rename"), CONCAT(-22, "Support for concat operation"), SYMLINKS(-23, "Support for symbolic links"), DELEGATION_TOKEN(-24, "Support for delegation tokens for security"), FSIMAGE_COMPRESSION(-25, "Support for fsimage compression"), FSIMAGE_CHECKSUM(-26, "Support checksum for fsimage"), REMOVE_REL13_DISK_LAYOUT_SUPPORT(-27, "Remove support for 0.13 disk layout"), EDITS_CHESKUM(-28, "Support checksum for editlog"), UNUSED(-29, "Skipped version"), FSIMAGE_NAME_OPTIMIZATION(-30, "Store only last part of path in fsimage"), RESERVED_REL20_203(-31, -19, "Reserved for release 0.20.203"), RESERVED_REL20_204(-32, "Reserved for release 0.20.204"), RESERVED_REL22(-33, -27, "Reserved for release 0.22"), RESERVED_REL23(-34, -30, "Reserved for release 0.23"), FEDERATION(-35, "Support for namenode federation"), LEASE_REASSIGNMENT(-36, "Support for persisting lease holder reassignment"), STORED_TXIDS(-37, "Transaction IDs are stored in edits log and image files"), TXID_BASED_LAYOUT(-38, "File names in NN Storage are based on transaction IDs"), EDITLOG_OP_OPTIMIZATION(-39, "Use LongWritable and ShortWritable directly instead of ArrayWritable of UTF8"), OPTIMIZE_PERSIST_BLOCKS(-40, "Serialize block lists with delta-encoded variable length ints, " + "add OP_UPDATE_BLOCKS"); final int lv; final int ancestorLV; final String description; /** * Feature that is added at {@code currentLV}. * @param lv new layout version with the addition of this feature * @param description description of the feature */ Feature(final int lv, final String description) { this(lv, lv + 1, description); } /** * Feature that is added at {@code currentLV}. * @param lv new layout version with the addition of this feature * @param ancestorLV layout version from which the new lv is derived * from. * @param description description of the feature */ Feature(final int lv, final int ancestorLV, final String description) { this.lv = lv; this.ancestorLV = ancestorLV; this.description = description; } /** * Accessor method for feature layout version * @return int lv value */ public int getLayoutVersion() { return lv; } /** * Accessor method for feature ancestor layout version * @return int ancestor LV value */ public int getAncestorLayoutVersion() { return ancestorLV; } /** * Accessor method for feature description * @return String feature description */ public String getDescription() { return description; } } // Build layout version and corresponding feature matrix static final Map<Integer, EnumSet<Feature>>map = new HashMap<Integer, EnumSet<Feature>>(); // Static initialization static { initMap(); } /** * Initialize the map of a layout version and EnumSet of {@link Feature}s * supported. */ private static void initMap() { // Go through all the enum constants and build a map of // LayoutVersion <-> EnumSet of all supported features in that LayoutVersion for (Feature f : Feature.values()) { EnumSet<Feature> ancestorSet = map.get(f.ancestorLV); if (ancestorSet == null) { ancestorSet = EnumSet.noneOf(Feature.class); // Empty enum set map.put(f.ancestorLV, ancestorSet); } EnumSet<Feature> featureSet = EnumSet.copyOf(ancestorSet); featureSet.add(f); map.put(f.lv, featureSet); } // Special initialization for 0.20.203 and 0.20.204 // to add Feature#DELEGATION_TOKEN specialInit(Feature.RESERVED_REL20_203.lv, Feature.DELEGATION_TOKEN); specialInit(Feature.RESERVED_REL20_204.lv, Feature.DELEGATION_TOKEN); } private static void specialInit(int lv, Feature f) { EnumSet<Feature> set = map.get(lv); set.add(f); } /** * Gets formatted string that describes {@link LayoutVersion} information. */ public static String getString() { final StringBuilder buf = new StringBuilder(); buf.append("Feature List:\n"); for (Feature f : Feature.values()) { buf.append(f).append(" introduced in layout version ") .append(f.lv).append(" ("). append(f.description).append(")\n"); } buf.append("\n\nLayoutVersion and supported features:\n"); for (Feature f : Feature.values()) { buf.append(f.lv).append(": ").append(map.get(f.lv)) .append("\n"); } return buf.toString(); } /** * Returns true if a given feature is supported in the given layout version * @param f Feature * @param lv LayoutVersion * @return true if {@code f} is supported in layout version {@code lv} */ public static boolean supports(final Feature f, final int lv) { final EnumSet<Feature> set = map.get(lv); return set != null && set.contains(f); } /** * Get the current layout version */ public static int getCurrentLayoutVersion() { Feature[] values = Feature.values(); return values[values.length - 1].lv; } }
[ "archen94@gmail.com" ]
archen94@gmail.com
9544256eb1fb3e1d926a171b27adef315ceb8c5e
c2ddba735dab768e5d865d75825e991420ff59ff
/Chapter1/MallardDuck.java
218b7ccbf4ed8d4037552a94b74185b284e57ca9
[]
no_license
scoyne2/design-patterns
23f5b0561e95e8c58fe6b515180fd908689d174a
f08c7c3a0ee6c928a486ccb9f701924588d5aa71
refs/heads/master
2020-07-20T08:13:58.410793
2019-09-13T21:13:00
2019-09-13T21:13:00
206,605,742
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
public class MallardDuck extends Duck{ public MallardDuck(){ quackBehavior = new Quack(); flyBehavior = new FlyWithWings(); } public void display() { System.out.println("I'm a real Mallard Duck"); } }
[ "scoyne@gopro.com" ]
scoyne@gopro.com
06d83f7e0cbbd1453686df53787e5a25fa387cd2
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/14/14_ee948150f6ee7586b7daa899e69b5817b7dec90a/AceJumpAction/14_ee948150f6ee7586b7daa899e69b5817b7dec90a_AceJumpAction_s.java
79148fd2fa2c266b71802d5766e7ac2831b8e54b
[]
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
25,477
java
package com.johnlindquist.acejump; import com.intellij.codeInsight.editorActions.SelectWordUtil; import com.intellij.find.FindManager; import com.intellij.find.FindModel; import com.intellij.find.FindResult; import com.intellij.ide.ui.UISettings; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.actionSystem.impl.ActionManagerImpl; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.impl.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.*; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.popup.AbstractPopup; import com.intellij.usageView.UsageInfo; import com.intellij.usages.UsageInfo2UsageAdapter; import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.text.BadLocationException; import java.awt.*; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; import java.util.*; import java.util.List; /** * User: John Lindquist * Date: 8/6/2012 * Time: 12:10 AM */ public class AceJumpAction extends AnAction { protected Project project; protected EditorImpl editor; protected FindModel findModel; protected FindManager findManager; protected AbstractPopup popup; protected VirtualFile virtualFile; protected DocumentImpl document; protected FoldingModelImpl foldingModel; protected SearchBox searchBox; protected DataContext dataContext; protected AnActionEvent inputEvent; protected CaretModel caretModel; private CharSequence allowedCharacters = "abcdefghijklmnopqrstuvwxyz";//0123456789-=[];',./"; private Font font; private Graphics2D aceGraphics; private AceCanvas aceCanvas; private EditorColorsScheme scheme; private int allowedCount; protected HashMap<String, Integer> offsetHash = new HashMap<String, Integer>(); public void actionPerformed(AnActionEvent e) { allowedCount = allowedCharacters.length(); inputEvent = e; project = e.getData(PlatformDataKeys.PROJECT); editor = (EditorImpl) e.getData(PlatformDataKeys.EDITOR); virtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE); document = (DocumentImpl) editor.getDocument(); foldingModel = editor.getFoldingModel(); dataContext = e.getDataContext(); caretModel = editor.getCaretModel(); findManager = FindManager.getInstance(project); findModel = createFindModel(findManager); scheme = EditorColorsManager.getInstance().getGlobalScheme(); font = new Font(scheme.getEditorFontName(), Font.BOLD, scheme.getEditorFontSize()); searchBox = new SearchBox(); searchBox.setFont(font); ComponentPopupBuilder popupBuilder = JBPopupFactory.getInstance().createComponentPopupBuilder(searchBox, searchBox); popupBuilder.setCancelKeyEnabled(true); popup = (AbstractPopup) popupBuilder.createPopup(); // popup.getContent().setBorder(new BlockBorder()); popup.show(guessBestLocation(editor)); /* popup.addListener(new JBPopupAdapter() { @Override public void onClosed(LightweightWindowEvent event) { offsetHash.clear(); } });*/ Dimension dimension = new Dimension(searchBox.getFontMetrics(font).stringWidth("w") * 2, editor.getLineHeight()); popup.setSize(dimension); searchBox.setSize(dimension); searchBox.setFocusable(true); searchBox.requestFocus(); } protected FindModel createFindModel(FindManager findManager) { FindModel clone = (FindModel) findManager.getFindInFileModel().clone(); clone.setFindAll(true); clone.setFromCursor(true); clone.setForward(true); clone.setRegularExpressions(false); clone.setWholeWordsOnly(false); clone.setCaseSensitive(false); clone.setSearchHighlighters(true); clone.setPreserveCase(false); return clone; } public RelativePoint guessBestLocation(Editor editor) { VisualPosition logicalPosition = editor.getCaretModel().getVisualPosition(); RelativePoint pointFromVisualPosition = getPointFromVisualPosition(editor, logicalPosition); return pointFromVisualPosition; } protected static RelativePoint getPointFromVisualPosition(Editor editor, VisualPosition logicalPosition) { Point p = editor.visualPositionToXY(new VisualPosition(logicalPosition.line, logicalPosition.column)); return new RelativePoint(editor.getContentComponent(), p); } protected void moveCaret(Integer offset) { editor.getCaretModel().moveToOffset(offset); // editor.getScrollingModel().scrollToCaret(ScrollType.CENTER); } protected void clearSelection() { aceCanvas.setBallonInfos(null); aceCanvas.repaint(); offsetHash.clear(); // popup.cancel(); editor.getSelectionModel().removeSelection(); } protected class SearchBox extends JTextField { private ArrayList<JBPopup> resultPopups = new ArrayList<JBPopup>(); protected int key; protected List<Integer> results; protected int startResult; protected int endResult; private SearchArea searchArea; private boolean searchMode = true; private boolean mnemonicsDisabled; @Override protected void paintBorder(Graphics g) { //do nothing } @Override public Dimension getPreferredSize() { return new Dimension(getFontMetrics(getFont()).stringWidth("w"), editor.getLineHeight()); } //todo: refactor, extract and clean up public SearchBox() { final UISettings settings = UISettings.getInstance(); addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { JComponent contentComponent = editor.getContentComponent(); aceCanvas = new AceCanvas(); contentComponent.add(aceCanvas); JViewport viewport = editor.getScrollPane().getViewport(); //the 1000s are for the panels on the sides, hopefully user testing will find any holes aceCanvas.setBounds(0, 0, viewport.getWidth() + 1000, viewport.getHeight() + 1000); //System.out.println(aceCanvas.getWidth()); Point locationOnScreen = contentComponent.getLocationOnScreen(); //probably need to check for menuBar visibility int menuBarHeight = editor.getComponent().getRootPane().getJMenuBar().getHeight(); aceCanvas.setLocation(-locationOnScreen.x, -locationOnScreen.y + menuBarHeight); aceGraphics = (Graphics2D) aceCanvas.getGraphics(); aceGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); aceGraphics.setClip(0, 0, aceCanvas.getWidth(), aceCanvas.getHeight()); mnemonicsDisabled = settings.DISABLE_MNEMONICS; if (!mnemonicsDisabled) { settings.DISABLE_MNEMONICS = true; settings.fireUISettingsChanged(); } } @Override public void focusLost(FocusEvent e) { reset(); if (!mnemonicsDisabled) { settings.DISABLE_MNEMONICS = false; settings.fireUISettingsChanged(); } } }); } //todo: clean up keys @Override protected void processKeyEvent(final KeyEvent e) { if (getText().length() == 0) { searchMode = true; } //todo: refactor to behaviors, just spiking for now boolean isSpecialChar = false; if (e.getID() == KeyEvent.KEY_RELEASED) { switch (e.getKeyCode()) { case KeyEvent.VK_HOME: findText("^.", true); //the textfield needs to have a char to read/delete for consistent behavior setText(" "); searchMode = false; isSpecialChar = true; break; case KeyEvent.VK_END: findText("\n", true); setText(" "); searchMode = false; isSpecialChar = true; break; case KeyEvent.VK_SPACE: searchMode = false; isSpecialChar = true; break; } } if (e.getID() == KeyEvent.KEY_PRESSED) { switch (e.getKeyCode()) { case KeyEvent.VK_BACK_SPACE: searchMode = false; clearSelection(); break; case KeyEvent.VK_ENTER: if (!e.isShiftDown()) { startResult += allowedCount; endResult += allowedCount; } else { startResult -= allowedCount; endResult -= allowedCount; } if (startResult < 0) { startResult = 0; } if (endResult < allowedCount) { endResult = allowedCount; } showBalloons(results, startResult, endResult); isSpecialChar = true; break; } } //System.out.println("start: " + startResult + " end: " + endResult); if (isSpecialChar) { return; } super.processKeyEvent(e); //only watch "key_typed" events if (e.getID() != KeyEvent.KEY_TYPED) { return; } char keyChar = e.getKeyChar(); key = Character.getNumericValue(keyChar); if (!searchMode) { //Systemm.out.println("navigating" + e.getKeyChar()); // System.out.println("value: " + key + " code " + keyCode + " char " + e.getKeyChar() + " location: " + e.getKeyLocation()); // System.out.println("---------passed: " + "value: " + key + " code " + keyCode + " char " + e.getKeyChar() + " location: " + e.getKeyLocation()); Integer offset = offsetHash.get(getLowerCaseStringFromChar(keyChar)); if (offset != null) { clearSelection(); popup.cancel(); if (e.isShiftDown()) { editor.getSelectionModel().removeSelection(); int caretOffset = caretModel.getOffset(); int offsetModifer = 1; if (offset < caretOffset) { offset = offset + searchBox.getText().length(); offsetModifer = -2; } editor.getSelectionModel().setSelection(caretOffset, offset + offsetModifer); } else if (e.isAltDown()) { moveCaret(offset); selectWordAtCaret(); ActionManager actionManager = ActionManagerImpl.getInstance(); final AnAction action = actionManager.getAction(IdeActions.ACTION_CODE_COMPLETION); AnActionEvent event = new AnActionEvent(null, editor.getDataContext(), IdeActions.ACTION_CODE_COMPLETION, inputEvent.getPresentation(), ActionManager.getInstance(), 0); action.actionPerformed(event); } else { moveCaret(offset); } } } if (searchMode && getText().length() == 1) { //System.out.println("searching " + e.getKeyChar() + "\n"); findText(getText(), false); searchMode = false; return; } if (getText().length() == 2) { try { setText(getText(0, 1)); } catch (BadLocationException e1) { e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } } protected void selectWordAtCaret() { CharSequence text = document.getCharsSequence(); List<TextRange> ranges = new ArrayList<TextRange>(); SelectWordUtil.addWordSelection(false, text, editor.getCaretModel().getOffset(), ranges); if (ranges.isEmpty()) return; int startWordOffset = Math.max(0, ranges.get(0).getStartOffset()); int endWordOffset = Math.min(ranges.get(0).getEndOffset(), document.getTextLength()); if (ranges.size() == 2 && editor.getSelectionModel().getSelectionStart() == startWordOffset && editor.getSelectionModel().getSelectionEnd() == endWordOffset) { startWordOffset = Math.max(0, ranges.get(1).getStartOffset()); endWordOffset = Math.min(ranges.get(1).getEndOffset(), document.getTextLength()); } editor.getSelectionModel().setSelection(startWordOffset, endWordOffset); } /*todo: I hate this. Strict mapping to my USA keyboard :(*/ private String getLowerCaseStringFromChar(char keyChar) { String s = String.valueOf(keyChar); if (s.equals("!")) { return "1"; } else if (s.equals("@")) { return "2"; } else if (s.equals("#")) { return "3"; } else if (s.equals("$")) { return "4"; } else if (s.equals("%")) { return "5"; } else if (s.equals("^")) { return "6"; } else if (s.equals("&")) { return "7"; } else if (s.equals("*")) { return "8"; } else if (s.equals("(")) { return "9"; } else if (s.equals(")")) { return "0"; } else if (s.equals("_")) { return "-"; } else if (s.equals("+")) { return "="; } else if (s.equals("{")) { return "["; } else if (s.equals("}")) { return "]"; } else if (s.equals("|")) { return "\\"; } else if (s.equals(":")) { return ";"; } else if (s.equals("<")) { return ","; } else if (s.equals(">")) { return "."; } else if (s.equals("?")) { return "/"; } return s.toLowerCase(); } private void findText(String text, boolean isRegEx) { findModel.setStringToFind(text); findModel.setRegularExpressions(isRegEx); ApplicationManager.getApplication().runReadAction(new Runnable() { @Override public void run() { searchArea = new SearchArea(); searchArea.invoke(); if (searchArea.getPsiFile() == null) return; results = new ArrayList<Integer>(); results = findAllVisible(); } }); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { final int caretOffset = editor.getCaretModel().getOffset(); int lineNumber = document.getLineNumber(caretOffset); final int lineStartOffset = document.getLineStartOffset(lineNumber); final int lineEndOffset = document.getLineEndOffset(lineNumber); Collections.sort(results, new Comparator<Integer>() { @Override public int compare(Integer o1, Integer o2) { int i1 = Math.abs(caretOffset - o1); int i2 = Math.abs(caretOffset - o2); boolean o1OnSameLine = o1 >= lineStartOffset && o1 <= lineEndOffset; boolean o2OnSameLine = o2 >= lineStartOffset && o2 <= lineEndOffset; if (i1 > i2) { if (!o2OnSameLine && o1OnSameLine) { return -1; } return 1; } else if (i1 == i2) { return 0; } else { if (!o1OnSameLine && o2OnSameLine) { return 1; } return -1; } } }); startResult = 0; endResult = allowedCharacters.length(); showBalloons(results, startResult, endResult);//To change body of implemented methods use File | Settings | File Templates. } }); } private void showBalloons(List<Integer> results, int start, int end) { offsetHash.clear(); int size = results.size(); if (end > size) { end = size; } Vector<Pair<String, Point>> ballonInfos = new Vector<Pair<String, Point>>(); for (int i = start; i < end; i++) { int textOffset = results.get(i); RelativePoint point = getPointFromVisualPosition(editor, editor.offsetToVisualPosition(textOffset)); Point originalPoint = point.getOriginalPoint(); char resultChar = allowedCharacters.charAt(i % allowedCharacters.length()); final String text = String.valueOf(resultChar); ballonInfos.add(new Pair<String, Point>(text, originalPoint)); offsetHash.put(text, textOffset); } aceCanvas.setFont(font); aceCanvas.setBallonInfos(ballonInfos); aceCanvas.setLineHeight(editor.getLineHeight()); aceCanvas.setBackgroundForegroundColors(new Pair<Color, Color>(scheme.getDefaultBackground(), scheme.getDefaultForeground())); aceCanvas.repaint(); } @Nullable protected java.util.List<Integer> findAllVisible() { //System.out.println("----- findAllVisible"); int offset = searchArea.getOffset(); int endOffset = searchArea.getEndOffset(); CharSequence text = searchArea.getText(); PsiFile psiFile = searchArea.getPsiFile(); Rectangle visibleArea = searchArea.getVisibleArea(); List<Integer> offsets = new ArrayList<Integer>(); FoldRegion[] allFoldRegions = foldingModel.getAllFoldRegions(); offsetWhile: while (offset < endOffset) { // System.out.println("offset: " + offset + "/" + endOffset); // System.out.println("Finding: " + findModel.getStringToFind() + " = " + offset); //skip folded regions. Re-think approach. for (FoldRegion foldRegion : allFoldRegions) { if (!foldRegion.isExpanded()) { if (offset >= foldRegion.getStartOffset() && offset <= foldRegion.getEndOffset()) { // System.out.println("before offset: " + offset); offset = foldRegion.getEndOffset() + 1; // System.out.println("after offset: " + offset); continue offsetWhile; } } } FindResult result = findManager.findString(text, offset, findModel, virtualFile); if (!result.isStringFound()) { //System.out.println(findModel.getStringToFind() + ": not found"); break; } //System.out.println("result: " + result.toString()); UsageInfo2UsageAdapter usageAdapter = new UsageInfo2UsageAdapter(new UsageInfo(psiFile, result.getStartOffset(), result.getEndOffset())); Point point = editor.logicalPositionToXY(editor.offsetToLogicalPosition(usageAdapter.getUsageInfo().getNavigationOffset())); if (visibleArea.contains(point)) { UsageInfo usageInfo = usageAdapter.getUsageInfo(); int navigationOffset = usageInfo.getNavigationOffset(); if (navigationOffset != caretModel.getOffset()) { if (!results.contains(navigationOffset)) { //System.out.println("Adding: " + navigationOffset + "-> " + usageAdapter.getPlainText()); offsets.add(navigationOffset); } } } final int prevOffset = offset; offset = result.getEndOffset(); if (prevOffset == offset) { ++offset; } } return offsets; } //todo: can probably refactor this out now public class SearchArea { private PsiFile psiFile; private CharSequence text; private Rectangle visibleArea; private int offset; private int endOffset; public PsiFile getPsiFile() { return psiFile; } public CharSequence getText() { return text; } public Rectangle getVisibleArea() { return visibleArea; } public int getOffset() { return offset; } public int getEndOffset() { return endOffset; } public void invoke() { psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document); if (psiFile == null) { return; } text = document.getCharsSequence(); JViewport viewport = editor.getScrollPane().getViewport(); double viewportY = viewport.getViewPosition().getY(); ScrollingModelImpl scrollingModel = (ScrollingModelImpl) editor.getScrollingModel(); //you need the "visibleArea" to see if the point is inside of it visibleArea = scrollingModel.getVisibleArea(); //it seems like visibleArea can miss a top line, so I'm manually adding one. Investigate later. visibleArea.setRect(visibleArea.x, visibleArea.y - editor.getLineHeight(), visibleArea.width, visibleArea.height + editor.getLineHeight()); //TODO: Can this be more accurate? double linesAbove = viewportY / editor.getLineHeight(); double visibleLines = editor.getPreferredHeight(); if (linesAbove < 0) linesAbove = 0; offset = document.getLineStartOffset((int) linesAbove); int endLine = (int) (linesAbove + visibleLines); int lineCount = document.getLineCount() - 1; if (endLine > lineCount) { endLine = lineCount; } endOffset = document.getLineEndOffset(endLine); } } } private void reset() { if (aceCanvas != null) { editor.getContentComponent().remove(aceCanvas); aceCanvas = null; } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
4cee24b7e218aebcd2e87aee769b6dcaa8e28695
0dfbe8f98be8f04e9aad102bef22479f37b6ebe7
/1.JavaSyntax/src/com/javarush/task/task10/task1012/Solution.java
39821b17eb220be51d6c1fb36c549e65eaa23685
[]
no_license
evgeniykarpenko/MyJavaRushTasks
4a6134bad734bac5cadd7d7591b82a89ea9dc4db
07aeab9e89c89f0ddf38ea3c1b3ccb78a0d4f5ce
refs/heads/master
2020-04-18T04:17:58.702797
2019-02-20T19:56:12
2019-02-20T19:56:12
167,233,011
0
0
null
null
null
null
UTF-8
Java
false
false
1,587
java
package com.javarush.task.task10.task1012; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; /* Количество букв */ public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); // алфавит String abc = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя"; char[] abcArray = abc.toCharArray(); Integer[] chislobukv = new Integer[33]; ArrayList<Character> alphabet = new ArrayList<Character>(); for (int i = 0; i < abcArray.length; i++) { alphabet.add(abcArray[i]); } // ввод строк ArrayList<String> list = new ArrayList<String>(); for (int i = 0; i < 10; i++) { String s = reader.readLine(); list.add(s.toLowerCase()); } int count = 1; for(int i = 0; i< 33; i++) chislobukv[i]=0; for(int i = 0; i< list.size(); i++) { char[] strok = (list.get(i)).toCharArray(); for (int j = 0; j<strok.length;j++) { for (int k=0;k<alphabet.size();k++) if( alphabet.get(k)==(strok[j])) chislobukv[k] = count + chislobukv[k]; // System.out.println(strok[j]); } } // напишите тут ваш код for(int i = 0; i< 33; i++) System.out.println(alphabet.get(i) + " "+ chislobukv[i]); } }
[ "izifrag@yandex.ru" ]
izifrag@yandex.ru
6b43ec41720fb71910c3caa09e5baf28ee59c22c
4fb10109a6a8dbbea9b51ac036aa8a907113f8d8
/shoppingBackend/src/main/java/com/sudheer/shoppingBackend/config/HibernateConfig.java
c698a8146e94ebf1e3cde08360d612fc38118d10
[]
no_license
Sudheer9511/online-sgopping
ca083453063e2d02ca4443591649a7a1cb191b2c
40e9e490b4a0d02880aad83274277ee32d698df2
refs/heads/master
2020-04-13T10:40:04.943983
2019-02-06T16:03:12
2019-02-06T16:03:12
163,148,451
0
0
null
null
null
null
UTF-8
Java
false
false
2,910
java
package com.sudheer.shoppingBackend.config; import java.util.Properties; import javax.sql.DataSource; import org.apache.commons.dbcp2.BasicDataSource; import org.hibernate.SessionFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.orm.hibernate5.HibernateTransactionManager; import org.springframework.orm.hibernate5.LocalSessionFactoryBean; import org.springframework.orm.hibernate5.LocalSessionFactoryBuilder; import org.springframework.transaction.annotation.EnableTransactionManagement; import com.sudheer.shoppingBackend.dao.CategoryDAO; import com.sudheer.shoppingBackend.daoimpl.CategoryDAOImpl; @Configuration @ComponentScan(basePackages = { "com.sudheer.shoppingBackend.dto" }) @EnableTransactionManagement public class HibernateConfig { // Change the below based on the DBMS you choose private final static String DATABASE_URL = "jdbc:h2:tcp://localhost/~/online_shopping"; private final static String DATABASE_DRIVER = "org.h2.Driver"; private final static String DATABASE_DIALECT = "org.hibernate.dialect.H2Dialect"; private final static String DATABASE_USERNAME = "Sudheer"; private final static String DATABASE_PASSWORD = "Sudheer@1992"; // dataSource bean will be available @Bean public DataSource getDataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); // providing Database Connection Information dataSource.setDriverClassName(DATABASE_DRIVER); dataSource.setUrl(DATABASE_URL); dataSource.setUsername(DATABASE_USERNAME); dataSource.setPassword(DATABASE_PASSWORD); return dataSource; } // SessionFactory bean will be available @Bean public LocalSessionFactoryBean getSessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(getDataSource()); sessionFactory.setPackagesToScan(new String[] { "com.sudheer.shoppingBackend.dto" }); sessionFactory.setHibernateProperties(getHibernateProperties()); return sessionFactory; } //All the hibernate properties will be returned in this method private Properties getHibernateProperties() { Properties properties = new Properties(); properties.put("hibernate.dialect", DATABASE_DIALECT); properties.put("hibernate.show_sql", "true"); properties.put("hibernate.format_sql", "true"); return properties; } @Bean public HibernateTransactionManager geTransactionManager(SessionFactory sessionFactory) { HibernateTransactionManager transactionManager = new HibernateTransactionManager(sessionFactory); return transactionManager; } }
[ "sudheerbhalerao148@gmail.com" ]
sudheerbhalerao148@gmail.com
6ef5c9fcf5281705b85ef95a000ee9ed72b9d95b
72d4d1cec6721df98bb2d1d2e09f926c242bcd30
/User-Service/src/main/java/de/tekup/user/data/models/UserEntity.java
8f23a5b8b9d191ac9de6fa511151e2542c717487
[]
no_license
Hmida-Rojbani/Microservices2021-A
fe13822be1678f80937b175c55d00910d5ece886
857460bd6661cd2c29238a83f68d600141be3392
refs/heads/master
2023-05-05T10:34:09.840212
2021-05-25T13:42:36
2021-05-25T13:42:36
368,554,759
1
0
null
null
null
null
UTF-8
Java
false
false
836
java
package de.tekup.user.data.models; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import lombok.Data; @Entity @Data public class UserEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @Column(length = 45, nullable = false) private String name; @Column(length = 45, nullable = false, unique = true) private String email; @Column(nullable = false) private String password; @Column(nullable = false) private String userID; public void setPassword(String rawPassword) { BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); this.password = encoder.encode(rawPassword); } }
[ "31728681+Hmida-Rojbani@users.noreply.github.com" ]
31728681+Hmida-Rojbani@users.noreply.github.com
7d6c055ab17830d818cdd9cb01585bc9f7d96a68
3b42fd343c6807ef915ba7ae0326b42799159776
/back/src/main/java/com/horacio/Response/GetUserResp.java
c4d9344c52cffec433f2224d1d54ac8427911bd5
[]
no_license
kobpko/DeviceManagementSystemFor510
dd6e836634ef356aaa7299b696f48aef94a2aa81
1daa6f3781d8b0135a381d778b2330e24f9c365a
refs/heads/master
2020-06-24T12:33:45.235609
2019-02-01T21:10:20
2019-02-01T21:10:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,012
java
package com.horacio.Response; /** * Created by Horac on 2017/5/20. */ public class GetUserResp { private int id; private String username; private double bestScore; private int lastCreate; private String position; public GetUserResp() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public double getBestScore() { return bestScore; } public void setBestScore(double bestScore) { this.bestScore = bestScore; } public int getLastCreate() { return lastCreate; } public void setLastCreate(int lastCreate) { this.lastCreate = lastCreate; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } }
[ "529023962@qq.com" ]
529023962@qq.com
9f84e9413d503c621145dde7efe1f8fcfaeb8c7c
a25f559113c82d2f3497a56d373fa189501b085f
/src/PortRange.java
7ed5ae2d4931f8285dc5d6a4e1b6c6e54489c6bb
[]
no_license
afmdnf/firewall
06123791ed380d22de2b7415860b6b290e1dfd38
206fdde9ebe4487f9e69cdb7b6e997febd7e11a6
refs/heads/master
2020-04-13T02:20:34.532667
2019-02-01T08:53:09
2019-02-01T08:53:09
162,899,986
0
0
null
null
null
null
UTF-8
Java
false
false
721
java
import java.util.Objects; public class PortRange implements Comparable<PortRange> { int start, end; PortRange(String start, String end) { this.start = Integer.parseInt(start); this.end = Integer.parseInt(end); } @Override public int compareTo(PortRange p) { return Integer.compare(this.start, p.start); // only compares start values } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PortRange portRange = (PortRange) o; return start == portRange.start; } @Override public int hashCode() { return Objects.hash(start); } }
[ "afmdnf@berkeley.edu" ]
afmdnf@berkeley.edu
46176169621dc7951ee23b377a39dc34f052757d
d93a76c7b98f1bb7fa14a632d0142cbdedbde003
/JavaRPG-master/src/com/katolisa/rpg/service/BattleService.java
510f028e2dbc1ad7b802feb156fb145d8578fd5f
[]
no_license
ononoy/Site
aca0017fe8bc407fb3103d5572d2361b007453da
8ac7e340e12122f9ad2479ec64c00533bf87ae13
refs/heads/master
2021-07-05T14:21:50.647433
2017-10-02T10:36:17
2017-10-02T10:36:17
104,168,316
0
0
null
null
null
null
UTF-8
Java
false
false
253
java
package com.katolisa.rpg.service; import java.util.ArrayList; import com.katolisa.rpg.character.Character; import com.katolisa.rpg.character.impl.Boss; public interface BattleService { void battle(ArrayList<Character> party, Boss boss); }
[ "yasu.ellegarden@gmail.com" ]
yasu.ellegarden@gmail.com
f615b48770bf64719a897b03bdecf2d74937c259
89d037a0b778530ff1ef2f94bad047ef76b03e2c
/services/repository/src/test/java/org/sagebionetworks/repo/web/EntityServiceImplAutowiredTest.java
a8aa6e2db1c657f57c6376695bab970b73dbecbd
[]
no_license
fgamador/Synapse-Repository-Services
c8da5ed1364bff7a3400073674e72b6d263696f1
287362ec8a9a2c348f62d64197e8a921f9efeaff
refs/heads/master
2021-01-21T01:39:15.825580
2013-06-27T17:43:17
2013-06-27T17:43:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,756
java
package org.sagebionetworks.repo.web; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.servlet.http.HttpServletRequest; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.sagebionetworks.repo.model.Data; import org.sagebionetworks.repo.model.DatastoreException; import org.sagebionetworks.repo.model.EntityHeader; import org.sagebionetworks.repo.model.InvalidModelException; import org.sagebionetworks.repo.model.LayerTypeNames; import org.sagebionetworks.repo.model.LocationData; import org.sagebionetworks.repo.model.LocationTypeNames; import org.sagebionetworks.repo.model.PaginatedResults; import org.sagebionetworks.repo.model.Project; import org.sagebionetworks.repo.model.Reference; import org.sagebionetworks.repo.model.Step; import org.sagebionetworks.repo.model.Study; import org.sagebionetworks.repo.model.UnauthorizedException; import org.sagebionetworks.repo.model.UserInfo; import org.sagebionetworks.repo.web.service.EntityService; import org.sagebionetworks.repo.web.util.UserProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:test-context.xml" }) public class EntityServiceImplAutowiredTest { @Autowired EntityService entityController; @Autowired public UserProvider testUserProvider; List<String> toDelete = null; private int totalEntities = 10; private int layers = 5; private int locations = 2; private String userName; private UserInfo userInfo; HttpServletRequest mockRequest; @Before public void before() throws DatastoreException, InvalidModelException, NotFoundException, UnauthorizedException{ assertNotNull(entityController); assertNotNull(testUserProvider); // Map test objects to their urls // Make sure we have a valid user. userInfo = testUserProvider.getTestAdminUserInfo(); UserInfo.validateUserInfo(userInfo); userName = userInfo.getUser().getUserId(); mockRequest = Mockito.mock(HttpServletRequest.class); when(mockRequest.getServletPath()).thenReturn("/repo/v1"); toDelete = new ArrayList<String>(); // Create a project to hold the datasets Project project = new Project(); project.setName("projectRoot"); project = entityController.createEntity(userName, project, mockRequest); assertNotNull(project); // Create some datasetst. for(int i=0; i<totalEntities; i++){ Study ds = createForTest(i); ds.setParentId(project.getId()); ds = entityController.createEntity(userName, ds, mockRequest); for(int layer=0; layer<layers; layer++){ Data inLayer = createLayerForTest(i*10+layer); inLayer.setParentId(ds.getId()); inLayer.setMd5("b960413cf33e1333b2b709319c29870d"); List<LocationData> locationDatas = new ArrayList<LocationData>(); inLayer.setLocations(locationDatas); for(int loc=0; loc<locations; loc++){ LocationData loca = createLayerLocatoinsForTest(i*10+layer*10+loc); locationDatas.add(loca); } inLayer = entityController.createEntity(userName, inLayer, mockRequest); } toDelete.add(ds.getId()); } toDelete.add(project.getId()); } private Study createForTest(int i){ Study ds = new Study(); ds.setName("someName"+i); ds.setDescription("someDesc"+i); ds.setCreatedBy("magic"+i); ds.setCreatedOn(new Date(1001)); ds.setAnnotations("someAnnoUrl"+1); ds.setUri("someUri"+i); return ds; } private Data createLayerForTest(int i) throws InvalidModelException{ Data layer = new Data(); layer.setName("layerName"+i); layer.setDescription("layerDesc"+i); layer.setCreatedOn(new Date(1001)); layer.setType(LayerTypeNames.G); return layer; } private LocationData createLayerLocatoinsForTest(int i) throws InvalidModelException{ LocationData locationData = new LocationData(); locationData.setPath("a/very/long/path/"+i); locationData.setType(LocationTypeNames.awsebs); return locationData; } @After public void after(){ if(entityController != null && toDelete != null){ for(String id: toDelete){ try{ entityController.deleteEntity(userName, id); }catch(Exception e){} } } } @Test public void testQuery() throws DatastoreException, NotFoundException, UnauthorizedException{ // Basic query PaginatedResults<Study> paginated = entityController.getEntities(userName, new PaginatedParameters(1,100, null, true), mockRequest, Study.class); assertNotNull(paginated); assertNotNull(paginated.getPaging()); List<Study> results = paginated.getResults(); assertNotNull(results); assertEquals(totalEntities, results.size()); // Check the urls for each object for(Study ds: results){ UrlHelpers.validateAllUrls(ds); } // Sorted paginated = entityController.getEntities(userName, new PaginatedParameters(1, 3, "name", true), mockRequest, Study.class); results = paginated.getResults(); assertNotNull(results); assertEquals(3, results.size()); assertNotNull(results.get(2)); assertEquals("someName2", results.get(2).getName()); } @Test public void testGetChildrenOfType() throws DatastoreException, NotFoundException, UnauthorizedException{ String datasetOneId = toDelete.get(0); List<Data> list = entityController.getEntityChildrenOfType(userName, datasetOneId, Data.class, mockRequest); assertNotNull(list); assertEquals(layers, list.size()); Data lastLayer = list.get(layers -1); assertNotNull(lastLayer); // Check the urls for each object for(Data layer: list){ // Check all of the urls UrlHelpers.validateAllUrls(layer); // Now get the locations. assertNotNull(layer.getLocations()); assertEquals(locations, layer.getLocations().size()); } } @Test public void testGetChildrenOfTypePaginated() throws DatastoreException, NotFoundException, UnauthorizedException{ String datasetOneId = toDelete.get(0); PaginatedResults<Data> resutls = entityController.getEntityChildrenOfTypePaginated(userName, datasetOneId, Data.class, new PaginatedParameters(), mockRequest); assertNotNull(resutls); assertEquals(layers, resutls.getTotalNumberOfResults()); List<Data> list = resutls.getResults(); assertNotNull(list); assertEquals(layers, list.size()); Data lastLayer = list.get(layers -1); assertNotNull(lastLayer); // Now get the locations. assertNotNull(lastLayer.getLocations()); assertEquals(locations, lastLayer.getLocations().size()); } @Test public void testGetReferences() throws Exception { // get an entity String id1 = toDelete.get(0); // verify that nothing refers to it PaginatedResults<EntityHeader> ehs = entityController.getEntityReferences(userName, id1, null, null, null, mockRequest); assertEquals(0, ehs.getTotalNumberOfResults()); // make another entity refer to the first one Step step = new Step(); Reference ref = new Reference(); ref.setTargetId(id1); Set<Reference> refs = new HashSet<Reference>(); refs.add(ref); step.setInput(refs); step = entityController.createEntity(userName, step, mockRequest); toDelete.add(step.getId()); // verify that the Step can be retrieved via its reference ehs = entityController.getEntityReferences(userName, id1, null, null, null, mockRequest); assertEquals(1, ehs.getTotalNumberOfResults()); assertEquals(step.getId(), ehs.getResults().iterator().next().getId()); } }
[ "bennett.ng@sagebase.org" ]
bennett.ng@sagebase.org
f075582ee5e6038383613fd225b51bd8a5daac23
6a8ce8bb3cfc4b1e03336843e60cb6aa8a72e9a9
/log-viewer/src/test/java/com/logviewer/formats/DefaultFieldSetTest.java
8b7ce8f53bd3e20ba8c7a90686eb30519b7693a8
[ "Apache-2.0" ]
permissive
ntfox0001/log-viewer
e523758473ecee621ab0c2f8565b430778af1baa
d3008b63010c81df4a6dbf8d004a5a2cb227fdf0
refs/heads/master
2023-05-12T03:08:16.958458
2021-06-02T21:04:24
2021-06-02T21:04:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,919
java
package com.logviewer.formats; import com.logviewer.AbstractLogTest; import com.logviewer.data2.*; import com.logviewer.formats.utils.*; import org.junit.Test; import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import java.util.stream.Collectors; import java.util.stream.Stream; import static org.junit.Assert.*; public class DefaultFieldSetTest extends AbstractLogTest { public static final DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutTextNode(" ["), LvLayoutStretchNode.threadNode(), new LvLayoutTextNode("] "), new LvLayoutFixedTextNode("level", FieldTypes.LEVEL_LOGBACK, "ERROR", "WARN", "INFO", "DEBUG", "TRACE"), new LvLayoutClassNode(), new LvLayoutTextNode(" - "), LvLayoutStretchNode.messageNode()); public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS"); @Test public void testFinalStretchProperty() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutTextNode(" "), LvLayoutStretchNode.threadNode()); LogReader reader = format.createReader(); String s = "2016-12-02_16:05:11.333 localhost-startStop-1"; assertTrue(reader.parseRecord(new BufferedFile.Line(s))); LogRecord record = reader.buildRecord(); assertEquals("localhost-startStop-1", fieldValue(format, record, "thread")); } @Test public void testStretchPropertyMinSizeAtEnd() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutStretchNode("f", "f", false, 3)); buildFailed(format, "2016-12-02_16:05:11.333"); buildFailed(format, "2016-12-02_16:05:11.333 "); buildFailed(format, "2016-12-02_16:05:11.333 "); LogRecord record = buildRecord(format, "2016-12-02_16:05:11.333 "); assertEquals(" ", fieldValue(format, record, "f")); record = buildRecord(format, "2016-12-02_16:05:11.333 "); assertEquals(" ", fieldValue(format, record, "f")); } @Test public void testDoubleStretchProperty() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutStretchNode("f1", "f", false, 3), new LvLayoutStretchNode("f2", "f", false, 3)); buildFailed(format, "2016-12-02_16:05:11.333"); buildFailed(format, "2016-12-02_16:05:11.333...,,"); LogRecord record = buildRecord(format, "2016-12-02_16:05:11.333...,,,"); assertEquals("...", fieldValue(format, record, "f1")); assertEquals(",,,", fieldValue(format, record, "f2")); record = buildRecord(format, "2016-12-02_16:05:11.333...,,,__"); assertEquals("...", fieldValue(format, record, "f1")); assertEquals(",,,__", fieldValue(format, record, "f2")); } @Test public void testDoubleStretchPropertyRollback() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutStretchNode("f1", "f", false, 1), new LvLayoutSimpleDateNode("="), new LvLayoutStretchNode("f2", "f", false, 1), new LvLayoutSimpleDateNode("=") ); buildFailed(format, "2016-12-02_16:05:11.333.....=_____=,"); buildFailed(format, "2016-12-02_16:05:11.333.....=="); buildFailed(format, "2016-12-02_16:05:11.333=,="); LogRecord record = buildRecord(format, "2016-12-02_16:05:11.333.....=_____="); assertEquals(".....", fieldValue(format, record, "f1")); assertEquals("_____", fieldValue(format, record, "f2")); record = buildRecord(format, "2016-12-02_16:05:11.333.....=_____='''=;;;;;="); assertEquals(".....", fieldValue(format, record, "f1")); assertEquals("_____='''=;;;;;", fieldValue(format, record, "f2")); } @Test public void testDoubleStretchPropertyRollbackNonSearchabeField() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutStretchNode("f1", "f", false, 1), new LvLayoutSimpleDateNode("yyyy-MM-dd"), new LvLayoutStretchNode("f2", "f", false, 1), new LvLayoutSimpleDateNode("yyyy-MM-dd") ); buildFailed(format, "2016-12-02_16:05:11.333.....2016-12-02_____2016-12-02,"); buildFailed(format, "2016-12-02_16:05:11.333.....2016-12-022016-12-02"); buildFailed(format, "2016-12-02_16:05:11.3332016-12-02,2016-12-02"); LogRecord record = buildRecord(format, "2016-12-02_16:05:11.333.....2016-12-02_____2016-12-02"); assertEquals(".....", fieldValue(format, record, "f1")); assertEquals("_____", fieldValue(format, record, "f2")); record = buildRecord(format, "2016-12-02_16:05:11.333.....2016-12-02_____2016-12-02'''2016-12-02;;;;;2016-12-02"); assertEquals(".....", fieldValue(format, record, "f1")); assertEquals("_____2016-12-02'''2016-12-02;;;;;", fieldValue(format, record, "f2")); } @Test public void testEmptyStretchProperty() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutTextNode(" "), LvLayoutStretchNode.messageNode()); buildFailed(format, "2016-12-02_16:05:11.333"); LogRecord record = buildRecord(format, "2016-12-02_16:05:11.333 "); assertEquals("", fieldValue(format, record, "msg")); } @Test public void testRequiredSpace() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutTextNode(" "), new LvLayoutClassNode()); buildFailed(format, "2016-12-02_16:05:11.333com.google.App"); LogRecord record = buildRecord(format, "2016-12-02_16:05:11.333 com.google.App"); assertEquals("com.google.App", fieldValue(format, record, "logger")); record = buildRecord(format, "2016-12-02_16:05:11.333 com.google.App"); assertEquals("com.google.App", fieldValue(format, record, "logger")); } @Test public void testRegexFieldAfterStretchField() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutTextNode(" "), new LvLayoutRegexNode("f0", "f", "\\d+"), new LvLayoutTextNode(" "), LvLayoutStretchNode.threadNode(), new LvLayoutRegexNode("f", "f", "\\d+") ); buildFailed(format, "2016-12-02_16:05:11.333 --"); LogRecord record = buildRecord(format, "2016-12-02_16:05:11.333 999 tt555"); assertEquals("999", fieldValue(format, record, "f0")); assertEquals("tt", fieldValue(format, record, "thread")); assertEquals("555", fieldValue(format, record, "f")); } @Test public void testEmptyStretchPropertyMiddle() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutTextNode(" "), LvLayoutStretchNode.messageNode(), new LvLayoutClassNode() ); LogRecord record = buildRecord(format, "2016-12-02_16:05:11.333 com.behavox.App"); assertEquals("", fieldValue(format, record, "msg")); assertEquals("com.behavox.App", fieldValue(format, record, "logger")); } @Test public void testStretchProperty5() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutTextNode(" "), LvLayoutStretchNode.messageNode(), new LvLayoutClassNode() ); buildFailed(format, "2016-12-02_16:05:11.333"); buildFailed(format, "2016-12-02_16:05:11.333 ..."); LogRecord record = buildRecord(format, "2016-12-02_16:05:11.333 mmmm com.google.MyApp"); assertEquals("mmmm", fieldValue(format, record, "msg")); assertEquals("com.google.MyApp", fieldValue(format, record, "logger")); } @Test public void testSpaceAtEnd() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutFixedTextNode("f", "f", "INFO", "WARN"), new LvLayoutTextNode(" ") ); buildFailed(format, "INFO"); buildFailed(format, "INFO."); LogRecord record = buildRecord(format, "INFO "); assertEquals("INFO", fieldValue(format, record, "f")); record = buildRecord(format, "INFO "); assertEquals("INFO", fieldValue(format, record, "f")); } private static void buildFailed(DefaultFieldSet format, String s) { LogReader reader = format.createReader(); assertFalse(reader.parseRecord(new BufferedFile.Line(s))); } private static LogRecord buildRecord(DefaultFieldSet format, String s) { LogReader reader = format.createReader(); assertTrue(reader.parseRecord(new BufferedFile.Line(s))); return reader.buildRecord(); } @Test public void testStringEnd() { DefaultFieldSet format = new DefaultFieldSet(StandardCharsets.UTF_8, true, new LvLayoutSimpleDateNode("yyyy-MM-dd_HH:mm:ss.SSS"), new LvLayoutTextNode("___"), new LvLayoutClassNode()); LogReader reader = format.createReader(); assertFalse(reader.parseRecord(new BufferedFile.Line("2016-12-02_16:05:11.333"))); assertFalse(reader.hasParsedRecord()); assertFalse(reader.parseRecord(new BufferedFile.Line("2016-12-02_16:05:11.333_"))); assertFalse(reader.hasParsedRecord()); assertFalse(reader.parseRecord(new BufferedFile.Line("2016-12-02_16:05:11.333___"))); assertFalse(reader.hasParsedRecord()); assertFalse(reader.parseRecord(new BufferedFile.Line("2016-12-02_16:05:11.333___*"))); assertFalse(reader.hasParsedRecord()); assertTrue(reader.parseRecord(new BufferedFile.Line("2016-12-02_16:05:11.333___Main"))); LogRecord record = reader.buildRecord(); assertEquals("Main", fieldValue(format, record, "logger")); } @Test public void testDefaultFormat() { assertEquals(Arrays.asList("date", "thread", "level", "logger", "msg"), Stream.of(format.getFields()) .map(LogFormat.FieldDescriptor::name) .collect(Collectors.toList())); LogReader reader = format.createReader(); String s = "2016-12-02_16:05:11.333 [localhost-startStop-1] INFO com.behavox.core.PluginManager - Plugins search time: 175 ms"; byte[] line = ("zzz\n" + s).getBytes(); line = Arrays.copyOf(line, line.length + 5); boolean b = reader.parseRecord(line, 4, s.length(), 10000, 1000100); assertTrue(b); LogRecord record = reader.buildRecord(); assertEquals(s, record.getMessage()); assertEquals("2016-12-02_16:05:11.333", fieldValue(format, record, "date")); assertEquals("localhost-startStop-1", fieldValue(format, record, "thread")); assertEquals("INFO", fieldValue(format, record, "level")); assertEquals("com.behavox.core.PluginManager", fieldValue(format, record, "logger")); assertEquals("Plugins search time: 175 ms", fieldValue(format, record, "msg")); assertEquals("2016-12-02_16:05:11.333", new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date(record.getTime()))); } private String fieldValue(DefaultFieldSet format, LogRecord record, String fieldName) { int fieldIdx = -1; LogFormat.FieldDescriptor[] fields = format.getFields(); for (int i = 0; i < fields.length; i++) { if (fields[i].name().equals(fieldName)) { fieldIdx = i; break; } } assert fieldIdx >= 0 : fieldName; return record.getFieldText(fieldIdx); } }
[ "sergey.evdokimov@behavox.com" ]
sergey.evdokimov@behavox.com
36cfb933b95fbdcf57492103d9c19162fce555a1
7efe4bc19394d1c84df53d53090da912250639b2
/LectureNotes/app/src/main/java/com/example/logicgupta/lecturenotes/mechanical/Sem3_Mechanical.java
8ee9b8598379819cbba4b51c43a630e998eb331c
[]
no_license
logicgupta/Android-
6b51e3c35d548b5325feb0aac0019dc09a5e323b
3e58a409517b2ee9bbd5e04926f8ac79d7bbc1c7
refs/heads/master
2020-03-29T06:10:18.098096
2018-09-20T13:32:31
2018-09-20T13:32:31
149,612,599
2
0
null
null
null
null
UTF-8
Java
false
false
3,299
java
package com.example.logicgupta.lecturenotes.mechanical; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import com.example.logicgupta.lecturenotes.R; import com.example.logicgupta.lecturenotes.computer_science.Math_sem1_computer; import com.example.logicgupta.lecturenotes.computer_science.MyRecycler_View; public class Sem3_Mechanical extends AppCompatActivity { ListView listView1; String branch; String semester; Bundle bundle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sem3__mechanical); bundle=getIntent().getExtras(); branch=bundle.getString("branch"); semester=bundle.getString("semester"); listView1=findViewById(R.id.listView1); final String sem1[]=getResources().getStringArray(R.array.mechanical_sem3); ArrayAdapter<String> arrayAdapter=new ArrayAdapter<String>(Sem3_Mechanical.this,android.R.layout.simple_list_item_1,sem1); listView1.setAdapter(arrayAdapter); listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String subject=sem1[position]; if (position == 0) { Intent intent=new Intent(Sem3_Mechanical.this,MyRecycler_View.class); intent.putExtra("branch",branch); intent.putExtra("semester",semester); intent.putExtra("subject",subject); startActivity(intent); } else if (position == 1) { Intent intent=new Intent(Sem3_Mechanical.this,MyRecycler_View.class); intent.putExtra("branch",branch); intent.putExtra("semester",semester); intent.putExtra("subject",subject); startActivity(intent); } else if (position == 2) { Intent intent=new Intent(Sem3_Mechanical.this,MyRecycler_View.class); intent.putExtra("branch",branch); intent.putExtra("semester",semester); intent.putExtra("subject",subject); startActivity(intent); } else if (position == 3) { Intent intent=new Intent(Sem3_Mechanical.this,MyRecycler_View.class); intent.putExtra("branch",branch); intent.putExtra("semester",semester); intent.putExtra("subject",subject); startActivity(intent); } else{ Intent intent=new Intent(Sem3_Mechanical.this,MyRecycler_View.class); intent.putExtra("branch",branch); intent.putExtra("semester",semester); intent.putExtra("subject",subject); startActivity(intent); } } }); } }
[ "logicgupta59@gmail.com" ]
logicgupta59@gmail.com
a5c7b5cedf1d3ba87368faf149754051b2c512b8
56c1e410f5c977fedce3242e92a1c6496e205af8
/lib/sources/dolphin-mybatis-generator/main/java/com/freetmp/mbg/merge/type/VoidTypeMerger.java
4bc8683572ba57aaa9b88d1de0eca0e6ce1d6cd5
[ "Apache-2.0" ]
permissive
jacksonpradolima/NewMuJava
8d759879ecff0a43b607d7ab949d6a3f9512944f
625229d042ab593f96f7780b8cbab2a3dbca7daf
refs/heads/master
2016-09-12T16:23:29.310385
2016-04-27T18:45:51
2016-04-27T18:45:51
57,235,697
0
0
null
null
null
null
UTF-8
Java
false
false
552
java
package com.freetmp.mbg.merge.type; import com.freetmp.mbg.merge.AbstractMerger; import com.github.javaparser.ast.type.VoidType; /** * Created by pin on 2015/4/19. */ public class VoidTypeMerger extends AbstractMerger<VoidType> { @Override public VoidType doMerge(VoidType first, VoidType second) { VoidType vt = new VoidType(); vt.setAnnotations(mergeCollections(first.getAnnotations(),second.getAnnotations())); return vt; } @Override public boolean doIsEquals(VoidType first, VoidType second) { return true; } }
[ "pradolima@live.com" ]
pradolima@live.com
203f3a9995936f99dc93324c6c9d6a49c051237f
ca185ca5afc4dd9ce16fc90f2700a5139dc2337c
/app/src/main/java/com/docbot/seminar/newproj/LanguageConfig.java
0eb82b729e95bbd5d188b1d7d4bbd5a0363cac87
[]
no_license
NehaM96/Health-Bot
0e126a88eb4b7399d069f7252dc15c255618792b
b5edb571ac4c82a0d7be1f5e782906137c7f4ecf
refs/heads/master
2021-01-20T06:47:22.881288
2017-05-02T04:10:24
2017-05-02T04:10:24
89,927,417
0
0
null
null
null
null
UTF-8
Java
false
false
1,695
java
package com.docbot.seminar.newproj; /*********************************************************************************************************************** * * API.AI Android SDK - API.AI libraries usage example * ================================================= * * Copyright (C) 2014 by Speaktoit, Inc. (https://www.speaktoit.com) * https://www.api.ai * *********************************************************************************************************************** * * 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. * ***********************************************************************************************************************/ import java.lang.String; public class LanguageConfig { private final String languageCode; private final String accessToken; public LanguageConfig(final String languageCode, final String accessToken) { this.languageCode = languageCode; this.accessToken = accessToken; } public String getLanguageCode() { return languageCode; } public String getAccessToken() { return accessToken; } @Override public String toString() { return languageCode; } }
[ "nehamohan1996@gmail.com" ]
nehamohan1996@gmail.com
fd7b602a4ec351fd552e7173168c744e73ce14df
d2525ddfb7a3f717e23d8692ab2d67eb06b3d179
/src/main/java/com/polls/payload/UseridentityAvailability.java
6b3dea3dc48b804aaf2673fcb70a444aca9e12a2
[]
no_license
baeddavid/polling
74aaaab622cf0bfd75350f638dab5ac6a5395459
ccd1218573e6a914ee35ea25903337c3f129a683
refs/heads/master
2023-04-17T00:48:32.920344
2021-04-25T23:13:11
2021-04-25T23:13:11
294,582,630
0
0
null
null
null
null
UTF-8
Java
false
false
371
java
package com.example.polls.payload; public class UseridentityAvailability { private Boolean available; public UseridentityAvailability(Boolean available) { this.available = available; } public Boolean getAvailable() { return available; } public void setAvailable(Boolean available) { this.available = available; } }
[ "baeddavid@gmail.com" ]
baeddavid@gmail.com
013cfd04bee9c84c1aaa5a8a820e0e1560d955bd
4a311c0750708cc351d6b33bd81f85ea42a7388c
/src/main/java/com/atguigu/MyJUC/NoList.java
b7c1368ec79c01e9754569ffb9207f7abbb0105d
[]
no_license
galigigi2333/MyJUC
2a7d41b6cdf0e14f215839f1a674fd2b827b60dd
c2a4b13ed6ad2fc48515c6858900bec5f579af0d
refs/heads/master
2020-11-25T10:13:14.951653
2019-12-17T12:34:43
2019-12-17T12:34:43
228,387,611
0
0
null
null
null
null
UTF-8
Java
false
false
1,454
java
package com.atguigu.MyJUC; import java.util.ArrayList; import java.util.List; import java.util.UUID; public class NoList { public static void main(String[] args) throws InterruptedException { List list = new ArrayList(); /* ArrayList 线程不安全 * * 1.故障现象 * java.util.ConcurrentModificationException * 2.导致原因 * 没加锁 * 发生读写版本号不一致(count!=expectedcount) * * 3. 解决方法 * Vector() * Collections.synchorizedList() * copyOnWriteArrayList() 写时复制 * * 4. * 写时复制 CopyOnWrite容器即写时复制的容器。往一个容器添加元素的时候,不直接往当前容器Object[]添加,而是先将当前容器Object[]进行Copy, 复制出一个新的容器Object[] newElements,然后新的容器Object[] newElements里添加元素,添加完元素之后, 再将原容器的引用指向新的容器 setArray(newElements);。这样做的好处是可以对CopyOnWrite容器进行并发的读, 而不需要加锁,因为当前容器不会添加任何元素。所以CopyOnWrite容器也是一种读写分离的思想,读和写不同的容器 * */ for (int i = 0; i <3 ; i++) { new Thread(()->{ list.add(UUID.randomUUID().toString().substring(0,6)); System.out.println(list); },"A").start(); } } }
[ "galigigi@foxmail.com" ]
galigigi@foxmail.com
b2908ed5247f7de34a02c08d25a868d3b10e9f81
7391ebc1b29db100224b0d8c1fc132053f3d5b79
/xflibrary/src/main/java/com/xuanfeng/xflibrary/utils/ImageUtil.java
47ba027f5e414938439acd4c81041f4d176fc7cd
[]
no_license
xuanfengwuxiang/XuanFengWeather
92f271cef25935f063fb2a6c61cab894f9fe01b7
0c2e6b4a9cf32fde23bda1a251331f7344a99591
refs/heads/master
2022-07-07T14:30:04.436855
2022-06-27T14:44:57
2022-06-27T14:44:57
101,604,294
1
0
null
null
null
null
UTF-8
Java
false
false
8,866
java
package com.xuanfeng.xflibrary.utils; import android.app.Activity; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.media.MediaMetadataRetriever; import android.net.Uri; import android.os.Build; import android.provider.MediaStore; import android.util.Log; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.bumptech.glide.Glide; import com.bumptech.glide.request.target.SimpleTarget; import com.bumptech.glide.request.transition.Transition; import java.io.BufferedInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.HashMap; /** * Created by xuanfengwuxiang on 2018/3/12. * 图片工具类 */ public class ImageUtil { private static final String TAG = "ImageUtil"; private ImageUtil() { } public static void loadImage(Context context, int resId, View view) { int width = context.getResources().getDisplayMetrics().widthPixels; int height = context.getResources().getDisplayMetrics().heightPixels; Glide.with(context).asDrawable() .load(resId) .into(new SimpleTarget<Drawable>(width, height) { @Override public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) { view.setBackgroundDrawable(resource); } }); } //修改控件的图片颜色 R G B范围0-255 public static Bitmap getColorBitmap(Bitmap bitmap, float r, float g, float b, float a) { Bitmap updateBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig()); Canvas canvas = new Canvas(updateBitmap); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);//抗锯齿的画笔 paint.setAntiAlias(true); Matrix matrix = new Matrix(); ColorMatrix cm = new ColorMatrix(); cm.set(new float[]{ r / 128f, 0, 0, 0, 0,// 红色值 0, g / 128f, 0, 0, 0,// 绿色值 0, 0, b / 128f, 0, 0,// 蓝色值 0, 0, 0, a / 128f, 0 // 透明度 }); paint.setColorFilter(new ColorMatrixColorFilter(cm)); canvas.drawBitmap(bitmap, matrix, paint); return updateBitmap; } //保存位图到SD卡 public static boolean saveBitmapToSD(Bitmap bitmap, String path, String fileName) { boolean isSuccessful = false; if (bitmap == null) { return false; } File file = new File(path, fileName); try { if (!file.exists()) { file.createNewFile(); } FileOutputStream fileOutputStream = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fileOutputStream); fileOutputStream.flush(); fileOutputStream.close(); isSuccessful = true; } catch (Exception e) { Log.e(TAG, e.toString()); } return isSuccessful; } //获取网络视频第一帧图片,待检验 public static Bitmap getBitmap(Context context, String url, boolean isSD) { Bitmap bitmap = null; //MediaMetadataRetriever 是android中定义好的一个类,提供了统一 //的接口,用于从输入的媒体文件中取得帧和元数据; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { if (isSD) { //()根据文件路径获取缩略图 retriever.setDataSource(context, Uri.fromFile(new File(url))); } else { //根据网络路径获取缩略图 retriever.setDataSource(url, new HashMap()); } //获得第一帧图片 bitmap = retriever.getFrameAtTime(); } catch (IllegalArgumentException e) { Log.e(TAG, e.toString()); } finally { retriever.release(); } return bitmap; } //从url获取bitmap public static Bitmap getBitmap(String url) { Bitmap bm = null; try { URL iconUrl = new URL(url); URLConnection conn = iconUrl.openConnection(); HttpURLConnection http = (HttpURLConnection) conn; int length = http.getContentLength(); conn.connect(); // 获得图像的字符流 InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is, length); bm = BitmapFactory.decodeStream(bis); bis.close(); is.close();// 关闭流 } catch (Exception e) { e.printStackTrace(); } return bm; } /** * 调用拍照 */ public static void takePhoto(Activity activity, Uri outUri, int requestCode) { Intent intent = new Intent(); intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);//设置Action为拍照 intent.putExtra(MediaStore.EXTRA_OUTPUT, outUri);//将拍取的照片保存到指定URI activity.startActivityForResult(intent, requestCode); } /** * 选 相册图片 */ public static void selectFromGallery(Activity activity, int requestCode) { Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); activity.startActivityForResult(intent, requestCode); } //相册返回的uri转成Bitmap public static Bitmap getBitmapFromUri(Context context, Uri uri) { InputStream inputStream = null; try { inputStream = context.getContentResolver().openInputStream(uri); return BitmapFactory.decodeStream(inputStream); } catch (Exception e) { e.printStackTrace(); return null; } finally { try { if (inputStream != null) { inputStream.close(); } } catch (Exception e) { e.printStackTrace(); } } } //相册返回的uri转测path public static String getPathFromUri(Context context, Uri uri) { String scheme = uri.getScheme(); if (ContentResolver.SCHEME_FILE.equals(scheme)) {//file:///开头 return uri.getPath(); } if (ContentResolver.SCHEME_CONTENT.equals(scheme)) {//content://开头 String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = context.getContentResolver().query(uri, filePathColumn, null, null, null);//从系统表中查询指定Uri对应的照片 if (cursor == null) { return ""; } cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String path = cursor.getString(columnIndex); //获取照片路径 cursor.close(); return path; } return ""; } /** * 系统裁剪 * * @param inUri 输入路径 * @param outUri 输出路径 * @param outputX 输出宽 * @param outputY 输出高 * @param aspectX 输出X比 * @param aspectY 输出Y比 */ public static void cropFromGallery(Activity activity, int requestCode, Uri inUri, Uri outUri, int outputX, int outputY, int aspectX, int aspectY) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(inUri, "image/*"); intent.putExtra("crop", "true"); intent.putExtra("aspectX", aspectX); intent.putExtra("aspectY", aspectY); intent.putExtra("outputX", outputX); intent.putExtra("outputY", outputY); intent.putExtra("scale", true); intent.putExtra("return-data", false); intent.putExtra(MediaStore.EXTRA_OUTPUT, outUri);//裁剪后Uri路径 intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); //7.0才需要 if (Build.VERSION.SDK_INT >= 24) { intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); } intent = Intent.createChooser(intent, "裁剪图片"); activity.startActivityForResult(intent, requestCode); } }
[ "630455664@qq.com" ]
630455664@qq.com
f1d36c5c2e9b4c394d80707be8458bb828293633
c18d2967417480a1423f97295fefe390895eff83
/modules/sinoservices-common/src/main/java/com/sinoservices/util/StringUtil.java
a313da87eb498302a00189c753d4cf6f6bfde79c
[]
no_license
sumohen/doppler
4a0db438eef47eded5867cf12ea8c2cf8543cc10
16c5f356308897f0cbca79661bae01d7ced70faa
refs/heads/master
2020-12-31T03:36:07.491078
2016-07-25T09:14:08
2016-07-25T09:14:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
17,884
java
package com.sinoservices.util; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by liujinye on 14-7-29. */ public class StringUtil { /** * trim字符串中所有的非可见字符,包括字符串中间 * * @param str * @return * @author hexiufeng * @created 2012-03-16 */ public static final String alltrimWithWideSpace(String str) { if (str == null) return ""; // 转换为字符数组循环判断左边后者右边的字符是否是space char[] chArray = str.toCharArray(); int first = -1, last = -1; for (int i = 0; i < chArray.length; i++) { char ch = chArray[i]; if (!Character.isWhitespace(ch) && !Character.isSpaceChar(ch)) { first = i; break; } } for (int i = chArray.length - 1; i >= 0; i--) { char ch = chArray[i]; if (!Character.isWhitespace(ch) && !Character.isSpaceChar(ch)) { last = i; break; } } if (first == -1 || last == -1 || last < first) return ""; StringBuilder sb = new StringBuilder(); for (int i = first; i <= last; i++) { char ch = chArray[i]; if (!Character.isWhitespace(ch) && !Character.isSpaceChar(ch)) { sb.append(ch); } } return sb.toString(); } /** * 去除字符串中的左边的非可见字符,包括半角/全角空格、回车、换行符号 * * @param str * @return * @author hexiufeng * @created 2012-03-16 */ public static final String ltrimWithWideSpace(String str) { return rawTrimWithWideSpace(str, true, false); } /** * 去除字符串中的右边的非可见字符,包括半角/全角空格、回车、换行符号 * * @param str * @return * @author hexiufeng * @created 2012-03-16 */ public static final String rtrimWithWideSpace(String str) { return rawTrimWithWideSpace(str, false, true); } /** * 去除字符串中左边和右边的非可见字符,包括半角/全角空格、回车、换行符号 * * @param str * @return * @author hexiufeng * @created 2012-03-16 */ public static final String trimWithWideSpace(String str) { return rawTrimWithWideSpace(str, true, true); } /** * 去除字符串中的非可见字符,包括半角/全角空格、回车、换行符号 * * @param str * @param left,消除左边空格 * @param right,消除右边空格 * @return * @author hexiufeng * @created 2012-03-16 */ public static final String rawTrimWithWideSpace(String str, boolean left, boolean right) { if (str == null) return ""; // 转换为字符数组循环判断左边后者右边的字符是否是space char[] chArray = str.toCharArray(); int first = -1, last = -1; if (!left) { first = 0; } else { for (int i = 0; i < chArray.length; i++) { char ch = chArray[i]; if (!Character.isWhitespace(ch) && !Character.isSpaceChar(ch)) { first = i; break; } } } if (!right) { last = chArray.length - 1; } else { for (int i = chArray.length - 1; i >= 0; i--) { char ch = chArray[i]; if (!Character.isWhitespace(ch) && !Character.isSpaceChar(ch)) { last = i; break; } } } if (first == -1 || last == -1 || last < first) return ""; return String.valueOf(chArray, first, last - first + 1); } /** * 如果字符串为null,则返回"",否则,返回字符串.trim() * * @param str * @return * @author zhaolei * @created 2011-4-20 */ public static final String null2Trim(String str) { return str == null ? "" : str.trim(); } /** * 字符串转成InputStream * * @param str * @return * @author zhaolei * @created 2011-4-20 */ public static final InputStream str2InputStream(String str) { if (!null2Trim(str).equals("")) { ByteArrayInputStream stream = new ByteArrayInputStream(str.getBytes()); return stream; } return null; } /** * 冒泡法排序字符串 * * @param strArray * @return * @author zhaolei * @created 2011-4-20 */ public static final String[] sort(String[] strArray) { if (strArray == null) return null; String tmp = ""; for (int i = 0; i < strArray.length; i++) { for (int j = 0; j < strArray.length - i - 1; j++) { if (strArray[j].compareTo(strArray[j + 1]) < 0) { tmp = strArray[j]; strArray[j] = strArray[j + 1]; strArray[j + 1] = tmp; } } } return strArray; } /** * ISO转换成GBK * * @param str * @return * @throws UnsupportedEncodingException * @author zhaolei * @created 2011-4-20 */ public static final String iso2gbk(String str) throws UnsupportedEncodingException { return new String(str.getBytes("iso-8859-1"), "GBK"); } /** * GBK转换成ISO * * @param str * @return * @throws UnsupportedEncodingException * @author zhaolei * @created 2011-4-20 */ public static final String gbk2Iso(String str) throws UnsupportedEncodingException { return new String(str.getBytes("GBK"), "iso-8859-1"); } /** * GBK转换成UTF-8 * * @param str * @return * @author zhaolei * @created 2011-4-20 */ public static final String gbk2Utf8(String str) { try { return new String(str.getBytes("GBK"), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return str; } } /** * UTF-8转换成GBK * * @param str * @return * @author zhaolei * @created 2011-4-20 */ public static final String utf82Gbk(String str) { try { return new String(str.getBytes("UTF-8"), "GBK"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return str; } } /** * 正则表达式验证,查询(大小写敏感) * * @param str * @param regx 正则表达式 * @return * @author zhaolei * @created 2011-4-20 */ public static final boolean regexMatch(String str, String regx) { Pattern pattern = Pattern.compile(regx); Matcher matcher = pattern.matcher(str); return matcher.find(); } /** * 正则表达式验证,查询(大小写不敏感) * * @param str * @param regx 正则表达式 * @return * @author zhaolei * @created 2011-4-20 */ public static final boolean regexMatchInsensitive(String str, String regx) { Pattern pattern = Pattern.compile(regx, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(str); return matcher.find(); } /** * 全部替换字符串内的匹配字符串.大小写敏感 * * @param str * @param regx 正则表达式 * @param replaceStr 要替换的结果 * @return * @author zhaolei * @created 2011-4-20 */ public static final String regexReplaceAll(String str, String regx, String replaceStr) { Pattern pattern = Pattern.compile(regx); Matcher matcher = pattern.matcher(str); return matcher.replaceAll(replaceStr); } /** * 从开始截取字符串.汉字算两个字节.不把汉字从中间截开 * * @param symbol * @param len 长度 * @return * @throws UnsupportedEncodingException * @author zhaolei * @created 2011-4-20 */ public static final String subStringFromStartByByteNum(String symbol, int len) throws UnsupportedEncodingException { int counterOfDoubleByte; byte b[]; counterOfDoubleByte = 0; b = symbol.getBytes("GBK"); if (b.length <= len) return symbol; for (int i = 0; i < len; i++) { if (b[i] < 0) counterOfDoubleByte++; } if (counterOfDoubleByte % 2 == 0) return new String(b, 0, len, "GBK"); else return new String(b, 0, len - 1, "GBK"); } /** * 判断传入字符串是否为数字 * * @param str * @return * @author zhaolei * @created 2011-4-20 */ public static boolean isNumeric(String str) { Pattern pattern = Pattern.compile("[0-9]*"); Matcher isNum = pattern.matcher(str); if (!isNum.matches()) { return false; } return true; } /** * 过滤掉特殊HTML标签 * * @param str * @return * @author zhaolei * @created 2011-4-20 */ public static String subNormString(String str) { if (str == null) return ""; return str.replaceAll("<[.[^<]]*>", "").replace("<", ""); } /** * 扩展String的substring方法。过滤掉特殊HTML标签 * * @param str * @param beginIndex 开始位置 * @param endIndex 结束位置 * @return * @author zhaolei * @created 2011-4-20 */ public static String subNormString(String str, int beginIndex, int endIndex) { if (str == null) return ""; str = str.replaceAll("<[.[^<]]*>", ""); int length = str.length(); endIndex = (endIndex < 0) ? 0 : endIndex; endIndex = (endIndex > length) ? length : endIndex; beginIndex = (beginIndex < 0) ? 0 : beginIndex; beginIndex = (beginIndex > endIndex) ? endIndex : beginIndex; str = str.substring(beginIndex, endIndex); return str.replace("<", ""); } /** * 过滤null * * @param str * @return * @author zhaolei * @created 2011-4-20 */ public static String replaceNull(String str) { return (str == null) ? "" : str; } /** * 将null替换成想要的值 * * @param str * @param defaultStr * @return * @author zhaolei * @created 2011-4-20 */ public static String replaceNull(String str, String defaultStr) { return (str == null) ? defaultStr : str; } /** * 截断字符串 * * @param str * @param beginIndex 开始位置 * @param endIndex 结束位置 * @return * @author zhaolei * @created 2011-4-20 */ public static String substring(String str, int beginIndex, int endIndex) { if (str == null) return ""; int length = str.length(); endIndex = (endIndex < 0) ? 0 : endIndex; endIndex = (endIndex > length) ? length : endIndex; beginIndex = (beginIndex < 0) ? 0 : beginIndex; beginIndex = (beginIndex > endIndex) ? endIndex : beginIndex; str = str.substring(beginIndex, endIndex); return str; } /** * 返回转换的int值。 * * @param o * @param defaultint * @return * @author zhaolei * @created 2011-4-20 */ public static int parseInt(Object o, int defaultint) { try { return Integer.parseInt(String.valueOf(o)); } catch (NumberFormatException e) { return defaultint; } } /** * 检查字符串是否有内容。 * * @param obj * @return * @author lichengwu@sankuai.com * @created 2011-5-5 */ public static boolean isBlank(Object obj) { if (obj == null) return true; if (obj instanceof String) { String str = (String) obj; return str == null ? true : "".equals(str.trim()); } try { String str = String.valueOf(obj); return str == null ? true : "".equals(str.trim()); } catch (Exception e) { return true; } } /** * 检查字符串是否有内容。 * * @param obj * @return * @author lichengwu@sankuai.com * @created 2011-5-5 */ public static boolean isNotBlank(Object obj) { return !isBlank(obj); } /** * 检查参数是否有效字符串是否有内容,数字是否为非0 * * @param obj * @return * @author liuhujun@meituan.com * @created 2012-3-2 */ public static boolean isValid(Object obj) { if (obj == null) return false; if (obj instanceof String) { String str = (String) obj; return !"".equals(str.trim()); } if (obj instanceof Integer) { Integer i = (Integer) obj; return !i.equals(0); } try { String str = String.valueOf(obj); return !"".equals(str.trim()); } catch (Exception e) { return false; } } /** * 检查参数是否有效字符串是否有内容,数字是否为非0 * * @param obj * @return * @author liuhujun@meituan.com * @created 2012-3-2 */ public static boolean isInvalid(Object obj) { return !isValid(obj); } /** * 将空白字符串替换成指的字符串 * * @param dest * @param str * @return * @author lichengwu * @created 2011-7-11 */ public static String changeNull(String dest, String str) { if (!isBlank(dest)) { return dest; } return str; } /** * 将空白字符串替换成指的字符串 * * @param dest * @param str * @return * @author lichengwu * @created 2011-9-6 */ public static String changeNull(Object dest, String str) { if (!isBlank(dest)) { return String.valueOf(dest); } return str; } /** * 对特殊字符转移处理。 * 处理字符:{code}\s、\n、‘、“、<、>、&{code} * * @param in * @return in 为null时直接返回null */ public static String escapeString(String in) { if (in == null) { return null; } StringBuilder out = new StringBuilder(); for (int i = 0; in != null && i < in.length(); i++) { char c = in.charAt(i); if (c == '\n') { out.append("<br/>"); } else if (c == '\'') { out.append("&#039;"); } else if (c == '\"') { out.append("&#034;"); } else if (c == '<') { out.append("&lt;"); } else if (c == '>') { out.append("&gt;"); } else { out.append(c); } } return out.toString(); } /** * 对已转移的字符串进行还原。 * 处理字符:{code}\s、\n、‘、“、<、>、&{code} * * @param in * @return in 为null时直接返回null */ public static String unescapeString(String in) { if (in == null) { return null; } return in.replace("<br/>", "\n") .replace("&nbsp;", " ") .replace("&#039;", "\'") .replace("&#034;", "\"") .replace("&lt;", "<") .replace("&gt;", ">"); } /** * 把List组装为sql in语法的String * * @param list * @return */ public static String list2SqlString(List<?> list) { if (list.size() == 0) { return ""; } StringBuilder out = new StringBuilder(); for (int i = 0, n = list.size(); i < n; i++) { Object obj = list.get(i); if (obj instanceof Integer) { out.append(obj + ","); } else if (obj instanceof String) { out.append("'" + obj + "',"); } else { out.append("'" + obj.toString() + "',"); } } return out.substring(0, out.length() - 1); } /** * 把list转为delimit分隔的字符串 * * @param list * @param delimit * @return */ public static String list2String(List<?> list, String delimit) { if (list.size() == 0) { return ""; } StringBuilder out = new StringBuilder(); for (int i = 0, n = list.size(); i < n; i++) { Object obj = list.get(i); out.append(obj.toString() + delimit); } return out.substring(0, out.length() - delimit.length()); } /** * <pre> * 将obj转化成String * String.valueOf 方法会将null 转换成 "null" * 如果对象为null时希望返回null,可以用这个方法 * </pre> * * @param obj * @return * @author lichengwu * @created 2011-11-10 */ public static String valueOf(Object obj) { return obj == null ? null : String.valueOf(obj); } private static final Pattern PATTERN = Pattern.compile("^([a-zA-Z0-9_-]|\\.)+@([a-zA-Z0-9_-])+(\\.([a-zA-Z0-9_-])+)+$") ; }
[ "aa-aa537@163.com" ]
aa-aa537@163.com
d554b2da4a88f34f62803fcfdfca5f01a82006c3
32cd70512c7a661aeefee440586339211fbc9efd
/aws-java-sdk-directory/src/main/java/com/amazonaws/services/directory/model/transform/DirectoryVpcSettingsJsonMarshaller.java
2b50f12bf1231ec539ef469b356ec8d7306e88bd
[ "Apache-2.0" ]
permissive
twigkit/aws-sdk-java
7409d949ce0b0fbd061e787a5b39a93db7247d3d
0b8dd8cf5e52ad7ae57acd2ce7a584fd83a998be
refs/heads/master
2020-04-03T16:40:16.625651
2018-05-04T12:05:14
2018-05-04T12:05:14
60,255,938
0
1
Apache-2.0
2018-05-04T12:48:26
2016-06-02T10:40:53
Java
UTF-8
Java
false
false
2,911
java
/* * Copyright 2010-2016 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.directory.model.transform; import java.util.Map; import java.util.List; import com.amazonaws.AmazonClientException; import com.amazonaws.services.directory.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.util.BinaryUtils; import com.amazonaws.util.StringUtils; import com.amazonaws.util.IdempotentUtils; import com.amazonaws.util.StringInputStream; import com.amazonaws.protocol.json.*; /** * DirectoryVpcSettingsMarshaller */ public class DirectoryVpcSettingsJsonMarshaller { /** * Marshall the given parameter object, and output to a SdkJsonGenerator */ public void marshall(DirectoryVpcSettings directoryVpcSettings, StructuredJsonGenerator jsonGenerator) { if (directoryVpcSettings == null) { throw new AmazonClientException( "Invalid argument passed to marshall(...)"); } try { jsonGenerator.writeStartObject(); if (directoryVpcSettings.getVpcId() != null) { jsonGenerator.writeFieldName("VpcId").writeValue( directoryVpcSettings.getVpcId()); } com.amazonaws.internal.SdkInternalList<String> subnetIdsList = (com.amazonaws.internal.SdkInternalList<String>) directoryVpcSettings .getSubnetIds(); if (!subnetIdsList.isEmpty() || !subnetIdsList.isAutoConstruct()) { jsonGenerator.writeFieldName("SubnetIds"); jsonGenerator.writeStartArray(); for (String subnetIdsListValue : subnetIdsList) { if (subnetIdsListValue != null) { jsonGenerator.writeValue(subnetIdsListValue); } } jsonGenerator.writeEndArray(); } jsonGenerator.writeEndObject(); } catch (Throwable t) { throw new AmazonClientException( "Unable to marshall request to JSON: " + t.getMessage(), t); } } private static DirectoryVpcSettingsJsonMarshaller instance; public static DirectoryVpcSettingsJsonMarshaller getInstance() { if (instance == null) instance = new DirectoryVpcSettingsJsonMarshaller(); return instance; } }
[ "aws@amazon.com" ]
aws@amazon.com
c844a1ca7c0399a97d94021514d31aebfa08dbca
e2d493395489f9e374ac33c13256228dc092724a
/src/com/cpz/entity/CpzBuyerMsgEntity.java
0c81cd213e17892273942255493c61192d39626e
[]
no_license
ChinaPost/WebManagerCpz
a69264b9829315b03c3b8fe966ef46f6339379ea
e94495c48b58bba4dd4175e6a208f9d0bea0476f
refs/heads/master
2020-12-31T00:09:39.058291
2017-07-27T03:43:46
2017-07-27T03:43:46
86,560,606
0
0
null
null
null
null
UTF-8
Java
false
false
2,216
java
package com.cpz.entity; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import org.apache.commons.lang.builder.ToStringBuilder; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; //买家基本信息表 @Entity @Table(name = "T_CPZ_BUYER_MSG") public class CpzBuyerMsgEntity { private int userid;//会员号 private String moileno;//手机号码 private String nickname;//会员呢称 private String sex;//性别"0:女1:男" private String headurl;//会员头像图片URL地址 private String cstmlevel;//会员等级"预留01:铜牌会员02:银牌会员03:金牌会员" private String lonvalue;//注册时所在经度格式:小数点后2位 private String latvalue;//注册时所在纬度格式:小数点后2位 private String createtime;//注册时间格式:yyyymmdd hh24miss @Id @GeneratedValue(strategy=GenerationType.AUTO) public int getUserid() { return userid; } public void setUserid(int muserid) { userid = muserid; } public String getMoileno() { return moileno; } public void setMoileno(String mmoileno) { moileno = mmoileno; } public String getNickname() { return nickname; } public void setNickname(String mnickname) { nickname = mnickname; } public String getSex() { return sex; } public void setSex(String msex) { sex = msex; } public String getHeadurl() { return headurl; } public void setHeadurl(String mheadurl) { headurl = mheadurl; } public String getCstmlevel() { return cstmlevel; } public void setCstmlevel(String mcstmlevel) { cstmlevel = mcstmlevel; } public String getLonvalue() { return lonvalue; } public void setLonvalue(String mlonvalue) { lonvalue = mlonvalue; } public String getLatvalue() { return latvalue; } public void setLatvalue(String mlatvalue) { latvalue = mlatvalue; } public String getCreatetime() { return createtime; } public void setCreatetime(String mcreatetime) { createtime = mcreatetime; } //public String toString() { // return ToStringBuilder.reflectionToString(this); //} }
[ "chinaposta1@163.com" ]
chinaposta1@163.com
0104b6dfecec275f00f59b416672a5364722b4a2
3e68ac5a68ef64ff4875bd81d81e9e53d19a8af6
/Generation/Projeto_Java/src/repeticao_java/ex_for2.java
f1eb8c1ab0f6f6c30fae8360759f5d8fd882c6c0
[]
no_license
Matheus251170/gitTest
496b5159c0382d26ecf55b7fdd7bf566ca810415
81629e5d260aaa422657217b406e759f0e09f3dc
refs/heads/master
2023-06-24T21:10:37.900630
2021-07-08T16:37:56
2021-07-08T16:37:56
358,029,694
0
0
null
null
null
null
ISO-8859-1
Java
false
false
576
java
package repeticao_java; import java.util.*; public class ex_for2 { public static void main(String[] args) { /*FOR Ler 10 números e imprimir quantos são pares e quantos são ímpares. */ Random r = new Random(); int par=0, impar=0, num; for(int x = 0; x <= 10; x++) { num = r.nextInt(1000); System.out.println(num); if(num % 2 == 0) { par++; } else { impar++; } } System.out.println("\nO total de números pares foi " + par); System.out.println("\nO total de números impares foi " + impar); } }
[ "matheus251170@outlook.com" ]
matheus251170@outlook.com
ff37b0e1bb38155f2e7e0798ebbd935864c211e9
a313d673f697e215036980696937bd13f63eda86
/src/test/java/com/flouis/demo/test/MyBatisTest.java
40b8878cfaf4b7fb01508487ede21ef6a2af888f
[]
no_license
Flouis2017/springboot_demo
7c54e8a17dd176ad8a49611012a36b05b255570f
610366a85ac5d6d99b5f7073956d8ebbe77ada67
refs/heads/master
2022-06-27T05:48:19.957797
2020-11-03T07:08:18
2020-11-03T07:08:18
162,879,350
0
0
null
null
null
null
UTF-8
Java
false
false
1,877
java
package com.flouis.demo.test; import com.alibaba.fastjson.JSON; import com.flouis.demo.entity.SysPermission; import com.flouis.demo.entity.SysUser; import com.flouis.demo.mapper.SysPermissionMapper; import com.flouis.demo.mapper.SysUserMapper; import com.flouis.demo.util.TreeUtil; import com.flouis.demo.vo.ZTree; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.List; import java.util.Optional; @RunWith(SpringRunner.class) @SpringBootTest public class MyBatisTest { @Autowired private SysUserMapper sysUserMapper; @Autowired private SysPermissionMapper sysPermissionMapper; @Test public void queryTest(){ SysUser sysUser = this.sysUserMapper.selectByPrimaryKey(1L); System.out.println("queryTest -->\n" + sysUser.toString()); } @Test public void jdk8Test(){ List<SysPermission> permissionList = this.sysPermissionMapper.queryAll(); List<ZTree> zTreeList = TreeUtil.toZTreeList(permissionList); System.out.println("zTreeList: " + JSON.toJSONString(zTreeList)); Optional<ZTree> res = zTreeList.stream().filter(z -> z.getId() > 1).findAny(); System.out.println("res : " + res); Optional<ZTree> res2 = zTreeList.stream().filter(z -> z.getId() > 1).findFirst(); System.out.println("res2: " + res2); } @Test public void buildPermissionTreeTest(){ List<SysPermission> permissionList = this.sysPermissionMapper.queryAll(); List<ZTree> zTreeList = TreeUtil.toZTreeList(permissionList); System.out.println("zTreeList: " + JSON.toJSONString(zTreeList)); ZTree permissionTree = TreeUtil.buildPermissionTree(TreeUtil.getZTreeRoot(), zTreeList); System.out.println("permissionTree: " + JSON.toJSONString(permissionTree)); } }
[ "315587951@qq.com" ]
315587951@qq.com
6f21306426a6753998479c878f3c8044285ebace
48bc6ac62f8a030f6d82e181e8b67c0771eb80ca
/src/Main/ToolBar.java
4aa16778c674698bc24ebc8f1db8dc13095e0fe1
[]
no_license
gedemagt/PDFClipper
7436a5ff0f2200552da03f70e91e705e29619a6c
71bcc9dbb1e39b3432e7aa1fb01013bc216a04c7
refs/heads/master
2021-01-11T07:14:53.780036
2014-06-25T14:28:43
2014-06-25T14:28:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,848
java
package Main; import Elements.LazyPage; import Elements.PageChooser; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import javax.swing.*; import javax.swing.filechooser.FileFilter; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * Created by Jesper on 18-06-2014. */ public class ToolBar extends JToolBar { private List<LazyPage> pages = new ArrayList<LazyPage>(); private Saver saver; private PagePanel pagePanel; private SelectionManager manager; private PageChooser pageChooser; private PDDocument doc; public ToolBar(PagePanel pagePanel, SelectionManager manager) { this.saver = new Saver(); this.pagePanel = pagePanel; this.manager = manager; setAlignmentX(0); setFloatable(false); setupSaveButton(); setupLoadButton(); setupPageChooser(); /* getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK), "load"); getActionMap().put("load", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { load(); } }); getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK), "save"); getActionMap().put("save", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { save(); } });*/ //setupZoom(); } private void save() { JFileChooser fileChooser = new JFileChooser() { @Override public void approveSelection() { File f = getSelectedFile(); if (f.exists()) { int result = JOptionPane.showConfirmDialog(this, "Do you want to overwrite the existing file?", "File already exists", JOptionPane.YES_NO_CANCEL_OPTION); switch (result) { case JOptionPane.YES_OPTION: super.approveSelection(); return; case JOptionPane.NO_OPTION: return; case JOptionPane.CLOSED_OPTION: cancelSelection(); return; case JOptionPane.CANCEL_OPTION: cancelSelection(); return; } } super.approveSelection(); } }; fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "Portable Document Format (*.pdf)"; } @Override public boolean accept(File f) { if (f.isDirectory()) { return true; } else { return f.getName().toLowerCase().endsWith(".pdf"); } } }); int res = fileChooser.showSaveDialog(null); if (res == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); if(!file.getAbsolutePath().endsWith(".pdf")) file = new File(file.getAbsolutePath().concat(".pdf")); saver.save(pagePanel.getPage(), manager.getCurrentSelection(), file.getAbsolutePath()); } } /* private void setupZoom() { Double[] d = new Double[]{50.0, 60.0, 75.0, 80.0, 90.0, 100.0, 200.0}; final JComboBox<Double> comboBox = new JComboBox<Double>(d); comboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { pagePanel.zoom((Double) comboBox.getSelectedItem()); } }); add(comboBox); }*/ private void setupPageChooser() { pageChooser = new PageChooser(); pageChooser.setListener(new PageChooser.PageChooserListener() { @Override public void onNewPage(int i) { pagePanel.setLazyPage(pages.get(i)); } }); add(pageChooser); } private void load() { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "Portable Document Format (*.pdf)"; } @Override public boolean accept(File f) { if (f.isDirectory()) { return true; } else { return f.getName().toLowerCase().endsWith(".pdf"); } } }); int res = fileChooser.showOpenDialog(null); if (res == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { doc = PDDocument.loadNonSeq(file, null); } catch (IOException e1) { e1.printStackTrace(); } List<PDPage> docPages = doc.getDocumentCatalog().getAllPages(); pages.clear(); for(PDPage p : docPages) { pages.add(new LazyPage(p)); } pageChooser.setMax(pages.size()); pagePanel.setLazyPage(pages.get(0)); preloadPages(); } } private void setupLoadButton() { JButton b = new JButton("Load"); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { load(); } }); add(b); } private void preloadPages() { Thread d = new Thread(new Runnable() { @Override public void run() { for(LazyPage p : pages) { try { p.preLoadImage(); } catch (IOException e) { e.printStackTrace(); } } } }); d.start(); } private void setupSaveButton() { JButton button = new JButton("Save"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { save(); } }); add(button); } }
[ "gedemagt@gmail.com" ]
gedemagt@gmail.com
a3109001e8b0e2259eb1fda75fdc5adb784a017c
30082708be24e73792aceb8954bc28d40d0c5b02
/app/src/main/java/com/example/nene/movie20/activity/test.java
35f610fcf0438e9ffe4ab319bda9f9e1be2ff964
[]
no_license
liutianle/app
d3ea3673d8b1a0c5e85c032ab3703fd64d497722
2b2fe4dc882b7c99f72060e712508fdef8b283b7
refs/heads/master
2020-03-16T17:28:42.950379
2018-06-13T08:30:04
2018-06-13T08:30:04
132,834,038
0
0
null
null
null
null
UTF-8
Java
false
false
1,036
java
package com.example.nene.movie20.activity; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import com.example.nene.movie20.R; public class test extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } }
[ "2712118128@qq.com" ]
2712118128@qq.com
ce3a570120c7edb303464eec27058a6f21724871
6c92f5e251a85ead45afcaf675eaceee18db86ba
/src/java/Classes/HibernateUtil.java
48fc957ba1b9db7adddf79f0c84820ba4539844a
[]
no_license
abdoulfatah/J2EE-Location-de-films
686da31aee858851296c5fbb479122163f774bb3
2b1c215d6c0b0eee1f314e9c89388dbc2e365b69
refs/heads/master
2021-05-30T22:46:28.995919
2016-02-02T23:11:35
2016-02-02T23:11:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,038
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 Classes; import org.hibernate.cfg.AnnotationConfiguration; import org.hibernate.SessionFactory; /** * Hibernate Utility class with a convenient method to get Session Factory * object. * * @author scra */ public class HibernateUtil { private static final SessionFactory sessionFactory; static { try { // Create the SessionFactory from standard (hibernate.cfg.xml) // config file. sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory(); } catch (Throwable ex) { // Log the exception. System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } }
[ "albanbertolini@gmail.com" ]
albanbertolini@gmail.com
962ebf01cd16020a7ae6290d5990618d6303f3d9
8905c11895d283c5c4cdd59fc2425d7309dcb237
/assets/src/main/java/com/kgc/tcmp077/wangyf/entity/Assets.java
df30d4bbe21cc0f90f95210624e7fdf08220f0f1
[ "Apache-2.0" ]
permissive
wangyifan0000/Day1004
dc4f687910088c2f14fb1e626f02b4deeda7c4f4
d1a141405839ff4b67b867f10cf06bc3934e8a18
refs/heads/main
2022-12-24T00:14:53.260697
2020-10-04T02:56:48
2020-10-04T02:56:48
301,012,072
0
0
null
null
null
null
UTF-8
Java
false
false
1,052
java
package com.kgc.tcmp077.wangyf.entity; import java.util.Date; public class Assets { private Long d; private String assetid; private String assetname; private String assettype; private Date intodate; public Long getD() { return d; } public void setD(Long d) { this.d = d; } public String getAssetid() { return assetid; } public void setAssetid(String assetid) { this.assetid = assetid == null ? null : assetid.trim(); } public String getAssetname() { return assetname; } public void setAssetname(String assetname) { this.assetname = assetname == null ? null : assetname.trim(); } public String getAssettype() { return assettype; } public void setAssettype(String assettype) { this.assettype = assettype == null ? null : assettype.trim(); } public Date getIntodate() { return intodate; } public void setIntodate(Date intodate) { this.intodate = intodate; } }
[ "2893084319" ]
2893084319
b33413428d288f3a2ea4894370cd8ad53b2805d5
df91fb57f5cb7271550a8433c4899e04e9902fae
/Competencia/codigos-grupos/simple/Nodo.java
4d4e701eb5e244d6b92aabaf5f26ff2d87045c05
[]
no_license
JFCowboy/Sistemas-Inteligentes
bbcd191bcdf47cef2b2caf99c9083166221ce651
b6211c1fe422c27769b2b5d22d698c3b9099a49a
refs/heads/master
2020-04-05T23:03:21.337470
2014-06-26T12:18:57
2014-06-26T12:18:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,229
java
package unalcol.agents.examples.labyrinth.multeseo.simple; public class Nodo { public final int NORTE = 0; public final int ORIENTE = 1; public final int SUR = 2; public final int OCCIDENTE = 3; private int x; private int y; private boolean visitado = false; private Nodo hijos[] = new Nodo[4]; private Nodo predecesor; public Nodo() { this(0, 0); } public Nodo(int _x, int _y) { x = _x; y = _y; inicializar(); } private void inicializar() { for (int x = 0; x < 4; x++) { getHijos()[x] = null; } } public void insertarHijo(int pos) { getHijos()[pos] = new Nodo(getX(), getY()); if (pos == NORTE) { hijos[pos].setY(hijos[pos].getY() - 1); } if (pos == ORIENTE) { hijos[pos].setX(hijos[pos].getX() + 1); } if (pos == SUR) { hijos[pos].setY(hijos[pos].getY() + 1); } if (pos == OCCIDENTE) { hijos[pos].setX(hijos[pos].getX() - 1); } } /** * @return the x */ public int getX() { return x; } /** * @param x the x to set */ public void setX(int x) { this.x = x; } /** * @return the y */ public int getY() { return y; } /** * @param y the y to set */ public void setY(int y) { this.y = y; } /** * @return the visitado */ public boolean isVisitado() { return visitado; } /** * @param visitado the visitado to set */ public void setVisitado(boolean visitado) { this.visitado = visitado; } /** * @return the hijos */ public Nodo[] getHijos() { return hijos; } /** * @param hijos the hijos to set */ public void setHijos(Nodo[] hijos) { this.hijos = hijos; } /** * @return the predecesor */ public Nodo getPredecesor() { return predecesor; } /** * @param predecesor the predecesor to set */ public void setPredecesor(Nodo predecesor) { this.predecesor = predecesor; } }
[ "cowboy9209@gmail.com" ]
cowboy9209@gmail.com
c6ec604bb3af55598a7b5452e7c942fb430b323b
6cb74307ba11f96e1b91e2cbecca3977dde7c627
/com.duff.dynamicreport/src/com/duff/dynamicreport/xml/TimePeriodSeries.java
6f57f75beca027737031a6625fd15975ba6ac23c
[]
no_license
Dufler/com.duff.dnd
9e877372310d08daf5b4cf3fbd4c404e7b50b48d
0bf730afd32df66a14b346b3a45f801c4a43555d
refs/heads/master
2020-09-17T07:30:28.402413
2019-12-08T20:32:08
2019-12-08T20:32:08
224,036,669
0
0
null
null
null
null
IBM852
Java
false
false
5,852
java
// // Questo file Ŕ stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.8-b130911.1802 // Vedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Qualsiasi modifica a questo file andrÓ persa durante la ricompilazione dello schema di origine. // Generato il: 2019.11.25 alle 11:10:35 PM CET // package com.duff.dynamicreport.xml; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Classe Java per anonymous complex type. * * <p>Il seguente frammento di schema specifica il contenuto previsto contenuto in questa classe. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{http://jasperreports.sourceforge.net/jasperreports}seriesExpression" minOccurs="0"/> * &lt;element ref="{http://jasperreports.sourceforge.net/jasperreports}startDateExpression" minOccurs="0"/> * &lt;element ref="{http://jasperreports.sourceforge.net/jasperreports}endDateExpression" minOccurs="0"/> * &lt;element ref="{http://jasperreports.sourceforge.net/jasperreports}valueExpression" minOccurs="0"/> * &lt;element ref="{http://jasperreports.sourceforge.net/jasperreports}labelExpression" minOccurs="0"/> * &lt;element ref="{http://jasperreports.sourceforge.net/jasperreports}itemHyperlink" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "seriesExpression", "startDateExpression", "endDateExpression", "valueExpression", "labelExpression", "itemHyperlink" }) @XmlRootElement(name = "timePeriodSeries") public class TimePeriodSeries { protected SeriesExpression seriesExpression; protected StartDateExpression startDateExpression; protected EndDateExpression endDateExpression; protected ValueExpression valueExpression; protected LabelExpression labelExpression; protected ItemHyperlink itemHyperlink; /** * Recupera il valore della proprietÓ seriesExpression. * * @return * possible object is * {@link SeriesExpression } * */ public SeriesExpression getSeriesExpression() { return seriesExpression; } /** * Imposta il valore della proprietÓ seriesExpression. * * @param value * allowed object is * {@link SeriesExpression } * */ public void setSeriesExpression(SeriesExpression value) { this.seriesExpression = value; } /** * Recupera il valore della proprietÓ startDateExpression. * * @return * possible object is * {@link StartDateExpression } * */ public StartDateExpression getStartDateExpression() { return startDateExpression; } /** * Imposta il valore della proprietÓ startDateExpression. * * @param value * allowed object is * {@link StartDateExpression } * */ public void setStartDateExpression(StartDateExpression value) { this.startDateExpression = value; } /** * Recupera il valore della proprietÓ endDateExpression. * * @return * possible object is * {@link EndDateExpression } * */ public EndDateExpression getEndDateExpression() { return endDateExpression; } /** * Imposta il valore della proprietÓ endDateExpression. * * @param value * allowed object is * {@link EndDateExpression } * */ public void setEndDateExpression(EndDateExpression value) { this.endDateExpression = value; } /** * Recupera il valore della proprietÓ valueExpression. * * @return * possible object is * {@link ValueExpression } * */ public ValueExpression getValueExpression() { return valueExpression; } /** * Imposta il valore della proprietÓ valueExpression. * * @param value * allowed object is * {@link ValueExpression } * */ public void setValueExpression(ValueExpression value) { this.valueExpression = value; } /** * Recupera il valore della proprietÓ labelExpression. * * @return * possible object is * {@link LabelExpression } * */ public LabelExpression getLabelExpression() { return labelExpression; } /** * Imposta il valore della proprietÓ labelExpression. * * @param value * allowed object is * {@link LabelExpression } * */ public void setLabelExpression(LabelExpression value) { this.labelExpression = value; } /** * Recupera il valore della proprietÓ itemHyperlink. * * @return * possible object is * {@link ItemHyperlink } * */ public ItemHyperlink getItemHyperlink() { return itemHyperlink; } /** * Imposta il valore della proprietÓ itemHyperlink. * * @param value * allowed object is * {@link ItemHyperlink } * */ public void setItemHyperlink(ItemHyperlink value) { this.itemHyperlink = value; } }
[ "Duff@Duff-PC" ]
Duff@Duff-PC
1f6ed48c3b65caf37f560879b4a6f0fd99e94239
0498b2a550adc40b48da03a5c7adcd7c3d3a037d
/errai-demos/errai-cdi-demo-tagcloud/src/main/java/org/jboss/errai/cdi/demo/tagcloud/client/shared/Updated.java
daddcc40c2c0414dab6ba4b3b4db5fc94f63ca83
[]
no_license
sinaisix/errai
ba5cd3db7a01f1a0829086635128d918f25c0122
7e7e0a387d02b7366cbed9947d6c969f21ac655f
refs/heads/master
2021-01-18T08:03:04.809057
2015-02-24T00:10:16
2015-02-24T00:14:28
31,277,838
1
0
null
2015-02-24T19:32:46
2015-02-24T19:32:46
null
UTF-8
Java
false
false
1,182
java
/** * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual * contributors by the @authors tag. See the copyright.txt in the * distribution for a full listing of individual contributors. * * 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.jboss.errai.cdi.demo.tagcloud.client.shared; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.inject.Qualifier; @Qualifier @Target({ ElementType.FIELD, ElementType.PARAMETER }) @Retention(RetentionPolicy.RUNTIME) public @interface Updated { }
[ "pslegr@redhat.com" ]
pslegr@redhat.com
6bb69a900ffb3569e7d3b467280621060c5587a2
dc3f341cb7bb5fa019ca385262630281dde72586
/src/main/java/com/tsixi/ddt2/test/utils/Excel.java
a4f48e2605fb854b9f9aecefa90f2b1104db1861
[]
no_license
TestXu/ddt-gm
7324f5cbf3dcfd7108587b1b8087952434ac9a9c
91676f4b85e15edc32d2585fca7070620e6241f8
refs/heads/master
2021-01-20T10:06:50.070828
2017-05-27T04:06:43
2017-05-27T04:06:43
90,324,997
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package com.tsixi.ddt2.test.utils; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URL; /** * 读取Excel */ public class Excel { private String file; public Workbook workbook; private InputStream input = null; public Excel(String file) { this.file = file; ClassLoader classLoader = Excel.class.getClassLoader(); URL resource = classLoader.getResource(file); String path = resource.getPath(); try { input = new FileInputStream(path); } catch (FileNotFoundException e) { e.printStackTrace(); System.out.println("打开文件错误"); } //获得一个工作簿对象 try { workbook = new XSSFWorkbook(input); } catch (IOException e) { e.printStackTrace(); System.out.println("读取Excel文件错误"); } } public void close() { try { input.close(); workbook.close(); } catch (IOException e) { e.printStackTrace(); System.out.println("关闭文件出错"); } } }
[ "taoxu858@163.com" ]
taoxu858@163.com
2e53f8647a7ae562b5d235907c886b5670fa48ec
a59a39687e6995aa6df60a67cd94e747e624af17
/Utility/src/com/ying/util/chickenRabbit/MathMaster.java
d973bfe13cfab746002990787ef0debd522a810a
[]
no_license
hsnyxfhyqhyh/java
e3ea46a94ca57ee761a7fd5da9f196899dcaec08
20405ff8c766cc77f5cd40de464c70cbdb2afde7
refs/heads/master
2021-01-17T08:59:03.755952
2017-12-11T14:41:15
2017-12-11T14:41:15
15,812,522
0
0
null
null
null
null
UTF-8
Java
false
false
2,216
java
package com.ying.util.chickenRabbit; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class MathMaster { /** * @param args */ public static void main(String[] args) { ArrayList<Question> al = new ArrayList(); String questions = ""; String answers = ""; int loop = 2; //load the questions // loadFractionQuestions(al, loop); loadCategory1Questions(al, loop); // loadCategory2Questions(al, loop); //shuffle the questions. Collections.shuffle(al); for (int i=0; i<al.size(); i++){ Question q = (Question)al.get(i); int count = i+1; questions = questions + count + "> \n" + q.getQuestion() + "\n\n"; answers = answers + count + "> \n" + q.getAnswer() + "\n\n"; } System.out.println(questions + "\n\n\n\n"); System.out.println(answers); } private static void loadFractionQuestions(ArrayList al, int loop) { if (loop <1) return; FractionQuestions fq = new FractionQuestions(); for (int i=0; i<loop; i++ ){ al.add(fq.FractionGen()); al.add(fq.FractionGen1()); al.add(fq.BrickGen()); al.add(fq.HarryPotterGen()); al.add(fq.ChickenGen()); } } private static void loadCategory1Questions(ArrayList al, int loop) { if (loop <1) return; Category1 c1 = new Category1(); for (int i=0; i<loop; i++ ){ al.add(c1.FruitGen()); al.add(c1.TeaGen()); al.add(c1.bottleGen()); al.add(c1.coinGen()); al.add(c1.chickenRabbitGen()); al.add(c1.chickenRabbitGen2()); al.add(c1.SquirrelGen()); al.add(c1.redBluePencilGen()); al.add(c1.chessGen()); al.add(c1.balloonGen()); al.add(c1.stampGen()); al.add(c1.mathExamGen()); al.add(c1.mathGen2 ()); al.add(c1.projectGen()); al.add(c1.typingGen()); /* //3 variables al.add(c1.insectGen()); al.add(c1.snackGen()); */ } } //3 variables, 2 equations private static void loadCategory2Questions(ArrayList al, int loop) { if (loop <1) return; Category2 c2 = new Category2(); for (int i=0; i<loop; i++ ){ al.add(c2.mathGen3()); al.add(c2.busTripGen() ); } } }
[ "xfyang46@gmail.com" ]
xfyang46@gmail.com
34e4dbd21b4f87d189c848c823266bf17b387b33
0cb4dc7d32c798dcc56c96c8db56c6b06794a6df
/src/java/ma/ensa/linked/metier/TypeCompte.java
48217597213229fcaa0018b3012841fe3bab7893
[]
no_license
medamineosm/LinkedEnsa
719c4d381e454ed7150a5861b129faab2910820b
b8425dab21cd9171cc1ef26f73165b0ae752d71b
refs/heads/master
2021-01-10T08:08:16.770844
2015-06-13T13:32:34
2015-06-13T13:32:34
36,518,162
1
0
null
null
null
null
UTF-8
Java
false
false
472
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ma.ensa.linked.metier; /** * * @author Yunho */ public enum TypeCompte { PROFESSEUR("prof"),ETUDIANT("etudiant"),ADMINISTRATEUR("admin"),ENTREPRISE("entreprise"); private String intitule; TypeCompte(String intitule) { this.intitule=intitule; } public String getIntitule() { return intitule; } }
[ "m.amine.osm@gmail.com" ]
m.amine.osm@gmail.com
fd470c52bfbe0513173839d66d3408109117e5dc
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_c3221cb4b6d4ba90ef7f00cd9de31f0620e4c7d4/LoginActivity/9_c3221cb4b6d4ba90ef7f00cd9de31f0620e4c7d4_LoginActivity_t.java
e49878371457d25bcf564ba066c0e6baf644c3e2
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
10,411
java
package com.friedran.appengine.dashboard.gui; import android.accounts.Account; import android.accounts.AccountManager; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.provider.Settings; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.Toast; import com.friedran.appengine.dashboard.R; import com.friedran.appengine.dashboard.client.AppEngineDashboardAPI; import com.friedran.appengine.dashboard.client.AppEngineDashboardAuthenticator; import com.friedran.appengine.dashboard.client.AppEngineDashboardClient; import com.friedran.appengine.dashboard.utils.AnalyticsUtils; import com.friedran.appengine.dashboard.utils.DashboardPreferences; import com.google.analytics.tracking.android.EasyTracker; import com.google.analytics.tracking.android.Tracker; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class LoginActivity extends Activity implements View.OnClickListener, AppEngineDashboardAuthenticator.OnUserInputRequiredCallback, AppEngineDashboardClient.PostExecuteCallback { public static final String EXTRA_ACCOUNT = "EXTRA_ACCOUNT"; protected LinearLayout mEnterAccountLayout; protected Spinner mAccountSpinner; protected Button mLoginButton; protected ProgressDialog mProgressDialog; protected AppEngineDashboardClient mAppEngineClient; protected DashboardPreferences mPreferences; protected List<Account> mAccounts; protected Account mSavedAccount; protected Tracker mTracker; // State parameters protected boolean mLoginInProgress; protected boolean mHasRequestedUserInput; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); mEnterAccountLayout = (LinearLayout) findViewById(R.id.login_enter_account_layout); mAccountSpinner = (Spinner) findViewById(R.id.login_account_spinner); mLoginButton = (Button) findViewById(R.id.login_button); mLoginButton.setOnClickListener(this); mProgressDialog = new ProgressDialog(this); mProgressDialog.setTitle("Loading"); mPreferences = new DashboardPreferences(this); mSavedAccount = mPreferences.getSavedAccount(); mLoginInProgress = false; mHasRequestedUserInput = false; mTracker = AnalyticsUtils.getTracker(this); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); } @Override protected void onStart() { super.onStart(); EasyTracker.getInstance().activityStart(this); // Refresh the accounts and spinner everytime the activity is restarted. mAccounts = Arrays.asList(AccountManager.get(this).getAccountsByType("com.google")); mAccountSpinner.setAdapter(createAccountsSpinnerAdapter(mAccounts)); // Set the login and spinner items according to whether there's any account if (mAccounts.size() == 0) { mAccountSpinner.setVisibility(View.INVISIBLE); mLoginButton.setText(R.string.add_existing_account); mTracker.sendEvent("ui_event", "activity_shown", "show_add_account", null); } else { mAccountSpinner.setVisibility(View.VISIBLE); mLoginButton.setText(R.string.login); mTracker.sendEvent("ui_event", "activity_shown", "show_login", null); } } private ArrayAdapter<String> createAccountsSpinnerAdapter(List<Account> accounts) { List<String> accountNames = new ArrayList<String>(); for (Account account : accounts) { accountNames.add(account.name); } ArrayAdapter<String> adapter = new ArrayAdapter<String>( this, android.R.layout.simple_spinner_item, new ArrayList<String>(accountNames)); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); return adapter; } @Override protected void onResume() { super.onResume(); // If we're in the middle of the login process, then continue automatically if (mLoginInProgress) { mEnterAccountLayout.setVisibility(View.INVISIBLE); mAppEngineClient.executeAuthentication(); // if we have a saved account then automatically start the login process with it } else if (mSavedAccount != null) { mEnterAccountLayout.setVisibility(View.INVISIBLE); startAuthentication(mSavedAccount); // Nothing? Wait for the "Login" click } else { mEnterAccountLayout.setVisibility(View.VISIBLE); } } /** Happens when the login button is clicked */ @Override public void onClick(View v) { // No accounts configured if (mAccounts.size() == 0) { mTracker.sendEvent("ui_action", "button_click", "add_account", null); startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT)); return; } mTracker.sendEvent("ui_action", "button_click", "login", null); Account selectedAccount = mAccounts.get(mAccountSpinner.getSelectedItemPosition()); startAuthentication(selectedAccount); } private void startAuthentication(Account selectedAccount) { mAppEngineClient = new AppEngineDashboardClient(selectedAccount, this, this, this); AppEngineDashboardAPI appEngineAPI = AppEngineDashboardAPI.getInstance(); appEngineAPI.setClient(selectedAccount, mAppEngineClient); showProgressDialog("Authenticating with Google AppEngine..."); mLoginInProgress = true; mAppEngineClient.executeAuthentication(); } // Called when the user approval is required to authorize us @Override public void onUserInputRequired(Intent accountManagerIntent) { // If we've already requested the user input and failed, then stop the login process and // wait for him to click the "Login" button again. if (mHasRequestedUserInput) { dismissProgress(true); resetSavedAccount(); mTracker.sendEvent("ui_event", "auth_error", "user_disapproved", null); return; } mHasRequestedUserInput = true; startActivity(accountManagerIntent); } // Called when the authentication is completed @Override public void onPostExecute(Bundle resultBundle) { boolean result = resultBundle.getBoolean(AppEngineDashboardClient.KEY_RESULT); Log.i("LoginActivity", "Authentication done, result = " + result); if (result) { onSuccessfulAuthentication(); } else { onFailedLogin("Authentication failed, please make sure you have Internet connectivity and try again"); mTracker.sendEvent("ui_event", "auth_error", "auth_failed", null); } } private void onSuccessfulAuthentication() { showProgressDialog("Retrieving AppEngine applications..."); mAppEngineClient.executeGetApplications(new AppEngineDashboardClient.PostExecuteCallback() { @Override public void onPostExecute(Bundle resultBundle) { boolean result = resultBundle.getBoolean(AppEngineDashboardClient.KEY_RESULT); Log.i("LoginActivity", "GetApplications done, result = " + result); Account targetAccount = mAppEngineClient.getAccount(); if (!result) { onFailedLogin("Failed retrieving list of applications for " + targetAccount.name); mTracker.sendEvent("ui_event", "auth_error", "get_applications_failed", null); return; } if (resultBundle.getStringArrayList(AppEngineDashboardClient.KEY_APPLICATIONS).size() == 0) { onFailedLogin("No applications found for " + targetAccount.name); mTracker.sendEvent("ui_event", "auth_error", "no_applications", null); return; } onSuccessfulLogin(targetAccount); dismissProgress(true); } }); } private void onFailedLogin(String message) { dismissProgress(true); resetSavedAccount(); Toast.makeText(LoginActivity.this, message, 5000).show(); } private void onSuccessfulLogin(Account account) { mTracker.sendEvent("ui_event", "auth", "auth_successful", null); // Updates the saved account if required if (!account.equals(mSavedAccount)) { mPreferences.saveAccount(account); Log.i("LoginActivity", "Saved account " + account); } Intent intent = new Intent(this, DashboardActivity.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK) .putExtra(LoginActivity.EXTRA_ACCOUNT, account); startActivity(intent); } @Override protected void onPause() { super.onPause(); dismissProgress(false); } @Override protected void onStop() { super.onStop(); EasyTracker.getInstance().activityStop(this); dismissProgress(false); } private void showProgressDialog(String message) { mProgressDialog.setMessage(message); mProgressDialog.show(); mLoginButton.setClickable(false); } private void dismissProgress(boolean stopLoginProcess) { if (mProgressDialog.isShowing()) mProgressDialog.dismiss(); mLoginButton.setClickable(true); if (stopLoginProcess) { Log.i("LoginActivity", "Login progress stopped"); mLoginInProgress = false; mHasRequestedUserInput = false; } } private void resetSavedAccount() { mPreferences.resetSavedAccount(); mSavedAccount = null; mEnterAccountLayout.setVisibility(View.VISIBLE); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
904274003bc93aeb0b193931cc9ed3f1b2b2511c
61173c4ea8b4eb913ee1a18ae88abcc18201f715
/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestMetaStoreHandler.java
b86d736a89dabd0a77506d4680b396aece242eb4
[ "BSD-3-Clause", "Python-2.0", "MIT", "GPL-1.0-or-later", "Apache-2.0", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "JSON" ]
permissive
futubda/hive
5a106e4382dbaed3fe0929b9c0f8f7154bbe3049
a8e46da4cf86d9e629f880780e8e86a5c0cc368b
refs/heads/master
2020-11-28T06:51:07.018722
2019-12-23T10:49:21
2019-12-23T10:49:21
229,727,542
1
0
Apache-2.0
2019-12-23T10:14:30
2019-12-23T10:14:29
null
UTF-8
Java
false
false
4,388
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hive.ql; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.conf.HiveConf.ConfVars; import org.apache.hadoop.hive.metastore.conf.MetastoreConf; import org.apache.hadoop.hive.metastore.dbinstall.rules.DatabaseRule; import org.apache.hadoop.hive.metastore.dbinstall.rules.Derby; import org.apache.hadoop.hive.metastore.dbinstall.rules.Mssql; import org.apache.hadoop.hive.metastore.dbinstall.rules.Mysql; import org.apache.hadoop.hive.metastore.dbinstall.rules.Oracle; import org.apache.hadoop.hive.metastore.dbinstall.rules.Postgres; import org.apache.hadoop.hive.metastore.txn.TxnDbUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * QTestMetaStoreHandler is responsible for wrapping the logic of handling different metastore * databases in qtests. */ public class QTestMetaStoreHandler { private static final Logger LOG = LoggerFactory.getLogger(QTestMetaStoreHandler.class); private String metastoreType; private DatabaseRule rule; public QTestMetaStoreHandler() { this.metastoreType = QTestSystemProperties.getMetaStoreDb() == null ? "derby" : QTestSystemProperties.getMetaStoreDb(); this.rule = getDatabaseRule(metastoreType).setVerbose(false); LOG.info(String.format("initialized metastore type '%s' for qtests", metastoreType)); } public DatabaseRule getRule() { return rule; } public boolean isDerby() { return "derby".equalsIgnoreCase(metastoreType); } public QTestMetaStoreHandler setMetaStoreConfiguration(HiveConf conf) { conf.setVar(ConfVars.METASTOREDBTYPE, getDbTypeConfString()); MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CONNECT_URL_KEY, rule.getJdbcUrl()); MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CONNECTION_DRIVER, rule.getJdbcDriver()); MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CONNECTION_USER_NAME, rule.getHiveUser()); MetastoreConf.setVar(conf, MetastoreConf.ConfVars.PWD, rule.getHivePassword()); LOG.info(String.format("set metastore connection to url: %s", MetastoreConf.getVar(conf, MetastoreConf.ConfVars.CONNECT_URL_KEY))); return this; } private DatabaseRule getDatabaseRule(String metastoreType) { switch (metastoreType) { case "postgres": return new Postgres(); case "oracle": return new Oracle(); case "mysql": return new Mysql(); case "mssql": case "sqlserver": return new Mssql(); default: return new Derby(); } } private String getDbTypeConfString() {// "ORACLE", "MYSQL", "MSSQL", "POSTGRES" return "sqlserver".equalsIgnoreCase(metastoreType) ? "MSSQL" : metastoreType.toUpperCase(); } public void beforeTest() throws Exception { getRule().before(); if (!isDerby()) {// derby is handled with old QTestUtil logic (TxnDbUtil stuff) getRule().install(); } } public void afterTest(QTestUtil qt) throws Exception { getRule().after(); // special qtest logic, which doesn't fit quite well into Derby.after() if (isDerby()) { TxnDbUtil.cleanDb(qt.getConf()); TxnDbUtil.prepDb(qt.getConf()); } } public void setSystemProperties() { System.setProperty(MetastoreConf.ConfVars.CONNECT_URL_KEY.getVarname(), rule.getJdbcUrl()); System.setProperty(MetastoreConf.ConfVars.CONNECTION_DRIVER.getVarname(), rule.getJdbcDriver()); System.setProperty(MetastoreConf.ConfVars.CONNECTION_USER_NAME.getVarname(), rule.getHiveUser()); System.setProperty(MetastoreConf.ConfVars.PWD.getVarname(), rule.getHivePassword()); } }
[ "bodorlaszlo0202@gmail.com" ]
bodorlaszlo0202@gmail.com
9a554f544abe30aa1b481d203d7cadd1e90d5911
a7863ed9e15ee607178ee848d118cac069e7ab91
/src/lab2/ArraySorter.java
5e4dfbb11091d467b965047d6744598abfc0bec5
[]
no_license
BodyaTheSlayer/Lab2
0fe94aa490fc86637d35792de6d2fa733f97307e
c31daac5c2eca525623fb6c8b6616690000e1ddd
refs/heads/master
2020-04-30T02:23:55.832010
2019-03-28T16:58:41
2019-03-28T16:58:41
176,558,358
0
0
null
null
null
null
UTF-8
Java
false
false
1,885
java
package lab2; public class ArraySorter { public static void sort(double[] array) { //Метод сортировки int i; boolean hasSwapped = true; while (hasSwapped) { int nPairs = array.length; hasSwapped = false; nPairs--; i = 0; while (i < nPairs) { if (array[i] > array[i + 1]) { swap(i, array); hasSwapped = true; } i++; } } } public static double[] sortFor(double[] array) { //Метод сортировки boolean hasSwapped = true; for (int nPairs = array.length; hasSwapped; nPairs--) { hasSwapped = false; for (int i = 1; i < nPairs - 1; i++) { if (array[i] > array[i + 1]) { swap(i, array); hasSwapped = true; } } } return array; } public static double[] sortSelect(double[] array) {//Метод сортировки int minIdx; for (int i = 0;i < array.length; i++) { double min = array[i]; minIdx = 0; for (int j = i+1; j < array.length; j++) { if (min > array[j]) { min = array[j]; minIdx = j; } } if (minIdx != 0){ swapPair(i,minIdx,array); } } return array; } private static void swap(int i, double[] array) { //Метод Swap double tmp = array[i]; array[i] = array[i + 1]; array[i + 1] = tmp; } private static void swapPair(int i,int j, double[] array) { //Метод Swap double tmp = array[i]; array[i] = array[j]; array[j] = tmp; } }
[ "venomcob@gmail.com" ]
venomcob@gmail.com
dc89113f38cb828aca227144b460cc75200d8a60
340324a0b65a60008eb39c5859157a465662056b
/app/src/main/java/com/wycd/yushangpu/views/StickyScrollView.java
3b50409210660bc0e480a42f1cec2b182d983691
[]
no_license
guting50/Cashier
d2c3a9604e7554a7381f4d44fa22f330c73a2d33
011598a55eb0569c7f5e44c55061e3268ebddaf4
refs/heads/master
2022-11-25T03:39:18.534413
2019-12-07T09:59:05
2019-12-07T09:59:05
225,297,402
0
1
null
null
null
null
UTF-8
Java
false
false
12,150
java
package com.wycd.yushangpu.views; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.animation.AlphaAnimation; import android.widget.ScrollView; import java.util.ArrayList; public class StickyScrollView extends ScrollView { /** * Tag for views that should stick and have constant drawing. e.g. * TextViews, ImageViews etc */ public static final String STICKY_TAG = "sticky"; /** * Flag for views that should stick and have non-constant drawing. e.g. * Buttons, ProgressBars etc */ public static final String FLAG_NONCONSTANT = "-nonconstant"; /** * Flag for views that have aren't fully opaque */ public static final String FLAG_HASTRANSPARANCY = "-hastransparancy"; private ArrayList<View> stickyViews; private View currentlyStickingView; private float stickyViewTopOffset; private boolean redirectTouchesToStickyView; private boolean clippingToPadding; private boolean clipToPaddingHasBeenSet; private final Runnable invalidateRunnable = new Runnable() { @Override public void run() { if (currentlyStickingView != null) { int l = getLeftForViewRelativeOnlyChild(currentlyStickingView); int t = getBottomForViewRelativeOnlyChild(currentlyStickingView); int r = getRightForViewRelativeOnlyChild(currentlyStickingView); int b = (int) (getScrollY() + (currentlyStickingView .getHeight() + stickyViewTopOffset)); invalidate(l, t, r, b); } postDelayed(this, 16); } }; public StickyScrollView(Context context) { this(context, null); } public StickyScrollView(Context context, AttributeSet attrs) { this(context, attrs, android.R.attr.scrollViewStyle); } public StickyScrollView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setup(); } public void setup() { stickyViews = new ArrayList<View>(); } private int getLeftForViewRelativeOnlyChild(View v) { int left = v.getLeft(); while (v.getParent() != getChildAt(0)) { v = (View) v.getParent(); left += v.getLeft(); } return left; } private int getTopForViewRelativeOnlyChild(View v) { int top = v.getTop(); while (v.getParent() != getChildAt(0)) { v = (View) v.getParent(); top += v.getTop(); } return top; } private int getRightForViewRelativeOnlyChild(View v) { int right = v.getRight(); while (v.getParent() != getChildAt(0)) { v = (View) v.getParent(); right += v.getRight(); } return right; } private int getBottomForViewRelativeOnlyChild(View v) { int bottom = v.getBottom(); while (v.getParent() != getChildAt(0)) { v = (View) v.getParent(); bottom += v.getBottom(); } return bottom; } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); if (!clipToPaddingHasBeenSet) { clippingToPadding = true; } notifyHierarchyChanged(); } @Override public void setClipToPadding(boolean clipToPadding) { super.setClipToPadding(clipToPadding); clippingToPadding = clipToPadding; clipToPaddingHasBeenSet = true; } @Override public void addView(View child) { super.addView(child); findStickyViews(child); } @Override public void addView(View child, int index) { super.addView(child, index); findStickyViews(child); } @Override public void addView(View child, int index, ViewGroup.LayoutParams params) { super.addView(child, index, params); findStickyViews(child); } @Override public void addView(View child, int width, int height) { super.addView(child, width, height); findStickyViews(child); } @Override public void addView(View child, ViewGroup.LayoutParams params) { super.addView(child, params); findStickyViews(child); } @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (currentlyStickingView != null) { canvas.save(); canvas.translate(getPaddingLeft(), getScrollY() + stickyViewTopOffset + (clippingToPadding ? getPaddingTop() : 0)); canvas.clipRect(0, (clippingToPadding ? -stickyViewTopOffset : 0), getWidth(), currentlyStickingView.getHeight()); if (getStringTagForView(currentlyStickingView).contains( FLAG_HASTRANSPARANCY)) { showView(currentlyStickingView); currentlyStickingView.draw(canvas); hideView(currentlyStickingView); } else { currentlyStickingView.draw(canvas); } canvas.restore(); } } @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { redirectTouchesToStickyView = true; } if (redirectTouchesToStickyView) { redirectTouchesToStickyView = currentlyStickingView != null; if (redirectTouchesToStickyView) { redirectTouchesToStickyView = ev.getY() <= (currentlyStickingView .getHeight() + stickyViewTopOffset) && ev.getX() >= getLeftForViewRelativeOnlyChild(currentlyStickingView) && ev.getX() <= getRightForViewRelativeOnlyChild(currentlyStickingView); } } else if (currentlyStickingView == null) { redirectTouchesToStickyView = false; } if (redirectTouchesToStickyView) { ev.offsetLocation( 0, -1 * ((getScrollY() + stickyViewTopOffset) - getTopForViewRelativeOnlyChild(currentlyStickingView))); } return super.dispatchTouchEvent(ev); } private boolean hasNotDoneActionDown = true; @Override public boolean onTouchEvent(MotionEvent ev) { if (redirectTouchesToStickyView) { ev.offsetLocation( 0, ((getScrollY() + stickyViewTopOffset) - getTopForViewRelativeOnlyChild(currentlyStickingView))); } if (ev.getAction() == MotionEvent.ACTION_DOWN) { hasNotDoneActionDown = false; } if (hasNotDoneActionDown) { MotionEvent down = MotionEvent.obtain(ev); down.setAction(MotionEvent.ACTION_DOWN); super.onTouchEvent(down); hasNotDoneActionDown = false; } if (ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_CANCEL) { hasNotDoneActionDown = true; } return super.onTouchEvent(ev); } @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); doTheStickyThing(); } private void doTheStickyThing() { View viewThatShouldStick = null; View approachingView = null; for (View v : stickyViews) { int viewTop = getTopForViewRelativeOnlyChild(v) - getScrollY() + (clippingToPadding ? 0 : getPaddingTop()); if (viewTop <= 0) { if (viewThatShouldStick == null || viewTop > (getTopForViewRelativeOnlyChild(viewThatShouldStick) - getScrollY() + (clippingToPadding ? 0 : getPaddingTop()))) { viewThatShouldStick = v; } } else { if (approachingView == null || viewTop < (getTopForViewRelativeOnlyChild(approachingView) - getScrollY() + (clippingToPadding ? 0 : getPaddingTop()))) { approachingView = v; } } } if (viewThatShouldStick != null) { stickyViewTopOffset = approachingView == null ? 0 : Math.min(0, getTopForViewRelativeOnlyChild(approachingView) - getScrollY() + (clippingToPadding ? 0 : getPaddingTop()) - viewThatShouldStick.getHeight()); if (viewThatShouldStick != currentlyStickingView) { if (currentlyStickingView != null) { stopStickingCurrentlyStickingView(); } startStickingView(viewThatShouldStick); } } else if (currentlyStickingView != null) { stopStickingCurrentlyStickingView(); } } private void startStickingView(View viewThatShouldStick) { currentlyStickingView = viewThatShouldStick; if (getStringTagForView(currentlyStickingView).contains( FLAG_HASTRANSPARANCY)) { hideView(currentlyStickingView); } if (((String) currentlyStickingView.getTag()) .contains(FLAG_NONCONSTANT)) { post(invalidateRunnable); } } private void stopStickingCurrentlyStickingView() { if (getStringTagForView(currentlyStickingView).contains( FLAG_HASTRANSPARANCY)) { showView(currentlyStickingView); } currentlyStickingView = null; removeCallbacks(invalidateRunnable); } /** * Notify that the sticky attribute has been added or removed from one or * more views in the View hierarchy */ public void notifyStickyAttributeChanged() { notifyHierarchyChanged(); } private void notifyHierarchyChanged() { if (currentlyStickingView != null) { stopStickingCurrentlyStickingView(); } stickyViews.clear(); findStickyViews(getChildAt(0)); doTheStickyThing(); invalidate(); } private void findStickyViews(View v) { if (v instanceof ViewGroup) { ViewGroup vg = (ViewGroup) v; for (int i = 0; i < vg.getChildCount(); i++) { String tag = getStringTagForView(vg.getChildAt(i)); if (tag != null && tag.contains(STICKY_TAG)) { stickyViews.add(vg.getChildAt(i)); } else if (vg.getChildAt(i) instanceof ViewGroup) { findStickyViews(vg.getChildAt(i)); } } } else { String tag = (String) v.getTag(); if (tag != null && tag.contains(STICKY_TAG)) { stickyViews.add(v); } } } private String getStringTagForView(View v) { Object tagObject = v.getTag(); return String.valueOf(tagObject); } private void hideView(View v) { // if (Build.VERSION.SDK_INT >= 11) { // v.setAlpha(0); // } else { AlphaAnimation anim = new AlphaAnimation(1, 0); anim.setDuration(0); anim.setFillAfter(true); v.startAnimation(anim); // TextView tv = (TextView) v.findViewById(R.id.tv_stickname); // tv.setVisibility(GONE); // } } private void showView(View v) { // if (Build.VERSION.SDK_INT >= 11) { // v.setAlpha(1); // } else { AlphaAnimation anim = new AlphaAnimation(0, 1); anim.setDuration(0); anim.setFillAfter(true); v.startAnimation(anim); // TextView tv = (TextView) v.findViewById(R.id.tv_stickname); // tv.setVisibility(VISIBLE); // } } }
[ "goodguting@gmail.com" ]
goodguting@gmail.com
9f54d272751fa6864d1b217a7a1a49bea38795f9
9a21965d440506705c517cabe40dbb67244a6b73
/xteacher/src/main/java/com/zjhz/teacher/ui/adapter/StatisticsOfMoralEducationClassOrPersonAdapter.java
31edecc1187ea8912fe90c0b141534a5805e86e1
[]
no_license
tianbaojun/XMvp
e6528041ee6fc43d79d004a4f8bff2d96477ff18
ede7fbbec1f5d4134a2d97b4106b1ee98524c2be
refs/heads/master
2021-01-15T08:13:56.469611
2017-08-18T08:52:43
2017-08-18T08:52:43
99,560,727
0
0
null
null
null
null
UTF-8
Java
false
false
2,750
java
package com.zjhz.teacher.ui.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.zjhz.teacher.R; import com.zjhz.teacher.base.BaseViewHolder; import com.zjhz.teacher.bean.StatisticsOfMoralEducationListBean; import com.zjhz.teacher.ui.activity.StatisticsOfMoralEducationClassActivity; import com.zjhz.teacher.ui.activity.StatisticsOfMoralEducationPersonActivity; import java.util.List; public class StatisticsOfMoralEducationClassOrPersonAdapter extends BaseAdapter { private Context mContext; private StatisticsOfMoralEducationClassActivity statisticsOfMoralEducationClassActivity; private StatisticsOfMoralEducationPersonActivity statisticsOfMoralEducationPersonActivity; private List<StatisticsOfMoralEducationListBean> datas; public StatisticsOfMoralEducationClassOrPersonAdapter(Context context, StatisticsOfMoralEducationClassActivity statisticsOfMoralEducationClassActivity) { this.mContext = context; this.statisticsOfMoralEducationClassActivity = statisticsOfMoralEducationClassActivity; } public StatisticsOfMoralEducationClassOrPersonAdapter(Context context, StatisticsOfMoralEducationPersonActivity statisticsOfMoralEducationPersonActivity) { this.mContext = context; this.statisticsOfMoralEducationPersonActivity = statisticsOfMoralEducationPersonActivity; } public List<StatisticsOfMoralEducationListBean> getDatas() { return datas; } public void setDatas(List<StatisticsOfMoralEducationListBean> datas) { this.datas = datas; } public void addDatas(List<StatisticsOfMoralEducationListBean> data) { datas.addAll(data); } @Override public int getCount() { if (datas != null && datas.size() > 0) { return datas.size(); } return 0; } @Override public Object getItem(int i) { return datas.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int i, View convertView, ViewGroup viewGroup) { if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.adapter_statistics_of_moral_class_person, viewGroup, false); } TextView content = BaseViewHolder.get(convertView, R.id.adapter_statistics_of_moral_class_person_content); TextView score = BaseViewHolder.get(convertView, R.id.adapter_statistics_of_moral_class_person_score); content.setText(datas.get(i).name); score.setText(datas.get(i).score); return convertView; } }
[ "woabw@foxmail.com" ]
woabw@foxmail.com
f782e296eefb48904cbcb80d0fcedf6f6d7763f0
73d3802bcf5f70b0220d9c76662af047ca124d15
/gulimall-coupon/src/main/java/com/atguigu/gulimall/coupon/controller/SeckillSessionController.java
46a8823ecda24605154e48cf99854b5a7c658018
[]
no_license
zch2017lrf/small-mall
eaff87a4c4b79e338f8c92c7e17580eeeef958d9
93ead71da4d049e52a1dcbd1af610bd0e7051c72
refs/heads/master
2023-04-14T10:42:17.712155
2021-03-08T01:30:04
2021-03-08T01:30:04
305,930,919
0
0
null
null
null
null
UTF-8
Java
false
false
2,427
java
package com.atguigu.gulimall.coupon.controller; import java.util.Arrays; import java.util.Map; //import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.atguigu.gulimall.coupon.entity.SeckillSessionEntity; import com.atguigu.gulimall.coupon.service.SeckillSessionService; import com.atguigu.common.utils.PageUtils; import com.atguigu.common.utils.R; /** * 秒杀活动场次 * * @author cosmoswong * @email sunlightcs@gmail.com * @date 2020-10-14 16:37:33 */ @RestController @RequestMapping("coupon/seckillsession") public class SeckillSessionController { @Autowired private SeckillSessionService seckillSessionService; /** * 列表 */ @RequestMapping("/list") //@RequiresPermissions("coupon:seckillsession:list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = seckillSessionService.queryPage(params); return R.ok().put("page", page); } /** * 信息 */ @RequestMapping("/info/{id}") //@RequiresPermissions("coupon:seckillsession:info") public R info(@PathVariable("id") Long id){ SeckillSessionEntity seckillSession = seckillSessionService.getById(id); return R.ok().put("seckillSession", seckillSession); } /** * 保存 */ @RequestMapping("/save") //@RequiresPermissions("coupon:seckillsession:save") public R save(@RequestBody SeckillSessionEntity seckillSession){ seckillSessionService.save(seckillSession); return R.ok(); } /** * 修改 */ @RequestMapping("/update") //@RequiresPermissions("coupon:seckillsession:update") public R update(@RequestBody SeckillSessionEntity seckillSession){ seckillSessionService.updateById(seckillSession); return R.ok(); } /** * 删除 */ @RequestMapping("/delete") //@RequiresPermissions("coupon:seckillsession:delete") public R delete(@RequestBody Long[] ids){ seckillSessionService.removeByIds(Arrays.asList(ids)); return R.ok(); } }
[ "zch1158809285@163.com" ]
zch1158809285@163.com
7f92ed1e1dd1c9d9566948154976c7eda62c1705
9a79567de721b3cca8adf186796304ae760ccb90
/src/main/java/ru/geekbrains/spring1/lesson1/Launcher.java
8d9bd4b53095345fc2ef12a79500907ffc5dadf7
[]
no_license
IMBABOT1/ru.geekbrains.spring1.lesson2
254d02c1cb45ce8046ed070a55b98217b34ba21a
8294bd6699134e39e4411e69413df7e910e31e12
refs/heads/main
2023-03-05T21:39:35.546274
2021-02-19T13:58:42
2021-02-19T13:58:42
340,332,295
0
0
null
null
null
null
UTF-8
Java
false
false
713
java
package ru.geekbrains.spring1.lesson1; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.webapp.WebAppContext; import java.net.URL; import java.security.ProtectionDomain; public class Launcher { public static void main(String[] args)throws Exception { Server server = new Server(8189); ProtectionDomain domain = Launcher.class.getProtectionDomain(); URL location = domain.getCodeSource().getLocation(); WebAppContext webAppContext = new WebAppContext(); webAppContext.setContextPath("/app"); webAppContext.setWar(location.toExternalForm()); server.setHandler(webAppContext); server.start(); server.join(); } }
[ "zlovred12@gmail.com" ]
zlovred12@gmail.com
290de52d8fdc61485ae5a6b60d612a0b3e8e9ff3
121a363cd42dbd093cdfddc2255a9041c7835d2c
/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogDecoder.java
be86cc8a8ff767914f28aabfb28c554a68dded71
[]
no_license
koolhazz/canal-rewrite
01a12a4c48ce83983cc24e776e8376706c58d183
2d6bade9f794bbec441b456d1029507e3543cbaf
refs/heads/master
2020-12-11T01:49:16.761809
2014-09-30T07:04:15
2014-09-30T07:04:15
25,023,161
2
4
null
null
null
null
UTF-8
Java
false
false
20,353
java
package com.taobao.tddl.dbsync.binlog; import java.io.IOException; import java.util.BitSet; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.taobao.tddl.dbsync.binlog.event.AppendBlockLogEvent; import com.taobao.tddl.dbsync.binlog.event.BeginLoadQueryLogEvent; import com.taobao.tddl.dbsync.binlog.event.CreateFileLogEvent; import com.taobao.tddl.dbsync.binlog.event.DeleteFileLogEvent; import com.taobao.tddl.dbsync.binlog.event.DeleteRowsLogEvent; import com.taobao.tddl.dbsync.binlog.event.ExecuteLoadLogEvent; import com.taobao.tddl.dbsync.binlog.event.ExecuteLoadQueryLogEvent; import com.taobao.tddl.dbsync.binlog.event.FormatDescriptionLogEvent; import com.taobao.tddl.dbsync.binlog.event.GtidLogEvent; import com.taobao.tddl.dbsync.binlog.event.HeartbeatLogEvent; import com.taobao.tddl.dbsync.binlog.event.IgnorableLogEvent; import com.taobao.tddl.dbsync.binlog.event.IncidentLogEvent; import com.taobao.tddl.dbsync.binlog.event.IntvarLogEvent; import com.taobao.tddl.dbsync.binlog.event.LoadLogEvent; import com.taobao.tddl.dbsync.binlog.event.LogHeader; import com.taobao.tddl.dbsync.binlog.event.PreviousGtidsLogEvent; import com.taobao.tddl.dbsync.binlog.event.QueryLogEvent; import com.taobao.tddl.dbsync.binlog.event.RandLogEvent; import com.taobao.tddl.dbsync.binlog.event.RotateLogEvent; import com.taobao.tddl.dbsync.binlog.event.RowsLogEvent; import com.taobao.tddl.dbsync.binlog.event.RowsQueryLogEvent; import com.taobao.tddl.dbsync.binlog.event.StartLogEventV3; import com.taobao.tddl.dbsync.binlog.event.StopLogEvent; import com.taobao.tddl.dbsync.binlog.event.TableMapLogEvent; import com.taobao.tddl.dbsync.binlog.event.UnknownLogEvent; import com.taobao.tddl.dbsync.binlog.event.UpdateRowsLogEvent; import com.taobao.tddl.dbsync.binlog.event.UserVarLogEvent; import com.taobao.tddl.dbsync.binlog.event.WriteRowsLogEvent; import com.taobao.tddl.dbsync.binlog.event.XidLogEvent; import com.taobao.tddl.dbsync.binlog.event.mariadb.AnnotateRowsEvent; import com.taobao.tddl.dbsync.binlog.event.mariadb.BinlogCheckPointLogEvent; import com.taobao.tddl.dbsync.binlog.event.mariadb.MariaGtidListLogEvent; import com.taobao.tddl.dbsync.binlog.event.mariadb.MariaGtidLogEvent; /** * Implements a binary-log decoder. * * <pre> * LogDecoder decoder = new LogDecoder(); * decoder.handle(...); * * LogEvent event; * do * { * event = decoder.decode(buffer, context); * * // process log event. * } * while (event != null); * // no more events in buffer. * </pre> * * @author <a href="mailto:changyuan.lh@taobao.com">Changyuan.lh</a> * @version 1.0 */ public final class LogDecoder { protected static final Log logger = LogFactory.getLog(LogDecoder.class); protected final BitSet handleSet = new BitSet(LogEvent.ENUM_END_EVENT); public LogDecoder() { } public LogDecoder(final int fromIndex, final int toIndex) { handleSet.set(fromIndex, toIndex); } public final void handle(final int fromIndex, final int toIndex) { handleSet.set(fromIndex, toIndex); } public final void handle(final int flagIndex) { handleSet.set(flagIndex); } /** * Decoding an event from binary-log buffer. * * @return <code>UknownLogEvent</code> if event type is unknown or skipped, * <code>null</code> if buffer is not including a full event. */ public LogEvent decode(LogBuffer buffer, LogContext context) throws IOException { final int limit = buffer.limit(); if (limit >= FormatDescriptionLogEvent.LOG_EVENT_HEADER_LEN) { LogHeader header = new LogHeader(buffer, context.getFormatDescription()); final int len = header.getEventLen(); if (limit >= len) { LogEvent event; /* Checking binary-log's header */ if (handleSet.get(header.getType())) { buffer.limit(len); try { /* Decoding binary-log to event */ event = decode(buffer, header, context); } catch (IOException e) { if (logger.isWarnEnabled()) logger.warn("Decoding " + LogEvent.getTypeName(header.getType()) + " failed from: " + context.getLogPosition(), e); throw e; } finally { buffer.limit(limit); /* Restore limit */ } } else { /* Ignore unsupported binary-log. */ event = new UnknownLogEvent(header); } /* consume this binary-log. */ buffer.consume(len); return event; } } /* Rewind buffer's position to 0. */ buffer.rewind(); return null; } /** * Deserialize an event from buffer. * * @return <code>UknownLogEvent</code> if event type is unknown or skipped. */ public static LogEvent decode(LogBuffer buffer, LogHeader header, LogContext context) throws IOException { FormatDescriptionLogEvent descriptionEvent = context.getFormatDescription(); LogPosition logPosition = context.getLogPosition(); int checksumAlg = LogEvent.BINLOG_CHECKSUM_ALG_UNDEF; if (header.getType() != LogEvent.FORMAT_DESCRIPTION_EVENT) { checksumAlg = descriptionEvent.header.getChecksumAlg(); }else { // 如果是format事件自己,也需要处理checksum checksumAlg = header.getChecksumAlg(); } if (checksumAlg != LogEvent.BINLOG_CHECKSUM_ALG_OFF && checksumAlg != LogEvent.BINLOG_CHECKSUM_ALG_UNDEF) { // remove checksum bytes buffer.limit(header.getEventLen() - LogEvent.BINLOG_CHECKSUM_LEN); } switch (header.getType()) { case LogEvent.QUERY_EVENT: { QueryLogEvent event = new QueryLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.XID_EVENT: { XidLogEvent event = new XidLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.TABLE_MAP_EVENT: { TableMapLogEvent mapEvent = new TableMapLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); context.putTable(mapEvent); return mapEvent; } case LogEvent.WRITE_ROWS_EVENT_V1: { RowsLogEvent event = new WriteRowsLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); event.fillTable(context); return event; } case LogEvent.UPDATE_ROWS_EVENT_V1: { RowsLogEvent event = new UpdateRowsLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); event.fillTable(context); return event; } case LogEvent.DELETE_ROWS_EVENT_V1: { RowsLogEvent event = new DeleteRowsLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); event.fillTable(context); return event; } case LogEvent.ROTATE_EVENT: { RotateLogEvent event = new RotateLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition = new LogPosition(event.getFilename(), event.getPosition()); context.setLogPosition(logPosition); return event; } case LogEvent.LOAD_EVENT: case LogEvent.NEW_LOAD_EVENT: { LoadLogEvent event = new LoadLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.SLAVE_EVENT: /* can never happen (unused event) */ { if (logger.isWarnEnabled()) logger.warn("Skipping unsupported SLAVE_EVENT from: " + context.getLogPosition()); break; } case LogEvent.CREATE_FILE_EVENT: { CreateFileLogEvent event = new CreateFileLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.APPEND_BLOCK_EVENT: { AppendBlockLogEvent event = new AppendBlockLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.DELETE_FILE_EVENT: { DeleteFileLogEvent event = new DeleteFileLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.EXEC_LOAD_EVENT: { ExecuteLoadLogEvent event = new ExecuteLoadLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.START_EVENT_V3: { /* This is sent only by MySQL <=4.x */ StartLogEventV3 event = new StartLogEventV3(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.STOP_EVENT: { StopLogEvent event = new StopLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.INTVAR_EVENT: { IntvarLogEvent event = new IntvarLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.RAND_EVENT: { RandLogEvent event = new RandLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.USER_VAR_EVENT: { UserVarLogEvent event = new UserVarLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.FORMAT_DESCRIPTION_EVENT: { descriptionEvent = new FormatDescriptionLogEvent(header, buffer, descriptionEvent); context.setFormatDescription(descriptionEvent); return descriptionEvent; } case LogEvent.PRE_GA_WRITE_ROWS_EVENT: { if (logger.isWarnEnabled()) logger.warn("Skipping unsupported PRE_GA_WRITE_ROWS_EVENT from: " + context.getLogPosition()); // ev = new Write_rows_log_event_old(buf, event_len, // description_event); break; } case LogEvent.PRE_GA_UPDATE_ROWS_EVENT: { if (logger.isWarnEnabled()) logger.warn("Skipping unsupported PRE_GA_UPDATE_ROWS_EVENT from: " + context.getLogPosition()); // ev = new Update_rows_log_event_old(buf, event_len, // description_event); break; } case LogEvent.PRE_GA_DELETE_ROWS_EVENT: { if (logger.isWarnEnabled()) logger.warn("Skipping unsupported PRE_GA_DELETE_ROWS_EVENT from: " + context.getLogPosition()); // ev = new Delete_rows_log_event_old(buf, event_len, // description_event); break; } case LogEvent.BEGIN_LOAD_QUERY_EVENT: { BeginLoadQueryLogEvent event = new BeginLoadQueryLogEvent( header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.EXECUTE_LOAD_QUERY_EVENT: { ExecuteLoadQueryLogEvent event = new ExecuteLoadQueryLogEvent( header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.INCIDENT_EVENT: { IncidentLogEvent event = new IncidentLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.HEARTBEAT_LOG_EVENT: { HeartbeatLogEvent event = new HeartbeatLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.IGNORABLE_LOG_EVENT: { IgnorableLogEvent event = new IgnorableLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.ROWS_QUERY_LOG_EVENT: { RowsQueryLogEvent event = new RowsQueryLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.WRITE_ROWS_EVENT: { RowsLogEvent event = new WriteRowsLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); event.fillTable(context); return event; } case LogEvent.UPDATE_ROWS_EVENT: { RowsLogEvent event = new UpdateRowsLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); event.fillTable(context); return event; } case LogEvent.DELETE_ROWS_EVENT: { RowsLogEvent event = new DeleteRowsLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); event.fillTable(context); return event; } case LogEvent.GTID_LOG_EVENT: case LogEvent.ANONYMOUS_GTID_LOG_EVENT: { GtidLogEvent event = new GtidLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.PREVIOUS_GTIDS_LOG_EVENT: { PreviousGtidsLogEvent event = new PreviousGtidsLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.ANNOTATE_ROWS_EVENT: { AnnotateRowsEvent event = new AnnotateRowsEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.BINLOG_CHECKPOINT_EVENT: { BinlogCheckPointLogEvent event = new BinlogCheckPointLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.GTID_EVENT: { MariaGtidLogEvent event = new MariaGtidLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } case LogEvent.GTID_LIST_EVENT: { MariaGtidListLogEvent event = new MariaGtidListLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; } default: /* Create an object of Ignorable_log_event for unrecognized sub-class. So that SLAVE SQL THREAD will only update the position and continue. */ if((buffer.getUint16(LogEvent.FLAGS_OFFSET) & LogEvent.LOG_EVENT_IGNORABLE_F) > 0){ IgnorableLogEvent event = new IgnorableLogEvent(header, buffer, descriptionEvent); /* updating position in context */ logPosition.position = header.getLogPos(); return event; }else { if (logger.isWarnEnabled()) logger.warn("Skipping unrecognized binlog event " + LogEvent.getTypeName(header.getType()) + " from: " + context.getLogPosition()); } } /* updating position in context */ logPosition.position = header.getLogPos(); /* Unknown or unsupported log event */ return new UnknownLogEvent(header); } }
[ "1186897618@qq.com" ]
1186897618@qq.com
ee6d47aede631f1d9478b770e77b423f6911bb9b
66a875410d2c7095bae72e9835fd8752721ea21a
/02 第二章/CyclicBarrier_run4/src/service/MyService.java
9316ee66bd23d1f8b3be8392e932d6dccb16a8c7
[]
no_license
kinglovelqn/Java-Concurrent-Programming
ae46042916174e39ba766ee6827e5194ecbc3878
d614b499a2814788aa204ab4632a8643e5c9c343
refs/heads/master
2021-10-20T19:08:31.064661
2019-03-01T07:54:25
2019-03-01T07:54:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
916
java
package service; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; public class MyService { public CyclicBarrier cyclicBarrier = new CyclicBarrier(3, new Runnable() { @Override public void run() { System.out.println(" 彻底结束了 " + System.currentTimeMillis()); } }); public void testMethod() { try { System.out.println(Thread.currentThread().getName() + " 准备!" + System.currentTimeMillis()); if (Thread.currentThread().getName().equals("C")) { Thread.sleep(Integer.MAX_VALUE); } cyclicBarrier.await(); System.out.println(Thread.currentThread().getName() + " 开始!" + System.currentTimeMillis()); // ///////// } catch (InterruptedException e) { e.printStackTrace(); } catch (BrokenBarrierException e) { e.printStackTrace(); } } }
[ "noreply@github.com" ]
noreply@github.com
1b79fa6b965506becfd841f420dcd893e3bfe872
883dc767927b1b5a83cbadf218b3f19fdf2ea7e1
/cloudplatform-webportal-data-model/src/main/java/com/letv/portal/proxy/IDbProxy.java
edaaac0f4ec6f70372664905f89d6ea441cc03eb
[]
no_license
mayl666/cloud_tv
cd72844453f5a56dd5cd2c9556e825eae9720bf8
cc268c5c3ddc67f66705995172b60e43b79dba0c
refs/heads/master
2021-05-06T02:28:27.243399
2017-09-20T04:05:40
2017-09-20T04:05:40
114,590,575
0
0
null
null
null
null
UTF-8
Java
false
false
653
java
package com.letv.portal.proxy; import java.util.Map; import com.letv.portal.model.DbModel; /**Program Name: IDbProxy <br> * Description: <br> * @author name: liuhao1 <br> * Written Date: 2014年10月7日 <br> * Modified By: <br> * Modified Date: <br> */ public interface IDbProxy extends IBaseProxy<DbModel> { public void auditAndBuild(Map<String,Object> params); /**Methods Name: saveAndBuild <br> * Description: 保存db,并创建container集群及db<br> * @author name: liuhao1 * @param dbModel * @param isCreateAdmin 是否默认创建管理员用户 */ public void saveAndBuild(DbModel dbModel,boolean isCreateAdmin); }
[ "liuhao1@letv.com" ]
liuhao1@letv.com
d851dfd043acfdec43e1076297cc35ebcd789577
f42ba86ca56f52d83da17e8566e14cccba6e96d9
/quora-api/src/main/java/com/upgrad/quora/api/controller/UserController.java
6d52a122a40b3fc1c8666dc9e6bb2aceb315962b
[]
no_license
akshaythedeveloper/Course-5-Project
1d5e79b1273b1f71508d9fa7ee140b382e500fb7
3fd73f31173bbd7352daf6b2c11c712dc6b39ca2
refs/heads/master
2020-04-01T18:33:15.326293
2018-11-04T16:52:00
2018-11-04T16:52:00
153,499,368
0
2
null
2018-11-04T17:49:10
2018-10-17T17:46:37
Java
UTF-8
Java
false
false
4,414
java
package com.upgrad.quora.api.controller; import com.upgrad.quora.api.model.*; //import com.upgrad.quora.service.business.AuthenticationService; import com.upgrad.quora.service.business.AuthenticationService; import com.upgrad.quora.service.business.SignupBusinessService; import com.upgrad.quora.service.entity.UserAuthEntity; import com.upgrad.quora.service.entity.UsersEntity; import com.upgrad.quora.service.exception.AuthenticationFailedException; import com.upgrad.quora.service.exception.SignOutRestrictedException; import com.upgrad.quora.service.exception.SignUpRestrictedException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.time.ZonedDateTime; import java.util.Base64; import java.util.UUID; @RestController @RequestMapping("/") public class UserController { @Autowired private SignupBusinessService signupBusinessService; @RequestMapping(method = RequestMethod.POST , path = "/user/signup" , produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<SignupUserResponse> signup(final SignupUserRequest signupUserRequest) throws SignUpRestrictedException { final UsersEntity usersEntity = new UsersEntity(); usersEntity.setUuid(UUID.randomUUID().toString()); usersEntity.setFirstname(signupUserRequest.getFirstName()); usersEntity.setLastname(signupUserRequest.getLastName()); usersEntity.setUsername(signupUserRequest.getUserName()); usersEntity.setEmail(signupUserRequest.getEmailAddress()); usersEntity.setPassword(signupUserRequest.getPassword()); usersEntity.setCountry(signupUserRequest.getCountry()); usersEntity.setAboutme(signupUserRequest.getAboutMe()); usersEntity.setDob(signupUserRequest.getDob()); usersEntity.setContactnumber(signupUserRequest.getContactNumber()); usersEntity.setRole("nonadmin"); usersEntity.setSalt("abc@123"); final UsersEntity createdUsersEntity = signupBusinessService.signup(usersEntity); SignupUserResponse userResponse = new SignupUserResponse().id(createdUsersEntity.getUuid()).status("USER SUCCESSFULLY REGISTERED"); return new ResponseEntity<SignupUserResponse>(userResponse, HttpStatus.CREATED); } @Autowired private AuthenticationService authenticationService; @RequestMapping(method = RequestMethod.POST , path = "/user/signin" ,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE ,produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<SigninResponse> signin(@RequestHeader("authorization") final String authorization) throws AuthenticationFailedException { byte[] decode = Base64.getDecoder().decode(authorization.split("Basic ")[1]); String decodedText = new String(decode); String[] decodedArray = decodedText.split(":"); UserAuthEntity userAuthEntity = authenticationService.authenticate(decodedArray[0] , decodedArray[1]); UsersEntity user = userAuthEntity.getUser(); SigninResponse signinResponse = new SigninResponse().id(user.getUuid()).message("SIGNED IN SUCCESSFULLY"); HttpHeaders headers = new HttpHeaders(); headers.add("access-token", userAuthEntity.getAccessToken()); return new ResponseEntity<SigninResponse>(signinResponse, headers, HttpStatus.OK); } @RequestMapping(method = RequestMethod.POST , path = "/user/signout" , produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<SignoutResponse> signout(@RequestHeader("authorization") final String accessToken) throws SignOutRestrictedException { UserAuthEntity userAuthEntity = authenticationService.signout(accessToken); UsersEntity usersEntity = userAuthEntity.getUser(); SignoutResponse signoutResponse = new SignoutResponse().id(usersEntity.getUuid()).message("SIGNED OUT SUCCESSFULLY"); return new ResponseEntity<SignoutResponse>(signoutResponse , HttpStatus.OK); } }
[ "akshay.verma0808@gmail.com" ]
akshay.verma0808@gmail.com
1c83ca3b44c93923f82ad0c43de0173c024b2be7
48c256df1eaf7c4fb147efbedaab3f9dd1f49db8
/Cars/src/de/nak/studentsdatabase/dao/ZenturieDAO.java
9098d1972a648455e822490b06d0260838b5d5d2
[]
no_license
Synonymic/Studentendatenbank
f0ea55cce577d4d9fb10e0d0f9a4cdb090cdaafb
fece73d8088830aac079624a9a754325e47b61c1
refs/heads/master
2021-01-01T18:41:58.231480
2014-11-09T15:58:25
2014-11-09T15:58:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,541
java
package de.nak.studentsdatabase.dao; import de.nak.studentsdatabase.model.Zenturie; import org.hibernate.SessionFactory; import java.util.List; /** * Zenturie data access object. * * @author Andreas Krey */ public class ZenturieDAO { /** The Hibernate Session factory. */ private SessionFactory sessionFactory; /** * Persists or merges the zenturie into the database.. * * @param zenturie The zenturie to persist. The given entity can be transient or detached. */ public void save(Zenturie zenturie) { sessionFactory.getCurrentSession().saveOrUpdate(zenturie); } /** * Loads a single zenturie entity from the database. * * @param id The identifier. * @return a zenturie or null if no zenturie was found with the given identifier. */ public Zenturie load(Long id) { return (Zenturie) sessionFactory.getCurrentSession().get(Zenturie.class, id); } /** * Deletes the zenturie from the database. * * @param zenturie The zenturie to be deleted. */ public void delete(Zenturie zenturie) { sessionFactory.getCurrentSession().delete(zenturie); } /** * Loads all zenturie's from the database. * * @return a list or zenturie which is empty if no car was found. */ @SuppressWarnings("unchecked") public List<Zenturie> loadAll() { return sessionFactory.getCurrentSession().createQuery("from Zenturie").list(); } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } }
[ "andreas.krey@nordakademie.de" ]
andreas.krey@nordakademie.de
2acddb29fb2539842fb152ed4e134800230c52d2
e271998868bac118b475bda02c3cd4bbccfc549c
/app/src/main/java/com/example/dsuappacademy/newstudent/QuickInfoFragment.java
dc4b288e81ad0257509dddff592e7f791d6bb31d
[]
no_license
ishwts/MadeForPurpose2-master
9223804bade368ff084b1257926907d3d16f2784
6a0c2da4bcb6dee5c07bf6147b85cd2c2c6417e4
refs/heads/master
2021-01-20T19:15:51.311748
2016-08-10T15:03:50
2016-08-10T15:03:50
65,392,032
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
package com.example.dsuappacademy.newstudent; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * Created by dsuappacademy on 8/5/16. */ public class QuickInfoFragment extends Fragment { public QuickInfoFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_quick_info,container,false); return rootView; } }
[ "watts.iyasu@gmail.com" ]
watts.iyasu@gmail.com
faf4decfa84ee893b6f12d9f0bb7f42cefdc6ed7
aa28aa9261505147e26545ff7e13ca0f8b41b2a8
/src/InterfaceSegregation/Pattern/Interfaces/MultiFunctionalMachine.java
888df6830df9a6e0688c22c3a45100f587391993
[]
no_license
nakiscia/SOLID-Examples-Java
8072d6cb878bed584102b874bec52041466269c7
e41d5524d7ed61172c6454a7468477ffaaf472e3
refs/heads/master
2021-04-13T16:37:22.833474
2020-05-31T11:44:54
2020-05-31T11:44:54
249,174,511
0
0
null
null
null
null
UTF-8
Java
false
false
118
java
package InterfaceSegregation.Pattern.Interfaces; public interface MultiFunctionalMachine extends Printer,Scanner { }
[ "ahmet.nakisci@etiya.com" ]
ahmet.nakisci@etiya.com
388e533e09ed6f78f9b9882a0711f779456533ea
b3300d47d2a9fafd37b8fc9ab5604533e28f2116
/apps/chipin/src/main/java/com/tinx/java/chipin/thread/entity/TaskParameter.java
b55c300f201da4d805225fb7e66d84cc6b827109
[]
no_license
tinxwong/spring-boot
ad2dae1912e2b84b09af1cbe0f38fcd30374aa28
118a72aa73023959e534b209f754967d2764ae9e
refs/heads/master
2020-04-04T14:30:24.517992
2018-12-25T09:42:06
2018-12-25T09:42:06
156,000,912
0
0
null
null
null
null
UTF-8
Java
false
false
124
java
package com.tinx.java.chipin.thread.entity; /** * @author tinx * @date 2018-9-9 21:00 */ public class TaskParameter { }
[ "tianxu.wang@meicloud.com" ]
tianxu.wang@meicloud.com
8952ec4f108c6459f284e55e259f9f6e81e74b89
a7de02c52b4aff53354e385ae8de0c506323d4a1
/src/com/edocti/jintro/lab09/BankAccountClassic2.java
4c712fb539a867f7f7d88b46f465fba6ced7c535
[]
no_license
lucianmanciu/com-edocti-jintro
7a9ab5ff3906c6780bcb2d84e69695ec37ceb79e
04dfc7f5257a33d49429dc5701b78c3f6f64dedd
refs/heads/master
2021-01-17T18:18:41.754572
2016-10-27T12:20:07
2016-10-27T12:20:07
71,341,115
0
0
null
null
null
null
UTF-8
Java
false
false
954
java
package com.edocti.jintro.lab09; public class BankAccountClassic2 implements BankAccount { private int balance; private int cucu; @Override public /*synchronized*/ void deposit(int amount) { synchronized(this) { balance += amount; } cucu += amount; } @Override public /*synchronized*/ void withdraw(int amount) { deposit(-amount); } @Override public synchronized int getBalance() { return balance; } public int getCucu() { return cucu; } public static void main(String[] args) throws InterruptedException { final BankAccountClassic2 ion = new BankAccountClassic2(); Thread[] producers = new Thread[10]; Thread[] consumers = new Thread[10]; for (int i = 0; i < 10; i++) { producers[i] = new Producer(ion, 10); producers[i].start(); consumers[i] = new Consumer(ion, 5); consumers[i].start(); } for(int i = 0; i < 10; i++) { producers[i].join(); consumers[i].join(); } } }
[ "lucian.manciu@aciworldwide.com" ]
lucian.manciu@aciworldwide.com
190453046874c7f4b2b0d1a001e15a985e924b09
ea7bd63ac0f5bb29407a69f808cd76fcfe4bf84c
/app/src/main/java/com/example/mycontacts/adapters/RecyclerViewAdapter.java
a39b83cec401747d02bb9781cdb88733b97ac5b3
[]
no_license
nanduarakalig1t/MyContacts
a54ee5407d90cb108f1640ec827546ba1efd649d
3af4b6c70ebb81e275738917237ddbcb04cd8d9d
refs/heads/master
2022-11-07T10:04:54.876167
2020-06-19T09:19:27
2020-06-19T09:19:27
273,361,851
0
0
null
null
null
null
UTF-8
Java
false
false
2,516
java
package com.example.mycontacts.adapters; import android.content.Context; import android.content.Intent; import android.util.Log; 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 com.example.mycontacts.R; import com.example.mycontacts.model.Contact; import java.util.ArrayList; public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> { private Context context; private ArrayList<Contact> contactList; public RecyclerViewAdapter(Context context, ArrayList<Contact> contactList) { this.context = context; this.contactList = contactList; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.contactrow, parent ,false); return new ViewHolder(view); } @Override public void onBindViewHolder(@NonNull RecyclerViewAdapter.ViewHolder holder, int position) { Contact contact = contactList.get(position); holder.name.setText(contact.getContactName()); holder.phone.setText(contact.getContactPhoneNumber()); } @Override public int getItemCount() { return contactList.size(); } public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ public TextView name; public TextView phone; public ImageView callButton; public ViewHolder(@NonNull View itemView) { super(itemView); //itemView.setOnClickListener(this); name = itemView.findViewById(R.id.tvName); phone = itemView.findViewById(R.id.tvPhone); callButton = itemView.findViewById(R.id.callButton); callButton.setOnClickListener(this); } @Override public void onClick(View v) { int position = getAdapterPosition(); Contact contact = contactList.get(position); Log.d("CLICK", "onClick: " + contact.getContactName()); Intent intent = new Intent(context, DetailDisplay.class); intent.putExtra("name", contact.getContactName()); intent.putExtra("phone", contact.getContactPhoneNumber()); context.startActivity(intent); } } }
[ "67098933+nanduarakalig1t@users.noreply.github.com" ]
67098933+nanduarakalig1t@users.noreply.github.com
0d63d9ae8391d40d4c0b8a9553d3e8e8c24f5a62
dd7fbfb8807780c2337295f3a32af3f16f3f4e04
/fox-student/src/main/java/com/fh/student/controller/StudentController.java
c39e1877a4c27d9c71a63737928fe7d51e9daf21
[]
no_license
lwhgithub/fox
00396ff9c0a56e43ebeabfda056b099d481ba32e
d7b5cda51b43189e6f5ae7544bab6215a7ba025b
refs/heads/master
2023-02-13T14:18:37.176592
2021-01-14T07:59:08
2021-01-14T07:59:08
329,541,959
0
0
null
null
null
null
UTF-8
Java
false
false
5,031
java
package com.fh.student.controller; import com.fh.common.ServerResponse; import com.fh.student.model.Student; import com.fh.student.model.StudentParam; import com.fh.student.service.StudentService; import com.fh.utils.ExportUtil; import io.lettuce.core.dynamic.annotation.Param; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.crypto.Data; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.List; /** * 生产地址: FLYFOX第五号BUG工厂第二分厂三十三号生产员 * 生产日期: 2020-12-28 19:51 */ @RequestMapping("StudentController") @RestController public class StudentController { @Resource private StudentService studentService; // 接口作用: 对t_student表的信息进行查询,分页 // 请求路径: http://localhost:8111/aa/StudentController/queryStudent // 请求类型: get // 接收参数: com.fh.student.model.StudentParam // 接收数据类型: com.fh.student.model.StudentParam // 必须参数: 无 默认提供pagingSize=10 pagingStart=0 // 返回值: {"code":1111,"data":{"count":条数,"list":[{数据1},{数据2},...]},"message":"成功"} // 返回值类型: json @GetMapping("queryStudent") public ServerResponse queryStudent(StudentParam student){ return studentService.queryStudent(student); } // 接口作用: 对t_student表的信息进行根据id修改 // 请求路径: http://localhost:8111/aa/StudentController/updateStudent // 请求类型: put // 接收参数: com.fh.student.model.Student // 接收数据类型: com.fh.student.model.Student // 必须参数: Integer类型: studentId; // 返回值: {"code":1111,"data":null,"message":"成功"} // 返回值类型: json @PutMapping("updateStudent") public ServerResponse updateStudent(Student student){ return studentService.updateStudent(student); } // 接口作用: 对t_student表的信息进行添加新的数据 // 请求路径: http://localhost:8111/aa/StudentController/addStudent // 请求类型: post // 接收参数: com.fh.student.model.Student // 接收数据类型: com.fh.student.model.Student // 必须参数: String类型: studentName;String类型:studentPhone; // 返回值: {"code":1111,"data":null,"message":"成功"} // 返回值类型: json @PostMapping("addStudent") private ServerResponse addStudent(Student student){ if(StringUtils.isBlank(student.getStudentName())){ return ServerResponse.error("学生姓名不允许为空"); } if(StringUtils.isBlank(student.getStudentPhone())){ return ServerResponse.error("学生手机号不允许为空"); } return studentService.addStudent(student); } // 接口作用: 对t_student表的信息进行根据id删除 // 请求路径: http://localhost:8111/aa/StudentController/deleteStudent // 请求类型: delete // 接收参数: studentId // 接收数据类型: Integer // 必须参数: Integer类型: studentId; // 返回值: {"code":1111,"data":null,"message":"成功"} // 返回值类型: json @DeleteMapping("deleteStudent") private ServerResponse deleteStudent(Integer studentId){ return studentService.deleteStudent(studentId); } // 接口作用: 对t_student表的信息进行导出成excel文件,条件查询后执行会导出查询后的数据 // 请求路径: http://localhost:8111/aa/StudentController/frmkexportExcel // 请求类型: 无要求 // 接收参数: 无 // 接收数据类型: 无 // 必须参数: 无 // 返回值: 无 // 返回值类型: 无 @GetMapping("frmkexportExcel") public void frmkexportExcel(HttpServletRequest request, HttpServletResponse response){ try { // 1.查询要导出的数据 List<Student> students = studentService.queryNoPage2(); for (int i=0; i<students.size(); i++){ students.get(i) .setStudentId(i+1); } //创建数据模型 HashMap<Object, Object> dataMap = new HashMap<>(); dataMap.put("students",students); // 3.调用工具类中的生成Word文档的方法 File file = ExportUtil.generateWord("/template", "Student.ftl", dataMap, request); // 4.调用工具类中的下载方法 ExportUtil.downloadFile(file,"飞狐教育学生信息统计.xlsx",request,response); // 5.删除项目发布路径下的垃圾数据 file.delete(); } catch (IOException e) { e.printStackTrace(); } } }
[ "15764032469@163.com" ]
15764032469@163.com
40eafc1b90b89aa9817122c0f13e7d73105cf8d2
dc2821f37a8c33994133d14257a3f33f3d70731d
/app/src/main/java/com/EducationIfo/checkInternet/Common.java
ba10cff0df2997de83cd6c47e6678b52cccb0270
[]
no_license
PrinsSayja/my
e104874fd6c19401c2c3b1f6b655faa154a3f2db
711b81f788b7d7f4ed8a41e1a6af767f15351f63
refs/heads/master
2023-02-26T11:43:48.026955
2021-02-05T08:33:11
2021-02-05T08:33:11
336,212,108
0
0
null
null
null
null
UTF-8
Java
false
false
791
java
package com.EducationIfo.checkInternet; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Common { public static boolean isConnectedToInternet(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager context.getSystemService(context.CONNECTIVITY_SERVICE); if (connectivityManager != null) { NetworkInfo[] info = connectivityManager.getAllNetworkInfo(); if (info != null) { for (int i = 0; i < info.lenth; i++) { if (info[i].getState() == NetworkInfo.State.CONNECTED) { return true; } } } return flase; } }
[ "psayja647@rku.ac.in" ]
psayja647@rku.ac.in
3d6d758acdaf17209ae25709d58ef723d9dcec3c
612f724dbe71df0e9d99f05bc554098b3dbb138e
/src/main/java/net/duckling/ddl/service/authenticate/impl/ForwardPolicy.java
0068f48e4264d66a066c5f93fba2430d3f44ccec
[]
no_license
alczorro/ddl
a0d2b2bd0cdd15696611ff455dc5b7a18a888379
f6a22feb195894fcd0e239f5bc75aecfae780eb1
refs/heads/master
2021-05-31T23:14:21.013183
2016-06-26T13:21:29
2016-06-26T13:21:29
270,529,289
0
1
null
2020-06-08T04:33:34
2020-06-08T04:33:33
null
UTF-8
Java
false
false
2,826
java
/* * Copyright (c) 2008-2016 Computer Network Information Center (CNIC), Chinese Academy of Sciences. * * This file is part of Duckling 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 net.duckling.ddl.service.authenticate.impl; import javax.servlet.http.HttpServletRequest; import net.duckling.ddl.common.VWBContainerImpl; import net.duckling.ddl.common.VWBSession; import net.duckling.ddl.constant.Attributes; /** * @date Jul 14, 2011 * @author xiejj@cnic.cn */ public class ForwardPolicy { public String getSavedFailURL(HttpServletRequest request) { return (String) getLoginSession(request).removeAttribute(Attributes.LOGIN_FAIL_URL); } public String getSavedSuccessURL(HttpServletRequest request) { return (String) getLoginSession(request).removeAttribute(Attributes.REQUEST_URL); } public void saveFailURL(HttpServletRequest request, String url) { if (url != null) { getLoginSession(request).setAttribute(Attributes.LOGIN_FAIL_URL, url); } } public void saveSuccessURL(HttpServletRequest request, String url) { LoginSession loginSession = getLoginSession(request); if (url == null) { // Saved from other place url = (String) VWBSession.findSession(request).removeAttribute(Attributes.REQUEST_URL); if (url != null) { loginSession.setAttribute(Attributes.REQUEST_URL, url); } else { // If has reference String referer = request.getHeader("Referer"); if (referer != null) { url = referer; } else { // Use switch team url = VWBContainerImpl.findContainer().getURL("switchTeam", null, null, true); } } } loginSession.setAttribute(Attributes.REQUEST_URL, url); } public void clearUrls(HttpServletRequest request) { LoginSession.removeLoginSession(request.getSession().getId()); } private LoginSession getLoginSession(HttpServletRequest request) { String sessionid = request.getSession().getId(); return LoginSession.getLoginSession(sessionid); } }
[ "nankai@cnic.ac.cn" ]
nankai@cnic.ac.cn
7c74259adee96feb805cbde09163ae85337811c5
e67455c122e0fc67b48b45eafc003fbcbe59806e
/android/app/src/main/java/com/rn_jiewuka/MainApplication.java
5165bd01bab70ebb2039465ab49a3db6945eb0e1
[]
no_license
cookieaaa/RN_JieWuKa
fdb33fb5759fd039cadf376d3ca2b8a78fae313f
7f13cfaba3ef7b0966fddb55d09109b6016fe7d1
refs/heads/master
2021-01-17T15:10:12.625314
2017-04-27T04:20:34
2017-04-27T04:20:34
69,522,781
0
0
null
null
null
null
UTF-8
Java
false
false
875
java
package com.rn_jiewuka; import android.app.Application; import android.util.Log; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import java.util.Arrays; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override protected boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage() ); } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } }
[ "chenyupeng@chenyupengtekiMacBook-Air.local" ]
chenyupeng@chenyupengtekiMacBook-Air.local
6fcd066f018a4f90b557ea4b97a2688fa5fa4f15
6d80bb5e4d0e4bf113edccbb3ca490d7cb9467fb
/Lab6/A6/src/gen/lang/ast/Opt.java
7115ee199d77a1dc249ff94eee20a3c3e0014372
[]
no_license
Nerja/EDAN65
e70b95fec482a3b7f7659c96ffa56e224c1f6b4f
db2c9dbe8c790b68308c0909fb341246495f3ec3
refs/heads/master
2021-03-30T03:29:47.661822
2016-10-13T07:56:35
2016-10-13T07:56:35
66,770,498
0
1
null
null
null
null
UTF-8
Java
false
false
3,468
java
/* This file was generated with JastAdd2 (http://jastadd.org) version 2.2.2 */ package lang.ast; import java.util.Map; import java.util.HashMap; import java.util.ArrayList; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.lang.reflect.InvocationTargetException; import java.util.Set; import java.util.TreeSet; import java.util.Iterator; import java.util.HashSet; /** * @ast node * @production Opt : {@link ASTNode}; */ public class Opt<T extends ASTNode> extends ASTNode<T> implements Cloneable { /** * @declaredat ASTNode:1 */ public Opt() { super(); } /** * Initializes the child array to the correct size. * Initializes List and Opt nta children. * @apilevel internal * @ast method * @declaredat ASTNode:10 */ public void init$Children() { } /** * @declaredat ASTNode:12 */ public Opt(T opt) { setChild(opt, 0); } /** @apilevel internal * @declaredat ASTNode:16 */ public void flushAttrCache() { super.flushAttrCache(); } /** @apilevel internal * @declaredat ASTNode:20 */ public void flushCollectionCache() { super.flushCollectionCache(); } /** @apilevel internal * @declaredat ASTNode:24 */ public Opt<T> clone() throws CloneNotSupportedException { Opt node = (Opt) super.clone(); return node; } /** @apilevel internal * @declaredat ASTNode:29 */ public Opt<T> copy() { try { Opt node = (Opt) clone(); node.parent = null; if (children != null) { node.children = (ASTNode[]) children.clone(); } return node; } catch (CloneNotSupportedException e) { throw new Error("Error: clone not supported for " + getClass().getName()); } } /** * Create a deep copy of the AST subtree at this node. * The copy is dangling, i.e. has no parent. * @return dangling copy of the subtree at this node * @apilevel low-level * @deprecated Please use treeCopy or treeCopyNoTransform instead * @declaredat ASTNode:48 */ @Deprecated public Opt<T> fullCopy() { return treeCopyNoTransform(); } /** * Create a deep copy of the AST subtree at this node. * The copy is dangling, i.e. has no parent. * @return dangling copy of the subtree at this node * @apilevel low-level * @declaredat ASTNode:58 */ public Opt<T> treeCopyNoTransform() { Opt tree = (Opt) copy(); if (children != null) { for (int i = 0; i < children.length; ++i) { ASTNode child = (ASTNode) children[i]; if (child != null) { child = child.treeCopyNoTransform(); tree.setChild(child, i); } } } return tree; } /** * Create a deep copy of the AST subtree at this node. * The subtree of this node is traversed to trigger rewrites before copy. * The copy is dangling, i.e. has no parent. * @return dangling copy of the subtree at this node * @apilevel low-level * @declaredat ASTNode:78 */ public Opt<T> treeCopy() { Opt tree = (Opt) copy(); if (children != null) { for (int i = 0; i < children.length; ++i) { ASTNode child = (ASTNode) getChild(i); if (child != null) { child = child.treeCopy(); tree.setChild(child, i); } } } return tree; } /** @apilevel internal * @declaredat ASTNode:92 */ protected boolean is$Equal(ASTNode node) { return super.is$Equal(node); } }
[ "marcusrodan@gmail.com" ]
marcusrodan@gmail.com
c27ee22053f42fb5157f8f01bb5c57de1dde3de2
cc37ea02ad3ffb8bea6ba500dd428a1bf9907f4e
/Ders4_2/Abstracts/ICampaign.java
caf9a12daaba31e98befb090714cce31d8fb485f
[]
no_license
iremcibal/JavaCamping
5d705e270a8078c005139c0430ba8f9dc6c1d294
43aa8993247b72aaa20e943993f8dc131dcefaa0
refs/heads/main
2023-04-18T01:21:44.100657
2021-05-08T16:28:35
2021-05-08T16:28:35
361,293,867
5
0
null
null
null
null
UTF-8
Java
false
false
200
java
package Ders4_2.Abstracts; import Ders4_2.Entities.Campaign; public interface ICampaign { void add(Campaign campaign); void delete(Campaign campaign); void update(Campaign campaign); }
[ "iremcibal@gmail.com" ]
iremcibal@gmail.com
155ca8206bb02fd8106a504684b66c3926282276
03294ace08608f11920b87b3872311bf45135321
/gamification/src/main/java/com/grantcs/gamification/service/impl/GameEventHandler.java
59d9e4e99620db3bbd96f71a8d586c2786219a17
[]
no_license
MikhailPalagashvili/spring-boot-reactjs-multiplication-game
7dbdbe1a2030dccaaaf59300f5df1c4891a4724d
7ab7e1ca7030503474366f240af91956fad7236b
refs/heads/master
2023-06-17T13:39:59.431356
2021-07-19T22:08:27
2021-07-19T22:08:27
379,235,815
1
0
null
null
null
null
UTF-8
Java
false
false
1,075
java
package com.grantcs.gamification.service.impl; import com.grantcs.gamification.domain.entity.ChallengeSolvedEvent; import com.grantcs.gamification.service.GameService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.amqp.AmqpRejectAndDontRequeueException; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Service; @RequiredArgsConstructor @Slf4j @Service public class GameEventHandler { private final GameService gameService; @RabbitListener(queues = "${amqp.queue.gamification}") void handleMultiplicationSolved(final ChallengeSolvedEvent event) { log.info("Challenge Solved Event received: {}", event.getAttemptId()); try { gameService.newAttemptForUser(event); } catch (final Exception e) { log.error("Error when trying to process ChallengeSolvedEvent", e); // Avoids the event to be re-queued and reprocessed. throw new AmqpRejectAndDontRequeueException(e); } } }
[ "48160170+MikhailPalagashvili@users.noreply.github.com" ]
48160170+MikhailPalagashvili@users.noreply.github.com
ebc21a0596457d7254a4d1537c48e01a983047a2
18a9d81aa8f6cdebaca31561b9f98ed633d48d54
/MyApplication2/app/src/main/java/bluetoothdemo/myapplication/wifi/UdpHelper.java
a4a784c7bf33e1e2f15e70329fd2ae7c32c4cce7
[]
no_license
zhouwei199388/shopAndroid
7083bf978ca67dfb4a7903da34e477b07aff2a91
49c0ca53e778c74b27db78677cf175ca543df469
refs/heads/master
2020-03-17T20:29:30.597771
2019-02-14T11:01:58
2019-02-14T11:01:58
133,912,592
0
0
null
null
null
null
UTF-8
Java
false
false
2,870
java
package bluetoothdemo.myapplication.wifi; import android.net.wifi.WifiManager; import android.util.Log; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketException; import java.net.UnknownHostException; /** * Created by ZouWei on 2018/5/23. */ public class UdpHelper implements Runnable{ public Boolean IsThreadDisable = false;//指示监听线程是否终止 private static WifiManager.MulticastLock lock; InetAddress mInetAddress; public UdpHelper(WifiManager manager) { this.lock= manager.createMulticastLock("UDPwifi"); } public void StartListen() { // UDP服务器监听的端口 Integer port = 8903; // 接收的字节大小,客户端发送的数据不能超过这个大小 byte[] message = new byte[100]; try { // 建立Socket连接 DatagramSocket datagramSocket = new DatagramSocket(port); datagramSocket.setBroadcast(true); DatagramPacket datagramPacket = new DatagramPacket(message, message.length); try { while (!IsThreadDisable) { // 准备接收数据 Log.d("UDP Demo", "准备接受"); this.lock.acquire(); datagramSocket.receive(datagramPacket); String strMsg=new String(datagramPacket.getData()).trim(); Log.d("UDP Demo", datagramPacket.getAddress() .getHostAddress().toString() + ":" +strMsg );this.lock.release(); } } catch (IOException e) {//IOException e.printStackTrace(); } } catch (SocketException e) { e.printStackTrace(); } } public static void send(String message) { message = (message == null ? "Hello IdeasAndroid!" : message); int server_port = 8904; Log.d("UDP Demo", "UDP发送数据:"+message); DatagramSocket s = null; try { s = new DatagramSocket(); } catch (SocketException e) { e.printStackTrace(); } InetAddress local = null; try { local = InetAddress.getByName("255.255.255.255"); } catch (UnknownHostException e) { e.printStackTrace(); } int msg_length = message.length(); byte[] messageByte = message.getBytes(); DatagramPacket p = new DatagramPacket(messageByte, msg_length, local, server_port); try { s.send(p); s.close(); } catch (IOException e) { e.printStackTrace(); } } @Override public void run() { StartListen(); } }
[ "15090824065@163.com" ]
15090824065@163.com
965ef51afdc100a888c37d8606a710bac14ba195
ef17b45c76cb3d08c60da1d10bd8d22ae7cd513e
/src/Recursion2/mergeSort.java
c19f4591b172c53dc2ce20b0753e231eb55e8331
[]
no_license
Ishaan-10/DSA-pratice-CN
2764764cbc7c7222f90f68fc2868e9db08268506
b6aa95005905082766e9f2a3b03b9ed435ad674b
refs/heads/master
2023-07-26T17:32:46.674347
2021-09-03T08:25:22
2021-09-03T08:25:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,263
java
package Recursion2; public class mergeSort { public static int[] sort(int arr[],int start,int end){ if(start==end){ int[] ba = new int[1]; ba[0]=arr[0]; return ba; } int mid = (start+end)/2; int[] fsh = sort(arr,start,mid); int[] ssh = sort(arr,mid+1,end); int[] fullArray = merge(fsh,ssh); return fullArray; } public static int[] merge(int a[],int b[]){ int newArr[] = new int[a.length+b.length]; int i=0,j=0,k=0; while(i<a.length && j<b.length){ if(a[i]>b[j]){ newArr[k]=b[j]; j++; k++; }else{ newArr[k]=a[i]; i++; k++; } } while(i<a.length){ newArr[k]=a[i]; i++; k++; } while(j<b.length){ newArr[k]=b[j]; j++; k++; } return newArr; } public static void main(String[] args) { int arr[] = {5,4,3,2,1}; int newArr[] = sort(arr, 0, arr.length-1); for(int i:newArr){ System.out.print(i + " "); } } }
[ "b.ishaan10@gmail.com" ]
b.ishaan10@gmail.com
6ec0a12b5b714e55cfdb69b4d320bf0cb2b6cb7f
3e9aad2a4abc72fea5c1b04e105b118b67df6b87
/anr-base/anr-rbac-starter/src/main/java/com/chuang/anarres/rbac/model/co/RoleAssignCO.java
a20c1cb50cc3424d716ecc65fb64a25a0da2a89c
[]
no_license
quchuangh/anarres
59d09f2294bd704a26bd940abb06adde2327523b
bdc53e0a01aef633265688789652241df8883c27
refs/heads/master
2023-05-25T21:28:33.957449
2021-05-26T12:09:15
2021-05-26T12:09:15
365,678,251
1
1
null
null
null
null
UTF-8
Java
false
false
516
java
package com.chuang.anarres.rbac.model.co; import com.chuang.anarres.crud.entity.bo.AL; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; import java.util.List; @Data @ApiModel("授权参数") public class RoleAssignCO { @ApiModelProperty(value = "角色id") @NotNull(message = "角色不能为空") private Integer roleId; @ApiModelProperty(value = "权限") private List<AL> abilities; }
[ "anarres.work@gmial.com" ]
anarres.work@gmial.com
c107b95fefc341c84e1b7088a49139297f0463f5
0c47357435d90589844909a11281de8baeb84797
/src/Job/Week01/LC1178/LC1178S1.java
54882608fe84ae99fe541d46416408869c21e3cf
[]
no_license
DanielDeen/Before2020
ed8c589042eb4746f7094041bc96790d72acf4f7
fafc83a7bb8559cd884293a3e37f67f6f74fb0d9
refs/heads/master
2022-11-02T19:31:23.218433
2022-10-03T13:08:14
2022-10-03T13:08:14
210,169,242
0
0
null
null
null
null
UTF-8
Java
false
false
1,305
java
package Job.Week01.LC1178; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @description: 1178.猜字谜 * @author: Daniel Deen * @create: 2021-02-26 23:41 */ public class LC1178S1 { public List<Integer> findNumOfValidWords(String[] words, String[] puzzles) { List<Integer> res = new ArrayList<>(); // 2^26的数组会爆内存。因此用HashMap,存放每种状态的个数 Map<Integer, Integer> state = new HashMap<>(); for (int i = 0; i < words.length; i++) { String s = words[i]; int temp = 0; for (int j = 0; j < s.length(); j++) { temp = temp | (1 << s.charAt(j) - 'a'); } state.put(temp, state.getOrDefault(temp, 0) + 1); } for (int i = 0; i < puzzles.length; i++) { String s = puzzles[i]; int temp = 0; for (int j = 0; j < s.length(); j++) { temp = temp | (1 << s.charAt(j) - 'a'); } int cnt = 0; for (int k = temp; k != 0; k = (k - 1) & temp) { if ((1 << (s.charAt(0) - 'a') & k) != 0) cnt += state.getOrDefault(k, 0); } res.add(cnt); } return res; } }
[ "ding.xuyong@gmail.com" ]
ding.xuyong@gmail.com